[DebianGIS-dev] r808 - in packages: . libhdf4 libhdf4/branches libhdf4/branches/upstream libhdf4/branches/upstream/current libhdf4/branches/upstream/current/config libhdf4/branches/upstream/current/hdf libhdf4/branches/upstream/current/hdf/fmpool libhdf4/branches/upstream/current/hdf/fmpool/config libhdf4/branches/upstream/current/hdf/jpeg libhdf4/branches/upstream/current/hdf/jpeg/config libhdf4/branches/upstream/current/hdf/pablo libhdf4/branches/upstream/current/hdf/src libhdf4/branches/upstream/current/hdf/src/fort_ps libhdf4/branches/upstream/current/hdf/test libhdf4/branches/upstream/current/hdf/test/fort_ps libhdf4/branches/upstream/current/hdf/util libhdf4/branches/upstream/current/hdf/util/MacProjects libhdf4/branches/upstream/current/hdf/util/fixatr libhdf4/branches/upstream/current/hdf/util/testfiles libhdf4/branches/upstream/current/hdf/zlib libhdf4/branches/upstream/current/hdf/zlib/amiga libhdf4/branches/upstream/current/hdf/zlib/contrib libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386 libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586 libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686 libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2 libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2 libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz libhdf4/branches/upstream/current/hdf/zlib/msdos libhdf4/branches/upstream/current/hdf/zlib/nt libhdf4/branches/upstream/current/hdf/zlib/os2 libhdf4/branches/upstream/current/man libhdf4/branches/upstream/current/mfhdf libhdf4/branches/upstream/current/mfhdf/c++ libhdf4/branches/upstream/current/mfhdf/doc libhdf4/branches/upstream/current/mfhdf/dumper libhdf4/branches/upstream/current/mfhdf/dumper/testfiles libhdf4/branches/upstream/current/mfhdf/fortran libhdf4/branches/upstream/current/mfhdf/fortran/config libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps libhdf4/branches/upstream/current/mfhdf/fortran/msoft libhdf4/branches/upstream/current/mfhdf/fortran/vms libhdf4/branches/upstream/current/mfhdf/libsrc libhdf4/branches/upstream/current/mfhdf/libsrc/config libhdf4/branches/upstream/current/mfhdf/ncdump libhdf4/branches/upstream/current/mfhdf/ncgen libhdf4/branches/upstream/current/mfhdf/nctest libhdf4/branches/upstream/current/mfhdf/pablo libhdf4/branches/upstream/current/mfhdf/port libhdf4/branches/upstream/current/mfhdf/util libhdf4/branches/upstream/current/mfhdf/xdr libhdf4/branches/upstream/current/release_notes

frankie at alioth.debian.org frankie at alioth.debian.org
Mon May 14 09:41:41 UTC 2007


Author: frankie
Date: 2007-05-14 09:41:34 +0000 (Mon, 14 May 2007)
New Revision: 808

Added:
   packages/libhdf4/
   packages/libhdf4/branches/
   packages/libhdf4/branches/upstream/
   packages/libhdf4/branches/upstream/current/
   packages/libhdf4/branches/upstream/current/COPYING
   packages/libhdf4/branches/upstream/current/INSTALL
   packages/libhdf4/branches/upstream/current/MAKEVMS.COM
   packages/libhdf4/branches/upstream/current/Makefile.in
   packages/libhdf4/branches/upstream/current/README
   packages/libhdf4/branches/upstream/current/Win32.nofortran.zip
   packages/libhdf4/branches/upstream/current/Win32.zip
   packages/libhdf4/branches/upstream/current/config.guess
   packages/libhdf4/branches/upstream/current/config.sub
   packages/libhdf4/branches/upstream/current/config/
   packages/libhdf4/branches/upstream/current/config/mh-aix
   packages/libhdf4/branches/upstream/current/config/mh-alpha
   packages/libhdf4/branches/upstream/current/config/mh-decstation
   packages/libhdf4/branches/upstream/current/config/mh-fbsd
   packages/libhdf4/branches/upstream/current/config/mh-fujivp
   packages/libhdf4/branches/upstream/current/config/mh-hpux
   packages/libhdf4/branches/upstream/current/config/mh-hpux11
   packages/libhdf4/branches/upstream/current/config/mh-ia64
   packages/libhdf4/branches/upstream/current/config/mh-irix32
   packages/libhdf4/branches/upstream/current/config/mh-irix5
   packages/libhdf4/branches/upstream/current/config/mh-irix6
   packages/libhdf4/branches/upstream/current/config/mh-linux
   packages/libhdf4/branches/upstream/current/config/mh-mac
   packages/libhdf4/branches/upstream/current/config/mh-solaris
   packages/libhdf4/branches/upstream/current/config/mh-solarisx86
   packages/libhdf4/branches/upstream/current/config/mh-sun
   packages/libhdf4/branches/upstream/current/config/mh-t3e
   packages/libhdf4/branches/upstream/current/config/mh-unicos
   packages/libhdf4/branches/upstream/current/configure
   packages/libhdf4/branches/upstream/current/configure.in
   packages/libhdf4/branches/upstream/current/hdf/
   packages/libhdf4/branches/upstream/current/hdf/MAKE.COM
   packages/libhdf4/branches/upstream/current/hdf/Makefile.in
   packages/libhdf4/branches/upstream/current/hdf/README
   packages/libhdf4/branches/upstream/current/hdf/build.inc
   packages/libhdf4/branches/upstream/current/hdf/fmpool/
   packages/libhdf4/branches/upstream/current/hdf/fmpool/Makefile.in
   packages/libhdf4/branches/upstream/current/hdf/fmpool/README
   packages/libhdf4/branches/upstream/current/hdf/fmpool/cdefs.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/compat.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config.guess
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config.sub
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpaix.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpalpha.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpconvex.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpdec.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpfbsd.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpfujivp.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmphpux.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpia64.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix32.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix4.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix5.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix6.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmplinux.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpmac.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpsolaris.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpsun.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpt3e.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpunicos.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-aix
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-alpha
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-convex
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-decstation
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-fbsd
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-fujivp
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-hpux
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-ia64
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix32
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix4
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix5
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix6
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-linux
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-mac
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-solaris
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-sun
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-t3e
   packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-unicos
   packages/libhdf4/branches/upstream/current/hdf/fmpool/configure
   packages/libhdf4/branches/upstream/current/hdf/fmpool/configure.in
   packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.3
   packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.c
   packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.3
   packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.c
   packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/fmptypes.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/move-if-change
   packages/libhdf4/branches/upstream/current/hdf/fmpool/queue.h
   packages/libhdf4/branches/upstream/current/hdf/fmpool/test_fmpio.c
   packages/libhdf4/branches/upstream/current/hdf/fmpool/tfmpio_read.c
   packages/libhdf4/branches/upstream/current/hdf/fmpool/tfmpio_write.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/
   packages/libhdf4/branches/upstream/current/hdf/jpeg/Makefile.in
   packages/libhdf4/branches/upstream/current/hdf/jpeg/README
   packages/libhdf4/branches/upstream/current/hdf/jpeg/ansi2knr.1
   packages/libhdf4/branches/upstream/current/hdf/jpeg/ansi2knr.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/cderror.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/cdjpeg.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/cdjpeg.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/change.log
   packages/libhdf4/branches/upstream/current/hdf/jpeg/cjpeg.1
   packages/libhdf4/branches/upstream/current/hdf/jpeg/cjpeg.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/ckconfig.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/coderules.doc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config.guess
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config.sub
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jaix.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jalpha.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jconvex.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jdec.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jfbsd.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jfujivp.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jhpux.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jia64.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix32.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix4.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix5.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix6.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jlinux.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jmac.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jsolaris.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jsun.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jt3e.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/junicos.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jwin32.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-aix
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-alpha
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-convex
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-decstation
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-fbsd
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-fujivp
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-hpux
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-ia64
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix32
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix4
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix5
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix6
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-linux
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-mac
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-solaris
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-sun
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-t3e
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-unicos
   packages/libhdf4/branches/upstream/current/hdf/jpeg/config/win32jpg.mak
   packages/libhdf4/branches/upstream/current/hdf/jpeg/configure.gnu
   packages/libhdf4/branches/upstream/current/hdf/jpeg/configure.in
   packages/libhdf4/branches/upstream/current/hdf/jpeg/djpeg.1
   packages/libhdf4/branches/upstream/current/hdf/jpeg/djpeg.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/example.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/filelist.doc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/install-sh
   packages/libhdf4/branches/upstream/current/hdf/jpeg/install.doc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcapimin.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcapistd.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jccoefct.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jccolor.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcdctmgr.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jchuff.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jchuff.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcinit.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmainct.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmarker.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmaster.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcomapi.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.bcc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.cfg
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.dj
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.doc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.mac
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.manx
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.mc6
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.sas
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.st
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.vc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.vms
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.wat
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcparam.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcphuff.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcprepct.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jcsample.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jctrans.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdapimin.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdapistd.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdatadst.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdatasrc.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdcoefct.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdcolor.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdct.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jddctmgr.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdhuff.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdhuff.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdinput.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmainct.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmarker.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmaster.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmerge.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdphuff.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdpostct.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdsample.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jdtrans.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jerror.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jerror.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctflt.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctfst.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctint.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctflt.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctfst.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctint.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctred.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jinclude.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemansi.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemdos.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemdosa.asm
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemmac.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemmgr.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemname.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemnobs.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemsys.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jmorecfg.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegint.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jpeglib.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jpeglib.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegtran.1
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegtran.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jquant1.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jquant2.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jutils.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/jversion.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/libjpeg.doc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/ltconfig
   packages/libhdf4/branches/upstream/current/hdf/jpeg/ltmain.sh
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makcjpeg.st
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makdjpeg.st
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makeapps.ds
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.ansi
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.bcc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.cfg
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.dj
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.manx
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.mc6
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.mms
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.sas
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.unix
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.vc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.vms
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.wat
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makelib.ds
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makeproj.mac
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makljpeg.st
   packages/libhdf4/branches/upstream/current/hdf/jpeg/maktjpeg.st
   packages/libhdf4/branches/upstream/current/hdf/jpeg/makvms.opt
   packages/libhdf4/branches/upstream/current/hdf/jpeg/rdbmp.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/rdcolmap.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/rdgif.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/rdjpgcom.1
   packages/libhdf4/branches/upstream/current/hdf/jpeg/rdjpgcom.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/rdppm.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/rdrle.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/rdswitch.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/rdtarga.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/structure.doc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.bmp
   packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.gif
   packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.jpg
   packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.ppm
   packages/libhdf4/branches/upstream/current/hdf/jpeg/testimgp.jpg
   packages/libhdf4/branches/upstream/current/hdf/jpeg/testorig.jpg
   packages/libhdf4/branches/upstream/current/hdf/jpeg/testprog.jpg
   packages/libhdf4/branches/upstream/current/hdf/jpeg/transupp.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/transupp.h
   packages/libhdf4/branches/upstream/current/hdf/jpeg/usage.doc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/wizard.doc
   packages/libhdf4/branches/upstream/current/hdf/jpeg/wrbmp.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/wrgif.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/wrjpgcom.1
   packages/libhdf4/branches/upstream/current/hdf/jpeg/wrjpgcom.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/wrppm.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/wrrle.c
   packages/libhdf4/branches/upstream/current/hdf/jpeg/wrtarga.c
   packages/libhdf4/branches/upstream/current/hdf/pablo/
   packages/libhdf4/branches/upstream/current/hdf/pablo/HDFIOTrace.h
   packages/libhdf4/branches/upstream/current/hdf/pablo/HDFTrace.h
   packages/libhdf4/branches/upstream/current/hdf/pablo/HDFrecord_RT.h
   packages/libhdf4/branches/upstream/current/hdf/pablo/Makefile.in
   packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF.c
   packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF.inc
   packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF_RT.c
   packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF_SDDF.c
   packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDFff.f
   packages/libhdf4/branches/upstream/current/hdf/pablo/PabloSedscr
   packages/libhdf4/branches/upstream/current/hdf/pablo/ProcIDs.h
   packages/libhdf4/branches/upstream/current/hdf/pablo/ProcTrace.h
   packages/libhdf4/branches/upstream/current/hdf/pablo/README.Pablo
   packages/libhdf4/branches/upstream/current/hdf/pablo/depend
   packages/libhdf4/branches/upstream/current/hdf/src/
   packages/libhdf4/branches/upstream/current/hdf/src/.indent.pro
   packages/libhdf4/branches/upstream/current/hdf/src/MAKEFS.COM
   packages/libhdf4/branches/upstream/current/hdf/src/MAKENOF.COM
   packages/libhdf4/branches/upstream/current/hdf/src/Makefile.in
   packages/libhdf4/branches/upstream/current/hdf/src/atom.c
   packages/libhdf4/branches/upstream/current/hdf/src/atom.h
   packages/libhdf4/branches/upstream/current/hdf/src/bitvect.c
   packages/libhdf4/branches/upstream/current/hdf/src/bitvect.h
   packages/libhdf4/branches/upstream/current/hdf/src/cdeflate.c
   packages/libhdf4/branches/upstream/current/hdf/src/cdeflate.h
   packages/libhdf4/branches/upstream/current/hdf/src/cnbit.c
   packages/libhdf4/branches/upstream/current/hdf/src/cnbit.h
   packages/libhdf4/branches/upstream/current/hdf/src/cnone.c
   packages/libhdf4/branches/upstream/current/hdf/src/cnone.h
   packages/libhdf4/branches/upstream/current/hdf/src/crle.c
   packages/libhdf4/branches/upstream/current/hdf/src/crle.h
   packages/libhdf4/branches/upstream/current/hdf/src/cskphuff.c
   packages/libhdf4/branches/upstream/current/hdf/src/cskphuff.h
   packages/libhdf4/branches/upstream/current/hdf/src/df.h
   packages/libhdf4/branches/upstream/current/hdf/src/df24.c
   packages/libhdf4/branches/upstream/current/hdf/src/df24f.c
   packages/libhdf4/branches/upstream/current/hdf/src/df24ff.f
   packages/libhdf4/branches/upstream/current/hdf/src/dfan.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfan.h
   packages/libhdf4/branches/upstream/current/hdf/src/dfanf.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfanff.f
   packages/libhdf4/branches/upstream/current/hdf/src/dfcomp.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfconv.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfconvrt.h
   packages/libhdf4/branches/upstream/current/hdf/src/dff.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfff.f
   packages/libhdf4/branches/upstream/current/hdf/src/dffunc.inc
   packages/libhdf4/branches/upstream/current/hdf/src/dfgr.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfgr.h
   packages/libhdf4/branches/upstream/current/hdf/src/dfgroup.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfi.h
   packages/libhdf4/branches/upstream/current/hdf/src/dfimcomp.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfivms.h
   packages/libhdf4/branches/upstream/current/hdf/src/dfjpeg.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfkconv.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfkcray.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfkfuji.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfknat.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfkswap.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfkvms.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfp.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfpf.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfpff.f
   packages/libhdf4/branches/upstream/current/hdf/src/dfr8.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfr8f.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfr8ff.f
   packages/libhdf4/branches/upstream/current/hdf/src/dfrig.h
   packages/libhdf4/branches/upstream/current/hdf/src/dfrle.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfsd.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfsd.h
   packages/libhdf4/branches/upstream/current/hdf/src/dfsdf.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfsdff.f
   packages/libhdf4/branches/upstream/current/hdf/src/dfstubs.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfstubs.h
   packages/libhdf4/branches/upstream/current/hdf/src/dfufp2i.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfufp2i.h
   packages/libhdf4/branches/upstream/current/hdf/src/dfufp2if.f
   packages/libhdf4/branches/upstream/current/hdf/src/dfunjpeg.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfutil.c
   packages/libhdf4/branches/upstream/current/hdf/src/dfutilf.c
   packages/libhdf4/branches/upstream/current/hdf/src/dir_mac.c
   packages/libhdf4/branches/upstream/current/hdf/src/dir_mac.h
   packages/libhdf4/branches/upstream/current/hdf/src/dynarray.c
   packages/libhdf4/branches/upstream/current/hdf/src/dynarray.h
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/herrpf.c
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/herrpff.f
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hfilepf.c
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hfilepff.f
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hprotop.h
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfanpf.c
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfanpff.f
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfgrpf.c
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfgrpff.f
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vattrpf.c
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vattrpff.f
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vgpf.c
   packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vgpff.f
   packages/libhdf4/branches/upstream/current/hdf/src/glist.c
   packages/libhdf4/branches/upstream/current/hdf/src/glist.h
   packages/libhdf4/branches/upstream/current/hdf/src/hbitio.c
   packages/libhdf4/branches/upstream/current/hdf/src/hbitio.h
   packages/libhdf4/branches/upstream/current/hdf/src/hblocks.c
   packages/libhdf4/branches/upstream/current/hdf/src/hbuffer.c
   packages/libhdf4/branches/upstream/current/hdf/src/hchunks.c
   packages/libhdf4/branches/upstream/current/hdf/src/hchunks.h
   packages/libhdf4/branches/upstream/current/hdf/src/hcomp.c
   packages/libhdf4/branches/upstream/current/hdf/src/hcomp.h
   packages/libhdf4/branches/upstream/current/hdf/src/hcompi.h
   packages/libhdf4/branches/upstream/current/hdf/src/hcompri.c
   packages/libhdf4/branches/upstream/current/hdf/src/hconv.h
   packages/libhdf4/branches/upstream/current/hdf/src/hdf.bld
   packages/libhdf4/branches/upstream/current/hdf/src/hdf.h
   packages/libhdf4/branches/upstream/current/hdf/src/hdf.inc
   packages/libhdf4/branches/upstream/current/hdf/src/hdfalloc.c
   packages/libhdf4/branches/upstream/current/hdf/src/hdfi.h
   packages/libhdf4/branches/upstream/current/hdf/src/hdflib.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/src/hdfnof.bld
   packages/libhdf4/branches/upstream/current/hdf/src/hdfnofw3.lbc
   packages/libhdf4/branches/upstream/current/hdf/src/hdfnofwc.lbc
   packages/libhdf4/branches/upstream/current/hdf/src/hdfw386.lbc
   packages/libhdf4/branches/upstream/current/hdf/src/hdfwcc.lbc
   packages/libhdf4/branches/upstream/current/hdf/src/herr.c
   packages/libhdf4/branches/upstream/current/hdf/src/herr.h
   packages/libhdf4/branches/upstream/current/hdf/src/herrf.c
   packages/libhdf4/branches/upstream/current/hdf/src/hextelt.c
   packages/libhdf4/branches/upstream/current/hdf/src/hfile.c
   packages/libhdf4/branches/upstream/current/hdf/src/hfile.h
   packages/libhdf4/branches/upstream/current/hdf/src/hfiledd.c
   packages/libhdf4/branches/upstream/current/hdf/src/hfilef.c
   packages/libhdf4/branches/upstream/current/hdf/src/hfileff.f
   packages/libhdf4/branches/upstream/current/hdf/src/hkit.c
   packages/libhdf4/branches/upstream/current/hdf/src/hkit.h
   packages/libhdf4/branches/upstream/current/hdf/src/hlimits.h
   packages/libhdf4/branches/upstream/current/hdf/src/hntdefs.h
   packages/libhdf4/branches/upstream/current/hdf/src/hproto.h
   packages/libhdf4/branches/upstream/current/hdf/src/hqueue.h
   packages/libhdf4/branches/upstream/current/hdf/src/htags.h
   packages/libhdf4/branches/upstream/current/hdf/src/linklist.c
   packages/libhdf4/branches/upstream/current/hdf/src/linklist.h
   packages/libhdf4/branches/upstream/current/hdf/src/makepc.386
   packages/libhdf4/branches/upstream/current/hdf/src/makepc.msc
   packages/libhdf4/branches/upstream/current/hdf/src/makepc.wcc
   packages/libhdf4/branches/upstream/current/hdf/src/makewin.msc
   packages/libhdf4/branches/upstream/current/hdf/src/maldebug.c
   packages/libhdf4/branches/upstream/current/hdf/src/maldebug.h
   packages/libhdf4/branches/upstream/current/hdf/src/mcache.c
   packages/libhdf4/branches/upstream/current/hdf/src/mcache.h
   packages/libhdf4/branches/upstream/current/hdf/src/mfan.c
   packages/libhdf4/branches/upstream/current/hdf/src/mfan.h
   packages/libhdf4/branches/upstream/current/hdf/src/mfanf.c
   packages/libhdf4/branches/upstream/current/hdf/src/mfgr.c
   packages/libhdf4/branches/upstream/current/hdf/src/mfgr.h
   packages/libhdf4/branches/upstream/current/hdf/src/mfgrf.c
   packages/libhdf4/branches/upstream/current/hdf/src/mfgrff.f
   packages/libhdf4/branches/upstream/current/hdf/src/mstdio.c
   packages/libhdf4/branches/upstream/current/hdf/src/mstdio.h
   packages/libhdf4/branches/upstream/current/hdf/src/patchlevel.h
   packages/libhdf4/branches/upstream/current/hdf/src/src.inc
   packages/libhdf4/branches/upstream/current/hdf/src/sys_dir_mac.h
   packages/libhdf4/branches/upstream/current/hdf/src/tbbt.c
   packages/libhdf4/branches/upstream/current/hdf/src/tbbt.h
   packages/libhdf4/branches/upstream/current/hdf/src/trace.h
   packages/libhdf4/branches/upstream/current/hdf/src/vattr.c
   packages/libhdf4/branches/upstream/current/hdf/src/vattr.h
   packages/libhdf4/branches/upstream/current/hdf/src/vattrf.c
   packages/libhdf4/branches/upstream/current/hdf/src/vattrff.f
   packages/libhdf4/branches/upstream/current/hdf/src/vconv.c
   packages/libhdf4/branches/upstream/current/hdf/src/vg.c
   packages/libhdf4/branches/upstream/current/hdf/src/vg.h
   packages/libhdf4/branches/upstream/current/hdf/src/vgf.c
   packages/libhdf4/branches/upstream/current/hdf/src/vgff.f
   packages/libhdf4/branches/upstream/current/hdf/src/vgint.h
   packages/libhdf4/branches/upstream/current/hdf/src/vgp.c
   packages/libhdf4/branches/upstream/current/hdf/src/vhi.c
   packages/libhdf4/branches/upstream/current/hdf/src/vio.c
   packages/libhdf4/branches/upstream/current/hdf/src/vparse.c
   packages/libhdf4/branches/upstream/current/hdf/src/vrw.c
   packages/libhdf4/branches/upstream/current/hdf/src/vsfld.c
   packages/libhdf4/branches/upstream/current/hdf/src/win32hdf.mak
   packages/libhdf4/branches/upstream/current/hdf/test/
   packages/libhdf4/branches/upstream/current/hdf/test/8bit.dat
   packages/libhdf4/branches/upstream/current/hdf/test/MAKE.COM
   packages/libhdf4/branches/upstream/current/hdf/test/MAKENOF.COM
   packages/libhdf4/branches/upstream/current/hdf/test/Makefile.in
   packages/libhdf4/branches/upstream/current/hdf/test/README
   packages/libhdf4/branches/upstream/current/hdf/test/SETUPTEST.COM
   packages/libhdf4/branches/upstream/current/hdf/test/an.c
   packages/libhdf4/branches/upstream/current/hdf/test/anfile.c
   packages/libhdf4/branches/upstream/current/hdf/test/bitio.c
   packages/libhdf4/branches/upstream/current/hdf/test/bitio.dat
   packages/libhdf4/branches/upstream/current/hdf/test/blocks.c
   packages/libhdf4/branches/upstream/current/hdf/test/buffer.c
   packages/libhdf4/branches/upstream/current/hdf/test/chunks.c
   packages/libhdf4/branches/upstream/current/hdf/test/comp.c
   packages/libhdf4/branches/upstream/current/hdf/test/conv.c
   packages/libhdf4/branches/upstream/current/hdf/test/egchi.res
   packages/libhdf4/branches/upstream/current/hdf/test/egfhi.f
   packages/libhdf4/branches/upstream/current/hdf/test/egfhi.res
   packages/libhdf4/branches/upstream/current/hdf/test/extelt.c
   packages/libhdf4/branches/upstream/current/hdf/test/file.c
   packages/libhdf4/branches/upstream/current/hdf/test/file1.c
   packages/libhdf4/branches/upstream/current/hdf/test/forsupf.c
   packages/libhdf4/branches/upstream/current/hdf/test/forsupff.f
   packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/
   packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/forsupffp.f
   packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortest.arg
   packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortestFp.f
   packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortestp.c
   packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/manpf.f
   packages/libhdf4/branches/upstream/current/hdf/test/fortest.c
   packages/libhdf4/branches/upstream/current/hdf/test/fortest.h
   packages/libhdf4/branches/upstream/current/hdf/test/fortest.inc
   packages/libhdf4/branches/upstream/current/hdf/test/fortest.sav
   packages/libhdf4/branches/upstream/current/hdf/test/fortestF.f
   packages/libhdf4/branches/upstream/current/hdf/test/gentest.c
   packages/libhdf4/branches/upstream/current/hdf/test/gr_r24.dat
   packages/libhdf4/branches/upstream/current/hdf/test/greyjpeg.dat
   packages/libhdf4/branches/upstream/current/hdf/test/jpeg.dat
   packages/libhdf4/branches/upstream/current/hdf/test/litend.c
   packages/libhdf4/branches/upstream/current/hdf/test/litend.dat
   packages/libhdf4/branches/upstream/current/hdf/test/macros.c
   packages/libhdf4/branches/upstream/current/hdf/test/makepc.386
   packages/libhdf4/branches/upstream/current/hdf/test/makepc.msc
   packages/libhdf4/branches/upstream/current/hdf/test/makewin.msc
   packages/libhdf4/branches/upstream/current/hdf/test/makewin.new
   packages/libhdf4/branches/upstream/current/hdf/test/man.c
   packages/libhdf4/branches/upstream/current/hdf/test/manf.f
   packages/libhdf4/branches/upstream/current/hdf/test/mgr.c
   packages/libhdf4/branches/upstream/current/hdf/test/mgrf.f
   packages/libhdf4/branches/upstream/current/hdf/test/mgrf_sunOS.f
   packages/libhdf4/branches/upstream/current/hdf/test/nbit.c
   packages/libhdf4/branches/upstream/current/hdf/test/nbit.dat
   packages/libhdf4/branches/upstream/current/hdf/test/rig.c
   packages/libhdf4/branches/upstream/current/hdf/test/sdmms.c
   packages/libhdf4/branches/upstream/current/hdf/test/sdnmms.c
   packages/libhdf4/branches/upstream/current/hdf/test/sdstr.c
   packages/libhdf4/branches/upstream/current/hdf/test/slab.c
   packages/libhdf4/branches/upstream/current/hdf/test/slabwf.f
   packages/libhdf4/branches/upstream/current/hdf/test/t24f.f
   packages/libhdf4/branches/upstream/current/hdf/test/tanf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tanfilef.f
   packages/libhdf4/branches/upstream/current/hdf/test/tbv.c
   packages/libhdf4/branches/upstream/current/hdf/test/testhdf.386
   packages/libhdf4/branches/upstream/current/hdf/test/testhdf.c
   packages/libhdf4/branches/upstream/current/hdf/test/testhdf.def
   packages/libhdf4/branches/upstream/current/hdf/test/testhdf.lnk
   packages/libhdf4/branches/upstream/current/hdf/test/testhdf.pc
   packages/libhdf4/branches/upstream/current/hdf/test/testhdf.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/test/tmgr.dat
   packages/libhdf4/branches/upstream/current/hdf/test/tpf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tproto.h
   packages/libhdf4/branches/upstream/current/hdf/test/tr8f.f
   packages/libhdf4/branches/upstream/current/hdf/test/tree.c
   packages/libhdf4/branches/upstream/current/hdf/test/tsdmmsf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tsdnmmsf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tsdnntf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tsdntf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tsdstrf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tstubsf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tutils.h
   packages/libhdf4/branches/upstream/current/hdf/test/tv1.res
   packages/libhdf4/branches/upstream/current/hdf/test/tv2.res
   packages/libhdf4/branches/upstream/current/hdf/test/tvattr.c
   packages/libhdf4/branches/upstream/current/hdf/test/tvattr.dat
   packages/libhdf4/branches/upstream/current/hdf/test/tvattrf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tvset.c
   packages/libhdf4/branches/upstream/current/hdf/test/tvsetf.f
   packages/libhdf4/branches/upstream/current/hdf/test/tvsfpack.c
   packages/libhdf4/branches/upstream/current/hdf/test/vers.c
   packages/libhdf4/branches/upstream/current/hdf/test/win32tst.mak
   packages/libhdf4/branches/upstream/current/hdf/util/
   packages/libhdf4/branches/upstream/current/hdf/util/HELINK.OPT
   packages/libhdf4/branches/upstream/current/hdf/util/MAKEUTIL.COM
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/PalToHDF.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/R8ToHDF.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/RISToHDF.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/fp2hdf.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdf24to8.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfcomp.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfed.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfls.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfpack.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdftoR8.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdftopal.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/vshow.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/util/Makefile.in
   packages/libhdf4/branches/upstream/current/hdf/util/README
   packages/libhdf4/branches/upstream/current/hdf/util/README.TST
   packages/libhdf4/branches/upstream/current/hdf/util/SETUPUTILS.COM
   packages/libhdf4/branches/upstream/current/hdf/util/decompress.c
   packages/libhdf4/branches/upstream/current/hdf/util/fixatr/
   packages/libhdf4/branches/upstream/current/hdf/util/fixatr/README
   packages/libhdf4/branches/upstream/current/hdf/util/fixatr/command.for
   packages/libhdf4/branches/upstream/current/hdf/util/fixatr/common.for
   packages/libhdf4/branches/upstream/current/hdf/util/fixatr/fixatr.cld
   packages/libhdf4/branches/upstream/current/hdf/util/fixatr/fixatr.hlp
   packages/libhdf4/branches/upstream/current/hdf/util/fixatr/makefix.com
   packages/libhdf4/branches/upstream/current/hdf/util/fixatr/parse.mar
   packages/libhdf4/branches/upstream/current/hdf/util/fixatr/rformat.for
   packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.c
   packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.input1
   packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.input1-32
   packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.mak
   packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out1
   packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out1-32
   packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out2
   packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out2-32
   packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.test.result
   packages/libhdf4/branches/upstream/current/hdf/util/fptest.c
   packages/libhdf4/branches/upstream/current/hdf/util/fptestf.f
   packages/libhdf4/branches/upstream/current/hdf/util/getopt.c
   packages/libhdf4/branches/upstream/current/hdf/util/getopt1.c
   packages/libhdf4/branches/upstream/current/hdf/util/gif.h
   packages/libhdf4/branches/upstream/current/hdf/util/gif2hdf.c
   packages/libhdf4/branches/upstream/current/hdf/util/gif2mem.c
   packages/libhdf4/branches/upstream/current/hdf/util/gifread.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdf24to8.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdf24to8.mak
   packages/libhdf4/branches/upstream/current/hdf/util/hdf2gif.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdf2jpeg.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdf2jpeg.mak
   packages/libhdf4/branches/upstream/current/hdf/util/hdf8to24.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdf8to24.mak
   packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.mak
   packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.out1
   packages/libhdf4/branches/upstream/current/hdf/util/hdfed.input1
   packages/libhdf4/branches/upstream/current/hdf/util/hdfed.mak
   packages/libhdf4/branches/upstream/current/hdf/util/hdfed.out1
   packages/libhdf4/branches/upstream/current/hdf/util/hdfgifwr.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdfls.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdfls.mak
   packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.mak
   packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.out1
   packages/libhdf4/branches/upstream/current/hdf/util/hdfrseq.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdftopal.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdftopal.mak
   packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.mak
   packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.out1
   packages/libhdf4/branches/upstream/current/hdf/util/hdfunpac.c
   packages/libhdf4/branches/upstream/current/hdf/util/hdfunpac.mak
   packages/libhdf4/branches/upstream/current/hdf/util/he.h
   packages/libhdf4/branches/upstream/current/hdf/util/he_cntrl.c
   packages/libhdf4/branches/upstream/current/hdf/util/he_disp.c
   packages/libhdf4/branches/upstream/current/hdf/util/he_file.c
   packages/libhdf4/branches/upstream/current/hdf/util/he_main.c
   packages/libhdf4/branches/upstream/current/hdf/util/he_proto.h
   packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.c
   packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.mak
   packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.out1
   packages/libhdf4/branches/upstream/current/hdf/util/makepc.386
   packages/libhdf4/branches/upstream/current/hdf/util/makepc.msc
   packages/libhdf4/branches/upstream/current/hdf/util/paltohdf.c
   packages/libhdf4/branches/upstream/current/hdf/util/paltohdf.mak
   packages/libhdf4/branches/upstream/current/hdf/util/r8tohdf.c
   packages/libhdf4/branches/upstream/current/hdf/util/r8tohdf.mak
   packages/libhdf4/branches/upstream/current/hdf/util/ristosds.c
   packages/libhdf4/branches/upstream/current/hdf/util/ristosds.input1
   packages/libhdf4/branches/upstream/current/hdf/util/ristosds.mak
   packages/libhdf4/branches/upstream/current/hdf/util/ristosds.out1
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/README
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/SunWheel.gif
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/bttrfly.gif
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/head.r24.Z
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/head.r8.Z
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/jet2.hdf
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/jpeg_img.jpg
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/ntcheck.hdf
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/palette.raw
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/skull.hdf
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm110.hdf
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm110.raw
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm120.hdf
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm120.raw
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm130.hdf
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm130.raw
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm140.raw
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/test.cdf
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/test.hdf
   packages/libhdf4/branches/upstream/current/hdf/util/testfiles/tvattr.hdf
   packages/libhdf4/branches/upstream/current/hdf/util/testutil.sh
   packages/libhdf4/branches/upstream/current/hdf/util/vcompat.c
   packages/libhdf4/branches/upstream/current/hdf/util/vcompat.mak
   packages/libhdf4/branches/upstream/current/hdf/util/vmake.c
   packages/libhdf4/branches/upstream/current/hdf/util/vmake.mak
   packages/libhdf4/branches/upstream/current/hdf/util/vshow.c
   packages/libhdf4/branches/upstream/current/hdf/util/vshow.mak
   packages/libhdf4/branches/upstream/current/hdf/util/writehdf.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/
   packages/libhdf4/branches/upstream/current/hdf/zlib/ChangeLog
   packages/libhdf4/branches/upstream/current/hdf/zlib/FAQ
   packages/libhdf4/branches/upstream/current/hdf/zlib/INDEX
   packages/libhdf4/branches/upstream/current/hdf/zlib/Make_vms.com
   packages/libhdf4/branches/upstream/current/hdf/zlib/Makefile.in
   packages/libhdf4/branches/upstream/current/hdf/zlib/Makefile.riscos
   packages/libhdf4/branches/upstream/current/hdf/zlib/README
   packages/libhdf4/branches/upstream/current/hdf/zlib/adler32.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/algorithm.txt
   packages/libhdf4/branches/upstream/current/hdf/zlib/amiga/
   packages/libhdf4/branches/upstream/current/hdf/zlib/amiga/Makefile.pup
   packages/libhdf4/branches/upstream/current/hdf/zlib/amiga/Makefile.sas
   packages/libhdf4/branches/upstream/current/hdf/zlib/compress.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/configure.gnu
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/README.contrib
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/gvmat32.asm
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/gvmat32c.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/mkgvmt32.bat
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.def
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.dsp
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.dsw
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586/README.586
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586/match.S
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686/README.686
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686/match.S
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi/zlib.mak
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi/zlibdef.pas
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/d_zlib.bpr
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/d_zlib.cpp
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/readme.txt
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.bpg
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.bpr
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.cpp
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.pas
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib32.bpr
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib32.cpp
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/test.cpp
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/zfstream.cpp
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/zfstream.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2/zstream.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2/zstream_test.cpp
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/ChangeLogUnzip
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/Makefile
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/miniunz.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/minizip.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/readme.txt
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.def
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.def
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.def
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.dsp
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.dsw
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/Makefile
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/makefile.w32
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/untgz.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/visual-basic.txt
   packages/libhdf4/branches/upstream/current/hdf/zlib/crc32.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/deflate.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/deflate.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/descrip.mms
   packages/libhdf4/branches/upstream/current/hdf/zlib/example.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/gzio.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/infblock.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/infblock.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/infcodes.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/infcodes.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/inffast.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/inffast.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/inffixed.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/inflate.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/inftrees.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/inftrees.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/infutil.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/infutil.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/maketree.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/minigzip.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.b32
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.bor
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.dj2
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.emx
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.msc
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.tc
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.w32
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.wat
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/zlib.def
   packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/zlib.rc
   packages/libhdf4/branches/upstream/current/hdf/zlib/nt/
   packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.emx
   packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.gcc
   packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.nt
   packages/libhdf4/branches/upstream/current/hdf/zlib/nt/zlib.dnt
   packages/libhdf4/branches/upstream/current/hdf/zlib/os2/
   packages/libhdf4/branches/upstream/current/hdf/zlib/os2/Makefile.os2
   packages/libhdf4/branches/upstream/current/hdf/zlib/os2/zlib.def
   packages/libhdf4/branches/upstream/current/hdf/zlib/trees.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/trees.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/uncompr.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/zconf.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.3
   packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.h
   packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.project.hqx
   packages/libhdf4/branches/upstream/current/hdf/zlib/zutil.c
   packages/libhdf4/branches/upstream/current/hdf/zlib/zutil.h
   packages/libhdf4/branches/upstream/current/install-sh
   packages/libhdf4/branches/upstream/current/man/
   packages/libhdf4/branches/upstream/current/man/Makefile.in
   packages/libhdf4/branches/upstream/current/man/gr_chunk.3
   packages/libhdf4/branches/upstream/current/man/hdf.1
   packages/libhdf4/branches/upstream/current/man/hdfunpac.1
   packages/libhdf4/branches/upstream/current/mfhdf/
   packages/libhdf4/branches/upstream/current/mfhdf/CHANGES
   packages/libhdf4/branches/upstream/current/mfhdf/COPYRIGHT
   packages/libhdf4/branches/upstream/current/mfhdf/CUSTOMIZE
   packages/libhdf4/branches/upstream/current/mfhdf/FAQ
   packages/libhdf4/branches/upstream/current/mfhdf/INSTALL
   packages/libhdf4/branches/upstream/current/mfhdf/MANIFEST
   packages/libhdf4/branches/upstream/current/mfhdf/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/ORIGIN
   packages/libhdf4/branches/upstream/current/mfhdf/README
   packages/libhdf4/branches/upstream/current/mfhdf/README.HDF
   packages/libhdf4/branches/upstream/current/mfhdf/THANKS
   packages/libhdf4/branches/upstream/current/mfhdf/VERSION
   packages/libhdf4/branches/upstream/current/mfhdf/aclocal.m4
   packages/libhdf4/branches/upstream/current/mfhdf/build.bat
   packages/libhdf4/branches/upstream/current/mfhdf/c++/
   packages/libhdf4/branches/upstream/current/mfhdf/c++/Makefile
   packages/libhdf4/branches/upstream/current/mfhdf/c++/README
   packages/libhdf4/branches/upstream/current/mfhdf/c++/example.c
   packages/libhdf4/branches/upstream/current/mfhdf/c++/example.cc
   packages/libhdf4/branches/upstream/current/mfhdf/c++/example.cdl
   packages/libhdf4/branches/upstream/current/mfhdf/c++/expected
   packages/libhdf4/branches/upstream/current/mfhdf/c++/nc.info
   packages/libhdf4/branches/upstream/current/mfhdf/c++/nc.txn
   packages/libhdf4/branches/upstream/current/mfhdf/c++/nctst.cc
   packages/libhdf4/branches/upstream/current/mfhdf/c++/ncvalues.cc
   packages/libhdf4/branches/upstream/current/mfhdf/c++/ncvalues.hh
   packages/libhdf4/branches/upstream/current/mfhdf/c++/netcdf.cc
   packages/libhdf4/branches/upstream/current/mfhdf/c++/netcdf.hh
   packages/libhdf4/branches/upstream/current/mfhdf/configure
   packages/libhdf4/branches/upstream/current/mfhdf/configure.in
   packages/libhdf4/branches/upstream/current/mfhdf/doc/
   packages/libhdf4/branches/upstream/current/mfhdf/doc/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/doc/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/doc/README
   packages/libhdf4/branches/upstream/current/mfhdf/doc/guide.ps
   packages/libhdf4/branches/upstream/current/mfhdf/doc/guide.txn
   packages/libhdf4/branches/upstream/current/mfhdf/doc/texindex.c
   packages/libhdf4/branches/upstream/current/mfhdf/doc/texinfo.tex
   packages/libhdf4/branches/upstream/current/mfhdf/doc/udunits.dat
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/Example6.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/Image_with_Palette.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/LongDataset.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/README
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/TEST
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/TEST.COM
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/ctxtr2r.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/depend
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfi322.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui162.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui82.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui83.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui84.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.h
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.mak
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.txt
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_dump.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_gr.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_list.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_rig.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_sds.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_util.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_vd.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_vg.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/make.com
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/show.c
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/star.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/swf32.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/swf32_fileattr.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/swi16.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/swi8.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/tdata.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/tdf24.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/tdfr8f.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/test.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-1.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-10.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-11.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-12.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-13.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-14.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-15.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-16.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-17.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-18.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-2.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-3.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-4.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-5.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-6.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-7.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-8.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-9.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-1.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-2.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-3.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-4.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-5.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-6.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-1.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-2.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-3.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-4.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-5.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-6.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-7.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-8.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-9.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-1.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-10.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-2.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-3.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-4.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-5.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-6.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-7.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-8.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-9.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-1.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-10.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-11.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-12.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-2.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-3.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-4.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-5.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-6.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-7.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-8.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-9.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-1.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-10.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-2.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-3.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-4.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-5.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-6.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-7.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-8.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-9.out
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/testhdp.sh
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/tvattr.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/dumper/tvset.hdf
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/Linux.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/README
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/aix.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/common.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/common.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-aix.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-alpha.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-convex.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-dec.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-fbsd.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-fujivp.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-hpux.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-ia64.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix32.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix4.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix5.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix6.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-linux.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-mac.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-solaris.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-solarisx86.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-sun.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-t3e.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-unicos.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-aix.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-alpha.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-convex.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-dec.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-fbsd.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-fujivp.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-hpux.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-ia64.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix32.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix4.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix5.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix6.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-linux.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-mac.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-solaris.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-solarisx86.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-sun.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-t3e.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-unicos.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-aix.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-alpha.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-convex.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-dec.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-fbsd.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-fujivp.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-hpux.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-ia64.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix32.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix4.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix5.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix6.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-linux.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-mac.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-solaris.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-solarisx86.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-sun.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-t3e.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-unicos.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/convex.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/craympp.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/depend
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/descrip.mms
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/hdftestp.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfhdfp.h
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfsdpf.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfsdpff.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc1.sed
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc2.sed
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/freebsd.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/ftest.lnk
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/ftest.src
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/fujivp.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/hdftest.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/hdftst.sav
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/hpux.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/irix.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/jackets.src
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/mfsdf.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/mfsdff.f
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft.mk
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/NOTES
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/fslen.asm
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/ftest.for
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/jackets.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/msoft.int
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/netcdf.inc
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/osf.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/solaris.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/sunos.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/ultrix.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/unicos.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vax-ultrix.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/ftest.for
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/ftest.m4
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/hdftest.for
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/jackets.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/make.com
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/mfsdf.c
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/mfsdff.for
   packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/netcdf.inc
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/README
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/alloc.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/array.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/attr.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdf.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.mak
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.project.hqx
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-aix.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-alpha.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-convex.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-dec.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-fbsd.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-fujivp.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-hpux.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-ia64.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix32.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix4.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix5.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix6.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-linux.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-mac.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-solaris.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-solarisx86.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-sun.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-t3e.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-unicos.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-vms.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/depend
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/descrip.mms
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/dim.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/error.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/error.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/file.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/globdef.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdf2netcdf.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdfout.sav
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdfsds.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.mak
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.project.hqx
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/htons.mar
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/iarray.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/local_nc.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/make.com
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfhdf.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfhdflib.project.hqx
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfsd.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/msoft.mk
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/netcdf.h.in
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/nssdc.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/ntohs.mar
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/putget.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/putgetg.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/sharray.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/string.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/test1.nc
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/test_cdf.sav
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/testout.sav
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/var.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/win32cdf.h
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/win32cdf.mak
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/xdrposix.c
   packages/libhdf4/branches/upstream/current/mfhdf/libsrc/xdrstdio.c
   packages/libhdf4/branches/upstream/current/mfhdf/macros.mk
   packages/libhdf4/branches/upstream/current/mfhdf/make.com
   packages/libhdf4/branches/upstream/current/mfhdf/mfhdf.mak
   packages/libhdf4/branches/upstream/current/mfhdf/msoft.mk
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/SETUPNCDUMP.COM
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ctest0.mak
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/depend
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/dumplib.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/dumplib.h
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/make.com
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/msoft.mk
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/msofttab.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.1
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.h
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.lnk
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.mak
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/test0.cdl
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/vardata.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncdump/vardata.h
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/README
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/close.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ctest0.mak
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/depend
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/descrip.mms
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/escapes.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/generate.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/generic.h
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/genlib.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/genlib.h
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/getfill.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/init.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/lexyacc.com
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/load.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/main.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/make.com
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msoft.mk
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msofttab.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msofttab.h
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msoftyy.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.1
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.h
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.l
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.lnk
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.mak
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.opt
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.y
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test.com
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test0.cdl
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test0.lnk
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vms_yy.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vmstab.c
   packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vmstab.h
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/README
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/add.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/add.h
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/atttests.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/cdftests.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/depend
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/dimtests.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/driver.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/emalloc.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/emalloc.h
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/error.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/error.h
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/make.com
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/misctest.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/msoft.mk
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.def
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.lnk
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.mak
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.project.hqx
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/rec.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/slabs.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/testcdf.h
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/tests.h
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/val.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/val.h
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/vardef.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/varget.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/vargetg.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/varput.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/varputg.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/vartests.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/vputget.c
   packages/libhdf4/branches/upstream/current/mfhdf/nctest/vputgetg.c
   packages/libhdf4/branches/upstream/current/mfhdf/pablo/
   packages/libhdf4/branches/upstream/current/mfhdf/pablo/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/pablo/depend
   packages/libhdf4/branches/upstream/current/mfhdf/port/
   packages/libhdf4/branches/upstream/current/mfhdf/port/COPYRIGHT
   packages/libhdf4/branches/upstream/current/mfhdf/port/CUSTOMIZE
   packages/libhdf4/branches/upstream/current/mfhdf/port/HISTORY
   packages/libhdf4/branches/upstream/current/mfhdf/port/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/port/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/port/VERSION
   packages/libhdf4/branches/upstream/current/mfhdf/port/aclocal.m4
   packages/libhdf4/branches/upstream/current/mfhdf/port/configure
   packages/libhdf4/branches/upstream/current/mfhdf/port/configure.in
   packages/libhdf4/branches/upstream/current/mfhdf/port/depend
   packages/libhdf4/branches/upstream/current/mfhdf/port/mast_mk.in
   packages/libhdf4/branches/upstream/current/mfhdf/port/master.mk.in
   packages/libhdf4/branches/upstream/current/mfhdf/port/uddummy.c
   packages/libhdf4/branches/upstream/current/mfhdf/port/udposix.h.in
   packages/libhdf4/branches/upstream/current/mfhdf/port/udposixh.in
   packages/libhdf4/branches/upstream/current/mfhdf/port/which
   packages/libhdf4/branches/upstream/current/mfhdf/util/
   packages/libhdf4/branches/upstream/current/mfhdf/util/getopt.c
   packages/libhdf4/branches/upstream/current/mfhdf/util/make.com
   packages/libhdf4/branches/upstream/current/mfhdf/util/msoft.mk
   packages/libhdf4/branches/upstream/current/mfhdf/util/win32utl.mak
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/Makefile.in
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/Makefile.in_orig
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/NOTICE.h
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/README
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/byteordr.c
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/depend
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/descrip.mms
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/htonl.mar
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/make.com
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/msoft.mk
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/ntohl.mar
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/test_xdr.sav
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/testout.sav
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/types.h
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/win32xdr.mak
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdr.c
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdr.h
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrarray.c
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrfloat.c
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrlib.project.hqx
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrstdio.c
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.c
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.mak
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.opt
   packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.project.hqx
   packages/libhdf4/branches/upstream/current/mkinstalldirs
   packages/libhdf4/branches/upstream/current/move-if-change
   packages/libhdf4/branches/upstream/current/release_notes/
   packages/libhdf4/branches/upstream/current/release_notes/ABOUT_4.1r4
   packages/libhdf4/branches/upstream/current/release_notes/bugs_fixed.txt
   packages/libhdf4/branches/upstream/current/release_notes/compile.txt
   packages/libhdf4/tags/
Log:
[svn-inject] Installing original source of libhdf4

Added: packages/libhdf4/branches/upstream/current/COPYING
===================================================================
--- packages/libhdf4/branches/upstream/current/COPYING	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/COPYING	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,51 @@
+------------------------------------------------------------------
+
+Copyright Notice and Statement for NCSA Hierarchical Data Format (HDF) 
+Software Library and Utilities
+
+Copyright 1988-2000 The Board of Trustees of the University of Illinois
+
+All rights reserved.
+
+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).
+
+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 National Center for Supercomputing Applications at the 
+University of Illinois at Urbana-Champaign and credit the contributors.
+
+5. Neither the name of the University nor the names of the Contributors 
+may be used to endorse or promote products derived from this software 
+without specific prior written permission from the University or the 
+Contributors.
+
+DISCLAIMER
+
+THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND THE CONTRIBUTORS "AS IS" 
+WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED.  In no event 
+shall the University 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. 
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/INSTALL
===================================================================
--- packages/libhdf4/branches/upstream/current/INSTALL	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/INSTALL	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1176 @@
+***************************************************************************
+  CONTENTS
+  --------
+
+  1. Obtaining the latest version
+
+  2. Installing HDF
+  2.1 Supported Platforms
+  2.2 Third Party Software Requirements
+  2.3 System Requirements
+
+  2.4 General Configuration/Installation - Unix
+  2.4.1 Overview
+  2.4.2 Layout of configuration files
+
+  2.4.3 Changing default values(CC,CFLAGS,..) and Setting Options
+  2.4.3.1 Changing default values(CC,CFLAGS,..)
+  2.4.3.2 Using HDF/MFHDF libraries w/ original netCDF library
+  2.4.3.3 Setting other Options
+
+  2.4.4 Running configure
+  2.4.5 Dealing with Configure Problems
+  2.4.6 Compiling, Testing and Installing
+
+  2.5 Platform-specific Notes
+  2.5.1 Solaris on Sparc
+  2.5.2 Solaris on INTEL(x86)
+  2.5.3 OpenVMS AXP on DEC Alpha
+  2.5.4 Windows 98/NT/2000
+  2.5.5 Macintosh OS - Power PC    ** Not Supported **
+  2.5.6 Exemplar 
+  2.5.7 SP2 Single node
+  2.5.8 T3E Single node
+  2.5.9a SGI IRIX 6.x
+  2.5.9b SGI IRIX64
+  2.5.10 DEC Alpha
+
+  2.6 Pablo Instrumentation
+  2.7 File Cache(Beta release)
+  2.8 Installation Location
+  2.9 Specifying the System Type
+  2.10 Configure Options 
+
+  3. Man pages
+
+  4. Release Notes
+
+  5. Documentation
+
+  6. FAQ
+
+  7. Java Products
+
+  8. HELP
+
+*****************************************************************************
+
+1. Obtaining the latest version
+   ============================
+
+    The most recent version of the distribution can be obtained from
+    the NCSA ftp archive site at:
+
+       ftp://ftp.ncsa.uiuc.edu/HDF/HDF/HDF_Current/
+
+    The HDF home page is at:   
+       http://hdf.ncsa.uiuc.edu/ 
+
+    The distribution can be downloaded from the HDF Home page at:
+       http://hdf.ncsa.uiuc.edu/obtain.html
+    
+
+2. Installing HDF	
+   ==============
+
+    For compiling and installing the HDF libraries, tests and
+    utilities on a system, please follow these instructions. 
+
+2.1 Supported Platforms
+    ===================
+
+    For PLATFORM specific NOTES see Section 2.5 called
+    'Platform-specific Notes'.
+
+
+  Platform(OS)                    C-Compiler       Fortran-Compiler   
+  ------------                    ----------       ---------------- 
+  Sun4(Solaris 2.7)               WorkShop         WorkShop Compilers 5.0
+                                  Compilers C 5.0  FORTRAN 77 5.0         
+  Sun4(Solaris 2.6)               WorkShop         WorkShop Compilers 5.0
+                                  Compilers C 5.0  FORTRAN 77 5.0             
+  SGI-Indy(IRIX v6.5)             CC 7.30          f77 7.30
+  SGI-Origin(IRIX64 v6.5-n32)     CC 7.3.1m        f77 7.3.1m 
+  SGI-Origin(IRIX64 v6.5-64)      CC 7.3.1m        f77 7.3.1m    
+  HP9000/755(HP-UX B.11.00)       CC A.11.00.13    f77 B.11.00.01
+  Exemplar(HP-UX B.10.01)         CC V2.0          f77 V1.2.6
+  Cray J90 (bob.1 10.0.0.7)       CC 6.3.0.2       Cray Fortran 3.4.0.1.0 
+  IBM SP (single node, v4.3)      XLC 5.0.1.0      f77 07.01.0000.0002 
+  DEC Alpha/Digital Unix v4.0     DEC C v5.2-040   Digital Fortran v4.1-92 
+  DEC Alpha/OpenVMS AXP v7.1      DEC C v5.6-003   Digital Fortran 77 X7.1-156  
+  IBM PC - Intel Pentium
+       Solarisx86 (2.5.1)         GCC 2.7.2          -                
+       Linux      (2.2.16)        GCC 2.95.2       g77  0.5.25    
+       FreeBSD    (4.1.1)         GCC 2.95.2       GNU f77 V0.5.25
+  Windows NT/98/2000              MSVC++ 6.0       DEC Visual Fortran 6.0
+  T3E (sn6711 2.0.539b)           Cray CC 6.3.0.2  Cray Fortran 3.4.0.1.0
+
+
+  NOTE:  Platforms listed with compiler information entered, are 
+  platforms that HDF was tested on and for which we provide 
+  pre-compiled binaries.  
+
+ 
+2.2  Third Party Software Requirements:
+     ==================================
+
+     1. IJPEG distribution release 6b(libjpeg.a). The "official" site
+        for this is ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
+
+     2. ZLIB 1.1.3(libz.a) distribution.
+
+     Both of these distributions are included with this distribution
+     in 'hdf/jpeg' and 'hdf/zlib'. The HDF/mfhdf base distribution
+     is known to work with these versions only.
+
+2.3 System Requirements
+    ===================
+
+    To build HDF from source, you need:
+
+      * an ANSI C compiler. The native ANSI compilers on the above 
+        platforms are supported. On platforms where no ANSI compiler
+        was available the free GNU ANSI compiler GCC was used.
+
+      * a Fortran 77 compiler (F90 on Crays) if you want Fortran support. 
+        See above table for platforms where Fortran is supported. You 
+        can compile both libraries without Fortran support by setting 
+        the Fortran compiler variable 'FC = NONE' in the respective
+        makefile fragment(mh-<os>) found in the top-level 'config'
+        directory: 
+
+                $(toplevel)/config/mh-<os>.
+
+        See below for further details of configuration and installation.
+        
+
+2.4 General Configuration/Installation - Unix
+    =========================================
+
+    2.4.1 Overview
+    --------------        
+    In this distribution there are two types of 'configure'
+    scripts. One is the Cygnus 'configure' script and the other is the
+    'configure' script created by the GNU autoconf package. The Cygnus
+    'configure' script is used at the top level to configure the overall
+    distribution and the HDF/MFHDF/IJPEG/ZLIB libraries. The GNU 'configure' 
+    script is used by the netCDF/IJPEG distributions to configure themselves. 
+    However, these gnu configure scripts are not used in configuring this 
+    distribution.
+ 
+    The Cygnus 'configure' script attempts to guess the correct
+    platform you are configuring the distribution for by calling the shell
+    script 'config.guess'. It outputs a unique string based on information
+    obtained from the UNIX command 'uname' consisting of CPU-VENDOR-OS
+    e.g. 'hppa1.1-hp-hpux9.03' for an  HP9000/735 running HPUX-9.03.
+
+    2.4.2 Layout of configuration files
+    -----------------------------------
+    The following shows the layout of the files used in the configuration
+    of the HDF distribution.
+
+    NOTE: The $(toplevel)/mfhdf/CUSTOMIZE and 
+          $(toplevel)/mfhdf/configure(autoconf) files are no longer used 
+          in the configuration of the distribution.
+  
+    $(toplevel)/Makefile.in
+                config.guess
+                config.sub
+                configure (cygnus)
+                configure.in (cygnus)
+                config/mh-hpux, mh-sun,.....(host makefile fragments)
+
+                man/Makefile.in
+
+                mfhdf/CUSTOMIZE(not used)
+                mfhdf/configure(autoconf - not used)
+                mfhdf/libsrc/config/netcdf-aix.h,...  -> copied to netcdf.h
+                mfhdf/fortran/config/ftest-aix.f,...  -> copied to ftest.f
+                mfhdf/fortran/config/jackets-aix.c,.. -> copied to jackets.c
+                mfhdf/fortran/config/netcdf-aix.inc,..-> copied to netcdf.inc
+
+                hdf/Makefile.in
+                hdf/src/Makefile.in
+                hdf/test/Makefile.in
+                hdf/util/Makefile.in
+                hdf/zlib/Makefile.in
+                hdf/pablo/Makefile.in
+
+                hdf/jpeg/configure.in (cygnus)
+                hdf/jpeg/Makefile.in
+                hdf/jpeg/configure.gnu(autoconf - not used)
+                hdf/jpeg/config/mh-hpux, mh-sun,... (host makefile fragments)
+                hdf/jpeg/config/jhpux.h, jsun.h,...   -> copied to jconfig.h
+
+                hdf/fmpool/configure, configure.in config.guess, config.sub,
+                           Makefile.in (all cygnus)
+                hdf/fmpool/config/mh-hpux, mh-sun,...(host makefile fragments)
+                hdf/fmpool/config/fmpsolaris.h,...    -> copied to fmpconf.h
+
+    2.4.3 Changing default values(CC,CFLAGS,..) and Setting Options
+    ---------------------------------------------------------------
+    To change any of the default values or set any of the options 
+    edit the makefile fragment: 
+
+             $(toplevel)/config/mh-<os>
+
+    for your particular operating system. After changing the values you must 
+    re-run the top-level 'configure' script. Make sure you start from
+    a clean distribution if you are rebuilding after a previous make
+    (i.e. 'make distclean') before re-running 'configure'.
+
+      2.4.3.1 Changing default values(CC,CFLAGS,..)
+      ********************************************
+      To change any of the default values for CC, FC, CFLAGS, FFLAGS,..etc
+      edit the top part of the makefile fragment: $(toplevel)/config/mh-<os>
+      It is also a good idea to look at the other system variables to make sure 
+      they are set correctly for your system.
+
+      2.4.3.2 Using HDF/MFHDF libraries w/ original netCDF library
+      ************************************************************
+      To use the HDF/MFHDF libraries(libdf.a, libmfhdf.a) with the
+      original netCDF library(libnetcdf.a) the HDF/MFHDF distribution
+      must be compiled with the option '-DHAVE_NETCDF'. This will
+      rename the HDF version of the C-interface(ncxxx) of the netCDF API
+      to sd_ncxxx to avoid clashing with the original netCDF API from
+      libnetcdf.a. Currently there is no support for renaming the 
+      netCDF Fortran interface stubs. As such the HDF/MFHDF distribution 
+      must be compiled without fortran support. HDF Users can still access
+      HDF/netCDF files through the SDxxx interface but not through the
+      ncxxx interface unless the renamed interface is used(sd_ncxxx).
+
+      2.4.3.3 Setting other Options
+      *****************************
+      The makefile fragment must also be modified to enable the features 
+      mentioned in sections 2.6) and 2.7) below.
+
+    2.4.4 Running configure
+    -----------------------
+    To build both of the libraries contained in this directory,
+    run the ``configure'' script in $(toplevel), e.g.:
+
+	./configure -v --prefix=/usr/local/hdf
+
+    If you're using `csh' on an old version of System V, you might need 
+    to type `sh ./configure -v --prefix=/usr/local/hdf' instead to prevent 
+    `csh' from trying to execute `configure' itself.
+
+    This will configure the distribution to install the libraries, utilities,
+    include and man files in '/usr/local/hdf/lib','/usr/local/hdf/bin',
+    '/usr/local/hdf/include' and '/usr/local/hdf/man' respectively. The
+    default 'prefix' is '/usr/local'. It is advisable to use something
+    like the above to avoid overwriting say another 'libjpeg.a' that might be
+    installed in '/usr/local/lib'. The '-v' option is for verbose output.
+
+    Note that both 'libz.a' and 'libjpeg.a' and their respective
+    include files are installed along with the base HDF(libdf.a) 
+    and netCDF(libmfhdf.a) libraries.
+
+    If the configure script can't determine your type of computer
+    then it probably is a platfrom that is no longer supported.
+    If you want to be adventurous see the section 'Dealing with
+    Configure Problems' below. Otherwise send an email to 
+    'hdfhelp at ncsa.uiuc.edu' for further help. 
+
+    2.4.5 Dealing with Configure Problems
+    *************************************
+    If you want to be adventurous you can try the following.
+
+    Configure basically calls either of the two shell scripts 'config.guess' 
+    or 'config.sub' depending upon whether a target platform was supplied 
+    on the command line to configure. If you don't provide a target on
+    the command line configure calls 'config.guess' to guess what platfrom
+    it is configuring for. The shell script 'config.guess' uses the unix
+    command 'uname' to figure out the CPU, vendor, and OS of the
+    platform. If you do provide a target on the command line, configure
+    calls the shell script 'config.sub' to build the triplet specifying
+    CPU, vendor, and OS from the full or partial target provided.
+
+    If the configure script can't determine your type of computer, give it
+    a general name that the computer is generally referred to as an argument, 
+    for instance './configure sun4'.  You can use the script 'config.sub' 
+    to test whether a general name is recognized; if it is, config.sub 
+    translates it to a triplet specifying CPU, vendor, and OS.
+    (e.g hppa1.1-hp-hpux9.03 for an HP900/735 running HPUX9.03).
+
+    If this still fails all is not lost. All the configure script really
+    needs is one of the supported targets mentioned above(except NT).
+    If you think your platform is close to one of the above platforms
+    mentioned in the 'Supported Platforms' sections you can pass configure
+    this target and it will configure the distribution for that target.
+
+    For possible mappings you will need to look inside the shell script
+    'config.sub' and look at the partial to full mappings and pick one
+    that satisfies the triplet mappings found in 'configure.in' below
+    the section "# per-host:'. Note that if you try a mapping and it
+    does not work this means that 'config.sub' needs to be edited to
+    provide the proper mapping from your target to a full mapping that
+    is supported. 
+
+    There are currently NO instructions for porting the distribution to a 
+    new platform.
+
+    2.4.6 Compiling, Testing and Installing
+    ---------------------------------------
+    To compile the library and utilities type:
+
+        make 
+
+    To find out the available make targets type:
+
+        make help
+
+    To test the libraries and utilities type:
+
+        make test 
+
+    It is a good idea to save the output of the tests and view it later 
+    for errors.
+    e.g. 
+
+        make test >& make.test.out
+
+    To install the libraries, utilities, includes and man pages type: e.g.
+
+        make install
+
+2.5 Platform-specific Notes
+    ========================
+
+
+    2.5.1 Solaris on Sparc
+    ----------------------
+    The distribution has been compiled/tested with the native
+    ANSI-C compiler and native fortran compiler. The binary 
+    distribution was compiled using the native compilers.
+
+    When compiling your programs on Solaris, you must include the 
+    the nsl library, to resolve calls to the xdr* routines.
+    For example,
+
+      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
+
+
+    2.5.2 Solaris on INTEL(x86)
+    ---------------------------
+
+    The distribution has been compiled/tested with GCC 2.7.2 with
+    *NO* FORTRAN support.
+
+    When compiling your programs on Solaris_x86, you must include the 
+    the nsl library, to resolve calls to the xdr* routines.
+    For example,
+
+       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
+
+    2.5.3 OpenVMS AXP on DEC Alpha
+    ------------------------------
+   
+   To build the HDF Library on Alpha OpenVMS systems use
+    MAKEVMS.COM file in the top level directory of the VMS Library source.
+                                                       -------------------
+
+    To build the library in interactive mode run
+
+    @MAKEVMS.COM
+
+    To build the library in the background:
+
+    1. Check that the first command in MAKEVMS.COM sets default directory
+       to the top level directory in the HDF Library source tree (just
+       edit the first command line:  $  set def.... ).
+
+    2. Submit MAKEVMS.COM to the appropriate batch queue on your system
+       For example:
+
+    $ submit/log=buildhdf.log/noprint/notify/restart/que=batch$queue MAKEVMS.COM
+
+
+    MAKEVMS.COM file
+
+    1.  Creates three directories in the top level directory:
+        [...tophdf.include]
+        [...tophdf.bin]
+        [...tophdf.lib]
+
+    2.  Builds four libraries LIBJPEG.OLB, LIBZ.OLB, DF.OLB, and MFHDF.OLB,
+        and copies them into the [...tophdf.bin] directory.
+
+    3.  Builds the HDF utilities and copies them into the [...tophdf.bin]
+        directory.
+
+    4.  Copies the header files to the [...tophdf.include] directory.
+
+    5.  Runs the library tests after building each library and the tests for the
+
+        ncdump, ncgen and hdp utilities.
+
+    We recommend building the library in background and then checking log file
+    for test results. Output of the hdp test is written to the
+    [...tophdf.mfhdf.dumper]hdp.out file.
+
+    See MAKEVMS.COM for more information.
+
+    NOTE: If you are building from UNIX source perform the following steps
+          before you run MAKEVMS.COM:
+
+          1. Make sure that files in the directory [.mfhdf.fortran.vms] are
+             up to date.
+          2. In the directory [.hdf.test] change the files
+             forsupff.f
+             tsdmmsf.f
+             tsdnmmsf.f
+             tsdntf.f
+             tsdnnt.f
+             tvsetf.f
+             slabwf.f
+                      following the instructions given in the comments,
+             which start with 'For VMS', in these files.
+
+
+    2.5.4 Windows 98/NT/2000
+    ------------------------
+
+      Install HDF4.1 Release 4 on Windows NT, Windows 2000 and Windows 98
+
+The instructions which follow assume that you will be using one of 
+the 'zip' files that we provide, either the binary code release
+(HDF41r4.zip) or the source code release (HDF41r4s.zip).
+
+In building HDF from source code you may select between 
+two build environment options ( with Fortran or without Fortran support
+depending on your application and environment needs ).  
+
+The following sections discuss in details installation procedures. 
+
+
+Building from Binary Code Release (HDF41r4.zip)
+===============================================
+To install the HDFand 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 (HDF41r4.zip) 
+      to that directory 
+      and unpack it by running WinZip on HDF41r4.zip (the binary archive).
+      This should create a directory called 'HDF41r4' which 
+      contains the following files and directories.
+
+            c:\MyHDFstuff\HDF41r4\lib             ( Single-threaded static
+                                                    versions of HDF and MFHDF
+                                                    libraries  with Fortran
+                                                    or without Fortran support )
+            c:\MyHDFstuff\HDF41r4\dlllib          ( Multi-threaded DLL import
+                                                    HDF and MFHDF  libraries 
+                                                    and DLL files with Fortran
+                                                    or no Fortran support )
+            c:\MyHDFstuff\HDF41r4\include         ( include files )
+            c:\MyHDFstuff\HDF41r4\bin             ( utilities )
+            c:\MyHDFstuff\HDF41r4\release_notes   ( release notes )
+            c:\MyHDFstuff\HDF41r4\install_NT_98   ( this file)
+
+      
+      3. If you are building an application that uses the HDF libraries 
+         the following locations will need to be specified for locating
+         header files and linking in the HDF libraries:
+ 
+            C:\MyHDFstuff\HDF41r4\lib or C:\MyHDFstuff\HDF41r4\dlllib
+            C:\MyHDFstuff\HDF41r4\include
+
+
+
+Note: The ws2_32.lib needs to linked with your executable if using the static 
+      mfhdf library.  The ws2_32.lib can be found in your Microsoft Visual C++
+      directory under the lib folder.
+
+
+Building from Source Code Release (HDF41r4s.zip)
+================================================
+
+STEP I:  Preconditions
+
+To build the HDF and MFHDF libraries ( single-threaded static or
+multi-threaded DLL import libraries) and utilities, 
+it is assumed that you have done the following:
+      
+      1. Installed MicroSoft Developer Studio, and Visual C++ 6.0.
+         Visual Fortran 6.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 HDF41r4s.zip (the entire source tree).
+      This should create a directory called 'HDF41r4' which 
+      contains several files and directories.
+      
+Note: If you are building from the UNIX source code, then you will
+      need to replace the jconfig.h and netcdf.h file as follows
+      ( this assumes that the HDF Library tree resides 
+      under HDF41r4 directory ):
+ 
+      copy C:\MyHDFstuff\HDF41r4\hdf\jpeg\config\jwin32.h
+                                 C:\MyHDFstuff\HDF41r4\hdf\jpeg\jconfig.h
+      copy C:\MyHDFstuff\HDF41r4\mfhdf\libsrc\win32cdf.h
+                                 C:\MyHDFstuff\HDF41r4\mfhdf\libsrc\netcdf.h
+
+You do not need to do this if you are using the HDF41r4s.zip file! 
+
+STEP II: Select Installation type and Build.
+
+You may select one of 2 ways to build the HDF libraries and 
+utilities, depending on your environment and application needs.
+
+Option I, (select Win32.nofortran.zip)
+This is the "NOFORTRAN" configuration : It builds debug and release single-threaded
+and multi-threaded versions of the HDF libraries, tests, and utilities. 
+There is no Fortran support.
+
+
+Option II, (select Win32.zip)
+This is "WITH FORTRAN support" configuration : it is the same as above but with
+Fortran support. 
+
+
+
+STEP III: Building the Libraries, tests and utilities.
+Note that the instructions are the same for both Options I and II. 
+
+
+	1. Unpack Win32.nofortran.zip or Win32.zip in 
+           directory HDF41r4\. 
+         
+        2. Invoke Microsoft Visial C++ 6.0, go to "File" and select
+           the "Open Workspace" option. 
+           Then open the c:\myHDFstuff\HDF41r4\all.dsw workspace. 
+
+        3. Select "Build", then Select "Set Active Configuration".
+
+           On Windows platform select as the active configuration
+
+           "all -- Win32 Debug" to build debug versions of single-threaded
+                                static libraries, tests and utilities and
+                                multi-threaded libraries and tests.
+            or
+ 
+           "all -- Win32 Release" to build release versions of single-threaded
+                                static libraries, tests and utilities and
+                                multi-threaded libraries and tests.
+
+
+           Select "Build" and "Build all.exe" to
+           build the corresponding version of the HDF41r4 library.
+           If you are building from the Win32.zip archive, 
+           you will see that the Digital Visual Fortran compiler is invoked
+           by the Visual C++ Development environment in compiling the fortran code.
+
+           NOTE: "all" is a dummy target. You will get a link error when   
+           "all.exe." is built : 
+                 LINK: error LNK2001: unresolved external symbol _WinMainCRTStartup.....
+                 all.exe - 2 error(s), ....
+
+           Warning messages can be ignored. The "all.exe" is never created, 
+           so it is OK.
+
+           When the debug build is done the directories listed 
+           below will contain the following files:
+
+           c:\MyHDFstuff\HDF41r4\Windows\bin\debug - 
+
+             utilities, statically linked with the single-threaded libraries.
+
+           c:\MyHDFstuff\HDF41r4\Windows\lib\debug\singlethreaded -
+
+              HD414d.lib - HDF static library (inludes JPEG and GZIP libraries) 
+              HM414d.lib - MFHDF static library
+
+           c:\MyHDFstuff\HDF41r4\Windows\lib\debug\multithreaded -
+
+              HD414md.lib - HDF multi-threaded DLL import library 
+                            (inludes JPEG and GZIP libraries)
+              HM414md.lib - MFHDF multi-threaded DLL import library 
+
+           c:\MyHDFstuff\HDF41r4\Windows\DLL\debug
+
+               HD414md.DLL - HDF DLL
+               HM414md.DLL - MFHDF DLL
+
+           When the release build is done the directories listed
+           below will contain the following files:
+ 
+           c:\MyHDFstuff\HDF41r4\Windows\bin\release - 
+ 
+             utilities, statically linked with the single-threaded libraries.
+ 
+           c:\MyHDFstuff\HDF41r4\Windows\lib\release\singlethreaded - 
+ 
+              HD414.lib - HDF static library (inludes JPEG and GZIP libraries)
+              HM414.lib - MFHDF static library
+
+           c:\MyHDFstuff\HDF41r4\Windows\lib\release\multithreaded - 
+ 
+              HD414m.lib - HDF multi-threaded DLL import library 
+                            (inludes JPEG and GZIP libraries)
+              HM414m.lib - MFHDF multi-threaded DLL import library
+ 
+           c:\MyHDFstuff\HDF41r4\Windows\DLL\release 
+
+               HD414m.DLL - HDF DLL
+               HM414m.DLL - MFHDF DLL
+
+
+Note: The ws2_32.lib needs to linked with your executable if using the static 
+      mfhdf library.  The ws2_32.lib can be found in your Microsoft Visual C++
+      directory under the lib folder.
+
+		
+STEP IV:   TESTING THE BUILD
+
+       In a command prompt window run the test batch file which
+       resides in the HDF41r4 directory to make sure that the libraries
+       were built correctly.
+
+       Set the path to include the DLL files or copy the files to the system
+       directory.
+
+       Then run Win32debugtst.bat to test debug version or
+       Win32releasetst.bat to test release version.  
+        
+
+STEP V:  INSTALLATION
+
+       In the command prompt window run the install_debug.bat file to install
+       the debug version. This file will create four directories under 
+       the HDF41r4 directory and copy over corresponding files:
+
+           bindbg     - utilties 
+           libdbg     - static libraries
+           dlllibdbg  - multi-threaded libraries and DLLs
+           include    - include files 
+
+       In the command prompt window run install_release.bat file to install 
+       release version. This file will create four directories under HDF41r4 
+       directory and copy corresponding files: 
+ 
+           bin     - utilties 
+           lib     - static libraries 
+           dlllib  - multi-threaded libraries and DLLs 
+           include - include files
+ 
+Note:  There is an error in the debug version of the hdp tool.  It will show an
+       alert box with the error and 3 buttons.  This is a known problem.  The release
+       version is fine.
+
+STEP VI:  
+
+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>\dlllib
+            <top-level HDF directory>\include
+
+where <top-level HDF directory> may be C:\myHDFstuff\dev or C:\MyHDFstuff\HDF41r4\
+
+
+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:
+         HD414.lib HM414.lib (single-threaded release version)
+         HD414d.lib HM414d.lib (single-threaded debug version)
+
+         HD414m.lib HM414m.lib (multi-threaded release version)
+         HD414md.lib HM414md.lib (multi-threaded debug version)
+
+
+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 Win32.zip  and Win32.nofortran.zip must end up 
+         in the HDF41r4\ directory installed by HDF41r4s.zip
+
+         If you must install all.dsw and all.dsp in 
+         another directory, relative to HDF41r4\ , you will be asked to
+	 locate the above 5 sub-project files, when you open the
+	 project all.dsw.
+	 
+	 If you want to rename all (the entire project),
+	 you will need to modify two files
+	 all.dsw and all.dsp as text
+	 (contrary to the explicit warnings in the files).
+
+	 You can also modify all.dsw and all.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 all.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
+                                   or Multi-Threaded
+                                   or Multi-Threaded debug
+
+
+
+
+
+    2.5.5 Macintosh OS - Power PC - 
+    -------------------------------
+    **** NOT SUPPORTED WITH HDF 4.1r4 ****
+
+    The distribution was compiled/tested with MetroWerks Codewarrior(CW Pro1).
+    Only the base libraries {jpeg.PPC.lib, z.PPC.lib, hdflib.PPC.lib,
+    xdr.PPC.lib and mfhdf.PPC.lib} were compiled and tested on the
+    PowerPC without Fortran support.
+
+    *NO* Fortran support is included in this distribution.
+
+    Codewarrior Projects can be found with this distribution.
+    They have been run through the Macintosh BinHex utility program. 
+    You need to compile the libraries before you can compile the test 
+    programs 'testhdf', 'xdrtest', 'cdftest', 'hdftest' and  'nctest'.
+
+    2.5.5.1 Special Notes
+    *********************
+    1. The test programs are SIOUX applications.
+    
+    2. When testing 'testhdf' in the 'hdf/test' directory make sure
+       that a directory called 'testdir' exists in 'hdf/test'.
+       This directory is used in the external element test.
+
+    3. You need at least 8MB of memory to run most of the test programs.
+ 
+    4. Distribution also contains projects files to build utilities,
+       but utilities were not tested.
+
+    2.5.5.2 Building the Distribution
+    *********************************
+    The distribution  and tests need to be built in the order specified below.
+    Codewarrior Projects with the targets for Power PC and 68K can be 
+    found in the following directories:
+ 
+    $(toplevel)/
+                hdf/zlib/zlib.project.hqx
+
+                hdf/jpeg/jpeglib.project.hqx
+
+                hdf/src/hdflib.project.hqx
+
+                hdf/test/testhdf.project.hqx
+
+                hdf/test/testdir(need to create this if it does not exist)
+    
+                mfhdf/xdr/xdrlib.project.hqx
+                mfhdf/xdr/xdrtest.project.hqx
+
+                mfhdf/libsrc/mfhdflib.project.hqx
+                             cdftest.project.hqx
+                             hdftest.project.hqx
+
+                mfhdf/nctest/nctest.project.hqx
+
+    Note that only the PPC version of the libraries and tests are supported.
+
+    2.5.5.3 Testing the Distribution
+    ********************************
+    Run the tests in the following order:
+      
+       1. hdf/test/testhdf
+          Note:
+           When testing 'testhdf' in the 'hdf/test' directory make sure
+           that a directory called 'testdir' exists in the 'hdf/test'.
+           This directory is used in the external element test.
+
+       2. mfhdf/xdr/xdrtest
+           After running this test compare the output to that shown in
+           the file mfhdf/xdr/testout.sav
+
+       3. mfhdf/libsrc/hdftest
+           After running this test compare the output to that shown in
+           the file mfhdf/libsrc/hdfout.sav
+
+       4. mfhdf/libsrc/cdftest
+           After running this test compare the output to that shown in
+           the file mfhdf/libsrc/testout.sav
+
+       5. mfhdf/nctest/nctest
+
+    2.5.5.4 Building utilities  
+    ********************************
+
+    Codewarrior Projects for utilities can be found in the following
+    directories:
+ 
+           
+    $(toplevel)/
+                mfhdf/dumper/hdp/hdp.project.hqx
+
+                hdf/util/fp2hdf/fp2hdf.project.hqx
+                         hdf24to8/hdf24to8.project.hqx
+                         hdfcomp/hdfcomp.project.hqx
+                         hdfed/hdfed.project.hqx
+                         hdfls/hdfls.project.hqx
+                         hdfls/hdfls.project.hqx
+                         hdfpack/hdfpack.project.hqx
+                         hdftoPal/hdftopal.project.hqx
+                         hdftoR8/hdftoR8.project.hqx
+                         vshow/vshow.project.hqx
+                         PalToHDF/PalToHDF.project.hqx
+                         R8ToHDF/R8ToHDF.project.hqx 
+                         RISToHDF/RISToHDF.project.hqx
+
+    2.5.6 Exemplar
+    --------------
+    HP Exemplar (Convex) machines running version 10.x of HP-UX are now only
+    able to be configured for HP-UX.  If you are running an Exemplar with an
+    earlier version of the software, you must configure the machine as
+    follows:
+
+        ./configure -v --host=c2-convex-bsd
+
+    Otherwise, the machine will be configured for HP-UX.
+        
+
+    2.5.7 SP2 Single node
+    ----------------------
+    HDF has been compiled and tested to run in a single node of the
+    SP2 system.  You can make the library the same way you would on an
+    AIX system.  To use it in the parallel processing environment, we
+    advise you to execute the HDF code in only one designated process
+    since HDF code does not support concurrent access to the same file.
+
+
+    2.5.8 T3E Single node
+    ---------------------
+    HDF has been compiled and tested to run in a single node of the
+    T3E system.  It is compiled with the '-X m' to produce malleable
+    code which can be executed with multiple processing elements (PEs).
+    The code has not been tested run with multiple PEs.  To use it in
+    the parallel processing environment, we advise you to execute the
+    HDF code in only one designated process since HDF code does not
+    support concurrent access to the same file.
+
+
+    NOTE: HDF is compiled with the f90 compiler starting release 4.1r2.
+    Cray has phased out the cf77 compiler.  The f90 compiler issues
+    numerous warnings during the compiling of the Fortran API test
+    programs.  They can be safely ignored.  One warning is about the
+    unsupported DOUBLE PRECISION being replaced by REAL.  That works fine
+    for the purpose of the test programs since T3E REAL is 8 bytes in
+    size which is the same size as DOUBLE PRECISION in other machines.
+    Another warning is by the loader complaining about many SYMBOLS
+    referenced but not defined.  Those SYMBOLS are actually HDF Fortran
+    function names declared in dffunc.inc file and they are not used in
+    the testing.
+
+
+    2.5.9a SGI IRIX 6.x
+    -------------------
+    IRIX is the traditional SGI 32-bit OS.  Starting in version 6.x,
+    it supports two classes of 32 bit compilers, the old 32 (-o32)
+    and the new 32-bits (-n32).  SGI is phasing out the -o32 compilers.
+    Continued maintenance is available on the -n32 class of compilers only.
+    The HDF library configures to use the -n32 class of C and F77 compilers.
+    If you want to use different compiler options, you need to edit
+    config/mh-irix32 and then run configure.  Consult the section
+    of "General Configuration/Installation" for more information.
+
+
+    2.5.9b SGI IRIX64
+    -----------------
+    IRIX64 supports multiple combinations of ABI (-64, -n32, -o32) and
+    instruction sets (-mips2, -mips3, -mips4).  Previous HDF
+    library releases had hard coded the MIPS settings by guessing what
+    might be the most reasonable combination.  This release no longer
+    sets the MIPS option but leaves it up to the local or user's
+    default.  The configure still generates -64 code by default on
+    an IRIX64 system.  If -n32 code is desired, one may override it
+    by specifying 'irix6_32' during the configure step.
+
+    Configure command	    Code produced
+    -----------------	    -------------
+    ./configure                 -64
+    ./configure irix6_32        -n32
+
+    If you want to use different compiler options, you need to edit
+    config/mh-irix6 (for just configure) or config/mh-irix32 (for
+    configure irix6_32) and then run configure.  Consult the section
+    of "General Configuration/Installation" for more information.
+
+
+    2.5.10 DEC Alpha
+    ----------------
+    The distribution has been compiled/tested with the native Digital 
+    Unix C and FORTRAN compilers.
+
+    During the testing of the library the test 'mfhdf/libsrc/hdftest' 
+    will report "Unaligned access ..." messages which can be ignored.
+
+
+2.6 Pablo Instrumentation
+    =====================
+
+    This version of the distribution has support to create an instrumented 
+    version of the HDF libraries(libdf-inst.a and libmfhdf-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.  
+    Version 5.1 or higher of the trace library is required.
+
+    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' or Microsoft Word Document file
+    '$(toplevel)/hdf/pablo/Pablo.doc' or the PDF document file
+    /$(toplevel)/hdf/pablo/Pablo.pdf'.  
+
+    In this version both an instrumented version of the core HDF library 
+    libdf.a and the library libmfhdf.a can be created.  Current interfaces 
+    supported are ANxx, GRxx, DFSDxx, DFANxx, DFPxx, DFR8xx, DF24xx, Hxx, 
+    SDxx, 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_INCDIR' to the Pablo distribution 
+    # include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+    #PABLO_FLAGS  = -DHAVE_PABLO
+    #PABLO_INCDIR = /usr/local/include/pablo-5.1
+    #PABLO_INCLUDE = -I$(PABLO_INCDIR)
+    After setting these values you must re-run the toplevel 'configure' script.
+    Make sure that you 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 above in the section
+    'General Configuration/Installation - Unix'.
+
+2.7 File Cache(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 cache 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 a 
+    future release). The default is 8192 bytes for page-size and 1 for number 
+    of pages in the pool.
+
+    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 behavior after it has been
+       opened or created. This may change 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 you 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 above in the section
+    'General Configuration/Installation - Unix'.
+
+    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.
+
+2.8 Installation Location
+    =====================
+
+    By default, `make install' will install the HDF/mfhdf files in
+    `$(toplevel)/NewHDF/bin', '$(toplevel)/NewHDF/lib', etc.  You may
+    then copy the files to the appropriate directories on your system.
+    If you prefer, you can specify the directory so that `make install'
+    will install the files directly in it.  This is done by giving
+    `configure' the option `--prefix=PATH'.
+
+    eg.  ./configure -v --prefix=/usr/local/hdf
+
+    This will configure the distribution to install the libraries,
+    utilities, include and man files in '/usr/local/hdf/lib',
+    '/usr/local/hdf/bin', '/usr/local/hdf/include' and
+    '/usr/local/hdf/man' respectively.
+
+2.9 Specifying the System Type
+    ==========================
+
+    There may be some features `configure' can not figure out
+    automatically, but needs to determine by the type of host HDF/mfhdf
+    will run on.  Usually `configure' can figure that out, but if it prints
+    a message saying it can not guess the host type, give it the
+    `--host=TYPE' option.  TYPE can either be a short name for the system
+    type, such as `sun4', or a canonical name with three fields:
+
+         CPU-COMPANY-SYSTEM
+
+    e.g. hppa1.1-hp-hpux9.03
+
+    See the file `config.sub' for the possible values of each field.
+
+
+2.10 Configure Options 
+    ==================
+
+    Usage: configure [OPTIONS] [HOST]
+
+    Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5",etc.
+
+    `configure' recognizes the following options to control how it
+    operates. 
+
+    NOTE: not all options are currently supported by this
+          distribution. The following are the only ones supported.
+
+    `--help'
+         Print a summary of the options to `configure', and exit.
+
+     `--prefix=MYDIR`          install into MYDIR [$(toplevel)/NewHDF]
+
+
+3. Man pages
+   =============
+
+    Man pages can be found in:
+
+         $(toplevel)/man
+
+4. Release notes
+   =============
+    The files in sub-directory $(toplevel)/release_notes are detailed 
+    descriptions for the new features and changes in this release.
+    They can be used as supplemental documentation. These files are also 
+    available on the NCSA ftp server (ftp.ncsa.uiuc.edu) in:
+ 
+         /HDF/HDF/HDF_Current/release_notes/.
+
+5. Documentation
+   =============
+
+   The HDF documentation can be found on the NCSA ftp server
+   in the directory /HDF/HDF/Documentation/.  The
+   HDF home page is at:
+
+      http://hdf.ncsa.uiuc.edu/
+
+6. FAQ
+   ===
+   An FAQ is available on our ftp server, as well as at:
+      http://hdf.ncsa.uiuc.edu/HDF-FAQ.html 
+   
+
+7. HDF Java Products
+   =================
+   The HDF Java Interface and Java HDF Viewer are built 
+   separately after the library.  See:
+      http://hdf.ncsa.uiuc.edu/java-hdf-html/ 
+
+
+8. HELP
+   ====
+   If you have any questions or comments, or would like to be
+   added to or removed from our hdfnews email list, contact us
+   at:
+
+      hdfhelp at ncsa.uiuc.edu
+
+

Added: packages/libhdf4/branches/upstream/current/MAKEVMS.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/MAKEVMS.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/MAKEVMS.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,212 @@
+$ set def [.HDF4r13]
+$ !
+$ write sys$output "Start building HDF"
+$ !
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
+$ ! Create directories [.lib], [.bin], [.include]
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ !
+$ hdftop = F$DIRECTORY()
+$ len = F$LENGTH(hdftop)
+$ hdftop_dir = F$EXTRACT(0,len-1,hdftop)
+$ subdir = hdftop + "LIB.DIR"
+$ lib_directory = hdftop_dir + ".LIB]"
+$ if F$SEARCH(subdir) .NES. ""
+$ then
+$    write sys$output "''subdir' directory exists, will not create"
+$ else
+$    write sys$output "Creating ''subdir'..."
+$    create/dir 'lib_directory'
+$    write sys$output "Done"
+$ endif 
+$ subdir = hdftop + "BIN.DIR"
+$ bin_directory = hdftop_dir + ".BIN]"
+$ if F$SEARCH(subdir) .NES. ""
+$ then
+$    write sys$output "''subdir' directory exists, will not create"
+$ else
+$    write sys$output "Creating ''subdir'..."
+$    create/dir 'bin_directory'
+$    write sys$output "Done"
+$ endif 
+$ subdir = hdftop + "INCLUDE.DIR"
+$ include_directory = hdftop_dir + ".INCLUDE]"
+$ if F$SEARCH(subdir) .NES. "" 
+$ then
+$    write sys$output "''subdir' directory exists, will not create"
+$ else
+$    write sys$output "Creating ''subdir'..."
+$    create/dir 'include_directory'
+$    write sys$output "Done"
+$ endif
+$ ! 
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ ! Build JPEG Library and copy library and include files to [.lib] and
+$ ! [.include] subdirectories.
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ !
+$ write sys$output " Building JPEG"
+$ jpeg_library = hdftop_dir +".HDF.JPEG]"
+$ set def 'jpeg_library'
+$ copy jconfig.vms jconfig.h
+$ copy makefile.vms make.com
+$ @make
+$ copy libjpeg.olb 'lib_directory'
+$ copy jconfig.h 'include_directory'
+$ copy jerror.h  'include_directory'
+$ copy jmorecfg.h 'include_directory'
+$ copy jpeglib.h  'include_directory'
+$ delete *.obj;*
+$ delete *.exe;*
+$ write sys$output "Done"
+$ !
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ ! Build GZIP Library and copy library and include files to [.lib] and
+$ ! [.include] subdirectories.
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ !
+$ write sys$output " Building ZLIB"
+$ zlib_library = hdftop_dir +".HDF.ZLIB]"
+$ set def 'zlib_library'
+$ copy make_vms.com make.com
+$ @make
+$ run example
+$ copy libz.olb 'lib_directory'
+$ copy zconf.h 'include_directory'
+$ copy zlib.h  'include_directory'
+$ delete *.obj;*
+$ delete *.exe;*
+$ write sys$output "Done"
+$ !
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ ! Make full DF library.
+$ ! Fortran stubs will be also built.
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ !
+$ write sys$output " Building DF Library"
+$ hdfsrc_directory = hdftop_dir + ".HDF.SRC]"
+$ set def 'hdfsrc_directory'
+$ @makenof
+$ !
+$ ! If you do not want to include the HDF Fortran interfaces, comment
+$ !   out the following command.
+$ !
+$ @makefs
+$ !
+$ ! Move the files to their correct destinations
+$ !
+$ copy df.olb 'lib_directory'
+$ copy *.h    'include_directory'
+$ copy dffunc.* 'include_directory'
+$ delete *.obj;*
+$ !
+$ ! Build the HDF utility programs
+$ !
+$ hdfutil_directory = hdftop_dir + ".HDF.UTIL]"
+$ set default 'hdfutil_directory'
+$ @makeutil
+$ !
+$ ! Move the HDF utilities to where they belong and define symbols
+$ !
+$ copy *.exe 'bin_directory'
+$ define hdf$bin 'bin_directory'
+$ !
+$ @setuputils
+$ !
+$ ! Build the test programs
+$ !
+$ hdftest_directory = hdftop_dir + ".HDF.TEST]"
+$ set default 'hdftest_directory'
+$ @make
+$ !
+$ delete *.obj;*
+$ write sys$output "Testing..."
+$ create/dir [.testdir]
+$ !
+$ ! Run testhdf
+$ !
+$ run testhdf
+$ !
+$ ! Cleanup
+$ !
+$ copy tvattr.hdf tvattr.dat
+$ delete [...]*.hdf;*
+$ !
+$ ! Run fortest 
+$ !
+$ run fortest
+$ !
+$ write sys$output " Done with DF library"
+$ !
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ ! Make full MFHDF library.
+$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ !
+$ ! Build XDR
+$ !
+$ xdr_directory = hdftop_dir + ".MFHDF.XDR]"
+$ set def 'xdr_directory'
+$ write sys$output "Building XDR..."
+$ @make  
+$ write sys$output "Testing XDR..."
+$ run xdrtest
+$ write sys$output "Done"
+$ !
+$ ! Build MFHDF
+$ !
+$ mfhdflibsrc_directory = hdftop_dir + ".MFHDF.LIBSRC]"
+$ set def 'mfhdflibsrc_directory'
+$ write sys$output "Building and testing MFHDF Library..."
+$ @make
+$ copy *.h    'include_directory'
+$ write sys$output "Done"
+$ !
+$ ! Testing netCDF library
+$ ! 
+$ nctest_directory = hdftop_dir + ".MFHDF.NCTEST]"
+$ set def 'nctest_directory'
+$ write sys$output "Testing netCDF..."
+$ @make
+$ write sys$output "Done"
+$ !
+$ ! Adding Fortran interfaces to the MFHDF Library
+$ !
+$ fortran_directory = hdftop_dir + ".MFHDF.FORTRAN.VMS]"
+$ set def 'fortran_directory'
+$ write sys$output "Adding Fortran routines to MFHDF Library"
+$ write sys$output " and running the tests..."
+$ @make
+$ copy netcdf.inc 'include_directory'
+$ write sys$output "Done"
+$ !
+$ ! Build NCDUMP utility
+$ !
+$ ncdump_directory = hdftop_dir + ".MFHDF.NCDUMP]"
+$ set def 'ncdump_directory'
+$ @make
+$ write sys$output "NCDUMP has been built"
+$ copy ncdump.exe 'bin_directory'
+$ !
+$ ! Build NCGEN
+$ !
+$ ncgen_directory = hdftop_dir + ".MFHDF.NCGEN]"
+$ set def 'ncgen_directory'
+$ @make
+$ write sys$output "NCGEN has been built"
+$ copy ncgen.exe 'bin_directory'
+$ write sys$output "Testing..."
+$ @test
+$ write sys$output "Done"
+$ !
+$ ! Build and test HDP
+$ !
+$ hdp_directory = hdftop_dir + ".MFHDF.DUMPER]"
+$ set def 'hdp_directory'
+$ write sys$output "Building HDP..."
+$ @make
+$ copy hdp.exe 'bin_directory'
+$ write sys$output "Testing HDP..."
+$ @test
+$ set def 'hdftop'
+$ write sys$output "........That's All, Folks!........." 
+$ exit


Property changes on: packages/libhdf4/branches/upstream/current/MAKEVMS.COM
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,535 @@
+# $Id: Makefile.in,v 1.40 1999/06/20 01:40:35 acheng Exp $
+#
+# Makefile to build HDF & netcdf libraries and utilities...etc
+#
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = .
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi -O
+FC = f77
+FFLAGS= -O
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefix)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+
+# ############# End of system configuration section. ###############
+
+PACKAGE	 = HDF
+VERSION  = 4.0
+MANIFEST = $(DISTFILES)
+DISTFILES = INSTALL README \
+	Makefile.in configure configure.in config.guess config.sub \
+	install-sh mkinstalldirs move-if-change \
+	config/mh-aix config/mh-alpha config/mh-convex \
+	config/mh-decstation config/mh-fbsd config/mh-hpux config/mh-irix32 \
+	config/mh-irix4 config/mh-irix5 config/mh-irix6 config/mh-linux \
+	config/mh-solaris config/mh-solarisx86 config/mh-sun config/mh-unicos
+
+HDFDIR    = hdf
+NETCDFDIR = mfhdf
+MANDIR = man
+SUBDIRS= $(HDFDIR) $(NETCDFDIR) $(MANDIR)
+OTHERDIRS= config
+
+# Location where the HDF include files are located
+HDFINC= `pwd`/hdf/src
+
+# Location where the HDF library is located
+HDFLIB= `pwd`/hdf/src
+
+# ==> where is your PABLO include files
+PABLO_HINC= `pwd`/hdf/pablo
+
+# ==> where is your FMPOOL include files
+FMPOOL_INC= `pwd`/hdf/fmpool
+
+#
+# Flags to recursively send to make to overide ones inserted by Configure
+#
+
+HDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        ACDEFS="$(ACDEFS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        FMPOOL_FLAGS="$(FMPOOL_FLAGS)" \
+        PABLO_FLAGS="$(PABLO_FLAGS)" \
+        PABLO_INCLUDE="$(PABLO_INCLUDE)" \
+        MACHINE="$(MACHINE)" \
+        HDFINC="$(HDFINC)" \
+        HDFLIB="$(HDFLIB)" 
+
+
+NETCDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        ACDEFS="$(ACDEFS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        FMPOOL_FLAGS="$(FMPOOL_FLAGS)" \
+        MACHINE="$(MACHINE)" \
+        HDFINC="$(HDFINC)" \
+        HDFLIB="$(HDFLIB)" 
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	FFLAGS="$(FFLAGS)" \
+	prefix="$(prefix)"
+
+#
+#General rules
+#
+
+all:	
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subdn
+
+HDF:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="all" \
+          SUBDIRS="$(HDFDIR)" subd
+
+NETCDF:
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG="all" \
+          SUBDIRS="$(NETCDFDIR)" subdn
+
+test:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="test-hdf" \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=test-utils \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subdn
+
+allnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=allnofortran \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) FC=NONE TARG=all \
+          SUBDIRS="$(NETCDFDIR)" subdn
+
+testnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=test-hdfnofortran \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) FC=NONE TARG=test \
+          SUBDIRS="$(NETCDFDIR)" subdn
+
+test-hdf:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=test-utils \
+          SUBDIRS="$(HDFDIR)" subd
+
+test-hdf-libs:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+
+test-hdf-utils:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=test-utils \
+          SUBDIRS="$(HDFDIR)" subd
+
+test-mfhdf:
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=test \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+hdf-test:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+
+mfhdf-test:
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+hdf-allnofortran: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="allnofortran" \
+          SUBDIRS="$(HDFDIR)" subd
+
+hdf-libnofortran: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="libnofortran" \
+          SUBDIRS="$(HDFDIR)" subd
+
+test-hdfnofortran: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="test-hdfnofortran" \
+          SUBDIRS="$(HDFDIR)" subd
+
+hdf-testnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="testnofortran" \
+          SUBDIRS="$(HDFDIR)" subd
+
+hdf-libnostub: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="libnostub" \
+          SUBDIRS="$(HDFDIR)" subd
+
+hdf-allnostub: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="allnostub" \
+          SUBDIRS="$(HDFDIR)" subd
+
+hdf-utilities: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="utilities" \
+          SUBDIRS="$(HDFDIR)" subd
+
+hdf-debug: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="debug" \
+          SUBDIRS="$(HDFDIR)" subd
+
+libs: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG="libmfhdf" \
+          SUBDIRS="$(NETCDFDIR)" subdn
+
+hdf-libs: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="libs" \
+          SUBDIRS="$(HDFDIR)" subd
+
+libdf: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+
+libjpeg: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+
+libz: 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+
+libmfhdf:
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subdn
+
+install:	
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install \
+          SUBDIRS="$(MANDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=install \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+install-libs:	
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+install-includes:	
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+install-utils:	
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+install-hdf:	
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install \
+          SUBDIRS="$(HDFDIR)" subd
+
+install-hdf-libs:	
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install-libs \
+          SUBDIRS="$(HDFDIR)" subd
+
+install-hdf-utils:	
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install-utils \
+          SUBDIRS="$(HDFDIR)" subd
+
+install-mfhdf:	
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=install \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+install-mfhdf-libs:	
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=install-libs \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+install-mfhdf-utils:	
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=install-utils \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+install-man:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install \
+          SUBDIRS="$(MANDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+install-hdf-man:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install \
+          SUBDIRS="$(MANDIR)" subd
+
+install-mfhdf-man:
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subd
+hdfclean:		
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="clean" \
+          SUBDIRS="$(HDFDIR)" subd
+
+mfhdfclean:		
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG="clean" \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+clean:		
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(MANDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subdn
+
+hdfdistclean:		
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG="distclean" \
+          SUBDIRS="$(HDFDIR)" subd
+
+mfhdfdistclean:		
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG="distclean" \
+          SUBDIRS="$(NETCDFDIR)" subd
+
+distclean:	
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(HDFDIR)" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(MANDIR)" subd
+	@$(MAKE) $(MFLAGS) $(NETCDF_FLAGS) TARG=$@ \
+          SUBDIRS="$(NETCDFDIR)" subdn
+	-$(RM) $(RMFLAGS) config.status Makefile
+
+help:
+	@echo ""
+	@echo "Make supports the following targets"
+	@echo "   (Use FC=NONE to exclude fortran support.)"
+	@echo "   (E.g., make FC=NONE all )"
+	@echo "make help    - prints this usage section"
+	@echo "make all     - (DEFAULT) makes both HDF and netCDF packages"
+	@echo "make HDF     - makes HDF library,utilities, and tests"
+	@echo "make NETCDF  - makes NETCDF package"
+	@echo "make hdf-test          - makes HDF library and tests" 
+	@echo "make hdf-utilities     - makes HDF library and utilities"
+	@echo "make libs              - makes HDF, IJG JPEG and mfhdf libraries only"
+	@echo "make hdf-libs          - makes HDF and IJG JPEG libraries only"
+	@echo "make libdf             - makes HDF library"
+	@echo "make libjpeg           - makes IJG JPEG library"
+	@echo "make libz              - makes GZIP deflate library"
+	@echo "make libmfhdf          - makes mfhdf library"
+	@echo "make test              - run both HDF and NETCDF tests"
+	@echo "make test-mfhdf        - run NETCDF tests" 
+	@echo "make test-hdf          - run HDF library and utilities tests" 
+	@echo "make test-hdf-libs     - run HDF library tests" 
+	@echo "make test-hdf-utils    - run HDF utilities test" 
+	@echo "make install           - install HDF,netCDF libraries,"
+	@echo "                         utilites, and includes" 
+	@echo "make install-libs      - install HDF,netCDF libraries and includes"
+	@echo "make install-includes  - install HDF,netCDF includes"
+	@echo "make install-utils     - install HDF,netCDF utilities"
+	@echo "make install-man       - install HDF and netCDF man pages"
+	@echo "make install-hdf       - install HDF library, utilities and includes"
+	@echo "make install-hdf-libs  - install HDF library and includes"
+	@echo "make install-hdf-utils - install utilities"
+	@echo "make install-hdf-man   - install HDF man pages"
+	@echo "make install-mfhdf     - install netCDF library, utilities and includes"
+	@echo "make install-mfhdf-libs - install netCDF library and includes"
+	@echo "make install-mfhdf-utils - install netCDF utilities"
+	@echo "make install-mfhdf-man   - install netCDF man pages"
+	@echo "make clean        - cleans up HDF and NETCDF packages(*.o,libdf.a,..)"
+	@echo "make distclean    - cleans up HDF and NETCDF packages including"
+	@echo "                    configuration(Makefiles,config.status,..)"
+	@echo "make hdfclean     - cleans up HDF package(*.o,libdf.a,..et)"
+	@echo "make hdfdistclean - cleans up HDF package including"
+	@echo "                    configuration(Makefiles,config.status,..)"
+	@echo "make mfhdfclean   - cleans up NETCDF package(*.o,libmfhdf.a,..et)"
+	@echo "make mfhdfdistclean - cleans up NETCDF package including"
+	@echo "                       configuration(Makefiles,config.status,..)"
+
+# target for recursive directory make
+subd:
+	@for dir in $(SUBDIRS); do \
+          (cd $$dir; echo Making \`$(TARG)\' in `pwd`; \
+              $(MAKE) $(MFLAGS) $(HDF_FLAGS) $(TARG)); \
+	done
+
+subdn:
+	@for dir in $(SUBDIRS); do \
+          (cd $$dir; echo Making \`$(TARG)\' in `pwd`; \
+              $(MAKE) $(MFLAGS) $(NETCDF_FLAGS) $(TARG)); \
+	done
+
+# For making distribution
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)
+dist: $(DISTFILES)
+	rm -rf $(distdir)
+	mkdir $(distdir)
+	chmod 777 $(distdir)
+	for subdir in $(OTHERDIRS); do \
+	  mkdir $(distdir)/$$subdir || exit 1; \
+	done
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir);}; \
+	done
+	for subdir in $(SUBDIRS); do \
+	  echo making $@ in $$subdir; \
+	  mkdir $(distdir)/$$subdir || exit 1; \
+	  (cd $$subdir && $(MAKE) $@) || exit 1; \
+	done
+	chmod -R a+r $(distdir)
+	tar chof $(distdir).tar $(distdir)
+	compress $(distdir).tar
+	rm -rf $(distdir)
+
+ftp:	$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE_IT
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE_IT
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# For the justification of the following Makefile rules, see node
+# `Automatic Remaking' in GNU Autoconf documentation.
+#
+#Makefile: $(TOP_SRCDIR)/config.status Makefile.in
+#	CONFIG_FILES=$@ CONFIG_HEADERS= $(TOP_SRCDIR)/config.status
+
+#config.h: stamp-h
+
+#stamp-h: $(TOP_SRCDIR)/config.status $(srcdir)/config.h.in
+#	CONFIG_FILES= CONFIG_HEADERS=config.h $(TOP_SRCDIR)/config.status
+
+#config.status: configure
+#	$(TOP_SRCDIR)/config.status --recheck
+
+#configure: configure.in
+#	cd $(srcdir) && autoconf
+
+#config.h.in: stamp-h.in
+
+#stamp-h.in: configure.in
+#	cd $(srcdir) && autoheader
+# Use echo instead of date to avoid spurious conflicts for
+# people who use CVS, since stamp-h.in is distributed.
+#	echo > $(srcdir)/$@
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+
+# dummy target as a dependency for forcing a rule to be always executed
+FORCE_IT:

Added: packages/libhdf4/branches/upstream/current/README
===================================================================
--- packages/libhdf4/branches/upstream/current/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,86 @@
+               README for HDF 4.1r4 Version
+               ----------------------------
+
+Obtaining the latest version
+----------------------------
+ The most recent version of the distribution can be obtained from
+ the NCSA ftp archive site at:
+
+     ftp://ftp.ncsa.uiuc.edu/HDF/HDF/HDF_Current/
+
+Distribution Layout
+-------------------
+ There are five subdirectories in this directory:
+
+   config -- contains machine dependent makefile fragments(mh-<os>). 
+
+   hdf    -- contains the source code for the HDF 'base library', the 
+             the multi_file annotation interface, the multi_file raster
+             image interface, HDF command line utilities (hdp, the hdf 
+             dumper is in mfhdf/), Pablo instrumentation support, 
+             and a test suite. It also contains the software
+             distributions for IJPEG(hdf/jpeg) and ZLIB(hdf/zlib) 
+             which are required by the HDF library. 
+             Please see the README in each directory for further info
+             on each package. 
+
+   mfhdf  -- contains the netCDF(mfhdf) part of the HDF/mfhdf distribution
+             and HDF dumper utility (hdp).
+
+   man    -- incomplete set of man page(s) for HDF.
+
+   release_notes -- descriptions on new features and bug fixes in this
+                    release. Files in this sub-directory can be used 
+                    as supplemental documentation for HDF4.1. These files 
+                    are also available on the NCSA ftp server, 
+                    in /HDF/HDF/HDF_Current/release_notes/.
+
+Third Party Software Requirements:
+---------------------------------
+ 1. IJPEG distribution release 6b(libjpeg.a). The "official" site 
+    for this is ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
+
+
+ 2. ZLIB 1.1.3(libz.a) distribution.  
+
+ Both of these distributions are included with this distribution
+ in 'hdf/jpeg' and 'hdf/zlib'. The HDF/mfhdf base distribution
+ in known to work with these versions only.
+
+System Requirements
+-------------------
+ To build the HDF library from source, you need:
+
+   * an ANSI C compiler. The native ANSI compilers on the above 
+     platforms are supported. On platforms where no ANSI compiler
+     was available the free GNU ANSI compiler GCC was used.
+
+   * a Fortran 77 (F90 for Crays) compiler if you want Fortran support.
+     You can compile both libraries without Fortran support by setting 
+     the Fortran compiler variable 'FC = NONE' in the respective
+     makefile fragment(mh-<os>) found in the top-level 'config'
+     directory. See the INSTALL file for further details on 
+     configuration and installation.
+
+Configuring/Testing/Installing 
+------------------------------
+ See the INSTALL file for instructions on configuring,
+ testing and installing for Unix and non-UNIX systems.
+
+DOCUMENTATION/FAQ/HELP
+----------------------
+ The HDF documentation can be found on the NCSA ftp server
+ in the directory /HDF/HDF/Documentation.  The HDF home page is at:
+
+      http://hdf.ncsa.uiuc.edu/
+
+ An FAQ is available on our ftp server, as well as under
+ "Information about HDF" in the home page.
+
+ If you have any questions or comments, or would like to be
+ added to or removed from our hdfnews email list, contact us
+ at:
+
+      hdfhelp at ncsa.uiuc.edu
+
+

Added: packages/libhdf4/branches/upstream/current/Win32.nofortran.zip
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/Win32.nofortran.zip
___________________________________________________________________
Name: svn:executable
   + 
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/Win32.zip
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/Win32.zip
___________________________________________________________________
Name: svn:executable
   + 
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/config/mh-aix
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-aix	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-aix	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,182 @@
+# $Id: mh-aix,v 1.14 1998/09/16 19:31:09 dwells Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+#Using ANSI compilier
+CC= xlc -qlanglvl=ansi
+#CC= gcc
+CFLAGS= -O
+
+# Fortran compilier
+FC = f77
+FFLAGS = -O
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= aix
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 

Added: packages/libhdf4/branches/upstream/current/config/mh-alpha
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-alpha	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-alpha	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,183 @@
+# $Id: mh-alpha,v 1.16 2000/03/01 17:11:44 epourmal Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+# This file is used for both the DEC Unix and Linux operating systems, running
+#    on DEC Alpha CPUs
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS= -Olimit 2048 -std1
+
+# Fortran compilier
+FC = f77 
+FFLAGS = 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= osf
+
+CPP      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+SWAP          = -DSWAP
+#SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -D_GNU_SOURCE
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS#
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 

Added: packages/libhdf4/branches/upstream/current/config/mh-decstation
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-decstation	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-decstation	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,181 @@
+# $Id: mh-decstation,v 1.11 1998/09/16 19:31:11 dwells Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+#Using ANSI compilier
+CC=gcc
+CFLAGS= -ansi
+
+# Fortran compilier
+FC = f77
+FFLAGS =
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= ultrix
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-fbsd
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-fbsd	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-fbsd	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,185 @@
+# $Id: mh-fbsd,v 1.20 2000/08/29 13:55:16 koziol Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+CFLAGS=-ansi -Wall -pedantic -g
+#CFLAGS=-ansi -Wall -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wmissing-prototypes -Wnested-externs -pedantic -O2
+#CFLAGS=-ansi -Wall -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wnested-externs -pedantic -O2
+#
+#Using ANSI compilier
+CC=cc
+#CFLAGS=
+
+# Fortran compilier
+FC = f77
+FFLAGS = -O
+#FFLAGS = -g
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= freebsd
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+SWAP          = -DSWAP
+#SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+#XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-fujivp
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-fujivp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-fujivp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,184 @@
+# $Id: mh-fujivp,v 1.6 1998/09/16 19:31:12 dwells Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi
+#CFLAGS=-ansi -Wall -pedantic -g
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS=-O
+
+# Fortran compilier
+FC = NONE
+#FC = frt
+FFLAGS = -Ab -Sw
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rs
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier, Fujitsu?
+LIBSX=-lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for  File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd, fujivp
+OS = fujivp
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+#XDR_LIBOBJS    =
+
+# Location of library, sometimes the sunos requires -lsun
+# Fujitsu requires -lnsl
+LD_XDR		= -lnsl
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 

Added: packages/libhdf4/branches/upstream/current/config/mh-hpux
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-hpux	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-hpux	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,183 @@
+# $Id: mh-hpux,v 1.21 1999/05/04 18:12:06 bljones Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi -g
+#
+#Using HP-ANSI compilier also needs LIBSX = -lm(see below)
+CC=cc
+CFLAGS=-Ae -s
+
+# Fortran compilier, possible values fort77, f77, cf77 and fc
+FC = f77
+FFLAGS = -s
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= hpux
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= $(TOP_SRCDIR)/mfhdf/port/uddummy.o 
+
+

Added: packages/libhdf4/branches/upstream/current/config/mh-hpux11
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-hpux11	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-hpux11	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,183 @@
+# $Id: mh-hpux11,v 1.1 2000/08/30 18:41:46 wendling Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi -g
+#
+#Using HP-ANSI compilier also needs LIBSX = -lm(see below)
+CC=cc
+CFLAGS=-Ae -s
+
+# Fortran compilier, possible values fort77, f77, cf77 and fc
+FC = f77
+FFLAGS = -s
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+LIBSX = -lm -lnsl
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= hpux
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= $(TOP_SRCDIR)/mfhdf/port/uddummy.o 
+
+

Added: packages/libhdf4/branches/upstream/current/config/mh-ia64
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-ia64	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-ia64	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,182 @@
+# $Id: mh-ia64,v 1.1 2000/05/23 18:07:01 acheng Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+# This file is used for IA64 running Linux
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS= -DNDEBUG -DHDF -DBIG_LONGS -DIA64
+
+# Fortran compilier
+FC = f90
+FFLAGS = 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= Linux
+
+CPP      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+SWAP          = -DSWAP
+#SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -D_GNU_SOURCE
+#
+# for IRIX6(64-bit) 
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -DIA64
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 

Added: packages/libhdf4/branches/upstream/current/config/mh-irix32
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-irix32	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-irix32	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,195 @@
+# $Id: mh-irix32,v 1.17 2000/08/29 00:30:39 acheng Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Machine/OS: SGI/IRIX 6.x (32-bit mode)
+#
+# This uses the -n32 options.
+# If you prefer other options like, you may change them in
+# the following CFLAGS and FFLAGS.
+# See also the netCDF section dealing with CPPFLAGS_HDF to
+# change the options there too.
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+# Using ANSI compilier
+CC=cc
+# IRIX 6.1 has an error in its system include file, stdio.h,
+# that gives incorrect warning message when both "-n32" and "-ansi"
+# flags are used.
+# Turn off some incorrect or harmless warnings.
+# 1521 -- about #ident not standard.  SGI puts them in their system header files
+warn=-woff 1521
+CFLAGS=-ansi -n32 -O -s $(warn)
+
+# Fortran compilier
+FC = f90
+FFLAGS =-n32 -O -s
+
+# Name of archive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rs
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= irix
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = -64 $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.x (32-bit mode).
+CPPFLAGS_HDF  = -n32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+#CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-irix5
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-irix5	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-irix5	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,185 @@
+# $Id: mh-irix5,v 1.15 1998/09/16 19:31:15 dwells Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+#Using ANSI compilier
+CC=cc
+#CFLAGS=-ansi -O -s -pedantic -fullwarn -wlint,-p -woff 828,841,822
+#CFLAGS=-ansi -O -s -pedantic -fullwarn -wlint,-p -woff 828,841,822,826,852,813
+CFLAGS=-ansi -O -s
+#CFLAGS=-ansi -g
+
+# Fortran compilier
+FC = f77
+FFLAGS = -O -s
+
+# Name of archive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rs
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= irix
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-irix6
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-irix6	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-irix6	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,185 @@
+# $Id: mh-irix6,v 1.17 2000/08/29 00:30:39 acheng Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+# Using ANSI compilier
+CC=cc
+# turn off some incorrect or harmless warnings.
+# 1429 -- about long long as non-standard.  It is in the new C standard.
+# 1521 -- about #ident not standard.  SGI puts them in their system header files
+warn=-woff 1429,1521
+CFLAGS=-ansi -64 -O -s $(warn)
+
+# Fortran compilier
+FC = f90
+FFLAGS =-64 -O -s
+
+# Name of archive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rs
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= irix
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+CPPFLAGS_HDF  = -ansi -64 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.x (32-bit mode).
+# CPPFLAGS_HDF  = -n32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+#CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-linux
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-linux	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-linux	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,180 @@
+# $Id: mh-linux,v 1.14 1999/05/04 17:39:49 mcgrath Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+CC=gcc
+CFLAGS=-ansi -D_BSD_SOURCE
+
+# Fortran compilier
+#FC = f77
+#FC = NONE
+FC = g77
+FFLAGS = 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= Linux
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+SWAP          = -DSWAP
+#SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+#CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+#LEX	= lex    # GNU flex?
+LEX	= flex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-mac
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-mac	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-mac	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,187 @@
+# $Id: mh-mac,v 1.6 1999/05/04 21:48:16 smitchel Exp $
+
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# This is a fake makefile fragment for the Macintosh
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+#
+# Compiliers:
+# For gcc version
+CC=gcc
+CFLAGS=-ansi -O
+#CFLAGS=-ansi -Wall -pedantic -g
+#
+#Using ANSI compilier
+#CC=cc
+#CFLAGS=
+
+# Fortran compilier
+FC = f77
+FFLAGS =
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+# LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= sunos
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-solaris
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-solaris	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-solaris	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,184 @@
+# $Id: mh-solaris,v 1.15 1998/09/16 19:31:17 dwells Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+#Using ANSI compilier also needs LIBSX = -lm(see below)
+CC=cc
+#CFLAGS= -Xc -xO2 -g -v
+CFLAGS= -Xc -xO2
+
+# Fortran compilier
+FC = f77
+#FFLAGS = -g
+FFLAGS = -O
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= solaris
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+# Solaris requires -lnsl
+LD_XDR		= -lnsl
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-solarisx86
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-solarisx86	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-solarisx86	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,182 @@
+# $Id: mh-solarisx86,v 1.11 1998/09/16 19:31:18 dwells Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+CC=gcc
+CFLAGS=-ansi -O
+#
+#Using ANSI compilier
+#CC=cc
+#CFLAGS= -Xa
+
+# Fortran compilier
+FC = NONE
+FFLAGS = -O
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= solarisx86
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+SWAP          = -DSWAP
+#SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+# Solaris requires -lnsl
+LD_XDR      = -lnsl
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 

Added: packages/libhdf4/branches/upstream/current/config/mh-sun
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-sun	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-sun	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,183 @@
+# $Id: mh-sun,v 1.15 1998/09/16 19:31:19 dwells Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+CC=gcc
+CFLAGS=-ansi  
+#CFLAGS=-ansi -Wall -pedantic -g
+#
+#Using ANSI compilier
+#CC=cc
+#CFLAGS=
+
+# Fortran compilier
+FC = f77
+FFLAGS = -f
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= sunos
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-t3e
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-t3e	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-t3e	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,184 @@
+# $Id: mh-t3e,v 1.10 1999/04/17 20:18:51 acheng Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS=-X m -s
+
+# Fortran compilier
+# the -Wl"-Dpermok=yes" is for cld to permit execution mode on even if
+# warnings are encountered.
+FC = f90
+FFLAGS =-X m -Wl"-Dpermok=yes" -Wl"-s"
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= craympp
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+#CPP_XDR		= -I/usr/include/rpc
+CPP_XDR	= -I../xdr
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+#XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config/mh-unicos
===================================================================
--- packages/libhdf4/branches/upstream/current/config/mh-unicos	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config/mh-unicos	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,182 @@
+# $Id: mh-unicos,v 1.12 1998/09/16 19:31:20 dwells Exp $
+
+# You can override the following variables here
+#
+# Sections in Host makefile fragments
+# ----------------------------------:
+# 1. General Macros for HDF
+# 2. Macros for Pablo Instrumentation
+# 3. Macros for File Cache
+# 4. General macros for NETCDF
+# 4.1 XDR Macros for NETCDF
+# 4.2 libsrc Macros for NETCDF
+# 4.3 Port Macros for NETCDF
+#
+
+# ------------ General Macros for HDF --------------------
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+#
+# Compiliers:
+# For gcc version
+#CC=gcc
+#CFLAGS=-ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS=-O -s
+
+# Fortran compilier
+FC = f90
+FFLAGS =-O 1
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Extra libraries to be include like '-lm' for fabs()
+# e.g with naitve HP-ANSI compilier
+#LIBSX = -lm
+
+# ------------ 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_INCDIR' to the Pablo distribution 
+# include directory to get to files 'IOTrace.h', 'IOTrace_SD.h' and others.
+
+#PABLO_FLAGS  = -DHAVE_PABLO
+#PABLO_INCDIR = /usr/local/include/pablo-5.1
+#PABLO_INCLUDE = -I$(PABLO_INCDIR)
+
+# ------------ Macros for File Cache(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
+
+# ------------ General Macros for NETCDF --------------------
+# Operating system, Used in fortran directory to generate fortran
+# wrappers. Possible values are osf, aix, hpux, irix, sunos, ultrix
+# unicos, convex, Linux, freebsd
+OS	= unicos
+
+CPP	      = $(CC) -E
+
+# for endianess, for little endian byte order need -DSWAP
+# for FreeBSD and Linux(anny x86 UNIX)
+#SWAP          = -DSWAP
+SWAP          = 
+
+# for 32bit 'network long' integer, possible value -DNETLONG=int
+NETLONG       = 
+
+# additional CFLAGS
+CFLAGS_NETCDF = 
+
+# Additional flags for preproccesor. Some no longer used because
+#   library now requires ANSI compilier.
+#
+# for no function prototypes add -DNO_HAVE_PROTOTYPES
+# for no strerror()          add -DNO_STRERROR
+# for no variadic function support add -DNO_STDARG
+#
+# They all require -DHDF and -DNDEBUG 
+# Any special preprocessor requirements go here
+#
+# for Unicos 
+CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_SHORTS -DBIG_LONGS
+#
+# for OSF(dec alpha) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS -std1
+#
+# for IRIX6(64-bit) 
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DBIG_LONGS
+#
+# for AIX
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -D_ALL_SOURCE
+#
+# for Sunos and Linux
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF -DNO_STRERROR
+#
+# for IRIX6.0 (32-bit mode). If you prefer other 32 bit option like -n32, 
+#  replace '-32' below
+# CPPFLAGS_HDF  = -32 $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+#
+# normal
+# CPPFLAGS_HDF  = $(FMPOOL_FLAGS) -DNDEBUG -DHDF
+
+#
+# Unix commands/utilities
+#
+# neqn(1)
+NEQN	= neqn
+# tbl(1)
+TBL	= tbl
+# which(1)
+WHICH	= which
+# lex(1)
+LEX	= lex    # GNU flex?
+# yacc(1)
+YACC	= yacc   # GNU bison?
+
+#diff(1)
+DIFF    = diff   # GNU diff?
+DIFF_FLAGS = -w
+
+# Other Macros
+NCDUMP	= 
+NCGEN	= 
+FTPDIR	= 
+VERSION_NETCDF	= 2.3.2
+
+# ------------ XDR Macros for NETCDF --------------------
+# This is where the location of system XDR library includes
+# and location of the library are set
+#
+# Location of <xdr.h> if you are using the system
+# one, Else you need to comment it out
+CPP_XDR		= -I/usr/include/rpc
+#CPP_XDR =
+
+# If XDR library not present on the system then you need
+# uncomment the following and comment the one below it
+#XDR_LIBOBJS    = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
+XDR_LIBOBJS     =
+
+# Location of library, sometimes the sunos requires -lsun
+LD_XDR		= 
+
+#
+XDR_INSTALL_DEPS =
+
+# ------------ libsrc Macros for NETCDF --------------------
+# Possible values are xdrposix and xdrstdio
+# This sets which version of the XDR interface to use.
+XDRFILE		= xdrposix
+
+# ------------ Port Macros for NETCDF --------------------
+# Major and Minor numbe of NETCDF library version
+MAJOR_NO	= 2
+MINOR_NO	= 3
+PORT_CFORTRAN	= 
+NEED_FORTC	= 
+FORTC		= 
+
+# possible values are limits.h, float.h, stddef.h, stdlib.h,
+# string.h time.h signal.h unistd.h
+PORT_HEADERS	= 
+PORT_SUBDIRS    =
+LIBOBJS		= uddummy.o 
+

Added: packages/libhdf4/branches/upstream/current/config.guess
===================================================================
--- packages/libhdf4/branches/upstream/current/config.guess	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config.guess	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,495 @@
+#!/bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, 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.
+
+# Written by Per Bothner <bothner at cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# 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 system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 8/24/94.)
+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
+UNAME_PROCESSOR=`(uname -p) 2>/dev/null` || UNAME_PROCESSOR=unknown
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}:${UNAME_PROCESSOR}" in
+    alpha:OSF1:V*:*)
+	# After 1.2, OSF1 uses "V1.3" for uname -r.
+	echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
+	exit 0 ;;
+    alpha:OSF1:*:*)
+	# 1.2 uses "1.2" for uname -r.
+	echo alpha-dec-osf${UNAME_RELEASE}
+        exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit 0;;
+    Pyramid*:OSx*:*:*)
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit 0 ;;
+    sun4*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    i86pc*:SunOS:*:*)
+	echo i386-sun-solaris2${UNAME_RELEASE}
+	exit 0 ;;
+    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 0 ;;
+    sun4*:SunOS:*:*)
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit 0 ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    mips:*:5*:RISCos)
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit 0 ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit 0 ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit 0 ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    AViiON:dgux:*:*)
+	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	fi
+ 	exit 0 ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit 0 ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit 0 ;;
+    *:IRIX64:6.*:*)		# IRIX 64 bits OS
+	echo mips-sgi-irix${UNAME_RELEASE}
+	exit 0 ;;
+    *:IRIX:6.*:*)		# IRIX 6.x but not 64 bits OS
+	echo mips-sgi-irix6_32
+	exit 0 ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix${UNAME_RELEASE}
+	exit 0 ;;
+    i[34]86:AIX:*:*)
+	echo i386-ibm-aix
+	exit 0 ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		sed 's/^		//' << EOF >dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+		rm -f dummy.c dummy
+		echo rs6000-ibm-aix3.2.5
+	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 0 ;;
+    *:AIX:*:4)
+	if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
+		IBM_REV=4.1
+	elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
+		IBM_REV=4.1.1
+	else
+		IBM_REV=4.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit 0 ;;
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit 0 ;;
+    9000/[3478]??:HP-UX:*:*)
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;;
+	    9000/8?? )            HP_ARCH=hppa1.0 ;;
+	esac
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    3050*:HI-UX:*:*)
+	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-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+	rm -f dummy.c dummy
+	echo unknown-hitachi-hiuxwe2
+	exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit 0 ;;
+    hp7??:OSF1:*:* | hp8?7:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit 0 ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*X-MP:*:*:*)
+	echo xmp-cray-unicos
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos
+        exit 0 ;;
+    CRAY-2:*:*:*)
+	echo cray2-cray-unicos
+        exit 0 ;;
+    CRAY*C90:c90:*:*)
+	echo c90-cray-unicos
+        exit 0 ;;
+    CRAY*J90:*:*:*)
+	echo j90-cray-unicos
+        exit 0 ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos
+        exit 0 ;;
+    CRAY*T3*:*:*:*)
+	echo t3e-cray-craympp
+        exit 0 ;;
+    hp3[0-9][05]:NetBSD:*:*)
+	echo m68k-hp-netbsd${UNAME_RELEASE}
+	exit 0 ;;
+    i[34]86:BSD/386:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:FreeBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit 0 ;;
+    *:NetBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	exit 0 ;;
+    *:GNU:*:*)
+	echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit 0 ;;
+    *:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux
+	exit 0 ;;
+# 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.
+    i[34]86:DYNIX/ptx:4*:*)
+	echo i386-sequent-sysv4
+	exit 0 ;;
+    i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+	else
+		echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
+	fi
+	exit 0 ;;
+    i[34]86:*:3.2:*)
+	if /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+		echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
+	elif test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-unknown-sysv32
+	fi
+	exit 0 ;;
+    Intel:Mach:3*:*)
+	echo i386-unknown-mach3
+	exit 0 ;;
+    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 0 ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit 0 ;;
+    M680[234]0:*:R3V[567]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
+        uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4.3 && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m680[234]0:LynxOS:2.2*:*)
+	echo m68k-lynx-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit 0 ;;
+    i[34]86:LynxOS:2.2*:*)
+	echo i386-lynx-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    TSUNAMI:LynxOS:2.2*:*)
+	echo sparc-lynx-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    rs6000:LynxOS:2.2*:*)
+	echo rs6000-lynx-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    *:*:*:*:S370)
+	echo S370-fujitsu-sysv
+	exit 0 ;;
+    *: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 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+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
+  printf ("m68k-sony-newsos\n"); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); 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`;
+  printf ("%s-next-nextstep%s\n", __ARCHITECTURE__,  version==2 ? "2" : "3");
+  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-unknown-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_)
+  printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+  printf ("vax-dec-bsd\n"); exit (0);
+#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-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# 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 0 ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit 0 ;;
+    c34*)
+	echo c34-convex-bsd
+	exit 0 ;;
+    c38*)
+	echo c38-convex-bsd
+	exit 0 ;;
+    c4*)
+	echo c4-convex-bsd
+	exit 0 ;;
+    esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1


Property changes on: packages/libhdf4/branches/upstream/current/config.guess
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/config.sub
===================================================================
--- packages/libhdf4/branches/upstream/current/config.sub	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/config.sub	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,827 @@
+#!/bin/sh
+# Configuration validation subroutine script, version 1.1.
+#   Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+# 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., 675 Mass Ave, Cambridge, MA 02139, 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.
+
+# 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
+# It is wrong to echo any other type of specification.
+
+# First pass through any local machine types.
+case $1 in
+	*local*)
+		echo $1
+		exit 0
+		;;
+	*)
+	;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS (if any).
+basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+if [ $basic_machine != $1 ]
+then os=`echo $1 | sed 's/.*-/-/'`
+else os=; fi
+
+### 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 )
+		os=
+		basic_machine=$1
+		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-lynx)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+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.
+	tahoe | i[3456]86 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
+		| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
+		| alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
+		| powerpc | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
+		| pdp11 | mips64el | mips64orion | mips64orionel )
+		basic_machine=$basic_machine-unknown
+		;;
+	# 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.
+	vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+	      | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* | ia64-* \
+	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+	      | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
+	      | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+	      | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
+	      | pdp11-* | sh-* | powerpc-* | sparc64-* | mips64-* | mipsel-* \
+	      | mips64el-* | mips64orion-* | mips64orionel-* | S370-* )
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-cbm
+		;;
+	amigados)
+		basic_machine=m68k-cbm
+		os=-amigados
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-cbm
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	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 | ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	cray2)
+		basic_machine=cray2-cray
+		os=-unicos
+		;;
+	c90*)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	cray-t3* | t3* | t3*-cray)
+		basic_machine=t3e-cray
+		os=-craympp
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	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
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-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
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i[3456]86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+		os=-sysv32
+		;;
+	i[3456]86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+		os=-sysv4
+		;;
+	i[3456]86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+		os=-sysv
+		;;
+	i[3456]86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+		os=-solaris2
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	irix6_32)
+		basic_machine=mips-sgi
+		os=-irix6_32
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	j90*)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	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
+		;;
+	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
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+        pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pentium-*)
+		# We will change tis to say i586 once there has been
+		# time for various packages to start to recognize that.
+		basic_machine=i486-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	fujitsu | vp | S370)
+		basic_machine=vp-fujitsu
+		os=-sysv
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	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
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+  	mac)
+		basic_machine=m68k-mac
+		os=-macos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t90*)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	xmp)
+		basic_machine=xmp-cray
+		os=-unicos
+		;;
+        xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	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.
+	mips)
+		basic_machine=mips-mips
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sparc)
+		basic_machine=sparc-sun
+		;;
+        cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	*)
+		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
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux|'`
+		;;
+	# 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[3456]* \
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigados* | -msdos* | -newsos* | -unicos* | -craympp | -aos* \
+	      | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
+	      | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+	      | -ptx* | -coff* | -winnt*)
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-xenix)
+		os=-xenix
+		;;
+  	-macos)
+		os=-macos
+		;;
+	-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
+	*-acorn)
+		os=-riscix1.2
+		;;
+        pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigados
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-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
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	*)
+		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
+				;;
+			-lynxos*)
+				vendor=lynx
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs*)
+				vendor=ibm
+				;;
+          -macos*)
+               vendor=apple
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os


Property changes on: packages/libhdf4/branches/upstream/current/config.sub
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/configure
===================================================================
--- packages/libhdf4/branches/upstream/current/configure	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/configure	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1091 @@
+#!/bin/sh
+
+### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
+
+# Configuration script
+# Copyright (C) 1988, 90, 91, 92, 93, 94 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 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# This version has been modified from the original configure script
+# Please report any problems running this configure script to
+# hdfhelp at ncsa.uiuc.edu
+#
+# OLD: Please report any problems running this configure script to
+#      configure at cygnus.com
+#      Please do not send reports about other problems to this address.  See
+#      gdb/README, gas/README, etc., for info on where and how to report
+#      problems about particular tools.
+
+# The orginal file was written by K. Richard Pixley.
+# This file has been modified by HDF group
+#
+# Shell script to create proper links to machine-dependent files in
+# preparation for compilation.
+#
+# If configure succeeds, it leaves its status in config.status.
+# If configure fails after disturbing the status quo, 
+#       config.status is removed.
+#
+
+export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
+
+remove=rm
+hard_link=ln
+symbolic_link='ln -s'
+mkdirprog=mkdir        # what is your make-directory-program
+
+#for Test
+#remove="echo rm"
+#hard_link="echo ln"
+#symbolic_link="echo ln -s"
+
+# clear some things potentially inherited from environment.
+
+Makefile=Makefile
+Makefile_in=Makefile.in
+arguments=$*
+build_alias=
+configdirs=
+exec_prefix=
+exec_prefixoption=
+fatal=
+floating_point=default
+gas=default
+host_alias=NOHOST
+host_makefile_frag=
+moveifchange=
+norecursion=
+other_options=
+package_makefile_frag=
+prefix='$(TOP_SRCDIR)/NewHDF'
+progname=
+program_prefix=
+program_prefixoption=
+program_suffix=
+program_suffixoption=
+program_transform_name=
+program_transform_nameoption=
+redirect=">/dev/null"
+removing=
+site=
+site_makefile_frag=
+site_option=
+srcdir=
+srctrigger=
+subdirs=
+target_alias=NOTARGET
+target_makefile_frag=
+undefs=NOUNDEFS
+version="$Revision: 1.12 $"
+x11=default
+
+### we might need to use some other shell than /bin/sh for running subshells
+#
+config_shell=${CONFIG_SHELL-/bin/sh}
+
+NO_EDIT="This file was generated automatically by configure.  Do not edit."
+
+## this is a little touchy and won't always work, but...
+##
+## if the argv[0] starts with a slash then it is an absolute name that can (and
+## must) be used as is.
+##
+## otherwise, if argv[0] has no slash in it, we can assume that it is on the
+## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
+##
+
+progname=$0
+# if PWD already has a value, it is probably wrong.
+if [ -n "$PWD" ]; then PWD=`pwd`; fi
+
+case "${progname}" in
+/*) ;;
+*/*) ;;
+*)
+        PATH=$PATH:${PWD=`pwd`} ; export PATH
+        ;;
+esac
+
+# Loop over all args
+
+#while :
+for arg
+do
+
+# Break out if there are no more args
+	case $# in
+	0)
+		break
+		;;
+	esac
+
+# Get the first arg, and shuffle
+	option=$1
+	shift
+
+# Make all options have two hyphens
+	orig_option=$option	# Save original for error messages
+	case $option in
+	--*) ;;
+	-*) option=-$option ;;
+	esac
+		
+# Split out the argument for options that take them
+	case $option in
+	--*=*)
+		optarg=`echo $option | sed -e 's/^[^=]*=//'`
+		;;
+# These options have mandatory values.  Since we didn't find an = sign,
+# the value must be in the next argument
+	--b* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
+		optarg=$1
+		shift
+		;;
+	esac
+
+# Now, process the options
+	case $option in
+
+	--build* | --b*)
+		case "$build_alias" in
+		"") build_alias=$optarg ;;
+		*) echo '***' Can only configure for one build machine at a time.  1>&2
+		   fatal=yes
+		   ;;
+		esac
+		;;
+# Accepted for compatibility with new autoconf; ignored.
+	--cache*)
+		;;
+	--disable-*)
+		enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
+		eval $enableopt=no
+		disableoptions="$disableoptions $option"
+		;;
+	--enable-*)
+		case "$option" in
+		*=*)	;;
+		*)	optarg=yes ;;
+		esac
+
+		enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
+		eval $enableopt="$optarg"
+		enableoptions="$enableoptions $option"
+		;;
+	--exec-prefix* | --ex*)
+		exec_prefix=$optarg
+		exec_prefixoption="--exec-prefix=$optarg"
+		;;
+	--gas | --g*)
+		gas=yes
+		;;
+	--help | --he*)
+		fatal=yes
+		;;
+	--host* | --ho*)
+		case $host_alias in
+		NOHOST) host_alias=$optarg ;;
+		*) echo '***' Can only configure for one host at a time.  1>&2
+		   fatal=yes
+		   ;;
+		esac
+		;;
+	--nfp | --nf*)
+		floating_point=no
+		;;
+	--norecursion | --no*)
+		norecursion=yes
+		;;
+	--prefix* | --pre*)
+		prefix=$optarg
+		prefixoption="--prefix=$optarg"
+		;;
+	--program-prefix* | --program-p*)
+		program_prefix=$optarg
+		program_prefixoption="--program-prefix=$optarg"
+		;;
+	--program-suffix* | --program-s*)
+		program_suffix=$optarg
+		program_suffixoption="--program-suffix=$optarg"
+		;;
+	--program-transform-name* | --program-t*)
+		# Double any backslashes or dollar signs in the argument
+		program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
+		program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
+		;;
+	--rm)
+		removing=--rm
+		;;
+	--silent | --sil* | --quiet | --q*)
+		redirect=">/dev/null"
+		verbose=--silent
+		;;
+	--site* | --sit*)
+		site=$optarg
+		site_option="--site=$optarg"
+		;;
+	--srcdir*/ | --sr*/)
+                # Remove trailing slashes.  Otherwise, when the file name gets
+                # bolted into an object file as debug info, it has two slashes
+                # in it.  Ordinarily this is ok, but emacs takes double slash
+                # to mean "forget the first part".
+		srcdir=`echo $optarg | sed -e 's:/$::'`
+		;;
+	--srcdir* | --sr*)
+		srcdir=$optarg
+		;;
+	--target* | --ta*)
+		case $target_alias in
+		NOTARGET) target_alias=$optarg ;;
+		*) echo '***' Can only configure for one target at a time.  1>&2
+		   fatal=yes
+		   ;;
+		esac
+		;;
+	--tmpdir* | --tm*)
+		TMPDIR=$optarg
+		tmpdiroption="--tmpdir=$optarg"
+		;;
+	--verbose | --v | --verb*)
+		redirect=
+		verbose=--verbose
+		;;
+	--version | --V | --vers*)
+		echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
+		exit 0
+		;;
+	--with-*)
+		case "$option" in
+		*=*)	;;
+		*)	optarg=yes ;;
+		esac
+
+		withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
+		eval $withopt="$optarg"
+		withoptions="$withoptions $option"
+		;;
+	--without-*)
+		withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
+		eval $withopt=no
+		withoutoptions="$withoutoptions $option"
+		;;
+	--x)	with_x=yes
+		withoptions="$withoptions --with-x"
+		;;
+	--x-i* | --x-l*) other_options="$other_options $orig_option"
+		;;
+	--*)
+		echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
+		exit 1
+		;;
+	*)
+		case $undefs in
+		NOUNDEFS) undefs=$option ;;
+		*) echo '***' Can only configure for one host and one target at a time.  1>&2
+		   fatal=yes
+		   ;;
+		esac
+		;;
+	esac
+done
+
+# process host and target
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET UNDEFS
+#
+# The rules are:
+# 1. You aren't allowed to specify --host, --target, and undefs at the
+#    same time.
+# 2. Host defaults to undefs.
+# 3. If undefs is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target defaults to undefs.
+# 5. If undefs is not specified, then target defaults to host.
+
+case "${fatal}" in
+"")
+	# Make sure that host, target & undefs aren't all specified at the
+	# same time.
+	case $host_alias---$target_alias---$undefs in
+	NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
+		;;
+	*) echo '***' Can only configure for one host and one target at a time.  1>&2
+	   fatal=yes
+	   break 2
+		;;
+	esac
+
+	# Now, do defaulting for host.
+	case $host_alias in
+	NOHOST)
+		case $undefs in
+		NOUNDEFS)
+			# Neither --host option nor undefs were present.
+			# Call config.guess.
+			guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
+			if host_alias=`${guesssys}`
+			then
+				# If the string we are going to use for
+				# the target is a prefix of the string
+				# we just guessed for the host, then
+				# assume we are running native, and force
+				# the same string for both target and host.
+				case $target_alias in
+				NOTARGET) ;;
+				*)
+					if expr $host_alias : $target_alias >/dev/null
+					then
+						host_alias=$target_alias
+					fi
+					;;
+				esac
+				echo "Configuring for a ${host_alias} host." 1>&2
+				arguments="--host=$host_alias $arguments"
+			else
+				echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
+				fatal=yes
+			fi
+			;;
+		*)
+			host_alias=$undefs
+			;;
+		esac
+	esac
+
+	# Do defaulting for target.  If --target option isn't present, default
+	# to undefs.  If undefs isn't present, default to host.
+	case $target_alias in
+	NOTARGET)
+		case $undefs in
+		NOUNDEFS)
+			target_alias=$host_alias
+			;;
+		*)
+			target_alias=$undefs
+			;;
+		esac
+	esac
+	;;
+*) ;;
+esac
+
+if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
+	exec 1>&2
+	echo Usage: configure [OPTIONS] [HOST]
+	echo
+	echo Options: [defaults in brackets]
+	echo ' --prefix=MYDIR		 install into MYDIR [/usr/local]'
+	echo ' --exec-prefix=MYDIR	 install host-dependent files into MYDIR [/usr/local]'
+	echo ' --help			 print this message [normal config]'
+	echo ' --build=BUILD		 configure for building on BUILD [BUILD=HOST]'
+	echo ' --host=HOST		 configure for HOST [determined via config.guess]'
+	echo ' --norecursion		 configure this directory only [recurse]'
+	echo ' --program-prefix=FOO	 prepend FOO to installed program names [""]'
+	echo ' --program-suffix=FOO	 append FOO to installed program names [""]'
+	echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
+	echo ' --site=SITE		 configure with site-specific makefile for SITE'
+	echo ' --srcdir=DIR		 find the sources in DIR [. or ..]'
+	echo ' --target=TARGET	 configure for TARGET [TARGET=HOST]'
+	echo ' --tmpdir=TMPDIR	 create temporary files in TMPDIR [/tmp]'
+	echo ' --nfp			 configure for software floating point [hard float]'
+	echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
+	echo ' --without-FOO		 package FOO is NOT available'
+	echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
+	echo ' --disable-FOO		 do not include feature FOO'
+	echo
+	echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
+	echo
+	if [ -r config.status ] ; then
+		cat config.status
+	fi
+
+	exit 1
+fi
+
+configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
+moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
+
+# this is a hack.  sun4 must always be a valid host alias or this will fail.
+if ${configsub} sun4 >/dev/null 2>&1 ; then
+        true
+else
+        echo '***' cannot find config.sub.  1>&2
+        exit 1
+fi
+
+touch config.junk
+if ${moveifchange} config.junk config.trash ; then
+        true
+else
+        echo '***' cannot find move-if-change.  1>&2
+        exit 1
+fi
+rm -f config.junk config.trash
+
+case "${srcdir}" in
+"")
+        if [ -r configure.in ] ; then
+                srcdir=.
+        else
+                if [ -r ${progname}.in ] ; then
+                        srcdir=`echo ${progname} | sed 's:/configure$::'`
+                else
+                        echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
+                        exit 1
+                fi
+        fi
+        ;;
+*) ;;
+esac
+
+### warn about some conflicting configurations.
+
+case "${srcdir}" in
+".") ;;
+*)
+        if [ -f ${srcdir}/config.status ] ; then
+                echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
+                exit 1
+        fi
+esac
+
+# default exec_prefix
+case "${exec_prefixoption}" in
+"") exec_prefix="\$(prefix)" ;;
+*) ;;
+esac
+
+### break up ${srcdir}/configure.in.
+case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
+"")
+        echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
+        exit 1
+        ;;
+*) ;;
+esac
+
+case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
+"")
+        echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
+        exit 1
+        ;;
+*) ;;
+esac
+
+case "${TMPDIR}" in
+"") TMPDIR=/tmp ; export TMPDIR ;;
+*) ;;
+esac
+
+# keep this filename short for &%*%$*# 14 char file names
+tmpfile=${TMPDIR}/cONf$$
+# Note that under many versions of sh a trap handler for 0 will *override* any
+# exit status you explicitly specify!  At this point, the only non-error exit
+# is at the end of the script; these actions are duplicated there, minus
+# the "exit 1".  Don't use "exit 0" anywhere after this without resetting the
+# trap handler, or you'll lose.
+trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
+
+# split ${srcdir}/configure.in into common, per-host, per-target,
+# and post-target parts.  Post-target is optional.
+sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
+sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
+if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
+  sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
+  sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
+else
+  sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
+  echo >${tmpfile}.pos
+fi
+
+### do common part of configure.in
+
+. ${tmpfile}.com
+
+# some sanity checks on configure.in
+case "${srctrigger}" in
+"")
+        echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
+        exit 1
+        ;;
+*) ;;
+esac
+
+case "${build_alias}" in
+"")	;;
+*)
+	if result=`${config_shell} ${configsub} ${build_alias}` ; then
+	    buildopt="--build=${build_alias}"
+	    build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+	    build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+	    build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+	    build=${build_cpu}-${build_vendor}-${build_os}
+	else
+	    echo "Unrecognized build system name ${build_alias}." 1>&2
+	    exit 1
+	fi
+	;;
+esac
+
+if result=`${config_shell} ${configsub} ${host_alias}` ; then
+    true
+else
+    echo "Unrecognized host system name ${host_alias}." 1>&2
+    exit 1
+fi
+host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+host=${host_cpu}-${host_vendor}-${host_os}
+
+. ${tmpfile}.hst
+
+if result=`${config_shell} ${configsub} ${target_alias}` ; then
+    true
+else
+    echo "Unrecognized target system name ${target_alias}." 1>&2
+    exit 1
+fi
+target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+target=${target_cpu}-${target_vendor}-${target_os}
+
+. ${tmpfile}.tgt
+
+# Find the source files, if location was not specified.
+case "${srcdir}" in
+"")
+        srcdirdefaulted=1
+        srcdir=.
+        if [ ! -r ${srctrigger} ] ; then
+                srcdir=..
+        fi
+        ;;
+*) ;;
+esac
+
+if [ ! -r ${srcdir}/${srctrigger} ] ; then
+        case "${srcdirdefaulted}" in
+        "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
+        *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
+        esac
+
+        echo '***' \(At least ${srctrigger} is missing.\) 1>&2
+        exit 1
+fi
+
+# Some systems (e.g., one of the i386-aix systems the gas testers are
+# using) don't handle "\$" correctly, so don't use it here.
+tooldir='$(exec_prefix)'/${target_alias}
+
+if [ "${host_alias}" != "${target_alias}" ] ; then
+    if [ "${program_prefixoption}" = "" ] ; then
+        if [ "${program_suffixoption}" = "" ] ; then 
+            if [ "${program_transform_nameoption}" = "" ] ; then
+                program_prefix=${target_alias}- ;
+            fi
+        fi
+    fi
+fi
+
+# Merge program_prefix and program_suffix onto program_transform_name.
+# (program_suffix used to use $, but it's hard to preserve $ through both
+# make and sh.)
+if [ "${program_suffix}" != "" ] ; then
+    program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
+fi
+
+if [ "${program_prefix}" != "" ] ; then
+    program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
+fi
+
+for subdir in . ${subdirs} ; do
+
+    # ${subdir} is relative path from . to the directory we're currently
+    # configuring.
+    # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
+    invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
+
+    ### figure out what to do with srcdir
+    case "${srcdir}" in
+        ".")  # no -srcdir option.  We're building in place.
+                makesrcdir=. ;;
+        /*) # absolute path
+                makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
+                ;;
+        *) # otherwise relative
+                case "${subdir}" in
+                .) makesrcdir=${srcdir} ;;
+                *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
+                esac
+                ;;
+    esac
+
+    if [ "${subdir}/" != "./" ] ; then
+        Makefile=${subdir}/Makefile
+    fi
+
+    if [ ! -d ${subdir} ] ; then
+        if mkdir ${subdir} ; then
+                true
+        else
+                echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
+                exit 1
+        fi
+    fi
+
+    case "${removing}" in
+    "")
+        case "${subdir}" in
+        .) ;;
+        *) eval echo Building in ${subdir} ${redirect} ;;
+        esac
+
+        # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
+        # Set up the list of links to be made.
+        # ${links} is the list of link names, and ${files} is the list of names to link to.
+
+        # Make the links.
+        configlinks="${links}"
+        if [ -r ${subdir}/config.status ] ; then
+                mv -f ${subdir}/config.status ${subdir}/config.back
+        fi
+#
+#  Added THISDIR variable to make symlinks easier when linking
+#  to files not in the same directory -GV
+#        THISDIR=${PWD=`pwd`}
+        ### figure out what to do with srcdir
+        case "${srcdir}" in
+          ".") THISDIR=${PWD=`pwd`} ;; # no -srcdir option.  We're building in place.
+          /*) # absolute path
+              THISDIR=${srcdir}
+              ;;
+          *) # otherwise relative
+             THISDIR=../${srcdir}
+             ;;
+        esac
+#        echo "thisdir is $THISDIR "
+#        while [ -n "${files}" ] ; do
+        for file in ${files} ;  do
+                # set file to car of files, files to cdr of files
+                set ${files}; file=$1; shift; files=$*
+                set ${links}; link=$1; shift; links=$*
+
+                ## Took this code from 'install-sh' script
+                ## this sed command emulates the dirname command
+                dstdir=`echo $link | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+                # Make sure that the destination directory exists.
+                #  this part is taken from Noah Friedman's mkinstalldirs script
+
+                # Skip lots of stat calls in the usual case.
+                if [ ! -d "$dstdir" ]; then
+                  defaultIFS='	
+                  '
+                  IFS="${IFS-${defaultIFS}}"
+
+                  oIFS="${IFS}"
+                  # Some sh's can't handle IFS=/ for some reason.
+                  IFS='%'
+                  set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+                  IFS="${oIFS}"
+
+                  pathcomp=''
+
+                  while [ $# -ne 0 ] ; do
+                    pathcomp="${pathcomp}${1}"
+                    shift
+
+                    if [ ! -d "${pathcomp}" ] ;
+                    then
+                      $mkdirprog "${pathcomp}"
+                    else
+                      true
+                    fi
+
+                    pathcomp="${pathcomp}/"
+                  done
+                fi
+
+                if [ ! -r ${srcdir}/${file} ] ; then
+                  #                  echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
+                  # Changed to copy instead of linking. -GV(5/10/96)
+                        echo '***' "${progname}: cannot copy file \"${link}\"," 1>&2                  
+                        echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
+                        exit 1
+                fi
+
+                ${remove} -f ${link}
+		# Make a symlink if possible, otherwise try a hard link
+#
+#  Used variable THISDIR to make symlinks easier when linking
+#  to files not in the same directory -GV
+#		if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
+		if ${symbolic_link} ${THISDIR}/${file} ${link} >/dev/null 2>&1 ; then
+			true
+		else
+			# We need to re-remove the file because Lynx leaves a 
+			# very strange directory there when it fails an NFS symlink.
+			${remove} -r -f ${link}
+#			${hard_link} ${srcdir}/${file} ${link}
+			${hard_link} ${THISDIR}/${file} ${link}
+		fi
+                if [ ! -r ${link} ] ; then
+                  #                  echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
+                  # Changed to copy instead of linking. -GV(5/10/96)
+                  echo '***' "${progname}: unable to copy  \"${srcdir}/${file}\" to  \"${link}\"." 1>&2
+                        exit 1
+                fi
+
+# Changed to copy instead of Linking -GV(5/10/96)
+                echo "Copied \"${srcdir}/${file}\" to \"${link}\" ."
+#                echo "Linked \"${link}\" to \"${srcdir}/${file}\"."                                
+        done
+
+        # Create a .gdbinit file which runs the one in srcdir
+        # and tells GDB to look there for source files.
+
+        if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
+                case ${srcdir} in
+                .) ;;
+                *) cat > ${subdir}/.gdbinit <<EOF
+# ${NO_EDIT}
+dir ${makesrcdir}
+dir .
+source ${makesrcdir}/.gdbinit
+EOF
+                        ;;
+                esac
+        fi
+
+        # Install a makefile, and make it set VPATH
+        # if necessary so that the sources are found.
+        # Also change its value of srcdir.
+        # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
+        # been somewhat optimized and is perhaps a bit twisty.
+
+        # code is order so as to try to sed the smallest input files we know.
+
+        # the four makefile fragments MUST end up in the resulting Makefile in this order: 
+        # package, target, host, and site.  so do these separately because I don't trust the
+        #  order of sed -e expressions.
+
+        if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
+
+            # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
+            rm -f ${subdir}/Makefile.tem
+              case "${site}" in
+              "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
+              *)
+                      site_makefile_frag=${srcdir}/config/ms-${site}
+
+                      if [ -f ${site_makefile_frag} ] ; then
+                              sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
+                                      > ${subdir}/Makefile.tem
+                      else
+                              cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
+                              site_makefile_frag=
+                      fi
+                      ;;
+            esac
+            # working copy now in ${subdir}/Makefile.tem
+
+            # Conditionalize the makefile for this host.
+            rm -f ${Makefile}
+            case "${host_makefile_frag}" in
+              "") mv ${subdir}/Makefile.tem ${Makefile} ;;
+              *)
+                      if [ ! -f ${host_makefile_frag} ] ; then
+                              host_makefile_frag=${srcdir}/${host_makefile_frag}
+                      fi
+                      if [ -f ${host_makefile_frag} ] ; then
+                              sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
+                      else
+                              echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
+                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
+                              mv ${subdir}/Makefile.tem ${Makefile}
+                      fi
+            esac
+            # working copy now in ${Makefile}
+
+            # Conditionalize the makefile for this target.
+            rm -f ${subdir}/Makefile.tem
+            case "${target_makefile_frag}" in
+              "") mv ${Makefile} ${subdir}/Makefile.tem ;;
+              *)
+                      if [ ! -f ${target_makefile_frag} ] ; then
+                              target_makefile_frag=${srcdir}/${target_makefile_frag}
+                      fi
+                      if [ -f ${target_makefile_frag} ] ; then
+                              sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
+                      else
+                              mv ${Makefile} ${subdir}/Makefile.tem
+                              target_makefile_frag=
+                      fi
+                      ;;
+            esac
+            # real copy now in ${subdir}/Makefile.tem
+
+            # Conditionalize the makefile for this package.
+            rm -f ${Makefile}
+            case "${package_makefile_frag}" in
+              "") mv ${subdir}/Makefile.tem ${Makefile} ;;
+              *)
+                      if [ ! -f ${package_makefile_frag} ] ; then
+                              package_makefile_frag=${srcdir}/${package_makefile_frag}
+                      fi
+                      if [ -f ${package_makefile_frag} ] ; then
+                              sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
+			      rm -f ${subdir}/Makefile.tem
+                      else
+                              echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
+                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
+                              mv ${subdir}/Makefile.tem ${Makefile}
+                      fi
+            esac
+            # working copy now in ${Makefile}
+
+            mv ${Makefile} ${subdir}/Makefile.tem
+
+            # real copy now in ${subdir}/Makefile.tem
+
+            # prepend warning about editting, and a bunch of variables.
+            rm -f ${Makefile}
+            cat > ${Makefile} <<EOF
+# ${NO_EDIT}
+#VPATH = ${makesrcdir}
+links = ${configlinks}
+host_alias = ${host_alias}
+host_cpu = ${host_cpu}
+host_vendor = ${host_vendor}
+host_os = ${host_os}
+host_canonical = ${host_cpu}-${host_vendor}-${host_os}
+target_alias = ${target_alias}
+target_cpu = ${target_cpu}
+target_vendor = ${target_vendor}
+target_os = ${target_os}
+target_canonical = ${target_cpu}-${target_vendor}-${target_os}
+EOF
+	    case "${build}" in
+	      "") ;;
+	      *)  cat >> ${Makefile} << EOF
+build_alias = ${build_alias}
+build_cpu = ${build_cpu}
+build_vendor = ${build_vendor}
+build_os = ${build_os}
+build_canonical = ${build_cpu}-${build_vendor}-${build_os}
+EOF
+	    esac
+
+            case "${package_makefile_frag}" in
+              "") ;;
+              /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
+              *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
+            esac
+
+            case "${target_makefile_frag}" in
+              "") ;;
+              /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
+              *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
+            esac
+
+            case "${host_makefile_frag}" in
+              "") ;;
+              /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
+              *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
+            esac
+
+            if [ "${site_makefile_frag}" != "" ] ; then
+                echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
+            fi 
+
+	    # make sure that some sort of reasonable default exists for these 
+	    # two variables
+	    CXX=${CXX-"g++ -O"}
+	    CC=${CC-cc}
+
+            # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
+            # remove any form feeds.
+            if [ -z "${subdirs}" ]; then
+                rm -f ${subdir}/Makefile.tem2
+                sed -e "s:^SUBDIRS[ 	]*=.*$:SUBDIRS = ${configdirs}:" \
+                    -e "s:^NONSUBDIRS[ 	]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
+                    ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
+                rm -f ${subdir}/Makefile.tem
+                mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
+            fi
+            sed -e "s:^prefix[ 	]*=.*$:prefix = ${prefix}:" \
+                    -e "s:^exec_prefix[ 	]*=.*$:exec_prefix = ${exec_prefix}:" \
+		    -e "s:^SHELL[	 ]*=.*$:SHELL = ${config_shell}:" \
+                    -e "s:^srcdir[ 	]*=.*$:srcdir = ${makesrcdir}:" \
+                    -e "s///" \
+                    -e "s:^program_prefix[ 	]*=.*$:program_prefix = ${program_prefix}:" \
+                    -e "s:^program_suffix[ 	]*=.*$:program_suffix = ${program_suffix}:" \
+                    -e "s:^program_transform_name[ 	]*=.*$:program_transform_name = ${program_transform_name}:" \
+                    -e "s:^tooldir[ 	]*=.*$:tooldir = ${tooldir}:" \
+                    ${subdir}/Makefile.tem >> ${Makefile}
+            # final copy now in ${Makefile}
+
+        else
+           echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
+        fi
+
+        rm -f ${subdir}/Makefile.tem
+
+        case "${host_makefile_frag}" in
+        "") using= ;;
+        *) using="and \"${host_makefile_frag}\"" ;;
+        esac
+
+        case "${target_makefile_frag}" in
+        "") ;;
+        *) using="${using} and \"${target_makefile_frag}\"" ;;
+        esac
+
+        case "${site_makefile_frag}" in
+        "") ;;
+        *) using="${using} and \"${site_makefile_frag}\"" ;;
+        esac
+
+        newusing=`echo "${using}" | sed 's/and/using/'`
+        using=${newusing}
+        echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
+
+        . ${tmpfile}.pos
+
+        # describe the chosen configuration in config.status.
+        # Make that file a shellscript which will reestablish
+        # the same configuration.  Used in Makefiles to rebuild
+        # Makefiles.
+
+        case "${norecursion}" in
+        "") arguments="${arguments} --norecursion" ;;
+        *) ;;
+        esac
+
+        if [ ${subdir} = . ] ; then
+            echo "#!/bin/sh
+# ${NO_EDIT}
+# This directory was configured as follows:
+${progname}" ${arguments}  "
+# ${using}" > ${subdir}/config.new
+        else
+            echo "#!/bin/sh
+# ${NO_EDIT}
+# This directory was configured as follows:
+cd ${invsubdir}
+${progname}" ${arguments}  "
+# ${using}" > ${subdir}/config.new
+        fi
+        chmod a+x ${subdir}/config.new
+        if [ -r ${subdir}/config.back ] ; then
+                mv -f ${subdir}/config.back ${subdir}/config.status
+        fi
+        ${moveifchange} ${subdir}/config.new ${subdir}/config.status
+        ;;
+
+    *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
+    esac
+done
+
+# If there are subdirectories, then recur. 
+if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
+        for configdir in ${configdirs} ; do
+
+                if [ -d ${srcdir}/${configdir} ] ; then
+                        eval echo Configuring ${configdir}... ${redirect}
+                        case "${srcdir}" in
+                        ".") ;;
+                        *)
+                                if [ ! -d ./${configdir} ] ; then
+                                        if mkdir ./${configdir} ; then
+                                                true
+                                        else
+                                                echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
+                                                exit 1
+                                        fi
+                                fi
+                                ;;
+                        esac
+
+                        POPDIR=${PWD=`pwd`}
+                        cd ${configdir} 
+
+### figure out what to do with srcdir
+                        case "${srcdir}" in
+                        ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
+                        /*) # absolute path
+                                newsrcdir=${srcdir}/${configdir}
+                                srcdiroption="--srcdir=${newsrcdir}"
+                                ;;
+                        *) # otherwise relative
+                                newsrcdir=../${srcdir}/${configdir}
+                                srcdiroption="--srcdir=${newsrcdir}"
+                                ;;
+                        esac
+
+### check for guested configure, otherwise fix possibly relative progname
+                        if [ -f ${newsrcdir}/configure ] ; then
+                                recprog=${newsrcdir}/configure
+                        elif [ -f ${newsrcdir}/configure.in ] ; then
+                                case "${progname}" in
+                                /*)     recprog=${progname} ;;
+##
+## Changed the way this is handled the default case is to use
+## the top level configure found originaly and not the one found in
+## parent directory -GV
+##                              *)      recprog=../${progname} ;;
+                                *)      recprog=${POPDIR}/${progname} ;;
+                                esac
+			else
+				eval echo No configuration information in ${configdir} ${redirect}
+				recprog=
+                        fi
+
+### The recursion line is here.
+			if [ ! -z "${recprog}" ] ; then
+	                        if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
+        	                        ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
+                	                ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then
+	                                true
+        	                else
+					echo Configure in `pwd` failed, exiting. 1>&2
+                	                exit 1
+                        	fi
+			fi
+
+                        cd ${POPDIR}
+                fi
+        done
+fi
+
+# Perform the same cleanup as the trap handler, minus the "exit 1" of course,
+# and reset the trap handler.
+rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
+trap 0
+
+exit 0
+
+#
+# Local Variables:
+# fill-column: 131
+# End:
+#
+
+# end of configure


Property changes on: packages/libhdf4/branches/upstream/current/configure
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/configure.in
===================================================================
--- packages/libhdf4/branches/upstream/current/configure.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/configure.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,201 @@
+##############################################################################
+## This file was taken from the Cygnus Toolkit distribution and used as
+## as a template.
+
+## This file is a Bourne shell script fragment that supplies the information
+## necessary to tailor a template configure script into the configure
+## script appropriate for this directory.  For more information, check
+## any existing configure script.  
+
+## Be warned, there are two types of configure.in files.  There are those
+## used by Autoconf, which are macros which are expanded into a configure
+## script by autoconf.  The other sort, of which this is one, is executed
+## by Cygnus configure.  
+
+## For more information on these two systems, check out the documentation
+## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi) or
+## the official documentation on these packages.  
+
+##############################################################################
+
+# Right now the JPEG has still needs a seperate makefile fragmenet
+# So we run configure here i.e we use configure.in and config/ 
+# directory found in the hdf/jpeg to build the configuration.
+host_libs="hdf/jpeg"
+
+# The followin features Not yet implemented
+#echo "without options are $withoutoptions"
+# without options for packages e.g 'jpeg'
+for wooption in $withoutoptions ; do
+if [ "$wooption" = "--without-jpeg" ] ; then 
+   host_libs=""
+fi
+done
+
+# Add file cache directory as a directory to run configure in also
+# since this is a self contained package that was setup 
+# using Cygnus configuration software.
+host_libs="$host_libs hdf/fmpool"
+
+# Not yet implemented
+#echo "enabled options are $enableoptions"
+# enabled options 'fmpool', 'pablo'
+#for eoption in $enableoptions ; do
+#if [ "$eoption" = "--enable-pablo" ] ; then 
+#   host_libs="$host_libs hdf/pablo"
+#fi
+#if [ "$eoption" = "--enable-fmpool" ] ; then 
+#   host_libs="$host_libs hdf/fmpool"
+#fi
+#done
+#echo "host libs are $host_libs"
+
+## We assign ${configdirs} this way to remove all embedded newlines.  This
+## is important because configure will choke if they ever get through.
+#
+configdirs=`echo ${host_libs}`
+
+#
+#Directories we want configure to generate Makefiles from Makefile.in
+#
+subdirs="hdf man hdf/src hdf/zlib hdf/test hdf/util hdf/pablo mfhdf mfhdf/xdr mfhdf/port mfhdf/libsrc mfhdf/dumper mfhdf/nctest mfhdf/ncgen mfhdf/ncdump mfhdf/fortran mfhdf/doc mfhdf/pablo"
+
+################################################################################
+
+srctrigger=move-if-change
+srcname="HDF/netCDF library"
+
+# This gets set non-empty for some net releases of packages.
+appdirs=""
+
+# per-host:
+
+# Work in distributions for each host makefile fragment
+host_makefile_frag=""
+if [ -d ${srcdir}/config ]; then
+case "${host}" in
+  alpha-*-*)         	  host_makefile_frag=config/mh-alpha ;;
+  mips*-dec-ultrix*)      host_makefile_frag=config/mh-decstation ;;
+  mips*-sgi-irix6.*)      host_makefile_frag=config/mh-irix6 ;;
+  mips*-sgi-irix6_32*)    host_makefile_frag=config/mh-irix32 ;;
+  mips*-sgi-irix5*)       host_makefile_frag=config/mh-irix5 ;;
+  mips*-sgi-irix4*)       host_makefile_frag=config/mh-irix4 ;;
+  i[3456]86-*-linux*)     host_makefile_frag=config/mh-linux ;;
+  i[3456]86-*-freebsd*)   host_makefile_frag=config/mh-fbsd ;;
+  ia64-*-*)               host_makefile_frag=config/mh-ia64 ;;
+  *-ibm-aix*)             host_makefile_frag=config/mh-aix ;;
+  i386-*-solaris2*)       host_makefile_frag=config/mh-solarisx86 ;;
+  *-*-solaris2*)          host_makefile_frag=config/mh-solaris ;;
+  *-sun-*)                host_makefile_frag=config/mh-sun ;;
+  *-hp-hpux11*)           host_makefile_frag=config/mh-hpux11 ;;
+  *-hp-hpux*)             host_makefile_frag=config/mh-hpux ;;
+  *-convex-bsd*)          host_makefile_frag=config/mh-convex ;;
+  *-cray-unicos*)         host_makefile_frag=config/mh-unicos ;;
+  t3*-cray-craympp)       host_makefile_frag=config/mh-t3e ;;
+  S370-fujitsu-sysv*)     host_makefile_frag=config/mh-fujivp ;;
+  *-mac-*)                host_makefile_frag=config/mh-mac ;;
+esac
+fi
+
+# Check for valid platfroms before we continue
+if [ "${host_makefile_frag}" = "" ] ; then
+    echo '***' "The HDF/netCDF library is not supported on host ${host}" 1>&2
+    exit 1
+fi
+
+# make sure makefile fragment is there
+if [ ! -f ${srcdir}/${host_makefile_frag} ]; then
+    echo '***' "We are missing makefile fragment ${host_makefile_frag}" 1>&2
+    echo '***' "Please read the installation docs" 1>&2
+    exit 1
+fi
+
+
+# The Solaris /usr/ucb/cc compiler does not appear to work.
+case "${host}" in
+  sparc-sun-solaris2*)
+      if [ "`/usr/bin/which ${CC-cc}`" = "/usr/ucb/cc" ] ; then
+          could_use=
+          [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
+          if [ -d /opt/cygnus/bin ] ; then
+              if [ "$could_use" == "" ] ; then
+                  could_use="/opt/cygnus/bin"
+              else
+                  could_use="$could_use or /opt/cygnus/bin"
+              fi
+          fi
+        if [ "$could_use" = "" ] ; then
+            echo "Warning: compilation may fail because you're using"
+            echo "/usr/ucb/cc.  You should change your PATH or CC "
+            echo "variable and rerun configure."
+        else
+            echo "Warning: compilation may fail because you're using"
+            echo "/usr/ucb/cc, when you should use the C compiler from"
+            echo "$could_use.  You should change your"
+            echo "PATH or CC variable and rerun configure."
+        fi
+      fi
+  ;;
+esac
+
+# per-target:
+
+# 
+# Set proper files that need to linked to the correct pre-generated
+# configuration files. These are mainly on the MFHDF side as 
+# the HDF side stuff is taken care of in the configure.in found
+# in two directories hdf/fmpool and hdf/jpeg respectively.
+files=
+links="mfhdf/libsrc/netcdf.h mfhdf/fortran/jackets.c mfhdf/fortran/netcdf.inc mfhdf/fortran/ftest.f"
+if [ -d ${srcdir}/config ]; then
+case "${host}" in
+  alpha-*-*)              files="mfhdf/libsrc/config/netcdf-alpha.h mfhdf/fortran/config/jackets-alpha.c mfhdf/fortran/config/netcdf-alpha.inc mfhdf/fortran/config/ftest-alpha.f" ;;
+  mips*-dec-ultrix*)      files="mfhdf/libsrc/config/netcdf-dec.h mfhdf/fortran/config/jackets-dec.c mfhdf/fortran/config/netcdf-dec.inc mfhdf/fortran/config/ftest-dec.f" ;;
+  mips*-sgi-irix6.*)      files="mfhdf/libsrc/config/netcdf-irix6.h mfhdf/fortran/config/jackets-irix6.c mfhdf/fortran/config/netcdf-irix6.inc mfhdf/fortran/config/ftest-irix6.f" ;;
+  mips*-sgi-irix6_32*)    files="mfhdf/libsrc/config/netcdf-irix32.h mfhdf/fortran/config/jackets-irix32.c mfhdf/fortran/config/netcdf-irix32.inc mfhdf/fortran/config/ftest-irix32.f" ;;
+  mips*-sgi-irix5*)       files="mfhdf/libsrc/config/netcdf-irix5.h mfhdf/fortran/config/jackets-irix5.c mfhdf/fortran/config/netcdf-irix5.inc mfhdf/fortran/config/ftest-irix5.f" ;;
+  mips*-sgi-irix4*)       files="mfhdf/libsrc/config/netcdf-irix4.h mfhdf/fortran/config/jackets-irix4.c mfhdf/fortran/config/netcdf-irix4.inc mfhdf/fortran/config/ftest-irix4.f" ;;
+  i[3456]86-*-linux*)     files="mfhdf/libsrc/config/netcdf-linux.h mfhdf/fortran/config/jackets-linux.c mfhdf/fortran/config/netcdf-linux.inc mfhdf/fortran/config/ftest-linux.f" ;;
+  i[3456]86-*-freebsd*)   files="mfhdf/libsrc/config/netcdf-fbsd.h mfhdf/fortran/config/jackets-fbsd.c mfhdf/fortran/config/netcdf-fbsd.inc mfhdf/fortran/config/ftest-fbsd.f" ;;
+  ia64-*-*)               files="mfhdf/libsrc/config/netcdf-ia64.h mfhdf/fortran/config/jackets-ia64.c mfhdf/fortran/config/netcdf-ia64.inc mfhdf/fortran/config/ftest-ia64.f" ;;
+  *-ibm-aix*)             files="mfhdf/libsrc/config/netcdf-aix.h mfhdf/fortran/config/jackets-aix.c mfhdf/fortran/config/netcdf-aix.inc mfhdf/fortran/config/ftest-aix.f" ;;
+  i386-*-solaris2*)       files="mfhdf/libsrc/config/netcdf-solarisx86.h mfhdf/fortran/config/jackets-solarisx86.c mfhdf/fortran/config/netcdf-solarisx86.inc mfhdf/fortran/config/ftest-solarisx86.f" ;;
+  *-*-solaris2*)          files="mfhdf/libsrc/config/netcdf-solaris.h mfhdf/fortran/config/jackets-solaris.c mfhdf/fortran/config/netcdf-solaris.inc mfhdf/fortran/config/ftest-solaris.f";;
+  *-sun-*)		          files="mfhdf/libsrc/config/netcdf-sun.h mfhdf/fortran/config/jackets-sun.c mfhdf/fortran/config/netcdf-sun.inc mfhdf/fortran/config/ftest-sun.f";;
+  *-hp-hpux*)             files="mfhdf/libsrc/config/netcdf-hpux.h mfhdf/fortran/config/jackets-hpux.c mfhdf/fortran/config/netcdf-hpux.inc mfhdf/fortran/config/ftest-hpux.f";;
+  *-convex-bsd*)          files="mfhdf/libsrc/config/netcdf-convex.h mfhdf/fortran/config/jackets-convex.c mfhdf/fortran/config/netcdf-convex.inc mfhdf/fortran/config/ftest-convex.f" ;;
+  *-cray-unicos*)         files="mfhdf/libsrc/config/netcdf-unicos.h mfhdf/fortran/config/jackets-unicos.c mfhdf/fortran/config/netcdf-unicos.inc mfhdf/fortran/config/ftest-unicos.f" ;;
+  t3*-cray-craympp)       files="mfhdf/libsrc/config/netcdf-t3e.h mfhdf/fortran/config/jackets-t3e.c mfhdf/fortran/config/netcdf-t3e.inc mfhdf/fortran/config/ftest-t3e.f" ;;
+  S370-fujitsu-sysv*)     files="mfhdf/libsrc/config/netcdf-fujivp.h mfhdf/fortran/config/jackets-fujivp.c mfhdf/fortran/config/netcdf-fujivp.inc mfhdf/fortran/config/ftest-fujivp.f" ;;
+  *-mac-*)		          files="mfhdf/libsrc/config/netcdf-mac.h mfhdf/fortran/config/jackets-mac.c mfhdf/fortran/config/netcdf-mac.inc mfhdf/fortran/config/ftest-mac.f" ;;
+esac
+fi
+
+# make sure host specific files are there
+#if [ ! -f ${srcdir}/${files} ]; then
+#    echo '***' "We are missing host specific customize file ${files}" 1>&2
+#    echo '***' "Please read the installation docs" 1>&2
+#    exit 1
+#fi
+
+# Decided to copy files instead of using symbolic links.
+#
+# Now for Mac and PC configurations we want to copy and not use symbolic
+# links. You can use this also for any platfrom you want.
+if [ -d ${srcdir}/config ]; then
+case "${host}" in
+  *-mac-*)             symbolic_link="cp -p" ;;
+  *-win-*)             symbolic_link="cp -p" ;;
+  *)                   symbolic_link="cp" ;;
+esac
+fi
+
+# post-target:
+
+# We don't have anything
+
+#
+# Local Variables:
+# fill-column: 131
+# End:
+#

Added: packages/libhdf4/branches/upstream/current/hdf/MAKE.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/MAKE.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/MAKE.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,108 @@
+! ****************************************************************************
+! * 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: MAKE.COM,v 1.15 1996/03/25 17:53:34 sxu Exp $
+!
+! $ !
+! $ ! Build the entire HDF library
+! $ !
+! $ !
+! $ ! The following defines should be used to tell VMS where to
+! $ !   place the resulting HDF library, include files, and utilites
+! $ !   These directories will not be created, you must create them
+! $ !   by hand.
+! $ !
+$ create/dir [-.lib]
+$ create/dir [-.include]
+$ create/dir [-.bin]
+$ define/nolog hdf$src     mrlxp4$dka200:[folk.dev.hdf.src]   ! HDF src
+$ define/nolog hdf$util    mrlxp4$dka200:[folk.dev.hdf.util]  ! HDF utilities
+$ define/nolog hdf$test    mrlxp4$dka200:[folk.dev.hdf.test]  ! HDF test programs
+$ define/nolog jpeg$src    mrlxp4$dka200:[folk.dev.hdf.jpeg]  !
+$ define/nolog zlib$src    mrlxp4$dka200:[folk.dev.hdf.zlib]  !
+$ define/nolog hdf$lib     mrlxp4$dka200:[folk.dev.lib]df ! Location and name for lib
+$ define/nolog jpeg$lib     mrlxp4$dka200:[folk.dev.lib]libjpeg.olb
+$ define/nolog zlib$lib     mrlxp4$dka200:[folk.dev.lib]libz.olb
+$ define/nolog hdf$include mrlxp4$dka200:[folk.dev.include] ! Where to put includes
+$ define/nolog hdf$bin     mrlxp4$dka200:[folk.dev.bin]   ! Where to put executables
+$ !
+$ define/nolog sys$clib sys$library:vaxcrtl
+$ !
+$ ! Makefile for VAX/VMX systems.
+$ !
+$ ! Make jpeg library
+$  type sys$input
+  ======== Building jpeg library =======
+$ set def jpeg$src
+$ copy jconfig.vms jconfig.h
+$ copy makefile.vms make.com
+$ @make
+$ copy libjpeg.olb jpeg$lib
+$ copy jconfig.h hdf$include
+$ copy jerror.h hdf$include
+$ copy jmorecfg.h  hdf$include
+$ copy jpeglib.h  hdf$include
+$ delete *.obj;*
+$ delete *.exe;*
+$!
+$ ! Make gzip library
+$  type sys$input
+  ======== Building gzip library =======
+$ set def zlib$src
+$ copy make_vms.com make.com
+$ @make
+$ copy libz.olb zlib$lib
+$ copy zconf.h hdf$include
+$ copy zlib.h  hdf$include
+$ delete *.obj;*
+$ delete *.exe;*
+$ !
+$ ! Make full df lib (with fortran stubs)
+$ type sys$input
+  ======== Building HDF 4.0 ========
+$ !              
+$ ! Build the base HDF library
+$ !
+$ set def hdf$src
+$ @MAKENOF
+$ !
+$ ! If you do not want to include the HDF Fortran interfaces, comment
+$ !   out the following command.
+$ !
+$ @MAKEFS
+$ !
+$ ! Move the files to their correct destinations
+$ !
+$ copy df.olb hdf$lib
+$ copy *.h    hdf$include
+$ delete *.obj;*
+$ !
+$ ! Build the HDF utility programs
+$ !
+$ set default hdf$util
+$ @MAKEUTIL
+$ !
+$ ! Move the HDF utilities to where they belong
+$ !
+$ copy *.exe hdf$bin
+$ delete *.obj;*
+$ !
+$ @setuputils
+$ !
+$ ! Build the test programs
+$ !
+$ set default hdf$test
+$ @MAKE
+$ !
+$ delete *.obj;*
+$ type sys$input
+  ======== HDF 4.0 has now been built ========

Added: packages/libhdf4/branches/upstream/current/hdf/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,340 @@
+# Makefile for HDF
+#
+### Start of system configuration section. ####
+# Set shell so we know what it is
+SHELL = /bin/sh
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+#defaults
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install scripts.
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+
+# ############# End of system configuration section. ###############
+
+PACKAGE	 = HDF
+VERSION  = 4.0
+
+MANIFEST = $(DISTFILES)
+DISTFILES = Makefile.in COPYING build.inc
+
+SUBDIRS= src jpeg zlib fmpool pablo test util
+
+HDFINC= $(srcdir)/src
+HDFLIB= $(srcdir)/src
+HDFBIN= $(srcdir)/bin
+PABLO_HINC= $(srcdir)/pablo
+FMPOOL_INC= $(srcdir)/fmpool
+
+#
+#
+# Flags to recursively send
+#
+
+HDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        FMPOOL_FLAGS="$(FMPOOL_FLAGS)" \
+        PABLO_FLAGS="$(PABLO_FLAGS)" \
+        PABLO_INCLUDE="$(PABLO_INCLUDE)" \
+        MACHINE="$(MACHINE)" 
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+	prefix="$(prefix)"
+
+#
+#
+# General rules
+#
+all:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd  
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd  
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="src pablo fmpool util test" subd
+
+allnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd  
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd  
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=nofortran \
+          SUBDIRS="src pablo fmpool util test" subd
+
+rebuild rebuildnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="src pablo fmpool util test" subd
+
+libnofortran:
+	@$(MAKE) $(MYFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+	  SUBDIRS="jpeg" subd 
+	@$(MAKE) $(MYFLAGS) $(HDF_FLAGS) TARG=libz.a \
+	  SUBDIRS="zlib" subd 
+	@$(MAKE) $(MYFLAGS) $(HDF_FLAGS) TARG=nofortran \
+	  SUBDIRS="src pablo fmpool" subd
+
+libnostub: libnofortran
+
+allnostub: allnofortran
+
+libs:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="src pablo fmpool" subd
+
+libdf:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="src" subd
+
+libjpeg:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd
+
+libz:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd
+
+utilities:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="src pablo fmpool util" subd
+
+hdf-test:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="src pablo fmpool test" subd
+
+hdf-testnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=nofortran \
+          SUBDIRS="src pablo fmpool test" subd
+
+testnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=nofortran \
+          SUBDIRS="src pablo fmpool test" subd
+
+test-hdf:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=test-hdf \
+          SUBDIRS="test" subd
+
+test-hdfnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=test-hdfnofortran \
+          SUBDIRS="test" subd
+
+test-hdffortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=test-hdffortran \
+          SUBDIRS="test" subd
+
+test-utils:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=test-utils \
+          SUBDIRS="util" subd
+
+install:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install-lib \
+          SUBDIRS="src jpeg zlib pablo fmpool" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install \
+          SUBDIRS="util" subd
+
+install-libs:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install-lib \
+          SUBDIRS="src jpeg zlib pablo fmpool" subd
+
+install-includes:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install-includes \
+          SUBDIRS="src jpeg zlib pablo fmpool" subd
+
+install-utils:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=install \
+          SUBDIRS="util" subd
+
+perfs:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="src perf fmpool" subd
+
+#install:      $(INSTALL_DIRS)
+#	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@  \
+#          SUBDIRS="src util test" subd
+
+debug:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libjpeg.a \
+          SUBDIRS="jpeg" subd 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=libz.a \
+          SUBDIRS="zlib" subd 
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=debug \
+          SUBDIRS="src fmpool test" subd
+
+saber:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=saber \
+          SUBDIRS="src jpeg zlib test" subd
+
+clean:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@  \
+          SUBDIRS="src jpeg zlib pablo fmpool util test" subd
+	-$(RM) $(RMFLAGS) core *.log
+
+distclean:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@  \
+          SUBDIRS="src jpeg zlib pablo fmpool util test" subd
+	-$(RM) $(RMFLAGS) core *.log
+	-$(RM) -rf bin lib include config.status Makefile
+
+# for recusive make in subdirs
+subd:
+	@for dir in $(SUBDIRS); do \
+          (cd $$dir; echo Making \`$(TARG)\' in `pwd`; \
+              $(MAKE) $(MFLAGS) $(HDF_FLAGS) $(TARG)); \
+	done
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = hdf
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+	for subdir in $(SUBDIRS); do \
+	  echo making $@ in $$subdir; \
+	  mkdir $(distdir)/$$subdir || exit 1; \
+	  (cd $$subdir && $(MAKE) $@) || exit 1; \
+	done
+
+# for auto remaking, see toplevel Makefile
+#Makefile: $(TOP_SRCDIR)/config.status Makefile.in
+#	CONFIG_FILES=$@ CONFIG_HEADERS= $(TOP_SRCDIR)/config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+
+
+help:
+	@echo ""
+	@echo "Make supports the following targets"
+	@echo "make help    - prints this usage section"
+	@echo "make all     - (DEFAULT) makes HDF package"
+	@echo "make allnofortran - makes HDF package excluding fortran support"
+	@echo "make libnofortran - makes HDF library excluding fortran support"
+	@echo "make testnofortran - makes HDF library and tests"
+	@echo "                     excluding fortran support"
+	@echo "make hdf-test      - makes HDF library and tests"
+	@echo "make utilities     - makes HDF library and utilities"
+	@echo "make libs          - makes HDF and IJG JPEG libraries only"
+	@echo "make libdf         - makes HDF library "
+	@echo "make libjpeg       - makes IJG JPEG library "
+	@echo "make libz          - makes GZIP deflate library "
+	@echo "make test-hdf          - run HDF library tests " 
+	@echo "make test-hdfnofortran - run HDF library tests except the fortran test " 
+	@echo "make test-hdffortran   - run HDF library fortran tests only " 
+	@echo "make test-utils        - run HDF utilities test"
+	@echo "make install           - install HDF library, "
+	@echo "                         utilites, and includes " 
+	@echo "make install-libs      - install HDF library and includes " 
+	@echo "make install-includes  - install HDF includes " 
+	@echo "make install-utils     - install HDF utilities " 
+	@echo "make clean     - cleans up HDF packages(*.o,libdf.a,..)"
+	@echo "make distclean - cleans up HDF packages including"
+	@echo "                 configuration(Makefiles,config.status,..)"
+	@echo ""
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/README
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,18 @@
+This directory contains:
+
+README -- This file.
+build.inc -- the hdf level Makefile to build HDF 4.1 on Unix based
+             platforms
+Makefile.in -- used by the Cygnus 'configure' script to
+       generate the hdf level Makefile.
+MAKE.COM -- make file for VMS
+src -- contains all the unpacked source code for the HDF base 
+          library.
+jpeg -- The Independent JPEG Group's JPEG software jpeg release.
+test -- a test suite to test the HDF library.
+util -- HDF utilities and test data files.
+pablo -- Pablo performance data capture library
+fmpool -- file memory pool functions        
+zlib -- gzip library
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/build.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/build.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/build.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,133 @@
+# ****************************************************************************
+# * 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: build.inc,v 1.6 1995/05/17 02:57:40 georgev Exp $
+#
+# ##################################################################
+#
+#
+# This is the top level Makefile to build HDF 4.0 on Unix based
+#       platforms
+#
+
+#
+#
+# Flags to recursively send
+#
+
+HDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        MACHINE="$(MACHINE)" \
+        HDFLIB="$(HDFLIB)" \
+        HDFINC="$(HDFINC)" \
+	HDFBIN="$(HDFBIN)"	
+
+#
+#
+# General rules
+#
+all:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="src jpeg util test" subd message 
+
+allnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=nofortran \
+          SUBDIRS="src jpeg util test" subd message 
+
+rebuild rebuildnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@ \
+          SUBDIRS="src jpeg util test" subd message 
+
+libnofortran:
+	@$(MAKE) $(MYFLAGS) $(HDF_FLAGS) TARG=nofortran \
+	  SUBDIRS="src jpeg" subd message
+
+libnostub: libnofortran
+
+allnostub: allnofortran
+
+libdf:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="src" subd
+
+libjpeg:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="jpeg" subd
+
+utilities:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="src jpeg util" subd
+
+tests:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="src jpeg test" subd
+
+testnofortran:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=nofortran \
+          SUBDIRS="src jpeg test" subd message 
+
+perfs:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=all \
+          SUBDIRS="src jpeg perf" subd
+
+#install:      $(INSTALL_DIRS)
+#	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@  \
+#          SUBDIRS="src util test" subd
+
+debug:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=debug \
+          SUBDIRS="src jpeg test" subd message 
+
+saber:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=saber \
+          SUBDIRS="src jpeg test" subd
+
+clean:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@  \
+          SUBDIRS="src jpeg util test" subd
+	$(RM) $(RMFLAGS) core *.log
+
+distclean:
+	@$(MAKE) $(MFLAGS) $(HDF_FLAGS) TARG=$@  \
+          SUBDIRS="src jpeg util test" subd
+	$(RM) $(RMFLAGS) core *.log
+	$(RM) -rf bin lib include
+
+subd:
+	@for dir in $(SUBDIRS); do \
+		(cd $$dir; echo Making \`$(TARG)\' in `pwd`; \
+		$(MAKE) $(MFLAGS) $(HDF_FLAGS) $(TARG)); \
+	done
+
+message:
+	@echo ""
+	@echo "***********************************************************"
+	@echo " HDF 4.0 library successfully created."
+	@echo ""
+	@echo "If you have any old vset files (v 1.0) you must use vcompat"
+	@echo "to make them compatible with Vset 2.0 applications"
+	@echo ""
+	@echo "User programs can be created as follows:"
+	@echo ""
+	@echo "   ${CC} program.c libdf.a -o program"
+	@echo ""
+	@echo "***********************************************************"
+	@echo ""
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,259 @@
+# Makefile for Shared Memory File Buffer Pool
+
+# Makefile.in is edited by Cygnus configure to produce a custom Makefile.
+
+# Read installation instructions before saying "make" !!
+
+# For compiling with source and object files in different directories.
+srcdir = .
+TOP_SRCDIR = ../..
+
+# Where to install the programs and man pages.
+prefix = $(TOP_SRCDIR)/NewHDF
+exec_prefix = ${prefix}
+bindir = $(exec_prefix)/bin
+libdir = $(exec_prefix)/lib
+includedir = $(prefix)/include
+binprefix =
+manprefix =
+manext = 1
+mandir = $(prefix)/man/man$(manext)
+
+# The following default options are overriden in the makefile fragment
+# section below
+#
+# The name of your C compiler:
+CC= gcc
+
+# You may need to adjust these cc options:
+CFLAGS= -O -I$(srcdir)
+
+# Link-time cc options:
+LDFLAGS= 
+
+# To link any special libraries, add the necessary -l commands here.
+LDLIBS= 
+
+# miscellaneous OS-dependent stuff
+SHELL= /bin/sh
+# linker
+LN= $(CC)
+# file deletion command
+RM = /bin/rm 
+RMFLAGS = -f
+
+# file rename command
+MV= mv
+# library (.a) file creation command
+#AR= ar rc
+AR = ar
+ARFLAGS = rc
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# second step in .a creation (use "touch" if not needed)
+AR2= $(RANLIB)
+
+# installation program
+INSTALL= cp
+INSTALL_PROGRAM= $(INSTALL)
+INSTALL_DATA= $(INSTALL) -m 644
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+AUXFLAGS= 
+
+#----------------- End of configurable options.---------------------------
+
+# source files: FMPOOL library
+LIBSOURCES= fmpool.c fmpio.c
+
+# source files: 
+APPSOURCES= 
+
+SOURCES= $(LIBSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= cdefs.h compat.h fmptypes.h queue.h fmpio.h fmpool.h 
+
+# documentation, test, and support files
+DOCS= 
+
+MKFILES= configure Makefile.in configure.in config.sub config.guess \
+	move-if-change
+CONFIGFILES= config/fmpsun.h config/fmpirix5.h config/mh-aix config/mh-alpha \
+	config/mh-convex config/mh-decstation config/mh-fbsd \
+	config/mh-hpux config/mh-irix32 config/mh-irix4 config/mh-irix5 \
+	config/mh-irix6 config/mh-linux config/mh-solaris config/mh-sun \
+	config/mh-unicos config/fmphpux.h config/fmpalpha.h \
+	config/fmpconvex.h config/fmpdec.h config/fmpfbsd.h config/fmpirix32.h \
+	config/fmpirix4.h config/fmpirix6.h config/fmplinux.h config/fmpsolaris.h \
+	config/fmpunicos.h config/fmpaix.h
+OTHERFILES= run.tests
+TESTFILES= test_fmpio.c tfmpio_read.c tfmpio_write.c
+
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+	$(OTHERFILES) $(TESTFILES)
+
+LIBOBJECTS= fmpool.o fmpio.o
+
+# object files for sample applications (excluding library files)
+TOBJECTS= test_fmpio.o
+
+# ==> specify directories where to find inludes and library
+#     HDF library, and HDF utilities
+HDFINC= $(srcdir)/../src
+HDFLIB= $(srcdir)/../src
+HDFBIN= $(srcdir)/../bin
+PABLO_DIR= $(srcdir)/../pablo
+
+#### makefile fragment from 'config/' goes here ##############
+## ------------------------ end of makefile fragments--------------------
+
+CL= ${CC} $(CFLAGS) -c -D__FMPINTERFACE_PRIVATE ${AUXFLAGS} -I. 
+
+HDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        MACHINE="$(MACHINE)" 
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+#all: libfmpool.a
+
+debug rebuild rebuildnofortran nofortran: all
+
+all::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  : true; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) pall; \
+	fi
+
+pall::         FORCE
+	@if test -z "$(PABLO_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) libfmpool.a; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) libfmpool.a pablolib; \
+	fi
+
+libfmpool.a: $(LIBOBJECTS) $(HDFLIB)/libdf.a
+	$(RM) $(RMFLAGS) libfmpool.a
+	$(AR) $(ARFLAGS) libfmpool.a  $(LIBOBJECTS)
+	if test -f $(HDFLIB)/libdf.a ; then \
+	  $(AR) rcuv $(HDFLIB)/libdf.a $(LIBOBJECTS); \
+	  $(RANLIB) $(HDFLIB)/libdf.a ; \
+	fi
+	$(AR2) libfmpool.a
+
+libfmpool: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libfmpool.a
+	$(AR) $(ARFLAGS) libfmpool.a  $(LIBOBJECTS)
+	$(AR2) libfmpool.a
+
+pablolib: $(LIBOBJECTS) $(PABLO_DIR)/libdf-inst.a
+	if test -f $(PABLO_DIR)/libdf-inst.a ; then \
+	  $(AR) rcuv $(PABLO_DIR)/libdf-inst.a $(LIBOBJECTS); \
+	  $(RANLIB) $(PABLO_DIR)/libdf-inst.a ; \
+	fi
+
+tfmp: ${INCLUDES} fmpconf.h test_fmpio.c libfmpool.a
+	${CC} $(CFLAGS)  ${AUXFLAGS} -I. -c test_fmpio.c 
+	$(LN) $(LDFLAGS) -o tfmp $(TOBJECTS) libfmpool.a $(LDLIBS)
+
+tfmpr: ${INCLUDES} fmpconf.h tfmpio_read.c libfmpool.a
+	${CC} $(CFLAGS)  ${AUXFLAGS} -I. -c tfmpio_read.c
+	$(LN) $(LDFLAGS) -o tfmpr tfmpio_read.o libfmpool.a $(LDLIBS)
+
+tfmpw: ${INCLUDES} fmpconf.h tfmpio_write.c libfmpool.a
+	${CC} $(CFLAGS)  ${AUXFLAGS} -I. -c tfmpio_write.c
+	$(LN) $(LDFLAGS) -o tfmpw tfmpio_write.o libfmpool.a $(LDLIBS)
+
+fmpool.o: ${INCLUDES} fmpconf.h fmpool.c 
+	${CL} fmpool.c
+
+fmpio.o:  ${INCLUDES} fmpconf.h fmpio.c 
+	${CL} fmpio.c
+
+$(HDFLIB)/libdf.a:
+
+install::  FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  : true; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) fmpinstall-headers; \
+	fi
+
+install-lib:: install
+
+install-includes::  FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  : true; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) fmpinstall-headers; \
+	fi
+
+fmpinstall-lib: libfmpool.a install-headers
+	$(INSTALL_DATA) libfmpool.a $(libdir)/$(binprefix)libfmpool.a
+
+fmpinstall-headers: fmpio.h
+	$(INSTALL_DATA) $(srcdir)/fmpio.h $(includedir)/fmpio.h
+
+manpages: 
+	c2man -G'File Memory Buffer Pool Stdio Interface' -ln -n fmpio.h
+	c2man -G'Shared Memory File Buffer Pool' -ln -n fmpool.h
+
+clean:
+	-$(RM) $(RMFLAGS) *.o *.mp core libfmpool.a tfmp tfmpr tfmpw
+
+distclean:
+	-$(RM) $(RMFLAGS) *.o *.mp core libfmpool.a tfmp tfmpr tfmpw
+	-$(RM) $(RMFLAGS) Makefile config.status fmpconf.h
+
+distribute:
+	$(RM) $(RMFLAGS) fmpoolsrc.tar*
+	tar cvf fmpoolsrc.tar $(DISTFILES)
+	compress -v fmpoolsrc.tar
+
+test: tfmp
+	$(RM) $(RMFLAGS) *.mp
+	./run.tests
+	cmp $(srcdir)/test.mp testout.mp
+	cmp $(srcdir)/test1.mp test1out.mp
+
+check: test
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+# GNU Make likes to know which target names are not really files to be made:
+.PHONY: all install install-lib install-headers clean distribute test check
+
+
+fmpool.o: fmpool.c fmpool.h fmptypes.h fmpconf.h compat.h cdefs.h 
+fmpio.o: fmpio.c fmpool.h fmpio.h fmptypes.h fmpconf.h compat.h cdefs.h 
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/README
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,68 @@
+File Page Buffering(libfmpool.a)
+=================================
+
+    This library is NOT officially supported on all platforms
+    and has not been extensively tested. As such it 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.
+
+    The current version supports setting the page-size and number of pages
+    in the memory pool through user C-routines. 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...)
+    -------------------------------------------------
+    MPset(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'. 
+ 
+    MPget(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.
+
+    For further use of these routines see the man page 'fmpio.3'.
+
+    To create the library 'libfmpool.a' you need to run the configure
+    script and then type 'make libfmpool'.
+
+    This library can then be used in any program that uses stdio(3)
+    calls to replace the functions open,read,write,flush and seek with
+    those defined in the man page 'fmpio.3'
+
+    For comments/suggestions/bugfixes please email them to
+
+    George Velamparampil <georgev at ncsa.uiuc.edu>
+    NCSA Software Development Group
+    HDF Group
+    152 Computing Applications Bldg.
+    605 E. Springfield Ave.
+    Champaign, IL 61820
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/cdefs.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/cdefs.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/cdefs.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Berkeley Software Design, Inc.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. 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.
+ *
+ *	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
+ */
+
+/*****************************************************************************
+ * File: compat.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.
+ *
+ *****************************************************************************/ 
+
+/*#if !defined(_CDEFS_H_) && !defined(_SYS_CDEFS_H) */
+#if !defined(_CDEFS_H_)
+#define	_CDEFS_H_
+
+#if defined(__cplusplus)
+#ifndef __BEGIN_DECLS   /* lets check this to be sure */
+#define	__BEGIN_DECLS	extern "C" {
+#define	__END_DECLS	};
+#endif
+#else
+#ifndef __BEGIN_DECLS   /* lets check this to be sure */
+#define	__BEGIN_DECLS
+#define	__END_DECLS
+#endif
+#endif /* __cplusplus */
+
+/*
+ * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
+ * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
+ * in between its arguments.  __CONCAT can also concatenate double-quoted
+ * strings produced by the __STRING macro, but this only works with ANSI C.
+ */
+#if defined(__STDC__) || defined(__cplusplus)
+
+/* Some ANSI environments don't define all of these */
+#ifndef __P
+#define	__P(protos)	protos		/* full-blown ANSI C */
+#endif
+
+#ifndef __CONCAT
+#define	__CONCAT(x,y)	x ## y
+#endif
+
+#ifndef __STRING
+#define	__STRING(x)	#x
+#endif
+
+#ifndef __const
+#define	__const		const		/* define reserved names to standard */
+#endif
+
+#ifndef __signed
+#define	__signed	signed
+#endif
+
+#ifndef __volatile
+#define	__volatile	volatile
+#endif
+#if defined(__cplusplus)
+#ifndef __inline
+#define	__inline	inline		/* convert to C++ keyword */
+#endif
+#else
+#ifndef __GNUC__
+#ifndef __inline
+#define	__inline			/* delete GCC keyword */
+#endif
+#endif /* !__GNUC__ */
+#endif /* !__cplusplus */
+
+#else	/* !(__STDC__ || __cplusplus) */
+
+/* In Non-ANSI environments */
+
+#define	__P(protos)	()		/* traditional C preprocessor */
+#define	__CONCAT(x,y)	x/**/y
+#define	__STRING(x)	"x"
+
+#ifndef __GNUC__
+#define	__const				/* delete pseudo-ANSI C keywords */
+#define	__inline
+#define	__signed
+#define	__volatile
+/*
+ * In non-ANSI C environments, new programs will want ANSI-only C keywords
+ * deleted from the program and old programs will want them left alone.
+ * When using a compiler other than gcc, programs using the ANSI C keywords
+ * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
+ * When using "gcc -traditional", we assume that this is the intent; if
+ * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
+ */
+#ifndef	NO_ANSI_KEYWORDS
+#define	const				/* delete ANSI C keywords */
+#define	inline
+#define	signed
+#define	volatile
+#endif
+#endif	/* !__GNUC__ */
+#endif	/* !(__STDC__ || __cplusplus) */
+
+/*
+ * GCC1 and some versions of GCC2 declare dead (non-returning) and
+ * pure (no side effects) functions using "volatile" and "const";
+ * unfortunately, these then cause warnings under "-ansi -pedantic".
+ * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
+ * these work for GNU C++ (modulo a slight glitch in the C++ grammar
+ * in the distribution version of 2.5.5).
+ */
+#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
+#define	__attribute__(x)	/* delete __attribute__ if non-gcc or gcc1 */
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#define	__dead		__volatile
+#define	__pure		__const
+#endif
+#endif
+
+/* Delete pseudo-keywords wherever they are not available or needed. */
+#ifndef __dead
+#define	__dead
+#define	__pure
+#endif
+
+#endif /* !_CDEFS_H_ */

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/compat.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/compat.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/compat.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,245 @@
+/*-
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. 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: compat.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.
+ *
+ *****************************************************************************/ 
+
+/* $Id: compat.h,v 1.4 1996/02/02 17:37:33 georgev Exp $ */
+
+#ifndef	_COMPAT_H_
+#define	_COMPAT_H_
+
+/*
+ * If your system doesn't typedef u_long, u_short, or u_char
+ */
+#ifndef HAVE_UCHAR
+typedef unsigned char	u_char;		/* 4.[34]BSD names. */
+#endif
+#ifndef HAVE_UINT
+typedef unsigned int	u_int;
+#endif
+#ifndef HAVE_ULONG
+typedef unsigned long	u_long;
+#endif
+#ifndef HAVE_USHORT
+typedef unsigned short	u_short;
+#endif
+
+/* If your system doesn't typedef size_t. */
+#ifndef HAVE_SIZE_T
+typedef unsigned int	size_t;		/* POSIX, 4.[34]BSD names. */
+#endif
+
+/* If your system doesn't typedef ssize_t */
+#ifndef HAVE_SSIZE_T
+typedef	int		ssize_t;	/* POSIX names. */
+#endif
+
+/*
+ * If your system doesn't have the POSIX type for a signal mask,
+ */
+#ifndef HAVE_SIGSET_T		/* POSIX 1003.1 signal mask type. */
+typedef unsigned int	sigset_t;
+#endif
+
+/*
+ * If your system's vsprintf returns a char *, not an int,
+ * change the 0 to a 1.
+ */
+#if 0
+#define	VSPRINTF_CHARSTAR
+#endif
+
+/*
+ * If you don't have POSIX 1003.1 signals, the signal code surrounding the 
+ * temporary file creation is intended to block all of the possible signals
+ * long enough to create the file and unlink it.  All of this stuff is
+ * intended to use old-style BSD calls to fake POSIX 1003.1 calls.
+ */
+#ifdef	NO_POSIX_SIGNALS
+#define	sigemptyset(set)	(*(set) = 0)
+#define	sigfillset(set)		(*(set) = ~(sigset_t)0, 0)
+#define	sigaddset(set,signo)	(*(set) |= sigmask(signo), 0)
+#define	sigdelset(set,signo)	(*(set) &= ~sigmask(signo), 0)
+#define	sigismember(set,signo)	((*(set) & sigmask(signo)) != 0)
+
+#define	SIG_BLOCK	1
+#define	SIG_UNBLOCK	2
+#define	SIG_SETMASK	3
+
+static int __sigtemp;		/* For the use of sigprocmask */
+
+/* Repeated test of oset != NULL is to avoid "*0". */
+#define	sigprocmask(how, set, oset)					\
+	((__sigtemp =							\
+	(((how) == SIG_BLOCK) ?						\
+		sigblock(0) | *(set) :					\
+	(((how) == SIG_UNBLOCK) ?					\
+		sigblock(0) & ~(*(set)) :				\
+	((how) == SIG_SETMASK ?						\
+		*(set) : sigblock(0))))),				\
+	((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) :	\
+		sigsetmask(__sigtemp)), 0)
+#endif /* NO_POSIX_SIGNALS */
+
+/*
+ * If your system doesn't have an include file with the appropriate
+ * byte order set, make sure you specify the correct one.
+ */
+#ifndef BYTE_ORDER
+#define	LITTLE_ENDIAN	1234		/* LSB first: i386, vax */
+#define	BIG_ENDIAN	4321		/* MSB first: 68000, ibm, net */
+#define	BYTE_ORDER	BIG_ENDIAN	/* Set for your system. */
+#endif
+
+#if defined(SYSV) || defined(SYSTEM5)
+#define	index(a, b)		strchr(a, b)
+#define	rindex(a, b)		strrchr(a, b)
+#define	bzero(a, b)		memset(a, 0, b)
+#define	bcmp(a, b, n)		memcmp(a, b, n)
+#define	bcopy(a, b, n)		memmove(b, a, n)
+#endif
+
+#if defined(BSD) || defined(BSD4_3)
+#define	strchr(a, b)		index(a, b)
+#define	strrchr(a, b)		rindex(a, b)
+#define	memcmp(a, b, n)		bcmp(a, b, n)
+#define	memmove(a, b, n)	bcopy(b, a, n)
+#endif
+
+/*
+ * 32-bit machine.  The db routines are theoretically independent of
+ * the size of u_shorts and u_longs, but I don't know that anyone has
+ * ever actually tried it.  At a minimum, change the following #define's
+ * if you are trying to compile on a different type of system.
+ */
+#ifndef USHRT_MAX
+#define	USHRT_MAX		0xFFFF
+#define	ULONG_MAX		0xFFFFFFFF
+#endif
+
+#ifndef O_ACCMODE			/* POSIX 1003.1 access mode mask. */
+#define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
+#endif
+
+#ifndef	_POSIX2_RE_DUP_MAX		/* POSIX 1003.2 RE limit. */
+#define	_POSIX2_RE_DUP_MAX	255
+#endif
+
+/*
+ * If you can't provide lock values in the open(2) call.  Note, this
+ * allows races to happen.
+ */
+#ifndef O_EXLOCK			/* 4.4BSD extension. */
+#define	O_EXLOCK	0
+#endif
+
+#ifndef O_SHLOCK			/* 4.4BSD extension. */
+#define	O_SHLOCK	0
+#endif
+
+#ifndef EFTYPE
+#define	EFTYPE		EINVAL		/* POSIX 1003.1 format errno. */
+#endif
+
+#ifndef	WCOREDUMP			/* 4.4BSD extension */
+#define	WCOREDUMP(a)	0
+#endif
+
+#ifndef	STDERR_FILENO
+#define	STDIN_FILENO	0		/* ANSI C #defines */
+#define	STDOUT_FILENO	1
+#define	STDERR_FILENO	2
+#endif
+
+#ifndef SEEK_END
+#define	SEEK_SET	0		/* POSIX 1003.1 seek values */
+#define	SEEK_CUR	1
+#define	SEEK_END	2
+#endif
+
+#ifndef _POSIX_VDISABLE			/* POSIX 1003.1 disabling char. */
+#define	_POSIX_VDISABLE	0		/* Some systems used 0. */
+#endif
+
+#ifndef	TCSASOFT			/* 4.4BSD extension. */
+#define	TCSASOFT	0
+#endif
+
+#ifndef _POSIX2_RE_DUP_MAX		/* POSIX 1003.2 values. */
+#define	_POSIX2_RE_DUP_MAX	255
+#endif
+
+#ifndef NULL				/* ANSI C #defines NULL everywhere. */
+#define	NULL		0
+#endif
+
+#ifndef	MAX				/* Usually found in <sys/param.h>. */
+#define	MAX(_a,_b)	((_a)<(_b)?(_b):(_a))
+#endif
+#ifndef	MIN				/* Usually found in <sys/param.h>. */
+#define	MIN(_a,_b)	((_a)<(_b)?(_a):(_b))
+#endif
+
+/* Default file permissions. */
+#ifndef DEF_FILEMODE			/* 4.4BSD extension. */
+#define	DEF_FILEMODE	(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
+#endif
+
+#ifndef S_ISDIR				/* POSIX 1003.1 file type tests. */
+#define	S_ISDIR(m)	((m & 0170000) == 0040000)	/* directory */
+#define	S_ISCHR(m)	((m & 0170000) == 0020000)	/* char special */
+#define	S_ISBLK(m)	((m & 0170000) == 0060000)	/* block special */
+#define	S_ISREG(m)	((m & 0170000) == 0100000)	/* regular file */
+#define	S_ISFIFO(m)	((m & 0170000) == 0010000)	/* fifo */
+#endif
+#ifndef S_ISLNK				/* BSD POSIX 1003.1 extensions */
+#define	S_ISLNK(m)	((m & 0170000) == 0120000)	/* symbolic link */
+#define	S_ISSOCK(m)	((m & 0170000) == 0140000)	/* socket */
+#endif
+
+/* The type of a va_list. */
+#ifndef _BSD_VA_LIST_			/* 4.4BSD #define. */
+#define	_BSD_VA_LIST_	char *
+#endif
+
+#endif /* !_COMPAT_H_ */

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpaix.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpaix.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpaix.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpaix.h,v 1.1 1995/09/21 17:13:02 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpalpha.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpalpha.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpalpha.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpalpha.h,v 1.1 1995/09/21 17:13:03 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpconvex.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpconvex.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpconvex.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpconvex.h,v 1.1 1995/09/21 17:13:04 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpdec.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpdec.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpdec.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpdec.h,v 1.1 1995/09/21 17:13:05 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpfbsd.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpfbsd.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpfbsd.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpfbsd.h,v 1.2 1995/09/25 16:16:48 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+#define HAVE_CDEFS_H
+#define __BIT_TYPES_DEFINED__
+#define	BYTE_ORDER  LITTLE_ENDIAN	
+
+#endif /* _FMPCONF_H */
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpfujivp.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpfujivp.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpfujivp.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpfujivp.h,v 1.1 1996/03/27 21:21:18 koziol Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmphpux.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmphpux.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmphpux.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmphpux.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmphpux.h,v 1.1 1995/09/21 17:13:06 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpia64.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpia64.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpia64.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpia64.h,v 1.1 2000/05/23 18:07:04 acheng Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix32.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix32.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix32.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,44 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpirix5.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpirix32.h,v 1.1 1995/09/21 17:13:07 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+#define __BIT_TYPES_DEFINED__   /* for SGI */
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix4.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix4.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix4.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,44 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpirix5.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpirix4.h,v 1.1 1995/09/21 17:13:08 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+#define __BIT_TYPES_DEFINED__   /* for SGI */
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix5.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix5.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix5.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,44 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpirix5.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpirix5.h,v 1.1 1995/09/21 17:13:08 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+#define __BIT_TYPES_DEFINED__   /* for SGI */
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix6.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix6.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpirix6.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,44 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpirix5.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpirix6.h,v 1.1 1995/09/21 17:13:09 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+#define __BIT_TYPES_DEFINED__   /* for SGI */
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmplinux.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmplinux.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmplinux.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmplinux.h,v 1.2 1995/09/25 16:16:49 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+#define HAVE_CDEFS_H
+#define	BYTE_ORDER  LITTLE_ENDIAN	
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpmac.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpmac.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpmac.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpmac.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpmac.h,v 1.1 1996/02/23 00:16:09 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpsolaris.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpsolaris.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpsolaris.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpsolaris.h,v 1.1 1995/09/21 17:13:11 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpsun.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpsun.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpsun.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpsun.h,v 1.1 1995/09/21 17:13:11 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpt3e.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpt3e.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpt3e.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpt3e.h,v 1.1 1996/05/06 19:05:19 acheng Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpunicos.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpunicos.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/fmpunicos.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpsun.h
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmpunicos.h,v 1.1 1995/09/21 17:13:12 georgev Exp $ */
+
+#ifndef _FMPCONF_H
+#define _FMPCONF_H
+
+#define HAVE_PROTOTYPES
+#define HAVE_UCHAR
+#define HAVE_UINT
+#define HAVE_ULONG
+#define HAVE_USHORT
+#define HAVE_SIZE_T
+#define HAVE_SSIZE_T
+#define HAVE_SIGSET_T
+#define HAVE_LIMITS_H
+#define HAVE_UNISTD_H
+#define HAVE_STDLIB
+#define HAVE_STDIO_H
+#define HAVE_FCNTL
+#define HAVE_STAT
+#define HAVE_MIN_MAX
+
+#endif /* _FMPCONF_H */
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-aix
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-aix	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-aix	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,40 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+CC=gcc
+CFLAGS= -O -ansi 
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-alpha
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-alpha	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-alpha	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+
+#Using ANSI compilier
+CC=cc
+CFLAGS= -Olimit 2048 -std1
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-convex
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-convex	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-convex	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+
+#Using ANSI compilier
+CC=cc
+CFLAGS= -ext
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-decstation
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-decstation	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-decstation	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+CC=gcc
+CFLAGS= -O -ansi 
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-fbsd
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-fbsd	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-fbsd	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+CC=gcc
+CFLAGS= -O -ansi 
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-fujivp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-fujivp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-fujivp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS=-O
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rs
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-hpux
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-hpux	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-hpux	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,46 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# HPUX ANSI compilier
+CC=cc
+CFLAGS= -O -Aa -D_HPUX_SOURCE
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -g -ansi -D_HPUX_SOURCE 
+#CFLAGS= -g -ansi -Wall -pedantic -D_HPUX_SOURCE
+#CFLAGS= -O -ansi -D_HPUX_SOURCE 
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-ia64
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-ia64	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-ia64	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+
+#Using ANSI compilier
+CC=cc
+CFLAGS=
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix32
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix32	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix32	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,49 @@
+# $Id: mh-irix32,v 1.3 1996/10/31 00:13:00 acheng Exp $
+#
+# Machine/OS: SGI/IRIX 6.0 (32-bit mode)
+#
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+#
+#Using ANSI compilier for 32-bit mode
+CC=cc
+CFLAGS=-ansi -n32 -mips3
+
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= -n32 -mips3
+LDLIBS= 
+
+# Name of archive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rs
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move comamnd
+MV= mv
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix4
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+# This makefile fragment will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS=-ansi
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of archive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rs
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+AR2 = true
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix5
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix5	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix5	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS=-ansi
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of archive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rs
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix6
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix6	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-irix6	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS=-ansi
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS=
+LDLIBS= 
+
+# Name of archive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rs
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-linux
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-linux	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-linux	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,40 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+CC=gcc
+CFLAGS= -O -ansi 
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-mac
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-mac	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-mac	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+CC=gcc
+CFLAGS= -O -ansi 
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-solaris
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-solaris	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-solaris	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS= -Xa
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-sun
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-sun	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-sun	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+CC=gcc
+CFLAGS= -O -ansi 
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = ru
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-t3e
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-t3e	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-t3e	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS=
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-unicos
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-unicos	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config/mh-unicos	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+# Gnu GCC
+#CC=gcc
+#CFLAGS= -O -ansi 
+#
+#Using ANSI compilier
+CC=cc
+CFLAGS=
+
+# -DPURIFY     -> when using purify
+# -DSTATISTICS -> when you want statistics
+# -DMPOOL_DEBUG -> debugging fmpool_xxx interface
+# -DMP_DEBUG    -> debugging MPxxx interface
+# 
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMPOOL_DEBUG -DMP_DEBUG -DCIRCLEQ_DEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DMP_DEBUG -DDEBUG
+#AUXFLAGS= -DPURIFY -DSTATISTICS -DSTAT_DEBUG
+#AUXFLAGS= -DHAVE_GETRUSAGE -DSTATISTICS
+#AUXFLAGS= -DDEBUG
+#AUXFLAGS= 
+
+LDFLAGS= 
+LDLIBS= 
+
+# Name of achive randomizer, usually ranlib (use 'true' if non-existant)
+RANLIB = true
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+# Move command
+MV= mv
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config.guess
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config.guess	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config.guess	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,489 @@
+#!/bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, 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.
+
+# Written by Per Bothner <bothner at cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# 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 system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 8/24/94.)
+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
+UNAME_PROCESSOR=`(uname -p) 2>/dev/null` || UNAME_PROCESSOR=unknown
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}:${UNAME_PROCESSOR}" in
+    alpha:OSF1:V*:*)
+	# After 1.2, OSF1 uses "V1.3" for uname -r.
+	echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
+	exit 0 ;;
+    alpha:OSF1:*:*)
+	# 1.2 uses "1.2" for uname -r.
+	echo alpha-dec-osf${UNAME_RELEASE}
+        exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit 0;;
+    Pyramid*:OSx*:*:*)
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit 0 ;;
+    sun4*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    i86pc*:SunOS:*:*)
+	echo i386-sun-solaris2${UNAME_RELEASE}
+	exit 0 ;;
+    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 0 ;;
+    sun4*:SunOS:*:*)
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit 0 ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    mips:*:5*:RISCos)
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit 0 ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit 0 ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit 0 ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    AViiON:dgux:*:*)
+	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	fi
+ 	exit 0 ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit 0 ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit 0 ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix${UNAME_RELEASE}
+	exit 0 ;;
+    i[34]86:AIX:*:*)
+	echo i386-ibm-aix
+	exit 0 ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		sed 's/^		//' << EOF >dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+		rm -f dummy.c dummy
+		echo rs6000-ibm-aix3.2.5
+	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 0 ;;
+    *:AIX:*:4)
+	if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
+		IBM_REV=4.1
+	elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
+		IBM_REV=4.1.1
+	else
+		IBM_REV=4.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit 0 ;;
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit 0 ;;
+    9000/[3478]??:HP-UX:*:*)
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;;
+	    9000/8?? )            HP_ARCH=hppa1.0 ;;
+	esac
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    3050*:HI-UX:*:*)
+	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-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+	rm -f dummy.c dummy
+	echo unknown-hitachi-hiuxwe2
+	exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit 0 ;;
+    hp7??:OSF1:*:* | hp8?7:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit 0 ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*X-MP:*:*:*)
+	echo xmp-cray-unicos
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos
+        exit 0 ;;
+    CRAY-2:*:*:*)
+	echo cray2-cray-unicos
+        exit 0 ;;
+    CRAY*C90:c90:*:*)
+	echo c90-cray-unicos
+        exit 0 ;;
+    CRAY*J90:*:*:*)
+	echo j90-cray-unicos
+        exit 0 ;;
+    CRAY*TS:*:*:*)
+        echo t90-cray-unicos
+        exit 0 ;;
+    CRAY*T3*:*:*:*)
+        echo t3e-cray-craympp
+        exit 0 ;;
+    hp3[0-9][05]:NetBSD:*:*)
+	echo m68k-hp-netbsd${UNAME_RELEASE}
+	exit 0 ;;
+    i[34]86:BSD/386:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:FreeBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit 0 ;;
+    *:NetBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	exit 0 ;;
+    *:GNU:*:*)
+	echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit 0 ;;
+    *:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux
+	exit 0 ;;
+# 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.
+    i[34]86:DYNIX/ptx:4*:*)
+	echo i386-sequent-sysv4
+	exit 0 ;;
+    i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+	else
+		echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
+	fi
+	exit 0 ;;
+    i[34]86:*:3.2:*)
+	if /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+		echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
+	elif test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-unknown-sysv32
+	fi
+	exit 0 ;;
+    Intel:Mach:3*:*)
+	echo i386-unknown-mach3
+	exit 0 ;;
+    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 0 ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit 0 ;;
+    M680[234]0:*:R3V[567]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
+        uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4.3 && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m680[234]0:LynxOS:2.2*:*)
+	echo m68k-lynx-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit 0 ;;
+    i[34]86:LynxOS:2.2*:*)
+	echo i386-lynx-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    TSUNAMI:LynxOS:2.2*:*)
+	echo sparc-lynx-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    rs6000:LynxOS:2.2*:*)
+	echo rs6000-lynx-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    *:*:*:*:S370)
+        echo S370-fujitsu-sysv
+        exit 0 ;;
+    *: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 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+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
+  printf ("m68k-sony-newsos\n"); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); 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`;
+  printf ("%s-next-nextstep%s\n", __ARCHITECTURE__,  version==2 ? "2" : "3");
+  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-unknown-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_)
+  printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+  printf ("vax-dec-bsd\n"); exit (0);
+#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-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# 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 0 ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit 0 ;;
+    c34*)
+	echo c34-convex-bsd
+	exit 0 ;;
+    c38*)
+	echo c38-convex-bsd
+	exit 0 ;;
+    c4*)
+	echo c4-convex-bsd
+	exit 0 ;;
+    esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/config.sub
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/config.sub	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/config.sub	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,827 @@
+#!/bin/sh
+# Configuration validation subroutine script, version 1.1.
+#   Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+# 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., 675 Mass Ave, Cambridge, MA 02139, 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.
+
+# 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
+# It is wrong to echo any other type of specification.
+
+# First pass through any local machine types.
+case $1 in
+	*local*)
+		echo $1
+		exit 0
+		;;
+	*)
+	;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS (if any).
+basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+if [ $basic_machine != $1 ]
+then os=`echo $1 | sed 's/.*-/-/'`
+else os=; fi
+
+### 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 )
+		os=
+		basic_machine=$1
+		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+		;;
+	-lynx)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+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.
+	tahoe | i[3456]86 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
+		| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
+		| alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
+		| powerpc | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
+		| pdp11 | mips64el | mips64orion | mips64orionel )
+		basic_machine=$basic_machine-unknown
+		;;
+	# 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.
+	vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+	      | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* | ia64-* \
+	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+	      | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
+	      | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+	      | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
+	      | pdp11-* | sh-* | powerpc-* | sparc64-* | mips64-* | mipsel-* \
+	      | mips64el-* | mips64orion-* | mips64orionel-* | S370-* )
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-cbm
+		;;
+	amigados)
+		basic_machine=m68k-cbm
+		os=-amigados
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-cbm
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	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 | ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	cray2)
+		basic_machine=cray2-cray
+		os=-unicos
+		;;
+	c90*)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	cray-t3* | t3* | t3*-cray)
+		basic_machine=t3e-cray
+		os=-craympp
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	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
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-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
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i[3456]86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+		os=-sysv32
+		;;
+	i[3456]86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+		os=-sysv4
+		;;
+	i[3456]86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+		os=-sysv
+		;;
+	i[3456]86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+		os=-solaris2
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	irix6_32)
+		basic_machine=mips-sgi
+		os=-irix6_32
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	j90*)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	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
+		;;
+	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
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+        pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pentium-*)
+		# We will change tis to say i586 once there has been
+		# time for various packages to start to recognize that.
+		basic_machine=i486-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	fujitsu | vp | S370)
+		basic_machine=vp-fujitsu
+		os=-sysv
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	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
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+  	mac)
+		basic_machine=m68k-mac
+		os=-macos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+        t90*)
+                basic_machine=t90-cray
+                os=-unicos
+                ;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	xmp)
+		basic_machine=xmp-cray
+		os=-unicos
+		;;
+        xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	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.
+	mips)
+		basic_machine=mips-mips
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sparc)
+		basic_machine=sparc-sun
+		;;
+        cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	*)
+		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
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux|'`
+		;;
+	# 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[3456]* \
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigados* | -msdos* | -newsos* | -unicos* | -craympp | -aos* \
+	      | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
+	      | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+	      | -ptx* | -coff* | -winnt*)
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-xenix)
+		os=-xenix
+		;;
+  	-macos)
+		os=-macos
+		;;
+	-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
+	*-acorn)
+		os=-riscix1.2
+		;;
+        pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigados
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-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
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	*)
+		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
+				;;
+			-lynxos*)
+				vendor=lynx
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs*)
+				vendor=ibm
+				;;
+          -macos*)
+               vendor=apple
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os


Property changes on: packages/libhdf4/branches/upstream/current/hdf/fmpool/config.sub
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/configure
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/configure	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/configure	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1091 @@
+#!/bin/sh
+
+### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
+
+# Configuration script
+# Copyright (C) 1988, 90, 91, 92, 93, 94 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 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# This version has been modified from the original configure script
+# Please report any problems running this configure script to
+# hdfhelp at ncsa.uiuc.edu
+#
+# OLD: Please report any problems running this configure script to
+#      configure at cygnus.com
+#      Please do not send reports about other problems to this address.  See
+#      gdb/README, gas/README, etc., for info on where and how to report
+#      problems about particular tools.
+
+# The orginal file was written by K. Richard Pixley.
+# This file has been modified by HDF group
+#
+# Shell script to create proper links to machine-dependent files in
+# preparation for compilation.
+#
+# If configure succeeds, it leaves its status in config.status.
+# If configure fails after disturbing the status quo, 
+#       config.status is removed.
+#
+
+export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
+
+remove=rm
+hard_link=ln
+symbolic_link='ln -s'
+mkdirprog=mkdir        # what is your make-directory-program
+
+#for Test
+#remove="echo rm"
+#hard_link="echo ln"
+#symbolic_link="echo ln -s"
+
+# clear some things potentially inherited from environment.
+
+Makefile=Makefile
+Makefile_in=Makefile.in
+arguments=$*
+build_alias=
+configdirs=
+exec_prefix=
+exec_prefixoption=
+fatal=
+floating_point=default
+gas=default
+host_alias=NOHOST
+host_makefile_frag=
+moveifchange=
+norecursion=
+other_options=
+package_makefile_frag=
+prefix='$(TOP_SRCDIR)/NewHDF'
+progname=
+program_prefix=
+program_prefixoption=
+program_suffix=
+program_suffixoption=
+program_transform_name=
+program_transform_nameoption=
+redirect=">/dev/null"
+removing=
+site=
+site_makefile_frag=
+site_option=
+srcdir=
+srctrigger=
+subdirs=
+target_alias=NOTARGET
+target_makefile_frag=
+undefs=NOUNDEFS
+version="$Revision: 1.7 $"
+x11=default
+
+### we might need to use some other shell than /bin/sh for running subshells
+#
+config_shell=${CONFIG_SHELL-/bin/sh}
+
+NO_EDIT="This file was generated automatically by configure.  Do not edit."
+
+## this is a little touchy and won't always work, but...
+##
+## if the argv[0] starts with a slash then it is an absolute name that can (and
+## must) be used as is.
+##
+## otherwise, if argv[0] has no slash in it, we can assume that it is on the
+## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
+##
+
+progname=$0
+# if PWD already has a value, it is probably wrong.
+if [ -n "$PWD" ]; then PWD=`pwd`; fi
+
+case "${progname}" in
+/*) ;;
+*/*) ;;
+*)
+        PATH=$PATH:${PWD=`pwd`} ; export PATH
+        ;;
+esac
+
+# Loop over all args
+
+#while :
+for arg
+do
+
+# Break out if there are no more args
+	case $# in
+	0)
+		break
+		;;
+	esac
+
+# Get the first arg, and shuffle
+	option=$1
+	shift
+
+# Make all options have two hyphens
+	orig_option=$option	# Save original for error messages
+	case $option in
+	--*) ;;
+	-*) option=-$option ;;
+	esac
+		
+# Split out the argument for options that take them
+	case $option in
+	--*=*)
+		optarg=`echo $option | sed -e 's/^[^=]*=//'`
+		;;
+# These options have mandatory values.  Since we didn't find an = sign,
+# the value must be in the next argument
+	--b* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
+		optarg=$1
+		shift
+		;;
+	esac
+
+# Now, process the options
+	case $option in
+
+	--build* | --b*)
+		case "$build_alias" in
+		"") build_alias=$optarg ;;
+		*) echo '***' Can only configure for one build machine at a time.  1>&2
+		   fatal=yes
+		   ;;
+		esac
+		;;
+# Accepted for compatibility with new autoconf; ignored.
+	--cache*)
+		;;
+	--disable-*)
+		enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
+		eval $enableopt=no
+		disableoptions="$disableoptions $option"
+		;;
+	--enable-*)
+		case "$option" in
+		*=*)	;;
+		*)	optarg=yes ;;
+		esac
+
+		enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
+		eval $enableopt="$optarg"
+		enableoptions="$enableoptions $option"
+		;;
+	--exec-prefix* | --ex*)
+		exec_prefix=$optarg
+		exec_prefixoption="--exec-prefix=$optarg"
+		;;
+	--gas | --g*)
+		gas=yes
+		;;
+	--help | --he*)
+		fatal=yes
+		;;
+	--host* | --ho*)
+		case $host_alias in
+		NOHOST) host_alias=$optarg ;;
+		*) echo '***' Can only configure for one host at a time.  1>&2
+		   fatal=yes
+		   ;;
+		esac
+		;;
+	--nfp | --nf*)
+		floating_point=no
+		;;
+	--norecursion | --no*)
+		norecursion=yes
+		;;
+	--prefix* | --pre*)
+		prefix=$optarg
+		prefixoption="--prefix=$optarg"
+		;;
+	--program-prefix* | --program-p*)
+		program_prefix=$optarg
+		program_prefixoption="--program-prefix=$optarg"
+		;;
+	--program-suffix* | --program-s*)
+		program_suffix=$optarg
+		program_suffixoption="--program-suffix=$optarg"
+		;;
+	--program-transform-name* | --program-t*)
+		# Double any backslashes or dollar signs in the argument
+		program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
+		program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
+		;;
+	--rm)
+		removing=--rm
+		;;
+	--silent | --sil* | --quiet | --q*)
+		redirect=">/dev/null"
+		verbose=--silent
+		;;
+	--site* | --sit*)
+		site=$optarg
+		site_option="--site=$optarg"
+		;;
+	--srcdir*/ | --sr*/)
+                # Remove trailing slashes.  Otherwise, when the file name gets
+                # bolted into an object file as debug info, it has two slashes
+                # in it.  Ordinarily this is ok, but emacs takes double slash
+                # to mean "forget the first part".
+		srcdir=`echo $optarg | sed -e 's:/$::'`
+		;;
+	--srcdir* | --sr*)
+		srcdir=$optarg
+		;;
+	--target* | --ta*)
+		case $target_alias in
+		NOTARGET) target_alias=$optarg ;;
+		*) echo '***' Can only configure for one target at a time.  1>&2
+		   fatal=yes
+		   ;;
+		esac
+		;;
+	--tmpdir* | --tm*)
+		TMPDIR=$optarg
+		tmpdiroption="--tmpdir=$optarg"
+		;;
+	--verbose | --v | --verb*)
+		redirect=
+		verbose=--verbose
+		;;
+	--version | --V | --vers*)
+		echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
+		exit 0
+		;;
+	--with-*)
+		case "$option" in
+		*=*)	;;
+		*)	optarg=yes ;;
+		esac
+
+		withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
+		eval $withopt="$optarg"
+		withoptions="$withoptions $option"
+		;;
+	--without-*)
+		withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
+		eval $withopt=no
+		withoutoptions="$withoutoptions $option"
+		;;
+	--x)	with_x=yes
+		withoptions="$withoptions --with-x"
+		;;
+	--x-i* | --x-l*) other_options="$other_options $orig_option"
+		;;
+	--*)
+		echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
+		exit 1
+		;;
+	*)
+		case $undefs in
+		NOUNDEFS) undefs=$option ;;
+		*) echo '***' Can only configure for one host and one target at a time.  1>&2
+		   fatal=yes
+		   ;;
+		esac
+		;;
+	esac
+done
+
+# process host and target
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET UNDEFS
+#
+# The rules are:
+# 1. You aren't allowed to specify --host, --target, and undefs at the
+#    same time.
+# 2. Host defaults to undefs.
+# 3. If undefs is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target defaults to undefs.
+# 5. If undefs is not specified, then target defaults to host.
+
+case "${fatal}" in
+"")
+	# Make sure that host, target & undefs aren't all specified at the
+	# same time.
+	case $host_alias---$target_alias---$undefs in
+	NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
+		;;
+	*) echo '***' Can only configure for one host and one target at a time.  1>&2
+	   fatal=yes
+	   break 2
+		;;
+	esac
+
+	# Now, do defaulting for host.
+	case $host_alias in
+	NOHOST)
+		case $undefs in
+		NOUNDEFS)
+			# Neither --host option nor undefs were present.
+			# Call config.guess.
+			guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
+			if host_alias=`${guesssys}`
+			then
+				# If the string we are going to use for
+				# the target is a prefix of the string
+				# we just guessed for the host, then
+				# assume we are running native, and force
+				# the same string for both target and host.
+				case $target_alias in
+				NOTARGET) ;;
+				*)
+					if expr $host_alias : $target_alias >/dev/null
+					then
+						host_alias=$target_alias
+					fi
+					;;
+				esac
+				echo "Configuring for a ${host_alias} host." 1>&2
+				arguments="--host=$host_alias $arguments"
+			else
+				echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
+				fatal=yes
+			fi
+			;;
+		*)
+			host_alias=$undefs
+			;;
+		esac
+	esac
+
+	# Do defaulting for target.  If --target option isn't present, default
+	# to undefs.  If undefs isn't present, default to host.
+	case $target_alias in
+	NOTARGET)
+		case $undefs in
+		NOUNDEFS)
+			target_alias=$host_alias
+			;;
+		*)
+			target_alias=$undefs
+			;;
+		esac
+	esac
+	;;
+*) ;;
+esac
+
+if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
+	exec 1>&2
+	echo Usage: configure [OPTIONS] [HOST]
+	echo
+	echo Options: [defaults in brackets]
+	echo ' --prefix=MYDIR		 install into MYDIR [/usr/local]'
+	echo ' --exec-prefix=MYDIR	 install host-dependent files into MYDIR [/usr/local]'
+	echo ' --help			 print this message [normal config]'
+	echo ' --build=BUILD		 configure for building on BUILD [BUILD=HOST]'
+	echo ' --host=HOST		 configure for HOST [determined via config.guess]'
+	echo ' --norecursion		 configure this directory only [recurse]'
+	echo ' --program-prefix=FOO	 prepend FOO to installed program names [""]'
+	echo ' --program-suffix=FOO	 append FOO to installed program names [""]'
+	echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
+	echo ' --site=SITE		 configure with site-specific makefile for SITE'
+	echo ' --srcdir=DIR		 find the sources in DIR [. or ..]'
+	echo ' --target=TARGET	 configure for TARGET [TARGET=HOST]'
+	echo ' --tmpdir=TMPDIR	 create temporary files in TMPDIR [/tmp]'
+	echo ' --nfp			 configure for software floating point [hard float]'
+	echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
+	echo ' --without-FOO		 package FOO is NOT available'
+	echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
+	echo ' --disable-FOO		 do not include feature FOO'
+	echo
+	echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
+	echo
+	if [ -r config.status ] ; then
+		cat config.status
+	fi
+
+	exit 1
+fi
+
+configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
+moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
+
+# this is a hack.  sun4 must always be a valid host alias or this will fail.
+if ${configsub} sun4 >/dev/null 2>&1 ; then
+        true
+else
+        echo '***' cannot find config.sub.  1>&2
+        exit 1
+fi
+
+touch config.junk
+if ${moveifchange} config.junk config.trash ; then
+        true
+else
+        echo '***' cannot find move-if-change.  1>&2
+        exit 1
+fi
+rm -f config.junk config.trash
+
+case "${srcdir}" in
+"")
+        if [ -r configure.in ] ; then
+                srcdir=.
+        else
+                if [ -r ${progname}.in ] ; then
+                        srcdir=`echo ${progname} | sed 's:/configure$::'`
+                else
+                        echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
+                        exit 1
+                fi
+        fi
+        ;;
+*) ;;
+esac
+
+### warn about some conflicting configurations.
+
+case "${srcdir}" in
+".") ;;
+*)
+        if [ -f ${srcdir}/config.status ] ; then
+                echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
+                exit 1
+        fi
+esac
+
+# default exec_prefix
+case "${exec_prefixoption}" in
+"") exec_prefix="\$(prefix)" ;;
+*) ;;
+esac
+
+### break up ${srcdir}/configure.in.
+case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
+"")
+        echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
+        exit 1
+        ;;
+*) ;;
+esac
+
+case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
+"")
+        echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
+        exit 1
+        ;;
+*) ;;
+esac
+
+case "${TMPDIR}" in
+"") TMPDIR=/tmp ; export TMPDIR ;;
+*) ;;
+esac
+
+# keep this filename short for &%*%$*# 14 char file names
+tmpfile=${TMPDIR}/cONf$$
+# Note that under many versions of sh a trap handler for 0 will *override* any
+# exit status you explicitly specify!  At this point, the only non-error exit
+# is at the end of the script; these actions are duplicated there, minus
+# the "exit 1".  Don't use "exit 0" anywhere after this without resetting the
+# trap handler, or you'll lose.
+trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
+
+# split ${srcdir}/configure.in into common, per-host, per-target,
+# and post-target parts.  Post-target is optional.
+sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
+sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
+if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
+  sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
+  sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
+else
+  sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
+  echo >${tmpfile}.pos
+fi
+
+### do common part of configure.in
+
+. ${tmpfile}.com
+
+# some sanity checks on configure.in
+case "${srctrigger}" in
+"")
+        echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
+        exit 1
+        ;;
+*) ;;
+esac
+
+case "${build_alias}" in
+"")	;;
+*)
+	if result=`${config_shell} ${configsub} ${build_alias}` ; then
+	    buildopt="--build=${build_alias}"
+	    build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+	    build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+	    build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+	    build=${build_cpu}-${build_vendor}-${build_os}
+	else
+	    echo "Unrecognized build system name ${build_alias}." 1>&2
+	    exit 1
+	fi
+	;;
+esac
+
+if result=`${config_shell} ${configsub} ${host_alias}` ; then
+    true
+else
+    echo "Unrecognized host system name ${host_alias}." 1>&2
+    exit 1
+fi
+host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+host=${host_cpu}-${host_vendor}-${host_os}
+
+. ${tmpfile}.hst
+
+if result=`${config_shell} ${configsub} ${target_alias}` ; then
+    true
+else
+    echo "Unrecognized target system name ${target_alias}." 1>&2
+    exit 1
+fi
+target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+target=${target_cpu}-${target_vendor}-${target_os}
+
+. ${tmpfile}.tgt
+
+# Find the source files, if location was not specified.
+case "${srcdir}" in
+"")
+        srcdirdefaulted=1
+        srcdir=.
+        if [ ! -r ${srctrigger} ] ; then
+                srcdir=..
+        fi
+        ;;
+*) ;;
+esac
+
+if [ ! -r ${srcdir}/${srctrigger} ] ; then
+        case "${srcdirdefaulted}" in
+        "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
+        *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
+        esac
+
+        echo '***' \(At least ${srctrigger} is missing.\) 1>&2
+        exit 1
+fi
+
+# Some systems (e.g., one of the i386-aix systems the gas testers are
+# using) don't handle "\$" correctly, so don't use it here.
+tooldir='$(exec_prefix)'/${target_alias}
+
+if [ "${host_alias}" != "${target_alias}" ] ; then
+    if [ "${program_prefixoption}" = "" ] ; then
+        if [ "${program_suffixoption}" = "" ] ; then 
+            if [ "${program_transform_nameoption}" = "" ] ; then
+                program_prefix=${target_alias}- ;
+            fi
+        fi
+    fi
+fi
+
+# Merge program_prefix and program_suffix onto program_transform_name.
+# (program_suffix used to use $, but it's hard to preserve $ through both
+# make and sh.)
+if [ "${program_suffix}" != "" ] ; then
+    program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
+fi
+
+if [ "${program_prefix}" != "" ] ; then
+    program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
+fi
+
+for subdir in . ${subdirs} ; do
+
+    # ${subdir} is relative path from . to the directory we're currently
+    # configuring.
+    # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
+    invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
+
+    ### figure out what to do with srcdir
+    case "${srcdir}" in
+        ".")  # no -srcdir option.  We're building in place.
+                makesrcdir=. ;;
+        /*) # absolute path
+                makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
+                ;;
+        *) # otherwise relative
+                case "${subdir}" in
+                .) makesrcdir=${srcdir} ;;
+                *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
+                esac
+                ;;
+    esac
+
+    if [ "${subdir}/" != "./" ] ; then
+        Makefile=${subdir}/Makefile
+    fi
+
+    if [ ! -d ${subdir} ] ; then
+        if mkdir ${subdir} ; then
+                true
+        else
+                echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
+                exit 1
+        fi
+    fi
+
+    case "${removing}" in
+    "")
+        case "${subdir}" in
+        .) ;;
+        *) eval echo Building in ${subdir} ${redirect} ;;
+        esac
+
+        # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
+        # Set up the list of links to be made.
+        # ${links} is the list of link names, and ${files} is the list of names to link to.
+
+        # Make the links.
+        configlinks="${links}"
+        if [ -r ${subdir}/config.status ] ; then
+                mv -f ${subdir}/config.status ${subdir}/config.back
+        fi
+#
+#  Added THISDIR variable to make symlinks easier when linking
+#  to files not in the same directory -GV
+#        THISDIR=${PWD=`pwd`}
+        ### figure out what to do with srcdir
+        case "${srcdir}" in
+          ".") THISDIR=${PWD=`pwd`} ;; # no -srcdir option.  We're building in place.
+          /*) # absolute path
+              THISDIR=${srcdir}
+              ;;
+          *) # otherwise relative
+             THISDIR=../${srcdir}
+             ;;
+        esac
+#        echo "thisdir is $THISDIR "
+#        while [ -n "${files}" ] ; do
+        for file in ${files} ;  do
+                # set file to car of files, files to cdr of files
+                set ${files}; file=$1; shift; files=$*
+                set ${links}; link=$1; shift; links=$*
+
+                ## Took this code from 'install-sh' script
+                ## this sed command emulates the dirname command
+                dstdir=`echo $link | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+                # Make sure that the destination directory exists.
+                #  this part is taken from Noah Friedman's mkinstalldirs script
+
+                # Skip lots of stat calls in the usual case.
+                if [ ! -d "$dstdir" ]; then
+                  defaultIFS='	
+                  '
+                  IFS="${IFS-${defaultIFS}}"
+
+                  oIFS="${IFS}"
+                  # Some sh's can't handle IFS=/ for some reason.
+                  IFS='%'
+                  set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+                  IFS="${oIFS}"
+
+                  pathcomp=''
+
+                  while [ $# -ne 0 ] ; do
+                    pathcomp="${pathcomp}${1}"
+                    shift
+
+                    if [ ! -d "${pathcomp}" ] ;
+                    then
+                      $mkdirprog "${pathcomp}"
+                    else
+                      true
+                    fi
+
+                    pathcomp="${pathcomp}/"
+                  done
+                fi
+
+                if [ ! -r ${srcdir}/${file} ] ; then
+                  #                  echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
+                  # Changed to copy instead of linking. -GV(5/10/96)
+                        echo '***' "${progname}: cannot copy file \"${link}\"," 1>&2                  
+                        echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
+                        exit 1
+                fi
+
+                ${remove} -f ${link}
+		# Make a symlink if possible, otherwise try a hard link
+#
+#  Used variable THISDIR to make symlinks easier when linking
+#  to files not in the same directory -GV
+#		if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
+		if ${symbolic_link} ${THISDIR}/${file} ${link} >/dev/null 2>&1 ; then
+			true
+		else
+			# We need to re-remove the file because Lynx leaves a 
+			# very strange directory there when it fails an NFS symlink.
+			${remove} -r -f ${link}
+#			${hard_link} ${srcdir}/${file} ${link}
+			${hard_link} ${THISDIR}/${file} ${link}
+		fi
+                if [ ! -r ${link} ] ; then
+                  #                  echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
+                  # Changed to copy instead of linking. -GV(5/10/96)
+                  echo '***' "${progname}: unable to copy  \"${srcdir}/${file}\" to  \"${link}\"." 1>&2
+                        exit 1
+                fi
+
+# Changed to copy instead of Linking -GV(5/10/96)
+                echo "Copied \"${srcdir}/${file}\" to \"${link}\" ."
+#                echo "Linked \"${link}\" to \"${srcdir}/${file}\"."                                
+        done
+
+        # Create a .gdbinit file which runs the one in srcdir
+        # and tells GDB to look there for source files.
+
+        if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
+                case ${srcdir} in
+                .) ;;
+                *) cat > ${subdir}/.gdbinit <<EOF
+# ${NO_EDIT}
+dir ${makesrcdir}
+dir .
+source ${makesrcdir}/.gdbinit
+EOF
+                        ;;
+                esac
+        fi
+
+        # Install a makefile, and make it set VPATH
+        # if necessary so that the sources are found.
+        # Also change its value of srcdir.
+        # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
+        # been somewhat optimized and is perhaps a bit twisty.
+
+        # code is order so as to try to sed the smallest input files we know.
+
+        # the four makefile fragments MUST end up in the resulting Makefile in this order: 
+        # package, target, host, and site.  so do these separately because I don't trust the
+        #  order of sed -e expressions.
+
+        if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
+
+            # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
+            rm -f ${subdir}/Makefile.tem
+              case "${site}" in
+              "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
+              *)
+                      site_makefile_frag=${srcdir}/config/ms-${site}
+
+                      if [ -f ${site_makefile_frag} ] ; then
+                              sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
+                                      > ${subdir}/Makefile.tem
+                      else
+                              cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
+                              site_makefile_frag=
+                      fi
+                      ;;
+            esac
+            # working copy now in ${subdir}/Makefile.tem
+
+            # Conditionalize the makefile for this host.
+            rm -f ${Makefile}
+            case "${host_makefile_frag}" in
+              "") mv ${subdir}/Makefile.tem ${Makefile} ;;
+              *)
+                      if [ ! -f ${host_makefile_frag} ] ; then
+                              host_makefile_frag=${srcdir}/${host_makefile_frag}
+                      fi
+                      if [ -f ${host_makefile_frag} ] ; then
+                              sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
+                      else
+                              echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
+                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
+                              mv ${subdir}/Makefile.tem ${Makefile}
+                      fi
+            esac
+            # working copy now in ${Makefile}
+
+            # Conditionalize the makefile for this target.
+            rm -f ${subdir}/Makefile.tem
+            case "${target_makefile_frag}" in
+              "") mv ${Makefile} ${subdir}/Makefile.tem ;;
+              *)
+                      if [ ! -f ${target_makefile_frag} ] ; then
+                              target_makefile_frag=${srcdir}/${target_makefile_frag}
+                      fi
+                      if [ -f ${target_makefile_frag} ] ; then
+                              sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
+                      else
+                              mv ${Makefile} ${subdir}/Makefile.tem
+                              target_makefile_frag=
+                      fi
+                      ;;
+            esac
+            # real copy now in ${subdir}/Makefile.tem
+
+            # Conditionalize the makefile for this package.
+            rm -f ${Makefile}
+            case "${package_makefile_frag}" in
+              "") mv ${subdir}/Makefile.tem ${Makefile} ;;
+              *)
+                      if [ ! -f ${package_makefile_frag} ] ; then
+                              package_makefile_frag=${srcdir}/${package_makefile_frag}
+                      fi
+                      if [ -f ${package_makefile_frag} ] ; then
+                              sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
+			      rm -f ${subdir}/Makefile.tem
+                      else
+                              echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
+                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
+                              mv ${subdir}/Makefile.tem ${Makefile}
+                      fi
+            esac
+            # working copy now in ${Makefile}
+
+            mv ${Makefile} ${subdir}/Makefile.tem
+
+            # real copy now in ${subdir}/Makefile.tem
+
+            # prepend warning about editting, and a bunch of variables.
+            rm -f ${Makefile}
+            cat > ${Makefile} <<EOF
+# ${NO_EDIT}
+#VPATH = ${makesrcdir}
+links = ${configlinks}
+host_alias = ${host_alias}
+host_cpu = ${host_cpu}
+host_vendor = ${host_vendor}
+host_os = ${host_os}
+host_canonical = ${host_cpu}-${host_vendor}-${host_os}
+target_alias = ${target_alias}
+target_cpu = ${target_cpu}
+target_vendor = ${target_vendor}
+target_os = ${target_os}
+target_canonical = ${target_cpu}-${target_vendor}-${target_os}
+EOF
+	    case "${build}" in
+	      "") ;;
+	      *)  cat >> ${Makefile} << EOF
+build_alias = ${build_alias}
+build_cpu = ${build_cpu}
+build_vendor = ${build_vendor}
+build_os = ${build_os}
+build_canonical = ${build_cpu}-${build_vendor}-${build_os}
+EOF
+	    esac
+
+            case "${package_makefile_frag}" in
+              "") ;;
+              /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
+              *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
+            esac
+
+            case "${target_makefile_frag}" in
+              "") ;;
+              /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
+              *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
+            esac
+
+            case "${host_makefile_frag}" in
+              "") ;;
+              /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
+              *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
+            esac
+
+            if [ "${site_makefile_frag}" != "" ] ; then
+                echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
+            fi 
+
+	    # make sure that some sort of reasonable default exists for these 
+	    # two variables
+	    CXX=${CXX-"g++ -O"}
+	    CC=${CC-cc}
+
+            # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
+            # remove any form feeds.
+            if [ -z "${subdirs}" ]; then
+                rm -f ${subdir}/Makefile.tem2
+                sed -e "s:^SUBDIRS[ 	]*=.*$:SUBDIRS = ${configdirs}:" \
+                    -e "s:^NONSUBDIRS[ 	]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
+                    ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
+                rm -f ${subdir}/Makefile.tem
+                mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
+            fi
+            sed -e "s:^prefix[ 	]*=.*$:prefix = ${prefix}:" \
+                    -e "s:^exec_prefix[ 	]*=.*$:exec_prefix = ${exec_prefix}:" \
+		    -e "s:^SHELL[	 ]*=.*$:SHELL = ${config_shell}:" \
+                    -e "s:^srcdir[ 	]*=.*$:srcdir = ${makesrcdir}:" \
+                    -e "s///" \
+                    -e "s:^program_prefix[ 	]*=.*$:program_prefix = ${program_prefix}:" \
+                    -e "s:^program_suffix[ 	]*=.*$:program_suffix = ${program_suffix}:" \
+                    -e "s:^program_transform_name[ 	]*=.*$:program_transform_name = ${program_transform_name}:" \
+                    -e "s:^tooldir[ 	]*=.*$:tooldir = ${tooldir}:" \
+                    ${subdir}/Makefile.tem >> ${Makefile}
+            # final copy now in ${Makefile}
+
+        else
+           echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
+        fi
+
+        rm -f ${subdir}/Makefile.tem
+
+        case "${host_makefile_frag}" in
+        "") using= ;;
+        *) using="and \"${host_makefile_frag}\"" ;;
+        esac
+
+        case "${target_makefile_frag}" in
+        "") ;;
+        *) using="${using} and \"${target_makefile_frag}\"" ;;
+        esac
+
+        case "${site_makefile_frag}" in
+        "") ;;
+        *) using="${using} and \"${site_makefile_frag}\"" ;;
+        esac
+
+        newusing=`echo "${using}" | sed 's/and/using/'`
+        using=${newusing}
+        echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
+
+        . ${tmpfile}.pos
+
+        # describe the chosen configuration in config.status.
+        # Make that file a shellscript which will reestablish
+        # the same configuration.  Used in Makefiles to rebuild
+        # Makefiles.
+
+        case "${norecursion}" in
+        "") arguments="${arguments} --norecursion" ;;
+        *) ;;
+        esac
+
+        if [ ${subdir} = . ] ; then
+            echo "#!/bin/sh
+# ${NO_EDIT}
+# This directory was configured as follows:
+${progname}" ${arguments}  "
+# ${using}" > ${subdir}/config.new
+        else
+            echo "#!/bin/sh
+# ${NO_EDIT}
+# This directory was configured as follows:
+cd ${invsubdir}
+${progname}" ${arguments}  "
+# ${using}" > ${subdir}/config.new
+        fi
+        chmod a+x ${subdir}/config.new
+        if [ -r ${subdir}/config.back ] ; then
+                mv -f ${subdir}/config.back ${subdir}/config.status
+        fi
+        ${moveifchange} ${subdir}/config.new ${subdir}/config.status
+        ;;
+
+    *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
+    esac
+done
+
+# If there are subdirectories, then recur. 
+if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
+        for configdir in ${configdirs} ; do
+
+                if [ -d ${srcdir}/${configdir} ] ; then
+                        eval echo Configuring ${configdir}... ${redirect}
+                        case "${srcdir}" in
+                        ".") ;;
+                        *)
+                                if [ ! -d ./${configdir} ] ; then
+                                        if mkdir ./${configdir} ; then
+                                                true
+                                        else
+                                                echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
+                                                exit 1
+                                        fi
+                                fi
+                                ;;
+                        esac
+
+                        POPDIR=${PWD=`pwd`}
+                        cd ${configdir} 
+
+### figure out what to do with srcdir
+                        case "${srcdir}" in
+                        ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
+                        /*) # absolute path
+                                newsrcdir=${srcdir}/${configdir}
+                                srcdiroption="--srcdir=${newsrcdir}"
+                                ;;
+                        *) # otherwise relative
+                                newsrcdir=../${srcdir}/${configdir}
+                                srcdiroption="--srcdir=${newsrcdir}"
+                                ;;
+                        esac
+
+### check for guested configure, otherwise fix possibly relative progname
+                        if [ -f ${newsrcdir}/configure ] ; then
+                                recprog=${newsrcdir}/configure
+                        elif [ -f ${newsrcdir}/configure.in ] ; then
+                                case "${progname}" in
+                                /*)     recprog=${progname} ;;
+##
+## Changed the way this is handled the default case is to use
+## the top level configure found originaly and not the one found in
+## parent directory -GV
+##                              *)      recprog=../${progname} ;;
+                                *)      recprog=${POPDIR}/${progname} ;;
+                                esac
+			else
+				eval echo No configuration information in ${configdir} ${redirect}
+				recprog=
+                        fi
+
+### The recursion line is here.
+			if [ ! -z "${recprog}" ] ; then
+	                        if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
+        	                        ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
+                	                ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then
+	                                true
+        	                else
+					echo Configure in `pwd` failed, exiting. 1>&2
+                	                exit 1
+                        	fi
+			fi
+
+                        cd ${POPDIR}
+                fi
+        done
+fi
+
+# Perform the same cleanup as the trap handler, minus the "exit 1" of course,
+# and reset the trap handler.
+rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
+trap 0
+
+exit 0
+
+#
+# Local Variables:
+# fill-column: 131
+# End:
+#
+
+# end of configure

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/configure.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/configure.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/configure.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,154 @@
+##############################################################################
+## This file was taken from the Cygnus Toolkit distribution and used as
+## as a template. This is called by the top level Cygnus Configure.
+
+## This file is a Bourne shell script fragment that supplies the information
+## necessary to tailor a template configure script into the configure
+## script appropriate for this directory.  For more information, check
+## any existing configure script.  
+
+## Be warned, there are two types of configure.in files.  There are those
+## used by Autoconf, which are macros which are expanded into a configure
+## script by autoconf.  The other sort, of which this is one, is executed
+## by Cygnus configure.  
+
+## For more information on these two systems, check out the documentation
+## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi) or
+## the official documentation on these packages.    
+
+##############################################################################
+
+################################################################################
+
+srctrigger=fmpool.h
+srcname="FMPOOL library"
+
+# This gets set non-empty for some net releases of packages.
+appdirs=""
+
+# per-host:
+
+# Work in distributions for each host makefile fragment
+host_makefile_frag=""
+if [ -d ${srcdir}/config ]; then
+case "${host}" in
+  alpha-*-*)              host_makefile_frag=config/mh-alpha ;;
+  mips*-dec-ultrix*)      host_makefile_frag=config/mh-decstation ;;
+  mips*-sgi-irix6.*)      host_makefile_frag=config/mh-irix6 ;;
+  mips*-sgi-irix6_32*)    host_makefile_frag=config/mh-irix32 ;;
+  mips*-sgi-irix5*)       host_makefile_frag=config/mh-irix5 ;;
+  mips*-sgi-irix4*)       host_makefile_frag=config/mh-irix4 ;;
+  i[3456]86-*-linux*)     host_makefile_frag=config/mh-linux ;;
+  i[3456]86-*-freebsd*)   host_makefile_frag=config/mh-fbsd ;;
+  ia64-*-*)               host_makefile_frag=config/mh-ia64 ;;
+  *-ibm-aix*)             host_makefile_frag=config/mh-aix ;;
+  *-*-solaris2*)          host_makefile_frag=config/mh-solaris ;;
+  *-sun-*)		          host_makefile_frag=config/mh-sun ;;
+  *-hp-hpux*)             host_makefile_frag=config/mh-hpux ;;
+  *-convex-bsd*)          host_makefile_frag=config/mh-convex ;;
+  *-cray-unicos*)         host_makefile_frag=config/mh-unicos ;;
+  t3*-cray-craympp)       host_makefile_frag=config/mh-t3e ;;
+  S370*)                  host_makefile_frag=config/mh-fujivp ;;
+  *-mac-*)		          host_makefile_frag=config/mh-mac ;;
+esac
+fi
+
+# Check for valid platfroms before we continue
+if [ "${host_makefile_frag}" = "" ] ; then
+    echo '***' "The HDF/netCDF version of the FMPOOL library is not supported on host ${host}" 1>&2
+    echo '***' "Please read the HDF installation docs" 1>&2
+    exit 1
+fi
+
+# make sure makefile fragment is there
+if [ ! -f ${srcdir}/${host_makefile_frag} ]; then
+    echo '***' "We are missing makefile fragment ${host_makefile_frag}" 1>&2
+    echo '***' "Please read the installation docs" 1>&2
+    exit 1
+fi
+
+
+# The Solaris /usr/ucb/cc compiler does not appear to work.
+case "${host}" in
+  sparc-sun-solaris2*)
+      if [ "`/usr/bin/which ${CC-cc}`" = "/usr/ucb/cc" ] ; then
+          could_use=
+          [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
+          if [ -d /opt/cygnus/bin ] ; then
+              if [ "$could_use" == "" ] ; then
+                  could_use="/opt/cygnus/bin"
+              else
+                  could_use="$could_use or /opt/cygnus/bin"
+              fi
+          fi
+        if [ "$could_use" = "" ] ; then
+            echo "Warning: compilation may fail because you're using"
+            echo "/usr/ucb/cc.  You should change your PATH or CC "
+            echo "variable and rerun configure."
+        else
+            echo "Warning: compilation may fail because you're using"
+            echo "/usr/ucb/cc, when you should use the C compiler from"
+            echo "$could_use.  You should change your"
+            echo "PATH or CC variable and rerun configure."
+        fi
+      fi
+  ;;
+esac
+
+# per-target:
+
+#
+# get proper 'fmpconf.h' i.e link the correct pre-generated file
+files=
+links=fmpconf.h
+if [ -d ${srcdir}/config ]; then
+case "${host}" in
+  alpha-*-*)              files=config/fmpalpha.h ;;
+  mips*-dec-ultrix*)      files=config/fmpdec.h ;;
+  mips*-sgi-irix6.*)      files=config/fmpirix6.h ;;
+  mips*-sgi-irix6_32*)    files=config/fmpirix32.h ;;
+  mips*-sgi-irix5*)       files=config/fmpirix5.h ;;
+  mips*-sgi-irix4*)       files=config/fmpirix4.h ;;
+  i[3456]86-*-linux*)     files=config/fmplinux.h ;;
+  i[3456]86-*-freebsd*)   files=config/fmpfbsd.h ;;
+  ia64-*-*)               files=config/fmpia64.h ;;
+  *-ibm-aix*)             files=config/fmpaix.h ;;
+  *-*-solaris2*)          files=config/fmpsolaris.h ;;
+  *-sun-*)		          files=config/fmpsun.h ;;
+  *-hp-hpux*)             files=config/fmphpux.h ;;
+  *-convex-bsd*)          files=config/fmpconvex.h ;;
+  *-cray-unicos*)         files=config/fmpunicos.h ;;
+  t3*-cray-craympp)       files=config/fmpt3e.h ;;
+  S370*)                  files=config/fmpfujivp.h ;;
+  *-mac-*)		          files=config/fmpmac.h ;;
+esac
+fi
+
+# make sure host specific 'fmconf.h' is there
+if [ ! -f ${srcdir}/${files} ]; then
+    echo '***' "We are missing host specific ${files}" 1>&2
+    echo '***' "Please read the installation docs" 1>&2
+    exit 1
+fi
+
+# Decided to copy files instead of using symbolic links.
+#
+# Now for Mac and PC configurations we want to copy and not use symbolic
+# links. You can use this also for any platfrom you want.
+if [ -d ${srcdir}/config ]; then
+case "${host}" in
+  *-mac-*)             symbolic_link="cp -p" ;;
+  *-win-*)             symbolic_link="cp -p" ;;
+  *)                   symbolic_link="cp" ;;
+esac
+fi
+
+# post-target:
+
+# We don't have anything
+
+#
+# Local Variables:
+# fill-column: 131
+# End:
+#

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.3
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.3	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.3	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,240 @@
+.\" WARNING! THIS FILE WAS GENERATED AUTOMATICALLY BY c2man!
+.\" DO NOT EDIT! CHANGES MADE TO THIS FILE WILL BE LOST!
+.TH "fmpio" 3 "2 February 1996" "c2man fmpio.h"
+.SH "NAME"
+MPset,
+MPget,
+MPopen,
+MPclose,
+MPflush,
+MPseek,
+MPread,
+MPwrite \- File Memory Buffer Pool Stdio Interface
+.SH "SYNOPSIS"
+.ft B
+#include <fmpio.h>
+.sp
+extern int MPset
+.br
+(
+.br
+	int pagesize,
+.br
+	int maxcache,
+.br
+	int flags
+.br
+);
+.sp
+extern int MPget
+.br
+(
+.br
+	int *pagesize,
+.br
+	int *maxcache,
+.br
+	int flags
+.br
+);
+.sp
+extern MPFILE *MPopen
+.br
+(
+.br
+	const char *path,
+.br
+	int flags
+.br
+);
+.sp
+extern int MPclose(MPFILE *mpfs);
+.sp
+extern int MPflush(MPFILE *mpfs);
+.sp
+extern int MPseek
+.br
+(
+.br
+	MPFILE *mpfs,
+.br
+	off_t offset,
+.br
+	int whence
+.br
+);
+.sp
+extern int MPread
+.br
+(
+.br
+	MPFILE *mpfs,
+.br
+	void *buf,
+.br
+	size_t nbytes
+.br
+);
+.sp
+extern int MPwrite
+.br
+(
+.br
+	MPFILE *mpfs,
+.br
+	void *buf,
+.br
+	size_t nbytes
+.br
+);
+.ft R
+.SH "PARAMETERS"
+.TP
+.B "int pagesize"
+IN: pagesize to use for next open/create.
+.TP
+.B "int maxcache"
+IN: max number of pages to cache.
+.TP
+.BR "int flags" "	(MPset)"
+IN: flags = 0, MP_PAGEALL.
+.TP
+.B "int *pagesize"
+OUT: pagesize to used in last open/create.
+.TP
+.B "int *maxcache"
+OUT: max number of pages cached in last open/create.
+.TP
+.BR "int flags" "	(MPget)"
+IN:.
+.TP
+.B "const char *path"
+IN: filename.
+.TP
+.BR "int flags" "	(MPopen)"
+IN: DFACC_CREATE, DFACC_READ, DFACC_WRITE,
+DFACC_RDWR, DFACC_ALL.
+.TP
+.B "MPFILE *mpfs"
+IN: File Memory pool handle.
+.TP
+.B "off_t offset"
+IN: Offset into the file.
+.TP
+.B "int whence"
+IN: SEEK_CUR, SEEK_SET, SEEK_END.
+.TP
+.BR "void *buf" "	(MPread)"
+IN: User buffer to read data into.
+.TP
+.BR "size_t nbytes" "	(MPread)"
+IN: number of bytes to read in.
+.TP
+.BR "void *buf" "	(MPwrite)"
+IN: User buffer to write data from.
+.TP
+.BR "size_t nbytes" "	(MPwrite)"
+IN: number of bytes to write out.
+.SH "DESCRIPTION"
+.SS "MPset"
+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.
+.SS "MPget"
+This gets the last pagesize and maximum number of pages cached for
+the last open/create of a file.
+.SS "MPopen"
+Open/Create the file for reading/writing and create a memory pool for
+the file. Currently we let the library decide whether to use the
+default PAGESIZE for creating pages and MAXCACHE for number of pages
+to cache in the pool.
+.SS "MPclose"
+First sync the file memory pool to disk. Next close the file memory pool.
+Finally close the file.
+.SS "MPflush"
+Flushes the file memory pool to disk.
+.SS "MPseek"
+Seeks to the correct page in the file depending upon the offset and the
+flag 'whence'. Similiar to the stdio routine. Assumes the flags values
+for SEEK_SET, SEEK_CUR and SEEK_END are universal. May not be true
+for non-Unix OS's.
+.SS "MPread"
+This routine handles getting the correct pages to read to satisfy
+the request. The data is then copied from the memory pool into
+the user's buffer.
+.SS "MPwrite"
+This routine handles getting the correct pages to write to satisfy
+the request. The data is then copied from the user's buffer to
+the memory pool.
+.SH "RETURNS"
+.SS "MPset"
+Returns SUCCEED if successful and FAIL otherwise.
+.SS "MPget"
+Returns SUCCEED.
+.SS "MPopen"
+Pointer to MPFILE struct if successful and NULL otherwise.
+.SS "MPclose"
+Returns SUCCEED on success and FAIL otherwise.
+.SS "MPflush"
+Returns SUCCEED on success and FAIL otherwise.
+.SS "MPseek"
+Returns offset into the file on success and FAIL otherwise.
+.SS "MPread"
+Returns number of bytes read if successful and FAIL otherwise.
+.SS "MPwrite"
+Returns number of bytes written if successful and FAIL otherwise.
+.SH "NAME"
+.SS "MPset"
+MPset - set pagesize and maximum number of pages to cache on next open/create.
+.SS "MPget"
+MPget - get last pagesize and max number of pages cached for open/create.
+.SS "MPopen"
+MPopen - open/create the file and create a memory pool for file.
+.SS "MPclose"
+MPclose - close the file, sync the file memory pool to disk and close it.
+.SS "MPflush"
+MPflush - flush file memory pool to disk.
+.SS "MPseek"
+MPseek - seek to the specified file offset in the memory pool.
+.SS "MPread"
+MPread  - read 'nbytes' from file memory pool into 'buf'.
+.SS "MPwrite"
+MPwrite - write 'nbytes' form 'buf' to the file memory pool.
+.SH "NOTE"
+.SS "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.
+
+Current memory usage overhead for the Memory Pool is approximately
+~(2k + maxcache*(28+pagesize) + npages*20) bytes.
+.SS "MPseek"
+Note that it returns an 'int' as opposed to 'off_t'. This is
+because the HDF library still deals with file offsets in terms of
+signed integers....*sigh*...hopefully This will be changed in a future
+release.
+.SS "MPread"
+The memcpy from the buffer pool to the users buffer is an expensive
+operation.
+.SS "MPwrite"
+The memcpy from the the users buffer to the memory pool is an expensive
+operation.
+
+.SH CONTACT
+George Velamparampil <georgev at ncsa.uiuc.edu>
+.sp 0
+NCSA Software Development Group
+.sp 0
+HDF Group
+.sp 0
+152 Computing Applications Bldg.
+.sp 0
+605 E. Springfield Ave.
+.sp 0
+Champaign, IL 61820

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,909 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.13 $";
+#endif
+
+/* $Id: fmpio.c,v 1.13 1996/02/02 17:37:35 georgev Exp $ */
+
+/*+
+   File Memory Pool level stdio I/O routines 
+
+   Routines
+   --------
+   MPset    - set pagesize and maximum number of pages to cache on next open/create
+   MPget    - get last pagesize and max number of pages cached for open/create
+   MPopen   - open/create the file and create a memory pool for file
+   MPclose  - close the file, sync the file memory pool to disk and close it.
+   MPflush  - flush file memory pool to disk 
+   MPseek   - seek to the specified file offset in the memory pool
+   MPread   - read data from file memory pool into user's buffer
+   MPwrite  - write data from user's buffer to file memory pool 
+
+   AUTHOR - George V.
+
+ +*/
+
+#include <errno.h>
+#include <string.h>
+#include "fmpio.h"
+
+/* global variable, use defaults */
+static fmp cur_fmp = { 0, 0}; 
+
+/******************************************************************************
+NAME
+     MPset - 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
+     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. 
+
+     Current memory usage overhead for the Memory Pool is approximately
+     ~(2k + maxcache*(28+pagesize) + npages*20) bytes.
+******************************************************************************/
+int
+MPset(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    = SUCCEED;
+
+  /* set pagesize on next open/create */
+  if (pagesize >= MIN_PAGESIZE)
+    cur_fmp.pagesize = (pageno_t)pagesize;
+  else
+    ret = FAIL;
+
+  /* set for number of pages to cache on next open/create */
+  if (flags != MP_PAGEALL)
+    { /* set user limit for number of pages to cache */
+      if (maxcache >= 1)
+        cur_fmp.maxcache = (pageno_t)maxcache;
+      else
+        ret = FAIL;
+    }
+  else /* we want to cache the whole file */
+    cur_fmp.maxcache = (pageno_t)MAX_PAGE_NUMBER - 1;
+
+  return ret;
+} /* MPset() */
+
+/******************************************************************************
+NAME
+     MPget - 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.
+******************************************************************************/
+int
+MPget(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   ret    = SUCCEED;
+
+  if (pagesize != NULL)
+    *pagesize = cur_fmp.pagesize;
+  if (maxcache != NULL)
+    *maxcache = cur_fmp.maxcache;
+
+  return ret;
+} /* MPget() */
+
+/******************************************************************************
+NAME
+      MPopen - open/create the file and create a memory pool for file
+
+DESCRIPTION
+      Open/Create the file for reading/writing and create a memory pool for
+      the file. Currently we let the library decide whether to use the 
+      default PAGESIZE for creating pages and MAXCACHE for number of pages 
+      to cache in the pool.
+
+RETURNS
+      Pointer to MPFILE struct if successful and NULL otherwise
+******************************************************************************/
+MPFILE * 
+MPopen(const char * path, /* IN: filename */
+       int flags          /* IN: DFACC_CREATE, DFACC_READ, DFACC_WRITE,
+                              DFACC_RDWR, DFACC_ALL */
+)
+{
+  MPFILE *mpfs = NULL; /* File struct */
+  int   ret    = SUCCEED;
+
+  if (path == NULL)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+  /* allocate space for file struct */
+  if ((mpfs = (MPFILE *)calloc(1,sizeof(MPFILE))) == NULL)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+  /* open file */
+  switch(flags)
+    {
+    case DFACC_CREATE:
+      if ((mpfs->fd = FMPI_CREATE(path)) == FMPI_OPEN_FAIL)
+        {
+          ret = FAIL;
+          goto done;
+        } 
+      break;
+    case DFACC_READ:
+    case DFACC_WRITE:
+    case DFACC_RDWR:
+    case DFACC_ALL:
+    default:
+      if ((mpfs->fd = FMPI_OPEN(path,flags)) == FMPI_OPEN_FAIL)
+        {
+          ret = FAIL;
+          goto done;
+        } 
+      break;
+    }
+
+  mpfs->oflags = flags;
+  mpfs->curp = 0; /* set current page to none */
+  mpfs->curpr = 0;
+  mpfs->poff = 0;
+  mpfs->foff = 0;
+  mpfs->rpage = NULL;
+
+  /* create private memory pool for file 
+  * currently we are sharing the pool*/
+  if ((mpfs->mp = fmpool_open(NULL,mpfs->fd,cur_fmp.pagesize,cur_fmp.maxcache)) 
+      == NULL)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPopen: mp->npages =%d\n",fmpool_get_npages(mpfs->mp));
+  fprintf(stderr,"MPopen: mp->pagesize =%d\n",fmpool_get_pagesize(mpfs->mp));
+  fprintf(stderr,"MPopen: mp->lastpagesize=%d\n",fmpool_get_lastpagesize(mpfs->mp));
+#endif
+
+  /* Get system defaults for pagesize and maxcache for the first time
+     when specifed as such(i.e both are 0) */
+  if (cur_fmp.pagesize == 0)
+    cur_fmp.pagesize = (int)fmpool_get_pagesize(mpfs->mp);
+
+  if (cur_fmp.maxcache == 0)
+    cur_fmp.maxcache = (int)fmpool_get_maxcache(mpfs->mp);
+
+  done:
+  if(ret == FAIL)
+    { /* error cleanup */
+      if (mpfs != NULL)
+        free(mpfs);
+      
+      mpfs = NULL; /* return value */
+    }
+  /* Normal cleanup */
+
+  return mpfs;
+} /* MPopen() */
+
+/******************************************************************************
+NAME
+    MPclose - close the file, sync the file memory pool to disk and close it.
+
+DESCRIPTION
+    First sync the file memory pool to disk. Next close the file memory pool.
+    Finally close the file
+
+RETURNS
+    Returns SUCCEED on success and FAIL otherwise.
+******************************************************************************/
+int
+MPclose(MPFILE *mpfs /* IN: File Memory pool handle */
+)
+{
+  int ret = SUCCEED;
+
+  if (mpfs == NULL)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPclose: sync the file\n");
+  fprintf(stderr,"MPclose: mp->npages =%d\n",fmpool_get_npages(mpfs->mp));
+  fprintf(stderr,"MPclose: mp->lastpagesize =%d\n",fmpool_get_lastpagesize(mpfs->mp));
+#endif
+  /* Don't sync the file for Read only access */
+  if (mpfs->oflags != DFACC_READ)
+    { /* sync pages and then close mpool*/
+      if (fmpool_sync(mpfs->mp) == RET_ERROR)
+        {
+          ret = FAIL;
+          goto done;
+        }
+    }
+#ifdef STATISTICS
+  fmpool_stat(mpfs->mp);
+#endif 
+  if (fmpool_close(mpfs->mp) == RET_ERROR)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+  /* Close the file */
+  if (FMPI_CLOSE(mpfs->fd) != FMPI_CLOSE_SUCCEED)
+    {
+      ret = FAIL;
+    }
+
+  done:
+  if(ret == FAIL)
+    { /* error cleanup */
+            
+    }
+  /* Normal cleanup */
+
+  /* free file struct */
+  free(mpfs);
+
+  return ret;
+} /* MPclose() */
+
+/******************************************************************************
+NAME
+     MPflush - flush file memory pool to disk 
+
+DESCRIPTION
+     Flushes the file memory pool to disk.
+
+RETURNS
+     Returns SUCCEED on success and FAIL otherwise
+******************************************************************************/
+int
+MPflush(MPFILE *mpfs /* IN: File Memory pool handle */
+)
+{
+  int ret = SUCCEED;
+
+  if (mpfs == NULL)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPflush: sync the file\n");
+  fprintf(stderr,"MPflush: mp->npages =%d\n",fmpool_get_npages(mpfs->mp));
+  fprintf(stderr,"MPflush: mp->lastpagesize =%d\n",fmpool_get_lastpagesize(mpfs->mp));
+#endif
+  /* sync pages */
+  if (fmpool_sync(mpfs->mp) == RET_ERROR)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+  done:
+  if(ret == FAIL)
+    { /* error cleanup */
+            
+    }
+  /* Normal cleanup */
+
+  return ret;
+} /* MPflush() */
+
+/******************************************************************************
+NAME
+     MPseek - seek to the specified file offset in the memory pool
+
+DESCRIPTION
+     Seeks to the correct page in the file depending upon the offset and the
+     flag 'whence'. Similiar to the stdio routine. Assumes the flags values
+     for SEEK_SET, SEEK_CUR and SEEK_END are universal. May not be true
+     for non-Unix OS's.
+
+RETURNS
+     Returns offset into the file on success and FAIL otherwise.
+
+NOTE
+     Note that it returns an 'int' as opposed to 'off_t'. This is 
+     because the HDF library still deals with file offsets in terms of
+     signed integers....*sigh*...hopefully this will be changed in a future
+     release.
+******************************************************************************/
+int 
+MPseek(MPFILE *mpfs, /* IN: File Memory pool handle */
+       off_t offset, /* IN: Offset into the file */
+       int whence    /* IN: SEEK_CUR, SEEK_SET, SEEK_END */
+)
+{
+  pageno_t   new_pgno = 0;
+  pageno_t   pagesize = 0;
+  pageno_t   oddpagesize = 0;
+  pageno_t   lastpagesize = 0;
+  pageno_t   npages = 0;
+  off_t      cur_off = 0;
+  u_int32_t  flags = 0;
+  void       *mypage = NULL;
+  int        ret = SUCCEED;
+
+  if (mpfs == NULL || offset < 0)
+    {
+      ret = FAIL;
+      goto done;
+    }
+#ifdef MP_DEBUG
+  fprintf(stderr,"ENTER->MPseek: mpfs->curp =%u\n",mpfs->curp);
+  fprintf(stderr,"ENTER->MPseek: mpfs->foff =%d\n",mpfs->foff);
+  fprintf(stderr,"ENTER->MPseek: mpfs->poff =%d\n",mpfs->poff);
+#endif
+  pagesize = fmpool_get_pagesize(mpfs->mp);
+  npages   = fmpool_get_npages(mpfs->mp);
+  lastpagesize = fmpool_get_lastpagesize(mpfs->mp);
+
+  /* Adjust offset deepending on seek flag */
+  switch( whence )
+    {
+    case 0:  /* SEEK_SET */
+      cur_off = offset;
+      break ;
+    case 1: /* SEEK_CUR */
+      cur_off = offset + mpfs->foff; /* add current offset in file */
+      break ;
+    case 2: /* SEEK_END */
+      cur_off = pagesize * npages; 
+      /* Adjust for odd size last page */
+      if (pagesize != lastpagesize)
+        cur_off -= (pagesize - lastpagesize);
+
+      cur_off += offset; /* add offset from end of file */
+      break ;
+    }
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPseek: seeking to cur_off =%d\n",cur_off);
+  fprintf(stderr,"MPseek: mp->npages=%u, mp->pagesize=%u\n",
+          npages,pagesize);
+#endif
+  /* calculate which page number this offset refers to */
+  new_pgno = (cur_off / pagesize);
+  new_pgno++;
+  oddpagesize = (cur_off % pagesize);
+  if (!oddpagesize && new_pgno != 1)
+    { /* we are even multiple of page sizes */
+      oddpagesize = pagesize;
+      new_pgno--;
+    }
+
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPseek: this offset corresponds to new_pgno =%u\n",new_pgno);
+#endif
+
+  /* Check to see if this page is the current page */
+  if (!(mpfs->curp != 0 && new_pgno == mpfs->curp))
+    { /* we need to get it */
+      /* Check to see if page exists */
+      if ((mypage = fmpool_get(mpfs->mp, new_pgno, 0)) == NULL)
+        { /* need to extend file and set lastpagesize*/
+#ifdef MP_DEBUG
+          fprintf(stderr,"MPseek: page =%u does not exist\n",new_pgno);
+          fprintf(stderr,"MPseek: oddpagesize=%u \n",oddpagesize);
+#endif
+          if ((mypage = fmpool_new(mpfs->mp, &new_pgno, oddpagesize, MPOOL_EXTEND)) 
+              == NULL)
+            {
+              ret = FAIL;
+              goto done;
+            }
+          flags = MPOOL_DIRTY; /* mark page as dirty */
+        }
+      else
+        flags = 0;
+
+#ifdef MP_DEBUG
+      fprintf(stderr,"MPseek: put page back \n");
+#endif
+
+      /* put page back */
+      if (fmpool_put(mpfs->mp, mypage, flags) == RET_ERROR)
+        {
+          ret = FAIL;
+          goto done;
+        }
+    } /* end if need to get page */
+
+  mpfs->curp = new_pgno;    /* current page */
+  mpfs->poff = oddpagesize; /* offset into current page */
+  mpfs->foff = cur_off;     /* file offset */
+
+  /* Is is this the last page? */
+  if (new_pgno == fmpool_get_npages(mpfs->mp))
+    { /* set last page size */
+      if (mpfs->poff && (mpfs->poff > fmpool_get_lastpagesize(mpfs->mp)))
+        {
+          if (fmpool_set_lastpagesize(mpfs->mp,oddpagesize) == RET_ERROR)
+            {
+              ret = FAIL;
+              goto done;
+            }
+#ifdef MP_DEBUG
+          fprintf(stderr,"MPseek last page now,  mpfs->mp->lastpagesize =%u\n",
+                  fmpool_get_lastpagesize(mpfs->mp));
+#endif
+        }
+    }
+
+  done:
+  if(ret == FAIL)
+    { /* error cleanup */
+      offset = FAIL;
+#ifdef MP_DEBUG
+      fprintf(stderr,"EXIT->Error with MPseek: \n");
+#endif
+    }
+  /* Normal cleanup */
+#ifdef MP_DEBUG
+  fprintf(stderr,"EXIT->MPseek: mpfs->curp =%u\n",mpfs->curp);
+  fprintf(stderr,"EXIT->MPseek: mpfs->foff =%d\n",mpfs->foff);
+  fprintf(stderr,"EXIT->MPseek: mpfs->poff =%d\n",mpfs->poff);
+#endif
+  return offset;
+} /* MPseek() */
+
+/******************************************************************************
+NAME
+     MPread  - read 'nbytes' from file memory pool into 'buf'
+
+DESCRIPTION
+     This routine handles getting the correct pages to read to satisfy 
+     the request. The data is then copied from the memory pool into 
+     the user's buffer.
+
+RETURNS
+     Returns number of bytes read if successful and FAIL otherwise
+
+NOTE
+     The memcpy from the buffer pool to the users buffer is an expensive
+     operation.
+******************************************************************************/
+int 
+MPread(MPFILE *mpfs, /* IN: File Memory pool handle */
+       void *buf,    /* IN: User buffer to read data into */
+       size_t nbytes /* IN: number of bytes to read in  */
+)
+{
+  size_t nr = 0;
+  size_t nbr = 0;
+  size_t nbl = 0;
+  pageno_t npageno = 0;
+  pageno_t pagesize = 0;
+  pageno_t npages = 0;
+  pageno_t oddpagesize = 0;
+  off_t    end_off = 0;
+  void *mypage = NULL;
+  void *cptr = NULL;
+  void *bptr = buf;
+  int   ret = SUCCEED;
+  int   skip_first_put = 0;
+
+  if (mpfs == NULL || buf == NULL)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+  pagesize = fmpool_get_pagesize(mpfs->mp);
+  npages   = fmpool_get_npages(mpfs->mp);
+
+  /* calculate bytes left, number of pages*/
+  nbl = nbytes;
+  end_off = (off_t)(mpfs->foff + nbytes);
+  npageno = (pageno_t)(end_off / pagesize);
+  npageno++;
+  oddpagesize = (pageno_t)(end_off % pagesize);
+  if (!oddpagesize && npageno != 1)
+    { /* we are even multiple of page sizes */
+      oddpagesize = pagesize;
+      npageno--;
+    }
+
+#ifdef MP_DEBUG
+  fprintf(stderr,"ENTER->MPread: npageno =%u\n",npageno);
+  fprintf(stderr,"ENTER->MPread: mpfs->curp =%u\n",mpfs->curp);
+  fprintf(stderr,"ENTER->MPread: mpfs->foff =%u\n",mpfs->foff);
+  fprintf(stderr,"ETNER->MPread: mpfs->poff =%u\n",mpfs->poff);
+#endif 
+
+  /* Check to see if this page is the last page read */
+  if (mpfs->curpr != 0 && mpfs->curp == mpfs->curpr )
+    {/* we don't need to get it */
+      mypage = mpfs->rpage;
+      skip_first_put = 1;
+    }
+  else
+    { /* we need to get it copy First page */
+      if ((mypage = fmpool_get(mpfs->mp, mpfs->curp, 0)) == NULL)
+        {
+          ret = FAIL;
+          goto done;
+        }
+    }
+
+  cptr = (char *)mypage + mpfs->poff; /* adjust into current page */
+
+  /* set number of bytes read */
+  if (nbl > (pagesize - mpfs->poff))
+    nbr = pagesize - mpfs->poff; 
+  else
+    nbr = nbl;
+
+  memcpy(bptr,cptr,nbr); /* copy from first page */
+  mpfs->poff = (off_t)(mpfs->poff + nbr);
+
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPread: read %d bytes, mpfs->poff =%u\n",nbr,mpfs->poff);
+#endif
+
+  /* return page */
+  if (!skip_first_put)
+    {
+      if (fmpool_put(mpfs->mp, mypage, 0) == RET_ERROR)
+        {
+          ret = FAIL;
+          goto done;
+        }
+    }
+  bptr = (char *)bptr + nbr; /* increment buffer ptr */
+  nbl -= nbr;  /* decrement bytes left to read */
+  nr += nbr;
+
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPread: %u pages to process\n",npageno - mpfs->curp);
+#endif
+  /* deal with all other pages */
+  while (npageno && (npageno - mpfs->curp))
+    {
+      mpfs->curp++; /* next page */
+      if ((mypage = fmpool_get(mpfs->mp, mpfs->curp, 0)) == NULL)
+        {
+          ret = FAIL;
+          goto done;
+        }
+      if (nbl > pagesize)
+        nbr = pagesize;
+      else
+        nbr = nbl;
+      memcpy(bptr,mypage,nbr); /* copy first page */
+      mpfs->poff = nbr;
+      /* return page */
+      if (fmpool_put(mpfs->mp, mypage, 0) == RET_ERROR)
+        {
+          ret = FAIL;
+          goto done;
+        }
+      bptr = (char *)bptr + nbr; /* increment buffer ptr */
+      nbl -= nbr;  /* decrement bytes left to read */
+      nr += nbr;
+    } /* end while */
+
+  mpfs->foff += nr; /* set file offset */
+
+  /* point last page read */
+  if (mpfs->curp != mpfs->curpr )
+   {
+     mpfs->rpage = mypage;
+     mpfs->curpr = mpfs->curp; 
+   }
+
+  done:
+  if(ret == FAIL)
+    { /* error cleanup */
+#ifdef MP_DEBUG
+      fprintf(stderr,"EXIT->MPread: FAILING\n");
+#endif
+      nr = FAIL;
+    }
+  /* Normal cleanup */
+#ifdef MP_DEBUG
+  fprintf(stderr,"EXIT->MPread: read %d bytes\n",nr);
+  fprintf(stderr,"EXIT->MPread: mpfs->curp =%u\n",mpfs->curp);
+  fprintf(stderr,"EXIT->MPread: mpfs->foff =%d\n",mpfs->foff);
+  fprintf(stderr,"EXIT->MPread: mpfs->poff =%d\n\n",mpfs->poff);
+#endif 
+  return nr;
+} /* MPread() */
+
+/******************************************************************************
+NAME
+     MPwrite - write 'nbytes' form 'buf' to the file memory pool
+
+DESCRIPTION
+     This routine handles getting the correct pages to write to satisfy 
+     the request. The data is then copied from the user's buffer to
+     the memory pool.
+
+RETURNS
+     Returns number of bytes written if successful and FAIL otherwise
+
+NOTE
+     The memcpy from the the users buffer to the memory pool is an expensive
+     operation.
+******************************************************************************/
+int 
+MPwrite(MPFILE *mpfs,  /* IN: File Memory pool handle */
+        void *buf,     /* IN: User buffer to write data from */
+        size_t nbytes  /* IN: number of bytes to write out */
+)
+{
+  size_t nw = 0;
+  size_t nbw = 0;
+  size_t nbl = 0;
+  pageno_t npagno = 0;
+  pageno_t pageno = 0;
+  pageno_t new_pgno = 0;
+  pageno_t pagesize = 0;
+  pageno_t npages = 0;
+  pageno_t oddpagesize = 0;
+  off_t    cur_off = 0;
+  void *mypage = NULL;
+  void *cptr = NULL;
+  void *bptr = buf;
+  int   ret = SUCCEED;
+
+  if (mpfs == NULL)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+  pagesize = fmpool_get_pagesize(mpfs->mp);
+  npages   = fmpool_get_npages(mpfs->mp);
+
+  /* calculate bytes left, number of pages*/
+  nbl = nbytes;
+  cur_off = (off_t)(mpfs->foff + nbytes);
+  pageno = (pageno_t)(mpfs->foff / pagesize);
+  pageno++;
+  npagno = (pageno_t)(cur_off / pagesize);
+  npagno++;
+  oddpagesize = (pageno_t)(cur_off % pagesize);
+  if (!oddpagesize && npagno != 1)
+    { /* we are even multiple of page sizes */
+      oddpagesize = pagesize;
+      npagno--;
+    }
+  
+#ifdef MP_DEBUG
+  fprintf(stderr,"Enter->MPwrite: nbytes =%d, mp->pagesize=%u, mp->npages=%u\n",
+          nbytes,pagesize,npages);
+  fprintf(stderr,"MPwrite: mpfs->curp =%u\n",mpfs->curp);
+  fprintf(stderr,"MPwrite: mpfs->foff =%d\n",mpfs->foff);
+  fprintf(stderr,"MPwrite: mpfs->poff =%d\n",mpfs->poff);
+  fprintf(stderr,"MPwrite: getting pageno =%u, npagno=%u\n",pageno, npagno);
+#endif
+
+  /* Check if this was the last page read */
+  if (mpfs->curpr >= pageno &&  mpfs->curpr <= npagno)
+     mpfs->curpr = 0; /* reset last page read to invalid */
+
+  /* Check to see if this is the current page */
+  if (mpfs->curp != pageno)
+    mpfs->poff = 0; /* reset page offset since not current page */
+
+  /* get First page */
+  if ((mypage = fmpool_get(mpfs->mp, pageno, 0)) == NULL)
+    {
+      if ((mypage = fmpool_new(mpfs->mp, &new_pgno, pagesize, 0)) == NULL)
+        {
+          ret = FAIL;
+          goto done;
+        }
+      mpfs->curp = new_pgno;
+      mpfs->poff = 0;
+      if (fmpool_set_lastpagesize(mpfs->mp,0) == RET_ERROR)
+        {
+          ret = FAIL;
+          goto done;
+        }
+#ifdef MP_DEBUG
+      fprintf(stderr,"MPwrite: page =%u does not exist\n",pageno);
+      fprintf(stderr,"MPwrite: pagesize=%u \n",pagesize);
+#endif
+    }
+  else
+    mpfs->curp = pageno;
+
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPwrite: now mpfs->curp =%u\n",mpfs->curp);
+  fprintf(stderr,"MPwrite: now mpfs->foff =%d\n",mpfs->foff);
+  fprintf(stderr,"MPwrite: now mpfs->poff =%d\n",mpfs->poff);
+#endif
+
+  cptr = (char *)mypage + mpfs->poff; /* adjust into current page */
+
+  /* set number of bytes to write */
+  if (nbl > (pagesize - mpfs->poff))
+    nbw = (pagesize - mpfs->poff); 
+  else
+    nbw = nbl;
+
+  memcpy(cptr,bptr,nbw); /* copy into first page */
+  mpfs->poff = (off_t)(mpfs->poff + nbw);
+
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPwrite: copied %d bytes\n",nbw);
+  fprintf(stderr,"MPwrite: mark dirty page=%u\n",mpfs->curp);
+  fprintf(stderr,"MPwrite: after write mpfs->poff =%d\n",mpfs->poff);
+#endif
+  /* Mark page as dirty */
+  if (fmpool_put(mpfs->mp, mypage, MPOOL_DIRTY) == RET_ERROR)
+    {
+      ret = FAIL;
+      goto done;
+    }
+
+  bptr = (char *)bptr + nbw; /* increment buffer ptr */
+  nbl -= nbw;  /* decrement bytes left to write */
+  nw += nbw;
+
+  /* Is is this the last page? */
+  if (mpfs->curp == fmpool_get_npages(mpfs->mp))
+    { /* set last page size */
+      if (mpfs->poff && (mpfs->poff > fmpool_get_lastpagesize(mpfs->mp)))
+        {
+          if (fmpool_set_lastpagesize(mpfs->mp,mpfs->poff) == RET_ERROR)
+            {
+              ret = FAIL;
+              goto done;
+            }
+#ifdef MP_DEBUG
+          fprintf(stderr,"MPwrite: now lastpagesize=%u \n",
+                  fmpool_get_lastpagesize(mpfs->mp));
+#endif
+        }
+    }
+
+  /* deal with all other pages */
+#ifdef MP_DEBUG
+  fprintf(stderr,"MPwrite: %u pages to process\n",npagno - mpfs->curp);
+#endif
+  while (npagno && (npagno - mpfs->curp))
+    {
+      mpfs->curp++; /* next page */
+#ifdef MP_DEBUG
+      fprintf(stderr,"MPwrite: processing page %u \n",mpfs->curp);
+#endif
+      if ((mypage = fmpool_get(mpfs->mp, mpfs->curp, 0)) == NULL)
+        { /* Is the page we requested still less than total number of pages */
+          if (mpfs->curp <= fmpool_get_npages(mpfs->mp))
+            {
+#ifdef MP_DEBUG
+              fprintf(stderr,"EXIT_ERROR->MPwrite: wrote %d bytes\n",nw);
+              fprintf(stderr,"MPwrite: mpfs->curp =%u\n",mpfs->curp);
+              fprintf(stderr,"MPwrite: mpfs->foff =%u\n",mpfs->foff);
+              fprintf(stderr,"MPwrite: mpfs->poff =%u\n\n",mpfs->poff);
+#endif
+              ret = FAIL;
+              goto done;
+            }
+          else
+            {
+              if ((mypage = fmpool_new(mpfs->mp, &new_pgno, pagesize, 0)) 
+                  == NULL)
+                {
+                  ret = FAIL;
+                  goto done;
+                }
+#ifdef MP_DEBUG
+              fprintf(stderr,"MPwrite: page =%u does not exist\n",mpfs->curp);
+              fprintf(stderr,"MPwrite: new page =%u \n",new_pgno);
+              fprintf(stderr,"MPwrite: pagesize=%u \n",pagesize);
+#endif
+              mpfs->curp = new_pgno;
+              mpfs->poff = 0;
+              if (fmpool_set_lastpagesize(mpfs->mp,0) == RET_ERROR)
+                {
+                  ret = FAIL;
+                  goto done;
+                }
+            }
+        } /* end if mypage */
+
+      if (nbl > pagesize)
+        nbw = pagesize;
+      else
+        nbw = nbl;
+      memcpy(mypage,bptr,nbw); /* copy page */
+      mpfs->poff = nbw;
+#ifdef MP_DEBUG
+      fprintf(stderr,"MPwrite: copied %d bytes, mpfs->poff=%u\n",nbw,mpfs->poff);
+      fprintf(stderr,"MPwrite: mark dirty page=%u\n",mpfs->curp);
+#endif
+      /* Mark page as dirty */
+      if (fmpool_put(mpfs->mp, mypage, MPOOL_DIRTY) == RET_ERROR)
+        {
+          ret = FAIL;
+          goto done;
+        }
+
+      bptr = (char *)bptr + nbw; /* increment buffer ptr */
+      nbl -= nbw;  /* decrement bytes left to write */
+      nw += nbw;
+      /* Is is this the last page? */
+      if (mpfs->curp == fmpool_get_npages(mpfs->mp))
+        { /* set last page size */
+          if (mpfs->poff && (mpfs->poff > fmpool_get_lastpagesize(mpfs->mp)))
+            {
+              if (fmpool_set_lastpagesize(mpfs->mp,mpfs->poff) == RET_ERROR)
+                {
+                  ret = FAIL;
+                  goto done;
+                }
+#ifdef MP_DEBUG
+              fprintf(stderr,"MPwrite: now lastpagesize=%u \n",
+                      fmpool_get_lastpagesize(mpfs->mp));
+#endif
+            }
+        }
+    } /* end while */
+
+  mpfs->foff += nw; /* set file offset */
+
+  done:
+  if(ret == FAIL)
+    { /* error cleanup */
+      nw = FAIL;
+#ifdef MP_DEBUG
+      fprintf(stderr,"EXIT->MPwrite Error\n");
+#endif
+    }
+  /* Normal cleanup */
+#ifdef MP_DEBUG
+  fprintf(stderr,"EXIT->MPwrite: wrote %d bytes\n",nw);
+  fprintf(stderr," MPwrite: mpfs->curp =%u\n",mpfs->curp);
+  fprintf(stderr," MPwrite: mpfs->foff =%d\n",mpfs->foff);
+  fprintf(stderr," MPwrite: mpfs->poff =%d\n",mpfs->poff);
+  fprintf(stderr," MPwrite: now lastpagesize=%u \n\n",
+          fmpool_get_lastpagesize(mpfs->mp));
+#endif
+  return nw;
+} /* MPwrite() */

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpio.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,229 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * File: fmpio.h
+ *
+ * AUTHOR - George V.
+ *****************************************************************************/ 
+
+/* $Id: fmpio.h,v 1.9 1996/02/02 17:37:36 georgev Exp $ */
+
+#ifndef _FMPIO_H
+#define _FMPIO_H
+
+#include <sys/types.h>
+#ifdef __FMPINTERFACE_PRIVATE
+#include "fmpconf.h"
+#include "fmptypes.h"
+#include "fmpool.h"
+
+/* Memory Pool file structure 
+* Note that we keep a ptr to the last  page read. 
+* This is probably not a good idea in a threaded environment */
+typedef struct mpfile_st 
+{
+  fmp_file_t  fd;     /* file handle */
+  int         oflags; /* open flags */
+  pageno_t    curpr;  /* current page read */
+  pageno_t    curp;   /* current page */
+  off_t       poff;   /* offset into current page */
+  off_t       foff;   /* current offset into file */
+  void        *rpage; /* ptr to last page read */
+  MPOOL       *mp;    /* memory pool for this file */
+} MPFILE;
+
+/* Global struct to hold current pagesize and maxcache 
+* Note we are using signed integers here instead of unsigned */
+typedef struct fmp_st {
+  int pagesize;   /* a value of 0 implies to use defaults */
+  int maxcache;   /* a value of 0 implies to use defaults  */
+} fmp;
+
+#define MIN_PAGESIZE  512
+
+#define MP_PAGEALL    0x01  /* page the whole file i.e. no limit on 'maxcache' */
+
+#else /* __FMPINTERFACE_PRIVATE */
+/* What we define to the user */
+
+/* Hidden data types */
+typedef void *MPFILE;
+
+/* file access codes (also found in fmptypes.h) */
+#ifndef DFACC_READ
+#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
+#endif  /* DFACC_READ */
+
+#endif /* __FMPINTERFACE_PRIVATE */
+
+/* File memory pool fucntions */
+
+/******************************************************************************
+NAME
+     MPset - 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
+     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.
+
+     Current memory usage overhead for the Memory Pool is approximately
+     ~(2k + maxcache*(28+pagesize) + npages*20) bytes.
+******************************************************************************/
+extern int     MPset(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
+     MPget - 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.
+******************************************************************************/
+extern int     MPget(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: */);
+
+/******************************************************************************
+NAME
+      MPopen - open/create the file and create a memory pool for file
+
+DESCRIPTION
+      Open/Create the file for reading/writing and create a memory pool for
+      the file. Currently we let the library decide whether to use the 
+      default PAGESIZE for creating pages and MAXCACHE for number of pages 
+      to cache in the pool.
+
+RETURNS
+      Pointer to MPFILE struct if successful and NULL otherwise
+******************************************************************************/
+extern MPFILE *MPopen( const char * path, /* IN: filename */
+                       int flags          /* IN: DFACC_CREATE, DFACC_READ, DFACC_WRITE,
+                                             DFACC_RDWR, DFACC_ALL */);
+
+/******************************************************************************
+NAME
+    MPclose - close the file, sync the file memory pool to disk and close it.
+
+DESCRIPTION
+    First sync the file memory pool to disk. Next close the file memory pool.
+    Finally close the file
+
+RETURNS
+    Returns SUCCEED on success and FAIL otherwise.
+******************************************************************************/
+extern int     MPclose(MPFILE *mpfs /* IN: File Memory pool handle */ );
+
+/******************************************************************************
+NAME
+     MPflush - flush file memory pool to disk 
+
+DESCRIPTION
+     Flushes the file memory pool to disk.
+
+RETURNS
+     Returns SUCCEED on success and FAIL otherwise
+******************************************************************************/
+extern int     MPflush(MPFILE *mpfs /* IN: File Memory pool handle */);
+
+/******************************************************************************
+NAME
+     MPseek - seek to the specified file offset in the memory pool
+
+DESCRIPTION
+     Seeks to the correct page in the file depending upon the offset and the
+     flag 'whence'. Similiar to the stdio routine. Assumes the flags values
+     for SEEK_SET, SEEK_CUR and SEEK_END are universal. May not be true
+     for non-Unix OS's.
+
+RETURNS
+     Returns offset into the file on success and FAIL otherwise.
+
+NOTE
+     Note that it returns an 'int' as opposed to 'off_t'. This is 
+     because the HDF library still deals with file offsets in terms of
+     signed integers....*sigh*...hopefully this will be changed in a future
+     release.
+******************************************************************************/
+extern int     MPseek(MPFILE *mpfs, /* IN: File Memory pool handle */
+                      off_t offset, /* IN: Offset into the file */
+                      int whence /* IN: SEEK_CUR, SEEK_SET, SEEK_END */);  
+
+/******************************************************************************
+NAME
+     MPread  - read 'nbytes' from file memory pool into 'buf'
+
+DESCRIPTION
+     This routine handles getting the correct pages to read to satisfy 
+     the request. The data is then copied from the memory pool into 
+     the user's buffer.
+
+RETURNS
+     Returns number of bytes read if successful and FAIL otherwise
+
+NOTE
+     The memcpy from the buffer pool to the users buffer is an expensive
+     operation.
+******************************************************************************/
+extern int     MPread(MPFILE *mpfs, /* IN: File Memory pool handle */
+                      void *buf,    /* IN: User buffer to read data into */
+                      size_t nbytes /* IN: number of bytes to read in  */);
+
+/******************************************************************************
+NAME
+     MPwrite - write 'nbytes' form 'buf' to the file memory pool
+
+DESCRIPTION
+     This routine handles getting the correct pages to write to satisfy 
+     the request. The data is then copied from the user's buffer to
+     the memory pool.
+
+RETURNS
+     Returns number of bytes written if successful and FAIL otherwise
+
+NOTE
+     The memcpy from the the users buffer to the memory pool is an expensive
+     operation.
+
+WARNING
+     this is sample warning.
+******************************************************************************/
+extern int     MPwrite(MPFILE *mpfs, /* IN: File Memory pool handle */
+                       void *buf,    /* IN: User buffer to write data from */
+                       size_t nbytes /* IN: number of bytes to write out */);
+#endif /* _FMPIO_H */

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.3
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.3	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.3	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,166 @@
+.\" WARNING! THIS FILE WAS GENERATED AUTOMATICALLY BY c2man!
+.\" DO NOT EDIT! CHANGES MADE TO THIS FILE WILL BE LOST!
+.TH "fmpool" 3 "2 February 1996" "c2man fmpool.h"
+.SH "NAME"
+fmpool_open,
+fmpool_filter,
+fmpool_new,
+fmpool_get,
+fmpool_put,
+fmpool_sync,
+fmpool_close,
+fmpool_set_lastpagesize,
+fmpool_get_lastpagesize,
+fmpool_get_pagesize,
+fmpool_get_maxcache,
+fmpool_get_npages \- Shared Memory File Buffer Pool
+.SH "SYNOPSIS"
+.ft B
+#include <fmpool.h>
+.sp
+MPOOL *fmpool_open(void);
+.sp
+void fmpool_filter(void);
+.sp
+void *fmpool_new(void);
+.sp
+void *fmpool_get(void);
+.sp
+int fmpool_put(void);
+.sp
+int fmpool_sync(void);
+.sp
+int fmpool_close(void);
+.sp
+int fmpool_set_lastpagesize(void);
+.sp
+pageno_t fmpool_get_lastpagesize(void);
+.sp
+pageno_t fmpool_get_pagesize(void);
+.sp
+pageno_t fmpool_get_maxcache(void);
+.sp
+pageno_t fmpool_get_npages(void);
+.ft R
+.SH "DESCRIPTION"
+.SS "fmpool_open"
+Initialize a memory pool.
+We try to find the length of the file using either the stat() calls
+or seeking to the end of the file and getting the offset. We take
+special note of the size of the lastpage when the file size is not even
+multiple of page sizes.
+.SS "fmpool_filter"
+Initialize input/output filters for user page processing.
+.SS "fmpool_new"
+Get a new page of memory. This is where we get new pages for the file.
+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' = MPOOL_EXTEND, set page to *pgnoaddr and
+npages = *pgnoaddr.
+
+All returned pages are pinned.
+.SS "fmpool_get"
+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.
+.SS "fmpool_put"
+Return a page to the buffer pool. Unpin it and mark it
+appropriately i.e. MPOOL_DIRTY.
+.SS "fmpool_sync"
+Sync the pool to disk. Does NOT Free the buffer pool.
+.SS "fmpool_close"
+Close the buffer pool.  Frees the buffer pool.
+Does not sync the buffer pool.
+.SS "fmpool_set_lastpagesize"
+Set the pagesize of the last page in the file.
+.SS "fmpool_get_lastpagesize"
+Finds the size of the last page in the file.
+.SS "fmpool_get_pagesize"
+Finds current pagesize used for file.
+.SS "fmpool_get_maxcache"
+Finds current number of pages cached for file.
+.SS "fmpool_get_npages"
+Finds current number of pages in file.
+.SH "RETURNS"
+.SS "fmpool_open"
+A memory pool cookie if successful else NULL.
+.SS "fmpool_filter"
+Nothing.
+.SS "fmpool_new"
+Returns the new page if successfull and NULL otherwise.
+.SS "fmpool_get"
+The specifed page if successful and NULL otherwise.
+.SS "fmpool_put"
+RET_SUCCESS if succesful and RET_ERROR otherwise.
+.SS "fmpool_sync"
+RET_SUCCESS if succesful and RET_ERROR otherwise.
+.SS "fmpool_close"
+RET_SUCCESS if succesful and RET_ERROR otherwise.
+.SS "fmpool_set_lastpagesize"
+Returns RET_SUCCESS if successful and RET_ERROR otherwise.
+.SS "fmpool_get_lastpagesize"
+Returns the pagesize of the last page in the file.
+.SS "fmpool_get_pagesize"
+Returns pagesize for file.
+.SS "fmpool_get_maxcache"
+Returns current number of pages cached.
+.SS "fmpool_get_npages"
+Returns current number of pages in file.
+.SH "NAME"
+.SS "fmpool_open"
+Fmpool_open -- Open a memory pool on the given file.
+.SS "fmpool_filter"
+Fmpool_filter -- Initialize input/output filters.
+.SS "fmpool_new"
+Fmpool_new -- get a new page of memory.
+.SS "fmpool_get"
+Fmpool_get - get a specified page by page number.
+.SS "fmpool_put"
+Fmpool_put -- put a page back into the memory buffer pool.
+.SS "fmpool_sync"
+Fmpool_sync -- sync the memory buffer pool.
+.SS "fmpool_close"
+Fmpool_close - close the memory buffer pool.
+.SS "fmpool_set_lastpagesize"
+Fmpool_set_lastpagesize - set the pagesize of the last page in the file.
+.SS "fmpool_get_lastpagesize"
+Fmpool_get_lastpagsize - returns pagesize of last page in file.
+.SS "fmpool_get_pagesize"
+Fmpool_get_pagsize - returns pagesize for file.
+.SS "fmpool_get_maxcache"
+Fmpool_get_maxcache - returns current number of pages cached.
+.SS "fmpool_get_npages"
+Fmpool_get_npages - returns current number of pages in file.
+.SH "NOTE"
+.SS "fmpool_open"
+We don't have much use for the page in/out filters as we rely
+on the interfaces above us to fill the page and we allow the user
+to arbitrarily change the pagesize from one invocation to another.
+This deviates from the original Berkely implemntation.
+
+The key string byte for sharing buffers is not implemented.
+.SS "fmpool_filter"
+The filters must now handle the case where the page
+is the last page which may not be a full 'pagesize' so
+the filters must check for this.
+
+We don't use these yet.
+
+.SH CONTACT
+George Velamparampil <georgev at ncsa.uiuc.edu>
+.sp 0
+NCSA Software Development Group
+.sp 0
+HDF Group
+.sp 0
+152 Computing Applications Bldg.
+.sp 0
+605 E. Springfield Ave.
+.sp 0
+Champaign, IL 61820

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1530 @@
+/*-
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. 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: fmpool.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.
+ *
+ * AUTHOR - George V.
+ *****************************************************************************/ 
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.15 $";
+#endif
+
+/* $Id: fmpool.c,v 1.15 1996/02/02 17:37:38 georgev Exp $ */
+
+#define	__FMPOOLINTERFACE_PRIVATE
+#include "fmpool.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 *fmpool_bkt   __P((MPOOL *));
+static BKT *fmpool_look  __P((MPOOL *, pageno_t));
+static int  fmpool_write __P((MPOOL *, BKT *));
+
+/******************************************************************************
+NAME
+    fmpool_get_npages - returns current number of pages in file.
+
+DESCRIPTION
+    Finds current number of pages in file.
+
+RETURNS
+    Returns current number of pages in file.
+******************************************************************************/
+pageno_t
+fmpool_get_npages(mp)
+  MPOOL *mp; /* IN: MPOOL cookie */
+{
+  if(mp != NULL)
+    return mp->npages;
+  else
+    return 0;
+} /* fmpool_get_npages */
+
+/******************************************************************************
+NAME
+    fmpool_get_maxcache - returns current number of pages cached.
+
+DESCRIPTION
+    Finds current number of pages cached for file.
+
+RETURNS
+    Returns current number of pages cached.
+******************************************************************************/
+pageno_t
+fmpool_get_maxcache(mp)
+  MPOOL *mp; /* IN: MPOOL cookie */
+{
+  if (mp != NULL)
+    return mp->maxcache;
+  else
+    return 0;
+} /* fmpool_get_maxcache */
+
+/******************************************************************************
+NAME
+    fmpool_get_pagsize - returns pagesize for file
+
+DESCRIPTION
+    Finds current pagesize used for file.
+
+RETURNS
+    returns pagesize for file.
+******************************************************************************/
+pageno_t
+fmpool_get_pagesize(mp)
+  MPOOL *mp; /* IN: MPOOL cookie */
+{
+  if (mp != NULL)
+    return mp->pagesize;
+  else
+    return 0;
+} /* fmpool_get_pagesize */
+
+/******************************************************************************
+NAME
+     fmpool_get_lastpagsize - returns pagesize of last page in file.
+
+DESCRIPTION
+     Finds the size of the last page in the file.
+
+RETURNS
+     returns the pagesize of the last page in the file.
+******************************************************************************/
+pageno_t
+fmpool_get_lastpagesize(mp)
+  MPOOL *mp; /* IN: MPOOL cookie */
+{
+  if (mp != NULL)
+    return mp->lastpagesize;
+  else
+    return 0;
+} /* fmpool_get_lastpagesize */
+
+/******************************************************************************
+NAME
+     fmpool_set_lastpagesize - set the pagesize of the last page in the file.
+
+DESCRIPTION
+     Set the pagesize of the last page in the file.
+
+RETURNS
+     Returns RET_SUCCESS if successful and RET_ERROR otherwise.
+******************************************************************************/
+int
+fmpool_set_lastpagesize(mp, lastpagesize)
+  MPOOL *mp;             /* IN: MPOOL cookie */
+  pageno_t lastpagesize; /* IN: pagesize to set for last page */
+{
+
+  if (lastpagesize > mp->pagesize || lastpagesize < 0)
+    return RET_ERROR;
+  else
+    mp->lastpagesize = lastpagesize;
+
+  return RET_SUCCESS;
+} /* fmpool_set_lastpagesize */
+
+/******************************************************************************
+NAME
+   fmpool_open -- Open a memory pool on the given file
+
+DESCRIPTION
+   Initialize a memory pool. 
+   We try to find the length of the file using either the stat() calls
+   or seeking to the end of the file and getting the offset. We take
+   special note of the size of the lastpage when the file size is not even
+   multiple of page sizes.
+
+RETURNS
+   A memory pool cookie if successful else NULL
+
+NOTE: We don't have much use for the page in/out filters as we rely
+      on the interfaces above us to fill the page and we allow the user
+      to arbitrarily change the pagesize from one invocation to another.
+      This deviates from the original Berkely implemntation.
+
+      The key string byte for sharing buffers is not implemented.
+******************************************************************************/
+MPOOL *
+fmpool_open(key, fd, pagesize, maxcache)
+  void       *key;     /* IN:byte string used as handle to share buffers */
+  fmp_file_t fd;       /* IN: seekable file handle */
+  pageno_t     pagesize; /* IN: size in bytes of the pages to break the file up into */
+  pageno_t     maxcache; /* IN: maximum number of pages to cache at any time */
+{
+#ifdef _POSIX_SOURCE
+  struct stat sb; /* file status info */
+#endif
+  struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+  MPOOL        *mp    = NULL; /* MPOOL cookie */
+  L_ELEM       *lp    = NULL;
+  int          len    = 0;    /* file length */
+  int          ret    = RET_SUCCESS;
+  int          entry;         /* index into hash table */
+  pageno_t     pageno;
+  pageno_t     lastpagesize;
+
+
+  /*
+   * Get information about the file.
+   * We don't currently handle pipes, although we should.
+   */
+#ifdef _POSIX_SOURCE
+  /* Lets get file information using "fstat()" */
+  if (fstat(fd, &sb))
+    return (NULL);
+  if (!S_ISREG(sb.st_mode)) 
+    {
+      errno = ESPIPE;
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* Set the size of the file, pagesize and max # of pages to cache */
+  len = sb.st_size;
+  if(pagesize == 0)
+    pagesize = (pageno_t)sb.st_blksize;
+  if (maxcache == 0)
+    maxcache = (pageno_t)DEF_MAXCACHE;
+#ifdef STAT_DEBUG
+    (void)fprintf(stderr,"fmpool_open: sb.st_blksize=%d\n",sb.st_blksize);
+#endif
+#else  /* !_POSIX_SOURCE */
+  /* Find the length of the file the really cheesy way! */
+  if (FMPI_SEEKEND(fd) == FAIL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+  if ((len = FMPI_TELL(fd)) == FAIL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* Set the pagesize and max # of pages to cache */
+  if(pagesize == 0)
+    pagesize = (pageno_t)DEF_PAGESIZE;
+  if (maxcache == 0)
+      maxcache = (pageno_t)DEF_MAXCACHE;
+#ifdef STAT_DEBUG
+    (void)fprintf(stderr,"fmpool_open: no fstat(),pagesize=%u\n",pagesize);
+#endif
+#endif /* !_POSIX_SOURCE */
+
+  /* Allocate and initialize the MPOOL cookie. */
+  if ((mp = (MPOOL *)calloc(1, sizeof(MPOOL))) == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+  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 file */
+  mp->maxcache = (pageno_t)maxcache;
+  mp->npages   = len / pagesize;
+  lastpagesize = len % pagesize;
+
+  /* Adjust for when file is not multiple of whole page sizes */
+  if (lastpagesize) 
+    {
+      mp->lastpagesize = lastpagesize; /* odd size of last page */
+      (mp->npages)++;
+    }
+  else if (!lastpagesize && len != 0)
+    mp->lastpagesize = pagesize; /* even multiple of pagesizes */
+  else
+    mp->lastpagesize = 0; /* 1st page */
+
+  /* Set pagesize and file handle */
+  mp->pagesize = pagesize;
+  mp->fd = fd;
+
+  /* Initialize list hash chain */
+  for (pageno = 1; pageno <= mp->npages; ++pageno)
+    {
+      lhead = &mp->lhqh[HASHKEY(pageno)];
+      if ((lp = (L_ELEM *)malloc(sizeof(L_ELEM))) == NULL)
+        {
+          ret = RET_ERROR;
+          goto done;
+        }
+      lp->pgno   = (pageno_t)pageno;     /* set page number */
+      lp->eflags = (u_int8_t)ELEM_SYNC; /* valid page exists 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 == RET_ERROR)
+    { /* error cleanup */
+      if (mp != NULL)
+        free(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);
+              free(lp);
+            }
+        } /* end for entry */
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_open: ERROR \n");
+#endif      
+      mp = NULL; /* return value */
+    } /* end error cleanup */
+  /* Normal cleanup */
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_open: mp->pagesize=%lu\n",mp->pagesize);
+    (void)fprintf(stderr,"fmpool_open: mp->lastpagesize=%lu\n",mp->lastpagesize);
+    (void)fprintf(stderr,"fmpool_open: mp->maxcache=%u\n",mp->maxcache);
+    (void)fprintf(stderr,"fmpool_open: mp->npages=%u\n",mp->npages);
+#ifdef STATISTICS
+    (void)fprintf(stderr,"fmpool_open: mp->listalloc=%lu\n",mp->listalloc);
+#endif
+#endif
+
+  return (mp);
+} /* fmpool_open () */
+
+/******************************************************************************
+NAME
+   fmpool_filter -- Initialize input/output filters.
+
+DESCRIPTION
+   Initialize input/output filters for user page processing.
+
+RETURNS
+   Nothing
+
+NOTE: the filters must now handle the case where the page
+      is the last page which may not be a full 'pagesize' so
+      the filters must check for this.
+
+      We don't use these yet.
+******************************************************************************/
+void
+fmpool_filter(mp, pgin, pgout, pgcookie)
+  MPOOL *mp;                                     /* IN: MPOOL cookie */
+  void (*pgin) __P((void *, pageno_t, void *));  /* IN: page in filter */
+  void (*pgout) __P((void *, pageno_t, void *)); /* IN: page out filter */
+  void *pgcookie;                                /* IN: filter cookie */
+{
+  mp->pgin     = pgin;
+  mp->pgout    = pgout;
+  mp->pgcookie = pgcookie;
+} /* fmpool_filter() */
+
+/******************************************************************************
+NAME
+   fmpool_new -- get a new page of memory
+
+DESCRIPTION
+    Get a new page of memory. This is where we get new pages for the file.
+    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' = MPOOL_EXTEND, set page to *pgnoaddr and
+                               npages = *pgnoaddr.
+
+    All returned pages are pinned.
+
+RETURNS
+    Returns the new page if successfull and NULL otherwise
+******************************************************************************/
+void *
+fmpool_new(mp, pgnoaddr, pagesize, flags)
+  MPOOL     *mp;         /* IN: MPOOL cookie */
+  pageno_t    *pgnoaddr; /* IN/OUT: address of newly create page */
+  pageno_t    pagesize;  /* IN: page size for last page*/
+  u_int32_t flags;       /* IN:MPOOL_EXTEND or 0 */
+{
+  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;
+  int          ret = RET_SUCCESS;
+
+  /* check inputs */
+  if (mp == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* page overflow? */
+  if (mp->npages == MAX_PAGE_NUMBER) 
+    {
+      fprintf(stderr, "fmpool_new: page allocation overflow.\n");
+      abort();
+    }
+#ifdef STATISTICS
+  ++mp->pagenew;
+#endif
+  /*
+   * Get a BKT from the cache.  
+   * Assign a new page number based upon 'flags'. If flags 
+   * is MPOOL_EXTEND then we want to extend file up to '*pgnoaddr' pages.
+   * attach it to the head of the hash chain, the tail of the lru chain,
+   * and return.
+   */
+  if ((bp = fmpool_bkt(mp)) == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  if (!(flags & MPOOL_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, "fmpool_new: page allocation overflow.\n");
+          abort();
+        }
+      /* If pagesize is odd size then it is size for last page */
+      if (mp->pagesize != pagesize) 
+        mp->lastpagesize = pagesize;
+      bp->pgno = *pgnoaddr;      /* page number to create */
+      mp->npages= *pgnoaddr; /* number of pages */
+    }
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_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 = MPOOL_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
+        ret = RET_SUCCESS;
+        goto done;
+      } /* end if lp->pgno */
+
+  /* NO hit, new list element */
+  if ((lp = (L_ELEM *)malloc(sizeof(L_ELEM))) == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+  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 MPOOL_DEBUG
+#ifdef STATISTICS
+    (void)fprintf(stderr,"fmpool_newn: mp->listalloc=%d\n",mp->listalloc);
+#endif
+#endif
+done:
+  if(ret == RET_ERROR)
+    { /* error cleanup */
+      if(lp != NULL)
+        free(lp);
+
+      return NULL;
+    }
+  /* Normal cleanup */
+
+  return (bp->page);
+} /* fmpool_new() */
+
+/******************************************************************************
+NAME
+   fmpool_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 *
+fmpool_get(mp, pgno, flags)
+  MPOOL     *mp;    /* IN: MPOOL cookie */
+  pageno_t    pgno; /* IN: page number */
+  u_int32_t flags;  /* IN: XXX not used? */
+{
+  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;
+  int          ret   = RET_SUCCESS;
+  off_t        off;         /* file offset? */
+  pageno_t       nr;          /* number of bytes read for page */
+  pageno_t       rpagesize;   /* pagesize to read */
+  int          list_hit;    /* hit flag */
+
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_get: entering \n");
+#endif
+  /* check inputs */
+  if (mp == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* Check for attempting to retrieve a non-existent page. 
+  *  remember pages go from 1 ->npages  */
+  if (pgno > mp->npages) 
+    {
+      errno = EINVAL;
+      ret = RET_ERROR;
+      goto done;
+    } 
+
+#ifdef STATISTICS
+  ++mp->pageget;
+#endif
+
+  /* Check for a page that is cached. */
+  if ((bp = fmpool_look(mp, pgno)) != NULL) 
+    {
+#ifdef MPOOL_DEBUG
+      if (bp->flags & MPOOL_PINNED) 
+        {
+          (void)fprintf(stderr,
+                        "fmpool_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 |= MPOOL_PINNED;
+
+#ifdef MPOOL_DEBUG
+      (void)fprintf(stderr,"fmpool_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 */
+
+      ret = RET_SUCCESS;
+      goto done;
+    } /* end if bp */
+
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_get: NOT cached page\n");
+#endif
+  /* Page not cached so
+   * Get a page from the cache to use or create one. */
+  if ((bp = fmpool_bkt(mp)) == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* 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)
+      { /* 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 *)malloc(sizeof(L_ELEM))) == NULL)
+        {
+          ret = RET_ERROR;
+          goto done;
+        }
+      lp->pgno = pgno;
+      lp->eflags = 0;
+#ifdef STATISTICS
+      ++mp->listalloc;
+      lp->elemhit =1;
+#endif
+      CIRCLEQ_INSERT_HEAD(lhead, lp, hl); /* add to list */
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_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
+
+      /* Check to see if we are reading in last page */
+      if (pgno != mp->npages) 
+        { /* regular page */
+          rpagesize = mp->pagesize;
+#ifdef MPOOL_DEBUG
+          (void)fprintf(stderr,"fmpool_get: reading in page=%d\n",pgno);
+#endif   
+        }
+      else 
+        { /* reading in last page */
+          rpagesize = mp->lastpagesize;
+#ifdef MPOOL_DEBUG
+          (void)fprintf(stderr,"fmpool_get: reading in last page=%d\n",pgno);
+#endif  
+        }
+
+      /* Get ready to read page */
+      off = mp->pagesize * (pgno -1);
+      if (FMPI_SEEK(mp->fd, off) == FAIL)
+        {
+          ret = RET_ERROR;
+          goto done;
+        }
+
+      /* We do this to see if we really have reached this postion */
+      if (FMPI_TELL(mp->fd) != off)
+        {
+#ifdef MPOOL_DEBUG
+          (void)fprintf(stderr,"fmpool_get: lseek error=%d\n",off);
+#endif
+          ret = RET_ERROR;
+          goto done;
+        }
+
+      /* Read in the contents. */
+      if ((nr = FMPI_READ(mp->fd, bp->page, rpagesize)) != rpagesize) 
+        {
+          if (nr >= 0)
+            errno = EFTYPE;
+          ret = RET_ERROR;
+          goto done;
+        }
+    } /* end else list hit */
+
+  /* Set the page number, pin the page. */
+  bp->pgno = pgno;
+  bp->flags = MPOOL_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);
+
+  /* Run through the user's filter. */
+  if (mp->pgin != NULL)
+    (mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
+
+done:
+  if(ret == RET_ERROR)
+    { /* error cleanup */
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_get: Error exiting \n");
+#endif
+      if (lp!=NULL)
+        free(lp);
+      return NULL;
+    }
+  /* Normal cleanup */
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_get: Exiting \n");
+#endif
+  return (bp->page);
+} /* fmpool_get() */
+
+/******************************************************************************
+NAME
+   fmpool_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. MPOOL_DIRTY
+
+RETURNS
+    RET_SUCCESS if succesful and RET_ERROR otherwise
+******************************************************************************/
+int
+fmpool_put(mp, page, flags)
+  MPOOL     *mp;    /* IN: MPOOL cookie */
+  void      *page;  /* IN: page to put */
+  u_int32_t flags;  /* IN: flags = 0, MPOOL_DIRTY */
+{
+  struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+  L_ELEM       *lp    = NULL;
+  BKT          *bp = NULL;    /* bucket element ptr */
+  int          ret = RET_SUCCESS;
+
+  /* check inputs */
+  if (mp == NULL || page == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+#ifdef STATISTICS
+  ++mp->pageput;
+#endif
+  /* get pointer to bucket element */
+  bp = (BKT *)((char *)page - sizeof(BKT));
+#ifdef MPOOL_DEBUG
+  (void)fprintf(stderr,"fmpool_put: putting page=%d\n",bp->pgno);
+  if (!(bp->flags & MPOOL_PINNED)) 
+    {
+      (void)fprintf(stderr,
+                    "fmpool_put: page %d not pinned\n", bp->pgno);
+      abort();
+    }
+#endif
+  /* Unpin the page and mark it appropriately */
+  bp->flags &= ~MPOOL_PINNED;
+  bp->flags |= flags & MPOOL_DIRTY;
+
+  if (bp->flags & MPOOL_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 == RET_ERROR)
+    { /* error cleanup */
+      return RET_ERROR;
+    }
+  /* Normal cleanup */
+
+  return (RET_SUCCESS);
+} /* fmpool_put () */
+
+/******************************************************************************
+NAME
+   fmpool_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   
+******************************************************************************/
+int
+fmpool_close(mp)
+  MPOOL *mp; /* IN: MPOOL cookie */
+{
+  L_ELEM  *lp = NULL;
+  BKT     *bp = NULL;   /* bucket element */
+  int     nelem = 0;
+  int     ret   = RET_SUCCESS;
+  int     entry;      /* index into hash table */
+
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_close: entered \n");
+#endif
+  /* check inputs */
+  if (mp == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* 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);
+      free(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);
+          free(lp);
+          nelem++;
+        }
+    } /* end for entry */
+
+done:
+  if(ret == RET_ERROR)
+    { /* error cleanup */
+      return RET_ERROR;
+    }
+  /* Normal cleanup */
+
+  /* Free the MPOOL cookie. */
+  free(mp);
+
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_close: freed %d list elements\n\n",nelem);
+#endif
+  return (RET_SUCCESS);
+} /* fmpool_close() */
+
+/******************************************************************************
+NAME
+   fmpool_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   
+******************************************************************************/
+int
+fmpool_sync(mp)
+  MPOOL *mp; /* IN: MPOOL cookie */
+{
+  BKT *bp = NULL; /* bucket element */
+  int ret = RET_SUCCESS;
+
+#ifdef MPOOL_DEBUG
+      (void)fprintf(stderr,"mpool_sync: entering \n");
+#endif
+  /* check inputs */
+  if (mp == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* 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 & MPOOL_DIRTY 
+          && fmpool_write(mp, bp) == RET_ERROR)
+        {
+          ret = RET_ERROR;
+          goto done;
+        }
+    } /* end for bp */
+
+  /* Sync the file descriptor. This is an expensive operation 
+  *  if using FCNTL routines */
+  if (FMPI_FLUSH(mp->fd) == FAIL)
+    ret = RET_ERROR ;
+
+done:
+  if(ret == RET_ERROR)
+    { /* error cleanup */
+      return RET_ERROR;
+    }
+  /* Normal cleanup */
+
+#ifdef MPOOL_DEBUG
+      (void)fprintf(stderr,"fmpool_sync: exiting \n");
+#endif
+
+  return ret;
+} /* fmpool_sync() */
+
+#if 0
+/******************************************************************************
+NAME
+   fmpool_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 file.
+      We need to mark the current file size by writing out
+      the last page(or part of it) otherwise mpool_get() on
+      an intermediate page between the current end of the file
+      and the new end of file will fail.
+******************************************************************************/
+int
+fmpool_page_sync(mp, pgno, flags)
+  MPOOL     *mp;     /* IN: MPOOL cookie */
+  pageno_t    pgno;  /* IN: page number */
+  u_int32_t flags;   /* IN: XXX not used? */
+{
+  struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+  L_ELEM       *lp    = NULL;
+  BKT          *bp    = NULL; /* bucket element */
+  int          ret = RET_SUCCESS;
+  off_t        off;               /* offset into the file */
+  pageno_t       wpagesize;         /* page size to write */
+
+
+#ifdef MPOOL_DEBUG
+          (void)fprintf(stderr,"fmpool_page_sync: entering\n");
+#endif  
+  /* check inputs */
+  if (mp == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* Check for attempting to sync a non-existent page. 
+  *  remember pages go from 1 ->npages  */
+  if (pgno > mp->npages) 
+    {
+      errno = EINVAL;
+      ret = RET_ERROR;
+      goto done;
+    } 
+
+  /* Check for a page that is cached. */
+  if ((bp = fmpool_look(mp, pgno)) != NULL) 
+    {
+#ifdef MPOOL_DEBUG
+      if (bp->flags & MPOOL_PINNED) 
+        {
+          (void)fprintf(stderr,
+                        "fmpool_page_sync: page %u already pinned\n", bp->pgno);
+          abort();
+        }
+#endif
+
+      /* only flush the page if dirty */
+      if (!(bp->flags & MPOOL_DIRTY))
+        {
+          ret = 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. */
+      if (mp->pgout)
+        (mp->pgout)(mp->pgcookie, bp->pgno, bp->page);
+
+#ifdef MPOOL_DEBUG
+      (void)fprintf(stderr,"fmpool_page_sync: npages=%u\n",mp->npages);
+#endif
+
+      /* Check to see if we are writing last page */
+      if (bp->pgno != mp->npages) 
+        {
+          wpagesize = mp->pagesize;
+#ifdef MPOOL_DEBUG
+          (void)fprintf(stderr,"fmpool_page_sync: writing page=%u\n",bp->pgno);
+#endif  
+        }
+      else 
+        { /* writing last page */
+          wpagesize = mp->lastpagesize;
+#ifdef MPOOL_DEBUG
+          (void)fprintf(stderr,"fmpool_page_sync: writing last page=%u\n",bp->pgno);
+          (void)fprintf(stderr,"fmpool_page_sync: lastpagesize=%u\n",mp->lastpagesize);
+#endif  
+
+        }
+
+      /* seek to proper postion */
+      off = mp->pagesize * (bp->pgno - 1);
+      if (FMPI_SEEK(mp->fd, off) == FAIL)
+        {
+#ifdef MPOOL_DEBUG
+          (void)fprintf(stderr,"fmpool_page_sync: lseek error=%d\n",off);
+#endif
+          ret = RET_ERROR;
+          goto done;
+        }
+
+      /* We do this to see if we really have reached this postion */
+      if (FMPI_TELL(mp->fd) != off)
+        {
+#ifdef MPOOL_DEBUG
+          (void)fprintf(stderr,"fmpool_page_sync: lseek error=%d\n",off);
+#endif
+          ret = RET_ERROR;
+          goto done;
+        }
+
+      /* write page out */
+      if (FMPI_WRITE(mp->fd, bp->page, wpagesize) != wpagesize)
+        {
+#ifdef MPOOL_DEBUG
+          perror("fmpool_page_sync");
+          (void)fprintf(stderr,"fmpool_page_sync: fd=%d,lseek =%d, wpagesize=%u\n",
+                        mp->fd,off,wpagesize);
+          (void)fprintf(stderr,"fmpool_page_sync: write error for page=%u\n",bp->pgno);
+#endif
+          ret = RET_ERROR;
+          goto done;
+        }
+
+      /* mark page as clean */
+      bp->flags &= ~MPOOL_DIRTY;
+
+    } /* end if cached page */
+  else /* not a cached page!...we shouldn't encounter this */
+    ret = RET_ERROR;
+
+done:
+  if(ret == RET_ERROR)
+    { /* error cleanup */
+      return RET_ERROR;
+    }
+  /* Normal cleanup */
+
+#ifdef MPOOL_DEBUG
+          (void)fprintf(stderr,"fmpool_page_sync: exiting\n");
+#endif  
+  return (RET_SUCCESS);
+} /* fmpool_page_sync() */
+#endif
+
+/******************************************************************************
+NAME
+   fmpool_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 *
+fmpool_bkt(mp)
+  MPOOL *mp;  /* IN: MPOOL cookie */
+{
+  struct _hqh *head = NULL;  /* head of hash chain */
+  BKT         *bp   = NULL;  /* bucket element */
+  int          ret  = RET_SUCCESS;
+
+  /* check inputs */
+  if (mp == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* If under the max cached, always create a new page. */
+  if ((pageno_t)mp->curcache < (pageno_t)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 & MPOOL_PINNED)) 
+      { /* Flush if dirty. */
+        if (bp->flags & MPOOL_DIRTY  && fmpool_write(mp, bp) == RET_ERROR)
+          {
+            ret = RET_ERROR;
+            goto done;
+          }
+#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 MPOOL_DEBUG
+        { void *spage;
+        spage = bp->page;
+        memset(bp, 0xff, sizeof(BKT) + mp->pagesize);
+        bp->page = spage;
+        }
+#endif
+        ret = RET_SUCCESS;
+        goto done;
+      } /* end if bp->flags */
+
+  /* create a new page */
+new: if ((bp = (BKT *)malloc(sizeof(BKT) + mp->pagesize)) == NULL)
+          {
+            ret = RET_ERROR;
+            goto done;
+          }
+
+#ifdef STATISTICS
+  ++mp->pagealloc;
+#endif
+
+#if defined(MPOOL_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 == RET_ERROR)
+    { /* error cleanup */
+      if (bp != NULL)
+        free(bp);
+
+      return NULL;
+    }
+  /* Normal cleanup */
+
+  return (bp); /* return only the pagesize fragement */
+} /* fmpool_bkt() */
+
+/******************************************************************************
+NAME
+   fmpool_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
+fmpool_write(mp, bp)
+  MPOOL *mp;     /* IN: MPOOL cookie */
+  BKT *bp;       /* IN: bucket element */
+{
+  struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+  L_ELEM       *lp   = NULL;
+  int          ret = RET_SUCCESS;
+  off_t        off;      /* offset into the file */
+  pageno_t       wpagesize;  /* page size to write */
+
+
+#ifdef MPOOL_DEBUG
+      (void)fprintf(stderr,"fmpool_write: entering \n");
+#endif
+  /* check inputs */
+  if (mp == NULL || bp == NULL)
+    {
+      ret = RET_ERROR;
+      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. */
+  if (mp->pgout)
+    (mp->pgout)(mp->pgcookie, bp->pgno, bp->page);
+
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_write: npages=%u\n",mp->npages);
+#endif
+
+  /* Check to see if we are writing last page */
+  if (bp->pgno != mp->npages) 
+    {
+      wpagesize = mp->pagesize;
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_write: writing page=%u\n",bp->pgno);
+#endif  
+    }
+  else 
+    { /* writing last page */
+      wpagesize = mp->lastpagesize;
+#ifdef MPOOL_DEBUG
+    (void)fprintf(stderr,"fmpool_write: writing last page=%u\n",bp->pgno);
+    (void)fprintf(stderr,"fmpool_write: lastpagesize=%u\n",mp->lastpagesize);
+#endif  
+
+    }
+
+  /* seek to proper postion */
+  off = mp->pagesize * (bp->pgno - 1);
+  if (FMPI_SEEK(mp->fd, off) == FAIL)
+    {
+#ifdef MPOOL_DEBUG
+      (void)fprintf(stderr,"fmpool_write: lseek error=%d\n",off);
+#endif
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* We do this to see if we really have reached this postion */
+  if (FMPI_TELL(mp->fd) != off)
+    {
+#ifdef MPOOL_DEBUG
+      (void)fprintf(stderr,"fmpool_page_sync: lseek error=%d\n",off);
+#endif
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* write page out */
+  if (FMPI_WRITE(mp->fd, bp->page, wpagesize) != wpagesize)
+    {
+#ifdef MPOOL_DEBUG
+      perror("fmpool_write");
+      (void)fprintf(stderr,"fmpool_write: write error\n");
+#endif
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* mark page as clean */
+  bp->flags &= ~MPOOL_DIRTY;
+
+done:
+  if(ret == RET_ERROR)
+    { /* error cleanup */
+#ifdef MPOOL_DEBUG
+      (void)fprintf(stderr,"fmpool_write: error exiting\n");
+#endif
+      return RET_SUCCESS;
+    }
+  /* Normal cleanup */
+
+#ifdef MPOOL_DEBUG
+      (void)fprintf(stderr,"fmpool_write: exiting\n");
+#endif
+  return (RET_SUCCESS);
+} /* fmpool_write() */
+
+/******************************************************************************
+NAME
+   fmpool_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 *
+fmpool_look(mp, pgno)
+  MPOOL *mp;     /* IN: MPOOL cookie */
+  pageno_t pgno; /* IN: page to look up in cache */
+{
+  struct _hqh *head = NULL; /* head of hash chain */
+  BKT         *bp   = NULL; /* bucket element */
+  int          ret  = RET_SUCCESS;
+
+  /* check inputs */
+  if (mp == NULL)
+    {
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* Check for attempt to look up a non-existent page. */
+  if (pgno > mp->npages) 
+    {
+      errno = EINVAL;
+      ret = RET_ERROR;
+      goto done;
+    }
+
+  /* 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
+        ret = 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 == RET_ERROR)
+    { /* error cleanup */
+      return NULL;
+    }
+  /* Normal cleanup */
+
+  return (bp);
+} /* fmpool_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
+   fmpool_stat - print out cache statistics
+
+DESCRIPTION
+   Print out cache statistics to STDERR.
+
+RETURNS
+   Nothing
+******************************************************************************/
+void
+fmpool_stat(mp)
+  MPOOL *mp; /* IN: MPOOL 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;
+  int          entry;         /* index into hash table */
+  int          cnt;
+  int          hitcnt; 
+
+#ifdef HAVE_GETRUSAGE
+  myrusage();
+#endif
+
+  /* check inputs */
+  if (mp != NULL)
+    {
+      (void)fprintf(stderr, "%u pages in the file\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(MPOOL)=%d, sizeof(BKT)=%d, sizeof(L_ELEM)=%d\n",
+                    sizeof(MPOOL), sizeof(BKT), sizeof(L_ELEM));
+      (void)fprintf(stderr, "memory pool used %u bytes\n",
+              (pageno_t)(sizeof(MPOOL)+ (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 & MPOOL_DIRTY)
+            (void)fprintf(stderr, "d");
+          if (bp->flags & MPOOL_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 */

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/fmpool.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,331 @@
+/*-
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. 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: fmpool.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.
+ *****************************************************************************/ 
+
+/* $Id: fmpool.h,v 1.13 1996/02/02 17:37:39 georgev Exp $ */
+
+#ifndef _FMPOOL_H
+#define _FMPOOL_H
+
+#include "fmpconf.h"
+#include "fmptypes.h" /* all the defined types */
+#include "queue.h"    /* Circluar queue functions(Macros) */
+
+/*
+ * 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
+
+/* 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 */
+  pageno_t   pgno;          /* page number */
+
+#define	MPOOL_DIRTY	 0x01   /* page needs to be written */
+#define	MPOOL_PINNED 0x02   /* page is pinned into memory */
+  u_int8_t flags;           /* flags */
+} BKT;
+
+/* The element structure for every page referenced(read/written) in file */
+typedef struct _lelem
+{
+  CIRCLEQ_ENTRY(_lelem) hl;	/* hash list */
+  pageno_t        pgno;         /* page number */
+#ifdef STATISTICS
+  u_int32_t	elemhit;            /* # of hits on page */
+#endif
+#define ELEM_READ       0x01
+#define ELEM_WRITTEN    0x02
+#define ELEM_SYNC       0x03
+  u_int8_t      eflags;         /* 1= read, 2=written, 3=synced */
+} L_ELEM;
+
+#define	MPOOL_EXTEND    0x10	/* increase number of pages 
+                                   i.e extend file */
+
+/* Memory pool */
+typedef struct MPOOL 
+{
+  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 */
+  pageno_t	curcache;		      /* current num of cached pages */
+  pageno_t	maxcache;		      /* max number of cached pages */
+  pageno_t	npages;			      /* number of pages in the file */
+  u_int32_t	lastpagesize;	              /* page size of last page */
+  u_int32_t	pagesize;		      /* file page size */
+  fmp_file_t    fd;			      /* file handle */
+  void (*pgin) __P((void *, pageno_t, void *)); /* page in conversion routine */
+  void (*pgout) __P((void *, pageno_t, void *));/* page out conversion routine*/
+  void	*pgcookie;                         /* cookie for page in/out routines */
+#ifdef STATISTICS
+  u_int32_t	listhit;                /* # of list hits */
+  u_int32_t	listalloc;              /* # of list elems allocated */
+  u_int32_t	cachehit;               /* # of cache hits */
+  u_int32_t	cachemiss;              /* # of cache misses */
+  u_int32_t	pagealloc;              /* # of pages allocated */
+  u_int32_t	pageflush;              /* # of pages flushed */
+  u_int32_t	pageget;                /* # of pages requested from pool */
+  u_int32_t	pagenew;                /* # of new pages */
+  u_int32_t	pageput;                /* # of pages put back into pool */
+  u_int32_t	pageread;               /* # of pages read from file */
+  u_int32_t	pagewrite;              /* # of pages written to file */
+#endif /* STATISTICS */
+} MPOOL;
+
+__BEGIN_DECLS
+/******************************************************************************
+NAME
+   fmpool_open -- Open a memory pool on the given file
+
+DESCRIPTION
+   Initialize a memory pool. 
+   We try to find the length of the file using either the stat() calls
+   or seeking to the end of the file and getting the offset. We take
+   special note of the size of the lastpage when the file size is not even
+   multiple of page sizes.
+
+RETURNS
+   A memory pool cookie if successful else NULL
+
+NOTE: We don't have much use for the page in/out filters as we rely
+      on the interfaces above us to fill the page and we allow the user
+      to arbitrarily change the pagesize from one invocation to another.
+      This deviates from the original Berkely implemntation.
+
+      The key string byte for sharing buffers is not implemented.
+******************************************************************************/
+MPOOL *fmpool_open __P((void *key, /* IN:byte string used as handle to share buffers */
+                        fmp_file_t fd, /* IN: seekable file handle */
+                        pageno_t pagesize, /* IN: size in bytes of the pages to break the file up into */
+                        pageno_t maxcache /* IN: maximum number of pages to cache at any time */));
+
+/******************************************************************************
+NAME
+   fmpool_filter -- Initialize input/output filters.
+
+DESCRIPTION
+   Initialize input/output filters for user page processing.
+
+RETURNS
+   Nothing
+
+NOTE: the filters must now handle the case where the page
+      is the last page which may not be a full 'pagesize' so
+      the filters must check for this.
+
+      We don't use these yet.
+******************************************************************************/
+void	 fmpool_filter __P((MPOOL *mp, /* IN: MPOOL cookie */
+                            void (*pgin)(void *, pageno_t, void *) ,/* IN: page in filter */
+                            void (*pgout)(void *, pageno_t, void *) , /* IN: page out filter */
+                            void * pgcookie /* IN: filter cookie */));
+
+/******************************************************************************
+NAME
+   fmpool_new -- get a new page of memory
+
+DESCRIPTION
+    Get a new page of memory. This is where we get new pages for the file.
+    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' = MPOOL_EXTEND, set page to *pgnoaddr and
+                               npages = *pgnoaddr.
+
+    All returned pages are pinned.
+
+RETURNS
+    Returns the new page if successfull and NULL otherwise
+******************************************************************************/
+void	*fmpool_new __P((MPOOL *mp, /* IN: MPOOL cookie */
+                         pageno_t *pgnoaddr, /* IN/OUT: address of newly create page */
+                         pageno_t pagesize, /* IN: page size for last page*/
+                         u_int32_t flags /* IN:MPOOL_EXTEND or 0 */));
+
+
+/******************************************************************************
+NAME
+   fmpool_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	*fmpool_get __P((MPOOL *mp, /* IN: MPOOL cookie */
+                         pageno_t pgno, /* IN: page number */
+                         u_int32_t flags /* IN: XXX not used? */));
+
+/******************************************************************************
+NAME
+   fmpool_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. MPOOL_DIRTY
+
+RETURNS
+    RET_SUCCESS if succesful and RET_ERROR otherwise
+******************************************************************************/
+int	 fmpool_put __P((MPOOL *mp, /* IN: MPOOL cookie */
+                         void *page, /* IN: page to put */ 
+                         u_int32_t flags /* IN: flags = 0, MPOOL_DIRTY */));
+
+/******************************************************************************
+NAME
+   fmpool_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   
+******************************************************************************/
+int	 fmpool_sync __P((MPOOL *mp /* IN: MPOOL cookie */));
+
+/******************************************************************************
+NAME
+   fmpool_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   
+******************************************************************************/
+int	 fmpool_close __P((MPOOL *mp /* IN: MPOOL cookie */));
+
+/******************************************************************************
+NAME
+     fmpool_set_lastpagesize - set the pagesize of the last page in the file.
+
+DESCRIPTION
+     Set the pagesize of the last page in the file.
+
+RETURNS
+     Returns RET_SUCCESS if successful and RET_ERROR otherwise.
+******************************************************************************/
+int  fmpool_set_lastpagesize __P((MPOOL *, /* IN: MPOOL cookie */
+                               pageno_t /* IN: pagesize to set for last page */));
+
+/******************************************************************************
+NAME
+     fmpool_get_lastpagsize - returns pagesize of last page in file.
+
+DESCRIPTION
+     Finds the size of the last page in the file.
+
+RETURNS
+     returns the pagesize of the last page in the file.
+******************************************************************************/
+pageno_t  fmpool_get_lastpagesize __P((MPOOL *mp /* IN: MPOOL cookie */));
+
+/******************************************************************************
+NAME
+    fmpool_get_pagsize - returns pagesize for file
+
+DESCRIPTION
+    Finds current pagesize used for file.
+
+RETURNS
+    returns pagesize for file.
+******************************************************************************/
+pageno_t  fmpool_get_pagesize __P((MPOOL *mp /* IN: MPOOL cookie */));
+
+/******************************************************************************
+NAME
+    fmpool_get_maxcache - returns current number of pages cached.
+
+DESCRIPTION
+    Finds current number of pages cached for file.
+
+RETURNS
+    Returns current number of pages cached.
+******************************************************************************/
+pageno_t  fmpool_get_maxcache __P((MPOOL *mp /* IN: MPOOL cookie */));
+
+/******************************************************************************
+NAME
+    fmpool_get_npages - returns current number of pages in file.
+
+DESCRIPTION
+    Finds current number of pages in file.
+
+RETURNS
+    Returns current number of pages in file.
+******************************************************************************/
+pageno_t  fmpool_get_npages __P((MPOOL *mp /* IN: MPOOL cookie */));
+#ifdef STATISTICS
+void	 fmpool_stat __P((MPOOL *));
+#endif /* STATISTICS */
+#if 0
+int	 fmpool_page_sync __P((MPOOL *, pageno_t, u_int32_t));
+#endif
+__END_DECLS
+
+#endif /* _FMPOOL_H */

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/fmptypes.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/fmptypes.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/fmptypes.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,265 @@
+/*-
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. 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: compat.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.
+ *
+ *****************************************************************************/ 
+
+/* $Id: fmptypes.h,v 1.9 1996/02/02 17:37:41 georgev Exp $ */
+
+#ifndef _FMPTYPES_H_
+#define	_FMPTYPES_H_
+
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#ifdef HAVE_CDEFS_H
+#include <cdefs.h>
+#else
+#include "cdefs.h"
+#endif
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif /* HAVE_LIMITS_H */
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
+#ifdef HAVE_FCNTL
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#endif /* HAVE_FCNTL */
+
+#ifdef HAVE_MIN_MAX
+#include <sys/param.h>
+#endif /* HAVE_MIN_MAX */
+
+#ifdef HAVE_STAT
+#include <sys/stat.h>
+#endif /* HAVE_STAT */
+
+#ifdef HAVE_STDLIB
+#include <stdlib.h>
+#endif /* HAVE_STDLIB */
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif /* HAVE_STDIO_H*/
+
+#ifdef __FMPINTERFACE_PRIVATE
+#include "compat.h"
+#endif
+
+#define	RET_ERROR	-1		/* Return values. */
+#define	RET_SUCCESS	 0
+#define	RET_SPECIAL	 1
+#ifndef SUCCEED
+#define SUCCEED          0
+#define FAIL            (-1)
+#endif  /* SUCCEED */
+
+#ifndef	__BIT_TYPES_DEFINED__
+#define	__BIT_TYPES_DEFINED__
+typedef	__signed char		   int8_t;
+typedef	unsigned char		 u_int8_t;
+typedef	short			  int16_t;
+typedef	unsigned short		u_int16_t;
+typedef	int			  int32_t;
+typedef	unsigned int		u_int32_t;
+#ifdef HAVE_INT64
+typedef	long long		  int64_t;
+typedef	unsigned long long	u_int64_t;
+#endif
+#endif /* __BIT_TYPES_DEFINED__ */
+
+#define	MAX_PAGE_NUMBER	0xffffffff	/* >= # of pages in a file */
+typedef u_int32_t	pageno_t;         /* page type */
+
+/* internal file access codes */
+#ifndef DFACC_READ
+#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
+#endif  /* DFACC_READ */
+
+/* -------------------------- File I/O Functions -------------------------- */
+/* FILE_IO -- file library to use for file access: 
+   1 stdio, 2 fcntl
+   default to stdio(1) library i.e. ANSI C buffered I/O */
+
+#ifdef HAVE_STDIO
+#define FMPI_OPEN_FAIL    NULL
+#define FMPI_CLOSE_SUCCEED   0
+/* using C buffered file I/O routines to access files */
+typedef FILE *fmp_file_t;
+
+#ifdef VMS
+/* For VMS, use "mbc=64" to improve performance     */
+#   define FMPI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                fopen((p), "r+", "mbc=64") : \
+                                fopen((p), "r", "mbc=64"))
+#else  /*  !VMS  */
+#ifdef PC386
+#   define FMPI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                fopen((p), "rb+") : fopen((p), "rb"))
+#else /* !PC386 */
+#   define FMPI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                fopen((p), "r+") : fopen((p), "r"))
+#endif /* PC386 */
+#endif /* !VMS */
+#ifdef PC386
+#   define FMPI_CREATE(p)      (fopen((p), "wb+"))
+#else  /* PC386 */
+#   define FMPI_CREATE(p)      (fopen((p), "w+"))
+#endif /* PC386 */
+#   define FMPI_READ(f, b, n)  (fread((b), 1, (size_t)(n), (f)))
+#   define FMPI_WRITE(f, b, n) (fwrite((b), 1, (size_t)(n), (f)))
+#   define FMPI_CLOSE(f)       (fclose(f))
+#   define FMPI_FLUSH(f)       (fflush(f)==0 ? SUCCEED : FAIL)
+#   define FMPI_SEEK(f,o)      (fseek((f), (long)(o), SEEK_SET)==0 ? SUCCEED : FAIL)
+#   define FMPI_SEEK_CUR(f,o)  (fseek((f), (long)(o), SEEK_CUR)==0 ? SUCCEED : FAIL)
+#   define FMPI_SEEKEND(f)     (fseek((f), (long)0, SEEK_END)==0 ? SUCCEED : FAIL)
+#   define FMPI_TELL(f)        (ftell(f))
+#endif /* FILE_IO == HAVE_STDIO */
+
+#ifdef HAVE_FCNTL
+#define FMPI_OPEN_FAIL    -1
+#define FMPI_CLOSE_SUCCEED   0
+/* using UNIX unbuffered file I/O routines to access files */
+typedef int fmp_file_t;
+
+#   define FMPI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                  open((p), O_RDWR, DEF_FILEMODE) : \
+                                  open((p), O_RDONLY, DEF_FILEMODE))
+#   define FMPI_CREATE(p)         (open((p), O_RDWR | O_CREAT | O_TRUNC,DEF_FILEMODE))
+#   define FMPI_CLOSE(f)          (close(f))
+#   define FMPI_FLUSH(f)          (fsync(f)==0 ? SUCCEED : FAIL)
+#if 0
+#   define FMPI_FLUSH(f)          (SUCCEED)
+#endif
+#   define FMPI_READ(f, b, n)     (read((f), (char *)(b), (n)))
+#   define FMPI_WRITE(f, b, n)    (write((f), (char *)(b), (n)))
+#   define FMPI_SEEK(f, o)        (lseek((f), (off_t)(o), SEEK_SET))
+#   define FMPI_SEEKEND(f)        (lseek((f), (off_t)0, SEEK_END))
+#   define FMPI_TELL(f)           (lseek((f), (off_t)0, SEEK_CUR))
+#endif /* FILE_IO == HAVE_FCNTL */
+
+#ifdef HAVE_MACIO
+#define FMPI_OPEN_FAIL    -1
+#define FMPI_CLOSE_SUCCEED   0
+/* using special routines to redirect to Mac Toolkit I/O */
+typedef short fmp_file_t;
+#   define FMPI_OPEN(x,y)         mopen(x,y)
+#   define FMPI_CREATE(name)      mopen(name, DFACC_CREATE)
+#   define FMPI_CLOSE(x)          mclose(x)
+#   define FMPI_FLUSH(a)          (SUCCEED)
+#   define FMPI_READ(a,b,c)       mread(a, (char *) b, (int32) c)
+#   define FMPI_WRITE(a,b,c)      mwrite(a, (char *) b, (int32) c)
+#   define FMPI_SEEK(x,y)         mlseek(x, (int32 )y, 0)
+#   define FMPI_SEEKEND(x)        mlseek(x, 0L, 2)
+#   define FMPI_TELL(x)           mlseek(x,0L,1)
+#endif /* FILE_IO == HAVE_MACIO */
+
+#ifdef HAVE_PCIO
+#define FMPI_OPEN_FAIL    NULL
+#define FMPI_CLOSE_SUCCEED   0
+/* using special PC functions to enable reading/writing large chunks */
+typedef FILE *fmp_file_t;
+#   define FMPI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                  fopen((p), "rb+") : fopen((p), "rb"))
+#   define FMPI_CREATE(p)        (fopen((p), "wb+"))
+/* Alias the FMPI_READ and FMPI_WRITE macros to functions which can handle */
+/*  32-bits of data to read/write */
+#   define FMPI_READ(f, b, n)    (((int32)(n) == HDfreadbig((b), (n), (f))) ? \
+                                  SUCCEED : FAIL)
+#   define FMPI_WRITE(f, b, n)   (((int32)(n) == HDfwritebig((b), (n), (f))) ? \
+                                  SUCCEED : FAIL)
+#   define FMPI_CLOSE(f)          (fclose(f))
+#   define FMPI_FLUSH(f)          (fflush(f)==0 ? SUCCEED : FAIL)
+#   define FMPI_SEEK(f,o)  (fseek((f), (long)(o), SEEK_SET)==0 ? SUCCEED : FAIL)
+#   define FMPI_SEEKEND(f) (fseek((f), (long)0, SEEK_END)==0 ? SUCCEED : FAIL)
+#   define FMPI_TELL(f)           (ftell(f))
+#endif /* FILE_IO == HAVE_PCIO */
+
+#ifdef HAVE_WINIO
+/* using special MS Windows functions to enable reading/writing large chunks */
+typedef HFILE fmp_file_t;
+#   define FMPI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                  _lopen((p), READ_WRITE) : _lopen((p), READ))
+#   define FMPI_CREATE(p)        (_lcreat((p), 0))
+/* Alias the FMPI_READ and FMPI_WRITE macros to functions which can handle */
+/*  32-bits of data to read/write */
+#   define FMPI_READ(f, b, n)    (((int32)(n) == HDfreadbig((b), (n), (f))) ? \
+                                  SUCCEED : FAIL)
+#   define FMPI_WRITE(f, b, n)   (((int32)(n) == HDfwritebig((b), (n), (f))) ? \
+                                  SUCCEED : FAIL)
+#   define FMPI_CLOSE(f)          (_lclose(f))
+#   define FMPI_FLUSH(f)          (0)
+#   define FMPI_SEEK(f, o)        (_llseek((f), (long)(o), SEEK_SET))
+#   define FMPI_SEEKEND(f)        (_llseek((f), (long)0, SEEK_END))
+#   define FMPI_TELL(f)           (_llseek((f),0l,SEEK_CUR))
+#endif /* FILE_IO == HAVE_WINIO */
+
+#ifdef HAVE_WINNTIO
+/* using special Windows NT functions to enable reading/writing large chunks */
+typedef HFILE fmp_file_t;
+#   define FMPI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                  _lopen((p), OF_READWRITE) : _lopen((p), OF_READ))
+#   define FMPI_CREATE(p)        (_lcreat((p), 0))
+#   define FMPI_READ(f, b, n)    (((int32)(n) == _hread((f), (b), (n))) ? \
+                                  SUCCEED : FAIL)
+#   define FMPI_WRITE(f, b, n)   (((int32)(n) == _hwrite((f), (b), (n))) ? \
+                                  SUCCEED : FAIL)
+#   define FMPI_CLOSE(f)        (_lclose(f)==0 ? SUCCEED : FAIL)
+#   define FMPI_FLUSH(f)        (0)
+#   define FMPI_SEEK(f, o)      (_llseek((f), (long)(o), 0))
+#   define FMPI_SEEKEND(f)      (_llseek((f), (long)0, 2))
+#   define FMPI_TELL(f)         (_llseek((f),0l,1))
+#endif /* FILE_IO == HAVE_WINNTIO */
+
+#endif /* !_FMPTYPES_H_ */

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/move-if-change
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/move-if-change	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/move-if-change	2007-05-14 09:41:34 UTC (rev 808)
@@ -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


Property changes on: packages/libhdf4/branches/upstream/current/hdf/fmpool/move-if-change
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/queue.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/queue.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/queue.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,298 @@
+/* 
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. 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: compat.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.
+ *
+ *****************************************************************************/ 
+
+#ifndef	_QUEUE_H_
+#define	_QUEUE_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.
+ */
+
+/*
+ * 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;		\
+}
+
+#ifndef LIST_DEBUG
+#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;			\
+}
+
+#else  /* LIST_DEBUG */
+#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;			\
+        (void)fprintf(stderr,"lhead=%08x\n",(head)); \
+        (void)fprintf(stderr,"lhead->lh_first=%08x\n",(head)->lh_first); \
+        (void)fprintf(stderr,"lelm=%08x\n",(elm)); \
+        (void)fprintf(stderr,"lelm->field.le_next=%08x\n",(elm)->field.le_next); \
+        (void)fprintf(stderr,"lelm->field.le_prev=%08x\n",(elm)->field.le_prev); \
+}
+#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;			\
+        (void)fprintf(stderr,"lelm=%08x\n",(elm)); \
+        (void)fprintf(stderr,"lelm->field.le_next=%08x\n",(elm)->field.le_next); \
+        (void)fprintf(stderr,"lelm->field.le_prev=%08x\n",(elm)->field.le_prev); \
+}
+
+#endif /* LIST_DEBUG */
+
+
+/*
+ * 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);				\
+}
+
+#ifndef CIRCLEQ_DEBUG
+#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);					\
+}
+#else /* CIRCLEQ_DEBUG */
+#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);					\
+        (void)fprintf(stderr,"chead=%08x\n",(head)); \
+        (void)fprintf(stderr,"chead->lh_first=%08x\n",(head)->cqh_first); \
+        (void)fprintf(stderr,"celm=%08x\n",(elm)); \
+        (void)fprintf(stderr,"celm->field.le_next=%08x\n",(elm)->field.cqe_next); \
+        (void)fprintf(stderr,"celm->field.le_prev=%08x\n",(elm)->field.cqe_prev); \
+}
+#endif /* CIRCLEQ_DEBUG */
+#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	/* !_QUEUE_H_ */

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/test_fmpio.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/test_fmpio.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/test_fmpio.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,258 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/* 
+ * tsds - writes a 2Dimensional 
+ *        dim[0] = numrecs
+ *        dim[1] = reclen
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "fmpio.h"
+
+#define DEFAULT_RECLEN  1024
+#define DEFAULT_NUMRECS 10
+
+#define USAGE1 \
+"Usage:test_mp <output filename> [record_length_in_bytes] [number of records] \n "
+#define USAGE2 \
+"This program writes out a 2dimensional array where \n"
+#define USAGE3 \
+" dim[0]=record length,dim[1]=number of records\n"
+
+char t_filename[256] = "test.mp";
+
+int 
+main(int argc, char *argv[], char *env[])    /* main body of code */
+{
+  char *buffer;
+  MPFILE *fhandle;
+  int sdfid, sdsid;
+  int start[2];
+  int dims[2];
+  int *pindex;
+  int cvalue;
+  int nindex;
+  int status;
+  int reclen;
+  int numrecs;
+  int thisrec;
+  int cur_seek_pos;
+  int i;
+
+  switch(argc)
+    {
+    case 1: /* no args */
+      printf(USAGE1);
+      printf(USAGE2);
+      printf(USAGE3);
+      reclen = DEFAULT_RECLEN;
+      numrecs = DEFAULT_NUMRECS;
+      printf("Using defaults: filname=%s,reclen=%d, numrecs=%d\n",
+             t_filename,reclen,numrecs);
+      break;
+    case 2: /* filename */
+      strcpy(t_filename,argv[1]);
+      reclen = DEFAULT_RECLEN;
+      numrecs = DEFAULT_NUMRECS;
+      break;
+    case 3: /* filename, reclen ?*/
+      strcpy(t_filename,argv[1]);
+      reclen = (unsigned) abs(atoi(argv[1])); 
+      numrecs = DEFAULT_NUMRECS;
+      break;
+    case 4: /* filename reclen and numrecs  ?*/
+      strcpy(t_filename,argv[1]);
+      reclen = (unsigned) abs(atoi(argv[2])); 
+      numrecs = (unsigned) abs(atoi(argv[3])); 
+      break;
+    default: /* print usage */
+      printf(USAGE1);
+      printf(USAGE2);
+      printf(USAGE3);
+      exit(1);
+    }
+
+  start[0] = 0;
+  start[1] = 0;
+  dims[0] = numrecs;  /* y bytes */
+  dims[1] = reclen ;  /* x bytes */
+
+#ifdef TSDS_DEBUG
+  printf("dims[0] = %d\n",dims[0]);
+  printf("dims[1] = %d\n",dims[1]);
+
+#endif
+
+  if ((buffer = (char *) calloc(1, reclen)) == NULL)
+    printf("unable to allocate buffer(reclen) of size %d\n",reclen);
+
+  for (i=0; i < reclen; i++)
+      buffer[i] = i % 15;
+
+  if ((pindex = (int *) calloc(numrecs, sizeof(int))) == NULL)
+    printf("unable to allocate pindex[numrecs] of size integer\n");
+
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      pindex[thisrec] = thisrec;
+    }
+
+  /* seed random generator */
+  srand(getpid());
+
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      nindex = rand() % numrecs;
+      cvalue = pindex[thisrec];
+      pindex[thisrec] = pindex[nindex];
+      pindex[nindex] = cvalue;
+#ifdef DEBUG
+      printf("pindex[%d]=%d, pindex[%d]=%d\n",
+             thisrec,pindex[thisrec],nindex,pindex[nindex]);
+#endif
+    }
+
+#ifdef DEBUG
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      printf("pindex[%d]=%d\n",thisrec,pindex[thisrec]);
+    }
+#endif
+  if((fhandle = MPopen(t_filename,DFACC_CREATE)) == NULL)
+    {
+      printf("MPopen: Cannot create temporary file: %s\n", t_filename);
+      exit(1);
+    }
+
+    /* set reclen x 1 slab to write out */
+    dims[0] = 1;     
+    dims[1] = reclen;
+
+    /* start at corner */ 
+    start[0] = 0;
+    start[1] = 0;
+
+
+  /* loop writing "numrecs" for size "recline" out */
+  cur_seek_pos = 0;
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+    cur_seek_pos = pindex[thisrec] * reclen;
+#ifdef DEBUG
+    printf("writing record=%d\n",pindex[thisrec]);
+#endif
+    /* Added seeking each time to handle RANDOM_IO case  */
+    if (MPseek(fhandle, cur_seek_pos, SEEK_SET) == -1)
+      {
+        fprintf(stderr,"error with MPseek=%d",cur_seek_pos);
+	printf("Error seeking to block %d\n", thisrec);
+        MPclose(fhandle);
+        exit(1);      
+      }
+#ifdef DEBUG
+    printf("\n");
+#endif
+
+    if((status = MPwrite(fhandle, buffer, reclen)) != reclen)
+      {
+	printf("Error writing block %d\n", thisrec);
+        fprintf(stderr,"cur_seek_pos=%d",cur_seek_pos);
+        printf("status = %d\n", status);
+        MPclose(fhandle);
+	exit(1);
+      }
+    } /* end for "thisrec" */
+
+  /* end access to data set */
+  if (MPclose(fhandle) == -1)
+    printf("MPclose: error closing file \n");
+
+  memset(buffer,'\0',reclen);
+
+  /* create a new permutation of indices */
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      nindex = rand() % numrecs;
+      cvalue = pindex[thisrec];
+      pindex[thisrec] = pindex[nindex];
+      pindex[nindex] = cvalue;
+#ifdef DEBUG
+      printf("pindex[%d]=%d, pindex[%d]=%d\n",
+             thisrec,pindex[thisrec],nindex,pindex[nindex]);
+#endif
+    }
+
+  /* reading time */
+  if((fhandle = MPopen(t_filename, DFACC_READ)) == NULL)
+    {
+      printf("MPopen: Cannot opentemporary file: %s\n", t_filename);
+      exit(1);
+    }
+
+  /* loop writing "numrecs" for size "recline" out */
+  cur_seek_pos = 0;
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      memset(buffer,'\0',reclen);
+    cur_seek_pos = pindex[thisrec] * reclen;
+#ifdef DEBUG
+    printf("reading record=%d\n",pindex[thisrec]);
+#endif
+    /* Added seeking each time to handle RANDOM_IO case  */
+    if (MPseek(fhandle, cur_seek_pos, SEEK_SET) == -1)
+      {
+        fprintf(stderr,"error with MPseek=%d",cur_seek_pos);
+	printf("Error seeking to block %d\n", thisrec);
+        MPclose(fhandle);
+        exit(1);      
+      }
+#ifdef DEBUG
+    printf("\n");
+#endif
+
+    if((status = MPread(fhandle, buffer, reclen)) != reclen)
+      {
+	printf("Error read %d bytes of block %d\n", status, thisrec);
+        fprintf(stderr,"cur_seek_pos=%d",cur_seek_pos);
+        printf("status = %d\n", status);
+        MPclose(fhandle);
+	exit(1);
+      }
+    /* check data */
+    for (i=0; i < reclen; i++)
+      {
+        if (buffer[i] != (i % 15))
+        {
+          printf("Error reading block %d, seekpos=%d, status=%d\n", 
+                 thisrec,cur_seek_pos,status);
+          printf("Error with buffer[%d]=%d, should be=%d\n",i, buffer[i],i%15 );
+          MPclose(fhandle);
+          exit(1);
+        }
+
+      }
+
+    } /* end for "thisrec" */
+
+  /* end access to data set */
+  if (MPclose(fhandle) == -1)
+    printf("MPclose: error closing file \n");
+
+  exit(0);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/tfmpio_read.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/tfmpio_read.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/tfmpio_read.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,190 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/* 
+ * tsds - writes a 2Dimensional 
+ *        dim[0] = numrecs
+ *        dim[1] = reclen
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "fmpio.h"
+
+#define DEFAULT_RECLEN  1024
+#define DEFAULT_NUMRECS 10
+
+#define USAGE1 \
+"Usage:test_mp <output filename> [record_length_in_bytes] [number of records] \n "
+#define USAGE2 \
+"This program writes out a 2dimensional array where \n"
+#define USAGE3 \
+" dim[0]=record length,dim[1]=number of records\n"
+
+char t_filename[256] = "test.mp";
+
+int 
+main(int argc, char *argv[])    /* main body of code */
+{
+  char *buffer = NULL;
+  MPFILE *fhandle = NULL;
+  int sdfid, sdsid;
+  int start[2];
+  int dims[2];
+  int *pindex;
+  int nindex;
+  int cvalue;
+  int status;
+  int reclen;
+  int numrecs;
+  int thisrec;
+  int cur_seek_pos;
+  int i;
+
+  switch(argc)
+    {
+    case 1: /* no args */
+      printf(USAGE1);
+      printf(USAGE2);
+      printf(USAGE3);
+      reclen = DEFAULT_RECLEN;
+      numrecs = DEFAULT_NUMRECS;
+      printf("Using defaults: filname=%s,reclen=%d, numrecs=%d\n",
+             t_filename,reclen,numrecs);
+      break;
+    case 2: /* filename */
+      strcpy(t_filename,argv[1]);
+      reclen = DEFAULT_RECLEN;
+      numrecs = DEFAULT_NUMRECS;
+      break;
+    case 3: /* filename, reclen ?*/
+      strcpy(t_filename,argv[1]);
+      reclen = (unsigned) abs(atoi(argv[1])); 
+      numrecs = DEFAULT_NUMRECS;
+      break;
+    case 4: /* filename reclen and numrecs  ?*/
+      strcpy(t_filename,argv[1]);
+      reclen = (unsigned) abs(atoi(argv[2])); 
+      numrecs = (unsigned) abs(atoi(argv[3])); 
+      break;
+    default: /* print usage */
+      printf(USAGE1);
+      printf(USAGE2);
+      printf(USAGE3);
+      exit(1);
+    }
+
+  start[0] = 0;
+  start[1] = 0;
+  dims[0] = numrecs;  /* y bytes */
+  dims[1] = reclen ;  /* x bytes */
+
+#ifdef TSDS_DEBUG
+  printf("dims[0] = %d\n",dims[0]);
+  printf("dims[1] = %d\n",dims[1]);
+
+#endif
+
+  if ((buffer = (char *) calloc(1, reclen)) == NULL)
+    printf("unable to allocate buffer(reclen) of size %d\n",reclen);
+
+  memset(buffer,'\0',reclen);
+
+  if ((pindex = (int *) calloc(numrecs, sizeof(int))) == NULL)
+    printf("unable to allocate pindex[numrecs] of size integer\n");
+
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      pindex[thisrec] = thisrec;
+    }
+
+  /* seed random generator */
+  srand(getpid());
+
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      nindex = rand() % numrecs;
+      cvalue = pindex[thisrec];
+      pindex[thisrec] = pindex[nindex];
+      pindex[nindex] = cvalue;
+#ifdef DEBUG
+      printf("pindex[%d]=%d, pindex[%d]=%d\n",
+             thisrec,pindex[thisrec],nindex,pindex[nindex]);
+#endif
+    }
+
+#ifdef DEBUG
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      printf("pindex[%d]=%d\n",thisrec,pindex[thisrec]);
+    }
+#endif
+
+  /* reading time */
+  if((fhandle = MPopen(t_filename, DFACC_READ)) == NULL)
+    {
+      printf("MPopen: Cannot opentemporary file: %s\n", t_filename);
+      exit(1);
+    }
+
+  /* loop writing "numrecs" for size "recline" out */
+  cur_seek_pos = 0;
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      memset(buffer,'\0',reclen);
+    cur_seek_pos = pindex[thisrec] * reclen;
+    /* Added seeking each time to handle RANDOM_IO case  */
+    if (MPseek(fhandle, cur_seek_pos, SEEK_SET) == -1)
+      {
+        fprintf(stderr,"error with MPseek=%d",cur_seek_pos);
+	printf("Error seeking to block %d\n", thisrec);
+        MPclose(fhandle);
+        exit(1);      
+      }
+#ifdef DEBUG
+    printf("\n");
+#endif
+
+    if((status = MPread(fhandle, buffer, reclen)) != reclen)
+      {
+	printf("Error read %d bytes of block %d\n", status, thisrec);
+        fprintf(stderr,"cur_seek_pos=%d",cur_seek_pos);
+        printf("status = %d\n", status);
+        MPclose(fhandle);
+	exit(1);
+      }
+    /* check data */
+    for (i=0; i < reclen; i++)
+      {
+        if (buffer[i] != (i % 15))
+        {
+          printf("Error reading block %d, seekpos=%d, status=%d\n", 
+                 thisrec,cur_seek_pos,status);
+          printf("Error with buffer[%d]=%d, should be=%d\n",i, buffer[i],i%15 );
+          MPclose(fhandle);
+          exit(1);
+        }
+
+      }
+    } /* end for "thisrec" */
+
+  /* end access to data set */
+  if (MPclose(fhandle) == -1)
+    printf("MPclose: error closing file \n");
+
+  exit(0);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/fmpool/tfmpio_write.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/fmpool/tfmpio_write.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/fmpool/tfmpio_write.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,185 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/* 
+ * tsds - writes a 2Dimensional 
+ *        dim[0] = numrecs
+ *        dim[1] = reclen
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "fmpio.h"
+
+#define DEFAULT_RECLEN  1024
+#define DEFAULT_NUMRECS 10
+
+#define USAGE1 \
+"Usage:test_mp <output filename> [record_length_in_bytes] [number of records] \n "
+#define USAGE2 \
+"This program writes out a 2dimensional array where \n"
+#define USAGE3 \
+" dim[0]=record length,dim[1]=number of records\n"
+
+char t_filename[256] = "test.mp";
+
+int 
+main(int argc, char *argv[])    /* main body of code */
+{
+  char *buffer;
+  MPFILE *fhandle;
+  int sdfid, sdsid;
+  int start[2];
+  int dims[2];
+  int *pindex;
+  int nindex;
+  int cvalue;
+  int status;
+  int reclen;
+  int numrecs;
+  int thisrec;
+  int cur_seek_pos;
+  int i;
+
+  switch(argc)
+    {
+    case 1: /* no args */
+      printf(USAGE1);
+      printf(USAGE2);
+      printf(USAGE3);
+      reclen = DEFAULT_RECLEN;
+      numrecs = DEFAULT_NUMRECS;
+      printf("Using defaults: filname=%s,reclen=%d, numrecs=%d\n",
+             t_filename,reclen,numrecs);
+      break;
+    case 2: /* filename */
+      strcpy(t_filename,argv[1]);
+      reclen = DEFAULT_RECLEN;
+      numrecs = DEFAULT_NUMRECS;
+      break;
+    case 3: /* filename, reclen ?*/
+      strcpy(t_filename,argv[1]);
+      reclen = (unsigned) abs(atoi(argv[1])); 
+      numrecs = DEFAULT_NUMRECS;
+      break;
+    case 4: /* filename reclen and numrecs  ?*/
+      strcpy(t_filename,argv[1]);
+      reclen = (unsigned) abs(atoi(argv[2])); 
+      numrecs = (unsigned) abs(atoi(argv[3])); 
+      break;
+    default: /* print usage */
+      printf(USAGE1);
+      printf(USAGE2);
+      printf(USAGE3);
+      exit(1);
+    }
+
+  start[0] = 0;
+  start[1] = 0;
+  dims[0] = numrecs;  /* y bytes */
+  dims[1] = reclen ;  /* x bytes */
+
+#ifdef TSDS_DEBUG
+  printf("dims[0] = %d\n",dims[0]);
+  printf("dims[1] = %d\n",dims[1]);
+
+#endif
+
+  if ((buffer = (char *) calloc(1, reclen)) == NULL)
+    printf("unable to allocate buffer(reclen) of size %d\n",reclen);
+
+
+  for (i=0; i < reclen; i++)
+      buffer[i] = i % 15;
+
+  if ((pindex = (int *) calloc(numrecs, sizeof(int))) == NULL)
+    printf("unable to allocate pindex[numrecs] of size integer\n");
+
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      pindex[thisrec] = thisrec;
+    }
+
+  /* seed random generator */
+  srand(getpid());
+
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      nindex = rand() % numrecs;
+      cvalue = pindex[thisrec];
+      pindex[thisrec] = pindex[nindex];
+      pindex[nindex] = cvalue;
+#ifdef DEBUG
+      printf("pindex[%d]=%d, pindex[%d]=%d\n",
+             thisrec,pindex[thisrec],nindex,pindex[nindex]);
+#endif
+    }
+
+#ifdef DEBUG
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      printf("pindex[%d]=%d\n",thisrec,pindex[thisrec]);
+    }
+#endif
+
+  if((fhandle = MPopen(t_filename,DFACC_CREATE)) == NULL)
+    {
+      printf("MPopen: Cannot create temporary file: %s\n", t_filename);
+      exit(1);
+    }
+
+    /* set reclen x 1 slab to write out */
+    dims[0] = 1;     
+    dims[1] = reclen;
+
+    /* start at corner */ 
+    start[0] = 0;
+    start[1] = 0;
+
+  /* loop writing "numrecs" for size "recline" out */
+  cur_seek_pos = 0;
+  for(thisrec = 0; thisrec < numrecs; thisrec++)
+    {
+      cur_seek_pos = pindex[thisrec] * reclen;
+    /* Added seeking each time to handle RANDOM_IO case  */
+    if (MPseek(fhandle, cur_seek_pos, SEEK_SET) == -1)
+      {
+        fprintf(stderr,"error with MPseek=%d",cur_seek_pos);
+	printf("Error seeking to block %d\n", thisrec);
+        MPclose(fhandle);
+        exit(1);      
+      }
+#ifdef DEBUG
+    printf("\n");
+#endif
+
+    if((status = MPwrite(fhandle, buffer, reclen)) != reclen)
+      {
+	printf("Error writing block %d\n", thisrec);
+        fprintf(stderr,"cur_seek_pos=%d",cur_seek_pos);
+        printf("status = %d\n", status);
+        MPclose(fhandle);
+	exit(1);
+      }
+    } /* end for "thisrec" */
+
+  /* end access to data set */
+  if (MPclose(fhandle) == -1)
+    printf("MPclose: error closing file \n");
+
+  exit(0);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,312 @@
+# Makefile for Independent JPEG Group's software
+
+# Note this Makefile.in is not used by the autoconf configure
+# distributed by the IJG.
+# Makefile.in is edited by Cygnus configure to produce a custom Makefile.
+
+# Read installation instructions before saying "make" !!
+
+# For compiling with source and object files in different directories.
+srcdir = .
+TOP_SRCDIR = ../..
+
+# Where to install the programs and man pages.
+prefix = $(TOP_SRCDIR)/NewHDF
+exec_prefix = ${prefix}
+bindir = $(exec_prefix)/bin
+libdir = $(exec_prefix)/lib
+includedir = $(prefix)/include
+binprefix =
+manprefix =
+manext = 1
+mandir = $(prefix)/man/man$(manext)
+
+# The following default options are overriden in the makefile fragment
+# section below
+#
+# The name of your C compiler:
+CC= gcc
+
+# You may need to adjust these cc options:
+CFLAGS= -O -I$(srcdir)
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+# However, any special defines for ansi2knr.c may be included here:
+ANSI2KNRFLAGS= 
+
+# Link-time cc options:
+LDFLAGS= 
+
+# To link any special libraries, add the necessary -l commands here.
+LDLIBS= 
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For Unix this is usually jmemnobs.o, but you may want
+# to use jmemansi.o or jmemname.o if you have limited swap space.
+SYSDEPMEM= jmemnobs.o
+
+# miscellaneous OS-dependent stuff
+SHELL= /bin/sh
+# linker
+LN= $(CC)
+# file deletion command
+RM = /bin/rm 
+RMFLAGS = -f
+
+# file rename command
+MV= mv
+# library (.a) file creation command
+#AR= ar rc
+AR = ar
+ARFLAGS = rc
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# second step in .a creation (use "touch" if not needed)
+AR2= $(RANLIB)
+
+# installation program
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+MANIFEST = $(DISTFILES)
+OTHERDIRS = config
+PACKAGE	 = HDF
+VERSION  = 4.0
+
+#----------------- End of configurable options.---------------------------
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \
+        jmemdos.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \
+        rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \
+        wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure.gnu makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makcjpeg.st makdjpeg.st \
+        makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
+        makefile.vms makvms.opt Makefile.in configure.in
+CONFIGFILES= jconfig.cfg jconfig.manx jconfig.sas jconfig.st jconfig.bcc \
+        jconfig.mc6 jconfig.dj jconfig.wat jconfig.vms \
+        config/jaix.h config/jalpha.h config/jconvex.h config/jdec.h \
+        config/jfbsd.h config/jhpux.h config/jirix32.h config/jirix4.h \
+        config/jirix5.h config/jirix6.h config/jlinux.h config/jsolaris.h \
+        config/jsun.h config/junicos.h config/jwin32.h \
+        config/mh-aix config/mh-alpha config/mh-convex config/mh-decstation \
+        config/mh-fbsd config/mh-hpux config/mh-irix32 config/mh-irix4 \
+        config/mh-irix5 config/mh-irix6 config/mh-linux config/mh-solaris \
+        config/mh-sun config/mh-unicos config/win32jpg.mak 
+
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \
+        jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \
+        jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \
+        jfdctint.o
+# decompression library object files
+DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \
+        jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \
+        jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \
+        jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o
+# These objectfiles are included in libjpeg.a
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \
+        cdjpeg.o
+DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \
+        cdjpeg.o
+TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o
+
+#### makefile fragment from 'config/' goes here - inclues ansi2knr section
+## ------------------------ end of makefile fragments--------------------
+
+cjpeg: $(COBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.a $(LDLIBS)
+
+djpeg: $(DOBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.a $(LDLIBS)
+
+jpegtran: $(TROBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.a $(LDLIBS)
+
+rdjpgcom: rdjpgcom.o
+	$(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.o $(LDLIBS)
+
+wrjpgcom: wrjpgcom.o
+	$(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS)
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	false
+
+install: cjpeg djpeg rdjpgcom wrjpgcom
+	$(INSTALL_PROGRAM) cjpeg $(bindir)/$(binprefix)cjpeg
+	$(INSTALL_PROGRAM) djpeg $(bindir)/$(binprefix)djpeg
+	$(INSTALL_PROGRAM) jpegtran $(bindir)/$(binprefix)jpegtran
+	$(INSTALL_PROGRAM) rdjpgcom $(bindir)/$(binprefix)rdjpgcom
+	$(INSTALL_PROGRAM) wrjpgcom $(bindir)/$(binprefix)wrjpgcom
+	$(INSTALL_DATA) $(srcdir)/cjpeg.1 $(mandir)/$(manprefix)cjpeg.$(manext)
+	$(INSTALL_DATA) $(srcdir)/djpeg.1 $(mandir)/$(manprefix)djpeg.$(manext)
+	$(INSTALL_DATA) $(srcdir)/jpegtran.1 $(mandir)/$(manprefix)jpegtran.$(manext)
+	$(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(mandir)/$(manprefix)rdjpgcom.$(manext)
+	$(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(mandir)/$(manprefix)wrjpgcom.$(manext)
+
+install-lib: libjpeg.a install-headers
+	$(INSTALL_DATA) libjpeg.a $(libdir)/$(binprefix)libjpeg.a
+	$(RANLIB) $(libdir)/$(binprefix)libjpeg.a
+
+install-includes:: install-headers
+
+install-headers: jconfig.h
+	$(INSTALL_DATA) jconfig.h $(includedir)/jconfig.h
+	$(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
+	$(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
+	$(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h
+
+clean:
+	-$(RM) $(RMFLAGS) *.o cjpeg djpeg jpegtran libjpeg.a rdjpgcom wrjpgcom
+	-$(RM) $(RMFLAGS) ansi2knr core testout.* config.log 
+
+distclean:
+	-$(RM) $(RMFLAGS) *.o cjpeg djpeg jpegtran libjpeg.a rdjpgcom wrjpgcom
+	-$(RM) $(RMFLAGS) ansi2knr core testout.* config.log config.status jconfig.h Makefile
+
+distribute:
+	$(RM) $(RMFLAGS) jpegsrc.tar*
+	tar cvf jpegsrc.tar $(DISTFILES)
+	compress -v jpegsrc.tar
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = hdf/jpeg
+dist: $(DISTFILES)
+	for subdir in $(OTHERDIRS); do \
+	  mkdir $(distdir)/$$subdir || exit 1; \
+	done
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+test: cjpeg djpeg jpegtran
+	$(RM) $(RMFLAGS) testout*
+	./djpeg -dct int -ppm -outfile testout.ppm  $(srcdir)/testorig.jpg
+	./djpeg -dct int -gif -outfile testout.gif  $(srcdir)/testorig.jpg
+	./cjpeg -dct int -outfile testout.jpg  $(srcdir)/testimg.ppm
+	./djpeg -dct int -ppm -outfile testoutp.ppm $(srcdir)/testprog.jpg
+	./cjpeg -dct int -progressive -opt -outfile testoutp.jpg $(srcdir)/testimg.ppm
+	./jpegtran -outfile testoutt.jpg $(srcdir)/testprog.jpg
+	cmp $(srcdir)/testimg.ppm testout.ppm
+	cmp $(srcdir)/testimg.gif testout.gif
+	cmp $(srcdir)/testimg.jpg testout.jpg
+	cmp $(srcdir)/testimg.ppm testoutp.ppm
+	cmp $(srcdir)/testimgp.jpg testoutp.jpg
+	cmp $(srcdir)/testorig.jpg testoutt.jpg
+
+check: test
+
+# GNU Make likes to know which target names are not really files to be made:
+.PHONY: all install install-lib install-headers clean distribute test check
+
+
+jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h
+rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/README
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,385 @@
+The Independent JPEG Group's JPEG software
+==========================================
+
+README for release 6b of 27-Mar-1998
+====================================
+
+This distribution contains the sixth public release of the Independent JPEG
+Group's free JPEG software.  You are welcome to redistribute this software and
+to use it for any purpose, subject to the conditions under LEGAL ISSUES, below.
+
+Serious users of this software (particularly those incorporating it into
+larger programs) should contact IJG at jpeg-info at uunet.uu.net to be added to
+our electronic mailing list.  Mailing list members are notified of updates
+and have a chance to participate in technical discussions, etc.
+
+This software is the work of Tom Lane, Philip Gladstone, Jim Boucher,
+Lee Crocker, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi,
+Guido Vollbeding, Ge' Weijers, and other members of the Independent JPEG
+Group.
+
+IJG is not affiliated with the official ISO JPEG standards committee.
+
+
+DOCUMENTATION ROADMAP
+=====================
+
+This file contains the following sections:
+
+OVERVIEW            General description of JPEG and the IJG software.
+LEGAL ISSUES        Copyright, lack of warranty, terms of distribution.
+REFERENCES          Where to learn more about JPEG.
+ARCHIVE LOCATIONS   Where to find newer versions of this software.
+RELATED SOFTWARE    Other stuff you should get.
+FILE FORMAT WARS    Software *not* to get.
+TO DO               Plans for future IJG releases.
+
+Other documentation files in the distribution are:
+
+User documentation:
+  install.doc       How to configure and install the IJG software.
+  usage.doc         Usage instructions for cjpeg, djpeg, jpegtran,
+                    rdjpgcom, and wrjpgcom.
+  *.1               Unix-style man pages for programs (same info as usage.doc).
+  wizard.doc        Advanced usage instructions for JPEG wizards only.
+  change.log        Version-to-version change highlights.
+Programmer and internal documentation:
+  libjpeg.doc       How to use the JPEG library in your own programs.
+  example.c         Sample code for calling the JPEG library.
+  structure.doc     Overview of the JPEG library's internal structure.
+  filelist.doc      Road map of IJG files.
+  coderules.doc     Coding style rules --- please read if you contribute code.
+
+Please read at least the files install.doc and usage.doc.  Useful information
+can also be found in the JPEG FAQ (Frequently Asked Questions) article.  See
+ARCHIVE LOCATIONS below to find out where to obtain the FAQ article.
+
+If you want to understand how the JPEG code works, we suggest reading one or
+more of the REFERENCES, then looking at the documentation files (in roughly
+the order listed) before diving into the code.
+
+
+OVERVIEW
+========
+
+This package contains C software to implement JPEG image compression and
+decompression.  JPEG (pronounced "jay-peg") is a standardized compression
+method for full-color and gray-scale images.  JPEG is intended for compressing
+"real-world" scenes; line drawings, cartoons and other non-realistic images
+are not its strong suit.  JPEG is lossy, meaning that the output image is not
+exactly identical to the input image.  Hence you must not use JPEG if you
+have to have identical output bits.  However, on typical photographic images,
+very good compression levels can be obtained with no visible change, and
+remarkably high compression levels are possible if you can tolerate a
+low-quality image.  For more details, see the references, or just experiment
+with various compression settings.
+
+This software implements JPEG baseline, extended-sequential, and progressive
+compression processes.  Provision is made for supporting all variants of these
+processes, although some uncommon parameter settings aren't implemented yet.
+For legal reasons, we are not distributing code for the arithmetic-coding
+variants of JPEG; see LEGAL ISSUES.  We have made no provision for supporting
+the hierarchical or lossless processes defined in the standard.
+
+We provide a set of library routines for reading and writing JPEG image files,
+plus two sample applications "cjpeg" and "djpeg", which use the library to
+perform conversion between JPEG and some other popular image file formats.
+The library is intended to be reused in other applications.
+
+In order to support file conversion and viewing software, we have included
+considerable functionality beyond the bare JPEG coding/decoding capability;
+for example, the color quantization modules are not strictly part of JPEG
+decoding, but they are essential for output to colormapped file formats or
+colormapped displays.  These extra functions can be compiled out of the
+library if not required for a particular application.  We have also included
+"jpegtran", a utility for lossless transcoding between different JPEG
+processes, and "rdjpgcom" and "wrjpgcom", two simple applications for
+inserting and extracting textual comments in JFIF files.
+
+The emphasis in designing this software has been on achieving portability and
+flexibility, while also making it fast enough to be useful.  In particular,
+the software is not intended to be read as a tutorial on JPEG.  (See the
+REFERENCES section for introductory material.)  Rather, it is intended to
+be reliable, portable, industrial-strength code.  We do not claim to have
+achieved that goal in every aspect of the software, but we strive for it.
+
+We welcome the use of this software as a component of commercial products.
+No royalty is required, but we do ask for an acknowledgement in product
+documentation, as described under LEGAL ISSUES.
+
+
+LEGAL ISSUES
+============
+
+In plain English:
+
+1. We don't promise that this software works.  (But if you find any bugs,
+   please let us know!)
+2. You can use this software for whatever you want.  You don't have to pay us.
+3. You may not pretend that you wrote this software.  If you use it in a
+   program, you must acknowledge somewhere in your documentation that
+   you've used the IJG code.
+
+In legalese:
+
+The authors make NO WARRANTY or representation, either express or implied,
+with respect to this software, its quality, accuracy, merchantability, or
+fitness for a particular purpose.  This software is provided "AS IS", and you,
+its user, assume the entire risk as to its quality and accuracy.
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library.  If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it.  This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
+
+
+ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
+sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
+ansi2knr.c is NOT covered by the above copyright and conditions, but instead
+by the usual distribution terms of the Free Software Foundation; principally,
+that you must include source code if you redistribute it.  (See the file
+ansi2knr.c for full details.)  However, since ansi2knr.c is not needed as part
+of any program generated from the IJG code, this does not limit you more than
+the foregoing paragraphs do.
+
+The Unix configuration script "configure" was produced with GNU Autoconf.
+It is copyright by the Free Software Foundation but is freely distributable.
+The same holds for its supporting scripts (config.guess, config.sub,
+ltconfig, ltmain.sh).  Another support script, install-sh, is copyright
+by M.I.T. but is also freely distributable.
+
+It appears that the arithmetic coding option of the JPEG spec is covered by
+patents owned by IBM, AT&T, and Mitsubishi.  Hence arithmetic coding cannot
+legally be used without obtaining one or more licenses.  For this reason,
+support for arithmetic coding has been removed from the free JPEG software.
+(Since arithmetic coding provides only a marginal gain over the unpatented
+Huffman mode, it is unlikely that very many implementations will support it.)
+So far as we are aware, there are no patent restrictions on the remaining
+code.
+
+The IJG distribution formerly included code to read and write GIF files.
+To avoid entanglement with the Unisys LZW patent, GIF reading support has
+been removed altogether, and the GIF writer has been simplified to produce
+"uncompressed GIFs".  This technique does not use the LZW algorithm; the
+resulting GIF files are larger than usual, but are readable by all standard
+GIF decoders.
+
+We are required to state that
+    "The Graphics Interchange Format(c) is the Copyright property of
+    CompuServe Incorporated.  GIF(sm) is a Service Mark property of
+    CompuServe Incorporated."
+
+
+REFERENCES
+==========
+
+We highly recommend reading one or more of these references before trying to
+understand the innards of the JPEG software.
+
+The best short technical introduction to the JPEG compression algorithm is
+	Wallace, Gregory K.  "The JPEG Still Picture Compression Standard",
+	Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
+(Adjacent articles in that issue discuss MPEG motion picture compression,
+applications of JPEG, and related topics.)  If you don't have the CACM issue
+handy, a PostScript file containing a revised version of Wallace's article is
+available at ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz.  The file (actually
+a preprint for an article that appeared in IEEE Trans. Consumer Electronics)
+omits the sample images that appeared in CACM, but it includes corrections
+and some added material.  Note: the Wallace article is copyright ACM and IEEE,
+and it may not be used for commercial purposes.
+
+A somewhat less technical, more leisurely introduction to JPEG can be found in
+"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by
+M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1.  This book provides
+good explanations and example C code for a multitude of compression methods
+including JPEG.  It is an excellent source if you are comfortable reading C
+code but don't know much about data compression in general.  The book's JPEG
+sample code is far from industrial-strength, but when you are ready to look
+at a full implementation, you've got one here...
+
+The best full description of JPEG is the textbook "JPEG Still Image Data
+Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published
+by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1.  Price US$59.95, 638 pp.
+The book includes the complete text of the ISO JPEG standards (DIS 10918-1
+and draft DIS 10918-2).  This is by far the most complete exposition of JPEG
+in existence, and we highly recommend it.
+
+The JPEG standard itself is not available electronically; you must order a
+paper copy through ISO or ITU.  (Unless you feel a need to own a certified
+official copy, we recommend buying the Pennebaker and Mitchell book instead;
+it's much cheaper and includes a great deal of useful explanatory material.)
+In the USA, copies of the standard may be ordered from ANSI Sales at (212)
+642-4900, or from Global Engineering Documents at (800) 854-7179.  (ANSI
+doesn't take credit card orders, but Global does.)  It's not cheap: as of
+1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7%
+shipping/handling.  The standard is divided into two parts, Part 1 being the
+actual specification, while Part 2 covers compliance testing methods.  Part 1
+is titled "Digital Compression and Coding of Continuous-tone Still Images,
+Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS
+10918-1, ITU-T T.81.  Part 2 is titled "Digital Compression and Coding of
+Continuous-tone Still Images, Part 2: Compliance testing" and has document
+numbers ISO/IEC IS 10918-2, ITU-T T.83.
+
+Some extensions to the original JPEG standard are defined in JPEG Part 3,
+a newer ISO standard numbered ISO/IEC IS 10918-3 and ITU-T T.84.  IJG
+currently does not support any Part 3 extensions.
+
+The JPEG standard does not specify all details of an interchangeable file
+format.  For the omitted details we follow the "JFIF" conventions, revision
+1.02.  A copy of the JFIF spec is available from:
+	Literature Department
+	C-Cube Microsystems, Inc.
+	1778 McCarthy Blvd.
+	Milpitas, CA 95035
+	phone (408) 944-6300,  fax (408) 944-6314
+A PostScript version of this document is available by FTP at
+ftp://ftp.uu.net/graphics/jpeg/jfif.ps.gz.  There is also a plain text
+version at ftp://ftp.uu.net/graphics/jpeg/jfif.txt.gz, but it is missing
+the figures.
+
+The TIFF 6.0 file format specification can be obtained by FTP from
+ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz.  The JPEG incorporation scheme
+found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems.
+IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6).
+Instead, we recommend the JPEG design proposed by TIFF Technical Note #2
+(Compression tag 7).  Copies of this Note can be obtained from ftp.sgi.com or
+from ftp://ftp.uu.net/graphics/jpeg/.  It is expected that the next revision
+of the TIFF spec will replace the 6.0 JPEG design with the Note's design.
+Although IJG's own code does not support TIFF/JPEG, the free libtiff library
+uses our library to implement TIFF/JPEG per the Note.  libtiff is available
+from ftp://ftp.sgi.com/graphics/tiff/.
+
+
+ARCHIVE LOCATIONS
+=================
+
+The "official" archive site for this software is ftp.uu.net (Internet
+address 192.48.96.9).  The most recent released version can always be found
+there in directory graphics/jpeg.  This particular version will be archived
+as ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz.  If you don't have
+direct Internet access, UUNET's archives are also available via UUCP; contact
+help at uunet.uu.net for information on retrieving files that way.
+
+Numerous Internet sites maintain copies of the UUNET files.  However, only
+ftp.uu.net is guaranteed to have the latest official version.
+
+You can also obtain this software in DOS-compatible "zip" archive format from
+the SimTel archives (ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/), or
+on CompuServe in the Graphics Support forum (GO CIS:GRAPHSUP), library 12
+"JPEG Tools".  Again, these versions may sometimes lag behind the ftp.uu.net
+release.
+
+The JPEG FAQ (Frequently Asked Questions) article is a useful source of
+general information about JPEG.  It is updated constantly and therefore is
+not included in this distribution.  The FAQ is posted every two weeks to
+Usenet newsgroups comp.graphics.misc, news.answers, and other groups.
+It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/
+and other news.answers archive sites, including the official news.answers
+archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/.
+If you don't have Web or FTP access, send e-mail to mail-server at rtfm.mit.edu
+with body
+	send usenet/news.answers/jpeg-faq/part1
+	send usenet/news.answers/jpeg-faq/part2
+
+
+RELATED SOFTWARE
+================
+
+Numerous viewing and image manipulation programs now support JPEG.  (Quite a
+few of them use this library to do so.)  The JPEG FAQ described above lists
+some of the more popular free and shareware viewers, and tells where to
+obtain them on Internet.
+
+If you are on a Unix machine, we highly recommend Jef Poskanzer's free
+PBMPLUS software, which provides many useful operations on PPM-format image
+files.  In particular, it can convert PPM images to and from a wide range of
+other formats, thus making cjpeg/djpeg considerably more useful.  The latest
+version is distributed by the NetPBM group, and is available from numerous
+sites, notably ftp://wuarchive.wustl.edu/graphics/graphics/packages/NetPBM/.
+Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software is;
+you are likely to have difficulty making it work on any non-Unix machine.
+
+A different free JPEG implementation, written by the PVRG group at Stanford,
+is available from ftp://havefun.stanford.edu/pub/jpeg/.  This program
+is designed for research and experimentation rather than production use;
+it is slower, harder to use, and less portable than the IJG code, but it
+is easier to read and modify.  Also, the PVRG code supports lossless JPEG,
+which we do not.  (On the other hand, it doesn't do progressive JPEG.)
+
+
+FILE FORMAT WARS
+================
+
+Some JPEG programs produce files that are not compatible with our library.
+The root of the problem is that the ISO JPEG committee failed to specify a
+concrete file format.  Some vendors "filled in the blanks" on their own,
+creating proprietary formats that no one else could read.  (For example, none
+of the early commercial JPEG implementations for the Macintosh were able to
+exchange compressed files.)
+
+The file format we have adopted is called JFIF (see REFERENCES).  This format
+has been agreed to by a number of major commercial JPEG vendors, and it has
+become the de facto standard.  JFIF is a minimal or "low end" representation.
+We recommend the use of TIFF/JPEG (TIFF revision 6.0 as modified by TIFF
+Technical Note #2) for "high end" applications that need to record a lot of
+additional data about an image.  TIFF/JPEG is fairly new and not yet widely
+supported, unfortunately.
+
+The upcoming JPEG Part 3 standard defines a file format called SPIFF.
+SPIFF is interoperable with JFIF, in the sense that most JFIF decoders should
+be able to read the most common variant of SPIFF.  SPIFF has some technical
+advantages over JFIF, but its major claim to fame is simply that it is an
+official standard rather than an informal one.  At this point it is unclear
+whether SPIFF will supersede JFIF or whether JFIF will remain the de-facto
+standard.  IJG intends to support SPIFF once the standard is frozen, but we
+have not decided whether it should become our default output format or not.
+(In any case, our decoder will remain capable of reading JFIF indefinitely.)
+
+Various proprietary file formats incorporating JPEG compression also exist.
+We have little or no sympathy for the existence of these formats.  Indeed,
+one of the original reasons for developing this free software was to help
+force convergence on common, open format standards for JPEG files.  Don't
+use a proprietary file format!
+
+
+TO DO
+=====
+
+The major thrust for v7 will probably be improvement of visual quality.
+The current method for scaling the quantization tables is known not to be
+very good at low Q values.  We also intend to investigate block boundary
+smoothing, "poor man's variable quantization", and other means of improving
+quality-vs-file-size performance without sacrificing compatibility.
+
+In future versions, we are considering supporting some of the upcoming JPEG
+Part 3 extensions --- principally, variable quantization and the SPIFF file
+format.
+
+As always, speeding things up is of great interest.
+
+Please send bug reports, offers of help, etc. to jpeg-info at uunet.uu.net.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/ansi2knr.1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/ansi2knr.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/ansi2knr.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,36 @@
+.TH ANSI2KNR 1 "19 Jan 1996"
+.SH NAME
+ansi2knr \- convert ANSI C to Kernighan & Ritchie C
+.SH SYNOPSIS
+.I ansi2knr
+[--varargs] input_file [output_file]
+.SH DESCRIPTION
+If no output_file is supplied, output goes to stdout.
+.br
+There are no error messages.
+.sp
+.I ansi2knr
+recognizes function definitions by seeing a non-keyword identifier at the left
+margin, followed by a left parenthesis, with a right parenthesis as the last
+character on the line, and with a left brace as the first token on the
+following line (ignoring possible intervening comments).  It will recognize a
+multi-line header provided that no intervening line ends with a left or right
+brace or a semicolon.  These algorithms ignore whitespace and comments, except
+that the function name must be the first thing on the line.
+.sp
+The following constructs will confuse it:
+.br
+     - Any other construct that starts at the left margin and follows the
+above syntax (such as a macro or function call).
+.br
+     - Some macros that tinker with the syntax of the function header.
+.sp
+The --varargs switch is obsolete, and is recognized only for
+backwards compatibility.  The present version of
+.I ansi2knr
+will always attempt to convert a ... argument to va_alist and va_dcl.
+.SH AUTHOR
+L. Peter Deutsch <ghost at aladdin.com> wrote the original ansi2knr and
+continues to maintain the current version; most of the code in the current
+version is his work.  ansi2knr also includes contributions by Francois
+Pinard <pinard at iro.umontreal.ca> and Jim Avera <jima at netcom.com>.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/ansi2knr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/ansi2knr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/ansi2knr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,693 @@
+/* ansi2knr.c */
+/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
+
+/*
+ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY.  No author or distributor accepts responsibility to anyone for the
+consequences of using it or for whether it serves any particular purpose or
+works at all, unless he says so in writing.  Refer to the GNU General Public
+License (the "GPL") for full details.
+
+Everyone is granted permission to copy, modify and redistribute ansi2knr,
+but only under the conditions described in the GPL.  A copy of this license
+is supposed to have been given to you along with ansi2knr so you can know
+your rights and responsibilities.  It should be in a file named COPYLEFT.
+[In the IJG distribution, the GPL appears below, not in a separate file.]
+Among other things, the copyright notice and this notice must be preserved
+on all copies.
+
+We explicitly state here what we believe is already implied by the GPL: if
+the ansi2knr program is distributed as a separate set of sources and a
+separate executable file which are aggregated on a storage medium together
+with another program, this in itself does not bring the other program under
+the GPL, nor does the mere fact that such a program or the procedures for
+constructing it invoke the ansi2knr executable bring any other part of the
+program under the GPL.
+*/
+
+/*
+---------- Here is the GNU GPL file COPYLEFT, referred to above ----------
+----- These terms do NOT apply to the JPEG software itself; see README ------
+
+		    GHOSTSCRIPT GENERAL PUBLIC LICENSE
+		    (Clarified 11 Feb 1988)
+
+ Copyright (C) 1988 Richard M. Stallman
+ Everyone is permitted to copy and distribute verbatim copies of this
+ license, but changing it is not allowed.  You can also use this wording
+ to make the terms for other programs.
+
+  The license agreements of most software companies keep you at the
+mercy of those companies.  By contrast, our general public license is
+intended to give everyone the right to share Ghostscript.  To make sure
+that you get the rights we want you to have, we need to make
+restrictions that forbid anyone to deny you these rights or to ask you
+to surrender the rights.  Hence this license agreement.
+
+  Specifically, we want to make sure that you have the right to give
+away copies of Ghostscript, that you receive source code or else can get
+it if you want it, that you can change Ghostscript or use pieces of it
+in new free programs, and that you know you can do these things.
+
+  To make sure that everyone has such rights, we have to forbid you to
+deprive anyone else of these rights.  For example, if you distribute
+copies of Ghostscript, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must tell them their rights.
+
+  Also, for our own protection, we must make certain that everyone finds
+out that there is no warranty for Ghostscript.  If Ghostscript is
+modified by someone else and passed on, we want its recipients to know
+that what they have is not what we distributed, so that any problems
+introduced by others will not reflect on our reputation.
+
+  Therefore we (Richard M. Stallman and the Free Software Foundation,
+Inc.) make the following terms which say what you must do to be allowed
+to distribute or change Ghostscript.
+
+
+			COPYING POLICIES
+
+  1. You may copy and distribute verbatim copies of Ghostscript source
+code as you receive it, in any medium, provided that you conspicuously
+and appropriately publish on each copy a valid copyright and license
+notice "Copyright (C) 1989 Aladdin Enterprises.  All rights reserved.
+Distributed by Free Software Foundation, Inc." (or with whatever year is
+appropriate); keep intact the notices on all files that refer to this
+License Agreement and to the absence of any warranty; and give any other
+recipients of the Ghostscript program a copy of this License Agreement
+along with the program.  You may charge a distribution fee for the
+physical act of transferring a copy.
+
+  2. You may modify your copy or copies of Ghostscript or any portion of
+it, and copy and distribute such modifications under the terms of
+Paragraph 1 above, provided that you also do the following:
+
+    a) cause the modified files to carry prominent notices stating
+    that you changed the files and the date of any change; and
+
+    b) cause the whole of any work that you distribute or publish,
+    that in whole or in part contains or is a derivative of Ghostscript
+    or any part thereof, to be licensed at no charge to all third
+    parties on terms identical to those contained in this License
+    Agreement (except that you may choose to grant more extensive
+    warranty protection to some or all third parties, at your option).
+
+    c) You may charge a distribution fee for the physical act of
+    transferring a copy, and you may at your option offer warranty
+    protection in exchange for a fee.
+
+Mere aggregation of another unrelated program with this program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other program under the scope of these terms.
+
+  3. You may copy and distribute Ghostscript (or a portion or derivative
+of it, under Paragraph 2) in object code or executable form under the
+terms of Paragraphs 1 and 2 above provided that you also do one of the
+following:
+
+    a) accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of
+    Paragraphs 1 and 2 above; or,
+
+    b) accompany it with a written offer, valid for at least three
+    years, to give any third party free (except for a nominal
+    shipping charge) a complete machine-readable copy of the
+    corresponding source code, to be distributed under the terms of
+    Paragraphs 1 and 2 above; or,
+
+    c) accompany it with the information you received as to where the
+    corresponding source code may be obtained.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form alone.)
+
+For an executable file, complete source code means all the source code for
+all modules it contains; but, as a special exception, it need not include
+source code for modules which are standard libraries that accompany the
+operating system on which the executable file runs.
+
+  4. You may not copy, sublicense, distribute or transfer Ghostscript
+except as expressly provided under this License Agreement.  Any attempt
+otherwise to copy, sublicense, distribute or transfer Ghostscript is
+void and your rights to use the program under this License agreement
+shall be automatically terminated.  However, parties who have received
+computer software programs from you with this License Agreement will not
+have their licenses terminated so long as such parties remain in full
+compliance.
+
+  5. If you wish to incorporate parts of Ghostscript into other free
+programs whose distribution conditions are different, write to the Free
+Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not
+yet worked out a simple rule that can be stated here, but we will often
+permit this.  We will be guided by the two goals of preserving the free
+status of all derivatives of our free software and of promoting the
+sharing and reuse of software.
+
+Your comments and suggestions about our licensing policies and our
+software are welcome!  Please contact the Free Software Foundation,
+Inc., 675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296.
+
+		       NO WARRANTY
+
+  BECAUSE GHOSTSCRIPT IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
+NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
+WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD
+M. STALLMAN, ALADDIN ENTERPRISES, L. PETER DEUTSCH, AND/OR OTHER PARTIES
+PROVIDE GHOSTSCRIPT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF GHOSTSCRIPT IS WITH
+YOU.  SHOULD GHOSTSCRIPT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
+STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., L. PETER DEUTSCH, ALADDIN
+ENTERPRISES, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE
+GHOSTSCRIPT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING
+ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE
+PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) GHOSTSCRIPT, EVEN IF YOU
+HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM
+BY ANY OTHER PARTY.
+
+-------------------- End of file COPYLEFT ------------------------------
+*/
+
+/*
+ * Usage:
+	ansi2knr input_file [output_file]
+ * If no output_file is supplied, output goes to stdout.
+ * There are no error messages.
+ *
+ * ansi2knr recognizes function definitions by seeing a non-keyword
+ * identifier at the left margin, followed by a left parenthesis,
+ * with a right parenthesis as the last character on the line,
+ * and with a left brace as the first token on the following line
+ * (ignoring possible intervening comments).
+ * It will recognize a multi-line header provided that no intervening
+ * line ends with a left or right brace or a semicolon.
+ * These algorithms ignore whitespace and comments, except that
+ * the function name must be the first thing on the line.
+ * The following constructs will confuse it:
+ *	- Any other construct that starts at the left margin and
+ *	    follows the above syntax (such as a macro or function call).
+ *	- Some macros that tinker with the syntax of the function header.
+ */
+
+/*
+ * The original and principal author of ansi2knr is L. Peter Deutsch
+ * <ghost at aladdin.com>.  Other authors are noted in the change history
+ * that follows (in reverse chronological order):
+	lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
+		compilers that don't understand void, as suggested by
+		Tom Lane
+	lpd 96-01-15 changed to require that the first non-comment token
+		on the line following a function header be a left brace,
+		to reduce sensitivity to macros, as suggested by Tom Lane
+		<tgl at sss.pgh.pa.us>
+	lpd 95-06-22 removed #ifndefs whose sole purpose was to define
+		undefined preprocessor symbols as 0; changed all #ifdefs
+		for configuration symbols to #ifs
+	lpd 95-04-05 changed copyright notice to make it clear that
+		including ansi2knr in a program does not bring the entire
+		program under the GPL
+	lpd 94-12-18 added conditionals for systems where ctype macros
+		don't handle 8-bit characters properly, suggested by
+		Francois Pinard <pinard at iro.umontreal.ca>;
+		removed --varargs switch (this is now the default)
+	lpd 94-10-10 removed CONFIG_BROKETS conditional
+	lpd 94-07-16 added some conditionals to help GNU `configure',
+		suggested by Francois Pinard <pinard at iro.umontreal.ca>;
+		properly erase prototype args in function parameters,
+		contributed by Jim Avera <jima at netcom.com>;
+		correct error in writeblanks (it shouldn't erase EOLs)
+	lpd 89-xx-xx original version
+ */
+
+/* Most of the conditionals here are to make ansi2knr work with */
+/* or without the GNU configure machinery. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+
+#if HAVE_CONFIG_H
+
+/*
+   For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
+   This will define HAVE_CONFIG_H and so, activate the following lines.
+ */
+
+# if STDC_HEADERS || HAVE_STRING_H
+#  include <string.h>
+# else
+#  include <strings.h>
+# endif
+
+#else /* not HAVE_CONFIG_H */
+
+/* Otherwise do it the hard way */
+
+# ifdef BSD
+#  include <strings.h>
+# else
+#  ifdef VMS
+    extern int strlen(), strncmp();
+#  else
+#   include <string.h>
+#  endif
+# endif
+
+#endif /* not HAVE_CONFIG_H */
+
+#if STDC_HEADERS
+# include <stdlib.h>
+#else
+/*
+   malloc and free should be declared in stdlib.h,
+   but if you've got a K&R compiler, they probably aren't.
+ */
+# ifdef MSDOS
+#  include <malloc.h>
+# else
+#  ifdef VMS
+     extern char *malloc();
+     extern void free();
+#  else
+     extern char *malloc();
+     extern int free();
+#  endif
+# endif
+
+#endif
+
+/*
+ * The ctype macros don't always handle 8-bit characters correctly.
+ * Compensate for this here.
+ */
+#ifdef isascii
+#  undef HAVE_ISASCII		/* just in case */
+#  define HAVE_ISASCII 1
+#else
+#endif
+#if STDC_HEADERS || !HAVE_ISASCII
+#  define is_ascii(c) 1
+#else
+#  define is_ascii(c) isascii(c)
+#endif
+
+#define is_space(c) (is_ascii(c) && isspace(c))
+#define is_alpha(c) (is_ascii(c) && isalpha(c))
+#define is_alnum(c) (is_ascii(c) && isalnum(c))
+
+/* Scanning macros */
+#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
+#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
+
+/* Forward references */
+char *skipspace();
+int writeblanks();
+int test1();
+int convert1();
+
+/* The main program */
+int
+main(argc, argv)
+    int argc;
+    char *argv[];
+{	FILE *in, *out;
+#define bufsize 5000			/* arbitrary size */
+	char *buf;
+	char *line;
+	char *more;
+	/*
+	 * In previous versions, ansi2knr recognized a --varargs switch.
+	 * If this switch was supplied, ansi2knr would attempt to convert
+	 * a ... argument to va_alist and va_dcl; if this switch was not
+	 * supplied, ansi2knr would simply drop any such arguments.
+	 * Now, ansi2knr always does this conversion, and we only
+	 * check for this switch for backward compatibility.
+	 */
+	int convert_varargs = 1;
+
+	if ( argc > 1 && argv[1][0] == '-' )
+	  {	if ( !strcmp(argv[1], "--varargs") )
+		  {	convert_varargs = 1;
+			argc--;
+			argv++;
+		  }
+		else
+		  {	fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
+			exit(1);
+		  }
+	  }
+	switch ( argc )
+	   {
+	default:
+		printf("Usage: ansi2knr input_file [output_file]\n");
+		exit(0);
+	case 2:
+		out = stdout;
+		break;
+	case 3:
+		out = fopen(argv[2], "w");
+		if ( out == NULL )
+		   {	fprintf(stderr, "Cannot open output file %s\n", argv[2]);
+			exit(1);
+		   }
+	   }
+	in = fopen(argv[1], "r");
+	if ( in == NULL )
+	   {	fprintf(stderr, "Cannot open input file %s\n", argv[1]);
+		exit(1);
+	   }
+	fprintf(out, "#line 1 \"%s\"\n", argv[1]);
+	buf = malloc(bufsize);
+	line = buf;
+	while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
+	   {
+test:		line += strlen(line);
+		switch ( test1(buf) )
+		   {
+		case 2:			/* a function header */
+			convert1(buf, out, 1, convert_varargs);
+			break;
+		case 1:			/* a function */
+			/* Check for a { at the start of the next line. */
+			more = ++line;
+f:			if ( line >= buf + (bufsize - 1) ) /* overflow check */
+			  goto wl;
+			if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
+			  goto wl;
+			switch ( *skipspace(more, 1) )
+			  {
+			  case '{':
+			    /* Definitely a function header. */
+			    convert1(buf, out, 0, convert_varargs);
+			    fputs(more, out);
+			    break;
+			  case 0:
+			    /* The next line was blank or a comment: */
+			    /* keep scanning for a non-comment. */
+			    line += strlen(line);
+			    goto f;
+			  default:
+			    /* buf isn't a function header, but */
+			    /* more might be. */
+			    fputs(buf, out);
+			    strcpy(buf, more);
+			    line = buf;
+			    goto test;
+			  }
+			break;
+		case -1:		/* maybe the start of a function */
+			if ( line != buf + (bufsize - 1) ) /* overflow check */
+			  continue;
+			/* falls through */
+		default:		/* not a function */
+wl:			fputs(buf, out);
+			break;
+		   }
+		line = buf;
+	   }
+	if ( line != buf )
+	  fputs(buf, out);
+	free(buf);
+	fclose(out);
+	fclose(in);
+	return 0;
+}
+
+/* Skip over space and comments, in either direction. */
+char *
+skipspace(p, dir)
+    register char *p;
+    register int dir;			/* 1 for forward, -1 for backward */
+{	for ( ; ; )
+	   {	while ( is_space(*p) )
+		  p += dir;
+		if ( !(*p == '/' && p[dir] == '*') )
+		  break;
+		p += dir;  p += dir;
+		while ( !(*p == '*' && p[dir] == '/') )
+		   {	if ( *p == 0 )
+			  return p;	/* multi-line comment?? */
+			p += dir;
+		   }
+		p += dir;  p += dir;
+	   }
+	return p;
+}
+
+/*
+ * Write blanks over part of a string.
+ * Don't overwrite end-of-line characters.
+ */
+int
+writeblanks(start, end)
+    char *start;
+    char *end;
+{	char *p;
+	for ( p = start; p < end; p++ )
+	  if ( *p != '\r' && *p != '\n' )
+	    *p = ' ';
+	return 0;
+}
+
+/*
+ * Test whether the string in buf is a function definition.
+ * The string may contain and/or end with a newline.
+ * Return as follows:
+ *	0 - definitely not a function definition;
+ *	1 - definitely a function definition;
+ *	2 - definitely a function prototype (NOT USED);
+ *	-1 - may be the beginning of a function definition,
+ *		append another line and look again.
+ * The reason we don't attempt to convert function prototypes is that
+ * Ghostscript's declaration-generating macros look too much like
+ * prototypes, and confuse the algorithms.
+ */
+int
+test1(buf)
+    char *buf;
+{	register char *p = buf;
+	char *bend;
+	char *endfn;
+	int contin;
+
+	if ( !isidfirstchar(*p) )
+	  return 0;		/* no name at left margin */
+	bend = skipspace(buf + strlen(buf) - 1, -1);
+	switch ( *bend )
+	   {
+	   case ';': contin = 0 /*2*/; break;
+	   case ')': contin = 1; break;
+	   case '{': return 0;		/* not a function */
+	   case '}': return 0;		/* not a function */
+	   default: contin = -1;
+	   }
+	while ( isidchar(*p) )
+	  p++;
+	endfn = p;
+	p = skipspace(p, 1);
+	if ( *p++ != '(' )
+	  return 0;		/* not a function */
+	p = skipspace(p, 1);
+	if ( *p == ')' )
+	  return 0;		/* no parameters */
+	/* Check that the apparent function name isn't a keyword. */
+	/* We only need to check for keywords that could be followed */
+	/* by a left parenthesis (which, unfortunately, is most of them). */
+	   {	static char *words[] =
+		   {	"asm", "auto", "case", "char", "const", "double",
+			"extern", "float", "for", "if", "int", "long",
+			"register", "return", "short", "signed", "sizeof",
+			"static", "switch", "typedef", "unsigned",
+			"void", "volatile", "while", 0
+		   };
+		char **key = words;
+		char *kp;
+		int len = endfn - buf;
+
+		while ( (kp = *key) != 0 )
+		   {	if ( strlen(kp) == len && !strncmp(kp, buf, len) )
+			  return 0;	/* name is a keyword */
+			key++;
+		   }
+	   }
+	return contin;
+}
+
+/* Convert a recognized function definition or header to K&R syntax. */
+int
+convert1(buf, out, header, convert_varargs)
+    char *buf;
+    FILE *out;
+    int header;			/* Boolean */
+    int convert_varargs;	/* Boolean */
+{	char *endfn;
+	register char *p;
+	char **breaks;
+	unsigned num_breaks = 2;	/* for testing */
+	char **btop;
+	char **bp;
+	char **ap;
+	char *vararg = 0;
+
+	/* Pre-ANSI implementations don't agree on whether strchr */
+	/* is called strchr or index, so we open-code it here. */
+	for ( endfn = buf; *(endfn++) != '('; )
+	  ;
+top:	p = endfn;
+	breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
+	if ( breaks == 0 )
+	   {	/* Couldn't allocate break table, give up */
+		fprintf(stderr, "Unable to allocate break table!\n");
+		fputs(buf, out);
+		return -1;
+	   }
+	btop = breaks + num_breaks * 2 - 2;
+	bp = breaks;
+	/* Parse the argument list */
+	do
+	   {	int level = 0;
+		char *lp = NULL;
+		char *rp;
+		char *end = NULL;
+
+		if ( bp >= btop )
+		   {	/* Filled up break table. */
+			/* Allocate a bigger one and start over. */
+			free((char *)breaks);
+			num_breaks <<= 1;
+			goto top;
+		   }
+		*bp++ = p;
+		/* Find the end of the argument */
+		for ( ; end == NULL; p++ )
+		   {	switch(*p)
+			   {
+			   case ',':
+				if ( !level ) end = p;
+				break;
+			   case '(':
+				if ( !level ) lp = p;
+				level++;
+				break;
+			   case ')':
+				if ( --level < 0 ) end = p;
+				else rp = p;
+				break;
+			   case '/':
+				p = skipspace(p, 1) - 1;
+				break;
+			   default:
+				;
+			   }
+		   }
+		/* Erase any embedded prototype parameters. */
+		if ( lp )
+		  writeblanks(lp + 1, rp);
+		p--;			/* back up over terminator */
+		/* Find the name being declared. */
+		/* This is complicated because of procedure and */
+		/* array modifiers. */
+		for ( ; ; )
+		   {	p = skipspace(p - 1, -1);
+			switch ( *p )
+			   {
+			   case ']':	/* skip array dimension(s) */
+			   case ')':	/* skip procedure args OR name */
+			   {	int level = 1;
+				while ( level )
+				 switch ( *--p )
+				   {
+				   case ']': case ')': level++; break;
+				   case '[': case '(': level--; break;
+				   case '/': p = skipspace(p, -1) + 1; break;
+				   default: ;
+				   }
+			   }
+				if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
+				   {	/* We found the name being declared */
+					while ( !isidfirstchar(*p) )
+					  p = skipspace(p, 1) + 1;
+					goto found;
+				   }
+				break;
+			   default:
+				goto found;
+			   }
+		   }
+found:		if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
+		  {	if ( convert_varargs )
+			  {	*bp++ = "va_alist";
+				vararg = p-2;
+			  }
+			else
+			  {	p++;
+				if ( bp == breaks + 1 )	/* sole argument */
+				  writeblanks(breaks[0], p);
+				else
+				  writeblanks(bp[-1] - 1, p);
+				bp--;
+			  }
+		   }
+		else
+		   {	while ( isidchar(*p) ) p--;
+			*bp++ = p+1;
+		   }
+		p = end;
+	   }
+	while ( *p++ == ',' );
+	*bp = p;
+	/* Make a special check for 'void' arglist */
+	if ( bp == breaks+2 )
+	   {	p = skipspace(breaks[0], 1);
+		if ( !strncmp(p, "void", 4) )
+		   {	p = skipspace(p+4, 1);
+			if ( p == breaks[2] - 1 )
+			   {	bp = breaks;	/* yup, pretend arglist is empty */
+				writeblanks(breaks[0], p + 1);
+			   }
+		   }
+	   }
+	/* Put out the function name and left parenthesis. */
+	p = buf;
+	while ( p != endfn ) putc(*p, out), p++;
+	/* Put out the declaration. */
+	if ( header )
+	  {	fputs(");", out);
+		for ( p = breaks[0]; *p; p++ )
+		  if ( *p == '\r' || *p == '\n' )
+		    putc(*p, out);
+	  }
+	else
+	  {	for ( ap = breaks+1; ap < bp; ap += 2 )
+		  {	p = *ap;
+			while ( isidchar(*p) )
+			  putc(*p, out), p++;
+			if ( ap < bp - 1 )
+			  fputs(", ", out);
+		  }
+		fputs(")  ", out);
+		/* Put out the argument declarations */
+		for ( ap = breaks+2; ap <= bp; ap += 2 )
+		  (*ap)[-1] = ';';
+		if ( vararg != 0 )
+		  {	*vararg = 0;
+			fputs(breaks[0], out);		/* any prior args */
+			fputs("va_dcl", out);		/* the final arg */
+			fputs(bp[0], out);
+		  }
+		else
+		  fputs(breaks[0], out);
+	  }
+	free((char *)breaks);
+	return 0;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/cderror.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/cderror.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/cderror.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,132 @@
+/*
+ * cderror.h
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file defines the error and message codes for the cjpeg/djpeg
+ * applications.  These strings are not needed as part of the JPEG library
+ * proper.
+ * Edit this file to add new codes, or to translate the message strings to
+ * some other language.
+ */
+
+/*
+ * To define the enum list of message codes, include this file without
+ * defining macro JMESSAGE.  To create a message string table, include it
+ * again with a suitable JMESSAGE definition (see jerror.c for an example).
+ */
+#ifndef JMESSAGE
+#ifndef CDERROR_H
+#define CDERROR_H
+/* First time through, define the enum list */
+#define JMAKE_ENUM_LIST
+#else
+/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
+#define JMESSAGE(code,string)
+#endif /* CDERROR_H */
+#endif /* JMESSAGE */
+
+#ifdef JMAKE_ENUM_LIST
+
+typedef enum {
+
+#define JMESSAGE(code,string)	code ,
+
+#endif /* JMAKE_ENUM_LIST */
+
+JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */
+
+#ifdef BMP_SUPPORTED
+JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
+JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported")
+JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
+JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
+JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
+JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
+JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
+JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
+JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
+JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
+JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
+#endif /* BMP_SUPPORTED */
+
+#ifdef GIF_SUPPORTED
+JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
+JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
+JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
+JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file")
+JMESSAGE(JERR_GIF_NOT, "Not a GIF file")
+JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image")
+JMESSAGE(JTRC_GIF_BADVERSION,
+	 "Warning: unexpected GIF version number '%c%c%c'")
+JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x")
+JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input")
+JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file")
+JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring")
+JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
+JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
+#endif /* GIF_SUPPORTED */
+
+#ifdef PPM_SUPPORTED
+JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
+JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
+JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
+JMESSAGE(JTRC_PGM, "%ux%u PGM image")
+JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
+JMESSAGE(JTRC_PPM, "%ux%u PPM image")
+JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
+#endif /* PPM_SUPPORTED */
+
+#ifdef RLE_SUPPORTED
+JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library")
+JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
+JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE")
+JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file")
+JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header")
+JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header")
+JMESSAGE(JERR_RLE_NOT, "Not an RLE file")
+JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE")
+JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup")
+JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file")
+JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d")
+JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file")
+JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d")
+JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d")
+#endif /* RLE_SUPPORTED */
+
+#ifdef TARGA_SUPPORTED
+JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
+JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
+JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB")
+JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
+JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image")
+JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image")
+#else
+JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
+#endif /* TARGA_SUPPORTED */
+
+JMESSAGE(JERR_BAD_CMAP_FILE,
+	 "Color map file is invalid or of unsupported format")
+JMESSAGE(JERR_TOO_MANY_COLORS,
+	 "Output file format cannot handle %d colormap entries")
+JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
+#ifdef TARGA_SUPPORTED
+JMESSAGE(JERR_UNKNOWN_FORMAT,
+	 "Unrecognized input file format --- perhaps you need -targa")
+#else
+JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
+#endif
+JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
+
+#ifdef JMAKE_ENUM_LIST
+
+  JMSG_LASTADDONCODE
+} ADDON_MESSAGE_CODE;
+
+#undef JMAKE_ENUM_LIST
+#endif /* JMAKE_ENUM_LIST */
+
+/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
+#undef JMESSAGE

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/cdjpeg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/cdjpeg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/cdjpeg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,181 @@
+/*
+ * cdjpeg.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains common support routines used by the IJG application
+ * programs (cjpeg, djpeg, jpegtran).
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+#include <ctype.h>		/* to declare isupper(), tolower() */
+#ifdef NEED_SIGNAL_CATCHER
+#include <signal.h>		/* to declare signal() */
+#endif
+#ifdef USE_SETMODE
+#include <fcntl.h>		/* to declare setmode()'s parameter macros */
+/* If you have setmode() but not <io.h>, just delete this line: */
+#include <io.h>			/* to declare setmode() */
+#endif
+
+
+/*
+ * Signal catcher to ensure that temporary files are removed before aborting.
+ * NB: for Amiga Manx C this is actually a global routine named _abort();
+ * we put "#define signal_catcher _abort" in jconfig.h.  Talk about bogus...
+ */
+
+#ifdef NEED_SIGNAL_CATCHER
+
+static j_common_ptr sig_cinfo;
+
+void				/* must be global for Manx C */
+signal_catcher (int signum)
+{
+  if (sig_cinfo != NULL) {
+    if (sig_cinfo->err != NULL) /* turn off trace output */
+      sig_cinfo->err->trace_level = 0;
+    jpeg_destroy(sig_cinfo);	/* clean up memory allocation & temp files */
+  }
+  exit(EXIT_FAILURE);
+}
+
+
+GLOBAL(void)
+enable_signal_catcher (j_common_ptr cinfo)
+{
+  sig_cinfo = cinfo;
+#ifdef SIGINT			/* not all systems have SIGINT */
+  signal(SIGINT, signal_catcher);
+#endif
+#ifdef SIGTERM			/* not all systems have SIGTERM */
+  signal(SIGTERM, signal_catcher);
+#endif
+}
+
+#endif
+
+
+/*
+ * Optional progress monitor: display a percent-done figure on stderr.
+ */
+
+#ifdef PROGRESS_REPORT
+
+METHODDEF(void)
+progress_monitor (j_common_ptr cinfo)
+{
+  cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress;
+  int total_passes = prog->pub.total_passes + prog->total_extra_passes;
+  int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit);
+
+  if (percent_done != prog->percent_done) {
+    prog->percent_done = percent_done;
+    if (total_passes > 1) {
+      fprintf(stderr, "\rPass %d/%d: %3d%% ",
+	      prog->pub.completed_passes + prog->completed_extra_passes + 1,
+	      total_passes, percent_done);
+    } else {
+      fprintf(stderr, "\r %3d%% ", percent_done);
+    }
+    fflush(stderr);
+  }
+}
+
+
+GLOBAL(void)
+start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress)
+{
+  /* Enable progress display, unless trace output is on */
+  if (cinfo->err->trace_level == 0) {
+    progress->pub.progress_monitor = progress_monitor;
+    progress->completed_extra_passes = 0;
+    progress->total_extra_passes = 0;
+    progress->percent_done = -1;
+    cinfo->progress = &progress->pub;
+  }
+}
+
+
+GLOBAL(void)
+end_progress_monitor (j_common_ptr cinfo)
+{
+  /* Clear away progress display */
+  if (cinfo->err->trace_level == 0) {
+    fprintf(stderr, "\r                \r");
+    fflush(stderr);
+  }
+}
+
+#endif
+
+
+/*
+ * Case-insensitive matching of possibly-abbreviated keyword switches.
+ * keyword is the constant keyword (must be lower case already),
+ * minchars is length of minimum legal abbreviation.
+ */
+
+GLOBAL(boolean)
+keymatch (char * arg, const char * keyword, int minchars)
+{
+  register int ca, ck;
+  register int nmatched = 0;
+
+  while ((ca = *arg++) != '\0') {
+    if ((ck = *keyword++) == '\0')
+      return FALSE;		/* arg longer than keyword, no good */
+    if (isupper(ca))		/* force arg to lcase (assume ck is already) */
+      ca = tolower(ca);
+    if (ca != ck)
+      return FALSE;		/* no good */
+    nmatched++;			/* count matched characters */
+  }
+  /* reached end of argument; fail if it's too short for unique abbrev */
+  if (nmatched < minchars)
+    return FALSE;
+  return TRUE;			/* A-OK */
+}
+
+
+/*
+ * Routines to establish binary I/O mode for stdin and stdout.
+ * Non-Unix systems often require some hacking to get out of text mode.
+ */
+
+GLOBAL(FILE *)
+read_stdin (void)
+{
+  FILE * input_file = stdin;
+
+#ifdef USE_SETMODE		/* need to hack file mode? */
+  setmode(fileno(stdin), O_BINARY);
+#endif
+#ifdef USE_FDOPEN		/* need to re-open in binary mode? */
+  if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
+    fprintf(stderr, "Cannot reopen stdin\n");
+    exit(EXIT_FAILURE);
+  }
+#endif
+  return input_file;
+}
+
+
+GLOBAL(FILE *)
+write_stdout (void)
+{
+  FILE * output_file = stdout;
+
+#ifdef USE_SETMODE		/* need to hack file mode? */
+  setmode(fileno(stdout), O_BINARY);
+#endif
+#ifdef USE_FDOPEN		/* need to re-open in binary mode? */
+  if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) {
+    fprintf(stderr, "Cannot reopen stdout\n");
+    exit(EXIT_FAILURE);
+  }
+#endif
+  return output_file;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/cdjpeg.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/cdjpeg.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/cdjpeg.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,184 @@
+/*
+ * cdjpeg.h
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains common declarations for the sample applications
+ * cjpeg and djpeg.  It is NOT used by the core JPEG library.
+ */
+
+#define JPEG_CJPEG_DJPEG	/* define proper options in jconfig.h */
+#define JPEG_INTERNAL_OPTIONS	/* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jerror.h"		/* get library error codes too */
+#include "cderror.h"		/* get application-specific error codes */
+
+
+/*
+ * Object interface for cjpeg's source file decoding modules
+ */
+
+typedef struct cjpeg_source_struct * cjpeg_source_ptr;
+
+struct cjpeg_source_struct {
+  JMETHOD(void, start_input, (j_compress_ptr cinfo,
+			      cjpeg_source_ptr sinfo));
+  JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
+				       cjpeg_source_ptr sinfo));
+  JMETHOD(void, finish_input, (j_compress_ptr cinfo,
+			       cjpeg_source_ptr sinfo));
+
+  FILE *input_file;
+
+  JSAMPARRAY buffer;
+  JDIMENSION buffer_height;
+};
+
+
+/*
+ * Object interface for djpeg's output file encoding modules
+ */
+
+typedef struct djpeg_dest_struct * djpeg_dest_ptr;
+
+struct djpeg_dest_struct {
+  /* start_output is called after jpeg_start_decompress finishes.
+   * The color map will be ready at this time, if one is needed.
+   */
+  JMETHOD(void, start_output, (j_decompress_ptr cinfo,
+			       djpeg_dest_ptr dinfo));
+  /* Emit the specified number of pixel rows from the buffer. */
+  JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo,
+				 djpeg_dest_ptr dinfo,
+				 JDIMENSION rows_supplied));
+  /* Finish up at the end of the image. */
+  JMETHOD(void, finish_output, (j_decompress_ptr cinfo,
+				djpeg_dest_ptr dinfo));
+
+  /* Target file spec; filled in by djpeg.c after object is created. */
+  FILE * output_file;
+
+  /* Output pixel-row buffer.  Created by module init or start_output.
+   * Width is cinfo->output_width * cinfo->output_components;
+   * height is buffer_height.
+   */
+  JSAMPARRAY buffer;
+  JDIMENSION buffer_height;
+};
+
+
+/*
+ * cjpeg/djpeg may need to perform extra passes to convert to or from
+ * the source/destination file format.  The JPEG library does not know
+ * about these passes, but we'd like them to be counted by the progress
+ * monitor.  We use an expanded progress monitor object to hold the
+ * additional pass count.
+ */
+
+struct cdjpeg_progress_mgr {
+  struct jpeg_progress_mgr pub;	/* fields known to JPEG library */
+  int completed_extra_passes;	/* extra passes completed */
+  int total_extra_passes;	/* total extra */
+  /* last printed percentage stored here to avoid multiple printouts */
+  int percent_done;
+};
+
+typedef struct cdjpeg_progress_mgr * cd_progress_ptr;
+
+
+/* Short forms of external names for systems with brain-damaged linkers. */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jinit_read_bmp		jIRdBMP
+#define jinit_write_bmp		jIWrBMP
+#define jinit_read_gif		jIRdGIF
+#define jinit_write_gif		jIWrGIF
+#define jinit_read_ppm		jIRdPPM
+#define jinit_write_ppm		jIWrPPM
+#define jinit_read_rle		jIRdRLE
+#define jinit_write_rle		jIWrRLE
+#define jinit_read_targa	jIRdTarga
+#define jinit_write_targa	jIWrTarga
+#define read_quant_tables	RdQTables
+#define read_scan_script	RdScnScript
+#define set_quant_slots		SetQSlots
+#define set_sample_factors	SetSFacts
+#define read_color_map		RdCMap
+#define enable_signal_catcher	EnSigCatcher
+#define start_progress_monitor	StProgMon
+#define end_progress_monitor	EnProgMon
+#define read_stdin		RdStdin
+#define write_stdout		WrStdout
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+/* Module selection routines for I/O modules. */
+
+EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo,
+					    boolean is_os2));
+EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo));
+EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo));
+EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo));
+EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo));
+EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo));
+
+/* cjpeg support routines (in rdswitch.c) */
+
+EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename,
+				    int scale_factor, boolean force_baseline));
+EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename));
+EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg));
+EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg));
+
+/* djpeg support routines (in rdcolmap.c) */
+
+EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile));
+
+/* common support routines (in cdjpeg.c) */
+
+EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo));
+EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo,
+					 cd_progress_ptr progress));
+EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo));
+EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars));
+EXTERN(FILE *) read_stdin JPP((void));
+EXTERN(FILE *) write_stdout JPP((void));
+
+/* miscellaneous useful macros */
+
+#ifdef DONT_USE_B_MODE		/* define mode parameters for fopen() */
+#define READ_BINARY	"r"
+#define WRITE_BINARY	"w"
+#else
+#ifdef VMS			/* VMS is very nonstandard */
+#define READ_BINARY	"rb", "ctx=stm"
+#define WRITE_BINARY	"wb", "ctx=stm"
+#else				/* standard ANSI-compliant case */
+#define READ_BINARY	"rb"
+#define WRITE_BINARY	"wb"
+#endif
+#endif
+
+#ifndef EXIT_FAILURE		/* define exit() codes if not provided */
+#define EXIT_FAILURE  1
+#endif
+#ifndef EXIT_SUCCESS
+#ifdef VMS
+#define EXIT_SUCCESS  1		/* VMS is very nonstandard */
+#else
+#define EXIT_SUCCESS  0
+#endif
+#endif
+#ifndef EXIT_WARNING
+#ifdef VMS
+#define EXIT_WARNING  1		/* VMS is very nonstandard */
+#else
+#define EXIT_WARNING  2
+#endif
+#endif

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/change.log
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/change.log	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/change.log	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,217 @@
+CHANGE LOG for Independent JPEG Group's JPEG software
+
+
+Version 6b  27-Mar-1998
+-----------------------
+
+jpegtran has new features for lossless image transformations (rotation
+and flipping) as well as "lossless" reduction to grayscale.
+
+jpegtran now copies comments by default; it has a -copy switch to enable
+copying all APPn blocks as well, or to suppress comments.  (Formerly it
+always suppressed comments and APPn blocks.)  jpegtran now also preserves
+JFIF version and resolution information.
+
+New decompressor library feature: COM and APPn markers found in the input
+file can be saved in memory for later use by the application.  (Before,
+you had to code this up yourself with a custom marker processor.)
+
+There is an unused field "void * client_data" now in compress and decompress
+parameter structs; this may be useful in some applications.
+
+JFIF version number information is now saved by the decoder and accepted by
+the encoder.  jpegtran uses this to copy the source file's version number,
+to ensure "jpegtran -copy all" won't create bogus files that contain JFXX
+extensions but claim to be version 1.01.  Applications that generate their
+own JFXX extension markers also (finally) have a supported way to cause the
+encoder to emit JFIF version number 1.02.
+
+djpeg's trace mode reports JFIF 1.02 thumbnail images as such, rather
+than as unknown APP0 markers.
+
+In -verbose mode, djpeg and rdjpgcom will try to print the contents of
+APP12 markers as text.  Some digital cameras store useful text information
+in APP12 markers.
+
+Handling of truncated data streams is more robust: blocks beyond the one in
+which the error occurs will be output as uniform gray, or left unchanged
+if decoding a progressive JPEG.  The appearance no longer depends on the
+Huffman tables being used.
+
+Huffman tables are checked for validity much more carefully than before.
+
+To avoid the Unisys LZW patent, djpeg's GIF output capability has been
+changed to produce "uncompressed GIFs", and cjpeg's GIF input capability
+has been removed altogether.  We're not happy about it either, but there
+seems to be no good alternative.
+
+The configure script now supports building libjpeg as a shared library
+on many flavors of Unix (all the ones that GNU libtool knows how to
+build shared libraries for).  Use "./configure --enable-shared" to
+try this out.
+
+New jconfig file and makefiles for Microsoft Visual C++ and Developer Studio.
+Also, a jconfig file and a build script for Metrowerks CodeWarrior
+on Apple Macintosh.  makefile.dj has been updated for DJGPP v2, and there
+are miscellaneous other minor improvements in the makefiles.
+
+jmemmac.c now knows how to create temporary files following Mac System 7
+conventions.
+
+djpeg's -map switch is now able to read raw-format PPM files reliably.
+
+cjpeg -progressive -restart no longer generates any unnecessary DRI markers.
+
+Multiple calls to jpeg_simple_progression for a single JPEG object
+no longer leak memory.
+
+
+Version 6a  7-Feb-96
+--------------------
+
+Library initialization sequence modified to detect version mismatches
+and struct field packing mismatches between library and calling application.
+This change requires applications to be recompiled, but does not require
+any application source code change.
+
+All routine declarations changed to the style "GLOBAL(type) name ...",
+that is, GLOBAL, LOCAL, METHODDEF, EXTERN are now macros taking the
+routine's return type as an argument.  This makes it possible to add
+Microsoft-style linkage keywords to all the routines by changing just
+these macros.  Note that any application code that was using these macros
+will have to be changed.
+
+DCT coefficient quantization tables are now stored in normal array order
+rather than zigzag order.  Application code that calls jpeg_add_quant_table,
+or otherwise manipulates quantization tables directly, will need to be
+changed.  If you need to make such code work with either older or newer
+versions of the library, a test like "#if JPEG_LIB_VERSION >= 61" is
+recommended.
+
+djpeg's trace capability now dumps DQT tables in natural order, not zigzag
+order.  This allows the trace output to be made into a "-qtables" file
+more easily.
+
+New system-dependent memory manager module for use on Apple Macintosh.
+
+Fix bug in cjpeg's -smooth option: last one or two scanlines would be
+duplicates of the prior line unless the image height mod 16 was 1 or 2.
+
+Repair minor problems in VMS, BCC, MC6 makefiles.
+
+New configure script based on latest GNU Autoconf.
+
+Correct the list of include files needed by MetroWerks C for ccommand().
+
+Numerous small documentation updates.
+
+
+Version 6  2-Aug-95
+-------------------
+
+Progressive JPEG support: library can read and write full progressive JPEG
+files.  A "buffered image" mode supports incremental decoding for on-the-fly
+display of progressive images.  Simply recompiling an existing IJG-v5-based
+decoder with v6 should allow it to read progressive files, though of course
+without any special progressive display.
+
+New "jpegtran" application performs lossless transcoding between different
+JPEG formats; primarily, it can be used to convert baseline to progressive
+JPEG and vice versa.  In support of jpegtran, the library now allows lossless
+reading and writing of JPEG files as DCT coefficient arrays.  This ability
+may be of use in other applications.
+
+Notes for programmers:
+* We changed jpeg_start_decompress() to be able to suspend; this makes all
+decoding modes available to suspending-input applications.  However,
+existing applications that use suspending input will need to be changed
+to check the return value from jpeg_start_decompress().  You don't need to
+do anything if you don't use a suspending data source.
+* We changed the interface to the virtual array routines: access_virt_array
+routines now take a count of the number of rows to access this time.  The
+last parameter to request_virt_array routines is now interpreted as the
+maximum number of rows that may be accessed at once, but not necessarily
+the height of every access.
+
+
+Version 5b  15-Mar-95
+---------------------
+
+Correct bugs with grayscale images having v_samp_factor > 1.
+
+jpeg_write_raw_data() now supports output suspension.
+
+Correct bugs in "configure" script for case of compiling in
+a directory other than the one containing the source files.
+
+Repair bug in jquant1.c: sometimes didn't use as many colors as it could.
+
+Borland C makefile and jconfig file work under either MS-DOS or OS/2.
+
+Miscellaneous improvements to documentation.
+
+
+Version 5a  7-Dec-94
+--------------------
+
+Changed color conversion roundoff behavior so that grayscale values are
+represented exactly.  (This causes test image files to change.)
+
+Make ordered dither use 16x16 instead of 4x4 pattern for a small quality
+improvement.
+
+New configure script based on latest GNU Autoconf.
+Fix configure script to handle CFLAGS correctly.
+Rename *.auto files to *.cfg, so that configure script still works if
+file names have been truncated for DOS.
+
+Fix bug in rdbmp.c: didn't allow for extra data between header and image.
+
+Modify rdppm.c/wrppm.c to handle 2-byte raw PPM/PGM formats for 12-bit data.
+
+Fix several bugs in rdrle.c.
+
+NEED_SHORT_EXTERNAL_NAMES option was broken.
+
+Revise jerror.h/jerror.c for more flexibility in message table.
+
+Repair oversight in jmemname.c NO_MKTEMP case: file could be there
+but unreadable.
+
+
+Version 5  24-Sep-94
+--------------------
+
+Version 5 represents a nearly complete redesign and rewrite of the IJG
+software.  Major user-visible changes include:
+  * Automatic configuration simplifies installation for most Unix systems.
+  * A range of speed vs. image quality tradeoffs are supported.
+    This includes resizing of an image during decompression: scaling down
+    by a factor of 1/2, 1/4, or 1/8 is handled very efficiently.
+  * New programs rdjpgcom and wrjpgcom allow insertion and extraction
+    of text comments in a JPEG file.
+
+The application programmer's interface to the library has changed completely.
+Notable improvements include:
+  * We have eliminated the use of callback routines for handling the
+    uncompressed image data.  The application now sees the library as a
+    set of routines that it calls to read or write image data on a
+    scanline-by-scanline basis.
+  * The application image data is represented in a conventional interleaved-
+    pixel format, rather than as a separate array for each color channel.
+    This can save a copying step in many programs.
+  * The handling of compressed data has been cleaned up: the application can
+    supply routines to source or sink the compressed data.  It is possible to
+    suspend processing on source/sink buffer overrun, although this is not
+    supported in all operating modes.
+  * All static state has been eliminated from the library, so that multiple
+    instances of compression or decompression can be active concurrently.
+  * JPEG abbreviated datastream formats are supported, ie, quantization and
+    Huffman tables can be stored separately from the image data.
+  * And not only that, but the documentation of the library has improved
+    considerably!
+
+
+The last widely used release before the version 5 rewrite was version 4A of
+18-Feb-93.  Change logs before that point have been discarded, since they
+are not of much interest after the rewrite.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/cjpeg.1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/cjpeg.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/cjpeg.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,292 @@
+.TH CJPEG 1 "20 March 1998"
+.SH NAME
+cjpeg \- compress an image file to a JPEG file
+.SH SYNOPSIS
+.B cjpeg
+[
+.I options
+]
+[
+.I filename
+]
+.LP
+.SH DESCRIPTION
+.LP
+.B cjpeg
+compresses the named image file, or the standard input if no file is
+named, and produces a JPEG/JFIF file on the standard output.
+The currently supported input file formats are: PPM (PBMPLUS color
+format), PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster
+Toolkit format).  (RLE is supported only if the URT library is available.)
+.SH OPTIONS
+All switch names may be abbreviated; for example,
+.B \-grayscale
+may be written
+.B \-gray
+or
+.BR \-gr .
+Most of the "basic" switches can be abbreviated to as little as one letter.
+Upper and lower case are equivalent (thus
+.B \-BMP
+is the same as
+.BR \-bmp ).
+British spellings are also accepted (e.g.,
+.BR \-greyscale ),
+though for brevity these are not mentioned below.
+.PP
+The basic switches are:
+.TP
+.BI \-quality " N"
+Scale quantization tables to adjust image quality.  Quality is 0 (worst) to
+100 (best); default is 75.  (See below for more info.)
+.TP
+.B \-grayscale
+Create monochrome JPEG file from color input.  Be sure to use this switch when
+compressing a grayscale BMP file, because
+.B cjpeg
+isn't bright enough to notice whether a BMP file uses only shades of gray.
+By saying
+.BR \-grayscale ,
+you'll get a smaller JPEG file that takes less time to process.
+.TP
+.B \-optimize
+Perform optimization of entropy encoding parameters.  Without this, default
+encoding parameters are used.
+.B \-optimize
+usually makes the JPEG file a little smaller, but
+.B cjpeg
+runs somewhat slower and needs much more memory.  Image quality and speed of
+decompression are unaffected by
+.BR \-optimize .
+.TP
+.B \-progressive
+Create progressive JPEG file (see below).
+.TP
+.B \-targa
+Input file is Targa format.  Targa files that contain an "identification"
+field will not be automatically recognized by
+.BR cjpeg ;
+for such files you must specify
+.B \-targa
+to make
+.B cjpeg
+treat the input as Targa format.
+For most Targa files, you won't need this switch.
+.PP
+The
+.B \-quality
+switch lets you trade off compressed file size against quality of the
+reconstructed image: the higher the quality setting, the larger the JPEG file,
+and the closer the output image will be to the original input.  Normally you
+want to use the lowest quality setting (smallest file) that decompresses into
+something visually indistinguishable from the original image.  For this
+purpose the quality setting should be between 50 and 95; the default of 75 is
+often about right.  If you see defects at
+.B \-quality
+75, then go up 5 or 10 counts at a time until you are happy with the output
+image.  (The optimal setting will vary from one image to another.)
+.PP
+.B \-quality
+100 will generate a quantization table of all 1's, minimizing loss in the
+quantization step (but there is still information loss in subsampling, as well
+as roundoff error).  This setting is mainly of interest for experimental
+purposes.  Quality values above about 95 are
+.B not
+recommended for normal use; the compressed file size goes up dramatically for
+hardly any gain in output image quality.
+.PP
+In the other direction, quality values below 50 will produce very small files
+of low image quality.  Settings around 5 to 10 might be useful in preparing an
+index of a large image library, for example.  Try
+.B \-quality
+2 (or so) for some amusing Cubist effects.  (Note: quality
+values below about 25 generate 2-byte quantization tables, which are
+considered optional in the JPEG standard.
+.B cjpeg
+emits a warning message when you give such a quality value, because some
+other JPEG programs may be unable to decode the resulting file.  Use
+.B \-baseline
+if you need to ensure compatibility at low quality values.)
+.PP
+The
+.B \-progressive
+switch creates a "progressive JPEG" file.  In this type of JPEG file, the data
+is stored in multiple scans of increasing quality.  If the file is being
+transmitted over a slow communications link, the decoder can use the first
+scan to display a low-quality image very quickly, and can then improve the
+display with each subsequent scan.  The final image is exactly equivalent to a
+standard JPEG file of the same quality setting, and the total file size is
+about the same --- often a little smaller.
+.B Caution:
+progressive JPEG is not yet widely implemented, so many decoders will be
+unable to view a progressive JPEG file at all.
+.PP
+Switches for advanced users:
+.TP
+.B \-dct int
+Use integer DCT method (default).
+.TP
+.B \-dct fast
+Use fast integer DCT (less accurate).
+.TP
+.B \-dct float
+Use floating-point DCT method.
+The float method is very slightly more accurate than the int method, but is
+much slower unless your machine has very fast floating-point hardware.  Also
+note that results of the floating-point method may vary slightly across
+machines, while the integer methods should give the same results everywhere.
+The fast integer method is much less accurate than the other two.
+.TP
+.BI \-restart " N"
+Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
+attached to the number.
+.B \-restart 0
+(the default) means no restart markers.
+.TP
+.BI \-smooth " N"
+Smooth the input image to eliminate dithering noise.  N, ranging from 1 to
+100, indicates the strength of smoothing.  0 (the default) means no smoothing.
+.TP
+.BI \-maxmemory " N"
+Set limit for amount of memory to use in processing large images.  Value is
+in thousands of bytes, or millions of bytes if "M" is attached to the
+number.  For example,
+.B \-max 4m
+selects 4000000 bytes.  If more space is needed, temporary files will be used.
+.TP
+.BI \-outfile " name"
+Send output image to the named file, not to standard output.
+.TP
+.B \-verbose
+Enable debug printout.  More
+.BR \-v 's
+give more output.  Also, version information is printed at startup.
+.TP
+.B \-debug
+Same as
+.BR \-verbose .
+.PP
+The
+.B \-restart
+option inserts extra markers that allow a JPEG decoder to resynchronize after
+a transmission error.  Without restart markers, any damage to a compressed
+file will usually ruin the image from the point of the error to the end of the
+image; with restart markers, the damage is usually confined to the portion of
+the image up to the next restart marker.  Of course, the restart markers
+occupy extra space.  We recommend
+.B \-restart 1
+for images that will be transmitted across unreliable networks such as Usenet.
+.PP
+The
+.B \-smooth
+option filters the input to eliminate fine-scale noise.  This is often useful
+when converting dithered images to JPEG: a moderate smoothing factor of 10 to
+50 gets rid of dithering patterns in the input file, resulting in a smaller
+JPEG file and a better-looking image.  Too large a smoothing factor will
+visibly blur the image, however.
+.PP
+Switches for wizards:
+.TP
+.B \-baseline
+Force baseline-compatible quantization tables to be generated.  This clamps
+quantization values to 8 bits even at low quality settings.  (This switch is
+poorly named, since it does not ensure that the output is actually baseline
+JPEG.  For example, you can use
+.B \-baseline
+and
+.B \-progressive
+together.)
+.TP
+.BI \-qtables " file"
+Use the quantization tables given in the specified text file.
+.TP
+.BI \-qslots " N[,...]"
+Select which quantization table to use for each color component.
+.TP
+.BI \-sample " HxV[,...]"
+Set JPEG sampling factors for each color component.
+.TP
+.BI \-scans " file"
+Use the scan script given in the specified text file.
+.PP
+The "wizard" switches are intended for experimentation with JPEG.  If you
+don't know what you are doing, \fBdon't use them\fR.  These switches are
+documented further in the file wizard.doc.
+.SH EXAMPLES
+.LP
+This example compresses the PPM file foo.ppm with a quality factor of
+60 and saves the output as foo.jpg:
+.IP
+.B cjpeg \-quality
+.I 60 foo.ppm
+.B >
+.I foo.jpg
+.SH HINTS
+Color GIF files are not the ideal input for JPEG; JPEG is really intended for
+compressing full-color (24-bit) images.  In particular, don't try to convert
+cartoons, line drawings, and other images that have only a few distinct
+colors.  GIF works great on these, JPEG does not.  If you want to convert a
+GIF to JPEG, you should experiment with
+.BR cjpeg 's
+.B \-quality
+and
+.B \-smooth
+options to get a satisfactory conversion.
+.B \-smooth 10
+or so is often helpful.
+.PP
+Avoid running an image through a series of JPEG compression/decompression
+cycles.  Image quality loss will accumulate; after ten or so cycles the image
+may be noticeably worse than it was after one cycle.  It's best to use a
+lossless format while manipulating an image, then convert to JPEG format when
+you are ready to file the image away.
+.PP
+The
+.B \-optimize
+option to
+.B cjpeg
+is worth using when you are making a "final" version for posting or archiving.
+It's also a win when you are using low quality settings to make very small
+JPEG files; the percentage improvement is often a lot more than it is on
+larger files.  (At present,
+.B \-optimize
+mode is always selected when generating progressive JPEG files.)
+.SH ENVIRONMENT
+.TP
+.B JPEGMEM
+If this environment variable is set, its value is the default memory limit.
+The value is specified as described for the
+.B \-maxmemory
+switch.
+.B JPEGMEM
+overrides the default value specified when the program was compiled, and
+itself is overridden by an explicit
+.BR \-maxmemory .
+.SH SEE ALSO
+.BR djpeg (1),
+.BR jpegtran (1),
+.BR rdjpgcom (1),
+.BR wrjpgcom (1)
+.br
+.BR ppm (5),
+.BR pgm (5)
+.br
+Wallace, Gregory K.  "The JPEG Still Picture Compression Standard",
+Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
+.SH AUTHOR
+Independent JPEG Group
+.SH BUGS
+Arithmetic coding is not supported for legal reasons.
+.PP
+GIF input files are no longer supported, to avoid the Unisys LZW patent.
+Use a Unisys-licensed program if you need to read a GIF file.  (Conversion
+of GIF files to JPEG is usually a bad idea anyway.)
+.PP
+Not all variants of BMP and Targa file formats are supported.
+.PP
+The
+.B \-targa
+switch is not a bug, it's a feature.  (It would be a bug if the Targa format
+designers had not been clueless.)
+.PP
+Still not as fast as we'd like.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/cjpeg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/cjpeg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/cjpeg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,606 @@
+/*
+ * cjpeg.c
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a command-line user interface for the JPEG compressor.
+ * It should work on any system with Unix- or MS-DOS-style command lines.
+ *
+ * Two different command line styles are permitted, depending on the
+ * compile-time switch TWO_FILE_COMMANDLINE:
+ *	cjpeg [options]  inputfile outputfile
+ *	cjpeg [options]  [inputfile]
+ * In the second style, output is always to standard output, which you'd
+ * normally redirect to a file or pipe to some other program.  Input is
+ * either from a named file or from standard input (typically redirected).
+ * The second style is convenient on Unix but is unhelpful on systems that
+ * don't support pipes.  Also, you MUST use the first style if your system
+ * doesn't do binary I/O to stdin/stdout.
+ * To simplify script writing, the "-outfile" switch is provided.  The syntax
+ *	cjpeg [options]  -outfile outputfile  inputfile
+ * works regardless of which command line style is used.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+#include "jversion.h"		/* for version message */
+
+#ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
+#ifdef __MWERKS__
+#include <SIOUX.h>              /* Metrowerks needs this */
+#include <console.h>		/* ... and this */
+#endif
+#ifdef THINK_C
+#include <console.h>		/* Think declares it here */
+#endif
+#endif
+
+
+/* Create the add-on message string table. */
+
+#define JMESSAGE(code,string)	string ,
+
+static const char * const cdjpeg_message_table[] = {
+#include "cderror.h"
+  NULL
+};
+
+
+/*
+ * This routine determines what format the input file is,
+ * and selects the appropriate input-reading module.
+ *
+ * To determine which family of input formats the file belongs to,
+ * we may look only at the first byte of the file, since C does not
+ * guarantee that more than one character can be pushed back with ungetc.
+ * Looking at additional bytes would require one of these approaches:
+ *     1) assume we can fseek() the input file (fails for piped input);
+ *     2) assume we can push back more than one character (works in
+ *        some C implementations, but unportable);
+ *     3) provide our own buffering (breaks input readers that want to use
+ *        stdio directly, such as the RLE library);
+ * or  4) don't put back the data, and modify the input_init methods to assume
+ *        they start reading after the start of file (also breaks RLE library).
+ * #1 is attractive for MS-DOS but is untenable on Unix.
+ *
+ * The most portable solution for file types that can't be identified by their
+ * first byte is to make the user tell us what they are.  This is also the
+ * only approach for "raw" file types that contain only arbitrary values.
+ * We presently apply this method for Targa files.  Most of the time Targa
+ * files start with 0x00, so we recognize that case.  Potentially, however,
+ * a Targa file could start with any byte value (byte 0 is the length of the
+ * seldom-used ID field), so we provide a switch to force Targa input mode.
+ */
+
+static boolean is_targa;	/* records user -targa switch */
+
+
+LOCAL(cjpeg_source_ptr)
+select_file_type (j_compress_ptr cinfo, FILE * infile)
+{
+  int c;
+
+  if (is_targa) {
+#ifdef TARGA_SUPPORTED
+    return jinit_read_targa(cinfo);
+#else
+    ERREXIT(cinfo, JERR_TGA_NOTCOMP);
+#endif
+  }
+
+  if ((c = getc(infile)) == EOF)
+    ERREXIT(cinfo, JERR_INPUT_EMPTY);
+  if (ungetc(c, infile) == EOF)
+    ERREXIT(cinfo, JERR_UNGETC_FAILED);
+
+  switch (c) {
+#ifdef BMP_SUPPORTED
+  case 'B':
+    return jinit_read_bmp(cinfo);
+#endif
+#ifdef GIF_SUPPORTED
+  case 'G':
+    return jinit_read_gif(cinfo);
+#endif
+#ifdef PPM_SUPPORTED
+  case 'P':
+    return jinit_read_ppm(cinfo);
+#endif
+#ifdef RLE_SUPPORTED
+  case 'R':
+    return jinit_read_rle(cinfo);
+#endif
+#ifdef TARGA_SUPPORTED
+  case 0x00:
+    return jinit_read_targa(cinfo);
+#endif
+  default:
+    ERREXIT(cinfo, JERR_UNKNOWN_FORMAT);
+    break;
+  }
+
+  return NULL;			/* suppress compiler warnings */
+}
+
+
+/*
+ * Argument-parsing code.
+ * The switch parser is designed to be useful with DOS-style command line
+ * syntax, ie, intermixed switches and file names, where only the switches
+ * to the left of a given file name affect processing of that file.
+ * The main program in this file doesn't actually use this capability...
+ */
+
+
+static const char * progname;	/* program name for error messages */
+static char * outfilename;	/* for -outfile switch */
+
+
+LOCAL(void)
+usage (void)
+/* complain about bad command line */
+{
+  fprintf(stderr, "usage: %s [switches] ", progname);
+#ifdef TWO_FILE_COMMANDLINE
+  fprintf(stderr, "inputfile outputfile\n");
+#else
+  fprintf(stderr, "[inputfile]\n");
+#endif
+
+  fprintf(stderr, "Switches (names may be abbreviated):\n");
+  fprintf(stderr, "  -quality N     Compression quality (0..100; 5-95 is useful range)\n");
+  fprintf(stderr, "  -grayscale     Create monochrome JPEG file\n");
+#ifdef ENTROPY_OPT_SUPPORTED
+  fprintf(stderr, "  -optimize      Optimize Huffman table (smaller file, but slow compression)\n");
+#endif
+#ifdef C_PROGRESSIVE_SUPPORTED
+  fprintf(stderr, "  -progressive   Create progressive JPEG file\n");
+#endif
+#ifdef TARGA_SUPPORTED
+  fprintf(stderr, "  -targa         Input file is Targa format (usually not needed)\n");
+#endif
+  fprintf(stderr, "Switches for advanced users:\n");
+#ifdef DCT_ISLOW_SUPPORTED
+  fprintf(stderr, "  -dct int       Use integer DCT method%s\n",
+	  (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
+#endif
+#ifdef DCT_IFAST_SUPPORTED
+  fprintf(stderr, "  -dct fast      Use fast integer DCT (less accurate)%s\n",
+	  (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+  fprintf(stderr, "  -dct float     Use floating-point DCT method%s\n",
+	  (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
+#endif
+  fprintf(stderr, "  -restart N     Set restart interval in rows, or in blocks with B\n");
+#ifdef INPUT_SMOOTHING_SUPPORTED
+  fprintf(stderr, "  -smooth N      Smooth dithered input (N=1..100 is strength)\n");
+#endif
+  fprintf(stderr, "  -maxmemory N   Maximum memory to use (in kbytes)\n");
+  fprintf(stderr, "  -outfile name  Specify name for output file\n");
+  fprintf(stderr, "  -verbose  or  -debug   Emit debug output\n");
+  fprintf(stderr, "Switches for wizards:\n");
+#ifdef C_ARITH_CODING_SUPPORTED
+  fprintf(stderr, "  -arithmetic    Use arithmetic coding\n");
+#endif
+  fprintf(stderr, "  -baseline      Force baseline quantization tables\n");
+  fprintf(stderr, "  -qtables file  Use quantization tables given in file\n");
+  fprintf(stderr, "  -qslots N[,...]    Set component quantization tables\n");
+  fprintf(stderr, "  -sample HxV[,...]  Set component sampling factors\n");
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+  fprintf(stderr, "  -scans file    Create multi-scan JPEG per script file\n");
+#endif
+  exit(EXIT_FAILURE);
+}
+
+
+LOCAL(int)
+parse_switches (j_compress_ptr cinfo, int argc, char **argv,
+		int last_file_arg_seen, boolean for_real)
+/* Parse optional switches.
+ * Returns argv[] index of first file-name argument (== argc if none).
+ * Any file names with indexes <= last_file_arg_seen are ignored;
+ * they have presumably been processed in a previous iteration.
+ * (Pass 0 for last_file_arg_seen on the first or only iteration.)
+ * for_real is FALSE on the first (dummy) pass; we may skip any expensive
+ * processing.
+ */
+{
+  int argn;
+  char * arg;
+  int quality;			/* -quality parameter */
+  int q_scale_factor;		/* scaling percentage for -qtables */
+  boolean force_baseline;
+  boolean simple_progressive;
+  char * qtablefile = NULL;	/* saves -qtables filename if any */
+  char * qslotsarg = NULL;	/* saves -qslots parm if any */
+  char * samplearg = NULL;	/* saves -sample parm if any */
+  char * scansarg = NULL;	/* saves -scans parm if any */
+
+  /* Set up default JPEG parameters. */
+  /* Note that default -quality level need not, and does not,
+   * match the default scaling for an explicit -qtables argument.
+   */
+  quality = 75;			/* default -quality value */
+  q_scale_factor = 100;		/* default to no scaling for -qtables */
+  force_baseline = FALSE;	/* by default, allow 16-bit quantizers */
+  simple_progressive = FALSE;
+  is_targa = FALSE;
+  outfilename = NULL;
+  cinfo->err->trace_level = 0;
+
+  /* Scan command line options, adjust parameters */
+
+  for (argn = 1; argn < argc; argn++) {
+    arg = argv[argn];
+    if (*arg != '-') {
+      /* Not a switch, must be a file name argument */
+      if (argn <= last_file_arg_seen) {
+	outfilename = NULL;	/* -outfile applies to just one input file */
+	continue;		/* ignore this name if previously processed */
+      }
+      break;			/* else done parsing switches */
+    }
+    arg++;			/* advance past switch marker character */
+
+    if (keymatch(arg, "arithmetic", 1)) {
+      /* Use arithmetic coding. */
+#ifdef C_ARITH_CODING_SUPPORTED
+      cinfo->arith_code = TRUE;
+#else
+      fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
+	      progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "baseline", 1)) {
+      /* Force baseline-compatible output (8-bit quantizer values). */
+      force_baseline = TRUE;
+
+    } else if (keymatch(arg, "dct", 2)) {
+      /* Select DCT algorithm. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (keymatch(argv[argn], "int", 1)) {
+	cinfo->dct_method = JDCT_ISLOW;
+      } else if (keymatch(argv[argn], "fast", 2)) {
+	cinfo->dct_method = JDCT_IFAST;
+      } else if (keymatch(argv[argn], "float", 2)) {
+	cinfo->dct_method = JDCT_FLOAT;
+      } else
+	usage();
+
+    } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
+      /* Enable debug printouts. */
+      /* On first -d, print version identification */
+      static boolean printed_version = FALSE;
+
+      if (! printed_version) {
+	fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n",
+		JVERSION, JCOPYRIGHT);
+	printed_version = TRUE;
+      }
+      cinfo->err->trace_level++;
+
+    } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) {
+      /* Force a monochrome JPEG file to be generated. */
+      jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
+
+    } else if (keymatch(arg, "maxmemory", 3)) {
+      /* Maximum memory in Kb (or Mb with 'm'). */
+      long lval;
+      char ch = 'x';
+
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
+	usage();
+      if (ch == 'm' || ch == 'M')
+	lval *= 1000L;
+      cinfo->mem->max_memory_to_use = lval * 1000L;
+
+    } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
+      /* Enable entropy parm optimization. */
+#ifdef ENTROPY_OPT_SUPPORTED
+      cinfo->optimize_coding = TRUE;
+#else
+      fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n",
+	      progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "outfile", 4)) {
+      /* Set output file name. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      outfilename = argv[argn];	/* save it away for later use */
+
+    } else if (keymatch(arg, "progressive", 1)) {
+      /* Select simple progressive mode. */
+#ifdef C_PROGRESSIVE_SUPPORTED
+      simple_progressive = TRUE;
+      /* We must postpone execution until num_components is known. */
+#else
+      fprintf(stderr, "%s: sorry, progressive output was not compiled\n",
+	      progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "quality", 1)) {
+      /* Quality factor (quantization table scaling factor). */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (sscanf(argv[argn], "%d", &quality) != 1)
+	usage();
+      /* Change scale factor in case -qtables is present. */
+      q_scale_factor = jpeg_quality_scaling(quality);
+
+    } else if (keymatch(arg, "qslots", 2)) {
+      /* Quantization table slot numbers. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      qslotsarg = argv[argn];
+      /* Must delay setting qslots until after we have processed any
+       * colorspace-determining switches, since jpeg_set_colorspace sets
+       * default quant table numbers.
+       */
+
+    } else if (keymatch(arg, "qtables", 2)) {
+      /* Quantization tables fetched from file. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      qtablefile = argv[argn];
+      /* We postpone actually reading the file in case -quality comes later. */
+
+    } else if (keymatch(arg, "restart", 1)) {
+      /* Restart interval in MCU rows (or in MCUs with 'b'). */
+      long lval;
+      char ch = 'x';
+
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
+	usage();
+      if (lval < 0 || lval > 65535L)
+	usage();
+      if (ch == 'b' || ch == 'B') {
+	cinfo->restart_interval = (unsigned int) lval;
+	cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
+      } else {
+	cinfo->restart_in_rows = (int) lval;
+	/* restart_interval will be computed during startup */
+      }
+
+    } else if (keymatch(arg, "sample", 2)) {
+      /* Set sampling factors. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      samplearg = argv[argn];
+      /* Must delay setting sample factors until after we have processed any
+       * colorspace-determining switches, since jpeg_set_colorspace sets
+       * default sampling factors.
+       */
+
+    } else if (keymatch(arg, "scans", 2)) {
+      /* Set scan script. */
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      scansarg = argv[argn];
+      /* We must postpone reading the file in case -progressive appears. */
+#else
+      fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n",
+	      progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "smooth", 2)) {
+      /* Set input smoothing factor. */
+      int val;
+
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (sscanf(argv[argn], "%d", &val) != 1)
+	usage();
+      if (val < 0 || val > 100)
+	usage();
+      cinfo->smoothing_factor = val;
+
+    } else if (keymatch(arg, "targa", 1)) {
+      /* Input file is Targa format. */
+      is_targa = TRUE;
+
+    } else {
+      usage();			/* bogus switch */
+    }
+  }
+
+  /* Post-switch-scanning cleanup */
+
+  if (for_real) {
+
+    /* Set quantization tables for selected quality. */
+    /* Some or all may be overridden if -qtables is present. */
+    jpeg_set_quality(cinfo, quality, force_baseline);
+
+    if (qtablefile != NULL)	/* process -qtables if it was present */
+      if (! read_quant_tables(cinfo, qtablefile,
+			      q_scale_factor, force_baseline))
+	usage();
+
+    if (qslotsarg != NULL)	/* process -qslots if it was present */
+      if (! set_quant_slots(cinfo, qslotsarg))
+	usage();
+
+    if (samplearg != NULL)	/* process -sample if it was present */
+      if (! set_sample_factors(cinfo, samplearg))
+	usage();
+
+#ifdef C_PROGRESSIVE_SUPPORTED
+    if (simple_progressive)	/* process -progressive; -scans can override */
+      jpeg_simple_progression(cinfo);
+#endif
+
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+    if (scansarg != NULL)	/* process -scans if it was present */
+      if (! read_scan_script(cinfo, scansarg))
+	usage();
+#endif
+  }
+
+  return argn;			/* return index of next arg (file name) */
+}
+
+
+/*
+ * The main program.
+ */
+
+int
+main (int argc, char **argv)
+{
+  struct jpeg_compress_struct cinfo;
+  struct jpeg_error_mgr jerr;
+#ifdef PROGRESS_REPORT
+  struct cdjpeg_progress_mgr progress;
+#endif
+  int file_index;
+  cjpeg_source_ptr src_mgr;
+  FILE * input_file;
+  FILE * output_file;
+  JDIMENSION num_scanlines;
+
+  /* On Mac, fetch a command line. */
+#ifdef USE_CCOMMAND
+  argc = ccommand(&argv);
+#endif
+
+  progname = argv[0];
+  if (progname == NULL || progname[0] == 0)
+    progname = "cjpeg";		/* in case C library doesn't provide it */
+
+  /* Initialize the JPEG compression object with default error handling. */
+  cinfo.err = jpeg_std_error(&jerr);
+  jpeg_create_compress(&cinfo);
+  /* Add some application-specific error messages (from cderror.h) */
+  jerr.addon_message_table = cdjpeg_message_table;
+  jerr.first_addon_message = JMSG_FIRSTADDONCODE;
+  jerr.last_addon_message = JMSG_LASTADDONCODE;
+
+  /* Now safe to enable signal catcher. */
+#ifdef NEED_SIGNAL_CATCHER
+  enable_signal_catcher((j_common_ptr) &cinfo);
+#endif
+
+  /* Initialize JPEG parameters.
+   * Much of this may be overridden later.
+   * In particular, we don't yet know the input file's color space,
+   * but we need to provide some value for jpeg_set_defaults() to work.
+   */
+
+  cinfo.in_color_space = JCS_RGB; /* arbitrary guess */
+  jpeg_set_defaults(&cinfo);
+
+  /* Scan command line to find file names.
+   * It is convenient to use just one switch-parsing routine, but the switch
+   * values read here are ignored; we will rescan the switches after opening
+   * the input file.
+   */
+
+  file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);
+
+#ifdef TWO_FILE_COMMANDLINE
+  /* Must have either -outfile switch or explicit output file name */
+  if (outfilename == NULL) {
+    if (file_index != argc-2) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+	      progname);
+      usage();
+    }
+    outfilename = argv[file_index+1];
+  } else {
+    if (file_index != argc-1) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+	      progname);
+      usage();
+    }
+  }
+#else
+  /* Unix style: expect zero or one file name */
+  if (file_index < argc-1) {
+    fprintf(stderr, "%s: only one input file\n", progname);
+    usage();
+  }
+#endif /* TWO_FILE_COMMANDLINE */
+
+  /* Open the input file. */
+  if (file_index < argc) {
+    if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default input file is stdin */
+    input_file = read_stdin();
+  }
+
+  /* Open the output file. */
+  if (outfilename != NULL) {
+    if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default output file is stdout */
+    output_file = write_stdout();
+  }
+
+#ifdef PROGRESS_REPORT
+  start_progress_monitor((j_common_ptr) &cinfo, &progress);
+#endif
+
+  /* Figure out the input file format, and set up to read it. */
+  src_mgr = select_file_type(&cinfo, input_file);
+  src_mgr->input_file = input_file;
+
+  /* Read the input file header to obtain file size & colorspace. */
+  (*src_mgr->start_input) (&cinfo, src_mgr);
+
+  /* Now that we know input colorspace, fix colorspace-dependent defaults */
+  jpeg_default_colorspace(&cinfo);
+
+  /* Adjust default compression parameters by re-parsing the options */
+  file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
+
+  /* Specify data destination for compression */
+  jpeg_stdio_dest(&cinfo, output_file);
+
+  /* Start compressor */
+  jpeg_start_compress(&cinfo, TRUE);
+
+  /* Process data */
+  while (cinfo.next_scanline < cinfo.image_height) {
+    num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr);
+    (void) jpeg_write_scanlines(&cinfo, src_mgr->buffer, num_scanlines);
+  }
+
+  /* Finish compression and release memory */
+  (*src_mgr->finish_input) (&cinfo, src_mgr);
+  jpeg_finish_compress(&cinfo);
+  jpeg_destroy_compress(&cinfo);
+
+  /* Close files, if we opened them */
+  if (input_file != stdin)
+    fclose(input_file);
+  if (output_file != stdout)
+    fclose(output_file);
+
+#ifdef PROGRESS_REPORT
+  end_progress_monitor((j_common_ptr) &cinfo);
+#endif
+
+  /* All done. */
+  exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
+  return 0;			/* suppress no-return-value warnings */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/ckconfig.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/ckconfig.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/ckconfig.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,402 @@
+/*
+ * ckconfig.c
+ *
+ * Copyright (C) 1991-1994, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ */
+
+/*
+ * This program is intended to help you determine how to configure the JPEG
+ * software for installation on a particular system.  The idea is to try to
+ * compile and execute this program.  If your compiler fails to compile the
+ * program, make changes as indicated in the comments below.  Once you can
+ * compile the program, run it, and it will produce a "jconfig.h" file for
+ * your system.
+ *
+ * As a general rule, each time you try to compile this program,
+ * pay attention only to the *first* error message you get from the compiler.
+ * Many C compilers will issue lots of spurious error messages once they
+ * have gotten confused.  Go to the line indicated in the first error message,
+ * and read the comments preceding that line to see what to change.
+ *
+ * Almost all of the edits you may need to make to this program consist of
+ * changing a line that reads "#define SOME_SYMBOL" to "#undef SOME_SYMBOL",
+ * or vice versa.  This is called defining or undefining that symbol.
+ */
+
+
+/* First we must see if your system has the include files we need.
+ * We start out with the assumption that your system has all the ANSI-standard
+ * include files.  If you get any error trying to include one of these files,
+ * undefine the corresponding HAVE_xxx symbol.
+ */
+
+#define HAVE_STDDEF_H		/* replace 'define' by 'undef' if error here */
+#ifdef HAVE_STDDEF_H		/* next line will be skipped if you undef... */
+#include <stddef.h>
+#endif
+
+#define HAVE_STDLIB_H		/* same thing for stdlib.h */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <stdio.h>		/* If you ain't got this, you ain't got C. */
+
+/* We have to see if your string functions are defined by
+ * strings.h (old BSD convention) or string.h (everybody else).
+ * We try the non-BSD convention first; define NEED_BSD_STRINGS
+ * if the compiler says it can't find string.h.
+ */
+
+#undef NEED_BSD_STRINGS
+
+#ifdef NEED_BSD_STRINGS
+#include <strings.h>
+#else
+#include <string.h>
+#endif
+
+/* On some systems (especially older Unix machines), type size_t is
+ * defined only in the include file <sys/types.h>.  If you get a failure
+ * on the size_t test below, try defining NEED_SYS_TYPES_H.
+ */
+
+#undef NEED_SYS_TYPES_H		/* start by assuming we don't need it */
+#ifdef NEED_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+
+/* Usually type size_t is defined in one of the include files we've included
+ * above.  If not, you'll get an error on the "typedef size_t my_size_t;" line.
+ * In that case, first try defining NEED_SYS_TYPES_H just above.
+ * If that doesn't work, you'll have to search through your system library
+ * to figure out which include file defines "size_t".  Look for a line that
+ * says "typedef something-or-other size_t;".  Then, change the line below
+ * that says "#include <someincludefile.h>" to instead include the file
+ * you found size_t in, and define NEED_SPECIAL_INCLUDE.  If you can't find
+ * type size_t anywhere, try replacing "#include <someincludefile.h>" with
+ * "typedef unsigned int size_t;".
+ */
+
+#undef NEED_SPECIAL_INCLUDE	/* assume we DON'T need it, for starters */
+
+#ifdef NEED_SPECIAL_INCLUDE
+#include <someincludefile.h>
+#endif
+
+typedef size_t my_size_t;	/* The payoff: do we have size_t now? */
+
+
+/* The next question is whether your compiler supports ANSI-style function
+ * prototypes.  You need to know this in order to choose between using
+ * makefile.ansi and using makefile.unix.
+ * The #define line below is set to assume you have ANSI function prototypes.
+ * If you get an error in this group of lines, undefine HAVE_PROTOTYPES.
+ */
+
+#define HAVE_PROTOTYPES
+
+#ifdef HAVE_PROTOTYPES
+int testfunction (int arg1, int * arg2); /* check prototypes */
+
+struct methods_struct {		/* check method-pointer declarations */
+  int (*error_exit) (char *msgtext);
+  int (*trace_message) (char *msgtext);
+  int (*another_method) (void);
+};
+
+int testfunction (int arg1, int * arg2) /* check definitions */
+{
+  return arg2[arg1];
+}
+
+int test2function (void)	/* check void arg list */
+{
+  return 0;
+}
+#endif
+
+
+/* Now we want to find out if your compiler knows what "unsigned char" means.
+ * If you get an error on the "unsigned char un_char;" line,
+ * then undefine HAVE_UNSIGNED_CHAR.
+ */
+
+#define HAVE_UNSIGNED_CHAR
+
+#ifdef HAVE_UNSIGNED_CHAR
+unsigned char un_char;
+#endif
+
+
+/* Now we want to find out if your compiler knows what "unsigned short" means.
+ * If you get an error on the "unsigned short un_short;" line,
+ * then undefine HAVE_UNSIGNED_SHORT.
+ */
+
+#define HAVE_UNSIGNED_SHORT
+
+#ifdef HAVE_UNSIGNED_SHORT
+unsigned short un_short;
+#endif
+
+
+/* Now we want to find out if your compiler understands type "void".
+ * If you get an error anywhere in here, undefine HAVE_VOID.
+ */
+
+#define HAVE_VOID
+
+#ifdef HAVE_VOID
+/* Caution: a C++ compiler will insist on complete prototypes */
+typedef void * void_ptr;	/* check void * */
+#ifdef HAVE_PROTOTYPES		/* check ptr to function returning void */
+typedef void (*void_func) (int a, int b);
+#else
+typedef void (*void_func) ();
+#endif
+
+#ifdef HAVE_PROTOTYPES		/* check void function result */
+void test3function (void_ptr arg1, void_func arg2)
+#else
+void test3function (arg1, arg2)
+     void_ptr arg1;
+     void_func arg2;
+#endif
+{
+  char * locptr = (char *) arg1; /* check casting to and from void * */
+  arg1 = (void *) locptr;
+  (*arg2) (1, 2);		/* check call of fcn returning void */
+}
+#endif
+
+
+/* Now we want to find out if your compiler knows what "const" means.
+ * If you get an error here, undefine HAVE_CONST.
+ */
+
+#define HAVE_CONST
+
+#ifdef HAVE_CONST
+static const int carray[3] = {1, 2, 3};
+
+#ifdef HAVE_PROTOTYPES
+int test4function (const int arg1)
+#else
+int test4function (arg1)
+     const int arg1;
+#endif
+{
+  return carray[arg1];
+}
+#endif
+
+
+/* If you get an error or warning about this structure definition,
+ * define INCOMPLETE_TYPES_BROKEN.
+ */
+
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifndef INCOMPLETE_TYPES_BROKEN
+typedef struct undefined_structure * undef_struct_ptr;
+#endif
+
+
+/* If you get an error about duplicate names,
+ * define NEED_SHORT_EXTERNAL_NAMES.
+ */
+
+#undef NEED_SHORT_EXTERNAL_NAMES
+
+#ifndef NEED_SHORT_EXTERNAL_NAMES
+
+int possibly_duplicate_function ()
+{
+  return 0;
+}
+
+int possibly_dupli_function ()
+{
+  return 1;
+}
+
+#endif
+
+
+
+/************************************************************************
+ *  OK, that's it.  You should not have to change anything beyond this
+ *  point in order to compile and execute this program.  (You might get
+ *  some warnings, but you can ignore them.)
+ *  When you run the program, it will make a couple more tests that it
+ *  can do automatically, and then it will create jconfig.h and print out
+ *  any additional suggestions it has.
+ ************************************************************************
+ */
+
+
+#ifdef HAVE_PROTOTYPES
+int is_char_signed (int arg)
+#else
+int is_char_signed (arg)
+     int arg;
+#endif
+{
+  if (arg == 189) {		/* expected result for unsigned char */
+    return 0;			/* type char is unsigned */
+  }
+  else if (arg != -67) {	/* expected result for signed char */
+    printf("Hmm, it seems 'char' is not eight bits wide on your machine.\n");
+    printf("I fear the JPEG software will not work at all.\n\n");
+  }
+  return 1;			/* assume char is signed otherwise */
+}
+
+
+#ifdef HAVE_PROTOTYPES
+int is_shifting_signed (long arg)
+#else
+int is_shifting_signed (arg)
+     long arg;
+#endif
+/* See whether right-shift on a long is signed or not. */
+{
+  long res = arg >> 4;
+
+  if (res == -0x7F7E80CL) {	/* expected result for signed shift */
+    return 1;			/* right shift is signed */
+  }
+  /* see if unsigned-shift hack will fix it. */
+  /* we can't just test exact value since it depends on width of long... */
+  res |= (~0L) << (32-4);
+  if (res == -0x7F7E80CL) {	/* expected result now? */
+    return 0;			/* right shift is unsigned */
+  }
+  printf("Right shift isn't acting as I expect it to.\n");
+  printf("I fear the JPEG software will not work at all.\n\n");
+  return 0;			/* try it with unsigned anyway */
+}
+
+
+#ifdef HAVE_PROTOTYPES
+int main (int argc, char ** argv)
+#else
+int main (argc, argv)
+     int argc;
+     char ** argv;
+#endif
+{
+  char signed_char_check = (char) (-67);
+  FILE *outfile;
+
+  /* Attempt to write jconfig.h */
+  if ((outfile = fopen("jconfig.h", "w")) == NULL) {
+    printf("Failed to write jconfig.h\n");
+    return 1;
+  }
+
+  /* Write out all the info */
+  fprintf(outfile, "/* jconfig.h --- generated by ckconfig.c */\n");
+  fprintf(outfile, "/* see jconfig.doc for explanations */\n\n");
+#ifdef HAVE_PROTOTYPES
+  fprintf(outfile, "#define HAVE_PROTOTYPES\n");
+#else
+  fprintf(outfile, "#undef HAVE_PROTOTYPES\n");
+#endif
+#ifdef HAVE_UNSIGNED_CHAR
+  fprintf(outfile, "#define HAVE_UNSIGNED_CHAR\n");
+#else
+  fprintf(outfile, "#undef HAVE_UNSIGNED_CHAR\n");
+#endif
+#ifdef HAVE_UNSIGNED_SHORT
+  fprintf(outfile, "#define HAVE_UNSIGNED_SHORT\n");
+#else
+  fprintf(outfile, "#undef HAVE_UNSIGNED_SHORT\n");
+#endif
+#ifdef HAVE_VOID
+  fprintf(outfile, "/* #define void char */\n");
+#else
+  fprintf(outfile, "#define void char\n");
+#endif
+#ifdef HAVE_CONST
+  fprintf(outfile, "/* #define const */\n");
+#else
+  fprintf(outfile, "#define const\n");
+#endif
+  if (is_char_signed((int) signed_char_check))
+    fprintf(outfile, "#undef CHAR_IS_UNSIGNED\n");
+  else
+    fprintf(outfile, "#define CHAR_IS_UNSIGNED\n");
+#ifdef HAVE_STDDEF_H
+  fprintf(outfile, "#define HAVE_STDDEF_H\n");
+#else
+  fprintf(outfile, "#undef HAVE_STDDEF_H\n");
+#endif
+#ifdef HAVE_STDLIB_H
+  fprintf(outfile, "#define HAVE_STDLIB_H\n");
+#else
+  fprintf(outfile, "#undef HAVE_STDLIB_H\n");
+#endif
+#ifdef NEED_BSD_STRINGS
+  fprintf(outfile, "#define NEED_BSD_STRINGS\n");
+#else
+  fprintf(outfile, "#undef NEED_BSD_STRINGS\n");
+#endif
+#ifdef NEED_SYS_TYPES_H
+  fprintf(outfile, "#define NEED_SYS_TYPES_H\n");
+#else
+  fprintf(outfile, "#undef NEED_SYS_TYPES_H\n");
+#endif
+  fprintf(outfile, "#undef NEED_FAR_POINTERS\n");
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+  fprintf(outfile, "#define NEED_SHORT_EXTERNAL_NAMES\n");
+#else
+  fprintf(outfile, "#undef NEED_SHORT_EXTERNAL_NAMES\n");
+#endif
+#ifdef INCOMPLETE_TYPES_BROKEN
+  fprintf(outfile, "#define INCOMPLETE_TYPES_BROKEN\n");
+#else
+  fprintf(outfile, "#undef INCOMPLETE_TYPES_BROKEN\n");
+#endif
+  fprintf(outfile, "\n#ifdef JPEG_INTERNALS\n\n");
+  if (is_shifting_signed(-0x7F7E80B1L))
+    fprintf(outfile, "#undef RIGHT_SHIFT_IS_UNSIGNED\n");
+  else
+    fprintf(outfile, "#define RIGHT_SHIFT_IS_UNSIGNED\n");
+  fprintf(outfile, "\n#endif /* JPEG_INTERNALS */\n");
+  fprintf(outfile, "\n#ifdef JPEG_CJPEG_DJPEG\n\n");
+  fprintf(outfile, "#define BMP_SUPPORTED		/* BMP image file format */\n");
+  fprintf(outfile, "#define GIF_SUPPORTED		/* GIF image file format */\n");
+  fprintf(outfile, "#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */\n");
+  fprintf(outfile, "#undef RLE_SUPPORTED		/* Utah RLE image file format */\n");
+  fprintf(outfile, "#define TARGA_SUPPORTED		/* Targa image file format */\n\n");
+  fprintf(outfile, "#undef TWO_FILE_COMMANDLINE	/* You may need this on non-Unix systems */\n");
+  fprintf(outfile, "#undef NEED_SIGNAL_CATCHER	/* Define this if you use jmemname.c */\n");
+  fprintf(outfile, "#undef DONT_USE_B_MODE\n");
+  fprintf(outfile, "/* #define PROGRESS_REPORT */	/* optional */\n");
+  fprintf(outfile, "\n#endif /* JPEG_CJPEG_DJPEG */\n");
+
+  /* Close the jconfig.h file */
+  fclose(outfile);
+
+  /* User report */
+  printf("Configuration check for Independent JPEG Group's software done.\n");
+  printf("\nI have written the jconfig.h file for you.\n\n");
+#ifdef HAVE_PROTOTYPES
+  printf("You should use makefile.ansi as the starting point for your Makefile.\n");
+#else
+  printf("You should use makefile.unix as the starting point for your Makefile.\n");
+#endif
+
+#ifdef NEED_SPECIAL_INCLUDE
+  printf("\nYou'll need to change jconfig.h to include the system include file\n");
+  printf("that you found type size_t in, or add a direct definition of type\n");
+  printf("size_t if that's what you used.  Just add it to the end.\n");
+#endif
+
+  return 0;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/coderules.doc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/coderules.doc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/coderules.doc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,118 @@
+IJG JPEG LIBRARY:  CODING RULES
+
+Copyright (C) 1991-1996, Thomas G. Lane.
+This file is part of the Independent JPEG Group's software.
+For conditions of distribution and use, see the accompanying README file.
+
+
+Since numerous people will be contributing code and bug fixes, it's important
+to establish a common coding style.  The goal of using similar coding styles
+is much more important than the details of just what that style is.
+
+In general we follow the recommendations of "Recommended C Style and Coding
+Standards" revision 6.1 (Cannon et al. as modified by Spencer, Keppel and
+Brader).  This document is available in the IJG FTP archive (see
+jpeg/doc/cstyle.ms.tbl.Z, or cstyle.txt.Z for those without nroff/tbl).
+
+Block comments should be laid out thusly:
+
+/*
+ *  Block comments in this style.
+ */
+
+We indent statements in K&R style, e.g.,
+	if (test) {
+	  then-part;
+	} else {
+	  else-part;
+	}
+with two spaces per indentation level.  (This indentation convention is
+handled automatically by GNU Emacs and many other text editors.)
+
+Multi-word names should be written in lower case with underscores, e.g.,
+multi_word_name (not multiWordName).  Preprocessor symbols and enum constants
+are similar but upper case (MULTI_WORD_NAME).  Names should be unique within
+the first fifteen characters.  (On some older systems, global names must be
+unique within six characters.  We accommodate this without cluttering the
+source code by using macros to substitute shorter names.)
+
+We use function prototypes everywhere; we rely on automatic source code
+transformation to feed prototype-less C compilers.  Transformation is done
+by the simple and portable tool 'ansi2knr.c' (courtesy of Ghostscript).
+ansi2knr is not very bright, so it imposes a format requirement on function
+declarations: the function name MUST BEGIN IN COLUMN 1.  Thus all functions
+should be written in the following style:
+
+LOCAL(int *)
+function_name (int a, char *b)
+{
+    code...
+}
+
+Note that each function definition must begin with GLOBAL(type), LOCAL(type),
+or METHODDEF(type).  These macros expand to "static type" or just "type" as
+appropriate.  They provide a readable indication of the routine's usage and
+can readily be changed for special needs.  (For instance, special linkage
+keywords can be inserted for use in Windows DLLs.)
+
+ansi2knr does not transform method declarations (function pointers in
+structs).  We handle these with a macro JMETHOD, defined as
+	#ifdef HAVE_PROTOTYPES
+	#define JMETHOD(type,methodname,arglist)  type (*methodname) arglist
+	#else
+	#define JMETHOD(type,methodname,arglist)  type (*methodname) ()
+	#endif
+which is used like this:
+	struct function_pointers {
+	  JMETHOD(void, init_entropy_encoder, (int somearg, jparms *jp));
+	  JMETHOD(void, term_entropy_encoder, (void));
+	};
+Note the set of parentheses surrounding the parameter list.
+
+A similar solution is used for forward and external function declarations
+(see the EXTERN and JPP macros).
+
+If the code is to work on non-ANSI compilers, we cannot rely on a prototype
+declaration to coerce actual parameters into the right types.  Therefore, use
+explicit casts on actual parameters whenever the actual parameter type is not
+identical to the formal parameter.  Beware of implicit conversions to "int".
+
+It seems there are some non-ANSI compilers in which the sizeof() operator
+is defined to return int, yet size_t is defined as long.  Needless to say,
+this is brain-damaged.  Always use the SIZEOF() macro in place of sizeof(),
+so that the result is guaranteed to be of type size_t.
+
+
+The JPEG library is intended to be used within larger programs.  Furthermore,
+we want it to be reentrant so that it can be used by applications that process
+multiple images concurrently.  The following rules support these requirements:
+
+1. Avoid direct use of file I/O, "malloc", error report printouts, etc;
+pass these through the common routines provided.
+
+2. Minimize global namespace pollution.  Functions should be declared static
+wherever possible.  (Note that our method-based calling conventions help this
+a lot: in many modules only the initialization function will ever need to be
+called directly, so only that function need be externally visible.)  All
+global function names should begin with "jpeg_", and should have an
+abbreviated name (unique in the first six characters) substituted by macro
+when NEED_SHORT_EXTERNAL_NAMES is set.
+
+3. Don't use global variables; anything that must be used in another module
+should be in the common data structures.
+
+4. Don't use static variables except for read-only constant tables.  Variables
+that should be private to a module can be placed into private structures (see
+the system architecture document, structure.doc).
+
+5. Source file names should begin with "j" for files that are part of the
+library proper; source files that are not part of the library, such as cjpeg.c
+and djpeg.c, do not begin with "j".  Keep source file names to eight
+characters (plus ".c" or ".h", etc) to make life easy for MS-DOSers.  Keep
+compression and decompression code in separate source files --- some
+applications may want only one half of the library.
+
+Note: these rules (particularly #4) are not followed religiously in the
+modules that are used in cjpeg/djpeg but are not part of the JPEG library
+proper.  Those modules are not really intended to be used in other
+applications.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jaix.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jaix.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jaix.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#define CHAR_IS_UNSIGNED 
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jalpha.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jalpha.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jalpha.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jconvex.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jconvex.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jconvex.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#define RIGHT_SHIFT_IS_UNSIGNED 
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jdec.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jdec.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jdec.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jfbsd.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jfbsd.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jfbsd.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jfujivp.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jfujivp.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jfujivp.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#undef HAVE_PROTOTYPES
+#undef HAVE_UNSIGNED_CHAR
+#undef HAVE_UNSIGNED_SHORT
+#define void char
+#define const 
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#define NEED_SHORT_EXTERNAL_NAMES 
+/* Define this if you get warnings about undefined structures. */
+#define INCOMPLETE_TYPES_BROKEN 
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#define INLINE 
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jhpux.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jhpux.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jhpux.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jia64.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jia64.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jia64.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix32.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix32.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix32.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,49 @@
+/* $Id: jirix32.h,v 1.1 1995/07/25 16:27:25 acheng Exp $ */
+/* */
+/* Machine/OS: SGI/IRIX 6.0 (32-bit mode) */
+/* */
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#define CHAR_IS_UNSIGNED 
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix4.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix4.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix4.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#define CHAR_IS_UNSIGNED 
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix5.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix5.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix5.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#define CHAR_IS_UNSIGNED 
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix6.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix6.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jirix6.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#define CHAR_IS_UNSIGNED 
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jlinux.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jlinux.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jlinux.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jmac.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jmac.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jmac.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jsolaris.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jsolaris.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jsolaris.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#undef HAVE_STDDEF_H
+#undef HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS 
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jsun.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jsun.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jsun.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jt3e.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jt3e.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jt3e.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.h.  Generated automatically by configure.  */
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES 
+#define HAVE_UNSIGNED_CHAR 
+#define HAVE_UNSIGNED_SHORT 
+#undef void
+#undef const
+#define CHAR_IS_UNSIGNED 
+#define HAVE_STDDEF_H 
+#define HAVE_STDLIB_H 
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#define INLINE 
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/junicos.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/junicos.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/junicos.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,37 @@
+/* jconfig.h --- generated by ckconfig.c */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#define CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#define RIGHT_SHIFT_IS_UNSIGNED
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE	/* You may need this on non-Unix systems */
+#undef NEED_SIGNAL_CATCHER	/* Define this if you use jmemname.c */
+#undef DONT_USE_B_MODE
+/* #define PROGRESS_REPORT */	/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jwin32.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jwin32.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/jwin32.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+/* jconfig.h --- generated by ckconfig.c */
+/* see jconfig.doc for explanations */
+
+#include <windows.h>
+#include <winnt.h>
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#define HAVE_BOOLEAN
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE	/* You may need this on non-Unix systems */
+#undef NEED_SIGNAL_CATCHER	/* Define this if you use jmemname.c */
+#undef DONT_USE_B_MODE
+/* #define PROGRESS_REPORT */	/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-aix
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-aix	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-aix	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-alpha
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-alpha	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-alpha	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-convex
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-convex	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-convex	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-decstation
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-decstation	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-decstation	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-fbsd
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-fbsd	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-fbsd	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-fujivp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-fujivp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-fujivp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-hpux
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-hpux	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-hpux	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-ia64
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-ia64	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-ia64	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix32
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix32	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix32	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+# $Id: mh-irix32,v 1.3 1996/10/31 00:13:02 acheng Exp $
+#
+# Machine/OS: SGI/IRIX 6.0 (32-bit mode)
+#
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= -n32 -mips3
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix4
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,42 @@
+# This makefile fragment will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+AR2 = true
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix5
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix5	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix5	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix6
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix6	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-irix6	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS=
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-linux
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-linux	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-linux	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-mac
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-mac	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-mac	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-solaris
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-solaris	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-solaris	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= -DBSD
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-sun
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-sun	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-sun	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-t3e
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-t3e	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-t3e	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-unicos
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-unicos	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/mh-unicos	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+# This makefile fragemnt will override the default options found at the top
+# of the 'Makefile' in the jpeg source directory. See 'Makefile.in'
+# for discussion of the various options.
+#
+
+ANSI2KNRFLAGS= 
+LDFLAGS= 
+LDLIBS= 
+SYSDEPMEM= jmemnobs.o
+RM = /bin/rm 
+RMFLAGS = -f
+MV= mv
+AR = ar
+ARFLAGS = rc
+
+# The following segment should not really be the fragments but I 
+# couldn't find a way to avoid this.-GV
+#
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#all: @ANSI2KNR@ libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
+
+# Uncomment the following rule if you don't have an ANSI compilier
+# This rule causes ansi2knr to be invoked.
+# .c.o:
+# 	./ansi2knr $(srcdir)/$*.c T$*.c
+# 	$(CC) $(CFLAGS) -c T$*.c
+# 	$(RM) $(RMFLAGS) T$*.c $*.o
+# 	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+# Uncomment the following line if you don't have an ANSI compilier
+# and comment out the one below it
+#libjpeg.a: @ANSI2KNR@ $(LIBOBJECTS)
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) $(RMFLAGS) libjpeg.a
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config/win32jpg.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config/win32jpg.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config/win32jpg.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,618 @@
+# 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 "win32jpg.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
+# PROP Target_Last_Scanned "Win32 Debug"
+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 : $(OUTDIR)/win32jpg.lib $(OUTDIR)/win32jpg.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c
+# SUBTRACT CPP /YX
+CPP_PROJ=/nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR$(INTDIR)/\
+ /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"win32jpg.bsc" 
+BSC32_SBRS= \
+	$(INTDIR)/jdcolor.sbr \
+	$(INTDIR)/jfdctint.sbr \
+	$(INTDIR)/jcmainct.sbr \
+	$(INTDIR)/jcsample.sbr \
+	$(INTDIR)/jdsample.sbr \
+	$(INTDIR)/jdcoefct.sbr \
+	$(INTDIR)/jcmaster.sbr \
+	$(INTDIR)/jfdctflt.sbr \
+	$(INTDIR)/jccolor.sbr \
+	$(INTDIR)/jutils.sbr \
+	$(INTDIR)/jdmerge.sbr \
+	$(INTDIR)/jdmarker.sbr \
+	$(INTDIR)/jcomapi.sbr \
+	$(INTDIR)/jquant2.sbr \
+	$(INTDIR)/jidctfst.sbr \
+	$(INTDIR)/jdapi.sbr \
+	$(INTDIR)/jdpostct.sbr \
+	$(INTDIR)/jdatasrc.sbr \
+	$(INTDIR)/jerror.sbr \
+	$(INTDIR)/jccoefct.sbr \
+	$(INTDIR)/jcprepct.sbr \
+	$(INTDIR)/jcdctmgr.sbr \
+	$(INTDIR)/jddctmgr.sbr \
+	$(INTDIR)/jfdctfst.sbr \
+	$(INTDIR)/jcparam.sbr \
+	$(INTDIR)/jmemmgr.sbr \
+	$(INTDIR)/jcmarker.sbr \
+	$(INTDIR)/jchuff.sbr \
+	$(INTDIR)/jcapi.sbr \
+	$(INTDIR)/jidctred.sbr \
+	$(INTDIR)/jdmainct.sbr \
+	$(INTDIR)/jidctint.sbr \
+	$(INTDIR)/jdmaster.sbr \
+	$(INTDIR)/jidctflt.sbr \
+	$(INTDIR)/jdatadst.sbr \
+	$(INTDIR)/jdhuff.sbr \
+	$(INTDIR)/jquant1.sbr \
+	$(INTDIR)/jmemansi.sbr \
+	$(INTDIR)/ckconfig.sbr
+
+$(OUTDIR)/win32jpg.bsc : $(OUTDIR)  $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	$(INTDIR)/jdcolor.obj \
+	$(INTDIR)/jfdctint.obj \
+	$(INTDIR)/jcmainct.obj \
+	$(INTDIR)/jcsample.obj \
+	$(INTDIR)/jdsample.obj \
+	$(INTDIR)/jdcoefct.obj \
+	$(INTDIR)/jcmaster.obj \
+	$(INTDIR)/jfdctflt.obj \
+	$(INTDIR)/jccolor.obj \
+	$(INTDIR)/jutils.obj \
+	$(INTDIR)/jdmerge.obj \
+	$(INTDIR)/jdmarker.obj \
+	$(INTDIR)/jcomapi.obj \
+	$(INTDIR)/jquant2.obj \
+	$(INTDIR)/jidctfst.obj \
+	$(INTDIR)/jdapi.obj \
+	$(INTDIR)/jdpostct.obj \
+	$(INTDIR)/jdatasrc.obj \
+	$(INTDIR)/jerror.obj \
+	$(INTDIR)/jccoefct.obj \
+	$(INTDIR)/jcprepct.obj \
+	$(INTDIR)/jcdctmgr.obj \
+	$(INTDIR)/jddctmgr.obj \
+	$(INTDIR)/jfdctfst.obj \
+	$(INTDIR)/jcparam.obj \
+	$(INTDIR)/jmemmgr.obj \
+	$(INTDIR)/jcmarker.obj \
+	$(INTDIR)/jchuff.obj \
+	$(INTDIR)/jcapi.obj \
+	$(INTDIR)/jidctred.obj \
+	$(INTDIR)/jdmainct.obj \
+	$(INTDIR)/jidctint.obj \
+	$(INTDIR)/jdmaster.obj \
+	$(INTDIR)/jidctflt.obj \
+	$(INTDIR)/jdatadst.obj \
+	$(INTDIR)/jdhuff.obj \
+	$(INTDIR)/jquant1.obj \
+	$(INTDIR)/jmemansi.obj \
+	$(INTDIR)/ckconfig.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"win32jpg.lib" 
+
+$(OUTDIR)/win32jpg.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 : $(OUTDIR)/win32jpg.lib $(OUTDIR)/win32jpg.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /Z7 /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
+ /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"win32jpg.bsc" 
+BSC32_SBRS= \
+	
+
+$(OUTDIR)/win32jpg.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	$(INTDIR)/jdcolor.obj \
+	$(INTDIR)/jfdctint.obj \
+	$(INTDIR)/jcmainct.obj \
+	$(INTDIR)/jcsample.obj \
+	$(INTDIR)/jdsample.obj \
+	$(INTDIR)/jdcoefct.obj \
+	$(INTDIR)/jcmaster.obj \
+	$(INTDIR)/jfdctflt.obj \
+	$(INTDIR)/jccolor.obj \
+	$(INTDIR)/jutils.obj \
+	$(INTDIR)/jdmerge.obj \
+	$(INTDIR)/jdmarker.obj \
+	$(INTDIR)/jcomapi.obj \
+	$(INTDIR)/jquant2.obj \
+	$(INTDIR)/jidctfst.obj \
+	$(INTDIR)/jdapi.obj \
+	$(INTDIR)/jdpostct.obj \
+	$(INTDIR)/jdatasrc.obj \
+	$(INTDIR)/jerror.obj \
+	$(INTDIR)/jccoefct.obj \
+	$(INTDIR)/jcprepct.obj \
+	$(INTDIR)/jcdctmgr.obj \
+	$(INTDIR)/jddctmgr.obj \
+	$(INTDIR)/jfdctfst.obj \
+	$(INTDIR)/jcparam.obj \
+	$(INTDIR)/jmemmgr.obj \
+	$(INTDIR)/jcmarker.obj \
+	$(INTDIR)/jchuff.obj \
+	$(INTDIR)/jcapi.obj \
+	$(INTDIR)/jidctred.obj \
+	$(INTDIR)/jdmainct.obj \
+	$(INTDIR)/jidctint.obj \
+	$(INTDIR)/jdmaster.obj \
+	$(INTDIR)/jidctflt.obj \
+	$(INTDIR)/jdatadst.obj \
+	$(INTDIR)/jdhuff.obj \
+	$(INTDIR)/jquant1.obj \
+	$(INTDIR)/jmemansi.obj \
+	$(INTDIR)/ckconfig.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"win32jpg.lib" 
+
+$(OUTDIR)/win32jpg.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=.\jdcolor.c
+
+$(INTDIR)/jdcolor.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jfdctint.c
+
+$(INTDIR)/jfdctint.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jcmainct.c
+
+$(INTDIR)/jcmainct.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jversion.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jcsample.c
+
+$(INTDIR)/jcsample.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdsample.c
+
+$(INTDIR)/jdsample.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdcoefct.c
+
+$(INTDIR)/jdcoefct.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jcmaster.c
+
+$(INTDIR)/jcmaster.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jfdctflt.c
+
+$(INTDIR)/jfdctflt.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cderror.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jccolor.c
+
+$(INTDIR)/jccolor.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jutils.c
+
+$(INTDIR)/jutils.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdmerge.c
+
+$(INTDIR)/jdmerge.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdmarker.c
+
+$(INTDIR)/jdmarker.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jcomapi.c
+
+$(INTDIR)/jcomapi.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jquant2.c
+
+$(INTDIR)/jquant2.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jidctfst.c
+
+$(INTDIR)/jidctfst.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jinclude.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jpegint.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdapi.c
+
+$(INTDIR)/jdapi.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdpostct.c
+
+$(INTDIR)/jdpostct.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdatasrc.c
+
+$(INTDIR)/jdatasrc.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jerror.c
+
+$(INTDIR)/jerror.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jccoefct.c
+
+$(INTDIR)/jccoefct.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jcprepct.c
+
+$(INTDIR)/jcprepct.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jcdctmgr.c
+
+$(INTDIR)/jcdctmgr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jmemsys.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jddctmgr.c
+
+$(INTDIR)/jddctmgr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jerror.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jfdctfst.c
+
+$(INTDIR)/jfdctfst.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jcparam.c
+
+$(INTDIR)/jcparam.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jmemmgr.c
+
+$(INTDIR)/jmemmgr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jcmarker.c
+
+$(INTDIR)/jcmarker.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jchuff.c
+
+$(INTDIR)/jchuff.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdct.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jcapi.c
+
+$(INTDIR)/jcapi.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jmorecfg.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jidctred.c
+
+$(INTDIR)/jidctred.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jpeglib.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdmainct.c
+
+$(INTDIR)/jdmainct.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jidctint.c
+
+$(INTDIR)/jidctint.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdmaster.c
+
+$(INTDIR)/jdmaster.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cdjpeg.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jidctflt.c
+
+$(INTDIR)/jidctflt.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdatadst.c
+
+$(INTDIR)/jdatadst.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jdhuff.c
+
+$(INTDIR)/jdhuff.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jquant1.c
+
+$(INTDIR)/jquant1.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jconfig.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\jmemansi.c
+
+$(INTDIR)/jmemansi.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\ckconfig.c
+
+$(INTDIR)/ckconfig.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config.guess
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config.guess	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config.guess	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,883 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+#
+# 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., 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.
+
+# Written by Per Bothner <bothner at cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# 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 system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 8/24/94.)
+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
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    alpha:OSF1:*:*)
+	if test $UNAME_RELEASE = "V4.0"; then
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+	fi
+	# 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.
+	cat <<EOF >dummy.s
+	.globl main
+	.ent main
+main:
+	.frame \$30,0,\$26,0
+	.prologue 0
+	.long 0x47e03d80 # implver $0
+	lda \$2,259
+	.long 0x47e20c21 # amask $2,$1
+	srl \$1,8,\$2
+	sll \$2,2,\$2
+	sll \$0,3,\$0
+	addl \$1,\$0,\$0
+	addl \$2,\$0,\$0
+	ret \$31,(\$26),1
+	.end main
+EOF
+	${CC-cc} dummy.s -o dummy 2>/dev/null
+	if test "$?" = 0 ; then
+		./dummy
+		case "$?" in
+			7)
+				UNAME_MACHINE="alpha"
+				;;
+			15)
+				UNAME_MACHINE="alphaev5"
+				;;
+			14)
+				UNAME_MACHINE="alphaev56"
+				;;
+			10)
+				UNAME_MACHINE="alphapca56"
+				;;
+			16)
+				UNAME_MACHINE="alphaev6"
+				;;
+		esac
+	fi
+	rm -f dummy.s dummy
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+	exit 0 ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-cbm-sysv4
+	exit 0;;
+    amiga:NetBSD:*:*)
+      echo m68k-cbm-netbsd${UNAME_RELEASE}
+      exit 0 ;;
+    amiga:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc64:OpenBSD:*:*)
+	echo mips64el-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hkmips:OpenBSD:*:*)
+	echo mips-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    pmax:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sgi:OpenBSD:*:*)
+	echo mips-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit 0;;
+    arm32:NetBSD:*:*)
+	echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	exit 0 ;;
+    SR2?01:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit 0;;
+    Pyramid*:OSx*:*:*|MIS*: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 0 ;;
+    NILE:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    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 0 ;;
+    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 0 ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(head -1 /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 0 ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    atari*:NetBSD:*:*)
+	echo m68k-atari-netbsd${UNAME_RELEASE}
+	exit 0 ;;
+    atari*:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3*:NetBSD:*:*)
+	echo m68k-sun-netbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3*:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:NetBSD:*:*)
+	echo m68k-apple-netbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit 0 ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit 0 ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    2020:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	sed 's/^	//' << EOF >dummy.c
+	int main (argc, argv) int argc; char **argv; {
+	#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-cc} dummy.c -o dummy \
+	  && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && rm dummy.c dummy && exit 0
+	rm -f dummy.c dummy
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit 0 ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit 0 ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit 0 ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+        if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+	     -o ${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 0 ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit 0 ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit 0 ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit 0 ;;
+    ????????: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 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i?86:AIX:*:*)
+	echo i386-ibm-aix
+	exit 0 ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		sed 's/^		//' << EOF >dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+		rm -f dummy.c dummy
+		echo rs6000-ibm-aix3.2.5
+	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 0 ;;
+    *:AIX:*:4)
+	if /usr/sbin/lsattr -EHl proc0 | 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=4.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit 0 ;;
+    9000/[3478]??:HP-UX:*:*)
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
+	    9000/8?? )            HP_ARCH=hppa1.0 ;;
+	esac
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    3050*:HI-UX:*:*)
+	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-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+	rm -f dummy.c dummy
+	echo unknown-hitachi-hiuxwe2
+	exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit 0 ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit 0 ;;
+    i?86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit 0 ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*X-MP:*:*:*)
+	echo xmp-cray-unicos
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE}
+	exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+	exit 0 ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE}
+	exit 0 ;;
+    CRAY-2:*:*:*)
+	echo cray2-cray-unicos
+        exit 0 ;;
+    F300:UNIX_System_V:*:*)
+        FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    F301:UNIX_System_V:*:*)
+       echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+       exit 0 ;;
+    hp3[0-9][05]:NetBSD:*:*)
+	echo m68k-hp-netbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hp300:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    i?86:BSD/386:*:* | *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:FreeBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit 0 ;;
+    *:NetBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	exit 0 ;;
+    *:OpenBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	exit 0 ;;
+    i*:CYGWIN*:*)
+	echo i386-pc-cygwin32
+	exit 0 ;;
+    i*:MINGW*:*)
+	echo i386-pc-mingw32
+	exit 0 ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin32
+	exit 0 ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    *:GNU:*:*)
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit 0 ;;
+    *:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us.
+	ld_help_string=`ld --help 2>&1`
+	ld_supported_emulations=`echo $ld_help_string \
+			 | sed -ne '/supported emulations:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported emulations: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_emulations" in
+	  i?86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
+	  i?86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
+	  sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+	  m68klinux)  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+	  elf32ppc)   echo "powerpc-unknown-linux-gnu"              ; exit 0 ;;
+	esac
+
+	if test "${UNAME_MACHINE}" = "alpha" ; then
+		sed 's/^	//'  <<EOF >dummy.s
+		.globl main
+		.ent main
+	main:
+		.frame \$30,0,\$26,0
+		.prologue 0
+		.long 0x47e03d80 # implver $0
+		lda \$2,259
+		.long 0x47e20c21 # amask $2,$1
+		srl \$1,8,\$2
+		sll \$2,2,\$2
+		sll \$0,3,\$0
+		addl \$1,\$0,\$0
+		addl \$2,\$0,\$0
+		ret \$31,(\$26),1
+		.end main
+EOF
+		LIBC=""
+		${CC-cc} dummy.s -o dummy 2>/dev/null
+		if test "$?" = 0 ; then
+			./dummy
+			case "$?" in
+			7)
+				UNAME_MACHINE="alpha"
+				;;
+			15)
+				UNAME_MACHINE="alphaev5"
+				;;
+			14)
+				UNAME_MACHINE="alphaev56"
+				;;
+			10)
+				UNAME_MACHINE="alphapca56"
+				;;
+			16)
+				UNAME_MACHINE="alphaev6"
+				;;
+			esac	
+
+			objdump --private-headers dummy | \
+			  grep ld.so.1 > /dev/null
+			if test "$?" = 0 ; then
+				LIBC="libc1"
+			fi
+		fi	
+		rm -f dummy.s dummy
+		echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+	elif test "${UNAME_MACHINE}" = "mips" ; then
+	  cat >dummy.c <<EOF
+main(argc, argv)
+     int argc;
+     char *argv[];
+{
+#ifdef __MIPSEB__
+  printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+  printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+  return 0;
+}
+EOF
+	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+	  rm -f dummy.c dummy
+	else
+	  # Either a pre-BFD a.out linker (linux-gnuoldld)
+	  # or one that does not give us useful --help.
+	  # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+	  # If ld does not provide *any* "supported emulations:"
+	  # that means it is gnuoldld.
+	  echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
+	  test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+	  case "${UNAME_MACHINE}" in
+	  i?86)
+	    VENDOR=pc;
+	    ;;
+	  *)
+	    VENDOR=unknown;
+	    ;;
+	  esac
+	  # Determine whether the default compiler is a.out or elf
+	  cat >dummy.c <<EOF
+#include <features.h>
+main(argc, argv)
+     int argc;
+     char *argv[];
+{
+#ifdef __ELF__
+# ifdef __GLIBC__
+#  if __GLIBC__ >= 2
+    printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+#  else
+    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+#  endif
+# else
+   printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+  printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+#endif
+  return 0;
+}
+EOF
+	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+	  rm -f dummy.c dummy
+	fi ;;
+# 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.
+    i?86:DYNIX/ptx:4*:*)
+	echo i386-sequent-sysv4
+	exit 0 ;;
+    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 0 ;;
+    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+	fi
+	exit 0 ;;
+    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|egrep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit 0 ;;
+    pc:*:*:*)
+        # 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 0 ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit 0 ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit 0 ;;
+    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 0 ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit 0 ;;
+    M68*:*:R3V[567]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*: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 0
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit 0 ;;
+    i?86:LynxOS:2.*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit 0 ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    *: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 0 ;;
+    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                           # says <Richard.M.Bartel at ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    *: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 0 ;;
+    *:*:*:FTX*)
+	# From seanf at swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit 0 ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit 0 ;;
+    news*:NEWS-OS:*:6*)
+	echo mips-sony-newsos6
+	exit 0 ;;
+    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+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"); 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`;
+  printf ("%s-next-nextstep%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)
+  printf ("vax-dec-bsd\n"); exit (0);
+#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-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# 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 0 ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit 0 ;;
+    c34*)
+	echo c34-convex-bsd
+	exit 0 ;;
+    c38*)
+	echo c38-convex-bsd
+	exit 0 ;;
+    c4*)
+	echo c4-convex-bsd
+	exit 0 ;;
+    esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/config.guess
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/config.sub
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/config.sub	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/config.sub	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,954 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+#   Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+# 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., 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.
+
+# 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.
+
+if [ x$1 = x ]
+then
+	echo Configuration name missing. 1>&2
+	echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+	echo "or     $0 ALIAS" 1>&2
+	echo where ALIAS is a recognized configuration type. 1>&2
+	exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+	*local*)
+		echo $1
+		exit 0
+		;;
+	*)
+	;;
+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
+  linux-gnu*)
+    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)
+		os=
+		basic_machine=$1
+		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-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/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		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
+		;;
+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.
+	tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+		| arme[lb] | pyramid | mn10200 | mn10300 \
+		| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+		| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
+		| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
+		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
+		| mipstx39 | mipstx39el \
+		| sparc | sparclet | sparclite | sparc64 | v850)
+		basic_machine=$basic_machine-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[3456]86)
+	  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.
+	vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+	      | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
+	      | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
+	      | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
+	      | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
+	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+	      | sparc64-* | mips64-* | mipsel-* \
+	      | mips64el-* | mips64orion-* | mips64orionel-*  \
+	      | mipstx39-* | mipstx39el-* \
+	      | f301-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-cbm
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-cbm
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-cbm
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	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 | ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	cray2)
+		basic_machine=cray2-cray
+		os=-unicos
+		;;
+	[ctj]90-cray)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	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
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-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
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i[3456]86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i[3456]86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i[3456]86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i[3456]86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	mipsel*-linux*)
+		basic_machine=mipsel-unknown
+		os=-linux-gnu
+		;;
+	mips*-linux*)
+		basic_machine=mips-unknown
+		os=-linux-gnu
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	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
+		;;
+	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
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+        pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pentium | p5)
+		basic_machine=i586-intel
+		;;
+	pentiumpro | p6)
+		basic_machine=i686-intel
+		;;
+	pentium-* | p5-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	k5)
+		# We don't have specific support for AMD's K5 yet, so just call it a Pentium
+		basic_machine=i586-amd
+		;;
+	nexen)
+		# We don't have specific support for Nexgen yet, so just call it a Pentium
+		basic_machine=i586-nexgen
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=rs6000-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/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	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
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	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
+		;;
+	xmp)
+		basic_machine=xmp-cray
+		os=-unicos
+		;;
+        xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	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.
+	mips)
+		if [ x$os = x-linux-gnu ]; then
+			basic_machine=mips-unknown
+		else
+			basic_machine=mips-mips
+		fi
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sparc)
+		basic_machine=sparc-sun
+		;;
+        cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	*)
+		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* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -uxpv*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-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|'`
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-ns2 )
+	        os=-nextstep2
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-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
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        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
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-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
+		;;
+	f301-fujitsu)
+		os=-uxpv
+		;;
+	*)
+		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
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-vxsim* | -vxworks*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/config.sub
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/configure.gnu
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/configure.gnu	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/configure.gnu	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2011 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.12 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+  --enable-shared         build shared library using GNU libtool"
+ac_help="$ac_help
+  --enable-static         build static library using GNU libtool"
+ac_help="$ac_help
+  --enable-maxmem[=N]     enable use of temp files, set max mem usage to N MB"
+ac_help="$ac_help
+"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -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 ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build="$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" ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$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)
+    # 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 << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --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
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$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" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    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)
+    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" ;;
+
+  -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 ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.12"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=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" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *=*)
+    varname=`echo "$ac_option"|sed -e 's/=.*//'`
+    # Reject names that aren't valid shell variable names.
+    if test -n "`echo $varname| sed 's/[a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $varname: invalid shell variable name" 1>&2; exit 1; }
+    fi
+    val="`echo "$ac_option"|sed 's/[^=]*=//'`"
+    test -n "$verbose" && echo "	setting shell variable $varname to $val"
+    eval "$varname='$val'"
+    eval "export $varname" ;;
+
+  *)
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=jcmaster.c
+
+# 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 its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  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
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi at caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='	'
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:538: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+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
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:567: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  ac_prog_rejected=no
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+	continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_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 $# -gt 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
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:615: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 625 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+if { (eval echo configure:629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:649: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:654: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+  test "${CFLAGS+set}" = set || CFLAGS="-O2"
+else
+  GCC=
+  test "${CFLAGS+set}" = set || CFLAGS="-O"
+fi
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:681: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 696 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 713 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking for function prototypes""... $ac_c" 1>&6
+echo "configure:742: checking for function prototypes" >&5
+if eval "test \"`echo '$''{'ijg_cv_have_prototypes'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 747 "configure"
+#include "confdefs.h"
+
+int testfunction (int arg1, int * arg2); /* check prototypes */
+struct methods_struct {		/* check method-pointer declarations */
+  int (*error_exit) (char *msgtext);
+  int (*trace_message) (char *msgtext);
+  int (*another_method) (void);
+};
+int testfunction (int arg1, int * arg2) /* check definitions */
+{ return arg2[arg1]; }
+int test2function (void)	/* check void arg list */
+{ return 0; }
+
+int main() {
+ 
+; return 0; }
+EOF
+if { (eval echo configure:765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ijg_cv_have_prototypes=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ijg_cv_have_prototypes=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ijg_cv_have_prototypes" 1>&6
+if test $ijg_cv_have_prototypes = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_PROTOTYPES 
+EOF
+
+else
+  echo Your compiler does not seem to know about function prototypes.
+  echo Perhaps it needs a special switch to enable ANSI C mode.
+  echo If so, we recommend running configure like this:
+  echo "   ./configure  CC='cc -switch'"
+  echo where -switch is the proper switch.
+fi
+ac_safe=`echo "stddef.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for stddef.h""... $ac_c" 1>&6
+echo "configure:792: checking for stddef.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 797 "configure"
+#include "confdefs.h"
+#include <stddef.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_STDDEF_H 
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+ac_safe=`echo "stdlib.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for stdlib.h""... $ac_c" 1>&6
+echo "configure:828: checking for stdlib.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 833 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_STDLIB_H 
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+ac_safe=`echo "string.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for string.h""... $ac_c" 1>&6
+echo "configure:864: checking for string.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 869 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+cat >> confdefs.h <<\EOF
+#define NEED_BSD_STRINGS 
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:900: checking for size_t" >&5
+cat > conftest.$ac_ext <<EOF
+#line 902 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#ifdef NEED_BSD_STRINGS
+#include <strings.h>
+#else
+#include <string.h>
+#endif
+typedef size_t my_size_t;
+
+int main() {
+ my_size_t foovar; 
+; return 0; }
+EOF
+if { (eval echo configure:923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ijg_size_t_ok=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ijg_size_t_ok="not ANSI, perhaps it is in sys/types.h"
+fi
+rm -f conftest*
+echo "$ac_t""$ijg_size_t_ok" 1>&6
+if test "$ijg_size_t_ok" != yes; then
+ac_safe=`echo "sys/types.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for sys/types.h""... $ac_c" 1>&6
+echo "configure:937: checking for sys/types.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 942 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define NEED_SYS_TYPES_H 
+EOF
+
+cat > conftest.$ac_ext <<EOF
+#line 968 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "size_t" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ijg_size_t_ok="size_t is in sys/types.h"
+else
+  rm -rf conftest*
+  ijg_size_t_ok=no
+fi
+rm -f conftest*
+
+else
+  echo "$ac_t""no" 1>&6
+ijg_size_t_ok=no
+fi
+
+echo "$ac_t""$ijg_size_t_ok" 1>&6
+if test "$ijg_size_t_ok" = no; then
+  echo Type size_t is not defined in any of the usual places.
+  echo Try putting '"typedef unsigned int size_t;"' in jconfig.h.
+fi
+fi
+echo $ac_n "checking for type unsigned char""... $ac_c" 1>&6
+echo "configure:994: checking for type unsigned char" >&5
+cat > conftest.$ac_ext <<EOF
+#line 996 "configure"
+#include "confdefs.h"
+
+int main() {
+ unsigned char un_char; 
+; return 0; }
+EOF
+if { (eval echo configure:1003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6
+cat >> confdefs.h <<\EOF
+#define HAVE_UNSIGNED_CHAR 
+EOF
+
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+echo $ac_n "checking for type unsigned short""... $ac_c" 1>&6
+echo "configure:1018: checking for type unsigned short" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1020 "configure"
+#include "confdefs.h"
+
+int main() {
+ unsigned short un_short; 
+; return 0; }
+EOF
+if { (eval echo configure:1027: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6
+cat >> confdefs.h <<\EOF
+#define HAVE_UNSIGNED_SHORT 
+EOF
+
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+echo $ac_n "checking for type void""... $ac_c" 1>&6
+echo "configure:1042: checking for type void" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1044 "configure"
+#include "confdefs.h"
+
+/* Caution: a C++ compiler will insist on valid prototypes */
+typedef void * void_ptr;	/* check void * */
+#ifdef HAVE_PROTOTYPES		/* check ptr to function returning void */
+typedef void (*void_func) (int a, int b);
+#else
+typedef void (*void_func) ();
+#endif
+
+#ifdef HAVE_PROTOTYPES		/* check void function result */
+void test3function (void_ptr arg1, void_func arg2)
+#else
+void test3function (arg1, arg2)
+     void_ptr arg1;
+     void_func arg2;
+#endif
+{
+  char * locptr = (char *) arg1; /* check casting to and from void * */
+  arg1 = (void *) locptr;
+  (*arg2) (1, 2);		/* check call of fcn returning void */
+}
+
+int main() {
+ 
+; return 0; }
+EOF
+if { (eval echo configure:1072: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+cat >> confdefs.h <<\EOF
+#define void char
+EOF
+
+fi
+rm -f conftest*
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1088: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1093 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:1142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_const=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1163: checking for inline" >&5
+ijg_cv_inline=""
+cat > conftest.$ac_ext <<EOF
+#line 1166 "configure"
+#include "confdefs.h"
+
+int main() {
+} __inline__ int foo() { return 0; }
+int bar() { return foo();
+; return 0; }
+EOF
+if { (eval echo configure:1174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ijg_cv_inline="__inline__"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cat > conftest.$ac_ext <<EOF
+#line 1182 "configure"
+#include "confdefs.h"
+
+int main() {
+} __inline int foo() { return 0; }
+int bar() { return foo();
+; return 0; }
+EOF
+if { (eval echo configure:1190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ijg_cv_inline="__inline"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cat > conftest.$ac_ext <<EOF
+#line 1198 "configure"
+#include "confdefs.h"
+
+int main() {
+} inline int foo() { return 0; }
+int bar() { return foo();
+; return 0; }
+EOF
+if { (eval echo configure:1206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ijg_cv_inline="inline"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+echo "$ac_t""$ijg_cv_inline" 1>&6
+cat >> confdefs.h <<EOF
+#define INLINE $ijg_cv_inline
+EOF
+
+echo $ac_n "checking for broken incomplete types""... $ac_c" 1>&6
+echo "configure:1224: checking for broken incomplete types" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1226 "configure"
+#include "confdefs.h"
+ typedef struct undefined_structure * undef_struct_ptr; 
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1233: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  echo "$ac_t""ok" 1>&6
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""broken" 1>&6
+cat >> confdefs.h <<\EOF
+#define INCOMPLETE_TYPES_BROKEN 
+EOF
+
+fi
+rm -f conftest*
+echo $ac_n "checking for short external names""... $ac_c" 1>&6
+echo "configure:1248: checking for short external names" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1250 "configure"
+#include "confdefs.h"
+
+int possibly_duplicate_function () { return 0; }
+int possibly_dupli_function () { return 1; }
+
+int main() {
+ 
+; return 0; }
+EOF
+if { (eval echo configure:1260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  echo "$ac_t""ok" 1>&6
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""short" 1>&6
+cat >> confdefs.h <<\EOF
+#define NEED_SHORT_EXTERNAL_NAMES 
+EOF
+
+fi
+rm -f conftest*
+echo $ac_n "checking to see if char is signed""... $ac_c" 1>&6
+echo "configure:1275: checking to see if char is signed" >&5
+if test "$cross_compiling" = yes; then
+  echo Assuming that char is signed on target machine.
+echo If it is unsigned, this will be a little bit inefficient.
+
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1282 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_PROTOTYPES
+int is_char_signed (int arg)
+#else
+int is_char_signed (arg)
+     int arg;
+#endif
+{
+  if (arg == 189) {		/* expected result for unsigned char */
+    return 0;			/* type char is unsigned */
+  }
+  else if (arg != -67) {	/* expected result for signed char */
+    printf("Hmm, it seems 'char' is not eight bits wide on your machine.\n");
+    printf("I fear the JPEG software will not work at all.\n\n");
+  }
+  return 1;			/* assume char is signed otherwise */
+}
+char signed_char_check = (char) (-67);
+main() {
+  exit(is_char_signed((int) signed_char_check));
+}
+EOF
+if { (eval echo configure:1306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  echo "$ac_t""no" 1>&6
+cat >> confdefs.h <<\EOF
+#define CHAR_IS_UNSIGNED 
+EOF
+
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  echo "$ac_t""yes" 1>&6
+fi
+rm -fr conftest*
+fi
+
+echo $ac_n "checking to see if right shift is signed""... $ac_c" 1>&6
+echo "configure:1323: checking to see if right shift is signed" >&5
+if test "$cross_compiling" = yes; then
+  echo "$ac_t""Assuming that right shift is signed on target machine." 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1328 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_PROTOTYPES
+int is_shifting_signed (long arg)
+#else
+int is_shifting_signed (arg)
+     long arg;
+#endif
+/* See whether right-shift on a long is signed or not. */
+{
+  long res = arg >> 4;
+
+  if (res == -0x7F7E80CL) {	/* expected result for signed shift */
+    return 1;			/* right shift is signed */
+  }
+  /* see if unsigned-shift hack will fix it. */
+  /* we can't just test exact value since it depends on width of long... */
+  res |= (~0L) << (32-4);
+  if (res == -0x7F7E80CL) {	/* expected result now? */
+    return 0;			/* right shift is unsigned */
+  }
+  printf("Right shift isn't acting as I expect it to.\n");
+  printf("I fear the JPEG software will not work at all.\n\n");
+  return 0;			/* try it with unsigned anyway */
+}
+main() {
+  exit(is_shifting_signed(-0x7F7E80B1L));
+}
+EOF
+if { (eval echo configure:1358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  echo "$ac_t""no" 1>&6
+cat >> confdefs.h <<\EOF
+#define RIGHT_SHIFT_IS_UNSIGNED 
+EOF
+
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  echo "$ac_t""yes" 1>&6
+fi
+rm -fr conftest*
+fi
+
+echo $ac_n "checking to see if fopen accepts b spec""... $ac_c" 1>&6
+echo "configure:1375: checking to see if fopen accepts b spec" >&5
+if test "$cross_compiling" = yes; then
+  echo "$ac_t""Assuming that it does." 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1380 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+main() {
+  if (fopen("conftestdata", "wb") != NULL)
+    exit(0);
+  exit(1);
+}
+EOF
+if { (eval echo configure:1390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  echo "$ac_t""no" 1>&6
+cat >> confdefs.h <<\EOF
+#define DONT_USE_B_MODE 
+EOF
+
+fi
+rm -fr conftest*
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; 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
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# 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
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1436: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      for ac_prog in ginstall installbsd scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+	  if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    # OSF/1 installbsd also uses dspmsg, but is usable.
+	    :
+	  else
+	    ac_cv_path_install="$ac_dir/$ac_prog -c"
+	    break 2
+	  fi
+	fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+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.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&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_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1488: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+# Decide whether to use libtool,
+# and if so whether to build shared, static, or both flavors of library.
+LTSHARED="no"
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  LTSHARED="$enableval"
+fi
+
+LTSTATIC="no"
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
+  LTSTATIC="$enableval"
+fi
+
+if test "x$LTSHARED" != xno  -o  "x$LTSTATIC" != xno; then
+  USELIBTOOL="yes"
+  LIBTOOL="./libtool"
+  O="lo"
+  A="la"
+  LN='$(LIBTOOL) --mode=link $(CC)'
+  INSTALL_LIB='$(LIBTOOL) --mode=install ${INSTALL}'
+  INSTALL_PROGRAM="\$(LIBTOOL) --mode=install $INSTALL_PROGRAM"
+else
+  USELIBTOOL="no"
+  LIBTOOL=""
+  O="o"
+  A="a"
+  LN='$(CC)'
+  INSTALL_LIB="$INSTALL_DATA"
+fi
+
+
+
+
+
+
+# Configure libtool if needed.
+if test $USELIBTOOL = yes; then
+  disable_shared=
+  disable_static=
+  if test "x$LTSHARED" = xno; then
+    disable_shared="--disable-shared"
+  fi
+  if test "x$LTSTATIC" = xno; then
+    disable_static="--disable-static"
+  fi
+  $srcdir/ltconfig $disable_shared $disable_static $srcdir/ltmain.sh
+fi
+
+# Select memory manager depending on user input.
+# If no "-enable-maxmem", use jmemnobs
+MEMORYMGR='jmemnobs.$(O)'
+MAXMEM="no"
+# Check whether --enable-maxmem or --disable-maxmem was given.
+if test "${enable_maxmem+set}" = set; then
+  enableval="$enable_maxmem"
+  MAXMEM="$enableval"
+fi
+
+# support --with-maxmem for backwards compatibility with IJG V5.
+# Check whether --with-maxmem or --without-maxmem was given.
+if test "${with_maxmem+set}" = set; then
+  withval="$with_maxmem"
+  MAXMEM="$withval"
+fi
+
+if test "x$MAXMEM" = xyes; then
+  MAXMEM=1
+fi
+if test "x$MAXMEM" != xno; then
+  if test -n "`echo $MAXMEM | sed 's/[0-9]//g'`"; then
+    { echo "configure: error: non-numeric argument to --enable-maxmem" 1>&2; exit 1; }
+  fi
+  DEFAULTMAXMEM=`expr $MAXMEM \* 1048576`
+cat >> confdefs.h <<EOF
+#define DEFAULT_MAX_MEM ${DEFAULTMAXMEM}
+EOF
+
+echo $ac_n "checking for 'tmpfile()'""... $ac_c" 1>&6
+echo "configure:1596: checking for 'tmpfile()'" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1598 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+int main() {
+ FILE * tfile = tmpfile(); 
+; return 0; }
+EOF
+if { (eval echo configure:1605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6
+MEMORYMGR='jmemansi.$(O)'
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+MEMORYMGR='jmemname.$(O)'
+cat >> confdefs.h <<\EOF
+#define NEED_SIGNAL_CATCHER 
+EOF
+
+echo $ac_n "checking for 'mktemp()'""... $ac_c" 1>&6
+echo "configure:1620: checking for 'mktemp()'" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1622 "configure"
+#include "confdefs.h"
+
+int main() {
+ char fname[80]; mktemp(fname); 
+; return 0; }
+EOF
+if { (eval echo configure:1629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+cat >> confdefs.h <<\EOF
+#define NO_MKTEMP 
+EOF
+
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+
+
+# Extract the library version ID from jpeglib.h.
+echo $ac_n "checking libjpeg version number""... $ac_c" 1>&6
+echo "configure:1650: checking libjpeg version number" >&5
+JPEG_LIB_VERSION=`sed -e '/^#define JPEG_LIB_VERSION/!d' -e 's/^[^0-9]*\([0-9][0-9]*\).*$/\1/' $srcdir/jpeglib.h`
+echo "$ac_t""$JPEG_LIB_VERSION" 1>&6
+
+
+# Prepare to massage makefile.cfg correctly.
+if test $ijg_cv_have_prototypes = yes; then
+  A2K_DEPS=""
+  COM_A2K="# "
+else
+  A2K_DEPS="ansi2knr"
+  COM_A2K=""
+fi
+
+
+# ansi2knr needs -DBSD if string.h is missing
+if test $ac_cv_header_string_h = no; then
+  ANSI2KNRFLAGS="-DBSD"
+else
+  ANSI2KNRFLAGS=""
+fi
+
+# Substitutions to enable or disable libtool-related stuff
+if test $USELIBTOOL = yes -a $ijg_cv_have_prototypes = yes; then
+  COM_LT=""
+else
+  COM_LT="# "
+fi
+
+if test "x$LTSHARED" != xno; then
+  FORCE_INSTALL_LIB="install-lib"
+else
+  FORCE_INSTALL_LIB=""
+fi
+
+# Set up -I directives
+if test "x$srcdir" = x.; then
+  INCLUDEFLAGS='-I$(srcdir)'
+else
+  INCLUDEFLAGS='-I. -I$(srcdir)'
+fi
+
+trap '' 1 2 15
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.12"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile:makefile.cfg jconfig.h:jconfig.cfg" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@RANLIB@%$RANLIB%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@O@%$O%g
+s%@A@%$A%g
+s%@LN@%$LN%g
+s%@INSTALL_LIB@%$INSTALL_LIB%g
+s%@MEMORYMGR@%$MEMORYMGR%g
+s%@JPEG_LIB_VERSION@%$JPEG_LIB_VERSION%g
+s%@A2K_DEPS@%$A2K_DEPS%g
+s%@COM_A2K@%$COM_A2K%g
+s%@ANSI2KNRFLAGS@%$ANSI2KNRFLAGS%g
+s%@COM_LT@%$COM_LT%g
+s%@FORCE_INSTALL_LIB@%$FORCE_INSTALL_LIB%g
+s%@INCLUDEFLAGS@%$INCLUDEFLAGS%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile:makefile.cfg"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_uB='\([ 	]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+  CONFIG_HEADERS="jconfig.h:jconfig.cfg"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  echo creating $ac_file
+
+  rm -f conftest.frag conftest.in conftest.out
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h.  And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #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.
+cat >> conftest.vals <<\EOF
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+  ac_lines=`grep -c . conftest.vals`
+  # grep -c gives empty output for an empty file on some AIX systems.
+  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+  # Write a limited-size here document to conftest.frag.
+  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  echo 'CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+  rm -f conftest.vals
+  mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+  rm -f conftest.frag conftest.h
+  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+  cat conftest.in >> conftest.h
+  rm -f conftest.in
+  if cmp -s $ac_file conftest.h 2>/dev/null; then
+    echo "$ac_file is unchanged"
+    rm -f conftest.h
+  else
+    # Remove last slash and all that follows it.  Not all systems have dirname.
+      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+      # The file is in a subdirectory.
+      test ! -d "$ac_dir" && mkdir "$ac_dir"
+    fi
+    rm -f $ac_file
+    mv conftest.h $ac_file
+  fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/configure.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/configure.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/configure.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,154 @@
+##############################################################################
+## This file was taken from the Cygnus Toolkit distribution and used as
+## as a template. This is called by the top level Cygnus Configure.
+
+## This file is Bourne a shell script fragment that supplies the information
+## necessary to tailor a template configure script into the configure
+## script appropriate for this directory.  For more information, check
+## any existing configure script.  
+
+## Be warned, there are two types of configure.in files.  There are those
+## used by Autoconf, which are macros which are expanded into a configure
+## script by autoconf.  The other sort, of which this is one, is executed
+## by Cygnus configure.  
+
+## For more information on these two systems, check out the documentation
+## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi) or
+## the official documentation on these packages.    
+
+##############################################################################
+
+################################################################################
+
+srctrigger=jpeglib.h
+srcname="JPEG library"
+
+# This gets set non-empty for some net releases of packages.
+appdirs=""
+
+# per-host:
+
+# Work in distributions for each host makefile fragment
+host_makefile_frag=""
+if [ -d ${srcdir}/config ]; then
+case "${host}" in
+  alpha-*-*)              host_makefile_frag=config/mh-alpha ;;
+  mips*-dec-ultrix*)      host_makefile_frag=config/mh-decstation ;;
+  mips*-sgi-irix6.*)      host_makefile_frag=config/mh-irix6 ;;
+  mips*-sgi-irix6_32*)    host_makefile_frag=config/mh-irix32 ;;
+  mips*-sgi-irix5*)       host_makefile_frag=config/mh-irix5 ;;
+  mips*-sgi-irix4*)       host_makefile_frag=config/mh-irix4 ;;
+  i[3456]86-*-linux*)     host_makefile_frag=config/mh-linux ;;
+  i[3456]86-*-freebsd*)   host_makefile_frag=config/mh-fbsd ;;
+  ia64-*-*)               host_makefile_frag=config/mh-ia64 ;;
+  *-ibm-aix*)             host_makefile_frag=config/mh-aix ;;
+  *-*-solaris2*)          host_makefile_frag=config/mh-solaris ;;
+  *-sun-*)		          host_makefile_frag=config/mh-sun ;;
+  *-hp-hpux*)             host_makefile_frag=config/mh-hpux ;;
+  *-convex-bsd*)          host_makefile_frag=config/mh-convex ;;
+  *-cray-unicos*)         host_makefile_frag=config/mh-unicos ;;
+  t3*-cray-craympp)       host_makefile_frag=config/mh-t3e ;;
+  S370*)                  host_makefile_frag=config/mh-fujivp ;;
+  *-mac-*)		          host_makefile_frag=config/mh-mac ;;
+esac
+fi
+
+# Check for valid platfroms before we continue
+if [ "${host_makefile_frag}" = "" ] ; then
+    echo '***' "The HDF/netCDF version of the JPEG library is not supported on host ${host}" 1>&2
+    echo '***' "Please read the HDF installation docs" 1>&2
+    exit 1
+fi
+
+# make sure makefile fragment is there
+if [ ! -f ${srcdir}/${host_makefile_frag} ]; then
+    echo '***' "We are missing makefile fragment ${host_makefile_frag}" 1>&2
+    echo '***' "Please read the installation docs" 1>&2
+    exit 1
+fi
+
+
+# The Solaris /usr/ucb/cc compiler does not appear to work.
+case "${host}" in
+  sparc-sun-solaris2*)
+      if [ "`/usr/bin/which ${CC-cc}`" = "/usr/ucb/cc" ] ; then
+          could_use=
+          [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
+          if [ -d /opt/cygnus/bin ] ; then
+              if [ "$could_use" == "" ] ; then
+                  could_use="/opt/cygnus/bin"
+              else
+                  could_use="$could_use or /opt/cygnus/bin"
+              fi
+          fi
+        if [ "$could_use" = "" ] ; then
+            echo "Warning: compilation may fail because you're using"
+            echo "/usr/ucb/cc.  You should change your PATH or CC "
+            echo "variable and rerun configure."
+        else
+            echo "Warning: compilation may fail because you're using"
+            echo "/usr/ucb/cc, when you should use the C compiler from"
+            echo "$could_use.  You should change your"
+            echo "PATH or CC variable and rerun configure."
+        fi
+      fi
+  ;;
+esac
+
+# per-target:
+
+#
+# get proper 'jconfig.h' ie. link in the correct pre-generated file
+files=
+links=jconfig.h
+if [ -d ${srcdir}/config ]; then
+case "${host}" in
+  alpha-*-*)              files=config/jalpha.h ;;
+  mips*-dec-ultrix*)      files=config/jdec.h ;;
+  mips*-sgi-irix6.*)      files=config/jirix6.h ;;
+  mips*-sgi-irix6_32*)    files=config/jirix32.h ;;
+  mips*-sgi-irix5*)       files=config/jirix5.h ;;
+  mips*-sgi-irix4*)       files=config/jirix4.h ;;
+  i[3456]86-*-linux*)     files=config/jlinux.h ;;
+  i[3456]86-*-freebsd*)   files=config/jfbsd.h ;;
+  ia64-*-*)               files=config/jia64.h ;;
+  *-ibm-aix*)             files=config/jaix.h ;;
+  *-*-solaris2*)          files=config/jsolaris.h ;;
+  *-sun-*)	              files=config/jsun.h ;;
+  *-hp-hpux*)             files=config/jhpux.h ;;
+  *-convex-bsd*)          files=config/jconvex.h ;;
+  *-cray-unicos*)         files=config/junicos.h ;;
+  t3*-cray-craympp)       files=config/jt3e.h ;;
+  S370*)                  files=config/jfujivp.h ;;
+  *-mac-*)	              files=config/jmac.h ;;
+esac
+fi
+
+# make sure host specific 'jconfig.h' is there
+if [ ! -f ${srcdir}/${files} ]; then
+    echo '***' "We are missing host specific ${files}" 1>&2
+    echo '***' "Please read the installation docs" 1>&2
+    exit 1
+fi
+
+# Decided to copy files instead of using symbolic links.
+#
+# Now for Mac and PC configurations we want to copy and not use symbolic
+# links. You can use this also for any platfrom you want.
+if [ -d ${srcdir}/config ]; then
+case "${host}" in
+  *-mac-*)             symbolic_link="cp -p" ;;
+  *-win-*)             symbolic_link="cp -p" ;;
+  *)                   symbolic_link="cp" ;;
+esac
+fi
+
+# post-target:
+
+# We don't have anything
+
+#
+# Local Variables:
+# fill-column: 131
+# End:
+#

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/djpeg.1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/djpeg.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/djpeg.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,253 @@
+.TH DJPEG 1 "22 August 1997"
+.SH NAME
+djpeg \- decompress a JPEG file to an image file
+.SH SYNOPSIS
+.B djpeg
+[
+.I options
+]
+[
+.I filename
+]
+.LP
+.SH DESCRIPTION
+.LP
+.B djpeg
+decompresses the named JPEG file, or the standard input if no file is named,
+and produces an image file on the standard output.  PBMPLUS (PPM/PGM), BMP,
+GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected.
+(RLE is supported only if the URT library is available.)
+.SH OPTIONS
+All switch names may be abbreviated; for example,
+.B \-grayscale
+may be written
+.B \-gray
+or
+.BR \-gr .
+Most of the "basic" switches can be abbreviated to as little as one letter.
+Upper and lower case are equivalent (thus
+.B \-BMP
+is the same as
+.BR \-bmp ).
+British spellings are also accepted (e.g.,
+.BR \-greyscale ),
+though for brevity these are not mentioned below.
+.PP
+The basic switches are:
+.TP
+.BI \-colors " N"
+Reduce image to at most N colors.  This reduces the number of colors used in
+the output image, so that it can be displayed on a colormapped display or
+stored in a colormapped file format.  For example, if you have an 8-bit
+display, you'd need to reduce to 256 or fewer colors.
+.TP
+.BI \-quantize " N"
+Same as
+.BR \-colors .
+.B \-colors
+is the recommended name,
+.B \-quantize
+is provided only for backwards compatibility.
+.TP
+.B \-fast
+Select recommended processing options for fast, low quality output.  (The
+default options are chosen for highest quality output.)  Currently, this is
+equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR.
+.TP
+.B \-grayscale
+Force gray-scale output even if JPEG file is color.  Useful for viewing on
+monochrome displays; also,
+.B djpeg
+runs noticeably faster in this mode.
+.TP
+.BI \-scale " M/N"
+Scale the output image by a factor M/N.  Currently the scale factor must be
+1/1, 1/2, 1/4, or 1/8.  Scaling is handy if the image is larger than your
+screen; also,
+.B djpeg
+runs much faster when scaling down the output.
+.TP
+.B \-bmp
+Select BMP output format (Windows flavor).  8-bit colormapped format is
+emitted if
+.B \-colors
+or
+.B \-grayscale
+is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color
+format is emitted.
+.TP
+.B \-gif
+Select GIF output format.  Since GIF does not support more than 256 colors,
+.B \-colors 256
+is assumed (unless you specify a smaller number of colors).
+.TP
+.B \-os2
+Select BMP output format (OS/2 1.x flavor).  8-bit colormapped format is
+emitted if
+.B \-colors
+or
+.B \-grayscale
+is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color
+format is emitted.
+.TP
+.B \-pnm
+Select PBMPLUS (PPM/PGM) output format (this is the default format).
+PGM is emitted if the JPEG file is gray-scale or if
+.B \-grayscale
+is specified; otherwise PPM is emitted.
+.TP
+.B \-rle
+Select RLE output format.  (Requires URT library.)
+.TP
+.B \-targa
+Select Targa output format.  Gray-scale format is emitted if the JPEG file is
+gray-scale or if
+.B \-grayscale
+is specified; otherwise, colormapped format is emitted if
+.B \-colors
+is specified; otherwise, 24-bit full-color format is emitted.
+.PP
+Switches for advanced users:
+.TP
+.B \-dct int
+Use integer DCT method (default).
+.TP
+.B \-dct fast
+Use fast integer DCT (less accurate).
+.TP
+.B \-dct float
+Use floating-point DCT method.
+The float method is very slightly more accurate than the int method, but is
+much slower unless your machine has very fast floating-point hardware.  Also
+note that results of the floating-point method may vary slightly across
+machines, while the integer methods should give the same results everywhere.
+The fast integer method is much less accurate than the other two.
+.TP
+.B \-dither fs
+Use Floyd-Steinberg dithering in color quantization.
+.TP
+.B \-dither ordered
+Use ordered dithering in color quantization.
+.TP
+.B \-dither none
+Do not use dithering in color quantization.
+By default, Floyd-Steinberg dithering is applied when quantizing colors; this
+is slow but usually produces the best results.  Ordered dither is a compromise
+between speed and quality; no dithering is fast but usually looks awful.  Note
+that these switches have no effect unless color quantization is being done.
+Ordered dither is only available in
+.B \-onepass
+mode.
+.TP
+.BI \-map " file"
+Quantize to the colors used in the specified image file.  This is useful for
+producing multiple files with identical color maps, or for forcing a
+predefined set of colors to be used.  The
+.I file
+must be a GIF or PPM file. This option overrides
+.B \-colors
+and
+.BR \-onepass .
+.TP
+.B \-nosmooth
+Use a faster, lower-quality upsampling routine.
+.TP
+.B \-onepass
+Use one-pass instead of two-pass color quantization.  The one-pass method is
+faster and needs less memory, but it produces a lower-quality image.
+.B \-onepass
+is ignored unless you also say
+.B \-colors
+.IR N .
+Also, the one-pass method is always used for gray-scale output (the two-pass
+method is no improvement then).
+.TP
+.BI \-maxmemory " N"
+Set limit for amount of memory to use in processing large images.  Value is
+in thousands of bytes, or millions of bytes if "M" is attached to the
+number.  For example,
+.B \-max 4m
+selects 4000000 bytes.  If more space is needed, temporary files will be used.
+.TP
+.BI \-outfile " name"
+Send output image to the named file, not to standard output.
+.TP
+.B \-verbose
+Enable debug printout.  More
+.BR \-v 's
+give more output.  Also, version information is printed at startup.
+.TP
+.B \-debug
+Same as
+.BR \-verbose .
+.SH EXAMPLES
+.LP
+This example decompresses the JPEG file foo.jpg, quantizes it to
+256 colors, and saves the output in 8-bit BMP format in foo.bmp:
+.IP
+.B djpeg \-colors 256 \-bmp
+.I foo.jpg
+.B >
+.I foo.bmp
+.SH HINTS
+To get a quick preview of an image, use the
+.B \-grayscale
+and/or
+.B \-scale
+switches.
+.B \-grayscale \-scale 1/8
+is the fastest case.
+.PP
+Several options are available that trade off image quality to gain speed.
+.B \-fast
+turns on the recommended settings.
+.PP
+.B \-dct fast
+and/or
+.B \-nosmooth
+gain speed at a small sacrifice in quality.
+When producing a color-quantized image,
+.B \-onepass \-dither ordered
+is fast but much lower quality than the default behavior.
+.B \-dither none
+may give acceptable results in two-pass mode, but is seldom tolerable in
+one-pass mode.
+.PP
+If you are fortunate enough to have very fast floating point hardware,
+\fB\-dct float\fR may be even faster than \fB\-dct fast\fR.  But on most
+machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is
+not worth using, because its theoretical accuracy advantage is too small to be
+significant in practice.
+.SH ENVIRONMENT
+.TP
+.B JPEGMEM
+If this environment variable is set, its value is the default memory limit.
+The value is specified as described for the
+.B \-maxmemory
+switch.
+.B JPEGMEM
+overrides the default value specified when the program was compiled, and
+itself is overridden by an explicit
+.BR \-maxmemory .
+.SH SEE ALSO
+.BR cjpeg (1),
+.BR jpegtran (1),
+.BR rdjpgcom (1),
+.BR wrjpgcom (1)
+.br
+.BR ppm (5),
+.BR pgm (5)
+.br
+Wallace, Gregory K.  "The JPEG Still Picture Compression Standard",
+Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
+.SH AUTHOR
+Independent JPEG Group
+.SH BUGS
+Arithmetic coding is not supported for legal reasons.
+.PP
+To avoid the Unisys LZW patent,
+.B djpeg
+produces uncompressed GIF files.  These are larger than they should be, but
+are readable by standard GIF decoders.
+.PP
+Still not as fast as we'd like.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/djpeg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/djpeg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/djpeg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,616 @@
+/*
+ * djpeg.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a command-line user interface for the JPEG decompressor.
+ * It should work on any system with Unix- or MS-DOS-style command lines.
+ *
+ * Two different command line styles are permitted, depending on the
+ * compile-time switch TWO_FILE_COMMANDLINE:
+ *	djpeg [options]  inputfile outputfile
+ *	djpeg [options]  [inputfile]
+ * In the second style, output is always to standard output, which you'd
+ * normally redirect to a file or pipe to some other program.  Input is
+ * either from a named file or from standard input (typically redirected).
+ * The second style is convenient on Unix but is unhelpful on systems that
+ * don't support pipes.  Also, you MUST use the first style if your system
+ * doesn't do binary I/O to stdin/stdout.
+ * To simplify script writing, the "-outfile" switch is provided.  The syntax
+ *	djpeg [options]  -outfile outputfile  inputfile
+ * works regardless of which command line style is used.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+#include "jversion.h"		/* for version message */
+
+#include <ctype.h>		/* to declare isprint() */
+
+#ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
+#ifdef __MWERKS__
+#include <SIOUX.h>              /* Metrowerks needs this */
+#include <console.h>		/* ... and this */
+#endif
+#ifdef THINK_C
+#include <console.h>		/* Think declares it here */
+#endif
+#endif
+
+
+/* Create the add-on message string table. */
+
+#define JMESSAGE(code,string)	string ,
+
+static const char * const cdjpeg_message_table[] = {
+#include "cderror.h"
+  NULL
+};
+
+
+/*
+ * This list defines the known output image formats
+ * (not all of which need be supported by a given version).
+ * You can change the default output format by defining DEFAULT_FMT;
+ * indeed, you had better do so if you undefine PPM_SUPPORTED.
+ */
+
+typedef enum {
+	FMT_BMP,		/* BMP format (Windows flavor) */
+	FMT_GIF,		/* GIF format */
+	FMT_OS2,		/* BMP format (OS/2 flavor) */
+	FMT_PPM,		/* PPM/PGM (PBMPLUS formats) */
+	FMT_RLE,		/* RLE format */
+	FMT_TARGA,		/* Targa format */
+	FMT_TIFF		/* TIFF format */
+} IMAGE_FORMATS;
+
+#ifndef DEFAULT_FMT		/* so can override from CFLAGS in Makefile */
+#define DEFAULT_FMT	FMT_PPM
+#endif
+
+static IMAGE_FORMATS requested_fmt;
+
+
+/*
+ * Argument-parsing code.
+ * The switch parser is designed to be useful with DOS-style command line
+ * syntax, ie, intermixed switches and file names, where only the switches
+ * to the left of a given file name affect processing of that file.
+ * The main program in this file doesn't actually use this capability...
+ */
+
+
+static const char * progname;	/* program name for error messages */
+static char * outfilename;	/* for -outfile switch */
+
+
+LOCAL(void)
+usage (void)
+/* complain about bad command line */
+{
+  fprintf(stderr, "usage: %s [switches] ", progname);
+#ifdef TWO_FILE_COMMANDLINE
+  fprintf(stderr, "inputfile outputfile\n");
+#else
+  fprintf(stderr, "[inputfile]\n");
+#endif
+
+  fprintf(stderr, "Switches (names may be abbreviated):\n");
+  fprintf(stderr, "  -colors N      Reduce image to no more than N colors\n");
+  fprintf(stderr, "  -fast          Fast, low-quality processing\n");
+  fprintf(stderr, "  -grayscale     Force grayscale output\n");
+#ifdef IDCT_SCALING_SUPPORTED
+  fprintf(stderr, "  -scale M/N     Scale output image by fraction M/N, eg, 1/8\n");
+#endif
+#ifdef BMP_SUPPORTED
+  fprintf(stderr, "  -bmp           Select BMP output format (Windows style)%s\n",
+	  (DEFAULT_FMT == FMT_BMP ? " (default)" : ""));
+#endif
+#ifdef GIF_SUPPORTED
+  fprintf(stderr, "  -gif           Select GIF output format%s\n",
+	  (DEFAULT_FMT == FMT_GIF ? " (default)" : ""));
+#endif
+#ifdef BMP_SUPPORTED
+  fprintf(stderr, "  -os2           Select BMP output format (OS/2 style)%s\n",
+	  (DEFAULT_FMT == FMT_OS2 ? " (default)" : ""));
+#endif
+#ifdef PPM_SUPPORTED
+  fprintf(stderr, "  -pnm           Select PBMPLUS (PPM/PGM) output format%s\n",
+	  (DEFAULT_FMT == FMT_PPM ? " (default)" : ""));
+#endif
+#ifdef RLE_SUPPORTED
+  fprintf(stderr, "  -rle           Select Utah RLE output format%s\n",
+	  (DEFAULT_FMT == FMT_RLE ? " (default)" : ""));
+#endif
+#ifdef TARGA_SUPPORTED
+  fprintf(stderr, "  -targa         Select Targa output format%s\n",
+	  (DEFAULT_FMT == FMT_TARGA ? " (default)" : ""));
+#endif
+  fprintf(stderr, "Switches for advanced users:\n");
+#ifdef DCT_ISLOW_SUPPORTED
+  fprintf(stderr, "  -dct int       Use integer DCT method%s\n",
+	  (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
+#endif
+#ifdef DCT_IFAST_SUPPORTED
+  fprintf(stderr, "  -dct fast      Use fast integer DCT (less accurate)%s\n",
+	  (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+  fprintf(stderr, "  -dct float     Use floating-point DCT method%s\n",
+	  (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
+#endif
+  fprintf(stderr, "  -dither fs     Use F-S dithering (default)\n");
+  fprintf(stderr, "  -dither none   Don't use dithering in quantization\n");
+  fprintf(stderr, "  -dither ordered  Use ordered dither (medium speed, quality)\n");
+#ifdef QUANT_2PASS_SUPPORTED
+  fprintf(stderr, "  -map FILE      Map to colors used in named image file\n");
+#endif
+  fprintf(stderr, "  -nosmooth      Don't use high-quality upsampling\n");
+#ifdef QUANT_1PASS_SUPPORTED
+  fprintf(stderr, "  -onepass       Use 1-pass quantization (fast, low quality)\n");
+#endif
+  fprintf(stderr, "  -maxmemory N   Maximum memory to use (in kbytes)\n");
+  fprintf(stderr, "  -outfile name  Specify name for output file\n");
+  fprintf(stderr, "  -verbose  or  -debug   Emit debug output\n");
+  exit(EXIT_FAILURE);
+}
+
+
+LOCAL(int)
+parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
+		int last_file_arg_seen, boolean for_real)
+/* Parse optional switches.
+ * Returns argv[] index of first file-name argument (== argc if none).
+ * Any file names with indexes <= last_file_arg_seen are ignored;
+ * they have presumably been processed in a previous iteration.
+ * (Pass 0 for last_file_arg_seen on the first or only iteration.)
+ * for_real is FALSE on the first (dummy) pass; we may skip any expensive
+ * processing.
+ */
+{
+  int argn;
+  char * arg;
+
+  /* Set up default JPEG parameters. */
+  requested_fmt = DEFAULT_FMT;	/* set default output file format */
+  outfilename = NULL;
+  cinfo->err->trace_level = 0;
+
+  /* Scan command line options, adjust parameters */
+
+  for (argn = 1; argn < argc; argn++) {
+    arg = argv[argn];
+    if (*arg != '-') {
+      /* Not a switch, must be a file name argument */
+      if (argn <= last_file_arg_seen) {
+	outfilename = NULL;	/* -outfile applies to just one input file */
+	continue;		/* ignore this name if previously processed */
+      }
+      break;			/* else done parsing switches */
+    }
+    arg++;			/* advance past switch marker character */
+
+    if (keymatch(arg, "bmp", 1)) {
+      /* BMP output format. */
+      requested_fmt = FMT_BMP;
+
+    } else if (keymatch(arg, "colors", 1) || keymatch(arg, "colours", 1) ||
+	       keymatch(arg, "quantize", 1) || keymatch(arg, "quantise", 1)) {
+      /* Do color quantization. */
+      int val;
+
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (sscanf(argv[argn], "%d", &val) != 1)
+	usage();
+      cinfo->desired_number_of_colors = val;
+      cinfo->quantize_colors = TRUE;
+
+    } else if (keymatch(arg, "dct", 2)) {
+      /* Select IDCT algorithm. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (keymatch(argv[argn], "int", 1)) {
+	cinfo->dct_method = JDCT_ISLOW;
+      } else if (keymatch(argv[argn], "fast", 2)) {
+	cinfo->dct_method = JDCT_IFAST;
+      } else if (keymatch(argv[argn], "float", 2)) {
+	cinfo->dct_method = JDCT_FLOAT;
+      } else
+	usage();
+
+    } else if (keymatch(arg, "dither", 2)) {
+      /* Select dithering algorithm. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (keymatch(argv[argn], "fs", 2)) {
+	cinfo->dither_mode = JDITHER_FS;
+      } else if (keymatch(argv[argn], "none", 2)) {
+	cinfo->dither_mode = JDITHER_NONE;
+      } else if (keymatch(argv[argn], "ordered", 2)) {
+	cinfo->dither_mode = JDITHER_ORDERED;
+      } else
+	usage();
+
+    } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
+      /* Enable debug printouts. */
+      /* On first -d, print version identification */
+      static boolean printed_version = FALSE;
+
+      if (! printed_version) {
+	fprintf(stderr, "Independent JPEG Group's DJPEG, version %s\n%s\n",
+		JVERSION, JCOPYRIGHT);
+	printed_version = TRUE;
+      }
+      cinfo->err->trace_level++;
+
+    } else if (keymatch(arg, "fast", 1)) {
+      /* Select recommended processing options for quick-and-dirty output. */
+      cinfo->two_pass_quantize = FALSE;
+      cinfo->dither_mode = JDITHER_ORDERED;
+      if (! cinfo->quantize_colors) /* don't override an earlier -colors */
+	cinfo->desired_number_of_colors = 216;
+      cinfo->dct_method = JDCT_FASTEST;
+      cinfo->do_fancy_upsampling = FALSE;
+
+    } else if (keymatch(arg, "gif", 1)) {
+      /* GIF output format. */
+      requested_fmt = FMT_GIF;
+
+    } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) {
+      /* Force monochrome output. */
+      cinfo->out_color_space = JCS_GRAYSCALE;
+
+    } else if (keymatch(arg, "map", 3)) {
+      /* Quantize to a color map taken from an input file. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (for_real) {		/* too expensive to do twice! */
+#ifdef QUANT_2PASS_SUPPORTED	/* otherwise can't quantize to supplied map */
+	FILE * mapfile;
+
+	if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) {
+	  fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
+	  exit(EXIT_FAILURE);
+	}
+	read_color_map(cinfo, mapfile);
+	fclose(mapfile);
+	cinfo->quantize_colors = TRUE;
+#else
+	ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+      }
+
+    } else if (keymatch(arg, "maxmemory", 3)) {
+      /* Maximum memory in Kb (or Mb with 'm'). */
+      long lval;
+      char ch = 'x';
+
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
+	usage();
+      if (ch == 'm' || ch == 'M')
+	lval *= 1000L;
+      cinfo->mem->max_memory_to_use = lval * 1000L;
+
+    } else if (keymatch(arg, "nosmooth", 3)) {
+      /* Suppress fancy upsampling */
+      cinfo->do_fancy_upsampling = FALSE;
+
+    } else if (keymatch(arg, "onepass", 3)) {
+      /* Use fast one-pass quantization. */
+      cinfo->two_pass_quantize = FALSE;
+
+    } else if (keymatch(arg, "os2", 3)) {
+      /* BMP output format (OS/2 flavor). */
+      requested_fmt = FMT_OS2;
+
+    } else if (keymatch(arg, "outfile", 4)) {
+      /* Set output file name. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      outfilename = argv[argn];	/* save it away for later use */
+
+    } else if (keymatch(arg, "pnm", 1) || keymatch(arg, "ppm", 1)) {
+      /* PPM/PGM output format. */
+      requested_fmt = FMT_PPM;
+
+    } else if (keymatch(arg, "rle", 1)) {
+      /* RLE output format. */
+      requested_fmt = FMT_RLE;
+
+    } else if (keymatch(arg, "scale", 1)) {
+      /* Scale the output image by a fraction M/N. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (sscanf(argv[argn], "%d/%d",
+		 &cinfo->scale_num, &cinfo->scale_denom) != 2)
+	usage();
+
+    } else if (keymatch(arg, "targa", 1)) {
+      /* Targa output format. */
+      requested_fmt = FMT_TARGA;
+
+    } else {
+      usage();			/* bogus switch */
+    }
+  }
+
+  return argn;			/* return index of next arg (file name) */
+}
+
+
+/*
+ * Marker processor for COM and interesting APPn markers.
+ * This replaces the library's built-in processor, which just skips the marker.
+ * We want to print out the marker as text, to the extent possible.
+ * Note this code relies on a non-suspending data source.
+ */
+
+LOCAL(unsigned int)
+jpeg_getc (j_decompress_ptr cinfo)
+/* Read next byte */
+{
+  struct jpeg_source_mgr * datasrc = cinfo->src;
+
+  if (datasrc->bytes_in_buffer == 0) {
+    if (! (*datasrc->fill_input_buffer) (cinfo))
+      ERREXIT(cinfo, JERR_CANT_SUSPEND);
+  }
+  datasrc->bytes_in_buffer--;
+  return GETJOCTET(*datasrc->next_input_byte++);
+}
+
+
+METHODDEF(boolean)
+print_text_marker (j_decompress_ptr cinfo)
+{
+  boolean traceit = (cinfo->err->trace_level >= 1);
+  INT32 length;
+  unsigned int ch;
+  unsigned int lastch = 0;
+
+  length = jpeg_getc(cinfo) << 8;
+  length += jpeg_getc(cinfo);
+  length -= 2;			/* discount the length word itself */
+
+  if (traceit) {
+    if (cinfo->unread_marker == JPEG_COM)
+      fprintf(stderr, "Comment, length %ld:\n", (long) length);
+    else			/* assume it is an APPn otherwise */
+      fprintf(stderr, "APP%d, length %ld:\n",
+	      cinfo->unread_marker - JPEG_APP0, (long) length);
+  }
+
+  while (--length >= 0) {
+    ch = jpeg_getc(cinfo);
+    if (traceit) {
+      /* Emit the character in a readable form.
+       * Nonprintables are converted to \nnn form,
+       * while \ is converted to \\.
+       * Newlines in CR, CR/LF, or LF form will be printed as one newline.
+       */
+      if (ch == '\r') {
+	fprintf(stderr, "\n");
+      } else if (ch == '\n') {
+	if (lastch != '\r')
+	  fprintf(stderr, "\n");
+      } else if (ch == '\\') {
+	fprintf(stderr, "\\\\");
+      } else if (isprint(ch)) {
+	putc(ch, stderr);
+      } else {
+	fprintf(stderr, "\\%03o", ch);
+      }
+      lastch = ch;
+    }
+  }
+
+  if (traceit)
+    fprintf(stderr, "\n");
+
+  return TRUE;
+}
+
+
+/*
+ * The main program.
+ */
+
+int
+main (int argc, char **argv)
+{
+  struct jpeg_decompress_struct cinfo;
+  struct jpeg_error_mgr jerr;
+#ifdef PROGRESS_REPORT
+  struct cdjpeg_progress_mgr progress;
+#endif
+  int file_index;
+  djpeg_dest_ptr dest_mgr = NULL;
+  FILE * input_file;
+  FILE * output_file;
+  JDIMENSION num_scanlines;
+
+  /* On Mac, fetch a command line. */
+#ifdef USE_CCOMMAND
+  argc = ccommand(&argv);
+#endif
+
+  progname = argv[0];
+  if (progname == NULL || progname[0] == 0)
+    progname = "djpeg";		/* in case C library doesn't provide it */
+
+  /* Initialize the JPEG decompression object with default error handling. */
+  cinfo.err = jpeg_std_error(&jerr);
+  jpeg_create_decompress(&cinfo);
+  /* Add some application-specific error messages (from cderror.h) */
+  jerr.addon_message_table = cdjpeg_message_table;
+  jerr.first_addon_message = JMSG_FIRSTADDONCODE;
+  jerr.last_addon_message = JMSG_LASTADDONCODE;
+
+  /* Insert custom marker processor for COM and APP12.
+   * APP12 is used by some digital camera makers for textual info,
+   * so we provide the ability to display it as text.
+   * If you like, additional APPn marker types can be selected for display,
+   * but don't try to override APP0 or APP14 this way (see libjpeg.doc).
+   */
+  jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker);
+  jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker);
+
+  /* Now safe to enable signal catcher. */
+#ifdef NEED_SIGNAL_CATCHER
+  enable_signal_catcher((j_common_ptr) &cinfo);
+#endif
+
+  /* Scan command line to find file names. */
+  /* It is convenient to use just one switch-parsing routine, but the switch
+   * values read here are ignored; we will rescan the switches after opening
+   * the input file.
+   * (Exception: tracing level set here controls verbosity for COM markers
+   * found during jpeg_read_header...)
+   */
+
+  file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);
+
+#ifdef TWO_FILE_COMMANDLINE
+  /* Must have either -outfile switch or explicit output file name */
+  if (outfilename == NULL) {
+    if (file_index != argc-2) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+	      progname);
+      usage();
+    }
+    outfilename = argv[file_index+1];
+  } else {
+    if (file_index != argc-1) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+	      progname);
+      usage();
+    }
+  }
+#else
+  /* Unix style: expect zero or one file name */
+  if (file_index < argc-1) {
+    fprintf(stderr, "%s: only one input file\n", progname);
+    usage();
+  }
+#endif /* TWO_FILE_COMMANDLINE */
+
+  /* Open the input file. */
+  if (file_index < argc) {
+    if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default input file is stdin */
+    input_file = read_stdin();
+  }
+
+  /* Open the output file. */
+  if (outfilename != NULL) {
+    if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default output file is stdout */
+    output_file = write_stdout();
+  }
+
+#ifdef PROGRESS_REPORT
+  start_progress_monitor((j_common_ptr) &cinfo, &progress);
+#endif
+
+  /* Specify data source for decompression */
+  jpeg_stdio_src(&cinfo, input_file);
+
+  /* Read file header, set default decompression parameters */
+  (void) jpeg_read_header(&cinfo, TRUE);
+
+  /* Adjust default decompression parameters by re-parsing the options */
+  file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
+
+  /* Initialize the output module now to let it override any crucial
+   * option settings (for instance, GIF wants to force color quantization).
+   */
+  switch (requested_fmt) {
+#ifdef BMP_SUPPORTED
+  case FMT_BMP:
+    dest_mgr = jinit_write_bmp(&cinfo, FALSE);
+    break;
+  case FMT_OS2:
+    dest_mgr = jinit_write_bmp(&cinfo, TRUE);
+    break;
+#endif
+#ifdef GIF_SUPPORTED
+  case FMT_GIF:
+    dest_mgr = jinit_write_gif(&cinfo);
+    break;
+#endif
+#ifdef PPM_SUPPORTED
+  case FMT_PPM:
+    dest_mgr = jinit_write_ppm(&cinfo);
+    break;
+#endif
+#ifdef RLE_SUPPORTED
+  case FMT_RLE:
+    dest_mgr = jinit_write_rle(&cinfo);
+    break;
+#endif
+#ifdef TARGA_SUPPORTED
+  case FMT_TARGA:
+    dest_mgr = jinit_write_targa(&cinfo);
+    break;
+#endif
+  default:
+    ERREXIT(&cinfo, JERR_UNSUPPORTED_FORMAT);
+    break;
+  }
+  dest_mgr->output_file = output_file;
+
+  /* Start decompressor */
+  (void) jpeg_start_decompress(&cinfo);
+
+  /* Write output file header */
+  (*dest_mgr->start_output) (&cinfo, dest_mgr);
+
+  /* Process data */
+  while (cinfo.output_scanline < cinfo.output_height) {
+    num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer,
+					dest_mgr->buffer_height);
+    (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines);
+  }
+
+#ifdef PROGRESS_REPORT
+  /* Hack: count final pass as done in case finish_output does an extra pass.
+   * The library won't have updated completed_passes.
+   */
+  progress.pub.completed_passes = progress.pub.total_passes;
+#endif
+
+  /* Finish decompression and release memory.
+   * I must do it in this order because output module has allocated memory
+   * of lifespan JPOOL_IMAGE; it needs to finish before releasing memory.
+   */
+  (*dest_mgr->finish_output) (&cinfo, dest_mgr);
+  (void) jpeg_finish_decompress(&cinfo);
+  jpeg_destroy_decompress(&cinfo);
+
+  /* Close files, if we opened them */
+  if (input_file != stdin)
+    fclose(input_file);
+  if (output_file != stdout)
+    fclose(output_file);
+
+#ifdef PROGRESS_REPORT
+  end_progress_monitor((j_common_ptr) &cinfo);
+#endif
+
+  /* All done. */
+  exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
+  return 0;			/* suppress no-return-value warnings */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/example.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/example.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/example.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,433 @@
+/*
+ * example.c
+ *
+ * This file illustrates how to use the IJG code as a subroutine library
+ * to read or write JPEG image files.  You should look at this code in
+ * conjunction with the documentation file libjpeg.doc.
+ *
+ * This code will not do anything useful as-is, but it may be helpful as a
+ * skeleton for constructing routines that call the JPEG library.  
+ *
+ * We present these routines in the same coding style used in the JPEG code
+ * (ANSI function definitions, etc); but you are of course free to code your
+ * routines in a different style if you prefer.
+ */
+
+#include <stdio.h>
+
+/*
+ * Include file for users of JPEG library.
+ * You will need to have included system headers that define at least
+ * the typedefs FILE and size_t before you can include jpeglib.h.
+ * (stdio.h is sufficient on ANSI-conforming systems.)
+ * You may also wish to include "jerror.h".
+ */
+
+#include "jpeglib.h"
+
+/*
+ * <setjmp.h> is used for the optional error recovery mechanism shown in
+ * the second part of the example.
+ */
+
+#include <setjmp.h>
+
+
+
+/******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/
+
+/* This half of the example shows how to feed data into the JPEG compressor.
+ * We present a minimal version that does not worry about refinements such
+ * as error recovery (the JPEG code will just exit() if it gets an error).
+ */
+
+
+/*
+ * IMAGE DATA FORMATS:
+ *
+ * The standard input image format is a rectangular array of pixels, with
+ * each pixel having the same number of "component" values (color channels).
+ * Each pixel row is an array of JSAMPLEs (which typically are unsigned chars).
+ * If you are working with color data, then the color values for each pixel
+ * must be adjacent in the row; for example, R,G,B,R,G,B,R,G,B,... for 24-bit
+ * RGB color.
+ *
+ * For this example, we'll assume that this data structure matches the way
+ * our application has stored the image in memory, so we can just pass a
+ * pointer to our image buffer.  In particular, let's say that the image is
+ * RGB color and is described by:
+ */
+
+extern JSAMPLE * image_buffer;	/* Points to large array of R,G,B-order data */
+extern int image_height;	/* Number of rows in image */
+extern int image_width;		/* Number of columns in image */
+
+
+/*
+ * Sample routine for JPEG compression.  We assume that the target file name
+ * and a compression quality factor are passed in.
+ */
+
+GLOBAL(void)
+write_JPEG_file (char * filename, int quality)
+{
+  /* This struct contains the JPEG compression parameters and pointers to
+   * working space (which is allocated as needed by the JPEG library).
+   * It is possible to have several such structures, representing multiple
+   * compression/decompression processes, in existence at once.  We refer
+   * to any one struct (and its associated working data) as a "JPEG object".
+   */
+  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;
+  /* More stuff */
+  FILE * outfile;		/* target file */
+  JSAMPROW row_pointer[1];	/* pointer to JSAMPLE row[s] */
+  int row_stride;		/* physical row width in image buffer */
+
+  /* Step 1: allocate and 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);
+  /* Now we can initialize the JPEG compression object. */
+  jpeg_create_compress(&cinfo);
+
+  /* Step 2: specify data destination (eg, a file) */
+  /* Note: steps 2 and 3 can be done in either order. */
+
+  /* Here we use the library-supplied code to send compressed data to a
+   * stdio stream.  You can also write your own code to do something else.
+   * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
+   * requires it in order to write binary files.
+   */
+  if ((outfile = fopen(filename, "wb")) == NULL) {
+    fprintf(stderr, "can't open %s\n", filename);
+    exit(1);
+  }
+  jpeg_stdio_dest(&cinfo, outfile);
+
+  /* Step 3: set parameters for compression */
+
+  /* First we supply a description of the input image.
+   * Four fields of the cinfo struct must be filled in:
+   */
+  cinfo.image_width = image_width; 	/* image width and height, in pixels */
+  cinfo.image_height = image_height;
+  cinfo.input_components = 3;		/* # of color components per pixel */
+  cinfo.in_color_space = JCS_RGB; 	/* colorspace of input image */
+  /* Now use the library's routine to set default compression parameters.
+   * (You must set at least cinfo.in_color_space before calling this,
+   * since the defaults depend on the source color space.)
+   */
+  jpeg_set_defaults(&cinfo);
+  /* Now you can set any non-default parameters you wish to.
+   * Here we just illustrate the use of quality (quantization table) scaling:
+   */
+  jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
+
+  /* Step 4: Start compressor */
+
+  /* TRUE ensures that we will write a complete interchange-JPEG file.
+   * Pass TRUE unless you are very sure of what you're doing.
+   */
+  jpeg_start_compress(&cinfo, TRUE);
+
+  /* Step 5: while (scan lines remain to be written) */
+  /*           jpeg_write_scanlines(...); */
+
+  /* Here we use the library's state variable cinfo.next_scanline as the
+   * loop counter, so that we don't have to keep track ourselves.
+   * To keep things simple, we pass one scanline per call; you can pass
+   * more if you wish, though.
+   */
+  row_stride = image_width * 3;	/* JSAMPLEs per row in image_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] = & image_buffer[cinfo.next_scanline * row_stride];
+    (void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
+  }
+
+  /* Step 6: Finish compression */
+
+  jpeg_finish_compress(&cinfo);
+  /* After finish_compress, we can close the output file. */
+  fclose(outfile);
+
+  /* Step 7: release JPEG compression object */
+
+  /* This is an important step since it will release a good deal of memory. */
+  jpeg_destroy_compress(&cinfo);
+
+  /* And we're done! */
+}
+
+
+/*
+ * SOME FINE POINTS:
+ *
+ * In the above loop, we ignored the return value of jpeg_write_scanlines,
+ * which is the number of scanlines actually written.  We could get away
+ * with this because we were only relying on the value of cinfo.next_scanline,
+ * which will be incremented correctly.  If you maintain additional loop
+ * variables then you should be careful to increment them properly.
+ * Actually, for output to a stdio stream you needn't worry, because
+ * then jpeg_write_scanlines will write all the lines passed (or else exit
+ * with a fatal error).  Partial writes can only occur if you use a data
+ * destination module that can demand suspension of the compressor.
+ * (If you don't know what that's for, you don't need it.)
+ *
+ * If the compressor requires full-image buffers (for entropy-coding
+ * optimization or a multi-scan JPEG file), it will create temporary
+ * files for anything that doesn't fit within the maximum-memory setting.
+ * (Note that temp files are NOT needed if you use the default parameters.)
+ * On some systems you may need to set up a signal handler to ensure that
+ * temporary files are deleted if the program is interrupted.  See libjpeg.doc.
+ *
+ * Scanlines MUST be supplied in top-to-bottom order if you want your JPEG
+ * files to be compatible with everyone else's.  If you cannot readily read
+ * your data in that order, you'll need an intermediate array to hold the
+ * image.  See rdtarga.c or rdbmp.c for examples of handling bottom-to-top
+ * source data using the JPEG code's internal virtual-array mechanisms.
+ */
+
+
+
+/******************** JPEG DECOMPRESSION SAMPLE INTERFACE *******************/
+
+/* This half of the example shows how to read data from the JPEG decompressor.
+ * It's a bit more refined than the above, in that we show:
+ *   (a) how to modify the JPEG library's standard error-reporting behavior;
+ *   (b) how to allocate workspace using the library's memory manager.
+ *
+ * Just to make this example a little different from the first one, we'll
+ * assume that we do not intend to put the whole image into an in-memory
+ * buffer, but to send it line-by-line someplace else.  We need a one-
+ * scanline-high JSAMPLE array as a work buffer, and we will let the JPEG
+ * memory manager allocate it for us.  This approach is actually quite useful
+ * because we don't need to remember to deallocate the buffer separately: it
+ * will go away automatically when the JPEG object is cleaned up.
+ */
+
+
+/*
+ * ERROR HANDLING:
+ *
+ * The JPEG library's standard error handler (jerror.c) is divided into
+ * several "methods" which you can override individually.  This lets you
+ * adjust the behavior without duplicating a lot of code, which you might
+ * have to update with each future release.
+ *
+ * Our example here shows how to override the "error_exit" method so that
+ * control is returned to the library's caller when a fatal error occurs,
+ * rather than calling exit() as the standard error_exit method does.
+ *
+ * We use C's setjmp/longjmp facility to return control.  This means that the
+ * routine which calls the JPEG library must first execute a setjmp() call to
+ * establish the return point.  We want the replacement error_exit to do a
+ * longjmp().  But we need to make the setjmp buffer accessible to the
+ * error_exit routine.  To do this, we make a private extension of the
+ * standard JPEG error handler object.  (If we were using C++, we'd say we
+ * were making a subclass of the regular error handler.)
+ *
+ * Here's the extended error handler struct:
+ */
+
+struct my_error_mgr {
+  struct jpeg_error_mgr pub;	/* "public" fields */
+
+  jmp_buf setjmp_buffer;	/* for return to caller */
+};
+
+typedef struct my_error_mgr * my_error_ptr;
+
+/*
+ * Here's the routine that will replace the standard error_exit method:
+ */
+
+METHODDEF(void)
+my_error_exit (j_common_ptr cinfo)
+{
+  /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
+  my_error_ptr myerr = (my_error_ptr) cinfo->err;
+
+  /* Always display the message. */
+  /* We could postpone this until after returning, if we chose. */
+  (*cinfo->err->output_message) (cinfo);
+
+  /* Return control to the setjmp point */
+  longjmp(myerr->setjmp_buffer, 1);
+}
+
+
+/*
+ * Sample routine for JPEG decompression.  We assume that the source file name
+ * is passed in.  We want to return 1 on success, 0 on error.
+ */
+
+
+GLOBAL(int)
+read_JPEG_file (char * filename)
+{
+  /* 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;
+  /* We use our private extension JPEG error handler.
+   * Note that this struct must live as long as the main JPEG parameter
+   * struct, to avoid dangling-pointer problems.
+   */
+  struct my_error_mgr jerr;
+  /* More stuff */
+  FILE * infile;		/* source file */
+  JSAMPARRAY buffer;		/* Output row buffer */
+  int row_stride;		/* physical row width in output buffer */
+
+  /* In this example we want to open the input file before doing anything else,
+   * so that the setjmp() error recovery below can assume the file is open.
+   * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
+   * requires it in order to read binary files.
+   */
+
+  if ((infile = fopen(filename, "rb")) == NULL) {
+    fprintf(stderr, "can't open %s\n", filename);
+    return 0;
+  }
+
+  /* Step 1: allocate and initialize JPEG decompression object */
+
+  /* We set up the normal JPEG error routines, then override error_exit. */
+  cinfo.err = jpeg_std_error(&jerr.pub);
+  jerr.pub.error_exit = my_error_exit;
+  /* Establish the setjmp return context for my_error_exit to use. */
+  if (setjmp(jerr.setjmp_buffer)) {
+    /* If we get here, the JPEG code has signaled an error.
+     * We need to clean up the JPEG object, close the input file, and return.
+     */
+    jpeg_destroy_decompress(&cinfo);
+    fclose(infile);
+    return 0;
+  }
+  /* Now we can initialize the JPEG decompression object. */
+  jpeg_create_decompress(&cinfo);
+
+  /* Step 2: specify data source (eg, a file) */
+
+  jpeg_stdio_src(&cinfo, infile);
+
+  /* Step 3: read file parameters with jpeg_read_header() */
+
+  (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.
+   */
+
+  /* Step 4: set parameters for decompression */
+
+  /* In this example, we don't need to change any of the defaults set by
+   * jpeg_read_header(), so we do nothing here.
+   */
+
+  /* Step 5: Start decompressor */
+
+  (void) jpeg_start_decompress(&cinfo);
+  /* We can ignore the return value since suspension is not possible
+   * with the stdio data source.
+   */
+
+  /* We may need to do some setup of our own at this point before reading
+   * the data.  After jpeg_start_decompress() we have the correct scaled
+   * output image dimensions available, as well as the output colormap
+   * if we asked for color quantization.
+   * In this example, we need to make an output work buffer of the right size.
+   */ 
+  /* JSAMPLEs per row in output buffer */
+  row_stride = cinfo.output_width * cinfo.output_components;
+  /* Make a one-row-high sample array that will go away when done with image */
+  buffer = (*cinfo.mem->alloc_sarray)
+		((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
+
+  /* Step 6: while (scan lines remain to be read) */
+  /*           jpeg_read_scanlines(...); */
+
+  /* Here we use the library's state variable cinfo.output_scanline as the
+   * loop counter, so that we don't have to keep track ourselves.
+   */
+  while (cinfo.output_scanline < cinfo.output_height) {
+    /* jpeg_read_scanlines expects an array of pointers to scanlines.
+     * Here the array is only one element long, but you could ask for
+     * more than one scanline at a time if that's more convenient.
+     */
+    (void) jpeg_read_scanlines(&cinfo, buffer, 1);
+    /* Assume put_scanline_someplace wants a pointer and sample count. */
+    put_scanline_someplace(buffer[0], row_stride);
+  }
+
+  /* Step 7: Finish decompression */
+
+  (void) jpeg_finish_decompress(&cinfo);
+  /* We can ignore the return value since suspension is not possible
+   * with the stdio data source.
+   */
+
+  /* Step 8: Release JPEG decompression object */
+
+  /* This is an important step since it will release a good deal of memory. */
+  jpeg_destroy_decompress(&cinfo);
+
+  /* After finish_decompress, we can close the input file.
+   * Here we postpone it until after no more JPEG errors are possible,
+   * so as to simplify the setjmp error logic above.  (Actually, I don't
+   * think that jpeg_destroy can do an error exit, but why assume anything...)
+   */
+  fclose(infile);
+
+  /* At this point you may want to check to see whether any corrupt-data
+   * warnings occurred (test whether jerr.pub.num_warnings is nonzero).
+   */
+
+  /* And we're done! */
+  return 1;
+}
+
+
+/*
+ * SOME FINE POINTS:
+ *
+ * In the above code, we ignored the return value of jpeg_read_scanlines,
+ * which is the number of scanlines actually read.  We could get away with
+ * this because we asked for only one line at a time and we weren't using
+ * a suspending data source.  See libjpeg.doc for more info.
+ *
+ * We cheated a bit by calling alloc_sarray() after jpeg_start_decompress();
+ * we should have done it beforehand to ensure that the space would be
+ * counted against the JPEG max_memory setting.  In some systems the above
+ * code would risk an out-of-memory error.  However, in general we don't
+ * know the output image dimensions before jpeg_start_decompress(), unless we
+ * call jpeg_calc_output_dimensions().  See libjpeg.doc for more about this.
+ *
+ * Scanlines are returned in the same order as they appear in the JPEG file,
+ * which is standardly top-to-bottom.  If you must emit data bottom-to-top,
+ * you can use one of the virtual arrays provided by the JPEG memory manager
+ * to invert the data.  See wrbmp.c for an example.
+ *
+ * As with compression, some operating modes may require temporary files.
+ * On some systems you may need to set up a signal handler to ensure that
+ * temporary files are deleted if the program is interrupted.  See libjpeg.doc.
+ */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/filelist.doc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/filelist.doc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/filelist.doc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,210 @@
+IJG JPEG LIBRARY:  FILE LIST
+
+Copyright (C) 1994-1998, Thomas G. Lane.
+This file is part of the Independent JPEG Group's software.
+For conditions of distribution and use, see the accompanying README file.
+
+
+Here is a road map to the files in the IJG JPEG distribution.  The
+distribution includes the JPEG library proper, plus two application
+programs ("cjpeg" and "djpeg") which use the library to convert JPEG
+files to and from some other popular image formats.  A third application
+"jpegtran" uses the library to do lossless conversion between different
+variants of JPEG.  There are also two stand-alone applications,
+"rdjpgcom" and "wrjpgcom".
+
+
+THE JPEG LIBRARY
+================
+
+Include files:
+
+jpeglib.h	JPEG library's exported data and function declarations.
+jconfig.h	Configuration declarations.  Note: this file is not present
+		in the distribution; it is generated during installation.
+jmorecfg.h	Additional configuration declarations; need not be changed
+		for a standard installation.
+jerror.h	Declares JPEG library's error and trace message codes.
+jinclude.h	Central include file used by all IJG .c files to reference
+		system include files.
+jpegint.h	JPEG library's internal data structures.
+jchuff.h	Private declarations for Huffman encoder modules.
+jdhuff.h	Private declarations for Huffman decoder modules.
+jdct.h		Private declarations for forward & reverse DCT subsystems.
+jmemsys.h	Private declarations for memory management subsystem.
+jversion.h	Version information.
+
+Applications using the library should include jpeglib.h (which in turn
+includes jconfig.h and jmorecfg.h).  Optionally, jerror.h may be included
+if the application needs to reference individual JPEG error codes.  The
+other include files are intended for internal use and would not normally
+be included by an application program.  (cjpeg/djpeg/etc do use jinclude.h,
+since its function is to improve portability of the whole IJG distribution.
+Most other applications will directly include the system include files they
+want, and hence won't need jinclude.h.)
+
+
+C source code files:
+
+These files contain most of the functions intended to be called directly by
+an application program:
+
+jcapimin.c	Application program interface: core routines for compression.
+jcapistd.c	Application program interface: standard compression.
+jdapimin.c	Application program interface: core routines for decompression.
+jdapistd.c	Application program interface: standard decompression.
+jcomapi.c	Application program interface routines common to compression
+		and decompression.
+jcparam.c	Compression parameter setting helper routines.
+jctrans.c	API and library routines for transcoding compression.
+jdtrans.c	API and library routines for transcoding decompression.
+
+Compression side of the library:
+
+jcinit.c	Initialization: determines which other modules to use.
+jcmaster.c	Master control: setup and inter-pass sequencing logic.
+jcmainct.c	Main buffer controller (preprocessor => JPEG compressor).
+jcprepct.c	Preprocessor buffer controller.
+jccoefct.c	Buffer controller for DCT coefficient buffer.
+jccolor.c	Color space conversion.
+jcsample.c	Downsampling.
+jcdctmgr.c	DCT manager (DCT implementation selection & control).
+jfdctint.c	Forward DCT using slow-but-accurate integer method.
+jfdctfst.c	Forward DCT using faster, less accurate integer method.
+jfdctflt.c	Forward DCT using floating-point arithmetic.
+jchuff.c	Huffman entropy coding for sequential JPEG.
+jcphuff.c	Huffman entropy coding for progressive JPEG.
+jcmarker.c	JPEG marker writing.
+jdatadst.c	Data destination manager for stdio output.
+
+Decompression side of the library:
+
+jdmaster.c	Master control: determines which other modules to use.
+jdinput.c	Input controller: controls input processing modules.
+jdmainct.c	Main buffer controller (JPEG decompressor => postprocessor).
+jdcoefct.c	Buffer controller for DCT coefficient buffer.
+jdpostct.c	Postprocessor buffer controller.
+jdmarker.c	JPEG marker reading.
+jdhuff.c	Huffman entropy decoding for sequential JPEG.
+jdphuff.c	Huffman entropy decoding for progressive JPEG.
+jddctmgr.c	IDCT manager (IDCT implementation selection & control).
+jidctint.c	Inverse DCT using slow-but-accurate integer method.
+jidctfst.c	Inverse DCT using faster, less accurate integer method.
+jidctflt.c	Inverse DCT using floating-point arithmetic.
+jidctred.c	Inverse DCTs with reduced-size outputs.
+jdsample.c	Upsampling.
+jdcolor.c	Color space conversion.
+jdmerge.c	Merged upsampling/color conversion (faster, lower quality).
+jquant1.c	One-pass color quantization using a fixed-spacing colormap.
+jquant2.c	Two-pass color quantization using a custom-generated colormap.
+		Also handles one-pass quantization to an externally given map.
+jdatasrc.c	Data source manager for stdio input.
+
+Support files for both compression and decompression:
+
+jerror.c	Standard error handling routines (application replaceable).
+jmemmgr.c	System-independent (more or less) memory management code.
+jutils.c	Miscellaneous utility routines.
+
+jmemmgr.c relies on a system-dependent memory management module.  The IJG
+distribution includes the following implementations of the system-dependent
+module:
+
+jmemnobs.c	"No backing store": assumes adequate virtual memory exists.
+jmemansi.c	Makes temporary files with ANSI-standard routine tmpfile().
+jmemname.c	Makes temporary files with program-generated file names.
+jmemdos.c	Custom implementation for MS-DOS (16-bit environment only):
+		can use extended and expanded memory as well as temp files.
+jmemmac.c	Custom implementation for Apple Macintosh.
+
+Exactly one of the system-dependent modules should be configured into an
+installed JPEG library (see install.doc for hints about which one to use).
+On unusual systems you may find it worthwhile to make a special
+system-dependent memory manager.
+
+
+Non-C source code files:
+
+jmemdosa.asm	80x86 assembly code support for jmemdos.c; used only in
+		MS-DOS-specific configurations of the JPEG library.
+
+
+CJPEG/DJPEG/JPEGTRAN
+====================
+
+Include files:
+
+cdjpeg.h	Declarations shared by cjpeg/djpeg/jpegtran modules.
+cderror.h	Additional error and trace message codes for cjpeg et al.
+transupp.h	Declarations for jpegtran support routines in transupp.c.
+
+C source code files:
+
+cjpeg.c		Main program for cjpeg.
+djpeg.c		Main program for djpeg.
+jpegtran.c	Main program for jpegtran.
+cdjpeg.c	Utility routines used by all three programs.
+rdcolmap.c	Code to read a colormap file for djpeg's "-map" switch.
+rdswitch.c	Code to process some of cjpeg's more complex switches.
+		Also used by jpegtran.
+transupp.c	Support code for jpegtran: lossless image manipulations.
+
+Image file reader modules for cjpeg:
+
+rdbmp.c		BMP file input.
+rdgif.c		GIF file input (now just a stub).
+rdppm.c		PPM/PGM file input.
+rdrle.c		Utah RLE file input.
+rdtarga.c	Targa file input.
+
+Image file writer modules for djpeg:
+
+wrbmp.c		BMP file output.
+wrgif.c		GIF file output (a mere shadow of its former self).
+wrppm.c		PPM/PGM file output.
+wrrle.c		Utah RLE file output.
+wrtarga.c	Targa file output.
+
+
+RDJPGCOM/WRJPGCOM
+=================
+
+C source code files:
+
+rdjpgcom.c	Stand-alone rdjpgcom application.
+wrjpgcom.c	Stand-alone wrjpgcom application.
+
+These programs do not depend on the IJG library.  They do use
+jconfig.h and jinclude.h, only to improve portability.
+
+
+ADDITIONAL FILES
+================
+
+Documentation (see README for a guide to the documentation files):
+
+README		Master documentation file.
+*.doc		Other documentation files.
+*.1		Documentation in Unix man page format.
+change.log	Version-to-version change highlights.
+example.c	Sample code for calling JPEG library.
+
+Configuration/installation files and programs (see install.doc for more info):
+
+configure	Unix shell script to perform automatic configuration.
+ltconfig	Support scripts for configure (from GNU libtool).
+ltmain.sh
+config.guess
+config.sub
+install-sh	Install shell script for those Unix systems lacking one.
+ckconfig.c	Program to generate jconfig.h on non-Unix systems.
+jconfig.doc	Template for making jconfig.h by hand.
+makefile.*	Sample makefiles for particular systems.
+jconfig.*	Sample jconfig.h for particular systems.
+ansi2knr.c	De-ANSIfier for pre-ANSI C compilers (courtesy of
+		L. Peter Deutsch and Aladdin Enterprises).
+
+Test files (see install.doc for test procedure):
+
+test*.*		Source and comparison files for confidence test.
+		These are binary image files, NOT text files.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/install-sh
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/install-sh	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/install-sh	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,250 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# 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.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "install:	no input file specified"
+	exit 1
+else
+	true
+fi
+
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+	
+	if [ -d $dst ]; then
+		instcmd=:
+	else
+		instcmd=mkdir
+	fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f $src -o -d $src ]
+	then
+		true
+	else
+		echo "install:  $src does not exist"
+		exit 1
+	fi
+	
+	if [ x"$dst" = x ]
+	then
+		echo "install:	no destination specified"
+		exit 1
+	else
+		true
+	fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+	if [ -d $dst ]
+	then
+		dst="$dst"/`basename $src`
+	else
+		true
+	fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='	
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp="${pathcomp}${1}"
+	shift
+
+	if [ ! -d "${pathcomp}" ] ;
+        then
+		$mkdirprog "${pathcomp}"
+	else
+		true
+	fi
+
+	pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd $dst &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+	if [ x"$transformarg" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		dstfile=`basename $dst $transformbasename | 
+			sed $transformarg`$transformbasename
+	fi
+
+# don't allow the sed command to completely eliminate the filename
+
+	if [ x"$dstfile" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		true
+	fi
+
+# Make a temp file name in the proper directory.
+
+	dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+	$doit $instcmd $src $dsttmp &&
+
+	trap "rm -f ${dsttmp}" 0 &&
+
+# 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 $instcmd $src $dsttmp" command.
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+	$doit $rmcmd -f $dstdir/$dstfile &&
+	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/install-sh
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/install.doc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/install.doc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/install.doc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1063 @@
+INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software
+
+Copyright (C) 1991-1998, Thomas G. Lane.
+This file is part of the Independent JPEG Group's software.
+For conditions of distribution and use, see the accompanying README file.
+
+
+This file explains how to configure and install the IJG software.  We have
+tried to make this software extremely portable and flexible, so that it can be
+adapted to almost any environment.  The downside of this decision is that the
+installation process is complicated.  We have provided shortcuts to simplify
+the task on common systems.  But in any case, you will need at least a little
+familiarity with C programming and program build procedures for your system.
+
+If you are only using this software as part of a larger program, the larger
+program's installation procedure may take care of configuring the IJG code.
+For example, Ghostscript's installation script will configure the IJG code.
+You don't need to read this file if you just want to compile Ghostscript.
+
+If you are on a Unix machine, you may not need to read this file at all.
+Try doing
+	./configure
+	make
+	make test
+If that doesn't complain, do
+	make install
+(better do "make -n install" first to see if the makefile will put the files
+where you want them).  Read further if you run into snags or want to customize
+the code for your system.
+
+
+TABLE OF CONTENTS
+-----------------
+
+Before you start
+Configuring the software:
+	using the automatic "configure" script
+	using one of the supplied jconfig and makefile files
+	by hand
+Building the software
+Testing the software
+Installing the software
+Optional stuff
+Optimization
+Hints for specific systems
+
+
+BEFORE YOU START
+================
+
+Before installing the software you must unpack the distributed source code.
+Since you are reading this file, you have probably already succeeded in this
+task.  However, there is a potential for error if you needed to convert the
+files to the local standard text file format (for example, if you are on
+MS-DOS you may have converted LF end-of-line to CR/LF).  You must apply
+such conversion to all the files EXCEPT those whose names begin with "test".
+The test files contain binary data; if you change them in any way then the
+self-test will give bad results.
+
+Please check the last section of this file to see if there are hints for the
+specific machine or compiler you are using.
+
+
+CONFIGURING THE SOFTWARE
+========================
+
+To configure the IJG code for your system, you need to create two files:
+  * jconfig.h: contains values for system-dependent #define symbols.
+  * Makefile: controls the compilation process.
+(On a non-Unix machine, you may create "project files" or some other
+substitute for a Makefile.  jconfig.h is needed in any environment.)
+
+We provide three different ways to generate these files:
+  * On a Unix system, you can just run the "configure" script.
+  * We provide sample jconfig files and makefiles for popular machines;
+    if your machine matches one of the samples, just copy the right sample
+    files to jconfig.h and Makefile.
+  * If all else fails, read the instructions below and make your own files.
+
+
+Configuring the software using the automatic "configure" script
+---------------------------------------------------------------
+
+If you are on a Unix machine, you can just type
+	./configure
+and let the configure script construct appropriate configuration files.
+If you're using "csh" on an old version of System V, you might need to type
+	sh configure
+instead to prevent csh from trying to execute configure itself.
+Expect configure to run for a few minutes, particularly on slower machines;
+it works by compiling a series of test programs.
+
+Configure was created with GNU Autoconf and it follows the usual conventions
+for GNU configure scripts.  It makes a few assumptions that you may want to
+override.  You can do this by providing optional switches to configure:
+
+* If you want to build libjpeg as a shared library, say
+	./configure --enable-shared
+To get both shared and static libraries, say
+	./configure --enable-shared --enable-static
+Note that these switches invoke GNU libtool to take care of system-dependent
+shared library building methods.  If things don't work this way, please try
+running configure without either switch; that should build a static library
+without using libtool.  If that works, your problem is probably with libtool
+not with the IJG code.  libtool is fairly new and doesn't support all flavors
+of Unix yet.  (You might be able to find a newer version of libtool than the
+one included with libjpeg; see ftp.gnu.org.  Report libtool problems to
+bug-libtool at gnu.org.)
+
+* Configure will use gcc (GNU C compiler) if it's available, otherwise cc.
+To force a particular compiler to be selected, use the CC option, for example
+	./configure CC='cc'
+The same method can be used to include any unusual compiler switches.
+For example, on HP-UX you probably want to say
+	./configure CC='cc -Aa'
+to get HP's compiler to run in ANSI mode.
+
+* The default CFLAGS setting is "-O" for non-gcc compilers, "-O2" for gcc.
+You can override this by saying, for example,
+	./configure CFLAGS='-g'
+if you want to compile with debugging support.
+
+* Configure will set up the makefile so that "make install" will install files
+into /usr/local/bin, /usr/local/man, etc.  You can specify an installation
+prefix other than "/usr/local" by giving configure the option "--prefix=PATH".
+
+* If you don't have a lot of swap space, you may need to enable the IJG
+software's internal virtual memory mechanism.  To do this, give the option
+"--enable-maxmem=N" where N is the default maxmemory limit in megabytes.
+This is discussed in more detail under "Selecting a memory manager", below.
+You probably don't need to worry about this on reasonably-sized Unix machines,
+unless you plan to process very large images.
+
+Configure has some other features that are useful if you are cross-compiling
+or working in a network of multiple machine types; but if you need those
+features, you probably already know how to use them.
+
+
+Configuring the software using one of the supplied jconfig and makefile files
+-----------------------------------------------------------------------------
+
+If you have one of these systems, you can just use the provided configuration
+files:
+
+Makefile	jconfig file	System and/or compiler
+
+makefile.manx	jconfig.manx	Amiga, Manx Aztec C
+makefile.sas	jconfig.sas	Amiga, SAS C
+makeproj.mac	jconfig.mac	Apple Macintosh, Metrowerks CodeWarrior
+mak*jpeg.st	jconfig.st	Atari ST/STE/TT, Pure C or Turbo C
+makefile.bcc	jconfig.bcc	MS-DOS or OS/2, Borland C
+makefile.dj	jconfig.dj	MS-DOS, DJGPP (Delorie's port of GNU C)
+makefile.mc6	jconfig.mc6	MS-DOS, Microsoft C (16-bit only)
+makefile.wat	jconfig.wat	MS-DOS, OS/2, or Windows NT, Watcom C
+makefile.vc	jconfig.vc	Windows NT/95, MS Visual C++
+make*.ds	jconfig.vc	Windows NT/95, MS Developer Studio
+makefile.mms	jconfig.vms	Digital VMS, with MMS software
+makefile.vms	jconfig.vms	Digital VMS, without MMS software
+
+Copy the proper jconfig file to jconfig.h and the makefile to Makefile (or
+whatever your system uses as the standard makefile name).  For more info see
+the appropriate system-specific hints section near the end of this file.
+
+
+Configuring the software by hand
+--------------------------------
+
+First, generate a jconfig.h file.  If you are moderately familiar with C,
+the comments in jconfig.doc should be enough information to do this; just
+copy jconfig.doc to jconfig.h and edit it appropriately.  Otherwise, you may
+prefer to use the ckconfig.c program.  You will need to compile and execute
+ckconfig.c by hand --- we hope you know at least enough to do that.
+ckconfig.c may not compile the first try (in fact, the whole idea is for it
+to fail if anything is going to).  If you get compile errors, fix them by
+editing ckconfig.c according to the directions given in ckconfig.c.  Once
+you get it to run, it will write a suitable jconfig.h file, and will also
+print out some advice about which makefile to use.
+
+You may also want to look at the canned jconfig files, if there is one for a
+system similar to yours.
+
+Second, select a makefile and copy it to Makefile (or whatever your system
+uses as the standard makefile name).  The most generic makefiles we provide
+are
+	makefile.ansi:	if your C compiler supports function prototypes
+	makefile.unix:	if not.
+(You have function prototypes if ckconfig.c put "#define HAVE_PROTOTYPES"
+in jconfig.h.)  You may want to start from one of the other makefiles if
+there is one for a system similar to yours.
+
+Look over the selected Makefile and adjust options as needed.  In particular
+you may want to change the CC and CFLAGS definitions.  For instance, if you
+are using GCC, set CC=gcc.  If you had to use any compiler switches to get
+ckconfig.c to work, make sure the same switches are in CFLAGS.
+
+If you are on a system that doesn't use makefiles, you'll need to set up
+project files (or whatever you do use) to compile all the source files and
+link them into executable files cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom.
+See the file lists in any of the makefiles to find out which files go into
+each program.  Note that the provided makefiles all make a "library" file
+libjpeg first, but you don't have to do that if you don't want to; the file
+lists identify which source files are actually needed for compression,
+decompression, or both.  As a last resort, you can make a batch script that
+just compiles everything and links it all together; makefile.vms is an example
+of this (it's for VMS systems that have no make-like utility).
+
+Here are comments about some specific configuration decisions you'll
+need to make:
+
+Command line style
+------------------
+
+These programs can use a Unix-like command line style which supports
+redirection and piping, like this:
+	cjpeg inputfile >outputfile
+	cjpeg <inputfile >outputfile
+	source program | cjpeg >outputfile
+The simpler "two file" command line style is just
+	cjpeg inputfile outputfile
+You may prefer the two-file style, particularly if you don't have pipes.
+
+You MUST use two-file style on any system that doesn't cope well with binary
+data fed through stdin/stdout; this is true for some MS-DOS compilers, for
+example.  If you're not on a Unix system, it's safest to assume you need
+two-file style.  (But if your compiler provides either the Posix-standard
+fdopen() library routine or a Microsoft-compatible setmode() routine, you
+can safely use the Unix command line style, by defining USE_FDOPEN or
+USE_SETMODE respectively.)
+
+To use the two-file style, make jconfig.h say "#define TWO_FILE_COMMANDLINE".
+
+Selecting a memory manager
+--------------------------
+
+The IJG code is capable of working on images that are too big to fit in main
+memory; data is swapped out to temporary files as necessary.  However, the
+code to do this is rather system-dependent.  We provide five different
+memory managers:
+
+* jmemansi.c	This version uses the ANSI-standard library routine tmpfile(),
+		which not all non-ANSI systems have.  On some systems
+		tmpfile() may put the temporary file in a non-optimal
+		location; if you don't like what it does, use jmemname.c.
+
+* jmemname.c	This version creates named temporary files.  For anything
+		except a Unix machine, you'll need to configure the
+		select_file_name() routine appropriately; see the comments
+		near the head of jmemname.c.  If you use this version, define
+		NEED_SIGNAL_CATCHER in jconfig.h to make sure the temp files
+		are removed if the program is aborted.
+
+* jmemnobs.c	(That stands for No Backing Store :-).)  This will compile on
+		almost any system, but it assumes you have enough main memory
+		or virtual memory to hold the biggest images you work with.
+
+* jmemdos.c	This should be used with most 16-bit MS-DOS compilers.
+		See the system-specific notes about MS-DOS for more info.
+		IMPORTANT: if you use this, define USE_MSDOS_MEMMGR in
+		jconfig.h, and include the assembly file jmemdosa.asm in the
+		programs.  The supplied makefiles and jconfig files for
+		16-bit MS-DOS compilers already do both.
+
+* jmemmac.c	Custom version for Apple Macintosh; see the system-specific
+		notes for Macintosh for more info.
+
+To use a particular memory manager, change the SYSDEPMEM variable in your
+makefile to equal the corresponding object file name (for example, jmemansi.o
+or jmemansi.obj for jmemansi.c).
+
+If you have plenty of (real or virtual) main memory, just use jmemnobs.c.
+"Plenty" means about ten bytes for every pixel in the largest images
+you plan to process, so a lot of systems don't meet this criterion.
+If yours doesn't, try jmemansi.c first.  If that doesn't compile, you'll have
+to use jmemname.c; be sure to adjust select_file_name() for local conditions.
+You may also need to change unlink() to remove() in close_backing_store().
+
+Except with jmemnobs.c or jmemmac.c, you need to adjust the DEFAULT_MAX_MEM
+setting to a reasonable value for your system (either by adding a #define for
+DEFAULT_MAX_MEM to jconfig.h, or by adding a -D switch to the Makefile).
+This value limits the amount of data space the program will attempt to
+allocate.  Code and static data space isn't counted, so the actual memory
+needs for cjpeg or djpeg are typically 100 to 150Kb more than the max-memory
+setting.  Larger max-memory settings reduce the amount of I/O needed to
+process a large image, but too large a value can result in "insufficient
+memory" failures.  On most Unix machines (and other systems with virtual
+memory), just set DEFAULT_MAX_MEM to several million and forget it.  At the
+other end of the spectrum, for MS-DOS machines you probably can't go much
+above 300K to 400K.  (On MS-DOS the value refers to conventional memory only.
+Extended/expanded memory is handled separately by jmemdos.c.)
+
+
+BUILDING THE SOFTWARE
+=====================
+
+Now you should be able to compile the software.  Just say "make" (or
+whatever's necessary to start the compilation).  Have a cup of coffee.
+
+Here are some things that could go wrong:
+
+If your compiler complains about undefined structures, you should be able to
+shut it up by putting "#define INCOMPLETE_TYPES_BROKEN" in jconfig.h.
+
+If you have trouble with missing system include files or inclusion of the
+wrong ones, read jinclude.h.  This shouldn't happen if you used configure
+or ckconfig.c to set up jconfig.h.
+
+There are a fair number of routines that do not use all of their parameters;
+some compilers will issue warnings about this, which you can ignore.  There
+are also a few configuration checks that may give "unreachable code" warnings.
+Any other warning deserves investigation.
+
+If you don't have a getenv() library routine, define NO_GETENV.
+
+Also see the system-specific hints, below.
+
+
+TESTING THE SOFTWARE
+====================
+
+As a quick test of functionality we've included a small sample image in
+several forms:
+	testorig.jpg	Starting point for the djpeg tests.
+	testimg.ppm	The output of djpeg testorig.jpg
+	testimg.bmp	The output of djpeg -bmp -colors 256 testorig.jpg
+	testimg.jpg	The output of cjpeg testimg.ppm
+	testprog.jpg	Progressive-mode equivalent of testorig.jpg.
+	testimgp.jpg	The output of cjpeg -progressive -optimize testimg.ppm
+(The first- and second-generation .jpg files aren't identical since JPEG is
+lossy.)  If you can generate duplicates of the testimg* files then you
+probably have working programs.
+
+With most of the makefiles, "make test" will perform the necessary
+comparisons.
+
+If you're using a makefile that doesn't provide the test option, run djpeg
+and cjpeg by hand and compare the output files to testimg* with whatever
+binary file comparison tool you have.  The files should be bit-for-bit
+identical.
+
+If the programs complain "MAX_ALLOC_CHUNK is wrong, please fix", then you
+need to reduce MAX_ALLOC_CHUNK to a value that fits in type size_t.
+Try adding "#define MAX_ALLOC_CHUNK 65520L" to jconfig.h.  A less likely
+configuration error is "ALIGN_TYPE is wrong, please fix": defining ALIGN_TYPE
+as long should take care of that one.
+
+If the cjpeg test run fails with "Missing Huffman code table entry", it's a
+good bet that you needed to define RIGHT_SHIFT_IS_UNSIGNED.  Go back to the
+configuration step and run ckconfig.c.  (This is a good plan for any other
+test failure, too.)
+
+If you are using Unix (one-file) command line style on a non-Unix system,
+it's a good idea to check that binary I/O through stdin/stdout actually
+works.  You should get the same results from "djpeg <testorig.jpg >out.ppm"
+as from "djpeg -outfile out.ppm testorig.jpg".  Note that the makefiles all
+use the latter style and therefore do not exercise stdin/stdout!  If this
+check fails, try recompiling with USE_SETMODE or USE_FDOPEN defined.
+If it still doesn't work, better use two-file style.
+
+If you chose a memory manager other than jmemnobs.c, you should test that
+temporary-file usage works.  Try "djpeg -bmp -colors 256 -max 0 testorig.jpg"
+and make sure its output matches testimg.bmp.  If you have any really large
+images handy, try compressing them with -optimize and/or decompressing with
+-colors 256 to make sure your DEFAULT_MAX_MEM setting is not too large.
+
+NOTE: this is far from an exhaustive test of the JPEG software; some modules,
+such as 1-pass color quantization, are not exercised at all.  It's just a
+quick test to give you some confidence that you haven't missed something
+major.
+
+
+INSTALLING THE SOFTWARE
+=======================
+
+Once you're done with the above steps, you can install the software by
+copying the executable files (cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom)
+to wherever you normally install programs.  On Unix systems, you'll also want
+to put the man pages (cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1)
+in the man-page directory.  The pre-fab makefiles don't support this step
+since there's such a wide variety of installation procedures on different
+systems.
+
+If you generated a Makefile with the "configure" script, you can just say
+	make install
+to install the programs and their man pages into the standard places.
+(You'll probably need to be root to do this.)  We recommend first saying
+	make -n install
+to see where configure thought the files should go.  You may need to edit
+the Makefile, particularly if your system's conventions for man page
+filenames don't match what configure expects.
+
+If you want to install the IJG library itself, for use in compiling other
+programs besides ours, then you need to put the four include files
+	jpeglib.h jerror.h jconfig.h jmorecfg.h
+into your include-file directory, and put the library file libjpeg.a
+(extension may vary depending on system) wherever library files go.
+If you generated a Makefile with "configure", it will do what it thinks
+is the right thing if you say
+	make install-lib
+
+
+OPTIONAL STUFF
+==============
+
+Progress monitor:
+
+If you like, you can #define PROGRESS_REPORT (in jconfig.h) to enable display
+of percent-done progress reports.  The routine provided in cdjpeg.c merely
+prints percentages to stderr, but you can customize it to do something
+fancier.
+
+Utah RLE file format support:
+
+We distribute the software with support for RLE image files (Utah Raster
+Toolkit format) disabled, because the RLE support won't compile without the
+Utah library.  If you have URT version 3.1 or later, you can enable RLE
+support as follows:
+	1.  #define RLE_SUPPORTED in jconfig.h.
+	2.  Add a -I option to CFLAGS in the Makefile for the directory
+	    containing the URT .h files (typically the "include"
+	    subdirectory of the URT distribution).
+	3.  Add -L... -lrle to LDLIBS in the Makefile, where ... specifies
+	    the directory containing the URT "librle.a" file (typically the
+	    "lib" subdirectory of the URT distribution).
+
+Support for 12-bit-deep pixel data:
+
+The JPEG standard allows either 8-bit or 12-bit data precision.  (For color,
+this means 8 or 12 bits per channel, of course.)  If you need to work with
+deeper than 8-bit data, you can compile the IJG code for 12-bit operation.
+To do so:
+  1. In jmorecfg.h, define BITS_IN_JSAMPLE as 12 rather than 8.
+  2. In jconfig.h, undefine BMP_SUPPORTED, RLE_SUPPORTED, and TARGA_SUPPORTED,
+     because the code for those formats doesn't handle 12-bit data and won't
+     even compile.  (The PPM code does work, as explained below.  The GIF
+     code works too; it scales 8-bit GIF data to and from 12-bit depth
+     automatically.)
+  3. Compile.  Don't expect "make test" to pass, since the supplied test
+     files are for 8-bit data.
+
+Currently, 12-bit support does not work on 16-bit-int machines.
+
+Note that a 12-bit version will not read 8-bit JPEG files, nor vice versa;
+so you'll want to keep around a regular 8-bit compilation as well.
+(Run-time selection of data depth, to allow a single copy that does both,
+is possible but would probably slow things down considerably; it's very low
+on our to-do list.)
+
+The PPM reader (rdppm.c) can read 12-bit data from either text-format or
+binary-format PPM and PGM files.  Binary-format PPM/PGM files which have a
+maxval greater than 255 are assumed to use 2 bytes per sample, LSB first
+(little-endian order).  As of early 1995, 2-byte binary format is not
+officially supported by the PBMPLUS library, but it is expected that a
+future release of PBMPLUS will support it.  Note that the PPM reader will
+read files of any maxval regardless of the BITS_IN_JSAMPLE setting; incoming
+data is automatically rescaled to either maxval=255 or maxval=4095 as
+appropriate for the cjpeg bit depth.
+
+The PPM writer (wrppm.c) will normally write 2-byte binary PPM or PGM
+format, maxval 4095, when compiled with BITS_IN_JSAMPLE=12.  Since this
+format is not yet widely supported, you can disable it by compiling wrppm.c
+with PPM_NORAWWORD defined; then the data is scaled down to 8 bits to make a
+standard 1-byte/sample PPM or PGM file.  (Yes, this means still another copy
+of djpeg to keep around.  But hopefully you won't need it for very long.
+Poskanzer's supposed to get that new PBMPLUS release out Real Soon Now.)
+
+Of course, if you are working with 12-bit data, you probably have it stored
+in some other, nonstandard format.  In that case you'll probably want to
+write your own I/O modules to read and write your format.
+
+Note that a 12-bit version of cjpeg always runs in "-optimize" mode, in
+order to generate valid Huffman tables.  This is necessary because our
+default Huffman tables only cover 8-bit data.
+
+Removing code:
+
+If you need to make a smaller version of the JPEG software, some optional
+functions can be removed at compile time.  See the xxx_SUPPORTED #defines in
+jconfig.h and jmorecfg.h.  If at all possible, we recommend that you leave in
+decoder support for all valid JPEG files, to ensure that you can read anyone's
+output.  Taking out support for image file formats that you don't use is the
+most painless way to make the programs smaller.  Another possibility is to
+remove some of the DCT methods: in particular, the "IFAST" method may not be
+enough faster than the others to be worth keeping on your machine.  (If you
+do remove ISLOW or IFAST, be sure to redefine JDCT_DEFAULT or JDCT_FASTEST
+to a supported method, by adding a #define in jconfig.h.)
+
+
+OPTIMIZATION
+============
+
+Unless you own a Cray, you'll probably be interested in making the JPEG
+software go as fast as possible.  This section covers some machine-dependent
+optimizations you may want to try.  We suggest that before trying any of
+this, you first get the basic installation to pass the self-test step.
+Repeat the self-test after any optimization to make sure that you haven't
+broken anything.
+
+The integer DCT routines perform a lot of multiplications.  These
+multiplications must yield 32-bit results, but none of their input values
+are more than 16 bits wide.  On many machines, notably the 680x0 and 80x86
+CPUs, a 16x16=>32 bit multiply instruction is faster than a full 32x32=>32
+bit multiply.  Unfortunately there is no portable way to specify such a
+multiplication in C, but some compilers can generate one when you use the
+right combination of casts.  See the MULTIPLYxxx macro definitions in
+jdct.h.  If your compiler makes "int" be 32 bits and "short" be 16 bits,
+defining SHORTxSHORT_32 is fairly likely to work.  When experimenting with
+alternate definitions, be sure to test not only whether the code still works
+(use the self-test), but also whether it is actually faster --- on some
+compilers, alternate definitions may compute the right answer, yet be slower
+than the default.  Timing cjpeg on a large PGM (grayscale) input file is the
+best way to check this, as the DCT will be the largest fraction of the runtime
+in that mode.  (Note: some of the distributed compiler-specific jconfig files
+already contain #define switches to select appropriate MULTIPLYxxx
+definitions.)
+
+If your machine has sufficiently fast floating point hardware, you may find
+that the float DCT method is faster than the integer DCT methods, even
+after tweaking the integer multiply macros.  In that case you may want to
+make the float DCT be the default method.  (The only objection to this is
+that float DCT results may vary slightly across machines.)  To do that, add
+"#define JDCT_DEFAULT JDCT_FLOAT" to jconfig.h.  Even if you don't change
+the default, you should redefine JDCT_FASTEST, which is the method selected
+by djpeg's -fast switch.  Don't forget to update the documentation files
+(usage.doc and/or cjpeg.1, djpeg.1) to agree with what you've done.
+
+If access to "short" arrays is slow on your machine, it may be a win to
+define type JCOEF as int rather than short.  This will cost a good deal of
+memory though, particularly in some multi-pass modes, so don't do it unless
+you have memory to burn and short is REALLY slow.
+
+If your compiler can compile function calls in-line, make sure the INLINE
+macro in jmorecfg.h is defined as the keyword that marks a function
+inline-able.  Some compilers have a switch that tells the compiler to inline
+any function it thinks is profitable (e.g., -finline-functions for gcc).
+Enabling such a switch is likely to make the compiled code bigger but faster.
+
+In general, it's worth trying the maximum optimization level of your compiler,
+and experimenting with any optional optimizations such as loop unrolling.
+(Unfortunately, far too many compilers have optimizer bugs ... be prepared to
+back off if the code fails self-test.)  If you do any experimentation along
+these lines, please report the optimal settings to jpeg-info at uunet.uu.net so
+we can mention them in future releases.  Be sure to specify your machine and
+compiler version.
+
+
+HINTS FOR SPECIFIC SYSTEMS
+==========================
+
+We welcome reports on changes needed for systems not mentioned here.  Submit
+'em to jpeg-info at uunet.uu.net.  Also, if configure or ckconfig.c is wrong
+about how to configure the JPEG software for your system, please let us know.
+
+
+Acorn RISC OS:
+
+(Thanks to Simon Middleton for these hints on compiling with Desktop C.)
+After renaming the files according to Acorn conventions, take a copy of
+makefile.ansi, change all occurrences of 'libjpeg.a' to 'libjpeg.o' and
+change these definitions as indicated:
+
+CFLAGS= -throwback -IC: -Wn
+LDLIBS=C:o.Stubs
+SYSDEPMEM=jmemansi.o
+LN=Link
+AR=LibFile -c -o
+
+Also add a new line '.c.o:; $(cc) $< $(cflags) -c -o $@'.  Remove the
+lines '$(RM) libjpeg.o' and '$(AR2) libjpeg.o' and the 'jconfig.h'
+dependency section.
+
+Copy jconfig.doc to jconfig.h.  Edit jconfig.h to define TWO_FILE_COMMANDLINE
+and CHAR_IS_UNSIGNED.
+
+Run the makefile using !AMU not !Make.  If you want to use the 'clean' and
+'test' makefile entries then you will have to fiddle with the syntax a bit
+and rename the test files.
+
+
+Amiga:
+
+SAS C 6.50 reportedly is too buggy to compile the IJG code properly.
+A patch to update to 6.51 is available from SAS or AmiNet FTP sites.
+
+The supplied config files are set up to use jmemname.c as the memory
+manager, with temporary files being created on the device named by
+"JPEGTMP:".
+
+
+Atari ST/STE/TT:
+ 
+Copy the project files makcjpeg.st, makdjpeg.st, maktjpeg.st, and makljpeg.st
+to cjpeg.prj, djpeg.prj, jpegtran.prj, and libjpeg.prj respectively.  The
+project files should work as-is with Pure C.  For Turbo C, change library
+filenames "pc..." to "tc..." in each project file.  Note that libjpeg.prj
+selects jmemansi.c as the recommended memory manager.  You'll probably want to
+adjust the DEFAULT_MAX_MEM setting --- you want it to be a couple hundred K
+less than your normal free memory.  Put "#define DEFAULT_MAX_MEM nnnn" into
+jconfig.h to do this.
+
+To use the 68881/68882 coprocessor for the floating point DCT, add the
+compiler option "-8" to the project files and replace pcfltlib.lib with
+pc881lib.lib in cjpeg.prj and djpeg.prj.  Or if you don't have a
+coprocessor, you may prefer to remove the float DCT code by undefining
+DCT_FLOAT_SUPPORTED in jmorecfg.h (since without a coprocessor, the float
+code will be too slow to be useful).  In that case, you can delete
+pcfltlib.lib from the project files.
+
+Note that you must make libjpeg.lib before making cjpeg.ttp, djpeg.ttp,
+or jpegtran.ttp.  You'll have to perform the self-test by hand.
+
+We haven't bothered to include project files for rdjpgcom and wrjpgcom.
+Those source files should just be compiled by themselves; they don't
+depend on the JPEG library.
+
+There is a bug in some older versions of the Turbo C library which causes the
+space used by temporary files created with "tmpfile()" not to be freed after
+an abnormal program exit.  If you check your disk afterwards, you will find
+cluster chains that are allocated but not used by a file.  This should not
+happen in cjpeg/djpeg/jpegtran, since we enable a signal catcher to explicitly
+close temp files before exiting.  But if you use the JPEG library with your
+own code, be sure to supply a signal catcher, or else use a different
+system-dependent memory manager.
+
+
+Cray:
+
+Should you be so fortunate as to be running JPEG on a Cray YMP, there is a
+compiler bug in old versions of Cray's Standard C (prior to 3.1).  If you
+still have an old compiler, you'll need to insert a line reading
+"#pragma novector" just before the loop	
+    for (i = 1; i <= (int) htbl->bits[l]; i++)
+      huffsize[p++] = (char) l;
+in fix_huff_tbl (in V5beta1, line 204 of jchuff.c and line 176 of jdhuff.c).
+[This bug may or may not still occur with the current IJG code, but it's
+probably a dead issue anyway...]
+
+
+HP-UX:
+
+If you have HP-UX 7.05 or later with the "software development" C compiler,
+you should run the compiler in ANSI mode.  If using the configure script,
+say
+	./configure CC='cc -Aa'
+(or -Ae if you prefer).  If configuring by hand, use makefile.ansi and add
+"-Aa" to the CFLAGS line in the makefile.
+
+If you have a pre-7.05 system, or if you are using the non-ANSI C compiler
+delivered with a minimum HP-UX system, then you must use makefile.unix
+(and do NOT add -Aa); or just run configure without the CC option.
+
+On HP 9000 series 800 machines, the HP C compiler is buggy in revisions prior
+to A.08.07.  If you get complaints about "not a typedef name", you'll have to
+use makefile.unix, or run configure without the CC option.
+
+
+Macintosh, generic comments:
+
+The supplied user-interface files (cjpeg.c, djpeg.c, etc) are set up to
+provide a Unix-style command line interface.  You can use this interface on
+the Mac by means of the ccommand() library routine provided by Metrowerks
+CodeWarrior or Think C.  This is only appropriate for testing the library,
+however; to make a user-friendly equivalent of cjpeg/djpeg you'd really want
+to develop a Mac-style user interface.  There isn't a complete example
+available at the moment, but there are some helpful starting points:
+1. Sam Bushell's free "To JPEG" applet provides drag-and-drop conversion to
+JPEG under System 7 and later.  This only illustrates how to use the
+compression half of the library, but it does a very nice job of that part.
+The CodeWarrior source code is available from http://www.pobox.com/~jsam.
+2. Jim Brunner prepared a Mac-style user interface for both compression and
+decompression.  Unfortunately, it hasn't been updated since IJG v4, and
+the library's API has changed considerably since then.  Still it may be of
+some help, particularly as a guide to compiling the IJG code under Think C.
+Jim's code is available from the Info-Mac archives, at sumex-aim.stanford.edu
+or mirrors thereof; see file /info-mac/dev/src/jpeg-convert-c.hqx.
+
+jmemmac.c is the recommended memory manager back end for Macintosh.  It uses
+NewPtr/DisposePtr instead of malloc/free, and has a Mac-specific
+implementation of jpeg_mem_available().  It also creates temporary files that
+follow Mac conventions.  (That part of the code relies on System-7-or-later OS
+functions.  See the comments in jmemmac.c if you need to run it on System 6.)
+NOTE that USE_MAC_MEMMGR must be defined in jconfig.h to use jmemmac.c.
+
+You can also use jmemnobs.c, if you don't care about handling images larger
+than available memory.  If you use any memory manager back end other than
+jmemmac.c, we recommend replacing "malloc" and "free" by "NewPtr" and
+"DisposePtr", because Mac C libraries often have peculiar implementations of
+malloc/free.  (For instance, free() may not return the freed space to the
+Mac Memory Manager.  This is undesirable for the IJG code because jmemmgr.c
+already clumps space requests.)
+
+
+Macintosh, Metrowerks CodeWarrior:
+
+The Unix-command-line-style interface can be used by defining USE_CCOMMAND.
+You'll also need to define TWO_FILE_COMMANDLINE to avoid stdin/stdout.
+This means that when using the cjpeg/djpeg programs, you'll have to type the
+input and output file names in the "Arguments" text-edit box, rather than
+using the file radio buttons.  (Perhaps USE_FDOPEN or USE_SETMODE would
+eliminate the problem, but I haven't heard from anyone who's tried it.)
+
+On 680x0 Macs, Metrowerks defines type "double" as a 10-byte IEEE extended
+float.  jmemmgr.c won't like this: it wants sizeof(ALIGN_TYPE) to be a power
+of 2.  Add "#define ALIGN_TYPE long" to jconfig.h to eliminate the complaint.
+
+The supplied configuration file jconfig.mac can be used for your jconfig.h;
+it includes all the recommended symbol definitions.  If you have AppleScript
+installed, you can run the supplied script makeproj.mac to create CodeWarrior
+project files for the library and the testbed applications, then build the
+library and applications.  (Thanks to Dan Sears and Don Agro for this nifty
+hack, which saves us from trying to maintain CodeWarrior project files as part
+of the IJG distribution...)
+
+
+Macintosh, Think C:
+
+The documentation in Jim Brunner's "JPEG Convert" source code (see above)
+includes detailed build instructions for Think C; it's probably somewhat
+out of date for the current release, but may be helpful.
+
+If you want to build the minimal command line version, proceed as follows.
+You'll have to prepare project files for the programs; we don't include any
+in the distribution since they are not text files.  Use the file lists in
+any of the supplied makefiles as a guide.  Also add the ANSI and Unix C
+libraries in a separate segment.  You may need to divide the JPEG files into
+more than one segment; we recommend dividing compression and decompression
+modules.  Define USE_CCOMMAND in jconfig.h so that the ccommand() routine is
+called.  You must also define TWO_FILE_COMMANDLINE because stdin/stdout
+don't handle binary data correctly.
+
+On 680x0 Macs, Think C defines type "double" as a 12-byte IEEE extended float.
+jmemmgr.c won't like this: it wants sizeof(ALIGN_TYPE) to be a power of 2.
+Add "#define ALIGN_TYPE long" to jconfig.h to eliminate the complaint.
+
+jconfig.mac should work as a jconfig.h configuration file for Think C,
+but the makeproj.mac AppleScript script is specific to CodeWarrior.  Sorry.
+
+
+MIPS R3000:
+
+MIPS's cc version 1.31 has a rather nasty optimization bug.  Don't use -O
+if you have that compiler version.  (Use "cc -V" to check the version.)
+Note that the R3000 chip is found in workstations from DEC and others.
+
+
+MS-DOS, generic comments for 16-bit compilers:
+
+The IJG code is designed to work well in 80x86 "small" or "medium" memory
+models (i.e., data pointers are 16 bits unless explicitly declared "far";
+code pointers can be either size).  You may be able to use small model to
+compile cjpeg or djpeg by itself, but you will probably have to use medium
+model for any larger application.  This won't make much difference in
+performance.  You *will* take a noticeable performance hit if you use a
+large-data memory model, and you should avoid "huge" model if at all
+possible.  Be sure that NEED_FAR_POINTERS is defined in jconfig.h if you use
+a small-data memory model; be sure it is NOT defined if you use a large-data
+model.  (The supplied makefiles and jconfig files for Borland and Microsoft C
+compile in medium model and define NEED_FAR_POINTERS.)
+
+The DOS-specific memory manager, jmemdos.c, should be used if possible.
+It needs some assembly-code routines which are in jmemdosa.asm; make sure
+your makefile assembles that file and includes it in the library.  If you
+don't have a suitable assembler, you can get pre-assembled object files for
+jmemdosa by FTP from ftp.uu.net:/graphics/jpeg/jdosaobj.zip.  (DOS-oriented
+distributions of the IJG source code often include these object files.)
+
+When using jmemdos.c, jconfig.h must define USE_MSDOS_MEMMGR and must set
+MAX_ALLOC_CHUNK to less than 64K (65520L is a typical value).  If your
+C library's far-heap malloc() can't allocate blocks that large, reduce
+MAX_ALLOC_CHUNK to whatever it can handle.
+
+If you can't use jmemdos.c for some reason --- for example, because you
+don't have an assembler to assemble jmemdosa.asm --- you'll have to fall
+back to jmemansi.c or jmemname.c.  You'll probably still need to set
+MAX_ALLOC_CHUNK in jconfig.h, because most DOS C libraries won't malloc()
+more than 64K at a time.  IMPORTANT: if you use jmemansi.c or jmemname.c,
+you will have to compile in a large-data memory model in order to get the
+right stdio library.  Too bad.
+
+wrjpgcom needs to be compiled in large model, because it malloc()s a 64KB
+work area to hold the comment text.  If your C library's malloc can't
+handle that, reduce MAX_COM_LENGTH as necessary in wrjpgcom.c.
+
+Most MS-DOS compilers treat stdin/stdout as text files, so you must use
+two-file command line style.  But if your compiler has either fdopen() or
+setmode(), you can use one-file style if you like.  To do this, define
+USE_SETMODE or USE_FDOPEN so that stdin/stdout will be set to binary mode.
+(USE_SETMODE seems to work with more DOS compilers than USE_FDOPEN.)  You
+should test that I/O through stdin/stdout produces the same results as I/O
+to explicitly named files... the "make test" procedures in the supplied
+makefiles do NOT use stdin/stdout.
+
+
+MS-DOS, generic comments for 32-bit compilers:
+
+None of the above comments about memory models apply if you are using a
+32-bit flat-memory-space environment, such as DJGPP or Watcom C.  (And you
+should use one if you have it, as performance will be much better than
+8086-compatible code!)  For flat-memory-space compilers, do NOT define
+NEED_FAR_POINTERS, and do NOT use jmemdos.c.  Use jmemnobs.c if the
+environment supplies adequate virtual memory, otherwise use jmemansi.c or
+jmemname.c.
+
+You'll still need to be careful about binary I/O through stdin/stdout.
+See the last paragraph of the previous section.
+
+
+MS-DOS, Borland C:
+
+Be sure to convert all the source files to DOS text format (CR/LF newlines).
+Although Borland C will often work OK with unmodified Unix (LF newlines)
+source files, sometimes it will give bogus compile errors.
+"Illegal character '#'" is the most common such error.  (This is true with
+Borland C 3.1, but perhaps is fixed in newer releases.)
+
+If you want one-file command line style, just undefine TWO_FILE_COMMANDLINE.
+jconfig.bcc already includes #define USE_SETMODE to make this work.
+(fdopen does not work correctly.)
+
+
+MS-DOS, Microsoft C:
+
+makefile.mc6 works with Microsoft C, DOS Visual C++, etc.  It should only
+be used if you want to build a 16-bit (small or medium memory model) program.
+
+If you want one-file command line style, just undefine TWO_FILE_COMMANDLINE.
+jconfig.mc6 already includes #define USE_SETMODE to make this work.
+(fdopen does not work correctly.)
+
+Note that this makefile assumes that the working copy of itself is called
+"makefile".  If you want to call it something else, say "makefile.mak",
+be sure to adjust the dependency line that reads "$(RFILE) : makefile".
+Otherwise the make will fail because it doesn't know how to create "makefile".
+Worse, some releases of Microsoft's make utilities give an incorrect error
+message in this situation.
+
+Old versions of MS C fail with an "out of macro expansion space" error
+because they can't cope with the macro TRACEMS8 (defined in jerror.h).
+If this happens to you, the easiest solution is to change TRACEMS8 to
+expand to nothing.  You'll lose the ability to dump out JPEG coefficient
+tables with djpeg -debug -debug, but at least you can compile.
+
+Original MS C 6.0 is very buggy; it compiles incorrect code unless you turn
+off optimization entirely (remove -O from CFLAGS).  6.00A is better, but it
+still generates bad code if you enable loop optimizations (-Ol or -Ox).
+
+MS C 8.0 crashes when compiling jquant1.c with optimization switch /Oo ...
+which is on by default.  To work around this bug, compile that one file
+with /Oo-.
+
+
+Microsoft Windows (all versions), generic comments:
+
+Some Windows system include files define typedef boolean as "unsigned char".
+The IJG code also defines typedef boolean, but we make it "int" by default.
+This doesn't affect the IJG programs because we don't import those Windows
+include files.  But if you use the JPEG library in your own program, and some
+of your program's files import one definition of boolean while some import the
+other, you can get all sorts of mysterious problems.  A good preventive step
+is to make the IJG library use "unsigned char" for boolean.  To do that,
+add something like this to your jconfig.h file:
+	/* Define "boolean" as unsigned char, not int, per Windows custom */
+	#ifndef __RPCNDR_H__	/* don't conflict if rpcndr.h already read */
+	typedef unsigned char boolean;
+	#endif
+	#define HAVE_BOOLEAN	/* prevent jmorecfg.h from redefining it */
+(This is already in jconfig.vc, by the way.)
+
+windef.h contains the declarations
+	#define far
+	#define FAR far
+Since jmorecfg.h tries to define FAR as empty, you may get a compiler
+warning if you include both jpeglib.h and windef.h (which windows.h
+includes).  To suppress the warning, you can put "#ifndef FAR"/"#endif"
+around the line "#define FAR" in jmorecfg.h.
+
+When using the library in a Windows application, you will almost certainly
+want to modify or replace the error handler module jerror.c, since our
+default error handler does a couple of inappropriate things:
+  1. it tries to write error and warning messages on stderr;
+  2. in event of a fatal error, it exits by calling exit().
+
+A simple stopgap solution for problem 1 is to replace the line
+	fprintf(stderr, "%s\n", buffer);
+(in output_message in jerror.c) with
+	MessageBox(GetActiveWindow(),buffer,"JPEG Error",MB_OK|MB_ICONERROR);
+It's highly recommended that you at least do that much, since otherwise
+error messages will disappear into nowhere.  (Beginning with IJG v6b, this
+code is already present in jerror.c; just define USE_WINDOWS_MESSAGEBOX in
+jconfig.h to enable it.)
+
+The proper solution for problem 2 is to return control to your calling
+application after a library error.  This can be done with the setjmp/longjmp
+technique discussed in libjpeg.doc and illustrated in example.c.  (NOTE:
+some older Windows C compilers provide versions of setjmp/longjmp that
+don't actually work under Windows.  You may need to use the Windows system
+functions Catch and Throw instead.)
+
+The recommended memory manager under Windows is jmemnobs.c; in other words,
+let Windows do any virtual memory management needed.  You should NOT use
+jmemdos.c nor jmemdosa.asm under Windows.
+
+For Windows 3.1, we recommend compiling in medium or large memory model;
+for newer Windows versions, use a 32-bit flat memory model.  (See the MS-DOS
+sections above for more info about memory models.)  In the 16-bit memory
+models only, you'll need to put
+	#define MAX_ALLOC_CHUNK 65520L	/* Maximum request to malloc() */
+into jconfig.h to limit allocation chunks to 64Kb.  (Without that, you'd
+have to use huge memory model, which slows things down unnecessarily.)
+jmemnobs.c works without modification in large or flat memory models, but to
+use medium model, you need to modify its jpeg_get_large and jpeg_free_large
+routines to allocate far memory.  In any case, you might like to replace
+its calls to malloc and free with direct calls on Windows memory allocation
+functions.
+
+You may also want to modify jdatasrc.c and jdatadst.c to use Windows file
+operations rather than fread/fwrite.  This is only necessary if your C
+compiler doesn't provide a competent implementation of C stdio functions.
+
+You might want to tweak the RGB_xxx macros in jmorecfg.h so that the library
+will accept or deliver color pixels in BGR sample order, not RGB; BGR order
+is usually more convenient under Windows.  Note that this change will break
+the sample applications cjpeg/djpeg, but the library itself works fine.
+
+
+Many people want to convert the IJG library into a DLL.  This is reasonably
+straightforward, but watch out for the following:
+
+  1. Don't try to compile as a DLL in small or medium memory model; use
+large model, or even better, 32-bit flat model.  Many places in the IJG code
+assume the address of a local variable is an ordinary (not FAR) pointer;
+that isn't true in a medium-model DLL.
+
+  2. Microsoft C cannot pass file pointers between applications and DLLs.
+(See Microsoft Knowledge Base, PSS ID Number Q50336.)  So jdatasrc.c and
+jdatadst.c don't work if you open a file in your application and then pass
+the pointer to the DLL.  One workaround is to make jdatasrc.c/jdatadst.c
+part of your main application rather than part of the DLL.
+
+  3. You'll probably need to modify the macros GLOBAL() and EXTERN() to
+attach suitable linkage keywords to the exported routine names.  Similarly,
+you'll want to modify METHODDEF() and JMETHOD() to ensure function pointers
+are declared in a way that lets application routines be called back through
+the function pointers.  These macros are in jmorecfg.h.  Typical definitions
+for a 16-bit DLL are:
+	#define GLOBAL(type)		type _far _pascal _loadds _export
+	#define EXTERN(type)		extern type _far _pascal _loadds
+	#define METHODDEF(type)		static type _far _pascal
+	#define JMETHOD(type,methodname,arglist)  \
+		type (_far _pascal *methodname) arglist
+For a 32-bit DLL you may want something like
+	#define GLOBAL(type)		__declspec(dllexport) type
+	#define EXTERN(type)		extern __declspec(dllexport) type
+Although not all the GLOBAL routines are actually intended to be called by
+the application, the performance cost of making them all DLL entry points is
+negligible.
+
+The unmodified IJG library presents a very C-specific application interface,
+so the resulting DLL is only usable from C or C++ applications.  There has
+been some talk of writing wrapper code that would present a simpler interface
+usable from other languages, such as Visual Basic.  This is on our to-do list
+but hasn't been very high priority --- any volunteers out there?
+
+
+Microsoft Windows, Borland C:
+
+The provided jconfig.bcc should work OK in a 32-bit Windows environment,
+but you'll need to tweak it in a 16-bit environment (you'd need to define
+NEED_FAR_POINTERS and MAX_ALLOC_CHUNK).  Beware that makefile.bcc will need
+alteration if you want to use it for Windows --- in particular, you should
+use jmemnobs.c not jmemdos.c under Windows.
+
+Borland C++ 4.5 fails with an internal compiler error when trying to compile
+jdmerge.c in 32-bit mode.  If enough people complain, perhaps Borland will fix
+it.  In the meantime, the simplest known workaround is to add a redundant
+definition of the variable range_limit in h2v1_merged_upsample(), at the head
+of the block that handles odd image width (about line 268 in v6 jdmerge.c):
+  /* If image width is odd, do the last output column separately */
+  if (cinfo->output_width & 1) {
+    register JSAMPLE * range_limit = cinfo->sample_range_limit; /* ADD THIS */
+    cb = GETJSAMPLE(*inptr1);
+Pretty bizarre, especially since the very similar routine h2v2_merged_upsample
+doesn't trigger the bug.
+Recent reports suggest that this bug does not occur with "bcc32a" (the
+Pentium-optimized version of the compiler).
+
+Another report from a user of Borland C 4.5 was that incorrect code (leading
+to a color shift in processed images) was produced if any of the following
+optimization switch combinations were used: 
+	-Ot -Og
+	-Ot -Op
+	-Ot -Om
+So try backing off on optimization if you see such a problem.  (Are there
+several different releases all numbered "4.5"??)
+
+
+Microsoft Windows, Microsoft Visual C++:
+
+jconfig.vc should work OK with any Microsoft compiler for a 32-bit memory
+model.  makefile.vc is intended for command-line use.  (If you are using
+the Developer Studio environment, you may prefer the DevStudio project
+files; see below.)
+
+Some users feel that it's easier to call the library from C++ code if you
+force VC++ to treat the library as C++ code, which you can do by renaming
+all the *.c files to *.cpp (and adjusting the makefile to match).  This
+avoids the need to put extern "C" { ... } around #include "jpeglib.h" in
+your C++ application.
+
+
+Microsoft Windows, Microsoft Developer Studio:
+
+We include makefiles that should work as project files in DevStudio 4.2 or
+later.  There is a library makefile that builds the IJG library as a static
+Win32 library, and an application makefile that builds the sample applications
+as Win32 console applications.  (Even if you only want the library, we
+recommend building the applications so that you can run the self-test.)
+
+To use:
+1. Copy jconfig.vc to jconfig.h, makelib.ds to jpeg.mak, and
+   makeapps.ds to apps.mak.  (Note that the renaming is critical!)
+2. Click on the .mak files to construct project workspaces.
+   (If you are using DevStudio more recent than 4.2, you'll probably
+   get a message saying that the makefiles are being updated.)
+3. Build the library project, then the applications project.
+4. Move the application .exe files from `app`\Release to an
+   appropriate location on your path.
+5. To perform the self-test, execute the command line
+	NMAKE /f makefile.vc  test
+
+
+OS/2, Borland C++:
+
+Watch out for optimization bugs in older Borland compilers; you may need
+to back off the optimization switch settings.  See the comments in
+makefile.bcc.
+
+
+SGI:
+
+On some SGI systems, you may need to set "AR2= ar -ts" in the Makefile.
+If you are using configure, you can do this by saying
+	./configure RANLIB='ar -ts'
+This change is not needed on all SGIs.  Use it only if the make fails at the
+stage of linking the completed programs.
+
+On the MIPS R4000 architecture (Indy, etc.), the compiler option "-mips2"
+reportedly speeds up the float DCT method substantially, enough to make it
+faster than the default int method (but still slower than the fast int
+method).  If you use -mips2, you may want to alter the default DCT method to
+be float.  To do this, put "#define JDCT_DEFAULT JDCT_FLOAT" in jconfig.h.
+
+
+VMS:
+
+On an Alpha/VMS system with MMS, be sure to use the "/Marco=Alpha=1"
+qualifier with MMS when building the JPEG package.
+
+VAX/VMS v5.5-1 may have problems with the test step of the build procedure
+reporting differences when it compares the original and test images.  If the
+error points to the last block of the files, it is most likely bogus and may
+be safely ignored.  It seems to be because the files are Stream_LF and
+Backup/Compare has difficulty with the (presumably) null padded files.
+This problem was not observed on VAX/VMS v6.1 or AXP/VMS v6.1.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcapimin.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcapimin.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcapimin.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,280 @@
+/*
+ * jcapimin.c
+ *
+ * Copyright (C) 1994-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains application interface code for the compression half
+ * of the JPEG library.  These are the "minimum" API routines that may be
+ * needed in either the normal full-compression case or the transcoding-only
+ * case.
+ *
+ * Most of the routines intended to be called directly by an application
+ * are in this file or in jcapistd.c.  But also see jcparam.c for
+ * parameter-setup helper routines, jcomapi.c for routines shared by
+ * compression and decompression, and jctrans.c for the transcoding case.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * Initialization of a JPEG compression object.
+ * The error manager must already be set up (in case memory manager fails).
+ */
+
+GLOBAL(void)
+jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
+{
+  int i;
+
+  /* Guard against version mismatches between library and caller. */
+  cinfo->mem = NULL;		/* so jpeg_destroy knows mem mgr not called */
+  if (version != JPEG_LIB_VERSION)
+    ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
+  if (structsize != SIZEOF(struct jpeg_compress_struct))
+    ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, 
+	     (int) SIZEOF(struct jpeg_compress_struct), (int) structsize);
+
+  /* For debugging purposes, we zero the whole master structure.
+   * But the application has already set the err pointer, and may have set
+   * client_data, so we have to save and restore those fields.
+   * Note: if application hasn't set client_data, tools like Purify may
+   * complain here.
+   */
+  {
+    struct jpeg_error_mgr * err = cinfo->err;
+    void * client_data = cinfo->client_data; /* ignore Purify complaint here */
+    MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct));
+    cinfo->err = err;
+    cinfo->client_data = client_data;
+  }
+  cinfo->is_decompressor = FALSE;
+
+  /* Initialize a memory manager instance for this object */
+  jinit_memory_mgr((j_common_ptr) cinfo);
+
+  /* Zero out pointers to permanent structures. */
+  cinfo->progress = NULL;
+  cinfo->dest = NULL;
+
+  cinfo->comp_info = NULL;
+
+  for (i = 0; i < NUM_QUANT_TBLS; i++)
+    cinfo->quant_tbl_ptrs[i] = NULL;
+
+  for (i = 0; i < NUM_HUFF_TBLS; i++) {
+    cinfo->dc_huff_tbl_ptrs[i] = NULL;
+    cinfo->ac_huff_tbl_ptrs[i] = NULL;
+  }
+
+  cinfo->script_space = NULL;
+
+  cinfo->input_gamma = 1.0;	/* in case application forgets */
+
+  /* OK, I'm ready */
+  cinfo->global_state = CSTATE_START;
+}
+
+
+/*
+ * Destruction of a JPEG compression object
+ */
+
+GLOBAL(void)
+jpeg_destroy_compress (j_compress_ptr cinfo)
+{
+  jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
+}
+
+
+/*
+ * Abort processing of a JPEG compression operation,
+ * but don't destroy the object itself.
+ */
+
+GLOBAL(void)
+jpeg_abort_compress (j_compress_ptr cinfo)
+{
+  jpeg_abort((j_common_ptr) cinfo); /* use common routine */
+}
+
+
+/*
+ * Forcibly suppress or un-suppress all quantization and Huffman tables.
+ * Marks all currently defined tables as already written (if suppress)
+ * or not written (if !suppress).  This will control whether they get emitted
+ * by a subsequent jpeg_start_compress call.
+ *
+ * This routine is exported for use by applications that want to produce
+ * abbreviated JPEG datastreams.  It logically belongs in jcparam.c, but
+ * since it is called by jpeg_start_compress, we put it here --- otherwise
+ * jcparam.o would be linked whether the application used it or not.
+ */
+
+GLOBAL(void)
+jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
+{
+  int i;
+  JQUANT_TBL * qtbl;
+  JHUFF_TBL * htbl;
+
+  for (i = 0; i < NUM_QUANT_TBLS; i++) {
+    if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL)
+      qtbl->sent_table = suppress;
+  }
+
+  for (i = 0; i < NUM_HUFF_TBLS; i++) {
+    if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL)
+      htbl->sent_table = suppress;
+    if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL)
+      htbl->sent_table = suppress;
+  }
+}
+
+
+/*
+ * Finish JPEG compression.
+ *
+ * If a multipass operating mode was selected, this may do a great deal of
+ * work including most of the actual output.
+ */
+
+GLOBAL(void)
+jpeg_finish_compress (j_compress_ptr cinfo)
+{
+  JDIMENSION iMCU_row;
+
+  if (cinfo->global_state == CSTATE_SCANNING ||
+      cinfo->global_state == CSTATE_RAW_OK) {
+    /* Terminate first pass */
+    if (cinfo->next_scanline < cinfo->image_height)
+      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
+    (*cinfo->master->finish_pass) (cinfo);
+  } else if (cinfo->global_state != CSTATE_WRCOEFS)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  /* Perform any remaining passes */
+  while (! cinfo->master->is_last_pass) {
+    (*cinfo->master->prepare_for_pass) (cinfo);
+    for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
+      if (cinfo->progress != NULL) {
+	cinfo->progress->pass_counter = (long) iMCU_row;
+	cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows;
+	(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+      }
+      /* We bypass the main controller and invoke coef controller directly;
+       * all work is being done from the coefficient buffer.
+       */
+      if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL))
+	ERREXIT(cinfo, JERR_CANT_SUSPEND);
+    }
+    (*cinfo->master->finish_pass) (cinfo);
+  }
+  /* Write EOI, do final cleanup */
+  (*cinfo->marker->write_file_trailer) (cinfo);
+  (*cinfo->dest->term_destination) (cinfo);
+  /* We can use jpeg_abort to release memory and reset global_state */
+  jpeg_abort((j_common_ptr) cinfo);
+}
+
+
+/*
+ * Write a special marker.
+ * This is only recommended for writing COM or APPn markers.
+ * Must be called after jpeg_start_compress() and before
+ * first call to jpeg_write_scanlines() or jpeg_write_raw_data().
+ */
+
+GLOBAL(void)
+jpeg_write_marker (j_compress_ptr cinfo, int marker,
+		   const JOCTET *dataptr, unsigned int datalen)
+{
+  JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val));
+
+  if (cinfo->next_scanline != 0 ||
+      (cinfo->global_state != CSTATE_SCANNING &&
+       cinfo->global_state != CSTATE_RAW_OK &&
+       cinfo->global_state != CSTATE_WRCOEFS))
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  (*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
+  write_marker_byte = cinfo->marker->write_marker_byte;	/* copy for speed */
+  while (datalen--) {
+    (*write_marker_byte) (cinfo, *dataptr);
+    dataptr++;
+  }
+}
+
+/* Same, but piecemeal. */
+
+GLOBAL(void)
+jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
+{
+  if (cinfo->next_scanline != 0 ||
+      (cinfo->global_state != CSTATE_SCANNING &&
+       cinfo->global_state != CSTATE_RAW_OK &&
+       cinfo->global_state != CSTATE_WRCOEFS))
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  (*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
+}
+
+GLOBAL(void)
+jpeg_write_m_byte (j_compress_ptr cinfo, int val)
+{
+  (*cinfo->marker->write_marker_byte) (cinfo, val);
+}
+
+
+/*
+ * Alternate compression function: just write an abbreviated table file.
+ * Before calling this, all parameters and a data destination must be set up.
+ *
+ * To produce a pair of files containing abbreviated tables and abbreviated
+ * image data, one would proceed as follows:
+ *
+ *		initialize JPEG object
+ *		set JPEG parameters
+ *		set destination to table file
+ *		jpeg_write_tables(cinfo);
+ *		set destination to image file
+ *		jpeg_start_compress(cinfo, FALSE);
+ *		write data...
+ *		jpeg_finish_compress(cinfo);
+ *
+ * jpeg_write_tables has the side effect of marking all tables written
+ * (same as jpeg_suppress_tables(..., TRUE)).  Thus a subsequent start_compress
+ * will not re-emit the tables unless it is passed write_all_tables=TRUE.
+ */
+
+GLOBAL(void)
+jpeg_write_tables (j_compress_ptr cinfo)
+{
+  if (cinfo->global_state != CSTATE_START)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  /* (Re)initialize error mgr and destination modules */
+  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+  (*cinfo->dest->init_destination) (cinfo);
+  /* Initialize the marker writer ... bit of a crock to do it here. */
+  jinit_marker_writer(cinfo);
+  /* Write them tables! */
+  (*cinfo->marker->write_tables_only) (cinfo);
+  /* And clean up. */
+  (*cinfo->dest->term_destination) (cinfo);
+  /*
+   * In library releases up through v6a, we called jpeg_abort() here to free
+   * any working memory allocated by the destination manager and marker
+   * writer.  Some applications had a problem with that: they allocated space
+   * of their own from the library memory manager, and didn't want it to go
+   * away during write_tables.  So now we do nothing.  This will cause a
+   * memory leak if an app calls write_tables repeatedly without doing a full
+   * compression cycle or otherwise resetting the JPEG object.  However, that
+   * seems less bad than unexpectedly freeing memory in the normal case.
+   * An app that prefers the old behavior can call jpeg_abort for itself after
+   * each call to jpeg_write_tables().
+   */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcapistd.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcapistd.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcapistd.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,161 @@
+/*
+ * jcapistd.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains application interface code for the compression half
+ * of the JPEG library.  These are the "standard" API routines that are
+ * used in the normal full-compression case.  They are not used by a
+ * transcoding-only application.  Note that if an application links in
+ * jpeg_start_compress, it will end up linking in the entire compressor.
+ * We thus must separate this file from jcapimin.c to avoid linking the
+ * whole compression library into a transcoder.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * Compression initialization.
+ * Before calling this, all parameters and a data destination must be set up.
+ *
+ * We require a write_all_tables parameter as a failsafe check when writing
+ * multiple datastreams from the same compression object.  Since prior runs
+ * will have left all the tables marked sent_table=TRUE, a subsequent run
+ * would emit an abbreviated stream (no tables) by default.  This may be what
+ * is wanted, but for safety's sake it should not be the default behavior:
+ * programmers should have to make a deliberate choice to emit abbreviated
+ * images.  Therefore the documentation and examples should encourage people
+ * to pass write_all_tables=TRUE; then it will take active thought to do the
+ * wrong thing.
+ */
+
+GLOBAL(void)
+jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
+{
+  if (cinfo->global_state != CSTATE_START)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  if (write_all_tables)
+    jpeg_suppress_tables(cinfo, FALSE);	/* mark all tables to be written */
+
+  /* (Re)initialize error mgr and destination modules */
+  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+  (*cinfo->dest->init_destination) (cinfo);
+  /* Perform master selection of active modules */
+  jinit_compress_master(cinfo);
+  /* Set up for the first pass */
+  (*cinfo->master->prepare_for_pass) (cinfo);
+  /* Ready for application to drive first pass through jpeg_write_scanlines
+   * or jpeg_write_raw_data.
+   */
+  cinfo->next_scanline = 0;
+  cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
+}
+
+
+/*
+ * Write some scanlines of data to the JPEG compressor.
+ *
+ * The return value will be the number of lines actually written.
+ * This should be less than the supplied num_lines only in case that
+ * the data destination module has requested suspension of the compressor,
+ * or if more than image_height scanlines are passed in.
+ *
+ * Note: we warn about excess calls to jpeg_write_scanlines() since
+ * this likely signals an application programmer error.  However,
+ * excess scanlines passed in the last valid call are *silently* ignored,
+ * so that the application need not adjust num_lines for end-of-image
+ * when using a multiple-scanline buffer.
+ */
+
+GLOBAL(JDIMENSION)
+jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
+		      JDIMENSION num_lines)
+{
+  JDIMENSION row_ctr, rows_left;
+
+  if (cinfo->global_state != CSTATE_SCANNING)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  if (cinfo->next_scanline >= cinfo->image_height)
+    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
+
+  /* Call progress monitor hook if present */
+  if (cinfo->progress != NULL) {
+    cinfo->progress->pass_counter = (long) cinfo->next_scanline;
+    cinfo->progress->pass_limit = (long) cinfo->image_height;
+    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+  }
+
+  /* Give master control module another chance if this is first call to
+   * jpeg_write_scanlines.  This lets output of the frame/scan headers be
+   * delayed so that application can write COM, etc, markers between
+   * jpeg_start_compress and jpeg_write_scanlines.
+   */
+  if (cinfo->master->call_pass_startup)
+    (*cinfo->master->pass_startup) (cinfo);
+
+  /* Ignore any extra scanlines at bottom of image. */
+  rows_left = cinfo->image_height - cinfo->next_scanline;
+  if (num_lines > rows_left)
+    num_lines = rows_left;
+
+  row_ctr = 0;
+  (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines);
+  cinfo->next_scanline += row_ctr;
+  return row_ctr;
+}
+
+
+/*
+ * Alternate entry point to write raw data.
+ * Processes exactly one iMCU row per call, unless suspended.
+ */
+
+GLOBAL(JDIMENSION)
+jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
+		     JDIMENSION num_lines)
+{
+  JDIMENSION lines_per_iMCU_row;
+
+  if (cinfo->global_state != CSTATE_RAW_OK)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  if (cinfo->next_scanline >= cinfo->image_height) {
+    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
+    return 0;
+  }
+
+  /* Call progress monitor hook if present */
+  if (cinfo->progress != NULL) {
+    cinfo->progress->pass_counter = (long) cinfo->next_scanline;
+    cinfo->progress->pass_limit = (long) cinfo->image_height;
+    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+  }
+
+  /* Give master control module another chance if this is first call to
+   * jpeg_write_raw_data.  This lets output of the frame/scan headers be
+   * delayed so that application can write COM, etc, markers between
+   * jpeg_start_compress and jpeg_write_raw_data.
+   */
+  if (cinfo->master->call_pass_startup)
+    (*cinfo->master->pass_startup) (cinfo);
+
+  /* Verify that at least one iMCU row has been passed. */
+  lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE;
+  if (num_lines < lines_per_iMCU_row)
+    ERREXIT(cinfo, JERR_BUFFER_SIZE);
+
+  /* Directly compress the row. */
+  if (! (*cinfo->coef->compress_data) (cinfo, data)) {
+    /* If compressor did not consume the whole row, suspend processing. */
+    return 0;
+  }
+
+  /* OK, we processed one iMCU row. */
+  cinfo->next_scanline += lines_per_iMCU_row;
+  return lines_per_iMCU_row;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jccoefct.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jccoefct.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jccoefct.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,449 @@
+/*
+ * jccoefct.c
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the coefficient buffer controller for compression.
+ * This controller is the top level of the JPEG compressor proper.
+ * The coefficient buffer lies between forward-DCT and entropy encoding steps.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* We use a full-image coefficient buffer when doing Huffman optimization,
+ * and also for writing multiple-scan JPEG files.  In all cases, the DCT
+ * step is run during the first pass, and subsequent passes need only read
+ * the buffered coefficients.
+ */
+#ifdef ENTROPY_OPT_SUPPORTED
+#define FULL_COEF_BUFFER_SUPPORTED
+#else
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+#define FULL_COEF_BUFFER_SUPPORTED
+#endif
+#endif
+
+
+/* Private buffer controller object */
+
+typedef struct {
+  struct jpeg_c_coef_controller pub; /* public fields */
+
+  JDIMENSION iMCU_row_num;	/* iMCU row # within image */
+  JDIMENSION mcu_ctr;		/* counts MCUs processed in current row */
+  int MCU_vert_offset;		/* counts MCU rows within iMCU row */
+  int MCU_rows_per_iMCU_row;	/* number of such rows needed */
+
+  /* For single-pass compression, it's sufficient to buffer just one MCU
+   * (although this may prove a bit slow in practice).  We allocate a
+   * workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it for each
+   * MCU constructed and sent.  (On 80x86, the workspace is FAR even though
+   * it's not really very big; this is to keep the module interfaces unchanged
+   * when a large coefficient buffer is necessary.)
+   * In multi-pass modes, this array points to the current MCU's blocks
+   * within the virtual arrays.
+   */
+  JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
+
+  /* In multi-pass modes, we need a virtual block array for each component. */
+  jvirt_barray_ptr whole_image[MAX_COMPONENTS];
+} my_coef_controller;
+
+typedef my_coef_controller * my_coef_ptr;
+
+
+/* Forward declarations */
+METHODDEF(boolean) compress_data
+    JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
+#ifdef FULL_COEF_BUFFER_SUPPORTED
+METHODDEF(boolean) compress_first_pass
+    JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
+METHODDEF(boolean) compress_output
+    JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
+#endif
+
+
+LOCAL(void)
+start_iMCU_row (j_compress_ptr cinfo)
+/* Reset within-iMCU-row counters for a new row */
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+
+  /* In an interleaved scan, an MCU row is the same as an iMCU row.
+   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
+   * But at the bottom of the image, process only what's left.
+   */
+  if (cinfo->comps_in_scan > 1) {
+    coef->MCU_rows_per_iMCU_row = 1;
+  } else {
+    if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
+      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
+    else
+      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
+  }
+
+  coef->mcu_ctr = 0;
+  coef->MCU_vert_offset = 0;
+}
+
+
+/*
+ * Initialize for a processing pass.
+ */
+
+METHODDEF(void)
+start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+
+  coef->iMCU_row_num = 0;
+  start_iMCU_row(cinfo);
+
+  switch (pass_mode) {
+  case JBUF_PASS_THRU:
+    if (coef->whole_image[0] != NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    coef->pub.compress_data = compress_data;
+    break;
+#ifdef FULL_COEF_BUFFER_SUPPORTED
+  case JBUF_SAVE_AND_PASS:
+    if (coef->whole_image[0] == NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    coef->pub.compress_data = compress_first_pass;
+    break;
+  case JBUF_CRANK_DEST:
+    if (coef->whole_image[0] == NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    coef->pub.compress_data = compress_output;
+    break;
+#endif
+  default:
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    break;
+  }
+}
+
+
+/*
+ * Process some data in the single-pass case.
+ * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
+ * per call, ie, v_samp_factor block rows for each component in the image.
+ * Returns TRUE if the iMCU row is completed, FALSE if suspended.
+ *
+ * NB: input_buf contains a plane for each component in image,
+ * which we index according to the component's SOF position.
+ */
+
+METHODDEF(boolean)
+compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION MCU_col_num;	/* index of current MCU within row */
+  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
+  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
+  int blkn, bi, ci, yindex, yoffset, blockcnt;
+  JDIMENSION ypos, xpos;
+  jpeg_component_info *compptr;
+
+  /* Loop to write as much as one whole iMCU row */
+  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
+       yoffset++) {
+    for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col;
+	 MCU_col_num++) {
+      /* Determine where data comes from in input_buf and do the DCT thing.
+       * Each call on forward_DCT processes a horizontal row of DCT blocks
+       * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks
+       * sequentially.  Dummy blocks at the right or bottom edge are filled in
+       * specially.  The data in them does not matter for image reconstruction,
+       * so we fill them with values that will encode to the smallest amount of
+       * data, viz: all zeroes in the AC entries, DC entries equal to previous
+       * block's DC value.  (Thanks to Thomas Kinsman for this idea.)
+       */
+      blkn = 0;
+      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+	compptr = cinfo->cur_comp_info[ci];
+	blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
+						: compptr->last_col_width;
+	xpos = MCU_col_num * compptr->MCU_sample_width;
+	ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
+	for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
+	  if (coef->iMCU_row_num < last_iMCU_row ||
+	      yoffset+yindex < compptr->last_row_height) {
+	    (*cinfo->fdct->forward_DCT) (cinfo, compptr,
+					 input_buf[compptr->component_index],
+					 coef->MCU_buffer[blkn],
+					 ypos, xpos, (JDIMENSION) blockcnt);
+	    if (blockcnt < compptr->MCU_width) {
+	      /* Create some dummy blocks at the right edge of the image. */
+	      jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt],
+			(compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK));
+	      for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
+		coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
+	      }
+	    }
+	  } else {
+	    /* Create a row of dummy blocks at the bottom of the image. */
+	    jzero_far((void FAR *) coef->MCU_buffer[blkn],
+		      compptr->MCU_width * SIZEOF(JBLOCK));
+	    for (bi = 0; bi < compptr->MCU_width; bi++) {
+	      coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
+	    }
+	  }
+	  blkn += compptr->MCU_width;
+	  ypos += DCTSIZE;
+	}
+      }
+      /* Try to write the MCU.  In event of a suspension failure, we will
+       * re-DCT the MCU on restart (a bit inefficient, could be fixed...)
+       */
+      if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
+	/* Suspension forced; update state counters and exit */
+	coef->MCU_vert_offset = yoffset;
+	coef->mcu_ctr = MCU_col_num;
+	return FALSE;
+      }
+    }
+    /* Completed an MCU row, but perhaps not an iMCU row */
+    coef->mcu_ctr = 0;
+  }
+  /* Completed the iMCU row, advance counters for next one */
+  coef->iMCU_row_num++;
+  start_iMCU_row(cinfo);
+  return TRUE;
+}
+
+
+#ifdef FULL_COEF_BUFFER_SUPPORTED
+
+/*
+ * Process some data in the first pass of a multi-pass case.
+ * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
+ * per call, ie, v_samp_factor block rows for each component in the image.
+ * This amount of data is read from the source buffer, DCT'd and quantized,
+ * and saved into the virtual arrays.  We also generate suitable dummy blocks
+ * as needed at the right and lower edges.  (The dummy blocks are constructed
+ * in the virtual arrays, which have been padded appropriately.)  This makes
+ * it possible for subsequent passes not to worry about real vs. dummy blocks.
+ *
+ * We must also emit the data to the entropy encoder.  This is conveniently
+ * done by calling compress_output() after we've loaded the current strip
+ * of the virtual arrays.
+ *
+ * NB: input_buf contains a plane for each component in image.  All
+ * components are DCT'd and loaded into the virtual arrays in this pass.
+ * However, it may be that only a subset of the components are emitted to
+ * the entropy encoder during this first pass; be careful about looking
+ * at the scan-dependent variables (MCU dimensions, etc).
+ */
+
+METHODDEF(boolean)
+compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
+  JDIMENSION blocks_across, MCUs_across, MCUindex;
+  int bi, ci, h_samp_factor, block_row, block_rows, ndummy;
+  JCOEF lastDC;
+  jpeg_component_info *compptr;
+  JBLOCKARRAY buffer;
+  JBLOCKROW thisblockrow, lastblockrow;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Align the virtual buffer for this component. */
+    buffer = (*cinfo->mem->access_virt_barray)
+      ((j_common_ptr) cinfo, coef->whole_image[ci],
+       coef->iMCU_row_num * compptr->v_samp_factor,
+       (JDIMENSION) compptr->v_samp_factor, TRUE);
+    /* Count non-dummy DCT block rows in this iMCU row. */
+    if (coef->iMCU_row_num < last_iMCU_row)
+      block_rows = compptr->v_samp_factor;
+    else {
+      /* NB: can't use last_row_height here, since may not be set! */
+      block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+      if (block_rows == 0) block_rows = compptr->v_samp_factor;
+    }
+    blocks_across = compptr->width_in_blocks;
+    h_samp_factor = compptr->h_samp_factor;
+    /* Count number of dummy blocks to be added at the right margin. */
+    ndummy = (int) (blocks_across % h_samp_factor);
+    if (ndummy > 0)
+      ndummy = h_samp_factor - ndummy;
+    /* Perform DCT for all non-dummy blocks in this iMCU row.  Each call
+     * on forward_DCT processes a complete horizontal row of DCT blocks.
+     */
+    for (block_row = 0; block_row < block_rows; block_row++) {
+      thisblockrow = buffer[block_row];
+      (*cinfo->fdct->forward_DCT) (cinfo, compptr,
+				   input_buf[ci], thisblockrow,
+				   (JDIMENSION) (block_row * DCTSIZE),
+				   (JDIMENSION) 0, blocks_across);
+      if (ndummy > 0) {
+	/* Create dummy blocks at the right edge of the image. */
+	thisblockrow += blocks_across; /* => first dummy block */
+	jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
+	lastDC = thisblockrow[-1][0];
+	for (bi = 0; bi < ndummy; bi++) {
+	  thisblockrow[bi][0] = lastDC;
+	}
+      }
+    }
+    /* If at end of image, create dummy block rows as needed.
+     * The tricky part here is that within each MCU, we want the DC values
+     * of the dummy blocks to match the last real block's DC value.
+     * This squeezes a few more bytes out of the resulting file...
+     */
+    if (coef->iMCU_row_num == last_iMCU_row) {
+      blocks_across += ndummy;	/* include lower right corner */
+      MCUs_across = blocks_across / h_samp_factor;
+      for (block_row = block_rows; block_row < compptr->v_samp_factor;
+	   block_row++) {
+	thisblockrow = buffer[block_row];
+	lastblockrow = buffer[block_row-1];
+	jzero_far((void FAR *) thisblockrow,
+		  (size_t) (blocks_across * SIZEOF(JBLOCK)));
+	for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
+	  lastDC = lastblockrow[h_samp_factor-1][0];
+	  for (bi = 0; bi < h_samp_factor; bi++) {
+	    thisblockrow[bi][0] = lastDC;
+	  }
+	  thisblockrow += h_samp_factor; /* advance to next MCU in row */
+	  lastblockrow += h_samp_factor;
+	}
+      }
+    }
+  }
+  /* NB: compress_output will increment iMCU_row_num if successful.
+   * A suspension return will result in redoing all the work above next time.
+   */
+
+  /* Emit data to the entropy encoder, sharing code with subsequent passes */
+  return compress_output(cinfo, input_buf);
+}
+
+
+/*
+ * Process some data in subsequent passes of a multi-pass case.
+ * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
+ * per call, ie, v_samp_factor block rows for each component in the scan.
+ * The data is obtained from the virtual arrays and fed to the entropy coder.
+ * Returns TRUE if the iMCU row is completed, FALSE if suspended.
+ *
+ * NB: input_buf is ignored; it is likely to be a NULL pointer.
+ */
+
+METHODDEF(boolean)
+compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION MCU_col_num;	/* index of current MCU within row */
+  int blkn, ci, xindex, yindex, yoffset;
+  JDIMENSION start_col;
+  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
+  JBLOCKROW buffer_ptr;
+  jpeg_component_info *compptr;
+
+  /* Align the virtual buffers for the components used in this scan.
+   * NB: during first pass, this is safe only because the buffers will
+   * already be aligned properly, so jmemmgr.c won't need to do any I/O.
+   */
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    buffer[ci] = (*cinfo->mem->access_virt_barray)
+      ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
+       coef->iMCU_row_num * compptr->v_samp_factor,
+       (JDIMENSION) compptr->v_samp_factor, FALSE);
+  }
+
+  /* Loop to process one whole iMCU row */
+  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
+       yoffset++) {
+    for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
+	 MCU_col_num++) {
+      /* Construct list of pointers to DCT blocks belonging to this MCU */
+      blkn = 0;			/* index of current DCT block within MCU */
+      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+	compptr = cinfo->cur_comp_info[ci];
+	start_col = MCU_col_num * compptr->MCU_width;
+	for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
+	  buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
+	  for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
+	    coef->MCU_buffer[blkn++] = buffer_ptr++;
+	  }
+	}
+      }
+      /* Try to write the MCU. */
+      if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
+	/* Suspension forced; update state counters and exit */
+	coef->MCU_vert_offset = yoffset;
+	coef->mcu_ctr = MCU_col_num;
+	return FALSE;
+      }
+    }
+    /* Completed an MCU row, but perhaps not an iMCU row */
+    coef->mcu_ctr = 0;
+  }
+  /* Completed the iMCU row, advance counters for next one */
+  coef->iMCU_row_num++;
+  start_iMCU_row(cinfo);
+  return TRUE;
+}
+
+#endif /* FULL_COEF_BUFFER_SUPPORTED */
+
+
+/*
+ * Initialize coefficient buffer controller.
+ */
+
+GLOBAL(void)
+jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
+{
+  my_coef_ptr coef;
+
+  coef = (my_coef_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_coef_controller));
+  cinfo->coef = (struct jpeg_c_coef_controller *) coef;
+  coef->pub.start_pass = start_pass_coef;
+
+  /* Create the coefficient buffer. */
+  if (need_full_buffer) {
+#ifdef FULL_COEF_BUFFER_SUPPORTED
+    /* Allocate a full-image virtual array for each component, */
+    /* padded to a multiple of samp_factor DCT blocks in each direction. */
+    int ci;
+    jpeg_component_info *compptr;
+
+    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	 ci++, compptr++) {
+      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
+	((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
+				(long) compptr->h_samp_factor),
+	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
+				(long) compptr->v_samp_factor),
+	 (JDIMENSION) compptr->v_samp_factor);
+    }
+#else
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+#endif
+  } else {
+    /* We only need a single-MCU buffer. */
+    JBLOCKROW buffer;
+    int i;
+
+    buffer = (JBLOCKROW)
+      (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
+    for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
+      coef->MCU_buffer[i] = buffer + i;
+    }
+    coef->whole_image[0] = NULL; /* flag for no virtual arrays */
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jccolor.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jccolor.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jccolor.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,459 @@
+/*
+ * jccolor.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains input colorspace conversion routines.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Private subobject */
+
+typedef struct {
+  struct jpeg_color_converter pub; /* public fields */
+
+  /* Private state for RGB->YCC conversion */
+  INT32 * rgb_ycc_tab;		/* => table for RGB to YCbCr conversion */
+} my_color_converter;
+
+typedef my_color_converter * my_cconvert_ptr;
+
+
+/**************** RGB -> YCbCr conversion: most common case **************/
+
+/*
+ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
+ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
+ * The conversion equations to be implemented are therefore
+ *	Y  =  0.29900 * R + 0.58700 * G + 0.11400 * B
+ *	Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B  + CENTERJSAMPLE
+ *	Cr =  0.50000 * R - 0.41869 * G - 0.08131 * B  + CENTERJSAMPLE
+ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
+ * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2,
+ * rather than CENTERJSAMPLE, for Cb and Cr.  This gave equal positive and
+ * negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0)
+ * were not represented exactly.  Now we sacrifice exact representation of
+ * maximum red and maximum blue in order to get exact grayscales.
+ *
+ * To avoid floating-point arithmetic, we represent the fractional constants
+ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
+ * the products by 2^16, with appropriate rounding, to get the correct answer.
+ *
+ * For even more speed, we avoid doing any multiplications in the inner loop
+ * by precalculating the constants times R,G,B for all possible values.
+ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
+ * for 12-bit samples it is still acceptable.  It's not very reasonable for
+ * 16-bit samples, but if you want lossless storage you shouldn't be changing
+ * colorspace anyway.
+ * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included
+ * in the tables to save adding them separately in the inner loop.
+ */
+
+#define SCALEBITS	16	/* speediest right-shift on some machines */
+#define CBCR_OFFSET	((INT32) CENTERJSAMPLE << SCALEBITS)
+#define ONE_HALF	((INT32) 1 << (SCALEBITS-1))
+#define FIX(x)		((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
+
+/* We allocate one big table and divide it up into eight parts, instead of
+ * doing eight alloc_small requests.  This lets us use a single table base
+ * address, which can be held in a register in the inner loops on many
+ * machines (more than can hold all eight addresses, anyway).
+ */
+
+#define R_Y_OFF		0			/* offset to R => Y section */
+#define G_Y_OFF		(1*(MAXJSAMPLE+1))	/* offset to G => Y section */
+#define B_Y_OFF		(2*(MAXJSAMPLE+1))	/* etc. */
+#define R_CB_OFF	(3*(MAXJSAMPLE+1))
+#define G_CB_OFF	(4*(MAXJSAMPLE+1))
+#define B_CB_OFF	(5*(MAXJSAMPLE+1))
+#define R_CR_OFF	B_CB_OFF		/* B=>Cb, R=>Cr are the same */
+#define G_CR_OFF	(6*(MAXJSAMPLE+1))
+#define B_CR_OFF	(7*(MAXJSAMPLE+1))
+#define TABLE_SIZE	(8*(MAXJSAMPLE+1))
+
+
+/*
+ * Initialize for RGB->YCC colorspace conversion.
+ */
+
+METHODDEF(void)
+rgb_ycc_start (j_compress_ptr cinfo)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  INT32 * rgb_ycc_tab;
+  INT32 i;
+
+  /* Allocate and fill in the conversion tables. */
+  cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(TABLE_SIZE * SIZEOF(INT32)));
+
+  for (i = 0; i <= MAXJSAMPLE; i++) {
+    rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
+    rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i;
+    rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i     + ONE_HALF;
+    rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i;
+    rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i;
+    /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
+     * This ensures that the maximum output will round to MAXJSAMPLE
+     * not MAXJSAMPLE+1, and thus that we don't have to range-limit.
+     */
+    rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i    + CBCR_OFFSET + ONE_HALF-1;
+/*  B=>Cb and R=>Cr tables are the same
+    rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i    + CBCR_OFFSET + ONE_HALF-1;
+*/
+    rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i;
+    rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i;
+  }
+}
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ *
+ * Note that we change from the application's interleaved-pixel format
+ * to our internal noninterleaved, one-plane-per-component format.
+ * The input buffer is therefore three times as wide as the output buffer.
+ *
+ * A starting row offset is provided only for the output buffer.  The caller
+ * can easily adjust the passed input_buf value to accommodate any row
+ * offset required on that side.
+ */
+
+METHODDEF(void)
+rgb_ycc_convert (j_compress_ptr cinfo,
+		 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+		 JDIMENSION output_row, int num_rows)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  register int r, g, b;
+  register INT32 * ctab = cconvert->rgb_ycc_tab;
+  register JSAMPROW inptr;
+  register JSAMPROW outptr0, outptr1, outptr2;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->image_width;
+
+  while (--num_rows >= 0) {
+    inptr = *input_buf++;
+    outptr0 = output_buf[0][output_row];
+    outptr1 = output_buf[1][output_row];
+    outptr2 = output_buf[2][output_row];
+    output_row++;
+    for (col = 0; col < num_cols; col++) {
+      r = GETJSAMPLE(inptr[RGB_RED]);
+      g = GETJSAMPLE(inptr[RGB_GREEN]);
+      b = GETJSAMPLE(inptr[RGB_BLUE]);
+      inptr += RGB_PIXELSIZE;
+      /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
+       * must be too; we do not need an explicit range-limiting operation.
+       * Hence the value being shifted is never negative, and we don't
+       * need the general RIGHT_SHIFT macro.
+       */
+      /* Y */
+      outptr0[col] = (JSAMPLE)
+		((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
+		 >> SCALEBITS);
+      /* Cb */
+      outptr1[col] = (JSAMPLE)
+		((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
+		 >> SCALEBITS);
+      /* Cr */
+      outptr2[col] = (JSAMPLE)
+		((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
+		 >> SCALEBITS);
+    }
+  }
+}
+
+
+/**************** Cases other than RGB -> YCbCr **************/
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ * This version handles RGB->grayscale conversion, which is the same
+ * as the RGB->Y portion of RGB->YCbCr.
+ * We assume rgb_ycc_start has been called (we only use the Y tables).
+ */
+
+METHODDEF(void)
+rgb_gray_convert (j_compress_ptr cinfo,
+		  JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+		  JDIMENSION output_row, int num_rows)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  register int r, g, b;
+  register INT32 * ctab = cconvert->rgb_ycc_tab;
+  register JSAMPROW inptr;
+  register JSAMPROW outptr;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->image_width;
+
+  while (--num_rows >= 0) {
+    inptr = *input_buf++;
+    outptr = output_buf[0][output_row];
+    output_row++;
+    for (col = 0; col < num_cols; col++) {
+      r = GETJSAMPLE(inptr[RGB_RED]);
+      g = GETJSAMPLE(inptr[RGB_GREEN]);
+      b = GETJSAMPLE(inptr[RGB_BLUE]);
+      inptr += RGB_PIXELSIZE;
+      /* Y */
+      outptr[col] = (JSAMPLE)
+		((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
+		 >> SCALEBITS);
+    }
+  }
+}
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ * This version handles Adobe-style CMYK->YCCK conversion,
+ * where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the same
+ * conversion as above, while passing K (black) unchanged.
+ * We assume rgb_ycc_start has been called.
+ */
+
+METHODDEF(void)
+cmyk_ycck_convert (j_compress_ptr cinfo,
+		   JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+		   JDIMENSION output_row, int num_rows)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  register int r, g, b;
+  register INT32 * ctab = cconvert->rgb_ycc_tab;
+  register JSAMPROW inptr;
+  register JSAMPROW outptr0, outptr1, outptr2, outptr3;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->image_width;
+
+  while (--num_rows >= 0) {
+    inptr = *input_buf++;
+    outptr0 = output_buf[0][output_row];
+    outptr1 = output_buf[1][output_row];
+    outptr2 = output_buf[2][output_row];
+    outptr3 = output_buf[3][output_row];
+    output_row++;
+    for (col = 0; col < num_cols; col++) {
+      r = MAXJSAMPLE - GETJSAMPLE(inptr[0]);
+      g = MAXJSAMPLE - GETJSAMPLE(inptr[1]);
+      b = MAXJSAMPLE - GETJSAMPLE(inptr[2]);
+      /* K passes through as-is */
+      outptr3[col] = inptr[3];	/* don't need GETJSAMPLE here */
+      inptr += 4;
+      /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
+       * must be too; we do not need an explicit range-limiting operation.
+       * Hence the value being shifted is never negative, and we don't
+       * need the general RIGHT_SHIFT macro.
+       */
+      /* Y */
+      outptr0[col] = (JSAMPLE)
+		((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
+		 >> SCALEBITS);
+      /* Cb */
+      outptr1[col] = (JSAMPLE)
+		((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
+		 >> SCALEBITS);
+      /* Cr */
+      outptr2[col] = (JSAMPLE)
+		((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
+		 >> SCALEBITS);
+    }
+  }
+}
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ * This version handles grayscale output with no conversion.
+ * The source can be either plain grayscale or YCbCr (since Y == gray).
+ */
+
+METHODDEF(void)
+grayscale_convert (j_compress_ptr cinfo,
+		   JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+		   JDIMENSION output_row, int num_rows)
+{
+  register JSAMPROW inptr;
+  register JSAMPROW outptr;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->image_width;
+  int instride = cinfo->input_components;
+
+  while (--num_rows >= 0) {
+    inptr = *input_buf++;
+    outptr = output_buf[0][output_row];
+    output_row++;
+    for (col = 0; col < num_cols; col++) {
+      outptr[col] = inptr[0];	/* don't need GETJSAMPLE() here */
+      inptr += instride;
+    }
+  }
+}
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ * This version handles multi-component colorspaces without conversion.
+ * We assume input_components == num_components.
+ */
+
+METHODDEF(void)
+null_convert (j_compress_ptr cinfo,
+	      JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+	      JDIMENSION output_row, int num_rows)
+{
+  register JSAMPROW inptr;
+  register JSAMPROW outptr;
+  register JDIMENSION col;
+  register int ci;
+  int nc = cinfo->num_components;
+  JDIMENSION num_cols = cinfo->image_width;
+
+  while (--num_rows >= 0) {
+    /* It seems fastest to make a separate pass for each component. */
+    for (ci = 0; ci < nc; ci++) {
+      inptr = *input_buf;
+      outptr = output_buf[ci][output_row];
+      for (col = 0; col < num_cols; col++) {
+	outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
+	inptr += nc;
+      }
+    }
+    input_buf++;
+    output_row++;
+  }
+}
+
+
+/*
+ * Empty method for start_pass.
+ */
+
+METHODDEF(void)
+null_method (j_compress_ptr cinfo)
+{
+  /* no work needed */
+}
+
+
+/*
+ * Module initialization routine for input colorspace conversion.
+ */
+
+GLOBAL(void)
+jinit_color_converter (j_compress_ptr cinfo)
+{
+  my_cconvert_ptr cconvert;
+
+  cconvert = (my_cconvert_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_color_converter));
+  cinfo->cconvert = (struct jpeg_color_converter *) cconvert;
+  /* set start_pass to null method until we find out differently */
+  cconvert->pub.start_pass = null_method;
+
+  /* Make sure input_components agrees with in_color_space */
+  switch (cinfo->in_color_space) {
+  case JCS_GRAYSCALE:
+    if (cinfo->input_components != 1)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+
+  case JCS_RGB:
+#if RGB_PIXELSIZE != 3
+    if (cinfo->input_components != RGB_PIXELSIZE)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+#endif /* else share code with YCbCr */
+
+  case JCS_YCbCr:
+    if (cinfo->input_components != 3)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+
+  case JCS_CMYK:
+  case JCS_YCCK:
+    if (cinfo->input_components != 4)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+
+  default:			/* JCS_UNKNOWN can be anything */
+    if (cinfo->input_components < 1)
+      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+    break;
+  }
+
+  /* Check num_components, set conversion method based on requested space */
+  switch (cinfo->jpeg_color_space) {
+  case JCS_GRAYSCALE:
+    if (cinfo->num_components != 1)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_GRAYSCALE)
+      cconvert->pub.color_convert = grayscale_convert;
+    else if (cinfo->in_color_space == JCS_RGB) {
+      cconvert->pub.start_pass = rgb_ycc_start;
+      cconvert->pub.color_convert = rgb_gray_convert;
+    } else if (cinfo->in_color_space == JCS_YCbCr)
+      cconvert->pub.color_convert = grayscale_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_RGB:
+    if (cinfo->num_components != 3)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_RGB && RGB_PIXELSIZE == 3)
+      cconvert->pub.color_convert = null_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_YCbCr:
+    if (cinfo->num_components != 3)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_RGB) {
+      cconvert->pub.start_pass = rgb_ycc_start;
+      cconvert->pub.color_convert = rgb_ycc_convert;
+    } else if (cinfo->in_color_space == JCS_YCbCr)
+      cconvert->pub.color_convert = null_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_CMYK:
+    if (cinfo->num_components != 4)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_CMYK)
+      cconvert->pub.color_convert = null_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_YCCK:
+    if (cinfo->num_components != 4)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    if (cinfo->in_color_space == JCS_CMYK) {
+      cconvert->pub.start_pass = rgb_ycc_start;
+      cconvert->pub.color_convert = cmyk_ycck_convert;
+    } else if (cinfo->in_color_space == JCS_YCCK)
+      cconvert->pub.color_convert = null_convert;
+    else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  default:			/* allow null conversion of JCS_UNKNOWN */
+    if (cinfo->jpeg_color_space != cinfo->in_color_space ||
+	cinfo->num_components != cinfo->input_components)
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    cconvert->pub.color_convert = null_convert;
+    break;
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcdctmgr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcdctmgr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcdctmgr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,387 @@
+/*
+ * jcdctmgr.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the forward-DCT management logic.
+ * This code selects a particular DCT implementation to be used,
+ * and it performs related housekeeping chores including coefficient
+ * quantization.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"		/* Private declarations for DCT subsystem */
+
+
+/* Private subobject for this module */
+
+typedef struct {
+  struct jpeg_forward_dct pub;	/* public fields */
+
+  /* Pointer to the DCT routine actually in use */
+  forward_DCT_method_ptr do_dct;
+
+  /* The actual post-DCT divisors --- not identical to the quant table
+   * entries, because of scaling (especially for an unnormalized DCT).
+   * Each table is given in normal array order.
+   */
+  DCTELEM * divisors[NUM_QUANT_TBLS];
+
+#ifdef DCT_FLOAT_SUPPORTED
+  /* Same as above for the floating-point case. */
+  float_DCT_method_ptr do_float_dct;
+  FAST_FLOAT * float_divisors[NUM_QUANT_TBLS];
+#endif
+} my_fdct_controller;
+
+typedef my_fdct_controller * my_fdct_ptr;
+
+
+/*
+ * Initialize for a processing pass.
+ * Verify that all referenced Q-tables are present, and set up
+ * the divisor table for each one.
+ * In the current implementation, DCT of all components is done during
+ * the first pass, even if only some components will be output in the
+ * first scan.  Hence all components should be examined here.
+ */
+
+METHODDEF(void)
+start_pass_fdctmgr (j_compress_ptr cinfo)
+{
+  my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
+  int ci, qtblno, i;
+  jpeg_component_info *compptr;
+  JQUANT_TBL * qtbl;
+  DCTELEM * dtbl;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    qtblno = compptr->quant_tbl_no;
+    /* Make sure specified quantization table is present */
+    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
+	cinfo->quant_tbl_ptrs[qtblno] == NULL)
+      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
+    qtbl = cinfo->quant_tbl_ptrs[qtblno];
+    /* Compute divisors for this quant table */
+    /* We may do this more than once for same table, but it's not a big deal */
+    switch (cinfo->dct_method) {
+#ifdef DCT_ISLOW_SUPPORTED
+    case JDCT_ISLOW:
+      /* For LL&M IDCT method, divisors are equal to raw quantization
+       * coefficients multiplied by 8 (to counteract scaling).
+       */
+      if (fdct->divisors[qtblno] == NULL) {
+	fdct->divisors[qtblno] = (DCTELEM *)
+	  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				      DCTSIZE2 * SIZEOF(DCTELEM));
+      }
+      dtbl = fdct->divisors[qtblno];
+      for (i = 0; i < DCTSIZE2; i++) {
+	dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3;
+      }
+      break;
+#endif
+#ifdef DCT_IFAST_SUPPORTED
+    case JDCT_IFAST:
+      {
+	/* For AA&N IDCT method, divisors are equal to quantization
+	 * coefficients scaled by scalefactor[row]*scalefactor[col], where
+	 *   scalefactor[0] = 1
+	 *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
+	 * We apply a further scale factor of 8.
+	 */
+#define CONST_BITS 14
+	static const INT16 aanscales[DCTSIZE2] = {
+	  /* precomputed values scaled up by 14 bits */
+	  16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
+	  22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
+	  21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
+	  19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
+	  16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
+	  12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
+	   8867, 12299, 11585, 10426,  8867,  6967,  4799,  2446,
+	   4520,  6270,  5906,  5315,  4520,  3552,  2446,  1247
+	};
+	SHIFT_TEMPS
+
+	if (fdct->divisors[qtblno] == NULL) {
+	  fdct->divisors[qtblno] = (DCTELEM *)
+	    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+					DCTSIZE2 * SIZEOF(DCTELEM));
+	}
+	dtbl = fdct->divisors[qtblno];
+	for (i = 0; i < DCTSIZE2; i++) {
+	  dtbl[i] = (DCTELEM)
+	    DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
+				  (INT32) aanscales[i]),
+		    CONST_BITS-3);
+	}
+      }
+      break;
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+    case JDCT_FLOAT:
+      {
+	/* For float AA&N IDCT method, divisors are equal to quantization
+	 * coefficients scaled by scalefactor[row]*scalefactor[col], where
+	 *   scalefactor[0] = 1
+	 *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
+	 * We apply a further scale factor of 8.
+	 * What's actually stored is 1/divisor so that the inner loop can
+	 * use a multiplication rather than a division.
+	 */
+	FAST_FLOAT * fdtbl;
+	int row, col;
+	static const double aanscalefactor[DCTSIZE] = {
+	  1.0, 1.387039845, 1.306562965, 1.175875602,
+	  1.0, 0.785694958, 0.541196100, 0.275899379
+	};
+
+	if (fdct->float_divisors[qtblno] == NULL) {
+	  fdct->float_divisors[qtblno] = (FAST_FLOAT *)
+	    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+					DCTSIZE2 * SIZEOF(FAST_FLOAT));
+	}
+	fdtbl = fdct->float_divisors[qtblno];
+	i = 0;
+	for (row = 0; row < DCTSIZE; row++) {
+	  for (col = 0; col < DCTSIZE; col++) {
+	    fdtbl[i] = (FAST_FLOAT)
+	      (1.0 / (((double) qtbl->quantval[i] *
+		       aanscalefactor[row] * aanscalefactor[col] * 8.0)));
+	    i++;
+	  }
+	}
+      }
+      break;
+#endif
+    default:
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+      break;
+    }
+  }
+}
+
+
+/*
+ * Perform forward DCT on one or more blocks of a component.
+ *
+ * The input samples are taken from the sample_data[] array starting at
+ * position start_row/start_col, and moving to the right for any additional
+ * blocks. The quantized coefficients are returned in coef_blocks[].
+ */
+
+METHODDEF(void)
+forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
+	     JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
+	     JDIMENSION start_row, JDIMENSION start_col,
+	     JDIMENSION num_blocks)
+/* This version is used for integer DCT implementations. */
+{
+  /* This routine is heavily used, so it's worth coding it tightly. */
+  my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
+  forward_DCT_method_ptr do_dct = fdct->do_dct;
+  DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no];
+  DCTELEM workspace[DCTSIZE2];	/* work area for FDCT subroutine */
+  JDIMENSION bi;
+
+  sample_data += start_row;	/* fold in the vertical offset once */
+
+  for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {
+    /* Load data into workspace, applying unsigned->signed conversion */
+    { register DCTELEM *workspaceptr;
+      register JSAMPROW elemptr;
+      register int elemr;
+
+      workspaceptr = workspace;
+      for (elemr = 0; elemr < DCTSIZE; elemr++) {
+	elemptr = sample_data[elemr] + start_col;
+#if DCTSIZE == 8		/* unroll the inner loop */
+	*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
+	*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
+	*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
+	*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
+	*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
+	*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
+	*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
+	*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
+#else
+	{ register int elemc;
+	  for (elemc = DCTSIZE; elemc > 0; elemc--) {
+	    *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
+	  }
+	}
+#endif
+      }
+    }
+
+    /* Perform the DCT */
+    (*do_dct) (workspace);
+
+    /* Quantize/descale the coefficients, and store into coef_blocks[] */
+    { register DCTELEM temp, qval;
+      register int i;
+      register JCOEFPTR output_ptr = coef_blocks[bi];
+
+      for (i = 0; i < DCTSIZE2; i++) {
+	qval = divisors[i];
+	temp = workspace[i];
+	/* Divide the coefficient value by qval, ensuring proper rounding.
+	 * Since C does not specify the direction of rounding for negative
+	 * quotients, we have to force the dividend positive for portability.
+	 *
+	 * In most files, at least half of the output values will be zero
+	 * (at default quantization settings, more like three-quarters...)
+	 * so we should ensure that this case is fast.  On many machines,
+	 * a comparison is enough cheaper than a divide to make a special test
+	 * a win.  Since both inputs will be nonnegative, we need only test
+	 * for a < b to discover whether a/b is 0.
+	 * If your machine's division is fast enough, define FAST_DIVIDE.
+	 */
+#ifdef FAST_DIVIDE
+#define DIVIDE_BY(a,b)	a /= b
+#else
+#define DIVIDE_BY(a,b)	if (a >= b) a /= b; else a = 0
+#endif
+	if (temp < 0) {
+	  temp = -temp;
+	  temp += qval>>1;	/* for rounding */
+	  DIVIDE_BY(temp, qval);
+	  temp = -temp;
+	} else {
+	  temp += qval>>1;	/* for rounding */
+	  DIVIDE_BY(temp, qval);
+	}
+	output_ptr[i] = (JCOEF) temp;
+      }
+    }
+  }
+}
+
+
+#ifdef DCT_FLOAT_SUPPORTED
+
+METHODDEF(void)
+forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
+		   JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
+		   JDIMENSION start_row, JDIMENSION start_col,
+		   JDIMENSION num_blocks)
+/* This version is used for floating-point DCT implementations. */
+{
+  /* This routine is heavily used, so it's worth coding it tightly. */
+  my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
+  float_DCT_method_ptr do_dct = fdct->do_float_dct;
+  FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no];
+  FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */
+  JDIMENSION bi;
+
+  sample_data += start_row;	/* fold in the vertical offset once */
+
+  for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {
+    /* Load data into workspace, applying unsigned->signed conversion */
+    { register FAST_FLOAT *workspaceptr;
+      register JSAMPROW elemptr;
+      register int elemr;
+
+      workspaceptr = workspace;
+      for (elemr = 0; elemr < DCTSIZE; elemr++) {
+	elemptr = sample_data[elemr] + start_col;
+#if DCTSIZE == 8		/* unroll the inner loop */
+	*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+	*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+	*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+	*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+	*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+	*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+	*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+	*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+#else
+	{ register int elemc;
+	  for (elemc = DCTSIZE; elemc > 0; elemc--) {
+	    *workspaceptr++ = (FAST_FLOAT)
+	      (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+	  }
+	}
+#endif
+      }
+    }
+
+    /* Perform the DCT */
+    (*do_dct) (workspace);
+
+    /* Quantize/descale the coefficients, and store into coef_blocks[] */
+    { register FAST_FLOAT temp;
+      register int i;
+      register JCOEFPTR output_ptr = coef_blocks[bi];
+
+      for (i = 0; i < DCTSIZE2; i++) {
+	/* Apply the quantization and scaling factor */
+	temp = workspace[i] * divisors[i];
+	/* Round to nearest integer.
+	 * Since C does not specify the direction of rounding for negative
+	 * quotients, we have to force the dividend positive for portability.
+	 * The maximum coefficient size is +-16K (for 12-bit data), so this
+	 * code should work for either 16-bit or 32-bit ints.
+	 */
+	output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384);
+      }
+    }
+  }
+}
+
+#endif /* DCT_FLOAT_SUPPORTED */
+
+
+/*
+ * Initialize FDCT manager.
+ */
+
+GLOBAL(void)
+jinit_forward_dct (j_compress_ptr cinfo)
+{
+  my_fdct_ptr fdct;
+  int i;
+
+  fdct = (my_fdct_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_fdct_controller));
+  cinfo->fdct = (struct jpeg_forward_dct *) fdct;
+  fdct->pub.start_pass = start_pass_fdctmgr;
+
+  switch (cinfo->dct_method) {
+#ifdef DCT_ISLOW_SUPPORTED
+  case JDCT_ISLOW:
+    fdct->pub.forward_DCT = forward_DCT;
+    fdct->do_dct = jpeg_fdct_islow;
+    break;
+#endif
+#ifdef DCT_IFAST_SUPPORTED
+  case JDCT_IFAST:
+    fdct->pub.forward_DCT = forward_DCT;
+    fdct->do_dct = jpeg_fdct_ifast;
+    break;
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+  case JDCT_FLOAT:
+    fdct->pub.forward_DCT = forward_DCT_float;
+    fdct->do_float_dct = jpeg_fdct_float;
+    break;
+#endif
+  default:
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+    break;
+  }
+
+  /* Mark divisor tables unallocated */
+  for (i = 0; i < NUM_QUANT_TBLS; i++) {
+    fdct->divisors[i] = NULL;
+#ifdef DCT_FLOAT_SUPPORTED
+    fdct->float_divisors[i] = NULL;
+#endif
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jchuff.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jchuff.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jchuff.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,909 @@
+/*
+ * jchuff.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains Huffman entropy encoding routines.
+ *
+ * Much of the complexity here has to do with supporting output suspension.
+ * If the data destination module demands suspension, we want to be able to
+ * back up to the start of the current MCU.  To do this, we copy state
+ * variables into local working storage, and update them back to the
+ * permanent JPEG objects only upon successful completion of an MCU.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jchuff.h"		/* Declarations shared with jcphuff.c */
+
+
+/* Expanded entropy encoder object for Huffman encoding.
+ *
+ * The savable_state subrecord contains fields that change within an MCU,
+ * but must not be updated permanently until we complete the MCU.
+ */
+
+typedef struct {
+  INT32 put_buffer;		/* current bit-accumulation buffer */
+  int put_bits;			/* # of bits now in it */
+  int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
+} savable_state;
+
+/* This macro is to work around compilers with missing or broken
+ * structure assignment.  You'll need to fix this code if you have
+ * such a compiler and you change MAX_COMPS_IN_SCAN.
+ */
+
+#ifndef NO_STRUCT_ASSIGN
+#define ASSIGN_STATE(dest,src)  ((dest) = (src))
+#else
+#if MAX_COMPS_IN_SCAN == 4
+#define ASSIGN_STATE(dest,src)  \
+	((dest).put_buffer = (src).put_buffer, \
+	 (dest).put_bits = (src).put_bits, \
+	 (dest).last_dc_val[0] = (src).last_dc_val[0], \
+	 (dest).last_dc_val[1] = (src).last_dc_val[1], \
+	 (dest).last_dc_val[2] = (src).last_dc_val[2], \
+	 (dest).last_dc_val[3] = (src).last_dc_val[3])
+#endif
+#endif
+
+
+typedef struct {
+  struct jpeg_entropy_encoder pub; /* public fields */
+
+  savable_state saved;		/* Bit buffer & DC state at start of MCU */
+
+  /* These fields are NOT loaded into local working state. */
+  unsigned int restarts_to_go;	/* MCUs left in this restart interval */
+  int next_restart_num;		/* next restart number to write (0-7) */
+
+  /* Pointers to derived tables (these workspaces have image lifespan) */
+  c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS];
+  c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS];
+
+#ifdef ENTROPY_OPT_SUPPORTED	/* Statistics tables for optimization */
+  long * dc_count_ptrs[NUM_HUFF_TBLS];
+  long * ac_count_ptrs[NUM_HUFF_TBLS];
+#endif
+} huff_entropy_encoder;
+
+typedef huff_entropy_encoder * huff_entropy_ptr;
+
+/* Working state while writing an MCU.
+ * This struct contains all the fields that are needed by subroutines.
+ */
+
+typedef struct {
+  JOCTET * next_output_byte;	/* => next byte to write in buffer */
+  size_t free_in_buffer;	/* # of byte spaces remaining in buffer */
+  savable_state cur;		/* Current bit buffer & DC state */
+  j_compress_ptr cinfo;		/* dump_buffer needs access to this */
+} working_state;
+
+
+/* Forward declarations */
+METHODDEF(boolean) encode_mcu_huff JPP((j_compress_ptr cinfo,
+					JBLOCKROW *MCU_data));
+METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo));
+#ifdef ENTROPY_OPT_SUPPORTED
+METHODDEF(boolean) encode_mcu_gather JPP((j_compress_ptr cinfo,
+					  JBLOCKROW *MCU_data));
+METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo));
+#endif
+
+
+/*
+ * Initialize for a Huffman-compressed scan.
+ * If gather_statistics is TRUE, we do not output anything during the scan,
+ * just count the Huffman symbols used and generate Huffman code tables.
+ */
+
+METHODDEF(void)
+start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
+{
+  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+  int ci, dctbl, actbl;
+  jpeg_component_info * compptr;
+
+  if (gather_statistics) {
+#ifdef ENTROPY_OPT_SUPPORTED
+    entropy->pub.encode_mcu = encode_mcu_gather;
+    entropy->pub.finish_pass = finish_pass_gather;
+#else
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+  } else {
+    entropy->pub.encode_mcu = encode_mcu_huff;
+    entropy->pub.finish_pass = finish_pass_huff;
+  }
+
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    dctbl = compptr->dc_tbl_no;
+    actbl = compptr->ac_tbl_no;
+    if (gather_statistics) {
+#ifdef ENTROPY_OPT_SUPPORTED
+      /* Check for invalid table indexes */
+      /* (make_c_derived_tbl does this in the other path) */
+      if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS)
+	ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
+      if (actbl < 0 || actbl >= NUM_HUFF_TBLS)
+	ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
+      /* Allocate and zero the statistics tables */
+      /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
+      if (entropy->dc_count_ptrs[dctbl] == NULL)
+	entropy->dc_count_ptrs[dctbl] = (long *)
+	  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				      257 * SIZEOF(long));
+      MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long));
+      if (entropy->ac_count_ptrs[actbl] == NULL)
+	entropy->ac_count_ptrs[actbl] = (long *)
+	  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				      257 * SIZEOF(long));
+      MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long));
+#endif
+    } else {
+      /* Compute derived values for Huffman tables */
+      /* We may do this more than once for a table, but it's not expensive */
+      jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
+			      & entropy->dc_derived_tbls[dctbl]);
+      jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
+			      & entropy->ac_derived_tbls[actbl]);
+    }
+    /* Initialize DC predictions to 0 */
+    entropy->saved.last_dc_val[ci] = 0;
+  }
+
+  /* Initialize bit buffer to empty */
+  entropy->saved.put_buffer = 0;
+  entropy->saved.put_bits = 0;
+
+  /* Initialize restart stuff */
+  entropy->restarts_to_go = cinfo->restart_interval;
+  entropy->next_restart_num = 0;
+}
+
+
+/*
+ * Compute the derived values for a Huffman table.
+ * This routine also performs some validation checks on the table.
+ *
+ * Note this is also used by jcphuff.c.
+ */
+
+GLOBAL(void)
+jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
+			 c_derived_tbl ** pdtbl)
+{
+  JHUFF_TBL *htbl;
+  c_derived_tbl *dtbl;
+  int p, i, l, lastp, si, maxsymbol;
+  char huffsize[257];
+  unsigned int huffcode[257];
+  unsigned int code;
+
+  /* Note that huffsize[] and huffcode[] are filled in code-length order,
+   * paralleling the order of the symbols themselves in htbl->huffval[].
+   */
+
+  /* Find the input Huffman table */
+  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
+    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
+  htbl =
+    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
+  if (htbl == NULL)
+    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
+
+  /* Allocate a workspace if we haven't already done so. */
+  if (*pdtbl == NULL)
+    *pdtbl = (c_derived_tbl *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(c_derived_tbl));
+  dtbl = *pdtbl;
+  
+  /* Figure C.1: make table of Huffman code length for each symbol */
+
+  p = 0;
+  for (l = 1; l <= 16; l++) {
+    i = (int) htbl->bits[l];
+    if (i < 0 || p + i > 256)	/* protect against table overrun */
+      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+    while (i--)
+      huffsize[p++] = (char) l;
+  }
+  huffsize[p] = 0;
+  lastp = p;
+  
+  /* Figure C.2: generate the codes themselves */
+  /* We also validate that the counts represent a legal Huffman code tree. */
+
+  code = 0;
+  si = huffsize[0];
+  p = 0;
+  while (huffsize[p]) {
+    while (((int) huffsize[p]) == si) {
+      huffcode[p++] = code;
+      code++;
+    }
+    /* code is now 1 more than the last code used for codelength si; but
+     * it must still fit in si bits, since no code is allowed to be all ones.
+     */
+    if (((INT32) code) >= (((INT32) 1) << si))
+      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+    code <<= 1;
+    si++;
+  }
+  
+  /* Figure C.3: generate encoding tables */
+  /* These are code and size indexed by symbol value */
+
+  /* Set all codeless symbols to have code length 0;
+   * this lets us detect duplicate VAL entries here, and later
+   * allows emit_bits to detect any attempt to emit such symbols.
+   */
+  MEMZERO(dtbl->ehufsi, SIZEOF(dtbl->ehufsi));
+
+  /* This is also a convenient place to check for out-of-range
+   * and duplicated VAL entries.  We allow 0..255 for AC symbols
+   * but only 0..15 for DC.  (We could constrain them further
+   * based on data depth and mode, but this seems enough.)
+   */
+  maxsymbol = isDC ? 15 : 255;
+
+  for (p = 0; p < lastp; p++) {
+    i = htbl->huffval[p];
+    if (i < 0 || i > maxsymbol || dtbl->ehufsi[i])
+      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+    dtbl->ehufco[i] = huffcode[p];
+    dtbl->ehufsi[i] = huffsize[p];
+  }
+}
+
+
+/* Outputting bytes to the file */
+
+/* Emit a byte, taking 'action' if must suspend. */
+#define emit_byte(state,val,action)  \
+	{ *(state)->next_output_byte++ = (JOCTET) (val);  \
+	  if (--(state)->free_in_buffer == 0)  \
+	    if (! dump_buffer(state))  \
+	      { action; } }
+
+
+LOCAL(boolean)
+dump_buffer (working_state * state)
+/* Empty the output buffer; return TRUE if successful, FALSE if must suspend */
+{
+  struct jpeg_destination_mgr * dest = state->cinfo->dest;
+
+  if (! (*dest->empty_output_buffer) (state->cinfo))
+    return FALSE;
+  /* After a successful buffer dump, must reset buffer pointers */
+  state->next_output_byte = dest->next_output_byte;
+  state->free_in_buffer = dest->free_in_buffer;
+  return TRUE;
+}
+
+
+/* Outputting bits to the file */
+
+/* Only the right 24 bits of put_buffer are used; the valid bits are
+ * left-justified in this part.  At most 16 bits can be passed to emit_bits
+ * in one call, and we never retain more than 7 bits in put_buffer
+ * between calls, so 24 bits are sufficient.
+ */
+
+INLINE
+LOCAL(boolean)
+emit_bits (working_state * state, unsigned int code, int size)
+/* Emit some bits; return TRUE if successful, FALSE if must suspend */
+{
+  /* This routine is heavily used, so it's worth coding tightly. */
+  register INT32 put_buffer = (INT32) code;
+  register int put_bits = state->cur.put_bits;
+
+  /* if size is 0, caller used an invalid Huffman table entry */
+  if (size == 0)
+    ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE);
+
+  put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */
+  
+  put_bits += size;		/* new number of bits in buffer */
+  
+  put_buffer <<= 24 - put_bits; /* align incoming bits */
+
+  put_buffer |= state->cur.put_buffer; /* and merge with old buffer contents */
+  
+  while (put_bits >= 8) {
+    int c = (int) ((put_buffer >> 16) & 0xFF);
+    
+    emit_byte(state, c, return FALSE);
+    if (c == 0xFF) {		/* need to stuff a zero byte? */
+      emit_byte(state, 0, return FALSE);
+    }
+    put_buffer <<= 8;
+    put_bits -= 8;
+  }
+
+  state->cur.put_buffer = put_buffer; /* update state variables */
+  state->cur.put_bits = put_bits;
+
+  return TRUE;
+}
+
+
+LOCAL(boolean)
+flush_bits (working_state * state)
+{
+  if (! emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */
+    return FALSE;
+  state->cur.put_buffer = 0;	/* and reset bit-buffer to empty */
+  state->cur.put_bits = 0;
+  return TRUE;
+}
+
+
+/* Encode a single block's worth of coefficients */
+
+LOCAL(boolean)
+encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
+		  c_derived_tbl *dctbl, c_derived_tbl *actbl)
+{
+  register int temp, temp2;
+  register int nbits;
+  register int k, r, i;
+  
+  /* Encode the DC coefficient difference per section F.1.2.1 */
+  
+  temp = temp2 = block[0] - last_dc_val;
+
+  if (temp < 0) {
+    temp = -temp;		/* temp is abs value of input */
+    /* For a negative input, want temp2 = bitwise complement of abs(input) */
+    /* This code assumes we are on a two's complement machine */
+    temp2--;
+  }
+  
+  /* Find the number of bits needed for the magnitude of the coefficient */
+  nbits = 0;
+  while (temp) {
+    nbits++;
+    temp >>= 1;
+  }
+  /* Check for out-of-range coefficient values.
+   * Since we're encoding a difference, the range limit is twice as much.
+   */
+  if (nbits > MAX_COEF_BITS+1)
+    ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
+  
+  /* Emit the Huffman-coded symbol for the number of bits */
+  if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))
+    return FALSE;
+
+  /* Emit that number of bits of the value, if positive, */
+  /* or the complement of its magnitude, if negative. */
+  if (nbits)			/* emit_bits rejects calls with size 0 */
+    if (! emit_bits(state, (unsigned int) temp2, nbits))
+      return FALSE;
+
+  /* Encode the AC coefficients per section F.1.2.2 */
+  
+  r = 0;			/* r = run length of zeros */
+  
+  for (k = 1; k < DCTSIZE2; k++) {
+    if ((temp = block[jpeg_natural_order[k]]) == 0) {
+      r++;
+    } else {
+      /* if run length > 15, must emit special run-length-16 codes (0xF0) */
+      while (r > 15) {
+	if (! emit_bits(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0]))
+	  return FALSE;
+	r -= 16;
+      }
+
+      temp2 = temp;
+      if (temp < 0) {
+	temp = -temp;		/* temp is abs value of input */
+	/* This code assumes we are on a two's complement machine */
+	temp2--;
+      }
+      
+      /* Find the number of bits needed for the magnitude of the coefficient */
+      nbits = 1;		/* there must be at least one 1 bit */
+      while ((temp >>= 1))
+	nbits++;
+      /* Check for out-of-range coefficient values */
+      if (nbits > MAX_COEF_BITS)
+	ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
+      
+      /* Emit Huffman symbol for run length / number of bits */
+      i = (r << 4) + nbits;
+      if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i]))
+	return FALSE;
+
+      /* Emit that number of bits of the value, if positive, */
+      /* or the complement of its magnitude, if negative. */
+      if (! emit_bits(state, (unsigned int) temp2, nbits))
+	return FALSE;
+      
+      r = 0;
+    }
+  }
+
+  /* If the last coef(s) were zero, emit an end-of-block code */
+  if (r > 0)
+    if (! emit_bits(state, actbl->ehufco[0], actbl->ehufsi[0]))
+      return FALSE;
+
+  return TRUE;
+}
+
+
+/*
+ * Emit a restart marker & resynchronize predictions.
+ */
+
+LOCAL(boolean)
+emit_restart (working_state * state, int restart_num)
+{
+  int ci;
+
+  if (! flush_bits(state))
+    return FALSE;
+
+  emit_byte(state, 0xFF, return FALSE);
+  emit_byte(state, JPEG_RST0 + restart_num, return FALSE);
+
+  /* Re-initialize DC predictions to 0 */
+  for (ci = 0; ci < state->cinfo->comps_in_scan; ci++)
+    state->cur.last_dc_val[ci] = 0;
+
+  /* The restart counter is not updated until we successfully write the MCU. */
+
+  return TRUE;
+}
+
+
+/*
+ * Encode and output one MCU's worth of Huffman-compressed coefficients.
+ */
+
+METHODDEF(boolean)
+encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+{
+  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+  working_state state;
+  int blkn, ci;
+  jpeg_component_info * compptr;
+
+  /* Load up working state */
+  state.next_output_byte = cinfo->dest->next_output_byte;
+  state.free_in_buffer = cinfo->dest->free_in_buffer;
+  ASSIGN_STATE(state.cur, entropy->saved);
+  state.cinfo = cinfo;
+
+  /* Emit restart marker if needed */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0)
+      if (! emit_restart(&state, entropy->next_restart_num))
+	return FALSE;
+  }
+
+  /* Encode the MCU data blocks */
+  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+    ci = cinfo->MCU_membership[blkn];
+    compptr = cinfo->cur_comp_info[ci];
+    if (! encode_one_block(&state,
+			   MCU_data[blkn][0], state.cur.last_dc_val[ci],
+			   entropy->dc_derived_tbls[compptr->dc_tbl_no],
+			   entropy->ac_derived_tbls[compptr->ac_tbl_no]))
+      return FALSE;
+    /* Update last_dc_val */
+    state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
+  }
+
+  /* Completed MCU, so update state */
+  cinfo->dest->next_output_byte = state.next_output_byte;
+  cinfo->dest->free_in_buffer = state.free_in_buffer;
+  ASSIGN_STATE(entropy->saved, state.cur);
+
+  /* Update restart-interval state too */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0) {
+      entropy->restarts_to_go = cinfo->restart_interval;
+      entropy->next_restart_num++;
+      entropy->next_restart_num &= 7;
+    }
+    entropy->restarts_to_go--;
+  }
+
+  return TRUE;
+}
+
+
+/*
+ * Finish up at the end of a Huffman-compressed scan.
+ */
+
+METHODDEF(void)
+finish_pass_huff (j_compress_ptr cinfo)
+{
+  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+  working_state state;
+
+  /* Load up working state ... flush_bits needs it */
+  state.next_output_byte = cinfo->dest->next_output_byte;
+  state.free_in_buffer = cinfo->dest->free_in_buffer;
+  ASSIGN_STATE(state.cur, entropy->saved);
+  state.cinfo = cinfo;
+
+  /* Flush out the last data */
+  if (! flush_bits(&state))
+    ERREXIT(cinfo, JERR_CANT_SUSPEND);
+
+  /* Update state */
+  cinfo->dest->next_output_byte = state.next_output_byte;
+  cinfo->dest->free_in_buffer = state.free_in_buffer;
+  ASSIGN_STATE(entropy->saved, state.cur);
+}
+
+
+/*
+ * Huffman coding optimization.
+ *
+ * We first scan the supplied data and count the number of uses of each symbol
+ * that is to be Huffman-coded. (This process MUST agree with the code above.)
+ * Then we build a Huffman coding tree for the observed counts.
+ * Symbols which are not needed at all for the particular image are not
+ * assigned any code, which saves space in the DHT marker as well as in
+ * the compressed data.
+ */
+
+#ifdef ENTROPY_OPT_SUPPORTED
+
+
+/* Process a single block's worth of coefficients */
+
+LOCAL(void)
+htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
+		 long dc_counts[], long ac_counts[])
+{
+  register int temp;
+  register int nbits;
+  register int k, r;
+  
+  /* Encode the DC coefficient difference per section F.1.2.1 */
+  
+  temp = block[0] - last_dc_val;
+  if (temp < 0)
+    temp = -temp;
+  
+  /* Find the number of bits needed for the magnitude of the coefficient */
+  nbits = 0;
+  while (temp) {
+    nbits++;
+    temp >>= 1;
+  }
+  /* Check for out-of-range coefficient values.
+   * Since we're encoding a difference, the range limit is twice as much.
+   */
+  if (nbits > MAX_COEF_BITS+1)
+    ERREXIT(cinfo, JERR_BAD_DCT_COEF);
+
+  /* Count the Huffman symbol for the number of bits */
+  dc_counts[nbits]++;
+  
+  /* Encode the AC coefficients per section F.1.2.2 */
+  
+  r = 0;			/* r = run length of zeros */
+  
+  for (k = 1; k < DCTSIZE2; k++) {
+    if ((temp = block[jpeg_natural_order[k]]) == 0) {
+      r++;
+    } else {
+      /* if run length > 15, must emit special run-length-16 codes (0xF0) */
+      while (r > 15) {
+	ac_counts[0xF0]++;
+	r -= 16;
+      }
+      
+      /* Find the number of bits needed for the magnitude of the coefficient */
+      if (temp < 0)
+	temp = -temp;
+      
+      /* Find the number of bits needed for the magnitude of the coefficient */
+      nbits = 1;		/* there must be at least one 1 bit */
+      while ((temp >>= 1))
+	nbits++;
+      /* Check for out-of-range coefficient values */
+      if (nbits > MAX_COEF_BITS)
+	ERREXIT(cinfo, JERR_BAD_DCT_COEF);
+      
+      /* Count Huffman symbol for run length / number of bits */
+      ac_counts[(r << 4) + nbits]++;
+      
+      r = 0;
+    }
+  }
+
+  /* If the last coef(s) were zero, emit an end-of-block code */
+  if (r > 0)
+    ac_counts[0]++;
+}
+
+
+/*
+ * Trial-encode one MCU's worth of Huffman-compressed coefficients.
+ * No data is actually output, so no suspension return is possible.
+ */
+
+METHODDEF(boolean)
+encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+{
+  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+  int blkn, ci;
+  jpeg_component_info * compptr;
+
+  /* Take care of restart intervals if needed */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0) {
+      /* Re-initialize DC predictions to 0 */
+      for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+	entropy->saved.last_dc_val[ci] = 0;
+      /* Update restart state */
+      entropy->restarts_to_go = cinfo->restart_interval;
+    }
+    entropy->restarts_to_go--;
+  }
+
+  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+    ci = cinfo->MCU_membership[blkn];
+    compptr = cinfo->cur_comp_info[ci];
+    htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci],
+		    entropy->dc_count_ptrs[compptr->dc_tbl_no],
+		    entropy->ac_count_ptrs[compptr->ac_tbl_no]);
+    entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0];
+  }
+
+  return TRUE;
+}
+
+
+/*
+ * Generate the best Huffman code table for the given counts, fill htbl.
+ * Note this is also used by jcphuff.c.
+ *
+ * The JPEG standard requires that no symbol be assigned a codeword of all
+ * one bits (so that padding bits added at the end of a compressed segment
+ * can't look like a valid code).  Because of the canonical ordering of
+ * codewords, this just means that there must be an unused slot in the
+ * longest codeword length category.  Section K.2 of the JPEG spec suggests
+ * reserving such a slot by pretending that symbol 256 is a valid symbol
+ * with count 1.  In theory that's not optimal; giving it count zero but
+ * including it in the symbol set anyway should give a better Huffman code.
+ * But the theoretically better code actually seems to come out worse in
+ * practice, because it produces more all-ones bytes (which incur stuffed
+ * zero bytes in the final file).  In any case the difference is tiny.
+ *
+ * The JPEG standard requires Huffman codes to be no more than 16 bits long.
+ * If some symbols have a very small but nonzero probability, the Huffman tree
+ * must be adjusted to meet the code length restriction.  We currently use
+ * the adjustment method suggested in JPEG section K.2.  This method is *not*
+ * optimal; it may not choose the best possible limited-length code.  But
+ * typically only very-low-frequency symbols will be given less-than-optimal
+ * lengths, so the code is almost optimal.  Experimental comparisons against
+ * an optimal limited-length-code algorithm indicate that the difference is
+ * microscopic --- usually less than a hundredth of a percent of total size.
+ * So the extra complexity of an optimal algorithm doesn't seem worthwhile.
+ */
+
+GLOBAL(void)
+jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
+{
+#define MAX_CLEN 32		/* assumed maximum initial code length */
+  UINT8 bits[MAX_CLEN+1];	/* bits[k] = # of symbols with code length k */
+  int codesize[257];		/* codesize[k] = code length of symbol k */
+  int others[257];		/* next symbol in current branch of tree */
+  int c1, c2;
+  int p, i, j;
+  long v;
+
+  /* This algorithm is explained in section K.2 of the JPEG standard */
+
+  MEMZERO(bits, SIZEOF(bits));
+  MEMZERO(codesize, SIZEOF(codesize));
+  for (i = 0; i < 257; i++)
+    others[i] = -1;		/* init links to empty */
+  
+  freq[256] = 1;		/* make sure 256 has a nonzero count */
+  /* Including the pseudo-symbol 256 in the Huffman procedure guarantees
+   * that no real symbol is given code-value of all ones, because 256
+   * will be placed last in the largest codeword category.
+   */
+
+  /* Huffman's basic algorithm to assign optimal code lengths to symbols */
+
+  for (;;) {
+    /* Find the smallest nonzero frequency, set c1 = its symbol */
+    /* In case of ties, take the larger symbol number */
+    c1 = -1;
+    v = 1000000000L;
+    for (i = 0; i <= 256; i++) {
+      if (freq[i] && freq[i] <= v) {
+	v = freq[i];
+	c1 = i;
+      }
+    }
+
+    /* Find the next smallest nonzero frequency, set c2 = its symbol */
+    /* In case of ties, take the larger symbol number */
+    c2 = -1;
+    v = 1000000000L;
+    for (i = 0; i <= 256; i++) {
+      if (freq[i] && freq[i] <= v && i != c1) {
+	v = freq[i];
+	c2 = i;
+      }
+    }
+
+    /* Done if we've merged everything into one frequency */
+    if (c2 < 0)
+      break;
+    
+    /* Else merge the two counts/trees */
+    freq[c1] += freq[c2];
+    freq[c2] = 0;
+
+    /* Increment the codesize of everything in c1's tree branch */
+    codesize[c1]++;
+    while (others[c1] >= 0) {
+      c1 = others[c1];
+      codesize[c1]++;
+    }
+    
+    others[c1] = c2;		/* chain c2 onto c1's tree branch */
+    
+    /* Increment the codesize of everything in c2's tree branch */
+    codesize[c2]++;
+    while (others[c2] >= 0) {
+      c2 = others[c2];
+      codesize[c2]++;
+    }
+  }
+
+  /* Now count the number of symbols of each code length */
+  for (i = 0; i <= 256; i++) {
+    if (codesize[i]) {
+      /* The JPEG standard seems to think that this can't happen, */
+      /* but I'm paranoid... */
+      if (codesize[i] > MAX_CLEN)
+	ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);
+
+      bits[codesize[i]]++;
+    }
+  }
+
+  /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
+   * Huffman procedure assigned any such lengths, we must adjust the coding.
+   * Here is what the JPEG spec says about how this next bit works:
+   * Since symbols are paired for the longest Huffman code, the symbols are
+   * removed from this length category two at a time.  The prefix for the pair
+   * (which is one bit shorter) is allocated to one of the pair; then,
+   * skipping the BITS entry for that prefix length, a code word from the next
+   * shortest nonzero BITS entry is converted into a prefix for two code words
+   * one bit longer.
+   */
+  
+  for (i = MAX_CLEN; i > 16; i--) {
+    while (bits[i] > 0) {
+      j = i - 2;		/* find length of new prefix to be used */
+      while (bits[j] == 0)
+	j--;
+      
+      bits[i] -= 2;		/* remove two symbols */
+      bits[i-1]++;		/* one goes in this length */
+      bits[j+1] += 2;		/* two new symbols in this length */
+      bits[j]--;		/* symbol of this length is now a prefix */
+    }
+  }
+
+  /* Remove the count for the pseudo-symbol 256 from the largest codelength */
+  while (bits[i] == 0)		/* find largest codelength still in use */
+    i--;
+  bits[i]--;
+  
+  /* Return final symbol counts (only for lengths 0..16) */
+  MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits));
+  
+  /* Return a list of the symbols sorted by code length */
+  /* It's not real clear to me why we don't need to consider the codelength
+   * changes made above, but the JPEG spec seems to think this works.
+   */
+  p = 0;
+  for (i = 1; i <= MAX_CLEN; i++) {
+    for (j = 0; j <= 255; j++) {
+      if (codesize[j] == i) {
+	htbl->huffval[p] = (UINT8) j;
+	p++;
+      }
+    }
+  }
+
+  /* Set sent_table FALSE so updated table will be written to JPEG file. */
+  htbl->sent_table = FALSE;
+}
+
+
+/*
+ * Finish up a statistics-gathering pass and create the new Huffman tables.
+ */
+
+METHODDEF(void)
+finish_pass_gather (j_compress_ptr cinfo)
+{
+  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+  int ci, dctbl, actbl;
+  jpeg_component_info * compptr;
+  JHUFF_TBL **htblptr;
+  boolean did_dc[NUM_HUFF_TBLS];
+  boolean did_ac[NUM_HUFF_TBLS];
+
+  /* It's important not to apply jpeg_gen_optimal_table more than once
+   * per table, because it clobbers the input frequency counts!
+   */
+  MEMZERO(did_dc, SIZEOF(did_dc));
+  MEMZERO(did_ac, SIZEOF(did_ac));
+
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    dctbl = compptr->dc_tbl_no;
+    actbl = compptr->ac_tbl_no;
+    if (! did_dc[dctbl]) {
+      htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl];
+      if (*htblptr == NULL)
+	*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
+      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
+      did_dc[dctbl] = TRUE;
+    }
+    if (! did_ac[actbl]) {
+      htblptr = & cinfo->ac_huff_tbl_ptrs[actbl];
+      if (*htblptr == NULL)
+	*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
+      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
+      did_ac[actbl] = TRUE;
+    }
+  }
+}
+
+
+#endif /* ENTROPY_OPT_SUPPORTED */
+
+
+/*
+ * Module initialization routine for Huffman entropy encoding.
+ */
+
+GLOBAL(void)
+jinit_huff_encoder (j_compress_ptr cinfo)
+{
+  huff_entropy_ptr entropy;
+  int i;
+
+  entropy = (huff_entropy_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(huff_entropy_encoder));
+  cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
+  entropy->pub.start_pass = start_pass_huff;
+
+  /* Mark tables unallocated */
+  for (i = 0; i < NUM_HUFF_TBLS; i++) {
+    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
+#ifdef ENTROPY_OPT_SUPPORTED
+    entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL;
+#endif
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jchuff.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jchuff.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jchuff.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,47 @@
+/*
+ * jchuff.h
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains declarations for Huffman entropy encoding routines
+ * that are shared between the sequential encoder (jchuff.c) and the
+ * progressive encoder (jcphuff.c).  No other modules need to see these.
+ */
+
+/* The legal range of a DCT coefficient is
+ *  -1024 .. +1023  for 8-bit data;
+ * -16384 .. +16383 for 12-bit data.
+ * Hence the magnitude should always fit in 10 or 14 bits respectively.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+#define MAX_COEF_BITS 10
+#else
+#define MAX_COEF_BITS 14
+#endif
+
+/* Derived data constructed for each Huffman table */
+
+typedef struct {
+  unsigned int ehufco[256];	/* code for each symbol */
+  char ehufsi[256];		/* length of code for each symbol */
+  /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */
+} c_derived_tbl;
+
+/* Short forms of external names for systems with brain-damaged linkers. */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jpeg_make_c_derived_tbl	jMkCDerived
+#define jpeg_gen_optimal_table	jGenOptTbl
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+/* Expand a Huffman table definition into the derived format */
+EXTERN(void) jpeg_make_c_derived_tbl
+	JPP((j_compress_ptr cinfo, boolean isDC, int tblno,
+	     c_derived_tbl ** pdtbl));
+
+/* Generate an optimal table definition given the specified counts */
+EXTERN(void) jpeg_gen_optimal_table
+	JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]));

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcinit.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcinit.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcinit.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,72 @@
+/*
+ * jcinit.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains initialization logic for the JPEG compressor.
+ * This routine is in charge of selecting the modules to be executed and
+ * making an initialization call to each one.
+ *
+ * Logically, this code belongs in jcmaster.c.  It's split out because
+ * linking this routine implies linking the entire compression library.
+ * For a transcoding-only application, we want to be able to use jcmaster.c
+ * without linking in the whole library.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * Master selection of compression modules.
+ * This is done once at the start of processing an image.  We determine
+ * which modules will be used and give them appropriate initialization calls.
+ */
+
+GLOBAL(void)
+jinit_compress_master (j_compress_ptr cinfo)
+{
+  /* Initialize master control (includes parameter checking/processing) */
+  jinit_c_master_control(cinfo, FALSE /* full compression */);
+
+  /* Preprocessing */
+  if (! cinfo->raw_data_in) {
+    jinit_color_converter(cinfo);
+    jinit_downsampler(cinfo);
+    jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
+  }
+  /* Forward DCT */
+  jinit_forward_dct(cinfo);
+  /* Entropy encoding: either Huffman or arithmetic coding. */
+  if (cinfo->arith_code) {
+    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
+  } else {
+    if (cinfo->progressive_mode) {
+#ifdef C_PROGRESSIVE_SUPPORTED
+      jinit_phuff_encoder(cinfo);
+#else
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+    } else
+      jinit_huff_encoder(cinfo);
+  }
+
+  /* Need a full-image coefficient buffer in any multi-pass mode. */
+  jinit_c_coef_controller(cinfo,
+		(boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
+  jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
+
+  jinit_marker_writer(cinfo);
+
+  /* We can now tell the memory manager to allocate virtual arrays. */
+  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
+
+  /* Write the datastream header (SOI) immediately.
+   * Frame and scan headers are postponed till later.
+   * This lets application insert special markers after the SOI.
+   */
+  (*cinfo->marker->write_file_header) (cinfo);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmainct.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmainct.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmainct.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,293 @@
+/*
+ * jcmainct.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the main buffer controller for compression.
+ * The main buffer lies between the pre-processor and the JPEG
+ * compressor proper; it holds downsampled data in the JPEG colorspace.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Note: currently, there is no operating mode in which a full-image buffer
+ * is needed at this step.  If there were, that mode could not be used with
+ * "raw data" input, since this module is bypassed in that case.  However,
+ * we've left the code here for possible use in special applications.
+ */
+#undef FULL_MAIN_BUFFER_SUPPORTED
+
+
+/* Private buffer controller object */
+
+typedef struct {
+  struct jpeg_c_main_controller pub; /* public fields */
+
+  JDIMENSION cur_iMCU_row;	/* number of current iMCU row */
+  JDIMENSION rowgroup_ctr;	/* counts row groups received in iMCU row */
+  boolean suspended;		/* remember if we suspended output */
+  J_BUF_MODE pass_mode;		/* current operating mode */
+
+  /* If using just a strip buffer, this points to the entire set of buffers
+   * (we allocate one for each component).  In the full-image case, this
+   * points to the currently accessible strips of the virtual arrays.
+   */
+  JSAMPARRAY buffer[MAX_COMPONENTS];
+
+#ifdef FULL_MAIN_BUFFER_SUPPORTED
+  /* If using full-image storage, this array holds pointers to virtual-array
+   * control blocks for each component.  Unused if not full-image storage.
+   */
+  jvirt_sarray_ptr whole_image[MAX_COMPONENTS];
+#endif
+} my_main_controller;
+
+typedef my_main_controller * my_main_ptr;
+
+
+/* Forward declarations */
+METHODDEF(void) process_data_simple_main
+	JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
+	     JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
+#ifdef FULL_MAIN_BUFFER_SUPPORTED
+METHODDEF(void) process_data_buffer_main
+	JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
+	     JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
+#endif
+
+
+/*
+ * Initialize for a processing pass.
+ */
+
+METHODDEF(void)
+start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+
+  /* Do nothing in raw-data mode. */
+  if (cinfo->raw_data_in)
+    return;
+
+  main->cur_iMCU_row = 0;	/* initialize counters */
+  main->rowgroup_ctr = 0;
+  main->suspended = FALSE;
+  main->pass_mode = pass_mode;	/* save mode for use by process_data */
+
+  switch (pass_mode) {
+  case JBUF_PASS_THRU:
+#ifdef FULL_MAIN_BUFFER_SUPPORTED
+    if (main->whole_image[0] != NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+#endif
+    main->pub.process_data = process_data_simple_main;
+    break;
+#ifdef FULL_MAIN_BUFFER_SUPPORTED
+  case JBUF_SAVE_SOURCE:
+  case JBUF_CRANK_DEST:
+  case JBUF_SAVE_AND_PASS:
+    if (main->whole_image[0] == NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    main->pub.process_data = process_data_buffer_main;
+    break;
+#endif
+  default:
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    break;
+  }
+}
+
+
+/*
+ * Process some data.
+ * This routine handles the simple pass-through mode,
+ * where we have only a strip buffer.
+ */
+
+METHODDEF(void)
+process_data_simple_main (j_compress_ptr cinfo,
+			  JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
+			  JDIMENSION in_rows_avail)
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+
+  while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
+    /* Read input data if we haven't filled the main buffer yet */
+    if (main->rowgroup_ctr < DCTSIZE)
+      (*cinfo->prep->pre_process_data) (cinfo,
+					input_buf, in_row_ctr, in_rows_avail,
+					main->buffer, &main->rowgroup_ctr,
+					(JDIMENSION) DCTSIZE);
+
+    /* If we don't have a full iMCU row buffered, return to application for
+     * more data.  Note that preprocessor will always pad to fill the iMCU row
+     * at the bottom of the image.
+     */
+    if (main->rowgroup_ctr != DCTSIZE)
+      return;
+
+    /* Send the completed row to the compressor */
+    if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
+      /* If compressor did not consume the whole row, then we must need to
+       * suspend processing and return to the application.  In this situation
+       * we pretend we didn't yet consume the last input row; otherwise, if
+       * it happened to be the last row of the image, the application would
+       * think we were done.
+       */
+      if (! main->suspended) {
+	(*in_row_ctr)--;
+	main->suspended = TRUE;
+      }
+      return;
+    }
+    /* We did finish the row.  Undo our little suspension hack if a previous
+     * call suspended; then mark the main buffer empty.
+     */
+    if (main->suspended) {
+      (*in_row_ctr)++;
+      main->suspended = FALSE;
+    }
+    main->rowgroup_ctr = 0;
+    main->cur_iMCU_row++;
+  }
+}
+
+
+#ifdef FULL_MAIN_BUFFER_SUPPORTED
+
+/*
+ * Process some data.
+ * This routine handles all of the modes that use a full-size buffer.
+ */
+
+METHODDEF(void)
+process_data_buffer_main (j_compress_ptr cinfo,
+			  JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
+			  JDIMENSION in_rows_avail)
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+  int ci;
+  jpeg_component_info *compptr;
+  boolean writing = (main->pass_mode != JBUF_CRANK_DEST);
+
+  while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
+    /* Realign the virtual buffers if at the start of an iMCU row. */
+    if (main->rowgroup_ctr == 0) {
+      for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	   ci++, compptr++) {
+	main->buffer[ci] = (*cinfo->mem->access_virt_sarray)
+	  ((j_common_ptr) cinfo, main->whole_image[ci],
+	   main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
+	   (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
+      }
+      /* In a read pass, pretend we just read some source data. */
+      if (! writing) {
+	*in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
+	main->rowgroup_ctr = DCTSIZE;
+      }
+    }
+
+    /* If a write pass, read input data until the current iMCU row is full. */
+    /* Note: preprocessor will pad if necessary to fill the last iMCU row. */
+    if (writing) {
+      (*cinfo->prep->pre_process_data) (cinfo,
+					input_buf, in_row_ctr, in_rows_avail,
+					main->buffer, &main->rowgroup_ctr,
+					(JDIMENSION) DCTSIZE);
+      /* Return to application if we need more data to fill the iMCU row. */
+      if (main->rowgroup_ctr < DCTSIZE)
+	return;
+    }
+
+    /* Emit data, unless this is a sink-only pass. */
+    if (main->pass_mode != JBUF_SAVE_SOURCE) {
+      if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
+	/* If compressor did not consume the whole row, then we must need to
+	 * suspend processing and return to the application.  In this situation
+	 * we pretend we didn't yet consume the last input row; otherwise, if
+	 * it happened to be the last row of the image, the application would
+	 * think we were done.
+	 */
+	if (! main->suspended) {
+	  (*in_row_ctr)--;
+	  main->suspended = TRUE;
+	}
+	return;
+      }
+      /* We did finish the row.  Undo our little suspension hack if a previous
+       * call suspended; then mark the main buffer empty.
+       */
+      if (main->suspended) {
+	(*in_row_ctr)++;
+	main->suspended = FALSE;
+      }
+    }
+
+    /* If get here, we are done with this iMCU row.  Mark buffer empty. */
+    main->rowgroup_ctr = 0;
+    main->cur_iMCU_row++;
+  }
+}
+
+#endif /* FULL_MAIN_BUFFER_SUPPORTED */
+
+
+/*
+ * Initialize main buffer controller.
+ */
+
+GLOBAL(void)
+jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
+{
+  my_main_ptr main;
+  int ci;
+  jpeg_component_info *compptr;
+
+  main = (my_main_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_main_controller));
+  cinfo->main = (struct jpeg_c_main_controller *) main;
+  main->pub.start_pass = start_pass_main;
+
+  /* We don't need to create a buffer in raw-data mode. */
+  if (cinfo->raw_data_in)
+    return;
+
+  /* Create the buffer.  It holds downsampled data, so each component
+   * may be of a different size.
+   */
+  if (need_full_buffer) {
+#ifdef FULL_MAIN_BUFFER_SUPPORTED
+    /* Allocate a full-image virtual array for each component */
+    /* Note we pad the bottom to a multiple of the iMCU height */
+    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	 ci++, compptr++) {
+      main->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
+	((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+	 compptr->width_in_blocks * DCTSIZE,
+	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
+				(long) compptr->v_samp_factor) * DCTSIZE,
+	 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
+    }
+#else
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+#endif
+  } else {
+#ifdef FULL_MAIN_BUFFER_SUPPORTED
+    main->whole_image[0] = NULL; /* flag for no virtual arrays */
+#endif
+    /* Allocate a strip buffer for each component */
+    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	 ci++, compptr++) {
+      main->buffer[ci] = (*cinfo->mem->alloc_sarray)
+	((j_common_ptr) cinfo, JPOOL_IMAGE,
+	 compptr->width_in_blocks * DCTSIZE,
+	 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
+    }
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmarker.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmarker.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmarker.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,664 @@
+/*
+ * jcmarker.c
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to write JPEG datastream markers.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+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_APP1  = 0xe1,
+  M_APP2  = 0xe2,
+  M_APP3  = 0xe3,
+  M_APP4  = 0xe4,
+  M_APP5  = 0xe5,
+  M_APP6  = 0xe6,
+  M_APP7  = 0xe7,
+  M_APP8  = 0xe8,
+  M_APP9  = 0xe9,
+  M_APP10 = 0xea,
+  M_APP11 = 0xeb,
+  M_APP12 = 0xec,
+  M_APP13 = 0xed,
+  M_APP14 = 0xee,
+  M_APP15 = 0xef,
+  
+  M_JPG0  = 0xf0,
+  M_JPG13 = 0xfd,
+  M_COM   = 0xfe,
+  
+  M_TEM   = 0x01,
+  
+  M_ERROR = 0x100
+} JPEG_MARKER;
+
+
+/* Private state */
+
+typedef struct {
+  struct jpeg_marker_writer pub; /* public fields */
+
+  unsigned int last_restart_interval; /* last DRI value emitted; 0 after SOI */
+} my_marker_writer;
+
+typedef my_marker_writer * my_marker_ptr;
+
+
+/*
+ * Basic output routines.
+ *
+ * Note that we do not support suspension while writing a marker.
+ * Therefore, an application using suspension must ensure that there is
+ * enough buffer space for the initial markers (typ. 600-700 bytes) before
+ * calling jpeg_start_compress, and enough space to write the trailing EOI
+ * (a few bytes) before calling jpeg_finish_compress.  Multipass compression
+ * modes are not supported at all with suspension, so those two are the only
+ * points where markers will be written.
+ */
+
+LOCAL(void)
+emit_byte (j_compress_ptr cinfo, int val)
+/* Emit a byte */
+{
+  struct jpeg_destination_mgr * dest = cinfo->dest;
+
+  *(dest->next_output_byte)++ = (JOCTET) val;
+  if (--dest->free_in_buffer == 0) {
+    if (! (*dest->empty_output_buffer) (cinfo))
+      ERREXIT(cinfo, JERR_CANT_SUSPEND);
+  }
+}
+
+
+LOCAL(void)
+emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark)
+/* Emit a marker code */
+{
+  emit_byte(cinfo, 0xFF);
+  emit_byte(cinfo, (int) mark);
+}
+
+
+LOCAL(void)
+emit_2bytes (j_compress_ptr cinfo, int value)
+/* Emit a 2-byte integer; these are always MSB first in JPEG files */
+{
+  emit_byte(cinfo, (value >> 8) & 0xFF);
+  emit_byte(cinfo, value & 0xFF);
+}
+
+
+/*
+ * Routines to write specific marker types.
+ */
+
+LOCAL(int)
+emit_dqt (j_compress_ptr cinfo, int index)
+/* Emit a DQT marker */
+/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
+{
+  JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index];
+  int prec;
+  int i;
+
+  if (qtbl == NULL)
+    ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
+
+  prec = 0;
+  for (i = 0; i < DCTSIZE2; i++) {
+    if (qtbl->quantval[i] > 255)
+      prec = 1;
+  }
+
+  if (! qtbl->sent_table) {
+    emit_marker(cinfo, M_DQT);
+
+    emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
+
+    emit_byte(cinfo, index + (prec<<4));
+
+    for (i = 0; i < DCTSIZE2; i++) {
+      /* The table entries must be emitted in zigzag order. */
+      unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
+      if (prec)
+	emit_byte(cinfo, (int) (qval >> 8));
+      emit_byte(cinfo, (int) (qval & 0xFF));
+    }
+
+    qtbl->sent_table = TRUE;
+  }
+
+  return prec;
+}
+
+
+LOCAL(void)
+emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
+/* Emit a DHT marker */
+{
+  JHUFF_TBL * htbl;
+  int length, i;
+  
+  if (is_ac) {
+    htbl = cinfo->ac_huff_tbl_ptrs[index];
+    index += 0x10;		/* output index has AC bit set */
+  } else {
+    htbl = cinfo->dc_huff_tbl_ptrs[index];
+  }
+
+  if (htbl == NULL)
+    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
+  
+  if (! htbl->sent_table) {
+    emit_marker(cinfo, M_DHT);
+    
+    length = 0;
+    for (i = 1; i <= 16; i++)
+      length += htbl->bits[i];
+    
+    emit_2bytes(cinfo, length + 2 + 1 + 16);
+    emit_byte(cinfo, index);
+    
+    for (i = 1; i <= 16; i++)
+      emit_byte(cinfo, htbl->bits[i]);
+    
+    for (i = 0; i < length; i++)
+      emit_byte(cinfo, htbl->huffval[i]);
+    
+    htbl->sent_table = TRUE;
+  }
+}
+
+
+LOCAL(void)
+emit_dac (j_compress_ptr cinfo)
+/* Emit a DAC marker */
+/* Since the useful info is so small, we want to emit all the tables in */
+/* one DAC marker.  Therefore this routine does its own scan of the table. */
+{
+#ifdef C_ARITH_CODING_SUPPORTED
+  char dc_in_use[NUM_ARITH_TBLS];
+  char ac_in_use[NUM_ARITH_TBLS];
+  int length, i;
+  jpeg_component_info *compptr;
+  
+  for (i = 0; i < NUM_ARITH_TBLS; i++)
+    dc_in_use[i] = ac_in_use[i] = 0;
+  
+  for (i = 0; i < cinfo->comps_in_scan; i++) {
+    compptr = cinfo->cur_comp_info[i];
+    dc_in_use[compptr->dc_tbl_no] = 1;
+    ac_in_use[compptr->ac_tbl_no] = 1;
+  }
+  
+  length = 0;
+  for (i = 0; i < NUM_ARITH_TBLS; i++)
+    length += dc_in_use[i] + ac_in_use[i];
+  
+  emit_marker(cinfo, M_DAC);
+  
+  emit_2bytes(cinfo, length*2 + 2);
+  
+  for (i = 0; i < NUM_ARITH_TBLS; i++) {
+    if (dc_in_use[i]) {
+      emit_byte(cinfo, i);
+      emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
+    }
+    if (ac_in_use[i]) {
+      emit_byte(cinfo, i + 0x10);
+      emit_byte(cinfo, cinfo->arith_ac_K[i]);
+    }
+  }
+#endif /* C_ARITH_CODING_SUPPORTED */
+}
+
+
+LOCAL(void)
+emit_dri (j_compress_ptr cinfo)
+/* Emit a DRI marker */
+{
+  emit_marker(cinfo, M_DRI);
+  
+  emit_2bytes(cinfo, 4);	/* fixed length */
+
+  emit_2bytes(cinfo, (int) cinfo->restart_interval);
+}
+
+
+LOCAL(void)
+emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
+/* Emit a SOF marker */
+{
+  int ci;
+  jpeg_component_info *compptr;
+  
+  emit_marker(cinfo, code);
+  
+  emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
+
+  /* Make sure image isn't bigger than SOF field can handle */
+  if ((long) cinfo->image_height > 65535L ||
+      (long) cinfo->image_width > 65535L)
+    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
+
+  emit_byte(cinfo, cinfo->data_precision);
+  emit_2bytes(cinfo, (int) cinfo->image_height);
+  emit_2bytes(cinfo, (int) cinfo->image_width);
+
+  emit_byte(cinfo, cinfo->num_components);
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    emit_byte(cinfo, compptr->component_id);
+    emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
+    emit_byte(cinfo, compptr->quant_tbl_no);
+  }
+}
+
+
+LOCAL(void)
+emit_sos (j_compress_ptr cinfo)
+/* Emit a SOS marker */
+{
+  int i, td, ta;
+  jpeg_component_info *compptr;
+  
+  emit_marker(cinfo, M_SOS);
+  
+  emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
+  
+  emit_byte(cinfo, cinfo->comps_in_scan);
+  
+  for (i = 0; i < cinfo->comps_in_scan; i++) {
+    compptr = cinfo->cur_comp_info[i];
+    emit_byte(cinfo, compptr->component_id);
+    td = compptr->dc_tbl_no;
+    ta = compptr->ac_tbl_no;
+    if (cinfo->progressive_mode) {
+      /* Progressive mode: only DC or only AC tables are used in one scan;
+       * furthermore, Huffman coding of DC refinement uses no table at all.
+       * We emit 0 for unused field(s); this is recommended by the P&M text
+       * but does not seem to be specified in the standard.
+       */
+      if (cinfo->Ss == 0) {
+	ta = 0;			/* DC scan */
+	if (cinfo->Ah != 0 && !cinfo->arith_code)
+	  td = 0;		/* no DC table either */
+      } else {
+	td = 0;			/* AC scan */
+      }
+    }
+    emit_byte(cinfo, (td << 4) + ta);
+  }
+
+  emit_byte(cinfo, cinfo->Ss);
+  emit_byte(cinfo, cinfo->Se);
+  emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
+}
+
+
+LOCAL(void)
+emit_jfif_app0 (j_compress_ptr cinfo)
+/* Emit a JFIF-compliant APP0 marker */
+{
+  /*
+   * Length of APP0 block	(2 bytes)
+   * Block ID			(4 bytes - ASCII "JFIF")
+   * Zero byte			(1 byte to terminate the ID string)
+   * Version Major, Minor	(2 bytes - major first)
+   * Units			(1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
+   * Xdpu			(2 bytes - dots per unit horizontal)
+   * Ydpu			(2 bytes - dots per unit vertical)
+   * Thumbnail X size		(1 byte)
+   * Thumbnail Y size		(1 byte)
+   */
+  
+  emit_marker(cinfo, M_APP0);
+  
+  emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
+
+  emit_byte(cinfo, 0x4A);	/* Identifier: ASCII "JFIF" */
+  emit_byte(cinfo, 0x46);
+  emit_byte(cinfo, 0x49);
+  emit_byte(cinfo, 0x46);
+  emit_byte(cinfo, 0);
+  emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
+  emit_byte(cinfo, cinfo->JFIF_minor_version);
+  emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
+  emit_2bytes(cinfo, (int) cinfo->X_density);
+  emit_2bytes(cinfo, (int) cinfo->Y_density);
+  emit_byte(cinfo, 0);		/* No thumbnail image */
+  emit_byte(cinfo, 0);
+}
+
+
+LOCAL(void)
+emit_adobe_app14 (j_compress_ptr cinfo)
+/* Emit an Adobe APP14 marker */
+{
+  /*
+   * Length of APP14 block	(2 bytes)
+   * Block ID			(5 bytes - ASCII "Adobe")
+   * Version Number		(2 bytes - currently 100)
+   * Flags0			(2 bytes - currently 0)
+   * Flags1			(2 bytes - currently 0)
+   * Color transform		(1 byte)
+   *
+   * Although Adobe TN 5116 mentions Version = 101, all the Adobe files
+   * now in circulation seem to use Version = 100, so that's what we write.
+   *
+   * We write the color transform byte as 1 if the JPEG color space is
+   * YCbCr, 2 if it's YCCK, 0 otherwise.  Adobe's definition has to do with
+   * whether the encoder performed a transformation, which is pretty useless.
+   */
+  
+  emit_marker(cinfo, M_APP14);
+  
+  emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
+
+  emit_byte(cinfo, 0x41);	/* Identifier: ASCII "Adobe" */
+  emit_byte(cinfo, 0x64);
+  emit_byte(cinfo, 0x6F);
+  emit_byte(cinfo, 0x62);
+  emit_byte(cinfo, 0x65);
+  emit_2bytes(cinfo, 100);	/* Version */
+  emit_2bytes(cinfo, 0);	/* Flags0 */
+  emit_2bytes(cinfo, 0);	/* Flags1 */
+  switch (cinfo->jpeg_color_space) {
+  case JCS_YCbCr:
+    emit_byte(cinfo, 1);	/* Color transform = 1 */
+    break;
+  case JCS_YCCK:
+    emit_byte(cinfo, 2);	/* Color transform = 2 */
+    break;
+  default:
+    emit_byte(cinfo, 0);	/* Color transform = 0 */
+    break;
+  }
+}
+
+
+/*
+ * These routines allow writing an arbitrary marker with parameters.
+ * The only intended use is to emit COM or APPn markers after calling
+ * write_file_header and before calling write_frame_header.
+ * Other uses are not guaranteed to produce desirable results.
+ * Counting the parameter bytes properly is the caller's responsibility.
+ */
+
+METHODDEF(void)
+write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
+/* Emit an arbitrary marker header */
+{
+  if (datalen > (unsigned int) 65533)		/* safety check */
+    ERREXIT(cinfo, JERR_BAD_LENGTH);
+
+  emit_marker(cinfo, (JPEG_MARKER) marker);
+
+  emit_2bytes(cinfo, (int) (datalen + 2));	/* total length */
+}
+
+METHODDEF(void)
+write_marker_byte (j_compress_ptr cinfo, int val)
+/* Emit one byte of marker parameters following write_marker_header */
+{
+  emit_byte(cinfo, val);
+}
+
+
+/*
+ * Write datastream header.
+ * This consists of an SOI and optional APPn markers.
+ * We recommend use of the JFIF marker, but not the Adobe marker,
+ * when using YCbCr or grayscale data.  The JFIF marker should NOT
+ * be used for any other JPEG colorspace.  The Adobe marker is helpful
+ * to distinguish RGB, CMYK, and YCCK colorspaces.
+ * Note that an application can write additional header markers after
+ * jpeg_start_compress returns.
+ */
+
+METHODDEF(void)
+write_file_header (j_compress_ptr cinfo)
+{
+  my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+
+  emit_marker(cinfo, M_SOI);	/* first the SOI */
+
+  /* SOI is defined to reset restart interval to 0 */
+  marker->last_restart_interval = 0;
+
+  if (cinfo->write_JFIF_header)	/* next an optional JFIF APP0 */
+    emit_jfif_app0(cinfo);
+  if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
+    emit_adobe_app14(cinfo);
+}
+
+
+/*
+ * Write frame header.
+ * This consists of DQT and SOFn markers.
+ * Note that we do not emit the SOF until we have emitted the DQT(s).
+ * This avoids compatibility problems with incorrect implementations that
+ * try to error-check the quant table numbers as soon as they see the SOF.
+ */
+
+METHODDEF(void)
+write_frame_header (j_compress_ptr cinfo)
+{
+  int ci, prec;
+  boolean is_baseline;
+  jpeg_component_info *compptr;
+  
+  /* Emit DQT for each quantization table.
+   * Note that emit_dqt() suppresses any duplicate tables.
+   */
+  prec = 0;
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    prec += emit_dqt(cinfo, compptr->quant_tbl_no);
+  }
+  /* now prec is nonzero iff there are any 16-bit quant tables. */
+
+  /* Check for a non-baseline specification.
+   * Note we assume that Huffman table numbers won't be changed later.
+   */
+  if (cinfo->arith_code || cinfo->progressive_mode ||
+      cinfo->data_precision != 8) {
+    is_baseline = FALSE;
+  } else {
+    is_baseline = TRUE;
+    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	 ci++, compptr++) {
+      if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
+	is_baseline = FALSE;
+    }
+    if (prec && is_baseline) {
+      is_baseline = FALSE;
+      /* If it's baseline except for quantizer size, warn the user */
+      TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
+    }
+  }
+
+  /* Emit the proper SOF marker */
+  if (cinfo->arith_code) {
+    emit_sof(cinfo, M_SOF9);	/* SOF code for arithmetic coding */
+  } else {
+    if (cinfo->progressive_mode)
+      emit_sof(cinfo, M_SOF2);	/* SOF code for progressive Huffman */
+    else if (is_baseline)
+      emit_sof(cinfo, M_SOF0);	/* SOF code for baseline implementation */
+    else
+      emit_sof(cinfo, M_SOF1);	/* SOF code for non-baseline Huffman file */
+  }
+}
+
+
+/*
+ * Write scan header.
+ * This consists of DHT or DAC markers, optional DRI, and SOS.
+ * Compressed data will be written following the SOS.
+ */
+
+METHODDEF(void)
+write_scan_header (j_compress_ptr cinfo)
+{
+  my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+  int i;
+  jpeg_component_info *compptr;
+
+  if (cinfo->arith_code) {
+    /* Emit arith conditioning info.  We may have some duplication
+     * if the file has multiple scans, but it's so small it's hardly
+     * worth worrying about.
+     */
+    emit_dac(cinfo);
+  } else {
+    /* Emit Huffman tables.
+     * Note that emit_dht() suppresses any duplicate tables.
+     */
+    for (i = 0; i < cinfo->comps_in_scan; i++) {
+      compptr = cinfo->cur_comp_info[i];
+      if (cinfo->progressive_mode) {
+	/* Progressive mode: only DC or only AC tables are used in one scan */
+	if (cinfo->Ss == 0) {
+	  if (cinfo->Ah == 0)	/* DC needs no table for refinement scan */
+	    emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
+	} else {
+	  emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
+	}
+      } else {
+	/* Sequential mode: need both DC and AC tables */
+	emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
+	emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
+      }
+    }
+  }
+
+  /* Emit DRI if required --- note that DRI value could change for each scan.
+   * We avoid wasting space with unnecessary DRIs, however.
+   */
+  if (cinfo->restart_interval != marker->last_restart_interval) {
+    emit_dri(cinfo);
+    marker->last_restart_interval = cinfo->restart_interval;
+  }
+
+  emit_sos(cinfo);
+}
+
+
+/*
+ * Write datastream trailer.
+ */
+
+METHODDEF(void)
+write_file_trailer (j_compress_ptr cinfo)
+{
+  emit_marker(cinfo, M_EOI);
+}
+
+
+/*
+ * Write an abbreviated table-specification datastream.
+ * This consists of SOI, DQT and DHT tables, and EOI.
+ * Any table that is defined and not marked sent_table = TRUE will be
+ * emitted.  Note that all tables will be marked sent_table = TRUE at exit.
+ */
+
+METHODDEF(void)
+write_tables_only (j_compress_ptr cinfo)
+{
+  int i;
+
+  emit_marker(cinfo, M_SOI);
+
+  for (i = 0; i < NUM_QUANT_TBLS; i++) {
+    if (cinfo->quant_tbl_ptrs[i] != NULL)
+      (void) emit_dqt(cinfo, i);
+  }
+
+  if (! cinfo->arith_code) {
+    for (i = 0; i < NUM_HUFF_TBLS; i++) {
+      if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
+	emit_dht(cinfo, i, FALSE);
+      if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
+	emit_dht(cinfo, i, TRUE);
+    }
+  }
+
+  emit_marker(cinfo, M_EOI);
+}
+
+
+/*
+ * Initialize the marker writer module.
+ */
+
+GLOBAL(void)
+jinit_marker_writer (j_compress_ptr cinfo)
+{
+  my_marker_ptr marker;
+
+  /* Create the subobject */
+  marker = (my_marker_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_marker_writer));
+  cinfo->marker = (struct jpeg_marker_writer *) marker;
+  /* Initialize method pointers */
+  marker->pub.write_file_header = write_file_header;
+  marker->pub.write_frame_header = write_frame_header;
+  marker->pub.write_scan_header = write_scan_header;
+  marker->pub.write_file_trailer = write_file_trailer;
+  marker->pub.write_tables_only = write_tables_only;
+  marker->pub.write_marker_header = write_marker_header;
+  marker->pub.write_marker_byte = write_marker_byte;
+  /* Initialize private state */
+  marker->last_restart_interval = 0;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmaster.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmaster.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcmaster.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/*
+ * jcmaster.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains master control logic for the JPEG compressor.
+ * These routines are concerned with parameter validation, initial setup,
+ * and inter-pass control (determining the number of passes and the work 
+ * to be done in each pass).
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Private state */
+
+typedef enum {
+	main_pass,		/* input data, also do first output step */
+	huff_opt_pass,		/* Huffman code optimization pass */
+	output_pass		/* data output pass */
+} c_pass_type;
+
+typedef struct {
+  struct jpeg_comp_master pub;	/* public fields */
+
+  c_pass_type pass_type;	/* the type of the current pass */
+
+  int pass_number;		/* # of passes completed */
+  int total_passes;		/* total # of passes needed */
+
+  int scan_number;		/* current index in scan_info[] */
+} my_comp_master;
+
+typedef my_comp_master * my_master_ptr;
+
+
+/*
+ * Support routines that do various essential calculations.
+ */
+
+LOCAL(void)
+initial_setup (j_compress_ptr cinfo)
+/* Do computations that are needed before master selection phase */
+{
+  int ci;
+  jpeg_component_info *compptr;
+  long samplesperrow;
+  JDIMENSION jd_samplesperrow;
+
+  /* Sanity check on image dimensions */
+  if (cinfo->image_height <= 0 || cinfo->image_width <= 0
+      || cinfo->num_components <= 0 || cinfo->input_components <= 0)
+    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
+
+  /* Make sure image isn't bigger than I can handle */
+  if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||
+      (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
+    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
+
+  /* Width of an input scanline must be representable as JDIMENSION. */
+  samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components;
+  jd_samplesperrow = (JDIMENSION) samplesperrow;
+  if ((long) jd_samplesperrow != samplesperrow)
+    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
+
+  /* For now, precision must match compiled-in value... */
+  if (cinfo->data_precision != BITS_IN_JSAMPLE)
+    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
+
+  /* Check that number of components won't exceed internal array sizes */
+  if (cinfo->num_components > MAX_COMPONENTS)
+    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
+	     MAX_COMPONENTS);
+
+  /* Compute maximum sampling factors; check factor validity */
+  cinfo->max_h_samp_factor = 1;
+  cinfo->max_v_samp_factor = 1;
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
+	compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
+      ERREXIT(cinfo, JERR_BAD_SAMPLING);
+    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
+				   compptr->h_samp_factor);
+    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
+				   compptr->v_samp_factor);
+  }
+
+  /* Compute dimensions of components */
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Fill in the correct component_index value; don't rely on application */
+    compptr->component_index = ci;
+    /* For compression, we never do DCT scaling. */
+    compptr->DCT_scaled_size = DCTSIZE;
+    /* Size in DCT blocks */
+    compptr->width_in_blocks = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
+		    (long) (cinfo->max_h_samp_factor * DCTSIZE));
+    compptr->height_in_blocks = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
+		    (long) (cinfo->max_v_samp_factor * DCTSIZE));
+    /* Size in samples */
+    compptr->downsampled_width = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
+		    (long) cinfo->max_h_samp_factor);
+    compptr->downsampled_height = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
+		    (long) cinfo->max_v_samp_factor);
+    /* Mark component needed (this flag isn't actually used for compression) */
+    compptr->component_needed = TRUE;
+  }
+
+  /* Compute number of fully interleaved MCU rows (number of times that
+   * main controller will call coefficient controller).
+   */
+  cinfo->total_iMCU_rows = (JDIMENSION)
+    jdiv_round_up((long) cinfo->image_height,
+		  (long) (cinfo->max_v_samp_factor*DCTSIZE));
+}
+
+
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+
+LOCAL(void)
+validate_script (j_compress_ptr cinfo)
+/* Verify that the scan script in cinfo->scan_info[] is valid; also
+ * determine whether it uses progressive JPEG, and set cinfo->progressive_mode.
+ */
+{
+  const jpeg_scan_info * scanptr;
+  int scanno, ncomps, ci, coefi, thisi;
+  int Ss, Se, Ah, Al;
+  boolean component_sent[MAX_COMPONENTS];
+#ifdef C_PROGRESSIVE_SUPPORTED
+  int * last_bitpos_ptr;
+  int last_bitpos[MAX_COMPONENTS][DCTSIZE2];
+  /* -1 until that coefficient has been seen; then last Al for it */
+#endif
+
+  if (cinfo->num_scans <= 0)
+    ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0);
+
+  /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1;
+   * for progressive JPEG, no scan can have this.
+   */
+  scanptr = cinfo->scan_info;
+  if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) {
+#ifdef C_PROGRESSIVE_SUPPORTED
+    cinfo->progressive_mode = TRUE;
+    last_bitpos_ptr = & last_bitpos[0][0];
+    for (ci = 0; ci < cinfo->num_components; ci++) 
+      for (coefi = 0; coefi < DCTSIZE2; coefi++)
+	*last_bitpos_ptr++ = -1;
+#else
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+  } else {
+    cinfo->progressive_mode = FALSE;
+    for (ci = 0; ci < cinfo->num_components; ci++) 
+      component_sent[ci] = FALSE;
+  }
+
+  for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) {
+    /* Validate component indexes */
+    ncomps = scanptr->comps_in_scan;
+    if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN)
+      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN);
+    for (ci = 0; ci < ncomps; ci++) {
+      thisi = scanptr->component_index[ci];
+      if (thisi < 0 || thisi >= cinfo->num_components)
+	ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
+      /* Components must appear in SOF order within each scan */
+      if (ci > 0 && thisi <= scanptr->component_index[ci-1])
+	ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
+    }
+    /* Validate progression parameters */
+    Ss = scanptr->Ss;
+    Se = scanptr->Se;
+    Ah = scanptr->Ah;
+    Al = scanptr->Al;
+    if (cinfo->progressive_mode) {
+#ifdef C_PROGRESSIVE_SUPPORTED
+      /* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that
+       * seems wrong: the upper bound ought to depend on data precision.
+       * Perhaps they really meant 0..N+1 for N-bit precision.
+       * Here we allow 0..10 for 8-bit data; Al larger than 10 results in
+       * out-of-range reconstructed DC values during the first DC scan,
+       * which might cause problems for some decoders.
+       */
+#if BITS_IN_JSAMPLE == 8
+#define MAX_AH_AL 10
+#else
+#define MAX_AH_AL 13
+#endif
+      if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
+	  Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL)
+	ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
+      if (Ss == 0) {
+	if (Se != 0)		/* DC and AC together not OK */
+	  ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
+      } else {
+	if (ncomps != 1)	/* AC scans must be for only one component */
+	  ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
+      }
+      for (ci = 0; ci < ncomps; ci++) {
+	last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0];
+	if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */
+	  ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
+	for (coefi = Ss; coefi <= Se; coefi++) {
+	  if (last_bitpos_ptr[coefi] < 0) {
+	    /* first scan of this coefficient */
+	    if (Ah != 0)
+	      ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
+	  } else {
+	    /* not first scan */
+	    if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1)
+	      ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
+	  }
+	  last_bitpos_ptr[coefi] = Al;
+	}
+      }
+#endif
+    } else {
+      /* For sequential JPEG, all progression parameters must be these: */
+      if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0)
+	ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
+      /* Make sure components are not sent twice */
+      for (ci = 0; ci < ncomps; ci++) {
+	thisi = scanptr->component_index[ci];
+	if (component_sent[thisi])
+	  ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
+	component_sent[thisi] = TRUE;
+      }
+    }
+  }
+
+  /* Now verify that everything got sent. */
+  if (cinfo->progressive_mode) {
+#ifdef C_PROGRESSIVE_SUPPORTED
+    /* For progressive mode, we only check that at least some DC data
+     * got sent for each component; the spec does not require that all bits
+     * of all coefficients be transmitted.  Would it be wiser to enforce
+     * transmission of all coefficient bits??
+     */
+    for (ci = 0; ci < cinfo->num_components; ci++) {
+      if (last_bitpos[ci][0] < 0)
+	ERREXIT(cinfo, JERR_MISSING_DATA);
+    }
+#endif
+  } else {
+    for (ci = 0; ci < cinfo->num_components; ci++) {
+      if (! component_sent[ci])
+	ERREXIT(cinfo, JERR_MISSING_DATA);
+    }
+  }
+}
+
+#endif /* C_MULTISCAN_FILES_SUPPORTED */
+
+
+LOCAL(void)
+select_scan_parameters (j_compress_ptr cinfo)
+/* Set up the scan parameters for the current scan */
+{
+  int ci;
+
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+  if (cinfo->scan_info != NULL) {
+    /* Prepare for current scan --- the script is already validated */
+    my_master_ptr master = (my_master_ptr) cinfo->master;
+    const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number;
+
+    cinfo->comps_in_scan = scanptr->comps_in_scan;
+    for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
+      cinfo->cur_comp_info[ci] =
+	&cinfo->comp_info[scanptr->component_index[ci]];
+    }
+    cinfo->Ss = scanptr->Ss;
+    cinfo->Se = scanptr->Se;
+    cinfo->Ah = scanptr->Ah;
+    cinfo->Al = scanptr->Al;
+  }
+  else
+#endif
+  {
+    /* Prepare for single sequential-JPEG scan containing all components */
+    if (cinfo->num_components > MAX_COMPS_IN_SCAN)
+      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
+	       MAX_COMPS_IN_SCAN);
+    cinfo->comps_in_scan = cinfo->num_components;
+    for (ci = 0; ci < cinfo->num_components; ci++) {
+      cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
+    }
+    cinfo->Ss = 0;
+    cinfo->Se = DCTSIZE2-1;
+    cinfo->Ah = 0;
+    cinfo->Al = 0;
+  }
+}
+
+
+LOCAL(void)
+per_scan_setup (j_compress_ptr cinfo)
+/* Do computations that are needed before processing a JPEG scan */
+/* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */
+{
+  int ci, mcublks, tmp;
+  jpeg_component_info *compptr;
+  
+  if (cinfo->comps_in_scan == 1) {
+    
+    /* Noninterleaved (single-component) scan */
+    compptr = cinfo->cur_comp_info[0];
+    
+    /* Overall image size in MCUs */
+    cinfo->MCUs_per_row = compptr->width_in_blocks;
+    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
+    
+    /* For noninterleaved scan, always one block per MCU */
+    compptr->MCU_width = 1;
+    compptr->MCU_height = 1;
+    compptr->MCU_blocks = 1;
+    compptr->MCU_sample_width = DCTSIZE;
+    compptr->last_col_width = 1;
+    /* For noninterleaved scans, it is convenient to define last_row_height
+     * as the number of block rows present in the last iMCU row.
+     */
+    tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+    if (tmp == 0) tmp = compptr->v_samp_factor;
+    compptr->last_row_height = tmp;
+    
+    /* Prepare array describing MCU composition */
+    cinfo->blocks_in_MCU = 1;
+    cinfo->MCU_membership[0] = 0;
+    
+  } else {
+    
+    /* Interleaved (multi-component) scan */
+    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
+      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
+	       MAX_COMPS_IN_SCAN);
+    
+    /* Overall image size in MCUs */
+    cinfo->MCUs_per_row = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width,
+		    (long) (cinfo->max_h_samp_factor*DCTSIZE));
+    cinfo->MCU_rows_in_scan = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height,
+		    (long) (cinfo->max_v_samp_factor*DCTSIZE));
+    
+    cinfo->blocks_in_MCU = 0;
+    
+    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+      compptr = cinfo->cur_comp_info[ci];
+      /* Sampling factors give # of blocks of component in each MCU */
+      compptr->MCU_width = compptr->h_samp_factor;
+      compptr->MCU_height = compptr->v_samp_factor;
+      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
+      compptr->MCU_sample_width = compptr->MCU_width * DCTSIZE;
+      /* Figure number of non-dummy blocks in last MCU column & row */
+      tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);
+      if (tmp == 0) tmp = compptr->MCU_width;
+      compptr->last_col_width = tmp;
+      tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);
+      if (tmp == 0) tmp = compptr->MCU_height;
+      compptr->last_row_height = tmp;
+      /* Prepare array describing MCU composition */
+      mcublks = compptr->MCU_blocks;
+      if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU)
+	ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
+      while (mcublks-- > 0) {
+	cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
+      }
+    }
+    
+  }
+
+  /* Convert restart specified in rows to actual MCU count. */
+  /* Note that count must fit in 16 bits, so we provide limiting. */
+  if (cinfo->restart_in_rows > 0) {
+    long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row;
+    cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L);
+  }
+}
+
+
+/*
+ * Per-pass setup.
+ * This is called at the beginning of each pass.  We determine which modules
+ * will be active during this pass and give them appropriate start_pass calls.
+ * We also set is_last_pass to indicate whether any more passes will be
+ * required.
+ */
+
+METHODDEF(void)
+prepare_for_pass (j_compress_ptr cinfo)
+{
+  my_master_ptr master = (my_master_ptr) cinfo->master;
+
+  switch (master->pass_type) {
+  case main_pass:
+    /* Initial pass: will collect input data, and do either Huffman
+     * optimization or data output for the first scan.
+     */
+    select_scan_parameters(cinfo);
+    per_scan_setup(cinfo);
+    if (! cinfo->raw_data_in) {
+      (*cinfo->cconvert->start_pass) (cinfo);
+      (*cinfo->downsample->start_pass) (cinfo);
+      (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);
+    }
+    (*cinfo->fdct->start_pass) (cinfo);
+    (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding);
+    (*cinfo->coef->start_pass) (cinfo,
+				(master->total_passes > 1 ?
+				 JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
+    (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
+    if (cinfo->optimize_coding) {
+      /* No immediate data output; postpone writing frame/scan headers */
+      master->pub.call_pass_startup = FALSE;
+    } else {
+      /* Will write frame/scan headers at first jpeg_write_scanlines call */
+      master->pub.call_pass_startup = TRUE;
+    }
+    break;
+#ifdef ENTROPY_OPT_SUPPORTED
+  case huff_opt_pass:
+    /* Do Huffman optimization for a scan after the first one. */
+    select_scan_parameters(cinfo);
+    per_scan_setup(cinfo);
+    if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code) {
+      (*cinfo->entropy->start_pass) (cinfo, TRUE);
+      (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
+      master->pub.call_pass_startup = FALSE;
+      break;
+    }
+    /* Special case: Huffman DC refinement scans need no Huffman table
+     * and therefore we can skip the optimization pass for them.
+     */
+    master->pass_type = output_pass;
+    master->pass_number++;
+    /*FALLTHROUGH*/
+#endif
+  case output_pass:
+    /* Do a data-output pass. */
+    /* We need not repeat per-scan setup if prior optimization pass did it. */
+    if (! cinfo->optimize_coding) {
+      select_scan_parameters(cinfo);
+      per_scan_setup(cinfo);
+    }
+    (*cinfo->entropy->start_pass) (cinfo, FALSE);
+    (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
+    /* We emit frame/scan headers now */
+    if (master->scan_number == 0)
+      (*cinfo->marker->write_frame_header) (cinfo);
+    (*cinfo->marker->write_scan_header) (cinfo);
+    master->pub.call_pass_startup = FALSE;
+    break;
+  default:
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+  }
+
+  master->pub.is_last_pass = (master->pass_number == master->total_passes-1);
+
+  /* Set up progress monitor's pass info if present */
+  if (cinfo->progress != NULL) {
+    cinfo->progress->completed_passes = master->pass_number;
+    cinfo->progress->total_passes = master->total_passes;
+  }
+}
+
+
+/*
+ * Special start-of-pass hook.
+ * This is called by jpeg_write_scanlines if call_pass_startup is TRUE.
+ * In single-pass processing, we need this hook because we don't want to
+ * write frame/scan headers during jpeg_start_compress; we want to let the
+ * application write COM markers etc. between jpeg_start_compress and the
+ * jpeg_write_scanlines loop.
+ * In multi-pass processing, this routine is not used.
+ */
+
+METHODDEF(void)
+pass_startup (j_compress_ptr cinfo)
+{
+  cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */
+
+  (*cinfo->marker->write_frame_header) (cinfo);
+  (*cinfo->marker->write_scan_header) (cinfo);
+}
+
+
+/*
+ * Finish up at end of pass.
+ */
+
+METHODDEF(void)
+finish_pass_master (j_compress_ptr cinfo)
+{
+  my_master_ptr master = (my_master_ptr) cinfo->master;
+
+  /* The entropy coder always needs an end-of-pass call,
+   * either to analyze statistics or to flush its output buffer.
+   */
+  (*cinfo->entropy->finish_pass) (cinfo);
+
+  /* Update state for next pass */
+  switch (master->pass_type) {
+  case main_pass:
+    /* next pass is either output of scan 0 (after optimization)
+     * or output of scan 1 (if no optimization).
+     */
+    master->pass_type = output_pass;
+    if (! cinfo->optimize_coding)
+      master->scan_number++;
+    break;
+  case huff_opt_pass:
+    /* next pass is always output of current scan */
+    master->pass_type = output_pass;
+    break;
+  case output_pass:
+    /* next pass is either optimization or output of next scan */
+    if (cinfo->optimize_coding)
+      master->pass_type = huff_opt_pass;
+    master->scan_number++;
+    break;
+  }
+
+  master->pass_number++;
+}
+
+
+/*
+ * Initialize master compression control.
+ */
+
+GLOBAL(void)
+jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
+{
+  my_master_ptr master;
+
+  master = (my_master_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(my_comp_master));
+  cinfo->master = (struct jpeg_comp_master *) master;
+  master->pub.prepare_for_pass = prepare_for_pass;
+  master->pub.pass_startup = pass_startup;
+  master->pub.finish_pass = finish_pass_master;
+  master->pub.is_last_pass = FALSE;
+
+  /* Validate parameters, determine derived values */
+  initial_setup(cinfo);
+
+  if (cinfo->scan_info != NULL) {
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+    validate_script(cinfo);
+#else
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+  } else {
+    cinfo->progressive_mode = FALSE;
+    cinfo->num_scans = 1;
+  }
+
+  if (cinfo->progressive_mode)	/*  TEMPORARY HACK ??? */
+    cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */
+
+  /* Initialize my private state */
+  if (transcode_only) {
+    /* no main pass in transcoding */
+    if (cinfo->optimize_coding)
+      master->pass_type = huff_opt_pass;
+    else
+      master->pass_type = output_pass;
+  } else {
+    /* for normal compression, first pass is always this type: */
+    master->pass_type = main_pass;
+  }
+  master->scan_number = 0;
+  master->pass_number = 0;
+  if (cinfo->optimize_coding)
+    master->total_passes = cinfo->num_scans * 2;
+  else
+    master->total_passes = cinfo->num_scans;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcomapi.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcomapi.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcomapi.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,106 @@
+/*
+ * jcomapi.c
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains application interface routines that are used for both
+ * compression and decompression.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * Abort processing of a JPEG compression or decompression operation,
+ * but don't destroy the object itself.
+ *
+ * For this, we merely clean up all the nonpermanent memory pools.
+ * Note that temp files (virtual arrays) are not allowed to belong to
+ * the permanent pool, so we will be able to close all temp files here.
+ * Closing a data source or destination, if necessary, is the application's
+ * responsibility.
+ */
+
+GLOBAL(void)
+jpeg_abort (j_common_ptr cinfo)
+{
+  int pool;
+
+  /* Do nothing if called on a not-initialized or destroyed JPEG object. */
+  if (cinfo->mem == NULL)
+    return;
+
+  /* Releasing pools in reverse order might help avoid fragmentation
+   * with some (brain-damaged) malloc libraries.
+   */
+  for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {
+    (*cinfo->mem->free_pool) (cinfo, pool);
+  }
+
+  /* Reset overall state for possible reuse of object */
+  if (cinfo->is_decompressor) {
+    cinfo->global_state = DSTATE_START;
+    /* Try to keep application from accessing now-deleted marker list.
+     * A bit kludgy to do it here, but this is the most central place.
+     */
+    ((j_decompress_ptr) cinfo)->marker_list = NULL;
+  } else {
+    cinfo->global_state = CSTATE_START;
+  }
+}
+
+
+/*
+ * Destruction of a JPEG object.
+ *
+ * Everything gets deallocated except the master jpeg_compress_struct itself
+ * and the error manager struct.  Both of these are supplied by the application
+ * and must be freed, if necessary, by the application.  (Often they are on
+ * the stack and so don't need to be freed anyway.)
+ * Closing a data source or destination, if necessary, is the application's
+ * responsibility.
+ */
+
+GLOBAL(void)
+jpeg_destroy (j_common_ptr cinfo)
+{
+  /* We need only tell the memory manager to release everything. */
+  /* NB: mem pointer is NULL if memory mgr failed to initialize. */
+  if (cinfo->mem != NULL)
+    (*cinfo->mem->self_destruct) (cinfo);
+  cinfo->mem = NULL;		/* be safe if jpeg_destroy is called twice */
+  cinfo->global_state = 0;	/* mark it destroyed */
+}
+
+
+/*
+ * Convenience routines for allocating quantization and Huffman tables.
+ * (Would jutils.c be a more reasonable place to put these?)
+ */
+
+GLOBAL(JQUANT_TBL *)
+jpeg_alloc_quant_table (j_common_ptr cinfo)
+{
+  JQUANT_TBL *tbl;
+
+  tbl = (JQUANT_TBL *)
+    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL));
+  tbl->sent_table = FALSE;	/* make sure this is false in any new table */
+  return tbl;
+}
+
+
+GLOBAL(JHUFF_TBL *)
+jpeg_alloc_huff_table (j_common_ptr cinfo)
+{
+  JHUFF_TBL *tbl;
+
+  tbl = (JHUFF_TBL *)
+    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL));
+  tbl->sent_table = FALSE;	/* make sure this is false in any new table */
+  return tbl;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.bcc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.bcc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.bcc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,48 @@
+/* jconfig.bcc --- jconfig.h for Borland C (Turbo C) on MS-DOS or OS/2. */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#ifdef __MSDOS__
+#define NEED_FAR_POINTERS	/* for small or medium memory model */
+#endif
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN	/* this assumes you have -w-stu in CFLAGS */
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#ifdef __MSDOS__
+#define USE_MSDOS_MEMMGR	/* Define this if you use jmemdos.c */
+#define MAX_ALLOC_CHUNK 65520L	/* Maximum request to malloc() */
+#define USE_FMEM		/* Borland has _fmemcpy() and _fmemset() */
+#endif
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#define TWO_FILE_COMMANDLINE
+#define USE_SETMODE		/* Borland has setmode() */
+#ifdef __MSDOS__
+#define NEED_SIGNAL_CATCHER	/* Define this if you use jmemdos.c */
+#endif
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.cfg
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.cfg	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.cfg	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,44 @@
+/* jconfig.cfg --- source file edited by configure script */
+/* see jconfig.doc for explanations */
+
+#undef HAVE_PROTOTYPES
+#undef HAVE_UNSIGNED_CHAR
+#undef HAVE_UNSIGNED_SHORT
+#undef void
+#undef const
+#undef CHAR_IS_UNSIGNED
+#undef HAVE_STDDEF_H
+#undef HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+/* Define this if you get warnings about undefined structures. */
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef INLINE
+/* These are for configuring the JPEG memory manager. */
+#undef DEFAULT_MAX_MEM
+#undef NO_MKTEMP
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
+#undef PROGRESS_REPORT
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.dj
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.dj	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.dj	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+/* jconfig.dj --- jconfig.h for DJGPP (Delorie's GNU C port) on MS-DOS. */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS	/* DJGPP uses flat 32-bit addressing */
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE	/* optional */
+#define USE_SETMODE		/* Needed to make one-file style work in DJGPP */
+#undef NEED_SIGNAL_CATCHER	/* Define this if you use jmemname.c */
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.doc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.doc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.doc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,155 @@
+/*
+ * jconfig.doc
+ *
+ * Copyright (C) 1991-1994, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file documents the configuration options that are required to
+ * customize the JPEG software for a particular system.
+ *
+ * The actual configuration options for a particular installation are stored
+ * in jconfig.h.  On many machines, jconfig.h can be generated automatically
+ * or copied from one of the "canned" jconfig files that we supply.  But if
+ * you need to generate a jconfig.h file by hand, this file tells you how.
+ *
+ * DO NOT EDIT THIS FILE --- IT WON'T ACCOMPLISH ANYTHING.
+ * EDIT A COPY NAMED JCONFIG.H.
+ */
+
+
+/*
+ * These symbols indicate the properties of your machine or compiler.
+ * #define the symbol if yes, #undef it if no.
+ */
+
+/* Does your compiler support function prototypes?
+ * (If not, you also need to use ansi2knr, see install.doc)
+ */
+#define HAVE_PROTOTYPES
+
+/* Does your compiler support the declaration "unsigned char" ?
+ * How about "unsigned short" ?
+ */
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+
+/* Define "void" as "char" if your compiler doesn't know about type void.
+ * NOTE: be sure to define void such that "void *" represents the most general
+ * pointer type, e.g., that returned by malloc().
+ */
+/* #define void char */
+
+/* Define "const" as empty if your compiler doesn't know the "const" keyword.
+ */
+/* #define const */
+
+/* Define this if an ordinary "char" type is unsigned.
+ * If you're not sure, leaving it undefined will work at some cost in speed.
+ * If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal.
+ */
+#undef CHAR_IS_UNSIGNED
+
+/* Define this if your system has an ANSI-conforming <stddef.h> file.
+ */
+#define HAVE_STDDEF_H
+
+/* Define this if your system has an ANSI-conforming <stdlib.h> file.
+ */
+#define HAVE_STDLIB_H
+
+/* Define this if your system does not have an ANSI/SysV <string.h>,
+ * but does have a BSD-style <strings.h>.
+ */
+#undef NEED_BSD_STRINGS
+
+/* Define this if your system does not provide typedef size_t in any of the
+ * ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in
+ * <sys/types.h> instead.
+ */
+#undef NEED_SYS_TYPES_H
+
+/* For 80x86 machines, you need to define NEED_FAR_POINTERS,
+ * unless you are using a large-data memory model or 80386 flat-memory mode.
+ * On less brain-damaged CPUs this symbol must not be defined.
+ * (Defining this symbol causes large data structures to be referenced through
+ * "far" pointers and to be allocated with a special version of malloc.)
+ */
+#undef NEED_FAR_POINTERS
+
+/* Define this if your linker needs global names to be unique in less
+ * than the first 15 characters.
+ */
+#undef NEED_SHORT_EXTERNAL_NAMES
+
+/* Although a real ANSI C compiler can deal perfectly well with pointers to
+ * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI
+ * and pseudo-ANSI compilers get confused.  To keep one of these bozos happy,
+ * define INCOMPLETE_TYPES_BROKEN.  This is not recommended unless you
+ * actually get "missing structure definition" warnings or errors while
+ * compiling the JPEG code.
+ */
+#undef INCOMPLETE_TYPES_BROKEN
+
+
+/*
+ * The following options affect code selection within the JPEG library,
+ * but they don't need to be visible to applications using the library.
+ * To minimize application namespace pollution, the symbols won't be
+ * defined unless JPEG_INTERNALS has been defined.
+ */
+
+#ifdef JPEG_INTERNALS
+
+/* Define this if your compiler implements ">>" on signed values as a logical
+ * (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift,
+ * which is the normal and rational definition.
+ */
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+
+#endif /* JPEG_INTERNALS */
+
+
+/*
+ * The remaining options do not affect the JPEG library proper,
+ * but only the sample applications cjpeg/djpeg (see cjpeg.c, djpeg.c).
+ * Other applications can ignore these.
+ */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+/* These defines indicate which image (non-JPEG) file formats are allowed. */
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+/* Define this if you want to name both input and output files on the command
+ * line, rather than using stdout and optionally stdin.  You MUST do this if
+ * your system can't cope with binary I/O to stdin/stdout.  See comments at
+ * head of cjpeg.c or djpeg.c.
+ */
+#undef TWO_FILE_COMMANDLINE
+
+/* Define this if your system needs explicit cleanup of temporary files.
+ * This is crucial under MS-DOS, where the temporary "files" may be areas
+ * of extended memory; on most other systems it's not as important.
+ */
+#undef NEED_SIGNAL_CATCHER
+
+/* By default, we open image files with fopen(...,"rb") or fopen(...,"wb").
+ * This is necessary on systems that distinguish text files from binary files,
+ * and is harmless on most systems that don't.  If you have one of the rare
+ * systems that complains about the "b" spec, define this symbol.
+ */
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg.
+ */
+#undef PROGRESS_REPORT
+
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.mac
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.mac	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.mac	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/* jconfig.mac --- jconfig.h for CodeWarrior on Apple Macintosh */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#define USE_MAC_MEMMGR		/* Define this if you use jmemmac.c */
+
+#define ALIGN_TYPE long		/* Needed for 680x0 Macs */
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#define USE_CCOMMAND		/* Command line reader for Macintosh */
+#define TWO_FILE_COMMANDLINE	/* Binary I/O thru stdin/stdout doesn't work */
+
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.manx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.manx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.manx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/* jconfig.manx --- jconfig.h for Amiga systems using Manx Aztec C ver 5.x. */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#define TEMP_DIRECTORY "JPEGTMP:"	/* recommended setting for Amiga */
+
+#define SHORTxSHORT_32		/* produces better DCT code with Aztec C */
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#define TWO_FILE_COMMANDLINE
+#define NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#define signal_catcher _abort	/* hack for Aztec C naming requirements */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.mc6
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.mc6	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.mc6	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,52 @@
+/* jconfig.mc6 --- jconfig.h for Microsoft C on MS-DOS, version 6.00A & up. */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#define NEED_FAR_POINTERS	/* for small or medium memory model */
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#define USE_MSDOS_MEMMGR	/* Define this if you use jmemdos.c */
+
+#define MAX_ALLOC_CHUNK 65520L	/* Maximum request to malloc() */
+
+#define USE_FMEM		/* Microsoft has _fmemcpy() and _fmemset() */
+
+#define NEED_FHEAPMIN		/* far heap management routines are broken */
+
+#define SHORTxLCONST_32		/* enable compiler-specific DCT optimization */
+/* Note: the above define is known to improve the code with Microsoft C 6.00A.
+ * I do not know whether it is good for later compiler versions.
+ * Please report any info on this point to jpeg-info at uunet.uu.net.
+ */
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#define TWO_FILE_COMMANDLINE
+#define USE_SETMODE		/* Microsoft has setmode() */
+#define NEED_SIGNAL_CATCHER	/* Define this if you use jmemdos.c */
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.sas
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.sas	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.sas	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+/* jconfig.sas --- jconfig.h for Amiga systems using SAS C 6.0 and up. */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#define TEMP_DIRECTORY "JPEGTMP:"	/* recommended setting for Amiga */
+
+#define NO_MKTEMP		/* SAS C doesn't have mktemp() */
+
+#define SHORTxSHORT_32		/* produces better DCT code with SAS C */
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#define TWO_FILE_COMMANDLINE
+#define NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.st
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.st	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.st	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,42 @@
+/* jconfig.st --- jconfig.h for Atari ST/STE/TT using Pure C or Turbo C. */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+#define INCOMPLETE_TYPES_BROKEN	/* suppress undefined-structure warnings */
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#define ALIGN_TYPE  long	/* apparently double is a weird size? */
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#define TWO_FILE_COMMANDLINE	/* optional -- undef if you like Unix style */
+/* Note: if you undef TWO_FILE_COMMANDLINE, you may need to define
+ * USE_SETMODE.  Some Atari compilers require it, some do not.
+ */
+#define NEED_SIGNAL_CATCHER	/* needed if you use jmemname.c */
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.vc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.vc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.vc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS	/* we presume a 32-bit flat memory model */
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+/* Define "boolean" as unsigned char, not int, per Windows custom */
+#ifndef __RPCNDR_H__		/* don't conflict if rpcndr.h already read */
+typedef unsigned char boolean;
+#endif
+#define HAVE_BOOLEAN		/* prevent jmorecfg.h from redefining it */
+
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#define TWO_FILE_COMMANDLINE	/* optional */
+#define USE_SETMODE		/* Microsoft has setmode() */
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.vms
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.vms	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.vms	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,37 @@
+/* jconfig.vms --- jconfig.h for use on Digital VMS. */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#undef CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#define TWO_FILE_COMMANDLINE	/* Needed on VMS */
+#undef NEED_SIGNAL_CATCHER
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.wat
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.wat	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jconfig.wat	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+/* jconfig.wat --- jconfig.h for Watcom C/C++ on MS-DOS or OS/2. */
+/* see jconfig.doc for explanations */
+
+#define HAVE_PROTOTYPES
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+/* #define void char */
+/* #define const */
+#define CHAR_IS_UNSIGNED
+#define HAVE_STDDEF_H
+#define HAVE_STDLIB_H
+#undef NEED_BSD_STRINGS
+#undef NEED_SYS_TYPES_H
+#undef NEED_FAR_POINTERS	/* Watcom uses flat 32-bit addressing */
+#undef NEED_SHORT_EXTERNAL_NAMES
+#undef INCOMPLETE_TYPES_BROKEN
+
+#ifdef JPEG_INTERNALS
+
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+#endif /* JPEG_INTERNALS */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+#define BMP_SUPPORTED		/* BMP image file format */
+#define GIF_SUPPORTED		/* GIF image file format */
+#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED		/* Utah RLE image file format */
+#define TARGA_SUPPORTED		/* Targa image file format */
+
+#undef TWO_FILE_COMMANDLINE	/* optional */
+#define USE_SETMODE		/* Needed to make one-file style work in Watcom */
+#undef NEED_SIGNAL_CATCHER	/* Define this if you use jmemname.c */
+#undef DONT_USE_B_MODE
+#undef PROGRESS_REPORT		/* optional */
+
+#endif /* JPEG_CJPEG_DJPEG */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcparam.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcparam.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcparam.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,610 @@
+/*
+ * jcparam.c
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains optional default-setting code for the JPEG compressor.
+ * Applications do not have to use this file, but those that don't use it
+ * must know a lot more about the innards of the JPEG code.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * Quantization table setup routines
+ */
+
+GLOBAL(void)
+jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
+		      const unsigned int *basic_table,
+		      int scale_factor, boolean force_baseline)
+/* Define a quantization table equal to the basic_table times
+ * a scale factor (given as a percentage).
+ * If force_baseline is TRUE, the computed quantization table entries
+ * are limited to 1..255 for JPEG baseline compatibility.
+ */
+{
+  JQUANT_TBL ** qtblptr;
+  int i;
+  long temp;
+
+  /* Safety check to ensure start_compress not called yet. */
+  if (cinfo->global_state != CSTATE_START)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS)
+    ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl);
+
+  qtblptr = & cinfo->quant_tbl_ptrs[which_tbl];
+
+  if (*qtblptr == NULL)
+    *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo);
+
+  for (i = 0; i < DCTSIZE2; i++) {
+    temp = ((long) basic_table[i] * scale_factor + 50L) / 100L;
+    /* limit the values to the valid range */
+    if (temp <= 0L) temp = 1L;
+    if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
+    if (force_baseline && temp > 255L)
+      temp = 255L;		/* limit to baseline range if requested */
+    (*qtblptr)->quantval[i] = (UINT16) temp;
+  }
+
+  /* Initialize sent_table FALSE so table will be written to JPEG file. */
+  (*qtblptr)->sent_table = FALSE;
+}
+
+
+GLOBAL(void)
+jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
+			 boolean force_baseline)
+/* Set or change the 'quality' (quantization) setting, using default tables
+ * and a straight percentage-scaling quality scale.  In most cases it's better
+ * to use jpeg_set_quality (below); this entry point is provided for
+ * applications that insist on a linear percentage scaling.
+ */
+{
+  /* These are the sample quantization tables given in JPEG spec section K.1.
+   * The spec says that the values given produce "good" quality, and
+   * when divided by 2, "very good" quality.
+   */
+  static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = {
+    16,  11,  10,  16,  24,  40,  51,  61,
+    12,  12,  14,  19,  26,  58,  60,  55,
+    14,  13,  16,  24,  40,  57,  69,  56,
+    14,  17,  22,  29,  51,  87,  80,  62,
+    18,  22,  37,  56,  68, 109, 103,  77,
+    24,  35,  55,  64,  81, 104, 113,  92,
+    49,  64,  78,  87, 103, 121, 120, 101,
+    72,  92,  95,  98, 112, 100, 103,  99
+  };
+  static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {
+    17,  18,  24,  47,  99,  99,  99,  99,
+    18,  21,  26,  66,  99,  99,  99,  99,
+    24,  26,  56,  99,  99,  99,  99,  99,
+    47,  66,  99,  99,  99,  99,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99
+  };
+
+  /* Set up two quantization tables using the specified scaling */
+  jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
+		       scale_factor, force_baseline);
+  jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
+		       scale_factor, force_baseline);
+}
+
+
+GLOBAL(int)
+jpeg_quality_scaling (int quality)
+/* Convert a user-specified quality rating to a percentage scaling factor
+ * for an underlying quantization table, using our recommended scaling curve.
+ * The input 'quality' factor should be 0 (terrible) to 100 (very good).
+ */
+{
+  /* Safety limit on quality factor.  Convert 0 to 1 to avoid zero divide. */
+  if (quality <= 0) quality = 1;
+  if (quality > 100) quality = 100;
+
+  /* The basic table is used as-is (scaling 100) for a quality of 50.
+   * Qualities 50..100 are converted to scaling percentage 200 - 2*Q;
+   * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table
+   * to make all the table entries 1 (hence, minimum quantization loss).
+   * Qualities 1..50 are converted to scaling percentage 5000/Q.
+   */
+  if (quality < 50)
+    quality = 5000 / quality;
+  else
+    quality = 200 - quality*2;
+
+  return quality;
+}
+
+
+GLOBAL(void)
+jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
+/* Set or change the 'quality' (quantization) setting, using default tables.
+ * This is the standard quality-adjusting entry point for typical user
+ * interfaces; only those who want detailed control over quantization tables
+ * would use the preceding three routines directly.
+ */
+{
+  /* Convert user 0-100 rating to percentage scaling */
+  quality = jpeg_quality_scaling(quality);
+
+  /* Set up standard quality tables */
+  jpeg_set_linear_quality(cinfo, quality, force_baseline);
+}
+
+
+/*
+ * Huffman table setup routines
+ */
+
+LOCAL(void)
+add_huff_table (j_compress_ptr cinfo,
+		JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
+/* Define a Huffman table */
+{
+  int nsymbols, len;
+
+  if (*htblptr == NULL)
+    *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
+
+  /* Copy the number-of-symbols-of-each-code-length counts */
+  MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
+
+  /* Validate the counts.  We do this here mainly so we can copy the right
+   * number of symbols from the val[] array, without risking marching off
+   * the end of memory.  jchuff.c will do a more thorough test later.
+   */
+  nsymbols = 0;
+  for (len = 1; len <= 16; len++)
+    nsymbols += bits[len];
+  if (nsymbols < 1 || nsymbols > 256)
+    ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+
+  MEMCOPY((*htblptr)->huffval, val, nsymbols * SIZEOF(UINT8));
+
+  /* Initialize sent_table FALSE so table will be written to JPEG file. */
+  (*htblptr)->sent_table = FALSE;
+}
+
+
+LOCAL(void)
+std_huff_tables (j_compress_ptr cinfo)
+/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
+/* IMPORTANT: these are only valid for 8-bit data precision! */
+{
+  static const UINT8 bits_dc_luminance[17] =
+    { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
+  static const UINT8 val_dc_luminance[] =
+    { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+  
+  static const UINT8 bits_dc_chrominance[17] =
+    { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
+  static const UINT8 val_dc_chrominance[] =
+    { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+  
+  static const UINT8 bits_ac_luminance[17] =
+    { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
+  static const UINT8 val_ac_luminance[] =
+    { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
+      0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
+      0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
+      0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
+      0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
+      0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
+      0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+      0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
+      0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
+      0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+      0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
+      0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+      0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+      0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+      0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
+      0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
+      0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
+      0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
+      0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
+      0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+      0xf9, 0xfa };
+  
+  static const UINT8 bits_ac_chrominance[17] =
+    { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
+  static const UINT8 val_ac_chrominance[] =
+    { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
+      0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
+      0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
+      0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
+      0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
+      0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
+      0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
+      0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+      0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+      0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+      0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+      0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+      0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
+      0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
+      0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
+      0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
+      0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
+      0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
+      0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
+      0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+      0xf9, 0xfa };
+  
+  add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
+		 bits_dc_luminance, val_dc_luminance);
+  add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0],
+		 bits_ac_luminance, val_ac_luminance);
+  add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1],
+		 bits_dc_chrominance, val_dc_chrominance);
+  add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1],
+		 bits_ac_chrominance, val_ac_chrominance);
+}
+
+
+/*
+ * Default parameter setup for compression.
+ *
+ * Applications that don't choose to use this routine must do their
+ * own setup of all these parameters.  Alternately, you can call this
+ * to establish defaults and then alter parameters selectively.  This
+ * is the recommended approach since, if we add any new parameters,
+ * your code will still work (they'll be set to reasonable defaults).
+ */
+
+GLOBAL(void)
+jpeg_set_defaults (j_compress_ptr cinfo)
+{
+  int i;
+
+  /* Safety check to ensure start_compress not called yet. */
+  if (cinfo->global_state != CSTATE_START)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  /* Allocate comp_info array large enough for maximum component count.
+   * Array is made permanent in case application wants to compress
+   * multiple images at same param settings.
+   */
+  if (cinfo->comp_info == NULL)
+    cinfo->comp_info = (jpeg_component_info *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+				  MAX_COMPONENTS * SIZEOF(jpeg_component_info));
+
+  /* Initialize everything not dependent on the color space */
+
+  cinfo->data_precision = BITS_IN_JSAMPLE;
+  /* Set up two quantization tables using default quality of 75 */
+  jpeg_set_quality(cinfo, 75, TRUE);
+  /* Set up two Huffman tables */
+  std_huff_tables(cinfo);
+
+  /* Initialize default arithmetic coding conditioning */
+  for (i = 0; i < NUM_ARITH_TBLS; i++) {
+    cinfo->arith_dc_L[i] = 0;
+    cinfo->arith_dc_U[i] = 1;
+    cinfo->arith_ac_K[i] = 5;
+  }
+
+  /* Default is no multiple-scan output */
+  cinfo->scan_info = NULL;
+  cinfo->num_scans = 0;
+
+  /* Expect normal source image, not raw downsampled data */
+  cinfo->raw_data_in = FALSE;
+
+  /* Use Huffman coding, not arithmetic coding, by default */
+  cinfo->arith_code = FALSE;
+
+  /* By default, don't do extra passes to optimize entropy coding */
+  cinfo->optimize_coding = FALSE;
+  /* The standard Huffman tables are only valid for 8-bit data precision.
+   * If the precision is higher, force optimization on so that usable
+   * tables will be computed.  This test can be removed if default tables
+   * are supplied that are valid for the desired precision.
+   */
+  if (cinfo->data_precision > 8)
+    cinfo->optimize_coding = TRUE;
+
+  /* By default, use the simpler non-cosited sampling alignment */
+  cinfo->CCIR601_sampling = FALSE;
+
+  /* No input smoothing */
+  cinfo->smoothing_factor = 0;
+
+  /* DCT algorithm preference */
+  cinfo->dct_method = JDCT_DEFAULT;
+
+  /* No restart markers */
+  cinfo->restart_interval = 0;
+  cinfo->restart_in_rows = 0;
+
+  /* Fill in default JFIF marker parameters.  Note that whether the marker
+   * will actually be written is determined by jpeg_set_colorspace.
+   *
+   * By default, the library emits JFIF version code 1.01.
+   * An application that wants to emit JFIF 1.02 extension markers should set
+   * JFIF_minor_version to 2.  We could probably get away with just defaulting
+   * to 1.02, but there may still be some decoders in use that will complain
+   * about that; saying 1.01 should minimize compatibility problems.
+   */
+  cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */
+  cinfo->JFIF_minor_version = 1;
+  cinfo->density_unit = 0;	/* Pixel size is unknown by default */
+  cinfo->X_density = 1;		/* Pixel aspect ratio is square by default */
+  cinfo->Y_density = 1;
+
+  /* Choose JPEG colorspace based on input space, set defaults accordingly */
+
+  jpeg_default_colorspace(cinfo);
+}
+
+
+/*
+ * Select an appropriate JPEG colorspace for in_color_space.
+ */
+
+GLOBAL(void)
+jpeg_default_colorspace (j_compress_ptr cinfo)
+{
+  switch (cinfo->in_color_space) {
+  case JCS_GRAYSCALE:
+    jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
+    break;
+  case JCS_RGB:
+    jpeg_set_colorspace(cinfo, JCS_YCbCr);
+    break;
+  case JCS_YCbCr:
+    jpeg_set_colorspace(cinfo, JCS_YCbCr);
+    break;
+  case JCS_CMYK:
+    jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */
+    break;
+  case JCS_YCCK:
+    jpeg_set_colorspace(cinfo, JCS_YCCK);
+    break;
+  case JCS_UNKNOWN:
+    jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
+    break;
+  default:
+    ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
+  }
+}
+
+
+/*
+ * Set the JPEG colorspace, and choose colorspace-dependent default values.
+ */
+
+GLOBAL(void)
+jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
+{
+  jpeg_component_info * compptr;
+  int ci;
+
+#define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl)  \
+  (compptr = &cinfo->comp_info[index], \
+   compptr->component_id = (id), \
+   compptr->h_samp_factor = (hsamp), \
+   compptr->v_samp_factor = (vsamp), \
+   compptr->quant_tbl_no = (quant), \
+   compptr->dc_tbl_no = (dctbl), \
+   compptr->ac_tbl_no = (actbl) )
+
+  /* Safety check to ensure start_compress not called yet. */
+  if (cinfo->global_state != CSTATE_START)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  /* For all colorspaces, we use Q and Huff tables 0 for luminance components,
+   * tables 1 for chrominance components.
+   */
+
+  cinfo->jpeg_color_space = colorspace;
+
+  cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */
+  cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
+
+  switch (colorspace) {
+  case JCS_GRAYSCALE:
+    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
+    cinfo->num_components = 1;
+    /* JFIF specifies component ID 1 */
+    SET_COMP(0, 1, 1,1, 0, 0,0);
+    break;
+  case JCS_RGB:
+    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
+    cinfo->num_components = 3;
+    SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);
+    SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);
+    SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);
+    break;
+  case JCS_YCbCr:
+    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
+    cinfo->num_components = 3;
+    /* JFIF specifies component IDs 1,2,3 */
+    /* We default to 2x2 subsamples of chrominance */
+    SET_COMP(0, 1, 2,2, 0, 0,0);
+    SET_COMP(1, 2, 1,1, 1, 1,1);
+    SET_COMP(2, 3, 1,1, 1, 1,1);
+    break;
+  case JCS_CMYK:
+    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
+    cinfo->num_components = 4;
+    SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0);
+    SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0);
+    SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0);
+    SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0);
+    break;
+  case JCS_YCCK:
+    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
+    cinfo->num_components = 4;
+    SET_COMP(0, 1, 2,2, 0, 0,0);
+    SET_COMP(1, 2, 1,1, 1, 1,1);
+    SET_COMP(2, 3, 1,1, 1, 1,1);
+    SET_COMP(3, 4, 2,2, 0, 0,0);
+    break;
+  case JCS_UNKNOWN:
+    cinfo->num_components = cinfo->input_components;
+    if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
+      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
+	       MAX_COMPONENTS);
+    for (ci = 0; ci < cinfo->num_components; ci++) {
+      SET_COMP(ci, ci, 1,1, 0, 0,0);
+    }
+    break;
+  default:
+    ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+  }
+}
+
+
+#ifdef C_PROGRESSIVE_SUPPORTED
+
+LOCAL(jpeg_scan_info *)
+fill_a_scan (jpeg_scan_info * scanptr, int ci,
+	     int Ss, int Se, int Ah, int Al)
+/* Support routine: generate one scan for specified component */
+{
+  scanptr->comps_in_scan = 1;
+  scanptr->component_index[0] = ci;
+  scanptr->Ss = Ss;
+  scanptr->Se = Se;
+  scanptr->Ah = Ah;
+  scanptr->Al = Al;
+  scanptr++;
+  return scanptr;
+}
+
+LOCAL(jpeg_scan_info *)
+fill_scans (jpeg_scan_info * scanptr, int ncomps,
+	    int Ss, int Se, int Ah, int Al)
+/* Support routine: generate one scan for each component */
+{
+  int ci;
+
+  for (ci = 0; ci < ncomps; ci++) {
+    scanptr->comps_in_scan = 1;
+    scanptr->component_index[0] = ci;
+    scanptr->Ss = Ss;
+    scanptr->Se = Se;
+    scanptr->Ah = Ah;
+    scanptr->Al = Al;
+    scanptr++;
+  }
+  return scanptr;
+}
+
+LOCAL(jpeg_scan_info *)
+fill_dc_scans (jpeg_scan_info * scanptr, int ncomps, int Ah, int Al)
+/* Support routine: generate interleaved DC scan if possible, else N scans */
+{
+  int ci;
+
+  if (ncomps <= MAX_COMPS_IN_SCAN) {
+    /* Single interleaved DC scan */
+    scanptr->comps_in_scan = ncomps;
+    for (ci = 0; ci < ncomps; ci++)
+      scanptr->component_index[ci] = ci;
+    scanptr->Ss = scanptr->Se = 0;
+    scanptr->Ah = Ah;
+    scanptr->Al = Al;
+    scanptr++;
+  } else {
+    /* Noninterleaved DC scan for each component */
+    scanptr = fill_scans(scanptr, ncomps, 0, 0, Ah, Al);
+  }
+  return scanptr;
+}
+
+
+/*
+ * Create a recommended progressive-JPEG script.
+ * cinfo->num_components and cinfo->jpeg_color_space must be correct.
+ */
+
+GLOBAL(void)
+jpeg_simple_progression (j_compress_ptr cinfo)
+{
+  int ncomps = cinfo->num_components;
+  int nscans;
+  jpeg_scan_info * scanptr;
+
+  /* Safety check to ensure start_compress not called yet. */
+  if (cinfo->global_state != CSTATE_START)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  /* Figure space needed for script.  Calculation must match code below! */
+  if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
+    /* Custom script for YCbCr color images. */
+    nscans = 10;
+  } else {
+    /* All-purpose script for other color spaces. */
+    if (ncomps > MAX_COMPS_IN_SCAN)
+      nscans = 6 * ncomps;	/* 2 DC + 4 AC scans per component */
+    else
+      nscans = 2 + 4 * ncomps;	/* 2 DC scans; 4 AC scans per component */
+  }
+
+  /* Allocate space for script.
+   * We need to put it in the permanent pool in case the application performs
+   * multiple compressions without changing the settings.  To avoid a memory
+   * leak if jpeg_simple_progression is called repeatedly for the same JPEG
+   * object, we try to re-use previously allocated space, and we allocate
+   * enough space to handle YCbCr even if initially asked for grayscale.
+   */
+  if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) {
+    cinfo->script_space_size = MAX(nscans, 10);
+    cinfo->script_space = (jpeg_scan_info *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+			cinfo->script_space_size * SIZEOF(jpeg_scan_info));
+  }
+  scanptr = cinfo->script_space;
+  cinfo->scan_info = scanptr;
+  cinfo->num_scans = nscans;
+
+  if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
+    /* Custom script for YCbCr color images. */
+    /* Initial DC scan */
+    scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
+    /* Initial AC scan: get some luma data out in a hurry */
+    scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2);
+    /* Chroma data is too small to be worth expending many scans on */
+    scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1);
+    scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1);
+    /* Complete spectral selection for luma AC */
+    scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2);
+    /* Refine next bit of luma AC */
+    scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1);
+    /* Finish DC successive approximation */
+    scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
+    /* Finish AC successive approximation */
+    scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0);
+    scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0);
+    /* Luma bottom bit comes last since it's usually largest scan */
+    scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0);
+  } else {
+    /* All-purpose script for other color spaces. */
+    /* Successive approximation first pass */
+    scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
+    scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2);
+    scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2);
+    /* Successive approximation second pass */
+    scanptr = fill_scans(scanptr, ncomps, 1, 63, 2, 1);
+    /* Successive approximation final pass */
+    scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
+    scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0);
+  }
+}
+
+#endif /* C_PROGRESSIVE_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcphuff.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcphuff.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcphuff.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,833 @@
+/*
+ * jcphuff.c
+ *
+ * Copyright (C) 1995-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains Huffman entropy encoding routines for progressive JPEG.
+ *
+ * We do not support output suspension in this module, since the library
+ * currently does not allow multiple-scan files to be written with output
+ * suspension.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jchuff.h"		/* Declarations shared with jchuff.c */
+
+#ifdef C_PROGRESSIVE_SUPPORTED
+
+/* Expanded entropy encoder object for progressive Huffman encoding. */
+
+typedef struct {
+  struct jpeg_entropy_encoder pub; /* public fields */
+
+  /* Mode flag: TRUE for optimization, FALSE for actual data output */
+  boolean gather_statistics;
+
+  /* Bit-level coding status.
+   * next_output_byte/free_in_buffer are local copies of cinfo->dest fields.
+   */
+  JOCTET * next_output_byte;	/* => next byte to write in buffer */
+  size_t free_in_buffer;	/* # of byte spaces remaining in buffer */
+  INT32 put_buffer;		/* current bit-accumulation buffer */
+  int put_bits;			/* # of bits now in it */
+  j_compress_ptr cinfo;		/* link to cinfo (needed for dump_buffer) */
+
+  /* Coding status for DC components */
+  int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
+
+  /* Coding status for AC components */
+  int ac_tbl_no;		/* the table number of the single component */
+  unsigned int EOBRUN;		/* run length of EOBs */
+  unsigned int BE;		/* # of buffered correction bits before MCU */
+  char * bit_buffer;		/* buffer for correction bits (1 per char) */
+  /* packing correction bits tightly would save some space but cost time... */
+
+  unsigned int restarts_to_go;	/* MCUs left in this restart interval */
+  int next_restart_num;		/* next restart number to write (0-7) */
+
+  /* Pointers to derived tables (these workspaces have image lifespan).
+   * Since any one scan codes only DC or only AC, we only need one set
+   * of tables, not one for DC and one for AC.
+   */
+  c_derived_tbl * derived_tbls[NUM_HUFF_TBLS];
+
+  /* Statistics tables for optimization; again, one set is enough */
+  long * count_ptrs[NUM_HUFF_TBLS];
+} phuff_entropy_encoder;
+
+typedef phuff_entropy_encoder * phuff_entropy_ptr;
+
+/* MAX_CORR_BITS is the number of bits the AC refinement correction-bit
+ * buffer can hold.  Larger sizes may slightly improve compression, but
+ * 1000 is already well into the realm of overkill.
+ * The minimum safe size is 64 bits.
+ */
+
+#define MAX_CORR_BITS  1000	/* Max # of correction bits I can buffer */
+
+/* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32.
+ * We assume that int right shift is unsigned if INT32 right shift is,
+ * which should be safe.
+ */
+
+#ifdef RIGHT_SHIFT_IS_UNSIGNED
+#define ISHIFT_TEMPS	int ishift_temp;
+#define IRIGHT_SHIFT(x,shft)  \
+	((ishift_temp = (x)) < 0 ? \
+	 (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
+	 (ishift_temp >> (shft)))
+#else
+#define ISHIFT_TEMPS
+#define IRIGHT_SHIFT(x,shft)	((x) >> (shft))
+#endif
+
+/* Forward declarations */
+METHODDEF(boolean) encode_mcu_DC_first JPP((j_compress_ptr cinfo,
+					    JBLOCKROW *MCU_data));
+METHODDEF(boolean) encode_mcu_AC_first JPP((j_compress_ptr cinfo,
+					    JBLOCKROW *MCU_data));
+METHODDEF(boolean) encode_mcu_DC_refine JPP((j_compress_ptr cinfo,
+					     JBLOCKROW *MCU_data));
+METHODDEF(boolean) encode_mcu_AC_refine JPP((j_compress_ptr cinfo,
+					     JBLOCKROW *MCU_data));
+METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo));
+METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo));
+
+
+/*
+ * Initialize for a Huffman-compressed scan using progressive JPEG.
+ */
+
+METHODDEF(void)
+start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
+{  
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  boolean is_DC_band;
+  int ci, tbl;
+  jpeg_component_info * compptr;
+
+  entropy->cinfo = cinfo;
+  entropy->gather_statistics = gather_statistics;
+
+  is_DC_band = (cinfo->Ss == 0);
+
+  /* We assume jcmaster.c already validated the scan parameters. */
+
+  /* Select execution routines */
+  if (cinfo->Ah == 0) {
+    if (is_DC_band)
+      entropy->pub.encode_mcu = encode_mcu_DC_first;
+    else
+      entropy->pub.encode_mcu = encode_mcu_AC_first;
+  } else {
+    if (is_DC_band)
+      entropy->pub.encode_mcu = encode_mcu_DC_refine;
+    else {
+      entropy->pub.encode_mcu = encode_mcu_AC_refine;
+      /* AC refinement needs a correction bit buffer */
+      if (entropy->bit_buffer == NULL)
+	entropy->bit_buffer = (char *)
+	  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				      MAX_CORR_BITS * SIZEOF(char));
+    }
+  }
+  if (gather_statistics)
+    entropy->pub.finish_pass = finish_pass_gather_phuff;
+  else
+    entropy->pub.finish_pass = finish_pass_phuff;
+
+  /* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1
+   * for AC coefficients.
+   */
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    /* Initialize DC predictions to 0 */
+    entropy->last_dc_val[ci] = 0;
+    /* Get table index */
+    if (is_DC_band) {
+      if (cinfo->Ah != 0)	/* DC refinement needs no table */
+	continue;
+      tbl = compptr->dc_tbl_no;
+    } else {
+      entropy->ac_tbl_no = tbl = compptr->ac_tbl_no;
+    }
+    if (gather_statistics) {
+      /* Check for invalid table index */
+      /* (make_c_derived_tbl does this in the other path) */
+      if (tbl < 0 || tbl >= NUM_HUFF_TBLS)
+        ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl);
+      /* Allocate and zero the statistics tables */
+      /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
+      if (entropy->count_ptrs[tbl] == NULL)
+	entropy->count_ptrs[tbl] = (long *)
+	  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				      257 * SIZEOF(long));
+      MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long));
+    } else {
+      /* Compute derived values for Huffman table */
+      /* We may do this more than once for a table, but it's not expensive */
+      jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl,
+			      & entropy->derived_tbls[tbl]);
+    }
+  }
+
+  /* Initialize AC stuff */
+  entropy->EOBRUN = 0;
+  entropy->BE = 0;
+
+  /* Initialize bit buffer to empty */
+  entropy->put_buffer = 0;
+  entropy->put_bits = 0;
+
+  /* Initialize restart stuff */
+  entropy->restarts_to_go = cinfo->restart_interval;
+  entropy->next_restart_num = 0;
+}
+
+
+/* Outputting bytes to the file.
+ * NB: these must be called only when actually outputting,
+ * that is, entropy->gather_statistics == FALSE.
+ */
+
+/* Emit a byte */
+#define emit_byte(entropy,val)  \
+	{ *(entropy)->next_output_byte++ = (JOCTET) (val);  \
+	  if (--(entropy)->free_in_buffer == 0)  \
+	    dump_buffer(entropy); }
+
+
+LOCAL(void)
+dump_buffer (phuff_entropy_ptr entropy)
+/* Empty the output buffer; we do not support suspension in this module. */
+{
+  struct jpeg_destination_mgr * dest = entropy->cinfo->dest;
+
+  if (! (*dest->empty_output_buffer) (entropy->cinfo))
+    ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND);
+  /* After a successful buffer dump, must reset buffer pointers */
+  entropy->next_output_byte = dest->next_output_byte;
+  entropy->free_in_buffer = dest->free_in_buffer;
+}
+
+
+/* Outputting bits to the file */
+
+/* Only the right 24 bits of put_buffer are used; the valid bits are
+ * left-justified in this part.  At most 16 bits can be passed to emit_bits
+ * in one call, and we never retain more than 7 bits in put_buffer
+ * between calls, so 24 bits are sufficient.
+ */
+
+INLINE
+LOCAL(void)
+emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
+/* Emit some bits, unless we are in gather mode */
+{
+  /* This routine is heavily used, so it's worth coding tightly. */
+  register INT32 put_buffer = (INT32) code;
+  register int put_bits = entropy->put_bits;
+
+  /* if size is 0, caller used an invalid Huffman table entry */
+  if (size == 0)
+    ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
+
+  if (entropy->gather_statistics)
+    return;			/* do nothing if we're only getting stats */
+
+  put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */
+  
+  put_bits += size;		/* new number of bits in buffer */
+  
+  put_buffer <<= 24 - put_bits; /* align incoming bits */
+
+  put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */
+
+  while (put_bits >= 8) {
+    int c = (int) ((put_buffer >> 16) & 0xFF);
+    
+    emit_byte(entropy, c);
+    if (c == 0xFF) {		/* need to stuff a zero byte? */
+      emit_byte(entropy, 0);
+    }
+    put_buffer <<= 8;
+    put_bits -= 8;
+  }
+
+  entropy->put_buffer = put_buffer; /* update variables */
+  entropy->put_bits = put_bits;
+}
+
+
+LOCAL(void)
+flush_bits (phuff_entropy_ptr entropy)
+{
+  emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */
+  entropy->put_buffer = 0;     /* and reset bit-buffer to empty */
+  entropy->put_bits = 0;
+}
+
+
+/*
+ * Emit (or just count) a Huffman symbol.
+ */
+
+INLINE
+LOCAL(void)
+emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol)
+{
+  if (entropy->gather_statistics)
+    entropy->count_ptrs[tbl_no][symbol]++;
+  else {
+    c_derived_tbl * tbl = entropy->derived_tbls[tbl_no];
+    emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]);
+  }
+}
+
+
+/*
+ * Emit bits from a correction bit buffer.
+ */
+
+LOCAL(void)
+emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart,
+		    unsigned int nbits)
+{
+  if (entropy->gather_statistics)
+    return;			/* no real work */
+
+  while (nbits > 0) {
+    emit_bits(entropy, (unsigned int) (*bufstart), 1);
+    bufstart++;
+    nbits--;
+  }
+}
+
+
+/*
+ * Emit any pending EOBRUN symbol.
+ */
+
+LOCAL(void)
+emit_eobrun (phuff_entropy_ptr entropy)
+{
+  register int temp, nbits;
+
+  if (entropy->EOBRUN > 0) {	/* if there is any pending EOBRUN */
+    temp = entropy->EOBRUN;
+    nbits = 0;
+    while ((temp >>= 1))
+      nbits++;
+    /* safety check: shouldn't happen given limited correction-bit buffer */
+    if (nbits > 14)
+      ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
+
+    emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4);
+    if (nbits)
+      emit_bits(entropy, entropy->EOBRUN, nbits);
+
+    entropy->EOBRUN = 0;
+
+    /* Emit any buffered correction bits */
+    emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE);
+    entropy->BE = 0;
+  }
+}
+
+
+/*
+ * Emit a restart marker & resynchronize predictions.
+ */
+
+LOCAL(void)
+emit_restart (phuff_entropy_ptr entropy, int restart_num)
+{
+  int ci;
+
+  emit_eobrun(entropy);
+
+  if (! entropy->gather_statistics) {
+    flush_bits(entropy);
+    emit_byte(entropy, 0xFF);
+    emit_byte(entropy, JPEG_RST0 + restart_num);
+  }
+
+  if (entropy->cinfo->Ss == 0) {
+    /* Re-initialize DC predictions to 0 */
+    for (ci = 0; ci < entropy->cinfo->comps_in_scan; ci++)
+      entropy->last_dc_val[ci] = 0;
+  } else {
+    /* Re-initialize all AC-related fields to 0 */
+    entropy->EOBRUN = 0;
+    entropy->BE = 0;
+  }
+}
+
+
+/*
+ * MCU encoding for DC initial scan (either spectral selection,
+ * or first pass of successive approximation).
+ */
+
+METHODDEF(boolean)
+encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+{
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  register int temp, temp2;
+  register int nbits;
+  int blkn, ci;
+  int Al = cinfo->Al;
+  JBLOCKROW block;
+  jpeg_component_info * compptr;
+  ISHIFT_TEMPS
+
+  entropy->next_output_byte = cinfo->dest->next_output_byte;
+  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
+
+  /* Emit restart marker if needed */
+  if (cinfo->restart_interval)
+    if (entropy->restarts_to_go == 0)
+      emit_restart(entropy, entropy->next_restart_num);
+
+  /* Encode the MCU data blocks */
+  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+    block = MCU_data[blkn];
+    ci = cinfo->MCU_membership[blkn];
+    compptr = cinfo->cur_comp_info[ci];
+
+    /* Compute the DC value after the required point transform by Al.
+     * This is simply an arithmetic right shift.
+     */
+    temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al);
+
+    /* DC differences are figured on the point-transformed values. */
+    temp = temp2 - entropy->last_dc_val[ci];
+    entropy->last_dc_val[ci] = temp2;
+
+    /* Encode the DC coefficient difference per section G.1.2.1 */
+    temp2 = temp;
+    if (temp < 0) {
+      temp = -temp;		/* temp is abs value of input */
+      /* For a negative input, want temp2 = bitwise complement of abs(input) */
+      /* This code assumes we are on a two's complement machine */
+      temp2--;
+    }
+    
+    /* Find the number of bits needed for the magnitude of the coefficient */
+    nbits = 0;
+    while (temp) {
+      nbits++;
+      temp >>= 1;
+    }
+    /* Check for out-of-range coefficient values.
+     * Since we're encoding a difference, the range limit is twice as much.
+     */
+    if (nbits > MAX_COEF_BITS+1)
+      ERREXIT(cinfo, JERR_BAD_DCT_COEF);
+    
+    /* Count/emit the Huffman-coded symbol for the number of bits */
+    emit_symbol(entropy, compptr->dc_tbl_no, nbits);
+    
+    /* Emit that number of bits of the value, if positive, */
+    /* or the complement of its magnitude, if negative. */
+    if (nbits)			/* emit_bits rejects calls with size 0 */
+      emit_bits(entropy, (unsigned int) temp2, nbits);
+  }
+
+  cinfo->dest->next_output_byte = entropy->next_output_byte;
+  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
+
+  /* Update restart-interval state too */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0) {
+      entropy->restarts_to_go = cinfo->restart_interval;
+      entropy->next_restart_num++;
+      entropy->next_restart_num &= 7;
+    }
+    entropy->restarts_to_go--;
+  }
+
+  return TRUE;
+}
+
+
+/*
+ * MCU encoding for AC initial scan (either spectral selection,
+ * or first pass of successive approximation).
+ */
+
+METHODDEF(boolean)
+encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+{
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  register int temp, temp2;
+  register int nbits;
+  register int r, k;
+  int Se = cinfo->Se;
+  int Al = cinfo->Al;
+  JBLOCKROW block;
+
+  entropy->next_output_byte = cinfo->dest->next_output_byte;
+  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
+
+  /* Emit restart marker if needed */
+  if (cinfo->restart_interval)
+    if (entropy->restarts_to_go == 0)
+      emit_restart(entropy, entropy->next_restart_num);
+
+  /* Encode the MCU data block */
+  block = MCU_data[0];
+
+  /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
+  
+  r = 0;			/* r = run length of zeros */
+   
+  for (k = cinfo->Ss; k <= Se; k++) {
+    if ((temp = (*block)[jpeg_natural_order[k]]) == 0) {
+      r++;
+      continue;
+    }
+    /* We must apply the point transform by Al.  For AC coefficients this
+     * is an integer division with rounding towards 0.  To do this portably
+     * in C, we shift after obtaining the absolute value; so the code is
+     * interwoven with finding the abs value (temp) and output bits (temp2).
+     */
+    if (temp < 0) {
+      temp = -temp;		/* temp is abs value of input */
+      temp >>= Al;		/* apply the point transform */
+      /* For a negative coef, want temp2 = bitwise complement of abs(coef) */
+      temp2 = ~temp;
+    } else {
+      temp >>= Al;		/* apply the point transform */
+      temp2 = temp;
+    }
+    /* Watch out for case that nonzero coef is zero after point transform */
+    if (temp == 0) {
+      r++;
+      continue;
+    }
+
+    /* Emit any pending EOBRUN */
+    if (entropy->EOBRUN > 0)
+      emit_eobrun(entropy);
+    /* if run length > 15, must emit special run-length-16 codes (0xF0) */
+    while (r > 15) {
+      emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
+      r -= 16;
+    }
+
+    /* Find the number of bits needed for the magnitude of the coefficient */
+    nbits = 1;			/* there must be at least one 1 bit */
+    while ((temp >>= 1))
+      nbits++;
+    /* Check for out-of-range coefficient values */
+    if (nbits > MAX_COEF_BITS)
+      ERREXIT(cinfo, JERR_BAD_DCT_COEF);
+
+    /* Count/emit Huffman symbol for run length / number of bits */
+    emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);
+
+    /* Emit that number of bits of the value, if positive, */
+    /* or the complement of its magnitude, if negative. */
+    emit_bits(entropy, (unsigned int) temp2, nbits);
+
+    r = 0;			/* reset zero run length */
+  }
+
+  if (r > 0) {			/* If there are trailing zeroes, */
+    entropy->EOBRUN++;		/* count an EOB */
+    if (entropy->EOBRUN == 0x7FFF)
+      emit_eobrun(entropy);	/* force it out to avoid overflow */
+  }
+
+  cinfo->dest->next_output_byte = entropy->next_output_byte;
+  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
+
+  /* Update restart-interval state too */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0) {
+      entropy->restarts_to_go = cinfo->restart_interval;
+      entropy->next_restart_num++;
+      entropy->next_restart_num &= 7;
+    }
+    entropy->restarts_to_go--;
+  }
+
+  return TRUE;
+}
+
+
+/*
+ * MCU encoding for DC successive approximation refinement scan.
+ * Note: we assume such scans can be multi-component, although the spec
+ * is not very clear on the point.
+ */
+
+METHODDEF(boolean)
+encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+{
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  register int temp;
+  int blkn;
+  int Al = cinfo->Al;
+  JBLOCKROW block;
+
+  entropy->next_output_byte = cinfo->dest->next_output_byte;
+  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
+
+  /* Emit restart marker if needed */
+  if (cinfo->restart_interval)
+    if (entropy->restarts_to_go == 0)
+      emit_restart(entropy, entropy->next_restart_num);
+
+  /* Encode the MCU data blocks */
+  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+    block = MCU_data[blkn];
+
+    /* We simply emit the Al'th bit of the DC coefficient value. */
+    temp = (*block)[0];
+    emit_bits(entropy, (unsigned int) (temp >> Al), 1);
+  }
+
+  cinfo->dest->next_output_byte = entropy->next_output_byte;
+  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
+
+  /* Update restart-interval state too */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0) {
+      entropy->restarts_to_go = cinfo->restart_interval;
+      entropy->next_restart_num++;
+      entropy->next_restart_num &= 7;
+    }
+    entropy->restarts_to_go--;
+  }
+
+  return TRUE;
+}
+
+
+/*
+ * MCU encoding for AC successive approximation refinement scan.
+ */
+
+METHODDEF(boolean)
+encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+{
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  register int temp;
+  register int r, k;
+  int EOB;
+  char *BR_buffer;
+  unsigned int BR;
+  int Se = cinfo->Se;
+  int Al = cinfo->Al;
+  JBLOCKROW block;
+  int absvalues[DCTSIZE2];
+
+  entropy->next_output_byte = cinfo->dest->next_output_byte;
+  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
+
+  /* Emit restart marker if needed */
+  if (cinfo->restart_interval)
+    if (entropy->restarts_to_go == 0)
+      emit_restart(entropy, entropy->next_restart_num);
+
+  /* Encode the MCU data block */
+  block = MCU_data[0];
+
+  /* It is convenient to make a pre-pass to determine the transformed
+   * coefficients' absolute values and the EOB position.
+   */
+  EOB = 0;
+  for (k = cinfo->Ss; k <= Se; k++) {
+    temp = (*block)[jpeg_natural_order[k]];
+    /* We must apply the point transform by Al.  For AC coefficients this
+     * is an integer division with rounding towards 0.  To do this portably
+     * in C, we shift after obtaining the absolute value.
+     */
+    if (temp < 0)
+      temp = -temp;		/* temp is abs value of input */
+    temp >>= Al;		/* apply the point transform */
+    absvalues[k] = temp;	/* save abs value for main pass */
+    if (temp == 1)
+      EOB = k;			/* EOB = index of last newly-nonzero coef */
+  }
+
+  /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
+  
+  r = 0;			/* r = run length of zeros */
+  BR = 0;			/* BR = count of buffered bits added now */
+  BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
+
+  for (k = cinfo->Ss; k <= Se; k++) {
+    if ((temp = absvalues[k]) == 0) {
+      r++;
+      continue;
+    }
+
+    /* Emit any required ZRLs, but not if they can be folded into EOB */
+    while (r > 15 && k <= EOB) {
+      /* emit any pending EOBRUN and the BE correction bits */
+      emit_eobrun(entropy);
+      /* Emit ZRL */
+      emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
+      r -= 16;
+      /* Emit buffered correction bits that must be associated with ZRL */
+      emit_buffered_bits(entropy, BR_buffer, BR);
+      BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
+      BR = 0;
+    }
+
+    /* If the coef was previously nonzero, it only needs a correction bit.
+     * NOTE: a straight translation of the spec's figure G.7 would suggest
+     * that we also need to test r > 15.  But if r > 15, we can only get here
+     * if k > EOB, which implies that this coefficient is not 1.
+     */
+    if (temp > 1) {
+      /* The correction bit is the next bit of the absolute value. */
+      BR_buffer[BR++] = (char) (temp & 1);
+      continue;
+    }
+
+    /* Emit any pending EOBRUN and the BE correction bits */
+    emit_eobrun(entropy);
+
+    /* Count/emit Huffman symbol for run length / number of bits */
+    emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);
+
+    /* Emit output bit for newly-nonzero coef */
+    temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1;
+    emit_bits(entropy, (unsigned int) temp, 1);
+
+    /* Emit buffered correction bits that must be associated with this code */
+    emit_buffered_bits(entropy, BR_buffer, BR);
+    BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
+    BR = 0;
+    r = 0;			/* reset zero run length */
+  }
+
+  if (r > 0 || BR > 0) {	/* If there are trailing zeroes, */
+    entropy->EOBRUN++;		/* count an EOB */
+    entropy->BE += BR;		/* concat my correction bits to older ones */
+    /* We force out the EOB if we risk either:
+     * 1. overflow of the EOB counter;
+     * 2. overflow of the correction bit buffer during the next MCU.
+     */
+    if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1))
+      emit_eobrun(entropy);
+  }
+
+  cinfo->dest->next_output_byte = entropy->next_output_byte;
+  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
+
+  /* Update restart-interval state too */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0) {
+      entropy->restarts_to_go = cinfo->restart_interval;
+      entropy->next_restart_num++;
+      entropy->next_restart_num &= 7;
+    }
+    entropy->restarts_to_go--;
+  }
+
+  return TRUE;
+}
+
+
+/*
+ * Finish up at the end of a Huffman-compressed progressive scan.
+ */
+
+METHODDEF(void)
+finish_pass_phuff (j_compress_ptr cinfo)
+{   
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+
+  entropy->next_output_byte = cinfo->dest->next_output_byte;
+  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
+
+  /* Flush out any buffered data */
+  emit_eobrun(entropy);
+  flush_bits(entropy);
+
+  cinfo->dest->next_output_byte = entropy->next_output_byte;
+  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
+}
+
+
+/*
+ * Finish up a statistics-gathering pass and create the new Huffman tables.
+ */
+
+METHODDEF(void)
+finish_pass_gather_phuff (j_compress_ptr cinfo)
+{
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  boolean is_DC_band;
+  int ci, tbl;
+  jpeg_component_info * compptr;
+  JHUFF_TBL **htblptr;
+  boolean did[NUM_HUFF_TBLS];
+
+  /* Flush out buffered data (all we care about is counting the EOB symbol) */
+  emit_eobrun(entropy);
+
+  is_DC_band = (cinfo->Ss == 0);
+
+  /* It's important not to apply jpeg_gen_optimal_table more than once
+   * per table, because it clobbers the input frequency counts!
+   */
+  MEMZERO(did, SIZEOF(did));
+
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    if (is_DC_band) {
+      if (cinfo->Ah != 0)	/* DC refinement needs no table */
+	continue;
+      tbl = compptr->dc_tbl_no;
+    } else {
+      tbl = compptr->ac_tbl_no;
+    }
+    if (! did[tbl]) {
+      if (is_DC_band)
+        htblptr = & cinfo->dc_huff_tbl_ptrs[tbl];
+      else
+        htblptr = & cinfo->ac_huff_tbl_ptrs[tbl];
+      if (*htblptr == NULL)
+        *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
+      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]);
+      did[tbl] = TRUE;
+    }
+  }
+}
+
+
+/*
+ * Module initialization routine for progressive Huffman entropy encoding.
+ */
+
+GLOBAL(void)
+jinit_phuff_encoder (j_compress_ptr cinfo)
+{
+  phuff_entropy_ptr entropy;
+  int i;
+
+  entropy = (phuff_entropy_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(phuff_entropy_encoder));
+  cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
+  entropy->pub.start_pass = start_pass_phuff;
+
+  /* Mark tables unallocated */
+  for (i = 0; i < NUM_HUFF_TBLS; i++) {
+    entropy->derived_tbls[i] = NULL;
+    entropy->count_ptrs[i] = NULL;
+  }
+  entropy->bit_buffer = NULL;	/* needed only in AC refinement scan */
+}
+
+#endif /* C_PROGRESSIVE_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcprepct.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcprepct.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcprepct.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,354 @@
+/*
+ * jcprepct.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the compression preprocessing controller.
+ * This controller manages the color conversion, downsampling,
+ * and edge expansion steps.
+ *
+ * Most of the complexity here is associated with buffering input rows
+ * as required by the downsampler.  See the comments at the head of
+ * jcsample.c for the downsampler's needs.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* At present, jcsample.c can request context rows only for smoothing.
+ * In the future, we might also need context rows for CCIR601 sampling
+ * or other more-complex downsampling procedures.  The code to support
+ * context rows should be compiled only if needed.
+ */
+#ifdef INPUT_SMOOTHING_SUPPORTED
+#define CONTEXT_ROWS_SUPPORTED
+#endif
+
+
+/*
+ * For the simple (no-context-row) case, we just need to buffer one
+ * row group's worth of pixels for the downsampling step.  At the bottom of
+ * the image, we pad to a full row group by replicating the last pixel row.
+ * The downsampler's last output row is then replicated if needed to pad
+ * out to a full iMCU row.
+ *
+ * When providing context rows, we must buffer three row groups' worth of
+ * pixels.  Three row groups are physically allocated, but the row pointer
+ * arrays are made five row groups high, with the extra pointers above and
+ * below "wrapping around" to point to the last and first real row groups.
+ * This allows the downsampler to access the proper context rows.
+ * At the top and bottom of the image, we create dummy context rows by
+ * copying the first or last real pixel row.  This copying could be avoided
+ * by pointer hacking as is done in jdmainct.c, but it doesn't seem worth the
+ * trouble on the compression side.
+ */
+
+
+/* Private buffer controller object */
+
+typedef struct {
+  struct jpeg_c_prep_controller pub; /* public fields */
+
+  /* Downsampling input buffer.  This buffer holds color-converted data
+   * until we have enough to do a downsample step.
+   */
+  JSAMPARRAY color_buf[MAX_COMPONENTS];
+
+  JDIMENSION rows_to_go;	/* counts rows remaining in source image */
+  int next_buf_row;		/* index of next row to store in color_buf */
+
+#ifdef CONTEXT_ROWS_SUPPORTED	/* only needed for context case */
+  int this_row_group;		/* starting row index of group to process */
+  int next_buf_stop;		/* downsample when we reach this index */
+#endif
+} my_prep_controller;
+
+typedef my_prep_controller * my_prep_ptr;
+
+
+/*
+ * Initialize for a processing pass.
+ */
+
+METHODDEF(void)
+start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
+{
+  my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
+
+  if (pass_mode != JBUF_PASS_THRU)
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+
+  /* Initialize total-height counter for detecting bottom of image */
+  prep->rows_to_go = cinfo->image_height;
+  /* Mark the conversion buffer empty */
+  prep->next_buf_row = 0;
+#ifdef CONTEXT_ROWS_SUPPORTED
+  /* Preset additional state variables for context mode.
+   * These aren't used in non-context mode, so we needn't test which mode.
+   */
+  prep->this_row_group = 0;
+  /* Set next_buf_stop to stop after two row groups have been read in. */
+  prep->next_buf_stop = 2 * cinfo->max_v_samp_factor;
+#endif
+}
+
+
+/*
+ * Expand an image vertically from height input_rows to height output_rows,
+ * by duplicating the bottom row.
+ */
+
+LOCAL(void)
+expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
+		    int input_rows, int output_rows)
+{
+  register int row;
+
+  for (row = input_rows; row < output_rows; row++) {
+    jcopy_sample_rows(image_data, input_rows-1, image_data, row,
+		      1, num_cols);
+  }
+}
+
+
+/*
+ * Process some data in the simple no-context case.
+ *
+ * Preprocessor output data is counted in "row groups".  A row group
+ * is defined to be v_samp_factor sample rows of each component.
+ * Downsampling will produce this much data from each max_v_samp_factor
+ * input rows.
+ */
+
+METHODDEF(void)
+pre_process_data (j_compress_ptr cinfo,
+		  JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
+		  JDIMENSION in_rows_avail,
+		  JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
+		  JDIMENSION out_row_groups_avail)
+{
+  my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
+  int numrows, ci;
+  JDIMENSION inrows;
+  jpeg_component_info * compptr;
+
+  while (*in_row_ctr < in_rows_avail &&
+	 *out_row_group_ctr < out_row_groups_avail) {
+    /* Do color conversion to fill the conversion buffer. */
+    inrows = in_rows_avail - *in_row_ctr;
+    numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
+    numrows = (int) MIN((JDIMENSION) numrows, inrows);
+    (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
+				       prep->color_buf,
+				       (JDIMENSION) prep->next_buf_row,
+				       numrows);
+    *in_row_ctr += numrows;
+    prep->next_buf_row += numrows;
+    prep->rows_to_go -= numrows;
+    /* If at bottom of image, pad to fill the conversion buffer. */
+    if (prep->rows_to_go == 0 &&
+	prep->next_buf_row < cinfo->max_v_samp_factor) {
+      for (ci = 0; ci < cinfo->num_components; ci++) {
+	expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
+			   prep->next_buf_row, cinfo->max_v_samp_factor);
+      }
+      prep->next_buf_row = cinfo->max_v_samp_factor;
+    }
+    /* If we've filled the conversion buffer, empty it. */
+    if (prep->next_buf_row == cinfo->max_v_samp_factor) {
+      (*cinfo->downsample->downsample) (cinfo,
+					prep->color_buf, (JDIMENSION) 0,
+					output_buf, *out_row_group_ctr);
+      prep->next_buf_row = 0;
+      (*out_row_group_ctr)++;
+    }
+    /* If at bottom of image, pad the output to a full iMCU height.
+     * Note we assume the caller is providing a one-iMCU-height output buffer!
+     */
+    if (prep->rows_to_go == 0 &&
+	*out_row_group_ctr < out_row_groups_avail) {
+      for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	   ci++, compptr++) {
+	expand_bottom_edge(output_buf[ci],
+			   compptr->width_in_blocks * DCTSIZE,
+			   (int) (*out_row_group_ctr * compptr->v_samp_factor),
+			   (int) (out_row_groups_avail * compptr->v_samp_factor));
+      }
+      *out_row_group_ctr = out_row_groups_avail;
+      break;			/* can exit outer loop without test */
+    }
+  }
+}
+
+
+#ifdef CONTEXT_ROWS_SUPPORTED
+
+/*
+ * Process some data in the context case.
+ */
+
+METHODDEF(void)
+pre_process_context (j_compress_ptr cinfo,
+		     JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
+		     JDIMENSION in_rows_avail,
+		     JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
+		     JDIMENSION out_row_groups_avail)
+{
+  my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
+  int numrows, ci;
+  int buf_height = cinfo->max_v_samp_factor * 3;
+  JDIMENSION inrows;
+
+  while (*out_row_group_ctr < out_row_groups_avail) {
+    if (*in_row_ctr < in_rows_avail) {
+      /* Do color conversion to fill the conversion buffer. */
+      inrows = in_rows_avail - *in_row_ctr;
+      numrows = prep->next_buf_stop - prep->next_buf_row;
+      numrows = (int) MIN((JDIMENSION) numrows, inrows);
+      (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
+					 prep->color_buf,
+					 (JDIMENSION) prep->next_buf_row,
+					 numrows);
+      /* Pad at top of image, if first time through */
+      if (prep->rows_to_go == cinfo->image_height) {
+	for (ci = 0; ci < cinfo->num_components; ci++) {
+	  int row;
+	  for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
+	    jcopy_sample_rows(prep->color_buf[ci], 0,
+			      prep->color_buf[ci], -row,
+			      1, cinfo->image_width);
+	  }
+	}
+      }
+      *in_row_ctr += numrows;
+      prep->next_buf_row += numrows;
+      prep->rows_to_go -= numrows;
+    } else {
+      /* Return for more data, unless we are at the bottom of the image. */
+      if (prep->rows_to_go != 0)
+	break;
+      /* When at bottom of image, pad to fill the conversion buffer. */
+      if (prep->next_buf_row < prep->next_buf_stop) {
+	for (ci = 0; ci < cinfo->num_components; ci++) {
+	  expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
+			     prep->next_buf_row, prep->next_buf_stop);
+	}
+	prep->next_buf_row = prep->next_buf_stop;
+      }
+    }
+    /* If we've gotten enough data, downsample a row group. */
+    if (prep->next_buf_row == prep->next_buf_stop) {
+      (*cinfo->downsample->downsample) (cinfo,
+					prep->color_buf,
+					(JDIMENSION) prep->this_row_group,
+					output_buf, *out_row_group_ctr);
+      (*out_row_group_ctr)++;
+      /* Advance pointers with wraparound as necessary. */
+      prep->this_row_group += cinfo->max_v_samp_factor;
+      if (prep->this_row_group >= buf_height)
+	prep->this_row_group = 0;
+      if (prep->next_buf_row >= buf_height)
+	prep->next_buf_row = 0;
+      prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor;
+    }
+  }
+}
+
+
+/*
+ * Create the wrapped-around downsampling input buffer needed for context mode.
+ */
+
+LOCAL(void)
+create_context_buffer (j_compress_ptr cinfo)
+{
+  my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
+  int rgroup_height = cinfo->max_v_samp_factor;
+  int ci, i;
+  jpeg_component_info * compptr;
+  JSAMPARRAY true_buffer, fake_buffer;
+
+  /* Grab enough space for fake row pointers for all the components;
+   * we need five row groups' worth of pointers for each component.
+   */
+  fake_buffer = (JSAMPARRAY)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(cinfo->num_components * 5 * rgroup_height) *
+				SIZEOF(JSAMPROW));
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Allocate the actual buffer space (3 row groups) for this component.
+     * We make the buffer wide enough to allow the downsampler to edge-expand
+     * horizontally within the buffer, if it so chooses.
+     */
+    true_buffer = (*cinfo->mem->alloc_sarray)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE,
+       (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
+		      cinfo->max_h_samp_factor) / compptr->h_samp_factor),
+       (JDIMENSION) (3 * rgroup_height));
+    /* Copy true buffer row pointers into the middle of the fake row array */
+    MEMCOPY(fake_buffer + rgroup_height, true_buffer,
+	    3 * rgroup_height * SIZEOF(JSAMPROW));
+    /* Fill in the above and below wraparound pointers */
+    for (i = 0; i < rgroup_height; i++) {
+      fake_buffer[i] = true_buffer[2 * rgroup_height + i];
+      fake_buffer[4 * rgroup_height + i] = true_buffer[i];
+    }
+    prep->color_buf[ci] = fake_buffer + rgroup_height;
+    fake_buffer += 5 * rgroup_height; /* point to space for next component */
+  }
+}
+
+#endif /* CONTEXT_ROWS_SUPPORTED */
+
+
+/*
+ * Initialize preprocessing controller.
+ */
+
+GLOBAL(void)
+jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
+{
+  my_prep_ptr prep;
+  int ci;
+  jpeg_component_info * compptr;
+
+  if (need_full_buffer)		/* safety check */
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+
+  prep = (my_prep_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_prep_controller));
+  cinfo->prep = (struct jpeg_c_prep_controller *) prep;
+  prep->pub.start_pass = start_pass_prep;
+
+  /* Allocate the color conversion buffer.
+   * We make the buffer wide enough to allow the downsampler to edge-expand
+   * horizontally within the buffer, if it so chooses.
+   */
+  if (cinfo->downsample->need_context_rows) {
+    /* Set up to provide context rows */
+#ifdef CONTEXT_ROWS_SUPPORTED
+    prep->pub.pre_process_data = pre_process_context;
+    create_context_buffer(cinfo);
+#else
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+  } else {
+    /* No context, just make it tall enough for one row group */
+    prep->pub.pre_process_data = pre_process_data;
+    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	 ci++, compptr++) {
+      prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
+	((j_common_ptr) cinfo, JPOOL_IMAGE,
+	 (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
+			cinfo->max_h_samp_factor) / compptr->h_samp_factor),
+	 (JDIMENSION) cinfo->max_v_samp_factor);
+    }
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jcsample.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jcsample.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jcsample.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,519 @@
+/*
+ * jcsample.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains downsampling routines.
+ *
+ * Downsampling input data is counted in "row groups".  A row group
+ * is defined to be max_v_samp_factor pixel rows of each component,
+ * from which the downsampler produces v_samp_factor sample rows.
+ * A single row group is processed in each call to the downsampler module.
+ *
+ * The downsampler is responsible for edge-expansion of its output data
+ * to fill an integral number of DCT blocks horizontally.  The source buffer
+ * may be modified if it is helpful for this purpose (the source buffer is
+ * allocated wide enough to correspond to the desired output width).
+ * The caller (the prep controller) is responsible for vertical padding.
+ *
+ * The downsampler may request "context rows" by setting need_context_rows
+ * during startup.  In this case, the input arrays will contain at least
+ * one row group's worth of pixels above and below the passed-in data;
+ * the caller will create dummy rows at image top and bottom by replicating
+ * the first or last real pixel row.
+ *
+ * An excellent reference for image resampling is
+ *   Digital Image Warping, George Wolberg, 1990.
+ *   Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
+ *
+ * The downsampling algorithm used here is a simple average of the source
+ * pixels covered by the output pixel.  The hi-falutin sampling literature
+ * refers to this as a "box filter".  In general the characteristics of a box
+ * filter are not very good, but for the specific cases we normally use (1:1
+ * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not
+ * nearly so bad.  If you intend to use other sampling ratios, you'd be well
+ * advised to improve this code.
+ *
+ * A simple input-smoothing capability is provided.  This is mainly intended
+ * for cleaning up color-dithered GIF input files (if you find it inadequate,
+ * we suggest using an external filtering program such as pnmconvol).  When
+ * enabled, each input pixel P is replaced by a weighted sum of itself and its
+ * eight neighbors.  P's weight is 1-8*SF and each neighbor's weight is SF,
+ * where SF = (smoothing_factor / 1024).
+ * Currently, smoothing is only supported for 2h2v sampling factors.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Pointer to routine to downsample a single component */
+typedef JMETHOD(void, downsample1_ptr,
+		(j_compress_ptr cinfo, jpeg_component_info * compptr,
+		 JSAMPARRAY input_data, JSAMPARRAY output_data));
+
+/* Private subobject */
+
+typedef struct {
+  struct jpeg_downsampler pub;	/* public fields */
+
+  /* Downsampling method pointers, one per component */
+  downsample1_ptr methods[MAX_COMPONENTS];
+} my_downsampler;
+
+typedef my_downsampler * my_downsample_ptr;
+
+
+/*
+ * Initialize for a downsampling pass.
+ */
+
+METHODDEF(void)
+start_pass_downsample (j_compress_ptr cinfo)
+{
+  /* no work for now */
+}
+
+
+/*
+ * Expand a component horizontally from width input_cols to width output_cols,
+ * by duplicating the rightmost samples.
+ */
+
+LOCAL(void)
+expand_right_edge (JSAMPARRAY image_data, int num_rows,
+		   JDIMENSION input_cols, JDIMENSION output_cols)
+{
+  register JSAMPROW ptr;
+  register JSAMPLE pixval;
+  register int count;
+  int row;
+  int numcols = (int) (output_cols - input_cols);
+
+  if (numcols > 0) {
+    for (row = 0; row < num_rows; row++) {
+      ptr = image_data[row] + input_cols;
+      pixval = ptr[-1];		/* don't need GETJSAMPLE() here */
+      for (count = numcols; count > 0; count--)
+	*ptr++ = pixval;
+    }
+  }
+}
+
+
+/*
+ * Do downsampling for a whole row group (all components).
+ *
+ * In this version we simply downsample each component independently.
+ */
+
+METHODDEF(void)
+sep_downsample (j_compress_ptr cinfo,
+		JSAMPIMAGE input_buf, JDIMENSION in_row_index,
+		JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
+{
+  my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
+  int ci;
+  jpeg_component_info * compptr;
+  JSAMPARRAY in_ptr, out_ptr;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    in_ptr = input_buf[ci] + in_row_index;
+    out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor);
+    (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
+  }
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * One row group is processed per call.
+ * This version handles arbitrary integral sampling ratios, without smoothing.
+ * Note that this version is not actually used for customary sampling ratios.
+ */
+
+METHODDEF(void)
+int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
+		JSAMPARRAY input_data, JSAMPARRAY output_data)
+{
+  int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
+  JDIMENSION outcol, outcol_h;	/* outcol_h == outcol*h_expand */
+  JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
+  JSAMPROW inptr, outptr;
+  INT32 outvalue;
+
+  h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;
+  v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;
+  numpix = h_expand * v_expand;
+  numpix2 = numpix/2;
+
+  /* Expand input data enough to let all the output samples be generated
+   * by the standard loop.  Special-casing padded output would be more
+   * efficient.
+   */
+  expand_right_edge(input_data, cinfo->max_v_samp_factor,
+		    cinfo->image_width, output_cols * h_expand);
+
+  inrow = 0;
+  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
+    outptr = output_data[outrow];
+    for (outcol = 0, outcol_h = 0; outcol < output_cols;
+	 outcol++, outcol_h += h_expand) {
+      outvalue = 0;
+      for (v = 0; v < v_expand; v++) {
+	inptr = input_data[inrow+v] + outcol_h;
+	for (h = 0; h < h_expand; h++) {
+	  outvalue += (INT32) GETJSAMPLE(*inptr++);
+	}
+      }
+      *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
+    }
+    inrow += v_expand;
+  }
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the special case of a full-size component,
+ * without smoothing.
+ */
+
+METHODDEF(void)
+fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
+		     JSAMPARRAY input_data, JSAMPARRAY output_data)
+{
+  /* Copy the data */
+  jcopy_sample_rows(input_data, 0, output_data, 0,
+		    cinfo->max_v_samp_factor, cinfo->image_width);
+  /* Edge-expand */
+  expand_right_edge(output_data, cinfo->max_v_samp_factor,
+		    cinfo->image_width, compptr->width_in_blocks * DCTSIZE);
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the common case of 2:1 horizontal and 1:1 vertical,
+ * without smoothing.
+ *
+ * A note about the "bias" calculations: when rounding fractional values to
+ * integer, we do not want to always round 0.5 up to the next integer.
+ * If we did that, we'd introduce a noticeable bias towards larger values.
+ * Instead, this code is arranged so that 0.5 will be rounded up or down at
+ * alternate pixel locations (a simple ordered dither pattern).
+ */
+
+METHODDEF(void)
+h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
+		 JSAMPARRAY input_data, JSAMPARRAY output_data)
+{
+  int outrow;
+  JDIMENSION outcol;
+  JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
+  register JSAMPROW inptr, outptr;
+  register int bias;
+
+  /* Expand input data enough to let all the output samples be generated
+   * by the standard loop.  Special-casing padded output would be more
+   * efficient.
+   */
+  expand_right_edge(input_data, cinfo->max_v_samp_factor,
+		    cinfo->image_width, output_cols * 2);
+
+  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
+    outptr = output_data[outrow];
+    inptr = input_data[outrow];
+    bias = 0;			/* bias = 0,1,0,1,... for successive samples */
+    for (outcol = 0; outcol < output_cols; outcol++) {
+      *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
+			      + bias) >> 1);
+      bias ^= 1;		/* 0=>1, 1=>0 */
+      inptr += 2;
+    }
+  }
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
+ * without smoothing.
+ */
+
+METHODDEF(void)
+h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
+		 JSAMPARRAY input_data, JSAMPARRAY output_data)
+{
+  int inrow, outrow;
+  JDIMENSION outcol;
+  JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
+  register JSAMPROW inptr0, inptr1, outptr;
+  register int bias;
+
+  /* Expand input data enough to let all the output samples be generated
+   * by the standard loop.  Special-casing padded output would be more
+   * efficient.
+   */
+  expand_right_edge(input_data, cinfo->max_v_samp_factor,
+		    cinfo->image_width, output_cols * 2);
+
+  inrow = 0;
+  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
+    outptr = output_data[outrow];
+    inptr0 = input_data[inrow];
+    inptr1 = input_data[inrow+1];
+    bias = 1;			/* bias = 1,2,1,2,... for successive samples */
+    for (outcol = 0; outcol < output_cols; outcol++) {
+      *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+			      GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1])
+			      + bias) >> 2);
+      bias ^= 3;		/* 1=>2, 2=>1 */
+      inptr0 += 2; inptr1 += 2;
+    }
+    inrow += 2;
+  }
+}
+
+
+#ifdef INPUT_SMOOTHING_SUPPORTED
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
+ * with smoothing.  One row of context is required.
+ */
+
+METHODDEF(void)
+h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
+			JSAMPARRAY input_data, JSAMPARRAY output_data)
+{
+  int inrow, outrow;
+  JDIMENSION colctr;
+  JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
+  register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
+  INT32 membersum, neighsum, memberscale, neighscale;
+
+  /* Expand input data enough to let all the output samples be generated
+   * by the standard loop.  Special-casing padded output would be more
+   * efficient.
+   */
+  expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
+		    cinfo->image_width, output_cols * 2);
+
+  /* We don't bother to form the individual "smoothed" input pixel values;
+   * we can directly compute the output which is the average of the four
+   * smoothed values.  Each of the four member pixels contributes a fraction
+   * (1-8*SF) to its own smoothed image and a fraction SF to each of the three
+   * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final
+   * output.  The four corner-adjacent neighbor pixels contribute a fraction
+   * SF to just one smoothed pixel, or SF/4 to the final output; while the
+   * eight edge-adjacent neighbors contribute SF to each of two smoothed
+   * pixels, or SF/2 overall.  In order to use integer arithmetic, these
+   * factors are scaled by 2^16 = 65536.
+   * Also recall that SF = smoothing_factor / 1024.
+   */
+
+  memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */
+  neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */
+
+  inrow = 0;
+  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
+    outptr = output_data[outrow];
+    inptr0 = input_data[inrow];
+    inptr1 = input_data[inrow+1];
+    above_ptr = input_data[inrow-1];
+    below_ptr = input_data[inrow+2];
+
+    /* Special case for first column: pretend column -1 is same as column 0 */
+    membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+		GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
+    neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
+	       GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
+	       GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
+	       GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
+    neighsum += neighsum;
+    neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
+		GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
+    membersum = membersum * memberscale + neighsum * neighscale;
+    *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
+    inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
+
+    for (colctr = output_cols - 2; colctr > 0; colctr--) {
+      /* sum of pixels directly mapped to this output element */
+      membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+		  GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
+      /* sum of edge-neighbor pixels */
+      neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
+		 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
+		 GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
+		 GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
+      /* The edge-neighbors count twice as much as corner-neighbors */
+      neighsum += neighsum;
+      /* Add in the corner-neighbors */
+      neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
+		  GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
+      /* form final output scaled up by 2^16 */
+      membersum = membersum * memberscale + neighsum * neighscale;
+      /* round, descale and output it */
+      *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
+      inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
+    }
+
+    /* Special case for last column */
+    membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+		GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
+    neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
+	       GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
+	       GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
+	       GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
+    neighsum += neighsum;
+    neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
+		GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
+    membersum = membersum * memberscale + neighsum * neighscale;
+    *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
+
+    inrow += 2;
+  }
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the special case of a full-size component,
+ * with smoothing.  One row of context is required.
+ */
+
+METHODDEF(void)
+fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
+			    JSAMPARRAY input_data, JSAMPARRAY output_data)
+{
+  int outrow;
+  JDIMENSION colctr;
+  JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
+  register JSAMPROW inptr, above_ptr, below_ptr, outptr;
+  INT32 membersum, neighsum, memberscale, neighscale;
+  int colsum, lastcolsum, nextcolsum;
+
+  /* Expand input data enough to let all the output samples be generated
+   * by the standard loop.  Special-casing padded output would be more
+   * efficient.
+   */
+  expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
+		    cinfo->image_width, output_cols);
+
+  /* Each of the eight neighbor pixels contributes a fraction SF to the
+   * smoothed pixel, while the main pixel contributes (1-8*SF).  In order
+   * to use integer arithmetic, these factors are multiplied by 2^16 = 65536.
+   * Also recall that SF = smoothing_factor / 1024.
+   */
+
+  memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */
+  neighscale = cinfo->smoothing_factor * 64; /* scaled SF */
+
+  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
+    outptr = output_data[outrow];
+    inptr = input_data[outrow];
+    above_ptr = input_data[outrow-1];
+    below_ptr = input_data[outrow+1];
+
+    /* Special case for first column */
+    colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
+	     GETJSAMPLE(*inptr);
+    membersum = GETJSAMPLE(*inptr++);
+    nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
+		 GETJSAMPLE(*inptr);
+    neighsum = colsum + (colsum - membersum) + nextcolsum;
+    membersum = membersum * memberscale + neighsum * neighscale;
+    *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
+    lastcolsum = colsum; colsum = nextcolsum;
+
+    for (colctr = output_cols - 2; colctr > 0; colctr--) {
+      membersum = GETJSAMPLE(*inptr++);
+      above_ptr++; below_ptr++;
+      nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
+		   GETJSAMPLE(*inptr);
+      neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
+      membersum = membersum * memberscale + neighsum * neighscale;
+      *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
+      lastcolsum = colsum; colsum = nextcolsum;
+    }
+
+    /* Special case for last column */
+    membersum = GETJSAMPLE(*inptr);
+    neighsum = lastcolsum + (colsum - membersum) + colsum;
+    membersum = membersum * memberscale + neighsum * neighscale;
+    *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
+
+  }
+}
+
+#endif /* INPUT_SMOOTHING_SUPPORTED */
+
+
+/*
+ * Module initialization routine for downsampling.
+ * Note that we must select a routine for each component.
+ */
+
+GLOBAL(void)
+jinit_downsampler (j_compress_ptr cinfo)
+{
+  my_downsample_ptr downsample;
+  int ci;
+  jpeg_component_info * compptr;
+  boolean smoothok = TRUE;
+
+  downsample = (my_downsample_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_downsampler));
+  cinfo->downsample = (struct jpeg_downsampler *) downsample;
+  downsample->pub.start_pass = start_pass_downsample;
+  downsample->pub.downsample = sep_downsample;
+  downsample->pub.need_context_rows = FALSE;
+
+  if (cinfo->CCIR601_sampling)
+    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
+
+  /* Verify we can handle the sampling factors, and set up method pointers */
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    if (compptr->h_samp_factor == cinfo->max_h_samp_factor &&
+	compptr->v_samp_factor == cinfo->max_v_samp_factor) {
+#ifdef INPUT_SMOOTHING_SUPPORTED
+      if (cinfo->smoothing_factor) {
+	downsample->methods[ci] = fullsize_smooth_downsample;
+	downsample->pub.need_context_rows = TRUE;
+      } else
+#endif
+	downsample->methods[ci] = fullsize_downsample;
+    } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
+	       compptr->v_samp_factor == cinfo->max_v_samp_factor) {
+      smoothok = FALSE;
+      downsample->methods[ci] = h2v1_downsample;
+    } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
+	       compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {
+#ifdef INPUT_SMOOTHING_SUPPORTED
+      if (cinfo->smoothing_factor) {
+	downsample->methods[ci] = h2v2_smooth_downsample;
+	downsample->pub.need_context_rows = TRUE;
+      } else
+#endif
+	downsample->methods[ci] = h2v2_downsample;
+    } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
+	       (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {
+      smoothok = FALSE;
+      downsample->methods[ci] = int_downsample;
+    } else
+      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
+  }
+
+#ifdef INPUT_SMOOTHING_SUPPORTED
+  if (cinfo->smoothing_factor && !smoothok)
+    TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
+#endif
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jctrans.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jctrans.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jctrans.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,388 @@
+/*
+ * jctrans.c
+ *
+ * Copyright (C) 1995-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains library routines for transcoding compression,
+ * that is, writing raw DCT coefficient arrays to an output JPEG file.
+ * The routines in jcapimin.c will also be needed by a transcoder.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Forward declarations */
+LOCAL(void) transencode_master_selection
+	JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
+LOCAL(void) transencode_coef_controller
+	JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
+
+
+/*
+ * Compression initialization for writing raw-coefficient data.
+ * Before calling this, all parameters and a data destination must be set up.
+ * Call jpeg_finish_compress() to actually write the data.
+ *
+ * The number of passed virtual arrays must match cinfo->num_components.
+ * Note that the virtual arrays need not be filled or even realized at
+ * the time write_coefficients is called; indeed, if the virtual arrays
+ * were requested from this compression object's memory manager, they
+ * typically will be realized during this routine and filled afterwards.
+ */
+
+GLOBAL(void)
+jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)
+{
+  if (cinfo->global_state != CSTATE_START)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  /* Mark all tables to be written */
+  jpeg_suppress_tables(cinfo, FALSE);
+  /* (Re)initialize error mgr and destination modules */
+  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+  (*cinfo->dest->init_destination) (cinfo);
+  /* Perform master selection of active modules */
+  transencode_master_selection(cinfo, coef_arrays);
+  /* Wait for jpeg_finish_compress() call */
+  cinfo->next_scanline = 0;	/* so jpeg_write_marker works */
+  cinfo->global_state = CSTATE_WRCOEFS;
+}
+
+
+/*
+ * Initialize the compression object with default parameters,
+ * then copy from the source object all parameters needed for lossless
+ * transcoding.  Parameters that can be varied without loss (such as
+ * scan script and Huffman optimization) are left in their default states.
+ */
+
+GLOBAL(void)
+jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
+			       j_compress_ptr dstinfo)
+{
+  JQUANT_TBL ** qtblptr;
+  jpeg_component_info *incomp, *outcomp;
+  JQUANT_TBL *c_quant, *slot_quant;
+  int tblno, ci, coefi;
+
+  /* Safety check to ensure start_compress not called yet. */
+  if (dstinfo->global_state != CSTATE_START)
+    ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state);
+  /* Copy fundamental image dimensions */
+  dstinfo->image_width = srcinfo->image_width;
+  dstinfo->image_height = srcinfo->image_height;
+  dstinfo->input_components = srcinfo->num_components;
+  dstinfo->in_color_space = srcinfo->jpeg_color_space;
+  /* Initialize all parameters to default values */
+  jpeg_set_defaults(dstinfo);
+  /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
+   * Fix it to get the right header markers for the image colorspace.
+   */
+  jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
+  dstinfo->data_precision = srcinfo->data_precision;
+  dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
+  /* Copy the source's quantization tables. */
+  for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
+    if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
+      qtblptr = & dstinfo->quant_tbl_ptrs[tblno];
+      if (*qtblptr == NULL)
+	*qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);
+      MEMCOPY((*qtblptr)->quantval,
+	      srcinfo->quant_tbl_ptrs[tblno]->quantval,
+	      SIZEOF((*qtblptr)->quantval));
+      (*qtblptr)->sent_table = FALSE;
+    }
+  }
+  /* Copy the source's per-component info.
+   * Note we assume jpeg_set_defaults has allocated the dest comp_info array.
+   */
+  dstinfo->num_components = srcinfo->num_components;
+  if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
+    ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,
+	     MAX_COMPONENTS);
+  for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
+       ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
+    outcomp->component_id = incomp->component_id;
+    outcomp->h_samp_factor = incomp->h_samp_factor;
+    outcomp->v_samp_factor = incomp->v_samp_factor;
+    outcomp->quant_tbl_no = incomp->quant_tbl_no;
+    /* Make sure saved quantization table for component matches the qtable
+     * slot.  If not, the input file re-used this qtable slot.
+     * IJG encoder currently cannot duplicate this.
+     */
+    tblno = outcomp->quant_tbl_no;
+    if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
+	srcinfo->quant_tbl_ptrs[tblno] == NULL)
+      ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);
+    slot_quant = srcinfo->quant_tbl_ptrs[tblno];
+    c_quant = incomp->quant_table;
+    if (c_quant != NULL) {
+      for (coefi = 0; coefi < DCTSIZE2; coefi++) {
+	if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
+	  ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
+      }
+    }
+    /* Note: we do not copy the source's Huffman table assignments;
+     * instead we rely on jpeg_set_colorspace to have made a suitable choice.
+     */
+  }
+  /* Also copy JFIF version and resolution information, if available.
+   * Strictly speaking this isn't "critical" info, but it's nearly
+   * always appropriate to copy it if available.  In particular,
+   * if the application chooses to copy JFIF 1.02 extension markers from
+   * the source file, we need to copy the version to make sure we don't
+   * emit a file that has 1.02 extensions but a claimed version of 1.01.
+   * We will *not*, however, copy version info from mislabeled "2.01" files.
+   */
+  if (srcinfo->saw_JFIF_marker) {
+    if (srcinfo->JFIF_major_version == 1) {
+      dstinfo->JFIF_major_version = srcinfo->JFIF_major_version;
+      dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version;
+    }
+    dstinfo->density_unit = srcinfo->density_unit;
+    dstinfo->X_density = srcinfo->X_density;
+    dstinfo->Y_density = srcinfo->Y_density;
+  }
+}
+
+
+/*
+ * Master selection of compression modules for transcoding.
+ * This substitutes for jcinit.c's initialization of the full compressor.
+ */
+
+LOCAL(void)
+transencode_master_selection (j_compress_ptr cinfo,
+			      jvirt_barray_ptr * coef_arrays)
+{
+  /* Although we don't actually use input_components for transcoding,
+   * jcmaster.c's initial_setup will complain if input_components is 0.
+   */
+  cinfo->input_components = 1;
+  /* Initialize master control (includes parameter checking/processing) */
+  jinit_c_master_control(cinfo, TRUE /* transcode only */);
+
+  /* Entropy encoding: either Huffman or arithmetic coding. */
+  if (cinfo->arith_code) {
+    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
+  } else {
+    if (cinfo->progressive_mode) {
+#ifdef C_PROGRESSIVE_SUPPORTED
+      jinit_phuff_encoder(cinfo);
+#else
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+    } else
+      jinit_huff_encoder(cinfo);
+  }
+
+  /* We need a special coefficient buffer controller. */
+  transencode_coef_controller(cinfo, coef_arrays);
+
+  jinit_marker_writer(cinfo);
+
+  /* We can now tell the memory manager to allocate virtual arrays. */
+  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
+
+  /* Write the datastream header (SOI, JFIF) immediately.
+   * Frame and scan headers are postponed till later.
+   * This lets application insert special markers after the SOI.
+   */
+  (*cinfo->marker->write_file_header) (cinfo);
+}
+
+
+/*
+ * The rest of this file is a special implementation of the coefficient
+ * buffer controller.  This is similar to jccoefct.c, but it handles only
+ * output from presupplied virtual arrays.  Furthermore, we generate any
+ * dummy padding blocks on-the-fly rather than expecting them to be present
+ * in the arrays.
+ */
+
+/* Private buffer controller object */
+
+typedef struct {
+  struct jpeg_c_coef_controller pub; /* public fields */
+
+  JDIMENSION iMCU_row_num;	/* iMCU row # within image */
+  JDIMENSION mcu_ctr;		/* counts MCUs processed in current row */
+  int MCU_vert_offset;		/* counts MCU rows within iMCU row */
+  int MCU_rows_per_iMCU_row;	/* number of such rows needed */
+
+  /* Virtual block array for each component. */
+  jvirt_barray_ptr * whole_image;
+
+  /* Workspace for constructing dummy blocks at right/bottom edges. */
+  JBLOCKROW dummy_buffer[C_MAX_BLOCKS_IN_MCU];
+} my_coef_controller;
+
+typedef my_coef_controller * my_coef_ptr;
+
+
+LOCAL(void)
+start_iMCU_row (j_compress_ptr cinfo)
+/* Reset within-iMCU-row counters for a new row */
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+
+  /* In an interleaved scan, an MCU row is the same as an iMCU row.
+   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
+   * But at the bottom of the image, process only what's left.
+   */
+  if (cinfo->comps_in_scan > 1) {
+    coef->MCU_rows_per_iMCU_row = 1;
+  } else {
+    if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
+      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
+    else
+      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
+  }
+
+  coef->mcu_ctr = 0;
+  coef->MCU_vert_offset = 0;
+}
+
+
+/*
+ * Initialize for a processing pass.
+ */
+
+METHODDEF(void)
+start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+
+  if (pass_mode != JBUF_CRANK_DEST)
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+
+  coef->iMCU_row_num = 0;
+  start_iMCU_row(cinfo);
+}
+
+
+/*
+ * Process some data.
+ * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
+ * per call, ie, v_samp_factor block rows for each component in the scan.
+ * The data is obtained from the virtual arrays and fed to the entropy coder.
+ * Returns TRUE if the iMCU row is completed, FALSE if suspended.
+ *
+ * NB: input_buf is ignored; it is likely to be a NULL pointer.
+ */
+
+METHODDEF(boolean)
+compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION MCU_col_num;	/* index of current MCU within row */
+  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
+  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
+  int blkn, ci, xindex, yindex, yoffset, blockcnt;
+  JDIMENSION start_col;
+  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
+  JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
+  JBLOCKROW buffer_ptr;
+  jpeg_component_info *compptr;
+
+  /* Align the virtual buffers for the components used in this scan. */
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    buffer[ci] = (*cinfo->mem->access_virt_barray)
+      ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
+       coef->iMCU_row_num * compptr->v_samp_factor,
+       (JDIMENSION) compptr->v_samp_factor, FALSE);
+  }
+
+  /* Loop to process one whole iMCU row */
+  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
+       yoffset++) {
+    for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
+	 MCU_col_num++) {
+      /* Construct list of pointers to DCT blocks belonging to this MCU */
+      blkn = 0;			/* index of current DCT block within MCU */
+      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+	compptr = cinfo->cur_comp_info[ci];
+	start_col = MCU_col_num * compptr->MCU_width;
+	blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
+						: compptr->last_col_width;
+	for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
+	  if (coef->iMCU_row_num < last_iMCU_row ||
+	      yindex+yoffset < compptr->last_row_height) {
+	    /* Fill in pointers to real blocks in this row */
+	    buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
+	    for (xindex = 0; xindex < blockcnt; xindex++)
+	      MCU_buffer[blkn++] = buffer_ptr++;
+	  } else {
+	    /* At bottom of image, need a whole row of dummy blocks */
+	    xindex = 0;
+	  }
+	  /* Fill in any dummy blocks needed in this row.
+	   * Dummy blocks are filled in the same way as in jccoefct.c:
+	   * all zeroes in the AC entries, DC entries equal to previous
+	   * block's DC value.  The init routine has already zeroed the
+	   * AC entries, so we need only set the DC entries correctly.
+	   */
+	  for (; xindex < compptr->MCU_width; xindex++) {
+	    MCU_buffer[blkn] = coef->dummy_buffer[blkn];
+	    MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0];
+	    blkn++;
+	  }
+	}
+      }
+      /* Try to write the MCU. */
+      if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
+	/* Suspension forced; update state counters and exit */
+	coef->MCU_vert_offset = yoffset;
+	coef->mcu_ctr = MCU_col_num;
+	return FALSE;
+      }
+    }
+    /* Completed an MCU row, but perhaps not an iMCU row */
+    coef->mcu_ctr = 0;
+  }
+  /* Completed the iMCU row, advance counters for next one */
+  coef->iMCU_row_num++;
+  start_iMCU_row(cinfo);
+  return TRUE;
+}
+
+
+/*
+ * Initialize coefficient buffer controller.
+ *
+ * Each passed coefficient array must be the right size for that
+ * coefficient: width_in_blocks wide and height_in_blocks high,
+ * with unitheight at least v_samp_factor.
+ */
+
+LOCAL(void)
+transencode_coef_controller (j_compress_ptr cinfo,
+			     jvirt_barray_ptr * coef_arrays)
+{
+  my_coef_ptr coef;
+  JBLOCKROW buffer;
+  int i;
+
+  coef = (my_coef_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_coef_controller));
+  cinfo->coef = (struct jpeg_c_coef_controller *) coef;
+  coef->pub.start_pass = start_pass_coef;
+  coef->pub.compress_data = compress_output;
+
+  /* Save pointer to virtual arrays */
+  coef->whole_image = coef_arrays;
+
+  /* Allocate and pre-zero space for dummy DCT blocks. */
+  buffer = (JBLOCKROW)
+    (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
+  jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
+  for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
+    coef->dummy_buffer[i] = buffer + i;
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdapimin.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdapimin.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdapimin.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,395 @@
+/*
+ * jdapimin.c
+ *
+ * Copyright (C) 1994-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains application interface code for the decompression half
+ * of the JPEG library.  These are the "minimum" API routines that may be
+ * needed in either the normal full-decompression case or the
+ * transcoding-only case.
+ *
+ * Most of the routines intended to be called directly by an application
+ * are in this file or in jdapistd.c.  But also see jcomapi.c for routines
+ * shared by compression and decompression, and jdtrans.c for the transcoding
+ * case.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * Initialization of a JPEG decompression object.
+ * The error manager must already be set up (in case memory manager fails).
+ */
+
+GLOBAL(void)
+jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
+{
+  int i;
+
+  /* Guard against version mismatches between library and caller. */
+  cinfo->mem = NULL;		/* so jpeg_destroy knows mem mgr not called */
+  if (version != JPEG_LIB_VERSION)
+    ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
+  if (structsize != SIZEOF(struct jpeg_decompress_struct))
+    ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, 
+	     (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize);
+
+  /* For debugging purposes, we zero the whole master structure.
+   * But the application has already set the err pointer, and may have set
+   * client_data, so we have to save and restore those fields.
+   * Note: if application hasn't set client_data, tools like Purify may
+   * complain here.
+   */
+  {
+    struct jpeg_error_mgr * err = cinfo->err;
+    void * client_data = cinfo->client_data; /* ignore Purify complaint here */
+    MEMZERO(cinfo, SIZEOF(struct jpeg_decompress_struct));
+    cinfo->err = err;
+    cinfo->client_data = client_data;
+  }
+  cinfo->is_decompressor = TRUE;
+
+  /* Initialize a memory manager instance for this object */
+  jinit_memory_mgr((j_common_ptr) cinfo);
+
+  /* Zero out pointers to permanent structures. */
+  cinfo->progress = NULL;
+  cinfo->src = NULL;
+
+  for (i = 0; i < NUM_QUANT_TBLS; i++)
+    cinfo->quant_tbl_ptrs[i] = NULL;
+
+  for (i = 0; i < NUM_HUFF_TBLS; i++) {
+    cinfo->dc_huff_tbl_ptrs[i] = NULL;
+    cinfo->ac_huff_tbl_ptrs[i] = NULL;
+  }
+
+  /* Initialize marker processor so application can override methods
+   * for COM, APPn markers before calling jpeg_read_header.
+   */
+  cinfo->marker_list = NULL;
+  jinit_marker_reader(cinfo);
+
+  /* And initialize the overall input controller. */
+  jinit_input_controller(cinfo);
+
+  /* OK, I'm ready */
+  cinfo->global_state = DSTATE_START;
+}
+
+
+/*
+ * Destruction of a JPEG decompression object
+ */
+
+GLOBAL(void)
+jpeg_destroy_decompress (j_decompress_ptr cinfo)
+{
+  jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
+}
+
+
+/*
+ * Abort processing of a JPEG decompression operation,
+ * but don't destroy the object itself.
+ */
+
+GLOBAL(void)
+jpeg_abort_decompress (j_decompress_ptr cinfo)
+{
+  jpeg_abort((j_common_ptr) cinfo); /* use common routine */
+}
+
+
+/*
+ * Set default decompression parameters.
+ */
+
+LOCAL(void)
+default_decompress_parms (j_decompress_ptr cinfo)
+{
+  /* Guess the input colorspace, and set output colorspace accordingly. */
+  /* (Wish JPEG committee had provided a real way to specify this...) */
+  /* Note application may override our guesses. */
+  switch (cinfo->num_components) {
+  case 1:
+    cinfo->jpeg_color_space = JCS_GRAYSCALE;
+    cinfo->out_color_space = JCS_GRAYSCALE;
+    break;
+    
+  case 3:
+    if (cinfo->saw_JFIF_marker) {
+      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
+    } else if (cinfo->saw_Adobe_marker) {
+      switch (cinfo->Adobe_transform) {
+      case 0:
+	cinfo->jpeg_color_space = JCS_RGB;
+	break;
+      case 1:
+	cinfo->jpeg_color_space = JCS_YCbCr;
+	break;
+      default:
+	WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
+	cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
+	break;
+      }
+    } else {
+      /* Saw no special markers, try to guess from the component IDs */
+      int cid0 = cinfo->comp_info[0].component_id;
+      int cid1 = cinfo->comp_info[1].component_id;
+      int cid2 = cinfo->comp_info[2].component_id;
+
+      if (cid0 == 1 && cid1 == 2 && cid2 == 3)
+	cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
+      else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
+	cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
+      else {
+	TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
+	cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
+      }
+    }
+    /* Always guess RGB is proper output colorspace. */
+    cinfo->out_color_space = JCS_RGB;
+    break;
+    
+  case 4:
+    if (cinfo->saw_Adobe_marker) {
+      switch (cinfo->Adobe_transform) {
+      case 0:
+	cinfo->jpeg_color_space = JCS_CMYK;
+	break;
+      case 2:
+	cinfo->jpeg_color_space = JCS_YCCK;
+	break;
+      default:
+	WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
+	cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
+	break;
+      }
+    } else {
+      /* No special markers, assume straight CMYK. */
+      cinfo->jpeg_color_space = JCS_CMYK;
+    }
+    cinfo->out_color_space = JCS_CMYK;
+    break;
+    
+  default:
+    cinfo->jpeg_color_space = JCS_UNKNOWN;
+    cinfo->out_color_space = JCS_UNKNOWN;
+    break;
+  }
+
+  /* Set defaults for other decompression parameters. */
+  cinfo->scale_num = 1;		/* 1:1 scaling */
+  cinfo->scale_denom = 1;
+  cinfo->output_gamma = 1.0;
+  cinfo->buffered_image = FALSE;
+  cinfo->raw_data_out = FALSE;
+  cinfo->dct_method = JDCT_DEFAULT;
+  cinfo->do_fancy_upsampling = TRUE;
+  cinfo->do_block_smoothing = TRUE;
+  cinfo->quantize_colors = FALSE;
+  /* We set these in case application only sets quantize_colors. */
+  cinfo->dither_mode = JDITHER_FS;
+#ifdef QUANT_2PASS_SUPPORTED
+  cinfo->two_pass_quantize = TRUE;
+#else
+  cinfo->two_pass_quantize = FALSE;
+#endif
+  cinfo->desired_number_of_colors = 256;
+  cinfo->colormap = NULL;
+  /* Initialize for no mode change in buffered-image mode. */
+  cinfo->enable_1pass_quant = FALSE;
+  cinfo->enable_external_quant = FALSE;
+  cinfo->enable_2pass_quant = FALSE;
+}
+
+
+/*
+ * Decompression startup: read start of JPEG datastream to see what's there.
+ * Need only initialize JPEG object and supply a data source before calling.
+ *
+ * This routine will read as far as the first SOS marker (ie, actual start of
+ * compressed data), and will save all tables and parameters in the JPEG
+ * object.  It will also initialize the decompression parameters to default
+ * values, and finally return JPEG_HEADER_OK.  On return, the application may
+ * adjust the decompression parameters and then call jpeg_start_decompress.
+ * (Or, if the application only wanted to determine the image parameters,
+ * the data need not be decompressed.  In that case, call jpeg_abort or
+ * jpeg_destroy to release any temporary space.)
+ * If an abbreviated (tables only) datastream is presented, the routine will
+ * return JPEG_HEADER_TABLES_ONLY upon reaching EOI.  The application may then
+ * re-use the JPEG object to read the abbreviated image datastream(s).
+ * It is unnecessary (but OK) to call jpeg_abort in this case.
+ * The JPEG_SUSPENDED return code only occurs if the data source module
+ * requests suspension of the decompressor.  In this case the application
+ * should load more source data and then re-call jpeg_read_header to resume
+ * processing.
+ * If a non-suspending data source is used and require_image is TRUE, then the
+ * return code need not be inspected since only JPEG_HEADER_OK is possible.
+ *
+ * This routine is now just a front end to jpeg_consume_input, with some
+ * extra error checking.
+ */
+
+GLOBAL(int)
+jpeg_read_header (j_decompress_ptr cinfo, boolean require_image)
+{
+  int retcode;
+
+  if (cinfo->global_state != DSTATE_START &&
+      cinfo->global_state != DSTATE_INHEADER)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  retcode = jpeg_consume_input(cinfo);
+
+  switch (retcode) {
+  case JPEG_REACHED_SOS:
+    retcode = JPEG_HEADER_OK;
+    break;
+  case JPEG_REACHED_EOI:
+    if (require_image)		/* Complain if application wanted an image */
+      ERREXIT(cinfo, JERR_NO_IMAGE);
+    /* Reset to start state; it would be safer to require the application to
+     * call jpeg_abort, but we can't change it now for compatibility reasons.
+     * A side effect is to free any temporary memory (there shouldn't be any).
+     */
+    jpeg_abort((j_common_ptr) cinfo); /* sets state = DSTATE_START */
+    retcode = JPEG_HEADER_TABLES_ONLY;
+    break;
+  case JPEG_SUSPENDED:
+    /* no work */
+    break;
+  }
+
+  return retcode;
+}
+
+
+/*
+ * Consume data in advance of what the decompressor requires.
+ * This can be called at any time once the decompressor object has
+ * been created and a data source has been set up.
+ *
+ * This routine is essentially a state machine that handles a couple
+ * of critical state-transition actions, namely initial setup and
+ * transition from header scanning to ready-for-start_decompress.
+ * All the actual input is done via the input controller's consume_input
+ * method.
+ */
+
+GLOBAL(int)
+jpeg_consume_input (j_decompress_ptr cinfo)
+{
+  int retcode = JPEG_SUSPENDED;
+
+  /* NB: every possible DSTATE value should be listed in this switch */
+  switch (cinfo->global_state) {
+  case DSTATE_START:
+    /* Start-of-datastream actions: reset appropriate modules */
+    (*cinfo->inputctl->reset_input_controller) (cinfo);
+    /* Initialize application's data source module */
+    (*cinfo->src->init_source) (cinfo);
+    cinfo->global_state = DSTATE_INHEADER;
+    /*FALLTHROUGH*/
+  case DSTATE_INHEADER:
+    retcode = (*cinfo->inputctl->consume_input) (cinfo);
+    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
+      /* Set up default parameters based on header data */
+      default_decompress_parms(cinfo);
+      /* Set global state: ready for start_decompress */
+      cinfo->global_state = DSTATE_READY;
+    }
+    break;
+  case DSTATE_READY:
+    /* Can't advance past first SOS until start_decompress is called */
+    retcode = JPEG_REACHED_SOS;
+    break;
+  case DSTATE_PRELOAD:
+  case DSTATE_PRESCAN:
+  case DSTATE_SCANNING:
+  case DSTATE_RAW_OK:
+  case DSTATE_BUFIMAGE:
+  case DSTATE_BUFPOST:
+  case DSTATE_STOPPING:
+    retcode = (*cinfo->inputctl->consume_input) (cinfo);
+    break;
+  default:
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  }
+  return retcode;
+}
+
+
+/*
+ * Have we finished reading the input file?
+ */
+
+GLOBAL(boolean)
+jpeg_input_complete (j_decompress_ptr cinfo)
+{
+  /* Check for valid jpeg object */
+  if (cinfo->global_state < DSTATE_START ||
+      cinfo->global_state > DSTATE_STOPPING)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  return cinfo->inputctl->eoi_reached;
+}
+
+
+/*
+ * Is there more than one scan?
+ */
+
+GLOBAL(boolean)
+jpeg_has_multiple_scans (j_decompress_ptr cinfo)
+{
+  /* Only valid after jpeg_read_header completes */
+  if (cinfo->global_state < DSTATE_READY ||
+      cinfo->global_state > DSTATE_STOPPING)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  return cinfo->inputctl->has_multiple_scans;
+}
+
+
+/*
+ * Finish JPEG decompression.
+ *
+ * This will normally just verify the file trailer and release temp storage.
+ *
+ * Returns FALSE if suspended.  The return value need be inspected only if
+ * a suspending data source is used.
+ */
+
+GLOBAL(boolean)
+jpeg_finish_decompress (j_decompress_ptr cinfo)
+{
+  if ((cinfo->global_state == DSTATE_SCANNING ||
+       cinfo->global_state == DSTATE_RAW_OK) && ! cinfo->buffered_image) {
+    /* Terminate final pass of non-buffered mode */
+    if (cinfo->output_scanline < cinfo->output_height)
+      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
+    (*cinfo->master->finish_output_pass) (cinfo);
+    cinfo->global_state = DSTATE_STOPPING;
+  } else if (cinfo->global_state == DSTATE_BUFIMAGE) {
+    /* Finishing after a buffered-image operation */
+    cinfo->global_state = DSTATE_STOPPING;
+  } else if (cinfo->global_state != DSTATE_STOPPING) {
+    /* STOPPING = repeat call after a suspension, anything else is error */
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  }
+  /* Read until EOI */
+  while (! cinfo->inputctl->eoi_reached) {
+    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
+      return FALSE;		/* Suspend, come back later */
+  }
+  /* Do final cleanup */
+  (*cinfo->src->term_source) (cinfo);
+  /* We can use jpeg_abort to release memory and reset global_state */
+  jpeg_abort((j_common_ptr) cinfo);
+  return TRUE;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdapistd.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdapistd.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdapistd.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,275 @@
+/*
+ * jdapistd.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains application interface code for the decompression half
+ * of the JPEG library.  These are the "standard" API routines that are
+ * used in the normal full-decompression case.  They are not used by a
+ * transcoding-only application.  Note that if an application links in
+ * jpeg_start_decompress, it will end up linking in the entire decompressor.
+ * We thus must separate this file from jdapimin.c to avoid linking the
+ * whole decompression library into a transcoder.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Forward declarations */
+LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo));
+
+
+/*
+ * Decompression initialization.
+ * jpeg_read_header must be completed before calling this.
+ *
+ * If a multipass operating mode was selected, this will do all but the
+ * last pass, and thus may take a great deal of time.
+ *
+ * Returns FALSE if suspended.  The return value need be inspected only if
+ * a suspending data source is used.
+ */
+
+GLOBAL(boolean)
+jpeg_start_decompress (j_decompress_ptr cinfo)
+{
+  if (cinfo->global_state == DSTATE_READY) {
+    /* First call: initialize master control, select active modules */
+    jinit_master_decompress(cinfo);
+    if (cinfo->buffered_image) {
+      /* No more work here; expecting jpeg_start_output next */
+      cinfo->global_state = DSTATE_BUFIMAGE;
+      return TRUE;
+    }
+    cinfo->global_state = DSTATE_PRELOAD;
+  }
+  if (cinfo->global_state == DSTATE_PRELOAD) {
+    /* If file has multiple scans, absorb them all into the coef buffer */
+    if (cinfo->inputctl->has_multiple_scans) {
+#ifdef D_MULTISCAN_FILES_SUPPORTED
+      for (;;) {
+	int retcode;
+	/* Call progress monitor hook if present */
+	if (cinfo->progress != NULL)
+	  (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+	/* Absorb some more input */
+	retcode = (*cinfo->inputctl->consume_input) (cinfo);
+	if (retcode == JPEG_SUSPENDED)
+	  return FALSE;
+	if (retcode == JPEG_REACHED_EOI)
+	  break;
+	/* Advance progress counter if appropriate */
+	if (cinfo->progress != NULL &&
+	    (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
+	  if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
+	    /* jdmaster underestimated number of scans; ratchet up one scan */
+	    cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
+	  }
+	}
+      }
+#else
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif /* D_MULTISCAN_FILES_SUPPORTED */
+    }
+    cinfo->output_scan_number = cinfo->input_scan_number;
+  } else if (cinfo->global_state != DSTATE_PRESCAN)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  /* Perform any dummy output passes, and set up for the final pass */
+  return output_pass_setup(cinfo);
+}
+
+
+/*
+ * Set up for an output pass, and perform any dummy pass(es) needed.
+ * Common subroutine for jpeg_start_decompress and jpeg_start_output.
+ * Entry: global_state = DSTATE_PRESCAN only if previously suspended.
+ * Exit: If done, returns TRUE and sets global_state for proper output mode.
+ *       If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN.
+ */
+
+LOCAL(boolean)
+output_pass_setup (j_decompress_ptr cinfo)
+{
+  if (cinfo->global_state != DSTATE_PRESCAN) {
+    /* First call: do pass setup */
+    (*cinfo->master->prepare_for_output_pass) (cinfo);
+    cinfo->output_scanline = 0;
+    cinfo->global_state = DSTATE_PRESCAN;
+  }
+  /* Loop over any required dummy passes */
+  while (cinfo->master->is_dummy_pass) {
+#ifdef QUANT_2PASS_SUPPORTED
+    /* Crank through the dummy pass */
+    while (cinfo->output_scanline < cinfo->output_height) {
+      JDIMENSION last_scanline;
+      /* Call progress monitor hook if present */
+      if (cinfo->progress != NULL) {
+	cinfo->progress->pass_counter = (long) cinfo->output_scanline;
+	cinfo->progress->pass_limit = (long) cinfo->output_height;
+	(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+      }
+      /* Process some data */
+      last_scanline = cinfo->output_scanline;
+      (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL,
+				    &cinfo->output_scanline, (JDIMENSION) 0);
+      if (cinfo->output_scanline == last_scanline)
+	return FALSE;		/* No progress made, must suspend */
+    }
+    /* Finish up dummy pass, and set up for another one */
+    (*cinfo->master->finish_output_pass) (cinfo);
+    (*cinfo->master->prepare_for_output_pass) (cinfo);
+    cinfo->output_scanline = 0;
+#else
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif /* QUANT_2PASS_SUPPORTED */
+  }
+  /* Ready for application to drive output pass through
+   * jpeg_read_scanlines or jpeg_read_raw_data.
+   */
+  cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
+  return TRUE;
+}
+
+
+/*
+ * Read some scanlines of data from the JPEG decompressor.
+ *
+ * The return value will be the number of lines actually read.
+ * This may be less than the number requested in several cases,
+ * including bottom of image, data source suspension, and operating
+ * modes that emit multiple scanlines at a time.
+ *
+ * Note: we warn about excess calls to jpeg_read_scanlines() since
+ * this likely signals an application programmer error.  However,
+ * an oversize buffer (max_lines > scanlines remaining) is not an error.
+ */
+
+GLOBAL(JDIMENSION)
+jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
+		     JDIMENSION max_lines)
+{
+  JDIMENSION row_ctr;
+
+  if (cinfo->global_state != DSTATE_SCANNING)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  if (cinfo->output_scanline >= cinfo->output_height) {
+    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
+    return 0;
+  }
+
+  /* Call progress monitor hook if present */
+  if (cinfo->progress != NULL) {
+    cinfo->progress->pass_counter = (long) cinfo->output_scanline;
+    cinfo->progress->pass_limit = (long) cinfo->output_height;
+    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+  }
+
+  /* Process some data */
+  row_ctr = 0;
+  (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines);
+  cinfo->output_scanline += row_ctr;
+  return row_ctr;
+}
+
+
+/*
+ * Alternate entry point to read raw data.
+ * Processes exactly one iMCU row per call, unless suspended.
+ */
+
+GLOBAL(JDIMENSION)
+jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
+		    JDIMENSION max_lines)
+{
+  JDIMENSION lines_per_iMCU_row;
+
+  if (cinfo->global_state != DSTATE_RAW_OK)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  if (cinfo->output_scanline >= cinfo->output_height) {
+    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
+    return 0;
+  }
+
+  /* Call progress monitor hook if present */
+  if (cinfo->progress != NULL) {
+    cinfo->progress->pass_counter = (long) cinfo->output_scanline;
+    cinfo->progress->pass_limit = (long) cinfo->output_height;
+    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+  }
+
+  /* Verify that at least one iMCU row can be returned. */
+  lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size;
+  if (max_lines < lines_per_iMCU_row)
+    ERREXIT(cinfo, JERR_BUFFER_SIZE);
+
+  /* Decompress directly into user's buffer. */
+  if (! (*cinfo->coef->decompress_data) (cinfo, data))
+    return 0;			/* suspension forced, can do nothing more */
+
+  /* OK, we processed one iMCU row. */
+  cinfo->output_scanline += lines_per_iMCU_row;
+  return lines_per_iMCU_row;
+}
+
+
+/* Additional entry points for buffered-image mode. */
+
+#ifdef D_MULTISCAN_FILES_SUPPORTED
+
+/*
+ * Initialize for an output pass in buffered-image mode.
+ */
+
+GLOBAL(boolean)
+jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
+{
+  if (cinfo->global_state != DSTATE_BUFIMAGE &&
+      cinfo->global_state != DSTATE_PRESCAN)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  /* Limit scan number to valid range */
+  if (scan_number <= 0)
+    scan_number = 1;
+  if (cinfo->inputctl->eoi_reached &&
+      scan_number > cinfo->input_scan_number)
+    scan_number = cinfo->input_scan_number;
+  cinfo->output_scan_number = scan_number;
+  /* Perform any dummy output passes, and set up for the real pass */
+  return output_pass_setup(cinfo);
+}
+
+
+/*
+ * Finish up after an output pass in buffered-image mode.
+ *
+ * Returns FALSE if suspended.  The return value need be inspected only if
+ * a suspending data source is used.
+ */
+
+GLOBAL(boolean)
+jpeg_finish_output (j_decompress_ptr cinfo)
+{
+  if ((cinfo->global_state == DSTATE_SCANNING ||
+       cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) {
+    /* Terminate this pass. */
+    /* We do not require the whole pass to have been completed. */
+    (*cinfo->master->finish_output_pass) (cinfo);
+    cinfo->global_state = DSTATE_BUFPOST;
+  } else if (cinfo->global_state != DSTATE_BUFPOST) {
+    /* BUFPOST = repeat call after a suspension, anything else is error */
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  }
+  /* Read markers looking for SOS or EOI */
+  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
+	 ! cinfo->inputctl->eoi_reached) {
+    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
+      return FALSE;		/* Suspend, come back later */
+  }
+  cinfo->global_state = DSTATE_BUFIMAGE;
+  return TRUE;
+}
+
+#endif /* D_MULTISCAN_FILES_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdatadst.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdatadst.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdatadst.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+/*
+ * jdatadst.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains compression data destination routines for the case of
+ * emitting JPEG data to a file (or any stdio stream).  While these routines
+ * are sufficient for most applications, some will want to use a different
+ * destination manager.
+ * IMPORTANT: we assume that fwrite() will correctly transcribe an array of
+ * JOCTETs into 8-bit-wide elements on external storage.  If char is wider
+ * than 8 bits on your machine, you may need to do some tweaking.
+ */
+
+/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jerror.h"
+
+
+/* Expanded data destination object for stdio output */
+
+typedef struct {
+  struct jpeg_destination_mgr pub; /* public fields */
+
+  FILE * outfile;		/* target stream */
+  JOCTET * buffer;		/* start of buffer */
+} my_destination_mgr;
+
+typedef my_destination_mgr * my_dest_ptr;
+
+#define OUTPUT_BUF_SIZE  4096	/* choose an efficiently fwrite'able size */
+
+
+/*
+ * Initialize destination --- called by jpeg_start_compress
+ * before any data is actually written.
+ */
+
+METHODDEF(void)
+init_destination (j_compress_ptr cinfo)
+{
+  my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
+
+  /* Allocate the output buffer --- it will be released when done with image */
+  dest->buffer = (JOCTET *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  OUTPUT_BUF_SIZE * SIZEOF(JOCTET));
+
+  dest->pub.next_output_byte = dest->buffer;
+  dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
+}
+
+
+/*
+ * Empty the output buffer --- called whenever buffer fills up.
+ *
+ * In typical applications, this should write the entire output buffer
+ * (ignoring the current state of next_output_byte & free_in_buffer),
+ * reset the pointer & count to the start of the buffer, and return TRUE
+ * indicating that the buffer has been dumped.
+ *
+ * In applications that need to be able to suspend compression due to output
+ * overrun, a FALSE return indicates that the buffer cannot be emptied now.
+ * In this situation, the compressor will return to its caller (possibly with
+ * an indication that it has not accepted all the supplied scanlines).  The
+ * application should resume compression after it has made more room in the
+ * output buffer.  Note that there are substantial restrictions on the use of
+ * suspension --- see the documentation.
+ *
+ * When suspending, the compressor will back up to a convenient restart point
+ * (typically the start of the current MCU). next_output_byte & free_in_buffer
+ * indicate where the restart point will be if the current call returns FALSE.
+ * Data beyond this point will be regenerated after resumption, so do not
+ * write it out when emptying the buffer externally.
+ */
+
+METHODDEF(boolean)
+empty_output_buffer (j_compress_ptr cinfo)
+{
+  my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
+
+  if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) !=
+      (size_t) OUTPUT_BUF_SIZE)
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+
+  dest->pub.next_output_byte = dest->buffer;
+  dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
+
+  return TRUE;
+}
+
+
+/*
+ * Terminate destination --- called by jpeg_finish_compress
+ * after all data has been written.  Usually needs to flush buffer.
+ *
+ * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
+ * application must deal with any cleanup that should happen even
+ * for error exit.
+ */
+
+METHODDEF(void)
+term_destination (j_compress_ptr cinfo)
+{
+  my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
+  size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;
+
+  /* Write any data remaining in the buffer */
+  if (datacount > 0) {
+    if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
+      ERREXIT(cinfo, JERR_FILE_WRITE);
+  }
+  fflush(dest->outfile);
+  /* Make sure we wrote the output file OK */
+  if (ferror(dest->outfile))
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+}
+
+
+/*
+ * Prepare for output to a stdio stream.
+ * The caller must have already opened the stream, and is responsible
+ * for closing it after finishing compression.
+ */
+
+GLOBAL(void)
+jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile)
+{
+  my_dest_ptr dest;
+
+  /* The destination object is made permanent so that multiple JPEG images
+   * can be written to the same file without re-executing jpeg_stdio_dest.
+   * This makes it dangerous to use this manager and a different destination
+   * manager serially with the same JPEG object, because their private object
+   * sizes may be different.  Caveat programmer.
+   */
+  if (cinfo->dest == NULL) {	/* first time for this JPEG object? */
+    cinfo->dest = (struct jpeg_destination_mgr *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+				  SIZEOF(my_destination_mgr));
+  }
+
+  dest = (my_dest_ptr) cinfo->dest;
+  dest->pub.init_destination = init_destination;
+  dest->pub.empty_output_buffer = empty_output_buffer;
+  dest->pub.term_destination = term_destination;
+  dest->outfile = outfile;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdatasrc.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdatasrc.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdatasrc.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,212 @@
+/*
+ * jdatasrc.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains decompression data source routines for the case of
+ * reading JPEG data from a file (or any stdio stream).  While these routines
+ * are sufficient for most applications, some will want to use a different
+ * source manager.
+ * IMPORTANT: we assume that fread() will correctly transcribe an array of
+ * JOCTETs from 8-bit-wide elements on external storage.  If char is wider
+ * than 8 bits on your machine, you may need to do some tweaking.
+ */
+
+/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jerror.h"
+
+
+/* Expanded data source object for stdio input */
+
+typedef struct {
+  struct jpeg_source_mgr pub;	/* public fields */
+
+  FILE * infile;		/* source stream */
+  JOCTET * buffer;		/* start of buffer */
+  boolean start_of_file;	/* have we gotten any data yet? */
+} my_source_mgr;
+
+typedef my_source_mgr * my_src_ptr;
+
+#define INPUT_BUF_SIZE  4096	/* choose an efficiently fread'able size */
+
+
+/*
+ * Initialize source --- called by jpeg_read_header
+ * before any data is actually read.
+ */
+
+METHODDEF(void)
+init_source (j_decompress_ptr cinfo)
+{
+  my_src_ptr src = (my_src_ptr) cinfo->src;
+
+  /* We reset the empty-input-file flag for each image,
+   * but we don't clear the input buffer.
+   * This is correct behavior for reading a series of images from one source.
+   */
+  src->start_of_file = TRUE;
+}
+
+
+/*
+ * Fill the input buffer --- called whenever buffer is emptied.
+ *
+ * In typical applications, this should read fresh data into the buffer
+ * (ignoring the current state of next_input_byte & bytes_in_buffer),
+ * reset the pointer & count to the start of the buffer, and return TRUE
+ * indicating that the buffer has been reloaded.  It is not necessary to
+ * fill the buffer entirely, only to obtain at least one more byte.
+ *
+ * There is no such thing as an EOF return.  If the end of the file has been
+ * reached, the routine has a choice of ERREXIT() or inserting fake data into
+ * the buffer.  In most cases, generating a warning message and inserting a
+ * fake EOI marker is the best course of action --- this will allow the
+ * decompressor to output however much of the image is there.  However,
+ * the resulting error message is misleading if the real problem is an empty
+ * input file, so we handle that case specially.
+ *
+ * In applications that need to be able to suspend compression due to input
+ * not being available yet, a FALSE return indicates that no more data can be
+ * obtained right now, but more may be forthcoming later.  In this situation,
+ * the decompressor will return to its caller (with an indication of the
+ * number of scanlines it has read, if any).  The application should resume
+ * decompression after it has loaded more data into the input buffer.  Note
+ * that there are substantial restrictions on the use of suspension --- see
+ * the documentation.
+ *
+ * When suspending, the decompressor will back up to a convenient restart point
+ * (typically the start of the current MCU). next_input_byte & bytes_in_buffer
+ * indicate where the restart point will be if the current call returns FALSE.
+ * Data beyond this point must be rescanned after resumption, so move it to
+ * the front of the buffer rather than discarding it.
+ */
+
+METHODDEF(boolean)
+fill_input_buffer (j_decompress_ptr cinfo)
+{
+  my_src_ptr src = (my_src_ptr) cinfo->src;
+  size_t nbytes;
+
+  nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE);
+
+  if (nbytes <= 0) {
+    if (src->start_of_file)	/* Treat empty input file as fatal error */
+      ERREXIT(cinfo, JERR_INPUT_EMPTY);
+    WARNMS(cinfo, JWRN_JPEG_EOF);
+    /* Insert a fake EOI marker */
+    src->buffer[0] = (JOCTET) 0xFF;
+    src->buffer[1] = (JOCTET) JPEG_EOI;
+    nbytes = 2;
+  }
+
+  src->pub.next_input_byte = src->buffer;
+  src->pub.bytes_in_buffer = nbytes;
+  src->start_of_file = FALSE;
+
+  return TRUE;
+}
+
+
+/*
+ * Skip data --- used to skip over a potentially large amount of
+ * uninteresting data (such as an APPn marker).
+ *
+ * Writers of suspendable-input applications must note that skip_input_data
+ * is not granted the right to give a suspension return.  If the skip extends
+ * beyond the data currently in the buffer, the buffer can be marked empty so
+ * that the next read will cause a fill_input_buffer call that can suspend.
+ * Arranging for additional bytes to be discarded before reloading the input
+ * buffer is the application writer's problem.
+ */
+
+METHODDEF(void)
+skip_input_data (j_decompress_ptr cinfo, long num_bytes)
+{
+  my_src_ptr src = (my_src_ptr) cinfo->src;
+
+  /* Just a dumb implementation for now.  Could use fseek() except
+   * it doesn't work on pipes.  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) fill_input_buffer(cinfo);
+      /* 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;
+  }
+}
+
+
+/*
+ * An additional method that can be provided by data source modules is the
+ * resync_to_restart method for error recovery in the presence of RST markers.
+ * For the moment, this source module just uses the default resync method
+ * provided by the JPEG library.  That method assumes that no backtracking
+ * is possible.
+ */
+
+
+/*
+ * Terminate source --- called by jpeg_finish_decompress
+ * after all data has been read.  Often a no-op.
+ *
+ * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
+ * application must deal with any cleanup that should happen even
+ * for error exit.
+ */
+
+METHODDEF(void)
+term_source (j_decompress_ptr cinfo)
+{
+  /* no work necessary here */
+}
+
+
+/*
+ * Prepare for input from a stdio stream.
+ * The caller must have already opened the stream, and is responsible
+ * for closing it after finishing decompression.
+ */
+
+GLOBAL(void)
+jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
+{
+  my_src_ptr src;
+
+  /* The source object and input buffer are made permanent so that a series
+   * of JPEG images can be read from the same file by calling jpeg_stdio_src
+   * only before the first one.  (If we discarded the buffer at the end of
+   * one image, we'd likely lose the start of the next one.)
+   * This makes it unsafe to use this manager and a different source
+   * manager serially with the same JPEG object.  Caveat programmer.
+   */
+  if (cinfo->src == NULL) {	/* first time for this JPEG object? */
+    cinfo->src = (struct jpeg_source_mgr *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+				  SIZEOF(my_source_mgr));
+    src = (my_src_ptr) cinfo->src;
+    src->buffer = (JOCTET *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+				  INPUT_BUF_SIZE * SIZEOF(JOCTET));
+  }
+
+  src = (my_src_ptr) cinfo->src;
+  src->pub.init_source = init_source;
+  src->pub.fill_input_buffer = fill_input_buffer;
+  src->pub.skip_input_data = skip_input_data;
+  src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
+  src->pub.term_source = term_source;
+  src->infile = infile;
+  src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
+  src->pub.next_input_byte = NULL; /* until buffer loaded */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdcoefct.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdcoefct.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdcoefct.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,736 @@
+/*
+ * jdcoefct.c
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the coefficient buffer controller for decompression.
+ * This controller is the top level of the JPEG decompressor proper.
+ * The coefficient buffer lies between entropy decoding and inverse-DCT steps.
+ *
+ * In buffered-image mode, this controller is the interface between
+ * input-oriented processing and output-oriented processing.
+ * Also, the input side (only) is used when reading a file for transcoding.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+/* Block smoothing is only applicable for progressive JPEG, so: */
+#ifndef D_PROGRESSIVE_SUPPORTED
+#undef BLOCK_SMOOTHING_SUPPORTED
+#endif
+
+/* Private buffer controller object */
+
+typedef struct {
+  struct jpeg_d_coef_controller pub; /* public fields */
+
+  /* These variables keep track of the current location of the input side. */
+  /* cinfo->input_iMCU_row is also used for this. */
+  JDIMENSION MCU_ctr;		/* counts MCUs processed in current row */
+  int MCU_vert_offset;		/* counts MCU rows within iMCU row */
+  int MCU_rows_per_iMCU_row;	/* number of such rows needed */
+
+  /* The output side's location is represented by cinfo->output_iMCU_row. */
+
+  /* In single-pass modes, it's sufficient to buffer just one MCU.
+   * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks,
+   * and let the entropy decoder write into that workspace each time.
+   * (On 80x86, the workspace is FAR even though it's not really very big;
+   * this is to keep the module interfaces unchanged when a large coefficient
+   * buffer is necessary.)
+   * In multi-pass modes, this array points to the current MCU's blocks
+   * within the virtual arrays; it is used only by the input side.
+   */
+  JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU];
+
+#ifdef D_MULTISCAN_FILES_SUPPORTED
+  /* In multi-pass modes, we need a virtual block array for each component. */
+  jvirt_barray_ptr whole_image[MAX_COMPONENTS];
+#endif
+
+#ifdef BLOCK_SMOOTHING_SUPPORTED
+  /* When doing block smoothing, we latch coefficient Al values here */
+  int * coef_bits_latch;
+#define SAVED_COEFS  6		/* we save coef_bits[0..5] */
+#endif
+} my_coef_controller;
+
+typedef my_coef_controller * my_coef_ptr;
+
+/* Forward declarations */
+METHODDEF(int) decompress_onepass
+	JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
+#ifdef D_MULTISCAN_FILES_SUPPORTED
+METHODDEF(int) decompress_data
+	JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
+#endif
+#ifdef BLOCK_SMOOTHING_SUPPORTED
+LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo));
+METHODDEF(int) decompress_smooth_data
+	JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
+#endif
+
+
+LOCAL(void)
+start_iMCU_row (j_decompress_ptr cinfo)
+/* Reset within-iMCU-row counters for a new row (input side) */
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+
+  /* In an interleaved scan, an MCU row is the same as an iMCU row.
+   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
+   * But at the bottom of the image, process only what's left.
+   */
+  if (cinfo->comps_in_scan > 1) {
+    coef->MCU_rows_per_iMCU_row = 1;
+  } else {
+    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
+      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
+    else
+      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
+  }
+
+  coef->MCU_ctr = 0;
+  coef->MCU_vert_offset = 0;
+}
+
+
+/*
+ * Initialize for an input processing pass.
+ */
+
+METHODDEF(void)
+start_input_pass (j_decompress_ptr cinfo)
+{
+  cinfo->input_iMCU_row = 0;
+  start_iMCU_row(cinfo);
+}
+
+
+/*
+ * Initialize for an output processing pass.
+ */
+
+METHODDEF(void)
+start_output_pass (j_decompress_ptr cinfo)
+{
+#ifdef BLOCK_SMOOTHING_SUPPORTED
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+
+  /* If multipass, check to see whether to use block smoothing on this pass */
+  if (coef->pub.coef_arrays != NULL) {
+    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
+      coef->pub.decompress_data = decompress_smooth_data;
+    else
+      coef->pub.decompress_data = decompress_data;
+  }
+#endif
+  cinfo->output_iMCU_row = 0;
+}
+
+
+/*
+ * Decompress and return some data in the single-pass case.
+ * Always attempts to emit one fully interleaved MCU row ("iMCU" row).
+ * Input and output must run in lockstep since we have only a one-MCU buffer.
+ * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
+ *
+ * NB: output_buf contains a plane for each component in image,
+ * which we index according to the component's SOF position.
+ */
+
+METHODDEF(int)
+decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION MCU_col_num;	/* index of current MCU within row */
+  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
+  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
+  int blkn, ci, xindex, yindex, yoffset, useful_width;
+  JSAMPARRAY output_ptr;
+  JDIMENSION start_col, output_col;
+  jpeg_component_info *compptr;
+  inverse_DCT_method_ptr inverse_DCT;
+
+  /* Loop to process as much as one whole iMCU row */
+  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
+       yoffset++) {
+    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
+	 MCU_col_num++) {
+      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
+      jzero_far((void FAR *) coef->MCU_buffer[0],
+		(size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));
+      if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
+	/* Suspension forced; update state counters and exit */
+	coef->MCU_vert_offset = yoffset;
+	coef->MCU_ctr = MCU_col_num;
+	return JPEG_SUSPENDED;
+      }
+      /* Determine where data should go in output_buf and do the IDCT thing.
+       * We skip dummy blocks at the right and bottom edges (but blkn gets
+       * incremented past them!).  Note the inner loop relies on having
+       * allocated the MCU_buffer[] blocks sequentially.
+       */
+      blkn = 0;			/* index of current DCT block within MCU */
+      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+	compptr = cinfo->cur_comp_info[ci];
+	/* Don't bother to IDCT an uninteresting component. */
+	if (! compptr->component_needed) {
+	  blkn += compptr->MCU_blocks;
+	  continue;
+	}
+	inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
+	useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
+						    : compptr->last_col_width;
+	output_ptr = output_buf[compptr->component_index] +
+	  yoffset * compptr->DCT_scaled_size;
+	start_col = MCU_col_num * compptr->MCU_sample_width;
+	for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
+	  if (cinfo->input_iMCU_row < last_iMCU_row ||
+	      yoffset+yindex < compptr->last_row_height) {
+	    output_col = start_col;
+	    for (xindex = 0; xindex < useful_width; xindex++) {
+	      (*inverse_DCT) (cinfo, compptr,
+			      (JCOEFPTR) coef->MCU_buffer[blkn+xindex],
+			      output_ptr, output_col);
+	      output_col += compptr->DCT_scaled_size;
+	    }
+	  }
+	  blkn += compptr->MCU_width;
+	  output_ptr += compptr->DCT_scaled_size;
+	}
+      }
+    }
+    /* Completed an MCU row, but perhaps not an iMCU row */
+    coef->MCU_ctr = 0;
+  }
+  /* Completed the iMCU row, advance counters for next one */
+  cinfo->output_iMCU_row++;
+  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
+    start_iMCU_row(cinfo);
+    return JPEG_ROW_COMPLETED;
+  }
+  /* Completed the scan */
+  (*cinfo->inputctl->finish_input_pass) (cinfo);
+  return JPEG_SCAN_COMPLETED;
+}
+
+
+/*
+ * Dummy consume-input routine for single-pass operation.
+ */
+
+METHODDEF(int)
+dummy_consume_data (j_decompress_ptr cinfo)
+{
+  return JPEG_SUSPENDED;	/* Always indicate nothing was done */
+}
+
+
+#ifdef D_MULTISCAN_FILES_SUPPORTED
+
+/*
+ * Consume input data and store it in the full-image coefficient buffer.
+ * We read as much as one fully interleaved MCU row ("iMCU" row) per call,
+ * ie, v_samp_factor block rows for each component in the scan.
+ * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
+ */
+
+METHODDEF(int)
+consume_data (j_decompress_ptr cinfo)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION MCU_col_num;	/* index of current MCU within row */
+  int blkn, ci, xindex, yindex, yoffset;
+  JDIMENSION start_col;
+  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
+  JBLOCKROW buffer_ptr;
+  jpeg_component_info *compptr;
+
+  /* Align the virtual buffers for the components used in this scan. */
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    buffer[ci] = (*cinfo->mem->access_virt_barray)
+      ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
+       cinfo->input_iMCU_row * compptr->v_samp_factor,
+       (JDIMENSION) compptr->v_samp_factor, TRUE);
+    /* Note: entropy decoder expects buffer to be zeroed,
+     * but this is handled automatically by the memory manager
+     * because we requested a pre-zeroed array.
+     */
+  }
+
+  /* Loop to process one whole iMCU row */
+  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
+       yoffset++) {
+    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
+	 MCU_col_num++) {
+      /* Construct list of pointers to DCT blocks belonging to this MCU */
+      blkn = 0;			/* index of current DCT block within MCU */
+      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+	compptr = cinfo->cur_comp_info[ci];
+	start_col = MCU_col_num * compptr->MCU_width;
+	for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
+	  buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
+	  for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
+	    coef->MCU_buffer[blkn++] = buffer_ptr++;
+	  }
+	}
+      }
+      /* Try to fetch the MCU. */
+      if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
+	/* Suspension forced; update state counters and exit */
+	coef->MCU_vert_offset = yoffset;
+	coef->MCU_ctr = MCU_col_num;
+	return JPEG_SUSPENDED;
+      }
+    }
+    /* Completed an MCU row, but perhaps not an iMCU row */
+    coef->MCU_ctr = 0;
+  }
+  /* Completed the iMCU row, advance counters for next one */
+  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
+    start_iMCU_row(cinfo);
+    return JPEG_ROW_COMPLETED;
+  }
+  /* Completed the scan */
+  (*cinfo->inputctl->finish_input_pass) (cinfo);
+  return JPEG_SCAN_COMPLETED;
+}
+
+
+/*
+ * Decompress and return some data in the multi-pass case.
+ * Always attempts to emit one fully interleaved MCU row ("iMCU" row).
+ * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
+ *
+ * NB: output_buf contains a plane for each component in image.
+ */
+
+METHODDEF(int)
+decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
+  JDIMENSION block_num;
+  int ci, block_row, block_rows;
+  JBLOCKARRAY buffer;
+  JBLOCKROW buffer_ptr;
+  JSAMPARRAY output_ptr;
+  JDIMENSION output_col;
+  jpeg_component_info *compptr;
+  inverse_DCT_method_ptr inverse_DCT;
+
+  /* Force some input to be done if we are getting ahead of the input. */
+  while (cinfo->input_scan_number < cinfo->output_scan_number ||
+	 (cinfo->input_scan_number == cinfo->output_scan_number &&
+	  cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
+    if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
+      return JPEG_SUSPENDED;
+  }
+
+  /* OK, output from the virtual arrays. */
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Don't bother to IDCT an uninteresting component. */
+    if (! compptr->component_needed)
+      continue;
+    /* Align the virtual buffer for this component. */
+    buffer = (*cinfo->mem->access_virt_barray)
+      ((j_common_ptr) cinfo, coef->whole_image[ci],
+       cinfo->output_iMCU_row * compptr->v_samp_factor,
+       (JDIMENSION) compptr->v_samp_factor, FALSE);
+    /* Count non-dummy DCT block rows in this iMCU row. */
+    if (cinfo->output_iMCU_row < last_iMCU_row)
+      block_rows = compptr->v_samp_factor;
+    else {
+      /* NB: can't use last_row_height here; it is input-side-dependent! */
+      block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+      if (block_rows == 0) block_rows = compptr->v_samp_factor;
+    }
+    inverse_DCT = cinfo->idct->inverse_DCT[ci];
+    output_ptr = output_buf[ci];
+    /* Loop over all DCT blocks to be processed. */
+    for (block_row = 0; block_row < block_rows; block_row++) {
+      buffer_ptr = buffer[block_row];
+      output_col = 0;
+      for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) {
+	(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr,
+			output_ptr, output_col);
+	buffer_ptr++;
+	output_col += compptr->DCT_scaled_size;
+      }
+      output_ptr += compptr->DCT_scaled_size;
+    }
+  }
+
+  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
+    return JPEG_ROW_COMPLETED;
+  return JPEG_SCAN_COMPLETED;
+}
+
+#endif /* D_MULTISCAN_FILES_SUPPORTED */
+
+
+#ifdef BLOCK_SMOOTHING_SUPPORTED
+
+/*
+ * This code applies interblock smoothing as described by section K.8
+ * of the JPEG standard: the first 5 AC coefficients are estimated from
+ * the DC values of a DCT block and its 8 neighboring blocks.
+ * We apply smoothing only for progressive JPEG decoding, and only if
+ * the coefficients it can estimate are not yet known to full precision.
+ */
+
+/* Natural-order array positions of the first 5 zigzag-order coefficients */
+#define Q01_POS  1
+#define Q10_POS  8
+#define Q20_POS  16
+#define Q11_POS  9
+#define Q02_POS  2
+
+/*
+ * Determine whether block smoothing is applicable and safe.
+ * We also latch the current states of the coef_bits[] entries for the
+ * AC coefficients; otherwise, if the input side of the decompressor
+ * advances into a new scan, we might think the coefficients are known
+ * more accurately than they really are.
+ */
+
+LOCAL(boolean)
+smoothing_ok (j_decompress_ptr cinfo)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  boolean smoothing_useful = FALSE;
+  int ci, coefi;
+  jpeg_component_info *compptr;
+  JQUANT_TBL * qtable;
+  int * coef_bits;
+  int * coef_bits_latch;
+
+  if (! cinfo->progressive_mode || cinfo->coef_bits == NULL)
+    return FALSE;
+
+  /* Allocate latch area if not already done */
+  if (coef->coef_bits_latch == NULL)
+    coef->coef_bits_latch = (int *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  cinfo->num_components *
+				  (SAVED_COEFS * SIZEOF(int)));
+  coef_bits_latch = coef->coef_bits_latch;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* All components' quantization values must already be latched. */
+    if ((qtable = compptr->quant_table) == NULL)
+      return FALSE;
+    /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */
+    if (qtable->quantval[0] == 0 ||
+	qtable->quantval[Q01_POS] == 0 ||
+	qtable->quantval[Q10_POS] == 0 ||
+	qtable->quantval[Q20_POS] == 0 ||
+	qtable->quantval[Q11_POS] == 0 ||
+	qtable->quantval[Q02_POS] == 0)
+      return FALSE;
+    /* DC values must be at least partly known for all components. */
+    coef_bits = cinfo->coef_bits[ci];
+    if (coef_bits[0] < 0)
+      return FALSE;
+    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
+    for (coefi = 1; coefi <= 5; coefi++) {
+      coef_bits_latch[coefi] = coef_bits[coefi];
+      if (coef_bits[coefi] != 0)
+	smoothing_useful = TRUE;
+    }
+    coef_bits_latch += SAVED_COEFS;
+  }
+
+  return smoothing_useful;
+}
+
+
+/*
+ * Variant of decompress_data for use when doing block smoothing.
+ */
+
+METHODDEF(int)
+decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
+{
+  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
+  JDIMENSION block_num, last_block_column;
+  int ci, block_row, block_rows, access_rows;
+  JBLOCKARRAY buffer;
+  JBLOCKROW buffer_ptr, prev_block_row, next_block_row;
+  JSAMPARRAY output_ptr;
+  JDIMENSION output_col;
+  jpeg_component_info *compptr;
+  inverse_DCT_method_ptr inverse_DCT;
+  boolean first_row, last_row;
+  JBLOCK workspace;
+  int *coef_bits;
+  JQUANT_TBL *quanttbl;
+  INT32 Q00,Q01,Q02,Q10,Q11,Q20, num;
+  int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9;
+  int Al, pred;
+
+  /* Force some input to be done if we are getting ahead of the input. */
+  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
+	 ! cinfo->inputctl->eoi_reached) {
+    if (cinfo->input_scan_number == cinfo->output_scan_number) {
+      /* If input is working on current scan, we ordinarily want it to
+       * have completed the current row.  But if input scan is DC,
+       * we want it to keep one row ahead so that next block row's DC
+       * values are up to date.
+       */
+      JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0;
+      if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta)
+	break;
+    }
+    if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
+      return JPEG_SUSPENDED;
+  }
+
+  /* OK, output from the virtual arrays. */
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Don't bother to IDCT an uninteresting component. */
+    if (! compptr->component_needed)
+      continue;
+    /* Count non-dummy DCT block rows in this iMCU row. */
+    if (cinfo->output_iMCU_row < last_iMCU_row) {
+      block_rows = compptr->v_samp_factor;
+      access_rows = block_rows * 2; /* this and next iMCU row */
+      last_row = FALSE;
+    } else {
+      /* NB: can't use last_row_height here; it is input-side-dependent! */
+      block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+      if (block_rows == 0) block_rows = compptr->v_samp_factor;
+      access_rows = block_rows; /* this iMCU row only */
+      last_row = TRUE;
+    }
+    /* Align the virtual buffer for this component. */
+    if (cinfo->output_iMCU_row > 0) {
+      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
+      buffer = (*cinfo->mem->access_virt_barray)
+	((j_common_ptr) cinfo, coef->whole_image[ci],
+	 (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
+	 (JDIMENSION) access_rows, FALSE);
+      buffer += compptr->v_samp_factor;	/* point to current iMCU row */
+      first_row = FALSE;
+    } else {
+      buffer = (*cinfo->mem->access_virt_barray)
+	((j_common_ptr) cinfo, coef->whole_image[ci],
+	 (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE);
+      first_row = TRUE;
+    }
+    /* Fetch component-dependent info */
+    coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
+    quanttbl = compptr->quant_table;
+    Q00 = quanttbl->quantval[0];
+    Q01 = quanttbl->quantval[Q01_POS];
+    Q10 = quanttbl->quantval[Q10_POS];
+    Q20 = quanttbl->quantval[Q20_POS];
+    Q11 = quanttbl->quantval[Q11_POS];
+    Q02 = quanttbl->quantval[Q02_POS];
+    inverse_DCT = cinfo->idct->inverse_DCT[ci];
+    output_ptr = output_buf[ci];
+    /* Loop over all DCT blocks to be processed. */
+    for (block_row = 0; block_row < block_rows; block_row++) {
+      buffer_ptr = buffer[block_row];
+      if (first_row && block_row == 0)
+	prev_block_row = buffer_ptr;
+      else
+	prev_block_row = buffer[block_row-1];
+      if (last_row && block_row == block_rows-1)
+	next_block_row = buffer_ptr;
+      else
+	next_block_row = buffer[block_row+1];
+      /* We fetch the surrounding DC values using a sliding-register approach.
+       * Initialize all nine here so as to do the right thing on narrow pics.
+       */
+      DC1 = DC2 = DC3 = (int) prev_block_row[0][0];
+      DC4 = DC5 = DC6 = (int) buffer_ptr[0][0];
+      DC7 = DC8 = DC9 = (int) next_block_row[0][0];
+      output_col = 0;
+      last_block_column = compptr->width_in_blocks - 1;
+      for (block_num = 0; block_num <= last_block_column; block_num++) {
+	/* Fetch current DCT block into workspace so we can modify it. */
+	jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1);
+	/* Update DC values */
+	if (block_num < last_block_column) {
+	  DC3 = (int) prev_block_row[1][0];
+	  DC6 = (int) buffer_ptr[1][0];
+	  DC9 = (int) next_block_row[1][0];
+	}
+	/* Compute coefficient estimates per K.8.
+	 * An estimate is applied only if coefficient is still zero,
+	 * and is not known to be fully accurate.
+	 */
+	/* AC01 */
+	if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) {
+	  num = 36 * Q00 * (DC4 - DC6);
+	  if (num >= 0) {
+	    pred = (int) (((Q01<<7) + num) / (Q01<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	  } else {
+	    pred = (int) (((Q01<<7) - num) / (Q01<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	    pred = -pred;
+	  }
+	  workspace[1] = (JCOEF) pred;
+	}
+	/* AC10 */
+	if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) {
+	  num = 36 * Q00 * (DC2 - DC8);
+	  if (num >= 0) {
+	    pred = (int) (((Q10<<7) + num) / (Q10<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	  } else {
+	    pred = (int) (((Q10<<7) - num) / (Q10<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	    pred = -pred;
+	  }
+	  workspace[8] = (JCOEF) pred;
+	}
+	/* AC20 */
+	if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) {
+	  num = 9 * Q00 * (DC2 + DC8 - 2*DC5);
+	  if (num >= 0) {
+	    pred = (int) (((Q20<<7) + num) / (Q20<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	  } else {
+	    pred = (int) (((Q20<<7) - num) / (Q20<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	    pred = -pred;
+	  }
+	  workspace[16] = (JCOEF) pred;
+	}
+	/* AC11 */
+	if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) {
+	  num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9);
+	  if (num >= 0) {
+	    pred = (int) (((Q11<<7) + num) / (Q11<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	  } else {
+	    pred = (int) (((Q11<<7) - num) / (Q11<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	    pred = -pred;
+	  }
+	  workspace[9] = (JCOEF) pred;
+	}
+	/* AC02 */
+	if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) {
+	  num = 9 * Q00 * (DC4 + DC6 - 2*DC5);
+	  if (num >= 0) {
+	    pred = (int) (((Q02<<7) + num) / (Q02<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	  } else {
+	    pred = (int) (((Q02<<7) - num) / (Q02<<8));
+	    if (Al > 0 && pred >= (1<<Al))
+	      pred = (1<<Al)-1;
+	    pred = -pred;
+	  }
+	  workspace[2] = (JCOEF) pred;
+	}
+	/* OK, do the IDCT */
+	(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace,
+			output_ptr, output_col);
+	/* Advance for next column */
+	DC1 = DC2; DC2 = DC3;
+	DC4 = DC5; DC5 = DC6;
+	DC7 = DC8; DC8 = DC9;
+	buffer_ptr++, prev_block_row++, next_block_row++;
+	output_col += compptr->DCT_scaled_size;
+      }
+      output_ptr += compptr->DCT_scaled_size;
+    }
+  }
+
+  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
+    return JPEG_ROW_COMPLETED;
+  return JPEG_SCAN_COMPLETED;
+}
+
+#endif /* BLOCK_SMOOTHING_SUPPORTED */
+
+
+/*
+ * Initialize coefficient buffer controller.
+ */
+
+GLOBAL(void)
+jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
+{
+  my_coef_ptr coef;
+
+  coef = (my_coef_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_coef_controller));
+  cinfo->coef = (struct jpeg_d_coef_controller *) coef;
+  coef->pub.start_input_pass = start_input_pass;
+  coef->pub.start_output_pass = start_output_pass;
+#ifdef BLOCK_SMOOTHING_SUPPORTED
+  coef->coef_bits_latch = NULL;
+#endif
+
+  /* Create the coefficient buffer. */
+  if (need_full_buffer) {
+#ifdef D_MULTISCAN_FILES_SUPPORTED
+    /* Allocate a full-image virtual array for each component, */
+    /* padded to a multiple of samp_factor DCT blocks in each direction. */
+    /* Note we ask for a pre-zeroed array. */
+    int ci, access_rows;
+    jpeg_component_info *compptr;
+
+    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	 ci++, compptr++) {
+      access_rows = compptr->v_samp_factor;
+#ifdef BLOCK_SMOOTHING_SUPPORTED
+      /* If block smoothing could be used, need a bigger window */
+      if (cinfo->progressive_mode)
+	access_rows *= 3;
+#endif
+      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
+	((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,
+	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
+				(long) compptr->h_samp_factor),
+	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
+				(long) compptr->v_samp_factor),
+	 (JDIMENSION) access_rows);
+    }
+    coef->pub.consume_data = consume_data;
+    coef->pub.decompress_data = decompress_data;
+    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
+#else
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+  } else {
+    /* We only need a single-MCU buffer. */
+    JBLOCKROW buffer;
+    int i;
+
+    buffer = (JBLOCKROW)
+      (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
+    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
+      coef->MCU_buffer[i] = buffer + i;
+    }
+    coef->pub.consume_data = dummy_consume_data;
+    coef->pub.decompress_data = decompress_onepass;
+    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdcolor.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdcolor.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdcolor.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,396 @@
+/*
+ * jdcolor.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains output colorspace conversion routines.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Private subobject */
+
+typedef struct {
+  struct jpeg_color_deconverter pub; /* public fields */
+
+  /* Private state for YCC->RGB conversion */
+  int * Cr_r_tab;		/* => table for Cr to R conversion */
+  int * Cb_b_tab;		/* => table for Cb to B conversion */
+  INT32 * Cr_g_tab;		/* => table for Cr to G conversion */
+  INT32 * Cb_g_tab;		/* => table for Cb to G conversion */
+} my_color_deconverter;
+
+typedef my_color_deconverter * my_cconvert_ptr;
+
+
+/**************** YCbCr -> RGB conversion: most common case **************/
+
+/*
+ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
+ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
+ * The conversion equations to be implemented are therefore
+ *	R = Y                + 1.40200 * Cr
+ *	G = Y - 0.34414 * Cb - 0.71414 * Cr
+ *	B = Y + 1.77200 * Cb
+ * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
+ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
+ *
+ * To avoid floating-point arithmetic, we represent the fractional constants
+ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
+ * the products by 2^16, with appropriate rounding, to get the correct answer.
+ * Notice that Y, being an integral input, does not contribute any fraction
+ * so it need not participate in the rounding.
+ *
+ * For even more speed, we avoid doing any multiplications in the inner loop
+ * by precalculating the constants times Cb and Cr for all possible values.
+ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
+ * for 12-bit samples it is still acceptable.  It's not very reasonable for
+ * 16-bit samples, but if you want lossless storage you shouldn't be changing
+ * colorspace anyway.
+ * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
+ * values for the G calculation are left scaled up, since we must add them
+ * together before rounding.
+ */
+
+#define SCALEBITS	16	/* speediest right-shift on some machines */
+#define ONE_HALF	((INT32) 1 << (SCALEBITS-1))
+#define FIX(x)		((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
+
+
+/*
+ * Initialize tables for YCC->RGB colorspace conversion.
+ */
+
+LOCAL(void)
+build_ycc_rgb_table (j_decompress_ptr cinfo)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  int i;
+  INT32 x;
+  SHIFT_TEMPS
+
+  cconvert->Cr_r_tab = (int *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(MAXJSAMPLE+1) * SIZEOF(int));
+  cconvert->Cb_b_tab = (int *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(MAXJSAMPLE+1) * SIZEOF(int));
+  cconvert->Cr_g_tab = (INT32 *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(MAXJSAMPLE+1) * SIZEOF(INT32));
+  cconvert->Cb_g_tab = (INT32 *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(MAXJSAMPLE+1) * SIZEOF(INT32));
+
+  for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
+    /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
+    /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
+    /* Cr=>R value is nearest int to 1.40200 * x */
+    cconvert->Cr_r_tab[i] = (int)
+		    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
+    /* Cb=>B value is nearest int to 1.77200 * x */
+    cconvert->Cb_b_tab[i] = (int)
+		    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
+    /* Cr=>G value is scaled-up -0.71414 * x */
+    cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x;
+    /* Cb=>G value is scaled-up -0.34414 * x */
+    /* We also add in ONE_HALF so that need not do it in inner loop */
+    cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;
+  }
+}
+
+
+/*
+ * Convert some rows of samples to the output colorspace.
+ *
+ * Note that we change from noninterleaved, one-plane-per-component format
+ * to interleaved-pixel format.  The output buffer is therefore three times
+ * as wide as the input buffer.
+ * A starting row offset is provided only for the input buffer.  The caller
+ * can easily adjust the passed output_buf value to accommodate any row
+ * offset required on that side.
+ */
+
+METHODDEF(void)
+ycc_rgb_convert (j_decompress_ptr cinfo,
+		 JSAMPIMAGE input_buf, JDIMENSION input_row,
+		 JSAMPARRAY output_buf, int num_rows)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  register int y, cb, cr;
+  register JSAMPROW outptr;
+  register JSAMPROW inptr0, inptr1, inptr2;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->output_width;
+  /* copy these pointers into registers if possible */
+  register JSAMPLE * range_limit = cinfo->sample_range_limit;
+  register int * Crrtab = cconvert->Cr_r_tab;
+  register int * Cbbtab = cconvert->Cb_b_tab;
+  register INT32 * Crgtab = cconvert->Cr_g_tab;
+  register INT32 * Cbgtab = cconvert->Cb_g_tab;
+  SHIFT_TEMPS
+
+  while (--num_rows >= 0) {
+    inptr0 = input_buf[0][input_row];
+    inptr1 = input_buf[1][input_row];
+    inptr2 = input_buf[2][input_row];
+    input_row++;
+    outptr = *output_buf++;
+    for (col = 0; col < num_cols; col++) {
+      y  = GETJSAMPLE(inptr0[col]);
+      cb = GETJSAMPLE(inptr1[col]);
+      cr = GETJSAMPLE(inptr2[col]);
+      /* Range-limiting is essential due to noise introduced by DCT losses. */
+      outptr[RGB_RED] =   range_limit[y + Crrtab[cr]];
+      outptr[RGB_GREEN] = range_limit[y +
+			      ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
+						 SCALEBITS))];
+      outptr[RGB_BLUE] =  range_limit[y + Cbbtab[cb]];
+      outptr += RGB_PIXELSIZE;
+    }
+  }
+}
+
+
+/**************** Cases other than YCbCr -> RGB **************/
+
+
+/*
+ * Color conversion for no colorspace change: just copy the data,
+ * converting from separate-planes to interleaved representation.
+ */
+
+METHODDEF(void)
+null_convert (j_decompress_ptr cinfo,
+	      JSAMPIMAGE input_buf, JDIMENSION input_row,
+	      JSAMPARRAY output_buf, int num_rows)
+{
+  register JSAMPROW inptr, outptr;
+  register JDIMENSION count;
+  register int num_components = cinfo->num_components;
+  JDIMENSION num_cols = cinfo->output_width;
+  int ci;
+
+  while (--num_rows >= 0) {
+    for (ci = 0; ci < num_components; ci++) {
+      inptr = input_buf[ci][input_row];
+      outptr = output_buf[0] + ci;
+      for (count = num_cols; count > 0; count--) {
+	*outptr = *inptr++;	/* needn't bother with GETJSAMPLE() here */
+	outptr += num_components;
+      }
+    }
+    input_row++;
+    output_buf++;
+  }
+}
+
+
+/*
+ * Color conversion for grayscale: just copy the data.
+ * This also works for YCbCr -> grayscale conversion, in which
+ * we just copy the Y (luminance) component and ignore chrominance.
+ */
+
+METHODDEF(void)
+grayscale_convert (j_decompress_ptr cinfo,
+		   JSAMPIMAGE input_buf, JDIMENSION input_row,
+		   JSAMPARRAY output_buf, int num_rows)
+{
+  jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0,
+		    num_rows, cinfo->output_width);
+}
+
+
+/*
+ * Convert grayscale to RGB: just duplicate the graylevel three times.
+ * This is provided to support applications that don't want to cope
+ * with grayscale as a separate case.
+ */
+
+METHODDEF(void)
+gray_rgb_convert (j_decompress_ptr cinfo,
+		  JSAMPIMAGE input_buf, JDIMENSION input_row,
+		  JSAMPARRAY output_buf, int num_rows)
+{
+  register JSAMPROW inptr, outptr;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->output_width;
+
+  while (--num_rows >= 0) {
+    inptr = input_buf[0][input_row++];
+    outptr = *output_buf++;
+    for (col = 0; col < num_cols; col++) {
+      /* We can dispense with GETJSAMPLE() here */
+      outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
+      outptr += RGB_PIXELSIZE;
+    }
+  }
+}
+
+
+/*
+ * Adobe-style YCCK->CMYK conversion.
+ * We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same
+ * conversion as above, while passing K (black) unchanged.
+ * We assume build_ycc_rgb_table has been called.
+ */
+
+METHODDEF(void)
+ycck_cmyk_convert (j_decompress_ptr cinfo,
+		   JSAMPIMAGE input_buf, JDIMENSION input_row,
+		   JSAMPARRAY output_buf, int num_rows)
+{
+  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+  register int y, cb, cr;
+  register JSAMPROW outptr;
+  register JSAMPROW inptr0, inptr1, inptr2, inptr3;
+  register JDIMENSION col;
+  JDIMENSION num_cols = cinfo->output_width;
+  /* copy these pointers into registers if possible */
+  register JSAMPLE * range_limit = cinfo->sample_range_limit;
+  register int * Crrtab = cconvert->Cr_r_tab;
+  register int * Cbbtab = cconvert->Cb_b_tab;
+  register INT32 * Crgtab = cconvert->Cr_g_tab;
+  register INT32 * Cbgtab = cconvert->Cb_g_tab;
+  SHIFT_TEMPS
+
+  while (--num_rows >= 0) {
+    inptr0 = input_buf[0][input_row];
+    inptr1 = input_buf[1][input_row];
+    inptr2 = input_buf[2][input_row];
+    inptr3 = input_buf[3][input_row];
+    input_row++;
+    outptr = *output_buf++;
+    for (col = 0; col < num_cols; col++) {
+      y  = GETJSAMPLE(inptr0[col]);
+      cb = GETJSAMPLE(inptr1[col]);
+      cr = GETJSAMPLE(inptr2[col]);
+      /* Range-limiting is essential due to noise introduced by DCT losses. */
+      outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])];	/* red */
+      outptr[1] = range_limit[MAXJSAMPLE - (y +			/* green */
+			      ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
+						 SCALEBITS)))];
+      outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])];	/* blue */
+      /* K passes through unchanged */
+      outptr[3] = inptr3[col];	/* don't need GETJSAMPLE here */
+      outptr += 4;
+    }
+  }
+}
+
+
+/*
+ * Empty method for start_pass.
+ */
+
+METHODDEF(void)
+start_pass_dcolor (j_decompress_ptr cinfo)
+{
+  /* no work needed */
+}
+
+
+/*
+ * Module initialization routine for output colorspace conversion.
+ */
+
+GLOBAL(void)
+jinit_color_deconverter (j_decompress_ptr cinfo)
+{
+  my_cconvert_ptr cconvert;
+  int ci;
+
+  cconvert = (my_cconvert_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_color_deconverter));
+  cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert;
+  cconvert->pub.start_pass = start_pass_dcolor;
+
+  /* Make sure num_components agrees with jpeg_color_space */
+  switch (cinfo->jpeg_color_space) {
+  case JCS_GRAYSCALE:
+    if (cinfo->num_components != 1)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    break;
+
+  case JCS_RGB:
+  case JCS_YCbCr:
+    if (cinfo->num_components != 3)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    break;
+
+  case JCS_CMYK:
+  case JCS_YCCK:
+    if (cinfo->num_components != 4)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    break;
+
+  default:			/* JCS_UNKNOWN can be anything */
+    if (cinfo->num_components < 1)
+      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
+    break;
+  }
+
+  /* Set out_color_components and conversion method based on requested space.
+   * Also clear the component_needed flags for any unused components,
+   * so that earlier pipeline stages can avoid useless computation.
+   */
+
+  switch (cinfo->out_color_space) {
+  case JCS_GRAYSCALE:
+    cinfo->out_color_components = 1;
+    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
+	cinfo->jpeg_color_space == JCS_YCbCr) {
+      cconvert->pub.color_convert = grayscale_convert;
+      /* For color->grayscale conversion, only the Y (0) component is needed */
+      for (ci = 1; ci < cinfo->num_components; ci++)
+	cinfo->comp_info[ci].component_needed = FALSE;
+    } else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_RGB:
+    cinfo->out_color_components = RGB_PIXELSIZE;
+    if (cinfo->jpeg_color_space == JCS_YCbCr) {
+      cconvert->pub.color_convert = ycc_rgb_convert;
+      build_ycc_rgb_table(cinfo);
+    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
+      cconvert->pub.color_convert = gray_rgb_convert;
+    } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) {
+      cconvert->pub.color_convert = null_convert;
+    } else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  case JCS_CMYK:
+    cinfo->out_color_components = 4;
+    if (cinfo->jpeg_color_space == JCS_YCCK) {
+      cconvert->pub.color_convert = ycck_cmyk_convert;
+      build_ycc_rgb_table(cinfo);
+    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
+      cconvert->pub.color_convert = null_convert;
+    } else
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+
+  default:
+    /* Permit null conversion to same output space */
+    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
+      cinfo->out_color_components = cinfo->num_components;
+      cconvert->pub.color_convert = null_convert;
+    } else			/* unsupported non-null conversion */
+      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
+    break;
+  }
+
+  if (cinfo->quantize_colors)
+    cinfo->output_components = 1; /* single colormapped output component */
+  else
+    cinfo->output_components = cinfo->out_color_components;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdct.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdct.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdct.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,176 @@
+/*
+ * jdct.h
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This include file contains common declarations for the forward and
+ * inverse DCT modules.  These declarations are private to the DCT managers
+ * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.
+ * The individual DCT algorithms are kept in separate files to ease 
+ * machine-dependent tuning (e.g., assembly coding).
+ */
+
+
+/*
+ * A forward DCT routine is given a pointer to a work area of type DCTELEM[];
+ * the DCT is to be performed in-place in that buffer.  Type DCTELEM is int
+ * for 8-bit samples, INT32 for 12-bit samples.  (NOTE: Floating-point DCT
+ * implementations use an array of type FAST_FLOAT, instead.)
+ * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE).
+ * The DCT outputs are returned scaled up by a factor of 8; they therefore
+ * have a range of +-8K for 8-bit data, +-128K for 12-bit data.  This
+ * convention improves accuracy in integer implementations and saves some
+ * work in floating-point ones.
+ * Quantization of the output coefficients is done by jcdctmgr.c.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+typedef int DCTELEM;		/* 16 or 32 bits is fine */
+#else
+typedef INT32 DCTELEM;		/* must have 32 bits */
+#endif
+
+typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data));
+typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data));
+
+
+/*
+ * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer
+ * to an output sample array.  The routine must dequantize the input data as
+ * well as perform the IDCT; for dequantization, it uses the multiplier table
+ * pointed to by compptr->dct_table.  The output data is to be placed into the
+ * sample array starting at a specified column.  (Any row offset needed will
+ * be applied to the array pointer before it is passed to the IDCT code.)
+ * Note that the number of samples emitted by the IDCT routine is
+ * DCT_scaled_size * DCT_scaled_size.
+ */
+
+/* typedef inverse_DCT_method_ptr is declared in jpegint.h */
+
+/*
+ * Each IDCT routine has its own ideas about the best dct_table element type.
+ */
+
+typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
+#if BITS_IN_JSAMPLE == 8
+typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
+#define IFAST_SCALE_BITS  2	/* fractional bits in scale factors */
+#else
+typedef INT32 IFAST_MULT_TYPE;	/* need 32 bits for scaled quantizers */
+#define IFAST_SCALE_BITS  13	/* fractional bits in scale factors */
+#endif
+typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
+
+
+/*
+ * Each IDCT routine is responsible for range-limiting its results and
+ * converting them to unsigned form (0..MAXJSAMPLE).  The raw outputs could
+ * be quite far out of range if the input data is corrupt, so a bulletproof
+ * range-limiting step is required.  We use a mask-and-table-lookup method
+ * to do the combined operations quickly.  See the comments with
+ * prepare_range_limit_table (in jdmaster.c) for more info.
+ */
+
+#define IDCT_range_limit(cinfo)  ((cinfo)->sample_range_limit + CENTERJSAMPLE)
+
+#define RANGE_MASK  (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
+
+
+/* Short forms of external names for systems with brain-damaged linkers. */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jpeg_fdct_islow		jFDislow
+#define jpeg_fdct_ifast		jFDifast
+#define jpeg_fdct_float		jFDfloat
+#define jpeg_idct_islow		jRDislow
+#define jpeg_idct_ifast		jRDifast
+#define jpeg_idct_float		jRDfloat
+#define jpeg_idct_4x4		jRD4x4
+#define jpeg_idct_2x2		jRD2x2
+#define jpeg_idct_1x1		jRD1x1
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+/* Extern declarations for the forward and inverse DCT routines. */
+
+EXTERN(void) jpeg_fdct_islow JPP((DCTELEM * data));
+EXTERN(void) jpeg_fdct_ifast JPP((DCTELEM * data));
+EXTERN(void) jpeg_fdct_float JPP((FAST_FLOAT * data));
+
+EXTERN(void) jpeg_idct_islow
+    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
+EXTERN(void) jpeg_idct_ifast
+    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
+EXTERN(void) jpeg_idct_float
+    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
+EXTERN(void) jpeg_idct_4x4
+    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
+EXTERN(void) jpeg_idct_2x2
+    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
+EXTERN(void) jpeg_idct_1x1
+    JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
+
+
+/*
+ * Macros for handling fixed-point arithmetic; these are used by many
+ * but not all of the DCT/IDCT modules.
+ *
+ * All values are expected to be of type INT32.
+ * Fractional constants are scaled left by CONST_BITS bits.
+ * CONST_BITS is defined within each module using these macros,
+ * and may differ from one module to the next.
+ */
+
+#define ONE	((INT32) 1)
+#define CONST_SCALE (ONE << CONST_BITS)
+
+/* Convert a positive real constant to an integer scaled by CONST_SCALE.
+ * Caution: some C compilers fail to reduce "FIX(constant)" at compile time,
+ * thus causing a lot of useless floating-point operations at run time.
+ */
+
+#define FIX(x)	((INT32) ((x) * CONST_SCALE + 0.5))
+
+/* Descale and correctly round an INT32 value that's scaled by N bits.
+ * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
+ * the fudge factor is correct for either sign of X.
+ */
+
+#define DESCALE(x,n)  RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
+
+/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
+ * This macro is used only when the two inputs will actually be no more than
+ * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a
+ * full 32x32 multiply.  This provides a useful speedup on many machines.
+ * Unfortunately there is no way to specify a 16x16->32 multiply portably
+ * in C, but some C compilers will do the right thing if you provide the
+ * correct combination of casts.
+ */
+
+#ifdef SHORTxSHORT_32		/* may work if 'int' is 32 bits */
+#define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT16) (const)))
+#endif
+#ifdef SHORTxLCONST_32		/* known to work with Microsoft C 6.0 */
+#define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT32) (const)))
+#endif
+
+#ifndef MULTIPLY16C16		/* default definition */
+#define MULTIPLY16C16(var,const)  ((var) * (const))
+#endif
+
+/* Same except both inputs are variables. */
+
+#ifdef SHORTxSHORT_32		/* may work if 'int' is 32 bits */
+#define MULTIPLY16V16(var1,var2)  (((INT16) (var1)) * ((INT16) (var2)))
+#endif
+
+#ifndef MULTIPLY16V16		/* default definition */
+#define MULTIPLY16V16(var1,var2)  ((var1) * (var2))
+#endif

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jddctmgr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jddctmgr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jddctmgr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,269 @@
+/*
+ * jddctmgr.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the inverse-DCT management logic.
+ * This code selects a particular IDCT implementation to be used,
+ * and it performs related housekeeping chores.  No code in this file
+ * is executed per IDCT step, only during output pass setup.
+ *
+ * Note that the IDCT routines are responsible for performing coefficient
+ * dequantization as well as the IDCT proper.  This module sets up the
+ * dequantization multiplier table needed by the IDCT routine.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"		/* Private declarations for DCT subsystem */
+
+
+/*
+ * The decompressor input side (jdinput.c) saves away the appropriate
+ * quantization table for each component at the start of the first scan
+ * involving that component.  (This is necessary in order to correctly
+ * decode files that reuse Q-table slots.)
+ * When we are ready to make an output pass, the saved Q-table is converted
+ * to a multiplier table that will actually be used by the IDCT routine.
+ * The multiplier table contents are IDCT-method-dependent.  To support
+ * application changes in IDCT method between scans, we can remake the
+ * multiplier tables if necessary.
+ * In buffered-image mode, the first output pass may occur before any data
+ * has been seen for some components, and thus before their Q-tables have
+ * been saved away.  To handle this case, multiplier tables are preset
+ * to zeroes; the result of the IDCT will be a neutral gray level.
+ */
+
+
+/* Private subobject for this module */
+
+typedef struct {
+  struct jpeg_inverse_dct pub;	/* public fields */
+
+  /* This array contains the IDCT method code that each multiplier table
+   * is currently set up for, or -1 if it's not yet set up.
+   * The actual multiplier tables are pointed to by dct_table in the
+   * per-component comp_info structures.
+   */
+  int cur_method[MAX_COMPONENTS];
+} my_idct_controller;
+
+typedef my_idct_controller * my_idct_ptr;
+
+
+/* Allocated multiplier tables: big enough for any supported variant */
+
+typedef union {
+  ISLOW_MULT_TYPE islow_array[DCTSIZE2];
+#ifdef DCT_IFAST_SUPPORTED
+  IFAST_MULT_TYPE ifast_array[DCTSIZE2];
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+  FLOAT_MULT_TYPE float_array[DCTSIZE2];
+#endif
+} multiplier_table;
+
+
+/* The current scaled-IDCT routines require ISLOW-style multiplier tables,
+ * so be sure to compile that code if either ISLOW or SCALING is requested.
+ */
+#ifdef DCT_ISLOW_SUPPORTED
+#define PROVIDE_ISLOW_TABLES
+#else
+#ifdef IDCT_SCALING_SUPPORTED
+#define PROVIDE_ISLOW_TABLES
+#endif
+#endif
+
+
+/*
+ * Prepare for an output pass.
+ * Here we select the proper IDCT routine for each component and build
+ * a matching multiplier table.
+ */
+
+METHODDEF(void)
+start_pass (j_decompress_ptr cinfo)
+{
+  my_idct_ptr idct = (my_idct_ptr) cinfo->idct;
+  int ci, i;
+  jpeg_component_info *compptr;
+  int method = 0;
+  inverse_DCT_method_ptr method_ptr = NULL;
+  JQUANT_TBL * qtbl;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Select the proper IDCT routine for this component's scaling */
+    switch (compptr->DCT_scaled_size) {
+#ifdef IDCT_SCALING_SUPPORTED
+    case 1:
+      method_ptr = jpeg_idct_1x1;
+      method = JDCT_ISLOW;	/* jidctred uses islow-style table */
+      break;
+    case 2:
+      method_ptr = jpeg_idct_2x2;
+      method = JDCT_ISLOW;	/* jidctred uses islow-style table */
+      break;
+    case 4:
+      method_ptr = jpeg_idct_4x4;
+      method = JDCT_ISLOW;	/* jidctred uses islow-style table */
+      break;
+#endif
+    case DCTSIZE:
+      switch (cinfo->dct_method) {
+#ifdef DCT_ISLOW_SUPPORTED
+      case JDCT_ISLOW:
+	method_ptr = jpeg_idct_islow;
+	method = JDCT_ISLOW;
+	break;
+#endif
+#ifdef DCT_IFAST_SUPPORTED
+      case JDCT_IFAST:
+	method_ptr = jpeg_idct_ifast;
+	method = JDCT_IFAST;
+	break;
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+      case JDCT_FLOAT:
+	method_ptr = jpeg_idct_float;
+	method = JDCT_FLOAT;
+	break;
+#endif
+      default:
+	ERREXIT(cinfo, JERR_NOT_COMPILED);
+	break;
+      }
+      break;
+    default:
+      ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->DCT_scaled_size);
+      break;
+    }
+    idct->pub.inverse_DCT[ci] = method_ptr;
+    /* Create multiplier table from quant table.
+     * However, we can skip this if the component is uninteresting
+     * or if we already built the table.  Also, if no quant table
+     * has yet been saved for the component, we leave the
+     * multiplier table all-zero; we'll be reading zeroes from the
+     * coefficient controller's buffer anyway.
+     */
+    if (! compptr->component_needed || idct->cur_method[ci] == method)
+      continue;
+    qtbl = compptr->quant_table;
+    if (qtbl == NULL)		/* happens if no data yet for component */
+      continue;
+    idct->cur_method[ci] = method;
+    switch (method) {
+#ifdef PROVIDE_ISLOW_TABLES
+    case JDCT_ISLOW:
+      {
+	/* For LL&M IDCT method, multipliers are equal to raw quantization
+	 * coefficients, but are stored as ints to ensure access efficiency.
+	 */
+	ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table;
+	for (i = 0; i < DCTSIZE2; i++) {
+	  ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i];
+	}
+      }
+      break;
+#endif
+#ifdef DCT_IFAST_SUPPORTED
+    case JDCT_IFAST:
+      {
+	/* For AA&N IDCT method, multipliers are equal to quantization
+	 * coefficients scaled by scalefactor[row]*scalefactor[col], where
+	 *   scalefactor[0] = 1
+	 *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
+	 * For integer operation, the multiplier table is to be scaled by
+	 * IFAST_SCALE_BITS.
+	 */
+	IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table;
+#define CONST_BITS 14
+	static const INT16 aanscales[DCTSIZE2] = {
+	  /* precomputed values scaled up by 14 bits */
+	  16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
+	  22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
+	  21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
+	  19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
+	  16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
+	  12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
+	   8867, 12299, 11585, 10426,  8867,  6967,  4799,  2446,
+	   4520,  6270,  5906,  5315,  4520,  3552,  2446,  1247
+	};
+	SHIFT_TEMPS
+
+	for (i = 0; i < DCTSIZE2; i++) {
+	  ifmtbl[i] = (IFAST_MULT_TYPE)
+	    DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
+				  (INT32) aanscales[i]),
+		    CONST_BITS-IFAST_SCALE_BITS);
+	}
+      }
+      break;
+#endif
+#ifdef DCT_FLOAT_SUPPORTED
+    case JDCT_FLOAT:
+      {
+	/* For float AA&N IDCT method, multipliers are equal to quantization
+	 * coefficients scaled by scalefactor[row]*scalefactor[col], where
+	 *   scalefactor[0] = 1
+	 *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
+	 */
+	FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table;
+	int row, col;
+	static const double aanscalefactor[DCTSIZE] = {
+	  1.0, 1.387039845, 1.306562965, 1.175875602,
+	  1.0, 0.785694958, 0.541196100, 0.275899379
+	};
+
+	i = 0;
+	for (row = 0; row < DCTSIZE; row++) {
+	  for (col = 0; col < DCTSIZE; col++) {
+	    fmtbl[i] = (FLOAT_MULT_TYPE)
+	      ((double) qtbl->quantval[i] *
+	       aanscalefactor[row] * aanscalefactor[col]);
+	    i++;
+	  }
+	}
+      }
+      break;
+#endif
+    default:
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+      break;
+    }
+  }
+}
+
+
+/*
+ * Initialize IDCT manager.
+ */
+
+GLOBAL(void)
+jinit_inverse_dct (j_decompress_ptr cinfo)
+{
+  my_idct_ptr idct;
+  int ci;
+  jpeg_component_info *compptr;
+
+  idct = (my_idct_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_idct_controller));
+  cinfo->idct = (struct jpeg_inverse_dct *) idct;
+  idct->pub.start_pass = start_pass;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Allocate and pre-zero a multiplier table for each component */
+    compptr->dct_table =
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(multiplier_table));
+    MEMZERO(compptr->dct_table, SIZEOF(multiplier_table));
+    /* Mark multiplier table not yet set up for any method */
+    idct->cur_method[ci] = -1;
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdhuff.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdhuff.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdhuff.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,651 @@
+/*
+ * jdhuff.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains Huffman entropy decoding routines.
+ *
+ * Much of the complexity here has to do with supporting input suspension.
+ * If the data source module demands suspension, we want to be able to back
+ * up to the start of the current MCU.  To do this, we copy state variables
+ * into local working storage, and update them back to the permanent
+ * storage only upon successful completion of an MCU.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdhuff.h"		/* Declarations shared with jdphuff.c */
+
+
+/*
+ * Expanded entropy decoder object for Huffman decoding.
+ *
+ * The savable_state subrecord contains fields that change within an MCU,
+ * but must not be updated permanently until we complete the MCU.
+ */
+
+typedef struct {
+  int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
+} savable_state;
+
+/* This macro is to work around compilers with missing or broken
+ * structure assignment.  You'll need to fix this code if you have
+ * such a compiler and you change MAX_COMPS_IN_SCAN.
+ */
+
+#ifndef NO_STRUCT_ASSIGN
+#define ASSIGN_STATE(dest,src)  ((dest) = (src))
+#else
+#if MAX_COMPS_IN_SCAN == 4
+#define ASSIGN_STATE(dest,src)  \
+	((dest).last_dc_val[0] = (src).last_dc_val[0], \
+	 (dest).last_dc_val[1] = (src).last_dc_val[1], \
+	 (dest).last_dc_val[2] = (src).last_dc_val[2], \
+	 (dest).last_dc_val[3] = (src).last_dc_val[3])
+#endif
+#endif
+
+
+typedef struct {
+  struct jpeg_entropy_decoder pub; /* public fields */
+
+  /* These fields are loaded into local variables at start of each MCU.
+   * In case of suspension, we exit WITHOUT updating them.
+   */
+  bitread_perm_state bitstate;	/* Bit buffer at start of MCU */
+  savable_state saved;		/* Other state at start of MCU */
+
+  /* These fields are NOT loaded into local working state. */
+  unsigned int restarts_to_go;	/* MCUs left in this restart interval */
+
+  /* Pointers to derived tables (these workspaces have image lifespan) */
+  d_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS];
+  d_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS];
+
+  /* Precalculated info set up by start_pass for use in decode_mcu: */
+
+  /* Pointers to derived tables to be used for each block within an MCU */
+  d_derived_tbl * dc_cur_tbls[D_MAX_BLOCKS_IN_MCU];
+  d_derived_tbl * ac_cur_tbls[D_MAX_BLOCKS_IN_MCU];
+  /* Whether we care about the DC and AC coefficient values for each block */
+  boolean dc_needed[D_MAX_BLOCKS_IN_MCU];
+  boolean ac_needed[D_MAX_BLOCKS_IN_MCU];
+} huff_entropy_decoder;
+
+typedef huff_entropy_decoder * huff_entropy_ptr;
+
+
+/*
+ * Initialize for a Huffman-compressed scan.
+ */
+
+METHODDEF(void)
+start_pass_huff_decoder (j_decompress_ptr cinfo)
+{
+  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+  int ci, blkn, dctbl, actbl;
+  jpeg_component_info * compptr;
+
+  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
+   * This ought to be an error condition, but we make it a warning because
+   * there are some baseline files out there with all zeroes in these bytes.
+   */
+  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||
+      cinfo->Ah != 0 || cinfo->Al != 0)
+    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
+
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    dctbl = compptr->dc_tbl_no;
+    actbl = compptr->ac_tbl_no;
+    /* Compute derived values for Huffman tables */
+    /* We may do this more than once for a table, but it's not expensive */
+    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
+			    & entropy->dc_derived_tbls[dctbl]);
+    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl,
+			    & entropy->ac_derived_tbls[actbl]);
+    /* Initialize DC predictions to 0 */
+    entropy->saved.last_dc_val[ci] = 0;
+  }
+
+  /* Precalculate decoding info for each block in an MCU of this scan */
+  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+    ci = cinfo->MCU_membership[blkn];
+    compptr = cinfo->cur_comp_info[ci];
+    /* Precalculate which table to use for each block */
+    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
+    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
+    /* Decide whether we really care about the coefficient values */
+    if (compptr->component_needed) {
+      entropy->dc_needed[blkn] = TRUE;
+      /* we don't need the ACs if producing a 1/8th-size image */
+      entropy->ac_needed[blkn] = (compptr->DCT_scaled_size > 1);
+    } else {
+      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
+    }
+  }
+
+  /* Initialize bitread state variables */
+  entropy->bitstate.bits_left = 0;
+  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
+  entropy->pub.insufficient_data = FALSE;
+
+  /* Initialize restart counter */
+  entropy->restarts_to_go = cinfo->restart_interval;
+}
+
+
+/*
+ * Compute the derived values for a Huffman table.
+ * This routine also performs some validation checks on the table.
+ *
+ * Note this is also used by jdphuff.c.
+ */
+
+GLOBAL(void)
+jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
+			 d_derived_tbl ** pdtbl)
+{
+  JHUFF_TBL *htbl;
+  d_derived_tbl *dtbl;
+  int p, i, l, si, numsymbols;
+  int lookbits, ctr;
+  char huffsize[257];
+  unsigned int huffcode[257];
+  unsigned int code;
+
+  /* Note that huffsize[] and huffcode[] are filled in code-length order,
+   * paralleling the order of the symbols themselves in htbl->huffval[].
+   */
+
+  /* Find the input Huffman table */
+  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
+    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
+  htbl =
+    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
+  if (htbl == NULL)
+    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
+
+  /* Allocate a workspace if we haven't already done so. */
+  if (*pdtbl == NULL)
+    *pdtbl = (d_derived_tbl *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(d_derived_tbl));
+  dtbl = *pdtbl;
+  dtbl->pub = htbl;		/* fill in back link */
+  
+  /* Figure C.1: make table of Huffman code length for each symbol */
+
+  p = 0;
+  for (l = 1; l <= 16; l++) {
+    i = (int) htbl->bits[l];
+    if (i < 0 || p + i > 256)	/* protect against table overrun */
+      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+    while (i--)
+      huffsize[p++] = (char) l;
+  }
+  huffsize[p] = 0;
+  numsymbols = p;
+  
+  /* Figure C.2: generate the codes themselves */
+  /* We also validate that the counts represent a legal Huffman code tree. */
+  
+  code = 0;
+  si = huffsize[0];
+  p = 0;
+  while (huffsize[p]) {
+    while (((int) huffsize[p]) == si) {
+      huffcode[p++] = code;
+      code++;
+    }
+    /* code is now 1 more than the last code used for codelength si; but
+     * it must still fit in si bits, since no code is allowed to be all ones.
+     */
+    if (((INT32) code) >= (((INT32) 1) << si))
+      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+    code <<= 1;
+    si++;
+  }
+
+  /* Figure F.15: generate decoding tables for bit-sequential decoding */
+
+  p = 0;
+  for (l = 1; l <= 16; l++) {
+    if (htbl->bits[l]) {
+      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
+       * minus the minimum code of length l
+       */
+      dtbl->valoffset[l] = (INT32) p - (INT32) huffcode[p];
+      p += htbl->bits[l];
+      dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */
+    } else {
+      dtbl->maxcode[l] = -1;	/* -1 if no codes of this length */
+    }
+  }
+  dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */
+
+  /* Compute lookahead tables to speed up decoding.
+   * First we set all the table entries to 0, indicating "too long";
+   * then we iterate through the Huffman codes that are short enough and
+   * fill in all the entries that correspond to bit sequences starting
+   * with that code.
+   */
+
+  MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits));
+
+  p = 0;
+  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
+    for (i = 1; i <= (int) htbl->bits[l]; i++, p++) {
+      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
+      /* Generate left-justified code followed by all possible bit sequences */
+      lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l);
+      for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) {
+	dtbl->look_nbits[lookbits] = l;
+	dtbl->look_sym[lookbits] = htbl->huffval[p];
+	lookbits++;
+      }
+    }
+  }
+
+  /* Validate symbols as being reasonable.
+   * For AC tables, we make no check, but accept all byte values 0..255.
+   * For DC tables, we require the symbols to be in range 0..15.
+   * (Tighter bounds could be applied depending on the data depth and mode,
+   * but this is sufficient to ensure safe decoding.)
+   */
+  if (isDC) {
+    for (i = 0; i < numsymbols; i++) {
+      int sym = htbl->huffval[i];
+      if (sym < 0 || sym > 15)
+	ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+    }
+  }
+}
+
+
+/*
+ * Out-of-line code for bit fetching (shared with jdphuff.c).
+ * See jdhuff.h for info about usage.
+ * Note: current values of get_buffer and bits_left are passed as parameters,
+ * but are returned in the corresponding fields of the state struct.
+ *
+ * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width
+ * of get_buffer to be used.  (On machines with wider words, an even larger
+ * buffer could be used.)  However, on some machines 32-bit shifts are
+ * quite slow and take time proportional to the number of places shifted.
+ * (This is true with most PC compilers, for instance.)  In this case it may
+ * be a win to set MIN_GET_BITS to the minimum value of 15.  This reduces the
+ * average shift distance at the cost of more calls to jpeg_fill_bit_buffer.
+ */
+
+#ifdef SLOW_SHIFT_32
+#define MIN_GET_BITS  15	/* minimum allowable value */
+#else
+#define MIN_GET_BITS  (BIT_BUF_SIZE-7)
+#endif
+
+
+GLOBAL(boolean)
+jpeg_fill_bit_buffer (bitread_working_state * state,
+		      register bit_buf_type get_buffer, register int bits_left,
+		      int nbits)
+/* Load up the bit buffer to a depth of at least nbits */
+{
+  /* Copy heavily used state fields into locals (hopefully registers) */
+  register const JOCTET * next_input_byte = state->next_input_byte;
+  register size_t bytes_in_buffer = state->bytes_in_buffer;
+  j_decompress_ptr cinfo = state->cinfo;
+
+  /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
+  /* (It is assumed that no request will be for more than that many bits.) */
+  /* We fail to do so only if we hit a marker or are forced to suspend. */
+
+  if (cinfo->unread_marker == 0) {	/* cannot advance past a marker */
+    while (bits_left < MIN_GET_BITS) {
+      register int c;
+
+      /* Attempt to read a byte */
+      if (bytes_in_buffer == 0) {
+	if (! (*cinfo->src->fill_input_buffer) (cinfo))
+	  return FALSE;
+	next_input_byte = cinfo->src->next_input_byte;
+	bytes_in_buffer = cinfo->src->bytes_in_buffer;
+      }
+      bytes_in_buffer--;
+      c = GETJOCTET(*next_input_byte++);
+
+      /* If it's 0xFF, check and discard stuffed zero byte */
+      if (c == 0xFF) {
+	/* Loop here to discard any padding FF's on terminating marker,
+	 * so that we can save a valid unread_marker value.  NOTE: we will
+	 * accept multiple FF's followed by a 0 as meaning a single FF data
+	 * byte.  This data pattern is not valid according to the standard.
+	 */
+	do {
+	  if (bytes_in_buffer == 0) {
+	    if (! (*cinfo->src->fill_input_buffer) (cinfo))
+	      return FALSE;
+	    next_input_byte = cinfo->src->next_input_byte;
+	    bytes_in_buffer = cinfo->src->bytes_in_buffer;
+	  }
+	  bytes_in_buffer--;
+	  c = GETJOCTET(*next_input_byte++);
+	} while (c == 0xFF);
+
+	if (c == 0) {
+	  /* Found FF/00, which represents an FF data byte */
+	  c = 0xFF;
+	} else {
+	  /* Oops, it's actually a marker indicating end of compressed data.
+	   * Save the marker code for later use.
+	   * Fine point: it might appear that we should save the marker into
+	   * bitread working state, not straight into permanent state.  But
+	   * once we have hit a marker, we cannot need to suspend within the
+	   * current MCU, because we will read no more bytes from the data
+	   * source.  So it is OK to update permanent state right away.
+	   */
+	  cinfo->unread_marker = c;
+	  /* See if we need to insert some fake zero bits. */
+	  goto no_more_bytes;
+	}
+      }
+
+      /* OK, load c into get_buffer */
+      get_buffer = (get_buffer << 8) | c;
+      bits_left += 8;
+    } /* end while */
+  } else {
+  no_more_bytes:
+    /* We get here if we've read the marker that terminates the compressed
+     * data segment.  There should be enough bits in the buffer register
+     * to satisfy the request; if so, no problem.
+     */
+    if (nbits > bits_left) {
+      /* Uh-oh.  Report corrupted data to user and stuff zeroes into
+       * the data stream, so that we can produce some kind of image.
+       * We use a nonvolatile flag to ensure that only one warning message
+       * appears per data segment.
+       */
+      if (! cinfo->entropy->insufficient_data) {
+	WARNMS(cinfo, JWRN_HIT_MARKER);
+	cinfo->entropy->insufficient_data = TRUE;
+      }
+      /* Fill the buffer with zero bits */
+      get_buffer <<= MIN_GET_BITS - bits_left;
+      bits_left = MIN_GET_BITS;
+    }
+  }
+
+  /* Unload the local registers */
+  state->next_input_byte = next_input_byte;
+  state->bytes_in_buffer = bytes_in_buffer;
+  state->get_buffer = get_buffer;
+  state->bits_left = bits_left;
+
+  return TRUE;
+}
+
+
+/*
+ * Out-of-line code for Huffman code decoding.
+ * See jdhuff.h for info about usage.
+ */
+
+GLOBAL(int)
+jpeg_huff_decode (bitread_working_state * state,
+		  register bit_buf_type get_buffer, register int bits_left,
+		  d_derived_tbl * htbl, int min_bits)
+{
+  register int l = min_bits;
+  register INT32 code;
+
+  /* HUFF_DECODE has determined that the code is at least min_bits */
+  /* bits long, so fetch that many bits in one swoop. */
+
+  CHECK_BIT_BUFFER(*state, l, return -1);
+  code = GET_BITS(l);
+
+  /* Collect the rest of the Huffman code one bit at a time. */
+  /* This is per Figure F.16 in the JPEG spec. */
+
+  while (code > htbl->maxcode[l]) {
+    code <<= 1;
+    CHECK_BIT_BUFFER(*state, 1, return -1);
+    code |= GET_BITS(1);
+    l++;
+  }
+
+  /* Unload the local registers */
+  state->get_buffer = get_buffer;
+  state->bits_left = bits_left;
+
+  /* With garbage input we may reach the sentinel value l = 17. */
+
+  if (l > 16) {
+    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
+    return 0;			/* fake a zero as the safest result */
+  }
+
+  return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ];
+}
+
+
+/*
+ * Figure F.12: extend sign bit.
+ * On some machines, a shift and add will be faster than a table lookup.
+ */
+
+#ifdef AVOID_TABLES
+
+#define HUFF_EXTEND(x,s)  ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))
+
+#else
+
+#define HUFF_EXTEND(x,s)  ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
+
+static const int extend_test[16] =   /* entry n is 2**(n-1) */
+  { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
+    0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
+
+static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
+  { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
+    ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
+    ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
+    ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+
+#endif /* AVOID_TABLES */
+
+
+/*
+ * Check for a restart marker & resynchronize decoder.
+ * Returns FALSE if must suspend.
+ */
+
+LOCAL(boolean)
+process_restart (j_decompress_ptr cinfo)
+{
+  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+  int ci;
+
+  /* Throw away any unused bits remaining in bit buffer; */
+  /* include any full bytes in next_marker's count of discarded bytes */
+  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
+  entropy->bitstate.bits_left = 0;
+
+  /* Advance past the RSTn marker */
+  if (! (*cinfo->marker->read_restart_marker) (cinfo))
+    return FALSE;
+
+  /* Re-initialize DC predictions to 0 */
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+    entropy->saved.last_dc_val[ci] = 0;
+
+  /* Reset restart counter */
+  entropy->restarts_to_go = cinfo->restart_interval;
+
+  /* Reset out-of-data flag, unless read_restart_marker left us smack up
+   * against a marker.  In that case we will end up treating the next data
+   * segment as empty, and we can avoid producing bogus output pixels by
+   * leaving the flag set.
+   */
+  if (cinfo->unread_marker == 0)
+    entropy->pub.insufficient_data = FALSE;
+
+  return TRUE;
+}
+
+
+/*
+ * Decode and return one MCU's worth of Huffman-compressed coefficients.
+ * The coefficients are reordered from zigzag order into natural array order,
+ * but are not dequantized.
+ *
+ * The i'th block of the MCU is stored into the block pointed to by
+ * MCU_data[i].  WE ASSUME THIS AREA HAS BEEN ZEROED BY THE CALLER.
+ * (Wholesale zeroing is usually a little faster than retail...)
+ *
+ * Returns FALSE if data source requested suspension.  In that case no
+ * changes have been made to permanent state.  (Exception: some output
+ * coefficients may already have been assigned.  This is harmless for
+ * this module, since we'll just re-assign them on the next call.)
+ */
+
+METHODDEF(boolean)
+decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+{
+  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+  int blkn;
+  BITREAD_STATE_VARS;
+  savable_state state;
+
+  /* Process restart marker if needed; may have to suspend */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0)
+      if (! process_restart(cinfo))
+	return FALSE;
+  }
+
+  /* If we've run out of data, just leave the MCU set to zeroes.
+   * This way, we return uniform gray for the remainder of the segment.
+   */
+  if (! entropy->pub.insufficient_data) {
+
+    /* Load up working state */
+    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+    ASSIGN_STATE(state, entropy->saved);
+
+    /* Outer loop handles each block in the MCU */
+
+    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+      JBLOCKROW block = MCU_data[blkn];
+      d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn];
+      d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn];
+      register int s, k, r;
+
+      /* Decode a single block's worth of coefficients */
+
+      /* Section F.2.2.1: decode the DC coefficient difference */
+      HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
+      if (s) {
+	CHECK_BIT_BUFFER(br_state, s, return FALSE);
+	r = GET_BITS(s);
+	s = HUFF_EXTEND(r, s);
+      }
+
+      if (entropy->dc_needed[blkn]) {
+	/* Convert DC difference to actual value, update last_dc_val */
+	int ci = cinfo->MCU_membership[blkn];
+	s += state.last_dc_val[ci];
+	state.last_dc_val[ci] = s;
+	/* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
+	(*block)[0] = (JCOEF) s;
+      }
+
+      if (entropy->ac_needed[blkn]) {
+
+	/* Section F.2.2.2: decode the AC coefficients */
+	/* Since zeroes are skipped, output area must be cleared beforehand */
+	for (k = 1; k < DCTSIZE2; k++) {
+	  HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
+      
+	  r = s >> 4;
+	  s &= 15;
+      
+	  if (s) {
+	    k += r;
+	    CHECK_BIT_BUFFER(br_state, s, return FALSE);
+	    r = GET_BITS(s);
+	    s = HUFF_EXTEND(r, s);
+	    /* Output coefficient in natural (dezigzagged) order.
+	     * Note: the extra entries in jpeg_natural_order[] will save us
+	     * if k >= DCTSIZE2, which could happen if the data is corrupted.
+	     */
+	    (*block)[jpeg_natural_order[k]] = (JCOEF) s;
+	  } else {
+	    if (r != 15)
+	      break;
+	    k += 15;
+	  }
+	}
+
+      } else {
+
+	/* Section F.2.2.2: decode the AC coefficients */
+	/* In this path we just discard the values */
+	for (k = 1; k < DCTSIZE2; k++) {
+	  HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
+      
+	  r = s >> 4;
+	  s &= 15;
+      
+	  if (s) {
+	    k += r;
+	    CHECK_BIT_BUFFER(br_state, s, return FALSE);
+	    DROP_BITS(s);
+	  } else {
+	    if (r != 15)
+	      break;
+	    k += 15;
+	  }
+	}
+
+      }
+    }
+
+    /* Completed MCU, so update state */
+    BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+    ASSIGN_STATE(entropy->saved, state);
+  }
+
+  /* Account for restart interval (no-op if not using restarts) */
+  entropy->restarts_to_go--;
+
+  return TRUE;
+}
+
+
+/*
+ * Module initialization routine for Huffman entropy decoding.
+ */
+
+GLOBAL(void)
+jinit_huff_decoder (j_decompress_ptr cinfo)
+{
+  huff_entropy_ptr entropy;
+  int i;
+
+  entropy = (huff_entropy_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(huff_entropy_decoder));
+  cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
+  entropy->pub.start_pass = start_pass_huff_decoder;
+  entropy->pub.decode_mcu = decode_mcu;
+
+  /* Mark tables unallocated */
+  for (i = 0; i < NUM_HUFF_TBLS; i++) {
+    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdhuff.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdhuff.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdhuff.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,201 @@
+/*
+ * jdhuff.h
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains declarations for Huffman entropy decoding routines
+ * that are shared between the sequential decoder (jdhuff.c) and the
+ * progressive decoder (jdphuff.c).  No other modules need to see these.
+ */
+
+/* Short forms of external names for systems with brain-damaged linkers. */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jpeg_make_d_derived_tbl	jMkDDerived
+#define jpeg_fill_bit_buffer	jFilBitBuf
+#define jpeg_huff_decode	jHufDecode
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+
+/* Derived data constructed for each Huffman table */
+
+#define HUFF_LOOKAHEAD	8	/* # of bits of lookahead */
+
+typedef struct {
+  /* Basic tables: (element [0] of each array is unused) */
+  INT32 maxcode[18];		/* largest code of length k (-1 if none) */
+  /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */
+  INT32 valoffset[17];		/* huffval[] offset for codes of length k */
+  /* valoffset[k] = huffval[] index of 1st symbol of code length k, less
+   * the smallest code of length k; so given a code of length k, the
+   * corresponding symbol is huffval[code + valoffset[k]]
+   */
+
+  /* Link to public Huffman table (needed only in jpeg_huff_decode) */
+  JHUFF_TBL *pub;
+
+  /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of
+   * the input data stream.  If the next Huffman code is no more
+   * than HUFF_LOOKAHEAD bits long, we can obtain its length and
+   * the corresponding symbol directly from these tables.
+   */
+  int look_nbits[1<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */
+  UINT8 look_sym[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */
+} d_derived_tbl;
+
+/* Expand a Huffman table definition into the derived format */
+EXTERN(void) jpeg_make_d_derived_tbl
+	JPP((j_decompress_ptr cinfo, boolean isDC, int tblno,
+	     d_derived_tbl ** pdtbl));
+
+
+/*
+ * Fetching the next N bits from the input stream is a time-critical operation
+ * for the Huffman decoders.  We implement it with a combination of inline
+ * macros and out-of-line subroutines.  Note that N (the number of bits
+ * demanded at one time) never exceeds 15 for JPEG use.
+ *
+ * We read source bytes into get_buffer and dole out bits as needed.
+ * If get_buffer already contains enough bits, they are fetched in-line
+ * by the macros CHECK_BIT_BUFFER and GET_BITS.  When there aren't enough
+ * bits, jpeg_fill_bit_buffer is called; it will attempt to fill get_buffer
+ * as full as possible (not just to the number of bits needed; this
+ * prefetching reduces the overhead cost of calling jpeg_fill_bit_buffer).
+ * Note that jpeg_fill_bit_buffer may return FALSE to indicate suspension.
+ * On TRUE return, jpeg_fill_bit_buffer guarantees that get_buffer contains
+ * at least the requested number of bits --- dummy zeroes are inserted if
+ * necessary.
+ */
+
+typedef INT32 bit_buf_type;	/* type of bit-extraction buffer */
+#define BIT_BUF_SIZE  32	/* size of buffer in bits */
+
+/* If long is > 32 bits on your machine, and shifting/masking longs is
+ * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE
+ * appropriately should be a win.  Unfortunately we can't define the size
+ * with something like  #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8)
+ * because not all machines measure sizeof in 8-bit bytes.
+ */
+
+typedef struct {		/* Bitreading state saved across MCUs */
+  bit_buf_type get_buffer;	/* current bit-extraction buffer */
+  int bits_left;		/* # of unused bits in it */
+} bitread_perm_state;
+
+typedef struct {		/* Bitreading working state within an MCU */
+  /* Current data source location */
+  /* We need a copy, rather than munging the original, in case of suspension */
+  const JOCTET * next_input_byte; /* => next byte to read from source */
+  size_t bytes_in_buffer;	/* # of bytes remaining in source buffer */
+  /* Bit input buffer --- note these values are kept in register variables,
+   * not in this struct, inside the inner loops.
+   */
+  bit_buf_type get_buffer;	/* current bit-extraction buffer */
+  int bits_left;		/* # of unused bits in it */
+  /* Pointer needed by jpeg_fill_bit_buffer. */
+  j_decompress_ptr cinfo;	/* back link to decompress master record */
+} bitread_working_state;
+
+/* Macros to declare and load/save bitread local variables. */
+#define BITREAD_STATE_VARS  \
+	register bit_buf_type get_buffer;  \
+	register int bits_left;  \
+	bitread_working_state br_state
+
+#define BITREAD_LOAD_STATE(cinfop,permstate)  \
+	br_state.cinfo = cinfop; \
+	br_state.next_input_byte = cinfop->src->next_input_byte; \
+	br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
+	get_buffer = permstate.get_buffer; \
+	bits_left = permstate.bits_left;
+
+#define BITREAD_SAVE_STATE(cinfop,permstate)  \
+	cinfop->src->next_input_byte = br_state.next_input_byte; \
+	cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
+	permstate.get_buffer = get_buffer; \
+	permstate.bits_left = bits_left
+
+/*
+ * These macros provide the in-line portion of bit fetching.
+ * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer
+ * before using GET_BITS, PEEK_BITS, or DROP_BITS.
+ * The variables get_buffer and bits_left are assumed to be locals,
+ * but the state struct might not be (jpeg_huff_decode needs this).
+ *	CHECK_BIT_BUFFER(state,n,action);
+ *		Ensure there are N bits in get_buffer; if suspend, take action.
+ *      val = GET_BITS(n);
+ *		Fetch next N bits.
+ *      val = PEEK_BITS(n);
+ *		Fetch next N bits without removing them from the buffer.
+ *	DROP_BITS(n);
+ *		Discard next N bits.
+ * The value N should be a simple variable, not an expression, because it
+ * is evaluated multiple times.
+ */
+
+#define CHECK_BIT_BUFFER(state,nbits,action) \
+	{ if (bits_left < (nbits)) {  \
+	    if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits))  \
+	      { action; }  \
+	    get_buffer = (state).get_buffer; bits_left = (state).bits_left; } }
+
+#define GET_BITS(nbits) \
+	(((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1))
+
+#define PEEK_BITS(nbits) \
+	(((int) (get_buffer >> (bits_left -  (nbits)))) & ((1<<(nbits))-1))
+
+#define DROP_BITS(nbits) \
+	(bits_left -= (nbits))
+
+/* Load up the bit buffer to a depth of at least nbits */
+EXTERN(boolean) jpeg_fill_bit_buffer
+	JPP((bitread_working_state * state, register bit_buf_type get_buffer,
+	     register int bits_left, int nbits));
+
+
+/*
+ * Code for extracting next Huffman-coded symbol from input bit stream.
+ * Again, this is time-critical and we make the main paths be macros.
+ *
+ * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits
+ * without looping.  Usually, more than 95% of the Huffman codes will be 8
+ * or fewer bits long.  The few overlength codes are handled with a loop,
+ * which need not be inline code.
+ *
+ * Notes about the HUFF_DECODE macro:
+ * 1. Near the end of the data segment, we may fail to get enough bits
+ *    for a lookahead.  In that case, we do it the hard way.
+ * 2. If the lookahead table contains no entry, the next code must be
+ *    more than HUFF_LOOKAHEAD bits long.
+ * 3. jpeg_huff_decode returns -1 if forced to suspend.
+ */
+
+#define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \
+{ register int nb, look; \
+  if (bits_left < HUFF_LOOKAHEAD) { \
+    if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \
+    get_buffer = state.get_buffer; bits_left = state.bits_left; \
+    if (bits_left < HUFF_LOOKAHEAD) { \
+      nb = 1; goto slowlabel; \
+    } \
+  } \
+  look = PEEK_BITS(HUFF_LOOKAHEAD); \
+  if ((nb = htbl->look_nbits[look]) != 0) { \
+    DROP_BITS(nb); \
+    result = htbl->look_sym[look]; \
+  } else { \
+    nb = HUFF_LOOKAHEAD+1; \
+slowlabel: \
+    if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \
+	{ failaction; } \
+    get_buffer = state.get_buffer; bits_left = state.bits_left; \
+  } \
+}
+
+/* Out-of-line case for Huffman code fetching */
+EXTERN(int) jpeg_huff_decode
+	JPP((bitread_working_state * state, register bit_buf_type get_buffer,
+	     register int bits_left, d_derived_tbl * htbl, int min_bits));

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdinput.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdinput.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdinput.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,381 @@
+/*
+ * jdinput.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains input control logic for the JPEG decompressor.
+ * These routines are concerned with controlling the decompressor's input
+ * processing (marker reading and coefficient decoding).  The actual input
+ * reading is done in jdmarker.c, jdhuff.c, and jdphuff.c.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Private state */
+
+typedef struct {
+  struct jpeg_input_controller pub; /* public fields */
+
+  boolean inheaders;		/* TRUE until first SOS is reached */
+} my_input_controller;
+
+typedef my_input_controller * my_inputctl_ptr;
+
+
+/* Forward declarations */
+METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo));
+
+
+/*
+ * Routines to calculate various quantities related to the size of the image.
+ */
+
+LOCAL(void)
+initial_setup (j_decompress_ptr cinfo)
+/* Called once, when first SOS marker is reached */
+{
+  int ci;
+  jpeg_component_info *compptr;
+
+  /* Make sure image isn't bigger than I can handle */
+  if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||
+      (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
+    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
+
+  /* For now, precision must match compiled-in value... */
+  if (cinfo->data_precision != BITS_IN_JSAMPLE)
+    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
+
+  /* Check that number of components won't exceed internal array sizes */
+  if (cinfo->num_components > MAX_COMPONENTS)
+    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
+	     MAX_COMPONENTS);
+
+  /* Compute maximum sampling factors; check factor validity */
+  cinfo->max_h_samp_factor = 1;
+  cinfo->max_v_samp_factor = 1;
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
+	compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
+      ERREXIT(cinfo, JERR_BAD_SAMPLING);
+    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
+				   compptr->h_samp_factor);
+    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
+				   compptr->v_samp_factor);
+  }
+
+  /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
+   * In the full decompressor, this will be overridden by jdmaster.c;
+   * but in the transcoder, jdmaster.c is not used, so we must do it here.
+   */
+  cinfo->min_DCT_scaled_size = DCTSIZE;
+
+  /* Compute dimensions of components */
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    compptr->DCT_scaled_size = DCTSIZE;
+    /* Size in DCT blocks */
+    compptr->width_in_blocks = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
+		    (long) (cinfo->max_h_samp_factor * DCTSIZE));
+    compptr->height_in_blocks = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
+		    (long) (cinfo->max_v_samp_factor * DCTSIZE));
+    /* downsampled_width and downsampled_height will also be overridden by
+     * jdmaster.c if we are doing full decompression.  The transcoder library
+     * doesn't use these values, but the calling application might.
+     */
+    /* Size in samples */
+    compptr->downsampled_width = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
+		    (long) cinfo->max_h_samp_factor);
+    compptr->downsampled_height = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
+		    (long) cinfo->max_v_samp_factor);
+    /* Mark component needed, until color conversion says otherwise */
+    compptr->component_needed = TRUE;
+    /* Mark no quantization table yet saved for component */
+    compptr->quant_table = NULL;
+  }
+
+  /* Compute number of fully interleaved MCU rows. */
+  cinfo->total_iMCU_rows = (JDIMENSION)
+    jdiv_round_up((long) cinfo->image_height,
+		  (long) (cinfo->max_v_samp_factor*DCTSIZE));
+
+  /* Decide whether file contains multiple scans */
+  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
+    cinfo->inputctl->has_multiple_scans = TRUE;
+  else
+    cinfo->inputctl->has_multiple_scans = FALSE;
+}
+
+
+LOCAL(void)
+per_scan_setup (j_decompress_ptr cinfo)
+/* Do computations that are needed before processing a JPEG scan */
+/* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */
+{
+  int ci, mcublks, tmp;
+  jpeg_component_info *compptr;
+  
+  if (cinfo->comps_in_scan == 1) {
+    
+    /* Noninterleaved (single-component) scan */
+    compptr = cinfo->cur_comp_info[0];
+    
+    /* Overall image size in MCUs */
+    cinfo->MCUs_per_row = compptr->width_in_blocks;
+    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
+    
+    /* For noninterleaved scan, always one block per MCU */
+    compptr->MCU_width = 1;
+    compptr->MCU_height = 1;
+    compptr->MCU_blocks = 1;
+    compptr->MCU_sample_width = compptr->DCT_scaled_size;
+    compptr->last_col_width = 1;
+    /* For noninterleaved scans, it is convenient to define last_row_height
+     * as the number of block rows present in the last iMCU row.
+     */
+    tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+    if (tmp == 0) tmp = compptr->v_samp_factor;
+    compptr->last_row_height = tmp;
+    
+    /* Prepare array describing MCU composition */
+    cinfo->blocks_in_MCU = 1;
+    cinfo->MCU_membership[0] = 0;
+    
+  } else {
+    
+    /* Interleaved (multi-component) scan */
+    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
+      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
+	       MAX_COMPS_IN_SCAN);
+    
+    /* Overall image size in MCUs */
+    cinfo->MCUs_per_row = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width,
+		    (long) (cinfo->max_h_samp_factor*DCTSIZE));
+    cinfo->MCU_rows_in_scan = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height,
+		    (long) (cinfo->max_v_samp_factor*DCTSIZE));
+    
+    cinfo->blocks_in_MCU = 0;
+    
+    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+      compptr = cinfo->cur_comp_info[ci];
+      /* Sampling factors give # of blocks of component in each MCU */
+      compptr->MCU_width = compptr->h_samp_factor;
+      compptr->MCU_height = compptr->v_samp_factor;
+      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
+      compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_scaled_size;
+      /* Figure number of non-dummy blocks in last MCU column & row */
+      tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);
+      if (tmp == 0) tmp = compptr->MCU_width;
+      compptr->last_col_width = tmp;
+      tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);
+      if (tmp == 0) tmp = compptr->MCU_height;
+      compptr->last_row_height = tmp;
+      /* Prepare array describing MCU composition */
+      mcublks = compptr->MCU_blocks;
+      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
+	ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
+      while (mcublks-- > 0) {
+	cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
+      }
+    }
+    
+  }
+}
+
+
+/*
+ * Save away a copy of the Q-table referenced by each component present
+ * in the current scan, unless already saved during a prior scan.
+ *
+ * In a multiple-scan JPEG file, the encoder could assign different components
+ * the same Q-table slot number, but change table definitions between scans
+ * so that each component uses a different Q-table.  (The IJG encoder is not
+ * currently capable of doing this, but other encoders might.)  Since we want
+ * to be able to dequantize all the components at the end of the file, this
+ * means that we have to save away the table actually used for each component.
+ * We do this by copying the table at the start of the first scan containing
+ * the component.
+ * The JPEG spec prohibits the encoder from changing the contents of a Q-table
+ * slot between scans of a component using that slot.  If the encoder does so
+ * anyway, this decoder will simply use the Q-table values that were current
+ * at the start of the first scan for the component.
+ *
+ * The decompressor output side looks only at the saved quant tables,
+ * not at the current Q-table slots.
+ */
+
+LOCAL(void)
+latch_quant_tables (j_decompress_ptr cinfo)
+{
+  int ci, qtblno;
+  jpeg_component_info *compptr;
+  JQUANT_TBL * qtbl;
+
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    /* No work if we already saved Q-table for this component */
+    if (compptr->quant_table != NULL)
+      continue;
+    /* Make sure specified quantization table is present */
+    qtblno = compptr->quant_tbl_no;
+    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
+	cinfo->quant_tbl_ptrs[qtblno] == NULL)
+      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
+    /* OK, save away the quantization table */
+    qtbl = (JQUANT_TBL *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(JQUANT_TBL));
+    MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL));
+    compptr->quant_table = qtbl;
+  }
+}
+
+
+/*
+ * Initialize the input modules to read a scan of compressed data.
+ * The first call to this is done by jdmaster.c after initializing
+ * the entire decompressor (during jpeg_start_decompress).
+ * Subsequent calls come from consume_markers, below.
+ */
+
+METHODDEF(void)
+start_input_pass (j_decompress_ptr cinfo)
+{
+  per_scan_setup(cinfo);
+  latch_quant_tables(cinfo);
+  (*cinfo->entropy->start_pass) (cinfo);
+  (*cinfo->coef->start_input_pass) (cinfo);
+  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
+}
+
+
+/*
+ * Finish up after inputting a compressed-data scan.
+ * This is called by the coefficient controller after it's read all
+ * the expected data of the scan.
+ */
+
+METHODDEF(void)
+finish_input_pass (j_decompress_ptr cinfo)
+{
+  cinfo->inputctl->consume_input = consume_markers;
+}
+
+
+/*
+ * Read JPEG markers before, between, or after compressed-data scans.
+ * Change state as necessary when a new scan is reached.
+ * Return value is JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
+ *
+ * The consume_input method pointer points either here or to the
+ * coefficient controller's consume_data routine, depending on whether
+ * we are reading a compressed data segment or inter-segment markers.
+ */
+
+METHODDEF(int)
+consume_markers (j_decompress_ptr cinfo)
+{
+  my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
+  int val;
+
+  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
+    return JPEG_REACHED_EOI;
+
+  val = (*cinfo->marker->read_markers) (cinfo);
+
+  switch (val) {
+  case JPEG_REACHED_SOS:	/* Found SOS */
+    if (inputctl->inheaders) {	/* 1st SOS */
+      initial_setup(cinfo);
+      inputctl->inheaders = FALSE;
+      /* Note: start_input_pass must be called by jdmaster.c
+       * before any more input can be consumed.  jdapimin.c is
+       * responsible for enforcing this sequencing.
+       */
+    } else {			/* 2nd or later SOS marker */
+      if (! inputctl->pub.has_multiple_scans)
+	ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
+      start_input_pass(cinfo);
+    }
+    break;
+  case JPEG_REACHED_EOI:	/* Found EOI */
+    inputctl->pub.eoi_reached = TRUE;
+    if (inputctl->inheaders) {	/* Tables-only datastream, apparently */
+      if (cinfo->marker->saw_SOF)
+	ERREXIT(cinfo, JERR_SOF_NO_SOS);
+    } else {
+      /* Prevent infinite loop in coef ctlr's decompress_data routine
+       * if user set output_scan_number larger than number of scans.
+       */
+      if (cinfo->output_scan_number > cinfo->input_scan_number)
+	cinfo->output_scan_number = cinfo->input_scan_number;
+    }
+    break;
+  case JPEG_SUSPENDED:
+    break;
+  }
+
+  return val;
+}
+
+
+/*
+ * Reset state to begin a fresh datastream.
+ */
+
+METHODDEF(void)
+reset_input_controller (j_decompress_ptr cinfo)
+{
+  my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
+
+  inputctl->pub.consume_input = consume_markers;
+  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
+  inputctl->pub.eoi_reached = FALSE;
+  inputctl->inheaders = TRUE;
+  /* Reset other modules */
+  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+  (*cinfo->marker->reset_marker_reader) (cinfo);
+  /* Reset progression state -- would be cleaner if entropy decoder did this */
+  cinfo->coef_bits = NULL;
+}
+
+
+/*
+ * Initialize the input controller module.
+ * This is called only once, when the decompression object is created.
+ */
+
+GLOBAL(void)
+jinit_input_controller (j_decompress_ptr cinfo)
+{
+  my_inputctl_ptr inputctl;
+
+  /* Create subobject in permanent pool */
+  inputctl = (my_inputctl_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+				SIZEOF(my_input_controller));
+  cinfo->inputctl = (struct jpeg_input_controller *) inputctl;
+  /* Initialize method pointers */
+  inputctl->pub.consume_input = consume_markers;
+  inputctl->pub.reset_input_controller = reset_input_controller;
+  inputctl->pub.start_input_pass = start_input_pass;
+  inputctl->pub.finish_input_pass = finish_input_pass;
+  /* Initialize state: can't use reset_input_controller since we don't
+   * want to try to reset other modules yet.
+   */
+  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
+  inputctl->pub.eoi_reached = FALSE;
+  inputctl->inheaders = TRUE;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmainct.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmainct.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmainct.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,512 @@
+/*
+ * jdmainct.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the main buffer controller for decompression.
+ * The main buffer lies between the JPEG decompressor proper and the
+ * post-processor; it holds downsampled data in the JPEG colorspace.
+ *
+ * Note that this code is bypassed in raw-data mode, since the application
+ * supplies the equivalent of the main buffer in that case.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * In the current system design, the main buffer need never be a full-image
+ * buffer; any full-height buffers will be found inside the coefficient or
+ * postprocessing controllers.  Nonetheless, the main controller is not
+ * trivial.  Its responsibility is to provide context rows for upsampling/
+ * rescaling, and doing this in an efficient fashion is a bit tricky.
+ *
+ * Postprocessor input data is counted in "row groups".  A row group
+ * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)
+ * sample rows of each component.  (We require DCT_scaled_size values to be
+ * chosen such that these numbers are integers.  In practice DCT_scaled_size
+ * values will likely be powers of two, so we actually have the stronger
+ * condition that DCT_scaled_size / min_DCT_scaled_size is an integer.)
+ * Upsampling will typically produce max_v_samp_factor pixel rows from each
+ * row group (times any additional scale factor that the upsampler is
+ * applying).
+ *
+ * The coefficient controller will deliver data to us one iMCU row at a time;
+ * each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or
+ * exactly min_DCT_scaled_size row groups.  (This amount of data corresponds
+ * to one row of MCUs when the image is fully interleaved.)  Note that the
+ * number of sample rows varies across components, but the number of row
+ * groups does not.  Some garbage sample rows may be included in the last iMCU
+ * row at the bottom of the image.
+ *
+ * Depending on the vertical scaling algorithm used, the upsampler may need
+ * access to the sample row(s) above and below its current input row group.
+ * The upsampler is required to set need_context_rows TRUE at global selection
+ * time if so.  When need_context_rows is FALSE, this controller can simply
+ * obtain one iMCU row at a time from the coefficient controller and dole it
+ * out as row groups to the postprocessor.
+ *
+ * When need_context_rows is TRUE, this controller guarantees that the buffer
+ * passed to postprocessing contains at least one row group's worth of samples
+ * above and below the row group(s) being processed.  Note that the context
+ * rows "above" the first passed row group appear at negative row offsets in
+ * the passed buffer.  At the top and bottom of the image, the required
+ * context rows are manufactured by duplicating the first or last real sample
+ * row; this avoids having special cases in the upsampling inner loops.
+ *
+ * The amount of context is fixed at one row group just because that's a
+ * convenient number for this controller to work with.  The existing
+ * upsamplers really only need one sample row of context.  An upsampler
+ * supporting arbitrary output rescaling might wish for more than one row
+ * group of context when shrinking the image; tough, we don't handle that.
+ * (This is justified by the assumption that downsizing will be handled mostly
+ * by adjusting the DCT_scaled_size values, so that the actual scale factor at
+ * the upsample step needn't be much less than one.)
+ *
+ * To provide the desired context, we have to retain the last two row groups
+ * of one iMCU row while reading in the next iMCU row.  (The last row group
+ * can't be processed until we have another row group for its below-context,
+ * and so we have to save the next-to-last group too for its above-context.)
+ * We could do this most simply by copying data around in our buffer, but
+ * that'd be very slow.  We can avoid copying any data by creating a rather
+ * strange pointer structure.  Here's how it works.  We allocate a workspace
+ * consisting of M+2 row groups (where M = min_DCT_scaled_size is the number
+ * of row groups per iMCU row).  We create two sets of redundant pointers to
+ * the workspace.  Labeling the physical row groups 0 to M+1, the synthesized
+ * pointer lists look like this:
+ *                   M+1                          M-1
+ * master pointer --> 0         master pointer --> 0
+ *                    1                            1
+ *                   ...                          ...
+ *                   M-3                          M-3
+ *                   M-2                           M
+ *                   M-1                          M+1
+ *                    M                           M-2
+ *                   M+1                          M-1
+ *                    0                            0
+ * We read alternate iMCU rows using each master pointer; thus the last two
+ * row groups of the previous iMCU row remain un-overwritten in the workspace.
+ * The pointer lists are set up so that the required context rows appear to
+ * be adjacent to the proper places when we pass the pointer lists to the
+ * upsampler.
+ *
+ * The above pictures describe the normal state of the pointer lists.
+ * At top and bottom of the image, we diddle the pointer lists to duplicate
+ * the first or last sample row as necessary (this is cheaper than copying
+ * sample rows around).
+ *
+ * This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1.  In that
+ * situation each iMCU row provides only one row group so the buffering logic
+ * must be different (eg, we must read two iMCU rows before we can emit the
+ * first row group).  For now, we simply do not support providing context
+ * rows when min_DCT_scaled_size is 1.  That combination seems unlikely to
+ * be worth providing --- if someone wants a 1/8th-size preview, they probably
+ * want it quick and dirty, so a context-free upsampler is sufficient.
+ */
+
+
+/* Private buffer controller object */
+
+typedef struct {
+  struct jpeg_d_main_controller pub; /* public fields */
+
+  /* Pointer to allocated workspace (M or M+2 row groups). */
+  JSAMPARRAY buffer[MAX_COMPONENTS];
+
+  boolean buffer_full;		/* Have we gotten an iMCU row from decoder? */
+  JDIMENSION rowgroup_ctr;	/* counts row groups output to postprocessor */
+
+  /* Remaining fields are only used in the context case. */
+
+  /* These are the master pointers to the funny-order pointer lists. */
+  JSAMPIMAGE xbuffer[2];	/* pointers to weird pointer lists */
+
+  int whichptr;			/* indicates which pointer set is now in use */
+  int context_state;		/* process_data state machine status */
+  JDIMENSION rowgroups_avail;	/* row groups available to postprocessor */
+  JDIMENSION iMCU_row_ctr;	/* counts iMCU rows to detect image top/bot */
+} my_main_controller;
+
+typedef my_main_controller * my_main_ptr;
+
+/* context_state values: */
+#define CTX_PREPARE_FOR_IMCU	0	/* need to prepare for MCU row */
+#define CTX_PROCESS_IMCU	1	/* feeding iMCU to postprocessor */
+#define CTX_POSTPONED_ROW	2	/* feeding postponed row group */
+
+
+/* Forward declarations */
+METHODDEF(void) process_data_simple_main
+	JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf,
+	     JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail));
+METHODDEF(void) process_data_context_main
+	JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf,
+	     JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail));
+#ifdef QUANT_2PASS_SUPPORTED
+METHODDEF(void) process_data_crank_post
+	JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf,
+	     JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail));
+#endif
+
+
+LOCAL(void)
+alloc_funny_pointers (j_decompress_ptr cinfo)
+/* Allocate space for the funny pointer lists.
+ * This is done only once, not once per pass.
+ */
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+  int ci, rgroup;
+  int M = cinfo->min_DCT_scaled_size;
+  jpeg_component_info *compptr;
+  JSAMPARRAY xbuf;
+
+  /* Get top-level space for component array pointers.
+   * We alloc both arrays with one call to save a few cycles.
+   */
+  main->xbuffer[0] = (JSAMPIMAGE)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
+  main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
+      cinfo->min_DCT_scaled_size; /* height of a row group of component */
+    /* Get space for pointer lists --- M+4 row groups in each list.
+     * We alloc both pointer lists with one call to save a few cycles.
+     */
+    xbuf = (JSAMPARRAY)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
+    xbuf += rgroup;		/* want one row group at negative offsets */
+    main->xbuffer[0][ci] = xbuf;
+    xbuf += rgroup * (M + 4);
+    main->xbuffer[1][ci] = xbuf;
+  }
+}
+
+
+LOCAL(void)
+make_funny_pointers (j_decompress_ptr cinfo)
+/* Create the funny pointer lists discussed in the comments above.
+ * The actual workspace is already allocated (in main->buffer),
+ * and the space for the pointer lists is allocated too.
+ * This routine just fills in the curiously ordered lists.
+ * This will be repeated at the beginning of each pass.
+ */
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+  int ci, i, rgroup;
+  int M = cinfo->min_DCT_scaled_size;
+  jpeg_component_info *compptr;
+  JSAMPARRAY buf, xbuf0, xbuf1;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
+      cinfo->min_DCT_scaled_size; /* height of a row group of component */
+    xbuf0 = main->xbuffer[0][ci];
+    xbuf1 = main->xbuffer[1][ci];
+    /* First copy the workspace pointers as-is */
+    buf = main->buffer[ci];
+    for (i = 0; i < rgroup * (M + 2); i++) {
+      xbuf0[i] = xbuf1[i] = buf[i];
+    }
+    /* In the second list, put the last four row groups in swapped order */
+    for (i = 0; i < rgroup * 2; i++) {
+      xbuf1[rgroup*(M-2) + i] = buf[rgroup*M + i];
+      xbuf1[rgroup*M + i] = buf[rgroup*(M-2) + i];
+    }
+    /* The wraparound pointers at top and bottom will be filled later
+     * (see set_wraparound_pointers, below).  Initially we want the "above"
+     * pointers to duplicate the first actual data line.  This only needs
+     * to happen in xbuffer[0].
+     */
+    for (i = 0; i < rgroup; i++) {
+      xbuf0[i - rgroup] = xbuf0[0];
+    }
+  }
+}
+
+
+LOCAL(void)
+set_wraparound_pointers (j_decompress_ptr cinfo)
+/* Set up the "wraparound" pointers at top and bottom of the pointer lists.
+ * This changes the pointer list state from top-of-image to the normal state.
+ */
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+  int ci, i, rgroup;
+  int M = cinfo->min_DCT_scaled_size;
+  jpeg_component_info *compptr;
+  JSAMPARRAY xbuf0, xbuf1;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
+      cinfo->min_DCT_scaled_size; /* height of a row group of component */
+    xbuf0 = main->xbuffer[0][ci];
+    xbuf1 = main->xbuffer[1][ci];
+    for (i = 0; i < rgroup; i++) {
+      xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];
+      xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];
+      xbuf0[rgroup*(M+2) + i] = xbuf0[i];
+      xbuf1[rgroup*(M+2) + i] = xbuf1[i];
+    }
+  }
+}
+
+
+LOCAL(void)
+set_bottom_pointers (j_decompress_ptr cinfo)
+/* Change the pointer lists to duplicate the last sample row at the bottom
+ * of the image.  whichptr indicates which xbuffer holds the final iMCU row.
+ * Also sets rowgroups_avail to indicate number of nondummy row groups in row.
+ */
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+  int ci, i, rgroup, iMCUheight, rows_left;
+  jpeg_component_info *compptr;
+  JSAMPARRAY xbuf;
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Count sample rows in one iMCU row and in one row group */
+    iMCUheight = compptr->v_samp_factor * compptr->DCT_scaled_size;
+    rgroup = iMCUheight / cinfo->min_DCT_scaled_size;
+    /* Count nondummy sample rows remaining for this component */
+    rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight);
+    if (rows_left == 0) rows_left = iMCUheight;
+    /* Count nondummy row groups.  Should get same answer for each component,
+     * so we need only do it once.
+     */
+    if (ci == 0) {
+      main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
+    }
+    /* Duplicate the last real sample row rgroup*2 times; this pads out the
+     * last partial rowgroup and ensures at least one full rowgroup of context.
+     */
+    xbuf = main->xbuffer[main->whichptr][ci];
+    for (i = 0; i < rgroup * 2; i++) {
+      xbuf[rows_left + i] = xbuf[rows_left-1];
+    }
+  }
+}
+
+
+/*
+ * Initialize for a processing pass.
+ */
+
+METHODDEF(void)
+start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+
+  switch (pass_mode) {
+  case JBUF_PASS_THRU:
+    if (cinfo->upsample->need_context_rows) {
+      main->pub.process_data = process_data_context_main;
+      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
+      main->whichptr = 0;	/* Read first iMCU row into xbuffer[0] */
+      main->context_state = CTX_PREPARE_FOR_IMCU;
+      main->iMCU_row_ctr = 0;
+    } else {
+      /* Simple case with no context needed */
+      main->pub.process_data = process_data_simple_main;
+    }
+    main->buffer_full = FALSE;	/* Mark buffer empty */
+    main->rowgroup_ctr = 0;
+    break;
+#ifdef QUANT_2PASS_SUPPORTED
+  case JBUF_CRANK_DEST:
+    /* For last pass of 2-pass quantization, just crank the postprocessor */
+    main->pub.process_data = process_data_crank_post;
+    break;
+#endif
+  default:
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    break;
+  }
+}
+
+
+/*
+ * Process some data.
+ * This handles the simple case where no context is required.
+ */
+
+METHODDEF(void)
+process_data_simple_main (j_decompress_ptr cinfo,
+			  JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+			  JDIMENSION out_rows_avail)
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+  JDIMENSION rowgroups_avail;
+
+  /* Read input data if we haven't filled the main buffer yet */
+  if (! main->buffer_full) {
+    if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer))
+      return;			/* suspension forced, can do nothing more */
+    main->buffer_full = TRUE;	/* OK, we have an iMCU row to work with */
+  }
+
+  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
+  rowgroups_avail = (JDIMENSION) cinfo->min_DCT_scaled_size;
+  /* Note: at the bottom of the image, we may pass extra garbage row groups
+   * to the postprocessor.  The postprocessor has to check for bottom
+   * of image anyway (at row resolution), so no point in us doing it too.
+   */
+
+  /* Feed the postprocessor */
+  (*cinfo->post->post_process_data) (cinfo, main->buffer,
+				     &main->rowgroup_ctr, rowgroups_avail,
+				     output_buf, out_row_ctr, out_rows_avail);
+
+  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
+  if (main->rowgroup_ctr >= rowgroups_avail) {
+    main->buffer_full = FALSE;
+    main->rowgroup_ctr = 0;
+  }
+}
+
+
+/*
+ * Process some data.
+ * This handles the case where context rows must be provided.
+ */
+
+METHODDEF(void)
+process_data_context_main (j_decompress_ptr cinfo,
+			   JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+			   JDIMENSION out_rows_avail)
+{
+  my_main_ptr main = (my_main_ptr) cinfo->main;
+
+  /* Read input data if we haven't filled the main buffer yet */
+  if (! main->buffer_full) {
+    if (! (*cinfo->coef->decompress_data) (cinfo,
+					   main->xbuffer[main->whichptr]))
+      return;			/* suspension forced, can do nothing more */
+    main->buffer_full = TRUE;	/* OK, we have an iMCU row to work with */
+    main->iMCU_row_ctr++;	/* count rows received */
+  }
+
+  /* Postprocessor typically will not swallow all the input data it is handed
+   * in one call (due to filling the output buffer first).  Must be prepared
+   * to exit and restart.  This switch lets us keep track of how far we got.
+   * Note that each case falls through to the next on successful completion.
+   */
+  switch (main->context_state) {
+  case CTX_POSTPONED_ROW:
+    /* Call postprocessor using previously set pointers for postponed row */
+    (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
+			&main->rowgroup_ctr, main->rowgroups_avail,
+			output_buf, out_row_ctr, out_rows_avail);
+    if (main->rowgroup_ctr < main->rowgroups_avail)
+      return;			/* Need to suspend */
+    main->context_state = CTX_PREPARE_FOR_IMCU;
+    if (*out_row_ctr >= out_rows_avail)
+      return;			/* Postprocessor exactly filled output buf */
+    /*FALLTHROUGH*/
+  case CTX_PREPARE_FOR_IMCU:
+    /* Prepare to process first M-1 row groups of this iMCU row */
+    main->rowgroup_ctr = 0;
+    main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size - 1);
+    /* Check for bottom of image: if so, tweak pointers to "duplicate"
+     * the last sample row, and adjust rowgroups_avail to ignore padding rows.
+     */
+    if (main->iMCU_row_ctr == cinfo->total_iMCU_rows)
+      set_bottom_pointers(cinfo);
+    main->context_state = CTX_PROCESS_IMCU;
+    /*FALLTHROUGH*/
+  case CTX_PROCESS_IMCU:
+    /* Call postprocessor using previously set pointers */
+    (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
+			&main->rowgroup_ctr, main->rowgroups_avail,
+			output_buf, out_row_ctr, out_rows_avail);
+    if (main->rowgroup_ctr < main->rowgroups_avail)
+      return;			/* Need to suspend */
+    /* After the first iMCU, change wraparound pointers to normal state */
+    if (main->iMCU_row_ctr == 1)
+      set_wraparound_pointers(cinfo);
+    /* Prepare to load new iMCU row using other xbuffer list */
+    main->whichptr ^= 1;	/* 0=>1 or 1=>0 */
+    main->buffer_full = FALSE;
+    /* Still need to process last row group of this iMCU row, */
+    /* which is saved at index M+1 of the other xbuffer */
+    main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_scaled_size + 1);
+    main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size + 2);
+    main->context_state = CTX_POSTPONED_ROW;
+  }
+}
+
+
+/*
+ * Process some data.
+ * Final pass of two-pass quantization: just call the postprocessor.
+ * Source data will be the postprocessor controller's internal buffer.
+ */
+
+#ifdef QUANT_2PASS_SUPPORTED
+
+METHODDEF(void)
+process_data_crank_post (j_decompress_ptr cinfo,
+			 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+			 JDIMENSION out_rows_avail)
+{
+  (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL,
+				     (JDIMENSION *) NULL, (JDIMENSION) 0,
+				     output_buf, out_row_ctr, out_rows_avail);
+}
+
+#endif /* QUANT_2PASS_SUPPORTED */
+
+
+/*
+ * Initialize main buffer controller.
+ */
+
+GLOBAL(void)
+jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
+{
+  my_main_ptr main;
+  int ci, rgroup, ngroups;
+  jpeg_component_info *compptr;
+
+  main = (my_main_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_main_controller));
+  cinfo->main = (struct jpeg_d_main_controller *) main;
+  main->pub.start_pass = start_pass_main;
+
+  if (need_full_buffer)		/* shouldn't happen */
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+
+  /* Allocate the workspace.
+   * ngroups is the number of row groups we need.
+   */
+  if (cinfo->upsample->need_context_rows) {
+    if (cinfo->min_DCT_scaled_size < 2) /* unsupported, see comments above */
+      ERREXIT(cinfo, JERR_NOTIMPL);
+    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
+    ngroups = cinfo->min_DCT_scaled_size + 2;
+  } else {
+    ngroups = cinfo->min_DCT_scaled_size;
+  }
+
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
+      cinfo->min_DCT_scaled_size; /* height of a row group of component */
+    main->buffer[ci] = (*cinfo->mem->alloc_sarray)
+			((j_common_ptr) cinfo, JPOOL_IMAGE,
+			 compptr->width_in_blocks * compptr->DCT_scaled_size,
+			 (JDIMENSION) (rgroup * ngroups));
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmarker.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmarker.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmarker.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1360 @@
+/*
+ * jdmarker.c
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to decode JPEG datastream markers.
+ * Most of the complexity arises from our desire to support input
+ * suspension: if not all of the data for a marker is available,
+ * we must exit back to the application.  On resumption, we reprocess
+ * the marker.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+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_APP1  = 0xe1,
+  M_APP2  = 0xe2,
+  M_APP3  = 0xe3,
+  M_APP4  = 0xe4,
+  M_APP5  = 0xe5,
+  M_APP6  = 0xe6,
+  M_APP7  = 0xe7,
+  M_APP8  = 0xe8,
+  M_APP9  = 0xe9,
+  M_APP10 = 0xea,
+  M_APP11 = 0xeb,
+  M_APP12 = 0xec,
+  M_APP13 = 0xed,
+  M_APP14 = 0xee,
+  M_APP15 = 0xef,
+  
+  M_JPG0  = 0xf0,
+  M_JPG13 = 0xfd,
+  M_COM   = 0xfe,
+  
+  M_TEM   = 0x01,
+  
+  M_ERROR = 0x100
+} JPEG_MARKER;
+
+
+/* Private state */
+
+typedef struct {
+  struct jpeg_marker_reader pub; /* public fields */
+
+  /* Application-overridable marker processing methods */
+  jpeg_marker_parser_method process_COM;
+  jpeg_marker_parser_method process_APPn[16];
+
+  /* Limit on marker data length to save for each marker type */
+  unsigned int length_limit_COM;
+  unsigned int length_limit_APPn[16];
+
+  /* Status of COM/APPn marker saving */
+  jpeg_saved_marker_ptr cur_marker;	/* NULL if not processing a marker */
+  unsigned int bytes_read;		/* data bytes read so far in marker */
+  /* Note: cur_marker is not linked into marker_list until it's all read. */
+} my_marker_reader;
+
+typedef my_marker_reader * my_marker_ptr;
+
+
+/*
+ * Macros for fetching data from the data source module.
+ *
+ * At all times, cinfo->src->next_input_byte and ->bytes_in_buffer reflect
+ * the current restart point; we update them only when we have reached a
+ * suitable place to restart if a suspension occurs.
+ */
+
+/* Declare and initialize local copies of input pointer/count */
+#define INPUT_VARS(cinfo)  \
+	struct jpeg_source_mgr * datasrc = (cinfo)->src;  \
+	const JOCTET * next_input_byte = datasrc->next_input_byte;  \
+	size_t bytes_in_buffer = datasrc->bytes_in_buffer
+
+/* Unload the local copies --- do this only at a restart boundary */
+#define INPUT_SYNC(cinfo)  \
+	( datasrc->next_input_byte = next_input_byte,  \
+	  datasrc->bytes_in_buffer = bytes_in_buffer )
+
+/* Reload the local copies --- used only in MAKE_BYTE_AVAIL */
+#define INPUT_RELOAD(cinfo)  \
+	( next_input_byte = datasrc->next_input_byte,  \
+	  bytes_in_buffer = datasrc->bytes_in_buffer )
+
+/* Internal macro for INPUT_BYTE and INPUT_2BYTES: make a byte available.
+ * Note we do *not* do INPUT_SYNC before calling fill_input_buffer,
+ * but we must reload the local copies after a successful fill.
+ */
+#define MAKE_BYTE_AVAIL(cinfo,action)  \
+	if (bytes_in_buffer == 0) {  \
+	  if (! (*datasrc->fill_input_buffer) (cinfo))  \
+	    { action; }  \
+	  INPUT_RELOAD(cinfo);  \
+	}
+
+/* Read a byte into variable V.
+ * If must suspend, take the specified action (typically "return FALSE").
+ */
+#define INPUT_BYTE(cinfo,V,action)  \
+	MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
+		  bytes_in_buffer--; \
+		  V = GETJOCTET(*next_input_byte++); )
+
+/* As above, but read two bytes interpreted as an unsigned 16-bit integer.
+ * V should be declared unsigned int or perhaps INT32.
+ */
+#define INPUT_2BYTES(cinfo,V,action)  \
+	MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
+		  bytes_in_buffer--; \
+		  V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \
+		  MAKE_BYTE_AVAIL(cinfo,action); \
+		  bytes_in_buffer--; \
+		  V += GETJOCTET(*next_input_byte++); )
+
+
+/*
+ * Routines to process JPEG markers.
+ *
+ * Entry condition: JPEG marker itself has been read and its code saved
+ *   in cinfo->unread_marker; input restart point is just after the marker.
+ *
+ * Exit: if return TRUE, have read and processed any parameters, and have
+ *   updated the restart point to point after the parameters.
+ *   If return FALSE, was forced to suspend before reaching end of
+ *   marker parameters; restart point has not been moved.  Same routine
+ *   will be called again after application supplies more input data.
+ *
+ * This approach to suspension assumes that all of a marker's parameters
+ * can fit into a single input bufferload.  This should hold for "normal"
+ * markers.  Some COM/APPn markers might have large parameter segments
+ * that might not fit.  If we are simply dropping such a marker, we use
+ * skip_input_data to get past it, and thereby put the problem on the
+ * source manager's shoulders.  If we are saving the marker's contents
+ * into memory, we use a slightly different convention: when forced to
+ * suspend, the marker processor updates the restart point to the end of
+ * what it's consumed (ie, the end of the buffer) before returning FALSE.
+ * On resumption, cinfo->unread_marker still contains the marker code,
+ * but the data source will point to the next chunk of marker data.
+ * The marker processor must retain internal state to deal with this.
+ *
+ * Note that we don't bother to avoid duplicate trace messages if a
+ * suspension occurs within marker parameters.  Other side effects
+ * require more care.
+ */
+
+
+LOCAL(boolean)
+get_soi (j_decompress_ptr cinfo)
+/* Process an SOI marker */
+{
+  int i;
+  
+  TRACEMS(cinfo, 1, JTRC_SOI);
+
+  if (cinfo->marker->saw_SOI)
+    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
+
+  /* Reset all parameters that are defined to be reset by SOI */
+
+  for (i = 0; i < NUM_ARITH_TBLS; i++) {
+    cinfo->arith_dc_L[i] = 0;
+    cinfo->arith_dc_U[i] = 1;
+    cinfo->arith_ac_K[i] = 5;
+  }
+  cinfo->restart_interval = 0;
+
+  /* Set initial assumptions for colorspace etc */
+
+  cinfo->jpeg_color_space = JCS_UNKNOWN;
+  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
+
+  cinfo->saw_JFIF_marker = FALSE;
+  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
+  cinfo->JFIF_minor_version = 1;
+  cinfo->density_unit = 0;
+  cinfo->X_density = 1;
+  cinfo->Y_density = 1;
+  cinfo->saw_Adobe_marker = FALSE;
+  cinfo->Adobe_transform = 0;
+
+  cinfo->marker->saw_SOI = TRUE;
+
+  return TRUE;
+}
+
+
+LOCAL(boolean)
+get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
+/* Process a SOFn marker */
+{
+  INT32 length;
+  int c, ci;
+  jpeg_component_info * compptr;
+  INPUT_VARS(cinfo);
+
+  cinfo->progressive_mode = is_prog;
+  cinfo->arith_code = is_arith;
+
+  INPUT_2BYTES(cinfo, length, return FALSE);
+
+  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
+  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
+  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
+  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
+
+  length -= 8;
+
+  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
+	   (int) cinfo->image_width, (int) cinfo->image_height,
+	   cinfo->num_components);
+
+  if (cinfo->marker->saw_SOF)
+    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
+
+  /* We don't support files in which the image height is initially specified */
+  /* as 0 and is later redefined by DNL.  As long as we have to check that,  */
+  /* might as well have a general sanity check. */
+  if (cinfo->image_height <= 0 || cinfo->image_width <= 0
+      || cinfo->num_components <= 0)
+    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
+
+  if (length != (cinfo->num_components * 3))
+    ERREXIT(cinfo, JERR_BAD_LENGTH);
+
+  if (cinfo->comp_info == NULL)	/* do only once, even if suspend */
+    cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small)
+			((j_common_ptr) cinfo, JPOOL_IMAGE,
+			 cinfo->num_components * SIZEOF(jpeg_component_info));
+  
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    compptr->component_index = ci;
+    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
+    INPUT_BYTE(cinfo, c, return FALSE);
+    compptr->h_samp_factor = (c >> 4) & 15;
+    compptr->v_samp_factor = (c     ) & 15;
+    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
+
+    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
+	     compptr->component_id, compptr->h_samp_factor,
+	     compptr->v_samp_factor, compptr->quant_tbl_no);
+  }
+
+  cinfo->marker->saw_SOF = TRUE;
+
+  INPUT_SYNC(cinfo);
+  return TRUE;
+}
+
+
+LOCAL(boolean)
+get_sos (j_decompress_ptr cinfo)
+/* Process a SOS marker */
+{
+  INT32 length;
+  int i, ci, n, c, cc;
+  jpeg_component_info * compptr;
+  INPUT_VARS(cinfo);
+
+  if (! cinfo->marker->saw_SOF)
+    ERREXIT(cinfo, JERR_SOS_NO_SOF);
+
+  INPUT_2BYTES(cinfo, length, return FALSE);
+
+  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
+
+  TRACEMS1(cinfo, 1, JTRC_SOS, n);
+
+  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
+    ERREXIT(cinfo, JERR_BAD_LENGTH);
+
+  cinfo->comps_in_scan = n;
+
+  /* Collect the component-spec parameters */
+
+  for (i = 0; i < n; i++) {
+    INPUT_BYTE(cinfo, cc, return FALSE);
+    INPUT_BYTE(cinfo, c, return FALSE);
+    
+    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	 ci++, compptr++) {
+      if (cc == compptr->component_id)
+	goto id_found;
+    }
+
+    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
+
+  id_found:
+
+    cinfo->cur_comp_info[i] = compptr;
+    compptr->dc_tbl_no = (c >> 4) & 15;
+    compptr->ac_tbl_no = (c     ) & 15;
+    
+    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
+	     compptr->dc_tbl_no, compptr->ac_tbl_no);
+  }
+
+  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
+  INPUT_BYTE(cinfo, c, return FALSE);
+  cinfo->Ss = c;
+  INPUT_BYTE(cinfo, c, return FALSE);
+  cinfo->Se = c;
+  INPUT_BYTE(cinfo, c, return FALSE);
+  cinfo->Ah = (c >> 4) & 15;
+  cinfo->Al = (c     ) & 15;
+
+  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
+	   cinfo->Ah, cinfo->Al);
+
+  /* Prepare to scan data & restart markers */
+  cinfo->marker->next_restart_num = 0;
+
+  /* Count another SOS marker */
+  cinfo->input_scan_number++;
+
+  INPUT_SYNC(cinfo);
+  return TRUE;
+}
+
+
+#ifdef D_ARITH_CODING_SUPPORTED
+
+LOCAL(boolean)
+get_dac (j_decompress_ptr cinfo)
+/* Process a DAC marker */
+{
+  INT32 length;
+  int index, val;
+  INPUT_VARS(cinfo);
+
+  INPUT_2BYTES(cinfo, length, return FALSE);
+  length -= 2;
+  
+  while (length > 0) {
+    INPUT_BYTE(cinfo, index, return FALSE);
+    INPUT_BYTE(cinfo, val, return FALSE);
+
+    length -= 2;
+
+    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
+
+    if (index < 0 || index >= (2*NUM_ARITH_TBLS))
+      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
+
+    if (index >= NUM_ARITH_TBLS) { /* define AC table */
+      cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val;
+    } else {			/* define DC table */
+      cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F);
+      cinfo->arith_dc_U[index] = (UINT8) (val >> 4);
+      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
+	ERREXIT1(cinfo, JERR_DAC_VALUE, val);
+    }
+  }
+
+  if (length != 0)
+    ERREXIT(cinfo, JERR_BAD_LENGTH);
+
+  INPUT_SYNC(cinfo);
+  return TRUE;
+}
+
+#else /* ! D_ARITH_CODING_SUPPORTED */
+
+#define get_dac(cinfo)  skip_variable(cinfo)
+
+#endif /* D_ARITH_CODING_SUPPORTED */
+
+
+LOCAL(boolean)
+get_dht (j_decompress_ptr cinfo)
+/* Process a DHT marker */
+{
+  INT32 length;
+  UINT8 bits[17];
+  UINT8 huffval[256];
+  int i, index, count;
+  JHUFF_TBL **htblptr;
+  INPUT_VARS(cinfo);
+
+  INPUT_2BYTES(cinfo, length, return FALSE);
+  length -= 2;
+  
+  while (length > 16) {
+    INPUT_BYTE(cinfo, index, return FALSE);
+
+    TRACEMS1(cinfo, 1, JTRC_DHT, index);
+      
+    bits[0] = 0;
+    count = 0;
+    for (i = 1; i <= 16; i++) {
+      INPUT_BYTE(cinfo, bits[i], return FALSE);
+      count += bits[i];
+    }
+
+    length -= 1 + 16;
+
+    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
+	     bits[1], bits[2], bits[3], bits[4],
+	     bits[5], bits[6], bits[7], bits[8]);
+    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
+	     bits[9], bits[10], bits[11], bits[12],
+	     bits[13], bits[14], bits[15], bits[16]);
+
+    /* Here we just do minimal validation of the counts to avoid walking
+     * off the end of our table space.  jdhuff.c will check more carefully.
+     */
+    if (count > 256 || ((INT32) count) > length)
+      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+
+    for (i = 0; i < count; i++)
+      INPUT_BYTE(cinfo, huffval[i], return FALSE);
+
+    length -= count;
+
+    if (index & 0x10) {		/* AC table definition */
+      index -= 0x10;
+      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
+    } else {			/* DC table definition */
+      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
+    }
+
+    if (index < 0 || index >= NUM_HUFF_TBLS)
+      ERREXIT1(cinfo, JERR_DHT_INDEX, index);
+
+    if (*htblptr == NULL)
+      *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
+  
+    MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
+    MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval));
+  }
+
+  if (length != 0)
+    ERREXIT(cinfo, JERR_BAD_LENGTH);
+
+  INPUT_SYNC(cinfo);
+  return TRUE;
+}
+
+
+LOCAL(boolean)
+get_dqt (j_decompress_ptr cinfo)
+/* Process a DQT marker */
+{
+  INT32 length;
+  int n, i, prec;
+  unsigned int tmp;
+  JQUANT_TBL *quant_ptr;
+  INPUT_VARS(cinfo);
+
+  INPUT_2BYTES(cinfo, length, return FALSE);
+  length -= 2;
+
+  while (length > 0) {
+    INPUT_BYTE(cinfo, n, return FALSE);
+    prec = n >> 4;
+    n &= 0x0F;
+
+    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
+
+    if (n >= NUM_QUANT_TBLS)
+      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
+      
+    if (cinfo->quant_tbl_ptrs[n] == NULL)
+      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo);
+    quant_ptr = cinfo->quant_tbl_ptrs[n];
+
+    for (i = 0; i < DCTSIZE2; i++) {
+      if (prec)
+	INPUT_2BYTES(cinfo, tmp, return FALSE);
+      else
+	INPUT_BYTE(cinfo, tmp, return FALSE);
+      /* We convert the zigzag-order table to natural array order. */
+      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp;
+    }
+
+    if (cinfo->err->trace_level >= 2) {
+      for (i = 0; i < DCTSIZE2; i += 8) {
+	TRACEMS8(cinfo, 2, JTRC_QUANTVALS,
+		 quant_ptr->quantval[i],   quant_ptr->quantval[i+1],
+		 quant_ptr->quantval[i+2], quant_ptr->quantval[i+3],
+		 quant_ptr->quantval[i+4], quant_ptr->quantval[i+5],
+		 quant_ptr->quantval[i+6], quant_ptr->quantval[i+7]);
+      }
+    }
+
+    length -= DCTSIZE2+1;
+    if (prec) length -= DCTSIZE2;
+  }
+
+  if (length != 0)
+    ERREXIT(cinfo, JERR_BAD_LENGTH);
+
+  INPUT_SYNC(cinfo);
+  return TRUE;
+}
+
+
+LOCAL(boolean)
+get_dri (j_decompress_ptr cinfo)
+/* Process a DRI marker */
+{
+  INT32 length;
+  unsigned int tmp;
+  INPUT_VARS(cinfo);
+
+  INPUT_2BYTES(cinfo, length, return FALSE);
+  
+  if (length != 4)
+    ERREXIT(cinfo, JERR_BAD_LENGTH);
+
+  INPUT_2BYTES(cinfo, tmp, return FALSE);
+
+  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
+
+  cinfo->restart_interval = tmp;
+
+  INPUT_SYNC(cinfo);
+  return TRUE;
+}
+
+
+/*
+ * Routines for processing APPn and COM markers.
+ * These are either saved in memory or discarded, per application request.
+ * APP0 and APP14 are specially checked to see if they are
+ * JFIF and Adobe markers, respectively.
+ */
+
+#define APP0_DATA_LEN	14	/* Length of interesting data in APP0 */
+#define APP14_DATA_LEN	12	/* Length of interesting data in APP14 */
+#define APPN_DATA_LEN	14	/* Must be the largest of the above!! */
+
+
+LOCAL(void)
+examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data,
+	      unsigned int datalen, INT32 remaining)
+/* Examine first few bytes from an APP0.
+ * Take appropriate action if it is a JFIF marker.
+ * datalen is # of bytes at data[], remaining is length of rest of marker data.
+ */
+{
+  INT32 totallen = (INT32) datalen + remaining;
+
+  if (datalen >= APP0_DATA_LEN &&
+      GETJOCTET(data[0]) == 0x4A &&
+      GETJOCTET(data[1]) == 0x46 &&
+      GETJOCTET(data[2]) == 0x49 &&
+      GETJOCTET(data[3]) == 0x46 &&
+      GETJOCTET(data[4]) == 0) {
+    /* Found JFIF APP0 marker: save info */
+    cinfo->saw_JFIF_marker = TRUE;
+    cinfo->JFIF_major_version = GETJOCTET(data[5]);
+    cinfo->JFIF_minor_version = GETJOCTET(data[6]);
+    cinfo->density_unit = GETJOCTET(data[7]);
+    cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]);
+    cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]);
+    /* Check version.
+     * Major version must be 1, anything else signals an incompatible change.
+     * (We used to treat this as an error, but now it's a nonfatal warning,
+     * because some bozo at Hijaak couldn't read the spec.)
+     * Minor version should be 0..2, but process anyway if newer.
+     */
+    if (cinfo->JFIF_major_version != 1)
+      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
+	      cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
+    /* Generate trace messages */
+    TRACEMS5(cinfo, 1, JTRC_JFIF,
+	     cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
+	     cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
+    /* Validate thumbnail dimensions and issue appropriate messages */
+    if (GETJOCTET(data[12]) | GETJOCTET(data[13]))
+      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL,
+	       GETJOCTET(data[12]), GETJOCTET(data[13]));
+    totallen -= APP0_DATA_LEN;
+    if (totallen !=
+	((INT32)GETJOCTET(data[12]) * (INT32)GETJOCTET(data[13]) * (INT32) 3))
+      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen);
+  } else if (datalen >= 6 &&
+      GETJOCTET(data[0]) == 0x4A &&
+      GETJOCTET(data[1]) == 0x46 &&
+      GETJOCTET(data[2]) == 0x58 &&
+      GETJOCTET(data[3]) == 0x58 &&
+      GETJOCTET(data[4]) == 0) {
+    /* Found JFIF "JFXX" extension APP0 marker */
+    /* The library doesn't actually do anything with these,
+     * but we try to produce a helpful trace message.
+     */
+    switch (GETJOCTET(data[5])) {
+    case 0x10:
+      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int) totallen);
+      break;
+    case 0x11:
+      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int) totallen);
+      break;
+    case 0x13:
+      TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int) totallen);
+      break;
+    default:
+      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION,
+	       GETJOCTET(data[5]), (int) totallen);
+      break;
+    }
+  } else {
+    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
+    TRACEMS1(cinfo, 1, JTRC_APP0, (int) totallen);
+  }
+}
+
+
+LOCAL(void)
+examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data,
+	       unsigned int datalen, INT32 remaining)
+/* Examine first few bytes from an APP14.
+ * Take appropriate action if it is an Adobe marker.
+ * datalen is # of bytes at data[], remaining is length of rest of marker data.
+ */
+{
+  unsigned int version, flags0, flags1, transform;
+
+  if (datalen >= APP14_DATA_LEN &&
+      GETJOCTET(data[0]) == 0x41 &&
+      GETJOCTET(data[1]) == 0x64 &&
+      GETJOCTET(data[2]) == 0x6F &&
+      GETJOCTET(data[3]) == 0x62 &&
+      GETJOCTET(data[4]) == 0x65) {
+    /* Found Adobe APP14 marker */
+    version = (GETJOCTET(data[5]) << 8) + GETJOCTET(data[6]);
+    flags0 = (GETJOCTET(data[7]) << 8) + GETJOCTET(data[8]);
+    flags1 = (GETJOCTET(data[9]) << 8) + GETJOCTET(data[10]);
+    transform = GETJOCTET(data[11]);
+    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
+    cinfo->saw_Adobe_marker = TRUE;
+    cinfo->Adobe_transform = (UINT8) transform;
+  } else {
+    /* Start of APP14 does not match "Adobe", or too short */
+    TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining));
+  }
+}
+
+
+METHODDEF(boolean)
+get_interesting_appn (j_decompress_ptr cinfo)
+/* Process an APP0 or APP14 marker without saving it */
+{
+  INT32 length;
+  JOCTET b[APPN_DATA_LEN];
+  unsigned int i, numtoread;
+  INPUT_VARS(cinfo);
+
+  INPUT_2BYTES(cinfo, length, return FALSE);
+  length -= 2;
+
+  /* get the interesting part of the marker data */
+  if (length >= APPN_DATA_LEN)
+    numtoread = APPN_DATA_LEN;
+  else if (length > 0)
+    numtoread = (unsigned int) length;
+  else
+    numtoread = 0;
+  for (i = 0; i < numtoread; i++)
+    INPUT_BYTE(cinfo, b[i], return FALSE);
+  length -= numtoread;
+
+  /* process it */
+  switch (cinfo->unread_marker) {
+  case M_APP0:
+    examine_app0(cinfo, (JOCTET FAR *) b, numtoread, length);
+    break;
+  case M_APP14:
+    examine_app14(cinfo, (JOCTET FAR *) b, numtoread, length);
+    break;
+  default:
+    /* can't get here unless jpeg_save_markers chooses wrong processor */
+    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
+    break;
+  }
+
+  /* skip any remaining data -- could be lots */
+  INPUT_SYNC(cinfo);
+  if (length > 0)
+    (*cinfo->src->skip_input_data) (cinfo, (long) length);
+
+  return TRUE;
+}
+
+
+#ifdef SAVE_MARKERS_SUPPORTED
+
+METHODDEF(boolean)
+save_marker (j_decompress_ptr cinfo)
+/* Save an APPn or COM marker into the marker list */
+{
+  my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+  jpeg_saved_marker_ptr cur_marker = marker->cur_marker;
+  unsigned int bytes_read, data_length;
+  JOCTET FAR * data;
+  INT32 length = 0;
+  INPUT_VARS(cinfo);
+
+  if (cur_marker == NULL) {
+    /* begin reading a marker */
+    INPUT_2BYTES(cinfo, length, return FALSE);
+    length -= 2;
+    if (length >= 0) {		/* watch out for bogus length word */
+      /* figure out how much we want to save */
+      unsigned int limit;
+      if (cinfo->unread_marker == (int) M_COM)
+	limit = marker->length_limit_COM;
+      else
+	limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0];
+      if ((unsigned int) length < limit)
+	limit = (unsigned int) length;
+      /* allocate and initialize the marker item */
+      cur_marker = (jpeg_saved_marker_ptr)
+	(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				    SIZEOF(struct jpeg_marker_struct) + limit);
+      cur_marker->next = NULL;
+      cur_marker->marker = (UINT8) cinfo->unread_marker;
+      cur_marker->original_length = (unsigned int) length;
+      cur_marker->data_length = limit;
+      /* data area is just beyond the jpeg_marker_struct */
+      data = cur_marker->data = (JOCTET FAR *) (cur_marker + 1);
+      marker->cur_marker = cur_marker;
+      marker->bytes_read = 0;
+      bytes_read = 0;
+      data_length = limit;
+    } else {
+      /* deal with bogus length word */
+      bytes_read = data_length = 0;
+      data = NULL;
+    }
+  } else {
+    /* resume reading a marker */
+    bytes_read = marker->bytes_read;
+    data_length = cur_marker->data_length;
+    data = cur_marker->data + bytes_read;
+  }
+
+  while (bytes_read < data_length) {
+    INPUT_SYNC(cinfo);		/* move the restart point to here */
+    marker->bytes_read = bytes_read;
+    /* If there's not at least one byte in buffer, suspend */
+    MAKE_BYTE_AVAIL(cinfo, return FALSE);
+    /* Copy bytes with reasonable rapidity */
+    while (bytes_read < data_length && bytes_in_buffer > 0) {
+      *data++ = *next_input_byte++;
+      bytes_in_buffer--;
+      bytes_read++;
+    }
+  }
+
+  /* Done reading what we want to read */
+  if (cur_marker != NULL) {	/* will be NULL if bogus length word */
+    /* Add new marker to end of list */
+    if (cinfo->marker_list == NULL) {
+      cinfo->marker_list = cur_marker;
+    } else {
+      jpeg_saved_marker_ptr prev = cinfo->marker_list;
+      while (prev->next != NULL)
+	prev = prev->next;
+      prev->next = cur_marker;
+    }
+    /* Reset pointer & calc remaining data length */
+    data = cur_marker->data;
+    length = cur_marker->original_length - data_length;
+  }
+  /* Reset to initial state for next marker */
+  marker->cur_marker = NULL;
+
+  /* Process the marker if interesting; else just make a generic trace msg */
+  switch (cinfo->unread_marker) {
+  case M_APP0:
+    examine_app0(cinfo, data, data_length, length);
+    break;
+  case M_APP14:
+    examine_app14(cinfo, data, data_length, length);
+    break;
+  default:
+    TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker,
+	     (int) (data_length + length));
+    break;
+  }
+
+  /* skip any remaining data -- could be lots */
+  INPUT_SYNC(cinfo);		/* do before skip_input_data */
+  if (length > 0)
+    (*cinfo->src->skip_input_data) (cinfo, (long) length);
+
+  return TRUE;
+}
+
+#endif /* SAVE_MARKERS_SUPPORTED */
+
+
+METHODDEF(boolean)
+skip_variable (j_decompress_ptr cinfo)
+/* Skip over an unknown or uninteresting variable-length marker */
+{
+  INT32 length;
+  INPUT_VARS(cinfo);
+
+  INPUT_2BYTES(cinfo, length, return FALSE);
+  length -= 2;
+  
+  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length);
+
+  INPUT_SYNC(cinfo);		/* do before skip_input_data */
+  if (length > 0)
+    (*cinfo->src->skip_input_data) (cinfo, (long) length);
+
+  return TRUE;
+}
+
+
+/*
+ * Find the next JPEG marker, save it in cinfo->unread_marker.
+ * Returns FALSE if had to suspend before reaching a marker;
+ * in that case cinfo->unread_marker is unchanged.
+ *
+ * Note that the result might not be a valid marker code,
+ * but it will never be 0 or FF.
+ */
+
+LOCAL(boolean)
+next_marker (j_decompress_ptr cinfo)
+{
+  int c;
+  INPUT_VARS(cinfo);
+
+  for (;;) {
+    INPUT_BYTE(cinfo, c, return FALSE);
+    /* Skip any non-FF bytes.
+     * This may look a bit inefficient, but it will not occur in a valid file.
+     * We sync after each discarded byte so that a suspending data source
+     * can discard the byte from its buffer.
+     */
+    while (c != 0xFF) {
+      cinfo->marker->discarded_bytes++;
+      INPUT_SYNC(cinfo);
+      INPUT_BYTE(cinfo, c, return FALSE);
+    }
+    /* This loop swallows any duplicate FF bytes.  Extra FFs are legal as
+     * pad bytes, so don't count them in discarded_bytes.  We assume there
+     * will not be so many consecutive FF bytes as to overflow a suspending
+     * data source's input buffer.
+     */
+    do {
+      INPUT_BYTE(cinfo, c, return FALSE);
+    } while (c == 0xFF);
+    if (c != 0)
+      break;			/* found a valid marker, exit loop */
+    /* Reach here if we found a stuffed-zero data sequence (FF/00).
+     * Discard it and loop back to try again.
+     */
+    cinfo->marker->discarded_bytes += 2;
+    INPUT_SYNC(cinfo);
+  }
+
+  if (cinfo->marker->discarded_bytes != 0) {
+    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
+    cinfo->marker->discarded_bytes = 0;
+  }
+
+  cinfo->unread_marker = c;
+
+  INPUT_SYNC(cinfo);
+  return TRUE;
+}
+
+
+LOCAL(boolean)
+first_marker (j_decompress_ptr cinfo)
+/* Like next_marker, but used to obtain the initial SOI marker. */
+/* For this marker, we do not allow preceding garbage or fill; otherwise,
+ * we might well scan an entire input file before realizing it ain't JPEG.
+ * If an application wants to process non-JFIF files, it must seek to the
+ * SOI before calling the JPEG library.
+ */
+{
+  int c, c2;
+  INPUT_VARS(cinfo);
+
+  INPUT_BYTE(cinfo, c, return FALSE);
+  INPUT_BYTE(cinfo, c2, return FALSE);
+  if (c != 0xFF || c2 != (int) M_SOI)
+    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
+
+  cinfo->unread_marker = c2;
+
+  INPUT_SYNC(cinfo);
+  return TRUE;
+}
+
+
+/*
+ * Read markers until SOS or EOI.
+ *
+ * Returns same codes as are defined for jpeg_consume_input:
+ * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
+ */
+
+METHODDEF(int)
+read_markers (j_decompress_ptr cinfo)
+{
+  /* Outer loop repeats once for each marker. */
+  for (;;) {
+    /* Collect the marker proper, unless we already did. */
+    /* NB: first_marker() enforces the requirement that SOI appear first. */
+    if (cinfo->unread_marker == 0) {
+      if (! cinfo->marker->saw_SOI) {
+	if (! first_marker(cinfo))
+	  return JPEG_SUSPENDED;
+      } else {
+	if (! next_marker(cinfo))
+	  return JPEG_SUSPENDED;
+      }
+    }
+    /* At this point cinfo->unread_marker contains the marker code and the
+     * input point is just past the marker proper, but before any parameters.
+     * A suspension will cause us to return with this state still true.
+     */
+    switch (cinfo->unread_marker) {
+    case M_SOI:
+      if (! get_soi(cinfo))
+	return JPEG_SUSPENDED;
+      break;
+
+    case M_SOF0:		/* Baseline */
+    case M_SOF1:		/* Extended sequential, Huffman */
+      if (! get_sof(cinfo, FALSE, FALSE))
+	return JPEG_SUSPENDED;
+      break;
+
+    case M_SOF2:		/* Progressive, Huffman */
+      if (! get_sof(cinfo, TRUE, FALSE))
+	return JPEG_SUSPENDED;
+      break;
+
+    case M_SOF9:		/* Extended sequential, arithmetic */
+      if (! get_sof(cinfo, FALSE, TRUE))
+	return JPEG_SUSPENDED;
+      break;
+
+    case M_SOF10:		/* Progressive, arithmetic */
+      if (! get_sof(cinfo, TRUE, TRUE))
+	return JPEG_SUSPENDED;
+      break;
+
+    /* Currently unsupported SOFn types */
+    case M_SOF3:		/* Lossless, Huffman */
+    case M_SOF5:		/* Differential sequential, Huffman */
+    case M_SOF6:		/* Differential progressive, Huffman */
+    case M_SOF7:		/* Differential lossless, Huffman */
+    case M_JPG:			/* Reserved for JPEG extensions */
+    case M_SOF11:		/* Lossless, arithmetic */
+    case M_SOF13:		/* Differential sequential, arithmetic */
+    case M_SOF14:		/* Differential progressive, arithmetic */
+    case M_SOF15:		/* Differential lossless, arithmetic */
+      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
+      break;
+
+    case M_SOS:
+      if (! get_sos(cinfo))
+	return JPEG_SUSPENDED;
+      cinfo->unread_marker = 0;	/* processed the marker */
+      return JPEG_REACHED_SOS;
+    
+    case M_EOI:
+      TRACEMS(cinfo, 1, JTRC_EOI);
+      cinfo->unread_marker = 0;	/* processed the marker */
+      return JPEG_REACHED_EOI;
+      
+    case M_DAC:
+      if (! get_dac(cinfo))
+	return JPEG_SUSPENDED;
+      break;
+      
+    case M_DHT:
+      if (! get_dht(cinfo))
+	return JPEG_SUSPENDED;
+      break;
+      
+    case M_DQT:
+      if (! get_dqt(cinfo))
+	return JPEG_SUSPENDED;
+      break;
+      
+    case M_DRI:
+      if (! get_dri(cinfo))
+	return JPEG_SUSPENDED;
+      break;
+      
+    case M_APP0:
+    case M_APP1:
+    case M_APP2:
+    case M_APP3:
+    case M_APP4:
+    case M_APP5:
+    case M_APP6:
+    case M_APP7:
+    case M_APP8:
+    case M_APP9:
+    case M_APP10:
+    case M_APP11:
+    case M_APP12:
+    case M_APP13:
+    case M_APP14:
+    case M_APP15:
+      if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[
+		cinfo->unread_marker - (int) M_APP0]) (cinfo))
+	return JPEG_SUSPENDED;
+      break;
+      
+    case M_COM:
+      if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo))
+	return JPEG_SUSPENDED;
+      break;
+
+    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:
+      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
+      break;
+
+    case M_DNL:			/* Ignore DNL ... perhaps the wrong thing */
+      if (! skip_variable(cinfo))
+	return JPEG_SUSPENDED;
+      break;
+
+    default:			/* must be DHP, EXP, JPGn, or RESn */
+      /* For now, we treat the reserved markers as fatal errors since they are
+       * likely to be used to signal incompatible JPEG Part 3 extensions.
+       * Once the JPEG 3 version-number marker is well defined, this code
+       * ought to change!
+       */
+      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
+      break;
+    }
+    /* Successfully processed marker, so reset state variable */
+    cinfo->unread_marker = 0;
+  } /* end loop */
+}
+
+
+/*
+ * Read a restart marker, which is expected to appear next in the datastream;
+ * if the marker is not there, take appropriate recovery action.
+ * Returns FALSE if suspension is required.
+ *
+ * This is called by the entropy decoder after it has read an appropriate
+ * number of MCUs.  cinfo->unread_marker may be nonzero if the entropy decoder
+ * has already read a marker from the data source.  Under normal conditions
+ * cinfo->unread_marker will be reset to 0 before returning; if not reset,
+ * it holds a marker which the decoder will be unable to read past.
+ */
+
+METHODDEF(boolean)
+read_restart_marker (j_decompress_ptr cinfo)
+{
+  /* Obtain a marker unless we already did. */
+  /* Note that next_marker will complain if it skips any data. */
+  if (cinfo->unread_marker == 0) {
+    if (! next_marker(cinfo))
+      return FALSE;
+  }
+
+  if (cinfo->unread_marker ==
+      ((int) M_RST0 + cinfo->marker->next_restart_num)) {
+    /* Normal case --- swallow the marker and let entropy decoder continue */
+    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
+    cinfo->unread_marker = 0;
+  } else {
+    /* Uh-oh, the restart markers have been messed up. */
+    /* Let the data source manager determine how to resync. */
+    if (! (*cinfo->src->resync_to_restart) (cinfo,
+					    cinfo->marker->next_restart_num))
+      return FALSE;
+  }
+
+  /* Update next-restart state */
+  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
+
+  return TRUE;
+}
+
+
+/*
+ * This is the default resync_to_restart method for data source managers
+ * to use if they don't have any better approach.  Some data source managers
+ * may be able to back up, or may have additional knowledge about the data
+ * which permits a more intelligent recovery strategy; such managers would
+ * presumably supply their own resync method.
+ *
+ * read_restart_marker calls resync_to_restart if it finds a marker other than
+ * the restart marker it was expecting.  (This code is *not* used unless
+ * a nonzero restart interval has been declared.)  cinfo->unread_marker is
+ * the marker code actually found (might be anything, except 0 or FF).
+ * The desired restart marker number (0..7) is passed as a parameter.
+ * This routine is supposed to apply whatever error recovery strategy seems
+ * appropriate in order to position the input stream to the next data segment.
+ * Note that cinfo->unread_marker is treated as a marker appearing before
+ * the current data-source input point; usually it should be reset to zero
+ * before returning.
+ * Returns FALSE if suspension is required.
+ *
+ * This implementation is substantially constrained by wanting to treat the
+ * input as a data stream; this means we can't back up.  Therefore, we have
+ * only the following actions to work with:
+ *   1. Simply discard the marker and let the entropy decoder resume at next
+ *      byte of file.
+ *   2. Read forward until we find another marker, discarding intervening
+ *      data.  (In theory we could look ahead within the current bufferload,
+ *      without having to discard data if we don't find the desired marker.
+ *      This idea is not implemented here, in part because it makes behavior
+ *      dependent on buffer size and chance buffer-boundary positions.)
+ *   3. Leave the marker unread (by failing to zero cinfo->unread_marker).
+ *      This will cause the entropy decoder to process an empty data segment,
+ *      inserting dummy zeroes, and then we will reprocess the marker.
+ *
+ * #2 is appropriate if we think the desired marker lies ahead, while #3 is
+ * appropriate if the found marker is a future restart marker (indicating
+ * that we have missed the desired restart marker, probably because it got
+ * corrupted).
+ * We apply #2 or #3 if the found marker is a restart marker no more than
+ * two counts behind or ahead of the expected one.  We also apply #2 if the
+ * found marker is not a legal JPEG marker code (it's certainly bogus data).
+ * If the found marker is a restart marker more than 2 counts away, we do #1
+ * (too much risk that the marker is erroneous; with luck we will be able to
+ * resync at some future point).
+ * For any valid non-restart JPEG marker, we apply #3.  This keeps us from
+ * overrunning the end of a scan.  An implementation limited to single-scan
+ * files might find it better to apply #2 for markers other than EOI, since
+ * any other marker would have to be bogus data in that case.
+ */
+
+GLOBAL(boolean)
+jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
+{
+  int marker = cinfo->unread_marker;
+  int action = 1;
+  
+  /* Always put up a warning. */
+  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
+  
+  /* Outer loop handles repeated decision after scanning forward. */
+  for (;;) {
+    if (marker < (int) M_SOF0)
+      action = 2;		/* invalid marker */
+    else if (marker < (int) M_RST0 || marker > (int) M_RST7)
+      action = 3;		/* valid non-restart marker */
+    else {
+      if (marker == ((int) M_RST0 + ((desired+1) & 7)) ||
+	  marker == ((int) M_RST0 + ((desired+2) & 7)))
+	action = 3;		/* one of the next two expected restarts */
+      else if (marker == ((int) M_RST0 + ((desired-1) & 7)) ||
+	       marker == ((int) M_RST0 + ((desired-2) & 7)))
+	action = 2;		/* a prior restart, so advance */
+      else
+	action = 1;		/* desired restart or too far away */
+    }
+    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
+    switch (action) {
+    case 1:
+      /* Discard marker and let entropy decoder resume processing. */
+      cinfo->unread_marker = 0;
+      return TRUE;
+    case 2:
+      /* Scan to the next marker, and repeat the decision loop. */
+      if (! next_marker(cinfo))
+	return FALSE;
+      marker = cinfo->unread_marker;
+      break;
+    case 3:
+      /* Return without advancing past this marker. */
+      /* Entropy decoder will be forced to process an empty segment. */
+      return TRUE;
+    }
+  } /* end loop */
+}
+
+
+/*
+ * Reset marker processing state to begin a fresh datastream.
+ */
+
+METHODDEF(void)
+reset_marker_reader (j_decompress_ptr cinfo)
+{
+  my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+
+  cinfo->comp_info = NULL;		/* until allocated by get_sof */
+  cinfo->input_scan_number = 0;		/* no SOS seen yet */
+  cinfo->unread_marker = 0;		/* no pending marker */
+  marker->pub.saw_SOI = FALSE;		/* set internal state too */
+  marker->pub.saw_SOF = FALSE;
+  marker->pub.discarded_bytes = 0;
+  marker->cur_marker = NULL;
+}
+
+
+/*
+ * Initialize the marker reader module.
+ * This is called only once, when the decompression object is created.
+ */
+
+GLOBAL(void)
+jinit_marker_reader (j_decompress_ptr cinfo)
+{
+  my_marker_ptr marker;
+  int i;
+
+  /* Create subobject in permanent pool */
+  marker = (my_marker_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+				SIZEOF(my_marker_reader));
+  cinfo->marker = (struct jpeg_marker_reader *) marker;
+  /* Initialize public method pointers */
+  marker->pub.reset_marker_reader = reset_marker_reader;
+  marker->pub.read_markers = read_markers;
+  marker->pub.read_restart_marker = read_restart_marker;
+  /* Initialize COM/APPn processing.
+   * By default, we examine and then discard APP0 and APP14,
+   * but simply discard COM and all other APPn.
+   */
+  marker->process_COM = skip_variable;
+  marker->length_limit_COM = 0;
+  for (i = 0; i < 16; i++) {
+    marker->process_APPn[i] = skip_variable;
+    marker->length_limit_APPn[i] = 0;
+  }
+  marker->process_APPn[0] = get_interesting_appn;
+  marker->process_APPn[14] = get_interesting_appn;
+  /* Reset marker processing state */
+  reset_marker_reader(cinfo);
+}
+
+
+/*
+ * Control saving of COM and APPn markers into marker_list.
+ */
+
+#ifdef SAVE_MARKERS_SUPPORTED
+
+GLOBAL(void)
+jpeg_save_markers (j_decompress_ptr cinfo, int marker_code,
+		   unsigned int length_limit)
+{
+  my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+  long maxlength;
+  jpeg_marker_parser_method processor;
+
+  /* Length limit mustn't be larger than what we can allocate
+   * (should only be a concern in a 16-bit environment).
+   */
+  maxlength = cinfo->mem->max_alloc_chunk - SIZEOF(struct jpeg_marker_struct);
+  if (((long) length_limit) > maxlength)
+    length_limit = (unsigned int) maxlength;
+
+  /* Choose processor routine to use.
+   * APP0/APP14 have special requirements.
+   */
+  if (length_limit) {
+    processor = save_marker;
+    /* If saving APP0/APP14, save at least enough for our internal use. */
+    if (marker_code == (int) M_APP0 && length_limit < APP0_DATA_LEN)
+      length_limit = APP0_DATA_LEN;
+    else if (marker_code == (int) M_APP14 && length_limit < APP14_DATA_LEN)
+      length_limit = APP14_DATA_LEN;
+  } else {
+    processor = skip_variable;
+    /* If discarding APP0/APP14, use our regular on-the-fly processor. */
+    if (marker_code == (int) M_APP0 || marker_code == (int) M_APP14)
+      processor = get_interesting_appn;
+  }
+
+  if (marker_code == (int) M_COM) {
+    marker->process_COM = processor;
+    marker->length_limit_COM = length_limit;
+  } else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15) {
+    marker->process_APPn[marker_code - (int) M_APP0] = processor;
+    marker->length_limit_APPn[marker_code - (int) M_APP0] = length_limit;
+  } else
+    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);
+}
+
+#endif /* SAVE_MARKERS_SUPPORTED */
+
+
+/*
+ * Install a special processing method for COM or APPn markers.
+ */
+
+GLOBAL(void)
+jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code,
+			   jpeg_marker_parser_method routine)
+{
+  my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+
+  if (marker_code == (int) M_COM)
+    marker->process_COM = routine;
+  else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15)
+    marker->process_APPn[marker_code - (int) M_APP0] = routine;
+  else
+    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmaster.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmaster.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmaster.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,557 @@
+/*
+ * jdmaster.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains master control logic for the JPEG decompressor.
+ * These routines are concerned with selecting the modules to be executed
+ * and with determining the number of passes and the work to be done in each
+ * pass.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Private state */
+
+typedef struct {
+  struct jpeg_decomp_master pub; /* public fields */
+
+  int pass_number;		/* # of passes completed */
+
+  boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */
+
+  /* Saved references to initialized quantizer modules,
+   * in case we need to switch modes.
+   */
+  struct jpeg_color_quantizer * quantizer_1pass;
+  struct jpeg_color_quantizer * quantizer_2pass;
+} my_decomp_master;
+
+typedef my_decomp_master * my_master_ptr;
+
+
+/*
+ * Determine whether merged upsample/color conversion should be used.
+ * CRUCIAL: this must match the actual capabilities of jdmerge.c!
+ */
+
+LOCAL(boolean)
+use_merged_upsample (j_decompress_ptr cinfo)
+{
+#ifdef UPSAMPLE_MERGING_SUPPORTED
+  /* Merging is the equivalent of plain box-filter upsampling */
+  if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
+    return FALSE;
+  /* jdmerge.c only supports YCC=>RGB color conversion */
+  if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||
+      cinfo->out_color_space != JCS_RGB ||
+      cinfo->out_color_components != RGB_PIXELSIZE)
+    return FALSE;
+  /* and it only handles 2h1v or 2h2v sampling ratios */
+  if (cinfo->comp_info[0].h_samp_factor != 2 ||
+      cinfo->comp_info[1].h_samp_factor != 1 ||
+      cinfo->comp_info[2].h_samp_factor != 1 ||
+      cinfo->comp_info[0].v_samp_factor >  2 ||
+      cinfo->comp_info[1].v_samp_factor != 1 ||
+      cinfo->comp_info[2].v_samp_factor != 1)
+    return FALSE;
+  /* furthermore, it doesn't work if we've scaled the IDCTs differently */
+  if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size ||
+      cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size ||
+      cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size)
+    return FALSE;
+  /* ??? also need to test for upsample-time rescaling, when & if supported */
+  return TRUE;			/* by golly, it'll work... */
+#else
+  return FALSE;
+#endif
+}
+
+
+/*
+ * Compute output image dimensions and related values.
+ * NOTE: this is exported for possible use by application.
+ * Hence it mustn't do anything that can't be done twice.
+ * Also note that it may be called before the master module is initialized!
+ */
+
+GLOBAL(void)
+jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
+/* Do computations that are needed before master selection phase */
+{
+#ifdef IDCT_SCALING_SUPPORTED
+  int ci;
+  jpeg_component_info *compptr;
+#endif
+
+  /* Prevent application from calling me at wrong times */
+  if (cinfo->global_state != DSTATE_READY)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+#ifdef IDCT_SCALING_SUPPORTED
+
+  /* Compute actual output image dimensions and DCT scaling choices. */
+  if (cinfo->scale_num * 8 <= cinfo->scale_denom) {
+    /* Provide 1/8 scaling */
+    cinfo->output_width = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width, 8L);
+    cinfo->output_height = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height, 8L);
+    cinfo->min_DCT_scaled_size = 1;
+  } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) {
+    /* Provide 1/4 scaling */
+    cinfo->output_width = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width, 4L);
+    cinfo->output_height = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height, 4L);
+    cinfo->min_DCT_scaled_size = 2;
+  } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) {
+    /* Provide 1/2 scaling */
+    cinfo->output_width = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width, 2L);
+    cinfo->output_height = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height, 2L);
+    cinfo->min_DCT_scaled_size = 4;
+  } else {
+    /* Provide 1/1 scaling */
+    cinfo->output_width = cinfo->image_width;
+    cinfo->output_height = cinfo->image_height;
+    cinfo->min_DCT_scaled_size = DCTSIZE;
+  }
+  /* In selecting the actual DCT scaling for each component, we try to
+   * scale up the chroma components via IDCT scaling rather than upsampling.
+   * This saves time if the upsampler gets to use 1:1 scaling.
+   * Note this code assumes that the supported DCT scalings are powers of 2.
+   */
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    int ssize = cinfo->min_DCT_scaled_size;
+    while (ssize < DCTSIZE &&
+	   (compptr->h_samp_factor * ssize * 2 <=
+	    cinfo->max_h_samp_factor * cinfo->min_DCT_scaled_size) &&
+	   (compptr->v_samp_factor * ssize * 2 <=
+	    cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size)) {
+      ssize = ssize * 2;
+    }
+    compptr->DCT_scaled_size = ssize;
+  }
+
+  /* Recompute downsampled dimensions of components;
+   * application needs to know these if using raw downsampled data.
+   */
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Size in samples, after IDCT scaling */
+    compptr->downsampled_width = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_width *
+		    (long) (compptr->h_samp_factor * compptr->DCT_scaled_size),
+		    (long) (cinfo->max_h_samp_factor * DCTSIZE));
+    compptr->downsampled_height = (JDIMENSION)
+      jdiv_round_up((long) cinfo->image_height *
+		    (long) (compptr->v_samp_factor * compptr->DCT_scaled_size),
+		    (long) (cinfo->max_v_samp_factor * DCTSIZE));
+  }
+
+#else /* !IDCT_SCALING_SUPPORTED */
+
+  /* Hardwire it to "no scaling" */
+  cinfo->output_width = cinfo->image_width;
+  cinfo->output_height = cinfo->image_height;
+  /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE,
+   * and has computed unscaled downsampled_width and downsampled_height.
+   */
+
+#endif /* IDCT_SCALING_SUPPORTED */
+
+  /* Report number of components in selected colorspace. */
+  /* Probably this should be in the color conversion module... */
+  switch (cinfo->out_color_space) {
+  case JCS_GRAYSCALE:
+    cinfo->out_color_components = 1;
+    break;
+  case JCS_RGB:
+#if RGB_PIXELSIZE != 3
+    cinfo->out_color_components = RGB_PIXELSIZE;
+    break;
+#endif /* else share code with YCbCr */
+  case JCS_YCbCr:
+    cinfo->out_color_components = 3;
+    break;
+  case JCS_CMYK:
+  case JCS_YCCK:
+    cinfo->out_color_components = 4;
+    break;
+  default:			/* else must be same colorspace as in file */
+    cinfo->out_color_components = cinfo->num_components;
+    break;
+  }
+  cinfo->output_components = (cinfo->quantize_colors ? 1 :
+			      cinfo->out_color_components);
+
+  /* See if upsampler will want to emit more than one row at a time */
+  if (use_merged_upsample(cinfo))
+    cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
+  else
+    cinfo->rec_outbuf_height = 1;
+}
+
+
+/*
+ * Several decompression processes need to range-limit values to the range
+ * 0..MAXJSAMPLE; the input value may fall somewhat outside this range
+ * due to noise introduced by quantization, roundoff error, etc.  These
+ * processes are inner loops and need to be as fast as possible.  On most
+ * machines, particularly CPUs with pipelines or instruction prefetch,
+ * a (subscript-check-less) C table lookup
+ *		x = sample_range_limit[x];
+ * is faster than explicit tests
+ *		if (x < 0)  x = 0;
+ *		else if (x > MAXJSAMPLE)  x = MAXJSAMPLE;
+ * These processes all use a common table prepared by the routine below.
+ *
+ * For most steps we can mathematically guarantee that the initial value
+ * of x is within MAXJSAMPLE+1 of the legal range, so a table running from
+ * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient.  But for the initial
+ * limiting step (just after the IDCT), a wildly out-of-range value is 
+ * possible if the input data is corrupt.  To avoid any chance of indexing
+ * off the end of memory and getting a bad-pointer trap, we perform the
+ * post-IDCT limiting thus:
+ *		x = range_limit[x & MASK];
+ * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit
+ * samples.  Under normal circumstances this is more than enough range and
+ * a correct output will be generated; with bogus input data the mask will
+ * cause wraparound, and we will safely generate a bogus-but-in-range output.
+ * For the post-IDCT step, we want to convert the data from signed to unsigned
+ * representation by adding CENTERJSAMPLE at the same time that we limit it.
+ * So the post-IDCT limiting table ends up looking like this:
+ *   CENTERJSAMPLE,CENTERJSAMPLE+1,...,MAXJSAMPLE,
+ *   MAXJSAMPLE (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),
+ *   0          (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),
+ *   0,1,...,CENTERJSAMPLE-1
+ * Negative inputs select values from the upper half of the table after
+ * masking.
+ *
+ * We can save some space by overlapping the start of the post-IDCT table
+ * with the simpler range limiting table.  The post-IDCT table begins at
+ * sample_range_limit + CENTERJSAMPLE.
+ *
+ * Note that the table is allocated in near data space on PCs; it's small
+ * enough and used often enough to justify this.
+ */
+
+LOCAL(void)
+prepare_range_limit_table (j_decompress_ptr cinfo)
+/* Allocate and fill in the sample_range_limit table */
+{
+  JSAMPLE * table;
+  int i;
+
+  table = (JSAMPLE *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+		(5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE));
+  table += (MAXJSAMPLE+1);	/* allow negative subscripts of simple table */
+  cinfo->sample_range_limit = table;
+  /* First segment of "simple" table: limit[x] = 0 for x < 0 */
+  MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
+  /* Main part of "simple" table: limit[x] = x */
+  for (i = 0; i <= MAXJSAMPLE; i++)
+    table[i] = (JSAMPLE) i;
+  table += CENTERJSAMPLE;	/* Point to where post-IDCT table starts */
+  /* End of simple table, rest of first half of post-IDCT table */
+  for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
+    table[i] = MAXJSAMPLE;
+  /* Second half of post-IDCT table */
+  MEMZERO(table + (2 * (MAXJSAMPLE+1)),
+	  (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE));
+  MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),
+	  cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE));
+}
+
+
+/*
+ * Master selection of decompression modules.
+ * This is done once at jpeg_start_decompress time.  We determine
+ * which modules will be used and give them appropriate initialization calls.
+ * We also initialize the decompressor input side to begin consuming data.
+ *
+ * Since jpeg_read_header has finished, we know what is in the SOF
+ * and (first) SOS markers.  We also have all the application parameter
+ * settings.
+ */
+
+LOCAL(void)
+master_selection (j_decompress_ptr cinfo)
+{
+  my_master_ptr master = (my_master_ptr) cinfo->master;
+  boolean use_c_buffer;
+  long samplesperrow;
+  JDIMENSION jd_samplesperrow;
+
+  /* Initialize dimensions and other stuff */
+  jpeg_calc_output_dimensions(cinfo);
+  prepare_range_limit_table(cinfo);
+
+  /* Width of an output scanline must be representable as JDIMENSION. */
+  samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components;
+  jd_samplesperrow = (JDIMENSION) samplesperrow;
+  if ((long) jd_samplesperrow != samplesperrow)
+    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
+
+  /* Initialize my private state */
+  master->pass_number = 0;
+  master->using_merged_upsample = use_merged_upsample(cinfo);
+
+  /* Color quantizer selection */
+  master->quantizer_1pass = NULL;
+  master->quantizer_2pass = NULL;
+  /* No mode changes if not using buffered-image mode. */
+  if (! cinfo->quantize_colors || ! cinfo->buffered_image) {
+    cinfo->enable_1pass_quant = FALSE;
+    cinfo->enable_external_quant = FALSE;
+    cinfo->enable_2pass_quant = FALSE;
+  }
+  if (cinfo->quantize_colors) {
+    if (cinfo->raw_data_out)
+      ERREXIT(cinfo, JERR_NOTIMPL);
+    /* 2-pass quantizer only works in 3-component color space. */
+    if (cinfo->out_color_components != 3) {
+      cinfo->enable_1pass_quant = TRUE;
+      cinfo->enable_external_quant = FALSE;
+      cinfo->enable_2pass_quant = FALSE;
+      cinfo->colormap = NULL;
+    } else if (cinfo->colormap != NULL) {
+      cinfo->enable_external_quant = TRUE;
+    } else if (cinfo->two_pass_quantize) {
+      cinfo->enable_2pass_quant = TRUE;
+    } else {
+      cinfo->enable_1pass_quant = TRUE;
+    }
+
+    if (cinfo->enable_1pass_quant) {
+#ifdef QUANT_1PASS_SUPPORTED
+      jinit_1pass_quantizer(cinfo);
+      master->quantizer_1pass = cinfo->cquantize;
+#else
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+    }
+
+    /* We use the 2-pass code to map to external colormaps. */
+    if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) {
+#ifdef QUANT_2PASS_SUPPORTED
+      jinit_2pass_quantizer(cinfo);
+      master->quantizer_2pass = cinfo->cquantize;
+#else
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+    }
+    /* If both quantizers are initialized, the 2-pass one is left active;
+     * this is necessary for starting with quantization to an external map.
+     */
+  }
+
+  /* Post-processing: in particular, color conversion first */
+  if (! cinfo->raw_data_out) {
+    if (master->using_merged_upsample) {
+#ifdef UPSAMPLE_MERGING_SUPPORTED
+      jinit_merged_upsampler(cinfo); /* does color conversion too */
+#else
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+    } else {
+      jinit_color_deconverter(cinfo);
+      jinit_upsampler(cinfo);
+    }
+    jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
+  }
+  /* Inverse DCT */
+  jinit_inverse_dct(cinfo);
+  /* Entropy decoding: either Huffman or arithmetic coding. */
+  if (cinfo->arith_code) {
+    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
+  } else {
+    if (cinfo->progressive_mode) {
+#ifdef D_PROGRESSIVE_SUPPORTED
+      jinit_phuff_decoder(cinfo);
+#else
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+    } else
+      jinit_huff_decoder(cinfo);
+  }
+
+  /* Initialize principal buffer controllers. */
+  use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
+  jinit_d_coef_controller(cinfo, use_c_buffer);
+
+  if (! cinfo->raw_data_out)
+    jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
+
+  /* We can now tell the memory manager to allocate virtual arrays. */
+  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
+
+  /* Initialize input side of decompressor to consume first scan. */
+  (*cinfo->inputctl->start_input_pass) (cinfo);
+
+#ifdef D_MULTISCAN_FILES_SUPPORTED
+  /* If jpeg_start_decompress will read the whole file, initialize
+   * progress monitoring appropriately.  The input step is counted
+   * as one pass.
+   */
+  if (cinfo->progress != NULL && ! cinfo->buffered_image &&
+      cinfo->inputctl->has_multiple_scans) {
+    int nscans;
+    /* Estimate number of scans to set pass_limit. */
+    if (cinfo->progressive_mode) {
+      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
+      nscans = 2 + 3 * cinfo->num_components;
+    } else {
+      /* For a nonprogressive multiscan file, estimate 1 scan per component. */
+      nscans = cinfo->num_components;
+    }
+    cinfo->progress->pass_counter = 0L;
+    cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
+    cinfo->progress->completed_passes = 0;
+    cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
+    /* Count the input pass as done */
+    master->pass_number++;
+  }
+#endif /* D_MULTISCAN_FILES_SUPPORTED */
+}
+
+
+/*
+ * Per-pass setup.
+ * This is called at the beginning of each output pass.  We determine which
+ * modules will be active during this pass and give them appropriate
+ * start_pass calls.  We also set is_dummy_pass to indicate whether this
+ * is a "real" output pass or a dummy pass for color quantization.
+ * (In the latter case, jdapistd.c will crank the pass to completion.)
+ */
+
+METHODDEF(void)
+prepare_for_output_pass (j_decompress_ptr cinfo)
+{
+  my_master_ptr master = (my_master_ptr) cinfo->master;
+
+  if (master->pub.is_dummy_pass) {
+#ifdef QUANT_2PASS_SUPPORTED
+    /* Final pass of 2-pass quantization */
+    master->pub.is_dummy_pass = FALSE;
+    (*cinfo->cquantize->start_pass) (cinfo, FALSE);
+    (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST);
+    (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST);
+#else
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif /* QUANT_2PASS_SUPPORTED */
+  } else {
+    if (cinfo->quantize_colors && cinfo->colormap == NULL) {
+      /* Select new quantization method */
+      if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) {
+	cinfo->cquantize = master->quantizer_2pass;
+	master->pub.is_dummy_pass = TRUE;
+      } else if (cinfo->enable_1pass_quant) {
+	cinfo->cquantize = master->quantizer_1pass;
+      } else {
+	ERREXIT(cinfo, JERR_MODE_CHANGE);
+      }
+    }
+    (*cinfo->idct->start_pass) (cinfo);
+    (*cinfo->coef->start_output_pass) (cinfo);
+    if (! cinfo->raw_data_out) {
+      if (! master->using_merged_upsample)
+	(*cinfo->cconvert->start_pass) (cinfo);
+      (*cinfo->upsample->start_pass) (cinfo);
+      if (cinfo->quantize_colors)
+	(*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);
+      (*cinfo->post->start_pass) (cinfo,
+	    (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
+      (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
+    }
+  }
+
+  /* Set up progress monitor's pass info if present */
+  if (cinfo->progress != NULL) {
+    cinfo->progress->completed_passes = master->pass_number;
+    cinfo->progress->total_passes = master->pass_number +
+				    (master->pub.is_dummy_pass ? 2 : 1);
+    /* In buffered-image mode, we assume one more output pass if EOI not
+     * yet reached, but no more passes if EOI has been reached.
+     */
+    if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) {
+      cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);
+    }
+  }
+}
+
+
+/*
+ * Finish up at end of an output pass.
+ */
+
+METHODDEF(void)
+finish_output_pass (j_decompress_ptr cinfo)
+{
+  my_master_ptr master = (my_master_ptr) cinfo->master;
+
+  if (cinfo->quantize_colors)
+    (*cinfo->cquantize->finish_pass) (cinfo);
+  master->pass_number++;
+}
+
+
+#ifdef D_MULTISCAN_FILES_SUPPORTED
+
+/*
+ * Switch to a new external colormap between output passes.
+ */
+
+GLOBAL(void)
+jpeg_new_colormap (j_decompress_ptr cinfo)
+{
+  my_master_ptr master = (my_master_ptr) cinfo->master;
+
+  /* Prevent application from calling me at wrong times */
+  if (cinfo->global_state != DSTATE_BUFIMAGE)
+    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+
+  if (cinfo->quantize_colors && cinfo->enable_external_quant &&
+      cinfo->colormap != NULL) {
+    /* Select 2-pass quantizer for external colormap use */
+    cinfo->cquantize = master->quantizer_2pass;
+    /* Notify quantizer of colormap change */
+    (*cinfo->cquantize->new_color_map) (cinfo);
+    master->pub.is_dummy_pass = FALSE; /* just in case */
+  } else
+    ERREXIT(cinfo, JERR_MODE_CHANGE);
+}
+
+#endif /* D_MULTISCAN_FILES_SUPPORTED */
+
+
+/*
+ * Initialize master decompression control and select active modules.
+ * This is performed at the start of jpeg_start_decompress.
+ */
+
+GLOBAL(void)
+jinit_master_decompress (j_decompress_ptr cinfo)
+{
+  my_master_ptr master;
+
+  master = (my_master_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(my_decomp_master));
+  cinfo->master = (struct jpeg_decomp_master *) master;
+  master->pub.prepare_for_output_pass = prepare_for_output_pass;
+  master->pub.finish_output_pass = finish_output_pass;
+
+  master->pub.is_dummy_pass = FALSE;
+
+  master_selection(cinfo);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmerge.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmerge.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdmerge.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,400 @@
+/*
+ * jdmerge.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains code for merged upsampling/color conversion.
+ *
+ * This file combines functions from jdsample.c and jdcolor.c;
+ * read those files first to understand what's going on.
+ *
+ * When the chroma components are to be upsampled by simple replication
+ * (ie, box filtering), we can save some work in color conversion by
+ * calculating all the output pixels corresponding to a pair of chroma
+ * samples at one time.  In the conversion equations
+ *	R = Y           + K1 * Cr
+ *	G = Y + K2 * Cb + K3 * Cr
+ *	B = Y + K4 * Cb
+ * only the Y term varies among the group of pixels corresponding to a pair
+ * of chroma samples, so the rest of the terms can be calculated just once.
+ * At typical sampling ratios, this eliminates half or three-quarters of the
+ * multiplications needed for color conversion.
+ *
+ * This file currently provides implementations for the following cases:
+ *	YCbCr => RGB color conversion only.
+ *	Sampling ratios of 2h1v or 2h2v.
+ *	No scaling needed at upsample time.
+ *	Corner-aligned (non-CCIR601) sampling alignment.
+ * Other special cases could be added, but in most applications these are
+ * the only common cases.  (For uncommon cases we fall back on the more
+ * general code in jdsample.c and jdcolor.c.)
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+#ifdef UPSAMPLE_MERGING_SUPPORTED
+
+
+/* Private subobject */
+
+typedef struct {
+  struct jpeg_upsampler pub;	/* public fields */
+
+  /* Pointer to routine to do actual upsampling/conversion of one row group */
+  JMETHOD(void, upmethod, (j_decompress_ptr cinfo,
+			   JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
+			   JSAMPARRAY output_buf));
+
+  /* Private state for YCC->RGB conversion */
+  int * Cr_r_tab;		/* => table for Cr to R conversion */
+  int * Cb_b_tab;		/* => table for Cb to B conversion */
+  INT32 * Cr_g_tab;		/* => table for Cr to G conversion */
+  INT32 * Cb_g_tab;		/* => table for Cb to G conversion */
+
+  /* For 2:1 vertical sampling, we produce two output rows at a time.
+   * We need a "spare" row buffer to hold the second output row if the
+   * application provides just a one-row buffer; we also use the spare
+   * to discard the dummy last row if the image height is odd.
+   */
+  JSAMPROW spare_row;
+  boolean spare_full;		/* T if spare buffer is occupied */
+
+  JDIMENSION out_row_width;	/* samples per output row */
+  JDIMENSION rows_to_go;	/* counts rows remaining in image */
+} my_upsampler;
+
+typedef my_upsampler * my_upsample_ptr;
+
+#define SCALEBITS	16	/* speediest right-shift on some machines */
+#define ONE_HALF	((INT32) 1 << (SCALEBITS-1))
+#define FIX(x)		((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
+
+
+/*
+ * Initialize tables for YCC->RGB colorspace conversion.
+ * This is taken directly from jdcolor.c; see that file for more info.
+ */
+
+LOCAL(void)
+build_ycc_rgb_table (j_decompress_ptr cinfo)
+{
+  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+  int i;
+  INT32 x;
+  SHIFT_TEMPS
+
+  upsample->Cr_r_tab = (int *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(MAXJSAMPLE+1) * SIZEOF(int));
+  upsample->Cb_b_tab = (int *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(MAXJSAMPLE+1) * SIZEOF(int));
+  upsample->Cr_g_tab = (INT32 *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(MAXJSAMPLE+1) * SIZEOF(INT32));
+  upsample->Cb_g_tab = (INT32 *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(MAXJSAMPLE+1) * SIZEOF(INT32));
+
+  for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
+    /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
+    /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
+    /* Cr=>R value is nearest int to 1.40200 * x */
+    upsample->Cr_r_tab[i] = (int)
+		    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
+    /* Cb=>B value is nearest int to 1.77200 * x */
+    upsample->Cb_b_tab[i] = (int)
+		    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
+    /* Cr=>G value is scaled-up -0.71414 * x */
+    upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x;
+    /* Cb=>G value is scaled-up -0.34414 * x */
+    /* We also add in ONE_HALF so that need not do it in inner loop */
+    upsample->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;
+  }
+}
+
+
+/*
+ * Initialize for an upsampling pass.
+ */
+
+METHODDEF(void)
+start_pass_merged_upsample (j_decompress_ptr cinfo)
+{
+  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+
+  /* Mark the spare buffer empty */
+  upsample->spare_full = FALSE;
+  /* Initialize total-height counter for detecting bottom of image */
+  upsample->rows_to_go = cinfo->output_height;
+}
+
+
+/*
+ * Control routine to do upsampling (and color conversion).
+ *
+ * The control routine just handles the row buffering considerations.
+ */
+
+METHODDEF(void)
+merged_2v_upsample (j_decompress_ptr cinfo,
+		    JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
+		    JDIMENSION in_row_groups_avail,
+		    JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+		    JDIMENSION out_rows_avail)
+/* 2:1 vertical sampling case: may need a spare row. */
+{
+  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+  JSAMPROW work_ptrs[2];
+  JDIMENSION num_rows;		/* number of rows returned to caller */
+
+  if (upsample->spare_full) {
+    /* If we have a spare row saved from a previous cycle, just return it. */
+    jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0,
+		      1, upsample->out_row_width);
+    num_rows = 1;
+    upsample->spare_full = FALSE;
+  } else {
+    /* Figure number of rows to return to caller. */
+    num_rows = 2;
+    /* Not more than the distance to the end of the image. */
+    if (num_rows > upsample->rows_to_go)
+      num_rows = upsample->rows_to_go;
+    /* And not more than what the client can accept: */
+    out_rows_avail -= *out_row_ctr;
+    if (num_rows > out_rows_avail)
+      num_rows = out_rows_avail;
+    /* Create output pointer array for upsampler. */
+    work_ptrs[0] = output_buf[*out_row_ctr];
+    if (num_rows > 1) {
+      work_ptrs[1] = output_buf[*out_row_ctr + 1];
+    } else {
+      work_ptrs[1] = upsample->spare_row;
+      upsample->spare_full = TRUE;
+    }
+    /* Now do the upsampling. */
+    (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, work_ptrs);
+  }
+
+  /* Adjust counts */
+  *out_row_ctr += num_rows;
+  upsample->rows_to_go -= num_rows;
+  /* When the buffer is emptied, declare this input row group consumed */
+  if (! upsample->spare_full)
+    (*in_row_group_ctr)++;
+}
+
+
+METHODDEF(void)
+merged_1v_upsample (j_decompress_ptr cinfo,
+		    JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
+		    JDIMENSION in_row_groups_avail,
+		    JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+		    JDIMENSION out_rows_avail)
+/* 1:1 vertical sampling case: much easier, never need a spare row. */
+{
+  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+
+  /* Just do the upsampling. */
+  (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr,
+			 output_buf + *out_row_ctr);
+  /* Adjust counts */
+  (*out_row_ctr)++;
+  (*in_row_group_ctr)++;
+}
+
+
+/*
+ * These are the routines invoked by the control routines to do
+ * the actual upsampling/conversion.  One row group is processed per call.
+ *
+ * Note: since we may be writing directly into application-supplied buffers,
+ * we have to be honest about the output width; we can't assume the buffer
+ * has been rounded up to an even width.
+ */
+
+
+/*
+ * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
+ */
+
+METHODDEF(void)
+h2v1_merged_upsample (j_decompress_ptr cinfo,
+		      JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
+		      JSAMPARRAY output_buf)
+{
+  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+  register int y, cred, cgreen, cblue;
+  int cb, cr;
+  register JSAMPROW outptr;
+  JSAMPROW inptr0, inptr1, inptr2;
+  JDIMENSION col;
+  /* copy these pointers into registers if possible */
+  register JSAMPLE * range_limit = cinfo->sample_range_limit;
+  int * Crrtab = upsample->Cr_r_tab;
+  int * Cbbtab = upsample->Cb_b_tab;
+  INT32 * Crgtab = upsample->Cr_g_tab;
+  INT32 * Cbgtab = upsample->Cb_g_tab;
+  SHIFT_TEMPS
+
+  inptr0 = input_buf[0][in_row_group_ctr];
+  inptr1 = input_buf[1][in_row_group_ctr];
+  inptr2 = input_buf[2][in_row_group_ctr];
+  outptr = output_buf[0];
+  /* Loop for each pair of output pixels */
+  for (col = cinfo->output_width >> 1; col > 0; col--) {
+    /* Do the chroma part of the calculation */
+    cb = GETJSAMPLE(*inptr1++);
+    cr = GETJSAMPLE(*inptr2++);
+    cred = Crrtab[cr];
+    cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+    cblue = Cbbtab[cb];
+    /* Fetch 2 Y values and emit 2 pixels */
+    y  = GETJSAMPLE(*inptr0++);
+    outptr[RGB_RED] =   range_limit[y + cred];
+    outptr[RGB_GREEN] = range_limit[y + cgreen];
+    outptr[RGB_BLUE] =  range_limit[y + cblue];
+    outptr += RGB_PIXELSIZE;
+    y  = GETJSAMPLE(*inptr0++);
+    outptr[RGB_RED] =   range_limit[y + cred];
+    outptr[RGB_GREEN] = range_limit[y + cgreen];
+    outptr[RGB_BLUE] =  range_limit[y + cblue];
+    outptr += RGB_PIXELSIZE;
+  }
+  /* If image width is odd, do the last output column separately */
+  if (cinfo->output_width & 1) {
+    cb = GETJSAMPLE(*inptr1);
+    cr = GETJSAMPLE(*inptr2);
+    cred = Crrtab[cr];
+    cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+    cblue = Cbbtab[cb];
+    y  = GETJSAMPLE(*inptr0);
+    outptr[RGB_RED] =   range_limit[y + cred];
+    outptr[RGB_GREEN] = range_limit[y + cgreen];
+    outptr[RGB_BLUE] =  range_limit[y + cblue];
+  }
+}
+
+
+/*
+ * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical.
+ */
+
+METHODDEF(void)
+h2v2_merged_upsample (j_decompress_ptr cinfo,
+		      JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
+		      JSAMPARRAY output_buf)
+{
+  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+  register int y, cred, cgreen, cblue;
+  int cb, cr;
+  register JSAMPROW outptr0, outptr1;
+  JSAMPROW inptr00, inptr01, inptr1, inptr2;
+  JDIMENSION col;
+  /* copy these pointers into registers if possible */
+  register JSAMPLE * range_limit = cinfo->sample_range_limit;
+  int * Crrtab = upsample->Cr_r_tab;
+  int * Cbbtab = upsample->Cb_b_tab;
+  INT32 * Crgtab = upsample->Cr_g_tab;
+  INT32 * Cbgtab = upsample->Cb_g_tab;
+  SHIFT_TEMPS
+
+  inptr00 = input_buf[0][in_row_group_ctr*2];
+  inptr01 = input_buf[0][in_row_group_ctr*2 + 1];
+  inptr1 = input_buf[1][in_row_group_ctr];
+  inptr2 = input_buf[2][in_row_group_ctr];
+  outptr0 = output_buf[0];
+  outptr1 = output_buf[1];
+  /* Loop for each group of output pixels */
+  for (col = cinfo->output_width >> 1; col > 0; col--) {
+    /* Do the chroma part of the calculation */
+    cb = GETJSAMPLE(*inptr1++);
+    cr = GETJSAMPLE(*inptr2++);
+    cred = Crrtab[cr];
+    cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+    cblue = Cbbtab[cb];
+    /* Fetch 4 Y values and emit 4 pixels */
+    y  = GETJSAMPLE(*inptr00++);
+    outptr0[RGB_RED] =   range_limit[y + cred];
+    outptr0[RGB_GREEN] = range_limit[y + cgreen];
+    outptr0[RGB_BLUE] =  range_limit[y + cblue];
+    outptr0 += RGB_PIXELSIZE;
+    y  = GETJSAMPLE(*inptr00++);
+    outptr0[RGB_RED] =   range_limit[y + cred];
+    outptr0[RGB_GREEN] = range_limit[y + cgreen];
+    outptr0[RGB_BLUE] =  range_limit[y + cblue];
+    outptr0 += RGB_PIXELSIZE;
+    y  = GETJSAMPLE(*inptr01++);
+    outptr1[RGB_RED] =   range_limit[y + cred];
+    outptr1[RGB_GREEN] = range_limit[y + cgreen];
+    outptr1[RGB_BLUE] =  range_limit[y + cblue];
+    outptr1 += RGB_PIXELSIZE;
+    y  = GETJSAMPLE(*inptr01++);
+    outptr1[RGB_RED] =   range_limit[y + cred];
+    outptr1[RGB_GREEN] = range_limit[y + cgreen];
+    outptr1[RGB_BLUE] =  range_limit[y + cblue];
+    outptr1 += RGB_PIXELSIZE;
+  }
+  /* If image width is odd, do the last output column separately */
+  if (cinfo->output_width & 1) {
+    cb = GETJSAMPLE(*inptr1);
+    cr = GETJSAMPLE(*inptr2);
+    cred = Crrtab[cr];
+    cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+    cblue = Cbbtab[cb];
+    y  = GETJSAMPLE(*inptr00);
+    outptr0[RGB_RED] =   range_limit[y + cred];
+    outptr0[RGB_GREEN] = range_limit[y + cgreen];
+    outptr0[RGB_BLUE] =  range_limit[y + cblue];
+    y  = GETJSAMPLE(*inptr01);
+    outptr1[RGB_RED] =   range_limit[y + cred];
+    outptr1[RGB_GREEN] = range_limit[y + cgreen];
+    outptr1[RGB_BLUE] =  range_limit[y + cblue];
+  }
+}
+
+
+/*
+ * Module initialization routine for merged upsampling/color conversion.
+ *
+ * NB: this is called under the conditions determined by use_merged_upsample()
+ * in jdmaster.c.  That routine MUST correspond to the actual capabilities
+ * of this module; no safety checks are made here.
+ */
+
+GLOBAL(void)
+jinit_merged_upsampler (j_decompress_ptr cinfo)
+{
+  my_upsample_ptr upsample;
+
+  upsample = (my_upsample_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_upsampler));
+  cinfo->upsample = (struct jpeg_upsampler *) upsample;
+  upsample->pub.start_pass = start_pass_merged_upsample;
+  upsample->pub.need_context_rows = FALSE;
+
+  upsample->out_row_width = cinfo->output_width * cinfo->out_color_components;
+
+  if (cinfo->max_v_samp_factor == 2) {
+    upsample->pub.upsample = merged_2v_upsample;
+    upsample->upmethod = h2v2_merged_upsample;
+    /* Allocate a spare row buffer */
+    upsample->spare_row = (JSAMPROW)
+      (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+		(size_t) (upsample->out_row_width * SIZEOF(JSAMPLE)));
+  } else {
+    upsample->pub.upsample = merged_1v_upsample;
+    upsample->upmethod = h2v1_merged_upsample;
+    /* No spare row needed */
+    upsample->spare_row = NULL;
+  }
+
+  build_ycc_rgb_table(cinfo);
+}
+
+#endif /* UPSAMPLE_MERGING_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdphuff.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdphuff.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdphuff.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,668 @@
+/*
+ * jdphuff.c
+ *
+ * Copyright (C) 1995-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains Huffman entropy decoding routines for progressive JPEG.
+ *
+ * Much of the complexity here has to do with supporting input suspension.
+ * If the data source module demands suspension, we want to be able to back
+ * up to the start of the current MCU.  To do this, we copy state variables
+ * into local working storage, and update them back to the permanent
+ * storage only upon successful completion of an MCU.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdhuff.h"		/* Declarations shared with jdhuff.c */
+
+
+#ifdef D_PROGRESSIVE_SUPPORTED
+
+/*
+ * Expanded entropy decoder object for progressive Huffman decoding.
+ *
+ * The savable_state subrecord contains fields that change within an MCU,
+ * but must not be updated permanently until we complete the MCU.
+ */
+
+typedef struct {
+  unsigned int EOBRUN;			/* remaining EOBs in EOBRUN */
+  int last_dc_val[MAX_COMPS_IN_SCAN];	/* last DC coef for each component */
+} savable_state;
+
+/* This macro is to work around compilers with missing or broken
+ * structure assignment.  You'll need to fix this code if you have
+ * such a compiler and you change MAX_COMPS_IN_SCAN.
+ */
+
+#ifndef NO_STRUCT_ASSIGN
+#define ASSIGN_STATE(dest,src)  ((dest) = (src))
+#else
+#if MAX_COMPS_IN_SCAN == 4
+#define ASSIGN_STATE(dest,src)  \
+	((dest).EOBRUN = (src).EOBRUN, \
+	 (dest).last_dc_val[0] = (src).last_dc_val[0], \
+	 (dest).last_dc_val[1] = (src).last_dc_val[1], \
+	 (dest).last_dc_val[2] = (src).last_dc_val[2], \
+	 (dest).last_dc_val[3] = (src).last_dc_val[3])
+#endif
+#endif
+
+
+typedef struct {
+  struct jpeg_entropy_decoder pub; /* public fields */
+
+  /* These fields are loaded into local variables at start of each MCU.
+   * In case of suspension, we exit WITHOUT updating them.
+   */
+  bitread_perm_state bitstate;	/* Bit buffer at start of MCU */
+  savable_state saved;		/* Other state at start of MCU */
+
+  /* These fields are NOT loaded into local working state. */
+  unsigned int restarts_to_go;	/* MCUs left in this restart interval */
+
+  /* Pointers to derived tables (these workspaces have image lifespan) */
+  d_derived_tbl * derived_tbls[NUM_HUFF_TBLS];
+
+  d_derived_tbl * ac_derived_tbl; /* active table during an AC scan */
+} phuff_entropy_decoder;
+
+typedef phuff_entropy_decoder * phuff_entropy_ptr;
+
+/* Forward declarations */
+METHODDEF(boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo,
+					    JBLOCKROW *MCU_data));
+METHODDEF(boolean) decode_mcu_AC_first JPP((j_decompress_ptr cinfo,
+					    JBLOCKROW *MCU_data));
+METHODDEF(boolean) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo,
+					     JBLOCKROW *MCU_data));
+METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo,
+					     JBLOCKROW *MCU_data));
+
+
+/*
+ * Initialize for a Huffman-compressed scan.
+ */
+
+METHODDEF(void)
+start_pass_phuff_decoder (j_decompress_ptr cinfo)
+{
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  boolean is_DC_band, bad;
+  int ci, coefi, tbl;
+  int *coef_bit_ptr;
+  jpeg_component_info * compptr;
+
+  is_DC_band = (cinfo->Ss == 0);
+
+  /* Validate scan parameters */
+  bad = FALSE;
+  if (is_DC_band) {
+    if (cinfo->Se != 0)
+      bad = TRUE;
+  } else {
+    /* need not check Ss/Se < 0 since they came from unsigned bytes */
+    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
+      bad = TRUE;
+    /* AC scans may have only one component */
+    if (cinfo->comps_in_scan != 1)
+      bad = TRUE;
+  }
+  if (cinfo->Ah != 0) {
+    /* Successive approximation refinement scan: must have Al = Ah-1. */
+    if (cinfo->Al != cinfo->Ah-1)
+      bad = TRUE;
+  }
+  if (cinfo->Al > 13)		/* need not check for < 0 */
+    bad = TRUE;
+  /* Arguably the maximum Al value should be less than 13 for 8-bit precision,
+   * but the spec doesn't say so, and we try to be liberal about what we
+   * accept.  Note: large Al values could result in out-of-range DC
+   * coefficients during early scans, leading to bizarre displays due to
+   * overflows in the IDCT math.  But we won't crash.
+   */
+  if (bad)
+    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
+	     cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
+  /* Update progression status, and verify that scan order is legal.
+   * Note that inter-scan inconsistencies are treated as warnings
+   * not fatal errors ... not clear if this is right way to behave.
+   */
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    int cindex = cinfo->cur_comp_info[ci]->component_index;
+    coef_bit_ptr = & cinfo->coef_bits[cindex][0];
+    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
+      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
+    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
+      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
+      if (cinfo->Ah != expected)
+	WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
+      coef_bit_ptr[coefi] = cinfo->Al;
+    }
+  }
+
+  /* Select MCU decoding routine */
+  if (cinfo->Ah == 0) {
+    if (is_DC_band)
+      entropy->pub.decode_mcu = decode_mcu_DC_first;
+    else
+      entropy->pub.decode_mcu = decode_mcu_AC_first;
+  } else {
+    if (is_DC_band)
+      entropy->pub.decode_mcu = decode_mcu_DC_refine;
+    else
+      entropy->pub.decode_mcu = decode_mcu_AC_refine;
+  }
+
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+    compptr = cinfo->cur_comp_info[ci];
+    /* Make sure requested tables are present, and compute derived tables.
+     * We may build same derived table more than once, but it's not expensive.
+     */
+    if (is_DC_band) {
+      if (cinfo->Ah == 0) {	/* DC refinement needs no table */
+	tbl = compptr->dc_tbl_no;
+	jpeg_make_d_derived_tbl(cinfo, TRUE, tbl,
+				& entropy->derived_tbls[tbl]);
+      }
+    } else {
+      tbl = compptr->ac_tbl_no;
+      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl,
+			      & entropy->derived_tbls[tbl]);
+      /* remember the single active table */
+      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
+    }
+    /* Initialize DC predictions to 0 */
+    entropy->saved.last_dc_val[ci] = 0;
+  }
+
+  /* Initialize bitread state variables */
+  entropy->bitstate.bits_left = 0;
+  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
+  entropy->pub.insufficient_data = FALSE;
+
+  /* Initialize private state variables */
+  entropy->saved.EOBRUN = 0;
+
+  /* Initialize restart counter */
+  entropy->restarts_to_go = cinfo->restart_interval;
+}
+
+
+/*
+ * Figure F.12: extend sign bit.
+ * On some machines, a shift and add will be faster than a table lookup.
+ */
+
+#ifdef AVOID_TABLES
+
+#define HUFF_EXTEND(x,s)  ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))
+
+#else
+
+#define HUFF_EXTEND(x,s)  ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
+
+static const int extend_test[16] =   /* entry n is 2**(n-1) */
+  { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
+    0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
+
+static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
+  { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
+    ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
+    ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
+    ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+
+#endif /* AVOID_TABLES */
+
+
+/*
+ * Check for a restart marker & resynchronize decoder.
+ * Returns FALSE if must suspend.
+ */
+
+LOCAL(boolean)
+process_restart (j_decompress_ptr cinfo)
+{
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  int ci;
+
+  /* Throw away any unused bits remaining in bit buffer; */
+  /* include any full bytes in next_marker's count of discarded bytes */
+  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
+  entropy->bitstate.bits_left = 0;
+
+  /* Advance past the RSTn marker */
+  if (! (*cinfo->marker->read_restart_marker) (cinfo))
+    return FALSE;
+
+  /* Re-initialize DC predictions to 0 */
+  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+    entropy->saved.last_dc_val[ci] = 0;
+  /* Re-init EOB run count, too */
+  entropy->saved.EOBRUN = 0;
+
+  /* Reset restart counter */
+  entropy->restarts_to_go = cinfo->restart_interval;
+
+  /* Reset out-of-data flag, unless read_restart_marker left us smack up
+   * against a marker.  In that case we will end up treating the next data
+   * segment as empty, and we can avoid producing bogus output pixels by
+   * leaving the flag set.
+   */
+  if (cinfo->unread_marker == 0)
+    entropy->pub.insufficient_data = FALSE;
+
+  return TRUE;
+}
+
+
+/*
+ * Huffman MCU decoding.
+ * Each of these routines decodes and returns one MCU's worth of
+ * Huffman-compressed coefficients. 
+ * The coefficients are reordered from zigzag order into natural array order,
+ * but are not dequantized.
+ *
+ * The i'th block of the MCU is stored into the block pointed to by
+ * MCU_data[i].  WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER.
+ *
+ * We return FALSE if data source requested suspension.  In that case no
+ * changes have been made to permanent state.  (Exception: some output
+ * coefficients may already have been assigned.  This is harmless for
+ * spectral selection, since we'll just re-assign them on the next call.
+ * Successive approximation AC refinement has to be more careful, however.)
+ */
+
+/*
+ * MCU decoding for DC initial scan (either spectral selection,
+ * or first pass of successive approximation).
+ */
+
+METHODDEF(boolean)
+decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+{   
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  int Al = cinfo->Al;
+  register int s, r;
+  int blkn, ci;
+  JBLOCKROW block;
+  BITREAD_STATE_VARS;
+  savable_state state;
+  d_derived_tbl * tbl;
+  jpeg_component_info * compptr;
+
+  /* Process restart marker if needed; may have to suspend */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0)
+      if (! process_restart(cinfo))
+	return FALSE;
+  }
+
+  /* If we've run out of data, just leave the MCU set to zeroes.
+   * This way, we return uniform gray for the remainder of the segment.
+   */
+  if (! entropy->pub.insufficient_data) {
+
+    /* Load up working state */
+    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+    ASSIGN_STATE(state, entropy->saved);
+
+    /* Outer loop handles each block in the MCU */
+
+    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+      block = MCU_data[blkn];
+      ci = cinfo->MCU_membership[blkn];
+      compptr = cinfo->cur_comp_info[ci];
+      tbl = entropy->derived_tbls[compptr->dc_tbl_no];
+
+      /* Decode a single block's worth of coefficients */
+
+      /* Section F.2.2.1: decode the DC coefficient difference */
+      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
+      if (s) {
+	CHECK_BIT_BUFFER(br_state, s, return FALSE);
+	r = GET_BITS(s);
+	s = HUFF_EXTEND(r, s);
+      }
+
+      /* Convert DC difference to actual value, update last_dc_val */
+      s += state.last_dc_val[ci];
+      state.last_dc_val[ci] = s;
+      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
+      (*block)[0] = (JCOEF) (s << Al);
+    }
+
+    /* Completed MCU, so update state */
+    BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+    ASSIGN_STATE(entropy->saved, state);
+  }
+
+  /* Account for restart interval (no-op if not using restarts) */
+  entropy->restarts_to_go--;
+
+  return TRUE;
+}
+
+
+/*
+ * MCU decoding for AC initial scan (either spectral selection,
+ * or first pass of successive approximation).
+ */
+
+METHODDEF(boolean)
+decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+{   
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  int Se = cinfo->Se;
+  int Al = cinfo->Al;
+  register int s, k, r;
+  unsigned int EOBRUN;
+  JBLOCKROW block;
+  BITREAD_STATE_VARS;
+  d_derived_tbl * tbl;
+
+  /* Process restart marker if needed; may have to suspend */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0)
+      if (! process_restart(cinfo))
+	return FALSE;
+  }
+
+  /* If we've run out of data, just leave the MCU set to zeroes.
+   * This way, we return uniform gray for the remainder of the segment.
+   */
+  if (! entropy->pub.insufficient_data) {
+
+    /* Load up working state.
+     * We can avoid loading/saving bitread state if in an EOB run.
+     */
+    EOBRUN = entropy->saved.EOBRUN;	/* only part of saved state we need */
+
+    /* There is always only one block per MCU */
+
+    if (EOBRUN > 0)		/* if it's a band of zeroes... */
+      EOBRUN--;			/* ...process it now (we do nothing) */
+    else {
+      BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+      block = MCU_data[0];
+      tbl = entropy->ac_derived_tbl;
+
+      for (k = cinfo->Ss; k <= Se; k++) {
+	HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
+	r = s >> 4;
+	s &= 15;
+	if (s) {
+	  k += r;
+	  CHECK_BIT_BUFFER(br_state, s, return FALSE);
+	  r = GET_BITS(s);
+	  s = HUFF_EXTEND(r, s);
+	  /* Scale and output coefficient in natural (dezigzagged) order */
+	  (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al);
+	} else {
+	  if (r == 15) {	/* ZRL */
+	    k += 15;		/* skip 15 zeroes in band */
+	  } else {		/* EOBr, run length is 2^r + appended bits */
+	    EOBRUN = 1 << r;
+	    if (r) {		/* EOBr, r > 0 */
+	      CHECK_BIT_BUFFER(br_state, r, return FALSE);
+	      r = GET_BITS(r);
+	      EOBRUN += r;
+	    }
+	    EOBRUN--;		/* this band is processed at this moment */
+	    break;		/* force end-of-band */
+	  }
+	}
+      }
+
+      BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+    }
+
+    /* Completed MCU, so update state */
+    entropy->saved.EOBRUN = EOBRUN;	/* only part of saved state we need */
+  }
+
+  /* Account for restart interval (no-op if not using restarts) */
+  entropy->restarts_to_go--;
+
+  return TRUE;
+}
+
+
+/*
+ * MCU decoding for DC successive approximation refinement scan.
+ * Note: we assume such scans can be multi-component, although the spec
+ * is not very clear on the point.
+ */
+
+METHODDEF(boolean)
+decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+{   
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  int p1 = 1 << cinfo->Al;	/* 1 in the bit position being coded */
+  int blkn;
+  JBLOCKROW block;
+  BITREAD_STATE_VARS;
+
+  /* Process restart marker if needed; may have to suspend */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0)
+      if (! process_restart(cinfo))
+	return FALSE;
+  }
+
+  /* Not worth the cycles to check insufficient_data here,
+   * since we will not change the data anyway if we read zeroes.
+   */
+
+  /* Load up working state */
+  BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+
+  /* Outer loop handles each block in the MCU */
+
+  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+    block = MCU_data[blkn];
+
+    /* Encoded data is simply the next bit of the two's-complement DC value */
+    CHECK_BIT_BUFFER(br_state, 1, return FALSE);
+    if (GET_BITS(1))
+      (*block)[0] |= p1;
+    /* Note: since we use |=, repeating the assignment later is safe */
+  }
+
+  /* Completed MCU, so update state */
+  BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+
+  /* Account for restart interval (no-op if not using restarts) */
+  entropy->restarts_to_go--;
+
+  return TRUE;
+}
+
+
+/*
+ * MCU decoding for AC successive approximation refinement scan.
+ */
+
+METHODDEF(boolean)
+decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+{   
+  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+  int Se = cinfo->Se;
+  int p1 = 1 << cinfo->Al;	/* 1 in the bit position being coded */
+  int m1 = (-1) << cinfo->Al;	/* -1 in the bit position being coded */
+  register int s, k, r;
+  unsigned int EOBRUN;
+  JBLOCKROW block;
+  JCOEFPTR thiscoef;
+  BITREAD_STATE_VARS;
+  d_derived_tbl * tbl;
+  int num_newnz;
+  int newnz_pos[DCTSIZE2];
+
+  /* Process restart marker if needed; may have to suspend */
+  if (cinfo->restart_interval) {
+    if (entropy->restarts_to_go == 0)
+      if (! process_restart(cinfo))
+	return FALSE;
+  }
+
+  /* If we've run out of data, don't modify the MCU.
+   */
+  if (! entropy->pub.insufficient_data) {
+
+    /* Load up working state */
+    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+    EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
+
+    /* There is always only one block per MCU */
+    block = MCU_data[0];
+    tbl = entropy->ac_derived_tbl;
+
+    /* If we are forced to suspend, we must undo the assignments to any newly
+     * nonzero coefficients in the block, because otherwise we'd get confused
+     * next time about which coefficients were already nonzero.
+     * But we need not undo addition of bits to already-nonzero coefficients;
+     * instead, we can test the current bit to see if we already did it.
+     */
+    num_newnz = 0;
+
+    /* initialize coefficient loop counter to start of band */
+    k = cinfo->Ss;
+
+    if (EOBRUN == 0) {
+      for (; k <= Se; k++) {
+	HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
+	r = s >> 4;
+	s &= 15;
+	if (s) {
+	  if (s != 1)		/* size of new coef should always be 1 */
+	    WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
+	  CHECK_BIT_BUFFER(br_state, 1, goto undoit);
+	  if (GET_BITS(1))
+	    s = p1;		/* newly nonzero coef is positive */
+	  else
+	    s = m1;		/* newly nonzero coef is negative */
+	} else {
+	  if (r != 15) {
+	    EOBRUN = 1 << r;	/* EOBr, run length is 2^r + appended bits */
+	    if (r) {
+	      CHECK_BIT_BUFFER(br_state, r, goto undoit);
+	      r = GET_BITS(r);
+	      EOBRUN += r;
+	    }
+	    break;		/* rest of block is handled by EOB logic */
+	  }
+	  /* note s = 0 for processing ZRL */
+	}
+	/* Advance over already-nonzero coefs and r still-zero coefs,
+	 * appending correction bits to the nonzeroes.  A correction bit is 1
+	 * if the absolute value of the coefficient must be increased.
+	 */
+	do {
+	  thiscoef = *block + jpeg_natural_order[k];
+	  if (*thiscoef != 0) {
+	    CHECK_BIT_BUFFER(br_state, 1, goto undoit);
+	    if (GET_BITS(1)) {
+	      if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
+		if (*thiscoef >= 0)
+		  *thiscoef += p1;
+		else
+		  *thiscoef += m1;
+	      }
+	    }
+	  } else {
+	    if (--r < 0)
+	      break;		/* reached target zero coefficient */
+	  }
+	  k++;
+	} while (k <= Se);
+	if (s) {
+	  int pos = jpeg_natural_order[k];
+	  /* Output newly nonzero coefficient */
+	  (*block)[pos] = (JCOEF) s;
+	  /* Remember its position in case we have to suspend */
+	  newnz_pos[num_newnz++] = pos;
+	}
+      }
+    }
+
+    if (EOBRUN > 0) {
+      /* Scan any remaining coefficient positions after the end-of-band
+       * (the last newly nonzero coefficient, if any).  Append a correction
+       * bit to each already-nonzero coefficient.  A correction bit is 1
+       * if the absolute value of the coefficient must be increased.
+       */
+      for (; k <= Se; k++) {
+	thiscoef = *block + jpeg_natural_order[k];
+	if (*thiscoef != 0) {
+	  CHECK_BIT_BUFFER(br_state, 1, goto undoit);
+	  if (GET_BITS(1)) {
+	    if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
+	      if (*thiscoef >= 0)
+		*thiscoef += p1;
+	      else
+		*thiscoef += m1;
+	    }
+	  }
+	}
+      }
+      /* Count one block completed in EOB run */
+      EOBRUN--;
+    }
+
+    /* Completed MCU, so update state */
+    BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+    entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
+  }
+
+  /* Account for restart interval (no-op if not using restarts) */
+  entropy->restarts_to_go--;
+
+  return TRUE;
+
+undoit:
+  /* Re-zero any output coefficients that we made newly nonzero */
+  while (num_newnz > 0)
+    (*block)[newnz_pos[--num_newnz]] = 0;
+
+  return FALSE;
+}
+
+
+/*
+ * Module initialization routine for progressive Huffman entropy decoding.
+ */
+
+GLOBAL(void)
+jinit_phuff_decoder (j_decompress_ptr cinfo)
+{
+  phuff_entropy_ptr entropy;
+  int *coef_bit_ptr;
+  int ci, i;
+
+  entropy = (phuff_entropy_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(phuff_entropy_decoder));
+  cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
+  entropy->pub.start_pass = start_pass_phuff_decoder;
+
+  /* Mark derived tables unallocated */
+  for (i = 0; i < NUM_HUFF_TBLS; i++) {
+    entropy->derived_tbls[i] = NULL;
+  }
+
+  /* Create progression status table */
+  cinfo->coef_bits = (int (*)[DCTSIZE2])
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				cinfo->num_components*DCTSIZE2*SIZEOF(int));
+  coef_bit_ptr = & cinfo->coef_bits[0][0];
+  for (ci = 0; ci < cinfo->num_components; ci++) 
+    for (i = 0; i < DCTSIZE2; i++)
+      *coef_bit_ptr++ = -1;
+}
+
+#endif /* D_PROGRESSIVE_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdpostct.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdpostct.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdpostct.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,290 @@
+/*
+ * jdpostct.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the decompression postprocessing controller.
+ * This controller manages the upsampling, color conversion, and color
+ * quantization/reduction steps; specifically, it controls the buffering
+ * between upsample/color conversion and color quantization/reduction.
+ *
+ * If no color quantization/reduction is required, then this module has no
+ * work to do, and it just hands off to the upsample/color conversion code.
+ * An integrated upsample/convert/quantize process would replace this module
+ * entirely.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Private buffer controller object */
+
+typedef struct {
+  struct jpeg_d_post_controller pub; /* public fields */
+
+  /* Color quantization source buffer: this holds output data from
+   * the upsample/color conversion step to be passed to the quantizer.
+   * For two-pass color quantization, we need a full-image buffer;
+   * for one-pass operation, a strip buffer is sufficient.
+   */
+  jvirt_sarray_ptr whole_image;	/* virtual array, or NULL if one-pass */
+  JSAMPARRAY buffer;		/* strip buffer, or current strip of virtual */
+  JDIMENSION strip_height;	/* buffer size in rows */
+  /* for two-pass mode only: */
+  JDIMENSION starting_row;	/* row # of first row in current strip */
+  JDIMENSION next_row;		/* index of next row to fill/empty in strip */
+} my_post_controller;
+
+typedef my_post_controller * my_post_ptr;
+
+
+/* Forward declarations */
+METHODDEF(void) post_process_1pass
+	JPP((j_decompress_ptr cinfo,
+	     JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
+	     JDIMENSION in_row_groups_avail,
+	     JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+	     JDIMENSION out_rows_avail));
+#ifdef QUANT_2PASS_SUPPORTED
+METHODDEF(void) post_process_prepass
+	JPP((j_decompress_ptr cinfo,
+	     JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
+	     JDIMENSION in_row_groups_avail,
+	     JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+	     JDIMENSION out_rows_avail));
+METHODDEF(void) post_process_2pass
+	JPP((j_decompress_ptr cinfo,
+	     JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
+	     JDIMENSION in_row_groups_avail,
+	     JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+	     JDIMENSION out_rows_avail));
+#endif
+
+
+/*
+ * Initialize for a processing pass.
+ */
+
+METHODDEF(void)
+start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
+{
+  my_post_ptr post = (my_post_ptr) cinfo->post;
+
+  switch (pass_mode) {
+  case JBUF_PASS_THRU:
+    if (cinfo->quantize_colors) {
+      /* Single-pass processing with color quantization. */
+      post->pub.post_process_data = post_process_1pass;
+      /* We could be doing buffered-image output before starting a 2-pass
+       * color quantization; in that case, jinit_d_post_controller did not
+       * allocate a strip buffer.  Use the virtual-array buffer as workspace.
+       */
+      if (post->buffer == NULL) {
+	post->buffer = (*cinfo->mem->access_virt_sarray)
+	  ((j_common_ptr) cinfo, post->whole_image,
+	   (JDIMENSION) 0, post->strip_height, TRUE);
+      }
+    } else {
+      /* For single-pass processing without color quantization,
+       * I have no work to do; just call the upsampler directly.
+       */
+      post->pub.post_process_data = cinfo->upsample->upsample;
+    }
+    break;
+#ifdef QUANT_2PASS_SUPPORTED
+  case JBUF_SAVE_AND_PASS:
+    /* First pass of 2-pass quantization */
+    if (post->whole_image == NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    post->pub.post_process_data = post_process_prepass;
+    break;
+  case JBUF_CRANK_DEST:
+    /* Second pass of 2-pass quantization */
+    if (post->whole_image == NULL)
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    post->pub.post_process_data = post_process_2pass;
+    break;
+#endif /* QUANT_2PASS_SUPPORTED */
+  default:
+    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+    break;
+  }
+  post->starting_row = post->next_row = 0;
+}
+
+
+/*
+ * Process some data in the one-pass (strip buffer) case.
+ * This is used for color precision reduction as well as one-pass quantization.
+ */
+
+METHODDEF(void)
+post_process_1pass (j_decompress_ptr cinfo,
+		    JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
+		    JDIMENSION in_row_groups_avail,
+		    JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+		    JDIMENSION out_rows_avail)
+{
+  my_post_ptr post = (my_post_ptr) cinfo->post;
+  JDIMENSION num_rows, max_rows;
+
+  /* Fill the buffer, but not more than what we can dump out in one go. */
+  /* Note we rely on the upsampler to detect bottom of image. */
+  max_rows = out_rows_avail - *out_row_ctr;
+  if (max_rows > post->strip_height)
+    max_rows = post->strip_height;
+  num_rows = 0;
+  (*cinfo->upsample->upsample) (cinfo,
+		input_buf, in_row_group_ctr, in_row_groups_avail,
+		post->buffer, &num_rows, max_rows);
+  /* Quantize and emit data. */
+  (*cinfo->cquantize->color_quantize) (cinfo,
+		post->buffer, output_buf + *out_row_ctr, (int) num_rows);
+  *out_row_ctr += num_rows;
+}
+
+
+#ifdef QUANT_2PASS_SUPPORTED
+
+/*
+ * Process some data in the first pass of 2-pass quantization.
+ */
+
+METHODDEF(void)
+post_process_prepass (j_decompress_ptr cinfo,
+		      JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
+		      JDIMENSION in_row_groups_avail,
+		      JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+		      JDIMENSION out_rows_avail)
+{
+  my_post_ptr post = (my_post_ptr) cinfo->post;
+  JDIMENSION old_next_row, num_rows;
+
+  /* Reposition virtual buffer if at start of strip. */
+  if (post->next_row == 0) {
+    post->buffer = (*cinfo->mem->access_virt_sarray)
+	((j_common_ptr) cinfo, post->whole_image,
+	 post->starting_row, post->strip_height, TRUE);
+  }
+
+  /* Upsample some data (up to a strip height's worth). */
+  old_next_row = post->next_row;
+  (*cinfo->upsample->upsample) (cinfo,
+		input_buf, in_row_group_ctr, in_row_groups_avail,
+		post->buffer, &post->next_row, post->strip_height);
+
+  /* Allow quantizer to scan new data.  No data is emitted, */
+  /* but we advance out_row_ctr so outer loop can tell when we're done. */
+  if (post->next_row > old_next_row) {
+    num_rows = post->next_row - old_next_row;
+    (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row,
+					 (JSAMPARRAY) NULL, (int) num_rows);
+    *out_row_ctr += num_rows;
+  }
+
+  /* Advance if we filled the strip. */
+  if (post->next_row >= post->strip_height) {
+    post->starting_row += post->strip_height;
+    post->next_row = 0;
+  }
+}
+
+
+/*
+ * Process some data in the second pass of 2-pass quantization.
+ */
+
+METHODDEF(void)
+post_process_2pass (j_decompress_ptr cinfo,
+		    JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
+		    JDIMENSION in_row_groups_avail,
+		    JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+		    JDIMENSION out_rows_avail)
+{
+  my_post_ptr post = (my_post_ptr) cinfo->post;
+  JDIMENSION num_rows, max_rows;
+
+  /* Reposition virtual buffer if at start of strip. */
+  if (post->next_row == 0) {
+    post->buffer = (*cinfo->mem->access_virt_sarray)
+	((j_common_ptr) cinfo, post->whole_image,
+	 post->starting_row, post->strip_height, FALSE);
+  }
+
+  /* Determine number of rows to emit. */
+  num_rows = post->strip_height - post->next_row; /* available in strip */
+  max_rows = out_rows_avail - *out_row_ctr; /* available in output area */
+  if (num_rows > max_rows)
+    num_rows = max_rows;
+  /* We have to check bottom of image here, can't depend on upsampler. */
+  max_rows = cinfo->output_height - post->starting_row;
+  if (num_rows > max_rows)
+    num_rows = max_rows;
+
+  /* Quantize and emit data. */
+  (*cinfo->cquantize->color_quantize) (cinfo,
+		post->buffer + post->next_row, output_buf + *out_row_ctr,
+		(int) num_rows);
+  *out_row_ctr += num_rows;
+
+  /* Advance if we filled the strip. */
+  post->next_row += num_rows;
+  if (post->next_row >= post->strip_height) {
+    post->starting_row += post->strip_height;
+    post->next_row = 0;
+  }
+}
+
+#endif /* QUANT_2PASS_SUPPORTED */
+
+
+/*
+ * Initialize postprocessing controller.
+ */
+
+GLOBAL(void)
+jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
+{
+  my_post_ptr post;
+
+  post = (my_post_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_post_controller));
+  cinfo->post = (struct jpeg_d_post_controller *) post;
+  post->pub.start_pass = start_pass_dpost;
+  post->whole_image = NULL;	/* flag for no virtual arrays */
+  post->buffer = NULL;		/* flag for no strip buffer */
+
+  /* Create the quantization buffer, if needed */
+  if (cinfo->quantize_colors) {
+    /* The buffer strip height is max_v_samp_factor, which is typically
+     * an efficient number of rows for upsampling to return.
+     * (In the presence of output rescaling, we might want to be smarter?)
+     */
+    post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor;
+    if (need_full_buffer) {
+      /* Two-pass color quantization: need full-image storage. */
+      /* We round up the number of rows to a multiple of the strip height. */
+#ifdef QUANT_2PASS_SUPPORTED
+      post->whole_image = (*cinfo->mem->request_virt_sarray)
+	((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+	 cinfo->output_width * cinfo->out_color_components,
+	 (JDIMENSION) jround_up((long) cinfo->output_height,
+				(long) post->strip_height),
+	 post->strip_height);
+#else
+      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
+#endif /* QUANT_2PASS_SUPPORTED */
+    } else {
+      /* One-pass color quantization: just make a strip buffer. */
+      post->buffer = (*cinfo->mem->alloc_sarray)
+	((j_common_ptr) cinfo, JPOOL_IMAGE,
+	 cinfo->output_width * cinfo->out_color_components,
+	 post->strip_height);
+    }
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdsample.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdsample.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdsample.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,478 @@
+/*
+ * jdsample.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains upsampling routines.
+ *
+ * Upsampling input data is counted in "row groups".  A row group
+ * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)
+ * sample rows of each component.  Upsampling will normally produce
+ * max_v_samp_factor pixel rows from each row group (but this could vary
+ * if the upsampler is applying a scale factor of its own).
+ *
+ * An excellent reference for image resampling is
+ *   Digital Image Warping, George Wolberg, 1990.
+ *   Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Pointer to routine to upsample a single component */
+typedef JMETHOD(void, upsample1_ptr,
+		(j_decompress_ptr cinfo, jpeg_component_info * compptr,
+		 JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr));
+
+/* Private subobject */
+
+typedef struct {
+  struct jpeg_upsampler pub;	/* public fields */
+
+  /* Color conversion buffer.  When using separate upsampling and color
+   * conversion steps, this buffer holds one upsampled row group until it
+   * has been color converted and output.
+   * Note: we do not allocate any storage for component(s) which are full-size,
+   * ie do not need rescaling.  The corresponding entry of color_buf[] is
+   * simply set to point to the input data array, thereby avoiding copying.
+   */
+  JSAMPARRAY color_buf[MAX_COMPONENTS];
+
+  /* Per-component upsampling method pointers */
+  upsample1_ptr methods[MAX_COMPONENTS];
+
+  int next_row_out;		/* counts rows emitted from color_buf */
+  JDIMENSION rows_to_go;	/* counts rows remaining in image */
+
+  /* Height of an input row group for each component. */
+  int rowgroup_height[MAX_COMPONENTS];
+
+  /* These arrays save pixel expansion factors so that int_expand need not
+   * recompute them each time.  They are unused for other upsampling methods.
+   */
+  UINT8 h_expand[MAX_COMPONENTS];
+  UINT8 v_expand[MAX_COMPONENTS];
+} my_upsampler;
+
+typedef my_upsampler * my_upsample_ptr;
+
+
+/*
+ * Initialize for an upsampling pass.
+ */
+
+METHODDEF(void)
+start_pass_upsample (j_decompress_ptr cinfo)
+{
+  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+
+  /* Mark the conversion buffer empty */
+  upsample->next_row_out = cinfo->max_v_samp_factor;
+  /* Initialize total-height counter for detecting bottom of image */
+  upsample->rows_to_go = cinfo->output_height;
+}
+
+
+/*
+ * Control routine to do upsampling (and color conversion).
+ *
+ * In this version we upsample each component independently.
+ * We upsample one row group into the conversion buffer, then apply
+ * color conversion a row at a time.
+ */
+
+METHODDEF(void)
+sep_upsample (j_decompress_ptr cinfo,
+	      JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
+	      JDIMENSION in_row_groups_avail,
+	      JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+	      JDIMENSION out_rows_avail)
+{
+  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+  int ci;
+  jpeg_component_info * compptr;
+  JDIMENSION num_rows;
+
+  /* Fill the conversion buffer, if it's empty */
+  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
+    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+	 ci++, compptr++) {
+      /* Invoke per-component upsample method.  Notice we pass a POINTER
+       * to color_buf[ci], so that fullsize_upsample can change it.
+       */
+      (*upsample->methods[ci]) (cinfo, compptr,
+	input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
+	upsample->color_buf + ci);
+    }
+    upsample->next_row_out = 0;
+  }
+
+  /* Color-convert and emit rows */
+
+  /* How many we have in the buffer: */
+  num_rows = (JDIMENSION) (cinfo->max_v_samp_factor - upsample->next_row_out);
+  /* Not more than the distance to the end of the image.  Need this test
+   * in case the image height is not a multiple of max_v_samp_factor:
+   */
+  if (num_rows > upsample->rows_to_go) 
+    num_rows = upsample->rows_to_go;
+  /* And not more than what the client can accept: */
+  out_rows_avail -= *out_row_ctr;
+  if (num_rows > out_rows_avail)
+    num_rows = out_rows_avail;
+
+  (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf,
+				     (JDIMENSION) upsample->next_row_out,
+				     output_buf + *out_row_ctr,
+				     (int) num_rows);
+
+  /* Adjust counts */
+  *out_row_ctr += num_rows;
+  upsample->rows_to_go -= num_rows;
+  upsample->next_row_out += num_rows;
+  /* When the buffer is emptied, declare this input row group consumed */
+  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
+    (*in_row_group_ctr)++;
+}
+
+
+/*
+ * These are the routines invoked by sep_upsample to upsample pixel values
+ * of a single component.  One row group is processed per call.
+ */
+
+
+/*
+ * For full-size components, we just make color_buf[ci] point at the
+ * input buffer, and thus avoid copying any data.  Note that this is
+ * safe only because sep_upsample doesn't declare the input row group
+ * "consumed" until we are done color converting and emitting it.
+ */
+
+METHODDEF(void)
+fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+		   JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
+{
+  *output_data_ptr = input_data;
+}
+
+
+/*
+ * This is a no-op version used for "uninteresting" components.
+ * These components will not be referenced by color conversion.
+ */
+
+METHODDEF(void)
+noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	       JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
+{
+  *output_data_ptr = NULL;	/* safety check */
+}
+
+
+/*
+ * This version handles any integral sampling ratios.
+ * This is not used for typical JPEG files, so it need not be fast.
+ * Nor, for that matter, is it particularly accurate: the algorithm is
+ * simple replication of the input pixel onto the corresponding output
+ * pixels.  The hi-falutin sampling literature refers to this as a
+ * "box filter".  A box filter tends to introduce visible artifacts,
+ * so if you are actually going to use 3:1 or 4:1 sampling ratios
+ * you would be well advised to improve this code.
+ */
+
+METHODDEF(void)
+int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	      JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
+{
+  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+  JSAMPARRAY output_data = *output_data_ptr;
+  register JSAMPROW inptr, outptr;
+  register JSAMPLE invalue;
+  register int h;
+  JSAMPROW outend;
+  int h_expand, v_expand;
+  int inrow, outrow;
+
+  h_expand = upsample->h_expand[compptr->component_index];
+  v_expand = upsample->v_expand[compptr->component_index];
+
+  inrow = outrow = 0;
+  while (outrow < cinfo->max_v_samp_factor) {
+    /* Generate one output row with proper horizontal expansion */
+    inptr = input_data[inrow];
+    outptr = output_data[outrow];
+    outend = outptr + cinfo->output_width;
+    while (outptr < outend) {
+      invalue = *inptr++;	/* don't need GETJSAMPLE() here */
+      for (h = h_expand; h > 0; h--) {
+	*outptr++ = invalue;
+      }
+    }
+    /* Generate any additional output rows by duplicating the first one */
+    if (v_expand > 1) {
+      jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
+			v_expand-1, cinfo->output_width);
+    }
+    inrow++;
+    outrow += v_expand;
+  }
+}
+
+
+/*
+ * Fast processing for the common case of 2:1 horizontal and 1:1 vertical.
+ * It's still a box filter.
+ */
+
+METHODDEF(void)
+h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	       JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
+{
+  JSAMPARRAY output_data = *output_data_ptr;
+  register JSAMPROW inptr, outptr;
+  register JSAMPLE invalue;
+  JSAMPROW outend;
+  int inrow;
+
+  for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
+    inptr = input_data[inrow];
+    outptr = output_data[inrow];
+    outend = outptr + cinfo->output_width;
+    while (outptr < outend) {
+      invalue = *inptr++;	/* don't need GETJSAMPLE() here */
+      *outptr++ = invalue;
+      *outptr++ = invalue;
+    }
+  }
+}
+
+
+/*
+ * Fast processing for the common case of 2:1 horizontal and 2:1 vertical.
+ * It's still a box filter.
+ */
+
+METHODDEF(void)
+h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	       JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
+{
+  JSAMPARRAY output_data = *output_data_ptr;
+  register JSAMPROW inptr, outptr;
+  register JSAMPLE invalue;
+  JSAMPROW outend;
+  int inrow, outrow;
+
+  inrow = outrow = 0;
+  while (outrow < cinfo->max_v_samp_factor) {
+    inptr = input_data[inrow];
+    outptr = output_data[outrow];
+    outend = outptr + cinfo->output_width;
+    while (outptr < outend) {
+      invalue = *inptr++;	/* don't need GETJSAMPLE() here */
+      *outptr++ = invalue;
+      *outptr++ = invalue;
+    }
+    jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
+		      1, cinfo->output_width);
+    inrow++;
+    outrow += 2;
+  }
+}
+
+
+/*
+ * Fancy processing for the common case of 2:1 horizontal and 1:1 vertical.
+ *
+ * The upsampling algorithm is linear interpolation between pixel centers,
+ * also known as a "triangle filter".  This is a good compromise between
+ * speed and visual quality.  The centers of the output pixels are 1/4 and 3/4
+ * of the way between input pixel centers.
+ *
+ * A note about the "bias" calculations: when rounding fractional values to
+ * integer, we do not want to always round 0.5 up to the next integer.
+ * If we did that, we'd introduce a noticeable bias towards larger values.
+ * Instead, this code is arranged so that 0.5 will be rounded up or down at
+ * alternate pixel locations (a simple ordered dither pattern).
+ */
+
+METHODDEF(void)
+h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+		     JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
+{
+  JSAMPARRAY output_data = *output_data_ptr;
+  register JSAMPROW inptr, outptr;
+  register int invalue;
+  register JDIMENSION colctr;
+  int inrow;
+
+  for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
+    inptr = input_data[inrow];
+    outptr = output_data[inrow];
+    /* Special case for first column */
+    invalue = GETJSAMPLE(*inptr++);
+    *outptr++ = (JSAMPLE) invalue;
+    *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2);
+
+    for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
+      /* General case: 3/4 * nearer pixel + 1/4 * further pixel */
+      invalue = GETJSAMPLE(*inptr++) * 3;
+      *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2);
+      *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(*inptr) + 2) >> 2);
+    }
+
+    /* Special case for last column */
+    invalue = GETJSAMPLE(*inptr);
+    *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2);
+    *outptr++ = (JSAMPLE) invalue;
+  }
+}
+
+
+/*
+ * Fancy processing for the common case of 2:1 horizontal and 2:1 vertical.
+ * Again a triangle filter; see comments for h2v1 case, above.
+ *
+ * It is OK for us to reference the adjacent input rows because we demanded
+ * context from the main buffer controller (see initialization code).
+ */
+
+METHODDEF(void)
+h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+		     JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
+{
+  JSAMPARRAY output_data = *output_data_ptr;
+  register JSAMPROW inptr0, inptr1, outptr;
+#if BITS_IN_JSAMPLE == 8
+  register int thiscolsum, lastcolsum, nextcolsum;
+#else
+  register INT32 thiscolsum, lastcolsum, nextcolsum;
+#endif
+  register JDIMENSION colctr;
+  int inrow, outrow, v;
+
+  inrow = outrow = 0;
+  while (outrow < cinfo->max_v_samp_factor) {
+    for (v = 0; v < 2; v++) {
+      /* inptr0 points to nearest input row, inptr1 points to next nearest */
+      inptr0 = input_data[inrow];
+      if (v == 0)		/* next nearest is row above */
+	inptr1 = input_data[inrow-1];
+      else			/* next nearest is row below */
+	inptr1 = input_data[inrow+1];
+      outptr = output_data[outrow++];
+
+      /* Special case for first column */
+      thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
+      nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
+      *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4);
+      *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);
+      lastcolsum = thiscolsum; thiscolsum = nextcolsum;
+
+      for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
+	/* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */
+	/* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */
+	nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
+	*outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
+	*outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);
+	lastcolsum = thiscolsum; thiscolsum = nextcolsum;
+      }
+
+      /* Special case for last column */
+      *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
+      *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 7) >> 4);
+    }
+    inrow++;
+  }
+}
+
+
+/*
+ * Module initialization routine for upsampling.
+ */
+
+GLOBAL(void)
+jinit_upsampler (j_decompress_ptr cinfo)
+{
+  my_upsample_ptr upsample;
+  int ci;
+  jpeg_component_info * compptr;
+  boolean need_buffer, do_fancy;
+  int h_in_group, v_in_group, h_out_group, v_out_group;
+
+  upsample = (my_upsample_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_upsampler));
+  cinfo->upsample = (struct jpeg_upsampler *) upsample;
+  upsample->pub.start_pass = start_pass_upsample;
+  upsample->pub.upsample = sep_upsample;
+  upsample->pub.need_context_rows = FALSE; /* until we find out differently */
+
+  if (cinfo->CCIR601_sampling)	/* this isn't supported */
+    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
+
+  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
+   * so don't ask for it.
+   */
+  do_fancy = cinfo->do_fancy_upsampling && cinfo->min_DCT_scaled_size > 1;
+
+  /* Verify we can handle the sampling factors, select per-component methods,
+   * and create storage as needed.
+   */
+  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+       ci++, compptr++) {
+    /* Compute size of an "input group" after IDCT scaling.  This many samples
+     * are to be converted to max_h_samp_factor * max_v_samp_factor pixels.
+     */
+    h_in_group = (compptr->h_samp_factor * compptr->DCT_scaled_size) /
+		 cinfo->min_DCT_scaled_size;
+    v_in_group = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
+		 cinfo->min_DCT_scaled_size;
+    h_out_group = cinfo->max_h_samp_factor;
+    v_out_group = cinfo->max_v_samp_factor;
+    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
+    need_buffer = TRUE;
+    if (! compptr->component_needed) {
+      /* Don't bother to upsample an uninteresting component. */
+      upsample->methods[ci] = noop_upsample;
+      need_buffer = FALSE;
+    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
+      /* Fullsize components can be processed without any work. */
+      upsample->methods[ci] = fullsize_upsample;
+      need_buffer = FALSE;
+    } else if (h_in_group * 2 == h_out_group &&
+	       v_in_group == v_out_group) {
+      /* Special cases for 2h1v upsampling */
+      if (do_fancy && compptr->downsampled_width > 2)
+	upsample->methods[ci] = h2v1_fancy_upsample;
+      else
+	upsample->methods[ci] = h2v1_upsample;
+    } else if (h_in_group * 2 == h_out_group &&
+	       v_in_group * 2 == v_out_group) {
+      /* Special cases for 2h2v upsampling */
+      if (do_fancy && compptr->downsampled_width > 2) {
+	upsample->methods[ci] = h2v2_fancy_upsample;
+	upsample->pub.need_context_rows = TRUE;
+      } else
+	upsample->methods[ci] = h2v2_upsample;
+    } else if ((h_out_group % h_in_group) == 0 &&
+	       (v_out_group % v_in_group) == 0) {
+      /* Generic integral-factors upsampling method */
+      upsample->methods[ci] = int_upsample;
+      upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group);
+      upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group);
+    } else
+      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
+    if (need_buffer) {
+      upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray)
+	((j_common_ptr) cinfo, JPOOL_IMAGE,
+	 (JDIMENSION) jround_up((long) cinfo->output_width,
+				(long) cinfo->max_h_samp_factor),
+	 (JDIMENSION) cinfo->max_v_samp_factor);
+    }
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jdtrans.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jdtrans.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jdtrans.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,143 @@
+/*
+ * jdtrans.c
+ *
+ * Copyright (C) 1995-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains library routines for transcoding decompression,
+ * that is, reading raw DCT coefficient arrays from an input JPEG file.
+ * The routines in jdapimin.c will also be needed by a transcoder.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/* Forward declarations */
+LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo));
+
+
+/*
+ * Read the coefficient arrays from a JPEG file.
+ * jpeg_read_header must be completed before calling this.
+ *
+ * The entire image is read into a set of virtual coefficient-block arrays,
+ * one per component.  The return value is a pointer to the array of
+ * virtual-array descriptors.  These can be manipulated directly via the
+ * JPEG memory manager, or handed off to jpeg_write_coefficients().
+ * To release the memory occupied by the virtual arrays, call
+ * jpeg_finish_decompress() when done with the data.
+ *
+ * An alternative usage is to simply obtain access to the coefficient arrays
+ * during a buffered-image-mode decompression operation.  This is allowed
+ * after any jpeg_finish_output() call.  The arrays can be accessed until
+ * jpeg_finish_decompress() is called.  (Note that any call to the library
+ * may reposition the arrays, so don't rely on access_virt_barray() results
+ * to stay valid across library calls.)
+ *
+ * Returns NULL if suspended.  This case need be checked only if
+ * a suspending data source is used.
+ */
+
+GLOBAL(jvirt_barray_ptr *)
+jpeg_read_coefficients (j_decompress_ptr cinfo)
+{
+  if (cinfo->global_state == DSTATE_READY) {
+    /* First call: initialize active modules */
+    transdecode_master_selection(cinfo);
+    cinfo->global_state = DSTATE_RDCOEFS;
+  }
+  if (cinfo->global_state == DSTATE_RDCOEFS) {
+    /* Absorb whole file into the coef buffer */
+    for (;;) {
+      int retcode;
+      /* Call progress monitor hook if present */
+      if (cinfo->progress != NULL)
+	(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+      /* Absorb some more input */
+      retcode = (*cinfo->inputctl->consume_input) (cinfo);
+      if (retcode == JPEG_SUSPENDED)
+	return NULL;
+      if (retcode == JPEG_REACHED_EOI)
+	break;
+      /* Advance progress counter if appropriate */
+      if (cinfo->progress != NULL &&
+	  (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
+	if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
+	  /* startup underestimated number of scans; ratchet up one scan */
+	  cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
+	}
+      }
+    }
+    /* Set state so that jpeg_finish_decompress does the right thing */
+    cinfo->global_state = DSTATE_STOPPING;
+  }
+  /* At this point we should be in state DSTATE_STOPPING if being used
+   * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access
+   * to the coefficients during a full buffered-image-mode decompression.
+   */
+  if ((cinfo->global_state == DSTATE_STOPPING ||
+       cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
+    return cinfo->coef->coef_arrays;
+  }
+  /* Oops, improper usage */
+  ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+  return NULL;			/* keep compiler happy */
+}
+
+
+/*
+ * Master selection of decompression modules for transcoding.
+ * This substitutes for jdmaster.c's initialization of the full decompressor.
+ */
+
+LOCAL(void)
+transdecode_master_selection (j_decompress_ptr cinfo)
+{
+  /* This is effectively a buffered-image operation. */
+  cinfo->buffered_image = TRUE;
+
+  /* Entropy decoding: either Huffman or arithmetic coding. */
+  if (cinfo->arith_code) {
+    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
+  } else {
+    if (cinfo->progressive_mode) {
+#ifdef D_PROGRESSIVE_SUPPORTED
+      jinit_phuff_decoder(cinfo);
+#else
+      ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+    } else
+      jinit_huff_decoder(cinfo);
+  }
+
+  /* Always get a full-image coefficient buffer. */
+  jinit_d_coef_controller(cinfo, TRUE);
+
+  /* We can now tell the memory manager to allocate virtual arrays. */
+  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
+
+  /* Initialize input side of decompressor to consume first scan. */
+  (*cinfo->inputctl->start_input_pass) (cinfo);
+
+  /* Initialize progress monitoring. */
+  if (cinfo->progress != NULL) {
+    int nscans;
+    /* Estimate number of scans to set pass_limit. */
+    if (cinfo->progressive_mode) {
+      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
+      nscans = 2 + 3 * cinfo->num_components;
+    } else if (cinfo->inputctl->has_multiple_scans) {
+      /* For a nonprogressive multiscan file, estimate 1 scan per component. */
+      nscans = cinfo->num_components;
+    } else {
+      nscans = 1;
+    }
+    cinfo->progress->pass_counter = 0L;
+    cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
+    cinfo->progress->completed_passes = 0;
+    cinfo->progress->total_passes = 1;
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jerror.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jerror.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jerror.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,252 @@
+/*
+ * jerror.c
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains simple error-reporting and trace-message routines.
+ * These are suitable for Unix-like systems and others where writing to
+ * stderr is the right thing to do.  Many applications will want to replace
+ * some or all of these routines.
+ *
+ * If you define USE_WINDOWS_MESSAGEBOX in jconfig.h or in the makefile,
+ * you get a Windows-specific hack to display error messages in a dialog box.
+ * It ain't much, but it beats dropping error messages into the bit bucket,
+ * which is what happens to output to stderr under most Windows C compilers.
+ *
+ * These routines are used by both the compression and decompression code.
+ */
+
+/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jversion.h"
+#include "jerror.h"
+
+#ifdef USE_WINDOWS_MESSAGEBOX
+#include <windows.h>
+#endif
+
+#ifndef EXIT_FAILURE		/* define exit() codes if not provided */
+#define EXIT_FAILURE  1
+#endif
+
+
+/*
+ * Create the message string table.
+ * We do this from the master message list in jerror.h by re-reading
+ * jerror.h with a suitable definition for macro JMESSAGE.
+ * The message table is made an external symbol just in case any applications
+ * want to refer to it directly.
+ */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jpeg_std_message_table	jMsgTable
+#endif
+
+#define JMESSAGE(code,string)	string ,
+
+const char * const jpeg_std_message_table[] = {
+#include "jerror.h"
+  NULL
+};
+
+
+/*
+ * Error exit handler: must not return to caller.
+ *
+ * Applications may override this if they want to get control back after
+ * an error.  Typically one would longjmp somewhere instead of exiting.
+ * The setjmp buffer can be made a private field within an expanded error
+ * handler object.  Note that the info needed to generate an error message
+ * is stored in the error object, so you can generate the message now or
+ * later, at your convenience.
+ * You should make sure that the JPEG object is cleaned up (with jpeg_abort
+ * or jpeg_destroy) at some point.
+ */
+
+METHODDEF(void)
+error_exit (j_common_ptr cinfo)
+{
+  /* Always display the message */
+  (*cinfo->err->output_message) (cinfo);
+
+  /* Let the memory manager delete any temp files before we die */
+  jpeg_destroy(cinfo);
+
+  exit(EXIT_FAILURE);
+}
+
+
+/*
+ * Actual output of an error or trace message.
+ * Applications may override this method to send JPEG messages somewhere
+ * other than stderr.
+ *
+ * On Windows, printing to stderr is generally completely useless,
+ * so we provide optional code to produce an error-dialog popup.
+ * Most Windows applications will still prefer to override this routine,
+ * but if they don't, it'll do something at least marginally useful.
+ *
+ * NOTE: to use the library in an environment that doesn't support the
+ * C stdio library, you may have to delete the call to fprintf() entirely,
+ * not just not use this routine.
+ */
+
+METHODDEF(void)
+output_message (j_common_ptr cinfo)
+{
+  char buffer[JMSG_LENGTH_MAX];
+
+  /* Create the message */
+  (*cinfo->err->format_message) (cinfo, buffer);
+
+#ifdef USE_WINDOWS_MESSAGEBOX
+  /* Display it in a message dialog box */
+  MessageBox(GetActiveWindow(), buffer, "JPEG Library Error",
+	     MB_OK | MB_ICONERROR);
+#else
+  /* Send it to stderr, adding a newline */
+  fprintf(stderr, "%s\n", buffer);
+#endif
+}
+
+
+/*
+ * Decide whether to emit a trace or warning message.
+ * msg_level is one of:
+ *   -1: recoverable corrupt-data warning, may want to abort.
+ *    0: important advisory messages (always display to user).
+ *    1: first level of tracing detail.
+ *    2,3,...: successively more detailed tracing messages.
+ * An application might override this method if it wanted to abort on warnings
+ * or change the policy about which messages to display.
+ */
+
+METHODDEF(void)
+emit_message (j_common_ptr cinfo, int msg_level)
+{
+  struct jpeg_error_mgr * err = cinfo->err;
+
+  if (msg_level < 0) {
+    /* It's a warning message.  Since corrupt files may generate many warnings,
+     * the policy implemented here is to show only the first warning,
+     * unless trace_level >= 3.
+     */
+    if (err->num_warnings == 0 || err->trace_level >= 3)
+      (*err->output_message) (cinfo);
+    /* Always count warnings in num_warnings. */
+    err->num_warnings++;
+  } else {
+    /* It's a trace message.  Show it if trace_level >= msg_level. */
+    if (err->trace_level >= msg_level)
+      (*err->output_message) (cinfo);
+  }
+}
+
+
+/*
+ * Format a message string for the most recent JPEG error or message.
+ * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX
+ * characters.  Note that no '\n' character is added to the string.
+ * Few applications should need to override this method.
+ */
+
+METHODDEF(void)
+format_message (j_common_ptr cinfo, char * buffer)
+{
+  struct jpeg_error_mgr * err = cinfo->err;
+  int msg_code = err->msg_code;
+  const char * msgtext = NULL;
+  const char * msgptr;
+  char ch;
+  boolean isstring;
+
+  /* Look up message string in proper table */
+  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
+    msgtext = err->jpeg_message_table[msg_code];
+  } else if (err->addon_message_table != NULL &&
+	     msg_code >= err->first_addon_message &&
+	     msg_code <= err->last_addon_message) {
+    msgtext = err->addon_message_table[msg_code - err->first_addon_message];
+  }
+
+  /* Defend against bogus message number */
+  if (msgtext == NULL) {
+    err->msg_parm.i[0] = msg_code;
+    msgtext = err->jpeg_message_table[0];
+  }
+
+  /* Check for string parameter, as indicated by %s in the message text */
+  isstring = FALSE;
+  msgptr = msgtext;
+  while ((ch = *msgptr++) != '\0') {
+    if (ch == '%') {
+      if (*msgptr == 's') isstring = TRUE;
+      break;
+    }
+  }
+
+  /* Format the message into the passed buffer */
+  if (isstring)
+    sprintf(buffer, msgtext, err->msg_parm.s);
+  else
+    sprintf(buffer, msgtext,
+	    err->msg_parm.i[0], err->msg_parm.i[1],
+	    err->msg_parm.i[2], err->msg_parm.i[3],
+	    err->msg_parm.i[4], err->msg_parm.i[5],
+	    err->msg_parm.i[6], err->msg_parm.i[7]);
+}
+
+
+/*
+ * Reset error state variables at start of a new image.
+ * This is called during compression startup to reset trace/error
+ * processing to default state, without losing any application-specific
+ * method pointers.  An application might possibly want to override
+ * this method if it has additional error processing state.
+ */
+
+METHODDEF(void)
+reset_error_mgr (j_common_ptr cinfo)
+{
+  cinfo->err->num_warnings = 0;
+  /* trace_level is not reset since it is an application-supplied parameter */
+  cinfo->err->msg_code = 0;	/* may be useful as a flag for "no error" */
+}
+
+
+/*
+ * Fill in the standard error-handling methods in a jpeg_error_mgr object.
+ * Typical call is:
+ *	struct jpeg_compress_struct cinfo;
+ *	struct jpeg_error_mgr err;
+ *
+ *	cinfo.err = jpeg_std_error(&err);
+ * after which the application may override some of the methods.
+ */
+
+GLOBAL(struct jpeg_error_mgr *)
+jpeg_std_error (struct jpeg_error_mgr * err)
+{
+  err->error_exit = error_exit;
+  err->emit_message = emit_message;
+  err->output_message = output_message;
+  err->format_message = format_message;
+  err->reset_error_mgr = reset_error_mgr;
+
+  err->trace_level = 0;		/* default = no tracing */
+  err->num_warnings = 0;	/* no warnings emitted yet */
+  err->msg_code = 0;		/* may be useful as a flag for "no error" */
+
+  /* Initialize message table pointers */
+  err->jpeg_message_table = jpeg_std_message_table;
+  err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1;
+
+  err->addon_message_table = NULL;
+  err->first_addon_message = 0;	/* for safety */
+  err->last_addon_message = 0;
+
+  return err;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jerror.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jerror.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jerror.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,291 @@
+/*
+ * jerror.h
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file defines the error and message codes for the JPEG library.
+ * Edit this file to add new codes, or to translate the message strings to
+ * some other language.
+ * A set of error-reporting macros are defined too.  Some applications using
+ * the JPEG library may wish to include this file to get the error codes
+ * and/or the macros.
+ */
+
+/*
+ * To define the enum list of message codes, include this file without
+ * defining macro JMESSAGE.  To create a message string table, include it
+ * again with a suitable JMESSAGE definition (see jerror.c for an example).
+ */
+#ifndef JMESSAGE
+#ifndef JERROR_H
+/* First time through, define the enum list */
+#define JMAKE_ENUM_LIST
+#else
+/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
+#define JMESSAGE(code,string)
+#endif /* JERROR_H */
+#endif /* JMESSAGE */
+
+#ifdef JMAKE_ENUM_LIST
+
+typedef enum {
+
+#define JMESSAGE(code,string)	code ,
+
+#endif /* JMAKE_ENUM_LIST */
+
+JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
+
+/* For maintenance convenience, list is alphabetical by message code name */
+JMESSAGE(JERR_ARITH_NOTIMPL,
+	 "Sorry, there are legal restrictions on arithmetic coding")
+JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
+JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
+JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
+JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
+JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
+JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
+JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
+JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
+JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
+JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")
+JMESSAGE(JERR_BAD_LIB_VERSION,
+	 "Wrong JPEG library version: library is %d, caller expects %d")
+JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan")
+JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")
+JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")
+JMESSAGE(JERR_BAD_PROGRESSION,
+	 "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")
+JMESSAGE(JERR_BAD_PROG_SCRIPT,
+	 "Invalid progressive parameters at scan script entry %d")
+JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")
+JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")
+JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")
+JMESSAGE(JERR_BAD_STRUCT_SIZE,
+	 "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u")
+JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")
+JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")
+JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")
+JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
+JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")
+JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")
+JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")
+JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")
+JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")
+JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")
+JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)")
+JMESSAGE(JERR_EMS_READ, "Read from EMS failed")
+JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed")
+JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
+JMESSAGE(JERR_FILE_READ, "Input file read error")
+JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
+JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")
+JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
+JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
+JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")
+JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
+JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
+JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,
+	 "Cannot transcode due to multiple use of quantization table %d")
+JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
+JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
+JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
+JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
+JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
+JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
+JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
+JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")
+JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")
+JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")
+JMESSAGE(JERR_QUANT_COMPONENTS,
+	 "Cannot quantize more than %d color components")
+JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
+JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
+JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
+JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
+JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
+JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
+JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
+JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
+JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
+JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
+JMESSAGE(JERR_TFILE_WRITE,
+	 "Write failed on temporary file --- out of disk space?")
+JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")
+JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")
+JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")
+JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")
+JMESSAGE(JERR_XMS_READ, "Read from XMS failed")
+JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")
+JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)
+JMESSAGE(JMSG_VERSION, JVERSION)
+JMESSAGE(JTRC_16BIT_TABLES,
+	 "Caution: quantization tables are too coarse for baseline JPEG")
+JMESSAGE(JTRC_ADOBE,
+	 "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
+JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
+JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
+JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
+JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
+JMESSAGE(JTRC_DQT, "Define Quantization Table %d  precision %d")
+JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
+JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")
+JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")
+JMESSAGE(JTRC_EOI, "End Of Image")
+JMESSAGE(JTRC_HUFFBITS, "        %3d %3d %3d %3d %3d %3d %3d %3d")
+JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d  %d")
+JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
+	 "Warning: thumbnail image size does not match data length %u")
+JMESSAGE(JTRC_JFIF_EXTENSION,
+	 "JFIF extension marker: type 0x%02x, length %u")
+JMESSAGE(JTRC_JFIF_THUMBNAIL, "    with %d x %d thumbnail image")
+JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
+JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
+JMESSAGE(JTRC_QUANTVALS, "        %4u %4u %4u %4u %4u %4u %4u %4u")
+JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")
+JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")
+JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")
+JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")
+JMESSAGE(JTRC_RST, "RST%d")
+JMESSAGE(JTRC_SMOOTH_NOTIMPL,
+	 "Smoothing not supported with nonstandard sampling ratios")
+JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")
+JMESSAGE(JTRC_SOF_COMPONENT, "    Component %d: %dhx%dv q=%d")
+JMESSAGE(JTRC_SOI, "Start of Image")
+JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
+JMESSAGE(JTRC_SOS_COMPONENT, "    Component %d: dc=%d ac=%d")
+JMESSAGE(JTRC_SOS_PARAMS, "  Ss=%d, Se=%d, Ah=%d, Al=%d")
+JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")
+JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")
+JMESSAGE(JTRC_THUMB_JPEG,
+	 "JFIF extension marker: JPEG-compressed thumbnail image, length %u")
+JMESSAGE(JTRC_THUMB_PALETTE,
+	 "JFIF extension marker: palette thumbnail image, length %u")
+JMESSAGE(JTRC_THUMB_RGB,
+	 "JFIF extension marker: RGB thumbnail image, length %u")
+JMESSAGE(JTRC_UNKNOWN_IDS,
+	 "Unrecognized component IDs %d %d %d, assuming YCbCr")
+JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
+JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
+JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
+JMESSAGE(JWRN_BOGUS_PROGRESSION,
+	 "Inconsistent progression sequence for component %d coefficient %d")
+JMESSAGE(JWRN_EXTRANEOUS_DATA,
+	 "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")
+JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment")
+JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")
+JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")
+JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
+JMESSAGE(JWRN_MUST_RESYNC,
+	 "Corrupt JPEG data: found marker 0x%02x instead of RST%d")
+JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
+JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
+
+#ifdef JMAKE_ENUM_LIST
+
+  JMSG_LASTMSGCODE
+} J_MESSAGE_CODE;
+
+#undef JMAKE_ENUM_LIST
+#endif /* JMAKE_ENUM_LIST */
+
+/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
+#undef JMESSAGE
+
+
+#ifndef JERROR_H
+#define JERROR_H
+
+/* Macros to simplify using the error and trace message stuff */
+/* The first parameter is either type of cinfo pointer */
+
+/* Fatal errors (print message and exit) */
+#define ERREXIT(cinfo,code)  \
+  ((cinfo)->err->msg_code = (code), \
+   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
+#define ERREXIT1(cinfo,code,p1)  \
+  ((cinfo)->err->msg_code = (code), \
+   (cinfo)->err->msg_parm.i[0] = (p1), \
+   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
+#define ERREXIT2(cinfo,code,p1,p2)  \
+  ((cinfo)->err->msg_code = (code), \
+   (cinfo)->err->msg_parm.i[0] = (p1), \
+   (cinfo)->err->msg_parm.i[1] = (p2), \
+   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
+#define ERREXIT3(cinfo,code,p1,p2,p3)  \
+  ((cinfo)->err->msg_code = (code), \
+   (cinfo)->err->msg_parm.i[0] = (p1), \
+   (cinfo)->err->msg_parm.i[1] = (p2), \
+   (cinfo)->err->msg_parm.i[2] = (p3), \
+   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
+#define ERREXIT4(cinfo,code,p1,p2,p3,p4)  \
+  ((cinfo)->err->msg_code = (code), \
+   (cinfo)->err->msg_parm.i[0] = (p1), \
+   (cinfo)->err->msg_parm.i[1] = (p2), \
+   (cinfo)->err->msg_parm.i[2] = (p3), \
+   (cinfo)->err->msg_parm.i[3] = (p4), \
+   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
+#define ERREXITS(cinfo,code,str)  \
+  ((cinfo)->err->msg_code = (code), \
+   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
+   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
+
+#define MAKESTMT(stuff)		do { stuff } while (0)
+
+/* Nonfatal errors (we can keep going, but the data is probably corrupt) */
+#define WARNMS(cinfo,code)  \
+  ((cinfo)->err->msg_code = (code), \
+   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
+#define WARNMS1(cinfo,code,p1)  \
+  ((cinfo)->err->msg_code = (code), \
+   (cinfo)->err->msg_parm.i[0] = (p1), \
+   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
+#define WARNMS2(cinfo,code,p1,p2)  \
+  ((cinfo)->err->msg_code = (code), \
+   (cinfo)->err->msg_parm.i[0] = (p1), \
+   (cinfo)->err->msg_parm.i[1] = (p2), \
+   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
+
+/* Informational/debugging messages */
+#define TRACEMS(cinfo,lvl,code)  \
+  ((cinfo)->err->msg_code = (code), \
+   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
+#define TRACEMS1(cinfo,lvl,code,p1)  \
+  ((cinfo)->err->msg_code = (code), \
+   (cinfo)->err->msg_parm.i[0] = (p1), \
+   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
+#define TRACEMS2(cinfo,lvl,code,p1,p2)  \
+  ((cinfo)->err->msg_code = (code), \
+   (cinfo)->err->msg_parm.i[0] = (p1), \
+   (cinfo)->err->msg_parm.i[1] = (p2), \
+   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
+#define TRACEMS3(cinfo,lvl,code,p1,p2,p3)  \
+  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
+	   _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
+	   (cinfo)->err->msg_code = (code); \
+	   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
+#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4)  \
+  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
+	   _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
+	   (cinfo)->err->msg_code = (code); \
+	   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
+#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5)  \
+  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
+	   _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
+	   _mp[4] = (p5); \
+	   (cinfo)->err->msg_code = (code); \
+	   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
+#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8)  \
+  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
+	   _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
+	   _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
+	   (cinfo)->err->msg_code = (code); \
+	   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
+#define TRACEMSS(cinfo,lvl,code,str)  \
+  ((cinfo)->err->msg_code = (code), \
+   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
+   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
+
+#endif /* JERROR_H */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctflt.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctflt.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctflt.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,168 @@
+/*
+ * jfdctflt.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a floating-point implementation of the
+ * forward DCT (Discrete Cosine Transform).
+ *
+ * This implementation should be more accurate than either of the integer
+ * DCT implementations.  However, it may not give the same results on all
+ * machines because of differences in roundoff behavior.  Speed will depend
+ * on the hardware's floating point capacity.
+ *
+ * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
+ * on each column.  Direct algorithms are also available, but they are
+ * much more complex and seem not to be any faster when reduced to code.
+ *
+ * This implementation is based on Arai, Agui, and Nakajima's algorithm for
+ * scaled DCT.  Their original paper (Trans. IEICE E-71(11):1095) is in
+ * Japanese, but the algorithm is described in the Pennebaker & Mitchell
+ * JPEG textbook (see REFERENCES section in file README).  The following code
+ * is based directly on figure 4-8 in P&M.
+ * While an 8-point DCT cannot be done in less than 11 multiplies, it is
+ * possible to arrange the computation so that many of the multiplies are
+ * simple scalings of the final outputs.  These multiplies can then be
+ * folded into the multiplications or divisions by the JPEG quantization
+ * table entries.  The AA&N method leaves only 5 multiplies and 29 adds
+ * to be done in the DCT itself.
+ * The primary disadvantage of this method is that with a fixed-point
+ * implementation, accuracy is lost due to imprecise representation of the
+ * scaled quantization values.  However, that problem does not arise if
+ * we use floating point arithmetic.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"		/* Private declarations for DCT subsystem */
+
+#ifdef DCT_FLOAT_SUPPORTED
+
+
+/*
+ * This module is specialized to the case DCTSIZE = 8.
+ */
+
+#if DCTSIZE != 8
+  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+#endif
+
+
+/*
+ * Perform the forward DCT on one block of samples.
+ */
+
+GLOBAL(void)
+jpeg_fdct_float (FAST_FLOAT * data)
+{
+  FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+  FAST_FLOAT tmp10, tmp11, tmp12, tmp13;
+  FAST_FLOAT z1, z2, z3, z4, z5, z11, z13;
+  FAST_FLOAT *dataptr;
+  int ctr;
+
+  /* Pass 1: process rows. */
+
+  dataptr = data;
+  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
+    tmp0 = dataptr[0] + dataptr[7];
+    tmp7 = dataptr[0] - dataptr[7];
+    tmp1 = dataptr[1] + dataptr[6];
+    tmp6 = dataptr[1] - dataptr[6];
+    tmp2 = dataptr[2] + dataptr[5];
+    tmp5 = dataptr[2] - dataptr[5];
+    tmp3 = dataptr[3] + dataptr[4];
+    tmp4 = dataptr[3] - dataptr[4];
+    
+    /* Even part */
+    
+    tmp10 = tmp0 + tmp3;	/* phase 2 */
+    tmp13 = tmp0 - tmp3;
+    tmp11 = tmp1 + tmp2;
+    tmp12 = tmp1 - tmp2;
+    
+    dataptr[0] = tmp10 + tmp11; /* phase 3 */
+    dataptr[4] = tmp10 - tmp11;
+    
+    z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */
+    dataptr[2] = tmp13 + z1;	/* phase 5 */
+    dataptr[6] = tmp13 - z1;
+    
+    /* Odd part */
+
+    tmp10 = tmp4 + tmp5;	/* phase 2 */
+    tmp11 = tmp5 + tmp6;
+    tmp12 = tmp6 + tmp7;
+
+    /* The rotator is modified from fig 4-8 to avoid extra negations. */
+    z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */
+    z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */
+    z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */
+    z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */
+
+    z11 = tmp7 + z3;		/* phase 5 */
+    z13 = tmp7 - z3;
+
+    dataptr[5] = z13 + z2;	/* phase 6 */
+    dataptr[3] = z13 - z2;
+    dataptr[1] = z11 + z4;
+    dataptr[7] = z11 - z4;
+
+    dataptr += DCTSIZE;		/* advance pointer to next row */
+  }
+
+  /* Pass 2: process columns. */
+
+  dataptr = data;
+  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
+    tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
+    tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
+    tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
+    tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
+    tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
+    tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
+    tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
+    tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
+    
+    /* Even part */
+    
+    tmp10 = tmp0 + tmp3;	/* phase 2 */
+    tmp13 = tmp0 - tmp3;
+    tmp11 = tmp1 + tmp2;
+    tmp12 = tmp1 - tmp2;
+    
+    dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
+    dataptr[DCTSIZE*4] = tmp10 - tmp11;
+    
+    z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */
+    dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
+    dataptr[DCTSIZE*6] = tmp13 - z1;
+    
+    /* Odd part */
+
+    tmp10 = tmp4 + tmp5;	/* phase 2 */
+    tmp11 = tmp5 + tmp6;
+    tmp12 = tmp6 + tmp7;
+
+    /* The rotator is modified from fig 4-8 to avoid extra negations. */
+    z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */
+    z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */
+    z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */
+    z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */
+
+    z11 = tmp7 + z3;		/* phase 5 */
+    z13 = tmp7 - z3;
+
+    dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */
+    dataptr[DCTSIZE*3] = z13 - z2;
+    dataptr[DCTSIZE*1] = z11 + z4;
+    dataptr[DCTSIZE*7] = z11 - z4;
+
+    dataptr++;			/* advance pointer to next column */
+  }
+}
+
+#endif /* DCT_FLOAT_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctfst.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctfst.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctfst.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,224 @@
+/*
+ * jfdctfst.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a fast, not so accurate integer implementation of the
+ * forward DCT (Discrete Cosine Transform).
+ *
+ * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
+ * on each column.  Direct algorithms are also available, but they are
+ * much more complex and seem not to be any faster when reduced to code.
+ *
+ * This implementation is based on Arai, Agui, and Nakajima's algorithm for
+ * scaled DCT.  Their original paper (Trans. IEICE E-71(11):1095) is in
+ * Japanese, but the algorithm is described in the Pennebaker & Mitchell
+ * JPEG textbook (see REFERENCES section in file README).  The following code
+ * is based directly on figure 4-8 in P&M.
+ * While an 8-point DCT cannot be done in less than 11 multiplies, it is
+ * possible to arrange the computation so that many of the multiplies are
+ * simple scalings of the final outputs.  These multiplies can then be
+ * folded into the multiplications or divisions by the JPEG quantization
+ * table entries.  The AA&N method leaves only 5 multiplies and 29 adds
+ * to be done in the DCT itself.
+ * The primary disadvantage of this method is that with fixed-point math,
+ * accuracy is lost due to imprecise representation of the scaled
+ * quantization values.  The smaller the quantization table entry, the less
+ * precise the scaled value, so this implementation does worse with high-
+ * quality-setting files than with low-quality ones.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"		/* Private declarations for DCT subsystem */
+
+#ifdef DCT_IFAST_SUPPORTED
+
+
+/*
+ * This module is specialized to the case DCTSIZE = 8.
+ */
+
+#if DCTSIZE != 8
+  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+#endif
+
+
+/* Scaling decisions are generally the same as in the LL&M algorithm;
+ * see jfdctint.c for more details.  However, we choose to descale
+ * (right shift) multiplication products as soon as they are formed,
+ * rather than carrying additional fractional bits into subsequent additions.
+ * This compromises accuracy slightly, but it lets us save a few shifts.
+ * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples)
+ * everywhere except in the multiplications proper; this saves a good deal
+ * of work on 16-bit-int machines.
+ *
+ * Again to save a few shifts, the intermediate results between pass 1 and
+ * pass 2 are not upscaled, but are represented only to integral precision.
+ *
+ * A final compromise is to represent the multiplicative constants to only
+ * 8 fractional bits, rather than 13.  This saves some shifting work on some
+ * machines, and may also reduce the cost of multiplication (since there
+ * are fewer one-bits in the constants).
+ */
+
+#define CONST_BITS  8
+
+
+/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
+ * causing a lot of useless floating-point operations at run time.
+ * To get around this we use the following pre-calculated constants.
+ * If you change CONST_BITS you may want to add appropriate values.
+ * (With a reasonable C compiler, you can just rely on the FIX() macro...)
+ */
+
+#if CONST_BITS == 8
+#define FIX_0_382683433  ((INT32)   98)		/* FIX(0.382683433) */
+#define FIX_0_541196100  ((INT32)  139)		/* FIX(0.541196100) */
+#define FIX_0_707106781  ((INT32)  181)		/* FIX(0.707106781) */
+#define FIX_1_306562965  ((INT32)  334)		/* FIX(1.306562965) */
+#else
+#define FIX_0_382683433  FIX(0.382683433)
+#define FIX_0_541196100  FIX(0.541196100)
+#define FIX_0_707106781  FIX(0.707106781)
+#define FIX_1_306562965  FIX(1.306562965)
+#endif
+
+
+/* We can gain a little more speed, with a further compromise in accuracy,
+ * by omitting the addition in a descaling shift.  This yields an incorrectly
+ * rounded result half the time...
+ */
+
+#ifndef USE_ACCURATE_ROUNDING
+#undef DESCALE
+#define DESCALE(x,n)  RIGHT_SHIFT(x, n)
+#endif
+
+
+/* Multiply a DCTELEM variable by an INT32 constant, and immediately
+ * descale to yield a DCTELEM result.
+ */
+
+#define MULTIPLY(var,const)  ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
+
+
+/*
+ * Perform the forward DCT on one block of samples.
+ */
+
+GLOBAL(void)
+jpeg_fdct_ifast (DCTELEM * data)
+{
+  DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+  DCTELEM tmp10, tmp11, tmp12, tmp13;
+  DCTELEM z1, z2, z3, z4, z5, z11, z13;
+  DCTELEM *dataptr;
+  int ctr;
+  SHIFT_TEMPS
+
+  /* Pass 1: process rows. */
+
+  dataptr = data;
+  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
+    tmp0 = dataptr[0] + dataptr[7];
+    tmp7 = dataptr[0] - dataptr[7];
+    tmp1 = dataptr[1] + dataptr[6];
+    tmp6 = dataptr[1] - dataptr[6];
+    tmp2 = dataptr[2] + dataptr[5];
+    tmp5 = dataptr[2] - dataptr[5];
+    tmp3 = dataptr[3] + dataptr[4];
+    tmp4 = dataptr[3] - dataptr[4];
+    
+    /* Even part */
+    
+    tmp10 = tmp0 + tmp3;	/* phase 2 */
+    tmp13 = tmp0 - tmp3;
+    tmp11 = tmp1 + tmp2;
+    tmp12 = tmp1 - tmp2;
+    
+    dataptr[0] = tmp10 + tmp11; /* phase 3 */
+    dataptr[4] = tmp10 - tmp11;
+    
+    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
+    dataptr[2] = tmp13 + z1;	/* phase 5 */
+    dataptr[6] = tmp13 - z1;
+    
+    /* Odd part */
+
+    tmp10 = tmp4 + tmp5;	/* phase 2 */
+    tmp11 = tmp5 + tmp6;
+    tmp12 = tmp6 + tmp7;
+
+    /* The rotator is modified from fig 4-8 to avoid extra negations. */
+    z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
+    z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
+    z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
+    z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
+
+    z11 = tmp7 + z3;		/* phase 5 */
+    z13 = tmp7 - z3;
+
+    dataptr[5] = z13 + z2;	/* phase 6 */
+    dataptr[3] = z13 - z2;
+    dataptr[1] = z11 + z4;
+    dataptr[7] = z11 - z4;
+
+    dataptr += DCTSIZE;		/* advance pointer to next row */
+  }
+
+  /* Pass 2: process columns. */
+
+  dataptr = data;
+  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
+    tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
+    tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
+    tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
+    tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
+    tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
+    tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
+    tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
+    tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
+    
+    /* Even part */
+    
+    tmp10 = tmp0 + tmp3;	/* phase 2 */
+    tmp13 = tmp0 - tmp3;
+    tmp11 = tmp1 + tmp2;
+    tmp12 = tmp1 - tmp2;
+    
+    dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
+    dataptr[DCTSIZE*4] = tmp10 - tmp11;
+    
+    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
+    dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
+    dataptr[DCTSIZE*6] = tmp13 - z1;
+    
+    /* Odd part */
+
+    tmp10 = tmp4 + tmp5;	/* phase 2 */
+    tmp11 = tmp5 + tmp6;
+    tmp12 = tmp6 + tmp7;
+
+    /* The rotator is modified from fig 4-8 to avoid extra negations. */
+    z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
+    z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
+    z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
+    z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
+
+    z11 = tmp7 + z3;		/* phase 5 */
+    z13 = tmp7 - z3;
+
+    dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */
+    dataptr[DCTSIZE*3] = z13 - z2;
+    dataptr[DCTSIZE*1] = z11 + z4;
+    dataptr[DCTSIZE*7] = z11 - z4;
+
+    dataptr++;			/* advance pointer to next column */
+  }
+}
+
+#endif /* DCT_IFAST_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctint.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctint.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jfdctint.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,283 @@
+/*
+ * jfdctint.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a slow-but-accurate integer implementation of the
+ * forward DCT (Discrete Cosine Transform).
+ *
+ * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
+ * on each column.  Direct algorithms are also available, but they are
+ * much more complex and seem not to be any faster when reduced to code.
+ *
+ * This implementation is based on an algorithm described in
+ *   C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
+ *   Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
+ *   Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
+ * The primary algorithm described there uses 11 multiplies and 29 adds.
+ * We use their alternate method with 12 multiplies and 32 adds.
+ * The advantage of this method is that no data path contains more than one
+ * multiplication; this allows a very simple and accurate implementation in
+ * scaled fixed-point arithmetic, with a minimal number of shifts.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"		/* Private declarations for DCT subsystem */
+
+#ifdef DCT_ISLOW_SUPPORTED
+
+
+/*
+ * This module is specialized to the case DCTSIZE = 8.
+ */
+
+#if DCTSIZE != 8
+  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+#endif
+
+
+/*
+ * The poop on this scaling stuff is as follows:
+ *
+ * Each 1-D DCT step produces outputs which are a factor of sqrt(N)
+ * larger than the true DCT outputs.  The final outputs are therefore
+ * a factor of N larger than desired; since N=8 this can be cured by
+ * a simple right shift at the end of the algorithm.  The advantage of
+ * this arrangement is that we save two multiplications per 1-D DCT,
+ * because the y0 and y4 outputs need not be divided by sqrt(N).
+ * In the IJG code, this factor of 8 is removed by the quantization step
+ * (in jcdctmgr.c), NOT in this module.
+ *
+ * We have to do addition and subtraction of the integer inputs, which
+ * is no problem, and multiplication by fractional constants, which is
+ * a problem to do in integer arithmetic.  We multiply all the constants
+ * by CONST_SCALE and convert them to integer constants (thus retaining
+ * CONST_BITS bits of precision in the constants).  After doing a
+ * multiplication we have to divide the product by CONST_SCALE, with proper
+ * rounding, to produce the correct output.  This division can be done
+ * cheaply as a right shift of CONST_BITS bits.  We postpone shifting
+ * as long as possible so that partial sums can be added together with
+ * full fractional precision.
+ *
+ * The outputs of the first pass are scaled up by PASS1_BITS bits so that
+ * they are represented to better-than-integral precision.  These outputs
+ * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
+ * with the recommended scaling.  (For 12-bit sample data, the intermediate
+ * array is INT32 anyway.)
+ *
+ * To avoid overflow of the 32-bit intermediate results in pass 2, we must
+ * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26.  Error analysis
+ * shows that the values given below are the most effective.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+#define CONST_BITS  13
+#define PASS1_BITS  2
+#else
+#define CONST_BITS  13
+#define PASS1_BITS  1		/* lose a little precision to avoid overflow */
+#endif
+
+/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
+ * causing a lot of useless floating-point operations at run time.
+ * To get around this we use the following pre-calculated constants.
+ * If you change CONST_BITS you may want to add appropriate values.
+ * (With a reasonable C compiler, you can just rely on the FIX() macro...)
+ */
+
+#if CONST_BITS == 13
+#define FIX_0_298631336  ((INT32)  2446)	/* FIX(0.298631336) */
+#define FIX_0_390180644  ((INT32)  3196)	/* FIX(0.390180644) */
+#define FIX_0_541196100  ((INT32)  4433)	/* FIX(0.541196100) */
+#define FIX_0_765366865  ((INT32)  6270)	/* FIX(0.765366865) */
+#define FIX_0_899976223  ((INT32)  7373)	/* FIX(0.899976223) */
+#define FIX_1_175875602  ((INT32)  9633)	/* FIX(1.175875602) */
+#define FIX_1_501321110  ((INT32)  12299)	/* FIX(1.501321110) */
+#define FIX_1_847759065  ((INT32)  15137)	/* FIX(1.847759065) */
+#define FIX_1_961570560  ((INT32)  16069)	/* FIX(1.961570560) */
+#define FIX_2_053119869  ((INT32)  16819)	/* FIX(2.053119869) */
+#define FIX_2_562915447  ((INT32)  20995)	/* FIX(2.562915447) */
+#define FIX_3_072711026  ((INT32)  25172)	/* FIX(3.072711026) */
+#else
+#define FIX_0_298631336  FIX(0.298631336)
+#define FIX_0_390180644  FIX(0.390180644)
+#define FIX_0_541196100  FIX(0.541196100)
+#define FIX_0_765366865  FIX(0.765366865)
+#define FIX_0_899976223  FIX(0.899976223)
+#define FIX_1_175875602  FIX(1.175875602)
+#define FIX_1_501321110  FIX(1.501321110)
+#define FIX_1_847759065  FIX(1.847759065)
+#define FIX_1_961570560  FIX(1.961570560)
+#define FIX_2_053119869  FIX(2.053119869)
+#define FIX_2_562915447  FIX(2.562915447)
+#define FIX_3_072711026  FIX(3.072711026)
+#endif
+
+
+/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
+ * For 8-bit samples with the recommended scaling, all the variable
+ * and constant values involved are no more than 16 bits wide, so a
+ * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
+ * For 12-bit samples, a full 32-bit multiplication will be needed.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+#define MULTIPLY(var,const)  MULTIPLY16C16(var,const)
+#else
+#define MULTIPLY(var,const)  ((var) * (const))
+#endif
+
+
+/*
+ * Perform the forward DCT on one block of samples.
+ */
+
+GLOBAL(void)
+jpeg_fdct_islow (DCTELEM * data)
+{
+  INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+  INT32 tmp10, tmp11, tmp12, tmp13;
+  INT32 z1, z2, z3, z4, z5;
+  DCTELEM *dataptr;
+  int ctr;
+  SHIFT_TEMPS
+
+  /* Pass 1: process rows. */
+  /* Note results are scaled up by sqrt(8) compared to a true DCT; */
+  /* furthermore, we scale the results by 2**PASS1_BITS. */
+
+  dataptr = data;
+  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
+    tmp0 = dataptr[0] + dataptr[7];
+    tmp7 = dataptr[0] - dataptr[7];
+    tmp1 = dataptr[1] + dataptr[6];
+    tmp6 = dataptr[1] - dataptr[6];
+    tmp2 = dataptr[2] + dataptr[5];
+    tmp5 = dataptr[2] - dataptr[5];
+    tmp3 = dataptr[3] + dataptr[4];
+    tmp4 = dataptr[3] - dataptr[4];
+    
+    /* Even part per LL&M figure 1 --- note that published figure is faulty;
+     * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
+     */
+    
+    tmp10 = tmp0 + tmp3;
+    tmp13 = tmp0 - tmp3;
+    tmp11 = tmp1 + tmp2;
+    tmp12 = tmp1 - tmp2;
+    
+    dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS);
+    dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS);
+    
+    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
+    dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
+				   CONST_BITS-PASS1_BITS);
+    dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
+				   CONST_BITS-PASS1_BITS);
+    
+    /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
+     * cK represents cos(K*pi/16).
+     * i0..i3 in the paper are tmp4..tmp7 here.
+     */
+    
+    z1 = tmp4 + tmp7;
+    z2 = tmp5 + tmp6;
+    z3 = tmp4 + tmp6;
+    z4 = tmp5 + tmp7;
+    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+    
+    tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+    tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+    tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+    tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+    z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+    z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+    z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+    z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+    
+    z3 += z5;
+    z4 += z5;
+    
+    dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
+    dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
+    dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
+    dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
+    
+    dataptr += DCTSIZE;		/* advance pointer to next row */
+  }
+
+  /* Pass 2: process columns.
+   * We remove the PASS1_BITS scaling, but leave the results scaled up
+   * by an overall factor of 8.
+   */
+
+  dataptr = data;
+  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
+    tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
+    tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
+    tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
+    tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
+    tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
+    tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
+    tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
+    tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
+    
+    /* Even part per LL&M figure 1 --- note that published figure is faulty;
+     * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
+     */
+    
+    tmp10 = tmp0 + tmp3;
+    tmp13 = tmp0 - tmp3;
+    tmp11 = tmp1 + tmp2;
+    tmp12 = tmp1 - tmp2;
+    
+    dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
+    dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);
+    
+    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
+    dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
+					   CONST_BITS+PASS1_BITS);
+    dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
+					   CONST_BITS+PASS1_BITS);
+    
+    /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
+     * cK represents cos(K*pi/16).
+     * i0..i3 in the paper are tmp4..tmp7 here.
+     */
+    
+    z1 = tmp4 + tmp7;
+    z2 = tmp5 + tmp6;
+    z3 = tmp4 + tmp6;
+    z4 = tmp5 + tmp7;
+    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+    
+    tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+    tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+    tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+    tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+    z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+    z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+    z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+    z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+    
+    z3 += z5;
+    z4 += z5;
+    
+    dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,
+					   CONST_BITS+PASS1_BITS);
+    dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,
+					   CONST_BITS+PASS1_BITS);
+    dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3,
+					   CONST_BITS+PASS1_BITS);
+    dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,
+					   CONST_BITS+PASS1_BITS);
+    
+    dataptr++;			/* advance pointer to next column */
+  }
+}
+
+#endif /* DCT_ISLOW_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctflt.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctflt.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctflt.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,242 @@
+/*
+ * jidctflt.c
+ *
+ * Copyright (C) 1994-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a floating-point implementation of the
+ * inverse DCT (Discrete Cosine Transform).  In the IJG code, this routine
+ * must also perform dequantization of the input coefficients.
+ *
+ * This implementation should be more accurate than either of the integer
+ * IDCT implementations.  However, it may not give the same results on all
+ * machines because of differences in roundoff behavior.  Speed will depend
+ * on the hardware's floating point capacity.
+ *
+ * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT
+ * on each row (or vice versa, but it's more convenient to emit a row at
+ * a time).  Direct algorithms are also available, but they are much more
+ * complex and seem not to be any faster when reduced to code.
+ *
+ * This implementation is based on Arai, Agui, and Nakajima's algorithm for
+ * scaled DCT.  Their original paper (Trans. IEICE E-71(11):1095) is in
+ * Japanese, but the algorithm is described in the Pennebaker & Mitchell
+ * JPEG textbook (see REFERENCES section in file README).  The following code
+ * is based directly on figure 4-8 in P&M.
+ * While an 8-point DCT cannot be done in less than 11 multiplies, it is
+ * possible to arrange the computation so that many of the multiplies are
+ * simple scalings of the final outputs.  These multiplies can then be
+ * folded into the multiplications or divisions by the JPEG quantization
+ * table entries.  The AA&N method leaves only 5 multiplies and 29 adds
+ * to be done in the DCT itself.
+ * The primary disadvantage of this method is that with a fixed-point
+ * implementation, accuracy is lost due to imprecise representation of the
+ * scaled quantization values.  However, that problem does not arise if
+ * we use floating point arithmetic.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"		/* Private declarations for DCT subsystem */
+
+#ifdef DCT_FLOAT_SUPPORTED
+
+
+/*
+ * This module is specialized to the case DCTSIZE = 8.
+ */
+
+#if DCTSIZE != 8
+  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+#endif
+
+
+/* Dequantize a coefficient by multiplying it by the multiplier-table
+ * entry; produce a float result.
+ */
+
+#define DEQUANTIZE(coef,quantval)  (((FAST_FLOAT) (coef)) * (quantval))
+
+
+/*
+ * Perform dequantization and inverse DCT on one block of coefficients.
+ */
+
+GLOBAL(void)
+jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+		 JCOEFPTR coef_block,
+		 JSAMPARRAY output_buf, JDIMENSION output_col)
+{
+  FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+  FAST_FLOAT tmp10, tmp11, tmp12, tmp13;
+  FAST_FLOAT z5, z10, z11, z12, z13;
+  JCOEFPTR inptr;
+  FLOAT_MULT_TYPE * quantptr;
+  FAST_FLOAT * wsptr;
+  JSAMPROW outptr;
+  JSAMPLE *range_limit = IDCT_range_limit(cinfo);
+  int ctr;
+  FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */
+  SHIFT_TEMPS
+
+  /* Pass 1: process columns from input, store into work array. */
+
+  inptr = coef_block;
+  quantptr = (FLOAT_MULT_TYPE *) compptr->dct_table;
+  wsptr = workspace;
+  for (ctr = DCTSIZE; ctr > 0; ctr--) {
+    /* Due to quantization, we will usually find that many of the input
+     * coefficients are zero, especially the AC terms.  We can exploit this
+     * by short-circuiting the IDCT calculation for any column in which all
+     * the AC terms are zero.  In that case each output is equal to the
+     * DC coefficient (with scale factor as needed).
+     * With typical images and quantization tables, half or more of the
+     * column DCT calculations can be simplified this way.
+     */
+    
+    if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
+	inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
+	inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
+	inptr[DCTSIZE*7] == 0) {
+      /* AC terms all zero */
+      FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+      
+      wsptr[DCTSIZE*0] = dcval;
+      wsptr[DCTSIZE*1] = dcval;
+      wsptr[DCTSIZE*2] = dcval;
+      wsptr[DCTSIZE*3] = dcval;
+      wsptr[DCTSIZE*4] = dcval;
+      wsptr[DCTSIZE*5] = dcval;
+      wsptr[DCTSIZE*6] = dcval;
+      wsptr[DCTSIZE*7] = dcval;
+      
+      inptr++;			/* advance pointers to next column */
+      quantptr++;
+      wsptr++;
+      continue;
+    }
+    
+    /* Even part */
+
+    tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+    tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
+    tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+    tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+
+    tmp10 = tmp0 + tmp2;	/* phase 3 */
+    tmp11 = tmp0 - tmp2;
+
+    tmp13 = tmp1 + tmp3;	/* phases 5-3 */
+    tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */
+
+    tmp0 = tmp10 + tmp13;	/* phase 2 */
+    tmp3 = tmp10 - tmp13;
+    tmp1 = tmp11 + tmp12;
+    tmp2 = tmp11 - tmp12;
+    
+    /* Odd part */
+
+    tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
+    tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
+    tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
+    tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+
+    z13 = tmp6 + tmp5;		/* phase 6 */
+    z10 = tmp6 - tmp5;
+    z11 = tmp4 + tmp7;
+    z12 = tmp4 - tmp7;
+
+    tmp7 = z11 + z13;		/* phase 5 */
+    tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */
+
+    z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
+    tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */
+    tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */
+
+    tmp6 = tmp12 - tmp7;	/* phase 2 */
+    tmp5 = tmp11 - tmp6;
+    tmp4 = tmp10 + tmp5;
+
+    wsptr[DCTSIZE*0] = tmp0 + tmp7;
+    wsptr[DCTSIZE*7] = tmp0 - tmp7;
+    wsptr[DCTSIZE*1] = tmp1 + tmp6;
+    wsptr[DCTSIZE*6] = tmp1 - tmp6;
+    wsptr[DCTSIZE*2] = tmp2 + tmp5;
+    wsptr[DCTSIZE*5] = tmp2 - tmp5;
+    wsptr[DCTSIZE*4] = tmp3 + tmp4;
+    wsptr[DCTSIZE*3] = tmp3 - tmp4;
+
+    inptr++;			/* advance pointers to next column */
+    quantptr++;
+    wsptr++;
+  }
+  
+  /* Pass 2: process rows from work array, store into output array. */
+  /* Note that we must descale the results by a factor of 8 == 2**3. */
+
+  wsptr = workspace;
+  for (ctr = 0; ctr < DCTSIZE; ctr++) {
+    outptr = output_buf[ctr] + output_col;
+    /* Rows of zeroes can be exploited in the same way as we did with columns.
+     * However, the column calculation has created many nonzero AC terms, so
+     * the simplification applies less often (typically 5% to 10% of the time).
+     * And testing floats for zero is relatively expensive, so we don't bother.
+     */
+    
+    /* Even part */
+
+    tmp10 = wsptr[0] + wsptr[4];
+    tmp11 = wsptr[0] - wsptr[4];
+
+    tmp13 = wsptr[2] + wsptr[6];
+    tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13;
+
+    tmp0 = tmp10 + tmp13;
+    tmp3 = tmp10 - tmp13;
+    tmp1 = tmp11 + tmp12;
+    tmp2 = tmp11 - tmp12;
+
+    /* Odd part */
+
+    z13 = wsptr[5] + wsptr[3];
+    z10 = wsptr[5] - wsptr[3];
+    z11 = wsptr[1] + wsptr[7];
+    z12 = wsptr[1] - wsptr[7];
+
+    tmp7 = z11 + z13;
+    tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562);
+
+    z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
+    tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */
+    tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */
+
+    tmp6 = tmp12 - tmp7;
+    tmp5 = tmp11 - tmp6;
+    tmp4 = tmp10 + tmp5;
+
+    /* Final output stage: scale down by a factor of 8 and range-limit */
+
+    outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3)
+			    & RANGE_MASK];
+    outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3)
+			    & RANGE_MASK];
+    outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3)
+			    & RANGE_MASK];
+    outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3)
+			    & RANGE_MASK];
+    outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3)
+			    & RANGE_MASK];
+    outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3)
+			    & RANGE_MASK];
+    outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3)
+			    & RANGE_MASK];
+    outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3)
+			    & RANGE_MASK];
+    
+    wsptr += DCTSIZE;		/* advance pointer to next row */
+  }
+}
+
+#endif /* DCT_FLOAT_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctfst.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctfst.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctfst.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,368 @@
+/*
+ * jidctfst.c
+ *
+ * Copyright (C) 1994-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a fast, not so accurate integer implementation of the
+ * inverse DCT (Discrete Cosine Transform).  In the IJG code, this routine
+ * must also perform dequantization of the input coefficients.
+ *
+ * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT
+ * on each row (or vice versa, but it's more convenient to emit a row at
+ * a time).  Direct algorithms are also available, but they are much more
+ * complex and seem not to be any faster when reduced to code.
+ *
+ * This implementation is based on Arai, Agui, and Nakajima's algorithm for
+ * scaled DCT.  Their original paper (Trans. IEICE E-71(11):1095) is in
+ * Japanese, but the algorithm is described in the Pennebaker & Mitchell
+ * JPEG textbook (see REFERENCES section in file README).  The following code
+ * is based directly on figure 4-8 in P&M.
+ * While an 8-point DCT cannot be done in less than 11 multiplies, it is
+ * possible to arrange the computation so that many of the multiplies are
+ * simple scalings of the final outputs.  These multiplies can then be
+ * folded into the multiplications or divisions by the JPEG quantization
+ * table entries.  The AA&N method leaves only 5 multiplies and 29 adds
+ * to be done in the DCT itself.
+ * The primary disadvantage of this method is that with fixed-point math,
+ * accuracy is lost due to imprecise representation of the scaled
+ * quantization values.  The smaller the quantization table entry, the less
+ * precise the scaled value, so this implementation does worse with high-
+ * quality-setting files than with low-quality ones.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"		/* Private declarations for DCT subsystem */
+
+#ifdef DCT_IFAST_SUPPORTED
+
+
+/*
+ * This module is specialized to the case DCTSIZE = 8.
+ */
+
+#if DCTSIZE != 8
+  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+#endif
+
+
+/* Scaling decisions are generally the same as in the LL&M algorithm;
+ * see jidctint.c for more details.  However, we choose to descale
+ * (right shift) multiplication products as soon as they are formed,
+ * rather than carrying additional fractional bits into subsequent additions.
+ * This compromises accuracy slightly, but it lets us save a few shifts.
+ * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples)
+ * everywhere except in the multiplications proper; this saves a good deal
+ * of work on 16-bit-int machines.
+ *
+ * The dequantized coefficients are not integers because the AA&N scaling
+ * factors have been incorporated.  We represent them scaled up by PASS1_BITS,
+ * so that the first and second IDCT rounds have the same input scaling.
+ * For 8-bit JSAMPLEs, we choose IFAST_SCALE_BITS = PASS1_BITS so as to
+ * avoid a descaling shift; this compromises accuracy rather drastically
+ * for small quantization table entries, but it saves a lot of shifts.
+ * For 12-bit JSAMPLEs, there's no hope of using 16x16 multiplies anyway,
+ * so we use a much larger scaling factor to preserve accuracy.
+ *
+ * A final compromise is to represent the multiplicative constants to only
+ * 8 fractional bits, rather than 13.  This saves some shifting work on some
+ * machines, and may also reduce the cost of multiplication (since there
+ * are fewer one-bits in the constants).
+ */
+
+#if BITS_IN_JSAMPLE == 8
+#define CONST_BITS  8
+#define PASS1_BITS  2
+#else
+#define CONST_BITS  8
+#define PASS1_BITS  1		/* lose a little precision to avoid overflow */
+#endif
+
+/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
+ * causing a lot of useless floating-point operations at run time.
+ * To get around this we use the following pre-calculated constants.
+ * If you change CONST_BITS you may want to add appropriate values.
+ * (With a reasonable C compiler, you can just rely on the FIX() macro...)
+ */
+
+#if CONST_BITS == 8
+#define FIX_1_082392200  ((INT32)  277)		/* FIX(1.082392200) */
+#define FIX_1_414213562  ((INT32)  362)		/* FIX(1.414213562) */
+#define FIX_1_847759065  ((INT32)  473)		/* FIX(1.847759065) */
+#define FIX_2_613125930  ((INT32)  669)		/* FIX(2.613125930) */
+#else
+#define FIX_1_082392200  FIX(1.082392200)
+#define FIX_1_414213562  FIX(1.414213562)
+#define FIX_1_847759065  FIX(1.847759065)
+#define FIX_2_613125930  FIX(2.613125930)
+#endif
+
+
+/* We can gain a little more speed, with a further compromise in accuracy,
+ * by omitting the addition in a descaling shift.  This yields an incorrectly
+ * rounded result half the time...
+ */
+
+#ifndef USE_ACCURATE_ROUNDING
+#undef DESCALE
+#define DESCALE(x,n)  RIGHT_SHIFT(x, n)
+#endif
+
+
+/* Multiply a DCTELEM variable by an INT32 constant, and immediately
+ * descale to yield a DCTELEM result.
+ */
+
+#define MULTIPLY(var,const)  ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
+
+
+/* Dequantize a coefficient by multiplying it by the multiplier-table
+ * entry; produce a DCTELEM result.  For 8-bit data a 16x16->16
+ * multiplication will do.  For 12-bit data, the multiplier table is
+ * declared INT32, so a 32-bit multiply will be used.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+#define DEQUANTIZE(coef,quantval)  (((IFAST_MULT_TYPE) (coef)) * (quantval))
+#else
+#define DEQUANTIZE(coef,quantval)  \
+	DESCALE((coef)*(quantval), IFAST_SCALE_BITS-PASS1_BITS)
+#endif
+
+
+/* Like DESCALE, but applies to a DCTELEM and produces an int.
+ * We assume that int right shift is unsigned if INT32 right shift is.
+ */
+
+#ifdef RIGHT_SHIFT_IS_UNSIGNED
+#define ISHIFT_TEMPS	DCTELEM ishift_temp;
+#if BITS_IN_JSAMPLE == 8
+#define DCTELEMBITS  16		/* DCTELEM may be 16 or 32 bits */
+#else
+#define DCTELEMBITS  32		/* DCTELEM must be 32 bits */
+#endif
+#define IRIGHT_SHIFT(x,shft)  \
+    ((ishift_temp = (x)) < 0 ? \
+     (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \
+     (ishift_temp >> (shft)))
+#else
+#define ISHIFT_TEMPS
+#define IRIGHT_SHIFT(x,shft)	((x) >> (shft))
+#endif
+
+#ifdef USE_ACCURATE_ROUNDING
+#define IDESCALE(x,n)  ((int) IRIGHT_SHIFT((x) + (1 << ((n)-1)), n))
+#else
+#define IDESCALE(x,n)  ((int) IRIGHT_SHIFT(x, n))
+#endif
+
+
+/*
+ * Perform dequantization and inverse DCT on one block of coefficients.
+ */
+
+GLOBAL(void)
+jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+		 JCOEFPTR coef_block,
+		 JSAMPARRAY output_buf, JDIMENSION output_col)
+{
+  DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+  DCTELEM tmp10, tmp11, tmp12, tmp13;
+  DCTELEM z5, z10, z11, z12, z13;
+  JCOEFPTR inptr;
+  IFAST_MULT_TYPE * quantptr;
+  int * wsptr;
+  JSAMPROW outptr;
+  JSAMPLE *range_limit = IDCT_range_limit(cinfo);
+  int ctr;
+  int workspace[DCTSIZE2];	/* buffers data between passes */
+  SHIFT_TEMPS			/* for DESCALE */
+  ISHIFT_TEMPS			/* for IDESCALE */
+
+  /* Pass 1: process columns from input, store into work array. */
+
+  inptr = coef_block;
+  quantptr = (IFAST_MULT_TYPE *) compptr->dct_table;
+  wsptr = workspace;
+  for (ctr = DCTSIZE; ctr > 0; ctr--) {
+    /* Due to quantization, we will usually find that many of the input
+     * coefficients are zero, especially the AC terms.  We can exploit this
+     * by short-circuiting the IDCT calculation for any column in which all
+     * the AC terms are zero.  In that case each output is equal to the
+     * DC coefficient (with scale factor as needed).
+     * With typical images and quantization tables, half or more of the
+     * column DCT calculations can be simplified this way.
+     */
+    
+    if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
+	inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
+	inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
+	inptr[DCTSIZE*7] == 0) {
+      /* AC terms all zero */
+      int dcval = (int) DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+
+      wsptr[DCTSIZE*0] = dcval;
+      wsptr[DCTSIZE*1] = dcval;
+      wsptr[DCTSIZE*2] = dcval;
+      wsptr[DCTSIZE*3] = dcval;
+      wsptr[DCTSIZE*4] = dcval;
+      wsptr[DCTSIZE*5] = dcval;
+      wsptr[DCTSIZE*6] = dcval;
+      wsptr[DCTSIZE*7] = dcval;
+      
+      inptr++;			/* advance pointers to next column */
+      quantptr++;
+      wsptr++;
+      continue;
+    }
+    
+    /* Even part */
+
+    tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+    tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
+    tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+    tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+
+    tmp10 = tmp0 + tmp2;	/* phase 3 */
+    tmp11 = tmp0 - tmp2;
+
+    tmp13 = tmp1 + tmp3;	/* phases 5-3 */
+    tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */
+
+    tmp0 = tmp10 + tmp13;	/* phase 2 */
+    tmp3 = tmp10 - tmp13;
+    tmp1 = tmp11 + tmp12;
+    tmp2 = tmp11 - tmp12;
+    
+    /* Odd part */
+
+    tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
+    tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
+    tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
+    tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+
+    z13 = tmp6 + tmp5;		/* phase 6 */
+    z10 = tmp6 - tmp5;
+    z11 = tmp4 + tmp7;
+    z12 = tmp4 - tmp7;
+
+    tmp7 = z11 + z13;		/* phase 5 */
+    tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
+
+    z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
+    tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
+    tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
+
+    tmp6 = tmp12 - tmp7;	/* phase 2 */
+    tmp5 = tmp11 - tmp6;
+    tmp4 = tmp10 + tmp5;
+
+    wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
+    wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
+    wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6);
+    wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6);
+    wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5);
+    wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5);
+    wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4);
+    wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4);
+
+    inptr++;			/* advance pointers to next column */
+    quantptr++;
+    wsptr++;
+  }
+  
+  /* Pass 2: process rows from work array, store into output array. */
+  /* Note that we must descale the results by a factor of 8 == 2**3, */
+  /* and also undo the PASS1_BITS scaling. */
+
+  wsptr = workspace;
+  for (ctr = 0; ctr < DCTSIZE; ctr++) {
+    outptr = output_buf[ctr] + output_col;
+    /* Rows of zeroes can be exploited in the same way as we did with columns.
+     * However, the column calculation has created many nonzero AC terms, so
+     * the simplification applies less often (typically 5% to 10% of the time).
+     * On machines with very fast multiplication, it's possible that the
+     * test takes more time than it's worth.  In that case this section
+     * may be commented out.
+     */
+    
+#ifndef NO_ZERO_ROW_TEST
+    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
+	wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
+      /* AC terms all zero */
+      JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3)
+				  & RANGE_MASK];
+      
+      outptr[0] = dcval;
+      outptr[1] = dcval;
+      outptr[2] = dcval;
+      outptr[3] = dcval;
+      outptr[4] = dcval;
+      outptr[5] = dcval;
+      outptr[6] = dcval;
+      outptr[7] = dcval;
+
+      wsptr += DCTSIZE;		/* advance pointer to next row */
+      continue;
+    }
+#endif
+    
+    /* Even part */
+
+    tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]);
+    tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]);
+
+    tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]);
+    tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562)
+	    - tmp13;
+
+    tmp0 = tmp10 + tmp13;
+    tmp3 = tmp10 - tmp13;
+    tmp1 = tmp11 + tmp12;
+    tmp2 = tmp11 - tmp12;
+
+    /* Odd part */
+
+    z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3];
+    z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3];
+    z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7];
+    z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7];
+
+    tmp7 = z11 + z13;		/* phase 5 */
+    tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
+
+    z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
+    tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
+    tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
+
+    tmp6 = tmp12 - tmp7;	/* phase 2 */
+    tmp5 = tmp11 - tmp6;
+    tmp4 = tmp10 + tmp5;
+
+    /* Final output stage: scale down by a factor of 8 and range-limit */
+
+    outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3)
+			    & RANGE_MASK];
+
+    wsptr += DCTSIZE;		/* advance pointer to next row */
+  }
+}
+
+#endif /* DCT_IFAST_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctint.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctint.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctint.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,389 @@
+/*
+ * jidctint.c
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a slow-but-accurate integer implementation of the
+ * inverse DCT (Discrete Cosine Transform).  In the IJG code, this routine
+ * must also perform dequantization of the input coefficients.
+ *
+ * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT
+ * on each row (or vice versa, but it's more convenient to emit a row at
+ * a time).  Direct algorithms are also available, but they are much more
+ * complex and seem not to be any faster when reduced to code.
+ *
+ * This implementation is based on an algorithm described in
+ *   C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
+ *   Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
+ *   Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
+ * The primary algorithm described there uses 11 multiplies and 29 adds.
+ * We use their alternate method with 12 multiplies and 32 adds.
+ * The advantage of this method is that no data path contains more than one
+ * multiplication; this allows a very simple and accurate implementation in
+ * scaled fixed-point arithmetic, with a minimal number of shifts.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"		/* Private declarations for DCT subsystem */
+
+#ifdef DCT_ISLOW_SUPPORTED
+
+
+/*
+ * This module is specialized to the case DCTSIZE = 8.
+ */
+
+#if DCTSIZE != 8
+  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+#endif
+
+
+/*
+ * The poop on this scaling stuff is as follows:
+ *
+ * Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
+ * larger than the true IDCT outputs.  The final outputs are therefore
+ * a factor of N larger than desired; since N=8 this can be cured by
+ * a simple right shift at the end of the algorithm.  The advantage of
+ * this arrangement is that we save two multiplications per 1-D IDCT,
+ * because the y0 and y4 inputs need not be divided by sqrt(N).
+ *
+ * We have to do addition and subtraction of the integer inputs, which
+ * is no problem, and multiplication by fractional constants, which is
+ * a problem to do in integer arithmetic.  We multiply all the constants
+ * by CONST_SCALE and convert them to integer constants (thus retaining
+ * CONST_BITS bits of precision in the constants).  After doing a
+ * multiplication we have to divide the product by CONST_SCALE, with proper
+ * rounding, to produce the correct output.  This division can be done
+ * cheaply as a right shift of CONST_BITS bits.  We postpone shifting
+ * as long as possible so that partial sums can be added together with
+ * full fractional precision.
+ *
+ * The outputs of the first pass are scaled up by PASS1_BITS bits so that
+ * they are represented to better-than-integral precision.  These outputs
+ * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
+ * with the recommended scaling.  (To scale up 12-bit sample data further, an
+ * intermediate INT32 array would be needed.)
+ *
+ * To avoid overflow of the 32-bit intermediate results in pass 2, we must
+ * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26.  Error analysis
+ * shows that the values given below are the most effective.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+#define CONST_BITS  13
+#define PASS1_BITS  2
+#else
+#define CONST_BITS  13
+#define PASS1_BITS  1		/* lose a little precision to avoid overflow */
+#endif
+
+/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
+ * causing a lot of useless floating-point operations at run time.
+ * To get around this we use the following pre-calculated constants.
+ * If you change CONST_BITS you may want to add appropriate values.
+ * (With a reasonable C compiler, you can just rely on the FIX() macro...)
+ */
+
+#if CONST_BITS == 13
+#define FIX_0_298631336  ((INT32)  2446)	/* FIX(0.298631336) */
+#define FIX_0_390180644  ((INT32)  3196)	/* FIX(0.390180644) */
+#define FIX_0_541196100  ((INT32)  4433)	/* FIX(0.541196100) */
+#define FIX_0_765366865  ((INT32)  6270)	/* FIX(0.765366865) */
+#define FIX_0_899976223  ((INT32)  7373)	/* FIX(0.899976223) */
+#define FIX_1_175875602  ((INT32)  9633)	/* FIX(1.175875602) */
+#define FIX_1_501321110  ((INT32)  12299)	/* FIX(1.501321110) */
+#define FIX_1_847759065  ((INT32)  15137)	/* FIX(1.847759065) */
+#define FIX_1_961570560  ((INT32)  16069)	/* FIX(1.961570560) */
+#define FIX_2_053119869  ((INT32)  16819)	/* FIX(2.053119869) */
+#define FIX_2_562915447  ((INT32)  20995)	/* FIX(2.562915447) */
+#define FIX_3_072711026  ((INT32)  25172)	/* FIX(3.072711026) */
+#else
+#define FIX_0_298631336  FIX(0.298631336)
+#define FIX_0_390180644  FIX(0.390180644)
+#define FIX_0_541196100  FIX(0.541196100)
+#define FIX_0_765366865  FIX(0.765366865)
+#define FIX_0_899976223  FIX(0.899976223)
+#define FIX_1_175875602  FIX(1.175875602)
+#define FIX_1_501321110  FIX(1.501321110)
+#define FIX_1_847759065  FIX(1.847759065)
+#define FIX_1_961570560  FIX(1.961570560)
+#define FIX_2_053119869  FIX(2.053119869)
+#define FIX_2_562915447  FIX(2.562915447)
+#define FIX_3_072711026  FIX(3.072711026)
+#endif
+
+
+/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
+ * For 8-bit samples with the recommended scaling, all the variable
+ * and constant values involved are no more than 16 bits wide, so a
+ * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
+ * For 12-bit samples, a full 32-bit multiplication will be needed.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+#define MULTIPLY(var,const)  MULTIPLY16C16(var,const)
+#else
+#define MULTIPLY(var,const)  ((var) * (const))
+#endif
+
+
+/* Dequantize a coefficient by multiplying it by the multiplier-table
+ * entry; produce an int result.  In this module, both inputs and result
+ * are 16 bits or less, so either int or short multiply will work.
+ */
+
+#define DEQUANTIZE(coef,quantval)  (((ISLOW_MULT_TYPE) (coef)) * (quantval))
+
+
+/*
+ * Perform dequantization and inverse DCT on one block of coefficients.
+ */
+
+GLOBAL(void)
+jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+		 JCOEFPTR coef_block,
+		 JSAMPARRAY output_buf, JDIMENSION output_col)
+{
+  INT32 tmp0, tmp1, tmp2, tmp3;
+  INT32 tmp10, tmp11, tmp12, tmp13;
+  INT32 z1, z2, z3, z4, z5;
+  JCOEFPTR inptr;
+  ISLOW_MULT_TYPE * quantptr;
+  int * wsptr;
+  JSAMPROW outptr;
+  JSAMPLE *range_limit = IDCT_range_limit(cinfo);
+  int ctr;
+  int workspace[DCTSIZE2];	/* buffers data between passes */
+  SHIFT_TEMPS
+
+  /* Pass 1: process columns from input, store into work array. */
+  /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
+  /* furthermore, we scale the results by 2**PASS1_BITS. */
+
+  inptr = coef_block;
+  quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+  wsptr = workspace;
+  for (ctr = DCTSIZE; ctr > 0; ctr--) {
+    /* Due to quantization, we will usually find that many of the input
+     * coefficients are zero, especially the AC terms.  We can exploit this
+     * by short-circuiting the IDCT calculation for any column in which all
+     * the AC terms are zero.  In that case each output is equal to the
+     * DC coefficient (with scale factor as needed).
+     * With typical images and quantization tables, half or more of the
+     * column DCT calculations can be simplified this way.
+     */
+    
+    if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
+	inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
+	inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
+	inptr[DCTSIZE*7] == 0) {
+      /* AC terms all zero */
+      int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
+      
+      wsptr[DCTSIZE*0] = dcval;
+      wsptr[DCTSIZE*1] = dcval;
+      wsptr[DCTSIZE*2] = dcval;
+      wsptr[DCTSIZE*3] = dcval;
+      wsptr[DCTSIZE*4] = dcval;
+      wsptr[DCTSIZE*5] = dcval;
+      wsptr[DCTSIZE*6] = dcval;
+      wsptr[DCTSIZE*7] = dcval;
+      
+      inptr++;			/* advance pointers to next column */
+      quantptr++;
+      wsptr++;
+      continue;
+    }
+    
+    /* Even part: reverse the even part of the forward DCT. */
+    /* The rotator is sqrt(2)*c(-6). */
+    
+    z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
+    z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+    
+    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
+    tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
+    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
+    
+    z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+    z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+
+    tmp0 = (z2 + z3) << CONST_BITS;
+    tmp1 = (z2 - z3) << CONST_BITS;
+    
+    tmp10 = tmp0 + tmp3;
+    tmp13 = tmp0 - tmp3;
+    tmp11 = tmp1 + tmp2;
+    tmp12 = tmp1 - tmp2;
+    
+    /* Odd part per figure 8; the matrix is unitary and hence its
+     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
+     */
+    
+    tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+    tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
+    tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
+    tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
+    
+    z1 = tmp0 + tmp3;
+    z2 = tmp1 + tmp2;
+    z3 = tmp0 + tmp2;
+    z4 = tmp1 + tmp3;
+    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+    
+    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+    z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+    z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+    z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+    z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+    
+    z3 += z5;
+    z4 += z5;
+    
+    tmp0 += z1 + z3;
+    tmp1 += z2 + z4;
+    tmp2 += z2 + z3;
+    tmp3 += z1 + z4;
+    
+    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
+    
+    wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
+    wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
+    wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
+    wsptr[DCTSIZE*6] = (int) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
+    wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
+    wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
+    wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
+    wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
+    
+    inptr++;			/* advance pointers to next column */
+    quantptr++;
+    wsptr++;
+  }
+  
+  /* Pass 2: process rows from work array, store into output array. */
+  /* Note that we must descale the results by a factor of 8 == 2**3, */
+  /* and also undo the PASS1_BITS scaling. */
+
+  wsptr = workspace;
+  for (ctr = 0; ctr < DCTSIZE; ctr++) {
+    outptr = output_buf[ctr] + output_col;
+    /* Rows of zeroes can be exploited in the same way as we did with columns.
+     * However, the column calculation has created many nonzero AC terms, so
+     * the simplification applies less often (typically 5% to 10% of the time).
+     * On machines with very fast multiplication, it's possible that the
+     * test takes more time than it's worth.  In that case this section
+     * may be commented out.
+     */
+    
+#ifndef NO_ZERO_ROW_TEST
+    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
+	wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
+      /* AC terms all zero */
+      JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
+				  & RANGE_MASK];
+      
+      outptr[0] = dcval;
+      outptr[1] = dcval;
+      outptr[2] = dcval;
+      outptr[3] = dcval;
+      outptr[4] = dcval;
+      outptr[5] = dcval;
+      outptr[6] = dcval;
+      outptr[7] = dcval;
+
+      wsptr += DCTSIZE;		/* advance pointer to next row */
+      continue;
+    }
+#endif
+    
+    /* Even part: reverse the even part of the forward DCT. */
+    /* The rotator is sqrt(2)*c(-6). */
+    
+    z2 = (INT32) wsptr[2];
+    z3 = (INT32) wsptr[6];
+    
+    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
+    tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
+    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
+    
+    tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS;
+    tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS;
+    
+    tmp10 = tmp0 + tmp3;
+    tmp13 = tmp0 - tmp3;
+    tmp11 = tmp1 + tmp2;
+    tmp12 = tmp1 - tmp2;
+    
+    /* Odd part per figure 8; the matrix is unitary and hence its
+     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
+     */
+    
+    tmp0 = (INT32) wsptr[7];
+    tmp1 = (INT32) wsptr[5];
+    tmp2 = (INT32) wsptr[3];
+    tmp3 = (INT32) wsptr[1];
+    
+    z1 = tmp0 + tmp3;
+    z2 = tmp1 + tmp2;
+    z3 = tmp0 + tmp2;
+    z4 = tmp1 + tmp3;
+    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+    
+    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+    z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+    z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+    z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+    z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+    
+    z3 += z5;
+    z4 += z5;
+    
+    tmp0 += z1 + z3;
+    tmp1 += z2 + z4;
+    tmp2 += z2 + z3;
+    tmp3 += z1 + z4;
+    
+    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
+    
+    outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3,
+					  CONST_BITS+PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3,
+					  CONST_BITS+PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2,
+					  CONST_BITS+PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2,
+					  CONST_BITS+PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1,
+					  CONST_BITS+PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1,
+					  CONST_BITS+PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0,
+					  CONST_BITS+PASS1_BITS+3)
+			    & RANGE_MASK];
+    outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0,
+					  CONST_BITS+PASS1_BITS+3)
+			    & RANGE_MASK];
+    
+    wsptr += DCTSIZE;		/* advance pointer to next row */
+  }
+}
+
+#endif /* DCT_ISLOW_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctred.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctred.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jidctred.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,398 @@
+/*
+ * jidctred.c
+ *
+ * Copyright (C) 1994-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains inverse-DCT routines that produce reduced-size output:
+ * either 4x4, 2x2, or 1x1 pixels from an 8x8 DCT block.
+ *
+ * The implementation is based on the Loeffler, Ligtenberg and Moschytz (LL&M)
+ * algorithm used in jidctint.c.  We simply replace each 8-to-8 1-D IDCT step
+ * with an 8-to-4 step that produces the four averages of two adjacent outputs
+ * (or an 8-to-2 step producing two averages of four outputs, for 2x2 output).
+ * These steps were derived by computing the corresponding values at the end
+ * of the normal LL&M code, then simplifying as much as possible.
+ *
+ * 1x1 is trivial: just take the DC coefficient divided by 8.
+ *
+ * See jidctint.c for additional comments.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jdct.h"		/* Private declarations for DCT subsystem */
+
+#ifdef IDCT_SCALING_SUPPORTED
+
+
+/*
+ * This module is specialized to the case DCTSIZE = 8.
+ */
+
+#if DCTSIZE != 8
+  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+#endif
+
+
+/* Scaling is the same as in jidctint.c. */
+
+#if BITS_IN_JSAMPLE == 8
+#define CONST_BITS  13
+#define PASS1_BITS  2
+#else
+#define CONST_BITS  13
+#define PASS1_BITS  1		/* lose a little precision to avoid overflow */
+#endif
+
+/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
+ * causing a lot of useless floating-point operations at run time.
+ * To get around this we use the following pre-calculated constants.
+ * If you change CONST_BITS you may want to add appropriate values.
+ * (With a reasonable C compiler, you can just rely on the FIX() macro...)
+ */
+
+#if CONST_BITS == 13
+#define FIX_0_211164243  ((INT32)  1730)	/* FIX(0.211164243) */
+#define FIX_0_509795579  ((INT32)  4176)	/* FIX(0.509795579) */
+#define FIX_0_601344887  ((INT32)  4926)	/* FIX(0.601344887) */
+#define FIX_0_720959822  ((INT32)  5906)	/* FIX(0.720959822) */
+#define FIX_0_765366865  ((INT32)  6270)	/* FIX(0.765366865) */
+#define FIX_0_850430095  ((INT32)  6967)	/* FIX(0.850430095) */
+#define FIX_0_899976223  ((INT32)  7373)	/* FIX(0.899976223) */
+#define FIX_1_061594337  ((INT32)  8697)	/* FIX(1.061594337) */
+#define FIX_1_272758580  ((INT32)  10426)	/* FIX(1.272758580) */
+#define FIX_1_451774981  ((INT32)  11893)	/* FIX(1.451774981) */
+#define FIX_1_847759065  ((INT32)  15137)	/* FIX(1.847759065) */
+#define FIX_2_172734803  ((INT32)  17799)	/* FIX(2.172734803) */
+#define FIX_2_562915447  ((INT32)  20995)	/* FIX(2.562915447) */
+#define FIX_3_624509785  ((INT32)  29692)	/* FIX(3.624509785) */
+#else
+#define FIX_0_211164243  FIX(0.211164243)
+#define FIX_0_509795579  FIX(0.509795579)
+#define FIX_0_601344887  FIX(0.601344887)
+#define FIX_0_720959822  FIX(0.720959822)
+#define FIX_0_765366865  FIX(0.765366865)
+#define FIX_0_850430095  FIX(0.850430095)
+#define FIX_0_899976223  FIX(0.899976223)
+#define FIX_1_061594337  FIX(1.061594337)
+#define FIX_1_272758580  FIX(1.272758580)
+#define FIX_1_451774981  FIX(1.451774981)
+#define FIX_1_847759065  FIX(1.847759065)
+#define FIX_2_172734803  FIX(2.172734803)
+#define FIX_2_562915447  FIX(2.562915447)
+#define FIX_3_624509785  FIX(3.624509785)
+#endif
+
+
+/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
+ * For 8-bit samples with the recommended scaling, all the variable
+ * and constant values involved are no more than 16 bits wide, so a
+ * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
+ * For 12-bit samples, a full 32-bit multiplication will be needed.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+#define MULTIPLY(var,const)  MULTIPLY16C16(var,const)
+#else
+#define MULTIPLY(var,const)  ((var) * (const))
+#endif
+
+
+/* Dequantize a coefficient by multiplying it by the multiplier-table
+ * entry; produce an int result.  In this module, both inputs and result
+ * are 16 bits or less, so either int or short multiply will work.
+ */
+
+#define DEQUANTIZE(coef,quantval)  (((ISLOW_MULT_TYPE) (coef)) * (quantval))
+
+
+/*
+ * Perform dequantization and inverse DCT on one block of coefficients,
+ * producing a reduced-size 4x4 output block.
+ */
+
+GLOBAL(void)
+jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	       JCOEFPTR coef_block,
+	       JSAMPARRAY output_buf, JDIMENSION output_col)
+{
+  INT32 tmp0, tmp2, tmp10, tmp12;
+  INT32 z1, z2, z3, z4;
+  JCOEFPTR inptr;
+  ISLOW_MULT_TYPE * quantptr;
+  int * wsptr;
+  JSAMPROW outptr;
+  JSAMPLE *range_limit = IDCT_range_limit(cinfo);
+  int ctr;
+  int workspace[DCTSIZE*4];	/* buffers data between passes */
+  SHIFT_TEMPS
+
+  /* Pass 1: process columns from input, store into work array. */
+
+  inptr = coef_block;
+  quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+  wsptr = workspace;
+  for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
+    /* Don't bother to process column 4, because second pass won't use it */
+    if (ctr == DCTSIZE-4)
+      continue;
+    if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
+	inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 &&
+	inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) {
+      /* AC terms all zero; we need not examine term 4 for 4x4 output */
+      int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
+      
+      wsptr[DCTSIZE*0] = dcval;
+      wsptr[DCTSIZE*1] = dcval;
+      wsptr[DCTSIZE*2] = dcval;
+      wsptr[DCTSIZE*3] = dcval;
+      
+      continue;
+    }
+    
+    /* Even part */
+    
+    tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+    tmp0 <<= (CONST_BITS+1);
+    
+    z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
+    z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+
+    tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865);
+    
+    tmp10 = tmp0 + tmp2;
+    tmp12 = tmp0 - tmp2;
+    
+    /* Odd part */
+    
+    z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+    z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
+    z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
+    z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
+    
+    tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
+	 + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
+	 + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
+	 + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
+    
+    tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
+	 + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
+	 + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
+	 + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
+
+    /* Final output stage */
+    
+    wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1);
+    wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1);
+    wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1);
+    wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1);
+  }
+  
+  /* Pass 2: process 4 rows from work array, store into output array. */
+
+  wsptr = workspace;
+  for (ctr = 0; ctr < 4; ctr++) {
+    outptr = output_buf[ctr] + output_col;
+    /* It's not clear whether a zero row test is worthwhile here ... */
+
+#ifndef NO_ZERO_ROW_TEST
+    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 &&
+	wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
+      /* AC terms all zero */
+      JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
+				  & RANGE_MASK];
+      
+      outptr[0] = dcval;
+      outptr[1] = dcval;
+      outptr[2] = dcval;
+      outptr[3] = dcval;
+      
+      wsptr += DCTSIZE;		/* advance pointer to next row */
+      continue;
+    }
+#endif
+    
+    /* Even part */
+    
+    tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1);
+    
+    tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065)
+	 + MULTIPLY((INT32) wsptr[6], - FIX_0_765366865);
+    
+    tmp10 = tmp0 + tmp2;
+    tmp12 = tmp0 - tmp2;
+    
+    /* Odd part */
+    
+    z1 = (INT32) wsptr[7];
+    z2 = (INT32) wsptr[5];
+    z3 = (INT32) wsptr[3];
+    z4 = (INT32) wsptr[1];
+    
+    tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
+	 + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
+	 + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
+	 + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
+    
+    tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
+	 + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
+	 + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
+	 + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
+
+    /* Final output stage */
+    
+    outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2,
+					  CONST_BITS+PASS1_BITS+3+1)
+			    & RANGE_MASK];
+    outptr[3] = range_limit[(int) DESCALE(tmp10 - tmp2,
+					  CONST_BITS+PASS1_BITS+3+1)
+			    & RANGE_MASK];
+    outptr[1] = range_limit[(int) DESCALE(tmp12 + tmp0,
+					  CONST_BITS+PASS1_BITS+3+1)
+			    & RANGE_MASK];
+    outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0,
+					  CONST_BITS+PASS1_BITS+3+1)
+			    & RANGE_MASK];
+    
+    wsptr += DCTSIZE;		/* advance pointer to next row */
+  }
+}
+
+
+/*
+ * Perform dequantization and inverse DCT on one block of coefficients,
+ * producing a reduced-size 2x2 output block.
+ */
+
+GLOBAL(void)
+jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	       JCOEFPTR coef_block,
+	       JSAMPARRAY output_buf, JDIMENSION output_col)
+{
+  INT32 tmp0, tmp10, z1;
+  JCOEFPTR inptr;
+  ISLOW_MULT_TYPE * quantptr;
+  int * wsptr;
+  JSAMPROW outptr;
+  JSAMPLE *range_limit = IDCT_range_limit(cinfo);
+  int ctr;
+  int workspace[DCTSIZE*2];	/* buffers data between passes */
+  SHIFT_TEMPS
+
+  /* Pass 1: process columns from input, store into work array. */
+
+  inptr = coef_block;
+  quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+  wsptr = workspace;
+  for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
+    /* Don't bother to process columns 2,4,6 */
+    if (ctr == DCTSIZE-2 || ctr == DCTSIZE-4 || ctr == DCTSIZE-6)
+      continue;
+    if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*3] == 0 &&
+	inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) {
+      /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */
+      int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
+      
+      wsptr[DCTSIZE*0] = dcval;
+      wsptr[DCTSIZE*1] = dcval;
+      
+      continue;
+    }
+    
+    /* Even part */
+    
+    z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+    tmp10 = z1 << (CONST_BITS+2);
+    
+    /* Odd part */
+
+    z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+    tmp0 = MULTIPLY(z1, - FIX_0_720959822); /* sqrt(2) * (c7-c5+c3-c1) */
+    z1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
+    tmp0 += MULTIPLY(z1, FIX_0_850430095); /* sqrt(2) * (-c1+c3+c5+c7) */
+    z1 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
+    tmp0 += MULTIPLY(z1, - FIX_1_272758580); /* sqrt(2) * (-c1+c3-c5-c7) */
+    z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
+    tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
+
+    /* Final output stage */
+    
+    wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2);
+    wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2);
+  }
+  
+  /* Pass 2: process 2 rows from work array, store into output array. */
+
+  wsptr = workspace;
+  for (ctr = 0; ctr < 2; ctr++) {
+    outptr = output_buf[ctr] + output_col;
+    /* It's not clear whether a zero row test is worthwhile here ... */
+
+#ifndef NO_ZERO_ROW_TEST
+    if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) {
+      /* AC terms all zero */
+      JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
+				  & RANGE_MASK];
+      
+      outptr[0] = dcval;
+      outptr[1] = dcval;
+      
+      wsptr += DCTSIZE;		/* advance pointer to next row */
+      continue;
+    }
+#endif
+    
+    /* Even part */
+    
+    tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2);
+    
+    /* Odd part */
+
+    tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */
+	 + MULTIPLY((INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */
+	 + MULTIPLY((INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */
+	 + MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
+
+    /* Final output stage */
+    
+    outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0,
+					  CONST_BITS+PASS1_BITS+3+2)
+			    & RANGE_MASK];
+    outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0,
+					  CONST_BITS+PASS1_BITS+3+2)
+			    & RANGE_MASK];
+    
+    wsptr += DCTSIZE;		/* advance pointer to next row */
+  }
+}
+
+
+/*
+ * Perform dequantization and inverse DCT on one block of coefficients,
+ * producing a reduced-size 1x1 output block.
+ */
+
+GLOBAL(void)
+jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+	       JCOEFPTR coef_block,
+	       JSAMPARRAY output_buf, JDIMENSION output_col)
+{
+  int dcval;
+  ISLOW_MULT_TYPE * quantptr;
+  JSAMPLE *range_limit = IDCT_range_limit(cinfo);
+  SHIFT_TEMPS
+
+  /* We hardly need an inverse DCT routine for this: just take the
+   * average pixel value, which is one-eighth of the DC coefficient.
+   */
+  quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+  dcval = DEQUANTIZE(coef_block[0], quantptr[0]);
+  dcval = (int) DESCALE((INT32) dcval, 3);
+
+  output_buf[0][output_col] = range_limit[dcval & RANGE_MASK];
+}
+
+#endif /* IDCT_SCALING_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jinclude.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jinclude.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jinclude.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,91 @@
+/*
+ * jinclude.h
+ *
+ * Copyright (C) 1991-1994, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file exists to provide a single place to fix any problems with
+ * including the wrong system include files.  (Common problems are taken
+ * care of by the standard jconfig symbols, but on really weird systems
+ * you may have to edit this file.)
+ *
+ * NOTE: this file is NOT intended to be included by applications using the
+ * JPEG library.  Most applications need only include jpeglib.h.
+ */
+
+
+/* Include auto-config file to find out which system include files we need. */
+
+#include "jconfig.h"		/* auto configuration options */
+#define JCONFIG_INCLUDED	/* so that jpeglib.h doesn't do it again */
+
+/*
+ * We need the NULL macro and size_t typedef.
+ * On an ANSI-conforming system it is sufficient to include <stddef.h>.
+ * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
+ * pull in <sys/types.h> as well.
+ * Note that the core JPEG library does not require <stdio.h>;
+ * only the default error handler and data source/destination modules do.
+ * But we must pull it in because of the references to FILE in jpeglib.h.
+ * You can remove those references if you want to compile without <stdio.h>.
+ */
+
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef NEED_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <stdio.h>
+
+/*
+ * We need memory copying and zeroing functions, plus strncpy().
+ * ANSI and System V implementations declare these in <string.h>.
+ * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
+ * Some systems may declare memset and memcpy in <memory.h>.
+ *
+ * NOTE: we assume the size parameters to these functions are of type size_t.
+ * Change the casts in these macros if not!
+ */
+
+#ifdef NEED_BSD_STRINGS
+
+#include <strings.h>
+#define MEMZERO(target,size)	bzero((void *)(target), (size_t)(size))
+#define MEMCOPY(dest,src,size)	bcopy((const void *)(src), (void *)(dest), (size_t)(size))
+
+#else /* not BSD, assume ANSI/SysV string lib */
+
+#include <string.h>
+#define MEMZERO(target,size)	memset((void *)(target), 0, (size_t)(size))
+#define MEMCOPY(dest,src,size)	memcpy((void *)(dest), (const void *)(src), (size_t)(size))
+
+#endif
+
+/*
+ * In ANSI C, and indeed any rational implementation, size_t is also the
+ * type returned by sizeof().  However, it seems there are some irrational
+ * implementations out there, in which sizeof() returns an int even though
+ * size_t is defined as long or unsigned long.  To ensure consistent results
+ * we always use this SIZEOF() macro in place of using sizeof() directly.
+ */
+
+#define SIZEOF(object)	((size_t) sizeof(object))
+
+/*
+ * The modules that use fread() and fwrite() always invoke them through
+ * these macros.  On some systems you may need to twiddle the argument casts.
+ * CAUTION: argument order is different from underlying functions!
+ */
+
+#define JFREAD(file,buf,sizeofbuf)  \
+  ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
+#define JFWRITE(file,buf,sizeofbuf)  \
+  ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemansi.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemansi.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemansi.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,167 @@
+/*
+ * jmemansi.c
+ *
+ * Copyright (C) 1992-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file provides a simple generic implementation of the system-
+ * dependent portion of the JPEG memory manager.  This implementation
+ * assumes that you have the ANSI-standard library routine tmpfile().
+ * Also, the problem of determining the amount of memory available
+ * is shoved onto the user.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jmemsys.h"		/* import the system-dependent declarations */
+
+#ifndef HAVE_STDLIB_H		/* <stdlib.h> should declare malloc(),free() */
+extern void * malloc JPP((size_t size));
+extern void free JPP((void *ptr));
+#endif
+
+#ifndef SEEK_SET		/* pre-ANSI systems may not define this; */
+#define SEEK_SET  0		/* if not, assume 0 is correct */
+#endif
+
+
+/*
+ * Memory allocation and freeing are controlled by the regular library
+ * routines malloc() and free().
+ */
+
+GLOBAL(void *)
+jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void *) malloc(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
+{
+  free(object);
+}
+
+
+/*
+ * "Large" objects are treated the same as "small" ones.
+ * NB: although we include FAR keywords in the routine declarations,
+ * this file won't actually work in 80x86 small/medium model; at least,
+ * you probably won't be able to process useful-size images in only 64KB.
+ */
+
+GLOBAL(void FAR *)
+jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void FAR *) malloc(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
+{
+  free(object);
+}
+
+
+/*
+ * This routine computes the total memory space available for allocation.
+ * It's impossible to do this in a portable way; our current solution is
+ * to make the user tell us (with a default value set at compile time).
+ * If you can actually get the available space, it's a good idea to subtract
+ * a slop factor of 5% or so.
+ */
+
+#ifndef DEFAULT_MAX_MEM		/* so can override from makefile */
+#define DEFAULT_MAX_MEM		1000000L /* default: one megabyte */
+#endif
+
+GLOBAL(long)
+jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
+		    long max_bytes_needed, long already_allocated)
+{
+  return cinfo->mem->max_memory_to_use - already_allocated;
+}
+
+
+/*
+ * Backing store (temporary file) management.
+ * Backing store objects are only used when the value returned by
+ * jpeg_mem_available is less than the total space needed.  You can dispense
+ * with these routines if you have plenty of virtual memory; see jmemnobs.c.
+ */
+
+
+METHODDEF(void)
+read_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+		    void FAR * buffer_address,
+		    long file_offset, long byte_count)
+{
+  if (fseek(info->temp_file, file_offset, SEEK_SET))
+    ERREXIT(cinfo, JERR_TFILE_SEEK);
+  if (JFREAD(info->temp_file, buffer_address, byte_count)
+      != (size_t) byte_count)
+    ERREXIT(cinfo, JERR_TFILE_READ);
+}
+
+
+METHODDEF(void)
+write_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+		     void FAR * buffer_address,
+		     long file_offset, long byte_count)
+{
+  if (fseek(info->temp_file, file_offset, SEEK_SET))
+    ERREXIT(cinfo, JERR_TFILE_SEEK);
+  if (JFWRITE(info->temp_file, buffer_address, byte_count)
+      != (size_t) byte_count)
+    ERREXIT(cinfo, JERR_TFILE_WRITE);
+}
+
+
+METHODDEF(void)
+close_backing_store (j_common_ptr cinfo, backing_store_ptr info)
+{
+  fclose(info->temp_file);
+  /* Since this implementation uses tmpfile() to create the file,
+   * no explicit file deletion is needed.
+   */
+}
+
+
+/*
+ * Initial opening of a backing-store object.
+ *
+ * This version uses tmpfile(), which constructs a suitable file name
+ * behind the scenes.  We don't have to use info->temp_name[] at all;
+ * indeed, we can't even find out the actual name of the temp file.
+ */
+
+GLOBAL(void)
+jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+			 long total_bytes_needed)
+{
+  if ((info->temp_file = tmpfile()) == NULL)
+    ERREXITS(cinfo, JERR_TFILE_CREATE, "");
+  info->read_backing_store = read_backing_store;
+  info->write_backing_store = write_backing_store;
+  info->close_backing_store = close_backing_store;
+}
+
+
+/*
+ * These routines take care of any system-dependent initialization and
+ * cleanup required.
+ */
+
+GLOBAL(long)
+jpeg_mem_init (j_common_ptr cinfo)
+{
+  return DEFAULT_MAX_MEM;	/* default for max_memory_to_use */
+}
+
+GLOBAL(void)
+jpeg_mem_term (j_common_ptr cinfo)
+{
+  /* no work */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemdos.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemdos.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemdos.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,638 @@
+/*
+ * jmemdos.c
+ *
+ * Copyright (C) 1992-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file provides an MS-DOS-compatible implementation of the system-
+ * dependent portion of the JPEG memory manager.  Temporary data can be
+ * stored in extended or expanded memory as well as in regular DOS files.
+ *
+ * If you use this file, you must be sure that NEED_FAR_POINTERS is defined
+ * if you compile in a small-data memory model; it should NOT be defined if
+ * you use a large-data memory model.  This file is not recommended if you
+ * are using a flat-memory-space 386 environment such as DJGCC or Watcom C.
+ * Also, this code will NOT work if struct fields are aligned on greater than
+ * 2-byte boundaries.
+ *
+ * Based on code contributed by Ge' Weijers.
+ */
+
+/*
+ * If you have both extended and expanded memory, you may want to change the
+ * order in which they are tried in jopen_backing_store.  On a 286 machine
+ * expanded memory is usually faster, since extended memory access involves
+ * an expensive protected-mode-and-back switch.  On 386 and better, extended
+ * memory is usually faster.  As distributed, the code tries extended memory
+ * first (what? not everyone has a 386? :-).
+ *
+ * You can disable use of extended/expanded memory entirely by altering these
+ * definitions or overriding them from the Makefile (eg, -DEMS_SUPPORTED=0).
+ */
+
+#ifndef XMS_SUPPORTED
+#define XMS_SUPPORTED  1
+#endif
+#ifndef EMS_SUPPORTED
+#define EMS_SUPPORTED  1
+#endif
+
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jmemsys.h"		/* import the system-dependent declarations */
+
+#ifndef HAVE_STDLIB_H		/* <stdlib.h> should declare these */
+extern void * malloc JPP((size_t size));
+extern void free JPP((void *ptr));
+extern char * getenv JPP((const char * name));
+#endif
+
+#ifdef NEED_FAR_POINTERS
+
+#ifdef __TURBOC__
+/* These definitions work for Borland C (Turbo C) */
+#include <alloc.h>		/* need farmalloc(), farfree() */
+#define far_malloc(x)	farmalloc(x)
+#define far_free(x)	farfree(x)
+#else
+/* These definitions work for Microsoft C and compatible compilers */
+#include <malloc.h>		/* need _fmalloc(), _ffree() */
+#define far_malloc(x)	_fmalloc(x)
+#define far_free(x)	_ffree(x)
+#endif
+
+#else /* not NEED_FAR_POINTERS */
+
+#define far_malloc(x)	malloc(x)
+#define far_free(x)	free(x)
+
+#endif /* NEED_FAR_POINTERS */
+
+#ifdef DONT_USE_B_MODE		/* define mode parameters for fopen() */
+#define READ_BINARY	"r"
+#else
+#define READ_BINARY	"rb"
+#endif
+
+#ifndef USE_MSDOS_MEMMGR	/* make sure user got configuration right */
+  You forgot to define USE_MSDOS_MEMMGR in jconfig.h. /* deliberate syntax error */
+#endif
+
+#if MAX_ALLOC_CHUNK >= 65535L	/* make sure jconfig.h got this right */
+  MAX_ALLOC_CHUNK should be less than 64K. /* deliberate syntax error */
+#endif
+
+
+/*
+ * Declarations for assembly-language support routines (see jmemdosa.asm).
+ *
+ * The functions are declared "far" as are all their pointer arguments;
+ * this ensures the assembly source code will work regardless of the
+ * compiler memory model.  We assume "short" is 16 bits, "long" is 32.
+ */
+
+typedef void far * XMSDRIVER;	/* actually a pointer to code */
+typedef struct {		/* registers for calling XMS driver */
+	unsigned short ax, dx, bx;
+	void far * ds_si;
+      } XMScontext;
+typedef struct {		/* registers for calling EMS driver */
+	unsigned short ax, dx, bx;
+	void far * ds_si;
+      } EMScontext;
+
+extern short far jdos_open JPP((short far * handle, char far * filename));
+extern short far jdos_close JPP((short handle));
+extern short far jdos_seek JPP((short handle, long offset));
+extern short far jdos_read JPP((short handle, void far * buffer,
+				unsigned short count));
+extern short far jdos_write JPP((short handle, void far * buffer,
+				 unsigned short count));
+extern void far jxms_getdriver JPP((XMSDRIVER far *));
+extern void far jxms_calldriver JPP((XMSDRIVER, XMScontext far *));
+extern short far jems_available JPP((void));
+extern void far jems_calldriver JPP((EMScontext far *));
+
+
+/*
+ * Selection of a file name for a temporary file.
+ * This is highly system-dependent, and you may want to customize it.
+ */
+
+static int next_file_num;	/* to distinguish among several temp files */
+
+LOCAL(void)
+select_file_name (char * fname)
+{
+  const char * env;
+  char * ptr;
+  FILE * tfile;
+
+  /* Keep generating file names till we find one that's not in use */
+  for (;;) {
+    /* Get temp directory name from environment TMP or TEMP variable;
+     * if none, use "."
+     */
+    if ((env = (const char *) getenv("TMP")) == NULL)
+      if ((env = (const char *) getenv("TEMP")) == NULL)
+	env = ".";
+    if (*env == '\0')		/* null string means "." */
+      env = ".";
+    ptr = fname;		/* copy name to fname */
+    while (*env != '\0')
+      *ptr++ = *env++;
+    if (ptr[-1] != '\\' && ptr[-1] != '/')
+      *ptr++ = '\\';		/* append backslash if not in env variable */
+    /* Append a suitable file name */
+    next_file_num++;		/* advance counter */
+    sprintf(ptr, "JPG%03d.TMP", next_file_num);
+    /* Probe to see if file name is already in use */
+    if ((tfile = fopen(fname, READ_BINARY)) == NULL)
+      break;
+    fclose(tfile);		/* oops, it's there; close tfile & try again */
+  }
+}
+
+
+/*
+ * Near-memory allocation and freeing are controlled by the regular library
+ * routines malloc() and free().
+ */
+
+GLOBAL(void *)
+jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void *) malloc(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
+{
+  free(object);
+}
+
+
+/*
+ * "Large" objects are allocated in far memory, if possible
+ */
+
+GLOBAL(void FAR *)
+jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void FAR *) far_malloc(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
+{
+  far_free(object);
+}
+
+
+/*
+ * This routine computes the total memory space available for allocation.
+ * It's impossible to do this in a portable way; our current solution is
+ * to make the user tell us (with a default value set at compile time).
+ * If you can actually get the available space, it's a good idea to subtract
+ * a slop factor of 5% or so.
+ */
+
+#ifndef DEFAULT_MAX_MEM		/* so can override from makefile */
+#define DEFAULT_MAX_MEM		300000L /* for total usage about 450K */
+#endif
+
+GLOBAL(long)
+jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
+		    long max_bytes_needed, long already_allocated)
+{
+  return cinfo->mem->max_memory_to_use - already_allocated;
+}
+
+
+/*
+ * Backing store (temporary file) management.
+ * Backing store objects are only used when the value returned by
+ * jpeg_mem_available is less than the total space needed.  You can dispense
+ * with these routines if you have plenty of virtual memory; see jmemnobs.c.
+ */
+
+/*
+ * For MS-DOS we support three types of backing storage:
+ *   1. Conventional DOS files.  We access these by direct DOS calls rather
+ *      than via the stdio package.  This provides a bit better performance,
+ *      but the real reason is that the buffers to be read or written are FAR.
+ *      The stdio library for small-data memory models can't cope with that.
+ *   2. Extended memory, accessed per the XMS V2.0 specification.
+ *   3. Expanded memory, accessed per the LIM/EMS 4.0 specification.
+ * You'll need copies of those specs to make sense of the related code.
+ * The specs are available by Internet FTP from the SIMTEL archives 
+ * (oak.oakland.edu and its various mirror sites).  See files
+ * pub/msdos/microsoft/xms20.arc and pub/msdos/info/limems41.zip.
+ */
+
+
+/*
+ * Access methods for a DOS file.
+ */
+
+
+METHODDEF(void)
+read_file_store (j_common_ptr cinfo, backing_store_ptr info,
+		 void FAR * buffer_address,
+		 long file_offset, long byte_count)
+{
+  if (jdos_seek(info->handle.file_handle, file_offset))
+    ERREXIT(cinfo, JERR_TFILE_SEEK);
+  /* Since MAX_ALLOC_CHUNK is less than 64K, byte_count will be too. */
+  if (byte_count > 65535L)	/* safety check */
+    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
+  if (jdos_read(info->handle.file_handle, buffer_address,
+		(unsigned short) byte_count))
+    ERREXIT(cinfo, JERR_TFILE_READ);
+}
+
+
+METHODDEF(void)
+write_file_store (j_common_ptr cinfo, backing_store_ptr info,
+		  void FAR * buffer_address,
+		  long file_offset, long byte_count)
+{
+  if (jdos_seek(info->handle.file_handle, file_offset))
+    ERREXIT(cinfo, JERR_TFILE_SEEK);
+  /* Since MAX_ALLOC_CHUNK is less than 64K, byte_count will be too. */
+  if (byte_count > 65535L)	/* safety check */
+    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
+  if (jdos_write(info->handle.file_handle, buffer_address,
+		 (unsigned short) byte_count))
+    ERREXIT(cinfo, JERR_TFILE_WRITE);
+}
+
+
+METHODDEF(void)
+close_file_store (j_common_ptr cinfo, backing_store_ptr info)
+{
+  jdos_close(info->handle.file_handle);	/* close the file */
+  remove(info->temp_name);	/* delete the file */
+/* If your system doesn't have remove(), try unlink() instead.
+ * remove() is the ANSI-standard name for this function, but
+ * unlink() was more common in pre-ANSI systems.
+ */
+  TRACEMSS(cinfo, 1, JTRC_TFILE_CLOSE, info->temp_name);
+}
+
+
+LOCAL(boolean)
+open_file_store (j_common_ptr cinfo, backing_store_ptr info,
+		 long total_bytes_needed)
+{
+  short handle;
+
+  select_file_name(info->temp_name);
+  if (jdos_open((short far *) & handle, (char far *) info->temp_name)) {
+    /* might as well exit since jpeg_open_backing_store will fail anyway */
+    ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name);
+    return FALSE;
+  }
+  info->handle.file_handle = handle;
+  info->read_backing_store = read_file_store;
+  info->write_backing_store = write_file_store;
+  info->close_backing_store = close_file_store;
+  TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name);
+  return TRUE;			/* succeeded */
+}
+
+
+/*
+ * Access methods for extended memory.
+ */
+
+#if XMS_SUPPORTED
+
+static XMSDRIVER xms_driver;	/* saved address of XMS driver */
+
+typedef union {			/* either long offset or real-mode pointer */
+	long offset;
+	void far * ptr;
+      } XMSPTR;
+
+typedef struct {		/* XMS move specification structure */
+	long length;
+	XMSH src_handle;
+	XMSPTR src;
+	XMSH dst_handle;
+	XMSPTR dst;
+      } XMSspec;
+
+#define ODD(X)	(((X) & 1L) != 0)
+
+
+METHODDEF(void)
+read_xms_store (j_common_ptr cinfo, backing_store_ptr info,
+		void FAR * buffer_address,
+		long file_offset, long byte_count)
+{
+  XMScontext ctx;
+  XMSspec spec;
+  char endbuffer[2];
+
+  /* The XMS driver can't cope with an odd length, so handle the last byte
+   * specially if byte_count is odd.  We don't expect this to be common.
+   */
+
+  spec.length = byte_count & (~ 1L);
+  spec.src_handle = info->handle.xms_handle;
+  spec.src.offset = file_offset;
+  spec.dst_handle = 0;
+  spec.dst.ptr = buffer_address;
+  
+  ctx.ds_si = (void far *) & spec;
+  ctx.ax = 0x0b00;		/* EMB move */
+  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
+  if (ctx.ax != 1)
+    ERREXIT(cinfo, JERR_XMS_READ);
+
+  if (ODD(byte_count)) {
+    read_xms_store(cinfo, info, (void FAR *) endbuffer,
+		   file_offset + byte_count - 1L, 2L);
+    ((char FAR *) buffer_address)[byte_count - 1L] = endbuffer[0];
+  }
+}
+
+
+METHODDEF(void)
+write_xms_store (j_common_ptr cinfo, backing_store_ptr info,
+		 void FAR * buffer_address,
+		 long file_offset, long byte_count)
+{
+  XMScontext ctx;
+  XMSspec spec;
+  char endbuffer[2];
+
+  /* The XMS driver can't cope with an odd length, so handle the last byte
+   * specially if byte_count is odd.  We don't expect this to be common.
+   */
+
+  spec.length = byte_count & (~ 1L);
+  spec.src_handle = 0;
+  spec.src.ptr = buffer_address;
+  spec.dst_handle = info->handle.xms_handle;
+  spec.dst.offset = file_offset;
+
+  ctx.ds_si = (void far *) & spec;
+  ctx.ax = 0x0b00;		/* EMB move */
+  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
+  if (ctx.ax != 1)
+    ERREXIT(cinfo, JERR_XMS_WRITE);
+
+  if (ODD(byte_count)) {
+    read_xms_store(cinfo, info, (void FAR *) endbuffer,
+		   file_offset + byte_count - 1L, 2L);
+    endbuffer[0] = ((char FAR *) buffer_address)[byte_count - 1L];
+    write_xms_store(cinfo, info, (void FAR *) endbuffer,
+		    file_offset + byte_count - 1L, 2L);
+  }
+}
+
+
+METHODDEF(void)
+close_xms_store (j_common_ptr cinfo, backing_store_ptr info)
+{
+  XMScontext ctx;
+
+  ctx.dx = info->handle.xms_handle;
+  ctx.ax = 0x0a00;
+  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
+  TRACEMS1(cinfo, 1, JTRC_XMS_CLOSE, info->handle.xms_handle);
+  /* we ignore any error return from the driver */
+}
+
+
+LOCAL(boolean)
+open_xms_store (j_common_ptr cinfo, backing_store_ptr info,
+		long total_bytes_needed)
+{
+  XMScontext ctx;
+
+  /* Get address of XMS driver */
+  jxms_getdriver((XMSDRIVER far *) & xms_driver);
+  if (xms_driver == NULL)
+    return FALSE;		/* no driver to be had */
+
+  /* Get version number, must be >= 2.00 */
+  ctx.ax = 0x0000;
+  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
+  if (ctx.ax < (unsigned short) 0x0200)
+    return FALSE;
+
+  /* Try to get space (expressed in kilobytes) */
+  ctx.dx = (unsigned short) ((total_bytes_needed + 1023L) >> 10);
+  ctx.ax = 0x0900;
+  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
+  if (ctx.ax != 1)
+    return FALSE;
+
+  /* Succeeded, save the handle and away we go */
+  info->handle.xms_handle = ctx.dx;
+  info->read_backing_store = read_xms_store;
+  info->write_backing_store = write_xms_store;
+  info->close_backing_store = close_xms_store;
+  TRACEMS1(cinfo, 1, JTRC_XMS_OPEN, ctx.dx);
+  return TRUE;			/* succeeded */
+}
+
+#endif /* XMS_SUPPORTED */
+
+
+/*
+ * Access methods for expanded memory.
+ */
+
+#if EMS_SUPPORTED
+
+/* The EMS move specification structure requires word and long fields aligned
+ * at odd byte boundaries.  Some compilers will align struct fields at even
+ * byte boundaries.  While it's usually possible to force byte alignment,
+ * that causes an overall performance penalty and may pose problems in merging
+ * JPEG into a larger application.  Instead we accept some rather dirty code
+ * here.  Note this code would fail if the hardware did not allow odd-byte
+ * word & long accesses, but all 80x86 CPUs do.
+ */
+
+typedef void far * EMSPTR;
+
+typedef union {			/* EMS move specification structure */
+	long length;		/* It's easy to access first 4 bytes */
+	char bytes[18];		/* Misaligned fields in here! */
+      } EMSspec;
+
+/* Macros for accessing misaligned fields */
+#define FIELD_AT(spec,offset,type)  (*((type *) &(spec.bytes[offset])))
+#define SRC_TYPE(spec)		FIELD_AT(spec,4,char)
+#define SRC_HANDLE(spec)	FIELD_AT(spec,5,EMSH)
+#define SRC_OFFSET(spec)	FIELD_AT(spec,7,unsigned short)
+#define SRC_PAGE(spec)		FIELD_AT(spec,9,unsigned short)
+#define SRC_PTR(spec)		FIELD_AT(spec,7,EMSPTR)
+#define DST_TYPE(spec)		FIELD_AT(spec,11,char)
+#define DST_HANDLE(spec)	FIELD_AT(spec,12,EMSH)
+#define DST_OFFSET(spec)	FIELD_AT(spec,14,unsigned short)
+#define DST_PAGE(spec)		FIELD_AT(spec,16,unsigned short)
+#define DST_PTR(spec)		FIELD_AT(spec,14,EMSPTR)
+
+#define EMSPAGESIZE	16384L	/* gospel, see the EMS specs */
+
+#define HIBYTE(W)  (((W) >> 8) & 0xFF)
+#define LOBYTE(W)  ((W) & 0xFF)
+
+
+METHODDEF(void)
+read_ems_store (j_common_ptr cinfo, backing_store_ptr info,
+		void FAR * buffer_address,
+		long file_offset, long byte_count)
+{
+  EMScontext ctx;
+  EMSspec spec;
+
+  spec.length = byte_count;
+  SRC_TYPE(spec) = 1;
+  SRC_HANDLE(spec) = info->handle.ems_handle;
+  SRC_PAGE(spec)   = (unsigned short) (file_offset / EMSPAGESIZE);
+  SRC_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE);
+  DST_TYPE(spec) = 0;
+  DST_HANDLE(spec) = 0;
+  DST_PTR(spec)    = buffer_address;
+  
+  ctx.ds_si = (void far *) & spec;
+  ctx.ax = 0x5700;		/* move memory region */
+  jems_calldriver((EMScontext far *) & ctx);
+  if (HIBYTE(ctx.ax) != 0)
+    ERREXIT(cinfo, JERR_EMS_READ);
+}
+
+
+METHODDEF(void)
+write_ems_store (j_common_ptr cinfo, backing_store_ptr info,
+		 void FAR * buffer_address,
+		 long file_offset, long byte_count)
+{
+  EMScontext ctx;
+  EMSspec spec;
+
+  spec.length = byte_count;
+  SRC_TYPE(spec) = 0;
+  SRC_HANDLE(spec) = 0;
+  SRC_PTR(spec)    = buffer_address;
+  DST_TYPE(spec) = 1;
+  DST_HANDLE(spec) = info->handle.ems_handle;
+  DST_PAGE(spec)   = (unsigned short) (file_offset / EMSPAGESIZE);
+  DST_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE);
+  
+  ctx.ds_si = (void far *) & spec;
+  ctx.ax = 0x5700;		/* move memory region */
+  jems_calldriver((EMScontext far *) & ctx);
+  if (HIBYTE(ctx.ax) != 0)
+    ERREXIT(cinfo, JERR_EMS_WRITE);
+}
+
+
+METHODDEF(void)
+close_ems_store (j_common_ptr cinfo, backing_store_ptr info)
+{
+  EMScontext ctx;
+
+  ctx.ax = 0x4500;
+  ctx.dx = info->handle.ems_handle;
+  jems_calldriver((EMScontext far *) & ctx);
+  TRACEMS1(cinfo, 1, JTRC_EMS_CLOSE, info->handle.ems_handle);
+  /* we ignore any error return from the driver */
+}
+
+
+LOCAL(boolean)
+open_ems_store (j_common_ptr cinfo, backing_store_ptr info,
+		long total_bytes_needed)
+{
+  EMScontext ctx;
+
+  /* Is EMS driver there? */
+  if (! jems_available())
+    return FALSE;
+
+  /* Get status, make sure EMS is OK */
+  ctx.ax = 0x4000;
+  jems_calldriver((EMScontext far *) & ctx);
+  if (HIBYTE(ctx.ax) != 0)
+    return FALSE;
+
+  /* Get version, must be >= 4.0 */
+  ctx.ax = 0x4600;
+  jems_calldriver((EMScontext far *) & ctx);
+  if (HIBYTE(ctx.ax) != 0 || LOBYTE(ctx.ax) < 0x40)
+    return FALSE;
+
+  /* Try to allocate requested space */
+  ctx.ax = 0x4300;
+  ctx.bx = (unsigned short) ((total_bytes_needed + EMSPAGESIZE-1L) / EMSPAGESIZE);
+  jems_calldriver((EMScontext far *) & ctx);
+  if (HIBYTE(ctx.ax) != 0)
+    return FALSE;
+
+  /* Succeeded, save the handle and away we go */
+  info->handle.ems_handle = ctx.dx;
+  info->read_backing_store = read_ems_store;
+  info->write_backing_store = write_ems_store;
+  info->close_backing_store = close_ems_store;
+  TRACEMS1(cinfo, 1, JTRC_EMS_OPEN, ctx.dx);
+  return TRUE;			/* succeeded */
+}
+
+#endif /* EMS_SUPPORTED */
+
+
+/*
+ * Initial opening of a backing-store object.
+ */
+
+GLOBAL(void)
+jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+			 long total_bytes_needed)
+{
+  /* Try extended memory, then expanded memory, then regular file. */
+#if XMS_SUPPORTED
+  if (open_xms_store(cinfo, info, total_bytes_needed))
+    return;
+#endif
+#if EMS_SUPPORTED
+  if (open_ems_store(cinfo, info, total_bytes_needed))
+    return;
+#endif
+  if (open_file_store(cinfo, info, total_bytes_needed))
+    return;
+  ERREXITS(cinfo, JERR_TFILE_CREATE, "");
+}
+
+
+/*
+ * These routines take care of any system-dependent initialization and
+ * cleanup required.
+ */
+
+GLOBAL(long)
+jpeg_mem_init (j_common_ptr cinfo)
+{
+  next_file_num = 0;		/* initialize temp file name generator */
+  return DEFAULT_MAX_MEM;	/* default for max_memory_to_use */
+}
+
+GLOBAL(void)
+jpeg_mem_term (j_common_ptr cinfo)
+{
+  /* Microsoft C, at least in v6.00A, will not successfully reclaim freed
+   * blocks of size > 32Kbytes unless we give it a kick in the rear, like so:
+   */
+#ifdef NEED_FHEAPMIN
+  _fheapmin();
+#endif
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemdosa.asm
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemdosa.asm	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemdosa.asm	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,379 @@
+;
+; jmemdosa.asm
+;
+; Copyright (C) 1992, Thomas G. Lane.
+; This file is part of the Independent JPEG Group's software.
+; For conditions of distribution and use, see the accompanying README file.
+;
+; This file contains low-level interface routines to support the MS-DOS
+; backing store manager (jmemdos.c).  Routines are provided to access disk
+; files through direct DOS calls, and to access XMS and EMS drivers.
+;
+; This file should assemble with Microsoft's MASM or any compatible
+; assembler (including Borland's Turbo Assembler).  If you haven't got
+; a compatible assembler, better fall back to jmemansi.c or jmemname.c.
+;
+; To minimize dependence on the C compiler's register usage conventions,
+; we save and restore all 8086 registers, even though most compilers only
+; require SI,DI,DS to be preserved.  Also, we use only 16-bit-wide return
+; values, which everybody returns in AX.
+;
+; Based on code contributed by Ge' Weijers.
+;
+
+JMEMDOSA_TXT	segment byte public 'CODE'
+
+		assume	cs:JMEMDOSA_TXT
+
+		public	_jdos_open
+		public	_jdos_close
+		public	_jdos_seek
+		public	_jdos_read
+		public	_jdos_write
+		public	_jxms_getdriver
+		public	_jxms_calldriver
+		public	_jems_available
+		public	_jems_calldriver
+
+;
+; short far jdos_open (short far * handle, char far * filename)
+;
+; Create and open a temporary file
+;
+_jdos_open	proc	far
+		push	bp			; linkage
+		mov 	bp,sp
+		push	si			; save all registers for safety
+		push	di
+		push	bx
+		push	cx
+		push	dx
+		push	es
+		push	ds
+		mov	cx,0			; normal file attributes
+		lds	dx,dword ptr [bp+10]	; get filename pointer
+		mov	ah,3ch			; create file
+		int	21h
+		jc	open_err		; if failed, return error code
+		lds	bx,dword ptr [bp+6]	; get handle pointer
+		mov	word ptr [bx],ax	; save the handle
+		xor	ax,ax			; return zero for OK
+open_err:	pop	ds			; restore registers and exit
+		pop	es
+		pop	dx
+		pop	cx
+		pop	bx
+		pop	di
+		pop	si
+		pop 	bp
+		ret
+_jdos_open	endp
+
+
+;
+; short far jdos_close (short handle)
+;
+; Close the file handle
+;
+_jdos_close	proc	far
+		push	bp			; linkage
+		mov 	bp,sp
+		push	si			; save all registers for safety
+		push	di
+		push	bx
+		push	cx
+		push	dx
+		push	es
+		push	ds
+		mov	bx,word ptr [bp+6]	; file handle
+		mov	ah,3eh			; close file
+		int	21h
+		jc	close_err		; if failed, return error code
+		xor	ax,ax			; return zero for OK
+close_err:	pop	ds			; restore registers and exit
+		pop	es
+		pop	dx
+		pop	cx
+		pop	bx
+		pop	di
+		pop	si
+		pop 	bp
+		ret
+_jdos_close	endp
+
+
+;
+; short far jdos_seek (short handle, long offset)
+;
+; Set file position
+;
+_jdos_seek	proc	far
+		push	bp			; linkage
+		mov 	bp,sp
+		push	si			; save all registers for safety
+		push	di
+		push	bx
+		push	cx
+		push	dx
+		push	es
+		push	ds
+		mov	bx,word ptr [bp+6]	; file handle
+		mov	dx,word ptr [bp+8]	; LS offset
+		mov	cx,word ptr [bp+10]	; MS offset
+		mov	ax,4200h		; absolute seek
+		int	21h
+		jc	seek_err		; if failed, return error code
+		xor	ax,ax			; return zero for OK
+seek_err:	pop	ds			; restore registers and exit
+		pop	es
+		pop	dx
+		pop	cx
+		pop	bx
+		pop	di
+		pop	si
+		pop 	bp
+		ret
+_jdos_seek	endp
+
+
+;
+; short far jdos_read (short handle, void far * buffer, unsigned short count)
+;
+; Read from file
+;
+_jdos_read	proc	far
+		push	bp			; linkage
+		mov 	bp,sp
+		push	si			; save all registers for safety
+		push	di
+		push	bx
+		push	cx
+		push	dx
+		push	es
+		push	ds
+		mov	bx,word ptr [bp+6]	; file handle
+		lds	dx,dword ptr [bp+8]	; buffer address
+		mov	cx,word ptr [bp+12]	; number of bytes
+		mov	ah,3fh			; read file
+		int	21h
+		jc	read_err		; if failed, return error code
+		cmp	ax,word ptr [bp+12]	; make sure all bytes were read
+		je	read_ok
+		mov	ax,1			; else return 1 for not OK
+		jmp	short read_err
+read_ok:	xor	ax,ax			; return zero for OK
+read_err:	pop	ds			; restore registers and exit
+		pop	es
+		pop	dx
+		pop	cx
+		pop	bx
+		pop	di
+		pop	si
+		pop 	bp
+		ret
+_jdos_read	endp
+
+
+;
+; short far jdos_write (short handle, void far * buffer, unsigned short count)
+;
+; Write to file
+;
+_jdos_write	proc	far
+		push	bp			; linkage
+		mov 	bp,sp
+		push	si			; save all registers for safety
+		push	di
+		push	bx
+		push	cx
+		push	dx
+		push	es
+		push	ds
+		mov	bx,word ptr [bp+6]	; file handle
+		lds	dx,dword ptr [bp+8]	; buffer address
+		mov	cx,word ptr [bp+12]	; number of bytes
+		mov	ah,40h			; write file
+		int	21h
+		jc	write_err		; if failed, return error code
+		cmp	ax,word ptr [bp+12]	; make sure all bytes written
+		je	write_ok
+		mov	ax,1			; else return 1 for not OK
+		jmp	short write_err
+write_ok:	xor	ax,ax			; return zero for OK
+write_err:	pop	ds			; restore registers and exit
+		pop	es
+		pop	dx
+		pop	cx
+		pop	bx
+		pop	di
+		pop	si
+		pop 	bp
+		ret
+_jdos_write	endp
+
+
+;
+; void far jxms_getdriver (XMSDRIVER far *)
+;
+; Get the address of the XMS driver, or NULL if not available
+;
+_jxms_getdriver	proc	far
+		push	bp			; linkage
+		mov 	bp,sp
+		push	si			; save all registers for safety
+		push	di
+		push	bx
+		push	cx
+		push	dx
+		push	es
+		push	ds
+		mov 	ax,4300h		; call multiplex interrupt with
+		int	2fh			; a magic cookie, hex 4300
+		cmp 	al,80h			; AL should contain hex 80
+		je	xmsavail
+		xor 	dx,dx			; no XMS driver available
+		xor 	ax,ax			; return a nil pointer
+		jmp	short xmsavail_done
+xmsavail:	mov 	ax,4310h		; fetch driver address with
+		int	2fh			; another magic cookie
+		mov 	dx,es			; copy address to dx:ax
+		mov 	ax,bx
+xmsavail_done:	les 	bx,dword ptr [bp+6]	; get pointer to return value
+		mov	word ptr es:[bx],ax
+		mov	word ptr es:[bx+2],dx
+		pop	ds			; restore registers and exit
+		pop	es
+		pop	dx
+		pop	cx
+		pop	bx
+		pop	di
+		pop	si
+		pop	bp
+		ret
+_jxms_getdriver	endp
+
+
+;
+; void far jxms_calldriver (XMSDRIVER, XMScontext far *)
+;
+; The XMScontext structure contains values for the AX,DX,BX,SI,DS registers.
+; These are loaded, the XMS call is performed, and the new values of the
+; AX,DX,BX registers are written back to the context structure.
+;
+_jxms_calldriver 	proc	far
+		push	bp			; linkage
+		mov 	bp,sp
+		push	si			; save all registers for safety
+		push	di
+		push	bx
+		push	cx
+		push	dx
+		push	es
+		push	ds
+		les 	bx,dword ptr [bp+10]	; get XMScontext pointer
+		mov 	ax,word ptr es:[bx]	; load registers
+		mov 	dx,word ptr es:[bx+2]
+		mov 	si,word ptr es:[bx+6]
+		mov 	ds,word ptr es:[bx+8]
+		mov 	bx,word ptr es:[bx+4]
+		call	dword ptr [bp+6]	; call the driver
+		mov	cx,bx			; save returned BX for a sec
+		les 	bx,dword ptr [bp+10]	; get XMScontext pointer
+		mov 	word ptr es:[bx],ax	; put back ax,dx,bx
+		mov 	word ptr es:[bx+2],dx
+		mov 	word ptr es:[bx+4],cx
+		pop	ds			; restore registers and exit
+		pop	es
+		pop	dx
+		pop	cx
+		pop	bx
+		pop	di
+		pop	si
+		pop 	bp
+		ret
+_jxms_calldriver 	endp
+
+
+;
+; short far jems_available (void)
+;
+; Have we got an EMS driver? (this comes straight from the EMS 4.0 specs)
+;
+_jems_available	proc	far
+		push	si			; save all registers for safety
+		push	di
+		push	bx
+		push	cx
+		push	dx
+		push	es
+		push	ds
+		mov	ax,3567h		; get interrupt vector 67h
+		int	21h
+		push	cs
+		pop	ds
+		mov	di,000ah		; check offs 10 in returned seg
+		lea	si,ASCII_device_name	; against literal string
+		mov	cx,8
+		cld
+		repe cmpsb
+		jne	no_ems
+		mov	ax,1			; match, it's there
+		jmp	short avail_done
+no_ems:		xor	ax,ax			; it's not there
+avail_done:	pop	ds			; restore registers and exit
+		pop	es
+		pop	dx
+		pop	cx
+		pop	bx
+		pop	di
+		pop	si
+		ret
+
+ASCII_device_name	db	"EMMXXXX0"
+
+_jems_available	endp
+
+
+;
+; void far jems_calldriver (EMScontext far *)
+;
+; The EMScontext structure contains values for the AX,DX,BX,SI,DS registers.
+; These are loaded, the EMS trap is performed, and the new values of the
+; AX,DX,BX registers are written back to the context structure.
+;
+_jems_calldriver	proc far
+		push	bp			; linkage
+		mov 	bp,sp
+		push	si			; save all registers for safety
+		push	di
+		push	bx
+		push	cx
+		push	dx
+		push	es
+		push	ds
+		les 	bx,dword ptr [bp+6]	; get EMScontext pointer
+		mov 	ax,word ptr es:[bx]	; load registers
+		mov 	dx,word ptr es:[bx+2]
+		mov 	si,word ptr es:[bx+6]
+		mov 	ds,word ptr es:[bx+8]
+		mov 	bx,word ptr es:[bx+4]
+		int	67h			; call the EMS driver
+		mov	cx,bx			; save returned BX for a sec
+		les 	bx,dword ptr [bp+6]	; get EMScontext pointer
+		mov 	word ptr es:[bx],ax	; put back ax,dx,bx
+		mov 	word ptr es:[bx+2],dx
+		mov 	word ptr es:[bx+4],cx
+		pop	ds			; restore registers and exit
+		pop	es
+		pop	dx
+		pop	cx
+		pop	bx
+		pop	di
+		pop	si
+		pop 	bp
+		ret
+_jems_calldriver	endp
+
+JMEMDOSA_TXT	ends
+
+		end

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemmac.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemmac.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemmac.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,289 @@
+/*
+ * jmemmac.c
+ *
+ * Copyright (C) 1992-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * jmemmac.c provides an Apple Macintosh implementation of the system-
+ * dependent portion of the JPEG memory manager.
+ *
+ * If you use jmemmac.c, then you must define USE_MAC_MEMMGR in the
+ * JPEG_INTERNALS part of jconfig.h.
+ *
+ * jmemmac.c uses the Macintosh toolbox routines NewPtr and DisposePtr
+ * instead of malloc and free.  It accurately determines the amount of
+ * memory available by using CompactMem.  Notice that if left to its
+ * own devices, this code can chew up all available space in the
+ * application's zone, with the exception of the rather small "slop"
+ * factor computed in jpeg_mem_available().  The application can ensure
+ * that more space is left over by reducing max_memory_to_use.
+ *
+ * Large images are swapped to disk using temporary files and System 7.0+'s
+ * temporary folder functionality.
+ *
+ * Note that jmemmac.c depends on two features of MacOS that were first
+ * introduced in System 7: FindFolder and the FSSpec-based calls.
+ * If your application uses jmemmac.c and is run under System 6 or earlier,
+ * and the jpeg library decides it needs a temporary file, it will abort,
+ * printing error messages about requiring System 7.  (If no temporary files
+ * are created, it will run fine.)
+ *
+ * If you want to use jmemmac.c in an application that might be used with
+ * System 6 or earlier, then you should remove dependencies on FindFolder
+ * and the FSSpec calls.  You will need to replace FindFolder with some
+ * other mechanism for finding a place to put temporary files, and you
+ * should replace the FSSpec calls with their HFS equivalents:
+ *
+ *     FSpDelete     ->  HDelete
+ *     FSpGetFInfo   ->  HGetFInfo
+ *     FSpCreate     ->  HCreate
+ *     FSpOpenDF     ->  HOpen      *** Note: not HOpenDF ***
+ *     FSMakeFSSpec  ->  (fill in spec by hand.)
+ *
+ * (Use HOpen instead of HOpenDF.  HOpen is just a glue-interface to PBHOpen,
+ * which is on all HFS macs.  HOpenDF is a System 7 addition which avoids the
+ * ages-old problem of names starting with a period.)
+ *
+ * Contributed by Sam Bushell (jsam at iagu.on.net) and
+ * Dan Gildor (gyld at in-touch.com).
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jmemsys.h"    /* import the system-dependent declarations */
+
+#ifndef USE_MAC_MEMMGR	/* make sure user got configuration right */
+  You forgot to define USE_MAC_MEMMGR in jconfig.h. /* deliberate syntax error */
+#endif
+
+#include <Memory.h>     /* we use the MacOS memory manager */
+#include <Files.h>      /* we use the MacOS File stuff */
+#include <Folders.h>    /* we use the MacOS HFS stuff */
+#include <Script.h>     /* for smSystemScript */
+#include <Gestalt.h>    /* we use Gestalt to test for specific functionality */
+
+#ifndef TEMP_FILE_NAME		/* can override from jconfig.h or Makefile */
+#define TEMP_FILE_NAME  "JPG%03d.TMP"
+#endif
+
+static int next_file_num;	/* to distinguish among several temp files */
+
+
+/*
+ * Memory allocation and freeing are controlled by the MacOS library
+ * routines NewPtr() and DisposePtr(), which allocate fixed-address
+ * storage.  Unfortunately, the IJG library isn't smart enough to cope
+ * with relocatable storage.
+ */
+
+GLOBAL(void *)
+jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void *) NewPtr(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
+{
+  DisposePtr((Ptr) object);
+}
+
+
+/*
+ * "Large" objects are treated the same as "small" ones.
+ * NB: we include FAR keywords in the routine declarations simply for
+ * consistency with the rest of the IJG code; FAR should expand to empty
+ * on rational architectures like the Mac.
+ */
+
+GLOBAL(void FAR *)
+jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void FAR *) NewPtr(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
+{
+  DisposePtr((Ptr) object);
+}
+
+
+/*
+ * This routine computes the total memory space available for allocation.
+ */
+
+GLOBAL(long)
+jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
+		    long max_bytes_needed, long already_allocated)
+{
+  long limit = cinfo->mem->max_memory_to_use - already_allocated;
+  long slop, mem;
+
+  /* Don't ask for more than what application has told us we may use */
+  if (max_bytes_needed > limit && limit > 0)
+    max_bytes_needed = limit;
+  /* Find whether there's a big enough free block in the heap.
+   * CompactMem tries to create a contiguous block of the requested size,
+   * and then returns the size of the largest free block (which could be
+   * much more or much less than we asked for).
+   * We add some slop to ensure we don't use up all available memory.
+   */
+  slop = max_bytes_needed / 16 + 32768L;
+  mem = CompactMem(max_bytes_needed + slop) - slop;
+  if (mem < 0)
+    mem = 0;			/* sigh, couldn't even get the slop */
+  /* Don't take more than the application says we can have */
+  if (mem > limit && limit > 0)
+    mem = limit;
+  return mem;
+}
+
+
+/*
+ * Backing store (temporary file) management.
+ * Backing store objects are only used when the value returned by
+ * jpeg_mem_available is less than the total space needed.  You can dispense
+ * with these routines if you have plenty of virtual memory; see jmemnobs.c.
+ */
+
+
+METHODDEF(void)
+read_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+		    void FAR * buffer_address,
+		    long file_offset, long byte_count)
+{
+  long bytes = byte_count;
+  long retVal;
+
+  if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr )
+    ERREXIT(cinfo, JERR_TFILE_SEEK);
+
+  retVal = FSRead ( info->temp_file, &bytes,
+		    (unsigned char *) buffer_address );
+  if ( retVal != noErr || bytes != byte_count )
+    ERREXIT(cinfo, JERR_TFILE_READ);
+}
+
+
+METHODDEF(void)
+write_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+		     void FAR * buffer_address,
+		     long file_offset, long byte_count)
+{
+  long bytes = byte_count;
+  long retVal;
+
+  if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr )
+    ERREXIT(cinfo, JERR_TFILE_SEEK);
+
+  retVal = FSWrite ( info->temp_file, &bytes,
+		     (unsigned char *) buffer_address );
+  if ( retVal != noErr || bytes != byte_count )
+    ERREXIT(cinfo, JERR_TFILE_WRITE);
+}
+
+
+METHODDEF(void)
+close_backing_store (j_common_ptr cinfo, backing_store_ptr info)
+{
+  FSClose ( info->temp_file );
+  FSpDelete ( &(info->tempSpec) );
+}
+
+
+/*
+ * Initial opening of a backing-store object.
+ *
+ * This version uses FindFolder to find the Temporary Items folder,
+ * and puts the temporary file in there.
+ */
+
+GLOBAL(void)
+jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+			 long total_bytes_needed)
+{
+  short         tmpRef, vRefNum;
+  long          dirID;
+  FInfo         finderInfo;
+  FSSpec        theSpec;
+  Str255        fName;
+  OSErr         osErr;
+  long          gestaltResponse = 0;
+
+  /* Check that FSSpec calls are available. */
+  osErr = Gestalt( gestaltFSAttr, &gestaltResponse );
+  if ( ( osErr != noErr )
+       || !( gestaltResponse & (1<<gestaltHasFSSpecCalls) ) )
+    ERREXITS(cinfo, JERR_TFILE_CREATE, "- System 7.0 or later required");
+  /* TO DO: add a proper error message to jerror.h. */
+
+  /* Check that FindFolder is available. */
+  osErr = Gestalt( gestaltFindFolderAttr, &gestaltResponse );
+  if ( ( osErr != noErr )
+       || !( gestaltResponse & (1<<gestaltFindFolderPresent) ) )
+    ERREXITS(cinfo, JERR_TFILE_CREATE, "- System 7.0 or later required.");
+  /* TO DO: add a proper error message to jerror.h. */
+
+  osErr = FindFolder ( kOnSystemDisk, kTemporaryFolderType, kCreateFolder,
+                       &vRefNum, &dirID );
+  if ( osErr != noErr )
+    ERREXITS(cinfo, JERR_TFILE_CREATE, "- temporary items folder unavailable");
+  /* TO DO: Try putting the temp files somewhere else. */
+
+  /* Keep generating file names till we find one that's not in use */
+  for (;;) {
+    next_file_num++;		/* advance counter */
+
+    sprintf(info->temp_name, TEMP_FILE_NAME, next_file_num);
+    strcpy ( (Ptr)fName+1, info->temp_name );
+    *fName = strlen (info->temp_name);
+    osErr = FSMakeFSSpec ( vRefNum, dirID, fName, &theSpec );
+
+    if ( (osErr = FSpGetFInfo ( &theSpec, &finderInfo ) ) != noErr )
+      break;
+  }
+
+  osErr = FSpCreate ( &theSpec, '????', '????', smSystemScript );
+  if ( osErr != noErr )
+    ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name);
+
+  osErr = FSpOpenDF ( &theSpec, fsRdWrPerm, &(info->temp_file) );
+  if ( osErr != noErr )
+    ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name);
+
+  info->tempSpec = theSpec;
+
+  info->read_backing_store = read_backing_store;
+  info->write_backing_store = write_backing_store;
+  info->close_backing_store = close_backing_store;
+  TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name);
+}
+
+
+/*
+ * These routines take care of any system-dependent initialization and
+ * cleanup required.
+ */
+
+GLOBAL(long)
+jpeg_mem_init (j_common_ptr cinfo)
+{
+  next_file_num = 0;
+
+  /* max_memory_to_use will be initialized to FreeMem()'s result;
+   * the calling application might later reduce it, for example
+   * to leave room to invoke multiple JPEG objects.
+   * Note that FreeMem returns the total number of free bytes;
+   * it may not be possible to allocate a single block of this size.
+   */
+  return FreeMem();
+}
+
+GLOBAL(void)
+jpeg_mem_term (j_common_ptr cinfo)
+{
+  /* no work */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemmgr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemmgr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemmgr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1118 @@
+/*
+ * jmemmgr.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the JPEG system-independent memory management
+ * routines.  This code is usable across a wide variety of machines; most
+ * of the system dependencies have been isolated in a separate file.
+ * The major functions provided here are:
+ *   * pool-based allocation and freeing of memory;
+ *   * policy decisions about how to divide available memory among the
+ *     virtual arrays;
+ *   * control logic for swapping virtual arrays between main memory and
+ *     backing storage.
+ * The separate system-dependent file provides the actual backing-storage
+ * access code, and it contains the policy decision about how much total
+ * main memory to use.
+ * This file is system-dependent in the sense that some of its functions
+ * are unnecessary in some systems.  For example, if there is enough virtual
+ * memory so that backing storage will never be used, much of the virtual
+ * array control logic could be removed.  (Of course, if you have that much
+ * memory then you shouldn't care about a little bit of unused code...)
+ */
+
+#define JPEG_INTERNALS
+#define AM_MEMORY_MANAGER	/* we define jvirt_Xarray_control structs */
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jmemsys.h"		/* import the system-dependent declarations */
+
+#ifndef NO_GETENV
+#ifndef HAVE_STDLIB_H		/* <stdlib.h> should declare getenv() */
+extern char * getenv JPP((const char * name));
+#endif
+#endif
+
+
+/*
+ * Some important notes:
+ *   The allocation routines provided here must never return NULL.
+ *   They should exit to error_exit if unsuccessful.
+ *
+ *   It's not a good idea to try to merge the sarray and barray routines,
+ *   even though they are textually almost the same, because samples are
+ *   usually stored as bytes while coefficients are shorts or ints.  Thus,
+ *   in machines where byte pointers have a different representation from
+ *   word pointers, the resulting machine code could not be the same.
+ */
+
+
+/*
+ * Many machines require storage alignment: longs must start on 4-byte
+ * boundaries, doubles on 8-byte boundaries, etc.  On such machines, malloc()
+ * always returns pointers that are multiples of the worst-case alignment
+ * requirement, and we had better do so too.
+ * There isn't any really portable way to determine the worst-case alignment
+ * requirement.  This module assumes that the alignment requirement is
+ * multiples of sizeof(ALIGN_TYPE).
+ * By default, we define ALIGN_TYPE as double.  This is necessary on some
+ * workstations (where doubles really do need 8-byte alignment) and will work
+ * fine on nearly everything.  If your machine has lesser alignment needs,
+ * you can save a few bytes by making ALIGN_TYPE smaller.
+ * The only place I know of where this will NOT work is certain Macintosh
+ * 680x0 compilers that define double as a 10-byte IEEE extended float.
+ * Doing 10-byte alignment is counterproductive because longwords won't be
+ * aligned well.  Put "#define ALIGN_TYPE long" in jconfig.h if you have
+ * such a compiler.
+ */
+
+#ifndef ALIGN_TYPE		/* so can override from jconfig.h */
+#define ALIGN_TYPE  double
+#endif
+
+
+/*
+ * We allocate objects from "pools", where each pool is gotten with a single
+ * request to jpeg_get_small() or jpeg_get_large().  There is no per-object
+ * overhead within a pool, except for alignment padding.  Each pool has a
+ * header with a link to the next pool of the same class.
+ * Small and large pool headers are identical except that the latter's
+ * link pointer must be FAR on 80x86 machines.
+ * Notice that the "real" header fields are union'ed with a dummy ALIGN_TYPE
+ * field.  This forces the compiler to make SIZEOF(small_pool_hdr) a multiple
+ * of the alignment requirement of ALIGN_TYPE.
+ */
+
+typedef union small_pool_struct * small_pool_ptr;
+
+typedef union small_pool_struct {
+  struct {
+    small_pool_ptr next;	/* next in list of pools */
+    size_t bytes_used;		/* how many bytes already used within pool */
+    size_t bytes_left;		/* bytes still available in this pool */
+  } hdr;
+  ALIGN_TYPE dummy;		/* included in union to ensure alignment */
+} small_pool_hdr;
+
+typedef union large_pool_struct FAR * large_pool_ptr;
+
+typedef union large_pool_struct {
+  struct {
+    large_pool_ptr next;	/* next in list of pools */
+    size_t bytes_used;		/* how many bytes already used within pool */
+    size_t bytes_left;		/* bytes still available in this pool */
+  } hdr;
+  ALIGN_TYPE dummy;		/* included in union to ensure alignment */
+} large_pool_hdr;
+
+
+/*
+ * Here is the full definition of a memory manager object.
+ */
+
+typedef struct {
+  struct jpeg_memory_mgr pub;	/* public fields */
+
+  /* Each pool identifier (lifetime class) names a linked list of pools. */
+  small_pool_ptr small_list[JPOOL_NUMPOOLS];
+  large_pool_ptr large_list[JPOOL_NUMPOOLS];
+
+  /* Since we only have one lifetime class of virtual arrays, only one
+   * linked list is necessary (for each datatype).  Note that the virtual
+   * array control blocks being linked together are actually stored somewhere
+   * in the small-pool list.
+   */
+  jvirt_sarray_ptr virt_sarray_list;
+  jvirt_barray_ptr virt_barray_list;
+
+  /* This counts total space obtained from jpeg_get_small/large */
+  long total_space_allocated;
+
+  /* alloc_sarray and alloc_barray set this value for use by virtual
+   * array routines.
+   */
+  JDIMENSION last_rowsperchunk;	/* from most recent alloc_sarray/barray */
+} my_memory_mgr;
+
+typedef my_memory_mgr * my_mem_ptr;
+
+
+/*
+ * The control blocks for virtual arrays.
+ * Note that these blocks are allocated in the "small" pool area.
+ * System-dependent info for the associated backing store (if any) is hidden
+ * inside the backing_store_info struct.
+ */
+
+struct jvirt_sarray_control {
+  JSAMPARRAY mem_buffer;	/* => the in-memory buffer */
+  JDIMENSION rows_in_array;	/* total virtual array height */
+  JDIMENSION samplesperrow;	/* width of array (and of memory buffer) */
+  JDIMENSION maxaccess;		/* max rows accessed by access_virt_sarray */
+  JDIMENSION rows_in_mem;	/* height of memory buffer */
+  JDIMENSION rowsperchunk;	/* allocation chunk size in mem_buffer */
+  JDIMENSION cur_start_row;	/* first logical row # in the buffer */
+  JDIMENSION first_undef_row;	/* row # of first uninitialized row */
+  boolean pre_zero;		/* pre-zero mode requested? */
+  boolean dirty;		/* do current buffer contents need written? */
+  boolean b_s_open;		/* is backing-store data valid? */
+  jvirt_sarray_ptr next;	/* link to next virtual sarray control block */
+  backing_store_info b_s_info;	/* System-dependent control info */
+};
+
+struct jvirt_barray_control {
+  JBLOCKARRAY mem_buffer;	/* => the in-memory buffer */
+  JDIMENSION rows_in_array;	/* total virtual array height */
+  JDIMENSION blocksperrow;	/* width of array (and of memory buffer) */
+  JDIMENSION maxaccess;		/* max rows accessed by access_virt_barray */
+  JDIMENSION rows_in_mem;	/* height of memory buffer */
+  JDIMENSION rowsperchunk;	/* allocation chunk size in mem_buffer */
+  JDIMENSION cur_start_row;	/* first logical row # in the buffer */
+  JDIMENSION first_undef_row;	/* row # of first uninitialized row */
+  boolean pre_zero;		/* pre-zero mode requested? */
+  boolean dirty;		/* do current buffer contents need written? */
+  boolean b_s_open;		/* is backing-store data valid? */
+  jvirt_barray_ptr next;	/* link to next virtual barray control block */
+  backing_store_info b_s_info;	/* System-dependent control info */
+};
+
+
+#ifdef MEM_STATS		/* optional extra stuff for statistics */
+
+LOCAL(void)
+print_mem_stats (j_common_ptr cinfo, int pool_id)
+{
+  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+  small_pool_ptr shdr_ptr;
+  large_pool_ptr lhdr_ptr;
+
+  /* Since this is only a debugging stub, we can cheat a little by using
+   * fprintf directly rather than going through the trace message code.
+   * This is helpful because message parm array can't handle longs.
+   */
+  fprintf(stderr, "Freeing pool %d, total space = %ld\n",
+	  pool_id, mem->total_space_allocated);
+
+  for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL;
+       lhdr_ptr = lhdr_ptr->hdr.next) {
+    fprintf(stderr, "  Large chunk used %ld\n",
+	    (long) lhdr_ptr->hdr.bytes_used);
+  }
+
+  for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL;
+       shdr_ptr = shdr_ptr->hdr.next) {
+    fprintf(stderr, "  Small chunk used %ld free %ld\n",
+	    (long) shdr_ptr->hdr.bytes_used,
+	    (long) shdr_ptr->hdr.bytes_left);
+  }
+}
+
+#endif /* MEM_STATS */
+
+
+LOCAL(void)
+out_of_memory (j_common_ptr cinfo, int which)
+/* Report an out-of-memory error and stop execution */
+/* If we compiled MEM_STATS support, report alloc requests before dying */
+{
+#ifdef MEM_STATS
+  cinfo->err->trace_level = 2;	/* force self_destruct to report stats */
+#endif
+  ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, which);
+}
+
+
+/*
+ * Allocation of "small" objects.
+ *
+ * For these, we use pooled storage.  When a new pool must be created,
+ * we try to get enough space for the current request plus a "slop" factor,
+ * where the slop will be the amount of leftover space in the new pool.
+ * The speed vs. space tradeoff is largely determined by the slop values.
+ * A different slop value is provided for each pool class (lifetime),
+ * and we also distinguish the first pool of a class from later ones.
+ * NOTE: the values given work fairly well on both 16- and 32-bit-int
+ * machines, but may be too small if longs are 64 bits or more.
+ */
+
+static const size_t first_pool_slop[JPOOL_NUMPOOLS] = 
+{
+	1600,			/* first PERMANENT pool */
+	16000			/* first IMAGE pool */
+};
+
+static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = 
+{
+	0,			/* additional PERMANENT pools */
+	5000			/* additional IMAGE pools */
+};
+
+#define MIN_SLOP  50		/* greater than 0 to avoid futile looping */
+
+
+METHODDEF(void *)
+alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
+/* Allocate a "small" object */
+{
+  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+  small_pool_ptr hdr_ptr, prev_hdr_ptr;
+  char * data_ptr;
+  size_t odd_bytes, min_request, slop;
+
+  /* Check for unsatisfiable request (do now to ensure no overflow below) */
+  if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(small_pool_hdr)))
+    out_of_memory(cinfo, 1);	/* request exceeds malloc's ability */
+
+  /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */
+  odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE);
+  if (odd_bytes > 0)
+    sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes;
+
+  /* See if space is available in any existing pool */
+  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
+    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);	/* safety check */
+  prev_hdr_ptr = NULL;
+  hdr_ptr = mem->small_list[pool_id];
+  while (hdr_ptr != NULL) {
+    if (hdr_ptr->hdr.bytes_left >= sizeofobject)
+      break;			/* found pool with enough space */
+    prev_hdr_ptr = hdr_ptr;
+    hdr_ptr = hdr_ptr->hdr.next;
+  }
+
+  /* Time to make a new pool? */
+  if (hdr_ptr == NULL) {
+    /* min_request is what we need now, slop is what will be leftover */
+    min_request = sizeofobject + SIZEOF(small_pool_hdr);
+    if (prev_hdr_ptr == NULL)	/* first pool in class? */
+      slop = first_pool_slop[pool_id];
+    else
+      slop = extra_pool_slop[pool_id];
+    /* Don't ask for more than MAX_ALLOC_CHUNK */
+    if (slop > (size_t) (MAX_ALLOC_CHUNK-min_request))
+      slop = (size_t) (MAX_ALLOC_CHUNK-min_request);
+    /* Try to get space, if fail reduce slop and try again */
+    for (;;) {
+      hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop);
+      if (hdr_ptr != NULL)
+	break;
+      slop /= 2;
+      if (slop < MIN_SLOP)	/* give up when it gets real small */
+	out_of_memory(cinfo, 2); /* jpeg_get_small failed */
+    }
+    mem->total_space_allocated += min_request + slop;
+    /* Success, initialize the new pool header and add to end of list */
+    hdr_ptr->hdr.next = NULL;
+    hdr_ptr->hdr.bytes_used = 0;
+    hdr_ptr->hdr.bytes_left = sizeofobject + slop;
+    if (prev_hdr_ptr == NULL)	/* first pool in class? */
+      mem->small_list[pool_id] = hdr_ptr;
+    else
+      prev_hdr_ptr->hdr.next = hdr_ptr;
+  }
+
+  /* OK, allocate the object from the current pool */
+  data_ptr = (char *) (hdr_ptr + 1); /* point to first data byte in pool */
+  data_ptr += hdr_ptr->hdr.bytes_used; /* point to place for object */
+  hdr_ptr->hdr.bytes_used += sizeofobject;
+  hdr_ptr->hdr.bytes_left -= sizeofobject;
+
+  return (void *) data_ptr;
+}
+
+
+/*
+ * Allocation of "large" objects.
+ *
+ * The external semantics of these are the same as "small" objects,
+ * except that FAR pointers are used on 80x86.  However the pool
+ * management heuristics are quite different.  We assume that each
+ * request is large enough that it may as well be passed directly to
+ * jpeg_get_large; the pool management just links everything together
+ * so that we can free it all on demand.
+ * Note: the major use of "large" objects is in JSAMPARRAY and JBLOCKARRAY
+ * structures.  The routines that create these structures (see below)
+ * deliberately bunch rows together to ensure a large request size.
+ */
+
+METHODDEF(void FAR *)
+alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
+/* Allocate a "large" object */
+{
+  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+  large_pool_ptr hdr_ptr;
+  size_t odd_bytes;
+
+  /* Check for unsatisfiable request (do now to ensure no overflow below) */
+  if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)))
+    out_of_memory(cinfo, 3);	/* request exceeds malloc's ability */
+
+  /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */
+  odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE);
+  if (odd_bytes > 0)
+    sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes;
+
+  /* Always make a new pool */
+  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
+    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);	/* safety check */
+
+  hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject +
+					    SIZEOF(large_pool_hdr));
+  if (hdr_ptr == NULL)
+    out_of_memory(cinfo, 4);	/* jpeg_get_large failed */
+  mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr);
+
+  /* Success, initialize the new pool header and add to list */
+  hdr_ptr->hdr.next = mem->large_list[pool_id];
+  /* We maintain space counts in each pool header for statistical purposes,
+   * even though they are not needed for allocation.
+   */
+  hdr_ptr->hdr.bytes_used = sizeofobject;
+  hdr_ptr->hdr.bytes_left = 0;
+  mem->large_list[pool_id] = hdr_ptr;
+
+  return (void FAR *) (hdr_ptr + 1); /* point to first data byte in pool */
+}
+
+
+/*
+ * Creation of 2-D sample arrays.
+ * The pointers are in near heap, the samples themselves in FAR heap.
+ *
+ * To minimize allocation overhead and to allow I/O of large contiguous
+ * blocks, we allocate the sample rows in groups of as many rows as possible
+ * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request.
+ * NB: the virtual array control routines, later in this file, know about
+ * this chunking of rows.  The rowsperchunk value is left in the mem manager
+ * object so that it can be saved away if this sarray is the workspace for
+ * a virtual array.
+ */
+
+METHODDEF(JSAMPARRAY)
+alloc_sarray (j_common_ptr cinfo, int pool_id,
+	      JDIMENSION samplesperrow, JDIMENSION numrows)
+/* Allocate a 2-D sample array */
+{
+  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+  JSAMPARRAY result;
+  JSAMPROW workspace;
+  JDIMENSION rowsperchunk, currow, i;
+  long ltemp;
+
+  /* Calculate max # of rows allowed in one allocation chunk */
+  ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
+	  ((long) samplesperrow * SIZEOF(JSAMPLE));
+  if (ltemp <= 0)
+    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
+  if (ltemp < (long) numrows)
+    rowsperchunk = (JDIMENSION) ltemp;
+  else
+    rowsperchunk = numrows;
+  mem->last_rowsperchunk = rowsperchunk;
+
+  /* Get space for row pointers (small object) */
+  result = (JSAMPARRAY) alloc_small(cinfo, pool_id,
+				    (size_t) (numrows * SIZEOF(JSAMPROW)));
+
+  /* Get the rows themselves (large objects) */
+  currow = 0;
+  while (currow < numrows) {
+    rowsperchunk = MIN(rowsperchunk, numrows - currow);
+    workspace = (JSAMPROW) alloc_large(cinfo, pool_id,
+	(size_t) ((size_t) rowsperchunk * (size_t) samplesperrow
+		  * SIZEOF(JSAMPLE)));
+    for (i = rowsperchunk; i > 0; i--) {
+      result[currow++] = workspace;
+      workspace += samplesperrow;
+    }
+  }
+
+  return result;
+}
+
+
+/*
+ * Creation of 2-D coefficient-block arrays.
+ * This is essentially the same as the code for sample arrays, above.
+ */
+
+METHODDEF(JBLOCKARRAY)
+alloc_barray (j_common_ptr cinfo, int pool_id,
+	      JDIMENSION blocksperrow, JDIMENSION numrows)
+/* Allocate a 2-D coefficient-block array */
+{
+  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+  JBLOCKARRAY result;
+  JBLOCKROW workspace;
+  JDIMENSION rowsperchunk, currow, i;
+  long ltemp;
+
+  /* Calculate max # of rows allowed in one allocation chunk */
+  ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
+	  ((long) blocksperrow * SIZEOF(JBLOCK));
+  if (ltemp <= 0)
+    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
+  if (ltemp < (long) numrows)
+    rowsperchunk = (JDIMENSION) ltemp;
+  else
+    rowsperchunk = numrows;
+  mem->last_rowsperchunk = rowsperchunk;
+
+  /* Get space for row pointers (small object) */
+  result = (JBLOCKARRAY) alloc_small(cinfo, pool_id,
+				     (size_t) (numrows * SIZEOF(JBLOCKROW)));
+
+  /* Get the rows themselves (large objects) */
+  currow = 0;
+  while (currow < numrows) {
+    rowsperchunk = MIN(rowsperchunk, numrows - currow);
+    workspace = (JBLOCKROW) alloc_large(cinfo, pool_id,
+	(size_t) ((size_t) rowsperchunk * (size_t) blocksperrow
+		  * SIZEOF(JBLOCK)));
+    for (i = rowsperchunk; i > 0; i--) {
+      result[currow++] = workspace;
+      workspace += blocksperrow;
+    }
+  }
+
+  return result;
+}
+
+
+/*
+ * About virtual array management:
+ *
+ * The above "normal" array routines are only used to allocate strip buffers
+ * (as wide as the image, but just a few rows high).  Full-image-sized buffers
+ * are handled as "virtual" arrays.  The array is still accessed a strip at a
+ * time, but the memory manager must save the whole array for repeated
+ * accesses.  The intended implementation is that there is a strip buffer in
+ * memory (as high as is possible given the desired memory limit), plus a
+ * backing file that holds the rest of the array.
+ *
+ * The request_virt_array routines are told the total size of the image and
+ * the maximum number of rows that will be accessed at once.  The in-memory
+ * buffer must be at least as large as the maxaccess value.
+ *
+ * The request routines create control blocks but not the in-memory buffers.
+ * That is postponed until realize_virt_arrays is called.  At that time the
+ * total amount of space needed is known (approximately, anyway), so free
+ * memory can be divided up fairly.
+ *
+ * The access_virt_array routines are responsible for making a specific strip
+ * area accessible (after reading or writing the backing file, if necessary).
+ * Note that the access routines are told whether the caller intends to modify
+ * the accessed strip; during a read-only pass this saves having to rewrite
+ * data to disk.  The access routines are also responsible for pre-zeroing
+ * any newly accessed rows, if pre-zeroing was requested.
+ *
+ * In current usage, the access requests are usually for nonoverlapping
+ * strips; that is, successive access start_row numbers differ by exactly
+ * num_rows = maxaccess.  This means we can get good performance with simple
+ * buffer dump/reload logic, by making the in-memory buffer be a multiple
+ * of the access height; then there will never be accesses across bufferload
+ * boundaries.  The code will still work with overlapping access requests,
+ * but it doesn't handle bufferload overlaps very efficiently.
+ */
+
+
+METHODDEF(jvirt_sarray_ptr)
+request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
+		     JDIMENSION samplesperrow, JDIMENSION numrows,
+		     JDIMENSION maxaccess)
+/* Request a virtual 2-D sample array */
+{
+  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+  jvirt_sarray_ptr result;
+
+  /* Only IMAGE-lifetime virtual arrays are currently supported */
+  if (pool_id != JPOOL_IMAGE)
+    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);	/* safety check */
+
+  /* get control block */
+  result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id,
+					  SIZEOF(struct jvirt_sarray_control));
+
+  result->mem_buffer = NULL;	/* marks array not yet realized */
+  result->rows_in_array = numrows;
+  result->samplesperrow = samplesperrow;
+  result->maxaccess = maxaccess;
+  result->pre_zero = pre_zero;
+  result->b_s_open = FALSE;	/* no associated backing-store object */
+  result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
+  mem->virt_sarray_list = result;
+
+  return result;
+}
+
+
+METHODDEF(jvirt_barray_ptr)
+request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
+		     JDIMENSION blocksperrow, JDIMENSION numrows,
+		     JDIMENSION maxaccess)
+/* Request a virtual 2-D coefficient-block array */
+{
+  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+  jvirt_barray_ptr result;
+
+  /* Only IMAGE-lifetime virtual arrays are currently supported */
+  if (pool_id != JPOOL_IMAGE)
+    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);	/* safety check */
+
+  /* get control block */
+  result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id,
+					  SIZEOF(struct jvirt_barray_control));
+
+  result->mem_buffer = NULL;	/* marks array not yet realized */
+  result->rows_in_array = numrows;
+  result->blocksperrow = blocksperrow;
+  result->maxaccess = maxaccess;
+  result->pre_zero = pre_zero;
+  result->b_s_open = FALSE;	/* no associated backing-store object */
+  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
+  mem->virt_barray_list = result;
+
+  return result;
+}
+
+
+METHODDEF(void)
+realize_virt_arrays (j_common_ptr cinfo)
+/* Allocate the in-memory buffers for any unrealized virtual arrays */
+{
+  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+  long space_per_minheight, maximum_space, avail_mem;
+  long minheights, max_minheights;
+  jvirt_sarray_ptr sptr;
+  jvirt_barray_ptr bptr;
+
+  /* Compute the minimum space needed (maxaccess rows in each buffer)
+   * and the maximum space needed (full image height in each buffer).
+   * These may be of use to the system-dependent jpeg_mem_available routine.
+   */
+  space_per_minheight = 0;
+  maximum_space = 0;
+  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
+    if (sptr->mem_buffer == NULL) { /* if not realized yet */
+      space_per_minheight += (long) sptr->maxaccess *
+			     (long) sptr->samplesperrow * SIZEOF(JSAMPLE);
+      maximum_space += (long) sptr->rows_in_array *
+		       (long) sptr->samplesperrow * SIZEOF(JSAMPLE);
+    }
+  }
+  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
+    if (bptr->mem_buffer == NULL) { /* if not realized yet */
+      space_per_minheight += (long) bptr->maxaccess *
+			     (long) bptr->blocksperrow * SIZEOF(JBLOCK);
+      maximum_space += (long) bptr->rows_in_array *
+		       (long) bptr->blocksperrow * SIZEOF(JBLOCK);
+    }
+  }
+
+  if (space_per_minheight <= 0)
+    return;			/* no unrealized arrays, no work */
+
+  /* Determine amount of memory to actually use; this is system-dependent. */
+  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
+				 mem->total_space_allocated);
+
+  /* If the maximum space needed is available, make all the buffers full
+   * height; otherwise parcel it out with the same number of minheights
+   * in each buffer.
+   */
+  if (avail_mem >= maximum_space)
+    max_minheights = 1000000000L;
+  else {
+    max_minheights = avail_mem / space_per_minheight;
+    /* If there doesn't seem to be enough space, try to get the minimum
+     * anyway.  This allows a "stub" implementation of jpeg_mem_available().
+     */
+    if (max_minheights <= 0)
+      max_minheights = 1;
+  }
+
+  /* Allocate the in-memory buffers and initialize backing store as needed. */
+
+  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
+    if (sptr->mem_buffer == NULL) { /* if not realized yet */
+      minheights = ((long) sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
+      if (minheights <= max_minheights) {
+	/* This buffer fits in memory */
+	sptr->rows_in_mem = sptr->rows_in_array;
+      } else {
+	/* It doesn't fit in memory, create backing store. */
+	sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess);
+	jpeg_open_backing_store(cinfo, & sptr->b_s_info,
+				(long) sptr->rows_in_array *
+				(long) sptr->samplesperrow *
+				(long) SIZEOF(JSAMPLE));
+	sptr->b_s_open = TRUE;
+      }
+      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
+				      sptr->samplesperrow, sptr->rows_in_mem);
+      sptr->rowsperchunk = mem->last_rowsperchunk;
+      sptr->cur_start_row = 0;
+      sptr->first_undef_row = 0;
+      sptr->dirty = FALSE;
+    }
+  }
+
+  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
+    if (bptr->mem_buffer == NULL) { /* if not realized yet */
+      minheights = ((long) bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
+      if (minheights <= max_minheights) {
+	/* This buffer fits in memory */
+	bptr->rows_in_mem = bptr->rows_in_array;
+      } else {
+	/* It doesn't fit in memory, create backing store. */
+	bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess);
+	jpeg_open_backing_store(cinfo, & bptr->b_s_info,
+				(long) bptr->rows_in_array *
+				(long) bptr->blocksperrow *
+				(long) SIZEOF(JBLOCK));
+	bptr->b_s_open = TRUE;
+      }
+      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
+				      bptr->blocksperrow, bptr->rows_in_mem);
+      bptr->rowsperchunk = mem->last_rowsperchunk;
+      bptr->cur_start_row = 0;
+      bptr->first_undef_row = 0;
+      bptr->dirty = FALSE;
+    }
+  }
+}
+
+
+LOCAL(void)
+do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
+/* Do backing store read or write of a virtual sample array */
+{
+  long bytesperrow, file_offset, byte_count, rows, thisrow, i;
+
+  bytesperrow = (long) ptr->samplesperrow * SIZEOF(JSAMPLE);
+  file_offset = ptr->cur_start_row * bytesperrow;
+  /* Loop to read or write each allocation chunk in mem_buffer */
+  for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
+    /* One chunk, but check for short chunk at end of buffer */
+    rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);
+    /* Transfer no more than is currently defined */
+    thisrow = (long) ptr->cur_start_row + i;
+    rows = MIN(rows, (long) ptr->first_undef_row - thisrow);
+    /* Transfer no more than fits in file */
+    rows = MIN(rows, (long) ptr->rows_in_array - thisrow);
+    if (rows <= 0)		/* this chunk might be past end of file! */
+      break;
+    byte_count = rows * bytesperrow;
+    if (writing)
+      (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,
+					    (void FAR *) ptr->mem_buffer[i],
+					    file_offset, byte_count);
+    else
+      (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,
+					   (void FAR *) ptr->mem_buffer[i],
+					   file_offset, byte_count);
+    file_offset += byte_count;
+  }
+}
+
+
+LOCAL(void)
+do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
+/* Do backing store read or write of a virtual coefficient-block array */
+{
+  long bytesperrow, file_offset, byte_count, rows, thisrow, i;
+
+  bytesperrow = (long) ptr->blocksperrow * SIZEOF(JBLOCK);
+  file_offset = ptr->cur_start_row * bytesperrow;
+  /* Loop to read or write each allocation chunk in mem_buffer */
+  for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
+    /* One chunk, but check for short chunk at end of buffer */
+    rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);
+    /* Transfer no more than is currently defined */
+    thisrow = (long) ptr->cur_start_row + i;
+    rows = MIN(rows, (long) ptr->first_undef_row - thisrow);
+    /* Transfer no more than fits in file */
+    rows = MIN(rows, (long) ptr->rows_in_array - thisrow);
+    if (rows <= 0)		/* this chunk might be past end of file! */
+      break;
+    byte_count = rows * bytesperrow;
+    if (writing)
+      (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,
+					    (void FAR *) ptr->mem_buffer[i],
+					    file_offset, byte_count);
+    else
+      (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,
+					   (void FAR *) ptr->mem_buffer[i],
+					   file_offset, byte_count);
+    file_offset += byte_count;
+  }
+}
+
+
+METHODDEF(JSAMPARRAY)
+access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
+		    JDIMENSION start_row, JDIMENSION num_rows,
+		    boolean writable)
+/* Access the part of a virtual sample array starting at start_row */
+/* and extending for num_rows rows.  writable is true if  */
+/* caller intends to modify the accessed area. */
+{
+  JDIMENSION end_row = start_row + num_rows;
+  JDIMENSION undef_row;
+
+  /* debugging check */
+  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
+      ptr->mem_buffer == NULL)
+    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
+
+  /* Make the desired part of the virtual array accessible */
+  if (start_row < ptr->cur_start_row ||
+      end_row > ptr->cur_start_row+ptr->rows_in_mem) {
+    if (! ptr->b_s_open)
+      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
+    /* Flush old buffer contents if necessary */
+    if (ptr->dirty) {
+      do_sarray_io(cinfo, ptr, TRUE);
+      ptr->dirty = FALSE;
+    }
+    /* Decide what part of virtual array to access.
+     * Algorithm: if target address > current window, assume forward scan,
+     * load starting at target address.  If target address < current window,
+     * assume backward scan, load so that target area is top of window.
+     * Note that when switching from forward write to forward read, will have
+     * start_row = 0, so the limiting case applies and we load from 0 anyway.
+     */
+    if (start_row > ptr->cur_start_row) {
+      ptr->cur_start_row = start_row;
+    } else {
+      /* use long arithmetic here to avoid overflow & unsigned problems */
+      long ltemp;
+
+      ltemp = (long) end_row - (long) ptr->rows_in_mem;
+      if (ltemp < 0)
+	ltemp = 0;		/* don't fall off front end of file */
+      ptr->cur_start_row = (JDIMENSION) ltemp;
+    }
+    /* Read in the selected part of the array.
+     * During the initial write pass, we will do no actual read
+     * because the selected part is all undefined.
+     */
+    do_sarray_io(cinfo, ptr, FALSE);
+  }
+  /* Ensure the accessed part of the array is defined; prezero if needed.
+   * To improve locality of access, we only prezero the part of the array
+   * that the caller is about to access, not the entire in-memory array.
+   */
+  if (ptr->first_undef_row < end_row) {
+    if (ptr->first_undef_row < start_row) {
+      if (writable)		/* writer skipped over a section of array */
+	ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
+      undef_row = start_row;	/* but reader is allowed to read ahead */
+    } else {
+      undef_row = ptr->first_undef_row;
+    }
+    if (writable)
+      ptr->first_undef_row = end_row;
+    if (ptr->pre_zero) {
+      size_t bytesperrow = (size_t) ptr->samplesperrow * SIZEOF(JSAMPLE);
+      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
+      end_row -= ptr->cur_start_row;
+      while (undef_row < end_row) {
+	jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);
+	undef_row++;
+      }
+    } else {
+      if (! writable)		/* reader looking at undefined data */
+	ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
+    }
+  }
+  /* Flag the buffer dirty if caller will write in it */
+  if (writable)
+    ptr->dirty = TRUE;
+  /* Return address of proper part of the buffer */
+  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
+}
+
+
+METHODDEF(JBLOCKARRAY)
+access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
+		    JDIMENSION start_row, JDIMENSION num_rows,
+		    boolean writable)
+/* Access the part of a virtual block array starting at start_row */
+/* and extending for num_rows rows.  writable is true if  */
+/* caller intends to modify the accessed area. */
+{
+  JDIMENSION end_row = start_row + num_rows;
+  JDIMENSION undef_row;
+
+  /* debugging check */
+  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
+      ptr->mem_buffer == NULL)
+    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
+
+  /* Make the desired part of the virtual array accessible */
+  if (start_row < ptr->cur_start_row ||
+      end_row > ptr->cur_start_row+ptr->rows_in_mem) {
+    if (! ptr->b_s_open)
+      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
+    /* Flush old buffer contents if necessary */
+    if (ptr->dirty) {
+      do_barray_io(cinfo, ptr, TRUE);
+      ptr->dirty = FALSE;
+    }
+    /* Decide what part of virtual array to access.
+     * Algorithm: if target address > current window, assume forward scan,
+     * load starting at target address.  If target address < current window,
+     * assume backward scan, load so that target area is top of window.
+     * Note that when switching from forward write to forward read, will have
+     * start_row = 0, so the limiting case applies and we load from 0 anyway.
+     */
+    if (start_row > ptr->cur_start_row) {
+      ptr->cur_start_row = start_row;
+    } else {
+      /* use long arithmetic here to avoid overflow & unsigned problems */
+      long ltemp;
+
+      ltemp = (long) end_row - (long) ptr->rows_in_mem;
+      if (ltemp < 0)
+	ltemp = 0;		/* don't fall off front end of file */
+      ptr->cur_start_row = (JDIMENSION) ltemp;
+    }
+    /* Read in the selected part of the array.
+     * During the initial write pass, we will do no actual read
+     * because the selected part is all undefined.
+     */
+    do_barray_io(cinfo, ptr, FALSE);
+  }
+  /* Ensure the accessed part of the array is defined; prezero if needed.
+   * To improve locality of access, we only prezero the part of the array
+   * that the caller is about to access, not the entire in-memory array.
+   */
+  if (ptr->first_undef_row < end_row) {
+    if (ptr->first_undef_row < start_row) {
+      if (writable)		/* writer skipped over a section of array */
+	ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
+      undef_row = start_row;	/* but reader is allowed to read ahead */
+    } else {
+      undef_row = ptr->first_undef_row;
+    }
+    if (writable)
+      ptr->first_undef_row = end_row;
+    if (ptr->pre_zero) {
+      size_t bytesperrow = (size_t) ptr->blocksperrow * SIZEOF(JBLOCK);
+      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
+      end_row -= ptr->cur_start_row;
+      while (undef_row < end_row) {
+	jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);
+	undef_row++;
+      }
+    } else {
+      if (! writable)		/* reader looking at undefined data */
+	ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
+    }
+  }
+  /* Flag the buffer dirty if caller will write in it */
+  if (writable)
+    ptr->dirty = TRUE;
+  /* Return address of proper part of the buffer */
+  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
+}
+
+
+/*
+ * Release all objects belonging to a specified pool.
+ */
+
+METHODDEF(void)
+free_pool (j_common_ptr cinfo, int pool_id)
+{
+  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+  small_pool_ptr shdr_ptr;
+  large_pool_ptr lhdr_ptr;
+  size_t space_freed;
+
+  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
+    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);	/* safety check */
+
+#ifdef MEM_STATS
+  if (cinfo->err->trace_level > 1)
+    print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */
+#endif
+
+  /* If freeing IMAGE pool, close any virtual arrays first */
+  if (pool_id == JPOOL_IMAGE) {
+    jvirt_sarray_ptr sptr;
+    jvirt_barray_ptr bptr;
+
+    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
+      if (sptr->b_s_open) {	/* there may be no backing store */
+	sptr->b_s_open = FALSE;	/* prevent recursive close if error */
+	(*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info);
+      }
+    }
+    mem->virt_sarray_list = NULL;
+    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
+      if (bptr->b_s_open) {	/* there may be no backing store */
+	bptr->b_s_open = FALSE;	/* prevent recursive close if error */
+	(*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info);
+      }
+    }
+    mem->virt_barray_list = NULL;
+  }
+
+  /* Release large objects */
+  lhdr_ptr = mem->large_list[pool_id];
+  mem->large_list[pool_id] = NULL;
+
+  while (lhdr_ptr != NULL) {
+    large_pool_ptr next_lhdr_ptr = lhdr_ptr->hdr.next;
+    space_freed = lhdr_ptr->hdr.bytes_used +
+		  lhdr_ptr->hdr.bytes_left +
+		  SIZEOF(large_pool_hdr);
+    jpeg_free_large(cinfo, (void FAR *) lhdr_ptr, space_freed);
+    mem->total_space_allocated -= space_freed;
+    lhdr_ptr = next_lhdr_ptr;
+  }
+
+  /* Release small objects */
+  shdr_ptr = mem->small_list[pool_id];
+  mem->small_list[pool_id] = NULL;
+
+  while (shdr_ptr != NULL) {
+    small_pool_ptr next_shdr_ptr = shdr_ptr->hdr.next;
+    space_freed = shdr_ptr->hdr.bytes_used +
+		  shdr_ptr->hdr.bytes_left +
+		  SIZEOF(small_pool_hdr);
+    jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed);
+    mem->total_space_allocated -= space_freed;
+    shdr_ptr = next_shdr_ptr;
+  }
+}
+
+
+/*
+ * Close up shop entirely.
+ * Note that this cannot be called unless cinfo->mem is non-NULL.
+ */
+
+METHODDEF(void)
+self_destruct (j_common_ptr cinfo)
+{
+  int pool;
+
+  /* Close all backing store, release all memory.
+   * Releasing pools in reverse order might help avoid fragmentation
+   * with some (brain-damaged) malloc libraries.
+   */
+  for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {
+    free_pool(cinfo, pool);
+  }
+
+  /* Release the memory manager control block too. */
+  jpeg_free_small(cinfo, (void *) cinfo->mem, SIZEOF(my_memory_mgr));
+  cinfo->mem = NULL;		/* ensures I will be called only once */
+
+  jpeg_mem_term(cinfo);		/* system-dependent cleanup */
+}
+
+
+/*
+ * Memory manager initialization.
+ * When this is called, only the error manager pointer is valid in cinfo!
+ */
+
+GLOBAL(void)
+jinit_memory_mgr (j_common_ptr cinfo)
+{
+  my_mem_ptr mem;
+  long max_to_use;
+  int pool;
+  size_t test_mac;
+
+  cinfo->mem = NULL;		/* for safety if init fails */
+
+  /* Check for configuration errors.
+   * SIZEOF(ALIGN_TYPE) should be a power of 2; otherwise, it probably
+   * doesn't reflect any real hardware alignment requirement.
+   * The test is a little tricky: for X>0, X and X-1 have no one-bits
+   * in common if and only if X is a power of 2, ie has only one one-bit.
+   * Some compilers may give an "unreachable code" warning here; ignore it.
+   */
+  if ((SIZEOF(ALIGN_TYPE) & (SIZEOF(ALIGN_TYPE)-1)) != 0)
+    ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
+  /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
+   * a multiple of SIZEOF(ALIGN_TYPE).
+   * Again, an "unreachable code" warning may be ignored here.
+   * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
+   */
+  test_mac = (size_t) MAX_ALLOC_CHUNK;
+  if ((long) test_mac != MAX_ALLOC_CHUNK ||
+      (MAX_ALLOC_CHUNK % SIZEOF(ALIGN_TYPE)) != 0)
+    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
+
+  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
+
+  /* Attempt to allocate memory manager's control block */
+  mem = (my_mem_ptr) jpeg_get_small(cinfo, SIZEOF(my_memory_mgr));
+
+  if (mem == NULL) {
+    jpeg_mem_term(cinfo);	/* system-dependent cleanup */
+    ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0);
+  }
+
+  /* OK, fill in the method pointers */
+  mem->pub.alloc_small = alloc_small;
+  mem->pub.alloc_large = alloc_large;
+  mem->pub.alloc_sarray = alloc_sarray;
+  mem->pub.alloc_barray = alloc_barray;
+  mem->pub.request_virt_sarray = request_virt_sarray;
+  mem->pub.request_virt_barray = request_virt_barray;
+  mem->pub.realize_virt_arrays = realize_virt_arrays;
+  mem->pub.access_virt_sarray = access_virt_sarray;
+  mem->pub.access_virt_barray = access_virt_barray;
+  mem->pub.free_pool = free_pool;
+  mem->pub.self_destruct = self_destruct;
+
+  /* Make MAX_ALLOC_CHUNK accessible to other modules */
+  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
+
+  /* Initialize working state */
+  mem->pub.max_memory_to_use = max_to_use;
+
+  for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {
+    mem->small_list[pool] = NULL;
+    mem->large_list[pool] = NULL;
+  }
+  mem->virt_sarray_list = NULL;
+  mem->virt_barray_list = NULL;
+
+  mem->total_space_allocated = SIZEOF(my_memory_mgr);
+
+  /* Declare ourselves open for business */
+  cinfo->mem = & mem->pub;
+
+  /* Check for an environment variable JPEGMEM; if found, override the
+   * default max_memory setting from jpeg_mem_init.  Note that the
+   * surrounding application may again override this value.
+   * If your system doesn't support getenv(), define NO_GETENV to disable
+   * this feature.
+   */
+#ifndef NO_GETENV
+  { char * memenv;
+
+    if ((memenv = getenv("JPEGMEM")) != NULL) {
+      char ch = 'x';
+
+      if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
+	if (ch == 'm' || ch == 'M')
+	  max_to_use *= 1000L;
+	mem->pub.max_memory_to_use = max_to_use * 1000L;
+      }
+    }
+  }
+#endif
+
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemname.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemname.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemname.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,276 @@
+/*
+ * jmemname.c
+ *
+ * Copyright (C) 1992-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file provides a generic implementation of the system-dependent
+ * portion of the JPEG memory manager.  This implementation assumes that
+ * you must explicitly construct a name for each temp file.
+ * Also, the problem of determining the amount of memory available
+ * is shoved onto the user.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jmemsys.h"		/* import the system-dependent declarations */
+
+#ifndef HAVE_STDLIB_H		/* <stdlib.h> should declare malloc(),free() */
+extern void * malloc JPP((size_t size));
+extern void free JPP((void *ptr));
+#endif
+
+#ifndef SEEK_SET		/* pre-ANSI systems may not define this; */
+#define SEEK_SET  0		/* if not, assume 0 is correct */
+#endif
+
+#ifdef DONT_USE_B_MODE		/* define mode parameters for fopen() */
+#define READ_BINARY	"r"
+#define RW_BINARY	"w+"
+#else
+#ifdef VMS			/* VMS is very nonstandard */
+#define READ_BINARY	"rb", "ctx=stm"
+#define RW_BINARY	"w+b", "ctx=stm"
+#else				/* standard ANSI-compliant case */
+#define READ_BINARY	"rb"
+#define RW_BINARY	"w+b"
+#endif
+#endif
+
+
+/*
+ * Selection of a file name for a temporary file.
+ * This is system-dependent!
+ *
+ * The code as given is suitable for most Unix systems, and it is easily
+ * modified for most non-Unix systems.  Some notes:
+ *  1.  The temp file is created in the directory named by TEMP_DIRECTORY.
+ *      The default value is /usr/tmp, which is the conventional place for
+ *      creating large temp files on Unix.  On other systems you'll probably
+ *      want to change the file location.  You can do this by editing the
+ *      #define, or (preferred) by defining TEMP_DIRECTORY in jconfig.h.
+ *
+ *  2.  If you need to change the file name as well as its location,
+ *      you can override the TEMP_FILE_NAME macro.  (Note that this is
+ *      actually a printf format string; it must contain %s and %d.)
+ *      Few people should need to do this.
+ *
+ *  3.  mktemp() is used to ensure that multiple processes running
+ *      simultaneously won't select the same file names.  If your system
+ *      doesn't have mktemp(), define NO_MKTEMP to do it the hard way.
+ *      (If you don't have <errno.h>, also define NO_ERRNO_H.)
+ *
+ *  4.  You probably want to define NEED_SIGNAL_CATCHER so that cjpeg.c/djpeg.c
+ *      will cause the temp files to be removed if you stop the program early.
+ */
+
+#ifndef TEMP_DIRECTORY		/* can override from jconfig.h or Makefile */
+#define TEMP_DIRECTORY  "/usr/tmp/" /* recommended setting for Unix */
+#endif
+
+static int next_file_num;	/* to distinguish among several temp files */
+
+#ifdef NO_MKTEMP
+
+#ifndef TEMP_FILE_NAME		/* can override from jconfig.h or Makefile */
+#define TEMP_FILE_NAME  "%sJPG%03d.TMP"
+#endif
+
+#ifndef NO_ERRNO_H
+#include <errno.h>		/* to define ENOENT */
+#endif
+
+/* ANSI C specifies that errno is a macro, but on older systems it's more
+ * likely to be a plain int variable.  And not all versions of errno.h
+ * bother to declare it, so we have to in order to be most portable.  Thus:
+ */
+#ifndef errno
+extern int errno;
+#endif
+
+
+LOCAL(void)
+select_file_name (char * fname)
+{
+  FILE * tfile;
+
+  /* Keep generating file names till we find one that's not in use */
+  for (;;) {
+    next_file_num++;		/* advance counter */
+    sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num);
+    if ((tfile = fopen(fname, READ_BINARY)) == NULL) {
+      /* fopen could have failed for a reason other than the file not
+       * being there; for example, file there but unreadable.
+       * If <errno.h> isn't available, then we cannot test the cause.
+       */
+#ifdef ENOENT
+      if (errno != ENOENT)
+	continue;
+#endif
+      break;
+    }
+    fclose(tfile);		/* oops, it's there; close tfile & try again */
+  }
+}
+
+#else /* ! NO_MKTEMP */
+
+/* Note that mktemp() requires the initial filename to end in six X's */
+#ifndef TEMP_FILE_NAME		/* can override from jconfig.h or Makefile */
+#define TEMP_FILE_NAME  "%sJPG%dXXXXXX"
+#endif
+
+LOCAL(void)
+select_file_name (char * fname)
+{
+  next_file_num++;		/* advance counter */
+  sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num);
+  mktemp(fname);		/* make sure file name is unique */
+  /* mktemp replaces the trailing XXXXXX with a unique string of characters */
+}
+
+#endif /* NO_MKTEMP */
+
+
+/*
+ * Memory allocation and freeing are controlled by the regular library
+ * routines malloc() and free().
+ */
+
+GLOBAL(void *)
+jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void *) malloc(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
+{
+  free(object);
+}
+
+
+/*
+ * "Large" objects are treated the same as "small" ones.
+ * NB: although we include FAR keywords in the routine declarations,
+ * this file won't actually work in 80x86 small/medium model; at least,
+ * you probably won't be able to process useful-size images in only 64KB.
+ */
+
+GLOBAL(void FAR *)
+jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void FAR *) malloc(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
+{
+  free(object);
+}
+
+
+/*
+ * This routine computes the total memory space available for allocation.
+ * It's impossible to do this in a portable way; our current solution is
+ * to make the user tell us (with a default value set at compile time).
+ * If you can actually get the available space, it's a good idea to subtract
+ * a slop factor of 5% or so.
+ */
+
+#ifndef DEFAULT_MAX_MEM		/* so can override from makefile */
+#define DEFAULT_MAX_MEM		1000000L /* default: one megabyte */
+#endif
+
+GLOBAL(long)
+jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
+		    long max_bytes_needed, long already_allocated)
+{
+  return cinfo->mem->max_memory_to_use - already_allocated;
+}
+
+
+/*
+ * Backing store (temporary file) management.
+ * Backing store objects are only used when the value returned by
+ * jpeg_mem_available is less than the total space needed.  You can dispense
+ * with these routines if you have plenty of virtual memory; see jmemnobs.c.
+ */
+
+
+METHODDEF(void)
+read_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+		    void FAR * buffer_address,
+		    long file_offset, long byte_count)
+{
+  if (fseek(info->temp_file, file_offset, SEEK_SET))
+    ERREXIT(cinfo, JERR_TFILE_SEEK);
+  if (JFREAD(info->temp_file, buffer_address, byte_count)
+      != (size_t) byte_count)
+    ERREXIT(cinfo, JERR_TFILE_READ);
+}
+
+
+METHODDEF(void)
+write_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+		     void FAR * buffer_address,
+		     long file_offset, long byte_count)
+{
+  if (fseek(info->temp_file, file_offset, SEEK_SET))
+    ERREXIT(cinfo, JERR_TFILE_SEEK);
+  if (JFWRITE(info->temp_file, buffer_address, byte_count)
+      != (size_t) byte_count)
+    ERREXIT(cinfo, JERR_TFILE_WRITE);
+}
+
+
+METHODDEF(void)
+close_backing_store (j_common_ptr cinfo, backing_store_ptr info)
+{
+  fclose(info->temp_file);	/* close the file */
+  unlink(info->temp_name);	/* delete the file */
+/* If your system doesn't have unlink(), use remove() instead.
+ * remove() is the ANSI-standard name for this function, but if
+ * your system was ANSI you'd be using jmemansi.c, right?
+ */
+  TRACEMSS(cinfo, 1, JTRC_TFILE_CLOSE, info->temp_name);
+}
+
+
+/*
+ * Initial opening of a backing-store object.
+ */
+
+GLOBAL(void)
+jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+			 long total_bytes_needed)
+{
+  select_file_name(info->temp_name);
+  if ((info->temp_file = fopen(info->temp_name, RW_BINARY)) == NULL)
+    ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name);
+  info->read_backing_store = read_backing_store;
+  info->write_backing_store = write_backing_store;
+  info->close_backing_store = close_backing_store;
+  TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name);
+}
+
+
+/*
+ * These routines take care of any system-dependent initialization and
+ * cleanup required.
+ */
+
+GLOBAL(long)
+jpeg_mem_init (j_common_ptr cinfo)
+{
+  next_file_num = 0;		/* initialize temp file name generator */
+  return DEFAULT_MAX_MEM;	/* default for max_memory_to_use */
+}
+
+GLOBAL(void)
+jpeg_mem_term (j_common_ptr cinfo)
+{
+  /* no work */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemnobs.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemnobs.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemnobs.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,109 @@
+/*
+ * jmemnobs.c
+ *
+ * Copyright (C) 1992-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file provides a really simple implementation of the system-
+ * dependent portion of the JPEG memory manager.  This implementation
+ * assumes that no backing-store files are needed: all required space
+ * can be obtained from malloc().
+ * This is very portable in the sense that it'll compile on almost anything,
+ * but you'd better have lots of main memory (or virtual memory) if you want
+ * to process big images.
+ * Note that the max_memory_to_use option is ignored by this implementation.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jmemsys.h"		/* import the system-dependent declarations */
+
+#ifndef HAVE_STDLIB_H		/* <stdlib.h> should declare malloc(),free() */
+extern void * malloc JPP((size_t size));
+extern void free JPP((void *ptr));
+#endif
+
+
+/*
+ * Memory allocation and freeing are controlled by the regular library
+ * routines malloc() and free().
+ */
+
+GLOBAL(void *)
+jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void *) malloc(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
+{
+  free(object);
+}
+
+
+/*
+ * "Large" objects are treated the same as "small" ones.
+ * NB: although we include FAR keywords in the routine declarations,
+ * this file won't actually work in 80x86 small/medium model; at least,
+ * you probably won't be able to process useful-size images in only 64KB.
+ */
+
+GLOBAL(void FAR *)
+jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
+{
+  return (void FAR *) malloc(sizeofobject);
+}
+
+GLOBAL(void)
+jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
+{
+  free(object);
+}
+
+
+/*
+ * This routine computes the total memory space available for allocation.
+ * Here we always say, "we got all you want bud!"
+ */
+
+GLOBAL(long)
+jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
+		    long max_bytes_needed, long already_allocated)
+{
+  return max_bytes_needed;
+}
+
+
+/*
+ * Backing store (temporary file) management.
+ * Since jpeg_mem_available always promised the moon,
+ * this should never be called and we can just error out.
+ */
+
+GLOBAL(void)
+jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+			 long total_bytes_needed)
+{
+  ERREXIT(cinfo, JERR_NO_BACKING_STORE);
+}
+
+
+/*
+ * These routines take care of any system-dependent initialization and
+ * cleanup required.  Here, there isn't any.
+ */
+
+GLOBAL(long)
+jpeg_mem_init (j_common_ptr cinfo)
+{
+  return 0;			/* just set max_memory_to_use to 0 */
+}
+
+GLOBAL(void)
+jpeg_mem_term (j_common_ptr cinfo)
+{
+  /* no work */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemsys.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemsys.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jmemsys.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,198 @@
+/*
+ * jmemsys.h
+ *
+ * Copyright (C) 1992-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This include file defines the interface between the system-independent
+ * and system-dependent portions of the JPEG memory manager.  No other
+ * modules need include it.  (The system-independent portion is jmemmgr.c;
+ * there are several different versions of the system-dependent portion.)
+ *
+ * This file works as-is for the system-dependent memory managers supplied
+ * in the IJG distribution.  You may need to modify it if you write a
+ * custom memory manager.  If system-dependent changes are needed in
+ * this file, the best method is to #ifdef them based on a configuration
+ * symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR
+ * and USE_MAC_MEMMGR.
+ */
+
+
+/* Short forms of external names for systems with brain-damaged linkers. */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jpeg_get_small		jGetSmall
+#define jpeg_free_small		jFreeSmall
+#define jpeg_get_large		jGetLarge
+#define jpeg_free_large		jFreeLarge
+#define jpeg_mem_available	jMemAvail
+#define jpeg_open_backing_store	jOpenBackStore
+#define jpeg_mem_init		jMemInit
+#define jpeg_mem_term		jMemTerm
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+
+/*
+ * These two functions are used to allocate and release small chunks of
+ * memory.  (Typically the total amount requested through jpeg_get_small is
+ * no more than 20K or so; this will be requested in chunks of a few K each.)
+ * Behavior should be the same as for the standard library functions malloc
+ * and free; in particular, jpeg_get_small must return NULL on failure.
+ * On most systems, these ARE malloc and free.  jpeg_free_small is passed the
+ * size of the object being freed, just in case it's needed.
+ * On an 80x86 machine using small-data memory model, these manage near heap.
+ */
+
+EXTERN(void *) jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject));
+EXTERN(void) jpeg_free_small JPP((j_common_ptr cinfo, void * object,
+				  size_t sizeofobject));
+
+/*
+ * These two functions are used to allocate and release large chunks of
+ * memory (up to the total free space designated by jpeg_mem_available).
+ * The interface is the same as above, except that on an 80x86 machine,
+ * far pointers are used.  On most other machines these are identical to
+ * the jpeg_get/free_small routines; but we keep them separate anyway,
+ * in case a different allocation strategy is desirable for large chunks.
+ */
+
+EXTERN(void FAR *) jpeg_get_large JPP((j_common_ptr cinfo,
+				       size_t sizeofobject));
+EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object,
+				  size_t sizeofobject));
+
+/*
+ * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may
+ * be requested in a single call to jpeg_get_large (and jpeg_get_small for that
+ * matter, but that case should never come into play).  This macro is needed
+ * to model the 64Kb-segment-size limit of far addressing on 80x86 machines.
+ * On those machines, we expect that jconfig.h will provide a proper value.
+ * On machines with 32-bit flat address spaces, any large constant may be used.
+ *
+ * NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type
+ * size_t and will be a multiple of sizeof(align_type).
+ */
+
+#ifndef MAX_ALLOC_CHUNK		/* may be overridden in jconfig.h */
+#define MAX_ALLOC_CHUNK  1000000000L
+#endif
+
+/*
+ * This routine computes the total space still available for allocation by
+ * jpeg_get_large.  If more space than this is needed, backing store will be
+ * used.  NOTE: any memory already allocated must not be counted.
+ *
+ * There is a minimum space requirement, corresponding to the minimum
+ * feasible buffer sizes; jmemmgr.c will request that much space even if
+ * jpeg_mem_available returns zero.  The maximum space needed, enough to hold
+ * all working storage in memory, is also passed in case it is useful.
+ * Finally, the total space already allocated is passed.  If no better
+ * method is available, cinfo->mem->max_memory_to_use - already_allocated
+ * is often a suitable calculation.
+ *
+ * It is OK for jpeg_mem_available to underestimate the space available
+ * (that'll just lead to more backing-store access than is really necessary).
+ * However, an overestimate will lead to failure.  Hence it's wise to subtract
+ * a slop factor from the true available space.  5% should be enough.
+ *
+ * On machines with lots of virtual memory, any large constant may be returned.
+ * Conversely, zero may be returned to always use the minimum amount of memory.
+ */
+
+EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo,
+				     long min_bytes_needed,
+				     long max_bytes_needed,
+				     long already_allocated));
+
+
+/*
+ * This structure holds whatever state is needed to access a single
+ * backing-store object.  The read/write/close method pointers are called
+ * by jmemmgr.c to manipulate the backing-store object; all other fields
+ * are private to the system-dependent backing store routines.
+ */
+
+#define TEMP_NAME_LENGTH   64	/* max length of a temporary file's name */
+
+
+#ifdef USE_MSDOS_MEMMGR		/* DOS-specific junk */
+
+typedef unsigned short XMSH;	/* type of extended-memory handles */
+typedef unsigned short EMSH;	/* type of expanded-memory handles */
+
+typedef union {
+  short file_handle;		/* DOS file handle if it's a temp file */
+  XMSH xms_handle;		/* handle if it's a chunk of XMS */
+  EMSH ems_handle;		/* handle if it's a chunk of EMS */
+} handle_union;
+
+#endif /* USE_MSDOS_MEMMGR */
+
+#ifdef USE_MAC_MEMMGR		/* Mac-specific junk */
+#include <Files.h>
+#endif /* USE_MAC_MEMMGR */
+
+
+typedef struct backing_store_struct * backing_store_ptr;
+
+typedef struct backing_store_struct {
+  /* Methods for reading/writing/closing this backing-store object */
+  JMETHOD(void, read_backing_store, (j_common_ptr cinfo,
+				     backing_store_ptr info,
+				     void FAR * buffer_address,
+				     long file_offset, long byte_count));
+  JMETHOD(void, write_backing_store, (j_common_ptr cinfo,
+				      backing_store_ptr info,
+				      void FAR * buffer_address,
+				      long file_offset, long byte_count));
+  JMETHOD(void, close_backing_store, (j_common_ptr cinfo,
+				      backing_store_ptr info));
+
+  /* Private fields for system-dependent backing-store management */
+#ifdef USE_MSDOS_MEMMGR
+  /* For the MS-DOS manager (jmemdos.c), we need: */
+  handle_union handle;		/* reference to backing-store storage object */
+  char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */
+#else
+#ifdef USE_MAC_MEMMGR
+  /* For the Mac manager (jmemmac.c), we need: */
+  short temp_file;		/* file reference number to temp file */
+  FSSpec tempSpec;		/* the FSSpec for the temp file */
+  char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */
+#else
+  /* For a typical implementation with temp files, we need: */
+  FILE * temp_file;		/* stdio reference to temp file */
+  char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */
+#endif
+#endif
+} backing_store_info;
+
+
+/*
+ * Initial opening of a backing-store object.  This must fill in the
+ * read/write/close pointers in the object.  The read/write routines
+ * may take an error exit if the specified maximum file size is exceeded.
+ * (If jpeg_mem_available always returns a large value, this routine can
+ * just take an error exit.)
+ */
+
+EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo,
+					  backing_store_ptr info,
+					  long total_bytes_needed));
+
+
+/*
+ * These routines take care of any system-dependent initialization and
+ * cleanup required.  jpeg_mem_init will be called before anything is
+ * allocated (and, therefore, nothing in cinfo is of use except the error
+ * manager pointer).  It should return a suitable default value for
+ * max_memory_to_use; this may subsequently be overridden by the surrounding
+ * application.  (Note that max_memory_to_use is only important if
+ * jpeg_mem_available chooses to consult it ... no one else will.)
+ * jpeg_mem_term may assume that all requested memory has been freed and that
+ * all opened backing-store objects have been closed.
+ */
+
+EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo));
+EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo));

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jmorecfg.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jmorecfg.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jmorecfg.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,363 @@
+/*
+ * jmorecfg.h
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains additional configuration options that customize the
+ * JPEG software for special applications or support machine-dependent
+ * optimizations.  Most users will not need to touch this file.
+ */
+
+
+/*
+ * Define BITS_IN_JSAMPLE as either
+ *   8   for 8-bit sample values (the usual setting)
+ *   12  for 12-bit sample values
+ * Only 8 and 12 are legal data precisions for lossy JPEG according to the
+ * JPEG standard, and the IJG code does not support anything else!
+ * We do not support run-time selection of data precision, sorry.
+ */
+
+#define BITS_IN_JSAMPLE  8	/* use 8 or 12 */
+
+
+/*
+ * Maximum number of components (color channels) allowed in JPEG image.
+ * To meet the letter of the JPEG spec, set this to 255.  However, darn
+ * few applications need more than 4 channels (maybe 5 for CMYK + alpha
+ * mask).  We recommend 10 as a reasonable compromise; use 4 if you are
+ * really short on memory.  (Each allowed component costs a hundred or so
+ * bytes of storage, whether actually used in an image or not.)
+ */
+
+#define MAX_COMPONENTS  10	/* maximum number of image components */
+
+
+/*
+ * Basic data types.
+ * You may need to change these if you have a machine with unusual data
+ * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
+ * or "long" not 32 bits.  We don't care whether "int" is 16 or 32 bits,
+ * but it had better be at least 16.
+ */
+
+/* Representation of a single sample (pixel element value).
+ * We frequently allocate large arrays of these, so it's important to keep
+ * them small.  But if you have memory to burn and access to char or short
+ * arrays is very slow on your hardware, you might want to change these.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+/* JSAMPLE should be the smallest type that will hold the values 0..255.
+ * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
+ */
+
+#ifdef HAVE_UNSIGNED_CHAR
+
+typedef unsigned char JSAMPLE;
+#define GETJSAMPLE(value)  ((int) (value))
+
+#else /* not HAVE_UNSIGNED_CHAR */
+
+typedef char JSAMPLE;
+#ifdef CHAR_IS_UNSIGNED
+#define GETJSAMPLE(value)  ((int) (value))
+#else
+#define GETJSAMPLE(value)  ((int) (value) & 0xFF)
+#endif /* CHAR_IS_UNSIGNED */
+
+#endif /* HAVE_UNSIGNED_CHAR */
+
+#define MAXJSAMPLE	255
+#define CENTERJSAMPLE	128
+
+#endif /* BITS_IN_JSAMPLE == 8 */
+
+
+#if BITS_IN_JSAMPLE == 12
+/* JSAMPLE should be the smallest type that will hold the values 0..4095.
+ * On nearly all machines "short" will do nicely.
+ */
+
+typedef short JSAMPLE;
+#define GETJSAMPLE(value)  ((int) (value))
+
+#define MAXJSAMPLE	4095
+#define CENTERJSAMPLE	2048
+
+#endif /* BITS_IN_JSAMPLE == 12 */
+
+
+/* Representation of a DCT frequency coefficient.
+ * This should be a signed value of at least 16 bits; "short" is usually OK.
+ * Again, we allocate large arrays of these, but you can change to int
+ * if you have memory to burn and "short" is really slow.
+ */
+
+typedef short JCOEF;
+
+
+/* Compressed datastreams are represented as arrays of JOCTET.
+ * These must be EXACTLY 8 bits wide, at least once they are written to
+ * external storage.  Note that when using the stdio data source/destination
+ * managers, this is also the data type passed to fread/fwrite.
+ */
+
+#ifdef HAVE_UNSIGNED_CHAR
+
+typedef unsigned char JOCTET;
+#define GETJOCTET(value)  (value)
+
+#else /* not HAVE_UNSIGNED_CHAR */
+
+typedef char JOCTET;
+#ifdef CHAR_IS_UNSIGNED
+#define GETJOCTET(value)  (value)
+#else
+#define GETJOCTET(value)  ((value) & 0xFF)
+#endif /* CHAR_IS_UNSIGNED */
+
+#endif /* HAVE_UNSIGNED_CHAR */
+
+
+/* These typedefs are used for various table entries and so forth.
+ * They must be at least as wide as specified; but making them too big
+ * won't cost a huge amount of memory, so we don't provide special
+ * extraction code like we did for JSAMPLE.  (In other words, these
+ * typedefs live at a different point on the speed/space tradeoff curve.)
+ */
+
+/* UINT8 must hold at least the values 0..255. */
+
+#ifdef HAVE_UNSIGNED_CHAR
+typedef unsigned char UINT8;
+#else /* not HAVE_UNSIGNED_CHAR */
+#ifdef CHAR_IS_UNSIGNED
+typedef char UINT8;
+#else /* not CHAR_IS_UNSIGNED */
+typedef short UINT8;
+#endif /* CHAR_IS_UNSIGNED */
+#endif /* HAVE_UNSIGNED_CHAR */
+
+/* UINT16 must hold at least the values 0..65535. */
+
+#ifdef HAVE_UNSIGNED_SHORT
+typedef unsigned short UINT16;
+#else /* not HAVE_UNSIGNED_SHORT */
+typedef unsigned int UINT16;
+#endif /* HAVE_UNSIGNED_SHORT */
+
+/* INT16 must hold at least the values -32768..32767. */
+
+#ifndef XMD_H			/* X11/xmd.h correctly defines INT16 */
+typedef short INT16;
+#endif
+
+/* INT32 must hold at least signed 32-bit values. */
+
+#ifndef XMD_H			/* X11/xmd.h correctly defines INT32 */
+typedef long INT32;
+#endif
+
+/* Datatype used for image dimensions.  The JPEG standard only supports
+ * images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore
+ * "unsigned int" is sufficient on all machines.  However, if you need to
+ * handle larger images and you don't mind deviating from the spec, you
+ * can change this datatype.
+ */
+
+typedef unsigned int JDIMENSION;
+
+#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
+
+
+/* These macros are used in all function definitions and extern declarations.
+ * You could modify them if you need to change function linkage conventions;
+ * in particular, you'll need to do that to make the library a Windows DLL.
+ * Another application is to make all functions global for use with debuggers
+ * or code profilers that require it.
+ */
+
+/* a function called through method pointers: */
+#define METHODDEF(type)		static type
+/* a function used only in its module: */
+#define LOCAL(type)		static type
+/* a function referenced thru EXTERNs: */
+#define GLOBAL(type)		type
+/* a reference to a GLOBAL function: */
+#define EXTERN(type)		extern type
+
+
+/* This macro is used to declare a "method", that is, a function pointer.
+ * We want to supply prototype parameters if the compiler can cope.
+ * Note that the arglist parameter must be parenthesized!
+ * Again, you can customize this if you need special linkage keywords.
+ */
+
+#ifdef HAVE_PROTOTYPES
+#define JMETHOD(type,methodname,arglist)  type (*methodname) arglist
+#else
+#define JMETHOD(type,methodname,arglist)  type (*methodname) ()
+#endif
+
+
+/* Here is the pseudo-keyword for declaring pointers that must be "far"
+ * on 80x86 machines.  Most of the specialized coding for 80x86 is handled
+ * by just saying "FAR *" where such a pointer is needed.  In a few places
+ * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
+ */
+
+#ifdef NEED_FAR_POINTERS
+#define FAR  far
+#else
+#define FAR
+#endif
+
+
+/*
+ * On a few systems, type boolean and/or its values FALSE, TRUE may appear
+ * in standard header files.  Or you may have conflicts with application-
+ * specific header files that you want to include together with these files.
+ * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
+ */
+
+#ifndef HAVE_BOOLEAN
+typedef int boolean;
+#endif
+#ifndef FALSE			/* in case these macros already exist */
+#define FALSE	0		/* values of boolean */
+#endif
+#ifndef TRUE
+#define TRUE	1
+#endif
+
+
+/*
+ * The remaining options affect code selection within the JPEG library,
+ * but they don't need to be visible to most applications using the library.
+ * To minimize application namespace pollution, the symbols won't be
+ * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
+ */
+
+#ifdef JPEG_INTERNALS
+#define JPEG_INTERNAL_OPTIONS
+#endif
+
+#ifdef JPEG_INTERNAL_OPTIONS
+
+
+/*
+ * These defines indicate whether to include various optional functions.
+ * Undefining some of these symbols will produce a smaller but less capable
+ * library.  Note that you can leave certain source files out of the
+ * compilation/linking process if you've #undef'd the corresponding symbols.
+ * (You may HAVE to do that if your compiler doesn't like null source files.)
+ */
+
+/* Arithmetic coding is unsupported for legal reasons.  Complaints to IBM. */
+
+/* Capability options common to encoder and decoder: */
+
+#define DCT_ISLOW_SUPPORTED	/* slow but accurate integer algorithm */
+#define DCT_IFAST_SUPPORTED	/* faster, less accurate integer method */
+#define DCT_FLOAT_SUPPORTED	/* floating-point: accurate, fast on fast HW */
+
+/* Encoder capability options: */
+
+#undef  C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
+#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
+#define C_PROGRESSIVE_SUPPORTED	    /* Progressive JPEG? (Requires MULTISCAN)*/
+#define ENTROPY_OPT_SUPPORTED	    /* Optimization of entropy coding parms? */
+/* Note: if you selected 12-bit data precision, it is dangerous to turn off
+ * ENTROPY_OPT_SUPPORTED.  The standard Huffman tables are only good for 8-bit
+ * precision, so jchuff.c normally uses entropy optimization to compute
+ * usable tables for higher precision.  If you don't want to do optimization,
+ * you'll have to supply different default Huffman tables.
+ * The exact same statements apply for progressive JPEG: the default tables
+ * don't work for progressive mode.  (This may get fixed, however.)
+ */
+#define INPUT_SMOOTHING_SUPPORTED   /* Input image smoothing option? */
+
+/* Decoder capability options: */
+
+#undef  D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
+#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
+#define D_PROGRESSIVE_SUPPORTED	    /* Progressive JPEG? (Requires MULTISCAN)*/
+#define SAVE_MARKERS_SUPPORTED	    /* jpeg_save_markers() needed? */
+#define BLOCK_SMOOTHING_SUPPORTED   /* Block smoothing? (Progressive only) */
+#define IDCT_SCALING_SUPPORTED	    /* Output rescaling via IDCT? */
+#undef  UPSAMPLE_SCALING_SUPPORTED  /* Output rescaling at upsample stage? */
+#define UPSAMPLE_MERGING_SUPPORTED  /* Fast path for sloppy upsampling? */
+#define QUANT_1PASS_SUPPORTED	    /* 1-pass color quantization? */
+#define QUANT_2PASS_SUPPORTED	    /* 2-pass color quantization? */
+
+/* more capability options later, no doubt */
+
+
+/*
+ * Ordering of RGB data in scanlines passed to or from the application.
+ * If your application wants to deal with data in the order B,G,R, just
+ * change these macros.  You can also deal with formats such as R,G,B,X
+ * (one extra byte per pixel) by changing RGB_PIXELSIZE.  Note that changing
+ * the offsets will also change the order in which colormap data is organized.
+ * RESTRICTIONS:
+ * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
+ * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
+ *    useful if you are using JPEG color spaces other than YCbCr or grayscale.
+ * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
+ *    is not 3 (they don't understand about dummy color components!).  So you
+ *    can't use color quantization if you change that value.
+ */
+
+#define RGB_RED		0	/* Offset of Red in an RGB scanline element */
+#define RGB_GREEN	1	/* Offset of Green */
+#define RGB_BLUE	2	/* Offset of Blue */
+#define RGB_PIXELSIZE	3	/* JSAMPLEs per RGB scanline element */
+
+
+/* Definitions for speed-related optimizations. */
+
+
+/* If your compiler supports inline functions, define INLINE
+ * as the inline keyword; otherwise define it as empty.
+ */
+
+#ifndef INLINE
+#ifdef __GNUC__			/* for instance, GNU C knows about inline */
+#define INLINE __inline__
+#endif
+#ifndef INLINE
+#define INLINE			/* default is to define it as empty */
+#endif
+#endif
+
+
+/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
+ * two 16-bit shorts is faster than multiplying two ints.  Define MULTIPLIER
+ * as short on such a machine.  MULTIPLIER must be at least 16 bits wide.
+ */
+
+#ifndef MULTIPLIER
+#define MULTIPLIER  int		/* type for fastest integer multiply */
+#endif
+
+
+/* FAST_FLOAT should be either float or double, whichever is done faster
+ * by your compiler.  (Note that this type is only used in the floating point
+ * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
+ * Typically, float is faster in ANSI C compilers, while double is faster in
+ * pre-ANSI compilers (because they insist on converting to double anyway).
+ * The code below therefore chooses float if we have ANSI-style prototypes.
+ */
+
+#ifndef FAST_FLOAT
+#ifdef HAVE_PROTOTYPES
+#define FAST_FLOAT  float
+#else
+#define FAST_FLOAT  double
+#endif
+#endif
+
+#endif /* JPEG_INTERNAL_OPTIONS */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegint.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegint.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegint.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,392 @@
+/*
+ * jpegint.h
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file provides common declarations for the various JPEG modules.
+ * These declarations are considered internal to the JPEG library; most
+ * applications using the library shouldn't need to include this file.
+ */
+
+
+/* Declarations for both compression & decompression */
+
+typedef enum {			/* Operating modes for buffer controllers */
+	JBUF_PASS_THRU,		/* Plain stripwise operation */
+	/* Remaining modes require a full-image buffer to have been created */
+	JBUF_SAVE_SOURCE,	/* Run source subobject only, save output */
+	JBUF_CRANK_DEST,	/* Run dest subobject only, using saved data */
+	JBUF_SAVE_AND_PASS	/* Run both subobjects, save output */
+} J_BUF_MODE;
+
+/* Values of global_state field (jdapi.c has some dependencies on ordering!) */
+#define CSTATE_START	100	/* after create_compress */
+#define CSTATE_SCANNING	101	/* start_compress done, write_scanlines OK */
+#define CSTATE_RAW_OK	102	/* start_compress done, write_raw_data OK */
+#define CSTATE_WRCOEFS	103	/* jpeg_write_coefficients done */
+#define DSTATE_START	200	/* after create_decompress */
+#define DSTATE_INHEADER	201	/* reading header markers, no SOS yet */
+#define DSTATE_READY	202	/* found SOS, ready for start_decompress */
+#define DSTATE_PRELOAD	203	/* reading multiscan file in start_decompress*/
+#define DSTATE_PRESCAN	204	/* performing dummy pass for 2-pass quant */
+#define DSTATE_SCANNING	205	/* start_decompress done, read_scanlines OK */
+#define DSTATE_RAW_OK	206	/* start_decompress done, read_raw_data OK */
+#define DSTATE_BUFIMAGE	207	/* expecting jpeg_start_output */
+#define DSTATE_BUFPOST	208	/* looking for SOS/EOI in jpeg_finish_output */
+#define DSTATE_RDCOEFS	209	/* reading file in jpeg_read_coefficients */
+#define DSTATE_STOPPING	210	/* looking for EOI in jpeg_finish_decompress */
+
+
+/* Declarations for compression modules */
+
+/* Master control module */
+struct jpeg_comp_master {
+  JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
+  JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
+  JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
+
+  /* State variables made visible to other modules */
+  boolean call_pass_startup;	/* True if pass_startup must be called */
+  boolean is_last_pass;		/* True during last pass */
+};
+
+/* Main buffer control (downsampled-data buffer) */
+struct jpeg_c_main_controller {
+  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
+  JMETHOD(void, process_data, (j_compress_ptr cinfo,
+			       JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
+			       JDIMENSION in_rows_avail));
+};
+
+/* Compression preprocessing (downsampling input buffer control) */
+struct jpeg_c_prep_controller {
+  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
+  JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
+				   JSAMPARRAY input_buf,
+				   JDIMENSION *in_row_ctr,
+				   JDIMENSION in_rows_avail,
+				   JSAMPIMAGE output_buf,
+				   JDIMENSION *out_row_group_ctr,
+				   JDIMENSION out_row_groups_avail));
+};
+
+/* Coefficient buffer control */
+struct jpeg_c_coef_controller {
+  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
+  JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
+				   JSAMPIMAGE input_buf));
+};
+
+/* Colorspace conversion */
+struct jpeg_color_converter {
+  JMETHOD(void, start_pass, (j_compress_ptr cinfo));
+  JMETHOD(void, color_convert, (j_compress_ptr cinfo,
+				JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+				JDIMENSION output_row, int num_rows));
+};
+
+/* Downsampling */
+struct jpeg_downsampler {
+  JMETHOD(void, start_pass, (j_compress_ptr cinfo));
+  JMETHOD(void, downsample, (j_compress_ptr cinfo,
+			     JSAMPIMAGE input_buf, JDIMENSION in_row_index,
+			     JSAMPIMAGE output_buf,
+			     JDIMENSION out_row_group_index));
+
+  boolean need_context_rows;	/* TRUE if need rows above & below */
+};
+
+/* Forward DCT (also controls coefficient quantization) */
+struct jpeg_forward_dct {
+  JMETHOD(void, start_pass, (j_compress_ptr cinfo));
+  /* perhaps this should be an array??? */
+  JMETHOD(void, forward_DCT, (j_compress_ptr cinfo,
+			      jpeg_component_info * compptr,
+			      JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
+			      JDIMENSION start_row, JDIMENSION start_col,
+			      JDIMENSION num_blocks));
+};
+
+/* Entropy encoding */
+struct jpeg_entropy_encoder {
+  JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
+  JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
+  JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
+};
+
+/* Marker writing */
+struct jpeg_marker_writer {
+  JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
+  JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
+  JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
+  JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
+  JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
+  /* These routines are exported to allow insertion of extra markers */
+  /* Probably only COM and APPn markers should be written this way */
+  JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
+				      unsigned int datalen));
+  JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
+};
+
+
+/* Declarations for decompression modules */
+
+/* Master control module */
+struct jpeg_decomp_master {
+  JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
+  JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
+
+  /* State variables made visible to other modules */
+  boolean is_dummy_pass;	/* True during 1st pass for 2-pass quant */
+};
+
+/* Input control module */
+struct jpeg_input_controller {
+  JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
+  JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
+  JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
+  JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
+
+  /* State variables made visible to other modules */
+  boolean has_multiple_scans;	/* True if file has multiple scans */
+  boolean eoi_reached;		/* True when EOI has been consumed */
+};
+
+/* Main buffer control (downsampled-data buffer) */
+struct jpeg_d_main_controller {
+  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
+  JMETHOD(void, process_data, (j_decompress_ptr cinfo,
+			       JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+			       JDIMENSION out_rows_avail));
+};
+
+/* Coefficient buffer control */
+struct jpeg_d_coef_controller {
+  JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
+  JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
+  JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
+  JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
+				 JSAMPIMAGE output_buf));
+  /* Pointer to array of coefficient virtual arrays, or NULL if none */
+  jvirt_barray_ptr *coef_arrays;
+};
+
+/* Decompression postprocessing (color quantization buffer control) */
+struct jpeg_d_post_controller {
+  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
+  JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
+				    JSAMPIMAGE input_buf,
+				    JDIMENSION *in_row_group_ctr,
+				    JDIMENSION in_row_groups_avail,
+				    JSAMPARRAY output_buf,
+				    JDIMENSION *out_row_ctr,
+				    JDIMENSION out_rows_avail));
+};
+
+/* Marker reading & parsing */
+struct jpeg_marker_reader {
+  JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
+  /* Read markers until SOS or EOI.
+   * Returns same codes as are defined for jpeg_consume_input:
+   * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
+   */
+  JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
+  /* Read a restart marker --- exported for use by entropy decoder only */
+  jpeg_marker_parser_method read_restart_marker;
+
+  /* State of marker reader --- nominally internal, but applications
+   * supplying COM or APPn handlers might like to know the state.
+   */
+  boolean saw_SOI;		/* found SOI? */
+  boolean saw_SOF;		/* found SOF? */
+  int next_restart_num;		/* next restart number expected (0-7) */
+  unsigned int discarded_bytes;	/* # of bytes skipped looking for a marker */
+};
+
+/* Entropy decoding */
+struct jpeg_entropy_decoder {
+  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
+  JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
+				JBLOCKROW *MCU_data));
+
+  /* This is here to share code between baseline and progressive decoders; */
+  /* other modules probably should not use it */
+  boolean insufficient_data;	/* set TRUE after emitting warning */
+};
+
+/* Inverse DCT (also performs dequantization) */
+typedef JMETHOD(void, inverse_DCT_method_ptr,
+		(j_decompress_ptr cinfo, jpeg_component_info * compptr,
+		 JCOEFPTR coef_block,
+		 JSAMPARRAY output_buf, JDIMENSION output_col));
+
+struct jpeg_inverse_dct {
+  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
+  /* It is useful to allow each component to have a separate IDCT method. */
+  inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
+};
+
+/* Upsampling (note that upsampler must also call color converter) */
+struct jpeg_upsampler {
+  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
+  JMETHOD(void, upsample, (j_decompress_ptr cinfo,
+			   JSAMPIMAGE input_buf,
+			   JDIMENSION *in_row_group_ctr,
+			   JDIMENSION in_row_groups_avail,
+			   JSAMPARRAY output_buf,
+			   JDIMENSION *out_row_ctr,
+			   JDIMENSION out_rows_avail));
+
+  boolean need_context_rows;	/* TRUE if need rows above & below */
+};
+
+/* Colorspace conversion */
+struct jpeg_color_deconverter {
+  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
+  JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
+				JSAMPIMAGE input_buf, JDIMENSION input_row,
+				JSAMPARRAY output_buf, int num_rows));
+};
+
+/* Color quantization or color precision reduction */
+struct jpeg_color_quantizer {
+  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
+  JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
+				 JSAMPARRAY input_buf, JSAMPARRAY output_buf,
+				 int num_rows));
+  JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
+  JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
+};
+
+
+/* Miscellaneous useful macros */
+
+#undef MAX
+#define MAX(a,b)	((a) > (b) ? (a) : (b))
+#undef MIN
+#define MIN(a,b)	((a) < (b) ? (a) : (b))
+
+
+/* We assume that right shift corresponds to signed division by 2 with
+ * rounding towards minus infinity.  This is correct for typical "arithmetic
+ * shift" instructions that shift in copies of the sign bit.  But some
+ * C compilers implement >> with an unsigned shift.  For these machines you
+ * must define RIGHT_SHIFT_IS_UNSIGNED.
+ * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
+ * It is only applied with constant shift counts.  SHIFT_TEMPS must be
+ * included in the variables of any routine using RIGHT_SHIFT.
+ */
+
+#ifdef RIGHT_SHIFT_IS_UNSIGNED
+#define SHIFT_TEMPS	INT32 shift_temp;
+#define RIGHT_SHIFT(x,shft)  \
+	((shift_temp = (x)) < 0 ? \
+	 (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
+	 (shift_temp >> (shft)))
+#else
+#define SHIFT_TEMPS
+#define RIGHT_SHIFT(x,shft)	((x) >> (shft))
+#endif
+
+
+/* Short forms of external names for systems with brain-damaged linkers. */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jinit_compress_master	jICompress
+#define jinit_c_master_control	jICMaster
+#define jinit_c_main_controller	jICMainC
+#define jinit_c_prep_controller	jICPrepC
+#define jinit_c_coef_controller	jICCoefC
+#define jinit_color_converter	jICColor
+#define jinit_downsampler	jIDownsampler
+#define jinit_forward_dct	jIFDCT
+#define jinit_huff_encoder	jIHEncoder
+#define jinit_phuff_encoder	jIPHEncoder
+#define jinit_marker_writer	jIMWriter
+#define jinit_master_decompress	jIDMaster
+#define jinit_d_main_controller	jIDMainC
+#define jinit_d_coef_controller	jIDCoefC
+#define jinit_d_post_controller	jIDPostC
+#define jinit_input_controller	jIInCtlr
+#define jinit_marker_reader	jIMReader
+#define jinit_huff_decoder	jIHDecoder
+#define jinit_phuff_decoder	jIPHDecoder
+#define jinit_inverse_dct	jIIDCT
+#define jinit_upsampler		jIUpsampler
+#define jinit_color_deconverter	jIDColor
+#define jinit_1pass_quantizer	jI1Quant
+#define jinit_2pass_quantizer	jI2Quant
+#define jinit_merged_upsampler	jIMUpsampler
+#define jinit_memory_mgr	jIMemMgr
+#define jdiv_round_up		jDivRound
+#define jround_up		jRound
+#define jcopy_sample_rows	jCopySamples
+#define jcopy_block_row		jCopyBlocks
+#define jzero_far		jZeroFar
+#define jpeg_zigzag_order	jZIGTable
+#define jpeg_natural_order	jZAGTable
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+
+/* Compression module initialization routines */
+EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
+EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
+					 boolean transcode_only));
+EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
+					  boolean need_full_buffer));
+EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
+					  boolean need_full_buffer));
+EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
+					  boolean need_full_buffer));
+EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
+EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
+EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
+EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
+EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo));
+EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
+/* Decompression module initialization routines */
+EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
+					  boolean need_full_buffer));
+EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
+					  boolean need_full_buffer));
+EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
+					  boolean need_full_buffer));
+EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
+EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
+/* Memory manager initialization */
+EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
+
+/* Utility routines in jutils.c */
+EXTERN(long) jdiv_round_up JPP((long a, long b));
+EXTERN(long) jround_up JPP((long a, long b));
+EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
+				    JSAMPARRAY output_array, int dest_row,
+				    int num_rows, JDIMENSION num_cols));
+EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
+				  JDIMENSION num_blocks));
+EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
+/* Constant tables in jutils.c */
+#if 0				/* This table is not actually needed in v6a */
+extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
+#endif
+extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
+
+/* Suppress undefined-structure complaints if necessary. */
+
+#ifdef INCOMPLETE_TYPES_BROKEN
+#ifndef AM_MEMORY_MANAGER	/* only jmemmgr.c defines these */
+struct jvirt_sarray_control { long dummy; };
+struct jvirt_barray_control { long dummy; };
+#endif
+#endif /* INCOMPLETE_TYPES_BROKEN */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jpeglib.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jpeglib.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jpeglib.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1096 @@
+/*
+ * jpeglib.h
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file defines the application interface for the JPEG library.
+ * Most applications using the library need only include this file,
+ * and perhaps jerror.h if they want to know the exact error codes.
+ */
+
+#ifndef JPEGLIB_H
+#define JPEGLIB_H
+
+/*
+ * First we include the configuration files that record how this
+ * installation of the JPEG library is set up.  jconfig.h can be
+ * generated automatically for many systems.  jmorecfg.h contains
+ * manual configuration options that most people need not worry about.
+ */
+
+#ifndef JCONFIG_INCLUDED	/* in case jinclude.h already did */
+#include "jconfig.h"		/* widely used configuration options */
+#endif
+#include "jmorecfg.h"		/* seldom changed options */
+
+
+/* Version ID for the JPEG library.
+ * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
+ */
+
+#define JPEG_LIB_VERSION  62	/* Version 6b */
+
+
+/* Various constants determining the sizes of things.
+ * All of these are specified by the JPEG standard, so don't change them
+ * if you want to be compatible.
+ */
+
+#define DCTSIZE		    8	/* The basic DCT block is 8x8 samples */
+#define DCTSIZE2	    64	/* DCTSIZE squared; # of elements in a block */
+#define NUM_QUANT_TBLS      4	/* Quantization tables are numbered 0..3 */
+#define NUM_HUFF_TBLS       4	/* Huffman tables are numbered 0..3 */
+#define NUM_ARITH_TBLS      16	/* Arith-coding tables are numbered 0..15 */
+#define MAX_COMPS_IN_SCAN   4	/* JPEG limit on # of components in one scan */
+#define MAX_SAMP_FACTOR     4	/* JPEG limit on sampling factors */
+/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
+ * the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
+ * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
+ * to handle it.  We even let you do this from the jconfig.h file.  However,
+ * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
+ * sometimes emits noncompliant files doesn't mean you should too.
+ */
+#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on blocks per MCU */
+#ifndef D_MAX_BLOCKS_IN_MCU
+#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on blocks per MCU */
+#endif
+
+
+/* Data structures for images (arrays of samples and of DCT coefficients).
+ * On 80x86 machines, the image arrays are too big for near pointers,
+ * but the pointer arrays can fit in near memory.
+ */
+
+typedef JSAMPLE FAR *JSAMPROW;	/* ptr to one image row of pixel samples. */
+typedef JSAMPROW *JSAMPARRAY;	/* ptr to some rows (a 2-D sample array) */
+typedef JSAMPARRAY *JSAMPIMAGE;	/* a 3-D sample array: top index is color */
+
+typedef JCOEF JBLOCK[DCTSIZE2];	/* one block of coefficients */
+typedef JBLOCK FAR *JBLOCKROW;	/* pointer to one row of coefficient blocks */
+typedef JBLOCKROW *JBLOCKARRAY;		/* a 2-D array of coefficient blocks */
+typedef JBLOCKARRAY *JBLOCKIMAGE;	/* a 3-D array of coefficient blocks */
+
+typedef JCOEF FAR *JCOEFPTR;	/* useful in a couple of places */
+
+
+/* Types for JPEG compression parameters and working tables. */
+
+
+/* DCT coefficient quantization tables. */
+
+typedef struct {
+  /* This array gives the coefficient quantizers in natural array order
+   * (not the zigzag order in which they are stored in a JPEG DQT marker).
+   * CAUTION: IJG versions prior to v6a kept this array in zigzag order.
+   */
+  UINT16 quantval[DCTSIZE2];	/* quantization step for each coefficient */
+  /* This field is used only during compression.  It's initialized FALSE when
+   * the table is created, and set TRUE when it's been output to the file.
+   * You could suppress output of a table by setting this to TRUE.
+   * (See jpeg_suppress_tables for an example.)
+   */
+  boolean sent_table;		/* TRUE when table has been output */
+} JQUANT_TBL;
+
+
+/* Huffman coding tables. */
+
+typedef struct {
+  /* These two fields directly represent the contents of a JPEG DHT marker */
+  UINT8 bits[17];		/* bits[k] = # of symbols with codes of */
+				/* length k bits; bits[0] is unused */
+  UINT8 huffval[256];		/* The symbols, in order of incr code length */
+  /* This field is used only during compression.  It's initialized FALSE when
+   * the table is created, and set TRUE when it's been output to the file.
+   * You could suppress output of a table by setting this to TRUE.
+   * (See jpeg_suppress_tables for an example.)
+   */
+  boolean sent_table;		/* TRUE when table has been output */
+} JHUFF_TBL;
+
+
+/* Basic info about one component (color channel). */
+
+typedef struct {
+  /* These values are fixed over the whole image. */
+  /* For compression, they must be supplied by parameter setup; */
+  /* for decompression, they are read from the SOF marker. */
+  int component_id;		/* identifier for this component (0..255) */
+  int component_index;		/* its index in SOF or cinfo->comp_info[] */
+  int h_samp_factor;		/* horizontal sampling factor (1..4) */
+  int v_samp_factor;		/* vertical sampling factor (1..4) */
+  int quant_tbl_no;		/* quantization table selector (0..3) */
+  /* These values may vary between scans. */
+  /* For compression, they must be supplied by parameter setup; */
+  /* for decompression, they are read from the SOS marker. */
+  /* The decompressor output side may not use these variables. */
+  int dc_tbl_no;		/* DC entropy table selector (0..3) */
+  int ac_tbl_no;		/* AC entropy table selector (0..3) */
+  
+  /* Remaining fields should be treated as private by applications. */
+  
+  /* These values are computed during compression or decompression startup: */
+  /* Component's size in DCT blocks.
+   * Any dummy blocks added to complete an MCU are not counted; therefore
+   * these values do not depend on whether a scan is interleaved or not.
+   */
+  JDIMENSION width_in_blocks;
+  JDIMENSION height_in_blocks;
+  /* Size of a DCT block in samples.  Always DCTSIZE for compression.
+   * For decompression this is the size of the output from one DCT block,
+   * reflecting any scaling we choose to apply during the IDCT step.
+   * Values of 1,2,4,8 are likely to be supported.  Note that different
+   * components may receive different IDCT scalings.
+   */
+  int DCT_scaled_size;
+  /* The downsampled dimensions are the component's actual, unpadded number
+   * of samples at the main buffer (preprocessing/compression interface), thus
+   * downsampled_width = ceil(image_width * Hi/Hmax)
+   * and similarly for height.  For decompression, IDCT scaling is included, so
+   * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
+   */
+  JDIMENSION downsampled_width;	 /* actual width in samples */
+  JDIMENSION downsampled_height; /* actual height in samples */
+  /* This flag is used only for decompression.  In cases where some of the
+   * components will be ignored (eg grayscale output from YCbCr image),
+   * we can skip most computations for the unused components.
+   */
+  boolean component_needed;	/* do we need the value of this component? */
+
+  /* These values are computed before starting a scan of the component. */
+  /* The decompressor output side may not use these variables. */
+  int MCU_width;		/* number of blocks per MCU, horizontally */
+  int MCU_height;		/* number of blocks per MCU, vertically */
+  int MCU_blocks;		/* MCU_width * MCU_height */
+  int MCU_sample_width;		/* MCU width in samples, MCU_width*DCT_scaled_size */
+  int last_col_width;		/* # of non-dummy blocks across in last MCU */
+  int last_row_height;		/* # of non-dummy blocks down in last MCU */
+
+  /* Saved quantization table for component; NULL if none yet saved.
+   * See jdinput.c comments about the need for this information.
+   * This field is currently used only for decompression.
+   */
+  JQUANT_TBL * quant_table;
+
+  /* Private per-component storage for DCT or IDCT subsystem. */
+  void * dct_table;
+} jpeg_component_info;
+
+
+/* The script for encoding a multiple-scan file is an array of these: */
+
+typedef struct {
+  int comps_in_scan;		/* number of components encoded in this scan */
+  int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
+  int Ss, Se;			/* progressive JPEG spectral selection parms */
+  int Ah, Al;			/* progressive JPEG successive approx. parms */
+} jpeg_scan_info;
+
+/* The decompressor can save APPn and COM markers in a list of these: */
+
+typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr;
+
+struct jpeg_marker_struct {
+  jpeg_saved_marker_ptr next;	/* next in list, or NULL */
+  UINT8 marker;			/* marker code: JPEG_COM, or JPEG_APP0+n */
+  unsigned int original_length;	/* # bytes of data in the file */
+  unsigned int data_length;	/* # bytes of data saved at data[] */
+  JOCTET FAR * data;		/* the data contained in the marker */
+  /* the marker length word is not counted in data_length or original_length */
+};
+
+/* Known color spaces. */
+
+typedef enum {
+	JCS_UNKNOWN,		/* error/unspecified */
+	JCS_GRAYSCALE,		/* monochrome */
+	JCS_RGB,		/* red/green/blue */
+	JCS_YCbCr,		/* Y/Cb/Cr (also known as YUV) */
+	JCS_CMYK,		/* C/M/Y/K */
+	JCS_YCCK		/* Y/Cb/Cr/K */
+} J_COLOR_SPACE;
+
+/* DCT/IDCT algorithm options. */
+
+typedef enum {
+	JDCT_ISLOW,		/* slow but accurate integer algorithm */
+	JDCT_IFAST,		/* faster, less accurate integer method */
+	JDCT_FLOAT		/* floating-point: accurate, fast on fast HW */
+} J_DCT_METHOD;
+
+#ifndef JDCT_DEFAULT		/* may be overridden in jconfig.h */
+#define JDCT_DEFAULT  JDCT_ISLOW
+#endif
+#ifndef JDCT_FASTEST		/* may be overridden in jconfig.h */
+#define JDCT_FASTEST  JDCT_IFAST
+#endif
+
+/* Dithering options for decompression. */
+
+typedef enum {
+	JDITHER_NONE,		/* no dithering */
+	JDITHER_ORDERED,	/* simple ordered dither */
+	JDITHER_FS		/* Floyd-Steinberg error diffusion dither */
+} J_DITHER_MODE;
+
+
+/* Common fields between JPEG compression and decompression master structs. */
+
+#define jpeg_common_fields \
+  struct jpeg_error_mgr * err;	/* Error handler module */\
+  struct jpeg_memory_mgr * mem;	/* Memory manager module */\
+  struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
+  void * client_data;		/* Available for use by application */\
+  boolean is_decompressor;	/* So common code can tell which is which */\
+  int global_state		/* For checking call sequence validity */
+
+/* Routines that are to be used by both halves of the library are declared
+ * to receive a pointer to this structure.  There are no actual instances of
+ * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
+ */
+struct jpeg_common_struct {
+  jpeg_common_fields;		/* Fields common to both master struct types */
+  /* Additional fields follow in an actual jpeg_compress_struct or
+   * jpeg_decompress_struct.  All three structs must agree on these
+   * initial fields!  (This would be a lot cleaner in C++.)
+   */
+};
+
+typedef struct jpeg_common_struct * j_common_ptr;
+typedef struct jpeg_compress_struct * j_compress_ptr;
+typedef struct jpeg_decompress_struct * j_decompress_ptr;
+
+
+/* Master record for a compression instance */
+
+struct jpeg_compress_struct {
+  jpeg_common_fields;		/* Fields shared with jpeg_decompress_struct */
+
+  /* Destination for compressed data */
+  struct jpeg_destination_mgr * dest;
+
+  /* Description of source image --- these fields must be filled in by
+   * outer application before starting compression.  in_color_space must
+   * be correct before you can even call jpeg_set_defaults().
+   */
+
+  JDIMENSION image_width;	/* input image width */
+  JDIMENSION image_height;	/* input image height */
+  int input_components;		/* # of color components in input image */
+  J_COLOR_SPACE in_color_space;	/* colorspace of input image */
+
+  double input_gamma;		/* image gamma of input image */
+
+  /* Compression parameters --- these fields must be set before calling
+   * jpeg_start_compress().  We recommend calling jpeg_set_defaults() to
+   * initialize everything to reasonable defaults, then changing anything
+   * the application specifically wants to change.  That way you won't get
+   * burnt when new parameters are added.  Also note that there are several
+   * helper routines to simplify changing parameters.
+   */
+
+  int data_precision;		/* bits of precision in image data */
+
+  int num_components;		/* # of color components in JPEG image */
+  J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
+
+  jpeg_component_info * comp_info;
+  /* comp_info[i] describes component that appears i'th in SOF */
+  
+  JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
+  /* ptrs to coefficient quantization tables, or NULL if not defined */
+  
+  JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
+  JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
+  /* ptrs to Huffman coding tables, or NULL if not defined */
+  
+  UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
+  UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
+  UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
+
+  int num_scans;		/* # of entries in scan_info array */
+  const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */
+  /* The default value of scan_info is NULL, which causes a single-scan
+   * sequential JPEG file to be emitted.  To create a multi-scan file,
+   * set num_scans and scan_info to point to an array of scan definitions.
+   */
+
+  boolean raw_data_in;		/* TRUE=caller supplies downsampled data */
+  boolean arith_code;		/* TRUE=arithmetic coding, FALSE=Huffman */
+  boolean optimize_coding;	/* TRUE=optimize entropy encoding parms */
+  boolean CCIR601_sampling;	/* TRUE=first samples are cosited */
+  int smoothing_factor;		/* 1..100, or 0 for no input smoothing */
+  J_DCT_METHOD dct_method;	/* DCT algorithm selector */
+
+  /* The restart interval can be specified in absolute MCUs by setting
+   * restart_interval, or in MCU rows by setting restart_in_rows
+   * (in which case the correct restart_interval will be figured
+   * for each scan).
+   */
+  unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
+  int restart_in_rows;		/* if > 0, MCU rows per restart interval */
+
+  /* Parameters controlling emission of special markers. */
+
+  boolean write_JFIF_header;	/* should a JFIF marker be written? */
+  UINT8 JFIF_major_version;	/* What to write for the JFIF version number */
+  UINT8 JFIF_minor_version;
+  /* These three values are not used by the JPEG code, merely copied */
+  /* into the JFIF APP0 marker.  density_unit can be 0 for unknown, */
+  /* 1 for dots/inch, or 2 for dots/cm.  Note that the pixel aspect */
+  /* ratio is defined by X_density/Y_density even when density_unit=0. */
+  UINT8 density_unit;		/* JFIF code for pixel size units */
+  UINT16 X_density;		/* Horizontal pixel density */
+  UINT16 Y_density;		/* Vertical pixel density */
+  boolean write_Adobe_marker;	/* should an Adobe marker be written? */
+  
+  /* State variable: index of next scanline to be written to
+   * jpeg_write_scanlines().  Application may use this to control its
+   * processing loop, e.g., "while (next_scanline < image_height)".
+   */
+
+  JDIMENSION next_scanline;	/* 0 .. image_height-1  */
+
+  /* Remaining fields are known throughout compressor, but generally
+   * should not be touched by a surrounding application.
+   */
+
+  /*
+   * These fields are computed during compression startup
+   */
+  boolean progressive_mode;	/* TRUE if scan script uses progressive mode */
+  int max_h_samp_factor;	/* largest h_samp_factor */
+  int max_v_samp_factor;	/* largest v_samp_factor */
+
+  JDIMENSION total_iMCU_rows;	/* # of iMCU rows to be input to coef ctlr */
+  /* The coefficient controller receives data in units of MCU rows as defined
+   * for fully interleaved scans (whether the JPEG file is interleaved or not).
+   * There are v_samp_factor * DCTSIZE sample rows of each component in an
+   * "iMCU" (interleaved MCU) row.
+   */
+  
+  /*
+   * These fields are valid during any one scan.
+   * They describe the components and MCUs actually appearing in the scan.
+   */
+  int comps_in_scan;		/* # of JPEG components in this scan */
+  jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
+  /* *cur_comp_info[i] describes component that appears i'th in SOS */
+  
+  JDIMENSION MCUs_per_row;	/* # of MCUs across the image */
+  JDIMENSION MCU_rows_in_scan;	/* # of MCU rows in the image */
+  
+  int blocks_in_MCU;		/* # of DCT blocks per MCU */
+  int MCU_membership[C_MAX_BLOCKS_IN_MCU];
+  /* MCU_membership[i] is index in cur_comp_info of component owning */
+  /* i'th block in an MCU */
+
+  int Ss, Se, Ah, Al;		/* progressive JPEG parameters for scan */
+
+  /*
+   * Links to compression subobjects (methods and private variables of modules)
+   */
+  struct jpeg_comp_master * master;
+  struct jpeg_c_main_controller * main;
+  struct jpeg_c_prep_controller * prep;
+  struct jpeg_c_coef_controller * coef;
+  struct jpeg_marker_writer * marker;
+  struct jpeg_color_converter * cconvert;
+  struct jpeg_downsampler * downsample;
+  struct jpeg_forward_dct * fdct;
+  struct jpeg_entropy_encoder * entropy;
+  jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */
+  int script_space_size;
+};
+
+
+/* Master record for a decompression instance */
+
+struct jpeg_decompress_struct {
+  jpeg_common_fields;		/* Fields shared with jpeg_compress_struct */
+
+  /* Source of compressed data */
+  struct jpeg_source_mgr * src;
+
+  /* Basic description of image --- filled in by jpeg_read_header(). */
+  /* Application may inspect these values to decide how to process image. */
+
+  JDIMENSION image_width;	/* nominal image width (from SOF marker) */
+  JDIMENSION image_height;	/* nominal image height */
+  int num_components;		/* # of color components in JPEG image */
+  J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
+
+  /* Decompression processing parameters --- these fields must be set before
+   * calling jpeg_start_decompress().  Note that jpeg_read_header() initializes
+   * them to default values.
+   */
+
+  J_COLOR_SPACE out_color_space; /* colorspace for output */
+
+  unsigned int scale_num, scale_denom; /* fraction by which to scale image */
+
+  double output_gamma;		/* image gamma wanted in output */
+
+  boolean buffered_image;	/* TRUE=multiple output passes */
+  boolean raw_data_out;		/* TRUE=downsampled data wanted */
+
+  J_DCT_METHOD dct_method;	/* IDCT algorithm selector */
+  boolean do_fancy_upsampling;	/* TRUE=apply fancy upsampling */
+  boolean do_block_smoothing;	/* TRUE=apply interblock smoothing */
+
+  boolean quantize_colors;	/* TRUE=colormapped output wanted */
+  /* the following are ignored if not quantize_colors: */
+  J_DITHER_MODE dither_mode;	/* type of color dithering to use */
+  boolean two_pass_quantize;	/* TRUE=use two-pass color quantization */
+  int desired_number_of_colors;	/* max # colors to use in created colormap */
+  /* these are significant only in buffered-image mode: */
+  boolean enable_1pass_quant;	/* enable future use of 1-pass quantizer */
+  boolean enable_external_quant;/* enable future use of external colormap */
+  boolean enable_2pass_quant;	/* enable future use of 2-pass quantizer */
+
+  /* Description of actual output image that will be returned to application.
+   * These fields are computed by jpeg_start_decompress().
+   * You can also use jpeg_calc_output_dimensions() to determine these values
+   * in advance of calling jpeg_start_decompress().
+   */
+
+  JDIMENSION output_width;	/* scaled image width */
+  JDIMENSION output_height;	/* scaled image height */
+  int out_color_components;	/* # of color components in out_color_space */
+  int output_components;	/* # of color components returned */
+  /* output_components is 1 (a colormap index) when quantizing colors;
+   * otherwise it equals out_color_components.
+   */
+  int rec_outbuf_height;	/* min recommended height of scanline buffer */
+  /* If the buffer passed to jpeg_read_scanlines() is less than this many rows
+   * high, space and time will be wasted due to unnecessary data copying.
+   * Usually rec_outbuf_height will be 1 or 2, at most 4.
+   */
+
+  /* When quantizing colors, the output colormap is described by these fields.
+   * The application can supply a colormap by setting colormap non-NULL before
+   * calling jpeg_start_decompress; otherwise a colormap is created during
+   * jpeg_start_decompress or jpeg_start_output.
+   * The map has out_color_components rows and actual_number_of_colors columns.
+   */
+  int actual_number_of_colors;	/* number of entries in use */
+  JSAMPARRAY colormap;		/* The color map as a 2-D pixel array */
+
+  /* State variables: these variables indicate the progress of decompression.
+   * The application may examine these but must not modify them.
+   */
+
+  /* Row index of next scanline to be read from jpeg_read_scanlines().
+   * Application may use this to control its processing loop, e.g.,
+   * "while (output_scanline < output_height)".
+   */
+  JDIMENSION output_scanline;	/* 0 .. output_height-1  */
+
+  /* Current input scan number and number of iMCU rows completed in scan.
+   * These indicate the progress of the decompressor input side.
+   */
+  int input_scan_number;	/* Number of SOS markers seen so far */
+  JDIMENSION input_iMCU_row;	/* Number of iMCU rows completed */
+
+  /* The "output scan number" is the notional scan being displayed by the
+   * output side.  The decompressor will not allow output scan/row number
+   * to get ahead of input scan/row, but it can fall arbitrarily far behind.
+   */
+  int output_scan_number;	/* Nominal scan number being displayed */
+  JDIMENSION output_iMCU_row;	/* Number of iMCU rows read */
+
+  /* Current progression status.  coef_bits[c][i] indicates the precision
+   * with which component c's DCT coefficient i (in zigzag order) is known.
+   * It is -1 when no data has yet been received, otherwise it is the point
+   * transform (shift) value for the most recent scan of the coefficient
+   * (thus, 0 at completion of the progression).
+   * This pointer is NULL when reading a non-progressive file.
+   */
+  int (*coef_bits)[DCTSIZE2];	/* -1 or current Al value for each coef */
+
+  /* Internal JPEG parameters --- the application usually need not look at
+   * these fields.  Note that the decompressor output side may not use
+   * any parameters that can change between scans.
+   */
+
+  /* Quantization and Huffman tables are carried forward across input
+   * datastreams when processing abbreviated JPEG datastreams.
+   */
+
+  JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
+  /* ptrs to coefficient quantization tables, or NULL if not defined */
+
+  JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
+  JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
+  /* ptrs to Huffman coding tables, or NULL if not defined */
+
+  /* These parameters are never carried across datastreams, since they
+   * are given in SOF/SOS markers or defined to be reset by SOI.
+   */
+
+  int data_precision;		/* bits of precision in image data */
+
+  jpeg_component_info * comp_info;
+  /* comp_info[i] describes component that appears i'th in SOF */
+
+  boolean progressive_mode;	/* TRUE if SOFn specifies progressive mode */
+  boolean arith_code;		/* TRUE=arithmetic coding, FALSE=Huffman */
+
+  UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
+  UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
+  UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
+
+  unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
+
+  /* These fields record data obtained from optional markers recognized by
+   * the JPEG library.
+   */
+  boolean saw_JFIF_marker;	/* TRUE iff a JFIF APP0 marker was found */
+  /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
+  UINT8 JFIF_major_version;	/* JFIF version number */
+  UINT8 JFIF_minor_version;
+  UINT8 density_unit;		/* JFIF code for pixel size units */
+  UINT16 X_density;		/* Horizontal pixel density */
+  UINT16 Y_density;		/* Vertical pixel density */
+  boolean saw_Adobe_marker;	/* TRUE iff an Adobe APP14 marker was found */
+  UINT8 Adobe_transform;	/* Color transform code from Adobe marker */
+
+  boolean CCIR601_sampling;	/* TRUE=first samples are cosited */
+
+  /* Aside from the specific data retained from APPn markers known to the
+   * library, the uninterpreted contents of any or all APPn and COM markers
+   * can be saved in a list for examination by the application.
+   */
+  jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
+
+  /* Remaining fields are known throughout decompressor, but generally
+   * should not be touched by a surrounding application.
+   */
+
+  /*
+   * These fields are computed during decompression startup
+   */
+  int max_h_samp_factor;	/* largest h_samp_factor */
+  int max_v_samp_factor;	/* largest v_samp_factor */
+
+  int min_DCT_scaled_size;	/* smallest DCT_scaled_size of any component */
+
+  JDIMENSION total_iMCU_rows;	/* # of iMCU rows in image */
+  /* The coefficient controller's input and output progress is measured in
+   * units of "iMCU" (interleaved MCU) rows.  These are the same as MCU rows
+   * in fully interleaved JPEG scans, but are used whether the scan is
+   * interleaved or not.  We define an iMCU row as v_samp_factor DCT block
+   * rows of each component.  Therefore, the IDCT output contains
+   * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
+   */
+
+  JSAMPLE * sample_range_limit; /* table for fast range-limiting */
+
+  /*
+   * These fields are valid during any one scan.
+   * They describe the components and MCUs actually appearing in the scan.
+   * Note that the decompressor output side must not use these fields.
+   */
+  int comps_in_scan;		/* # of JPEG components in this scan */
+  jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
+  /* *cur_comp_info[i] describes component that appears i'th in SOS */
+
+  JDIMENSION MCUs_per_row;	/* # of MCUs across the image */
+  JDIMENSION MCU_rows_in_scan;	/* # of MCU rows in the image */
+
+  int blocks_in_MCU;		/* # of DCT blocks per MCU */
+  int MCU_membership[D_MAX_BLOCKS_IN_MCU];
+  /* MCU_membership[i] is index in cur_comp_info of component owning */
+  /* i'th block in an MCU */
+
+  int Ss, Se, Ah, Al;		/* progressive JPEG parameters for scan */
+
+  /* This field is shared between entropy decoder and marker parser.
+   * It is either zero or the code of a JPEG marker that has been
+   * read from the data source, but has not yet been processed.
+   */
+  int unread_marker;
+
+  /*
+   * Links to decompression subobjects (methods, private variables of modules)
+   */
+  struct jpeg_decomp_master * master;
+  struct jpeg_d_main_controller * main;
+  struct jpeg_d_coef_controller * coef;
+  struct jpeg_d_post_controller * post;
+  struct jpeg_input_controller * inputctl;
+  struct jpeg_marker_reader * marker;
+  struct jpeg_entropy_decoder * entropy;
+  struct jpeg_inverse_dct * idct;
+  struct jpeg_upsampler * upsample;
+  struct jpeg_color_deconverter * cconvert;
+  struct jpeg_color_quantizer * cquantize;
+};
+
+
+/* "Object" declarations for JPEG modules that may be supplied or called
+ * directly by the surrounding application.
+ * As with all objects in the JPEG library, these structs only define the
+ * publicly visible methods and state variables of a module.  Additional
+ * private fields may exist after the public ones.
+ */
+
+
+/* Error handler object */
+
+struct jpeg_error_mgr {
+  /* Error exit handler: does not return to caller */
+  JMETHOD(void, error_exit, (j_common_ptr cinfo));
+  /* Conditionally emit a trace or warning message */
+  JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
+  /* Routine that actually outputs a trace or error message */
+  JMETHOD(void, output_message, (j_common_ptr cinfo));
+  /* Format a message string for the most recent JPEG error or message */
+  JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));
+#define JMSG_LENGTH_MAX  200	/* recommended size of format_message buffer */
+  /* Reset error state variables at start of a new image */
+  JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
+  
+  /* The message ID code and any parameters are saved here.
+   * A message can have one string parameter or up to 8 int parameters.
+   */
+  int msg_code;
+#define JMSG_STR_PARM_MAX  80
+  union {
+    int i[8];
+    char s[JMSG_STR_PARM_MAX];
+  } msg_parm;
+  
+  /* Standard state variables for error facility */
+  
+  int trace_level;		/* max msg_level that will be displayed */
+  
+  /* For recoverable corrupt-data errors, we emit a warning message,
+   * but keep going unless emit_message chooses to abort.  emit_message
+   * should count warnings in num_warnings.  The surrounding application
+   * can check for bad data by seeing if num_warnings is nonzero at the
+   * end of processing.
+   */
+  long num_warnings;		/* number of corrupt-data warnings */
+
+  /* These fields point to the table(s) of error message strings.
+   * An application can change the table pointer to switch to a different
+   * message list (typically, to change the language in which errors are
+   * reported).  Some applications may wish to add additional error codes
+   * that will be handled by the JPEG library error mechanism; the second
+   * table pointer is used for this purpose.
+   *
+   * First table includes all errors generated by JPEG library itself.
+   * Error code 0 is reserved for a "no such error string" message.
+   */
+  const char * const * jpeg_message_table; /* Library errors */
+  int last_jpeg_message;    /* Table contains strings 0..last_jpeg_message */
+  /* Second table can be added by application (see cjpeg/djpeg for example).
+   * It contains strings numbered first_addon_message..last_addon_message.
+   */
+  const char * const * addon_message_table; /* Non-library errors */
+  int first_addon_message;	/* code for first string in addon table */
+  int last_addon_message;	/* code for last string in addon table */
+};
+
+
+/* Progress monitor object */
+
+struct jpeg_progress_mgr {
+  JMETHOD(void, progress_monitor, (j_common_ptr cinfo));
+
+  long pass_counter;		/* work units completed in this pass */
+  long pass_limit;		/* total number of work units in this pass */
+  int completed_passes;		/* passes completed so far */
+  int total_passes;		/* total number of passes expected */
+};
+
+
+/* Data destination object for compression */
+
+struct jpeg_destination_mgr {
+  JOCTET * next_output_byte;	/* => next byte to write in buffer */
+  size_t free_in_buffer;	/* # of byte spaces remaining in buffer */
+
+  JMETHOD(void, init_destination, (j_compress_ptr cinfo));
+  JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));
+  JMETHOD(void, term_destination, (j_compress_ptr cinfo));
+};
+
+
+/* Data source object for decompression */
+
+struct jpeg_source_mgr {
+  const JOCTET * next_input_byte; /* => next byte to read from buffer */
+  size_t bytes_in_buffer;	/* # of bytes remaining in buffer */
+
+  JMETHOD(void, init_source, (j_decompress_ptr cinfo));
+  JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));
+  JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));
+  JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired));
+  JMETHOD(void, term_source, (j_decompress_ptr cinfo));
+};
+
+
+/* Memory manager object.
+ * Allocates "small" objects (a few K total), "large" objects (tens of K),
+ * and "really big" objects (virtual arrays with backing store if needed).
+ * The memory manager does not allow individual objects to be freed; rather,
+ * each created object is assigned to a pool, and whole pools can be freed
+ * at once.  This is faster and more convenient than remembering exactly what
+ * to free, especially where malloc()/free() are not too speedy.
+ * NB: alloc routines never return NULL.  They exit to error_exit if not
+ * successful.
+ */
+
+#define JPOOL_PERMANENT	0	/* lasts until master record is destroyed */
+#define JPOOL_IMAGE	1	/* lasts until done with image/datastream */
+#define JPOOL_NUMPOOLS	2
+
+typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
+typedef struct jvirt_barray_control * jvirt_barray_ptr;
+
+
+struct jpeg_memory_mgr {
+  /* Method pointers */
+  JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,
+				size_t sizeofobject));
+  JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,
+				     size_t sizeofobject));
+  JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
+				     JDIMENSION samplesperrow,
+				     JDIMENSION numrows));
+  JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
+				      JDIMENSION blocksperrow,
+				      JDIMENSION numrows));
+  JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
+						  int pool_id,
+						  boolean pre_zero,
+						  JDIMENSION samplesperrow,
+						  JDIMENSION numrows,
+						  JDIMENSION maxaccess));
+  JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
+						  int pool_id,
+						  boolean pre_zero,
+						  JDIMENSION blocksperrow,
+						  JDIMENSION numrows,
+						  JDIMENSION maxaccess));
+  JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));
+  JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,
+					   jvirt_sarray_ptr ptr,
+					   JDIMENSION start_row,
+					   JDIMENSION num_rows,
+					   boolean writable));
+  JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,
+					    jvirt_barray_ptr ptr,
+					    JDIMENSION start_row,
+					    JDIMENSION num_rows,
+					    boolean writable));
+  JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));
+  JMETHOD(void, self_destruct, (j_common_ptr cinfo));
+
+  /* Limit on memory allocation for this JPEG object.  (Note that this is
+   * merely advisory, not a guaranteed maximum; it only affects the space
+   * used for virtual-array buffers.)  May be changed by outer application
+   * after creating the JPEG object.
+   */
+  long max_memory_to_use;
+
+  /* Maximum allocation request accepted by alloc_large. */
+  long max_alloc_chunk;
+};
+
+
+/* Routine signature for application-supplied marker processing methods.
+ * Need not pass marker code since it is stored in cinfo->unread_marker.
+ */
+typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
+
+
+/* Declarations for routines called by application.
+ * The JPP macro hides prototype parameters from compilers that can't cope.
+ * Note JPP requires double parentheses.
+ */
+
+#ifdef HAVE_PROTOTYPES
+#define JPP(arglist)	arglist
+#else
+#define JPP(arglist)	()
+#endif
+
+
+/* Short forms of external names for systems with brain-damaged linkers.
+ * We shorten external names to be unique in the first six letters, which
+ * is good enough for all known systems.
+ * (If your compiler itself needs names to be unique in less than 15 
+ * characters, you are out of luck.  Get a better compiler.)
+ */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jpeg_std_error		jStdError
+#define jpeg_CreateCompress	jCreaCompress
+#define jpeg_CreateDecompress	jCreaDecompress
+#define jpeg_destroy_compress	jDestCompress
+#define jpeg_destroy_decompress	jDestDecompress
+#define jpeg_stdio_dest		jStdDest
+#define jpeg_stdio_src		jStdSrc
+#define jpeg_set_defaults	jSetDefaults
+#define jpeg_set_colorspace	jSetColorspace
+#define jpeg_default_colorspace	jDefColorspace
+#define jpeg_set_quality	jSetQuality
+#define jpeg_set_linear_quality	jSetLQuality
+#define jpeg_add_quant_table	jAddQuantTable
+#define jpeg_quality_scaling	jQualityScaling
+#define jpeg_simple_progression	jSimProgress
+#define jpeg_suppress_tables	jSuppressTables
+#define jpeg_alloc_quant_table	jAlcQTable
+#define jpeg_alloc_huff_table	jAlcHTable
+#define jpeg_start_compress	jStrtCompress
+#define jpeg_write_scanlines	jWrtScanlines
+#define jpeg_finish_compress	jFinCompress
+#define jpeg_write_raw_data	jWrtRawData
+#define jpeg_write_marker	jWrtMarker
+#define jpeg_write_m_header	jWrtMHeader
+#define jpeg_write_m_byte	jWrtMByte
+#define jpeg_write_tables	jWrtTables
+#define jpeg_read_header	jReadHeader
+#define jpeg_start_decompress	jStrtDecompress
+#define jpeg_read_scanlines	jReadScanlines
+#define jpeg_finish_decompress	jFinDecompress
+#define jpeg_read_raw_data	jReadRawData
+#define jpeg_has_multiple_scans	jHasMultScn
+#define jpeg_start_output	jStrtOutput
+#define jpeg_finish_output	jFinOutput
+#define jpeg_input_complete	jInComplete
+#define jpeg_new_colormap	jNewCMap
+#define jpeg_consume_input	jConsumeInput
+#define jpeg_calc_output_dimensions	jCalcDimensions
+#define jpeg_save_markers	jSaveMarkers
+#define jpeg_set_marker_processor	jSetMarker
+#define jpeg_read_coefficients	jReadCoefs
+#define jpeg_write_coefficients	jWrtCoefs
+#define jpeg_copy_critical_parameters	jCopyCrit
+#define jpeg_abort_compress	jAbrtCompress
+#define jpeg_abort_decompress	jAbrtDecompress
+#define jpeg_abort		jAbort
+#define jpeg_destroy		jDestroy
+#define jpeg_resync_to_restart	jResyncRestart
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+
+/* Default error-management setup */
+EXTERN(struct jpeg_error_mgr *) jpeg_std_error
+	JPP((struct jpeg_error_mgr * err));
+
+/* Initialization of JPEG compression objects.
+ * jpeg_create_compress() and jpeg_create_decompress() are the exported
+ * names that applications should call.  These expand to calls on
+ * jpeg_CreateCompress and jpeg_CreateDecompress with additional information
+ * passed for version mismatch checking.
+ * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.
+ */
+#define jpeg_create_compress(cinfo) \
+    jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
+			(size_t) sizeof(struct jpeg_compress_struct))
+#define jpeg_create_decompress(cinfo) \
+    jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
+			  (size_t) sizeof(struct jpeg_decompress_struct))
+EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo,
+				      int version, size_t structsize));
+EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo,
+					int version, size_t structsize));
+/* Destruction of JPEG compression objects */
+EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo));
+EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
+
+/* Standard data source and destination managers: stdio streams. */
+/* Caller is responsible for opening the file before and closing after. */
+EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
+EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
+
+/* Default parameter setup for compression */
+EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
+/* Compression parameter setup aids */
+EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo,
+				      J_COLOR_SPACE colorspace));
+EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo));
+EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
+				   boolean force_baseline));
+EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
+					  int scale_factor,
+					  boolean force_baseline));
+EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
+				       const unsigned int *basic_table,
+				       int scale_factor,
+				       boolean force_baseline));
+EXTERN(int) jpeg_quality_scaling JPP((int quality));
+EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo));
+EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo,
+				       boolean suppress));
+EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo));
+EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo));
+
+/* Main entry points for compression */
+EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,
+				      boolean write_all_tables));
+EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo,
+					     JSAMPARRAY scanlines,
+					     JDIMENSION num_lines));
+EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));
+
+/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
+EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,
+					    JSAMPIMAGE data,
+					    JDIMENSION num_lines));
+
+/* Write a special marker.  See libjpeg.doc concerning safe usage. */
+EXTERN(void) jpeg_write_marker
+	JPP((j_compress_ptr cinfo, int marker,
+	     const JOCTET * dataptr, unsigned int datalen));
+/* Same, but piecemeal. */
+EXTERN(void) jpeg_write_m_header
+	JPP((j_compress_ptr cinfo, int marker, unsigned int datalen));
+EXTERN(void) jpeg_write_m_byte
+	JPP((j_compress_ptr cinfo, int val));
+
+/* Alternate compression function: just write an abbreviated table file */
+EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo));
+
+/* Decompression startup: read start of JPEG datastream to see what's there */
+EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
+				  boolean require_image));
+/* Return value is one of: */
+#define JPEG_SUSPENDED		0 /* Suspended due to lack of input data */
+#define JPEG_HEADER_OK		1 /* Found valid image datastream */
+#define JPEG_HEADER_TABLES_ONLY	2 /* Found valid table-specs-only datastream */
+/* If you pass require_image = TRUE (normal case), you need not check for
+ * a TABLES_ONLY return code; an abbreviated file will cause an error exit.
+ * JPEG_SUSPENDED is only possible if you use a data source module that can
+ * give a suspension return (the stdio source module doesn't).
+ */
+
+/* Main entry points for decompression */
+EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo));
+EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo,
+					    JSAMPARRAY scanlines,
+					    JDIMENSION max_lines));
+EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo));
+
+/* Replaces jpeg_read_scanlines when reading raw downsampled data. */
+EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo,
+					   JSAMPIMAGE data,
+					   JDIMENSION max_lines));
+
+/* Additional entry points for buffered-image mode. */
+EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));
+EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo,
+				       int scan_number));
+EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo));
+EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo));
+EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo));
+EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));
+/* Return value is one of: */
+/* #define JPEG_SUSPENDED	0    Suspended due to lack of input data */
+#define JPEG_REACHED_SOS	1 /* Reached start of new scan */
+#define JPEG_REACHED_EOI	2 /* Reached end of image */
+#define JPEG_ROW_COMPLETED	3 /* Completed one iMCU row */
+#define JPEG_SCAN_COMPLETED	4 /* Completed last iMCU row of a scan */
+
+/* Precalculate output dimensions for current decompression parameters. */
+EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
+
+/* Control saving of COM and APPn markers into marker_list. */
+EXTERN(void) jpeg_save_markers
+	JPP((j_decompress_ptr cinfo, int marker_code,
+	     unsigned int length_limit));
+
+/* Install a special processing method for COM or APPn markers. */
+EXTERN(void) jpeg_set_marker_processor
+	JPP((j_decompress_ptr cinfo, int marker_code,
+	     jpeg_marker_parser_method routine));
+
+/* Read or write raw DCT coefficients --- useful for lossless transcoding. */
+EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo));
+EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo,
+					  jvirt_barray_ptr * coef_arrays));
+EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,
+						j_compress_ptr dstinfo));
+
+/* If you choose to abort compression or decompression before completing
+ * jpeg_finish_(de)compress, then you need to clean up to release memory,
+ * temporary files, etc.  You can just call jpeg_destroy_(de)compress
+ * if you're done with the JPEG object, but if you want to clean it up and
+ * reuse it, call this:
+ */
+EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo));
+EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo));
+
+/* Generic versions of jpeg_abort and jpeg_destroy that work on either
+ * flavor of JPEG object.  These may be more convenient in some places.
+ */
+EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo));
+EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo));
+
+/* Default restart-marker-resync procedure for use by data source modules */
+EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,
+					    int desired));
+
+
+/* These marker codes are exported since applications and data source modules
+ * are likely to want to use them.
+ */
+
+#define JPEG_RST0	0xD0	/* RST0 marker code */
+#define JPEG_EOI	0xD9	/* EOI marker code */
+#define JPEG_APP0	0xE0	/* APP0 marker code */
+#define JPEG_COM	0xFE	/* COM marker code */
+
+
+/* If we have a brain-damaged compiler that emits warnings (or worse, errors)
+ * for structure definitions that are never filled in, keep it quiet by
+ * supplying dummy definitions for the various substructures.
+ */
+
+#ifdef INCOMPLETE_TYPES_BROKEN
+#ifndef JPEG_INTERNALS		/* will be defined in jpegint.h */
+struct jvirt_sarray_control { long dummy; };
+struct jvirt_barray_control { long dummy; };
+struct jpeg_comp_master { long dummy; };
+struct jpeg_c_main_controller { long dummy; };
+struct jpeg_c_prep_controller { long dummy; };
+struct jpeg_c_coef_controller { long dummy; };
+struct jpeg_marker_writer { long dummy; };
+struct jpeg_color_converter { long dummy; };
+struct jpeg_downsampler { long dummy; };
+struct jpeg_forward_dct { long dummy; };
+struct jpeg_entropy_encoder { long dummy; };
+struct jpeg_decomp_master { long dummy; };
+struct jpeg_d_main_controller { long dummy; };
+struct jpeg_d_coef_controller { long dummy; };
+struct jpeg_d_post_controller { long dummy; };
+struct jpeg_input_controller { long dummy; };
+struct jpeg_marker_reader { long dummy; };
+struct jpeg_entropy_decoder { long dummy; };
+struct jpeg_inverse_dct { long dummy; };
+struct jpeg_upsampler { long dummy; };
+struct jpeg_color_deconverter { long dummy; };
+struct jpeg_color_quantizer { long dummy; };
+#endif /* JPEG_INTERNALS */
+#endif /* INCOMPLETE_TYPES_BROKEN */
+
+
+/*
+ * The JPEG library modules define JPEG_INTERNALS before including this file.
+ * The internal structure declarations are read only when that is true.
+ * Applications using the library should not include jpegint.h, but may wish
+ * to include jerror.h.
+ */
+
+#ifdef JPEG_INTERNALS
+#include "jpegint.h"		/* fetch private declarations */
+#include "jerror.h"		/* fetch error codes too */
+#endif
+
+#endif /* JPEGLIB_H */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jpeglib.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jpeglib.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jpeglib.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2491 @@
+(This file must be converted with BinHex 4.0)
+
+:$fT`C at GXD@)ZF(*[DQ9MG!"069"b3eG*43!!!!(5CJ!!!!$+i'0[Ef`!!!!#!!!
+!+!!"a)J!!F5`!!!0YJ!!!)F"!!!!!!!!!!!!!!!!"3%!rrm!!!!!!!!!!2rr!3%
+"!3%!!!!!(J%"!!!!!!!!!!#CQ3!!2rmrrcrr!!%!#3C0EfjKBfm!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!"!!S!!S"`J+!!#J!#J(#!S!!!!!!!!!!!!!!!!!
+!!!!!!3!!!3!V!RN#Y`2k!!-!!l#T!!$jXJ!!!*X!!!#F!!!!R3!!!*i!!!#A!!!
+!QJ!!!*m!!!#J!!!!S3!!!*B!!!#C!!!!SJ!!!+-!!!#N!!!!T3!!!+B!!!#R!!!
+!U!!!!+N!!!#U!!!!U`!!!+`!!!#B!!!!XJ!!!,-!!!#d!!!!Y3!!!+i!!!#a!!!
+!YJ!!!,F!!!#i!!!!V3!!!,!!!!#j!!!!ZJ!!!,X!!!#m!!!![3!!!,i!!!#r!!!
+!`!!!!-%!!!$#!!!!``!!!+m!!!$*!!!!bJ!!!-X!!!$-!!!!a3!!!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!!!$Hm!!!!+F(*PCJ!#E&-!!!$Y!!!!!!!!!!"`V`!
+!!-4`FQ9Q!!+GC3!!!1i!!!!!!!!!!(54!!!"&R"bC at B!!M1B!!!!l`!!!!!!!!!
+!J6N!!!#kF(*PCJ!$)-%!!!$`!!!!!!!!!!!0q3!!!#j`FQ9Q!!**6`!!!2%!!!!
+!!!!!!)(c!!!#$("bC at B!!V83!!!!mJ!!RBF!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegtran.1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegtran.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegtran.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,238 @@
+.TH JPEGTRAN 1 "3 August 1997"
+.SH NAME
+jpegtran \- lossless transformation of JPEG files
+.SH SYNOPSIS
+.B jpegtran
+[
+.I options
+]
+[
+.I filename
+]
+.LP
+.SH DESCRIPTION
+.LP
+.B jpegtran
+performs various useful transformations of JPEG files.
+It can translate the coded representation from one variant of JPEG to another,
+for example from baseline JPEG to progressive JPEG or vice versa.  It can also
+perform some rearrangements of the image data, for example turning an image
+from landscape to portrait format by rotation.
+.PP
+.B jpegtran
+works by rearranging the compressed data (DCT coefficients), without
+ever fully decoding the image.  Therefore, its transformations are lossless:
+there is no image degradation at all, which would not be true if you used
+.B djpeg
+followed by
+.B cjpeg
+to accomplish the same conversion.  But by the same token,
+.B jpegtran
+cannot perform lossy operations such as changing the image quality.
+.PP
+.B jpegtran
+reads the named JPEG/JFIF file, or the standard input if no file is
+named, and produces a JPEG/JFIF file on the standard output.
+.SH OPTIONS
+All switch names may be abbreviated; for example,
+.B \-optimize
+may be written
+.B \-opt
+or
+.BR \-o .
+Upper and lower case are equivalent.
+British spellings are also accepted (e.g.,
+.BR \-optimise ),
+though for brevity these are not mentioned below.
+.PP
+To specify the coded JPEG representation used in the output file,
+.B jpegtran
+accepts a subset of the switches recognized by
+.BR cjpeg :
+.TP
+.B \-optimize
+Perform optimization of entropy encoding parameters.
+.TP
+.B \-progressive
+Create progressive JPEG file.
+.TP
+.BI \-restart " N"
+Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
+attached to the number.
+.TP
+.BI \-scans " file"
+Use the scan script given in the specified text file.
+.PP
+See
+.BR cjpeg (1)
+for more details about these switches.
+If you specify none of these switches, you get a plain baseline-JPEG output
+file.  The quality setting and so forth are determined by the input file.
+.PP
+The image can be losslessly transformed by giving one of these switches:
+.TP
+.B \-flip horizontal
+Mirror image horizontally (left-right).
+.TP
+.B \-flip vertical
+Mirror image vertically (top-bottom).
+.TP
+.B \-rotate 90
+Rotate image 90 degrees clockwise.
+.TP
+.B \-rotate 180
+Rotate image 180 degrees.
+.TP
+.B \-rotate 270
+Rotate image 270 degrees clockwise (or 90 ccw).
+.TP
+.B \-transpose
+Transpose image (across UL-to-LR axis).
+.TP
+.B \-transverse
+Transverse transpose (across UR-to-LL axis).
+.PP
+The transpose transformation has no restrictions regarding image dimensions.
+The other transformations operate rather oddly if the image dimensions are not
+a multiple of the iMCU size (usually 8 or 16 pixels), because they can only
+transform complete blocks of DCT coefficient data in the desired way.
+.PP
+.BR jpegtran 's
+default behavior when transforming an odd-size image is designed
+to preserve exact reversibility and mathematical consistency of the
+transformation set.  As stated, transpose is able to flip the entire image
+area.  Horizontal mirroring leaves any partial iMCU column at the right edge
+untouched, but is able to flip all rows of the image.  Similarly, vertical
+mirroring leaves any partial iMCU row at the bottom edge untouched, but is
+able to flip all columns.  The other transforms can be built up as sequences
+of transpose and flip operations; for consistency, their actions on edge
+pixels are defined to be the same as the end result of the corresponding
+transpose-and-flip sequence.
+.PP
+For practical use, you may prefer to discard any untransformable edge pixels
+rather than having a strange-looking strip along the right and/or bottom edges
+of a transformed image.  To do this, add the
+.B \-trim
+switch:
+.TP
+.B \-trim
+Drop non-transformable edge blocks.
+.PP
+Obviously, a transformation with
+.B \-trim
+is not reversible, so strictly speaking
+.B jpegtran
+with this switch is not lossless.  Also, the expected mathematical
+equivalences between the transformations no longer hold.  For example,
+.B \-rot 270 -trim
+trims only the bottom edge, but
+.B \-rot 90 -trim
+followed by
+.B \-rot 180 -trim
+trims both edges.
+.PP
+Another not-strictly-lossless transformation switch is:
+.TP
+.B \-grayscale
+Force grayscale output.
+.PP
+This option discards the chrominance channels if the input image is YCbCr
+(ie, a standard color JPEG), resulting in a grayscale JPEG file.  The
+luminance channel is preserved exactly, so this is a better method of reducing
+to grayscale than decompression, conversion, and recompression.  This switch
+is particularly handy for fixing a monochrome picture that was mistakenly
+encoded as a color JPEG.  (In such a case, the space savings from getting rid
+of the near-empty chroma channels won't be large; but the decoding time for
+a grayscale JPEG is substantially less than that for a color JPEG.)
+.PP
+.B jpegtran
+also recognizes these switches that control what to do with "extra" markers,
+such as comment blocks:
+.TP
+.B \-copy none
+Copy no extra markers from source file.  This setting suppresses all
+comments and other excess baggage present in the source file.
+.TP
+.B \-copy comments
+Copy only comment markers.  This setting copies comments from the source file,
+but discards any other inessential data.
+.TP
+.B \-copy all
+Copy all extra markers.  This setting preserves miscellaneous markers
+found in the source file, such as JFIF thumbnails and Photoshop settings.
+In some files these extra markers can be sizable.
+.PP
+The default behavior is
+.BR "\-copy comments" .
+(Note: in IJG releases v6 and v6a,
+.B jpegtran
+always did the equivalent of
+.BR "\-copy none" .)
+.PP
+Additional switches recognized by jpegtran are:
+.TP
+.BI \-maxmemory " N"
+Set limit for amount of memory to use in processing large images.  Value is
+in thousands of bytes, or millions of bytes if "M" is attached to the
+number.  For example,
+.B \-max 4m
+selects 4000000 bytes.  If more space is needed, temporary files will be used.
+.TP
+.BI \-outfile " name"
+Send output image to the named file, not to standard output.
+.TP
+.B \-verbose
+Enable debug printout.  More
+.BR \-v 's
+give more output.  Also, version information is printed at startup.
+.TP
+.B \-debug
+Same as
+.BR \-verbose .
+.SH EXAMPLES
+.LP
+This example converts a baseline JPEG file to progressive form:
+.IP
+.B jpegtran \-progressive
+.I foo.jpg
+.B >
+.I fooprog.jpg
+.PP
+This example rotates an image 90 degrees clockwise, discarding any
+unrotatable edge pixels:
+.IP
+.B jpegtran \-rot 90 -trim
+.I foo.jpg
+.B >
+.I foo90.jpg
+.SH ENVIRONMENT
+.TP
+.B JPEGMEM
+If this environment variable is set, its value is the default memory limit.
+The value is specified as described for the
+.B \-maxmemory
+switch.
+.B JPEGMEM
+overrides the default value specified when the program was compiled, and
+itself is overridden by an explicit
+.BR \-maxmemory .
+.SH SEE ALSO
+.BR cjpeg (1),
+.BR djpeg (1),
+.BR rdjpgcom (1),
+.BR wrjpgcom (1)
+.br
+Wallace, Gregory K.  "The JPEG Still Picture Compression Standard",
+Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
+.SH AUTHOR
+Independent JPEG Group
+.SH BUGS
+Arithmetic coding is not supported for legal reasons.
+.PP
+The transform options can't transform odd-size images perfectly.  Use
+.B \-trim
+if you don't like the results without it.
+.PP
+The entire image is read into memory and then written out again, even in
+cases where this isn't really necessary.  Expect swapping on large images,
+especially when using the more complex transform options.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegtran.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegtran.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jpegtran.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,504 @@
+/*
+ * jpegtran.c
+ *
+ * Copyright (C) 1995-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a command-line user interface for JPEG transcoding.
+ * It is very similar to cjpeg.c, but provides lossless transcoding between
+ * different JPEG file formats.  It also provides some lossless and sort-of-
+ * lossless transformations of JPEG data.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+#include "transupp.h"		/* Support routines for jpegtran */
+#include "jversion.h"		/* for version message */
+
+#ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
+#ifdef __MWERKS__
+#include <SIOUX.h>              /* Metrowerks needs this */
+#include <console.h>		/* ... and this */
+#endif
+#ifdef THINK_C
+#include <console.h>		/* Think declares it here */
+#endif
+#endif
+
+
+/*
+ * Argument-parsing code.
+ * The switch parser is designed to be useful with DOS-style command line
+ * syntax, ie, intermixed switches and file names, where only the switches
+ * to the left of a given file name affect processing of that file.
+ * The main program in this file doesn't actually use this capability...
+ */
+
+
+static const char * progname;	/* program name for error messages */
+static char * outfilename;	/* for -outfile switch */
+static JCOPY_OPTION copyoption;	/* -copy switch */
+static jpeg_transform_info transformoption; /* image transformation options */
+
+
+LOCAL(void)
+usage (void)
+/* complain about bad command line */
+{
+  fprintf(stderr, "usage: %s [switches] ", progname);
+#ifdef TWO_FILE_COMMANDLINE
+  fprintf(stderr, "inputfile outputfile\n");
+#else
+  fprintf(stderr, "[inputfile]\n");
+#endif
+
+  fprintf(stderr, "Switches (names may be abbreviated):\n");
+  fprintf(stderr, "  -copy none     Copy no extra markers from source file\n");
+  fprintf(stderr, "  -copy comments Copy only comment markers (default)\n");
+  fprintf(stderr, "  -copy all      Copy all extra markers\n");
+#ifdef ENTROPY_OPT_SUPPORTED
+  fprintf(stderr, "  -optimize      Optimize Huffman table (smaller file, but slow compression)\n");
+#endif
+#ifdef C_PROGRESSIVE_SUPPORTED
+  fprintf(stderr, "  -progressive   Create progressive JPEG file\n");
+#endif
+#if TRANSFORMS_SUPPORTED
+  fprintf(stderr, "Switches for modifying the image:\n");
+  fprintf(stderr, "  -grayscale     Reduce to grayscale (omit color data)\n");
+  fprintf(stderr, "  -flip [horizontal|vertical]  Mirror image (left-right or top-bottom)\n");
+  fprintf(stderr, "  -rotate [90|180|270]         Rotate image (degrees clockwise)\n");
+  fprintf(stderr, "  -transpose     Transpose image\n");
+  fprintf(stderr, "  -transverse    Transverse transpose image\n");
+  fprintf(stderr, "  -trim          Drop non-transformable edge blocks\n");
+#endif /* TRANSFORMS_SUPPORTED */
+  fprintf(stderr, "Switches for advanced users:\n");
+  fprintf(stderr, "  -restart N     Set restart interval in rows, or in blocks with B\n");
+  fprintf(stderr, "  -maxmemory N   Maximum memory to use (in kbytes)\n");
+  fprintf(stderr, "  -outfile name  Specify name for output file\n");
+  fprintf(stderr, "  -verbose  or  -debug   Emit debug output\n");
+  fprintf(stderr, "Switches for wizards:\n");
+#ifdef C_ARITH_CODING_SUPPORTED
+  fprintf(stderr, "  -arithmetic    Use arithmetic coding\n");
+#endif
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+  fprintf(stderr, "  -scans file    Create multi-scan JPEG per script file\n");
+#endif
+  exit(EXIT_FAILURE);
+}
+
+
+LOCAL(void)
+select_transform (JXFORM_CODE transform)
+/* Silly little routine to detect multiple transform options,
+ * which we can't handle.
+ */
+{
+#if TRANSFORMS_SUPPORTED
+  if (transformoption.transform == JXFORM_NONE ||
+      transformoption.transform == transform) {
+    transformoption.transform = transform;
+  } else {
+    fprintf(stderr, "%s: can only do one image transformation at a time\n",
+	    progname);
+    usage();
+  }
+#else
+  fprintf(stderr, "%s: sorry, image transformation was not compiled\n",
+	  progname);
+  exit(EXIT_FAILURE);
+#endif
+}
+
+
+LOCAL(int)
+parse_switches (j_compress_ptr cinfo, int argc, char **argv,
+		int last_file_arg_seen, boolean for_real)
+/* Parse optional switches.
+ * Returns argv[] index of first file-name argument (== argc if none).
+ * Any file names with indexes <= last_file_arg_seen are ignored;
+ * they have presumably been processed in a previous iteration.
+ * (Pass 0 for last_file_arg_seen on the first or only iteration.)
+ * for_real is FALSE on the first (dummy) pass; we may skip any expensive
+ * processing.
+ */
+{
+  int argn;
+  char * arg;
+  boolean simple_progressive;
+  char * scansarg = NULL;	/* saves -scans parm if any */
+
+  /* Set up default JPEG parameters. */
+  simple_progressive = FALSE;
+  outfilename = NULL;
+  copyoption = JCOPYOPT_DEFAULT;
+  transformoption.transform = JXFORM_NONE;
+  transformoption.trim = FALSE;
+  transformoption.force_grayscale = FALSE;
+  cinfo->err->trace_level = 0;
+
+  /* Scan command line options, adjust parameters */
+
+  for (argn = 1; argn < argc; argn++) {
+    arg = argv[argn];
+    if (*arg != '-') {
+      /* Not a switch, must be a file name argument */
+      if (argn <= last_file_arg_seen) {
+	outfilename = NULL;	/* -outfile applies to just one input file */
+	continue;		/* ignore this name if previously processed */
+      }
+      break;			/* else done parsing switches */
+    }
+    arg++;			/* advance past switch marker character */
+
+    if (keymatch(arg, "arithmetic", 1)) {
+      /* Use arithmetic coding. */
+#ifdef C_ARITH_CODING_SUPPORTED
+      cinfo->arith_code = TRUE;
+#else
+      fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
+	      progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "copy", 1)) {
+      /* Select which extra markers to copy. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (keymatch(argv[argn], "none", 1)) {
+	copyoption = JCOPYOPT_NONE;
+      } else if (keymatch(argv[argn], "comments", 1)) {
+	copyoption = JCOPYOPT_COMMENTS;
+      } else if (keymatch(argv[argn], "all", 1)) {
+	copyoption = JCOPYOPT_ALL;
+      } else
+	usage();
+
+    } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
+      /* Enable debug printouts. */
+      /* On first -d, print version identification */
+      static boolean printed_version = FALSE;
+
+      if (! printed_version) {
+	fprintf(stderr, "Independent JPEG Group's JPEGTRAN, version %s\n%s\n",
+		JVERSION, JCOPYRIGHT);
+	printed_version = TRUE;
+      }
+      cinfo->err->trace_level++;
+
+    } else if (keymatch(arg, "flip", 1)) {
+      /* Mirror left-right or top-bottom. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (keymatch(argv[argn], "horizontal", 1))
+	select_transform(JXFORM_FLIP_H);
+      else if (keymatch(argv[argn], "vertical", 1))
+	select_transform(JXFORM_FLIP_V);
+      else
+	usage();
+
+    } else if (keymatch(arg, "grayscale", 1) || keymatch(arg, "greyscale",1)) {
+      /* Force to grayscale. */
+#if TRANSFORMS_SUPPORTED
+      transformoption.force_grayscale = TRUE;
+#else
+      select_transform(JXFORM_NONE);	/* force an error */
+#endif
+
+    } else if (keymatch(arg, "maxmemory", 3)) {
+      /* Maximum memory in Kb (or Mb with 'm'). */
+      long lval;
+      char ch = 'x';
+
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
+	usage();
+      if (ch == 'm' || ch == 'M')
+	lval *= 1000L;
+      cinfo->mem->max_memory_to_use = lval * 1000L;
+
+    } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
+      /* Enable entropy parm optimization. */
+#ifdef ENTROPY_OPT_SUPPORTED
+      cinfo->optimize_coding = TRUE;
+#else
+      fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n",
+	      progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "outfile", 4)) {
+      /* Set output file name. */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      outfilename = argv[argn];	/* save it away for later use */
+
+    } else if (keymatch(arg, "progressive", 1)) {
+      /* Select simple progressive mode. */
+#ifdef C_PROGRESSIVE_SUPPORTED
+      simple_progressive = TRUE;
+      /* We must postpone execution until num_components is known. */
+#else
+      fprintf(stderr, "%s: sorry, progressive output was not compiled\n",
+	      progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "restart", 1)) {
+      /* Restart interval in MCU rows (or in MCUs with 'b'). */
+      long lval;
+      char ch = 'x';
+
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
+	usage();
+      if (lval < 0 || lval > 65535L)
+	usage();
+      if (ch == 'b' || ch == 'B') {
+	cinfo->restart_interval = (unsigned int) lval;
+	cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
+      } else {
+	cinfo->restart_in_rows = (int) lval;
+	/* restart_interval will be computed during startup */
+      }
+
+    } else if (keymatch(arg, "rotate", 2)) {
+      /* Rotate 90, 180, or 270 degrees (measured clockwise). */
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      if (keymatch(argv[argn], "90", 2))
+	select_transform(JXFORM_ROT_90);
+      else if (keymatch(argv[argn], "180", 3))
+	select_transform(JXFORM_ROT_180);
+      else if (keymatch(argv[argn], "270", 3))
+	select_transform(JXFORM_ROT_270);
+      else
+	usage();
+
+    } else if (keymatch(arg, "scans", 1)) {
+      /* Set scan script. */
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+      if (++argn >= argc)	/* advance to next argument */
+	usage();
+      scansarg = argv[argn];
+      /* We must postpone reading the file in case -progressive appears. */
+#else
+      fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n",
+	      progname);
+      exit(EXIT_FAILURE);
+#endif
+
+    } else if (keymatch(arg, "transpose", 1)) {
+      /* Transpose (across UL-to-LR axis). */
+      select_transform(JXFORM_TRANSPOSE);
+
+    } else if (keymatch(arg, "transverse", 6)) {
+      /* Transverse transpose (across UR-to-LL axis). */
+      select_transform(JXFORM_TRANSVERSE);
+
+    } else if (keymatch(arg, "trim", 3)) {
+      /* Trim off any partial edge MCUs that the transform can't handle. */
+      transformoption.trim = TRUE;
+
+    } else {
+      usage();			/* bogus switch */
+    }
+  }
+
+  /* Post-switch-scanning cleanup */
+
+  if (for_real) {
+
+#ifdef C_PROGRESSIVE_SUPPORTED
+    if (simple_progressive)	/* process -progressive; -scans can override */
+      jpeg_simple_progression(cinfo);
+#endif
+
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+    if (scansarg != NULL)	/* process -scans if it was present */
+      if (! read_scan_script(cinfo, scansarg))
+	usage();
+#endif
+  }
+
+  return argn;			/* return index of next arg (file name) */
+}
+
+
+/*
+ * The main program.
+ */
+
+int
+main (int argc, char **argv)
+{
+  struct jpeg_decompress_struct srcinfo;
+  struct jpeg_compress_struct dstinfo;
+  struct jpeg_error_mgr jsrcerr, jdsterr;
+#ifdef PROGRESS_REPORT
+  struct cdjpeg_progress_mgr progress;
+#endif
+  jvirt_barray_ptr * src_coef_arrays;
+  jvirt_barray_ptr * dst_coef_arrays;
+  int file_index;
+  FILE * input_file;
+  FILE * output_file;
+
+  /* On Mac, fetch a command line. */
+#ifdef USE_CCOMMAND
+  argc = ccommand(&argv);
+#endif
+
+  progname = argv[0];
+  if (progname == NULL || progname[0] == 0)
+    progname = "jpegtran";	/* in case C library doesn't provide it */
+
+  /* Initialize the JPEG decompression object with default error handling. */
+  srcinfo.err = jpeg_std_error(&jsrcerr);
+  jpeg_create_decompress(&srcinfo);
+  /* Initialize the JPEG compression object with default error handling. */
+  dstinfo.err = jpeg_std_error(&jdsterr);
+  jpeg_create_compress(&dstinfo);
+
+  /* Now safe to enable signal catcher.
+   * Note: we assume only the decompression object will have virtual arrays.
+   */
+#ifdef NEED_SIGNAL_CATCHER
+  enable_signal_catcher((j_common_ptr) &srcinfo);
+#endif
+
+  /* Scan command line to find file names.
+   * It is convenient to use just one switch-parsing routine, but the switch
+   * values read here are mostly ignored; we will rescan the switches after
+   * opening the input file.  Also note that most of the switches affect the
+   * destination JPEG object, so we parse into that and then copy over what
+   * needs to affects the source too.
+   */
+
+  file_index = parse_switches(&dstinfo, argc, argv, 0, FALSE);
+  jsrcerr.trace_level = jdsterr.trace_level;
+  srcinfo.mem->max_memory_to_use = dstinfo.mem->max_memory_to_use;
+
+#ifdef TWO_FILE_COMMANDLINE
+  /* Must have either -outfile switch or explicit output file name */
+  if (outfilename == NULL) {
+    if (file_index != argc-2) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+	      progname);
+      usage();
+    }
+    outfilename = argv[file_index+1];
+  } else {
+    if (file_index != argc-1) {
+      fprintf(stderr, "%s: must name one input and one output file\n",
+	      progname);
+      usage();
+    }
+  }
+#else
+  /* Unix style: expect zero or one file name */
+  if (file_index < argc-1) {
+    fprintf(stderr, "%s: only one input file\n", progname);
+    usage();
+  }
+#endif /* TWO_FILE_COMMANDLINE */
+
+  /* Open the input file. */
+  if (file_index < argc) {
+    if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default input file is stdin */
+    input_file = read_stdin();
+  }
+
+  /* Open the output file. */
+  if (outfilename != NULL) {
+    if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default output file is stdout */
+    output_file = write_stdout();
+  }
+
+#ifdef PROGRESS_REPORT
+  start_progress_monitor((j_common_ptr) &dstinfo, &progress);
+#endif
+
+  /* Specify data source for decompression */
+  jpeg_stdio_src(&srcinfo, input_file);
+
+  /* Enable saving of extra markers that we want to copy */
+  jcopy_markers_setup(&srcinfo, copyoption);
+
+  /* Read file header */
+  (void) jpeg_read_header(&srcinfo, TRUE);
+
+  /* Any space needed by a transform option must be requested before
+   * jpeg_read_coefficients so that memory allocation will be done right.
+   */
+#if TRANSFORMS_SUPPORTED
+  jtransform_request_workspace(&srcinfo, &transformoption);
+#endif
+
+  /* Read source file as DCT coefficients */
+  src_coef_arrays = jpeg_read_coefficients(&srcinfo);
+
+  /* Initialize destination compression parameters from source values */
+  jpeg_copy_critical_parameters(&srcinfo, &dstinfo);
+
+  /* Adjust destination parameters if required by transform options;
+   * also find out which set of coefficient arrays will hold the output.
+   */
+#if TRANSFORMS_SUPPORTED
+  dst_coef_arrays = jtransform_adjust_parameters(&srcinfo, &dstinfo,
+						 src_coef_arrays,
+						 &transformoption);
+#else
+  dst_coef_arrays = src_coef_arrays;
+#endif
+
+  /* Adjust default compression parameters by re-parsing the options */
+  file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE);
+
+  /* Specify data destination for compression */
+  jpeg_stdio_dest(&dstinfo, output_file);
+
+  /* Start compressor (note no image data is actually written here) */
+  jpeg_write_coefficients(&dstinfo, dst_coef_arrays);
+
+  /* Copy to the output file any extra markers that we want to preserve */
+  jcopy_markers_execute(&srcinfo, &dstinfo, copyoption);
+
+  /* Execute image transformation, if any */
+#if TRANSFORMS_SUPPORTED
+  jtransform_execute_transformation(&srcinfo, &dstinfo,
+				    src_coef_arrays,
+				    &transformoption);
+#endif
+
+  /* Finish compression and release memory */
+  jpeg_finish_compress(&dstinfo);
+  jpeg_destroy_compress(&dstinfo);
+  (void) jpeg_finish_decompress(&srcinfo);
+  jpeg_destroy_decompress(&srcinfo);
+
+  /* Close files, if we opened them */
+  if (input_file != stdin)
+    fclose(input_file);
+  if (output_file != stdout)
+    fclose(output_file);
+
+#ifdef PROGRESS_REPORT
+  end_progress_monitor((j_common_ptr) &dstinfo);
+#endif
+
+  /* All done. */
+  exit(jsrcerr.num_warnings + jdsterr.num_warnings ?EXIT_WARNING:EXIT_SUCCESS);
+  return 0;			/* suppress no-return-value warnings */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jquant1.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jquant1.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jquant1.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,856 @@
+/*
+ * jquant1.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains 1-pass color quantization (color mapping) routines.
+ * These routines provide mapping to a fixed color map using equally spaced
+ * color values.  Optional Floyd-Steinberg or ordered dithering is available.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+#ifdef QUANT_1PASS_SUPPORTED
+
+
+/*
+ * The main purpose of 1-pass quantization is to provide a fast, if not very
+ * high quality, colormapped output capability.  A 2-pass quantizer usually
+ * gives better visual quality; however, for quantized grayscale output this
+ * quantizer is perfectly adequate.  Dithering is highly recommended with this
+ * quantizer, though you can turn it off if you really want to.
+ *
+ * In 1-pass quantization the colormap must be chosen in advance of seeing the
+ * image.  We use a map consisting of all combinations of Ncolors[i] color
+ * values for the i'th component.  The Ncolors[] values are chosen so that
+ * their product, the total number of colors, is no more than that requested.
+ * (In most cases, the product will be somewhat less.)
+ *
+ * Since the colormap is orthogonal, the representative value for each color
+ * component can be determined without considering the other components;
+ * then these indexes can be combined into a colormap index by a standard
+ * N-dimensional-array-subscript calculation.  Most of the arithmetic involved
+ * can be precalculated and stored in the lookup table colorindex[].
+ * colorindex[i][j] maps pixel value j in component i to the nearest
+ * representative value (grid plane) for that component; this index is
+ * multiplied by the array stride for component i, so that the
+ * index of the colormap entry closest to a given pixel value is just
+ *    sum( colorindex[component-number][pixel-component-value] )
+ * Aside from being fast, this scheme allows for variable spacing between
+ * representative values with no additional lookup cost.
+ *
+ * If gamma correction has been applied in color conversion, it might be wise
+ * to adjust the color grid spacing so that the representative colors are
+ * equidistant in linear space.  At this writing, gamma correction is not
+ * implemented by jdcolor, so nothing is done here.
+ */
+
+
+/* Declarations for ordered dithering.
+ *
+ * We use a standard 16x16 ordered dither array.  The basic concept of ordered
+ * dithering is described in many references, for instance Dale Schumacher's
+ * chapter II.2 of Graphics Gems II (James Arvo, ed. Academic Press, 1991).
+ * In place of Schumacher's comparisons against a "threshold" value, we add a
+ * "dither" value to the input pixel and then round the result to the nearest
+ * output value.  The dither value is equivalent to (0.5 - threshold) times
+ * the distance between output values.  For ordered dithering, we assume that
+ * the output colors are equally spaced; if not, results will probably be
+ * worse, since the dither may be too much or too little at a given point.
+ *
+ * The normal calculation would be to form pixel value + dither, range-limit
+ * this to 0..MAXJSAMPLE, and then index into the colorindex table as usual.
+ * We can skip the separate range-limiting step by extending the colorindex
+ * table in both directions.
+ */
+
+#define ODITHER_SIZE  16	/* dimension of dither matrix */
+/* NB: if ODITHER_SIZE is not a power of 2, ODITHER_MASK uses will break */
+#define ODITHER_CELLS (ODITHER_SIZE*ODITHER_SIZE)	/* # cells in matrix */
+#define ODITHER_MASK  (ODITHER_SIZE-1) /* mask for wrapping around counters */
+
+typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE];
+typedef int (*ODITHER_MATRIX_PTR)[ODITHER_SIZE];
+
+static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = {
+  /* Bayer's order-4 dither array.  Generated by the code given in
+   * Stephen Hawley's article "Ordered Dithering" in Graphics Gems I.
+   * The values in this array must range from 0 to ODITHER_CELLS-1.
+   */
+  {   0,192, 48,240, 12,204, 60,252,  3,195, 51,243, 15,207, 63,255 },
+  { 128, 64,176,112,140, 76,188,124,131, 67,179,115,143, 79,191,127 },
+  {  32,224, 16,208, 44,236, 28,220, 35,227, 19,211, 47,239, 31,223 },
+  { 160, 96,144, 80,172,108,156, 92,163, 99,147, 83,175,111,159, 95 },
+  {   8,200, 56,248,  4,196, 52,244, 11,203, 59,251,  7,199, 55,247 },
+  { 136, 72,184,120,132, 68,180,116,139, 75,187,123,135, 71,183,119 },
+  {  40,232, 24,216, 36,228, 20,212, 43,235, 27,219, 39,231, 23,215 },
+  { 168,104,152, 88,164,100,148, 84,171,107,155, 91,167,103,151, 87 },
+  {   2,194, 50,242, 14,206, 62,254,  1,193, 49,241, 13,205, 61,253 },
+  { 130, 66,178,114,142, 78,190,126,129, 65,177,113,141, 77,189,125 },
+  {  34,226, 18,210, 46,238, 30,222, 33,225, 17,209, 45,237, 29,221 },
+  { 162, 98,146, 82,174,110,158, 94,161, 97,145, 81,173,109,157, 93 },
+  {  10,202, 58,250,  6,198, 54,246,  9,201, 57,249,  5,197, 53,245 },
+  { 138, 74,186,122,134, 70,182,118,137, 73,185,121,133, 69,181,117 },
+  {  42,234, 26,218, 38,230, 22,214, 41,233, 25,217, 37,229, 21,213 },
+  { 170,106,154, 90,166,102,150, 86,169,105,153, 89,165,101,149, 85 }
+};
+
+
+/* Declarations for Floyd-Steinberg dithering.
+ *
+ * Errors are accumulated into the array fserrors[], at a resolution of
+ * 1/16th of a pixel count.  The error at a given pixel is propagated
+ * to its not-yet-processed neighbors using the standard F-S fractions,
+ *		...	(here)	7/16
+ *		3/16	5/16	1/16
+ * We work left-to-right on even rows, right-to-left on odd rows.
+ *
+ * We can get away with a single array (holding one row's worth of errors)
+ * by using it to store the current row's errors at pixel columns not yet
+ * processed, but the next row's errors at columns already processed.  We
+ * need only a few extra variables to hold the errors immediately around the
+ * current column.  (If we are lucky, those variables are in registers, but
+ * even if not, they're probably cheaper to access than array elements are.)
+ *
+ * The fserrors[] array is indexed [component#][position].
+ * We provide (#columns + 2) entries per component; the extra entry at each
+ * end saves us from special-casing the first and last pixels.
+ *
+ * Note: on a wide image, we might not have enough room in a PC's near data
+ * segment to hold the error array; so it is allocated with alloc_large.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+typedef INT16 FSERROR;		/* 16 bits should be enough */
+typedef int LOCFSERROR;		/* use 'int' for calculation temps */
+#else
+typedef INT32 FSERROR;		/* may need more than 16 bits */
+typedef INT32 LOCFSERROR;	/* be sure calculation temps are big enough */
+#endif
+
+typedef FSERROR FAR *FSERRPTR;	/* pointer to error array (in FAR storage!) */
+
+
+/* Private subobject */
+
+#define MAX_Q_COMPS 4		/* max components I can handle */
+
+typedef struct {
+  struct jpeg_color_quantizer pub; /* public fields */
+
+  /* Initially allocated colormap is saved here */
+  JSAMPARRAY sv_colormap;	/* The color map as a 2-D pixel array */
+  int sv_actual;		/* number of entries in use */
+
+  JSAMPARRAY colorindex;	/* Precomputed mapping for speed */
+  /* colorindex[i][j] = index of color closest to pixel value j in component i,
+   * premultiplied as described above.  Since colormap indexes must fit into
+   * JSAMPLEs, the entries of this array will too.
+   */
+  boolean is_padded;		/* is the colorindex padded for odither? */
+
+  int Ncolors[MAX_Q_COMPS];	/* # of values alloced to each component */
+
+  /* Variables for ordered dithering */
+  int row_index;		/* cur row's vertical index in dither matrix */
+  ODITHER_MATRIX_PTR odither[MAX_Q_COMPS]; /* one dither array per component */
+
+  /* Variables for Floyd-Steinberg dithering */
+  FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */
+  boolean on_odd_row;		/* flag to remember which row we are on */
+} my_cquantizer;
+
+typedef my_cquantizer * my_cquantize_ptr;
+
+
+/*
+ * Policy-making subroutines for create_colormap and create_colorindex.
+ * These routines determine the colormap to be used.  The rest of the module
+ * only assumes that the colormap is orthogonal.
+ *
+ *  * select_ncolors decides how to divvy up the available colors
+ *    among the components.
+ *  * output_value defines the set of representative values for a component.
+ *  * largest_input_value defines the mapping from input values to
+ *    representative values for a component.
+ * Note that the latter two routines may impose different policies for
+ * different components, though this is not currently done.
+ */
+
+
+LOCAL(int)
+select_ncolors (j_decompress_ptr cinfo, int Ncolors[])
+/* Determine allocation of desired colors to components, */
+/* and fill in Ncolors[] array to indicate choice. */
+/* Return value is total number of colors (product of Ncolors[] values). */
+{
+  int nc = cinfo->out_color_components; /* number of color components */
+  int max_colors = cinfo->desired_number_of_colors;
+  int total_colors, iroot, i, j;
+  boolean changed;
+  long temp;
+  static const int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE };
+
+  /* We can allocate at least the nc'th root of max_colors per component. */
+  /* Compute floor(nc'th root of max_colors). */
+  iroot = 1;
+  do {
+    iroot++;
+    temp = iroot;		/* set temp = iroot ** nc */
+    for (i = 1; i < nc; i++)
+      temp *= iroot;
+  } while (temp <= (long) max_colors); /* repeat till iroot exceeds root */
+  iroot--;			/* now iroot = floor(root) */
+
+  /* Must have at least 2 color values per component */
+  if (iroot < 2)
+    ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, (int) temp);
+
+  /* Initialize to iroot color values for each component */
+  total_colors = 1;
+  for (i = 0; i < nc; i++) {
+    Ncolors[i] = iroot;
+    total_colors *= iroot;
+  }
+  /* We may be able to increment the count for one or more components without
+   * exceeding max_colors, though we know not all can be incremented.
+   * Sometimes, the first component can be incremented more than once!
+   * (Example: for 16 colors, we start at 2*2*2, go to 3*2*2, then 4*2*2.)
+   * In RGB colorspace, try to increment G first, then R, then B.
+   */
+  do {
+    changed = FALSE;
+    for (i = 0; i < nc; i++) {
+      j = (cinfo->out_color_space == JCS_RGB ? RGB_order[i] : i);
+      /* calculate new total_colors if Ncolors[j] is incremented */
+      temp = total_colors / Ncolors[j];
+      temp *= Ncolors[j]+1;	/* done in long arith to avoid oflo */
+      if (temp > (long) max_colors)
+	break;			/* won't fit, done with this pass */
+      Ncolors[j]++;		/* OK, apply the increment */
+      total_colors = (int) temp;
+      changed = TRUE;
+    }
+  } while (changed);
+
+  return total_colors;
+}
+
+
+LOCAL(int)
+output_value (j_decompress_ptr cinfo, int ci, int j, int maxj)
+/* Return j'th output value, where j will range from 0 to maxj */
+/* The output values must fall in 0..MAXJSAMPLE in increasing order */
+{
+  /* We always provide values 0 and MAXJSAMPLE for each component;
+   * any additional values are equally spaced between these limits.
+   * (Forcing the upper and lower values to the limits ensures that
+   * dithering can't produce a color outside the selected gamut.)
+   */
+  return (int) (((INT32) j * MAXJSAMPLE + maxj/2) / maxj);
+}
+
+
+LOCAL(int)
+largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj)
+/* Return largest input value that should map to j'th output value */
+/* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */
+{
+  /* Breakpoints are halfway between values returned by output_value */
+  return (int) (((INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj));
+}
+
+
+/*
+ * Create the colormap.
+ */
+
+LOCAL(void)
+create_colormap (j_decompress_ptr cinfo)
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  JSAMPARRAY colormap;		/* Created colormap */
+  int total_colors;		/* Number of distinct output colors */
+  int i,j,k, nci, blksize, blkdist, ptr, val;
+
+  /* Select number of colors for each component */
+  total_colors = select_ncolors(cinfo, cquantize->Ncolors);
+
+  /* Report selected color counts */
+  if (cinfo->out_color_components == 3)
+    TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS,
+	     total_colors, cquantize->Ncolors[0],
+	     cquantize->Ncolors[1], cquantize->Ncolors[2]);
+  else
+    TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors);
+
+  /* Allocate and fill in the colormap. */
+  /* The colors are ordered in the map in standard row-major order, */
+  /* i.e. rightmost (highest-indexed) color changes most rapidly. */
+
+  colormap = (*cinfo->mem->alloc_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE,
+     (JDIMENSION) total_colors, (JDIMENSION) cinfo->out_color_components);
+
+  /* blksize is number of adjacent repeated entries for a component */
+  /* blkdist is distance between groups of identical entries for a component */
+  blkdist = total_colors;
+
+  for (i = 0; i < cinfo->out_color_components; i++) {
+    /* fill in colormap entries for i'th color component */
+    nci = cquantize->Ncolors[i]; /* # of distinct values for this color */
+    blksize = blkdist / nci;
+    for (j = 0; j < nci; j++) {
+      /* Compute j'th output value (out of nci) for component */
+      val = output_value(cinfo, i, j, nci-1);
+      /* Fill in all colormap entries that have this value of this component */
+      for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) {
+	/* fill in blksize entries beginning at ptr */
+	for (k = 0; k < blksize; k++)
+	  colormap[i][ptr+k] = (JSAMPLE) val;
+      }
+    }
+    blkdist = blksize;		/* blksize of this color is blkdist of next */
+  }
+
+  /* Save the colormap in private storage,
+   * where it will survive color quantization mode changes.
+   */
+  cquantize->sv_colormap = colormap;
+  cquantize->sv_actual = total_colors;
+}
+
+
+/*
+ * Create the color index table.
+ */
+
+LOCAL(void)
+create_colorindex (j_decompress_ptr cinfo)
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  JSAMPROW indexptr;
+  int i,j,k, nci, blksize, val, pad;
+
+  /* For ordered dither, we pad the color index tables by MAXJSAMPLE in
+   * each direction (input index values can be -MAXJSAMPLE .. 2*MAXJSAMPLE).
+   * This is not necessary in the other dithering modes.  However, we
+   * flag whether it was done in case user changes dithering mode.
+   */
+  if (cinfo->dither_mode == JDITHER_ORDERED) {
+    pad = MAXJSAMPLE*2;
+    cquantize->is_padded = TRUE;
+  } else {
+    pad = 0;
+    cquantize->is_padded = FALSE;
+  }
+
+  cquantize->colorindex = (*cinfo->mem->alloc_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE,
+     (JDIMENSION) (MAXJSAMPLE+1 + pad),
+     (JDIMENSION) cinfo->out_color_components);
+
+  /* blksize is number of adjacent repeated entries for a component */
+  blksize = cquantize->sv_actual;
+
+  for (i = 0; i < cinfo->out_color_components; i++) {
+    /* fill in colorindex entries for i'th color component */
+    nci = cquantize->Ncolors[i]; /* # of distinct values for this color */
+    blksize = blksize / nci;
+
+    /* adjust colorindex pointers to provide padding at negative indexes. */
+    if (pad)
+      cquantize->colorindex[i] += MAXJSAMPLE;
+
+    /* in loop, val = index of current output value, */
+    /* and k = largest j that maps to current val */
+    indexptr = cquantize->colorindex[i];
+    val = 0;
+    k = largest_input_value(cinfo, i, 0, nci-1);
+    for (j = 0; j <= MAXJSAMPLE; j++) {
+      while (j > k)		/* advance val if past boundary */
+	k = largest_input_value(cinfo, i, ++val, nci-1);
+      /* premultiply so that no multiplication needed in main processing */
+      indexptr[j] = (JSAMPLE) (val * blksize);
+    }
+    /* Pad at both ends if necessary */
+    if (pad)
+      for (j = 1; j <= MAXJSAMPLE; j++) {
+	indexptr[-j] = indexptr[0];
+	indexptr[MAXJSAMPLE+j] = indexptr[MAXJSAMPLE];
+      }
+  }
+}
+
+
+/*
+ * Create an ordered-dither array for a component having ncolors
+ * distinct output values.
+ */
+
+LOCAL(ODITHER_MATRIX_PTR)
+make_odither_array (j_decompress_ptr cinfo, int ncolors)
+{
+  ODITHER_MATRIX_PTR odither;
+  int j,k;
+  INT32 num,den;
+
+  odither = (ODITHER_MATRIX_PTR)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(ODITHER_MATRIX));
+  /* The inter-value distance for this color is MAXJSAMPLE/(ncolors-1).
+   * Hence the dither value for the matrix cell with fill order f
+   * (f=0..N-1) should be (N-1-2*f)/(2*N) * MAXJSAMPLE/(ncolors-1).
+   * On 16-bit-int machine, be careful to avoid overflow.
+   */
+  den = 2 * ODITHER_CELLS * ((INT32) (ncolors - 1));
+  for (j = 0; j < ODITHER_SIZE; j++) {
+    for (k = 0; k < ODITHER_SIZE; k++) {
+      num = ((INT32) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k])))
+	    * MAXJSAMPLE;
+      /* Ensure round towards zero despite C's lack of consistency
+       * about rounding negative values in integer division...
+       */
+      odither[j][k] = (int) (num<0 ? -((-num)/den) : num/den);
+    }
+  }
+  return odither;
+}
+
+
+/*
+ * Create the ordered-dither tables.
+ * Components having the same number of representative colors may 
+ * share a dither table.
+ */
+
+LOCAL(void)
+create_odither_tables (j_decompress_ptr cinfo)
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  ODITHER_MATRIX_PTR odither;
+  int i, j, nci;
+
+  for (i = 0; i < cinfo->out_color_components; i++) {
+    nci = cquantize->Ncolors[i]; /* # of distinct values for this color */
+    odither = NULL;		/* search for matching prior component */
+    for (j = 0; j < i; j++) {
+      if (nci == cquantize->Ncolors[j]) {
+	odither = cquantize->odither[j];
+	break;
+      }
+    }
+    if (odither == NULL)	/* need a new table? */
+      odither = make_odither_array(cinfo, nci);
+    cquantize->odither[i] = odither;
+  }
+}
+
+
+/*
+ * Map some rows of pixels to the output colormapped representation.
+ */
+
+METHODDEF(void)
+color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+		JSAMPARRAY output_buf, int num_rows)
+/* General case, no dithering */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  JSAMPARRAY colorindex = cquantize->colorindex;
+  register int pixcode, ci;
+  register JSAMPROW ptrin, ptrout;
+  int row;
+  JDIMENSION col;
+  JDIMENSION width = cinfo->output_width;
+  register int nc = cinfo->out_color_components;
+
+  for (row = 0; row < num_rows; row++) {
+    ptrin = input_buf[row];
+    ptrout = output_buf[row];
+    for (col = width; col > 0; col--) {
+      pixcode = 0;
+      for (ci = 0; ci < nc; ci++) {
+	pixcode += GETJSAMPLE(colorindex[ci][GETJSAMPLE(*ptrin++)]);
+      }
+      *ptrout++ = (JSAMPLE) pixcode;
+    }
+  }
+}
+
+
+METHODDEF(void)
+color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+		 JSAMPARRAY output_buf, int num_rows)
+/* Fast path for out_color_components==3, no dithering */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  register int pixcode;
+  register JSAMPROW ptrin, ptrout;
+  JSAMPROW colorindex0 = cquantize->colorindex[0];
+  JSAMPROW colorindex1 = cquantize->colorindex[1];
+  JSAMPROW colorindex2 = cquantize->colorindex[2];
+  int row;
+  JDIMENSION col;
+  JDIMENSION width = cinfo->output_width;
+
+  for (row = 0; row < num_rows; row++) {
+    ptrin = input_buf[row];
+    ptrout = output_buf[row];
+    for (col = width; col > 0; col--) {
+      pixcode  = GETJSAMPLE(colorindex0[GETJSAMPLE(*ptrin++)]);
+      pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*ptrin++)]);
+      pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*ptrin++)]);
+      *ptrout++ = (JSAMPLE) pixcode;
+    }
+  }
+}
+
+
+METHODDEF(void)
+quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+		     JSAMPARRAY output_buf, int num_rows)
+/* General case, with ordered dithering */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  register JSAMPROW input_ptr;
+  register JSAMPROW output_ptr;
+  JSAMPROW colorindex_ci;
+  int * dither;			/* points to active row of dither matrix */
+  int row_index, col_index;	/* current indexes into dither matrix */
+  int nc = cinfo->out_color_components;
+  int ci;
+  int row;
+  JDIMENSION col;
+  JDIMENSION width = cinfo->output_width;
+
+  for (row = 0; row < num_rows; row++) {
+    /* Initialize output values to 0 so can process components separately */
+    jzero_far((void FAR *) output_buf[row],
+	      (size_t) (width * SIZEOF(JSAMPLE)));
+    row_index = cquantize->row_index;
+    for (ci = 0; ci < nc; ci++) {
+      input_ptr = input_buf[row] + ci;
+      output_ptr = output_buf[row];
+      colorindex_ci = cquantize->colorindex[ci];
+      dither = cquantize->odither[ci][row_index];
+      col_index = 0;
+
+      for (col = width; col > 0; col--) {
+	/* Form pixel value + dither, range-limit to 0..MAXJSAMPLE,
+	 * select output value, accumulate into output code for this pixel.
+	 * Range-limiting need not be done explicitly, as we have extended
+	 * the colorindex table to produce the right answers for out-of-range
+	 * inputs.  The maximum dither is +- MAXJSAMPLE; this sets the
+	 * required amount of padding.
+	 */
+	*output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]];
+	input_ptr += nc;
+	output_ptr++;
+	col_index = (col_index + 1) & ODITHER_MASK;
+      }
+    }
+    /* Advance row index for next row */
+    row_index = (row_index + 1) & ODITHER_MASK;
+    cquantize->row_index = row_index;
+  }
+}
+
+
+METHODDEF(void)
+quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+		      JSAMPARRAY output_buf, int num_rows)
+/* Fast path for out_color_components==3, with ordered dithering */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  register int pixcode;
+  register JSAMPROW input_ptr;
+  register JSAMPROW output_ptr;
+  JSAMPROW colorindex0 = cquantize->colorindex[0];
+  JSAMPROW colorindex1 = cquantize->colorindex[1];
+  JSAMPROW colorindex2 = cquantize->colorindex[2];
+  int * dither0;		/* points to active row of dither matrix */
+  int * dither1;
+  int * dither2;
+  int row_index, col_index;	/* current indexes into dither matrix */
+  int row;
+  JDIMENSION col;
+  JDIMENSION width = cinfo->output_width;
+
+  for (row = 0; row < num_rows; row++) {
+    row_index = cquantize->row_index;
+    input_ptr = input_buf[row];
+    output_ptr = output_buf[row];
+    dither0 = cquantize->odither[0][row_index];
+    dither1 = cquantize->odither[1][row_index];
+    dither2 = cquantize->odither[2][row_index];
+    col_index = 0;
+
+    for (col = width; col > 0; col--) {
+      pixcode  = GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) +
+					dither0[col_index]]);
+      pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) +
+					dither1[col_index]]);
+      pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) +
+					dither2[col_index]]);
+      *output_ptr++ = (JSAMPLE) pixcode;
+      col_index = (col_index + 1) & ODITHER_MASK;
+    }
+    row_index = (row_index + 1) & ODITHER_MASK;
+    cquantize->row_index = row_index;
+  }
+}
+
+
+METHODDEF(void)
+quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+		    JSAMPARRAY output_buf, int num_rows)
+/* General case, with Floyd-Steinberg dithering */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  register LOCFSERROR cur;	/* current error or pixel value */
+  LOCFSERROR belowerr;		/* error for pixel below cur */
+  LOCFSERROR bpreverr;		/* error for below/prev col */
+  LOCFSERROR bnexterr;		/* error for below/next col */
+  LOCFSERROR delta;
+  register FSERRPTR errorptr;	/* => fserrors[] at column before current */
+  register JSAMPROW input_ptr;
+  register JSAMPROW output_ptr;
+  JSAMPROW colorindex_ci;
+  JSAMPROW colormap_ci;
+  int pixcode;
+  int nc = cinfo->out_color_components;
+  int dir;			/* 1 for left-to-right, -1 for right-to-left */
+  int dirnc;			/* dir * nc */
+  int ci;
+  int row;
+  JDIMENSION col;
+  JDIMENSION width = cinfo->output_width;
+  JSAMPLE *range_limit = cinfo->sample_range_limit;
+  SHIFT_TEMPS
+
+  for (row = 0; row < num_rows; row++) {
+    /* Initialize output values to 0 so can process components separately */
+    jzero_far((void FAR *) output_buf[row],
+	      (size_t) (width * SIZEOF(JSAMPLE)));
+    for (ci = 0; ci < nc; ci++) {
+      input_ptr = input_buf[row] + ci;
+      output_ptr = output_buf[row];
+      if (cquantize->on_odd_row) {
+	/* work right to left in this row */
+	input_ptr += (width-1) * nc; /* so point to rightmost pixel */
+	output_ptr += width-1;
+	dir = -1;
+	dirnc = -nc;
+	errorptr = cquantize->fserrors[ci] + (width+1); /* => entry after last column */
+      } else {
+	/* work left to right in this row */
+	dir = 1;
+	dirnc = nc;
+	errorptr = cquantize->fserrors[ci]; /* => entry before first column */
+      }
+      colorindex_ci = cquantize->colorindex[ci];
+      colormap_ci = cquantize->sv_colormap[ci];
+      /* Preset error values: no error propagated to first pixel from left */
+      cur = 0;
+      /* and no error propagated to row below yet */
+      belowerr = bpreverr = 0;
+
+      for (col = width; col > 0; col--) {
+	/* cur holds the error propagated from the previous pixel on the
+	 * current line.  Add the error propagated from the previous line
+	 * to form the complete error correction term for this pixel, and
+	 * round the error term (which is expressed * 16) to an integer.
+	 * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct
+	 * for either sign of the error value.
+	 * Note: errorptr points to *previous* column's array entry.
+	 */
+	cur = RIGHT_SHIFT(cur + errorptr[dir] + 8, 4);
+	/* Form pixel value + error, and range-limit to 0..MAXJSAMPLE.
+	 * The maximum error is +- MAXJSAMPLE; this sets the required size
+	 * of the range_limit array.
+	 */
+	cur += GETJSAMPLE(*input_ptr);
+	cur = GETJSAMPLE(range_limit[cur]);
+	/* Select output value, accumulate into output code for this pixel */
+	pixcode = GETJSAMPLE(colorindex_ci[cur]);
+	*output_ptr += (JSAMPLE) pixcode;
+	/* Compute actual representation error at this pixel */
+	/* Note: we can do this even though we don't have the final */
+	/* pixel code, because the colormap is orthogonal. */
+	cur -= GETJSAMPLE(colormap_ci[pixcode]);
+	/* Compute error fractions to be propagated to adjacent pixels.
+	 * Add these into the running sums, and simultaneously shift the
+	 * next-line error sums left by 1 column.
+	 */
+	bnexterr = cur;
+	delta = cur * 2;
+	cur += delta;		/* form error * 3 */
+	errorptr[0] = (FSERROR) (bpreverr + cur);
+	cur += delta;		/* form error * 5 */
+	bpreverr = belowerr + cur;
+	belowerr = bnexterr;
+	cur += delta;		/* form error * 7 */
+	/* At this point cur contains the 7/16 error value to be propagated
+	 * to the next pixel on the current line, and all the errors for the
+	 * next line have been shifted over. We are therefore ready to move on.
+	 */
+	input_ptr += dirnc;	/* advance input ptr to next column */
+	output_ptr += dir;	/* advance output ptr to next column */
+	errorptr += dir;	/* advance errorptr to current column */
+      }
+      /* Post-loop cleanup: we must unload the final error value into the
+       * final fserrors[] entry.  Note we need not unload belowerr because
+       * it is for the dummy column before or after the actual array.
+       */
+      errorptr[0] = (FSERROR) bpreverr; /* unload prev err into array */
+    }
+    cquantize->on_odd_row = (cquantize->on_odd_row ? FALSE : TRUE);
+  }
+}
+
+
+/*
+ * Allocate workspace for Floyd-Steinberg errors.
+ */
+
+LOCAL(void)
+alloc_fs_workspace (j_decompress_ptr cinfo)
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  size_t arraysize;
+  int i;
+
+  arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR));
+  for (i = 0; i < cinfo->out_color_components; i++) {
+    cquantize->fserrors[i] = (FSERRPTR)
+      (*cinfo->mem->alloc_large)((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize);
+  }
+}
+
+
+/*
+ * Initialize for one-pass color quantization.
+ */
+
+METHODDEF(void)
+start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  size_t arraysize;
+  int i;
+
+  /* Install my colormap. */
+  cinfo->colormap = cquantize->sv_colormap;
+  cinfo->actual_number_of_colors = cquantize->sv_actual;
+
+  /* Initialize for desired dithering mode. */
+  switch (cinfo->dither_mode) {
+  case JDITHER_NONE:
+    if (cinfo->out_color_components == 3)
+      cquantize->pub.color_quantize = color_quantize3;
+    else
+      cquantize->pub.color_quantize = color_quantize;
+    break;
+  case JDITHER_ORDERED:
+    if (cinfo->out_color_components == 3)
+      cquantize->pub.color_quantize = quantize3_ord_dither;
+    else
+      cquantize->pub.color_quantize = quantize_ord_dither;
+    cquantize->row_index = 0;	/* initialize state for ordered dither */
+    /* If user changed to ordered dither from another mode,
+     * we must recreate the color index table with padding.
+     * This will cost extra space, but probably isn't very likely.
+     */
+    if (! cquantize->is_padded)
+      create_colorindex(cinfo);
+    /* Create ordered-dither tables if we didn't already. */
+    if (cquantize->odither[0] == NULL)
+      create_odither_tables(cinfo);
+    break;
+  case JDITHER_FS:
+    cquantize->pub.color_quantize = quantize_fs_dither;
+    cquantize->on_odd_row = FALSE; /* initialize state for F-S dither */
+    /* Allocate Floyd-Steinberg workspace if didn't already. */
+    if (cquantize->fserrors[0] == NULL)
+      alloc_fs_workspace(cinfo);
+    /* Initialize the propagated errors to zero. */
+    arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR));
+    for (i = 0; i < cinfo->out_color_components; i++)
+      jzero_far((void FAR *) cquantize->fserrors[i], arraysize);
+    break;
+  default:
+    ERREXIT(cinfo, JERR_NOT_COMPILED);
+    break;
+  }
+}
+
+
+/*
+ * Finish up at the end of the pass.
+ */
+
+METHODDEF(void)
+finish_pass_1_quant (j_decompress_ptr cinfo)
+{
+  /* no work in 1-pass case */
+}
+
+
+/*
+ * Switch to a new external colormap between output passes.
+ * Shouldn't get to this module!
+ */
+
+METHODDEF(void)
+new_color_map_1_quant (j_decompress_ptr cinfo)
+{
+  ERREXIT(cinfo, JERR_MODE_CHANGE);
+}
+
+
+/*
+ * Module initialization routine for 1-pass color quantization.
+ */
+
+GLOBAL(void)
+jinit_1pass_quantizer (j_decompress_ptr cinfo)
+{
+  my_cquantize_ptr cquantize;
+
+  cquantize = (my_cquantize_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_cquantizer));
+  cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
+  cquantize->pub.start_pass = start_pass_1_quant;
+  cquantize->pub.finish_pass = finish_pass_1_quant;
+  cquantize->pub.new_color_map = new_color_map_1_quant;
+  cquantize->fserrors[0] = NULL; /* Flag FS workspace not allocated */
+  cquantize->odither[0] = NULL;	/* Also flag odither arrays not allocated */
+
+  /* Make sure my internal arrays won't overflow */
+  if (cinfo->out_color_components > MAX_Q_COMPS)
+    ERREXIT1(cinfo, JERR_QUANT_COMPONENTS, MAX_Q_COMPS);
+  /* Make sure colormap indexes can be represented by JSAMPLEs */
+  if (cinfo->desired_number_of_colors > (MAXJSAMPLE+1))
+    ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXJSAMPLE+1);
+
+  /* Create the colormap and color index table. */
+  create_colormap(cinfo);
+  create_colorindex(cinfo);
+
+  /* Allocate Floyd-Steinberg workspace now if requested.
+   * We do this now since it is FAR storage and may affect the memory
+   * manager's space calculations.  If the user changes to FS dither
+   * mode in a later pass, we will allocate the space then, and will
+   * possibly overrun the max_memory_to_use setting.
+   */
+  if (cinfo->dither_mode == JDITHER_FS)
+    alloc_fs_workspace(cinfo);
+}
+
+#endif /* QUANT_1PASS_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jquant2.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jquant2.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jquant2.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1310 @@
+/*
+ * jquant2.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains 2-pass color quantization (color mapping) routines.
+ * These routines provide selection of a custom color map for an image,
+ * followed by mapping of the image to that color map, with optional
+ * Floyd-Steinberg dithering.
+ * It is also possible to use just the second pass to map to an arbitrary
+ * externally-given color map.
+ *
+ * Note: ordered dithering is not supported, since there isn't any fast
+ * way to compute intercolor distances; it's unclear that ordered dither's
+ * fundamental assumptions even hold with an irregularly spaced color map.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+#ifdef QUANT_2PASS_SUPPORTED
+
+
+/*
+ * This module implements the well-known Heckbert paradigm for color
+ * quantization.  Most of the ideas used here can be traced back to
+ * Heckbert's seminal paper
+ *   Heckbert, Paul.  "Color Image Quantization for Frame Buffer Display",
+ *   Proc. SIGGRAPH '82, Computer Graphics v.16 #3 (July 1982), pp 297-304.
+ *
+ * In the first pass over the image, we accumulate a histogram showing the
+ * usage count of each possible color.  To keep the histogram to a reasonable
+ * size, we reduce the precision of the input; typical practice is to retain
+ * 5 or 6 bits per color, so that 8 or 4 different input values are counted
+ * in the same histogram cell.
+ *
+ * Next, the color-selection step begins with a box representing the whole
+ * color space, and repeatedly splits the "largest" remaining box until we
+ * have as many boxes as desired colors.  Then the mean color in each
+ * remaining box becomes one of the possible output colors.
+ * 
+ * The second pass over the image maps each input pixel to the closest output
+ * color (optionally after applying a Floyd-Steinberg dithering correction).
+ * This mapping is logically trivial, but making it go fast enough requires
+ * considerable care.
+ *
+ * Heckbert-style quantizers vary a good deal in their policies for choosing
+ * the "largest" box and deciding where to cut it.  The particular policies
+ * used here have proved out well in experimental comparisons, but better ones
+ * may yet be found.
+ *
+ * In earlier versions of the IJG code, this module quantized in YCbCr color
+ * space, processing the raw upsampled data without a color conversion step.
+ * This allowed the color conversion math to be done only once per colormap
+ * entry, not once per pixel.  However, that optimization precluded other
+ * useful optimizations (such as merging color conversion with upsampling)
+ * and it also interfered with desired capabilities such as quantizing to an
+ * externally-supplied colormap.  We have therefore abandoned that approach.
+ * The present code works in the post-conversion color space, typically RGB.
+ *
+ * To improve the visual quality of the results, we actually work in scaled
+ * RGB space, giving G distances more weight than R, and R in turn more than
+ * B.  To do everything in integer math, we must use integer scale factors.
+ * The 2/3/1 scale factors used here correspond loosely to the relative
+ * weights of the colors in the NTSC grayscale equation.
+ * If you want to use this code to quantize a non-RGB color space, you'll
+ * probably need to change these scale factors.
+ */
+
+#define R_SCALE 2		/* scale R distances by this much */
+#define G_SCALE 3		/* scale G distances by this much */
+#define B_SCALE 1		/* and B by this much */
+
+/* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined
+ * in jmorecfg.h.  As the code stands, it will do the right thing for R,G,B
+ * and B,G,R orders.  If you define some other weird order in jmorecfg.h,
+ * you'll get compile errors until you extend this logic.  In that case
+ * you'll probably want to tweak the histogram sizes too.
+ */
+
+#if RGB_RED == 0
+#define C0_SCALE R_SCALE
+#endif
+#if RGB_BLUE == 0
+#define C0_SCALE B_SCALE
+#endif
+#if RGB_GREEN == 1
+#define C1_SCALE G_SCALE
+#endif
+#if RGB_RED == 2
+#define C2_SCALE R_SCALE
+#endif
+#if RGB_BLUE == 2
+#define C2_SCALE B_SCALE
+#endif
+
+
+/*
+ * First we have the histogram data structure and routines for creating it.
+ *
+ * The number of bits of precision can be adjusted by changing these symbols.
+ * We recommend keeping 6 bits for G and 5 each for R and B.
+ * If you have plenty of memory and cycles, 6 bits all around gives marginally
+ * better results; if you are short of memory, 5 bits all around will save
+ * some space but degrade the results.
+ * To maintain a fully accurate histogram, we'd need to allocate a "long"
+ * (preferably unsigned long) for each cell.  In practice this is overkill;
+ * we can get by with 16 bits per cell.  Few of the cell counts will overflow,
+ * and clamping those that do overflow to the maximum value will give close-
+ * enough results.  This reduces the recommended histogram size from 256Kb
+ * to 128Kb, which is a useful savings on PC-class machines.
+ * (In the second pass the histogram space is re-used for pixel mapping data;
+ * in that capacity, each cell must be able to store zero to the number of
+ * desired colors.  16 bits/cell is plenty for that too.)
+ * Since the JPEG code is intended to run in small memory model on 80x86
+ * machines, we can't just allocate the histogram in one chunk.  Instead
+ * of a true 3-D array, we use a row of pointers to 2-D arrays.  Each
+ * pointer corresponds to a C0 value (typically 2^5 = 32 pointers) and
+ * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries.  Note that
+ * on 80x86 machines, the pointer row is in near memory but the actual
+ * arrays are in far memory (same arrangement as we use for image arrays).
+ */
+
+#define MAXNUMCOLORS  (MAXJSAMPLE+1) /* maximum size of colormap */
+
+/* These will do the right thing for either R,G,B or B,G,R color order,
+ * but you may not like the results for other color orders.
+ */
+#define HIST_C0_BITS  5		/* bits of precision in R/B histogram */
+#define HIST_C1_BITS  6		/* bits of precision in G histogram */
+#define HIST_C2_BITS  5		/* bits of precision in B/R histogram */
+
+/* Number of elements along histogram axes. */
+#define HIST_C0_ELEMS  (1<<HIST_C0_BITS)
+#define HIST_C1_ELEMS  (1<<HIST_C1_BITS)
+#define HIST_C2_ELEMS  (1<<HIST_C2_BITS)
+
+/* These are the amounts to shift an input value to get a histogram index. */
+#define C0_SHIFT  (BITS_IN_JSAMPLE-HIST_C0_BITS)
+#define C1_SHIFT  (BITS_IN_JSAMPLE-HIST_C1_BITS)
+#define C2_SHIFT  (BITS_IN_JSAMPLE-HIST_C2_BITS)
+
+
+typedef UINT16 histcell;	/* histogram cell; prefer an unsigned type */
+
+typedef histcell FAR * histptr;	/* for pointers to histogram cells */
+
+typedef histcell hist1d[HIST_C2_ELEMS]; /* typedefs for the array */
+typedef hist1d FAR * hist2d;	/* type for the 2nd-level pointers */
+typedef hist2d * hist3d;	/* type for top-level pointer */
+
+
+/* Declarations for Floyd-Steinberg dithering.
+ *
+ * Errors are accumulated into the array fserrors[], at a resolution of
+ * 1/16th of a pixel count.  The error at a given pixel is propagated
+ * to its not-yet-processed neighbors using the standard F-S fractions,
+ *		...	(here)	7/16
+ *		3/16	5/16	1/16
+ * We work left-to-right on even rows, right-to-left on odd rows.
+ *
+ * We can get away with a single array (holding one row's worth of errors)
+ * by using it to store the current row's errors at pixel columns not yet
+ * processed, but the next row's errors at columns already processed.  We
+ * need only a few extra variables to hold the errors immediately around the
+ * current column.  (If we are lucky, those variables are in registers, but
+ * even if not, they're probably cheaper to access than array elements are.)
+ *
+ * The fserrors[] array has (#columns + 2) entries; the extra entry at
+ * each end saves us from special-casing the first and last pixels.
+ * Each entry is three values long, one value for each color component.
+ *
+ * Note: on a wide image, we might not have enough room in a PC's near data
+ * segment to hold the error array; so it is allocated with alloc_large.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+typedef INT16 FSERROR;		/* 16 bits should be enough */
+typedef int LOCFSERROR;		/* use 'int' for calculation temps */
+#else
+typedef INT32 FSERROR;		/* may need more than 16 bits */
+typedef INT32 LOCFSERROR;	/* be sure calculation temps are big enough */
+#endif
+
+typedef FSERROR FAR *FSERRPTR;	/* pointer to error array (in FAR storage!) */
+
+
+/* Private subobject */
+
+typedef struct {
+  struct jpeg_color_quantizer pub; /* public fields */
+
+  /* Space for the eventually created colormap is stashed here */
+  JSAMPARRAY sv_colormap;	/* colormap allocated at init time */
+  int desired;			/* desired # of colors = size of colormap */
+
+  /* Variables for accumulating image statistics */
+  hist3d histogram;		/* pointer to the histogram */
+
+  boolean needs_zeroed;		/* TRUE if next pass must zero histogram */
+
+  /* Variables for Floyd-Steinberg dithering */
+  FSERRPTR fserrors;		/* accumulated errors */
+  boolean on_odd_row;		/* flag to remember which row we are on */
+  int * error_limiter;		/* table for clamping the applied error */
+} my_cquantizer;
+
+typedef my_cquantizer * my_cquantize_ptr;
+
+
+/*
+ * Prescan some rows of pixels.
+ * In this module the prescan simply updates the histogram, which has been
+ * initialized to zeroes by start_pass.
+ * An output_buf parameter is required by the method signature, but no data
+ * is actually output (in fact the buffer controller is probably passing a
+ * NULL pointer).
+ */
+
+METHODDEF(void)
+prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+		  JSAMPARRAY output_buf, int num_rows)
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  register JSAMPROW ptr;
+  register histptr histp;
+  register hist3d histogram = cquantize->histogram;
+  int row;
+  JDIMENSION col;
+  JDIMENSION width = cinfo->output_width;
+
+  for (row = 0; row < num_rows; row++) {
+    ptr = input_buf[row];
+    for (col = width; col > 0; col--) {
+      /* get pixel value and index into the histogram */
+      histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT]
+			 [GETJSAMPLE(ptr[1]) >> C1_SHIFT]
+			 [GETJSAMPLE(ptr[2]) >> C2_SHIFT];
+      /* increment, check for overflow and undo increment if so. */
+      if (++(*histp) <= 0)
+	(*histp)--;
+      ptr += 3;
+    }
+  }
+}
+
+
+/*
+ * Next we have the really interesting routines: selection of a colormap
+ * given the completed histogram.
+ * These routines work with a list of "boxes", each representing a rectangular
+ * subset of the input color space (to histogram precision).
+ */
+
+typedef struct {
+  /* The bounds of the box (inclusive); expressed as histogram indexes */
+  int c0min, c0max;
+  int c1min, c1max;
+  int c2min, c2max;
+  /* The volume (actually 2-norm) of the box */
+  INT32 volume;
+  /* The number of nonzero histogram cells within this box */
+  long colorcount;
+} box;
+
+typedef box * boxptr;
+
+
+LOCAL(boxptr)
+find_biggest_color_pop (boxptr boxlist, int numboxes)
+/* Find the splittable box with the largest color population */
+/* Returns NULL if no splittable boxes remain */
+{
+  register boxptr boxp;
+  register int i;
+  register long maxc = 0;
+  boxptr which = NULL;
+  
+  for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) {
+    if (boxp->colorcount > maxc && boxp->volume > 0) {
+      which = boxp;
+      maxc = boxp->colorcount;
+    }
+  }
+  return which;
+}
+
+
+LOCAL(boxptr)
+find_biggest_volume (boxptr boxlist, int numboxes)
+/* Find the splittable box with the largest (scaled) volume */
+/* Returns NULL if no splittable boxes remain */
+{
+  register boxptr boxp;
+  register int i;
+  register INT32 maxv = 0;
+  boxptr which = NULL;
+  
+  for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) {
+    if (boxp->volume > maxv) {
+      which = boxp;
+      maxv = boxp->volume;
+    }
+  }
+  return which;
+}
+
+
+LOCAL(void)
+update_box (j_decompress_ptr cinfo, boxptr boxp)
+/* Shrink the min/max bounds of a box to enclose only nonzero elements, */
+/* and recompute its volume and population */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  hist3d histogram = cquantize->histogram;
+  histptr histp;
+  int c0,c1,c2;
+  int c0min,c0max,c1min,c1max,c2min,c2max;
+  INT32 dist0,dist1,dist2;
+  long ccount;
+  
+  c0min = boxp->c0min;  c0max = boxp->c0max;
+  c1min = boxp->c1min;  c1max = boxp->c1max;
+  c2min = boxp->c2min;  c2max = boxp->c2max;
+  
+  if (c0max > c0min)
+    for (c0 = c0min; c0 <= c0max; c0++)
+      for (c1 = c1min; c1 <= c1max; c1++) {
+	histp = & histogram[c0][c1][c2min];
+	for (c2 = c2min; c2 <= c2max; c2++)
+	  if (*histp++ != 0) {
+	    boxp->c0min = c0min = c0;
+	    goto have_c0min;
+	  }
+      }
+ have_c0min:
+  if (c0max > c0min)
+    for (c0 = c0max; c0 >= c0min; c0--)
+      for (c1 = c1min; c1 <= c1max; c1++) {
+	histp = & histogram[c0][c1][c2min];
+	for (c2 = c2min; c2 <= c2max; c2++)
+	  if (*histp++ != 0) {
+	    boxp->c0max = c0max = c0;
+	    goto have_c0max;
+	  }
+      }
+ have_c0max:
+  if (c1max > c1min)
+    for (c1 = c1min; c1 <= c1max; c1++)
+      for (c0 = c0min; c0 <= c0max; c0++) {
+	histp = & histogram[c0][c1][c2min];
+	for (c2 = c2min; c2 <= c2max; c2++)
+	  if (*histp++ != 0) {
+	    boxp->c1min = c1min = c1;
+	    goto have_c1min;
+	  }
+      }
+ have_c1min:
+  if (c1max > c1min)
+    for (c1 = c1max; c1 >= c1min; c1--)
+      for (c0 = c0min; c0 <= c0max; c0++) {
+	histp = & histogram[c0][c1][c2min];
+	for (c2 = c2min; c2 <= c2max; c2++)
+	  if (*histp++ != 0) {
+	    boxp->c1max = c1max = c1;
+	    goto have_c1max;
+	  }
+      }
+ have_c1max:
+  if (c2max > c2min)
+    for (c2 = c2min; c2 <= c2max; c2++)
+      for (c0 = c0min; c0 <= c0max; c0++) {
+	histp = & histogram[c0][c1min][c2];
+	for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
+	  if (*histp != 0) {
+	    boxp->c2min = c2min = c2;
+	    goto have_c2min;
+	  }
+      }
+ have_c2min:
+  if (c2max > c2min)
+    for (c2 = c2max; c2 >= c2min; c2--)
+      for (c0 = c0min; c0 <= c0max; c0++) {
+	histp = & histogram[c0][c1min][c2];
+	for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
+	  if (*histp != 0) {
+	    boxp->c2max = c2max = c2;
+	    goto have_c2max;
+	  }
+      }
+ have_c2max:
+
+  /* Update box volume.
+   * We use 2-norm rather than real volume here; this biases the method
+   * against making long narrow boxes, and it has the side benefit that
+   * a box is splittable iff norm > 0.
+   * Since the differences are expressed in histogram-cell units,
+   * we have to shift back to JSAMPLE units to get consistent distances;
+   * after which, we scale according to the selected distance scale factors.
+   */
+  dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE;
+  dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE;
+  dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE;
+  boxp->volume = dist0*dist0 + dist1*dist1 + dist2*dist2;
+  
+  /* Now scan remaining volume of box and compute population */
+  ccount = 0;
+  for (c0 = c0min; c0 <= c0max; c0++)
+    for (c1 = c1min; c1 <= c1max; c1++) {
+      histp = & histogram[c0][c1][c2min];
+      for (c2 = c2min; c2 <= c2max; c2++, histp++)
+	if (*histp != 0) {
+	  ccount++;
+	}
+    }
+  boxp->colorcount = ccount;
+}
+
+
+LOCAL(int)
+median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
+	    int desired_colors)
+/* Repeatedly select and split the largest box until we have enough boxes */
+{
+  int n,lb;
+  int c0,c1,c2,cmax;
+  register boxptr b1,b2;
+
+  while (numboxes < desired_colors) {
+    /* Select box to split.
+     * Current algorithm: by population for first half, then by volume.
+     */
+    if (numboxes*2 <= desired_colors) {
+      b1 = find_biggest_color_pop(boxlist, numboxes);
+    } else {
+      b1 = find_biggest_volume(boxlist, numboxes);
+    }
+    if (b1 == NULL)		/* no splittable boxes left! */
+      break;
+    b2 = &boxlist[numboxes];	/* where new box will go */
+    /* Copy the color bounds to the new box. */
+    b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max;
+    b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min;
+    /* Choose which axis to split the box on.
+     * Current algorithm: longest scaled axis.
+     * See notes in update_box about scaling distances.
+     */
+    c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE;
+    c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE;
+    c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE;
+    /* We want to break any ties in favor of green, then red, blue last.
+     * This code does the right thing for R,G,B or B,G,R color orders only.
+     */
+#if RGB_RED == 0
+    cmax = c1; n = 1;
+    if (c0 > cmax) { cmax = c0; n = 0; }
+    if (c2 > cmax) { n = 2; }
+#else
+    cmax = c1; n = 1;
+    if (c2 > cmax) { cmax = c2; n = 2; }
+    if (c0 > cmax) { n = 0; }
+#endif
+    /* Choose split point along selected axis, and update box bounds.
+     * Current algorithm: split at halfway point.
+     * (Since the box has been shrunk to minimum volume,
+     * any split will produce two nonempty subboxes.)
+     * Note that lb value is max for lower box, so must be < old max.
+     */
+    switch (n) {
+    case 0:
+      lb = (b1->c0max + b1->c0min) / 2;
+      b1->c0max = lb;
+      b2->c0min = lb+1;
+      break;
+    case 1:
+      lb = (b1->c1max + b1->c1min) / 2;
+      b1->c1max = lb;
+      b2->c1min = lb+1;
+      break;
+    case 2:
+      lb = (b1->c2max + b1->c2min) / 2;
+      b1->c2max = lb;
+      b2->c2min = lb+1;
+      break;
+    }
+    /* Update stats for boxes */
+    update_box(cinfo, b1);
+    update_box(cinfo, b2);
+    numboxes++;
+  }
+  return numboxes;
+}
+
+
+LOCAL(void)
+compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
+/* Compute representative color for a box, put it in colormap[icolor] */
+{
+  /* Current algorithm: mean weighted by pixels (not colors) */
+  /* Note it is important to get the rounding correct! */
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  hist3d histogram = cquantize->histogram;
+  histptr histp;
+  int c0,c1,c2;
+  int c0min,c0max,c1min,c1max,c2min,c2max;
+  long count;
+  long total = 0;
+  long c0total = 0;
+  long c1total = 0;
+  long c2total = 0;
+  
+  c0min = boxp->c0min;  c0max = boxp->c0max;
+  c1min = boxp->c1min;  c1max = boxp->c1max;
+  c2min = boxp->c2min;  c2max = boxp->c2max;
+  
+  for (c0 = c0min; c0 <= c0max; c0++)
+    for (c1 = c1min; c1 <= c1max; c1++) {
+      histp = & histogram[c0][c1][c2min];
+      for (c2 = c2min; c2 <= c2max; c2++) {
+	if ((count = *histp++) != 0) {
+	  total += count;
+	  c0total += ((c0 << C0_SHIFT) + ((1<<C0_SHIFT)>>1)) * count;
+	  c1total += ((c1 << C1_SHIFT) + ((1<<C1_SHIFT)>>1)) * count;
+	  c2total += ((c2 << C2_SHIFT) + ((1<<C2_SHIFT)>>1)) * count;
+	}
+      }
+    }
+  
+  cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total);
+  cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total);
+  cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total);
+}
+
+
+LOCAL(void)
+select_colors (j_decompress_ptr cinfo, int desired_colors)
+/* Master routine for color selection */
+{
+  boxptr boxlist;
+  int numboxes;
+  int i;
+
+  /* Allocate workspace for box list */
+  boxlist = (boxptr) (*cinfo->mem->alloc_small)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF(box));
+  /* Initialize one box containing whole space */
+  numboxes = 1;
+  boxlist[0].c0min = 0;
+  boxlist[0].c0max = MAXJSAMPLE >> C0_SHIFT;
+  boxlist[0].c1min = 0;
+  boxlist[0].c1max = MAXJSAMPLE >> C1_SHIFT;
+  boxlist[0].c2min = 0;
+  boxlist[0].c2max = MAXJSAMPLE >> C2_SHIFT;
+  /* Shrink it to actually-used volume and set its statistics */
+  update_box(cinfo, & boxlist[0]);
+  /* Perform median-cut to produce final box list */
+  numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors);
+  /* Compute the representative color for each box, fill colormap */
+  for (i = 0; i < numboxes; i++)
+    compute_color(cinfo, & boxlist[i], i);
+  cinfo->actual_number_of_colors = numboxes;
+  TRACEMS1(cinfo, 1, JTRC_QUANT_SELECTED, numboxes);
+}
+
+
+/*
+ * These routines are concerned with the time-critical task of mapping input
+ * colors to the nearest color in the selected colormap.
+ *
+ * We re-use the histogram space as an "inverse color map", essentially a
+ * cache for the results of nearest-color searches.  All colors within a
+ * histogram cell will be mapped to the same colormap entry, namely the one
+ * closest to the cell's center.  This may not be quite the closest entry to
+ * the actual input color, but it's almost as good.  A zero in the cache
+ * indicates we haven't found the nearest color for that cell yet; the array
+ * is cleared to zeroes before starting the mapping pass.  When we find the
+ * nearest color for a cell, its colormap index plus one is recorded in the
+ * cache for future use.  The pass2 scanning routines call fill_inverse_cmap
+ * when they need to use an unfilled entry in the cache.
+ *
+ * Our method of efficiently finding nearest colors is based on the "locally
+ * sorted search" idea described by Heckbert and on the incremental distance
+ * calculation described by Spencer W. Thomas in chapter III.1 of Graphics
+ * Gems II (James Arvo, ed.  Academic Press, 1991).  Thomas points out that
+ * the distances from a given colormap entry to each cell of the histogram can
+ * be computed quickly using an incremental method: the differences between
+ * distances to adjacent cells themselves differ by a constant.  This allows a
+ * fairly fast implementation of the "brute force" approach of computing the
+ * distance from every colormap entry to every histogram cell.  Unfortunately,
+ * it needs a work array to hold the best-distance-so-far for each histogram
+ * cell (because the inner loop has to be over cells, not colormap entries).
+ * The work array elements have to be INT32s, so the work array would need
+ * 256Kb at our recommended precision.  This is not feasible in DOS machines.
+ *
+ * To get around these problems, we apply Thomas' method to compute the
+ * nearest colors for only the cells within a small subbox of the histogram.
+ * The work array need be only as big as the subbox, so the memory usage
+ * problem is solved.  Furthermore, we need not fill subboxes that are never
+ * referenced in pass2; many images use only part of the color gamut, so a
+ * fair amount of work is saved.  An additional advantage of this
+ * approach is that we can apply Heckbert's locality criterion to quickly
+ * eliminate colormap entries that are far away from the subbox; typically
+ * three-fourths of the colormap entries are rejected by Heckbert's criterion,
+ * and we need not compute their distances to individual cells in the subbox.
+ * The speed of this approach is heavily influenced by the subbox size: too
+ * small means too much overhead, too big loses because Heckbert's criterion
+ * can't eliminate as many colormap entries.  Empirically the best subbox
+ * size seems to be about 1/512th of the histogram (1/8th in each direction).
+ *
+ * Thomas' article also describes a refined method which is asymptotically
+ * faster than the brute-force method, but it is also far more complex and
+ * cannot efficiently be applied to small subboxes.  It is therefore not
+ * useful for programs intended to be portable to DOS machines.  On machines
+ * with plenty of memory, filling the whole histogram in one shot with Thomas'
+ * refined method might be faster than the present code --- but then again,
+ * it might not be any faster, and it's certainly more complicated.
+ */
+
+
+/* log2(histogram cells in update box) for each axis; this can be adjusted */
+#define BOX_C0_LOG  (HIST_C0_BITS-3)
+#define BOX_C1_LOG  (HIST_C1_BITS-3)
+#define BOX_C2_LOG  (HIST_C2_BITS-3)
+
+#define BOX_C0_ELEMS  (1<<BOX_C0_LOG) /* # of hist cells in update box */
+#define BOX_C1_ELEMS  (1<<BOX_C1_LOG)
+#define BOX_C2_ELEMS  (1<<BOX_C2_LOG)
+
+#define BOX_C0_SHIFT  (C0_SHIFT + BOX_C0_LOG)
+#define BOX_C1_SHIFT  (C1_SHIFT + BOX_C1_LOG)
+#define BOX_C2_SHIFT  (C2_SHIFT + BOX_C2_LOG)
+
+
+/*
+ * The next three routines implement inverse colormap filling.  They could
+ * all be folded into one big routine, but splitting them up this way saves
+ * some stack space (the mindist[] and bestdist[] arrays need not coexist)
+ * and may allow some compilers to produce better code by registerizing more
+ * inner-loop variables.
+ */
+
+LOCAL(int)
+find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
+		    JSAMPLE colorlist[])
+/* Locate the colormap entries close enough to an update box to be candidates
+ * for the nearest entry to some cell(s) in the update box.  The update box
+ * is specified by the center coordinates of its first cell.  The number of
+ * candidate colormap entries is returned, and their colormap indexes are
+ * placed in colorlist[].
+ * This routine uses Heckbert's "locally sorted search" criterion to select
+ * the colors that need further consideration.
+ */
+{
+  int numcolors = cinfo->actual_number_of_colors;
+  int maxc0, maxc1, maxc2;
+  int centerc0, centerc1, centerc2;
+  int i, x, ncolors;
+  INT32 minmaxdist, min_dist, max_dist, tdist;
+  INT32 mindist[MAXNUMCOLORS];	/* min distance to colormap entry i */
+
+  /* Compute true coordinates of update box's upper corner and center.
+   * Actually we compute the coordinates of the center of the upper-corner
+   * histogram cell, which are the upper bounds of the volume we care about.
+   * Note that since ">>" rounds down, the "center" values may be closer to
+   * min than to max; hence comparisons to them must be "<=", not "<".
+   */
+  maxc0 = minc0 + ((1 << BOX_C0_SHIFT) - (1 << C0_SHIFT));
+  centerc0 = (minc0 + maxc0) >> 1;
+  maxc1 = minc1 + ((1 << BOX_C1_SHIFT) - (1 << C1_SHIFT));
+  centerc1 = (minc1 + maxc1) >> 1;
+  maxc2 = minc2 + ((1 << BOX_C2_SHIFT) - (1 << C2_SHIFT));
+  centerc2 = (minc2 + maxc2) >> 1;
+
+  /* For each color in colormap, find:
+   *  1. its minimum squared-distance to any point in the update box
+   *     (zero if color is within update box);
+   *  2. its maximum squared-distance to any point in the update box.
+   * Both of these can be found by considering only the corners of the box.
+   * We save the minimum distance for each color in mindist[];
+   * only the smallest maximum distance is of interest.
+   */
+  minmaxdist = 0x7FFFFFFFL;
+
+  for (i = 0; i < numcolors; i++) {
+    /* We compute the squared-c0-distance term, then add in the other two. */
+    x = GETJSAMPLE(cinfo->colormap[0][i]);
+    if (x < minc0) {
+      tdist = (x - minc0) * C0_SCALE;
+      min_dist = tdist*tdist;
+      tdist = (x - maxc0) * C0_SCALE;
+      max_dist = tdist*tdist;
+    } else if (x > maxc0) {
+      tdist = (x - maxc0) * C0_SCALE;
+      min_dist = tdist*tdist;
+      tdist = (x - minc0) * C0_SCALE;
+      max_dist = tdist*tdist;
+    } else {
+      /* within cell range so no contribution to min_dist */
+      min_dist = 0;
+      if (x <= centerc0) {
+	tdist = (x - maxc0) * C0_SCALE;
+	max_dist = tdist*tdist;
+      } else {
+	tdist = (x - minc0) * C0_SCALE;
+	max_dist = tdist*tdist;
+      }
+    }
+
+    x = GETJSAMPLE(cinfo->colormap[1][i]);
+    if (x < minc1) {
+      tdist = (x - minc1) * C1_SCALE;
+      min_dist += tdist*tdist;
+      tdist = (x - maxc1) * C1_SCALE;
+      max_dist += tdist*tdist;
+    } else if (x > maxc1) {
+      tdist = (x - maxc1) * C1_SCALE;
+      min_dist += tdist*tdist;
+      tdist = (x - minc1) * C1_SCALE;
+      max_dist += tdist*tdist;
+    } else {
+      /* within cell range so no contribution to min_dist */
+      if (x <= centerc1) {
+	tdist = (x - maxc1) * C1_SCALE;
+	max_dist += tdist*tdist;
+      } else {
+	tdist = (x - minc1) * C1_SCALE;
+	max_dist += tdist*tdist;
+      }
+    }
+
+    x = GETJSAMPLE(cinfo->colormap[2][i]);
+    if (x < minc2) {
+      tdist = (x - minc2) * C2_SCALE;
+      min_dist += tdist*tdist;
+      tdist = (x - maxc2) * C2_SCALE;
+      max_dist += tdist*tdist;
+    } else if (x > maxc2) {
+      tdist = (x - maxc2) * C2_SCALE;
+      min_dist += tdist*tdist;
+      tdist = (x - minc2) * C2_SCALE;
+      max_dist += tdist*tdist;
+    } else {
+      /* within cell range so no contribution to min_dist */
+      if (x <= centerc2) {
+	tdist = (x - maxc2) * C2_SCALE;
+	max_dist += tdist*tdist;
+      } else {
+	tdist = (x - minc2) * C2_SCALE;
+	max_dist += tdist*tdist;
+      }
+    }
+
+    mindist[i] = min_dist;	/* save away the results */
+    if (max_dist < minmaxdist)
+      minmaxdist = max_dist;
+  }
+
+  /* Now we know that no cell in the update box is more than minmaxdist
+   * away from some colormap entry.  Therefore, only colors that are
+   * within minmaxdist of some part of the box need be considered.
+   */
+  ncolors = 0;
+  for (i = 0; i < numcolors; i++) {
+    if (mindist[i] <= minmaxdist)
+      colorlist[ncolors++] = (JSAMPLE) i;
+  }
+  return ncolors;
+}
+
+
+LOCAL(void)
+find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
+		  int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[])
+/* Find the closest colormap entry for each cell in the update box,
+ * given the list of candidate colors prepared by find_nearby_colors.
+ * Return the indexes of the closest entries in the bestcolor[] array.
+ * This routine uses Thomas' incremental distance calculation method to
+ * find the distance from a colormap entry to successive cells in the box.
+ */
+{
+  int ic0, ic1, ic2;
+  int i, icolor;
+  register INT32 * bptr;	/* pointer into bestdist[] array */
+  JSAMPLE * cptr;		/* pointer into bestcolor[] array */
+  INT32 dist0, dist1;		/* initial distance values */
+  register INT32 dist2;		/* current distance in inner loop */
+  INT32 xx0, xx1;		/* distance increments */
+  register INT32 xx2;
+  INT32 inc0, inc1, inc2;	/* initial values for increments */
+  /* This array holds the distance to the nearest-so-far color for each cell */
+  INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
+
+  /* Initialize best-distance for each cell of the update box */
+  bptr = bestdist;
+  for (i = BOX_C0_ELEMS*BOX_C1_ELEMS*BOX_C2_ELEMS-1; i >= 0; i--)
+    *bptr++ = 0x7FFFFFFFL;
+  
+  /* For each color selected by find_nearby_colors,
+   * compute its distance to the center of each cell in the box.
+   * If that's less than best-so-far, update best distance and color number.
+   */
+  
+  /* Nominal steps between cell centers ("x" in Thomas article) */
+#define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
+#define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
+#define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
+  
+  for (i = 0; i < numcolors; i++) {
+    icolor = GETJSAMPLE(colorlist[i]);
+    /* Compute (square of) distance from minc0/c1/c2 to this color */
+    inc0 = (minc0 - GETJSAMPLE(cinfo->colormap[0][icolor])) * C0_SCALE;
+    dist0 = inc0*inc0;
+    inc1 = (minc1 - GETJSAMPLE(cinfo->colormap[1][icolor])) * C1_SCALE;
+    dist0 += inc1*inc1;
+    inc2 = (minc2 - GETJSAMPLE(cinfo->colormap[2][icolor])) * C2_SCALE;
+    dist0 += inc2*inc2;
+    /* Form the initial difference increments */
+    inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0;
+    inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1;
+    inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2;
+    /* Now loop over all cells in box, updating distance per Thomas method */
+    bptr = bestdist;
+    cptr = bestcolor;
+    xx0 = inc0;
+    for (ic0 = BOX_C0_ELEMS-1; ic0 >= 0; ic0--) {
+      dist1 = dist0;
+      xx1 = inc1;
+      for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) {
+	dist2 = dist1;
+	xx2 = inc2;
+	for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) {
+	  if (dist2 < *bptr) {
+	    *bptr = dist2;
+	    *cptr = (JSAMPLE) icolor;
+	  }
+	  dist2 += xx2;
+	  xx2 += 2 * STEP_C2 * STEP_C2;
+	  bptr++;
+	  cptr++;
+	}
+	dist1 += xx1;
+	xx1 += 2 * STEP_C1 * STEP_C1;
+      }
+      dist0 += xx0;
+      xx0 += 2 * STEP_C0 * STEP_C0;
+    }
+  }
+}
+
+
+LOCAL(void)
+fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
+/* Fill the inverse-colormap entries in the update box that contains */
+/* histogram cell c0/c1/c2.  (Only that one cell MUST be filled, but */
+/* we can fill as many others as we wish.) */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  hist3d histogram = cquantize->histogram;
+  int minc0, minc1, minc2;	/* lower left corner of update box */
+  int ic0, ic1, ic2;
+  register JSAMPLE * cptr;	/* pointer into bestcolor[] array */
+  register histptr cachep;	/* pointer into main cache array */
+  /* This array lists the candidate colormap indexes. */
+  JSAMPLE colorlist[MAXNUMCOLORS];
+  int numcolors;		/* number of candidate colors */
+  /* This array holds the actually closest colormap index for each cell. */
+  JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
+
+  /* Convert cell coordinates to update box ID */
+  c0 >>= BOX_C0_LOG;
+  c1 >>= BOX_C1_LOG;
+  c2 >>= BOX_C2_LOG;
+
+  /* Compute true coordinates of update box's origin corner.
+   * Actually we compute the coordinates of the center of the corner
+   * histogram cell, which are the lower bounds of the volume we care about.
+   */
+  minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1);
+  minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1);
+  minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1);
+  
+  /* Determine which colormap entries are close enough to be candidates
+   * for the nearest entry to some cell in the update box.
+   */
+  numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist);
+
+  /* Determine the actually nearest colors. */
+  find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist,
+		   bestcolor);
+
+  /* Save the best color numbers (plus 1) in the main cache array */
+  c0 <<= BOX_C0_LOG;		/* convert ID back to base cell indexes */
+  c1 <<= BOX_C1_LOG;
+  c2 <<= BOX_C2_LOG;
+  cptr = bestcolor;
+  for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) {
+    for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) {
+      cachep = & histogram[c0+ic0][c1+ic1][c2];
+      for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) {
+	*cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1);
+      }
+    }
+  }
+}
+
+
+/*
+ * Map some rows of pixels to the output colormapped representation.
+ */
+
+METHODDEF(void)
+pass2_no_dither (j_decompress_ptr cinfo,
+		 JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
+/* This version performs no dithering */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  hist3d histogram = cquantize->histogram;
+  register JSAMPROW inptr, outptr;
+  register histptr cachep;
+  register int c0, c1, c2;
+  int row;
+  JDIMENSION col;
+  JDIMENSION width = cinfo->output_width;
+
+  for (row = 0; row < num_rows; row++) {
+    inptr = input_buf[row];
+    outptr = output_buf[row];
+    for (col = width; col > 0; col--) {
+      /* get pixel value and index into the cache */
+      c0 = GETJSAMPLE(*inptr++) >> C0_SHIFT;
+      c1 = GETJSAMPLE(*inptr++) >> C1_SHIFT;
+      c2 = GETJSAMPLE(*inptr++) >> C2_SHIFT;
+      cachep = & histogram[c0][c1][c2];
+      /* If we have not seen this color before, find nearest colormap entry */
+      /* and update the cache */
+      if (*cachep == 0)
+	fill_inverse_cmap(cinfo, c0,c1,c2);
+      /* Now emit the colormap index for this cell */
+      *outptr++ = (JSAMPLE) (*cachep - 1);
+    }
+  }
+}
+
+
+METHODDEF(void)
+pass2_fs_dither (j_decompress_ptr cinfo,
+		 JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
+/* This version performs Floyd-Steinberg dithering */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  hist3d histogram = cquantize->histogram;
+  register LOCFSERROR cur0, cur1, cur2;	/* current error or pixel value */
+  LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */
+  LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */
+  register FSERRPTR errorptr;	/* => fserrors[] at column before current */
+  JSAMPROW inptr;		/* => current input pixel */
+  JSAMPROW outptr;		/* => current output pixel */
+  histptr cachep;
+  int dir;			/* +1 or -1 depending on direction */
+  int dir3;			/* 3*dir, for advancing inptr & errorptr */
+  int row;
+  JDIMENSION col;
+  JDIMENSION width = cinfo->output_width;
+  JSAMPLE *range_limit = cinfo->sample_range_limit;
+  int *error_limit = cquantize->error_limiter;
+  JSAMPROW colormap0 = cinfo->colormap[0];
+  JSAMPROW colormap1 = cinfo->colormap[1];
+  JSAMPROW colormap2 = cinfo->colormap[2];
+  SHIFT_TEMPS
+
+  for (row = 0; row < num_rows; row++) {
+    inptr = input_buf[row];
+    outptr = output_buf[row];
+    if (cquantize->on_odd_row) {
+      /* work right to left in this row */
+      inptr += (width-1) * 3;	/* so point to rightmost pixel */
+      outptr += width-1;
+      dir = -1;
+      dir3 = -3;
+      errorptr = cquantize->fserrors + (width+1)*3; /* => entry after last column */
+      cquantize->on_odd_row = FALSE; /* flip for next time */
+    } else {
+      /* work left to right in this row */
+      dir = 1;
+      dir3 = 3;
+      errorptr = cquantize->fserrors; /* => entry before first real column */
+      cquantize->on_odd_row = TRUE; /* flip for next time */
+    }
+    /* Preset error values: no error propagated to first pixel from left */
+    cur0 = cur1 = cur2 = 0;
+    /* and no error propagated to row below yet */
+    belowerr0 = belowerr1 = belowerr2 = 0;
+    bpreverr0 = bpreverr1 = bpreverr2 = 0;
+
+    for (col = width; col > 0; col--) {
+      /* curN holds the error propagated from the previous pixel on the
+       * current line.  Add the error propagated from the previous line
+       * to form the complete error correction term for this pixel, and
+       * round the error term (which is expressed * 16) to an integer.
+       * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct
+       * for either sign of the error value.
+       * Note: errorptr points to *previous* column's array entry.
+       */
+      cur0 = RIGHT_SHIFT(cur0 + errorptr[dir3+0] + 8, 4);
+      cur1 = RIGHT_SHIFT(cur1 + errorptr[dir3+1] + 8, 4);
+      cur2 = RIGHT_SHIFT(cur2 + errorptr[dir3+2] + 8, 4);
+      /* Limit the error using transfer function set by init_error_limit.
+       * See comments with init_error_limit for rationale.
+       */
+      cur0 = error_limit[cur0];
+      cur1 = error_limit[cur1];
+      cur2 = error_limit[cur2];
+      /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE.
+       * The maximum error is +- MAXJSAMPLE (or less with error limiting);
+       * this sets the required size of the range_limit array.
+       */
+      cur0 += GETJSAMPLE(inptr[0]);
+      cur1 += GETJSAMPLE(inptr[1]);
+      cur2 += GETJSAMPLE(inptr[2]);
+      cur0 = GETJSAMPLE(range_limit[cur0]);
+      cur1 = GETJSAMPLE(range_limit[cur1]);
+      cur2 = GETJSAMPLE(range_limit[cur2]);
+      /* Index into the cache with adjusted pixel value */
+      cachep = & histogram[cur0>>C0_SHIFT][cur1>>C1_SHIFT][cur2>>C2_SHIFT];
+      /* If we have not seen this color before, find nearest colormap */
+      /* entry and update the cache */
+      if (*cachep == 0)
+	fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT);
+      /* Now emit the colormap index for this cell */
+      { register int pixcode = *cachep - 1;
+	*outptr = (JSAMPLE) pixcode;
+	/* Compute representation error for this pixel */
+	cur0 -= GETJSAMPLE(colormap0[pixcode]);
+	cur1 -= GETJSAMPLE(colormap1[pixcode]);
+	cur2 -= GETJSAMPLE(colormap2[pixcode]);
+      }
+      /* Compute error fractions to be propagated to adjacent pixels.
+       * Add these into the running sums, and simultaneously shift the
+       * next-line error sums left by 1 column.
+       */
+      { register LOCFSERROR bnexterr, delta;
+
+	bnexterr = cur0;	/* Process component 0 */
+	delta = cur0 * 2;
+	cur0 += delta;		/* form error * 3 */
+	errorptr[0] = (FSERROR) (bpreverr0 + cur0);
+	cur0 += delta;		/* form error * 5 */
+	bpreverr0 = belowerr0 + cur0;
+	belowerr0 = bnexterr;
+	cur0 += delta;		/* form error * 7 */
+	bnexterr = cur1;	/* Process component 1 */
+	delta = cur1 * 2;
+	cur1 += delta;		/* form error * 3 */
+	errorptr[1] = (FSERROR) (bpreverr1 + cur1);
+	cur1 += delta;		/* form error * 5 */
+	bpreverr1 = belowerr1 + cur1;
+	belowerr1 = bnexterr;
+	cur1 += delta;		/* form error * 7 */
+	bnexterr = cur2;	/* Process component 2 */
+	delta = cur2 * 2;
+	cur2 += delta;		/* form error * 3 */
+	errorptr[2] = (FSERROR) (bpreverr2 + cur2);
+	cur2 += delta;		/* form error * 5 */
+	bpreverr2 = belowerr2 + cur2;
+	belowerr2 = bnexterr;
+	cur2 += delta;		/* form error * 7 */
+      }
+      /* At this point curN contains the 7/16 error value to be propagated
+       * to the next pixel on the current line, and all the errors for the
+       * next line have been shifted over.  We are therefore ready to move on.
+       */
+      inptr += dir3;		/* Advance pixel pointers to next column */
+      outptr += dir;
+      errorptr += dir3;		/* advance errorptr to current column */
+    }
+    /* Post-loop cleanup: we must unload the final error values into the
+     * final fserrors[] entry.  Note we need not unload belowerrN because
+     * it is for the dummy column before or after the actual array.
+     */
+    errorptr[0] = (FSERROR) bpreverr0; /* unload prev errs into array */
+    errorptr[1] = (FSERROR) bpreverr1;
+    errorptr[2] = (FSERROR) bpreverr2;
+  }
+}
+
+
+/*
+ * Initialize the error-limiting transfer function (lookup table).
+ * The raw F-S error computation can potentially compute error values of up to
+ * +- MAXJSAMPLE.  But we want the maximum correction applied to a pixel to be
+ * much less, otherwise obviously wrong pixels will be created.  (Typical
+ * effects include weird fringes at color-area boundaries, isolated bright
+ * pixels in a dark area, etc.)  The standard advice for avoiding this problem
+ * is to ensure that the "corners" of the color cube are allocated as output
+ * colors; then repeated errors in the same direction cannot cause cascading
+ * error buildup.  However, that only prevents the error from getting
+ * completely out of hand; Aaron Giles reports that error limiting improves
+ * the results even with corner colors allocated.
+ * A simple clamping of the error values to about +- MAXJSAMPLE/8 works pretty
+ * well, but the smoother transfer function used below is even better.  Thanks
+ * to Aaron Giles for this idea.
+ */
+
+LOCAL(void)
+init_error_limit (j_decompress_ptr cinfo)
+/* Allocate and fill in the error_limiter table */
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  int * table;
+  int in, out;
+
+  table = (int *) (*cinfo->mem->alloc_small)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * SIZEOF(int));
+  table += MAXJSAMPLE;		/* so can index -MAXJSAMPLE .. +MAXJSAMPLE */
+  cquantize->error_limiter = table;
+
+#define STEPSIZE ((MAXJSAMPLE+1)/16)
+  /* Map errors 1:1 up to +- MAXJSAMPLE/16 */
+  out = 0;
+  for (in = 0; in < STEPSIZE; in++, out++) {
+    table[in] = out; table[-in] = -out;
+  }
+  /* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */
+  for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) {
+    table[in] = out; table[-in] = -out;
+  }
+  /* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */
+  for (; in <= MAXJSAMPLE; in++) {
+    table[in] = out; table[-in] = -out;
+  }
+#undef STEPSIZE
+}
+
+
+/*
+ * Finish up at the end of each pass.
+ */
+
+METHODDEF(void)
+finish_pass1 (j_decompress_ptr cinfo)
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+
+  /* Select the representative colors and fill in cinfo->colormap */
+  cinfo->colormap = cquantize->sv_colormap;
+  select_colors(cinfo, cquantize->desired);
+  /* Force next pass to zero the color index table */
+  cquantize->needs_zeroed = TRUE;
+}
+
+
+METHODDEF(void)
+finish_pass2 (j_decompress_ptr cinfo)
+{
+  /* no work */
+}
+
+
+/*
+ * Initialize for each processing pass.
+ */
+
+METHODDEF(void)
+start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+  hist3d histogram = cquantize->histogram;
+  int i;
+
+  /* Only F-S dithering or no dithering is supported. */
+  /* If user asks for ordered dither, give him F-S. */
+  if (cinfo->dither_mode != JDITHER_NONE)
+    cinfo->dither_mode = JDITHER_FS;
+
+  if (is_pre_scan) {
+    /* Set up method pointers */
+    cquantize->pub.color_quantize = prescan_quantize;
+    cquantize->pub.finish_pass = finish_pass1;
+    cquantize->needs_zeroed = TRUE; /* Always zero histogram */
+  } else {
+    /* Set up method pointers */
+    if (cinfo->dither_mode == JDITHER_FS)
+      cquantize->pub.color_quantize = pass2_fs_dither;
+    else
+      cquantize->pub.color_quantize = pass2_no_dither;
+    cquantize->pub.finish_pass = finish_pass2;
+
+    /* Make sure color count is acceptable */
+    i = cinfo->actual_number_of_colors;
+    if (i < 1)
+      ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 1);
+    if (i > MAXNUMCOLORS)
+      ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
+
+    if (cinfo->dither_mode == JDITHER_FS) {
+      size_t arraysize = (size_t) ((cinfo->output_width + 2) *
+				   (3 * SIZEOF(FSERROR)));
+      /* Allocate Floyd-Steinberg workspace if we didn't already. */
+      if (cquantize->fserrors == NULL)
+	cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
+	  ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize);
+      /* Initialize the propagated errors to zero. */
+      jzero_far((void FAR *) cquantize->fserrors, arraysize);
+      /* Make the error-limit table if we didn't already. */
+      if (cquantize->error_limiter == NULL)
+	init_error_limit(cinfo);
+      cquantize->on_odd_row = FALSE;
+    }
+
+  }
+  /* Zero the histogram or inverse color map, if necessary */
+  if (cquantize->needs_zeroed) {
+    for (i = 0; i < HIST_C0_ELEMS; i++) {
+      jzero_far((void FAR *) histogram[i],
+		HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell));
+    }
+    cquantize->needs_zeroed = FALSE;
+  }
+}
+
+
+/*
+ * Switch to a new external colormap between output passes.
+ */
+
+METHODDEF(void)
+new_color_map_2_quant (j_decompress_ptr cinfo)
+{
+  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+
+  /* Reset the inverse color map */
+  cquantize->needs_zeroed = TRUE;
+}
+
+
+/*
+ * Module initialization routine for 2-pass color quantization.
+ */
+
+GLOBAL(void)
+jinit_2pass_quantizer (j_decompress_ptr cinfo)
+{
+  my_cquantize_ptr cquantize;
+  int i;
+
+  cquantize = (my_cquantize_ptr)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				SIZEOF(my_cquantizer));
+  cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
+  cquantize->pub.start_pass = start_pass_2_quant;
+  cquantize->pub.new_color_map = new_color_map_2_quant;
+  cquantize->fserrors = NULL;	/* flag optional arrays not allocated */
+  cquantize->error_limiter = NULL;
+
+  /* Make sure jdmaster didn't give me a case I can't handle */
+  if (cinfo->out_color_components != 3)
+    ERREXIT(cinfo, JERR_NOTIMPL);
+
+  /* Allocate the histogram/inverse colormap storage */
+  cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * SIZEOF(hist2d));
+  for (i = 0; i < HIST_C0_ELEMS; i++) {
+    cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE,
+       HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell));
+  }
+  cquantize->needs_zeroed = TRUE; /* histogram is garbage now */
+
+  /* Allocate storage for the completed colormap, if required.
+   * We do this now since it is FAR storage and may affect
+   * the memory manager's space calculations.
+   */
+  if (cinfo->enable_2pass_quant) {
+    /* Make sure color count is acceptable */
+    int desired = cinfo->desired_number_of_colors;
+    /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */
+    if (desired < 8)
+      ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8);
+    /* Make sure colormap indexes can be represented by JSAMPLEs */
+    if (desired > MAXNUMCOLORS)
+      ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
+    cquantize->sv_colormap = (*cinfo->mem->alloc_sarray)
+      ((j_common_ptr) cinfo,JPOOL_IMAGE, (JDIMENSION) desired, (JDIMENSION) 3);
+    cquantize->desired = desired;
+  } else
+    cquantize->sv_colormap = NULL;
+
+  /* Only F-S dithering or no dithering is supported. */
+  /* If user asks for ordered dither, give him F-S. */
+  if (cinfo->dither_mode != JDITHER_NONE)
+    cinfo->dither_mode = JDITHER_FS;
+
+  /* Allocate Floyd-Steinberg workspace if necessary.
+   * This isn't really needed until pass 2, but again it is FAR storage.
+   * Although we will cope with a later change in dither_mode,
+   * we do not promise to honor max_memory_to_use if dither_mode changes.
+   */
+  if (cinfo->dither_mode == JDITHER_FS) {
+    cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE,
+       (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF(FSERROR))));
+    /* Might as well create the error-limiting table too. */
+    init_error_limit(cinfo);
+  }
+}
+
+#endif /* QUANT_2PASS_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jutils.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jutils.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jutils.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,179 @@
+/*
+ * jutils.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains tables and miscellaneous utility routines needed
+ * for both compression and decompression.
+ * Note we prefix all global names with "j" to minimize conflicts with
+ * a surrounding application.
+ */
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+
+/*
+ * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element
+ * of a DCT block read in natural order (left to right, top to bottom).
+ */
+
+#if 0				/* This table is not actually needed in v6a */
+
+const int jpeg_zigzag_order[DCTSIZE2] = {
+   0,  1,  5,  6, 14, 15, 27, 28,
+   2,  4,  7, 13, 16, 26, 29, 42,
+   3,  8, 12, 17, 25, 30, 41, 43,
+   9, 11, 18, 24, 31, 40, 44, 53,
+  10, 19, 23, 32, 39, 45, 52, 54,
+  20, 22, 33, 38, 46, 51, 55, 60,
+  21, 34, 37, 47, 50, 56, 59, 61,
+  35, 36, 48, 49, 57, 58, 62, 63
+};
+
+#endif
+
+/*
+ * jpeg_natural_order[i] is the natural-order position of the i'th element
+ * of zigzag order.
+ *
+ * When reading corrupted data, the Huffman decoders could attempt
+ * to reference an entry beyond the end of this array (if the decoded
+ * zero run length reaches past the end of the block).  To prevent
+ * wild stores without adding an inner-loop test, we put some extra
+ * "63"s after the real entries.  This will cause the extra coefficient
+ * to be stored in location 63 of the block, not somewhere random.
+ * The worst case would be a run-length of 15, which means we need 16
+ * fake entries.
+ */
+
+const int jpeg_natural_order[DCTSIZE2+16] = {
+  0,  1,  8, 16,  9,  2,  3, 10,
+ 17, 24, 32, 25, 18, 11,  4,  5,
+ 12, 19, 26, 33, 40, 48, 41, 34,
+ 27, 20, 13,  6,  7, 14, 21, 28,
+ 35, 42, 49, 56, 57, 50, 43, 36,
+ 29, 22, 15, 23, 30, 37, 44, 51,
+ 58, 59, 52, 45, 38, 31, 39, 46,
+ 53, 60, 61, 54, 47, 55, 62, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */
+ 63, 63, 63, 63, 63, 63, 63, 63
+};
+
+
+/*
+ * Arithmetic utilities
+ */
+
+GLOBAL(long)
+jdiv_round_up (long a, long b)
+/* Compute a/b rounded up to next integer, ie, ceil(a/b) */
+/* Assumes a >= 0, b > 0 */
+{
+  return (a + b - 1L) / b;
+}
+
+
+GLOBAL(long)
+jround_up (long a, long b)
+/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */
+/* Assumes a >= 0, b > 0 */
+{
+  a += b - 1L;
+  return a - (a % b);
+}
+
+
+/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
+ * and coefficient-block arrays.  This won't work on 80x86 because the arrays
+ * are FAR and we're assuming a small-pointer memory model.  However, some
+ * DOS compilers provide far-pointer versions of memcpy() and memset() even
+ * in the small-model libraries.  These will be used if USE_FMEM is defined.
+ * Otherwise, the routines below do it the hard way.  (The performance cost
+ * is not all that great, because these routines aren't very heavily used.)
+ */
+
+#ifndef NEED_FAR_POINTERS	/* normal case, same as regular macros */
+#define FMEMCOPY(dest,src,size)	MEMCOPY(dest,src,size)
+#define FMEMZERO(target,size)	MEMZERO(target,size)
+#else				/* 80x86 case, define if we can */
+#ifdef USE_FMEM
+#define FMEMCOPY(dest,src,size)	_fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size))
+#define FMEMZERO(target,size)	_fmemset((void FAR *)(target), 0, (size_t)(size))
+#endif
+#endif
+
+
+GLOBAL(void)
+jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
+		   JSAMPARRAY output_array, int dest_row,
+		   int num_rows, JDIMENSION num_cols)
+/* Copy some rows of samples from one place to another.
+ * num_rows rows are copied from input_array[source_row++]
+ * to output_array[dest_row++]; these areas may overlap for duplication.
+ * The source and destination arrays must be at least as wide as num_cols.
+ */
+{
+  register JSAMPROW inptr, outptr;
+#ifdef FMEMCOPY
+  register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE));
+#else
+  register JDIMENSION count;
+#endif
+  register int row;
+
+  input_array += source_row;
+  output_array += dest_row;
+
+  for (row = num_rows; row > 0; row--) {
+    inptr = *input_array++;
+    outptr = *output_array++;
+#ifdef FMEMCOPY
+    FMEMCOPY(outptr, inptr, count);
+#else
+    for (count = num_cols; count > 0; count--)
+      *outptr++ = *inptr++;	/* needn't bother with GETJSAMPLE() here */
+#endif
+  }
+}
+
+
+GLOBAL(void)
+jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row,
+		 JDIMENSION num_blocks)
+/* Copy a row of coefficient blocks from one place to another. */
+{
+#ifdef FMEMCOPY
+  FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF)));
+#else
+  register JCOEFPTR inptr, outptr;
+  register long count;
+
+  inptr = (JCOEFPTR) input_row;
+  outptr = (JCOEFPTR) output_row;
+  for (count = (long) num_blocks * DCTSIZE2; count > 0; count--) {
+    *outptr++ = *inptr++;
+  }
+#endif
+}
+
+
+GLOBAL(void)
+jzero_far (void FAR * target, size_t bytestozero)
+/* Zero out a chunk of FAR memory. */
+/* This might be sample-array data, block-array data, or alloc_large data. */
+{
+#ifdef FMEMZERO
+  FMEMZERO(target, bytestozero);
+#else
+  register char FAR * ptr = (char FAR *) target;
+  register size_t count;
+
+  for (count = bytestozero; count > 0; count--) {
+    *ptr++ = 0;
+  }
+#endif
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/jversion.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/jversion.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/jversion.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,14 @@
+/*
+ * jversion.h
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains software version identification.
+ */
+
+
+#define JVERSION	"6b  27-Mar-1998"
+
+#define JCOPYRIGHT	"Copyright (C) 1998, Thomas G. Lane"

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/libjpeg.doc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/libjpeg.doc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/libjpeg.doc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,3006 @@
+USING THE IJG JPEG LIBRARY
+
+Copyright (C) 1994-1998, Thomas G. Lane.
+This file is part of the Independent JPEG Group's software.
+For conditions of distribution and use, see the accompanying README file.
+
+
+This file describes how to use the IJG JPEG library within an application
+program.  Read it if you want to write a program that uses the library.
+
+The file example.c provides heavily commented skeleton code for calling the
+JPEG library.  Also see jpeglib.h (the include file to be used by application
+programs) for full details about data structures and function parameter lists.
+The library source code, of course, is the ultimate reference.
+
+Note that there have been *major* changes from the application interface
+presented by IJG version 4 and earlier versions.  The old design had several
+inherent limitations, and it had accumulated a lot of cruft as we added
+features while trying to minimize application-interface changes.  We have
+sacrificed backward compatibility in the version 5 rewrite, but we think the
+improvements justify this.
+
+
+TABLE OF CONTENTS
+-----------------
+
+Overview:
+	Functions provided by the library
+	Outline of typical usage
+Basic library usage:
+	Data formats
+	Compression details
+	Decompression details
+	Mechanics of usage: include files, linking, etc
+Advanced features:
+	Compression parameter selection
+	Decompression parameter selection
+	Special color spaces
+	Error handling
+	Compressed data handling (source and destination managers)
+	I/O suspension
+	Progressive JPEG support
+	Buffered-image mode
+	Abbreviated datastreams and multiple images
+	Special markers
+	Raw (downsampled) image data
+	Really raw data: DCT coefficients
+	Progress monitoring
+	Memory management
+	Memory usage
+	Library compile-time options
+	Portability considerations
+	Notes for MS-DOS implementors
+
+You should read at least the overview and basic usage sections before trying
+to program with the library.  The sections on advanced features can be read
+if and when you need them.
+
+
+OVERVIEW
+========
+
+Functions provided by the library
+---------------------------------
+
+The IJG JPEG library provides C code to read and write JPEG-compressed image
+files.  The surrounding application program receives or supplies image data a
+scanline at a time, using a straightforward uncompressed image format.  All
+details of color conversion and other preprocessing/postprocessing can be
+handled by the library.
+
+The library includes a substantial amount of code that is not covered by the
+JPEG standard but is necessary for typical applications of JPEG.  These
+functions preprocess the image before JPEG compression or postprocess it after
+decompression.  They include colorspace conversion, downsampling/upsampling,
+and color quantization.  The application indirectly selects use of this code
+by specifying the format in which it wishes to supply or receive image data.
+For example, if colormapped output is requested, then the decompression
+library automatically invokes color quantization.
+
+A wide range of quality vs. speed tradeoffs are possible in JPEG processing,
+and even more so in decompression postprocessing.  The decompression library
+provides multiple implementations that cover most of the useful tradeoffs,
+ranging from very-high-quality down to fast-preview operation.  On the
+compression side we have generally not provided low-quality choices, since
+compression is normally less time-critical.  It should be understood that the
+low-quality modes may not meet the JPEG standard's accuracy requirements;
+nonetheless, they are useful for viewers.
+
+A word about functions *not* provided by the library.  We handle a subset of
+the ISO JPEG standard; most baseline, extended-sequential, and progressive
+JPEG processes are supported.  (Our subset includes all features now in common
+use.)  Unsupported ISO options include:
+	* Hierarchical storage
+	* Lossless JPEG
+	* Arithmetic entropy coding (unsupported for legal reasons)
+	* DNL marker
+	* Nonintegral subsampling ratios
+We support both 8- and 12-bit data precision, but this is a compile-time
+choice rather than a run-time choice; hence it is difficult to use both
+precisions in a single application.
+
+By itself, the library handles only interchange JPEG datastreams --- in
+particular the widely used JFIF file format.  The library can be used by
+surrounding code to process interchange or abbreviated JPEG datastreams that
+are embedded in more complex file formats.  (For example, this library is
+used by the free LIBTIFF library to support JPEG compression in TIFF.)
+
+
+Outline of typical usage
+------------------------
+
+The rough outline of a JPEG compression operation is:
+
+	Allocate and initialize a JPEG compression object
+	Specify the destination for the compressed data (eg, a file)
+	Set parameters for compression, including image size & colorspace
+	jpeg_start_compress(...);
+	while (scan lines remain to be written)
+		jpeg_write_scanlines(...);
+	jpeg_finish_compress(...);
+	Release the JPEG compression object
+
+A JPEG compression object holds parameters and working state for the JPEG
+library.  We make creation/destruction of the object separate from starting
+or finishing compression of an image; the same object can be re-used for a
+series of image compression operations.  This makes it easy to re-use the
+same parameter settings for a sequence of images.  Re-use of a JPEG object
+also has important implications for processing abbreviated JPEG datastreams,
+as discussed later.
+
+The image data to be compressed is supplied to jpeg_write_scanlines() from
+in-memory buffers.  If the application is doing file-to-file compression,
+reading image data from the source file is the application's responsibility.
+The library emits compressed data by calling a "data destination manager",
+which typically will write the data into a file; but the application can
+provide its own destination manager to do something else.
+
+Similarly, the rough outline of a JPEG decompression operation is:
+
+	Allocate and initialize a JPEG decompression object
+	Specify the source of the compressed data (eg, a file)
+	Call jpeg_read_header() to obtain image info
+	Set parameters for decompression
+	jpeg_start_decompress(...);
+	while (scan lines remain to be read)
+		jpeg_read_scanlines(...);
+	jpeg_finish_decompress(...);
+	Release the JPEG decompression object
+
+This is comparable to the compression outline except that reading the
+datastream header is a separate step.  This is helpful because information
+about the image's size, colorspace, etc is available when the application
+selects decompression parameters.  For example, the application can choose an
+output scaling ratio that will fit the image into the available screen size.
+
+The decompression library obtains compressed data by calling a data source
+manager, which typically will read the data from a file; but other behaviors
+can be obtained with a custom source manager.  Decompressed data is delivered
+into in-memory buffers passed to jpeg_read_scanlines().
+
+It is possible to abort an incomplete compression or decompression operation
+by calling jpeg_abort(); or, if you do not need to retain the JPEG object,
+simply release it by calling jpeg_destroy().
+
+JPEG compression and decompression objects are two separate struct types.
+However, they share some common fields, and certain routines such as
+jpeg_destroy() can work on either type of object.
+
+The JPEG library has no static variables: all state is in the compression
+or decompression object.  Therefore it is possible to process multiple
+compression and decompression operations concurrently, using multiple JPEG
+objects.
+
+Both compression and decompression can be done in an incremental memory-to-
+memory fashion, if suitable source/destination managers are used.  See the
+section on "I/O suspension" for more details.
+
+
+BASIC LIBRARY USAGE
+===================
+
+Data formats
+------------
+
+Before diving into procedural details, it is helpful to understand the
+image data format that the JPEG library expects or returns.
+
+The standard input image format is a rectangular array of pixels, with each
+pixel having the same number of "component" or "sample" values (color
+channels).  You must specify how many components there are and the colorspace
+interpretation of the components.  Most applications will use RGB data
+(three components per pixel) or grayscale data (one component per pixel).
+PLEASE NOTE THAT RGB DATA IS THREE SAMPLES PER PIXEL, GRAYSCALE ONLY ONE.
+A remarkable number of people manage to miss this, only to find that their
+programs don't work with grayscale JPEG files.
+
+There is no provision for colormapped input.  JPEG files are always full-color
+or full grayscale (or sometimes another colorspace such as CMYK).  You can
+feed in a colormapped image by expanding it to full-color format.  However
+JPEG often doesn't work very well with source data that has been colormapped,
+because of dithering noise.  This is discussed in more detail in the JPEG FAQ
+and the other references mentioned in the README file.
+
+Pixels are stored by scanlines, with each scanline running from left to
+right.  The component values for each pixel are adjacent in the row; for
+example, R,G,B,R,G,B,R,G,B,... for 24-bit RGB color.  Each scanline is an
+array of data type JSAMPLE --- which is typically "unsigned char", unless
+you've changed jmorecfg.h.  (You can also change the RGB pixel layout, say
+to B,G,R order, by modifying jmorecfg.h.  But see the restrictions listed in
+that file before doing so.)
+
+A 2-D array of pixels is formed by making a list of pointers to the starts of
+scanlines; so the scanlines need not be physically adjacent in memory.  Even
+if you process just one scanline at a time, you must make a one-element
+pointer array to conform to this structure.  Pointers to JSAMPLE rows are of
+type JSAMPROW, and the pointer to the pointer array is of type JSAMPARRAY.
+
+The library accepts or supplies one or more complete scanlines per call.
+It is not possible to process part of a row at a time.  Scanlines are always
+processed top-to-bottom.  You can process an entire image in one call if you
+have it all in memory, but usually it's simplest to process one scanline at
+a time.
+
+For best results, source data values should have the precision specified by
+BITS_IN_JSAMPLE (normally 8 bits).  For instance, if you choose to compress
+data that's only 6 bits/channel, you should left-justify each value in a
+byte before passing it to the compressor.  If you need to compress data
+that has more than 8 bits/channel, compile with BITS_IN_JSAMPLE = 12.
+(See "Library compile-time options", later.)
+
+
+The data format returned by the decompressor is the same in all details,
+except that colormapped output is supported.  (Again, a JPEG file is never
+colormapped.  But you can ask the decompressor to perform on-the-fly color
+quantization to deliver colormapped output.)  If you request colormapped
+output then the returned data array contains a single JSAMPLE per pixel;
+its value is an index into a color map.  The color map is represented as
+a 2-D JSAMPARRAY in which each row holds the values of one color component,
+that is, colormap[i][j] is the value of the i'th color component for pixel
+value (map index) j.  Note that since the colormap indexes are stored in
+JSAMPLEs, the maximum number of colors is limited by the size of JSAMPLE
+(ie, at most 256 colors for an 8-bit JPEG library).
+
+
+Compression details
+-------------------
+
+Here we revisit the JPEG compression outline given in the overview.
+
+1. Allocate and initialize a JPEG compression object.
+
+A JPEG compression object is a "struct jpeg_compress_struct".  (It also has
+a bunch of subsidiary structures which are allocated via malloc(), but the
+application doesn't control those directly.)  This struct can be just a local
+variable in the calling routine, if a single routine is going to execute the
+whole JPEG compression sequence.  Otherwise it can be static or allocated
+from malloc().
+
+You will also need a structure representing a JPEG error handler.  The part
+of this that the library cares about is a "struct jpeg_error_mgr".  If you
+are providing your own error handler, you'll typically want to embed the
+jpeg_error_mgr struct in a larger structure; this is discussed later under
+"Error handling".  For now we'll assume you are just using the default error
+handler.  The default error handler will print JPEG error/warning messages
+on stderr, and it will call exit() if a fatal error occurs.
+
+You must initialize the error handler structure, store a pointer to it into
+the JPEG object's "err" field, and then call jpeg_create_compress() to
+initialize the rest of the JPEG object.
+
+Typical code for this step, if you are using the default error handler, is
+
+	struct jpeg_compress_struct cinfo;
+	struct jpeg_error_mgr jerr;
+	...
+	cinfo.err = jpeg_std_error(&jerr);
+	jpeg_create_compress(&cinfo);
+
+jpeg_create_compress allocates a small amount of memory, so it could fail
+if you are out of memory.  In that case it will exit via the error handler;
+that's why the error handler must be initialized first.
+
+
+2. Specify the destination for the compressed data (eg, a file).
+
+As previously mentioned, the JPEG library delivers compressed data to a
+"data destination" module.  The library includes one data destination
+module which knows how to write to a stdio stream.  You can use your own
+destination module if you want to do something else, as discussed later.
+
+If you use the standard destination module, you must open the target stdio
+stream beforehand.  Typical code for this step looks like:
+
+	FILE * outfile;
+	...
+	if ((outfile = fopen(filename, "wb")) == NULL) {
+	    fprintf(stderr, "can't open %s\n", filename);
+	    exit(1);
+	}
+	jpeg_stdio_dest(&cinfo, outfile);
+
+where the last line invokes the standard destination module.
+
+WARNING: it is critical that the binary compressed data be delivered to the
+output file unchanged.  On non-Unix systems the stdio library may perform
+newline translation or otherwise corrupt binary data.  To suppress this
+behavior, you may need to use a "b" option to fopen (as shown above), or use
+setmode() or another routine to put the stdio stream in binary mode.  See
+cjpeg.c and djpeg.c for code that has been found to work on many systems.
+
+You can select the data destination after setting other parameters (step 3),
+if that's more convenient.  You may not change the destination between
+calling jpeg_start_compress() and jpeg_finish_compress().
+
+
+3. Set parameters for compression, including image size & colorspace.
+
+You must supply information about the source image by setting the following
+fields in the JPEG object (cinfo structure):
+
+	image_width		Width of image, in pixels
+	image_height		Height of image, in pixels
+	input_components	Number of color channels (samples per pixel)
+	in_color_space		Color space of source image
+
+The image dimensions are, hopefully, obvious.  JPEG supports image dimensions
+of 1 to 64K pixels in either direction.  The input color space is typically
+RGB or grayscale, and input_components is 3 or 1 accordingly.  (See "Special
+color spaces", later, for more info.)  The in_color_space field must be
+assigned one of the J_COLOR_SPACE enum constants, typically JCS_RGB or
+JCS_GRAYSCALE.
+
+JPEG has a large number of compression parameters that determine how the
+image is encoded.  Most applications don't need or want to know about all
+these parameters.  You can set all the parameters to reasonable defaults by
+calling jpeg_set_defaults(); then, if there are particular values you want
+to change, you can do so after that.  The "Compression parameter selection"
+section tells about all the parameters.
+
+You must set in_color_space correctly before calling jpeg_set_defaults(),
+because the defaults depend on the source image colorspace.  However the
+other three source image parameters need not be valid until you call
+jpeg_start_compress().  There's no harm in calling jpeg_set_defaults() more
+than once, if that happens to be convenient.
+
+Typical code for a 24-bit RGB source image is
+
+	cinfo.image_width = Width; 	/* image width and height, in pixels */
+	cinfo.image_height = Height;
+	cinfo.input_components = 3;	/* # of color components per pixel */
+	cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
+
+	jpeg_set_defaults(&cinfo);
+	/* Make optional parameter settings here */
+
+
+4. jpeg_start_compress(...);
+
+After you have established the data destination and set all the necessary
+source image info and other parameters, call jpeg_start_compress() to begin
+a compression cycle.  This will initialize internal state, allocate working
+storage, and emit the first few bytes of the JPEG datastream header.
+
+Typical code:
+
+	jpeg_start_compress(&cinfo, TRUE);
+
+The "TRUE" parameter ensures that a complete JPEG interchange datastream
+will be written.  This is appropriate in most cases.  If you think you might
+want to use an abbreviated datastream, read the section on abbreviated
+datastreams, below.
+
+Once you have called jpeg_start_compress(), you may not alter any JPEG
+parameters or other fields of the JPEG object until you have completed
+the compression cycle.
+
+
+5. while (scan lines remain to be written)
+	jpeg_write_scanlines(...);
+
+Now write all the required image data by calling jpeg_write_scanlines()
+one or more times.  You can pass one or more scanlines in each call, up
+to the total image height.  In most applications it is convenient to pass
+just one or a few scanlines at a time.  The expected format for the passed
+data is discussed under "Data formats", above.
+
+Image data should be written in top-to-bottom scanline order.  The JPEG spec
+contains some weasel wording about how top and bottom are application-defined
+terms (a curious interpretation of the English language...) but if you want
+your files to be compatible with everyone else's, you WILL use top-to-bottom
+order.  If the source data must be read in bottom-to-top order, you can use
+the JPEG library's virtual array mechanism to invert the data efficiently.
+Examples of this can be found in the sample application cjpeg.
+
+The library maintains a count of the number of scanlines written so far
+in the next_scanline field of the JPEG object.  Usually you can just use
+this variable as the loop counter, so that the loop test looks like
+"while (cinfo.next_scanline < cinfo.image_height)".
+
+Code for this step depends heavily on the way that you store the source data.
+example.c shows the following code for the case of a full-size 2-D source
+array containing 3-byte RGB pixels:
+
+	JSAMPROW row_pointer[1];	/* pointer to a single row */
+	int row_stride;			/* physical row width in buffer */
+
+	row_stride = image_width * 3;	/* JSAMPLEs per row in image_buffer */
+
+	while (cinfo.next_scanline < cinfo.image_height) {
+	    row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride];
+	    jpeg_write_scanlines(&cinfo, row_pointer, 1);
+	}
+
+jpeg_write_scanlines() returns the number of scanlines actually written.
+This will normally be equal to the number passed in, so you can usually
+ignore the return value.  It is different in just two cases:
+  * If you try to write more scanlines than the declared image height,
+    the additional scanlines are ignored.
+  * If you use a suspending data destination manager, output buffer overrun
+    will cause the compressor to return before accepting all the passed lines.
+    This feature is discussed under "I/O suspension", below.  The normal
+    stdio destination manager will NOT cause this to happen.
+In any case, the return value is the same as the change in the value of
+next_scanline.
+
+
+6. jpeg_finish_compress(...);
+
+After all the image data has been written, call jpeg_finish_compress() to
+complete the compression cycle.  This step is ESSENTIAL to ensure that the
+last bufferload of data is written to the data destination.
+jpeg_finish_compress() also releases working memory associated with the JPEG
+object.
+
+Typical code:
+
+	jpeg_finish_compress(&cinfo);
+
+If using the stdio destination manager, don't forget to close the output
+stdio stream (if necessary) afterwards.
+
+If you have requested a multi-pass operating mode, such as Huffman code
+optimization, jpeg_finish_compress() will perform the additional passes using
+data buffered by the first pass.  In this case jpeg_finish_compress() may take
+quite a while to complete.  With the default compression parameters, this will
+not happen.
+
+It is an error to call jpeg_finish_compress() before writing the necessary
+total number of scanlines.  If you wish to abort compression, call
+jpeg_abort() as discussed below.
+
+After completing a compression cycle, you may dispose of the JPEG object
+as discussed next, or you may use it to compress another image.  In that case
+return to step 2, 3, or 4 as appropriate.  If you do not change the
+destination manager, the new datastream will be written to the same target.
+If you do not change any JPEG parameters, the new datastream will be written
+with the same parameters as before.  Note that you can change the input image
+dimensions freely between cycles, but if you change the input colorspace, you
+should call jpeg_set_defaults() to adjust for the new colorspace; and then
+you'll need to repeat all of step 3.
+
+
+7. Release the JPEG compression object.
+
+When you are done with a JPEG compression object, destroy it by calling
+jpeg_destroy_compress().  This will free all subsidiary memory (regardless of
+the previous state of the object).  Or you can call jpeg_destroy(), which
+works for either compression or decompression objects --- this may be more
+convenient if you are sharing code between compression and decompression
+cases.  (Actually, these routines are equivalent except for the declared type
+of the passed pointer.  To avoid gripes from ANSI C compilers, jpeg_destroy()
+should be passed a j_common_ptr.)
+
+If you allocated the jpeg_compress_struct structure from malloc(), freeing
+it is your responsibility --- jpeg_destroy() won't.  Ditto for the error
+handler structure.
+
+Typical code:
+
+	jpeg_destroy_compress(&cinfo);
+
+
+8. Aborting.
+
+If you decide to abort a compression cycle before finishing, you can clean up
+in either of two ways:
+
+* If you don't need the JPEG object any more, just call
+  jpeg_destroy_compress() or jpeg_destroy() to release memory.  This is
+  legitimate at any point after calling jpeg_create_compress() --- in fact,
+  it's safe even if jpeg_create_compress() fails.
+
+* If you want to re-use the JPEG object, call jpeg_abort_compress(), or call
+  jpeg_abort() which works on both compression and decompression objects.
+  This will return the object to an idle state, releasing any working memory.
+  jpeg_abort() is allowed at any time after successful object creation.
+
+Note that cleaning up the data destination, if required, is your
+responsibility; neither of these routines will call term_destination().
+(See "Compressed data handling", below, for more about that.)
+
+jpeg_destroy() and jpeg_abort() are the only safe calls to make on a JPEG
+object that has reported an error by calling error_exit (see "Error handling"
+for more info).  The internal state of such an object is likely to be out of
+whack.  Either of these two routines will return the object to a known state.
+
+
+Decompression details
+---------------------
+
+Here we revisit the JPEG decompression outline given in the overview.
+
+1. Allocate and initialize a JPEG decompression object.
+
+This is just like initialization for compression, as discussed above,
+except that the object is a "struct jpeg_decompress_struct" and you
+call jpeg_create_decompress().  Error handling is exactly the same.
+
+Typical code:
+
+	struct jpeg_decompress_struct cinfo;
+	struct jpeg_error_mgr jerr;
+	...
+	cinfo.err = jpeg_std_error(&jerr);
+	jpeg_create_decompress(&cinfo);
+
+(Both here and in the IJG code, we usually use variable name "cinfo" for
+both compression and decompression objects.)
+
+
+2. Specify the source of the compressed data (eg, a file).
+
+As previously mentioned, the JPEG library reads compressed data from a "data
+source" module.  The library includes one data source module which knows how
+to read from a stdio stream.  You can use your own source module if you want
+to do something else, as discussed later.
+
+If you use the standard source module, you must open the source stdio stream
+beforehand.  Typical code for this step looks like:
+
+	FILE * infile;
+	...
+	if ((infile = fopen(filename, "rb")) == NULL) {
+	    fprintf(stderr, "can't open %s\n", filename);
+	    exit(1);
+	}
+	jpeg_stdio_src(&cinfo, infile);
+
+where the last line invokes the standard source module.
+
+WARNING: it is critical that the binary compressed data be read unchanged.
+On non-Unix systems the stdio library may perform newline translation or
+otherwise corrupt binary data.  To suppress this behavior, you may need to use
+a "b" option to fopen (as shown above), or use setmode() or another routine to
+put the stdio stream in binary mode.  See cjpeg.c and djpeg.c for code that
+has been found to work on many systems.
+
+You may not change the data source between calling jpeg_read_header() and
+jpeg_finish_decompress().  If you wish to read a series of JPEG images from
+a single source file, you should repeat the jpeg_read_header() to
+jpeg_finish_decompress() sequence without reinitializing either the JPEG
+object or the data source module; this prevents buffered input data from
+being discarded.
+
+
+3. Call jpeg_read_header() to obtain image info.
+
+Typical code for this step is just
+
+	jpeg_read_header(&cinfo, TRUE);
+
+This will read the source datastream header markers, up to the beginning
+of the compressed data proper.  On return, the image dimensions and other
+info have been stored in the JPEG object.  The application may wish to
+consult this information before selecting decompression parameters.
+
+More complex code is necessary if
+  * A suspending data source is used --- in that case jpeg_read_header()
+    may return before it has read all the header data.  See "I/O suspension",
+    below.  The normal stdio source manager will NOT cause this to happen.
+  * Abbreviated JPEG files are to be processed --- see the section on
+    abbreviated datastreams.  Standard applications that deal only in
+    interchange JPEG files need not be concerned with this case either.
+
+It is permissible to stop at this point if you just wanted to find out the
+image dimensions and other header info for a JPEG file.  In that case,
+call jpeg_destroy() when you are done with the JPEG object, or call
+jpeg_abort() to return it to an idle state before selecting a new data
+source and reading another header.
+
+
+4. Set parameters for decompression.
+
+jpeg_read_header() sets appropriate default decompression parameters based on
+the properties of the image (in particular, its colorspace).  However, you
+may well want to alter these defaults before beginning the decompression.
+For example, the default is to produce full color output from a color file.
+If you want colormapped output you must ask for it.  Other options allow the
+returned image to be scaled and allow various speed/quality tradeoffs to be
+selected.  "Decompression parameter selection", below, gives details.
+
+If the defaults are appropriate, nothing need be done at this step.
+
+Note that all default values are set by each call to jpeg_read_header().
+If you reuse a decompression object, you cannot expect your parameter
+settings to be preserved across cycles, as you can for compression.
+You must set desired parameter values each time.
+
+
+5. jpeg_start_decompress(...);
+
+Once the parameter values are satisfactory, call jpeg_start_decompress() to
+begin decompression.  This will initialize internal state, allocate working
+memory, and prepare for returning data.
+
+Typical code is just
+
+	jpeg_start_decompress(&cinfo);
+
+If you have requested a multi-pass operating mode, such as 2-pass color
+quantization, jpeg_start_decompress() will do everything needed before data
+output can begin.  In this case jpeg_start_decompress() may take quite a while
+to complete.  With a single-scan (non progressive) JPEG file and default
+decompression parameters, this will not happen; jpeg_start_decompress() will
+return quickly.
+
+After this call, the final output image dimensions, including any requested
+scaling, are available in the JPEG object; so is the selected colormap, if
+colormapped output has been requested.  Useful fields include
+
+	output_width		image width and height, as scaled
+	output_height
+	out_color_components	# of color components in out_color_space
+	output_components	# of color components returned per pixel
+	colormap		the selected colormap, if any
+	actual_number_of_colors		number of entries in colormap
+
+output_components is 1 (a colormap index) when quantizing colors; otherwise it
+equals out_color_components.  It is the number of JSAMPLE values that will be
+emitted per pixel in the output arrays.
+
+Typically you will need to allocate data buffers to hold the incoming image.
+You will need output_width * output_components JSAMPLEs per scanline in your
+output buffer, and a total of output_height scanlines will be returned.
+
+Note: if you are using the JPEG library's internal memory manager to allocate
+data buffers (as djpeg does), then the manager's protocol requires that you
+request large buffers *before* calling jpeg_start_decompress().  This is a
+little tricky since the output_XXX fields are not normally valid then.  You
+can make them valid by calling jpeg_calc_output_dimensions() after setting the
+relevant parameters (scaling, output color space, and quantization flag).
+
+
+6. while (scan lines remain to be read)
+	jpeg_read_scanlines(...);
+
+Now you can read the decompressed image data by calling jpeg_read_scanlines()
+one or more times.  At each call, you pass in the maximum number of scanlines
+to be read (ie, the height of your working buffer); jpeg_read_scanlines()
+will return up to that many lines.  The return value is the number of lines
+actually read.  The format of the returned data is discussed under "Data
+formats", above.  Don't forget that grayscale and color JPEGs will return
+different data formats!
+
+Image data is returned in top-to-bottom scanline order.  If you must write
+out the image in bottom-to-top order, you can use the JPEG library's virtual
+array mechanism to invert the data efficiently.  Examples of this can be
+found in the sample application djpeg.
+
+The library maintains a count of the number of scanlines returned so far
+in the output_scanline field of the JPEG object.  Usually you can just use
+this variable as the loop counter, so that the loop test looks like
+"while (cinfo.output_scanline < cinfo.output_height)".  (Note that the test
+should NOT be against image_height, unless you never use scaling.  The
+image_height field is the height of the original unscaled image.)
+The return value always equals the change in the value of output_scanline.
+
+If you don't use a suspending data source, it is safe to assume that
+jpeg_read_scanlines() reads at least one scanline per call, until the
+bottom of the image has been reached.
+
+If you use a buffer larger than one scanline, it is NOT safe to assume that
+jpeg_read_scanlines() fills it.  (The current implementation returns only a
+few scanlines per call, no matter how large a buffer you pass.)  So you must
+always provide a loop that calls jpeg_read_scanlines() repeatedly until the
+whole image has been read.
+
+
+7. jpeg_finish_decompress(...);
+
+After all the image data has been read, call jpeg_finish_decompress() to
+complete the decompression cycle.  This causes working memory associated
+with the JPEG object to be released.
+
+Typical code:
+
+	jpeg_finish_decompress(&cinfo);
+
+If using the stdio source manager, don't forget to close the source stdio
+stream if necessary.
+
+It is an error to call jpeg_finish_decompress() before reading the correct
+total number of scanlines.  If you wish to abort decompression, call
+jpeg_abort() as discussed below.
+
+After completing a decompression cycle, you may dispose of the JPEG object as
+discussed next, or you may use it to decompress another image.  In that case
+return to step 2 or 3 as appropriate.  If you do not change the source
+manager, the next image will be read from the same source.
+
+
+8. Release the JPEG decompression object.
+
+When you are done with a JPEG decompression object, destroy it by calling
+jpeg_destroy_decompress() or jpeg_destroy().  The previous discussion of
+destroying compression objects applies here too.
+
+Typical code:
+
+	jpeg_destroy_decompress(&cinfo);
+
+
+9. Aborting.
+
+You can abort a decompression cycle by calling jpeg_destroy_decompress() or
+jpeg_destroy() if you don't need the JPEG object any more, or
+jpeg_abort_decompress() or jpeg_abort() if you want to reuse the object.
+The previous discussion of aborting compression cycles applies here too.
+
+
+Mechanics of usage: include files, linking, etc
+-----------------------------------------------
+
+Applications using the JPEG library should include the header file jpeglib.h
+to obtain declarations of data types and routines.  Before including
+jpeglib.h, include system headers that define at least the typedefs FILE and
+size_t.  On ANSI-conforming systems, including <stdio.h> is sufficient; on
+older Unix systems, you may need <sys/types.h> to define size_t.
+
+If the application needs to refer to individual JPEG library error codes, also
+include jerror.h to define those symbols.
+
+jpeglib.h indirectly includes the files jconfig.h and jmorecfg.h.  If you are
+installing the JPEG header files in a system directory, you will want to
+install all four files: jpeglib.h, jerror.h, jconfig.h, jmorecfg.h.
+
+The most convenient way to include the JPEG code into your executable program
+is to prepare a library file ("libjpeg.a", or a corresponding name on non-Unix
+machines) and reference it at your link step.  If you use only half of the
+library (only compression or only decompression), only that much code will be
+included from the library, unless your linker is hopelessly brain-damaged.
+The supplied makefiles build libjpeg.a automatically (see install.doc).
+
+While you can build the JPEG library as a shared library if the whim strikes
+you, we don't really recommend it.  The trouble with shared libraries is that
+at some point you'll probably try to substitute a new version of the library
+without recompiling the calling applications.  That generally doesn't work
+because the parameter struct declarations usually change with each new
+version.  In other words, the library's API is *not* guaranteed binary
+compatible across versions; we only try to ensure source-code compatibility.
+(In hindsight, it might have been smarter to hide the parameter structs from
+applications and introduce a ton of access functions instead.  Too late now,
+however.)
+
+On some systems your application may need to set up a signal handler to ensure
+that temporary files are deleted if the program is interrupted.  This is most
+critical if you are on MS-DOS and use the jmemdos.c memory manager back end;
+it will try to grab extended memory for temp files, and that space will NOT be
+freed automatically.  See cjpeg.c or djpeg.c for an example signal handler.
+
+It may be worth pointing out that the core JPEG library does not actually
+require the stdio library: only the default source/destination managers and
+error handler need it.  You can use the library in a stdio-less environment
+if you replace those modules and use jmemnobs.c (or another memory manager of
+your own devising).  More info about the minimum system library requirements
+may be found in jinclude.h.
+
+
+ADVANCED FEATURES
+=================
+
+Compression parameter selection
+-------------------------------
+
+This section describes all the optional parameters you can set for JPEG
+compression, as well as the "helper" routines provided to assist in this
+task.  Proper setting of some parameters requires detailed understanding
+of the JPEG standard; if you don't know what a parameter is for, it's best
+not to mess with it!  See REFERENCES in the README file for pointers to
+more info about JPEG.
+
+It's a good idea to call jpeg_set_defaults() first, even if you plan to set
+all the parameters; that way your code is more likely to work with future JPEG
+libraries that have additional parameters.  For the same reason, we recommend
+you use a helper routine where one is provided, in preference to twiddling
+cinfo fields directly.
+
+The helper routines are:
+
+jpeg_set_defaults (j_compress_ptr cinfo)
+	This routine sets all JPEG parameters to reasonable defaults, using
+	only the input image's color space (field in_color_space, which must
+	already be set in cinfo).  Many applications will only need to use
+	this routine and perhaps jpeg_set_quality().
+
+jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
+	Sets the JPEG file's colorspace (field jpeg_color_space) as specified,
+	and sets other color-space-dependent parameters appropriately.  See
+	"Special color spaces", below, before using this.  A large number of
+	parameters, including all per-component parameters, are set by this
+	routine; if you want to twiddle individual parameters you should call
+	jpeg_set_colorspace() before rather than after.
+
+jpeg_default_colorspace (j_compress_ptr cinfo)
+	Selects an appropriate JPEG colorspace based on cinfo->in_color_space,
+	and calls jpeg_set_colorspace().  This is actually a subroutine of
+	jpeg_set_defaults().  It's broken out in case you want to change
+	just the colorspace-dependent JPEG parameters.
+
+jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
+	Constructs JPEG quantization tables appropriate for the indicated
+	quality setting.  The quality value is expressed on the 0..100 scale
+	recommended by IJG (cjpeg's "-quality" switch uses this routine).
+	Note that the exact mapping from quality values to tables may change
+	in future IJG releases as more is learned about DCT quantization.
+	If the force_baseline parameter is TRUE, then the quantization table
+	entries are constrained to the range 1..255 for full JPEG baseline
+	compatibility.  In the current implementation, this only makes a
+	difference for quality settings below 25, and it effectively prevents
+	very small/low quality files from being generated.  The IJG decoder
+	is capable of reading the non-baseline files generated at low quality
+	settings when force_baseline is FALSE, but other decoders may not be.
+
+jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
+			 boolean force_baseline)
+	Same as jpeg_set_quality() except that the generated tables are the
+	sample tables given in the JPEC spec section K.1, multiplied by the
+	specified scale factor (which is expressed as a percentage; thus
+	scale_factor = 100 reproduces the spec's tables).  Note that larger
+	scale factors give lower quality.  This entry point is useful for
+	conforming to the Adobe PostScript DCT conventions, but we do not
+	recommend linear scaling as a user-visible quality scale otherwise.
+	force_baseline again constrains the computed table entries to 1..255.
+
+int jpeg_quality_scaling (int quality)
+	Converts a value on the IJG-recommended quality scale to a linear
+	scaling percentage.  Note that this routine may change or go away
+	in future releases --- IJG may choose to adopt a scaling method that
+	can't be expressed as a simple scalar multiplier, in which case the
+	premise of this routine collapses.  Caveat user.
+
+jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
+		      const unsigned int *basic_table,
+		      int scale_factor, boolean force_baseline)
+	Allows an arbitrary quantization table to be created.  which_tbl
+	indicates which table slot to fill.  basic_table points to an array
+	of 64 unsigned ints given in normal array order.  These values are
+	multiplied by scale_factor/100 and then clamped to the range 1..65535
+	(or to 1..255 if force_baseline is TRUE).
+	CAUTION: prior to library version 6a, jpeg_add_quant_table expected
+	the basic table to be given in JPEG zigzag order.  If you need to
+	write code that works with either older or newer versions of this
+	routine, you must check the library version number.  Something like
+	"#if JPEG_LIB_VERSION >= 61" is the right test.
+
+jpeg_simple_progression (j_compress_ptr cinfo)
+	Generates a default scan script for writing a progressive-JPEG file.
+	This is the recommended method of creating a progressive file,
+	unless you want to make a custom scan sequence.  You must ensure that
+	the JPEG color space is set correctly before calling this routine.
+
+
+Compression parameters (cinfo fields) include:
+
+J_DCT_METHOD dct_method
+	Selects the algorithm used for the DCT step.  Choices are:
+		JDCT_ISLOW: slow but accurate integer algorithm
+		JDCT_IFAST: faster, less accurate integer method
+		JDCT_FLOAT: floating-point method
+		JDCT_DEFAULT: default method (normally JDCT_ISLOW)
+		JDCT_FASTEST: fastest method (normally JDCT_IFAST)
+	The FLOAT method is very slightly more accurate than the ISLOW method,
+	but may give different results on different machines due to varying
+	roundoff behavior.  The integer methods should give the same results
+	on all machines.  On machines with sufficiently fast FP hardware, the
+	floating-point method may also be the fastest.  The IFAST method is
+	considerably less accurate than the other two; its use is not
+	recommended if high quality is a concern.  JDCT_DEFAULT and
+	JDCT_FASTEST are macros configurable by each installation.
+
+J_COLOR_SPACE jpeg_color_space
+int num_components
+	The JPEG color space and corresponding number of components; see
+	"Special color spaces", below, for more info.  We recommend using
+	jpeg_set_color_space() if you want to change these.
+
+boolean optimize_coding
+	TRUE causes the compressor to compute optimal Huffman coding tables
+	for the image.  This requires an extra pass over the data and
+	therefore costs a good deal of space and time.  The default is
+	FALSE, which tells the compressor to use the supplied or default
+	Huffman tables.  In most cases optimal tables save only a few percent
+	of file size compared to the default tables.  Note that when this is
+	TRUE, you need not supply Huffman tables at all, and any you do
+	supply will be overwritten.
+
+unsigned int restart_interval
+int restart_in_rows
+	To emit restart markers in the JPEG file, set one of these nonzero.
+	Set restart_interval to specify the exact interval in MCU blocks.
+	Set restart_in_rows to specify the interval in MCU rows.  (If
+	restart_in_rows is not 0, then restart_interval is set after the
+	image width in MCUs is computed.)  Defaults are zero (no restarts).
+	One restart marker per MCU row is often a good choice.
+	NOTE: the overhead of restart markers is higher in grayscale JPEG
+	files than in color files, and MUCH higher in progressive JPEGs.
+	If you use restarts, you may want to use larger intervals in those
+	cases.
+
+const jpeg_scan_info * scan_info
+int num_scans
+	By default, scan_info is NULL; this causes the compressor to write a
+	single-scan sequential JPEG file.  If not NULL, scan_info points to
+	an array of scan definition records of length num_scans.  The
+	compressor will then write a JPEG file having one scan for each scan
+	definition record.  This is used to generate noninterleaved or
+	progressive JPEG files.  The library checks that the scan array
+	defines a valid JPEG scan sequence.  (jpeg_simple_progression creates
+	a suitable scan definition array for progressive JPEG.)  This is
+	discussed further under "Progressive JPEG support".
+
+int smoothing_factor
+	If non-zero, the input image is smoothed; the value should be 1 for
+	minimal smoothing to 100 for maximum smoothing.  Consult jcsample.c
+	for details of the smoothing algorithm.  The default is zero.
+
+boolean write_JFIF_header
+	If TRUE, a JFIF APP0 marker is emitted.  jpeg_set_defaults() and
+	jpeg_set_colorspace() set this TRUE if a JFIF-legal JPEG color space
+	(ie, YCbCr or grayscale) is selected, otherwise FALSE.
+
+UINT8 JFIF_major_version
+UINT8 JFIF_minor_version
+	The version number to be written into the JFIF marker.
+	jpeg_set_defaults() initializes the version to 1.01 (major=minor=1).
+	You should set it to 1.02 (major=1, minor=2) if you plan to write
+	any JFIF 1.02 extension markers.
+
+UINT8 density_unit
+UINT16 X_density
+UINT16 Y_density
+	The resolution information to be written into the JFIF marker;
+	not used otherwise.  density_unit may be 0 for unknown,
+	1 for dots/inch, or 2 for dots/cm.  The default values are 0,1,1
+	indicating square pixels of unknown size.
+
+boolean write_Adobe_marker
+	If TRUE, an Adobe APP14 marker is emitted.  jpeg_set_defaults() and
+	jpeg_set_colorspace() set this TRUE if JPEG color space RGB, CMYK,
+	or YCCK is selected, otherwise FALSE.  It is generally a bad idea
+	to set both write_JFIF_header and write_Adobe_marker.  In fact,
+	you probably shouldn't change the default settings at all --- the
+	default behavior ensures that the JPEG file's color space can be
+	recognized by the decoder.
+
+JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]
+	Pointers to coefficient quantization tables, one per table slot,
+	or NULL if no table is defined for a slot.  Usually these should
+	be set via one of the above helper routines; jpeg_add_quant_table()
+	is general enough to define any quantization table.  The other
+	routines will set up table slot 0 for luminance quality and table
+	slot 1 for chrominance.
+
+JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]
+JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]
+	Pointers to Huffman coding tables, one per table slot, or NULL if
+	no table is defined for a slot.  Slots 0 and 1 are filled with the
+	JPEG sample tables by jpeg_set_defaults().  If you need to allocate
+	more table structures, jpeg_alloc_huff_table() may be used.
+	Note that optimal Huffman tables can be computed for an image
+	by setting optimize_coding, as discussed above; there's seldom
+	any need to mess with providing your own Huffman tables.
+
+There are some additional cinfo fields which are not documented here
+because you currently can't change them; for example, you can't set
+arith_code TRUE because arithmetic coding is unsupported.
+
+
+Per-component parameters are stored in the struct cinfo.comp_info[i] for
+component number i.  Note that components here refer to components of the
+JPEG color space, *not* the source image color space.  A suitably large
+comp_info[] array is allocated by jpeg_set_defaults(); if you choose not
+to use that routine, it's up to you to allocate the array.
+
+int component_id
+	The one-byte identifier code to be recorded in the JPEG file for
+	this component.  For the standard color spaces, we recommend you
+	leave the default values alone.
+
+int h_samp_factor
+int v_samp_factor
+	Horizontal and vertical sampling factors for the component; must
+	be 1..4 according to the JPEG standard.  Note that larger sampling
+	factors indicate a higher-resolution component; many people find
+	this behavior quite unintuitive.  The default values are 2,2 for
+	luminance components and 1,1 for chrominance components, except
+	for grayscale where 1,1 is used.
+
+int quant_tbl_no
+	Quantization table number for component.  The default value is
+	0 for luminance components and 1 for chrominance components.
+
+int dc_tbl_no
+int ac_tbl_no
+	DC and AC entropy coding table numbers.  The default values are
+	0 for luminance components and 1 for chrominance components.
+
+int component_index
+	Must equal the component's index in comp_info[].  (Beginning in
+	release v6, the compressor library will fill this in automatically;
+	you don't have to.)
+
+
+Decompression parameter selection
+---------------------------------
+
+Decompression parameter selection is somewhat simpler than compression
+parameter selection, since all of the JPEG internal parameters are
+recorded in the source file and need not be supplied by the application.
+(Unless you are working with abbreviated files, in which case see
+"Abbreviated datastreams", below.)  Decompression parameters control
+the postprocessing done on the image to deliver it in a format suitable
+for the application's use.  Many of the parameters control speed/quality
+tradeoffs, in which faster decompression may be obtained at the price of
+a poorer-quality image.  The defaults select the highest quality (slowest)
+processing.
+
+The following fields in the JPEG object are set by jpeg_read_header() and
+may be useful to the application in choosing decompression parameters:
+
+JDIMENSION image_width			Width and height of image
+JDIMENSION image_height
+int num_components			Number of color components
+J_COLOR_SPACE jpeg_color_space		Colorspace of image
+boolean saw_JFIF_marker			TRUE if a JFIF APP0 marker was seen
+  UINT8 JFIF_major_version		Version information from JFIF marker
+  UINT8 JFIF_minor_version
+  UINT8 density_unit			Resolution data from JFIF marker
+  UINT16 X_density
+  UINT16 Y_density
+boolean saw_Adobe_marker		TRUE if an Adobe APP14 marker was seen
+  UINT8 Adobe_transform			Color transform code from Adobe marker
+
+The JPEG color space, unfortunately, is something of a guess since the JPEG
+standard proper does not provide a way to record it.  In practice most files
+adhere to the JFIF or Adobe conventions, and the decoder will recognize these
+correctly.  See "Special color spaces", below, for more info.
+
+
+The decompression parameters that determine the basic properties of the
+returned image are:
+
+J_COLOR_SPACE out_color_space
+	Output color space.  jpeg_read_header() sets an appropriate default
+	based on jpeg_color_space; typically it will be RGB or grayscale.
+	The application can change this field to request output in a different
+	colorspace.  For example, set it to JCS_GRAYSCALE to get grayscale
+	output from a color file.  (This is useful for previewing: grayscale
+	output is faster than full color since the color components need not
+	be processed.)  Note that not all possible color space transforms are
+	currently implemented; you may need to extend jdcolor.c if you want an
+	unusual conversion.
+
+unsigned int scale_num, scale_denom
+	Scale the image by the fraction scale_num/scale_denom.  Default is
+	1/1, or no scaling.  Currently, the only supported scaling ratios
+	are 1/1, 1/2, 1/4, and 1/8.  (The library design allows for arbitrary
+	scaling ratios but this is not likely to be implemented any time soon.)
+	Smaller scaling ratios permit significantly faster decoding since
+	fewer pixels need be processed and a simpler IDCT method can be used.
+
+boolean quantize_colors
+	If set TRUE, colormapped output will be delivered.  Default is FALSE,
+	meaning that full-color output will be delivered.
+
+The next three parameters are relevant only if quantize_colors is TRUE.
+
+int desired_number_of_colors
+	Maximum number of colors to use in generating a library-supplied color
+	map (the actual number of colors is returned in a different field).
+	Default 256.  Ignored when the application supplies its own color map.
+
+boolean two_pass_quantize
+	If TRUE, an extra pass over the image is made to select a custom color
+	map for the image.  This usually looks a lot better than the one-size-
+	fits-all colormap that is used otherwise.  Default is TRUE.  Ignored
+	when the application supplies its own color map.
+
+J_DITHER_MODE dither_mode
+	Selects color dithering method.  Supported values are:
+		JDITHER_NONE	no dithering: fast, very low quality
+		JDITHER_ORDERED	ordered dither: moderate speed and quality
+		JDITHER_FS	Floyd-Steinberg dither: slow, high quality
+	Default is JDITHER_FS.  (At present, ordered dither is implemented
+	only in the single-pass, standard-colormap case.  If you ask for
+	ordered dither when two_pass_quantize is TRUE or when you supply
+	an external color map, you'll get F-S dithering.)
+
+When quantize_colors is TRUE, the target color map is described by the next
+two fields.  colormap is set to NULL by jpeg_read_header().  The application
+can supply a color map by setting colormap non-NULL and setting
+actual_number_of_colors to the map size.  Otherwise, jpeg_start_decompress()
+selects a suitable color map and sets these two fields itself.
+[Implementation restriction: at present, an externally supplied colormap is
+only accepted for 3-component output color spaces.]
+
+JSAMPARRAY colormap
+	The color map, represented as a 2-D pixel array of out_color_components
+	rows and actual_number_of_colors columns.  Ignored if not quantizing.
+	CAUTION: if the JPEG library creates its own colormap, the storage
+	pointed to by this field is released by jpeg_finish_decompress().
+	Copy the colormap somewhere else first, if you want to save it.
+
+int actual_number_of_colors
+	The number of colors in the color map.
+
+Additional decompression parameters that the application may set include:
+
+J_DCT_METHOD dct_method
+	Selects the algorithm used for the DCT step.  Choices are the same
+	as described above for compression.
+
+boolean do_fancy_upsampling
+	If TRUE, do careful upsampling of chroma components.  If FALSE,
+	a faster but sloppier method is used.  Default is TRUE.  The visual
+	impact of the sloppier method is often very small.
+
+boolean do_block_smoothing
+	If TRUE, interblock smoothing is applied in early stages of decoding
+	progressive JPEG files; if FALSE, not.  Default is TRUE.  Early
+	progression stages look "fuzzy" with smoothing, "blocky" without.
+	In any case, block smoothing ceases to be applied after the first few
+	AC coefficients are known to full accuracy, so it is relevant only
+	when using buffered-image mode for progressive images.
+
+boolean enable_1pass_quant
+boolean enable_external_quant
+boolean enable_2pass_quant
+	These are significant only in buffered-image mode, which is
+	described in its own section below.
+
+
+The output image dimensions are given by the following fields.  These are
+computed from the source image dimensions and the decompression parameters
+by jpeg_start_decompress().  You can also call jpeg_calc_output_dimensions()
+to obtain the values that will result from the current parameter settings.
+This can be useful if you are trying to pick a scaling ratio that will get
+close to a desired target size.  It's also important if you are using the
+JPEG library's memory manager to allocate output buffer space, because you
+are supposed to request such buffers *before* jpeg_start_decompress().
+
+JDIMENSION output_width		Actual dimensions of output image.
+JDIMENSION output_height
+int out_color_components	Number of color components in out_color_space.
+int output_components		Number of color components returned.
+int rec_outbuf_height		Recommended height of scanline buffer.
+
+When quantizing colors, output_components is 1, indicating a single color map
+index per pixel.  Otherwise it equals out_color_components.  The output arrays
+are required to be output_width * output_components JSAMPLEs wide.
+
+rec_outbuf_height is the recommended minimum height (in scanlines) of the
+buffer passed to jpeg_read_scanlines().  If the buffer is smaller, the
+library will still work, but time will be wasted due to unnecessary data
+copying.  In high-quality modes, rec_outbuf_height is always 1, but some
+faster, lower-quality modes set it to larger values (typically 2 to 4).
+If you are going to ask for a high-speed processing mode, you may as well
+go to the trouble of honoring rec_outbuf_height so as to avoid data copying.
+(An output buffer larger than rec_outbuf_height lines is OK, but won't
+provide any material speed improvement over that height.)
+
+
+Special color spaces
+--------------------
+
+The JPEG standard itself is "color blind" and doesn't specify any particular
+color space.  It is customary to convert color data to a luminance/chrominance
+color space before compressing, since this permits greater compression.  The
+existing de-facto JPEG file format standards specify YCbCr or grayscale data
+(JFIF), or grayscale, RGB, YCbCr, CMYK, or YCCK (Adobe).  For special
+applications such as multispectral images, other color spaces can be used,
+but it must be understood that such files will be unportable.
+
+The JPEG library can handle the most common colorspace conversions (namely
+RGB <=> YCbCr and CMYK <=> YCCK).  It can also deal with data of an unknown
+color space, passing it through without conversion.  If you deal extensively
+with an unusual color space, you can easily extend the library to understand
+additional color spaces and perform appropriate conversions.
+
+For compression, the source data's color space is specified by field
+in_color_space.  This is transformed to the JPEG file's color space given
+by jpeg_color_space.  jpeg_set_defaults() chooses a reasonable JPEG color
+space depending on in_color_space, but you can override this by calling
+jpeg_set_colorspace().  Of course you must select a supported transformation.
+jccolor.c currently supports the following transformations:
+	RGB => YCbCr
+	RGB => GRAYSCALE
+	YCbCr => GRAYSCALE
+	CMYK => YCCK
+plus the null transforms: GRAYSCALE => GRAYSCALE, RGB => RGB,
+YCbCr => YCbCr, CMYK => CMYK, YCCK => YCCK, and UNKNOWN => UNKNOWN.
+
+The de-facto file format standards (JFIF and Adobe) specify APPn markers that
+indicate the color space of the JPEG file.  It is important to ensure that
+these are written correctly, or omitted if the JPEG file's color space is not
+one of the ones supported by the de-facto standards.  jpeg_set_colorspace()
+will set the compression parameters to include or omit the APPn markers
+properly, so long as it is told the truth about the JPEG color space.
+For example, if you are writing some random 3-component color space without
+conversion, don't try to fake out the library by setting in_color_space and
+jpeg_color_space to JCS_YCbCr; use JCS_UNKNOWN.  You may want to write an
+APPn marker of your own devising to identify the colorspace --- see "Special
+markers", below.
+
+When told that the color space is UNKNOWN, the library will default to using
+luminance-quality compression parameters for all color components.  You may
+well want to change these parameters.  See the source code for
+jpeg_set_colorspace(), in jcparam.c, for details.
+
+For decompression, the JPEG file's color space is given in jpeg_color_space,
+and this is transformed to the output color space out_color_space.
+jpeg_read_header's setting of jpeg_color_space can be relied on if the file
+conforms to JFIF or Adobe conventions, but otherwise it is no better than a
+guess.  If you know the JPEG file's color space for certain, you can override
+jpeg_read_header's guess by setting jpeg_color_space.  jpeg_read_header also
+selects a default output color space based on (its guess of) jpeg_color_space;
+set out_color_space to override this.  Again, you must select a supported
+transformation.  jdcolor.c currently supports
+	YCbCr => GRAYSCALE
+	YCbCr => RGB
+	GRAYSCALE => RGB
+	YCCK => CMYK
+as well as the null transforms.  (Since GRAYSCALE=>RGB is provided, an
+application can force grayscale JPEGs to look like color JPEGs if it only
+wants to handle one case.)
+
+The two-pass color quantizer, jquant2.c, is specialized to handle RGB data
+(it weights distances appropriately for RGB colors).  You'll need to modify
+the code if you want to use it for non-RGB output color spaces.  Note that
+jquant2.c is used to map to an application-supplied colormap as well as for
+the normal two-pass colormap selection process.
+
+CAUTION: it appears that Adobe Photoshop writes inverted data in CMYK JPEG
+files: 0 represents 100% ink coverage, rather than 0% ink as you'd expect.
+This is arguably a bug in Photoshop, but if you need to work with Photoshop
+CMYK files, you will have to deal with it in your application.  We cannot
+"fix" this in the library by inverting the data during the CMYK<=>YCCK
+transform, because that would break other applications, notably Ghostscript.
+Photoshop versions prior to 3.0 write EPS files containing JPEG-encoded CMYK
+data in the same inverted-YCCK representation used in bare JPEG files, but
+the surrounding PostScript code performs an inversion using the PS image
+operator.  I am told that Photoshop 3.0 will write uninverted YCCK in
+EPS/JPEG files, and will omit the PS-level inversion.  (But the data
+polarity used in bare JPEG files will not change in 3.0.)  In either case,
+the JPEG library must not invert the data itself, or else Ghostscript would
+read these EPS files incorrectly.
+
+
+Error handling
+--------------
+
+When the default error handler is used, any error detected inside the JPEG
+routines will cause a message to be printed on stderr, followed by exit().
+You can supply your own error handling routines to override this behavior
+and to control the treatment of nonfatal warnings and trace/debug messages.
+The file example.c illustrates the most common case, which is to have the
+application regain control after an error rather than exiting.
+
+The JPEG library never writes any message directly; it always goes through
+the error handling routines.  Three classes of messages are recognized:
+  * Fatal errors: the library cannot continue.
+  * Warnings: the library can continue, but the data is corrupt, and a
+    damaged output image is likely to result.
+  * Trace/informational messages.  These come with a trace level indicating
+    the importance of the message; you can control the verbosity of the
+    program by adjusting the maximum trace level that will be displayed.
+
+You may, if you wish, simply replace the entire JPEG error handling module
+(jerror.c) with your own code.  However, you can avoid code duplication by
+only replacing some of the routines depending on the behavior you need.
+This is accomplished by calling jpeg_std_error() as usual, but then overriding
+some of the method pointers in the jpeg_error_mgr struct, as illustrated by
+example.c.
+
+All of the error handling routines will receive a pointer to the JPEG object
+(a j_common_ptr which points to either a jpeg_compress_struct or a
+jpeg_decompress_struct; if you need to tell which, test the is_decompressor
+field).  This struct includes a pointer to the error manager struct in its
+"err" field.  Frequently, custom error handler routines will need to access
+additional data which is not known to the JPEG library or the standard error
+handler.  The most convenient way to do this is to embed either the JPEG
+object or the jpeg_error_mgr struct in a larger structure that contains
+additional fields; then casting the passed pointer provides access to the
+additional fields.  Again, see example.c for one way to do it.  (Beginning
+with IJG version 6b, there is also a void pointer "client_data" in each
+JPEG object, which the application can also use to find related data.
+The library does not touch client_data at all.)
+
+The individual methods that you might wish to override are:
+
+error_exit (j_common_ptr cinfo)
+	Receives control for a fatal error.  Information sufficient to
+	generate the error message has been stored in cinfo->err; call
+	output_message to display it.  Control must NOT return to the caller;
+	generally this routine will exit() or longjmp() somewhere.
+	Typically you would override this routine to get rid of the exit()
+	default behavior.  Note that if you continue processing, you should
+	clean up the JPEG object with jpeg_abort() or jpeg_destroy().
+
+output_message (j_common_ptr cinfo)
+	Actual output of any JPEG message.  Override this to send messages
+	somewhere other than stderr.  Note that this method does not know
+	how to generate a message, only where to send it.
+
+format_message (j_common_ptr cinfo, char * buffer)
+	Constructs a readable error message string based on the error info
+	stored in cinfo->err.  This method is called by output_message.  Few
+	applications should need to override this method.  One possible
+	reason for doing so is to implement dynamic switching of error message
+	language.
+
+emit_message (j_common_ptr cinfo, int msg_level)
+	Decide whether or not to emit a warning or trace message; if so,
+	calls output_message.  The main reason for overriding this method
+	would be to abort on warnings.  msg_level is -1 for warnings,
+	0 and up for trace messages.
+
+Only error_exit() and emit_message() are called from the rest of the JPEG
+library; the other two are internal to the error handler.
+
+The actual message texts are stored in an array of strings which is pointed to
+by the field err->jpeg_message_table.  The messages are numbered from 0 to
+err->last_jpeg_message, and it is these code numbers that are used in the
+JPEG library code.  You could replace the message texts (for instance, with
+messages in French or German) by changing the message table pointer.  See
+jerror.h for the default texts.  CAUTION: this table will almost certainly
+change or grow from one library version to the next.
+
+It may be useful for an application to add its own message texts that are
+handled by the same mechanism.  The error handler supports a second "add-on"
+message table for this purpose.  To define an addon table, set the pointer
+err->addon_message_table and the message numbers err->first_addon_message and
+err->last_addon_message.  If you number the addon messages beginning at 1000
+or so, you won't have to worry about conflicts with the library's built-in
+messages.  See the sample applications cjpeg/djpeg for an example of using
+addon messages (the addon messages are defined in cderror.h).
+
+Actual invocation of the error handler is done via macros defined in jerror.h:
+	ERREXITn(...)	for fatal errors
+	WARNMSn(...)	for corrupt-data warnings
+	TRACEMSn(...)	for trace and informational messages.
+These macros store the message code and any additional parameters into the
+error handler struct, then invoke the error_exit() or emit_message() method.
+The variants of each macro are for varying numbers of additional parameters.
+The additional parameters are inserted into the generated message using
+standard printf() format codes.
+
+See jerror.h and jerror.c for further details.
+
+
+Compressed data handling (source and destination managers)
+----------------------------------------------------------
+
+The JPEG compression library sends its compressed data to a "destination
+manager" module.  The default destination manager just writes the data to a
+stdio stream, but you can provide your own manager to do something else.
+Similarly, the decompression library calls a "source manager" to obtain the
+compressed data; you can provide your own source manager if you want the data
+to come from somewhere other than a stdio stream.
+
+In both cases, compressed data is processed a bufferload at a time: the
+destination or source manager provides a work buffer, and the library invokes
+the manager only when the buffer is filled or emptied.  (You could define a
+one-character buffer to force the manager to be invoked for each byte, but
+that would be rather inefficient.)  The buffer's size and location are
+controlled by the manager, not by the library.  For example, if you desired to
+decompress a JPEG datastream that was all in memory, you could just make the
+buffer pointer and length point to the original data in memory.  Then the
+buffer-reload procedure would be invoked only if the decompressor ran off the
+end of the datastream, which would indicate an erroneous datastream.
+
+The work buffer is defined as an array of datatype JOCTET, which is generally
+"char" or "unsigned char".  On a machine where char is not exactly 8 bits
+wide, you must define JOCTET as a wider data type and then modify the data
+source and destination modules to transcribe the work arrays into 8-bit units
+on external storage.
+
+A data destination manager struct contains a pointer and count defining the
+next byte to write in the work buffer and the remaining free space:
+
+	JOCTET * next_output_byte;  /* => next byte to write in buffer */
+	size_t free_in_buffer;      /* # of byte spaces remaining in buffer */
+
+The library increments the pointer and decrements the count until the buffer
+is filled.  The manager's empty_output_buffer method must reset the pointer
+and count.  The manager is expected to remember the buffer's starting address
+and total size in private fields not visible to the library.
+
+A data destination manager provides three methods:
+
+init_destination (j_compress_ptr cinfo)
+	Initialize destination.  This is called by jpeg_start_compress()
+	before any data is actually written.  It must initialize
+	next_output_byte and free_in_buffer.  free_in_buffer must be
+	initialized to a positive value.
+
+empty_output_buffer (j_compress_ptr cinfo)
+	This is called whenever the buffer has filled (free_in_buffer
+	reaches zero).  In typical applications, it should write out the
+	*entire* buffer (use the saved start address and buffer length;
+	ignore the current state of next_output_byte and free_in_buffer).
+	Then reset the pointer & count to the start of the buffer, and
+	return TRUE indicating that the buffer has been dumped.
+	free_in_buffer must be set to a positive value when TRUE is
+	returned.  A FALSE return should only be used when I/O suspension is
+	desired (this operating mode is discussed in the next section).
+
+term_destination (j_compress_ptr cinfo)
+	Terminate destination --- called by jpeg_finish_compress() after all
+	data has been written.  In most applications, this must flush any
+	data remaining in the buffer.  Use either next_output_byte or
+	free_in_buffer to determine how much data is in the buffer.
+
+term_destination() is NOT called by jpeg_abort() or jpeg_destroy().  If you
+want the destination manager to be cleaned up during an abort, you must do it
+yourself.
+
+You will also need code to create a jpeg_destination_mgr struct, fill in its
+method pointers, and insert a pointer to the struct into the "dest" field of
+the JPEG compression object.  This can be done in-line in your setup code if
+you like, but it's probably cleaner to provide a separate routine similar to
+the jpeg_stdio_dest() routine of the supplied destination manager.
+
+Decompression source managers follow a parallel design, but with some
+additional frammishes.  The source manager struct contains a pointer and count
+defining the next byte to read from the work buffer and the number of bytes
+remaining:
+
+	const JOCTET * next_input_byte; /* => next byte to read from buffer */
+	size_t bytes_in_buffer;         /* # of bytes remaining in buffer */
+
+The library increments the pointer and decrements the count until the buffer
+is emptied.  The manager's fill_input_buffer method must reset the pointer and
+count.  In most applications, the manager must remember the buffer's starting
+address and total size in private fields not visible to the library.
+
+A data source manager provides five methods:
+
+init_source (j_decompress_ptr cinfo)
+	Initialize source.  This is called by jpeg_read_header() before any
+	data is actually read.  Unlike init_destination(), it may leave
+	bytes_in_buffer set to 0 (in which case a fill_input_buffer() call
+	will occur immediately).
+
+fill_input_buffer (j_decompress_ptr cinfo)
+	This is called whenever bytes_in_buffer has reached zero and more
+	data is wanted.  In typical applications, it should read fresh data
+	into the buffer (ignoring the current state of next_input_byte and
+	bytes_in_buffer), reset the pointer & count to the start of the
+	buffer, and return TRUE indicating that the buffer has been reloaded.
+	It is not necessary to fill the buffer entirely, only to obtain at
+	least one more byte.  bytes_in_buffer MUST be set to a positive value
+	if TRUE is returned.  A FALSE return should only be used when I/O
+	suspension is desired (this mode is discussed in the next section).
+
+skip_input_data (j_decompress_ptr cinfo, long num_bytes)
+	Skip num_bytes worth of data.  The buffer pointer and count should
+	be advanced over num_bytes input bytes, refilling the buffer as
+	needed.  This is used to skip over a potentially large amount of
+	uninteresting data (such as an APPn marker).  In some applications
+	it may be possible to optimize away the reading of the skipped data,
+	but it's not clear that being smart is worth much trouble; large
+	skips are uncommon.  bytes_in_buffer may be zero on return.
+	A zero or negative skip count should be treated as a no-op.
+
+resync_to_restart (j_decompress_ptr cinfo, int desired)
+	This routine is called only when the decompressor has failed to find
+	a restart (RSTn) marker where one is expected.  Its mission is to
+	find a suitable point for resuming decompression.  For most
+	applications, we recommend that you just use the default resync
+	procedure, jpeg_resync_to_restart().  However, if you are able to back
+	up in the input data stream, or if you have a-priori knowledge about
+	the likely location of restart markers, you may be able to do better.
+	Read the read_restart_marker() and jpeg_resync_to_restart() routines
+	in jdmarker.c if you think you'd like to implement your own resync
+	procedure.
+
+term_source (j_decompress_ptr cinfo)
+	Terminate source --- called by jpeg_finish_decompress() after all
+	data has been read.  Often a no-op.
+
+For both fill_input_buffer() and skip_input_data(), there is no such thing
+as an EOF return.  If the end of the file has been reached, the routine has
+a choice of exiting via ERREXIT() or inserting fake data into the buffer.
+In most cases, generating a warning message and inserting a fake EOI marker
+is the best course of action --- this will allow the decompressor to output
+however much of the image is there.  In pathological cases, the decompressor
+may swallow the EOI and again demand data ... just keep feeding it fake EOIs.
+jdatasrc.c illustrates the recommended error recovery behavior.
+
+term_source() is NOT called by jpeg_abort() or jpeg_destroy().  If you want
+the source manager to be cleaned up during an abort, you must do it yourself.
+
+You will also need code to create a jpeg_source_mgr struct, fill in its method
+pointers, and insert a pointer to the struct into the "src" field of the JPEG
+decompression object.  This can be done in-line in your setup code if you
+like, but it's probably cleaner to provide a separate routine similar to the
+jpeg_stdio_src() routine of the supplied source manager.
+
+For more information, consult the stdio source and destination managers
+in jdatasrc.c and jdatadst.c.
+
+
+I/O suspension
+--------------
+
+Some applications need to use the JPEG library as an incremental memory-to-
+memory filter: when the compressed data buffer is filled or emptied, they want
+control to return to the outer loop, rather than expecting that the buffer can
+be emptied or reloaded within the data source/destination manager subroutine.
+The library supports this need by providing an "I/O suspension" mode, which we
+describe in this section.
+
+The I/O suspension mode is not a panacea: nothing is guaranteed about the
+maximum amount of time spent in any one call to the library, so it will not
+eliminate response-time problems in single-threaded applications.  If you
+need guaranteed response time, we suggest you "bite the bullet" and implement
+a real multi-tasking capability.
+
+To use I/O suspension, cooperation is needed between the calling application
+and the data source or destination manager; you will always need a custom
+source/destination manager.  (Please read the previous section if you haven't
+already.)  The basic idea is that the empty_output_buffer() or
+fill_input_buffer() routine is a no-op, merely returning FALSE to indicate
+that it has done nothing.  Upon seeing this, the JPEG library suspends
+operation and returns to its caller.  The surrounding application is
+responsible for emptying or refilling the work buffer before calling the
+JPEG library again.
+
+Compression suspension:
+
+For compression suspension, use an empty_output_buffer() routine that returns
+FALSE; typically it will not do anything else.  This will cause the
+compressor to return to the caller of jpeg_write_scanlines(), with the return
+value indicating that not all the supplied scanlines have been accepted.
+The application must make more room in the output buffer, adjust the output
+buffer pointer/count appropriately, and then call jpeg_write_scanlines()
+again, pointing to the first unconsumed scanline.
+
+When forced to suspend, the compressor will backtrack to a convenient stopping
+point (usually the start of the current MCU); it will regenerate some output
+data when restarted.  Therefore, although empty_output_buffer() is only
+called when the buffer is filled, you should NOT write out the entire buffer
+after a suspension.  Write only the data up to the current position of
+next_output_byte/free_in_buffer.  The data beyond that point will be
+regenerated after resumption.
+
+Because of the backtracking behavior, a good-size output buffer is essential
+for efficiency; you don't want the compressor to suspend often.  (In fact, an
+overly small buffer could lead to infinite looping, if a single MCU required
+more data than would fit in the buffer.)  We recommend a buffer of at least
+several Kbytes.  You may want to insert explicit code to ensure that you don't
+call jpeg_write_scanlines() unless there is a reasonable amount of space in
+the output buffer; in other words, flush the buffer before trying to compress
+more data.
+
+The compressor does not allow suspension while it is trying to write JPEG
+markers at the beginning and end of the file.  This means that:
+  * At the beginning of a compression operation, there must be enough free
+    space in the output buffer to hold the header markers (typically 600 or
+    so bytes).  The recommended buffer size is bigger than this anyway, so
+    this is not a problem as long as you start with an empty buffer.  However,
+    this restriction might catch you if you insert large special markers, such
+    as a JFIF thumbnail image, without flushing the buffer afterwards.
+  * When you call jpeg_finish_compress(), there must be enough space in the
+    output buffer to emit any buffered data and the final EOI marker.  In the
+    current implementation, half a dozen bytes should suffice for this, but
+    for safety's sake we recommend ensuring that at least 100 bytes are free
+    before calling jpeg_finish_compress().
+
+A more significant restriction is that jpeg_finish_compress() cannot suspend.
+This means you cannot use suspension with multi-pass operating modes, namely
+Huffman code optimization and multiple-scan output.  Those modes write the
+whole file during jpeg_finish_compress(), which will certainly result in
+buffer overrun.  (Note that this restriction applies only to compression,
+not decompression.  The decompressor supports input suspension in all of its
+operating modes.)
+
+Decompression suspension:
+
+For decompression suspension, use a fill_input_buffer() routine that simply
+returns FALSE (except perhaps during error recovery, as discussed below).
+This will cause the decompressor to return to its caller with an indication
+that suspension has occurred.  This can happen at four places:
+  * jpeg_read_header(): will return JPEG_SUSPENDED.
+  * jpeg_start_decompress(): will return FALSE, rather than its usual TRUE.
+  * jpeg_read_scanlines(): will return the number of scanlines already
+	completed (possibly 0).
+  * jpeg_finish_decompress(): will return FALSE, rather than its usual TRUE.
+The surrounding application must recognize these cases, load more data into
+the input buffer, and repeat the call.  In the case of jpeg_read_scanlines(),
+increment the passed pointers past any scanlines successfully read.
+
+Just as with compression, the decompressor will typically backtrack to a
+convenient restart point before suspending.  When fill_input_buffer() is
+called, next_input_byte/bytes_in_buffer point to the current restart point,
+which is where the decompressor will backtrack to if FALSE is returned.
+The data beyond that position must NOT be discarded if you suspend; it needs
+to be re-read upon resumption.  In most implementations, you'll need to shift
+this data down to the start of your work buffer and then load more data after
+it.  Again, this behavior means that a several-Kbyte work buffer is essential
+for decent performance; furthermore, you should load a reasonable amount of
+new data before resuming decompression.  (If you loaded, say, only one new
+byte each time around, you could waste a LOT of cycles.)
+
+The skip_input_data() source manager routine requires special care in a
+suspension scenario.  This routine is NOT granted the ability to suspend the
+decompressor; it can decrement bytes_in_buffer to zero, but no more.  If the
+requested skip distance exceeds the amount of data currently in the input
+buffer, then skip_input_data() must set bytes_in_buffer to zero and record the
+additional skip distance somewhere else.  The decompressor will immediately
+call fill_input_buffer(), which should return FALSE, which will cause a
+suspension return.  The surrounding application must then arrange to discard
+the recorded number of bytes before it resumes loading the input buffer.
+(Yes, this design is rather baroque, but it avoids complexity in the far more
+common case where a non-suspending source manager is used.)
+
+If the input data has been exhausted, we recommend that you emit a warning
+and insert dummy EOI markers just as a non-suspending data source manager
+would do.  This can be handled either in the surrounding application logic or
+within fill_input_buffer(); the latter is probably more efficient.  If
+fill_input_buffer() knows that no more data is available, it can set the
+pointer/count to point to a dummy EOI marker and then return TRUE just as
+though it had read more data in a non-suspending situation.
+
+The decompressor does not attempt to suspend within standard JPEG markers;
+instead it will backtrack to the start of the marker and reprocess the whole
+marker next time.  Hence the input buffer must be large enough to hold the
+longest standard marker in the file.  Standard JPEG markers should normally
+not exceed a few hundred bytes each (DHT tables are typically the longest).
+We recommend at least a 2K buffer for performance reasons, which is much
+larger than any correct marker is likely to be.  For robustness against
+damaged marker length counts, you may wish to insert a test in your
+application for the case that the input buffer is completely full and yet
+the decoder has suspended without consuming any data --- otherwise, if this
+situation did occur, it would lead to an endless loop.  (The library can't
+provide this test since it has no idea whether "the buffer is full", or
+even whether there is a fixed-size input buffer.)
+
+The input buffer would need to be 64K to allow for arbitrary COM or APPn
+markers, but these are handled specially: they are either saved into allocated
+memory, or skipped over by calling skip_input_data().  In the former case,
+suspension is handled correctly, and in the latter case, the problem of
+buffer overrun is placed on skip_input_data's shoulders, as explained above.
+Note that if you provide your own marker handling routine for large markers,
+you should consider how to deal with buffer overflow.
+
+Multiple-buffer management:
+
+In some applications it is desirable to store the compressed data in a linked
+list of buffer areas, so as to avoid data copying.  This can be handled by
+having empty_output_buffer() or fill_input_buffer() set the pointer and count
+to reference the next available buffer; FALSE is returned only if no more
+buffers are available.  Although seemingly straightforward, there is a
+pitfall in this approach: the backtrack that occurs when FALSE is returned
+could back up into an earlier buffer.  For example, when fill_input_buffer()
+is called, the current pointer & count indicate the backtrack restart point.
+Since fill_input_buffer() will set the pointer and count to refer to a new
+buffer, the restart position must be saved somewhere else.  Suppose a second
+call to fill_input_buffer() occurs in the same library call, and no
+additional input data is available, so fill_input_buffer must return FALSE.
+If the JPEG library has not moved the pointer/count forward in the current
+buffer, then *the correct restart point is the saved position in the prior
+buffer*.  Prior buffers may be discarded only after the library establishes
+a restart point within a later buffer.  Similar remarks apply for output into
+a chain of buffers.
+
+The library will never attempt to backtrack over a skip_input_data() call,
+so any skipped data can be permanently discarded.  You still have to deal
+with the case of skipping not-yet-received data, however.
+
+It's much simpler to use only a single buffer; when fill_input_buffer() is
+called, move any unconsumed data (beyond the current pointer/count) down to
+the beginning of this buffer and then load new data into the remaining buffer
+space.  This approach requires a little more data copying but is far easier
+to get right.
+
+
+Progressive JPEG support
+------------------------
+
+Progressive JPEG rearranges the stored data into a series of scans of
+increasing quality.  In situations where a JPEG file is transmitted across a
+slow communications link, a decoder can generate a low-quality image very
+quickly from the first scan, then gradually improve the displayed quality as
+more scans are received.  The final image after all scans are complete is
+identical to that of a regular (sequential) JPEG file of the same quality
+setting.  Progressive JPEG files are often slightly smaller than equivalent
+sequential JPEG files, but the possibility of incremental display is the main
+reason for using progressive JPEG.
+
+The IJG encoder library generates progressive JPEG files when given a
+suitable "scan script" defining how to divide the data into scans.
+Creation of progressive JPEG files is otherwise transparent to the encoder.
+Progressive JPEG files can also be read transparently by the decoder library.
+If the decoding application simply uses the library as defined above, it
+will receive a final decoded image without any indication that the file was
+progressive.  Of course, this approach does not allow incremental display.
+To perform incremental display, an application needs to use the decoder
+library's "buffered-image" mode, in which it receives a decoded image
+multiple times.
+
+Each displayed scan requires about as much work to decode as a full JPEG
+image of the same size, so the decoder must be fairly fast in relation to the
+data transmission rate in order to make incremental display useful.  However,
+it is possible to skip displaying the image and simply add the incoming bits
+to the decoder's coefficient buffer.  This is fast because only Huffman
+decoding need be done, not IDCT, upsampling, colorspace conversion, etc.
+The IJG decoder library allows the application to switch dynamically between
+displaying the image and simply absorbing the incoming bits.  A properly
+coded application can automatically adapt the number of display passes to
+suit the time available as the image is received.  Also, a final
+higher-quality display cycle can be performed from the buffered data after
+the end of the file is reached.
+
+Progressive compression:
+
+To create a progressive JPEG file (or a multiple-scan sequential JPEG file),
+set the scan_info cinfo field to point to an array of scan descriptors, and
+perform compression as usual.  Instead of constructing your own scan list,
+you can call the jpeg_simple_progression() helper routine to create a
+recommended progression sequence; this method should be used by all
+applications that don't want to get involved in the nitty-gritty of
+progressive scan sequence design.  (If you want to provide user control of
+scan sequences, you may wish to borrow the scan script reading code found
+in rdswitch.c, so that you can read scan script files just like cjpeg's.)
+When scan_info is not NULL, the compression library will store DCT'd data
+into a buffer array as jpeg_write_scanlines() is called, and will emit all
+the requested scans during jpeg_finish_compress().  This implies that
+multiple-scan output cannot be created with a suspending data destination
+manager, since jpeg_finish_compress() does not support suspension.  We
+should also note that the compressor currently forces Huffman optimization
+mode when creating a progressive JPEG file, because the default Huffman
+tables are unsuitable for progressive files.
+
+Progressive decompression:
+
+When buffered-image mode is not used, the decoder library will read all of
+a multi-scan file during jpeg_start_decompress(), so that it can provide a
+final decoded image.  (Here "multi-scan" means either progressive or
+multi-scan sequential.)  This makes multi-scan files transparent to the
+decoding application.  However, existing applications that used suspending
+input with version 5 of the IJG library will need to be modified to check
+for a suspension return from jpeg_start_decompress().
+
+To perform incremental display, an application must use the library's
+buffered-image mode.  This is described in the next section.
+
+
+Buffered-image mode
+-------------------
+
+In buffered-image mode, the library stores the partially decoded image in a
+coefficient buffer, from which it can be read out as many times as desired.
+This mode is typically used for incremental display of progressive JPEG files,
+but it can be used with any JPEG file.  Each scan of a progressive JPEG file
+adds more data (more detail) to the buffered image.  The application can
+display in lockstep with the source file (one display pass per input scan),
+or it can allow input processing to outrun display processing.  By making
+input and display processing run independently, it is possible for the
+application to adapt progressive display to a wide range of data transmission
+rates.
+
+The basic control flow for buffered-image decoding is
+
+	jpeg_create_decompress()
+	set data source
+	jpeg_read_header()
+	set overall decompression parameters
+	cinfo.buffered_image = TRUE;	/* select buffered-image mode */
+	jpeg_start_decompress()
+	for (each output pass) {
+	    adjust output decompression parameters if required
+	    jpeg_start_output()		/* start a new output pass */
+	    for (all scanlines in image) {
+	        jpeg_read_scanlines()
+	        display scanlines
+	    }
+	    jpeg_finish_output()	/* terminate output pass */
+	}
+	jpeg_finish_decompress()
+	jpeg_destroy_decompress()
+
+This differs from ordinary unbuffered decoding in that there is an additional
+level of looping.  The application can choose how many output passes to make
+and how to display each pass.
+
+The simplest approach to displaying progressive images is to do one display
+pass for each scan appearing in the input file.  In this case the outer loop
+condition is typically
+	while (! jpeg_input_complete(&cinfo))
+and the start-output call should read
+	jpeg_start_output(&cinfo, cinfo.input_scan_number);
+The second parameter to jpeg_start_output() indicates which scan of the input
+file is to be displayed; the scans are numbered starting at 1 for this
+purpose.  (You can use a loop counter starting at 1 if you like, but using
+the library's input scan counter is easier.)  The library automatically reads
+data as necessary to complete each requested scan, and jpeg_finish_output()
+advances to the next scan or end-of-image marker (hence input_scan_number
+will be incremented by the time control arrives back at jpeg_start_output()).
+With this technique, data is read from the input file only as needed, and
+input and output processing run in lockstep.
+
+After reading the final scan and reaching the end of the input file, the
+buffered image remains available; it can be read additional times by
+repeating the jpeg_start_output()/jpeg_read_scanlines()/jpeg_finish_output()
+sequence.  For example, a useful technique is to use fast one-pass color
+quantization for display passes made while the image is arriving, followed by
+a final display pass using two-pass quantization for highest quality.  This
+is done by changing the library parameters before the final output pass.
+Changing parameters between passes is discussed in detail below.
+
+In general the last scan of a progressive file cannot be recognized as such
+until after it is read, so a post-input display pass is the best approach if
+you want special processing in the final pass.
+
+When done with the image, be sure to call jpeg_finish_decompress() to release
+the buffered image (or just use jpeg_destroy_decompress()).
+
+If input data arrives faster than it can be displayed, the application can
+cause the library to decode input data in advance of what's needed to produce
+output.  This is done by calling the routine jpeg_consume_input().
+The return value is one of the following:
+	JPEG_REACHED_SOS:    reached an SOS marker (the start of a new scan)
+	JPEG_REACHED_EOI:    reached the EOI marker (end of image)
+	JPEG_ROW_COMPLETED:  completed reading one MCU row of compressed data
+	JPEG_SCAN_COMPLETED: completed reading last MCU row of current scan
+	JPEG_SUSPENDED:      suspended before completing any of the above
+(JPEG_SUSPENDED can occur only if a suspending data source is used.)  This
+routine can be called at any time after initializing the JPEG object.  It
+reads some additional data and returns when one of the indicated significant
+events occurs.  (If called after the EOI marker is reached, it will
+immediately return JPEG_REACHED_EOI without attempting to read more data.)
+
+The library's output processing will automatically call jpeg_consume_input()
+whenever the output processing overtakes the input; thus, simple lockstep
+display requires no direct calls to jpeg_consume_input().  But by adding
+calls to jpeg_consume_input(), you can absorb data in advance of what is
+being displayed.  This has two benefits:
+  * You can limit buildup of unprocessed data in your input buffer.
+  * You can eliminate extra display passes by paying attention to the
+    state of the library's input processing.
+
+The first of these benefits only requires interspersing calls to
+jpeg_consume_input() with your display operations and any other processing
+you may be doing.  To avoid wasting cycles due to backtracking, it's best to
+call jpeg_consume_input() only after a hundred or so new bytes have arrived.
+This is discussed further under "I/O suspension", above.  (Note: the JPEG
+library currently is not thread-safe.  You must not call jpeg_consume_input()
+from one thread of control if a different library routine is working on the
+same JPEG object in another thread.)
+
+When input arrives fast enough that more than one new scan is available
+before you start a new output pass, you may as well skip the output pass
+corresponding to the completed scan.  This occurs for free if you pass
+cinfo.input_scan_number as the target scan number to jpeg_start_output().
+The input_scan_number field is simply the index of the scan currently being
+consumed by the input processor.  You can ensure that this is up-to-date by
+emptying the input buffer just before calling jpeg_start_output(): call
+jpeg_consume_input() repeatedly until it returns JPEG_SUSPENDED or
+JPEG_REACHED_EOI.
+
+The target scan number passed to jpeg_start_output() is saved in the
+cinfo.output_scan_number field.  The library's output processing calls
+jpeg_consume_input() whenever the current input scan number and row within
+that scan is less than or equal to the current output scan number and row.
+Thus, input processing can "get ahead" of the output processing but is not
+allowed to "fall behind".  You can achieve several different effects by
+manipulating this interlock rule.  For example, if you pass a target scan
+number greater than the current input scan number, the output processor will
+wait until that scan starts to arrive before producing any output.  (To avoid
+an infinite loop, the target scan number is automatically reset to the last
+scan number when the end of image is reached.  Thus, if you specify a large
+target scan number, the library will just absorb the entire input file and
+then perform an output pass.  This is effectively the same as what
+jpeg_start_decompress() does when you don't select buffered-image mode.)
+When you pass a target scan number equal to the current input scan number,
+the image is displayed no faster than the current input scan arrives.  The
+final possibility is to pass a target scan number less than the current input
+scan number; this disables the input/output interlock and causes the output
+processor to simply display whatever it finds in the image buffer, without
+waiting for input.  (However, the library will not accept a target scan
+number less than one, so you can't avoid waiting for the first scan.)
+
+When data is arriving faster than the output display processing can advance
+through the image, jpeg_consume_input() will store data into the buffered
+image beyond the point at which the output processing is reading data out
+again.  If the input arrives fast enough, it may "wrap around" the buffer to
+the point where the input is more than one whole scan ahead of the output.
+If the output processing simply proceeds through its display pass without
+paying attention to the input, the effect seen on-screen is that the lower
+part of the image is one or more scans better in quality than the upper part.
+Then, when the next output scan is started, you have a choice of what target
+scan number to use.  The recommended choice is to use the current input scan
+number at that time, which implies that you've skipped the output scans
+corresponding to the input scans that were completed while you processed the
+previous output scan.  In this way, the decoder automatically adapts its
+speed to the arriving data, by skipping output scans as necessary to keep up
+with the arriving data.
+
+When using this strategy, you'll want to be sure that you perform a final
+output pass after receiving all the data; otherwise your last display may not
+be full quality across the whole screen.  So the right outer loop logic is
+something like this:
+	do {
+	    absorb any waiting input by calling jpeg_consume_input()
+	    final_pass = jpeg_input_complete(&cinfo);
+	    adjust output decompression parameters if required
+	    jpeg_start_output(&cinfo, cinfo.input_scan_number);
+	    ...
+	    jpeg_finish_output()
+	} while (! final_pass);
+rather than quitting as soon as jpeg_input_complete() returns TRUE.  This
+arrangement makes it simple to use higher-quality decoding parameters
+for the final pass.  But if you don't want to use special parameters for
+the final pass, the right loop logic is like this:
+	for (;;) {
+	    absorb any waiting input by calling jpeg_consume_input()
+	    jpeg_start_output(&cinfo, cinfo.input_scan_number);
+	    ...
+	    jpeg_finish_output()
+	    if (jpeg_input_complete(&cinfo) &&
+	        cinfo.input_scan_number == cinfo.output_scan_number)
+	      break;
+	}
+In this case you don't need to know in advance whether an output pass is to
+be the last one, so it's not necessary to have reached EOF before starting
+the final output pass; rather, what you want to test is whether the output
+pass was performed in sync with the final input scan.  This form of the loop
+will avoid an extra output pass whenever the decoder is able (or nearly able)
+to keep up with the incoming data.
+
+When the data transmission speed is high, you might begin a display pass,
+then find that much or all of the file has arrived before you can complete
+the pass.  (You can detect this by noting the JPEG_REACHED_EOI return code
+from jpeg_consume_input(), or equivalently by testing jpeg_input_complete().)
+In this situation you may wish to abort the current display pass and start a
+new one using the newly arrived information.  To do so, just call
+jpeg_finish_output() and then start a new pass with jpeg_start_output().
+
+A variant strategy is to abort and restart display if more than one complete
+scan arrives during an output pass; this can be detected by noting
+JPEG_REACHED_SOS returns and/or examining cinfo.input_scan_number.  This
+idea should be employed with caution, however, since the display process
+might never get to the bottom of the image before being aborted, resulting
+in the lower part of the screen being several passes worse than the upper.
+In most cases it's probably best to abort an output pass only if the whole
+file has arrived and you want to begin the final output pass immediately.
+
+When receiving data across a communication link, we recommend always using
+the current input scan number for the output target scan number; if a
+higher-quality final pass is to be done, it should be started (aborting any
+incomplete output pass) as soon as the end of file is received.  However,
+many other strategies are possible.  For example, the application can examine
+the parameters of the current input scan and decide whether to display it or
+not.  If the scan contains only chroma data, one might choose not to use it
+as the target scan, expecting that the scan will be small and will arrive
+quickly.  To skip to the next scan, call jpeg_consume_input() until it
+returns JPEG_REACHED_SOS or JPEG_REACHED_EOI.  Or just use the next higher
+number as the target scan for jpeg_start_output(); but that method doesn't
+let you inspect the next scan's parameters before deciding to display it.
+
+
+In buffered-image mode, jpeg_start_decompress() never performs input and
+thus never suspends.  An application that uses input suspension with
+buffered-image mode must be prepared for suspension returns from these
+routines:
+* jpeg_start_output() performs input only if you request 2-pass quantization
+  and the target scan isn't fully read yet.  (This is discussed below.)
+* jpeg_read_scanlines(), as always, returns the number of scanlines that it
+  was able to produce before suspending.
+* jpeg_finish_output() will read any markers following the target scan,
+  up to the end of the file or the SOS marker that begins another scan.
+  (But it reads no input if jpeg_consume_input() has already reached the
+  end of the file or a SOS marker beyond the target output scan.)
+* jpeg_finish_decompress() will read until the end of file, and thus can
+  suspend if the end hasn't already been reached (as can be tested by
+  calling jpeg_input_complete()).
+jpeg_start_output(), jpeg_finish_output(), and jpeg_finish_decompress()
+all return TRUE if they completed their tasks, FALSE if they had to suspend.
+In the event of a FALSE return, the application must load more input data
+and repeat the call.  Applications that use non-suspending data sources need
+not check the return values of these three routines.
+
+
+It is possible to change decoding parameters between output passes in the
+buffered-image mode.  The decoder library currently supports only very
+limited changes of parameters.  ONLY THE FOLLOWING parameter changes are
+allowed after jpeg_start_decompress() is called:
+* dct_method can be changed before each call to jpeg_start_output().
+  For example, one could use a fast DCT method for early scans, changing
+  to a higher quality method for the final scan.
+* dither_mode can be changed before each call to jpeg_start_output();
+  of course this has no impact if not using color quantization.  Typically
+  one would use ordered dither for initial passes, then switch to
+  Floyd-Steinberg dither for the final pass.  Caution: changing dither mode
+  can cause more memory to be allocated by the library.  Although the amount
+  of memory involved is not large (a scanline or so), it may cause the
+  initial max_memory_to_use specification to be exceeded, which in the worst
+  case would result in an out-of-memory failure.
+* do_block_smoothing can be changed before each call to jpeg_start_output().
+  This setting is relevant only when decoding a progressive JPEG image.
+  During the first DC-only scan, block smoothing provides a very "fuzzy" look
+  instead of the very "blocky" look seen without it; which is better seems a
+  matter of personal taste.  But block smoothing is nearly always a win
+  during later stages, especially when decoding a successive-approximation
+  image: smoothing helps to hide the slight blockiness that otherwise shows
+  up on smooth gradients until the lowest coefficient bits are sent.
+* Color quantization mode can be changed under the rules described below.
+  You *cannot* change between full-color and quantized output (because that
+  would alter the required I/O buffer sizes), but you can change which
+  quantization method is used.
+
+When generating color-quantized output, changing quantization method is a
+very useful way of switching between high-speed and high-quality display.
+The library allows you to change among its three quantization methods:
+1. Single-pass quantization to a fixed color cube.
+   Selected by cinfo.two_pass_quantize = FALSE and cinfo.colormap = NULL.
+2. Single-pass quantization to an application-supplied colormap.
+   Selected by setting cinfo.colormap to point to the colormap (the value of
+   two_pass_quantize is ignored); also set cinfo.actual_number_of_colors.
+3. Two-pass quantization to a colormap chosen specifically for the image.
+   Selected by cinfo.two_pass_quantize = TRUE and cinfo.colormap = NULL.
+   (This is the default setting selected by jpeg_read_header, but it is
+   probably NOT what you want for the first pass of progressive display!)
+These methods offer successively better quality and lesser speed.  However,
+only the first method is available for quantizing in non-RGB color spaces.
+
+IMPORTANT: because the different quantizer methods have very different
+working-storage requirements, the library requires you to indicate which
+one(s) you intend to use before you call jpeg_start_decompress().  (If we did
+not require this, the max_memory_to_use setting would be a complete fiction.)
+You do this by setting one or more of these three cinfo fields to TRUE:
+	enable_1pass_quant		Fixed color cube colormap
+	enable_external_quant		Externally-supplied colormap
+	enable_2pass_quant		Two-pass custom colormap
+All three are initialized FALSE by jpeg_read_header().  But
+jpeg_start_decompress() automatically sets TRUE the one selected by the
+current two_pass_quantize and colormap settings, so you only need to set the
+enable flags for any other quantization methods you plan to change to later.
+
+After setting the enable flags correctly at jpeg_start_decompress() time, you
+can change to any enabled quantization method by setting two_pass_quantize
+and colormap properly just before calling jpeg_start_output().  The following
+special rules apply:
+1. You must explicitly set cinfo.colormap to NULL when switching to 1-pass
+   or 2-pass mode from a different mode, or when you want the 2-pass
+   quantizer to be re-run to generate a new colormap.
+2. To switch to an external colormap, or to change to a different external
+   colormap than was used on the prior pass, you must call
+   jpeg_new_colormap() after setting cinfo.colormap.
+NOTE: if you want to use the same colormap as was used in the prior pass,
+you should not do either of these things.  This will save some nontrivial
+switchover costs.
+(These requirements exist because cinfo.colormap will always be non-NULL
+after completing a prior output pass, since both the 1-pass and 2-pass
+quantizers set it to point to their output colormaps.  Thus you have to
+do one of these two things to notify the library that something has changed.
+Yup, it's a bit klugy, but it's necessary to do it this way for backwards
+compatibility.)
+
+Note that in buffered-image mode, the library generates any requested colormap
+during jpeg_start_output(), not during jpeg_start_decompress().
+
+When using two-pass quantization, jpeg_start_output() makes a pass over the
+buffered image to determine the optimum color map; it therefore may take a
+significant amount of time, whereas ordinarily it does little work.  The
+progress monitor hook is called during this pass, if defined.  It is also
+important to realize that if the specified target scan number is greater than
+or equal to the current input scan number, jpeg_start_output() will attempt
+to consume input as it makes this pass.  If you use a suspending data source,
+you need to check for a FALSE return from jpeg_start_output() under these
+conditions.  The combination of 2-pass quantization and a not-yet-fully-read
+target scan is the only case in which jpeg_start_output() will consume input.
+
+
+Application authors who support buffered-image mode may be tempted to use it
+for all JPEG images, even single-scan ones.  This will work, but it is
+inefficient: there is no need to create an image-sized coefficient buffer for
+single-scan images.  Requesting buffered-image mode for such an image wastes
+memory.  Worse, it can cost time on large images, since the buffered data has
+to be swapped out or written to a temporary file.  If you are concerned about
+maximum performance on baseline JPEG files, you should use buffered-image
+mode only when the incoming file actually has multiple scans.  This can be
+tested by calling jpeg_has_multiple_scans(), which will return a correct
+result at any time after jpeg_read_header() completes.
+
+It is also worth noting that when you use jpeg_consume_input() to let input
+processing get ahead of output processing, the resulting pattern of access to
+the coefficient buffer is quite nonsequential.  It's best to use the memory
+manager jmemnobs.c if you can (ie, if you have enough real or virtual main
+memory).  If not, at least make sure that max_memory_to_use is set as high as
+possible.  If the JPEG memory manager has to use a temporary file, you will
+probably see a lot of disk traffic and poor performance.  (This could be
+improved with additional work on the memory manager, but we haven't gotten
+around to it yet.)
+
+In some applications it may be convenient to use jpeg_consume_input() for all
+input processing, including reading the initial markers; that is, you may
+wish to call jpeg_consume_input() instead of jpeg_read_header() during
+startup.  This works, but note that you must check for JPEG_REACHED_SOS and
+JPEG_REACHED_EOI return codes as the equivalent of jpeg_read_header's codes.
+Once the first SOS marker has been reached, you must call
+jpeg_start_decompress() before jpeg_consume_input() will consume more input;
+it'll just keep returning JPEG_REACHED_SOS until you do.  If you read a
+tables-only file this way, jpeg_consume_input() will return JPEG_REACHED_EOI
+without ever returning JPEG_REACHED_SOS; be sure to check for this case.
+If this happens, the decompressor will not read any more input until you call
+jpeg_abort() to reset it.  It is OK to call jpeg_consume_input() even when not
+using buffered-image mode, but in that case it's basically a no-op after the
+initial markers have been read: it will just return JPEG_SUSPENDED.
+
+
+Abbreviated datastreams and multiple images
+-------------------------------------------
+
+A JPEG compression or decompression object can be reused to process multiple
+images.  This saves a small amount of time per image by eliminating the
+"create" and "destroy" operations, but that isn't the real purpose of the
+feature.  Rather, reuse of an object provides support for abbreviated JPEG
+datastreams.  Object reuse can also simplify processing a series of images in
+a single input or output file.  This section explains these features.
+
+A JPEG file normally contains several hundred bytes worth of quantization
+and Huffman tables.  In a situation where many images will be stored or
+transmitted with identical tables, this may represent an annoying overhead.
+The JPEG standard therefore permits tables to be omitted.  The standard
+defines three classes of JPEG datastreams:
+  * "Interchange" datastreams contain an image and all tables needed to decode
+     the image.  These are the usual kind of JPEG file.
+  * "Abbreviated image" datastreams contain an image, but are missing some or
+    all of the tables needed to decode that image.
+  * "Abbreviated table specification" (henceforth "tables-only") datastreams
+    contain only table specifications.
+To decode an abbreviated image, it is necessary to load the missing table(s)
+into the decoder beforehand.  This can be accomplished by reading a separate
+tables-only file.  A variant scheme uses a series of images in which the first
+image is an interchange (complete) datastream, while subsequent ones are
+abbreviated and rely on the tables loaded by the first image.  It is assumed
+that once the decoder has read a table, it will remember that table until a
+new definition for the same table number is encountered.
+
+It is the application designer's responsibility to figure out how to associate
+the correct tables with an abbreviated image.  While abbreviated datastreams
+can be useful in a closed environment, their use is strongly discouraged in
+any situation where data exchange with other applications might be needed.
+Caveat designer.
+
+The JPEG library provides support for reading and writing any combination of
+tables-only datastreams and abbreviated images.  In both compression and
+decompression objects, a quantization or Huffman table will be retained for
+the lifetime of the object, unless it is overwritten by a new table definition.
+
+
+To create abbreviated image datastreams, it is only necessary to tell the
+compressor not to emit some or all of the tables it is using.  Each
+quantization and Huffman table struct contains a boolean field "sent_table",
+which normally is initialized to FALSE.  For each table used by the image, the
+header-writing process emits the table and sets sent_table = TRUE unless it is
+already TRUE.  (In normal usage, this prevents outputting the same table
+definition multiple times, as would otherwise occur because the chroma
+components typically share tables.)  Thus, setting this field to TRUE before
+calling jpeg_start_compress() will prevent the table from being written at
+all.
+
+If you want to create a "pure" abbreviated image file containing no tables,
+just call "jpeg_suppress_tables(&cinfo, TRUE)" after constructing all the
+tables.  If you want to emit some but not all tables, you'll need to set the
+individual sent_table fields directly.
+
+To create an abbreviated image, you must also call jpeg_start_compress()
+with a second parameter of FALSE, not TRUE.  Otherwise jpeg_start_compress()
+will force all the sent_table fields to FALSE.  (This is a safety feature to
+prevent abbreviated images from being created accidentally.)
+
+To create a tables-only file, perform the same parameter setup that you
+normally would, but instead of calling jpeg_start_compress() and so on, call
+jpeg_write_tables(&cinfo).  This will write an abbreviated datastream
+containing only SOI, DQT and/or DHT markers, and EOI.  All the quantization
+and Huffman tables that are currently defined in the compression object will
+be emitted unless their sent_tables flag is already TRUE, and then all the
+sent_tables flags will be set TRUE.
+
+A sure-fire way to create matching tables-only and abbreviated image files
+is to proceed as follows:
+
+	create JPEG compression object
+	set JPEG parameters
+	set destination to tables-only file
+	jpeg_write_tables(&cinfo);
+	set destination to image file
+	jpeg_start_compress(&cinfo, FALSE);
+	write data...
+	jpeg_finish_compress(&cinfo);
+
+Since the JPEG parameters are not altered between writing the table file and
+the abbreviated image file, the same tables are sure to be used.  Of course,
+you can repeat the jpeg_start_compress() ... jpeg_finish_compress() sequence
+many times to produce many abbreviated image files matching the table file.
+
+You cannot suppress output of the computed Huffman tables when Huffman
+optimization is selected.  (If you could, there'd be no way to decode the
+image...)  Generally, you don't want to set optimize_coding = TRUE when
+you are trying to produce abbreviated files.
+
+In some cases you might want to compress an image using tables which are
+not stored in the application, but are defined in an interchange or
+tables-only file readable by the application.  This can be done by setting up
+a JPEG decompression object to read the specification file, then copying the
+tables into your compression object.  See jpeg_copy_critical_parameters()
+for an example of copying quantization tables.
+
+
+To read abbreviated image files, you simply need to load the proper tables
+into the decompression object before trying to read the abbreviated image.
+If the proper tables are stored in the application program, you can just
+allocate the table structs and fill in their contents directly.  For example,
+to load a fixed quantization table into table slot "n":
+
+    if (cinfo.quant_tbl_ptrs[n] == NULL)
+      cinfo.quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) &cinfo);
+    quant_ptr = cinfo.quant_tbl_ptrs[n];	/* quant_ptr is JQUANT_TBL* */
+    for (i = 0; i < 64; i++) {
+      /* Qtable[] is desired quantization table, in natural array order */
+      quant_ptr->quantval[i] = Qtable[i];
+    }
+
+Code to load a fixed Huffman table is typically (for AC table "n"):
+
+    if (cinfo.ac_huff_tbl_ptrs[n] == NULL)
+      cinfo.ac_huff_tbl_ptrs[n] = jpeg_alloc_huff_table((j_common_ptr) &cinfo);
+    huff_ptr = cinfo.ac_huff_tbl_ptrs[n];	/* huff_ptr is JHUFF_TBL* */
+    for (i = 1; i <= 16; i++) {
+      /* counts[i] is number of Huffman codes of length i bits, i=1..16 */
+      huff_ptr->bits[i] = counts[i];
+    }
+    for (i = 0; i < 256; i++) {
+      /* symbols[] is the list of Huffman symbols, in code-length order */
+      huff_ptr->huffval[i] = symbols[i];
+    }
+
+(Note that trying to set cinfo.quant_tbl_ptrs[n] to point directly at a
+constant JQUANT_TBL object is not safe.  If the incoming file happened to
+contain a quantization table definition, your master table would get
+overwritten!  Instead allocate a working table copy and copy the master table
+into it, as illustrated above.  Ditto for Huffman tables, of course.)
+
+You might want to read the tables from a tables-only file, rather than
+hard-wiring them into your application.  The jpeg_read_header() call is
+sufficient to read a tables-only file.  You must pass a second parameter of
+FALSE to indicate that you do not require an image to be present.  Thus, the
+typical scenario is
+
+	create JPEG decompression object
+	set source to tables-only file
+	jpeg_read_header(&cinfo, FALSE);
+	set source to abbreviated image file
+	jpeg_read_header(&cinfo, TRUE);
+	set decompression parameters
+	jpeg_start_decompress(&cinfo);
+	read data...
+	jpeg_finish_decompress(&cinfo);
+
+In some cases, you may want to read a file without knowing whether it contains
+an image or just tables.  In that case, pass FALSE and check the return value
+from jpeg_read_header(): it will be JPEG_HEADER_OK if an image was found,
+JPEG_HEADER_TABLES_ONLY if only tables were found.  (A third return value,
+JPEG_SUSPENDED, is possible when using a suspending data source manager.)
+Note that jpeg_read_header() will not complain if you read an abbreviated
+image for which you haven't loaded the missing tables; the missing-table check
+occurs later, in jpeg_start_decompress().
+
+
+It is possible to read a series of images from a single source file by
+repeating the jpeg_read_header() ... jpeg_finish_decompress() sequence,
+without releasing/recreating the JPEG object or the data source module.
+(If you did reinitialize, any partial bufferload left in the data source
+buffer at the end of one image would be discarded, causing you to lose the
+start of the next image.)  When you use this method, stored tables are
+automatically carried forward, so some of the images can be abbreviated images
+that depend on tables from earlier images.
+
+If you intend to write a series of images into a single destination file,
+you might want to make a specialized data destination module that doesn't
+flush the output buffer at term_destination() time.  This would speed things
+up by some trifling amount.  Of course, you'd need to remember to flush the
+buffer after the last image.  You can make the later images be abbreviated
+ones by passing FALSE to jpeg_start_compress().
+
+
+Special markers
+---------------
+
+Some applications may need to insert or extract special data in the JPEG
+datastream.  The JPEG standard provides marker types "COM" (comment) and
+"APP0" through "APP15" (application) to hold application-specific data.
+Unfortunately, the use of these markers is not specified by the standard.
+COM markers are fairly widely used to hold user-supplied text.  The JFIF file
+format spec uses APP0 markers with specified initial strings to hold certain
+data.  Adobe applications use APP14 markers beginning with the string "Adobe"
+for miscellaneous data.  Other APPn markers are rarely seen, but might
+contain almost anything.
+
+If you wish to store user-supplied text, we recommend you use COM markers
+and place readable 7-bit ASCII text in them.  Newline conventions are not
+standardized --- expect to find LF (Unix style), CR/LF (DOS style), or CR
+(Mac style).  A robust COM reader should be able to cope with random binary
+garbage, including nulls, since some applications generate COM markers
+containing non-ASCII junk.  (But yours should not be one of them.)
+
+For program-supplied data, use an APPn marker, and be sure to begin it with an
+identifying string so that you can tell whether the marker is actually yours.
+It's probably best to avoid using APP0 or APP14 for any private markers.
+(NOTE: the upcoming SPIFF standard will use APP8 markers; we recommend you
+not use APP8 markers for any private purposes, either.)
+
+Keep in mind that at most 65533 bytes can be put into one marker, but you
+can have as many markers as you like.
+
+By default, the IJG compression library will write a JFIF APP0 marker if the
+selected JPEG colorspace is grayscale or YCbCr, or an Adobe APP14 marker if
+the selected colorspace is RGB, CMYK, or YCCK.  You can disable this, but
+we don't recommend it.  The decompression library will recognize JFIF and
+Adobe markers and will set the JPEG colorspace properly when one is found.
+
+
+You can write special markers immediately following the datastream header by
+calling jpeg_write_marker() after jpeg_start_compress() and before the first
+call to jpeg_write_scanlines().  When you do this, the markers appear after
+the SOI and the JFIF APP0 and Adobe APP14 markers (if written), but before
+all else.  Specify the marker type parameter as "JPEG_COM" for COM or
+"JPEG_APP0 + n" for APPn.  (Actually, jpeg_write_marker will let you write
+any marker type, but we don't recommend writing any other kinds of marker.)
+For example, to write a user comment string pointed to by comment_text:
+	jpeg_write_marker(cinfo, JPEG_COM, comment_text, strlen(comment_text));
+
+If it's not convenient to store all the marker data in memory at once,
+you can instead call jpeg_write_m_header() followed by multiple calls to
+jpeg_write_m_byte().  If you do it this way, it's your responsibility to
+call jpeg_write_m_byte() exactly the number of times given in the length
+parameter to jpeg_write_m_header().  (This method lets you empty the
+output buffer partway through a marker, which might be important when
+using a suspending data destination module.  In any case, if you are using
+a suspending destination, you should flush its buffer after inserting
+any special markers.  See "I/O suspension".)
+
+Or, if you prefer to synthesize the marker byte sequence yourself,
+you can just cram it straight into the data destination module.
+
+If you are writing JFIF 1.02 extension markers (thumbnail images), don't
+forget to set cinfo.JFIF_minor_version = 2 so that the encoder will write the
+correct JFIF version number in the JFIF header marker.  The library's default
+is to write version 1.01, but that's wrong if you insert any 1.02 extension
+markers.  (We could probably get away with just defaulting to 1.02, but there
+used to be broken decoders that would complain about unknown minor version
+numbers.  To reduce compatibility risks it's safest not to write 1.02 unless
+you are actually using 1.02 extensions.)
+
+
+When reading, two methods of handling special markers are available:
+1. You can ask the library to save the contents of COM and/or APPn markers
+into memory, and then examine them at your leisure afterwards.
+2. You can supply your own routine to process COM and/or APPn markers
+on-the-fly as they are read.
+The first method is simpler to use, especially if you are using a suspending
+data source; writing a marker processor that copes with input suspension is
+not easy (consider what happens if the marker is longer than your available
+input buffer).  However, the second method conserves memory since the marker
+data need not be kept around after it's been processed.
+
+For either method, you'd normally set up marker handling after creating a
+decompression object and before calling jpeg_read_header(), because the
+markers of interest will typically be near the head of the file and so will
+be scanned by jpeg_read_header.  Once you've established a marker handling
+method, it will be used for the life of that decompression object
+(potentially many datastreams), unless you change it.  Marker handling is
+determined separately for COM markers and for each APPn marker code.
+
+
+To save the contents of special markers in memory, call
+	jpeg_save_markers(cinfo, marker_code, length_limit)
+where marker_code is the marker type to save, JPEG_COM or JPEG_APP0+n.
+(To arrange to save all the special marker types, you need to call this
+routine 17 times, for COM and APP0-APP15.)  If the incoming marker is longer
+than length_limit data bytes, only length_limit bytes will be saved; this
+parameter allows you to avoid chewing up memory when you only need to see the
+first few bytes of a potentially large marker.  If you want to save all the
+data, set length_limit to 0xFFFF; that is enough since marker lengths are only
+16 bits.  As a special case, setting length_limit to 0 prevents that marker
+type from being saved at all.  (That is the default behavior, in fact.)
+
+After jpeg_read_header() completes, you can examine the special markers by
+following the cinfo->marker_list pointer chain.  All the special markers in
+the file appear in this list, in order of their occurrence in the file (but
+omitting any markers of types you didn't ask for).  Both the original data
+length and the saved data length are recorded for each list entry; the latter
+will not exceed length_limit for the particular marker type.  Note that these
+lengths exclude the marker length word, whereas the stored representation
+within the JPEG file includes it.  (Hence the maximum data length is really
+only 65533.)
+
+It is possible that additional special markers appear in the file beyond the
+SOS marker at which jpeg_read_header stops; if so, the marker list will be
+extended during reading of the rest of the file.  This is not expected to be
+common, however.  If you are short on memory you may want to reset the length
+limit to zero for all marker types after finishing jpeg_read_header, to
+ensure that the max_memory_to_use setting cannot be exceeded due to addition
+of later markers.
+
+The marker list remains stored until you call jpeg_finish_decompress or
+jpeg_abort, at which point the memory is freed and the list is set to empty.
+(jpeg_destroy also releases the storage, of course.)
+
+Note that the library is internally interested in APP0 and APP14 markers;
+if you try to set a small nonzero length limit on these types, the library
+will silently force the length up to the minimum it wants.  (But you can set
+a zero length limit to prevent them from being saved at all.)  Also, in a
+16-bit environment, the maximum length limit may be constrained to less than
+65533 by malloc() limitations.  It is therefore best not to assume that the
+effective length limit is exactly what you set it to be.
+
+
+If you want to supply your own marker-reading routine, you do it by calling
+jpeg_set_marker_processor().  A marker processor routine must have the
+signature
+	boolean jpeg_marker_parser_method (j_decompress_ptr cinfo)
+Although the marker code is not explicitly passed, the routine can find it
+in cinfo->unread_marker.  At the time of call, the marker proper has been
+read from the data source module.  The processor routine is responsible for
+reading the marker length word and the remaining parameter bytes, if any.
+Return TRUE to indicate success.  (FALSE should be returned only if you are
+using a suspending data source and it tells you to suspend.  See the standard
+marker processors in jdmarker.c for appropriate coding methods if you need to
+use a suspending data source.)
+
+If you override the default APP0 or APP14 processors, it is up to you to
+recognize JFIF and Adobe markers if you want colorspace recognition to occur
+properly.  We recommend copying and extending the default processors if you
+want to do that.  (A better idea is to save these marker types for later
+examination by calling jpeg_save_markers(); that method doesn't interfere
+with the library's own processing of these markers.)
+
+jpeg_set_marker_processor() and jpeg_save_markers() are mutually exclusive
+--- if you call one it overrides any previous call to the other, for the
+particular marker type specified.
+
+A simple example of an external COM processor can be found in djpeg.c.
+Also, see jpegtran.c for an example of using jpeg_save_markers.
+
+
+Raw (downsampled) image data
+----------------------------
+
+Some applications need to supply already-downsampled image data to the JPEG
+compressor, or to receive raw downsampled data from the decompressor.  The
+library supports this requirement by allowing the application to write or
+read raw data, bypassing the normal preprocessing or postprocessing steps.
+The interface is different from the standard one and is somewhat harder to
+use.  If your interest is merely in bypassing color conversion, we recommend
+that you use the standard interface and simply set jpeg_color_space =
+in_color_space (or jpeg_color_space = out_color_space for decompression).
+The mechanism described in this section is necessary only to supply or
+receive downsampled image data, in which not all components have the same
+dimensions.
+
+
+To compress raw data, you must supply the data in the colorspace to be used
+in the JPEG file (please read the earlier section on Special color spaces)
+and downsampled to the sampling factors specified in the JPEG parameters.
+You must supply the data in the format used internally by the JPEG library,
+namely a JSAMPIMAGE array.  This is an array of pointers to two-dimensional
+arrays, each of type JSAMPARRAY.  Each 2-D array holds the values for one
+color component.  This structure is necessary since the components are of
+different sizes.  If the image dimensions are not a multiple of the MCU size,
+you must also pad the data correctly (usually, this is done by replicating
+the last column and/or row).  The data must be padded to a multiple of a DCT
+block in each component: that is, each downsampled row must contain a
+multiple of 8 valid samples, and there must be a multiple of 8 sample rows
+for each component.  (For applications such as conversion of digital TV
+images, the standard image size is usually a multiple of the DCT block size,
+so that no padding need actually be done.)
+
+The procedure for compression of raw data is basically the same as normal
+compression, except that you call jpeg_write_raw_data() in place of
+jpeg_write_scanlines().  Before calling jpeg_start_compress(), you must do
+the following:
+  * Set cinfo->raw_data_in to TRUE.  (It is set FALSE by jpeg_set_defaults().)
+    This notifies the library that you will be supplying raw data.
+  * Ensure jpeg_color_space is correct --- an explicit jpeg_set_colorspace()
+    call is a good idea.  Note that since color conversion is bypassed,
+    in_color_space is ignored, except that jpeg_set_defaults() uses it to
+    choose the default jpeg_color_space setting.
+  * Ensure the sampling factors, cinfo->comp_info[i].h_samp_factor and
+    cinfo->comp_info[i].v_samp_factor, are correct.  Since these indicate the
+    dimensions of the data you are supplying, it's wise to set them
+    explicitly, rather than assuming the library's defaults are what you want.
+
+To pass raw data to the library, call jpeg_write_raw_data() in place of
+jpeg_write_scanlines().  The two routines work similarly except that
+jpeg_write_raw_data takes a JSAMPIMAGE data array rather than JSAMPARRAY.
+The scanlines count passed to and returned from jpeg_write_raw_data is
+measured in terms of the component with the largest v_samp_factor.
+
+jpeg_write_raw_data() processes one MCU row per call, which is to say
+v_samp_factor*DCTSIZE sample rows of each component.  The passed num_lines
+value must be at least max_v_samp_factor*DCTSIZE, and the return value will
+be exactly that amount (or possibly some multiple of that amount, in future
+library versions).  This is true even on the last call at the bottom of the
+image; don't forget to pad your data as necessary.
+
+The required dimensions of the supplied data can be computed for each
+component as
+	cinfo->comp_info[i].width_in_blocks*DCTSIZE  samples per row
+	cinfo->comp_info[i].height_in_blocks*DCTSIZE rows in image
+after jpeg_start_compress() has initialized those fields.  If the valid data
+is smaller than this, it must be padded appropriately.  For some sampling
+factors and image sizes, additional dummy DCT blocks are inserted to make
+the image a multiple of the MCU dimensions.  The library creates such dummy
+blocks itself; it does not read them from your supplied data.  Therefore you
+need never pad by more than DCTSIZE samples.  An example may help here.
+Assume 2h2v downsampling of YCbCr data, that is
+	cinfo->comp_info[0].h_samp_factor = 2		for Y
+	cinfo->comp_info[0].v_samp_factor = 2
+	cinfo->comp_info[1].h_samp_factor = 1		for Cb
+	cinfo->comp_info[1].v_samp_factor = 1
+	cinfo->comp_info[2].h_samp_factor = 1		for Cr
+	cinfo->comp_info[2].v_samp_factor = 1
+and suppose that the nominal image dimensions (cinfo->image_width and
+cinfo->image_height) are 101x101 pixels.  Then jpeg_start_compress() will
+compute downsampled_width = 101 and width_in_blocks = 13 for Y,
+downsampled_width = 51 and width_in_blocks = 7 for Cb and Cr (and the same
+for the height fields).  You must pad the Y data to at least 13*8 = 104
+columns and rows, the Cb/Cr data to at least 7*8 = 56 columns and rows.  The
+MCU height is max_v_samp_factor = 2 DCT rows so you must pass at least 16
+scanlines on each call to jpeg_write_raw_data(), which is to say 16 actual
+sample rows of Y and 8 each of Cb and Cr.  A total of 7 MCU rows are needed,
+so you must pass a total of 7*16 = 112 "scanlines".  The last DCT block row
+of Y data is dummy, so it doesn't matter what you pass for it in the data
+arrays, but the scanlines count must total up to 112 so that all of the Cb
+and Cr data gets passed.
+
+Output suspension is supported with raw-data compression: if the data
+destination module suspends, jpeg_write_raw_data() will return 0.
+In this case the same data rows must be passed again on the next call.
+
+
+Decompression with raw data output implies bypassing all postprocessing:
+you cannot ask for rescaling or color quantization, for instance.  More
+seriously, you must deal with the color space and sampling factors present in
+the incoming file.  If your application only handles, say, 2h1v YCbCr data,
+you must check for and fail on other color spaces or other sampling factors.
+The library will not convert to a different color space for you.
+
+To obtain raw data output, set cinfo->raw_data_out = TRUE before
+jpeg_start_decompress() (it is set FALSE by jpeg_read_header()).  Be sure to
+verify that the color space and sampling factors are ones you can handle.
+Then call jpeg_read_raw_data() in place of jpeg_read_scanlines().  The
+decompression process is otherwise the same as usual.
+
+jpeg_read_raw_data() returns one MCU row per call, and thus you must pass a
+buffer of at least max_v_samp_factor*DCTSIZE scanlines (scanline counting is
+the same as for raw-data compression).  The buffer you pass must be large
+enough to hold the actual data plus padding to DCT-block boundaries.  As with
+compression, any entirely dummy DCT blocks are not processed so you need not
+allocate space for them, but the total scanline count includes them.  The
+above example of computing buffer dimensions for raw-data compression is
+equally valid for decompression.
+
+Input suspension is supported with raw-data decompression: if the data source
+module suspends, jpeg_read_raw_data() will return 0.  You can also use
+buffered-image mode to read raw data in multiple passes.
+
+
+Really raw data: DCT coefficients
+---------------------------------
+
+It is possible to read or write the contents of a JPEG file as raw DCT
+coefficients.  This facility is mainly intended for use in lossless
+transcoding between different JPEG file formats.  Other possible applications
+include lossless cropping of a JPEG image, lossless reassembly of a
+multi-strip or multi-tile TIFF/JPEG file into a single JPEG datastream, etc.
+
+To read the contents of a JPEG file as DCT coefficients, open the file and do
+jpeg_read_header() as usual.  But instead of calling jpeg_start_decompress()
+and jpeg_read_scanlines(), call jpeg_read_coefficients().  This will read the
+entire image into a set of virtual coefficient-block arrays, one array per
+component.  The return value is a pointer to an array of virtual-array
+descriptors.  Each virtual array can be accessed directly using the JPEG
+memory manager's access_virt_barray method (see Memory management, below,
+and also read structure.doc's discussion of virtual array handling).  Or,
+for simple transcoding to a different JPEG file format, the array list can
+just be handed directly to jpeg_write_coefficients().
+
+Each block in the block arrays contains quantized coefficient values in
+normal array order (not JPEG zigzag order).  The block arrays contain only
+DCT blocks containing real data; any entirely-dummy blocks added to fill out
+interleaved MCUs at the right or bottom edges of the image are discarded
+during reading and are not stored in the block arrays.  (The size of each
+block array can be determined from the width_in_blocks and height_in_blocks
+fields of the component's comp_info entry.)  This is also the data format
+expected by jpeg_write_coefficients().
+
+When you are done using the virtual arrays, call jpeg_finish_decompress()
+to release the array storage and return the decompression object to an idle
+state; or just call jpeg_destroy() if you don't need to reuse the object.
+
+If you use a suspending data source, jpeg_read_coefficients() will return
+NULL if it is forced to suspend; a non-NULL return value indicates successful
+completion.  You need not test for a NULL return value when using a
+non-suspending data source.
+
+It is also possible to call jpeg_read_coefficients() to obtain access to the
+decoder's coefficient arrays during a normal decode cycle in buffered-image
+mode.  This frammish might be useful for progressively displaying an incoming
+image and then re-encoding it without loss.  To do this, decode in buffered-
+image mode as discussed previously, then call jpeg_read_coefficients() after
+the last jpeg_finish_output() call.  The arrays will be available for your use
+until you call jpeg_finish_decompress().
+
+
+To write the contents of a JPEG file as DCT coefficients, you must provide
+the DCT coefficients stored in virtual block arrays.  You can either pass
+block arrays read from an input JPEG file by jpeg_read_coefficients(), or
+allocate virtual arrays from the JPEG compression object and fill them
+yourself.  In either case, jpeg_write_coefficients() is substituted for
+jpeg_start_compress() and jpeg_write_scanlines().  Thus the sequence is
+  * Create compression object
+  * Set all compression parameters as necessary
+  * Request virtual arrays if needed
+  * jpeg_write_coefficients()
+  * jpeg_finish_compress()
+  * Destroy or re-use compression object
+jpeg_write_coefficients() is passed a pointer to an array of virtual block
+array descriptors; the number of arrays is equal to cinfo.num_components.
+
+The virtual arrays need only have been requested, not realized, before
+jpeg_write_coefficients() is called.  A side-effect of
+jpeg_write_coefficients() is to realize any virtual arrays that have been
+requested from the compression object's memory manager.  Thus, when obtaining
+the virtual arrays from the compression object, you should fill the arrays
+after calling jpeg_write_coefficients().  The data is actually written out
+when you call jpeg_finish_compress(); jpeg_write_coefficients() only writes
+the file header.
+
+When writing raw DCT coefficients, it is crucial that the JPEG quantization
+tables and sampling factors match the way the data was encoded, or the
+resulting file will be invalid.  For transcoding from an existing JPEG file,
+we recommend using jpeg_copy_critical_parameters().  This routine initializes
+all the compression parameters to default values (like jpeg_set_defaults()),
+then copies the critical information from a source decompression object.
+The decompression object should have just been used to read the entire
+JPEG input file --- that is, it should be awaiting jpeg_finish_decompress().
+
+jpeg_write_coefficients() marks all tables stored in the compression object
+as needing to be written to the output file (thus, it acts like
+jpeg_start_compress(cinfo, TRUE)).  This is for safety's sake, to avoid
+emitting abbreviated JPEG files by accident.  If you really want to emit an
+abbreviated JPEG file, call jpeg_suppress_tables(), or set the tables'
+individual sent_table flags, between calling jpeg_write_coefficients() and
+jpeg_finish_compress().
+
+
+Progress monitoring
+-------------------
+
+Some applications may need to regain control from the JPEG library every so
+often.  The typical use of this feature is to produce a percent-done bar or
+other progress display.  (For a simple example, see cjpeg.c or djpeg.c.)
+Although you do get control back frequently during the data-transferring pass
+(the jpeg_read_scanlines or jpeg_write_scanlines loop), any additional passes
+will occur inside jpeg_finish_compress or jpeg_start_decompress; those
+routines may take a long time to execute, and you don't get control back
+until they are done.
+
+You can define a progress-monitor routine which will be called periodically
+by the library.  No guarantees are made about how often this call will occur,
+so we don't recommend you use it for mouse tracking or anything like that.
+At present, a call will occur once per MCU row, scanline, or sample row
+group, whichever unit is convenient for the current processing mode; so the
+wider the image, the longer the time between calls.  During the data
+transferring pass, only one call occurs per call of jpeg_read_scanlines or
+jpeg_write_scanlines, so don't pass a large number of scanlines at once if
+you want fine resolution in the progress count.  (If you really need to use
+the callback mechanism for time-critical tasks like mouse tracking, you could
+insert additional calls inside some of the library's inner loops.)
+
+To establish a progress-monitor callback, create a struct jpeg_progress_mgr,
+fill in its progress_monitor field with a pointer to your callback routine,
+and set cinfo->progress to point to the struct.  The callback will be called
+whenever cinfo->progress is non-NULL.  (This pointer is set to NULL by
+jpeg_create_compress or jpeg_create_decompress; the library will not change
+it thereafter.  So if you allocate dynamic storage for the progress struct,
+make sure it will live as long as the JPEG object does.  Allocating from the
+JPEG memory manager with lifetime JPOOL_PERMANENT will work nicely.)  You
+can use the same callback routine for both compression and decompression.
+
+The jpeg_progress_mgr struct contains four fields which are set by the library:
+	long pass_counter;	/* work units completed in this pass */
+	long pass_limit;	/* total number of work units in this pass */
+	int completed_passes;	/* passes completed so far */
+	int total_passes;	/* total number of passes expected */
+During any one pass, pass_counter increases from 0 up to (not including)
+pass_limit; the step size is usually but not necessarily 1.  The pass_limit
+value may change from one pass to another.  The expected total number of
+passes is in total_passes, and the number of passes already completed is in
+completed_passes.  Thus the fraction of work completed may be estimated as
+		completed_passes + (pass_counter/pass_limit)
+		--------------------------------------------
+				total_passes
+ignoring the fact that the passes may not be equal amounts of work.
+
+When decompressing, pass_limit can even change within a pass, because it
+depends on the number of scans in the JPEG file, which isn't always known in
+advance.  The computed fraction-of-work-done may jump suddenly (if the library
+discovers it has overestimated the number of scans) or even decrease (in the
+opposite case).  It is not wise to put great faith in the work estimate.
+
+When using the decompressor's buffered-image mode, the progress monitor work
+estimate is likely to be completely unhelpful, because the library has no way
+to know how many output passes will be demanded of it.  Currently, the library
+sets total_passes based on the assumption that there will be one more output
+pass if the input file end hasn't yet been read (jpeg_input_complete() isn't
+TRUE), but no more output passes if the file end has been reached when the
+output pass is started.  This means that total_passes will rise as additional
+output passes are requested.  If you have a way of determining the input file
+size, estimating progress based on the fraction of the file that's been read
+will probably be more useful than using the library's value.
+
+
+Memory management
+-----------------
+
+This section covers some key facts about the JPEG library's built-in memory
+manager.  For more info, please read structure.doc's section about the memory
+manager, and consult the source code if necessary.
+
+All memory and temporary file allocation within the library is done via the
+memory manager.  If necessary, you can replace the "back end" of the memory
+manager to control allocation yourself (for example, if you don't want the
+library to use malloc() and free() for some reason).
+
+Some data is allocated "permanently" and will not be freed until the JPEG
+object is destroyed.  Most data is allocated "per image" and is freed by
+jpeg_finish_compress, jpeg_finish_decompress, or jpeg_abort.  You can call the
+memory manager yourself to allocate structures that will automatically be
+freed at these times.  Typical code for this is
+  ptr = (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, size);
+Use JPOOL_PERMANENT to get storage that lasts as long as the JPEG object.
+Use alloc_large instead of alloc_small for anything bigger than a few Kbytes.
+There are also alloc_sarray and alloc_barray routines that automatically
+build 2-D sample or block arrays.
+
+The library's minimum space requirements to process an image depend on the
+image's width, but not on its height, because the library ordinarily works
+with "strip" buffers that are as wide as the image but just a few rows high.
+Some operating modes (eg, two-pass color quantization) require full-image
+buffers.  Such buffers are treated as "virtual arrays": only the current strip
+need be in memory, and the rest can be swapped out to a temporary file.
+
+If you use the simplest memory manager back end (jmemnobs.c), then no
+temporary files are used; virtual arrays are simply malloc()'d.  Images bigger
+than memory can be processed only if your system supports virtual memory.
+The other memory manager back ends support temporary files of various flavors
+and thus work in machines without virtual memory.  They may also be useful on
+Unix machines if you need to process images that exceed available swap space.
+
+When using temporary files, the library will make the in-memory buffers for
+its virtual arrays just big enough to stay within a "maximum memory" setting.
+Your application can set this limit by setting cinfo->mem->max_memory_to_use
+after creating the JPEG object.  (Of course, there is still a minimum size for
+the buffers, so the max-memory setting is effective only if it is bigger than
+the minimum space needed.)  If you allocate any large structures yourself, you
+must allocate them before jpeg_start_compress() or jpeg_start_decompress() in
+order to have them counted against the max memory limit.  Also keep in mind
+that space allocated with alloc_small() is ignored, on the assumption that
+it's too small to be worth worrying about; so a reasonable safety margin
+should be left when setting max_memory_to_use.
+
+If you use the jmemname.c or jmemdos.c memory manager back end, it is
+important to clean up the JPEG object properly to ensure that the temporary
+files get deleted.  (This is especially crucial with jmemdos.c, where the
+"temporary files" may be extended-memory segments; if they are not freed,
+DOS will require a reboot to recover the memory.)  Thus, with these memory
+managers, it's a good idea to provide a signal handler that will trap any
+early exit from your program.  The handler should call either jpeg_abort()
+or jpeg_destroy() for any active JPEG objects.  A handler is not needed with
+jmemnobs.c, and shouldn't be necessary with jmemansi.c or jmemmac.c either,
+since the C library is supposed to take care of deleting files made with
+tmpfile().
+
+
+Memory usage
+------------
+
+Working memory requirements while performing compression or decompression
+depend on image dimensions, image characteristics (such as colorspace and
+JPEG process), and operating mode (application-selected options).
+
+As of v6b, the decompressor requires:
+ 1. About 24K in more-or-less-fixed-size data.  This varies a bit depending
+    on operating mode and image characteristics (particularly color vs.
+    grayscale), but it doesn't depend on image dimensions.
+ 2. Strip buffers (of size proportional to the image width) for IDCT and
+    upsampling results.  The worst case for commonly used sampling factors
+    is about 34 bytes * width in pixels for a color image.  A grayscale image
+    only needs about 8 bytes per pixel column.
+ 3. A full-image DCT coefficient buffer is needed to decode a multi-scan JPEG
+    file (including progressive JPEGs), or whenever you select buffered-image
+    mode.  This takes 2 bytes/coefficient.  At typical 2x2 sampling, that's
+    3 bytes per pixel for a color image.  Worst case (1x1 sampling) requires
+    6 bytes/pixel.  For grayscale, figure 2 bytes/pixel.
+ 4. To perform 2-pass color quantization, the decompressor also needs a
+    128K color lookup table and a full-image pixel buffer (3 bytes/pixel).
+This does not count any memory allocated by the application, such as a
+buffer to hold the final output image.
+
+The above figures are valid for 8-bit JPEG data precision and a machine with
+32-bit ints.  For 12-bit JPEG data, double the size of the strip buffers and
+quantization pixel buffer.  The "fixed-size" data will be somewhat smaller
+with 16-bit ints, larger with 64-bit ints.  Also, CMYK or other unusual
+color spaces will require different amounts of space.
+
+The full-image coefficient and pixel buffers, if needed at all, do not
+have to be fully RAM resident; you can have the library use temporary
+files instead when the total memory usage would exceed a limit you set.
+(But if your OS supports virtual memory, it's probably better to just use
+jmemnobs and let the OS do the swapping.)
+
+The compressor's memory requirements are similar, except that it has no need
+for color quantization.  Also, it needs a full-image DCT coefficient buffer
+if Huffman-table optimization is asked for, even if progressive mode is not
+requested.
+
+If you need more detailed information about memory usage in a particular
+situation, you can enable the MEM_STATS code in jmemmgr.c.
+
+
+Library compile-time options
+----------------------------
+
+A number of compile-time options are available by modifying jmorecfg.h.
+
+The JPEG standard provides for both the baseline 8-bit DCT process and
+a 12-bit DCT process.  The IJG code supports 12-bit lossy JPEG if you define
+BITS_IN_JSAMPLE as 12 rather than 8.  Note that this causes JSAMPLE to be
+larger than a char, so it affects the surrounding application's image data.
+The sample applications cjpeg and djpeg can support 12-bit mode only for PPM
+and GIF file formats; you must disable the other file formats to compile a
+12-bit cjpeg or djpeg.  (install.doc has more information about that.)
+At present, a 12-bit library can handle *only* 12-bit images, not both
+precisions.  (If you need to include both 8- and 12-bit libraries in a single
+application, you could probably do it by defining NEED_SHORT_EXTERNAL_NAMES
+for just one of the copies.  You'd have to access the 8-bit and 12-bit copies
+from separate application source files.  This is untested ... if you try it,
+we'd like to hear whether it works!)
+
+Note that a 12-bit library always compresses in Huffman optimization mode,
+in order to generate valid Huffman tables.  This is necessary because our
+default Huffman tables only cover 8-bit data.  If you need to output 12-bit
+files in one pass, you'll have to supply suitable default Huffman tables.
+You may also want to supply your own DCT quantization tables; the existing
+quality-scaling code has been developed for 8-bit use, and probably doesn't
+generate especially good tables for 12-bit.
+
+The maximum number of components (color channels) in the image is determined
+by MAX_COMPONENTS.  The JPEG standard allows up to 255 components, but we
+expect that few applications will need more than four or so.
+
+On machines with unusual data type sizes, you may be able to improve
+performance or reduce memory space by tweaking the various typedefs in
+jmorecfg.h.  In particular, on some RISC CPUs, access to arrays of "short"s
+is quite slow; consider trading memory for speed by making JCOEF, INT16, and
+UINT16 be "int" or "unsigned int".  UINT8 is also a candidate to become int.
+You probably don't want to make JSAMPLE be int unless you have lots of memory
+to burn.
+
+You can reduce the size of the library by compiling out various optional
+functions.  To do this, undefine xxx_SUPPORTED symbols as necessary.
+
+You can also save a few K by not having text error messages in the library;
+the standard error message table occupies about 5Kb.  This is particularly
+reasonable for embedded applications where there's no good way to display 
+a message anyway.  To do this, remove the creation of the message table
+(jpeg_std_message_table[]) from jerror.c, and alter format_message to do
+something reasonable without it.  You could output the numeric value of the
+message code number, for example.  If you do this, you can also save a couple
+more K by modifying the TRACEMSn() macros in jerror.h to expand to nothing;
+you don't need trace capability anyway, right?
+
+
+Portability considerations
+--------------------------
+
+The JPEG library has been written to be extremely portable; the sample
+applications cjpeg and djpeg are slightly less so.  This section summarizes
+the design goals in this area.  (If you encounter any bugs that cause the
+library to be less portable than is claimed here, we'd appreciate hearing
+about them.)
+
+The code works fine on ANSI C, C++, and pre-ANSI C compilers, using any of
+the popular system include file setups, and some not-so-popular ones too.
+See install.doc for configuration procedures.
+
+The code is not dependent on the exact sizes of the C data types.  As
+distributed, we make the assumptions that
+	char	is at least 8 bits wide
+	short	is at least 16 bits wide
+	int	is at least 16 bits wide
+	long	is at least 32 bits wide
+(These are the minimum requirements of the ANSI C standard.)  Wider types will
+work fine, although memory may be used inefficiently if char is much larger
+than 8 bits or short is much bigger than 16 bits.  The code should work
+equally well with 16- or 32-bit ints.
+
+In a system where these assumptions are not met, you may be able to make the
+code work by modifying the typedefs in jmorecfg.h.  However, you will probably
+have difficulty if int is less than 16 bits wide, since references to plain
+int abound in the code.
+
+char can be either signed or unsigned, although the code runs faster if an
+unsigned char type is available.  If char is wider than 8 bits, you will need
+to redefine JOCTET and/or provide custom data source/destination managers so
+that JOCTET represents exactly 8 bits of data on external storage.
+
+The JPEG library proper does not assume ASCII representation of characters.
+But some of the image file I/O modules in cjpeg/djpeg do have ASCII
+dependencies in file-header manipulation; so does cjpeg's select_file_type()
+routine.
+
+The JPEG library does not rely heavily on the C library.  In particular, C
+stdio is used only by the data source/destination modules and the error
+handler, all of which are application-replaceable.  (cjpeg/djpeg are more
+heavily dependent on stdio.)  malloc and free are called only from the memory
+manager "back end" module, so you can use a different memory allocator by
+replacing that one file.
+
+The code generally assumes that C names must be unique in the first 15
+characters.  However, global function names can be made unique in the
+first 6 characters by defining NEED_SHORT_EXTERNAL_NAMES.
+
+More info about porting the code may be gleaned by reading jconfig.doc,
+jmorecfg.h, and jinclude.h.
+
+
+Notes for MS-DOS implementors
+-----------------------------
+
+The IJG code is designed to work efficiently in 80x86 "small" or "medium"
+memory models (i.e., data pointers are 16 bits unless explicitly declared
+"far"; code pointers can be either size).  You may be able to use small
+model to compile cjpeg or djpeg by itself, but you will probably have to use
+medium model for any larger application.  This won't make much difference in
+performance.  You *will* take a noticeable performance hit if you use a
+large-data memory model (perhaps 10%-25%), and you should avoid "huge" model
+if at all possible.
+
+The JPEG library typically needs 2Kb-3Kb of stack space.  It will also
+malloc about 20K-30K of near heap space while executing (and lots of far
+heap, but that doesn't count in this calculation).  This figure will vary
+depending on selected operating mode, and to a lesser extent on image size.
+There is also about 5Kb-6Kb of constant data which will be allocated in the
+near data segment (about 4Kb of this is the error message table).
+Thus you have perhaps 20K available for other modules' static data and near
+heap space before you need to go to a larger memory model.  The C library's
+static data will account for several K of this, but that still leaves a good
+deal for your needs.  (If you are tight on space, you could reduce the sizes
+of the I/O buffers allocated by jdatasrc.c and jdatadst.c, say from 4K to
+1K.  Another possibility is to move the error message table to far memory;
+this should be doable with only localized hacking on jerror.c.)
+
+About 2K of the near heap space is "permanent" memory that will not be
+released until you destroy the JPEG object.  This is only an issue if you
+save a JPEG object between compression or decompression operations.
+
+Far data space may also be a tight resource when you are dealing with large
+images.  The most memory-intensive case is decompression with two-pass color
+quantization, or single-pass quantization to an externally supplied color
+map.  This requires a 128Kb color lookup table plus strip buffers amounting
+to about 40 bytes per column for typical sampling ratios (eg, about 25600
+bytes for a 640-pixel-wide image).  You may not be able to process wide
+images if you have large data structures of your own.
+
+Of course, all of these concerns vanish if you use a 32-bit flat-memory-model
+compiler, such as DJGPP or Watcom C.  We highly recommend flat model if you
+can use it; the JPEG library is significantly faster in flat model.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/ltconfig
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/ltconfig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/ltconfig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1512 @@
+#! /bin/sh
+
+# ltconfig - Create a system-specific libtool.
+# Copyright (C) 1996-1998 Free Software Foundation, Inc.
+# Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
+#
+# 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., 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.
+
+# A lot of this script is taken from autoconf-2.10.
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi
+
+echo=echo
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then :
+else
+  # The Solaris and AIX default echo program unquotes backslashes.
+  # This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  # So, we emulate echo with printf '%s\n'
+  echo="printf %s\\n"
+  if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then :
+  else
+    # Oops.  We have no working printf.  Try to find a not-so-buggy echo.
+    echo=echo
+    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
+    for dir in $PATH /usr/ucb; do
+      if test -f $dir/echo && test "X`$dir/echo '\t'`" = 'X\t'; then
+        echo="$dir/echo"
+        break
+      fi
+    done
+    IFS="$save_ifs"
+  fi
+fi
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# The name of this program.
+progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
+
+# Constants:
+PROGRAM=ltconfig
+PACKAGE=libtool
+VERSION=1.2
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5'
+rm="rm -f"
+
+help="Try \`$progname --help' for more information."
+
+# Global variables:
+can_build_shared=yes
+enable_shared=yes
+# All known linkers require a `.a' archive for static linking.
+enable_static=yes
+ltmain=
+silent=
+srcdir=
+ac_config_guess=
+ac_config_sub=
+host=
+nonopt=
+verify_host=yes
+with_gcc=no
+with_gnu_ld=no
+
+old_AR="$AR"
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+old_CPPFLAGS="$CPPFLAGS"
+old_LD="$LD"
+old_LN_S="$LN_S"
+old_NM="$NM"
+old_RANLIB="$RANLIB"
+
+# Parse the command line options.
+args=
+prev=
+for option
+do
+  case "$option" in
+  -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    eval "$prev=\$option"
+    prev=
+    continue
+  fi
+
+  case "$option" in
+  --help) cat <<EOM
+Usage: $progname [OPTION]... LTMAIN [HOST]
+
+Generate a system-specific libtool script.
+
+    --disable-shared       do not build shared libraries
+    --disable-static       do not build static libraries
+    --help                 display this help and exit
+    --no-verify            do not verify that HOST is a valid host type
+    --quiet                same as \`--silent'
+    --silent               do not print informational messages
+    --srcdir=DIR           find \`config.guess' in DIR
+    --version              output version information and exit
+    --with-gcc             assume that the GNU C compiler will be used
+    --with-gnu-ld          assume that the C compiler uses the GNU linker
+
+LTMAIN is the \`ltmain.sh' shell script fragment that provides basic libtool
+functionality.
+
+HOST is the canonical host system name [default=guessed].
+EOM
+  exit 0
+  ;;
+
+  --disable-shared) enable_shared=no ;;
+
+  --disable-static) enable_static=no ;;
+
+  --quiet | --silent) silent=yes ;;
+
+  --srcdir) prev=srcdir ;;
+  --srcdir=*) srcdir="$optarg" ;;
+
+  --no-verify) verify_host=no ;;
+
+  --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;;
+
+  --with-gcc) with_gcc=yes ;;
+  --with-gnu-ld) with_gnu_ld=yes ;;
+
+  -*)
+    echo "$progname: unrecognized option \`$option'" 1>&2
+    echo "$help" 1>&2
+    exit 1
+    ;;
+
+  *)
+    if test -z "$ltmain"; then
+      ltmain="$option"
+    elif test -z "$host"; then
+# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
+#      if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
+#        echo "$progname: warning \`$option' is not a valid host type" 1>&2
+#      fi
+      host="$option"
+    else
+      echo "$progname: too many arguments" 1>&2
+      echo "$help" 1>&2
+      exit 1
+    fi ;;
+  esac
+done
+
+if test -z "$ltmain"; then
+  echo "$progname: you must specify a LTMAIN file" 1>&2
+  echo "$help" 1>&2
+  exit 1
+fi
+
+if test -f "$ltmain"; then :
+else
+  echo "$progname: \`$ltmain' does not exist" 1>&2
+  echo "$help" 1>&2
+  exit 1
+fi
+
+# Quote any args containing shell metacharacters.
+ltconfig_args=
+for arg
+do
+  case "$arg" in
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ltconfig_args="$ltconfig_args '$arg'" ;;
+  *) ltconfig_args="$ltconfig_args $arg" ;;
+  esac
+done
+
+# A relevant subset of AC_INIT.
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 5 compiler messages saved in config.log
+# 6 checking for... messages and results
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>>./config.log
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi at caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='	'
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+if test -z "$srcdir"; then
+  # Assume the source directory is the same one as the path to ltmain.sh.
+  srcdir=`$echo "$ltmain" | $Xsed -e 's%/[^/]*$%%'`
+  test "$srcdir" = "$ltmain" && srcdir=.
+fi
+
+trap "$rm conftest*; exit 1" 1 2 15
+if test "$verify_host" = yes; then
+  # Check for config.guess and config.sub.
+  ac_aux_dir=
+  for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+    if test -f $ac_dir/config.guess; then
+      ac_aux_dir=$ac_dir
+      break
+    fi
+  done
+  if test -z "$ac_aux_dir"; then
+    echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
+    echo "$help" 1>&2
+    exit 1
+  fi
+  ac_config_guess=$ac_aux_dir/config.guess
+  ac_config_sub=$ac_aux_dir/config.sub
+
+  # Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+  else
+    echo "$progname: cannot run $ac_config_sub" 1>&2
+    echo "$help" 1>&2
+    exit 1
+  fi
+
+  echo $ac_n "checking host system type""... $ac_c" 1>&6
+
+  host_alias=$host
+  case "$host_alias" in
+  "")
+    if host_alias=`$ac_config_guess`; then :
+    else
+      echo "$progname: cannot guess host type; you must specify one" 1>&2
+      echo "$help" 1>&2
+      exit 1
+    fi ;;
+  esac
+  host=`$ac_config_sub $host_alias`
+  echo "$ac_t$host" 1>&6
+
+  # Make sure the host verified.
+  test -z "$host" && exit 1
+
+elif test -z "$host"; then
+  echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
+  echo "$help" 1>&2
+  exit 1
+else
+  host_alias=$host
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case "$host_os" in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+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 "${COLLECT_NAMES+set}" != set; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR cru $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+# Set a sane default for `AR'.
+test -z "$AR" && AR=ar
+
+# If RANLIB is not set, then run the test.
+if test "${RANLIB+set}" != "set"; then
+  result=no
+
+  echo $ac_n "checking for ranlib... $ac_c" 1>&6
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/ranlib; then
+      RANLIB="ranlib"
+      result="ranlib"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  echo "$ac_t$result" 1>&6
+fi
+
+if test -n "$RANLIB"; then
+  old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib"
+  old_postinstall_cmds="\$RANLIB \$oldlib;$old_postinstall_cmds"
+fi
+
+# Check to see if we are using GCC.
+if test "$with_gcc" != yes || test -z "$CC"; then
+  # If CC is not set, then try to find GCC or a usable CC.
+  if test -z "$CC"; then
+    echo $ac_n "checking for gcc... $ac_c" 1>&6
+    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
+    for dir in $PATH; do
+      IFS="$save_ifs"
+      test -z "$dir" && dir=.
+      if test -f $dir/gcc; then
+	CC="gcc"
+	break
+      fi
+    done
+    IFS="$save_ifs"
+
+    if test -n "$CC"; then
+      echo "$ac_t$CC" 1>&6
+    else
+      echo "$ac_t"no 1>&6
+    fi
+  fi
+
+  # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
+  if test -z "$CC"; then
+    echo $ac_n "checking for cc... $ac_c" 1>&6
+    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
+    cc_rejected=no
+    for dir in $PATH; do
+      test -z "$dir" && dir=.
+      if test -f $dir/cc; then
+	if test "$dir/cc" = "/usr/ucb/cc"; then
+	  cc_rejected=yes
+	  continue
+	fi
+	CC="cc"
+	break
+      fi
+    done
+    IFS="$save_ifs"
+    if test $cc_rejected = yes; then
+      # We found a bogon in the path, so make sure we never use it.
+      set dummy $CC
+      shift
+      if test $# -gt 0; then
+	# We chose a different compiler from the bogus one.
+	# However, it has the same name, so the bogon will be chosen
+	# first if we set CC to just the name; use the full file name.
+	shift
+	set dummy "$dir/cc" "$@"
+	shift
+	CC="$@"
+      fi
+    fi
+
+    if test -n "$CC"; then
+      echo "$ac_t$CC" 1>&6
+    else
+      echo "$ac_t"no 1>&6
+    fi
+
+    if test -z "$CC"; then
+      echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
+      exit 1
+    fi
+  fi
+
+  # Now see if the compiler is really GCC.
+  with_gcc=no
+  echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
+  echo "$progname:424: checking whether we are using GNU C" >&5
+
+  $rm conftest.c
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+    with_gcc=yes
+  fi
+  $rm conftest.c
+  echo "$ac_t$with_gcc" 1>&6
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
+pic_flag=
+special_shlib_compile_flags=
+wl=
+link_static_flag=
+no_builtin_flag=
+
+if test "$with_gcc" = yes; then
+  wl='-Wl,'
+  link_static_flag='-static'
+  no_builtin_flag=' -fno-builtin'
+
+  case "$host_os" in
+  aix3* | aix4* | irix5* | irix6* | osf3* | osf4*)
+    # PIC is the default for these OSes.
+    ;;
+  os2*)
+    # We can build DLLs from non-PIC.
+    ;;
+  amigaos*)
+    # FIXME: we need at least 68020 code to build shared libraries, but
+    # adding the `-m68020' flag to GCC prevents building anything better,
+    # like `-m68040'.
+    pic_flag='-m68020 -resident32 -malways-restore-a4'
+    ;;
+  *)
+    pic_flag='-fPIC'
+    ;;
+  esac
+else
+  # PORTME Check for PIC flags for the system compiler.
+  case "$host_os" in
+  aix3* | aix4*)
+    # All AIX code is PIC.
+    link_static_flag='-bnso -bI:/lib/syscalls.exp'
+    ;;
+
+  hpux9* | hpux10*)
+    # Is there a better link_static_flag that works with the bundled CC?
+    wl='-Wl,'
+    link_static_flag="${wl}-a ${wl}archive"
+    pic_flag='+Z'
+    ;;
+
+  irix5* | irix6*)
+    wl='-Wl,'
+    link_static_flag='-non_shared'
+    # PIC (with -KPIC) is the default.
+    ;;
+
+  os2*)
+    # We can build DLLs from non-PIC.
+    ;;
+
+  osf3* | osf4*)
+    # All OSF/1 code is PIC.
+    wl='-Wl,'
+    link_static_flag='-non_shared'
+    ;;
+
+  sco3.2v5*)
+    pic_flag='-Kpic'
+    link_static_flag='-dn'
+    special_shlib_compile_flags='-belf'
+    ;;
+
+  solaris2*)
+    pic_flag='-KPIC'
+    link_static_flag='-Bstatic'
+    wl='-Wl,'
+    ;;
+
+  sunos4*)
+    pic_flag='-PIC'
+    link_static_flag='-Bstatic'
+    wl='-Qoption ld '
+    ;;
+
+  sysv4.2uw2*)
+    pic_flag='-KPIC'
+    link_static_flag='-Bstatic'
+    wl='-Wl,'
+    ;;
+
+  uts4*)
+    pic_flag='-pic'
+    link_static_flag='-Bstatic'
+    ;;
+
+  *)
+    can_build_shared=no
+    ;;
+  esac
+fi
+
+if test -n "$pic_flag"; then
+  echo "$ac_t$pic_flag" 1>&6
+
+  # Check to make sure the pic_flag actually works.
+  echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
+  $rm conftest*
+  echo > conftest.c
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS $pic_flag -DPIC"
+  echo "$progname:547: checking if $compiler PIC flag $pic_flag works" >&5
+  if { (eval echo $progname:548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
+    # Append any warnings to the config.log.
+    cat conftest.err 1>&5
+
+    # On HP-UX, both CC and GCC only warn that PIC is supported... then they
+    # create non-PIC objects.  So, if there were any warnings, we assume that
+    # PIC is not supported.
+    if test -s conftest.err; then
+      echo "$ac_t"no 1>&6
+      can_build_shared=no
+      pic_flag=
+    else
+      echo "$ac_t"yes 1>&6
+      pic_flag=" $pic_flag"
+    fi
+  else
+    # Append any errors to the config.log.
+    cat conftest.err 1>&5
+    can_build_shared=no
+    pic_flag=
+    echo "$ac_t"no 1>&6
+  fi
+  CFLAGS="$save_CFLAGS"
+  $rm conftest*
+else
+  echo "$ac_t"none 1>&6
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$special_shlib_compile_flags"; then
+  echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$special_shlib_compile_flags[ 	]" >/dev/null; then :
+  else
+    echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
+    can_build_shared=no
+  fi
+fi
+
+echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
+$rm conftest*
+echo 'main(){return(0);}' > conftest.c
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $link_static_flag"
+echo "$progname:591: checking if $compiler static flag $link_static_flag works" >&5
+if { (eval echo $progname:592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  echo "$ac_t$link_static_flag" 1>&6
+else
+  echo "$ac_t"none 1>&6
+  link_static_flag=
+fi
+LDFLAGS="$save_LDFLAGS"
+$rm conftest*
+
+if test -z "$LN_S"; then
+  # Check to see if we can use ln -s, or we need hard links.
+  echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
+  $rm conftestdata
+  if ln -s X conftestdata 2>/dev/null; then
+    $rm conftestdata
+    LN_S="ln -s"
+  else
+    LN_S=ln
+  fi
+  if test "$LN_S" = "ln -s"; then
+    echo "$ac_t"yes 1>&6
+  else
+    echo "$ac_t"no 1>&6
+  fi
+fi
+
+# Make sure LD is an absolute path.
+if test -z "$LD"; then
+  ac_prog=ld
+  if test "$with_gcc" = yes; then
+    # Check if gcc -print-prog-name=ld gives a path.
+    echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
+    echo "$progname:624: checking for ld used by GCC" >&5
+    ac_prog=`($CC -print-prog-name=ld) 2>&5`
+    case "$ac_prog" in
+    # Accept absolute paths.
+    /* | [A-Za-z]:\\*)
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+    "")
+      # If it fails, then pretend we are not 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
+    echo $ac_n "checking for GNU ld... $ac_c" 1>&6
+    echo "$progname:642: checking for GNU ld" >&5
+  else
+    echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+    echo "$progname:645: checking for non-GNU ld" >&5
+  fi
+
+  if test -z "$LD"; then
+    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+    for ac_dir in $PATH; do
+      test -z "$ac_dir" && ac_dir=.
+      if test -f "$ac_dir/$ac_prog"; then
+	LD="$ac_dir/$ac_prog"
+	# Check to see if the program is GNU ld.  I'd rather use --version,
+	# but apparently some GNU ld's only accept -v.
+	# Break only if it was the GNU/non-GNU ld that we prefer.
+	if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+	  test "$with_gnu_ld" != no && break
+	else
+	  test "$with_gnu_ld" != yes && break
+	fi
+      fi
+    done
+    IFS="$ac_save_ifs"
+  fi
+
+  if test -n "$LD"; then
+    echo "$ac_t$LD" 1>&6
+  else
+    echo "$ac_t"no 1>&6
+  fi
+
+  if test -z "$LD"; then
+    echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
+    exit 1
+  fi
+fi
+
+# Check to see if it really is or is not GNU ld.
+echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
+# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+echo "$ac_t$with_gnu_ld" 1>&6
+
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
+
+allow_undefined_flag=
+no_undefined_flag=
+archive_cmds=
+old_archive_from_new_cmds=
+export_dynamic_flag_spec=
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+
+case "$host_os" in
+amigaos* | sunos4*)
+  # On these operating systems, we should treat GNU ld like the system ld.
+  gnu_ld_acts_native=yes
+  ;;
+*)
+  gnu_ld_acts_native=no
+  ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes && test "$gnu_ld_acts_native" != yes; then
+
+  # See if GNU ld supports shared libraries.
+  if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+    archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs'
+    runpath_var=LD_RUN_PATH
+    ld_shlibs=yes
+  else
+    ld_shlibs=no
+  fi
+
+  if test "$ld_shlibs" = yes; then
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case "$host_os" in
+  aix3*)
+    allow_undefined_flag=unsupported
+    archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE;$AR cru $lib $objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$with_gcc" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4*)
+    allow_undefined_flag=unsupported
+    archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry;$AR cru $lib $objdir/$soname'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $objdir/a2ixlibrary.data;$echo "#define NAME $libname" > $objdir/a2ixlibrary.data;$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data;$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data;$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data;$AR cru $lib$libobjs;$RANLIB $lib;(cd $objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    ;;
+
+  # 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 /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib$libobjs'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3, at last, uses gcc -shared to do shared libraries.
+  freebsd3*)
+    archive_cmds='$CC -shared -o $lib$libobjs'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9*)
+    archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs;mv $objdir/$soname $lib'
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  hpux10*)
+    archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs'
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6*)
+    archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs'
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    ;;
+
+  netbsd*)
+    # Tested with NetBSD 1.2 ld
+    archive_cmds='$LD -Bshareable -o $lib$libobjs'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    archive_cmds='$LD -Bshareable -o $lib$libobjs'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;$echo DATA >> $objdir/$libname.def;$echo " SINGLE NONSHARED" >> $objdir/$libname.def;$echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
+    ;;
+
+  osf3* | osf4*)
+    allow_undefined_flag=' -expect_unresolved \*'
+    archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs$deplibs'
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -o $lib$libobjs'
+    hardcode_direct=yes
+    ;;
+
+  solaris2*)
+    no_undefined_flag=' -z text'
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib$libobjs'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+
+    # Solaris 2 before 2.5 hardcodes -L paths.
+    case "$host_os" in
+    solaris2.[0-4]*)
+      hardcode_minus_L=yes
+      ;;
+    esac
+    ;;
+
+  sunos4*)
+    if test "$with_gcc" = yes; then
+      archive_cmds='$CC -shared -o $lib$libobjs'
+    else
+      archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
+    fi
+
+    if test "$with_gnu_ld" = yes; then
+      export_dynamic_flag_spec='${wl}-export-dynamic'
+    fi
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib$libobjs'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=no
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    can_build_shared=no
+    ;;
+  esac
+fi
+echo "$ac_t$ld_shlibs" 1>&6
+
+if test -z "$NM"; then
+  echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
+  case "$NM" in
+  /* | [A-Za-z]:\\*) ;; # Let the user override the test with a path.
+  *)
+    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+    for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
+      test -z "$ac_dir" && ac_dir=.
+      if test -f $ac_dir/nm; 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
+        if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+          NM="$ac_dir/nm -B"
+        elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+          NM="$ac_dir/nm -p"
+	else
+          NM="$ac_dir/nm"
+	fi
+        break
+      fi
+    done
+    IFS="$ac_save_ifs"
+    test -z "$NM" && NM=nm
+    ;;
+  esac
+  echo "$ac_t$NM" 1>&6
+fi
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
+
+# 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='[BCDEGRSTU]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \1'
+
+# Define system-specific variables.
+case "$host_os" in
+aix*)
+  symcode='[BCDTU]'
+  ;;
+irix*)
+  # Cannot use undefined symbols on IRIX because inlined functions mess us up.
+  symcode='[BCDEGRST]'
+  ;;
+solaris2*)
+  symcode='[BDTU]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[ABCDGISTUW]'
+fi
+
+# Write the raw and C identifiers.
+global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'"
+
+# Check to see that the pipe works correctly.
+pipe_works=no
+$rm conftest*
+cat > conftest.c <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+echo "$progname:971: checking if global_symbol_pipe works" >&5
+if { (eval echo $progname:972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then
+  # Now try to grab the symbols.
+  nlist=conftest.nm
+  if { echo "$progname:975: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
+
+    # Try sorting and uniquifying the output.
+    if sort "$nlist" | uniq > "$nlist"T; then
+      mv -f "$nlist"T "$nlist"
+      wcout=`wc "$nlist" 2>/dev/null`
+      count=`$echo "X$wcout" | $Xsed -e 's/^[ 	]*\([0-9][0-9]*\).*$/\1/'`
+      (test "$count" -ge 0) 2>/dev/null || count=-1
+    else
+      rm -f "$nlist"T
+      count=-1
+    fi
+
+    # Make sure that we snagged all the symbols we need.
+    if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+      if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	cat <<EOF > conftest.c
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+        # Now generate the symbol file.
+        sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c
+
+	cat <<EOF >> conftest.c
+#if defined (__STDC__) && __STDC__
+# define __ptr_t void *
+#else
+# define __ptr_t char *
+#endif
+
+/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
+int dld_preloaded_symbol_count = $count;
+
+/* The mapping between symbol names and symbols. */
+struct {
+  char *name;
+  __ptr_t address;
+}
+dld_preloaded_symbols[] =
+{
+EOF
+        sed 's/^\(.*\) \(.*\)$/  {"\1", (__ptr_t) \&\2},/' < "$nlist" >> conftest.c
+        cat <<\EOF >> conftest.c
+  {0, (__ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+        # Now try linking the two files.
+        mv conftest.o conftestm.o
+	save_LIBS="$LIBS"
+	save_CFLAGS="$CFLAGS"
+        LIBS='conftestm.o'
+	CFLAGS="$CFLAGS$no_builtin_flag"
+        if { (eval echo $progname:1033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+          pipe_works=yes
+        else
+          echo "$progname: failed program was:" >&5
+          cat conftest.c >&5
+        fi
+        LIBS="$save_LIBS"
+      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 $global_symbol_pipe" >&5
+  fi
+else
+  echo "$progname: failed program was:" >&5
+  cat conftest.c >&5
+fi
+$rm conftest*
+
+# Do not use the global_symbol_pipe unless it works.
+echo "$ac_t$pipe_works" 1>&6
+test "$pipe_works" = yes || global_symbol_pipe=
+
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var"; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no && \
+     test "$hardcode_minus_L" != no && \
+     test "$hardcode_shlibpath_var" != 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
+elif test "$hardcode_direct" != yes && \
+     test "$hardcode_minus_L" != yes && \
+     test "$hardcode_shlibpath_var" != yes; then
+  # We cannot hardcode anything.
+  hardcode_action=unsupported
+else
+  # We can only hardcode existing directories.
+  hardcode_action=relink
+fi
+echo "$ac_t$hardcode_action" 1>&6
+test "$hardcode_action" = unsupported && can_build_shared=no
+
+
+reload_flag=
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
+# PORTME Some linker may need a different reload flag.
+reload_flag='-r'
+echo "$ac_t$reload_flag"
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+# PORTME Fill in your ld.so characteristics
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+version_type=none
+dynamic_linker="$host_os ld.so"
+
+echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
+case "$host_os" in
+aix3* | aix4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so.$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}.so.$major'
+  ;;
+
+amigaos*)
+  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=`$echo "X$lib" | $Xsed -e '\''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'
+  ;;
+
+freebsd2* | freebsd3*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so.$versuffix $libname.so'
+  finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+gnu*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so.$versuffix'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+hpux9* | hpux10*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  dynamic_linker="$host_os dld.sl"
+  version_type=sunos
+  shlibpath_var=SHLIB_PATH
+  library_names_spec='${libname}${release}.sl.$versuffix ${libname}${release}.sl.$major $libname.sl'
+  soname_spec='${libname}${release}.sl.$major'
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6*)
+  version_type=osf
+  soname_spec='${libname}${release}.so'
+  library_names_spec='${libname}${release}.so.$versuffix $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
+  soname_spec='${libname}${release}.so.$major'
+  finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+
+  if test -f /lib/ld.so.1; then
+    dynamic_linker='GNU ld.so'
+  else
+    # Only the GNU ld.so supports shared libraries on MkLinux.
+    case "$host_cpu" in
+    powerpc*) dynamic_linker=no ;;
+    *) dynamic_linker='Linux ld.so' ;;
+    esac
+  fi
+  ;;
+
+netbsd* | openbsd*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so.$versuffix'
+  finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+os2*)
+  libname_spec='$name'
+  library_names_spec='$libname.dll $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4*)
+  version_type=osf
+  soname_spec='${libname}${release}.so'
+  library_names_spec='${libname}${release}.so.$versuffix $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}.so.$major'
+  library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris2*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
+  soname_spec='${libname}${release}.so.$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so.$versuffix'
+  finish_cmds='PATH="$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sysv4.2uw2*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
+  soname_spec='${libname}${release}.so.$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
+  soname_spec='${libname}${release}.so.$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$ac_t$dynamic_linker"
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
+
+echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&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
+aix*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds;\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+esac
+
+echo "$ac_t$enable_shared" 1>&6
+
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+
+echo "checking whether to build static libraries... $enable_static" 1>&6
+
+echo $ac_n "checking for objdir... $ac_c" 1>&6
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t$objdir" 1>&6
+
+# Copy echo and quote the copy, instead of the original, because it is
+# used later.
+ltecho="$echo"
+
+# Now quote all the things that may contain metacharacters.
+for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
+  old_LN_S AR CC LD LN_S NM reload_flag reload_cmds wl pic_flag \
+  link_static_flag no_builtin_flag export_dynamic_flag_spec \
+  libname_spec library_names_spec soname_spec RANLIB \
+  old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+  old_postuninstall_cmds archive_cmds postinstall_cmds postuninstall_cmds \
+  allow_undefined_flag no_undefined_flag \
+  finish_cmds finish_eval global_symbol_pipe \
+  hardcode_libdir_flag_spec hardcode_libdir_separator; do
+
+  case "$var" in
+  reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+  old_postinstall_cmds | old_postuninstall_cmds | archive_cmds | \
+  postinstall_cmds | postuninstall_cmds | finish_cmds)
+    # Double-quote double-evaled strings.
+    eval "$var=\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`"
+    ;;
+  *)
+    eval "$var=\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`"
+    ;;
+  esac
+done
+
+ofile=libtool
+trap "$rm $ofile; exit 1" 1 2 15
+echo creating $ofile
+$rm $ofile
+cat <<EOF > $ofile
+#! /bin/sh
+
+# libtool - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION
+# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
+#
+# Copyright (C) 1996-1998 Free Software Foundation, Inc.
+# Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 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 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., 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.
+
+# This program was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\
+# LD="$old_LD" NM="$old_NM" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
+#   $0$ltconfig_args
+#
+# Compiler and other test output produced by $progname, useful for
+# debugging $progname, is in ./config.log if it exists.
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="sed -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi
+
+# An echo program that does not interpret backslashes.
+echo="$ltecho"
+
+# The version of $progname that generated this script.
+LTCONFIG_VERSION="$VERSION"
+
+# Shell to use when invoking shell scripts.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Whether or not to build libtool libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build old-style libraries.
+build_old_libs=$enable_static
+
+# The host system.
+host_alias="$host_alias"
+host="$host"
+
+# The archiver.
+AR="$AR"
+
+# The default C compiler.
+CC="$CC"
+
+# The linker used to build libraries.
+LD="$LD"
+
+# Whether we need hard or soft links.
+LN_S="$LN_S"
+
+# A BSD-compatible nm program.
+NM="$NM"
+
+# The name of the directory that contains temporary libtool files.
+objdir="$objdir"
+
+# How to create reloadable object files.
+reload_flag="$reload_flag"
+reload_cmds="$reload_cmds"
+
+# How to pass a linker flag through the compiler.
+wl="$wl"
+
+# Additional compiler flags for building library objects.
+pic_flag="$pic_flag"
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag="$link_static_flag"
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag="$no_builtin_flag"
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec="$export_dynamic_flag_spec"
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec="$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="$library_names_spec"
+
+# The coded name of the library, if different from the real name.
+soname_spec="$soname_spec"
+
+# Commands used to build and install an old-style archive.
+RANLIB="$RANLIB"
+old_archive_cmds="$old_archive_cmds"
+old_postinstall_cmds="$old_postinstall_cmds"
+old_postuninstall_cmds="$old_postuninstall_cmds"
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds="$old_archive_from_new_cmds"
+
+# Commands used to build and install a shared archive.
+archive_cmds="$archive_cmds"
+postinstall_cmds="$postinstall_cmds"
+postuninstall_cmds="$postuninstall_cmds"
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag="$allow_undefined_flag"
+
+# Flag that forces no undefined symbols.
+no_undefined_flag="$no_undefined_flag"
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds="$finish_cmds"
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval="$finish_eval"
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe="$global_symbol_pipe"
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# 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
+
+EOF
+
+case "$host_os" in
+aix3*)
+  cat <<\EOF >> $ofile
+# 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 "${COLLECT_NAMES+set}" != set; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+
+EOF
+  ;;
+esac
+
+# Append the ltmain.sh script.
+cat "$ltmain" >> $ofile || (rm -f $ofile; exit 1)
+
+chmod +x $ofile
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/ltconfig
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/ltmain.sh
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/ltmain.sh	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/ltmain.sh	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2453 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun ltconfig.
+#
+# Copyright (C) 1996-1998 Free Software Foundation, Inc.
+# Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 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 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., 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.
+
+# The name of this program.
+progname=`$echo "$0" | sed 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.2
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+
+if test "$LTCONFIG_VERSION" != "$VERSION"; then
+  echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
+  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit 1
+fi
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  echo "$modename: not configured to build any kind of library" 1>&2
+  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+  arg="$1"
+  shift
+
+  case "$arg" in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case "$prev" in
+    execute_dlfiles)
+      eval "$prev=\"\$$prev \$arg\""
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case "$arg" in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    echo "$PROGRAM (GNU $PACKAGE) $VERSION"
+    exit 0
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --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 0
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --quiet | --silent)
+    show=:
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit 1
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit 1
+fi
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    case "$nonopt" in
+    *cc | *++ | gcc* | *-gcc*)
+      mode=link
+      for arg
+      do
+        case "$arg" in
+        -c)
+           mode=compile
+           break
+           ;;
+        esac
+      done
+      ;;
+    *db | *dbx)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+        if test -n "$nonopt"; then
+          $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+        else
+          $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+        fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit 1
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case "$mode" in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    lastarg=
+    srcfile="$nonopt"
+    suppress_output=
+
+    for arg
+    do
+      # Accept any command-line options.
+      case "$arg" in
+      -o)
+	$echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
+	$echo "$help" 1>&2
+	exit 1
+	;;
+
+      -static)
+	build_libtool_libs=no
+	build_old_libs=yes
+	continue
+	;;
+      esac
+
+      # Accept the current argument as the source file.
+      lastarg="$srcfile"
+      srcfile="$arg"
+
+      # Aesthetically quote the previous argument.
+
+      # Backslashify any backslashes, double quotes, and dollar signs.
+      # These are the only characters that are still specially
+      # interpreted inside of double-quoted scrings.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly in scan
+      # sets, so we specify it separately.
+      case "$lastarg" in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	lastarg="\"$lastarg\""
+	;;
+      esac
+
+      # Add the previous argument to base_compile.
+      if test -z "$base_compile"; then
+	base_compile="$lastarg"
+      else
+	base_compile="$base_compile $lastarg"
+      fi
+    done
+
+    # Get the name of the library object.
+    libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+
+    # Recognize several different file suffixes.
+    xform='[cCFSfms]'
+    case "$libobj" in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.f90) xform=f90 ;;
+    *.for) xform=for ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case "$libobj" in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
+      exit 1
+      ;;
+    esac
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      $run $rm $obj $libobj
+      trap "$run $rm $obj $libobj; exit 1" 1 2 15
+    else
+      $run $rm $libobj
+      trap "$run $rm $libobj; exit 1" 1 2 15
+    fi
+
+    # 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
+
+      # All platforms use -DPIC, to notify preprocessed assembler code.
+      $show "$base_compile$pic_flag -DPIC $srcfile"
+      if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
+      else
+        test -n "$obj" && $run $rm $obj
+        exit 1
+      fi
+
+      # If we have no pic_flag, then copy the object into place and finish.
+      if test -z "$pic_flag"; then
+        $show "$LN_S $obj $libobj"
+        $run $LN_S $obj $libobj
+        exit $?
+      fi
+
+      # Just move the object, then go on to compile the next one
+      $show "$mv $obj $libobj"
+      $run $mv $obj $libobj || exit 1
+
+      # Allow error messages only from the first compilation.
+      suppress_output=' >/dev/null 2>&1'
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      # Suppress compiler output if we already did a PIC compilation.
+      $show "$base_compile $srcfile$suppress_output"
+      if $run eval "$base_compile \$srcfile$suppress_output"; then :
+      else
+        $run $rm $obj $libobj
+        exit 1
+      fi
+    fi
+
+    # Create an invalid libtool object if no PIC, so that we do not
+    # accidentally link it into a program.
+    if test "$build_libtool_libs" != yes; then
+      $show "echo timestamp > $libobj"
+      $run eval "echo timestamp > \$libobj" || exit $?
+    fi
+
+    exit 0
+    ;;
+
+  # libtool link mode
+  link)
+    modename="$modename: link"
+    CC="$nonopt"
+    allow_undefined=yes
+    compile_command="$CC"
+    finalize_command="$CC"
+
+    compile_shlibpath=
+    finalize_shlibpath=
+    deplibs=
+    dlfiles=
+    dlprefiles=
+    export_dynamic=no
+    hardcode_libdirs=
+    libobjs=
+    link_against_libtool_libs=
+    ltlibs=
+    objs=
+    prev=
+    prevarg=
+    release=
+    rpath=
+    perm_rpath=
+    temp_rpath=
+    vinfo=
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case "$arg" in
+      -all-static | -static)
+        if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+        fi
+        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.
+    for arg
+    do
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+        case "$prev" in
+        output)
+          compile_command="$compile_command @OUTPUT@"
+          finalize_command="$finalize_command @OUTPUT@"
+          ;;
+        esac
+
+        case "$prev" in
+        dlfiles|dlprefiles)
+          case "$arg" in
+          *.la | *.lo) ;;  # We handle these cases below.
+          *)
+            dlprefiles="$dlprefiles $arg"
+            test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
+            prev=
+            ;;
+          esac
+          ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+        rpath)
+          rpath="$rpath $arg"
+	  prev=
+	  continue
+	  ;;
+        *)
+          eval "$prev=\"\$arg\""
+          prev=
+          continue
+          ;;
+        esac
+      fi
+
+      prevarg="$arg"
+
+      case "$arg" in
+      -all-static)
+	if test -n "$link_static_flag"; then
+          compile_command="$compile_command $link_static_flag"
+	  finalize_command="$finalize_command $link_static_flag"
+        fi
+        continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+	continue
+	;;
+
+      -dlopen)
+        prev=dlfiles
+        continue
+        ;;
+
+      -dlpreopen)
+        prev=dlprefiles
+        continue
+        ;;
+
+      -export-dynamic)
+        if test "$export_dynamic" != yes; then
+          export_dynamic=yes
+	  if test -n "$export_dynamic_flag_spec"; then
+	    eval arg=\"$export_dynamic_flag_spec\"
+	  else
+	    arg=
+	  fi
+
+          # Add the symbol object into the linking commands.
+	  compile_command="$compile_command @SYMFILE@"
+	  finalize_command="$finalize_command @SYMFILE@"
+        fi
+        ;;
+
+      -L*)
+        dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
+        case "$dir" in
+        /* | [A-Za-z]:\\*)
+	  # Add the corresponding hardcode_libdir_flag, if it is not identical.
+          ;;
+        *)
+          $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
+          exit 1
+          ;;
+        esac
+        deplibs="$deplibs $arg"
+        ;;
+
+      -l*) deplibs="$deplibs $arg" ;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+        prev=rpath
+        continue
+        ;;
+
+      -static)
+	# If we have no pic_flag, then this is the same as -all-static.
+	if test -z "$pic_flag" && test -n "$link_static_flag"; then
+          compile_command="$compile_command $link_static_flag"
+	  finalize_command="$finalize_command $link_static_flag"
+        fi
+	continue
+	;;
+
+      -version-info)
+        prev=vinfo
+        continue
+        ;;
+
+      # Some other compiler flag.
+      -* | +*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case "$arg" in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	  arg="\"$arg\""
+	  ;;
+	esac
+        ;;
+
+      *.o | *.a)
+        # A standard object.
+        objs="$objs $arg"
+        ;;
+
+      *.lo)
+        # A library object.
+	if test "$prev" = dlfiles; then
+	  dlfiles="$dlfiles $arg"
+	  if test "$build_libtool_libs" = yes; then
+	    prev=
+	    continue
+	  else
+	    # If libtool objects are unsupported, then we need to preload.
+	    prev=dlprefiles
+	  fi
+	fi
+
+	if test "$prev" = dlprefiles; then
+	  # Preload the old-style object.
+	  dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'`
+	  prev=
+	fi
+	libobjs="$libobjs $arg"
+        ;;
+
+      *.la)
+        # A libtool-controlled library.
+
+        dlname=
+        libdir=
+        library_names=
+        old_library=
+
+        # Check to see that this really is a libtool archive.
+        if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
+        else
+          $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
+          exit 1
+        fi
+
+        # If there is no directory component, then add one.
+        case "$arg" in
+        */* | *\\*) . $arg ;;
+        *) . ./$arg ;;
+        esac
+
+        if test -z "$libdir"; then
+          $echo "$modename: \`$arg' contains no -rpath information" 1>&2
+          exit 1
+        fi
+
+        # Get the name of the library we link against.
+        linklib=
+        for l in $old_library $library_names; do
+          linklib="$l"
+        done
+
+        if test -z "$linklib"; then
+          $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
+          exit 1
+        fi
+
+        # Find the relevant object directory and library name.
+        name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
+        dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+        if test "X$dir" = "X$arg"; then
+          dir="$objdir"
+        else
+          dir="$dir/$objdir"
+        fi
+
+        # This library was specified with -dlopen.
+        if test "$prev" = dlfiles; then
+          dlfiles="$dlfiles $arg"
+          if test -z "$dlname"; then
+            # If there is no dlname, we need to preload.
+            prev=dlprefiles
+          else
+            # We should not create a dependency on this library, but we
+	    # may need any libraries it requires.
+	    compile_command="$compile_command$dependency_libs"
+	    finalize_command="$finalize_command$dependency_libs"
+            prev=
+            continue
+          fi
+        fi
+
+        # The library was specified with -dlpreopen.
+        if test "$prev" = dlprefiles; then
+          # Prefer using a static library (so that no silly _DYNAMIC symbols
+          # are required to link).
+          if test -n "$old_library"; then
+            dlprefiles="$dlprefiles $dir/$old_library"
+          else
+            dlprefiles="$dlprefiles $dir/$linklib"
+          fi
+          prev=
+        fi
+
+        if test "$build_libtool_libs" = yes && test -n "$library_names"; then
+          link_against_libtool_libs="$link_against_libtool_libs $arg"
+          if test -n "$shlibpath_var"; then
+            # Make sure the rpath contains only unique directories.
+            case "$temp_rpath " in
+            *" $dir "*) ;;
+            *) temp_rpath="$temp_rpath $dir" ;;
+            esac
+          fi
+
+	  # This is the magic to use -rpath.
+          if test -n "$hardcode_libdir_flag_spec"; then
+            if test -n "$hardcode_libdir_separator"; then
+              if test -z "$hardcode_libdirs"; then
+                # Put the magic libdir with the hardcode flag.
+                hardcode_libdirs="$libdir"
+                libdir="@HARDCODE_LIBDIRS@"
+              else
+                # Just accumulate the unique libdirs.
+		case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+		*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		  ;;
+		*)
+		  hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		  ;;
+		esac
+                libdir=
+              fi
+            fi
+
+            if test -n "$libdir"; then
+              eval flag=\"$hardcode_libdir_flag_spec\"
+
+              compile_command="$compile_command $flag"
+              finalize_command="$finalize_command $flag"
+            fi
+          elif test -n "$runpath_var"; then
+            # Do the same for the permanent run path.
+            case "$perm_rpath " in
+            *" $libdir "*) ;;
+            *) perm_rpath="$perm_rpath $libdir" ;;
+            esac
+          fi
+
+
+          case "$hardcode_action" in
+          immediate)
+            if test "$hardcode_direct" = no; then
+              compile_command="$compile_command $dir/$linklib"
+            elif test "$hardcode_minus_L" = no; then
+              compile_command="$compile_command -L$dir -l$name"
+            elif test "$hardcode_shlibpath_var" = no; then
+              compile_shlibpath="$compile_shlibpath$dir:"
+              compile_command="$compile_command -l$name"
+            fi
+            ;;
+
+          relink)
+            # We need an absolute path.
+            case "$dir" in
+            /* | [A-Za-z]:\\*) ;;
+            *)
+              absdir=`cd "$dir" && pwd`
+              if test -z "$absdir"; then
+                $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+                exit 1
+              fi
+              dir="$absdir"
+              ;;
+            esac
+
+            if test "$hardcode_direct" = yes; then
+              compile_command="$compile_command $dir/$linklib"
+            elif test "$hardcode_minus_L" = yes; then
+              compile_command="$compile_command -L$dir -l$name"
+            elif test "$hardcode_shlibpath_var" = yes; then
+              compile_shlibpath="$compile_shlibpath$dir:"
+              compile_command="$compile_command -l$name"
+            fi
+            ;;
+
+          *)
+            $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2
+            exit 1
+            ;;
+          esac
+
+          # Finalize command for both is simple: just hardcode it.
+          if test "$hardcode_direct" = yes; then
+            finalize_command="$finalize_command $libdir/$linklib"
+          elif test "$hardcode_minus_L" = yes; then
+            finalize_command="$finalize_command -L$libdir -l$name"
+          elif test "$hardcode_shlibpath_var" = yes; then
+            finalize_shlibpath="$finalize_shlibpath$libdir:"
+            finalize_command="$finalize_command -l$name"
+          else
+            # We cannot seem to hardcode it, guess we'll fake it.
+            finalize_command="$finalize_command -L$libdir -l$name"
+          fi
+        else
+          # Transform directly to old archives if we don't build new libraries.
+          if test -n "$pic_flag" && test -z "$old_library"; then
+            $echo "$modename: cannot find static library for \`$arg'" 1>&2
+            exit 1
+          fi
+
+	  # 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_command="$compile_command $dir/$linklib"
+	    finalize_command="$finalize_command $dir/$linklib"
+	  else
+	    compile_command="$compile_command -L$dir -l$name"
+	    finalize_command="$finalize_command -L$dir -l$name"
+	  fi
+        fi
+
+	# Add in any libraries that this one depends upon.
+	compile_command="$compile_command$dependency_libs"
+	finalize_command="$finalize_command$dependency_libs"
+	continue
+        ;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case "$arg" in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	  arg="\"$arg\""
+	  ;;
+	esac
+        ;;
+      esac
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+      fi
+    done
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    if test -n "$vinfo" && test -n "$release"; then
+      $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    oldlib=
+    oldobjs=
+    case "$output" in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+      ;;
+
+    */* | *\\*)
+      $echo "$modename: output file \`$output' must have no directory components" 1>&2
+      exit 1
+      ;;
+
+    *.a)
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      build_old_libs=yes
+      oldlib="$output"
+      $show "$rm $oldlib"
+      $run $rm $oldlib
+      ;;
+
+    *.la)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case "$output" in
+      lib*) ;;
+      *)
+	$echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2
+	$echo "$help" 1>&2
+	exit 1
+	;;
+      esac
+
+      name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+      eval libname=\"$libname_spec\"
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+      current=0
+      revision=0
+      age=0
+
+      if test -n "$objs"; then
+        $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
+        exit 1
+      fi
+
+      # How the heck are we supposed to write a wrapper for a shared library?
+      if test -n "$link_against_libtool_libs"; then
+        $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
+        exit 1
+      fi
+
+      if test -n "$dlfiles$dlprefiles"; then
+        $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
+        # Nullify the symbol file.
+        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test -z "$rpath"; then
+        $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2
+	$echo "$help" 1>&2
+        exit 1
+      fi
+
+      set dummy $rpath
+      if test $# -gt 2; then
+	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      # Parse the version information argument.
+      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=':'
+      set dummy $vinfo
+      IFS="$save_ifs"
+
+      if test -n "$5"; then
+        $echo "$modename: too many parameters to \`-version-info'" 1>&2
+        $echo "$help" 1>&2
+        exit 1
+      fi
+
+      test -n "$2" && current="$2"
+      test -n "$3" && revision="$3"
+      test -n "$4" && age="$4"
+
+      # Check that each of the things are valid numbers.
+      case "$current" in
+      0 | [1-9] | [1-9][0-9]*) ;;
+      *)
+        $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+        $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+        exit 1
+        ;;
+      esac
+
+      case "$revision" in
+      0 | [1-9] | [1-9][0-9]*) ;;
+      *)
+        $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+        $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+        exit 1
+        ;;
+      esac
+
+      case "$age" in
+      0 | [1-9] | [1-9][0-9]*) ;;
+      *)
+        $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+        $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+        exit 1
+        ;;
+      esac
+
+      if test $age -gt $current; then
+        $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+        $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+        exit 1
+      fi
+
+      # Calculate the version variables.
+      version_vars="version_type current age revision"
+      case "$version_type" in
+      none) ;;
+
+      linux)
+        version_vars="$version_vars major versuffix"
+        major=`expr $current - $age`
+        versuffix="$major.$age.$revision"
+        ;;
+
+      osf)
+        version_vars="$version_vars versuffix verstring"
+        major=`expr $current - $age`
+        versuffix="$current.$age.$revision"
+        verstring="$versuffix"
+
+        # Add in all the interfaces that we are compatible with.
+        loop=$age
+        while test $loop != 0; do
+          iface=`expr $current - $loop`
+          loop=`expr $loop - 1`
+          verstring="$verstring:${iface}.0"
+        done
+
+        # Make executables depend on our current version.
+        verstring="$verstring:${current}.0"
+        ;;
+
+      sunos)
+        version_vars="$version_vars major versuffix"
+        major="$current"
+        versuffix="$current.$revision"
+        ;;
+
+      *)
+        $echo "$modename: unknown library version type \`$version_type'" 1>&2
+        echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+        exit 1
+        ;;
+      esac
+
+      # Create the output directory, or remove our outputs if we need to.
+      if test -d $objdir; then
+        $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
+        $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
+      else
+        $show "$mkdir $objdir"
+        $run $mkdir $objdir
+	status=$?
+	if test $status -eq 0 || test -d $objdir; then :
+	else
+	  exit $status
+	fi
+      fi
+
+      # Check to see if the archive will have undefined symbols.
+      if test "$allow_undefined" = yes; then
+        if test "$allow_undefined_flag" = unsupported; then
+          $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+          build_libtool_libs=no
+	  build_old_libs=yes
+        fi
+      else
+        # Don't allow undefined symbols.
+        allow_undefined_flag="$no_undefined_flag"
+      fi
+
+      # Add libc to deplibs on all systems.
+      dependency_libs="$deplibs"
+      deplibs="$deplibs -lc"
+
+      if test "$build_libtool_libs" = yes; then
+        # Get the real and link names of the library.
+        eval library_names=\"$library_names_spec\"
+        set dummy $library_names
+        realname="$2"
+        shift; shift
+
+        if test -n "$soname_spec"; then
+          eval soname=\"$soname_spec\"
+        else
+          soname="$realname"
+        fi
+
+        lib="$objdir/$realname"
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+        # Use standard objects if they are PIC.
+        test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
+
+        # Do each of the archive commands.
+        eval cmds=\"$archive_cmds\"
+        IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=';'
+        for cmd in $cmds; do
+          IFS="$save_ifs"
+          $show "$cmd"
+          $run eval "$cmd" || exit $?
+        done
+        IFS="$save_ifs"
+
+        # Create links to the real library.
+        for linkname in $linknames; do
+          $show "(cd $objdir && $LN_S $realname $linkname)"
+          $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
+        done
+
+        # If -export-dynamic was specified, set the dlname.
+        if test "$export_dynamic" = yes; then
+          # On all known operating systems, these are identical.
+          dlname="$soname"
+        fi
+      fi
+
+      # Now set the variables for building old libraries.
+      oldlib="$objdir/$libname.a"
+      ;;
+
+    *.lo | *.o)
+      if test -n "$link_against_libtool_libs"; then
+        $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2
+        exit 1
+      fi
+
+      if test -n "$deplibs"; then
+        $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles"; then
+        $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2
+        # Nullify the symbol file.
+        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test -n "$rpath"; then
+        $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+        $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+        $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
+      fi
+
+      case "$output" in
+      *.lo)
+        if test -n "$objs"; then
+          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+          exit 1
+        fi
+        libobj="$output"
+        obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
+        ;;
+      *)
+        libobj=
+        obj="$output"
+        ;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Create the old-style object.
+      reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^       ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
+
+      output="$obj"
+      eval cmds=\"$reload_cmds\"
+      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=';'
+      for cmd in $cmds; do
+        IFS="$save_ifs"
+        $show "$cmd"
+        $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      test -z "$libobj" && exit 0
+
+      if test "$build_libtool_libs" != yes; then
+        # Create an invalid libtool object if no PIC, so that we don't
+        # accidentally link it into a program.
+        $show "echo timestamp > $libobj"
+        $run eval "echo timestamp > $libobj" || exit $?
+        exit 0
+      fi
+
+      if test -n "$pic_flag"; then
+        # Only do commands if we really have different PIC objects.
+        reload_objs="$libobjs"
+        output="$libobj"
+        eval cmds=\"$reload_cmds\"
+        IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=';'
+        for cmd in $cmds; do
+          IFS="$save_ifs"
+          $show "$cmd"
+          $run eval "$cmd" || exit $?
+        done
+        IFS="$save_ifs"
+      else
+        # Just create a symlink.
+        $show "$LN_S $obj $libobj"
+        $run $LN_S $obj $libobj || exit 1
+      fi
+
+      exit 0
+      ;;
+
+    *)
+      if test -n "$vinfo"; then
+        $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+        $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath; do
+          if test -n "$hardcode_libdir_flag_spec"; then
+            if test -n "$hardcode_libdir_separator"; then
+              if test -z "$hardcode_libdirs"; then
+                # Put the magic libdir with the hardcode flag.
+                hardcode_libdirs="$libdir"
+                libdir="@HARDCODE_LIBDIRS@"
+              else
+                # Just accumulate the unique libdirs.
+		case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+		*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		  ;;
+		*)
+		  hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		  ;;
+		esac
+                libdir=
+              fi
+            fi
+
+            if test -n "$libdir"; then
+              eval flag=\"$hardcode_libdir_flag_spec\"
+
+              compile_command="$compile_command $flag"
+              finalize_command="$finalize_command $flag"
+            fi
+          elif test -n "$runpath_var"; then
+            case "$perm_rpath " in
+            *" $libdir "*) ;;
+            *) perm_rpath="$perm_rpath $libdir" ;;
+            esac
+          fi
+	done
+      fi
+
+      # Substitute the hardcoded libdirs into the compile commands.
+      if test -n "$hardcode_libdir_separator"; then
+	compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
+	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
+      fi
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+        # Transform all the library objects into standard objects.
+        compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
+        finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
+      fi
+
+      if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
+        dlsyms="${output}S.c"
+      else
+        dlsyms=
+      fi
+
+      if test -n "$dlsyms"; then
+        # Add our own program objects to the preloaded list.
+        dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
+
+	# Discover the nlist of each of the dlfiles.
+        nlist="$objdir/${output}.nm"
+
+	if test -d $objdir; then
+	  $show "$rm $nlist ${nlist}T"
+	  $run $rm "$nlist" "${nlist}T"
+	else
+	  $show "$mkdir $objdir"
+	  $run $mkdir $objdir
+	  status=$?
+	  if test $status -eq 0 || test -d $objdir; then :
+	  else
+	    exit $status
+	  fi
+	fi
+
+        for arg in $dlprefiles; do
+	  $show "extracting global C symbols from \`$arg'"
+	  $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+        done
+
+        # Parse the name list into a source file.
+        $show "creating $objdir/$dlsyms"
+        if test -z "$run"; then
+	  # Make sure we at least have an empty file.
+	  test -f "$nlist" || : > "$nlist"
+
+	  # Try sorting and uniquifying the output.
+	  if sort "$nlist" | uniq > "$nlist"T; then
+	    mv -f "$nlist"T "$nlist"
+	    wcout=`wc "$nlist" 2>/dev/null`
+	    count=`echo "X$wcout" | $Xsed -e 's/^[ 	]*\([0-9][0-9]*\).*$/\1/'`
+	    (test "$count" -ge 0) 2>/dev/null || count=-1
+	  else
+	    $rm "$nlist"T
+	    count=-1
+	  fi
+
+	  case "$dlsyms" in
+	  "") ;;
+	  *.c)
+	    $echo > "$objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define dld_preloaded_symbol_count some_other_symbol
+#define dld_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+	    if test -f "$nlist"; then
+	      sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
+	    else
+	      echo '/* NONE */' >> "$objdir/$dlsyms"
+	    fi
+
+	    $echo >> "$objdir/$dlsyms" "\
+
+#undef dld_preloaded_symbol_count
+#undef dld_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define __ptr_t void *
+#else
+# define __ptr_t char *
+#endif
+
+/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
+int dld_preloaded_symbol_count = $count;
+
+/* The mapping between symbol names and symbols. */
+struct {
+  char *name;
+  __ptr_t address;
+}
+dld_preloaded_symbols[] =
+{\
+"
+
+	    if test -f "$nlist"; then
+	      sed 's/^\(.*\) \(.*\)$/  {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
+	    fi
+
+	    $echo >> "$objdir/$dlsyms" "\
+  {0, (__ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	    ;;
+
+	  *)
+	    $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+	    exit 1
+	    ;;
+	  esac
+        fi
+
+        # Now compile the dynamic symbol file.
+        $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
+        $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
+
+        # Transform the symbol file into the correct name.
+        compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
+        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
+      elif test "$export_dynamic" != yes; then
+        test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
+      else
+        # We keep going just in case the user didn't refer to
+        # dld_preloaded_symbols.  The linker will fail if global_symbol_pipe
+        # really was required.
+        $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+
+        # Nullify the symbol file.
+        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
+        # Replace the output file specification.
+        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+        finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+
+        # We have no uninstalled library dependencies, so finalize right now.
+        $show "$compile_command"
+        $run eval "$compile_command"
+        exit $?
+      fi
+
+      # Replace the output file specification.
+      compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
+      finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
+
+      # Create the binary in the object directory, then wrap it.
+      if test -d $objdir; then :
+      else
+        $show "$mkdir $objdir"
+	$run $mkdir $objdir
+	status=$?
+	if test $status -eq 0 || test -d $objdir; then :
+	else
+	  exit $status
+	fi
+      fi
+
+      if test -n "$shlibpath_var"; then
+        # We should set the shlibpath_var
+        rpath=
+        for dir in $temp_rpath; do
+          case "$dir" in
+          /* | [A-Za-z]:\\*)
+            # Absolute path.
+            rpath="$rpath$dir:"
+            ;;
+          *)
+            # Relative path: add a thisdir entry.
+            rpath="$rpath\$thisdir/$dir:"
+            ;;
+          esac
+        done
+        temp_rpath="$rpath"
+      fi
+
+      # Delete the old output file.
+      $run $rm $output
+
+      if test -n "$compile_shlibpath"; then
+        compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      if test -n "$runpath_var" && test -n "$perm_rpath"; then
+        # We should set the runpath_var.
+        rpath=
+        for dir in $perm_rpath; do
+          rpath="$rpath$dir:"
+        done
+        compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
+        finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
+      fi
+
+      case "$hardcode_action" in
+      relink)
+        # AGH! Flame the AIX and HP-UX people for me, will ya?
+        $echo "$modename: warning: using a buggy system linker" 1>&2
+        $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
+        ;;
+      esac
+
+      $show "$compile_command"
+      $run eval "$compile_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the finalize command for shipping.
+      finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
+
+      # Quote $echo for shipping.
+      qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+        $rm $output
+        trap "$rm $output; exit 1" 1 2 15
+
+        $echo > $output "\
+#! /bin/sh
+
+# $output - temporary wrapper script for $objdir/$output
+# Generated by ltmain.sh - GNU $PACKAGE $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 \``pwd`'.
+# 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.
+Xsed='sed -e s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  link_against_libtool_libs='$link_against_libtool_libs'
+  finalize_command=\"$finalize_command\"
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" = \"$magic\"; then :
+  else
+    echo=\"$qecho\"
+    file=\"\$0\"
+  fi\
+"
+        $echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e '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 \"X\$file\" | \$Xsed -e '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 \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+
+  progdir=\"\$thisdir/$objdir\"
+  program='$output'
+
+  if test -f \"\$progdir/\$program\"; then"
+
+        # Export our shlibpath_var if we have one.
+        if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+          $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
+
+    export $shlibpath_var
+"
+        fi
+
+        $echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+
+      # Export the path to the program.
+      PATH=\"\$progdir:\$PATH\"
+      export PATH
+
+      exec \$program \${1+\"\$@\"}
+
+      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      exit 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\
+"
+        chmod +x $output
+      fi
+      exit 0
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    if test "$build_old_libs" = "yes"; then
+      # Transform .lo files to .o files.
+      oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^   ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+	eval cmds=\"$old_archive_from_new_cmds\"
+      else
+	eval cmds=\"$old_archive_cmds\"
+      fi
+      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=';'
+      for cmd in $cmds; do
+        IFS="$save_ifs"
+        $show "$cmd"
+        $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    fi
+
+    # Now create the libtool archive.
+    case "$output" in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.a"
+
+      $show "creating $output"
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+        $echo > $output "\
+# $output - a libtool library file
+# Generated by ltmain.sh - GNU $PACKAGE $VERSION
+
+# The name that we can dlopen(3).
+dlname='$dlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'\
+"
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $objdir && $LN_S ../$output $output)"
+      $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
+      ;;
+    esac
+    exit 0
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional /bin/sh argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL"; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case "$arg" in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg="$nonopt"
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case "$arg" in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+        files="$files $dest"
+        dest="$arg"
+        continue
+      fi
+
+      case "$arg" in
+      -d) isdir=yes ;;
+      -f) prev="-f" ;;
+      -g) prev="-g" ;;
+      -m) prev="-m" ;;
+      -o) prev="-o" ;;
+      -s)
+        stripme=" -s"
+        continue
+        ;;
+      -*) ;;
+
+      *)
+        # If the previous option needed an argument, then skip it.
+        if test -n "$prev"; then
+          prev=
+        else
+          dest="$arg"
+          continue
+        fi
+        ;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case "$arg" in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+        $echo "$modename: no file or destination specified" 1>&2
+      else
+        $echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test -n "$isdir"; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test $# -gt 2; then
+        $echo "$modename: \`$dest' is not a directory" 1>&2
+        $echo "$help" 1>&2
+        exit 1
+      fi
+    fi
+    case "$destdir" in
+    /* | [A-Za-z]:\\*) ;;
+    *)
+      for file in $files; do
+        case "$file" in
+        *.lo) ;;
+        *)
+          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+          $echo "$help" 1>&2
+          exit 1
+          ;;
+        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
+      *.a)
+        # Do the static libraries later.
+        staticlibs="$staticlibs $file"
+        ;;
+
+      *.la)
+        # Check to see that this really is a libtool archive.
+        if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
+        else
+          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+          $echo "$help" 1>&2
+          exit 1
+        fi
+
+        library_names=
+        old_library=
+        # If there is no directory component, then add one.
+        case "$file" in
+        */* | *\\*) . $file ;;
+        *) . ./$file ;;
+        esac
+
+        # Add the libdir to current_libdirs if it is the destination.
+        if test "X$destdir" = "X$libdir"; then
+          case "$current_libdirs " in
+          *" $libdir "*) ;;
+          *) current_libdirs="$current_libdirs $libdir" ;;
+          esac
+        else
+          # Note the libdir as a future libdir.
+          case "$future_libdirs " in
+          *" $libdir "*) ;;
+          *) future_libdirs="$future_libdirs $libdir" ;;
+          esac
+        fi
+
+        dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
+        test "X$dir" = "X$file/" && dir=
+        dir="$dir$objdir"
+
+        # See the names of the shared library.
+        set dummy $library_names
+        if test -n "$2"; then
+          realname="$2"
+          shift
+          shift
+
+          # Install the shared library and build the symlinks.
+          $show "$install_prog $dir/$realname $destdir/$realname"
+          $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
+          test "X$dlname" = "X$realname" && dlname=
+
+          if test $# -gt 0; then
+            # Delete the old symlinks.
+            rmcmd="$rm"
+            for linkname
+            do
+              rmcmd="$rmcmd $destdir/$linkname"
+            done
+            $show "$rmcmd"
+            $run $rmcmd
+
+            # ... and create new ones.
+            for linkname
+            do
+              test "X$dlname" = "X$linkname" && dlname=
+              $show "(cd $destdir && $LN_S $realname $linkname)"
+              $run eval "(cd $destdir && $LN_S $realname $linkname)"
+            done
+          fi
+
+          if test -n "$dlname"; then
+            # Install the dynamically-loadable library.
+            $show "$install_prog $dir/$dlname $destdir/$dlname"
+            $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
+          fi
+
+          # Do each command in the postinstall commands.
+          lib="$destdir/$realname"
+          eval cmds=\"$postinstall_cmds\"
+          IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=';'
+          for cmd in $cmds; do
+            IFS="$save_ifs"
+            $show "$cmd"
+            $run eval "$cmd" || exit $?
+          done
+          IFS="$save_ifs"
+        fi
+
+        # Install the pseudo-library for information purposes.
+        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+        $show "$install_prog $file $destdir/$name"
+        $run eval "$install_prog $file $destdir/$name" || exit $?
+
+        # Maybe install the static library, too.
+        test -n "$old_library" && staticlibs="$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
+          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+          destfile="$destdir/$destfile"
+        fi
+
+        # Deduce the name of the destination old-style object file.
+        case "$destfile" in
+        *.lo)
+          staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/\.o/'`
+          ;;
+        *.o)
+          staticdest="$destfile"
+          destfile=
+          ;;
+        *)
+          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+          $echo "$help" 1>&2
+          exit 1
+          ;;
+        esac
+
+        # Install the libtool object if requested.
+        if test -n "$destfile"; then
+          $show "$install_prog $file $destfile"
+          $run eval "$install_prog $file $destfile" || exit $?
+        fi
+
+        # Install the old object if enabled.
+        if test "$build_old_libs" = yes; then
+          # Deduce the name of the old-style object file.
+          staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/\.o/'`
+
+          $show "$install_prog $staticobj $staticdest"
+          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+        fi
+        exit 0
+        ;;
+
+      *)
+        # Do a test to see if this is really a libtool program.
+        if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
+          link_against_libtool_libs=
+          finalize_command=
+
+          # If there is no directory component, then add one.
+          case "$file" in
+          */* | *\\*) . $file ;;
+          *) . ./$file ;;
+          esac
+
+          # Check the variables that should have been set.
+          if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
+            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
+            exit 1
+          fi
+
+          finalize=yes
+          for lib in $link_against_libtool_libs; do
+            # Check to see that each library is installed.
+            libdir=
+            if test -f "$lib"; then
+              # If there is no directory component, then add one.
+              case "$lib" in
+              */* | *\\*) . $lib ;;
+              *) . ./$lib ;;
+              esac
+            fi
+            libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
+            if test -z "$libdir"; then
+              $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2
+            elif test -f "$libfile"; then :
+            else
+              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+              finalize=no
+            fi
+          done
+
+          if test "$hardcode_action" = relink; then
+            if test "$finalize" = yes; then
+              $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
+              $show "$finalize_command"
+              if $run eval "$finalize_command"; then :
+              else
+                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+                continue
+              fi
+              file="$objdir/$file"T
+            else
+              $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
+            fi
+          else
+            # Install the binary that we compiled earlier.
+	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+          fi
+        fi
+
+        $show "$install_prog$stripme $file $dest"
+        $run eval "$install_prog\$stripme \$file \$dest" || exit $?
+        ;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      # Do each command in the postinstall commands.
+      eval cmds=\"$old_postinstall_cmds\"
+      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=';'
+      for cmd in $cmds; do
+        IFS="$save_ifs"
+        $show "$cmd"
+        $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec $SHELL $0 --finish$current_libdirs
+      exit 1
+    fi
+
+    exit 0
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+        libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  eval cmds=\"$finish_cmds\"
+          IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=';'
+          for cmd in $cmds; do
+            IFS="$save_ifs"
+            $show "$cmd"
+            $run eval "$cmd"
+          done
+          IFS="$save_ifs"
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $run eval "$cmds"
+	fi
+      done
+    fi
+
+    echo "------------------------------------------------------------------------------"
+    echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      echo "   $libdir"
+    done
+    echo
+    echo "To link against installed libraries in a given directory, LIBDIR,"
+    echo "you must use the \`-LLIBDIR' flag during linking."
+    echo
+    echo " You will also need to do 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 -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"
+    echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    echo "------------------------------------------------------------------------------"
+    exit 0
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit 1
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test -f "$file"; then :
+      else
+	$echo "$modename: \`$file' is not a file" 1>&2
+	$echo "$help" 1>&2
+	exit 1
+      fi
+
+      dir=
+      case "$file" in
+      *.la)
+        # Check to see that this really is a libtool archive.
+        if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
+        else
+          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+          $echo "$help" 1>&2
+          exit 1
+        fi
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+
+        # If there is no directory component, then add one.
+	case "$file" in
+	*/* | *\\*) . $file ;;
+        *) . ./$file ;;
+	esac
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	  exit 1
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+	;;
+
+      *)
+	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+        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
+      -*) ;;
+      *)
+        # Do a test to see if this is really a libtool program.
+        if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
+	  # If there is no directory component, then add one.
+	  case "$file" in
+	  */* | *\\*) . $file ;;
+	  *) . ./$file ;;
+	  esac
+
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+        ;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      # Export the shlibpath_var.
+      eval "export $shlibpath_var"
+
+      # Now actually exec the command.
+      eval "exec \$cmd$args"
+
+      $echo "$modename: cannot exec \$cmd$args"
+      exit 1
+    else
+      # Display what would be done.
+      eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+      $echo "export $shlibpath_var"
+      $echo "$cmd$args"
+      exit 0
+    fi
+    ;;
+
+  # libtool uninstall mode
+  uninstall)
+    modename="$modename: uninstall"
+    rm="$nonopt"
+    files=
+
+    for arg
+    do
+      case "$arg" in
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$dir" = "X$file" && dir=.
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      rmfiles="$file"
+
+      case "$name" in
+      *.la)
+        # Possibly a libtool archive, so verify it.
+        if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
+          . $dir/$name
+
+          # Delete the libtool libraries and symlinks.
+          for n in $library_names; do
+            rmfiles="$rmfiles $dir/$n"
+            test "X$n" = "X$dlname" && dlname=
+          done
+          test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
+          test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
+
+	  $show "$rm $rmfiles"
+	  $run $rm $rmfiles
+
+	  if test -n "$library_names"; then
+	    # Do each command in the postuninstall commands.
+	    eval cmds=\"$postuninstall_cmds\"
+	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=';'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      $show "$cmd"
+	      $run eval "$cmd"
+	    done
+	    IFS="$save_ifs"
+	  fi
+
+          if test -n "$old_library"; then
+	    # Do each command in the old_postuninstall commands.
+	    eval cmds=\"$old_postuninstall_cmds\"
+	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=';'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      $show "$cmd"
+	      $run eval "$cmd"
+	    done
+	    IFS="$save_ifs"
+	  fi
+
+          # FIXME: should reinstall the best remaining shared library.
+        fi
+        ;;
+
+      *.lo)
+        if test "$build_old_libs" = yes; then
+          oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/\.o/'`
+          rmfiles="$rmfiles $dir/$oldobj"
+        fi
+	$show "$rm $rmfiles"
+	$run $rm $rmfiles
+        ;;
+
+      *)
+      	$show "$rm $rmfiles"
+	$run $rm $rmfiles
+	;;
+      esac
+    done
+    exit 0
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit 1
+    ;;
+  esac
+
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$generic_help" 1>&2
+  exit 1
+fi # test -z "$show_help"
+
+# We need to display help for each of the modes.
+case "$mode" in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+-n, --dry-run         display commands without modifying any files
+    --features        display configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --version         print version information
+
+MODE must be one of the following:
+
+      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.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+  exit 0
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+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: $modename [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: $modename [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: $modename [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 rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [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
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to dld_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -static           do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+
+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.
+
+If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
+and \`ranlib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
+created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo
+"Usage: $modename [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."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit 1
+  ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makcjpeg.st
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makcjpeg.st	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makcjpeg.st	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+; Project file for Independent JPEG Group's software
+;
+; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C.
+; Thanks to Frank Moehle (Frank.Moehle at arbi.informatik.uni-oldenburg.de),
+; Dr. B. Setzepfandt (bernd at gina.uni-muenster.de),
+; and Guido Vollbeding (guivol at esc.de).
+;
+; To use this file, rename it to cjpeg.prj.
+; If you are using Turbo C, change filenames beginning with "pc..." to "tc..."
+; Read installation instructions before trying to make the program!
+;
+;
+;      * * * Output file * * *
+cjpeg.ttp
+;
+; * * * COMPILER OPTIONS * * *  
+.C[-P]        ; absolute calls
+.C[-M]        ; and no string merging, folks
+.C[-w-cln]    ; no "constant is long" warnings
+.C[-w-par]    ; no "parameter xxxx unused"
+.C[-w-rch]    ; no "unreachable code"
+.C[-wsig]     ; warn if significant digits may be lost
+=
+; * * * * List of modules * * * * 
+pcstart.o
+cjpeg.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h,jversion.h)
+cdjpeg.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+rdswitch.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+rdppm.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+rdgif.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+rdtarga.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+rdbmp.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+rdrle.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+libjpeg.lib        ; built by libjpeg.prj
+pcfltlib.lib       ; floating point library
+; the float library can be omitted if you've turned off DCT_FLOAT_SUPPORTED
+pcstdlib.lib       ; standard library
+pcextlib.lib       ; extended library

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makdjpeg.st
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makdjpeg.st	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makdjpeg.st	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+; Project file for Independent JPEG Group's software
+;
+; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C.
+; Thanks to Frank Moehle (Frank.Moehle at arbi.informatik.uni-oldenburg.de),
+; Dr. B. Setzepfandt (bernd at gina.uni-muenster.de),
+; and Guido Vollbeding (guivol at esc.de).
+;
+; To use this file, rename it to djpeg.prj.
+; If you are using Turbo C, change filenames beginning with "pc..." to "tc..."
+; Read installation instructions before trying to make the program!
+;
+;
+;      * * * Output file * * *
+djpeg.ttp
+;
+; * * * COMPILER OPTIONS * * *  
+.C[-P]        ; absolute calls
+.C[-M]        ; and no string merging, folks
+.C[-w-cln]    ; no "constant is long" warnings
+.C[-w-par]    ; no "parameter xxxx unused"
+.C[-w-rch]    ; no "unreachable code"
+.C[-wsig]     ; warn if significant digits may be lost
+=
+; * * * * List of modules * * * * 
+pcstart.o
+djpeg.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h,jversion.h)
+cdjpeg.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+rdcolmap.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+wrppm.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+wrgif.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+wrtarga.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+wrbmp.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+wrrle.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+libjpeg.lib        ; built by libjpeg.prj
+pcfltlib.lib       ; floating point library
+; the float library can be omitted if you've turned off DCT_FLOAT_SUPPORTED
+pcstdlib.lib       ; standard library
+pcextlib.lib       ; extended library

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makeapps.ds
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makeapps.ds	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makeapps.ds	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,828 @@
+# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+!IF "$(CFG)" == ""
+CFG=cjpeg - Win32
+!MESSAGE No configuration specified.  Defaulting to cjpeg - Win32.
+!ENDIF 
+
+!IF "$(CFG)" != "cjpeg - Win32" && "$(CFG)" != "djpeg - Win32" &&\
+ "$(CFG)" != "jpegtran - Win32" && "$(CFG)" != "rdjpgcom - Win32" &&\
+ "$(CFG)" != "wrjpgcom - Win32"
+!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 "apps.mak" CFG="cjpeg - Win32"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "cjpeg - Win32" (based on "Win32 (x86) Console Application")
+!MESSAGE "djpeg - Win32" (based on "Win32 (x86) Console Application")
+!MESSAGE "jpegtran - Win32" (based on "Win32 (x86) Console Application")
+!MESSAGE "rdjpgcom - Win32" (based on "Win32 (x86) Console Application")
+!MESSAGE "wrjpgcom - Win32" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE 
+NULL=nul
+!ENDIF 
+################################################################################
+# Begin Project
+# PROP Target_Last_Scanned "cjpeg - Win32"
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "cjpeg - Win32"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "cjpeg\Release"
+# PROP BASE Intermediate_Dir "cjpeg\Release"
+# PROP BASE Target_Dir "cjpeg"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "cjpeg\Release"
+# PROP Intermediate_Dir "cjpeg\Release"
+# PROP Target_Dir "cjpeg"
+OUTDIR=.\cjpeg\Release
+INTDIR=.\cjpeg\Release
+
+ALL : "$(OUTDIR)\cjpeg.exe"
+
+CLEAN : 
+	- at erase "$(INTDIR)\cjpeg.obj"
+	- at erase "$(INTDIR)\rdppm.obj"
+	- at erase "$(INTDIR)\rdgif.obj"
+	- at erase "$(INTDIR)\rdtarga.obj"
+	- at erase "$(INTDIR)\rdrle.obj"
+	- at erase "$(INTDIR)\rdbmp.obj"
+	- at erase "$(INTDIR)\rdswitch.obj"
+	- at erase "$(INTDIR)\cdjpeg.obj"
+	- at erase "$(OUTDIR)\cjpeg.exe"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\
+ /Fp"$(INTDIR)/cjpeg.pch" /YX /Fo"$(INTDIR)/" /c 
+CPP_OBJS=.\cjpeg\Release/
+CPP_SBRS=.\.
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/cjpeg.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+# 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 Release\jpeg.lib 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
+LINK32_FLAGS=Release\jpeg.lib 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 /incremental:no\
+ /pdb:"$(OUTDIR)/cjpeg.pdb" /machine:I386 /out:"$(OUTDIR)/cjpeg.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\cjpeg.obj" \
+	"$(INTDIR)\rdppm.obj" \
+	"$(INTDIR)\rdgif.obj" \
+	"$(INTDIR)\rdtarga.obj" \
+	"$(INTDIR)\rdrle.obj" \
+	"$(INTDIR)\rdbmp.obj" \
+	"$(INTDIR)\rdswitch.obj" \
+	"$(INTDIR)\cdjpeg.obj" \
+
+
+"$(OUTDIR)\cjpeg.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "djpeg - Win32"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "djpeg\Release"
+# PROP BASE Intermediate_Dir "djpeg\Release"
+# PROP BASE Target_Dir "djpeg"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "djpeg\Release"
+# PROP Intermediate_Dir "djpeg\Release"
+# PROP Target_Dir "djpeg"
+OUTDIR=.\djpeg\Release
+INTDIR=.\djpeg\Release
+
+ALL : "$(OUTDIR)\djpeg.exe"
+
+CLEAN : 
+	- at erase "$(INTDIR)\djpeg.obj"
+	- at erase "$(INTDIR)\wrppm.obj"
+	- at erase "$(INTDIR)\wrgif.obj"
+	- at erase "$(INTDIR)\wrtarga.obj"
+	- at erase "$(INTDIR)\wrrle.obj"
+	- at erase "$(INTDIR)\wrbmp.obj"
+	- at erase "$(INTDIR)\rdcolmap.obj"
+	- at erase "$(INTDIR)\cdjpeg.obj"
+	- at erase "$(OUTDIR)\djpeg.exe"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\
+ /Fp"$(INTDIR)/djpeg.pch" /YX /Fo"$(INTDIR)/" /c 
+CPP_OBJS=.\djpeg\Release/
+CPP_SBRS=.\.
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/djpeg.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+# 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 Release\jpeg.lib 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
+LINK32_FLAGS=Release\jpeg.lib 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 /incremental:no\
+ /pdb:"$(OUTDIR)/djpeg.pdb" /machine:I386 /out:"$(OUTDIR)/djpeg.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\djpeg.obj" \
+	"$(INTDIR)\wrppm.obj" \
+	"$(INTDIR)\wrgif.obj" \
+	"$(INTDIR)\wrtarga.obj" \
+	"$(INTDIR)\wrrle.obj" \
+	"$(INTDIR)\wrbmp.obj" \
+	"$(INTDIR)\rdcolmap.obj" \
+	"$(INTDIR)\cdjpeg.obj" \
+
+
+"$(OUTDIR)\djpeg.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "jpegtran - Win32"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "jpegtran\Release"
+# PROP BASE Intermediate_Dir "jpegtran\Release"
+# PROP BASE Target_Dir "jpegtran"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "jpegtran\Release"
+# PROP Intermediate_Dir "jpegtran\Release"
+# PROP Target_Dir "jpegtran"
+OUTDIR=.\jpegtran\Release
+INTDIR=.\jpegtran\Release
+
+ALL : "$(OUTDIR)\jpegtran.exe"
+
+CLEAN : 
+	- at erase "$(INTDIR)\jpegtran.obj"
+	- at erase "$(INTDIR)\rdswitch.obj"
+	- at erase "$(INTDIR)\cdjpeg.obj"
+	- at erase "$(INTDIR)\transupp.obj"
+	- at erase "$(OUTDIR)\jpegtran.exe"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\
+ /Fp"$(INTDIR)/jpegtran.pch" /YX /Fo"$(INTDIR)/" /c 
+CPP_OBJS=.\jpegtran\Release/
+CPP_SBRS=.\.
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/jpegtran.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+# 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 Release\jpeg.lib 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
+LINK32_FLAGS=Release\jpeg.lib 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 /incremental:no\
+ /pdb:"$(OUTDIR)/jpegtran.pdb" /machine:I386 /out:"$(OUTDIR)/jpegtran.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\jpegtran.obj" \
+	"$(INTDIR)\rdswitch.obj" \
+	"$(INTDIR)\cdjpeg.obj" \
+	"$(INTDIR)\transupp.obj" \
+
+
+"$(OUTDIR)\jpegtran.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "rdjpgcom - Win32"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "rdjpgcom\Release"
+# PROP BASE Intermediate_Dir "rdjpgcom\Release"
+# PROP BASE Target_Dir "rdjpgcom"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "rdjpgcom\Release"
+# PROP Intermediate_Dir "rdjpgcom\Release"
+# PROP Target_Dir "rdjpgcom"
+OUTDIR=.\rdjpgcom\Release
+INTDIR=.\rdjpgcom\Release
+
+ALL : "$(OUTDIR)\rdjpgcom.exe"
+
+CLEAN : 
+	- at erase "$(INTDIR)\rdjpgcom.obj"
+	- at erase "$(OUTDIR)\rdjpgcom.exe"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\
+ /Fp"$(INTDIR)/rdjpgcom.pch" /YX /Fo"$(INTDIR)/" /c 
+CPP_OBJS=.\rdjpgcom\Release/
+CPP_SBRS=.\.
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/rdjpgcom.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+# 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 Release\jpeg.lib 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
+LINK32_FLAGS=Release\jpeg.lib 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 /incremental:no\
+ /pdb:"$(OUTDIR)/rdjpgcom.pdb" /machine:I386 /out:"$(OUTDIR)/rdjpgcom.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\rdjpgcom.obj"
+
+"$(OUTDIR)\rdjpgcom.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "wrjpgcom - Win32"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "wrjpgcom\Release"
+# PROP BASE Intermediate_Dir "wrjpgcom\Release"
+# PROP BASE Target_Dir "wrjpgcom"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "wrjpgcom\Release"
+# PROP Intermediate_Dir "wrjpgcom\Release"
+# PROP Target_Dir "wrjpgcom"
+OUTDIR=.\wrjpgcom\Release
+INTDIR=.\wrjpgcom\Release
+
+ALL : "$(OUTDIR)\wrjpgcom.exe"
+
+CLEAN : 
+	- at erase "$(INTDIR)\wrjpgcom.obj"
+	- at erase "$(OUTDIR)\wrjpgcom.exe"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\
+ /Fp"$(INTDIR)/wrjpgcom.pch" /YX /Fo"$(INTDIR)/" /c 
+CPP_OBJS=.\wrjpgcom\Release/
+CPP_SBRS=.\.
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/wrjpgcom.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+# 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 Release\jpeg.lib 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
+LINK32_FLAGS=Release\jpeg.lib 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 /incremental:no\
+ /pdb:"$(OUTDIR)/wrjpgcom.pdb" /machine:I386 /out:"$(OUTDIR)/wrjpgcom.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\wrjpgcom.obj"
+
+"$(OUTDIR)\wrjpgcom.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) $<  
+
+.c{$(CPP_SBRS)}.sbr:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cpp{$(CPP_SBRS)}.sbr:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cxx{$(CPP_SBRS)}.sbr:
+   $(CPP) $(CPP_PROJ) $<  
+
+################################################################################
+# Begin Target
+
+# Name "cjpeg - Win32"
+
+!IF  "$(CFG)" == "cjpeg - Win32"
+
+!ENDIF 
+
+################################################################################
+# Begin Source File
+
+SOURCE="cjpeg.c"
+DEP_CPP_CJPEG=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	"jversion.h"\
+	
+
+"$(INTDIR)\cjpeg.obj" : $(SOURCE) $(DEP_CPP_CJPEG) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="cdjpeg.c"
+DEP_CPP_CDJPE=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\cdjpeg.obj" : $(SOURCE) $(DEP_CPP_CDJPE) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="rdswitch.c"
+DEP_CPP_RDSWI=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\rdswitch.obj" : $(SOURCE) $(DEP_CPP_RDSWI) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="rdppm.c"
+DEP_CPP_RDPPM=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\rdppm.obj" : $(SOURCE) $(DEP_CPP_RDPPM) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="rdgif.c"
+DEP_CPP_RDGIF=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\rdgif.obj" : $(SOURCE) $(DEP_CPP_RDGIF) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="rdtarga.c"
+DEP_CPP_RDTAR=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\rdtarga.obj" : $(SOURCE) $(DEP_CPP_RDTAR) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="rdbmp.c"
+DEP_CPP_RDBMP=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\rdbmp.obj" : $(SOURCE) $(DEP_CPP_RDBMP) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="rdrle.c"
+DEP_CPP_RDRLE=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\rdrle.obj" : $(SOURCE) $(DEP_CPP_RDRLE) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+# End Target
+################################################################################
+# Begin Target
+
+# Name "djpeg - Win32"
+
+!IF  "$(CFG)" == "djpeg - Win32"
+
+!ENDIF 
+
+################################################################################
+# Begin Source File
+
+SOURCE="djpeg.c"
+DEP_CPP_DJPEG=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	"jversion.h"\
+	
+
+"$(INTDIR)\djpeg.obj" : $(SOURCE) $(DEP_CPP_DJPEG) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="cdjpeg.c"
+DEP_CPP_CDJPE=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\cdjpeg.obj" : $(SOURCE) $(DEP_CPP_CDJPE) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="rdcolmap.c"
+DEP_CPP_RDCOL=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\rdcolmap.obj" : $(SOURCE) $(DEP_CPP_RDCOL) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="wrppm.c"
+DEP_CPP_WRPPM=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\wrppm.obj" : $(SOURCE) $(DEP_CPP_WRPPM) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="wrgif.c"
+DEP_CPP_WRGIF=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\wrgif.obj" : $(SOURCE) $(DEP_CPP_WRGIF) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="wrtarga.c"
+DEP_CPP_WRTAR=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\wrtarga.obj" : $(SOURCE) $(DEP_CPP_WRTAR) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="wrbmp.c"
+DEP_CPP_WRBMP=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\wrbmp.obj" : $(SOURCE) $(DEP_CPP_WRBMP) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="wrrle.c"
+DEP_CPP_WRRLE=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\wrrle.obj" : $(SOURCE) $(DEP_CPP_WRRLE) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+# End Target
+################################################################################
+# Begin Target
+
+# Name "jpegtran - Win32"
+
+!IF  "$(CFG)" == "jpegtran - Win32"
+
+!ENDIF 
+
+################################################################################
+# Begin Source File
+
+SOURCE="jpegtran.c"
+DEP_CPP_JPEGT=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	"transupp.h"\
+	"jversion.h"\
+	
+
+"$(INTDIR)\jpegtran.obj" : $(SOURCE) $(DEP_CPP_JPEGT) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="cdjpeg.c"
+DEP_CPP_CDJPE=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\cdjpeg.obj" : $(SOURCE) $(DEP_CPP_CDJPE) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="rdswitch.c"
+DEP_CPP_RDSWI=\
+	"cdjpeg.h"\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	"cderror.h"\
+	
+
+"$(INTDIR)\rdswitch.obj" : $(SOURCE) $(DEP_CPP_RDSWI) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="transupp.c"
+DEP_CPP_TRANS=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"transupp.h"\
+	
+
+"$(INTDIR)\transupp.obj" : $(SOURCE) $(DEP_CPP_TRANS) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+# End Target
+################################################################################
+# Begin Target
+
+# Name "rdjpgcom - Win32"
+
+!IF  "$(CFG)" == "rdjpgcom - Win32"
+
+!ENDIF 
+
+################################################################################
+# Begin Source File
+
+SOURCE="rdjpgcom.c"
+DEP_CPP_RDJPG=\
+	"jinclude.h"\
+	"jconfig.h"\
+	
+
+"$(INTDIR)\rdjpgcom.obj" : $(SOURCE) $(DEP_CPP_RDJPG) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+# End Target
+################################################################################
+# Begin Target
+
+# Name "wrjpgcom - Win32"
+
+!IF  "$(CFG)" == "wrjpgcom - Win32"
+
+!ENDIF 
+
+################################################################################
+# Begin Source File
+
+SOURCE="wrjpgcom.c"
+DEP_CPP_WRJPG=\
+	"jinclude.h"\
+	"jconfig.h"\
+	
+
+"$(INTDIR)\wrjpgcom.obj" : $(SOURCE) $(DEP_CPP_WRJPG) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+# End Target
+# End Project
+################################################################################
+

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.ansi
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.ansi	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.ansi	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,214 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is suitable for Unix-like systems with ANSI-capable compilers.
+# If you have a non-ANSI compiler, makefile.unix is a better starting point.
+
+# Read installation instructions before saying "make" !!
+
+# The name of your C compiler:
+CC= cc
+
+# You may need to adjust these cc options:
+CFLAGS= -O
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+
+# Link-time cc options:
+LDFLAGS= 
+
+# To link any special libraries, add the necessary -l commands here.
+LDLIBS= 
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For Unix this is usually jmemnobs.o, but you may want
+# to use jmemansi.o or jmemname.o if you have limited swap space.
+SYSDEPMEM= jmemnobs.o
+
+# miscellaneous OS-dependent stuff
+# linker
+LN= $(CC)
+# file deletion command
+RM= rm -f
+# library (.a) file creation command
+AR= ar rc
+# second step in .a creation (use "touch" if not needed)
+AR2= ranlib
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \
+        jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \
+        jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \
+        jfdctint.o
+# decompression library object files
+DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \
+        jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \
+        jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \
+        jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o
+# These objectfiles are included in libjpeg.a
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \
+        cdjpeg.o
+DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \
+        cdjpeg.o
+TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o
+
+
+all: libjpeg.a cjpeg djpeg jpegtran rdjpgcom wrjpgcom
+
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) libjpeg.a
+	$(AR) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a
+
+cjpeg: $(COBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.a $(LDLIBS)
+
+djpeg: $(DOBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.a $(LDLIBS)
+
+jpegtran: $(TROBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.a $(LDLIBS)
+
+rdjpgcom: rdjpgcom.o
+	$(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.o $(LDLIBS)
+
+wrjpgcom: wrjpgcom.o
+	$(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS)
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+clean:
+	$(RM) *.o cjpeg djpeg jpegtran libjpeg.a rdjpgcom wrjpgcom
+	$(RM) core testout*
+
+test: cjpeg djpeg jpegtran
+	$(RM) testout*
+	./djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	./djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	./cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	./djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	./cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	./jpegtran -outfile testoutt.jpg testprog.jpg
+	cmp testimg.ppm testout.ppm
+	cmp testimg.bmp testout.bmp
+	cmp testimg.jpg testout.jpg
+	cmp testimg.ppm testoutp.ppm
+	cmp testimgp.jpg testoutp.jpg
+	cmp testorig.jpg testoutt.jpg
+
+
+jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.bcc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.bcc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.bcc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,285 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is suitable for Borland C on MS-DOS or OS/2.
+# It works with Borland C++ for DOS, revision 3.0 or later,
+# and has been tested with Borland C++ for OS/2.
+# Watch out for optimization bugs in the OS/2 compilers --- see notes below!
+# Thanks to Tom Wright and Ge' Weijers (original DOS) and
+# Ken Porter (OS/2) for this file.
+
+# Read installation instructions before saying "make" !!
+
+# Are we under DOS or OS/2?
+!if !$d(DOS) && !$d(OS2)
+!if $d(__OS2__)
+OS2=1
+!else
+DOS=1
+!endif
+!endif
+
+# The name of your C compiler:
+CC= bcc
+
+# You may need to adjust these cc options:
+!if $d(DOS)
+CFLAGS= -O2 -mm -w-par -w-stu -w-ccc -w-rch
+!else
+CFLAGS= -O1 -w-par -w-stu -w-ccc -w-rch
+!endif
+# -O2 enables full code optimization (for pre-3.0 Borland C++, use -O -G -Z).
+# -O2 is buggy in Borland OS/2 C++ revision 2.0, so use -O1 there for now.
+# If you have Borland OS/2 C++ revision 1.0, use -O or no optimization at all.
+# -mm selects medium memory model (near data, far code pointers; DOS only!)
+# -w-par suppresses warnings about unused function parameters
+# -w-stu suppresses warnings about incomplete structures
+# -w-ccc suppresses warnings about compile-time-constant conditions
+# -w-rch suppresses warnings about unreachable code
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+
+# Link-time cc options:
+!if $d(DOS)
+LDFLAGS= -mm
+# memory model option here must match CFLAGS!
+!else
+LDFLAGS=
+# -lai full-screen app
+# -lc case-significant link
+!endif
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.
+# For DOS, we recommend jmemdos.c and jmemdosa.asm.
+# For OS/2, we recommend jmemnobs.c (flat memory!)
+# SYSDEPMEMLIB must list the same files with "+" signs for the librarian.
+!if $d(DOS)
+SYSDEPMEM= jmemdos.obj jmemdosa.obj
+SYSDEPMEMLIB= +jmemdos.obj +jmemdosa.obj
+!else
+SYSDEPMEM= jmemnobs.obj
+SYSDEPMEMLIB= +jmemnobs.obj
+!endif
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj \
+        jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \
+        jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \
+        jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj
+# decompression library object files
+DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj \
+        jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj \
+        jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \
+        jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \
+        jquant1.obj jquant2.obj jdmerge.obj
+# These objectfiles are included in libjpeg.lib
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj \
+        rdswitch.obj cdjpeg.obj
+DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj \
+        rdcolmap.obj cdjpeg.obj
+TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj
+
+
+all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe
+
+libjpeg.lib: $(LIBOBJECTS)
+	- del libjpeg.lib
+	tlib libjpeg.lib /E /C @&&|
++jcapimin.obj +jcapistd.obj +jctrans.obj +jcparam.obj +jdatadst.obj &
++jcinit.obj +jcmaster.obj +jcmarker.obj +jcmainct.obj +jcprepct.obj &
++jccoefct.obj +jccolor.obj +jcsample.obj +jchuff.obj +jcphuff.obj &
++jcdctmgr.obj +jfdctfst.obj +jfdctflt.obj +jfdctint.obj +jdapimin.obj &
++jdapistd.obj +jdtrans.obj +jdatasrc.obj +jdmaster.obj +jdinput.obj &
++jdmarker.obj +jdhuff.obj +jdphuff.obj +jdmainct.obj +jdcoefct.obj &
++jdpostct.obj +jddctmgr.obj +jidctfst.obj +jidctflt.obj +jidctint.obj &
++jidctred.obj +jdsample.obj +jdcolor.obj +jquant1.obj +jquant2.obj &
++jdmerge.obj +jcomapi.obj +jutils.obj +jerror.obj +jmemmgr.obj &
+$(SYSDEPMEMLIB)
+|
+
+cjpeg.exe: $(COBJECTS) libjpeg.lib
+	$(CC) $(LDFLAGS) -ecjpeg.exe $(COBJECTS) libjpeg.lib
+
+djpeg.exe: $(DOBJECTS) libjpeg.lib
+	$(CC) $(LDFLAGS) -edjpeg.exe $(DOBJECTS) libjpeg.lib
+
+jpegtran.exe: $(TROBJECTS) libjpeg.lib
+	$(CC) $(LDFLAGS) -ejpegtran.exe $(TROBJECTS) libjpeg.lib
+
+rdjpgcom.exe: rdjpgcom.c
+!if $d(DOS)
+	$(CC) -ms -O rdjpgcom.c
+!else
+	$(CC) $(CFLAGS) rdjpgcom.c
+!endif
+
+# On DOS, wrjpgcom needs large model so it can malloc a 64K chunk
+wrjpgcom.exe: wrjpgcom.c
+!if $d(DOS)
+	$(CC) -ml -O wrjpgcom.c
+!else
+	$(CC) $(CFLAGS) wrjpgcom.c
+!endif
+
+# This "{}" syntax allows Borland Make to "batch" source files.
+# In this way, each run of the compiler can build many modules.
+.c.obj:
+	$(CC) $(CFLAGS) -c{ $<}
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+clean:
+	- del *.obj
+	- del libjpeg.lib
+	- del cjpeg.exe
+	- del djpeg.exe
+	- del jpegtran.exe
+	- del rdjpgcom.exe
+	- del wrjpgcom.exe
+	- del testout*.*
+
+test: cjpeg.exe djpeg.exe jpegtran.exe
+	- del testout*.*
+	djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	jpegtran -outfile testoutt.jpg testprog.jpg
+!if $d(DOS)
+	fc /b testimg.ppm testout.ppm
+	fc /b testimg.bmp testout.bmp
+	fc /b testimg.jpg testout.jpg
+	fc /b testimg.ppm testoutp.ppm
+	fc /b testimgp.jpg testoutp.jpg
+	fc /b testorig.jpg testoutt.jpg
+!else
+	echo n > n.tmp
+	comp testimg.ppm testout.ppm < n.tmp
+	comp testimg.bmp testout.bmp < n.tmp
+	comp testimg.jpg testout.jpg < n.tmp
+	comp testimg.ppm testoutp.ppm < n.tmp
+	comp testimgp.jpg testoutp.jpg < n.tmp
+	comp testorig.jpg testoutt.jpg < n.tmp
+	del n.tmp
+!endif
+
+
+jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.obj: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.obj: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.obj: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.obj: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.obj: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.obj: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.obj: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.obj: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.obj: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.obj: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.obj: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.obj: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.obj: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.obj: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.obj: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.obj: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.obj: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.obj: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.obj: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.obj: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.obj: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.obj: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.obj: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.obj: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.obj: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+jmemdosa.obj: jmemdosa.asm
+	tasm /mx jmemdosa.asm

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.cfg
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.cfg	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.cfg	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,319 @@
+# Makefile for Independent JPEG Group's software
+
+# makefile.cfg is edited by configure to produce a custom Makefile.
+
+# Read installation instructions before saying "make" !!
+
+# For compiling with source and object files in different directories.
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+# Where to install the programs and man pages.
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = $(exec_prefix)/bin
+libdir = $(exec_prefix)/lib
+includedir = $(prefix)/include
+binprefix =
+manprefix =
+manext = 1
+mandir = $(prefix)/man/man$(manext)
+
+# The name of your C compiler:
+CC= @CC@
+
+# You may need to adjust these cc options:
+CFLAGS= @CFLAGS@ @CPPFLAGS@ @INCLUDEFLAGS@
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+# However, any special defines for ansi2knr.c may be included here:
+ANSI2KNRFLAGS= @ANSI2KNRFLAGS@
+
+# Link-time cc options:
+LDFLAGS= @LDFLAGS@
+
+# To link any special libraries, add the necessary -l commands here.
+LDLIBS= @LIBS@
+
+# If using GNU libtool, LIBTOOL references it; if not, LIBTOOL is empty.
+LIBTOOL = @LIBTOOL@
+# $(O) expands to "lo" if using libtool, plain "o" if not.
+# Similarly, $(A) expands to "la" or "a".
+O = @O@
+A = @A@
+
+# Library version ID; libtool uses this for the shared library version number.
+# Note: we suggest this match the macro of the same name in jpeglib.h.
+JPEG_LIB_VERSION = @JPEG_LIB_VERSION@
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For Unix this is usually jmemnobs.o, but you may want
+# to use jmemansi.o or jmemname.o if you have limited swap space.
+SYSDEPMEM= @MEMORYMGR@
+
+# miscellaneous OS-dependent stuff
+SHELL= /bin/sh
+# linker
+LN= @LN@
+# file deletion command
+RM= rm -f
+# directory creation command
+MKDIR= mkdir
+# library (.a) file creation command
+AR= ar rc
+# second step in .a creation (use "touch" if not needed)
+AR2= @RANLIB@
+# installation program
+INSTALL= @INSTALL@
+INSTALL_PROGRAM= @INSTALL_PROGRAM@
+INSTALL_LIB= @INSTALL_LIB@
+INSTALL_DATA= @INSTALL_DATA@
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.$(O) jutils.$(O) jerror.$(O) jmemmgr.$(O) $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.$(O) jcapistd.$(O) jctrans.$(O) jcparam.$(O) \
+        jdatadst.$(O) jcinit.$(O) jcmaster.$(O) jcmarker.$(O) jcmainct.$(O) \
+        jcprepct.$(O) jccoefct.$(O) jccolor.$(O) jcsample.$(O) jchuff.$(O) \
+        jcphuff.$(O) jcdctmgr.$(O) jfdctfst.$(O) jfdctflt.$(O) \
+        jfdctint.$(O)
+# decompression library object files
+DLIBOBJECTS= jdapimin.$(O) jdapistd.$(O) jdtrans.$(O) jdatasrc.$(O) \
+        jdmaster.$(O) jdinput.$(O) jdmarker.$(O) jdhuff.$(O) jdphuff.$(O) \
+        jdmainct.$(O) jdcoefct.$(O) jdpostct.$(O) jddctmgr.$(O) \
+        jidctfst.$(O) jidctflt.$(O) jidctint.$(O) jidctred.$(O) \
+        jdsample.$(O) jdcolor.$(O) jquant1.$(O) jquant2.$(O) jdmerge.$(O)
+# These objectfiles are included in libjpeg.a
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.$(O) rdppm.$(O) rdgif.$(O) rdtarga.$(O) rdrle.$(O) \
+        rdbmp.$(O) rdswitch.$(O) cdjpeg.$(O)
+DOBJECTS= djpeg.$(O) wrppm.$(O) wrgif.$(O) wrtarga.$(O) wrrle.$(O) \
+        wrbmp.$(O) rdcolmap.$(O) cdjpeg.$(O)
+TROBJECTS= jpegtran.$(O) rdswitch.$(O) cdjpeg.$(O) transupp.$(O)
+
+
+all: @A2K_DEPS@ libjpeg.$(A) cjpeg djpeg jpegtran rdjpgcom wrjpgcom
+
+# Special compilation rules to support ansi2knr and libtool.
+.SUFFIXES: .lo .la
+
+# How to compile with libtool.
+ at COM_LT@.c.lo:
+ at COM_LT@	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$*.c
+
+# How to use ansi2knr, when not using libtool.
+ at COM_A2K@.c.o:
+ at COM_A2K@	./ansi2knr $(srcdir)/$*.c knr/$*.c
+ at COM_A2K@	$(CC) $(CFLAGS) -c knr/$*.c
+ at COM_A2K@	$(RM) knr/$*.c
+
+# How to use ansi2knr AND libtool.
+ at COM_A2K@.c.lo:
+ at COM_A2K@	./ansi2knr $(srcdir)/$*.c knr/$*.c
+ at COM_A2K@	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c knr/$*.c
+ at COM_A2K@	$(RM) knr/$*.c
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr $(srcdir)/ansi2knr.c
+	$(MKDIR) knr
+
+# the library:
+
+# without libtool:
+libjpeg.a: @A2K_DEPS@ $(LIBOBJECTS)
+	$(RM) libjpeg.a
+	$(AR) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a
+
+# with libtool:
+libjpeg.la: @A2K_DEPS@ $(LIBOBJECTS)
+	$(LIBTOOL) --mode=link $(CC) -o libjpeg.la $(LIBOBJECTS) \
+		-rpath $(libdir) -version-info $(JPEG_LIB_VERSION)
+
+# sample programs:
+
+cjpeg: $(COBJECTS) libjpeg.$(A)
+	$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.$(A) $(LDLIBS)
+
+djpeg: $(DOBJECTS) libjpeg.$(A)
+	$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.$(A) $(LDLIBS)
+
+jpegtran: $(TROBJECTS) libjpeg.$(A)
+	$(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.$(A) $(LDLIBS)
+
+rdjpgcom: rdjpgcom.$(O)
+	$(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.$(O) $(LDLIBS)
+
+wrjpgcom: wrjpgcom.$(O)
+	$(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.$(O) $(LDLIBS)
+
+# Installation rules:
+
+install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom @FORCE_INSTALL_LIB@
+	$(INSTALL_PROGRAM) cjpeg $(bindir)/$(binprefix)cjpeg
+	$(INSTALL_PROGRAM) djpeg $(bindir)/$(binprefix)djpeg
+	$(INSTALL_PROGRAM) jpegtran $(bindir)/$(binprefix)jpegtran
+	$(INSTALL_PROGRAM) rdjpgcom $(bindir)/$(binprefix)rdjpgcom
+	$(INSTALL_PROGRAM) wrjpgcom $(bindir)/$(binprefix)wrjpgcom
+	$(INSTALL_DATA) $(srcdir)/cjpeg.1 $(mandir)/$(manprefix)cjpeg.$(manext)
+	$(INSTALL_DATA) $(srcdir)/djpeg.1 $(mandir)/$(manprefix)djpeg.$(manext)
+	$(INSTALL_DATA) $(srcdir)/jpegtran.1 $(mandir)/$(manprefix)jpegtran.$(manext)
+	$(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(mandir)/$(manprefix)rdjpgcom.$(manext)
+	$(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(mandir)/$(manprefix)wrjpgcom.$(manext)
+
+install-lib: libjpeg.$(A) install-headers
+	$(INSTALL_LIB) libjpeg.$(A) $(libdir)/$(binprefix)libjpeg.$(A)
+
+install-headers: jconfig.h
+	$(INSTALL_DATA) jconfig.h $(includedir)/jconfig.h
+	$(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
+	$(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
+	$(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h
+
+clean:
+	$(RM) *.o *.lo libjpeg.a libjpeg.la
+	$(RM) cjpeg djpeg jpegtran rdjpgcom wrjpgcom
+	$(RM) ansi2knr core testout* config.log config.status
+	$(RM) -r knr .libs _libs
+
+distclean: clean
+	$(RM) Makefile jconfig.h libtool config.cache
+
+test: cjpeg djpeg jpegtran
+	$(RM) testout*
+	./djpeg -dct int -ppm -outfile testout.ppm  $(srcdir)/testorig.jpg
+	./djpeg -dct int -bmp -colors 256 -outfile testout.bmp  $(srcdir)/testorig.jpg
+	./cjpeg -dct int -outfile testout.jpg  $(srcdir)/testimg.ppm
+	./djpeg -dct int -ppm -outfile testoutp.ppm $(srcdir)/testprog.jpg
+	./cjpeg -dct int -progressive -opt -outfile testoutp.jpg $(srcdir)/testimg.ppm
+	./jpegtran -outfile testoutt.jpg $(srcdir)/testprog.jpg
+	cmp $(srcdir)/testimg.ppm testout.ppm
+	cmp $(srcdir)/testimg.bmp testout.bmp
+	cmp $(srcdir)/testimg.jpg testout.jpg
+	cmp $(srcdir)/testimg.ppm testoutp.ppm
+	cmp $(srcdir)/testimgp.jpg testoutp.jpg
+	cmp $(srcdir)/testorig.jpg testoutt.jpg
+
+check: test
+
+# Mistake catcher:
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+# GNU Make likes to know which target names are not really files to be made:
+.PHONY: all install install-lib install-headers clean distclean test check
+
+
+jcapimin.$(O): jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.$(O): jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.$(O): jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.$(O): jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.$(O): jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.$(O): jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.$(O): jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.$(O): jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.$(O): jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.$(O): jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.$(O): jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.$(O): jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.$(O): jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.$(O): jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.$(O): jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.$(O): jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.$(O): jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.$(O): jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.$(O): jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.$(O): jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.$(O): jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.$(O): jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.$(O): jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.$(O): jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.$(O): jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.$(O): jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.$(O): jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.$(O): jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.$(O): jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.$(O): jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.$(O): jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.$(O): jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.$(O): jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.$(O): jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.$(O): jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.$(O): jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.$(O): jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.$(O): jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.$(O): jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.$(O): jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.$(O): jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.$(O): jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.$(O): jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.$(O): jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.$(O): jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.$(O): jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.$(O): jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.$(O): jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.$(O): jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.$(O): jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.$(O): cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.$(O): djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.$(O): jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.$(O): rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.$(O): wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.$(O): cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.$(O): rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.$(O): rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.$(O): transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.$(O): rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.$(O): wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.$(O): rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.$(O): wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.$(O): rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.$(O): wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.$(O): rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.$(O): wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.$(O): rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.$(O): wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.dj
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.dj	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.dj	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,220 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is for DJGPP (Delorie's GNU C port on MS-DOS), v2.0 or later.
+# Thanks to Frank J. Donahoe for this version.
+
+# Read installation instructions before saying "make" !!
+
+# The name of your C compiler:
+CC= gcc
+
+# You may need to adjust these cc options:
+CFLAGS= -O2 -Wall -I.
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+
+# Link-time cc options:
+LDFLAGS= -s
+
+# To link any special libraries, add the necessary -l commands here.
+LDLIBS= 
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For DJGPP this is usually jmemnobs.o, but you could
+# use jmemname.o if you want to use named temp files instead of swap space.
+SYSDEPMEM= jmemnobs.o
+
+# miscellaneous OS-dependent stuff
+# linker
+LN= $(CC)
+# file deletion command
+RM= del
+# library (.a) file creation command
+AR= ar rc
+# second step in .a creation (use "touch" if not needed)
+AR2= ranlib
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \
+        jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \
+        jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \
+        jfdctint.o
+# decompression library object files
+DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \
+        jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \
+        jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \
+        jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o
+# These objectfiles are included in libjpeg.a
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \
+        cdjpeg.o
+DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \
+        cdjpeg.o
+TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o
+
+
+all: libjpeg.a cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe
+
+libjpeg.a: $(LIBOBJECTS)
+	$(RM) libjpeg.a
+	$(AR) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a
+
+cjpeg.exe: $(COBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o cjpeg.exe $(COBJECTS) libjpeg.a $(LDLIBS)
+
+djpeg.exe: $(DOBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o djpeg.exe $(DOBJECTS) libjpeg.a $(LDLIBS)
+
+jpegtran.exe: $(TROBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o jpegtran.exe $(TROBJECTS) libjpeg.a $(LDLIBS)
+
+rdjpgcom.exe: rdjpgcom.o
+	$(LN) $(LDFLAGS) -o rdjpgcom.exe rdjpgcom.o $(LDLIBS)
+
+wrjpgcom.exe: wrjpgcom.o
+	$(LN) $(LDFLAGS) -o wrjpgcom.exe wrjpgcom.o $(LDLIBS)
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+clean:
+	$(RM) *.o
+	$(RM) cjpeg.exe
+	$(RM) djpeg.exe
+	$(RM) jpegtran.exe
+	$(RM) rdjpgcom.exe
+	$(RM) wrjpgcom.exe
+	$(RM) libjpeg.a
+	$(RM) testout*.*
+
+test: cjpeg.exe djpeg.exe jpegtran.exe
+	$(RM) testout*.*
+	./djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	./djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	./cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	./djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	./cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	./jpegtran -outfile testoutt.jpg testprog.jpg
+	fc /b testimg.ppm testout.ppm
+	fc /b testimg.bmp testout.bmp
+	fc /b testimg.jpg testout.jpg
+	fc /b testimg.ppm testoutp.ppm
+	fc /b testimgp.jpg testoutp.jpg
+	fc /b testorig.jpg testoutt.jpg
+
+
+jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.manx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.manx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.manx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,214 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is for Amiga systems using Manx Aztec C ver 5.x.
+# Thanks to D.J. James (djjames at cup.portal.com) for this version.
+
+# Read installation instructions before saying "make" !!
+
+# The name of your C compiler:
+CC= cc
+
+# You may need to adjust these cc options:
+# Uncomment for generic 68000 code (will work on any Amiga)
+ARCHFLAGS= -sn
+
+# Uncomment for 68020/68030 code (faster, but won't run on 68000 CPU)
+#ARCHFLAGS= -c2
+
+CFLAGS= -MC -MD $(ARCHFLAGS) -spfam -r4
+
+# Link-time cc options:
+LDFLAGS= -g
+
+# To link any special libraries, add the necessary -l commands here.
+LDLIBS= -lml -lcl
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For Amiga we recommend jmemname.o.
+SYSDEPMEM= jmemname.o
+
+# miscellaneous OS-dependent stuff
+# linker
+LN= ln
+# file deletion command
+RM= delete quiet
+# library (.lib) file creation command
+AR= lb
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \
+        jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \
+        jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \
+        jfdctint.o
+# decompression library object files
+DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \
+        jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \
+        jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \
+        jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o
+# These objectfiles are included in libjpeg.lib
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \
+        cdjpeg.o
+DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \
+        cdjpeg.o
+TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o
+
+
+all: libjpeg.lib cjpeg djpeg jpegtran rdjpgcom wrjpgcom
+
+libjpeg.lib: $(LIBOBJECTS)
+	-$(RM) libjpeg.lib
+	$(AR) libjpeg.lib  $(LIBOBJECTS)
+
+cjpeg: $(COBJECTS) libjpeg.lib
+	$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.lib $(LDLIBS)
+
+djpeg: $(DOBJECTS) libjpeg.lib
+	$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.lib $(LDLIBS)
+
+jpegtran: $(TROBJECTS) libjpeg.lib
+	$(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.lib $(LDLIBS)
+
+rdjpgcom: rdjpgcom.o
+	$(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.o $(LDLIBS)
+
+wrjpgcom: wrjpgcom.o
+	$(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS)
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+clean:
+	-$(RM) *.o cjpeg djpeg jpegtran libjpeg.lib rdjpgcom wrjpgcom
+	-$(RM) core testout*.*
+
+test: cjpeg djpeg jpegtran
+	-$(RM) testout*.*
+	djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	jpegtran -outfile testoutt.jpg testprog.jpg
+	cmp testimg.ppm testout.ppm
+	cmp testimg.bmp testout.bmp
+	cmp testimg.jpg testout.jpg
+	cmp testimg.ppm testoutp.ppm
+	cmp testimgp.jpg testoutp.jpg
+	cmp testorig.jpg testoutt.jpg
+
+
+jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.mc6
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.mc6	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.mc6	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,249 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is for Microsoft C for MS-DOS, version 6.00A and up.
+# Use NMAKE, not Microsoft's brain-damaged MAKE.
+# Thanks to Alan Wright and Chris Turner of Olivetti Research Ltd.
+
+# Read installation instructions before saying "nmake" !!
+
+# You may need to adjust these compiler options:
+CFLAGS = -AM -Oecigt -Gs -W3
+# -AM medium memory model (or use -AS for small model, if you remove features)
+# -Oecigt -Gs  maximum safe optimisation (-Ol has bugs in MSC 6.00A)
+# -W3 warning level 3
+# You might also want to add -G2 if you have an 80286, etc.
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+
+# Jan-Herman Buining suggests the following switches for MS C 8.0 and a 486:
+# CFLAGS = /AM /f- /FPi87 /G3 /Gs /Gy /Ob1 /Oc /Oe /Og /Oi /Ol /On /Oo /Ot \
+#          /OV4 /W3
+# except for jquant1.c, which must be compiled with /Oo- to avoid a compiler
+# crash.
+
+# Ingar Steinsland suggests the following switches when building
+# a 16-bit Windows DLL:
+# CFLAGS = -ALw -Gsw -Zpe -W3 -O2 -Zi -Zd
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For DOS, we recommend jmemdos.c and jmemdosa.asm.
+# (But not for Windows; see install.doc if you use this makefile for Windows.)
+SYSDEPMEM= jmemdos.obj jmemdosa.obj
+# SYSDEPMEMLIB must list the same files with "+" signs for the librarian.
+SYSDEPMEMLIB= +jmemdos.obj +jmemdosa.obj
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj \
+        jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \
+        jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \
+        jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj
+# decompression library object files
+DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj \
+        jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj \
+        jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \
+        jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \
+        jquant1.obj jquant2.obj jdmerge.obj
+# These objectfiles are included in libjpeg.lib
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj \
+        rdswitch.obj cdjpeg.obj
+DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj \
+        rdcolmap.obj cdjpeg.obj
+TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj
+
+# need linker response file because file list > 128 chars
+RFILE = libjpeg.ans
+
+
+all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe
+
+libjpeg.lib: $(LIBOBJECTS) $(RFILE)
+	del libjpeg.lib
+	lib @$(RFILE)
+
+# linker response file for building libjpeg.lib
+$(RFILE) : makefile
+	del $(RFILE)
+	echo libjpeg.lib >$(RFILE)
+# silly want-to-create-it prompt:
+	echo y >>$(RFILE)
+	echo +jcapimin.obj +jcapistd.obj +jctrans.obj +jcparam.obj & >>$(RFILE)
+	echo +jdatadst.obj +jcinit.obj +jcmaster.obj +jcmarker.obj & >>$(RFILE)
+	echo +jcmainct.obj +jcprepct.obj +jccoefct.obj & >>$(RFILE)
+	echo +jccolor.obj +jcsample.obj +jchuff.obj +jcphuff.obj & >>$(RFILE)
+	echo +jcdctmgr.obj +jfdctfst.obj +jfdctflt.obj & >>$(RFILE)
+	echo +jfdctint.obj +jdapimin.obj +jdapistd.obj & >>$(RFILE)
+	echo +jdtrans.obj +jdatasrc.obj +jdmaster.obj +jdinput.obj & >>$(RFILE)
+	echo +jdmarker.obj +jdhuff.obj +jdphuff.obj +jdmainct.obj & >>$(RFILE)
+	echo +jdcoefct.obj +jdpostct.obj +jddctmgr.obj & >>$(RFILE)
+	echo +jidctfst.obj +jidctflt.obj +jidctint.obj & >>$(RFILE)
+	echo +jidctred.obj +jdsample.obj +jdcolor.obj +jquant1.obj & >>$(RFILE)
+	echo +jquant2.obj +jdmerge.obj +jcomapi.obj +jutils.obj & >>$(RFILE)
+	echo +jerror.obj +jmemmgr.obj & >>$(RFILE)
+	echo $(SYSDEPMEMLIB) ; >>$(RFILE)
+
+cjpeg.exe: $(COBJECTS) libjpeg.lib
+	echo $(COBJECTS) >cjpeg.lst
+	link /STACK:4096 /EXEPACK @cjpeg.lst, cjpeg.exe, , libjpeg.lib, ;
+	del cjpeg.lst
+
+djpeg.exe: $(DOBJECTS) libjpeg.lib
+	echo $(DOBJECTS) >djpeg.lst
+	link /STACK:4096 /EXEPACK @djpeg.lst, djpeg.exe, , libjpeg.lib, ;
+	del djpeg.lst
+
+jpegtran.exe: $(TROBJECTS) libjpeg.lib
+	link /STACK:4096 /EXEPACK $(TROBJECTS), jpegtran.exe, , libjpeg.lib, ;
+
+rdjpgcom.exe: rdjpgcom.c
+	$(CC) -AS -O -W3 rdjpgcom.c
+
+# wrjpgcom needs large model so it can malloc a 64K chunk
+wrjpgcom.exe: wrjpgcom.c
+	$(CC) -AL -O -W3 wrjpgcom.c
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+clean:
+	del *.obj
+	del libjpeg.lib
+	del cjpeg.exe
+	del djpeg.exe
+	del jpegtran.exe
+	del rdjpgcom.exe
+	del wrjpgcom.exe
+	del testout*.*
+
+test: cjpeg.exe djpeg.exe jpegtran.exe
+	del testout*.*
+	djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	jpegtran -outfile testoutt.jpg testprog.jpg
+	fc /b testimg.ppm testout.ppm
+	fc /b testimg.bmp testout.bmp
+	fc /b testimg.jpg testout.jpg
+	fc /b testimg.ppm testoutp.ppm
+	fc /b testimgp.jpg testoutp.jpg
+	fc /b testorig.jpg testoutt.jpg
+
+
+jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.obj: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.obj: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.obj: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.obj: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.obj: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.obj: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.obj: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.obj: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.obj: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.obj: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.obj: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.obj: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.obj: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.obj: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.obj: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.obj: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.obj: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.obj: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.obj: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.obj: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.obj: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.obj: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.obj: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.obj: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.obj: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+jmemdosa.obj : jmemdosa.asm
+	masm /mx $*;

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.mms
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.mms	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.mms	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,218 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is for use with MMS on Digital VMS systems.
+# Thanks to Rick Dyson (dyson at iowasp.physics.uiowa.edu)
+# and Tim Bell (tbell at netcom.com) for their help.
+
+# Read installation instructions before saying "MMS" !!
+
+# You may need to adjust these cc options:
+CFLAGS= $(CFLAGS) /NoDebug /Optimize
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via /Define switches here.
+.ifdef ALPHA
+OPT=
+.else
+OPT= ,Sys$Disk:[]MAKVMS.OPT/Option
+.endif
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For Unix this is usually jmemnobs.o, but you may want
+# to use jmemansi.o or jmemname.o if you have limited swap space.
+SYSDEPMEM= jmemnobs.obj
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj \
+        jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \
+        jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \
+        jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj
+# decompression library object files
+DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj \
+        jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj \
+        jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \
+        jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \
+        jquant1.obj jquant2.obj jdmerge.obj
+# These objectfiles are included in libjpeg.olb
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj \
+        rdswitch.obj cdjpeg.obj
+DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj \
+        rdcolmap.obj cdjpeg.obj
+TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj
+# objectfile lists with commas --- what a crock
+COBJLIST= cjpeg.obj,rdppm.obj,rdgif.obj,rdtarga.obj,rdrle.obj,rdbmp.obj,\
+          rdswitch.obj,cdjpeg.obj
+DOBJLIST= djpeg.obj,wrppm.obj,wrgif.obj,wrtarga.obj,wrrle.obj,wrbmp.obj,\
+          rdcolmap.obj,cdjpeg.obj
+TROBJLIST= jpegtran.obj,rdswitch.obj,cdjpeg.obj,transupp.obj
+LIBOBJLIST= jcapimin.obj,jcapistd.obj,jctrans.obj,jcparam.obj,jdatadst.obj,\
+          jcinit.obj,jcmaster.obj,jcmarker.obj,jcmainct.obj,jcprepct.obj,\
+          jccoefct.obj,jccolor.obj,jcsample.obj,jchuff.obj,jcphuff.obj,\
+          jcdctmgr.obj,jfdctfst.obj,jfdctflt.obj,jfdctint.obj,jdapimin.obj,\
+          jdapistd.obj,jdtrans.obj,jdatasrc.obj,jdmaster.obj,jdinput.obj,\
+          jdmarker.obj,jdhuff.obj,jdphuff.obj,jdmainct.obj,jdcoefct.obj,\
+          jdpostct.obj,jddctmgr.obj,jidctfst.obj,jidctflt.obj,jidctint.obj,\
+          jidctred.obj,jdsample.obj,jdcolor.obj,jquant1.obj,jquant2.obj,\
+          jdmerge.obj,jcomapi.obj,jutils.obj,jerror.obj,jmemmgr.obj,$(SYSDEPMEM)
+
+
+.first
+	@- Define /NoLog Sys Sys$Library
+
+ALL : libjpeg.olb cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe
+	@ Continue
+
+libjpeg.olb : $(LIBOBJECTS)
+	Library /Create libjpeg.olb $(LIBOBJLIST)
+
+cjpeg.exe : $(COBJECTS) libjpeg.olb
+	$(LINK) $(LFLAGS) /Executable = cjpeg.exe $(COBJLIST),libjpeg.olb/Library$(OPT)
+
+djpeg.exe : $(DOBJECTS) libjpeg.olb
+	$(LINK) $(LFLAGS) /Executable = djpeg.exe $(DOBJLIST),libjpeg.olb/Library$(OPT)
+
+jpegtran.exe : $(TROBJECTS) libjpeg.olb
+	$(LINK) $(LFLAGS) /Executable = jpegtran.exe $(TROBJLIST),libjpeg.olb/Library$(OPT)
+
+rdjpgcom.exe : rdjpgcom.obj
+	$(LINK) $(LFLAGS) /Executable = rdjpgcom.exe rdjpgcom.obj$(OPT)
+
+wrjpgcom.exe : wrjpgcom.obj
+	$(LINK) $(LFLAGS) /Executable = wrjpgcom.exe wrjpgcom.obj$(OPT)
+
+jconfig.h : jconfig.vms
+	@- Copy jconfig.vms jconfig.h
+
+clean :
+	@- Set Protection = Owner:RWED *.*;-1
+	@- Set Protection = Owner:RWED *.OBJ
+	- Purge /NoLog /NoConfirm *.*
+	- Delete /NoLog /NoConfirm *.OBJ;
+
+test : cjpeg.exe djpeg.exe jpegtran.exe
+	mcr sys$disk:[]djpeg -dct int -ppm -outfile testout.ppm testorig.jpg
+	mcr sys$disk:[]djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg
+	mcr sys$disk:[]cjpeg -dct int      -outfile testout.jpg testimg.ppm
+	mcr sys$disk:[]djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	mcr sys$disk:[]cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	mcr sys$disk:[]jpegtran -outfile testoutt.jpg testprog.jpg
+	- Backup /Compare/Log	  testimg.ppm testout.ppm
+	- Backup /Compare/Log	  testimg.bmp testout.bmp
+	- Backup /Compare/Log	  testimg.jpg testout.jpg
+	- Backup /Compare/Log	  testimg.ppm testoutp.ppm
+	- Backup /Compare/Log	  testimgp.jpg testoutp.jpg
+	- Backup /Compare/Log	  testorig.jpg testoutt.jpg
+
+
+jcapimin.obj : jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.obj : jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.obj : jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.obj : jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.obj : jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.obj : jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.obj : jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.obj : jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.obj : jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.obj : jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.obj : jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.obj : jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.obj : jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.obj : jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.obj : jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.obj : jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.obj : jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.obj : jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.obj : jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.obj : jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.obj : jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.obj : jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.obj : jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.obj : jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.obj : jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.obj : jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.obj : jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.obj : jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.obj : jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.obj : jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.obj : jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.obj : jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.obj : jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.obj : jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.obj : jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.obj : jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.obj : jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.obj : jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.obj : jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.obj : jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.obj : jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.obj : jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.obj : jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.obj : jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.obj : jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.obj : cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.obj : djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.obj : jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.obj : rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.obj : wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.obj : cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.obj : rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.obj : rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.obj : transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.obj : rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.obj : wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.obj : rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.obj : wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.obj : rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.obj : wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.obj : rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.obj : wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.obj : rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.obj : wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.sas
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.sas	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.sas	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,252 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is for Amiga systems using SAS C 6.0 and up.
+# Thanks to Ed Hanway, Mark Rinfret, and Jim Zepeda.
+
+# Read installation instructions before saying "make" !!
+
+# The name of your C compiler:
+CC= sc
+
+# You may need to adjust these cc options:
+# Uncomment the following lines for generic 680x0 version
+ARCHFLAGS= cpu=any
+SUFFIX=
+
+# Uncomment the following lines for 68030-only version
+#ARCHFLAGS= cpu=68030
+#SUFFIX=.030
+
+CFLAGS= nostackcheck data=near parms=register optimize $(ARCHFLAGS) \
+	ignore=104 ignore=304 ignore=306
+# ignore=104 disables warnings for mismatched const qualifiers
+# ignore=304 disables warnings for variables being optimized out
+# ignore=306 disables warnings for the inlining of functions
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via define switches here.
+
+# Link-time cc options:
+LDFLAGS= SC SD ND BATCH
+
+# To link any special libraries, add the necessary commands here.
+LDLIBS= LIB:scm.lib LIB:sc.lib
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For Amiga we recommend jmemname.o.
+SYSDEPMEM= jmemname.o
+
+# miscellaneous OS-dependent stuff
+# linker
+LN= slink
+# file deletion command
+RM= delete quiet
+# library (.lib) file creation command
+AR= oml
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \
+        jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \
+        jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \
+        jfdctint.o
+# decompression library object files
+DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \
+        jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \
+        jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \
+        jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o
+# These objectfiles are included in libjpeg.lib
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \
+        cdjpeg.o
+DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \
+        cdjpeg.o
+TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o
+
+
+all: libjpeg.lib cjpeg$(SUFFIX) djpeg$(SUFFIX) jpegtran$(SUFFIX) rdjpgcom$(SUFFIX) wrjpgcom$(SUFFIX)
+
+# note: do several AR steps to avoid command line length limitations
+
+libjpeg.lib: $(LIBOBJECTS)
+	-$(RM) libjpeg.lib
+	$(AR) libjpeg.lib r $(CLIBOBJECTS)
+	$(AR) libjpeg.lib r $(DLIBOBJECTS)
+	$(AR) libjpeg.lib r $(COMOBJECTS)
+
+cjpeg$(SUFFIX): $(COBJECTS) libjpeg.lib
+	$(LN) <WITH <
+$(LDFLAGS)
+TO cjpeg$(SUFFIX)
+FROM LIB:c.o $(COBJECTS)
+LIB libjpeg.lib $(LDLIBS)
+<
+
+djpeg$(SUFFIX): $(DOBJECTS) libjpeg.lib
+	$(LN) <WITH <
+$(LDFLAGS)
+TO djpeg$(SUFFIX)
+FROM LIB:c.o $(DOBJECTS)
+LIB libjpeg.lib $(LDLIBS)
+<
+
+jpegtran$(SUFFIX): $(TROBJECTS) libjpeg.lib
+	$(LN) <WITH <
+$(LDFLAGS)
+TO jpegtran$(SUFFIX)
+FROM LIB:c.o $(TROBJECTS)
+LIB libjpeg.lib $(LDLIBS)
+<
+
+rdjpgcom$(SUFFIX): rdjpgcom.o
+	$(LN) <WITH <
+$(LDFLAGS)
+TO rdjpgcom$(SUFFIX)
+FROM LIB:c.o rdjpgcom.o
+LIB $(LDLIBS)
+<
+
+wrjpgcom$(SUFFIX): wrjpgcom.o
+	$(LN) <WITH <
+$(LDFLAGS)
+TO wrjpgcom$(SUFFIX)
+FROM LIB:c.o wrjpgcom.o
+LIB $(LDLIBS)
+<
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+clean:
+	-$(RM) *.o cjpeg djpeg jpegtran cjpeg.030 djpeg.030 jpegtran.030
+	-$(RM) rdjpgcom wrjpgcom rdjpgcom.030 wrjpgcom.030
+	-$(RM) libjpeg.lib core testout*.*
+
+test: cjpeg djpeg jpegtran
+	-$(RM) testout*.*
+	djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	jpegtran -outfile testoutt.jpg testprog.jpg
+	cmp testimg.ppm testout.ppm
+	cmp testimg.bmp testout.bmp
+	cmp testimg.jpg testout.jpg
+	cmp testimg.ppm testoutp.ppm
+	cmp testimgp.jpg testoutp.jpg
+	cmp testorig.jpg testoutt.jpg
+
+
+jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.unix
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.unix	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.unix	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,228 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is suitable for Unix-like systems with non-ANSI compilers.
+# If you have an ANSI compiler, makefile.ansi is a better starting point.
+
+# Read installation instructions before saying "make" !!
+
+# The name of your C compiler:
+CC= cc
+
+# You may need to adjust these cc options:
+CFLAGS= -O
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+# However, any special defines for ansi2knr.c may be included here:
+ANSI2KNRFLAGS= 
+
+# Link-time cc options:
+LDFLAGS= 
+
+# To link any special libraries, add the necessary -l commands here.
+LDLIBS= 
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For Unix this is usually jmemnobs.o, but you may want
+# to use jmemansi.o or jmemname.o if you have limited swap space.
+SYSDEPMEM= jmemnobs.o
+
+# miscellaneous OS-dependent stuff
+# linker
+LN= $(CC)
+# file deletion command
+RM= rm -f
+# file rename command
+MV= mv
+# library (.a) file creation command
+AR= ar rc
+# second step in .a creation (use "touch" if not needed)
+AR2= ranlib
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \
+        jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \
+        jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \
+        jfdctint.o
+# decompression library object files
+DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \
+        jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \
+        jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \
+        jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o
+# These objectfiles are included in libjpeg.a
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \
+        cdjpeg.o
+DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \
+        cdjpeg.o
+TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o
+
+
+all: ansi2knr libjpeg.a cjpeg djpeg jpegtran rdjpgcom wrjpgcom
+
+# This rule causes ansi2knr to be invoked.
+.c.o:
+	./ansi2knr $*.c T$*.c
+	$(CC) $(CFLAGS) -c T$*.c
+	$(RM) T$*.c $*.o
+	$(MV) T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+libjpeg.a: ansi2knr $(LIBOBJECTS)
+	$(RM) libjpeg.a
+	$(AR) libjpeg.a  $(LIBOBJECTS)
+	$(AR2) libjpeg.a
+
+cjpeg: ansi2knr $(COBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.a $(LDLIBS)
+
+djpeg: ansi2knr $(DOBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.a $(LDLIBS)
+
+jpegtran: ansi2knr $(TROBJECTS) libjpeg.a
+	$(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.a $(LDLIBS)
+
+rdjpgcom: rdjpgcom.o
+	$(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.o $(LDLIBS)
+
+wrjpgcom: wrjpgcom.o
+	$(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS)
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+clean:
+	$(RM) *.o cjpeg djpeg jpegtran libjpeg.a rdjpgcom wrjpgcom
+	$(RM) ansi2knr core testout*
+
+test: cjpeg djpeg jpegtran
+	$(RM) testout*
+	./djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	./djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	./cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	./djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	./cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	./jpegtran -outfile testoutt.jpg testprog.jpg
+	cmp testimg.ppm testout.ppm
+	cmp testimg.bmp testout.bmp
+	cmp testimg.jpg testout.jpg
+	cmp testimg.ppm testoutp.ppm
+	cmp testimgp.jpg testoutp.jpg
+	cmp testorig.jpg testoutt.jpg
+
+
+jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.vc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.vc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.vc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,211 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is for Microsoft Visual C++ on Windows NT (and 95?).
+# It builds the IJG library as a statically linkable library (.LIB),
+# and builds the sample applications as console-mode apps.
+# Thanks to Xingong Chang, Raymond Everly and others.
+
+# Read installation instructions before saying "nmake" !!
+# To build an optimized library without debug info, say "nmake nodebug=1".
+
+# Pull in standard variable definitions
+!include <win32.mak>
+
+# You may want to adjust these compiler options:
+CFLAGS= $(cflags) $(cdebug) $(cvars) -I.
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+
+# Link-time options:
+LDFLAGS= $(ldebug) $(conlflags)
+
+# To link any special libraries, add the necessary commands here.
+LDLIBS= $(conlibs)
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  For NT we suggest jmemnobs.obj, which expects the OS to
+# provide adequate virtual memory.
+SYSDEPMEM= jmemnobs.obj
+
+# miscellaneous OS-dependent stuff
+# file deletion command
+RM= del
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj \
+        jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \
+        jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \
+        jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj
+# decompression library object files
+DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj \
+        jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj \
+        jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \
+        jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \
+        jquant1.obj jquant2.obj jdmerge.obj
+# These objectfiles are included in libjpeg.lib
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj \
+        rdswitch.obj cdjpeg.obj
+DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj \
+        rdcolmap.obj cdjpeg.obj
+TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj
+
+# Template command for compiling .c to .obj
+.c.obj:
+	$(cc) $(CFLAGS) $*.c
+
+
+all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe
+
+libjpeg.lib: $(LIBOBJECTS)
+	$(RM) libjpeg.lib
+	lib -out:libjpeg.lib  $(LIBOBJECTS)
+
+cjpeg.exe: $(COBJECTS) libjpeg.lib
+	$(link) $(LDFLAGS) -out:cjpeg.exe $(COBJECTS) libjpeg.lib $(LDLIBS)
+
+djpeg.exe: $(DOBJECTS) libjpeg.lib
+	$(link) $(LDFLAGS) -out:djpeg.exe $(DOBJECTS) libjpeg.lib $(LDLIBS)
+
+jpegtran.exe: $(TROBJECTS) libjpeg.lib
+	$(link) $(LDFLAGS) -out:jpegtran.exe $(TROBJECTS) libjpeg.lib $(LDLIBS)
+
+rdjpgcom.exe: rdjpgcom.obj
+	$(link) $(LDFLAGS) -out:rdjpgcom.exe rdjpgcom.obj $(LDLIBS)
+
+wrjpgcom.exe: wrjpgcom.obj
+	$(link) $(LDFLAGS) -out:wrjpgcom.exe wrjpgcom.obj $(LDLIBS)
+
+
+clean:
+	$(RM) *.obj *.exe libjpeg.lib
+	$(RM) testout*
+
+test: cjpeg.exe djpeg.exe jpegtran.exe
+	$(RM) testout*
+	.\djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	.\djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	.\cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	.\djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	.\cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	.\jpegtran -outfile testoutt.jpg testprog.jpg
+	fc /b testimg.ppm testout.ppm
+	fc /b testimg.bmp testout.bmp
+	fc /b testimg.jpg testout.jpg
+	fc /b testimg.ppm testoutp.ppm
+	fc /b testimgp.jpg testoutp.jpg
+	fc /b testorig.jpg testoutt.jpg
+
+
+jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.obj: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.obj: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.obj: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.obj: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.obj: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.obj: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.obj: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.obj: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.obj: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.obj: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.obj: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.obj: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.obj: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.obj: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.obj: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.obj: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.obj: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.obj: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.obj: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.obj: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.obj: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.obj: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.obj: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.obj: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.obj: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.vms
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.vms	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.vms	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,142 @@
+$! Makefile for Independent JPEG Group's software
+$!
+$! This is a command procedure for Digital VMS systems that do not have MMS.
+$! It builds the JPEG software by brute force, recompiling everything whether
+$! or not it is necessary.  It then runs the basic self-test.
+$! Thanks to Rick Dyson (dyson at iowasp.physics.uiowa.edu)
+$! and Tim Bell (tbell at netcom.com) for their help.
+$!
+$! Read installation instructions before running this!!
+$!
+$ If F$Mode () .eqs. "INTERACTIVE"
+$   Then
+$       VERIFY = F$Verify (0)
+$   Else
+$       VERIFY = F$Verify (1)
+$ EndIf
+$ On Control_Y Then GoTo End
+$ On Error     Then GoTo End
+$
+$ If F$GetSyi ("HW_MODEL") .gt. 1023 
+$   Then
+$       OPT = ""
+$   Else
+$       OPT = ",Sys$Disk:[]makvms.opt/Option"
+$ EndIf
+$ 
+$ DoCompile := CC /NoDebug /Optimize /NoList
+$!
+$ DoCompile jcapimin.c
+$ DoCompile jcapistd.c
+$ DoCompile jctrans.c
+$ DoCompile jcparam.c
+$ DoCompile jdatadst.c
+$ DoCompile jcinit.c
+$ DoCompile jcmaster.c
+$ DoCompile jcmarker.c
+$ DoCompile jcmainct.c
+$ DoCompile jcprepct.c
+$ DoCompile jccoefct.c
+$ DoCompile jccolor.c
+$ DoCompile jcsample.c
+$ DoCompile jchuff.c
+$ DoCompile jcphuff.c
+$ DoCompile jcdctmgr.c
+$ DoCompile jfdctfst.c
+$ DoCompile jfdctflt.c
+$ DoCompile jfdctint.c
+$ DoCompile jdapimin.c
+$ DoCompile jdapistd.c
+$ DoCompile jdtrans.c
+$ DoCompile jdatasrc.c
+$ DoCompile jdmaster.c
+$ DoCompile jdinput.c
+$ DoCompile jdmarker.c
+$ DoCompile jdhuff.c
+$ DoCompile jdphuff.c
+$ DoCompile jdmainct.c
+$ DoCompile jdcoefct.c
+$ DoCompile jdpostct.c
+$ DoCompile jddctmgr.c
+$ DoCompile jidctfst.c
+$ DoCompile jidctflt.c
+$ DoCompile jidctint.c
+$ DoCompile jidctred.c
+$ DoCompile jdsample.c
+$ DoCompile jdcolor.c
+$ DoCompile jquant1.c
+$ DoCompile jquant2.c
+$ DoCompile jdmerge.c
+$ DoCompile jcomapi.c
+$ DoCompile jutils.c
+$ DoCompile jerror.c
+$ DoCompile jmemmgr.c
+$ DoCompile jmemnobs.c
+$!
+$ Library /Create libjpeg.olb  jcapimin.obj,jcapistd.obj,jctrans.obj, -
+          jcparam.obj,jdatadst.obj,jcinit.obj,jcmaster.obj,jcmarker.obj, -
+          jcmainct.obj,jcprepct.obj,jccoefct.obj,jccolor.obj,jcsample.obj, -
+          jchuff.obj,jcphuff.obj,jcdctmgr.obj,jfdctfst.obj,jfdctflt.obj, -
+          jfdctint.obj,jdapimin.obj,jdapistd.obj,jdtrans.obj,jdatasrc.obj, -
+          jdmaster.obj,jdinput.obj,jdmarker.obj,jdhuff.obj,jdphuff.obj, -
+          jdmainct.obj,jdcoefct.obj,jdpostct.obj,jddctmgr.obj,jidctfst.obj, -
+          jidctflt.obj,jidctint.obj,jidctred.obj,jdsample.obj,jdcolor.obj, -
+          jquant1.obj,jquant2.obj,jdmerge.obj,jcomapi.obj,jutils.obj, -
+          jerror.obj,jmemmgr.obj,jmemnobs.obj
+$!
+$ DoCompile cjpeg.c
+$ DoCompile rdppm.c
+$ DoCompile rdgif.c
+$ DoCompile rdtarga.c
+$ DoCompile rdrle.c
+$ DoCompile rdbmp.c
+$ DoCompile rdswitch.c
+$ DoCompile cdjpeg.c
+$!
+$ Link /NoMap /Executable = cjpeg.exe  cjpeg.obj,rdppm.obj,rdgif.obj, -
+          rdtarga.obj,rdrle.obj,rdbmp.obj,rdswitch.obj,cdjpeg.obj,libjpeg.olb/Library'OPT'
+$!
+$ DoCompile djpeg.c
+$ DoCompile wrppm.c
+$ DoCompile wrgif.c
+$ DoCompile wrtarga.c
+$ DoCompile wrrle.c
+$ DoCompile wrbmp.c
+$ DoCompile rdcolmap.c
+$ DoCompile cdjpeg.c
+$!
+$ Link /NoMap /Executable = djpeg.exe  djpeg.obj,wrppm.obj,wrgif.obj, -
+          wrtarga.obj,wrrle.obj,wrbmp.obj,rdcolmap.obj,cdjpeg.obj,libjpeg.olb/Library'OPT'
+$!
+$ DoCompile jpegtran.c
+$ DoCompile rdswitch.c
+$ DoCompile cdjpeg.c
+$ DoCompile transupp.c
+$!
+$ Link /NoMap /Executable = jpegtran.exe  jpegtran.obj,rdswitch.obj, -
+          cdjpeg.obj,transupp.obj,libjpeg.olb/Library'OPT'
+$!
+$ DoCompile rdjpgcom.c
+$ Link /NoMap /Executable = rdjpgcom.exe  rdjpgcom.obj'OPT'
+$!
+$ DoCompile wrjpgcom.c
+$ Link /NoMap /Executable = wrjpgcom.exe  wrjpgcom.obj'OPT'
+$!
+$! Run the self-test
+$!
+$ mcr sys$disk:[]djpeg -dct int -ppm -outfile testout.ppm testorig.jpg
+$ mcr sys$disk:[]djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg
+$ mcr sys$disk:[]cjpeg -dct int      -outfile testout.jpg testimg.ppm
+$ mcr sys$disk:[]djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+$ mcr sys$disk:[]cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+$ mcr sys$disk:[]jpegtran -outfile testoutt.jpg testprog.jpg
+$ Backup /Compare/Log testimg.ppm testout.ppm
+$ Backup /Compare/Log testimg.bmp testout.bmp
+$ Backup /Compare/Log testimg.jpg testout.jpg
+$ Backup /Compare/Log testimg.ppm testoutp.ppm
+$ Backup /Compare/Log testimgp.jpg testoutp.jpg
+$ Backup /Compare/Log testorig.jpg testoutt.jpg
+$!
+$End:
+$   If Verify Then Set Verify
+$ Exit

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.wat
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.wat	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makefile.wat	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,233 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is suitable for Watcom C/C++ 10.0 on MS-DOS (using
+# dos4g extender), OS/2, and Windows NT console mode.
+# Thanks to Janos Haide, jhaide at btrvtech.com.
+
+# Read installation instructions before saying "wmake" !!
+
+# Uncomment line for desired system
+SYSTEM=DOS
+#SYSTEM=OS2
+#SYSTEM=NT
+
+# The name of your C compiler:
+CC= wcl386
+
+# You may need to adjust these cc options:
+CFLAGS= -4r -ort -wx -zq -bt=$(SYSTEM)
+# Caution: avoid -ol or -ox; these generate bad code with 10.0 or 10.0a.
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+
+# Link-time cc options:
+!ifeq SYSTEM DOS
+LDFLAGS= -zq -l=dos4g
+!else ifeq SYSTEM OS2
+LDFLAGS= -zq -l=os2v2
+!else ifeq SYSTEM NT
+LDFLAGS= -zq -l=nt
+!endif
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  jmemnobs should work fine for dos4g or OS/2 environment.
+SYSDEPMEM= jmemnobs.obj
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c &
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c &
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c &
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c &
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c &
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c &
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c &
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c &
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c &
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h &
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 &
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc &
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc &
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds &
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st &
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms &
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat &
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas &
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg &
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) &
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj &
+        jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj &
+        jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj &
+        jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj
+# decompression library object files
+DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj &
+        jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj &
+        jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj &
+        jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj &
+        jquant1.obj jquant2.obj jdmerge.obj
+# These objectfiles are included in libjpeg.lib
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj &
+        rdswitch.obj cdjpeg.obj
+DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj &
+        rdcolmap.obj cdjpeg.obj
+TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj
+
+
+all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe
+
+libjpeg.lib: $(LIBOBJECTS)
+	- del libjpeg.lib
+	* wlib -n libjpeg.lib $(LIBOBJECTS)
+
+cjpeg.exe: $(COBJECTS) libjpeg.lib
+	$(CC) $(LDFLAGS) $(COBJECTS) libjpeg.lib
+
+djpeg.exe: $(DOBJECTS) libjpeg.lib
+	$(CC) $(LDFLAGS) $(DOBJECTS) libjpeg.lib
+
+jpegtran.exe: $(TROBJECTS) libjpeg.lib
+	$(CC) $(LDFLAGS) $(TROBJECTS) libjpeg.lib
+
+rdjpgcom.exe: rdjpgcom.c
+	$(CC) $(CFLAGS) $(LDFLAGS) rdjpgcom.c
+
+wrjpgcom.exe: wrjpgcom.c
+	$(CC) $(CFLAGS) $(LDFLAGS) wrjpgcom.c
+
+.c.obj:
+	$(CC) $(CFLAGS) -c $<
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+clean: .SYMBOLIC
+	- del *.obj
+	- del libjpeg.lib
+	- del cjpeg.exe
+	- del djpeg.exe
+	- del jpegtran.exe
+	- del rdjpgcom.exe
+	- del wrjpgcom.exe
+	- del testout*.*
+
+test: cjpeg.exe djpeg.exe jpegtran.exe  .SYMBOLIC
+	- del testout*.*
+	djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	jpegtran -outfile testoutt.jpg testprog.jpg
+!ifeq SYSTEM DOS
+	fc /b testimg.ppm testout.ppm
+	fc /b testimg.bmp testout.bmp
+	fc /b testimg.jpg testout.jpg
+	fc /b testimg.ppm testoutp.ppm
+	fc /b testimgp.jpg testoutp.jpg
+	fc /b testorig.jpg testoutt.jpg
+!else
+	echo n > n.tmp
+	comp testimg.ppm testout.ppm < n.tmp
+	comp testimg.bmp testout.bmp < n.tmp
+	comp testimg.jpg testout.jpg < n.tmp
+	comp testimg.ppm testoutp.ppm < n.tmp
+	comp testimgp.jpg testoutp.jpg < n.tmp
+	comp testorig.jpg testoutt.jpg < n.tmp
+	del n.tmp
+!endif
+
+
+jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.obj: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.obj: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.obj: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.obj: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.obj: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.obj: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.obj: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.obj: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.obj: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.obj: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.obj: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.obj: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.obj: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.obj: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.obj: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.obj: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.obj: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.obj: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.obj: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.obj: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.obj: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.obj: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.obj: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.obj: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.obj: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makelib.ds
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makelib.ds	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makelib.ds	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1046 @@
+# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+!IF "$(CFG)" == ""
+CFG=jpeg - Win32
+!MESSAGE No configuration specified.  Defaulting to jpeg - Win32.
+!ENDIF 
+
+!IF "$(CFG)" != "jpeg - Win32"
+!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 "jpeg.mak" CFG="jpeg - Win32"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jpeg - Win32" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE 
+NULL=nul
+!ENDIF 
+################################################################################
+# Begin Project
+# PROP Target_Last_Scanned "jpeg - Win32"
+CPP=cl.exe
+
+!IF  "$(CFG)" == "jpeg - Win32"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+OUTDIR=.\Release
+INTDIR=.\Release
+
+ALL : "$(OUTDIR)\jpeg.lib"
+
+CLEAN : 
+	- at erase "$(INTDIR)\jcapimin.obj"
+	- at erase "$(INTDIR)\jcapistd.obj"
+	- at erase "$(INTDIR)\jctrans.obj"
+	- at erase "$(INTDIR)\jcparam.obj"
+	- at erase "$(INTDIR)\jdatadst.obj"
+	- at erase "$(INTDIR)\jcinit.obj"
+	- at erase "$(INTDIR)\jcmaster.obj"
+	- at erase "$(INTDIR)\jcmarker.obj"
+	- at erase "$(INTDIR)\jcmainct.obj"
+	- at erase "$(INTDIR)\jcprepct.obj"
+	- at erase "$(INTDIR)\jccoefct.obj"
+	- at erase "$(INTDIR)\jccolor.obj"
+	- at erase "$(INTDIR)\jcsample.obj"
+	- at erase "$(INTDIR)\jchuff.obj"
+	- at erase "$(INTDIR)\jcphuff.obj"
+	- at erase "$(INTDIR)\jcdctmgr.obj"
+	- at erase "$(INTDIR)\jfdctfst.obj"
+	- at erase "$(INTDIR)\jfdctflt.obj"
+	- at erase "$(INTDIR)\jfdctint.obj"
+	- at erase "$(INTDIR)\jdapimin.obj"
+	- at erase "$(INTDIR)\jdapistd.obj"
+	- at erase "$(INTDIR)\jdtrans.obj"
+	- at erase "$(INTDIR)\jdatasrc.obj"
+	- at erase "$(INTDIR)\jdmaster.obj"
+	- at erase "$(INTDIR)\jdinput.obj"
+	- at erase "$(INTDIR)\jdmarker.obj"
+	- at erase "$(INTDIR)\jdhuff.obj"
+	- at erase "$(INTDIR)\jdphuff.obj"
+	- at erase "$(INTDIR)\jdmainct.obj"
+	- at erase "$(INTDIR)\jdcoefct.obj"
+	- at erase "$(INTDIR)\jdpostct.obj"
+	- at erase "$(INTDIR)\jddctmgr.obj"
+	- at erase "$(INTDIR)\jidctfst.obj"
+	- at erase "$(INTDIR)\jidctflt.obj"
+	- at erase "$(INTDIR)\jidctint.obj"
+	- at erase "$(INTDIR)\jidctred.obj"
+	- at erase "$(INTDIR)\jdsample.obj"
+	- at erase "$(INTDIR)\jdcolor.obj"
+	- at erase "$(INTDIR)\jquant1.obj"
+	- at erase "$(INTDIR)\jquant2.obj"
+	- at erase "$(INTDIR)\jdmerge.obj"
+	- at erase "$(INTDIR)\jcomapi.obj"
+	- at erase "$(INTDIR)\jutils.obj"
+	- at erase "$(INTDIR)\jerror.obj"
+	- at erase "$(INTDIR)\jmemmgr.obj"
+	- at erase "$(INTDIR)\jmemnobs.obj"
+	- at erase "$(OUTDIR)\jpeg.lib"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
+ /Fp"$(INTDIR)/jpeg.pch" /YX /Fo"$(INTDIR)/" /c 
+CPP_OBJS=.\Release/
+CPP_SBRS=.\.
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/jpeg.bsc" 
+BSC32_SBRS= \
+	
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+LIB32_FLAGS=/nologo /out:"$(OUTDIR)/jpeg.lib" 
+LIB32_OBJS= \
+	"$(INTDIR)\jcapimin.obj" \
+	"$(INTDIR)\jcapistd.obj" \
+	"$(INTDIR)\jctrans.obj" \
+	"$(INTDIR)\jcparam.obj" \
+	"$(INTDIR)\jdatadst.obj" \
+	"$(INTDIR)\jcinit.obj" \
+	"$(INTDIR)\jcmaster.obj" \
+	"$(INTDIR)\jcmarker.obj" \
+	"$(INTDIR)\jcmainct.obj" \
+	"$(INTDIR)\jcprepct.obj" \
+	"$(INTDIR)\jccoefct.obj" \
+	"$(INTDIR)\jccolor.obj" \
+	"$(INTDIR)\jcsample.obj" \
+	"$(INTDIR)\jchuff.obj" \
+	"$(INTDIR)\jcphuff.obj" \
+	"$(INTDIR)\jcdctmgr.obj" \
+	"$(INTDIR)\jfdctfst.obj" \
+	"$(INTDIR)\jfdctflt.obj" \
+	"$(INTDIR)\jfdctint.obj" \
+	"$(INTDIR)\jdapimin.obj" \
+	"$(INTDIR)\jdapistd.obj" \
+	"$(INTDIR)\jdtrans.obj" \
+	"$(INTDIR)\jdatasrc.obj" \
+	"$(INTDIR)\jdmaster.obj" \
+	"$(INTDIR)\jdinput.obj" \
+	"$(INTDIR)\jdmarker.obj" \
+	"$(INTDIR)\jdhuff.obj" \
+	"$(INTDIR)\jdphuff.obj" \
+	"$(INTDIR)\jdmainct.obj" \
+	"$(INTDIR)\jdcoefct.obj" \
+	"$(INTDIR)\jdpostct.obj" \
+	"$(INTDIR)\jddctmgr.obj" \
+	"$(INTDIR)\jidctfst.obj" \
+	"$(INTDIR)\jidctflt.obj" \
+	"$(INTDIR)\jidctint.obj" \
+	"$(INTDIR)\jidctred.obj" \
+	"$(INTDIR)\jdsample.obj" \
+	"$(INTDIR)\jdcolor.obj" \
+	"$(INTDIR)\jquant1.obj" \
+	"$(INTDIR)\jquant2.obj" \
+	"$(INTDIR)\jdmerge.obj" \
+	"$(INTDIR)\jcomapi.obj" \
+	"$(INTDIR)\jutils.obj" \
+	"$(INTDIR)\jerror.obj" \
+	"$(INTDIR)\jmemmgr.obj" \
+	"$(INTDIR)\jmemnobs.obj"
+
+"$(OUTDIR)\jpeg.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) $<  
+
+.c{$(CPP_SBRS)}.sbr:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cpp{$(CPP_SBRS)}.sbr:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cxx{$(CPP_SBRS)}.sbr:
+   $(CPP) $(CPP_PROJ) $<  
+
+################################################################################
+# Begin Target
+
+# Name "jpeg - Win32"
+
+!IF  "$(CFG)" == "jpeg - Win32"
+
+!ENDIF 
+
+################################################################################
+# Begin Source File
+
+SOURCE="jcapimin.c"
+DEP_CPP_JCAPI=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcapimin.obj" : $(SOURCE) $(DEP_CPP_JCAPI) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcapistd.c"
+DEP_CPP_JCAPIS=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcapistd.obj" : $(SOURCE) $(DEP_CPP_JCAPIS) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jccoefct.c"
+DEP_CPP_JCCOE=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jccoefct.obj" : $(SOURCE) $(DEP_CPP_JCCOE) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jccolor.c"
+DEP_CPP_JCCOL=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jccolor.obj" : $(SOURCE) $(DEP_CPP_JCCOL) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcdctmgr.c"
+DEP_CPP_JCDCT=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdct.h"\
+	
+
+"$(INTDIR)\jcdctmgr.obj" : $(SOURCE) $(DEP_CPP_JCDCT) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jchuff.c"
+DEP_CPP_JCHUF=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jchuff.h"\
+	
+
+"$(INTDIR)\jchuff.obj" : $(SOURCE) $(DEP_CPP_JCHUF) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcinit.c"
+DEP_CPP_JCINI=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcinit.obj" : $(SOURCE) $(DEP_CPP_JCINI) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcmainct.c"
+DEP_CPP_JCMAI=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcmainct.obj" : $(SOURCE) $(DEP_CPP_JCMAI) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcmarker.c"
+DEP_CPP_JCMAR=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcmarker.obj" : $(SOURCE) $(DEP_CPP_JCMAR) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcmaster.c"
+DEP_CPP_JCMAS=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcmaster.obj" : $(SOURCE) $(DEP_CPP_JCMAS) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcomapi.c"
+DEP_CPP_JCOMA=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcomapi.obj" : $(SOURCE) $(DEP_CPP_JCOMA) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcparam.c"
+DEP_CPP_JCPAR=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcparam.obj" : $(SOURCE) $(DEP_CPP_JCPAR) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcphuff.c"
+DEP_CPP_JCPHU=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jchuff.h"\
+	
+
+"$(INTDIR)\jcphuff.obj" : $(SOURCE) $(DEP_CPP_JCPHU) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcprepct.c"
+DEP_CPP_JCPRE=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcprepct.obj" : $(SOURCE) $(DEP_CPP_JCPRE) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jcsample.c"
+DEP_CPP_JCSAM=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jcsample.obj" : $(SOURCE) $(DEP_CPP_JCSAM) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jctrans.c"
+DEP_CPP_JCTRA=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jctrans.obj" : $(SOURCE) $(DEP_CPP_JCTRA) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdapimin.c"
+DEP_CPP_JDAPI=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdapimin.obj" : $(SOURCE) $(DEP_CPP_JDAPI) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdapistd.c"
+DEP_CPP_JDAPIS=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdapistd.obj" : $(SOURCE) $(DEP_CPP_JDAPIS) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdatadst.c"
+DEP_CPP_JDATA=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdatadst.obj" : $(SOURCE) $(DEP_CPP_JDATA) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdatasrc.c"
+DEP_CPP_JDATAS=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdatasrc.obj" : $(SOURCE) $(DEP_CPP_JDATAS) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdcoefct.c"
+DEP_CPP_JDCOE=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdcoefct.obj" : $(SOURCE) $(DEP_CPP_JDCOE) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdcolor.c"
+DEP_CPP_JDCOL=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdcolor.obj" : $(SOURCE) $(DEP_CPP_JDCOL) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jddctmgr.c"
+DEP_CPP_JDDCT=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdct.h"\
+	
+
+"$(INTDIR)\jddctmgr.obj" : $(SOURCE) $(DEP_CPP_JDDCT) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdhuff.c"
+DEP_CPP_JDHUF=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdhuff.h"\
+	
+
+"$(INTDIR)\jdhuff.obj" : $(SOURCE) $(DEP_CPP_JDHUF) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdinput.c"
+DEP_CPP_JDINP=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdinput.obj" : $(SOURCE) $(DEP_CPP_JDINP) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdmainct.c"
+DEP_CPP_JDMAI=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdmainct.obj" : $(SOURCE) $(DEP_CPP_JDMAI) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdmarker.c"
+DEP_CPP_JDMAR=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdmarker.obj" : $(SOURCE) $(DEP_CPP_JDMAR) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdmaster.c"
+DEP_CPP_JDMAS=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdmaster.obj" : $(SOURCE) $(DEP_CPP_JDMAS) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdmerge.c"
+DEP_CPP_JDMER=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdmerge.obj" : $(SOURCE) $(DEP_CPP_JDMER) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdphuff.c"
+DEP_CPP_JDPHU=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdhuff.h"\
+	
+
+"$(INTDIR)\jdphuff.obj" : $(SOURCE) $(DEP_CPP_JDPHU) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdpostct.c"
+DEP_CPP_JDPOS=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdpostct.obj" : $(SOURCE) $(DEP_CPP_JDPOS) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdsample.c"
+DEP_CPP_JDSAM=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdsample.obj" : $(SOURCE) $(DEP_CPP_JDSAM) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jdtrans.c"
+DEP_CPP_JDTRA=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jdtrans.obj" : $(SOURCE) $(DEP_CPP_JDTRA) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jerror.c"
+DEP_CPP_JERRO=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jversion.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jerror.obj" : $(SOURCE) $(DEP_CPP_JERRO) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jfdctflt.c"
+DEP_CPP_JFDCT=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdct.h"\
+	
+
+"$(INTDIR)\jfdctflt.obj" : $(SOURCE) $(DEP_CPP_JFDCT) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jfdctfst.c"
+DEP_CPP_JFDCTF=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdct.h"\
+	
+
+"$(INTDIR)\jfdctfst.obj" : $(SOURCE) $(DEP_CPP_JFDCTF) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jfdctint.c"
+DEP_CPP_JFDCTI=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdct.h"\
+	
+
+"$(INTDIR)\jfdctint.obj" : $(SOURCE) $(DEP_CPP_JFDCTI) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jidctflt.c"
+DEP_CPP_JIDCT=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdct.h"\
+	
+
+"$(INTDIR)\jidctflt.obj" : $(SOURCE) $(DEP_CPP_JIDCT) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jidctfst.c"
+DEP_CPP_JIDCTF=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdct.h"\
+	
+
+"$(INTDIR)\jidctfst.obj" : $(SOURCE) $(DEP_CPP_JIDCTF) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jidctint.c"
+DEP_CPP_JIDCTI=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdct.h"\
+	
+
+"$(INTDIR)\jidctint.obj" : $(SOURCE) $(DEP_CPP_JIDCTI) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jidctred.c"
+DEP_CPP_JIDCTR=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jdct.h"\
+	
+
+"$(INTDIR)\jidctred.obj" : $(SOURCE) $(DEP_CPP_JIDCTR) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jquant1.c"
+DEP_CPP_JQUAN=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jquant1.obj" : $(SOURCE) $(DEP_CPP_JQUAN) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jquant2.c"
+DEP_CPP_JQUANT=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jquant2.obj" : $(SOURCE) $(DEP_CPP_JQUANT) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jutils.c"
+DEP_CPP_JUTIL=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	
+
+"$(INTDIR)\jutils.obj" : $(SOURCE) $(DEP_CPP_JUTIL) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jmemmgr.c"
+DEP_CPP_JMEMM=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jmemsys.h"\
+	
+
+"$(INTDIR)\jmemmgr.obj" : $(SOURCE) $(DEP_CPP_JMEMM) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE="jmemnobs.c"
+DEP_CPP_JMEMN=\
+	"jinclude.h"\
+	"jconfig.h"\
+	"jpeglib.h"\
+	"jmorecfg.h"\
+	"jpegint.h"\
+	"jerror.h"\
+	"jmemsys.h"\
+	
+
+"$(INTDIR)\jmemnobs.obj" : $(SOURCE) $(DEP_CPP_JMEMN) "$(INTDIR)"
+   $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+# End Target
+# End Project
+################################################################################
+

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makeproj.mac
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makeproj.mac	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makeproj.mac	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,213 @@
+--
+-- makeproj.mac
+--
+-- This AppleScript builds Code Warrior PRO Release 2 project files for the
+-- libjpeg library as well as the test programs 'cjpeg', 'djpeg', 'jpegtran'.
+-- (We'd distribute real project files, except they're not text
+-- and would create maintenance headaches.)
+--
+-- The script then compiles and links the library and the test programs.
+-- NOTE: if you haven't already created a 'jconfig.h' file, the script
+-- automatically copies 'jconfig.mac' to 'jconfig.h'.
+--
+-- To use this script, you must have AppleScript 1.1 or later installed
+-- and a suitable AppleScript editor like Script Editor or Script Debugger
+-- (http://www.latenightsw.com). Open this file with your AppleScript
+-- editor and execute the "run" command to build the projects.
+--
+-- Thanks to Dan Sears and Don Agro for this script.
+-- Questions about this script can be addressed to dogpark at interlog.com
+--
+
+on run
+
+	choose folder with prompt ">>> Select IJG source folder <<<"
+	set ijg_folder to result
+
+	choose folder with prompt ">>> Select MetroWerks folder <<<"
+	set cw_folder to result
+
+	-- if jconfig.h doesn't already exist, copy jconfig.mac
+
+	tell application "Finder"
+		if not (exists file "jconfig.h" of ijg_folder) then
+			duplicate {file "jconfig.mac" of folder ijg_folder}
+			select file "jconfig.mac copy" of folder ijg_folder
+			set name of selection to "jconfig.h"
+		end if
+	end tell
+
+	tell application "CodeWarrior IDE 2.1"
+	  with timeout of 10000 seconds
+
+		-- create libjpeg project
+
+		activate
+		Create Project (ijg_folder as string) & "libjpeg.proj"
+		Set Preferences of panel "Target Settings" to {Target Name:"libjpeg"}
+		Set Preferences of panel "PPC Project" to {File Name:"libjpeg"}
+		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
+		Set Preferences of panel "PPC Project" to {Project Type:library}
+		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
+		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
+		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
+		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
+
+		Add Files (ijg_folder as string) & "jcapimin.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcapistd.c" To Segment 1
+		Add Files (ijg_folder as string) & "jctrans.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcparam.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdatadst.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcinit.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcmaster.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcmarker.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcmainct.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcprepct.c" To Segment 1
+		Add Files (ijg_folder as string) & "jccoefct.c" To Segment 1
+		Add Files (ijg_folder as string) & "jccolor.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcsample.c" To Segment 1
+		Add Files (ijg_folder as string) & "jchuff.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcphuff.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcdctmgr.c" To Segment 1
+		Add Files (ijg_folder as string) & "jfdctfst.c" To Segment 1
+		Add Files (ijg_folder as string) & "jfdctflt.c" To Segment 1
+		Add Files (ijg_folder as string) & "jfdctint.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdapimin.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdapistd.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdtrans.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdatasrc.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdmaster.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdinput.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdmarker.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdhuff.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdphuff.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdmainct.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdcoefct.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdpostct.c" To Segment 1
+		Add Files (ijg_folder as string) & "jddctmgr.c" To Segment 1
+		Add Files (ijg_folder as string) & "jidctfst.c" To Segment 1
+		Add Files (ijg_folder as string) & "jidctflt.c" To Segment 1
+		Add Files (ijg_folder as string) & "jidctint.c" To Segment 1
+		Add Files (ijg_folder as string) & "jidctred.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdsample.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdcolor.c" To Segment 1
+		Add Files (ijg_folder as string) & "jquant1.c" To Segment 1
+		Add Files (ijg_folder as string) & "jquant2.c" To Segment 1
+		Add Files (ijg_folder as string) & "jdmerge.c" To Segment 1
+		Add Files (ijg_folder as string) & "jcomapi.c" To Segment 1
+		Add Files (ijg_folder as string) & "jutils.c" To Segment 1
+		Add Files (ijg_folder as string) & "jerror.c" To Segment 1
+		Add Files (ijg_folder as string) & "jmemmgr.c" To Segment 1
+		Add Files (ijg_folder as string) & "jmemmac.c" To Segment 1
+
+		-- compile and link the library
+
+		Make Project
+		Close Project
+
+		-- create cjpeg project
+
+		activate
+		Create Project (ijg_folder as string) & "cjpeg.proj"
+		Set Preferences of panel "Target Settings" to {Target Name:"cjpeg"}
+		Set Preferences of panel "PPC Project" to {File Name:"cjpeg"}
+		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
+		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
+		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
+		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
+		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
+
+		Add Files (ijg_folder as string) & "cjpeg.c" To Segment 1
+		Add Files (ijg_folder as string) & "rdppm.c" To Segment 1
+		Add Files (ijg_folder as string) & "rdgif.c" To Segment 1
+		Add Files (ijg_folder as string) & "rdtarga.c" To Segment 1
+		Add Files (ijg_folder as string) & "rdrle.c" To Segment 1
+		Add Files (ijg_folder as string) & "rdbmp.c" To Segment 1
+		Add Files (ijg_folder as string) & "rdswitch.c" To Segment 1
+		Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1
+
+		Add Files (ijg_folder as string) & "libjpeg" To Segment 2
+
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3
+
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4
+
+		-- compile and link cjpeg
+
+		Make Project
+		Close Project
+
+		-- create djpeg project
+
+		activate
+		Create Project (ijg_folder as string) & "djpeg.proj"
+		Set Preferences of panel "Target Settings" to {Target Name:"djpeg"}
+		Set Preferences of panel "PPC Project" to {File Name:"djpeg"}
+		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
+		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
+		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
+		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
+		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
+
+		Add Files (ijg_folder as string) & "djpeg.c" To Segment 1
+		Add Files (ijg_folder as string) & "wrppm.c" To Segment 1
+		Add Files (ijg_folder as string) & "wrgif.c" To Segment 1
+		Add Files (ijg_folder as string) & "wrtarga.c" To Segment 1
+		Add Files (ijg_folder as string) & "wrrle.c" To Segment 1
+		Add Files (ijg_folder as string) & "wrbmp.c" To Segment 1
+		Add Files (ijg_folder as string) & "rdcolmap.c" To Segment 1
+		Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1
+
+		Add Files (ijg_folder as string) & "libjpeg" To Segment 2
+
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3
+
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4
+
+		-- compile and link djpeg
+
+		Make Project
+		Close Project
+
+		-- create jpegtran project
+
+		activate
+		Create Project (ijg_folder as string) & "jpegtran.proj"
+		Set Preferences of panel "Target Settings" to {Target Name:"jpegtran"}
+		Set Preferences of panel "PPC Project" to {File Name:"jpegtran"}
+		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
+		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
+		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
+		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
+		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
+
+		Add Files (ijg_folder as string) & "jpegtran.c" To Segment 1
+		Add Files (ijg_folder as string) & "rdswitch.c" To Segment 1
+		Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1
+		Add Files (ijg_folder as string) & "transupp.c" To Segment 1
+
+		Add Files (ijg_folder as string) & "libjpeg" To Segment 2
+
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3
+
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4
+		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4
+
+		-- compile and link jpegtran
+
+		Make Project
+		Close Project
+
+		quit
+
+	  end timeout
+	end tell
+end run

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makljpeg.st
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makljpeg.st	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makljpeg.st	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,70 @@
+; Project file for Independent JPEG Group's software
+;
+; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C.
+; Thanks to Frank Moehle (Frank.Moehle at arbi.informatik.uni-oldenburg.de),
+; Dr. B. Setzepfandt (bernd at gina.uni-muenster.de),
+; and Guido Vollbeding (guivol at esc.de).
+;
+; To use this file, rename it to libjpeg.prj.
+; Read installation instructions before trying to make the program!
+;
+;
+;      * * * Output file * * *
+libjpeg.lib
+;
+; * * * COMPILER OPTIONS * * *  
+.C[-P]        ; absolute calls
+.C[-M]        ; and no string merging, folks
+.C[-w-cln]    ; no "constant is long" warnings
+.C[-w-par]    ; no "parameter xxxx unused"
+.C[-w-rch]    ; no "unreachable code"
+.C[-wsig]     ; warn if significant digits may be lost
+.L[-J]        ; link new Obj-format (so we get a library)
+=
+; * * * * List of modules * * * * 
+jcapimin.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jcapistd.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jccoefct.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jccolor.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jcdctmgr.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h)
+jchuff.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jchuff.h)
+jcinit.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jcmainct.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jcmarker.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jcmaster.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jcomapi.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jcparam.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jcphuff.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jchuff.h)
+jcprepct.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jcsample.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jctrans.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdapimin.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdapistd.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdatadst.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h)
+jdatasrc.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h)
+jdcoefct.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdcolor.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jddctmgr.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h)
+jdhuff.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdhuff.h)
+jdinput.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdmainct.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdmarker.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdmaster.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdmerge.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdphuff.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdhuff.h)
+jdpostct.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdsample.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jdtrans.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jerror.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jversion.h,jerror.h)
+jfdctflt.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h)
+jfdctfst.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h)
+jfdctint.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h)
+jidctflt.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h)
+jidctfst.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h)
+jidctint.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h)
+jidctred.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h)
+jquant1.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jquant2.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jutils.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h)
+jmemmgr.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jmemsys.h)
+jmemansi.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jmemsys.h)

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/maktjpeg.st
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/maktjpeg.st	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/maktjpeg.st	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,32 @@
+; Project file for Independent JPEG Group's software
+;
+; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C.
+; Thanks to Frank Moehle (Frank.Moehle at arbi.informatik.uni-oldenburg.de),
+; Dr. B. Setzepfandt (bernd at gina.uni-muenster.de),
+; and Guido Vollbeding (guivol at esc.de).
+;
+; To use this file, rename it to jpegtran.prj.
+; If you are using Turbo C, change filenames beginning with "pc..." to "tc..."
+; Read installation instructions before trying to make the program!
+;
+;
+;      * * * Output file * * *
+jpegtran.ttp
+;
+; * * * COMPILER OPTIONS * * *  
+.C[-P]        ; absolute calls
+.C[-M]        ; and no string merging, folks
+.C[-w-cln]    ; no "constant is long" warnings
+.C[-w-par]    ; no "parameter xxxx unused"
+.C[-w-rch]    ; no "unreachable code"
+.C[-wsig]     ; warn if significant digits may be lost
+=
+; * * * * List of modules * * * * 
+pcstart.o
+jpegtran.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h,transupp.h,jversion.h)
+cdjpeg.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+rdswitch.c	(cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h)
+transupp.c	(jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,transupp.h)
+libjpeg.lib        ; built by libjpeg.prj
+pcstdlib.lib       ; standard library
+pcextlib.lib       ; extended library

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/makvms.opt
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/makvms.opt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/makvms.opt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4 @@
+! A pointer to the VAX/VMS C Run-Time Shareable Library.
+! This file is needed by makefile.mms and makefile.vms,
+! but only for the older VAX C compiler.  DEC C does not need it.
+Sys$Library:VAXCRTL.EXE /Share

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/rdbmp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/rdbmp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/rdbmp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,439 @@
+/*
+ * rdbmp.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to read input images in Microsoft "BMP"
+ * format (MS Windows 3.x, OS/2 1.x, and OS/2 2.x flavors).
+ * Currently, only 8-bit and 24-bit images are supported, not 1-bit or
+ * 4-bit (feeding such low-depth images into JPEG would be silly anyway).
+ * Also, we don't support RLE-compressed files.
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications.  As they stand, they assume input from
+ * an ordinary stdio stream.  They further assume that reading begins
+ * at the start of the file; start_input may need work if the
+ * user interface has already read some data (e.g., to determine that
+ * the file is indeed BMP format).
+ *
+ * This code contributed by James Arthur Boucher.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef BMP_SUPPORTED
+
+
+/* Macros to deal with unsigned chars as efficiently as compiler allows */
+
+#ifdef HAVE_UNSIGNED_CHAR
+typedef unsigned char U_CHAR;
+#define UCH(x)	((int) (x))
+#else /* !HAVE_UNSIGNED_CHAR */
+#ifdef CHAR_IS_UNSIGNED
+typedef char U_CHAR;
+#define UCH(x)	((int) (x))
+#else
+typedef char U_CHAR;
+#define UCH(x)	((int) (x) & 0xFF)
+#endif
+#endif /* HAVE_UNSIGNED_CHAR */
+
+
+#define	ReadOK(file,buffer,len)	(JFREAD(file,buffer,len) == ((size_t) (len)))
+
+
+/* Private version of data source object */
+
+typedef struct _bmp_source_struct * bmp_source_ptr;
+
+typedef struct _bmp_source_struct {
+  struct cjpeg_source_struct pub; /* public fields */
+
+  j_compress_ptr cinfo;		/* back link saves passing separate parm */
+
+  JSAMPARRAY colormap;		/* BMP colormap (converted to my format) */
+
+  jvirt_sarray_ptr whole_image;	/* Needed to reverse row order */
+  JDIMENSION source_row;	/* Current source row number */
+  JDIMENSION row_width;		/* Physical width of scanlines in file */
+
+  int bits_per_pixel;		/* remembers 8- or 24-bit format */
+} bmp_source_struct;
+
+
+LOCAL(int)
+read_byte (bmp_source_ptr sinfo)
+/* Read next byte from BMP file */
+{
+  register FILE *infile = sinfo->pub.input_file;
+  register int c;
+
+  if ((c = getc(infile)) == EOF)
+    ERREXIT(sinfo->cinfo, JERR_INPUT_EOF);
+  return c;
+}
+
+
+LOCAL(void)
+read_colormap (bmp_source_ptr sinfo, int cmaplen, int mapentrysize)
+/* Read the colormap from a BMP file */
+{
+  int i;
+
+  switch (mapentrysize) {
+  case 3:
+    /* BGR format (occurs in OS/2 files) */
+    for (i = 0; i < cmaplen; i++) {
+      sinfo->colormap[2][i] = (JSAMPLE) read_byte(sinfo);
+      sinfo->colormap[1][i] = (JSAMPLE) read_byte(sinfo);
+      sinfo->colormap[0][i] = (JSAMPLE) read_byte(sinfo);
+    }
+    break;
+  case 4:
+    /* BGR0 format (occurs in MS Windows files) */
+    for (i = 0; i < cmaplen; i++) {
+      sinfo->colormap[2][i] = (JSAMPLE) read_byte(sinfo);
+      sinfo->colormap[1][i] = (JSAMPLE) read_byte(sinfo);
+      sinfo->colormap[0][i] = (JSAMPLE) read_byte(sinfo);
+      (void) read_byte(sinfo);
+    }
+    break;
+  default:
+    ERREXIT(sinfo->cinfo, JERR_BMP_BADCMAP);
+    break;
+  }
+}
+
+
+/*
+ * Read one row of pixels.
+ * The image has been read into the whole_image array, but is otherwise
+ * unprocessed.  We must read it out in top-to-bottom row order, and if
+ * it is an 8-bit image, we must expand colormapped pixels to 24bit format.
+ */
+
+METHODDEF(JDIMENSION)
+get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading 8-bit colormap indexes */
+{
+  bmp_source_ptr source = (bmp_source_ptr) sinfo;
+  register JSAMPARRAY colormap = source->colormap;
+  JSAMPARRAY image_ptr;
+  register int t;
+  register JSAMPROW inptr, outptr;
+  register JDIMENSION col;
+
+  /* Fetch next row from virtual array */
+  source->source_row--;
+  image_ptr = (*cinfo->mem->access_virt_sarray)
+    ((j_common_ptr) cinfo, source->whole_image,
+     source->source_row, (JDIMENSION) 1, FALSE);
+
+  /* Expand the colormap indexes to real data */
+  inptr = image_ptr[0];
+  outptr = source->pub.buffer[0];
+  for (col = cinfo->image_width; col > 0; col--) {
+    t = GETJSAMPLE(*inptr++);
+    *outptr++ = colormap[0][t];	/* can omit GETJSAMPLE() safely */
+    *outptr++ = colormap[1][t];
+    *outptr++ = colormap[2][t];
+  }
+
+  return 1;
+}
+
+
+METHODDEF(JDIMENSION)
+get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading 24-bit pixels */
+{
+  bmp_source_ptr source = (bmp_source_ptr) sinfo;
+  JSAMPARRAY image_ptr;
+  register JSAMPROW inptr, outptr;
+  register JDIMENSION col;
+
+  /* Fetch next row from virtual array */
+  source->source_row--;
+  image_ptr = (*cinfo->mem->access_virt_sarray)
+    ((j_common_ptr) cinfo, source->whole_image,
+     source->source_row, (JDIMENSION) 1, FALSE);
+
+  /* Transfer data.  Note source values are in BGR order
+   * (even though Microsoft's own documents say the opposite).
+   */
+  inptr = image_ptr[0];
+  outptr = source->pub.buffer[0];
+  for (col = cinfo->image_width; col > 0; col--) {
+    outptr[2] = *inptr++;	/* can omit GETJSAMPLE() safely */
+    outptr[1] = *inptr++;
+    outptr[0] = *inptr++;
+    outptr += 3;
+  }
+
+  return 1;
+}
+
+
+/*
+ * This method loads the image into whole_image during the first call on
+ * get_pixel_rows.  The get_pixel_rows pointer is then adjusted to call
+ * get_8bit_row or get_24bit_row on subsequent calls.
+ */
+
+METHODDEF(JDIMENSION)
+preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  bmp_source_ptr source = (bmp_source_ptr) sinfo;
+  register FILE *infile = source->pub.input_file;
+  register int c;
+  register JSAMPROW out_ptr;
+  JSAMPARRAY image_ptr;
+  JDIMENSION row, col;
+  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+
+  /* Read the data into a virtual array in input-file row order. */
+  for (row = 0; row < cinfo->image_height; row++) {
+    if (progress != NULL) {
+      progress->pub.pass_counter = (long) row;
+      progress->pub.pass_limit = (long) cinfo->image_height;
+      (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+    }
+    image_ptr = (*cinfo->mem->access_virt_sarray)
+      ((j_common_ptr) cinfo, source->whole_image,
+       row, (JDIMENSION) 1, TRUE);
+    out_ptr = image_ptr[0];
+    for (col = source->row_width; col > 0; col--) {
+      /* inline copy of read_byte() for speed */
+      if ((c = getc(infile)) == EOF)
+	ERREXIT(cinfo, JERR_INPUT_EOF);
+      *out_ptr++ = (JSAMPLE) c;
+    }
+  }
+  if (progress != NULL)
+    progress->completed_extra_passes++;
+
+  /* Set up to read from the virtual array in top-to-bottom order */
+  switch (source->bits_per_pixel) {
+  case 8:
+    source->pub.get_pixel_rows = get_8bit_row;
+    break;
+  case 24:
+    source->pub.get_pixel_rows = get_24bit_row;
+    break;
+  default:
+    ERREXIT(cinfo, JERR_BMP_BADDEPTH);
+  }
+  source->source_row = cinfo->image_height;
+
+  /* And read the first row */
+  return (*source->pub.get_pixel_rows) (cinfo, sinfo);
+}
+
+
+/*
+ * Read the file header; return image size and component count.
+ */
+
+METHODDEF(void)
+start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  bmp_source_ptr source = (bmp_source_ptr) sinfo;
+  U_CHAR bmpfileheader[14];
+  U_CHAR bmpinfoheader[64];
+#define GET_2B(array,offset)  ((unsigned int) UCH(array[offset]) + \
+			       (((unsigned int) UCH(array[offset+1])) << 8))
+#define GET_4B(array,offset)  ((INT32) UCH(array[offset]) + \
+			       (((INT32) UCH(array[offset+1])) << 8) + \
+			       (((INT32) UCH(array[offset+2])) << 16) + \
+			       (((INT32) UCH(array[offset+3])) << 24))
+  INT32 bfOffBits;
+  INT32 headerSize;
+  INT32 biWidth = 0;		/* initialize to avoid compiler warning */
+  INT32 biHeight = 0;
+  unsigned int biPlanes;
+  INT32 biCompression;
+  INT32 biXPelsPerMeter,biYPelsPerMeter;
+  INT32 biClrUsed = 0;
+  int mapentrysize = 0;		/* 0 indicates no colormap */
+  INT32 bPad;
+  JDIMENSION row_width;
+
+  /* Read and verify the bitmap file header */
+  if (! ReadOK(source->pub.input_file, bmpfileheader, 14))
+    ERREXIT(cinfo, JERR_INPUT_EOF);
+  if (GET_2B(bmpfileheader,0) != 0x4D42) /* 'BM' */
+    ERREXIT(cinfo, JERR_BMP_NOT);
+  bfOffBits = (INT32) GET_4B(bmpfileheader,10);
+  /* We ignore the remaining fileheader fields */
+
+  /* The infoheader might be 12 bytes (OS/2 1.x), 40 bytes (Windows),
+   * or 64 bytes (OS/2 2.x).  Check the first 4 bytes to find out which.
+   */
+  if (! ReadOK(source->pub.input_file, bmpinfoheader, 4))
+    ERREXIT(cinfo, JERR_INPUT_EOF);
+  headerSize = (INT32) GET_4B(bmpinfoheader,0);
+  if (headerSize < 12 || headerSize > 64)
+    ERREXIT(cinfo, JERR_BMP_BADHEADER);
+  if (! ReadOK(source->pub.input_file, bmpinfoheader+4, headerSize-4))
+    ERREXIT(cinfo, JERR_INPUT_EOF);
+
+  switch ((int) headerSize) {
+  case 12:
+    /* Decode OS/2 1.x header (Microsoft calls this a BITMAPCOREHEADER) */
+    biWidth = (INT32) GET_2B(bmpinfoheader,4);
+    biHeight = (INT32) GET_2B(bmpinfoheader,6);
+    biPlanes = GET_2B(bmpinfoheader,8);
+    source->bits_per_pixel = (int) GET_2B(bmpinfoheader,10);
+
+    switch (source->bits_per_pixel) {
+    case 8:			/* colormapped image */
+      mapentrysize = 3;		/* OS/2 uses RGBTRIPLE colormap */
+      TRACEMS2(cinfo, 1, JTRC_BMP_OS2_MAPPED, (int) biWidth, (int) biHeight);
+      break;
+    case 24:			/* RGB image */
+      TRACEMS2(cinfo, 1, JTRC_BMP_OS2, (int) biWidth, (int) biHeight);
+      break;
+    default:
+      ERREXIT(cinfo, JERR_BMP_BADDEPTH);
+      break;
+    }
+    if (biPlanes != 1)
+      ERREXIT(cinfo, JERR_BMP_BADPLANES);
+    break;
+  case 40:
+  case 64:
+    /* Decode Windows 3.x header (Microsoft calls this a BITMAPINFOHEADER) */
+    /* or OS/2 2.x header, which has additional fields that we ignore */
+    biWidth = GET_4B(bmpinfoheader,4);
+    biHeight = GET_4B(bmpinfoheader,8);
+    biPlanes = GET_2B(bmpinfoheader,12);
+    source->bits_per_pixel = (int) GET_2B(bmpinfoheader,14);
+    biCompression = GET_4B(bmpinfoheader,16);
+    biXPelsPerMeter = GET_4B(bmpinfoheader,24);
+    biYPelsPerMeter = GET_4B(bmpinfoheader,28);
+    biClrUsed = GET_4B(bmpinfoheader,32);
+    /* biSizeImage, biClrImportant fields are ignored */
+
+    switch (source->bits_per_pixel) {
+    case 8:			/* colormapped image */
+      mapentrysize = 4;		/* Windows uses RGBQUAD colormap */
+      TRACEMS2(cinfo, 1, JTRC_BMP_MAPPED, (int) biWidth, (int) biHeight);
+      break;
+    case 24:			/* RGB image */
+      TRACEMS2(cinfo, 1, JTRC_BMP, (int) biWidth, (int) biHeight);
+      break;
+    default:
+      ERREXIT(cinfo, JERR_BMP_BADDEPTH);
+      break;
+    }
+    if (biPlanes != 1)
+      ERREXIT(cinfo, JERR_BMP_BADPLANES);
+    if (biCompression != 0)
+      ERREXIT(cinfo, JERR_BMP_COMPRESSED);
+
+    if (biXPelsPerMeter > 0 && biYPelsPerMeter > 0) {
+      /* Set JFIF density parameters from the BMP data */
+      cinfo->X_density = (UINT16) (biXPelsPerMeter/100); /* 100 cm per meter */
+      cinfo->Y_density = (UINT16) (biYPelsPerMeter/100);
+      cinfo->density_unit = 2;	/* dots/cm */
+    }
+    break;
+  default:
+    ERREXIT(cinfo, JERR_BMP_BADHEADER);
+    break;
+  }
+
+  /* Compute distance to bitmap data --- will adjust for colormap below */
+  bPad = bfOffBits - (headerSize + 14);
+
+  /* Read the colormap, if any */
+  if (mapentrysize > 0) {
+    if (biClrUsed <= 0)
+      biClrUsed = 256;		/* assume it's 256 */
+    else if (biClrUsed > 256)
+      ERREXIT(cinfo, JERR_BMP_BADCMAP);
+    /* Allocate space to store the colormap */
+    source->colormap = (*cinfo->mem->alloc_sarray)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE,
+       (JDIMENSION) biClrUsed, (JDIMENSION) 3);
+    /* and read it from the file */
+    read_colormap(source, (int) biClrUsed, mapentrysize);
+    /* account for size of colormap */
+    bPad -= biClrUsed * mapentrysize;
+  }
+
+  /* Skip any remaining pad bytes */
+  if (bPad < 0)			/* incorrect bfOffBits value? */
+    ERREXIT(cinfo, JERR_BMP_BADHEADER);
+  while (--bPad >= 0) {
+    (void) read_byte(source);
+  }
+
+  /* Compute row width in file, including padding to 4-byte boundary */
+  if (source->bits_per_pixel == 24)
+    row_width = (JDIMENSION) (biWidth * 3);
+  else
+    row_width = (JDIMENSION) biWidth;
+  while ((row_width & 3) != 0) row_width++;
+  source->row_width = row_width;
+
+  /* Allocate space for inversion array, prepare for preload pass */
+  source->whole_image = (*cinfo->mem->request_virt_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+     row_width, (JDIMENSION) biHeight, (JDIMENSION) 1);
+  source->pub.get_pixel_rows = preload_image;
+  if (cinfo->progress != NULL) {
+    cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+    progress->total_extra_passes++; /* count file input as separate pass */
+  }
+
+  /* Allocate one-row buffer for returned data */
+  source->pub.buffer = (*cinfo->mem->alloc_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE,
+     (JDIMENSION) (biWidth * 3), (JDIMENSION) 1);
+  source->pub.buffer_height = 1;
+
+  cinfo->in_color_space = JCS_RGB;
+  cinfo->input_components = 3;
+  cinfo->data_precision = 8;
+  cinfo->image_width = (JDIMENSION) biWidth;
+  cinfo->image_height = (JDIMENSION) biHeight;
+}
+
+
+/*
+ * Finish up at the end of the file.
+ */
+
+METHODDEF(void)
+finish_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  /* no work */
+}
+
+
+/*
+ * The module selection routine for BMP format input.
+ */
+
+GLOBAL(cjpeg_source_ptr)
+jinit_read_bmp (j_compress_ptr cinfo)
+{
+  bmp_source_ptr source;
+
+  /* Create module interface object */
+  source = (bmp_source_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(bmp_source_struct));
+  source->cinfo = cinfo;	/* make back link for subroutines */
+  /* Fill in method ptrs, except get_pixel_rows which start_input sets */
+  source->pub.start_input = start_input_bmp;
+  source->pub.finish_input = finish_input_bmp;
+
+  return (cjpeg_source_ptr) source;
+}
+
+#endif /* BMP_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/rdcolmap.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/rdcolmap.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/rdcolmap.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,253 @@
+/*
+ * rdcolmap.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file implements djpeg's "-map file" switch.  It reads a source image
+ * and constructs a colormap to be supplied to the JPEG decompressor.
+ *
+ * Currently, these file formats are supported for the map file:
+ *   GIF: the contents of the GIF's global colormap are used.
+ *   PPM (either text or raw flavor): the entire file is read and
+ *      each unique pixel value is entered in the map.
+ * Note that reading a large PPM file will be horrendously slow.
+ * Typically, a PPM-format map file should contain just one pixel
+ * of each desired color.  Such a file can be extracted from an
+ * ordinary image PPM file with ppmtomap(1).
+ *
+ * Rescaling a PPM that has a maxval unequal to MAXJSAMPLE is not
+ * currently implemented.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef QUANT_2PASS_SUPPORTED	/* otherwise can't quantize to supplied map */
+
+/* Portions of this code are based on the PBMPLUS library, which is:
+**
+** Copyright (C) 1988 by Jef Poskanzer.
+**
+** Permission to use, copy, modify, and distribute this software and its
+** documentation for any purpose and without fee is hereby granted, provided
+** that the above copyright notice appear in all copies and that both that
+** copyright notice and this permission notice appear in supporting
+** documentation.  This software is provided "as is" without express or
+** implied warranty.
+*/
+
+
+/*
+ * Add a (potentially) new color to the color map.
+ */
+
+LOCAL(void)
+add_map_entry (j_decompress_ptr cinfo, int R, int G, int B)
+{
+  JSAMPROW colormap0 = cinfo->colormap[0];
+  JSAMPROW colormap1 = cinfo->colormap[1];
+  JSAMPROW colormap2 = cinfo->colormap[2];
+  int ncolors = cinfo->actual_number_of_colors;
+  int index;
+
+  /* Check for duplicate color. */
+  for (index = 0; index < ncolors; index++) {
+    if (GETJSAMPLE(colormap0[index]) == R &&
+	GETJSAMPLE(colormap1[index]) == G &&
+	GETJSAMPLE(colormap2[index]) == B)
+      return;			/* color is already in map */
+  }
+
+  /* Check for map overflow. */
+  if (ncolors >= (MAXJSAMPLE+1))
+    ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, (MAXJSAMPLE+1));
+
+  /* OK, add color to map. */
+  colormap0[ncolors] = (JSAMPLE) R;
+  colormap1[ncolors] = (JSAMPLE) G;
+  colormap2[ncolors] = (JSAMPLE) B;
+  cinfo->actual_number_of_colors++;
+}
+
+
+/*
+ * Extract color map from a GIF file.
+ */
+
+LOCAL(void)
+read_gif_map (j_decompress_ptr cinfo, FILE * infile)
+{
+  int header[13];
+  int i, colormaplen;
+  int R, G, B;
+
+  /* Initial 'G' has already been read by read_color_map */
+  /* Read the rest of the GIF header and logical screen descriptor */
+  for (i = 1; i < 13; i++) {
+    if ((header[i] = getc(infile)) == EOF)
+      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+  }
+
+  /* Verify GIF Header */
+  if (header[1] != 'I' || header[2] != 'F')
+    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+
+  /* There must be a global color map. */
+  if ((header[10] & 0x80) == 0)
+    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+
+  /* OK, fetch it. */
+  colormaplen = 2 << (header[10] & 0x07);
+
+  for (i = 0; i < colormaplen; i++) {
+    R = getc(infile);
+    G = getc(infile);
+    B = getc(infile);
+    if (R == EOF || G == EOF || B == EOF)
+      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+    add_map_entry(cinfo,
+		  R << (BITS_IN_JSAMPLE-8),
+		  G << (BITS_IN_JSAMPLE-8),
+		  B << (BITS_IN_JSAMPLE-8));
+  }
+}
+
+
+/* Support routines for reading PPM */
+
+
+LOCAL(int)
+pbm_getc (FILE * infile)
+/* Read next char, skipping over any comments */
+/* A comment/newline sequence is returned as a newline */
+{
+  register int ch;
+  
+  ch = getc(infile);
+  if (ch == '#') {
+    do {
+      ch = getc(infile);
+    } while (ch != '\n' && ch != EOF);
+  }
+  return ch;
+}
+
+
+LOCAL(unsigned int)
+read_pbm_integer (j_decompress_ptr cinfo, FILE * infile)
+/* Read an unsigned decimal integer from the PPM file */
+/* Swallows one trailing character after the integer */
+/* Note that on a 16-bit-int machine, only values up to 64k can be read. */
+/* This should not be a problem in practice. */
+{
+  register int ch;
+  register unsigned int val;
+  
+  /* Skip any leading whitespace */
+  do {
+    ch = pbm_getc(infile);
+    if (ch == EOF)
+      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+  } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
+  
+  if (ch < '0' || ch > '9')
+    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+  
+  val = ch - '0';
+  while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') {
+    val *= 10;
+    val += ch - '0';
+  }
+  return val;
+}
+
+
+/*
+ * Extract color map from a PPM file.
+ */
+
+LOCAL(void)
+read_ppm_map (j_decompress_ptr cinfo, FILE * infile)
+{
+  int c;
+  unsigned int w, h, maxval, row, col;
+  int R, G, B;
+
+  /* Initial 'P' has already been read by read_color_map */
+  c = getc(infile);		/* save format discriminator for a sec */
+
+  /* while we fetch the remaining header info */
+  w = read_pbm_integer(cinfo, infile);
+  h = read_pbm_integer(cinfo, infile);
+  maxval = read_pbm_integer(cinfo, infile);
+
+  if (w <= 0 || h <= 0 || maxval <= 0) /* error check */
+    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+
+  /* For now, we don't support rescaling from an unusual maxval. */
+  if (maxval != (unsigned int) MAXJSAMPLE)
+    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+
+  switch (c) {
+  case '3':			/* it's a text-format PPM file */
+    for (row = 0; row < h; row++) {
+      for (col = 0; col < w; col++) {
+	R = read_pbm_integer(cinfo, infile);
+	G = read_pbm_integer(cinfo, infile);
+	B = read_pbm_integer(cinfo, infile);
+	add_map_entry(cinfo, R, G, B);
+      }
+    }
+    break;
+
+  case '6':			/* it's a raw-format PPM file */
+    for (row = 0; row < h; row++) {
+      for (col = 0; col < w; col++) {
+	R = getc(infile);
+	G = getc(infile);
+	B = getc(infile);
+	if (R == EOF || G == EOF || B == EOF)
+	  ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+	add_map_entry(cinfo, R, G, B);
+      }
+    }
+    break;
+
+  default:
+    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+    break;
+  }
+}
+
+
+/*
+ * Main entry point from djpeg.c.
+ *  Input: opened input file (from file name argument on command line).
+ *  Output: colormap and actual_number_of_colors fields are set in cinfo.
+ */
+
+GLOBAL(void)
+read_color_map (j_decompress_ptr cinfo, FILE * infile)
+{
+  /* Allocate space for a color map of maximum supported size. */
+  cinfo->colormap = (*cinfo->mem->alloc_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE,
+     (JDIMENSION) (MAXJSAMPLE+1), (JDIMENSION) 3);
+  cinfo->actual_number_of_colors = 0; /* initialize map to empty */
+
+  /* Read first byte to determine file format */
+  switch (getc(infile)) {
+  case 'G':
+    read_gif_map(cinfo, infile);
+    break;
+  case 'P':
+    read_ppm_map(cinfo, infile);
+    break;
+  default:
+    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
+    break;
+  }
+}
+
+#endif /* QUANT_2PASS_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/rdgif.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/rdgif.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/rdgif.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+/*
+ * rdgif.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to read input images in GIF format.
+ *
+ *****************************************************************************
+ * NOTE: to avoid entanglements with Unisys' patent on LZW compression,      *
+ * the ability to read GIF files has been removed from the IJG distribution. *
+ * Sorry about that.                                                         *
+ *****************************************************************************
+ *
+ * We are required to state that
+ *    "The Graphics Interchange Format(c) is the Copyright property of
+ *    CompuServe Incorporated. GIF(sm) is a Service Mark property of
+ *    CompuServe Incorporated."
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef GIF_SUPPORTED
+
+/*
+ * The module selection routine for GIF format input.
+ */
+
+GLOBAL(cjpeg_source_ptr)
+jinit_read_gif (j_compress_ptr cinfo)
+{
+  fprintf(stderr, "GIF input is unsupported for legal reasons.  Sorry.\n");
+  exit(EXIT_FAILURE);
+  return NULL;			/* keep compiler happy */
+}
+
+#endif /* GIF_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/rdjpgcom.1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/rdjpgcom.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/rdjpgcom.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,54 @@
+.TH RDJPGCOM 1 "11 October 1997"
+.SH NAME
+rdjpgcom \- display text comments from a JPEG file
+.SH SYNOPSIS
+.B rdjpgcom
+[
+.B \-verbose
+]
+[
+.I filename
+]
+.LP
+.SH DESCRIPTION
+.LP
+.B rdjpgcom
+reads the named JPEG/JFIF file, or the standard input if no file is named,
+and prints any text comments found in the file on the standard output.
+.PP
+The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file.
+Although the standard doesn't actually define what COM blocks are for, they
+are widely used to hold user-supplied text strings.  This lets you add
+annotations, titles, index terms, etc to your JPEG files, and later retrieve
+them as text.  COM blocks do not interfere with the image stored in the JPEG
+file.  The maximum size of a COM block is 64K, but you can have as many of
+them as you like in one JPEG file.
+.SH OPTIONS
+.TP
+.B \-verbose
+Causes
+.B rdjpgcom
+to also display the JPEG image dimensions.
+.PP
+Switch names may be abbreviated, and are not case sensitive.
+.SH HINTS
+.B rdjpgcom
+does not depend on the IJG JPEG library.  Its source code is intended as an
+illustration of the minimum amount of code required to parse a JPEG file
+header correctly.
+.PP
+In
+.B \-verbose
+mode,
+.B rdjpgcom
+will also attempt to print the contents of any "APP12" markers as text.
+Some digital cameras produce APP12 markers containing useful textual
+information.  If you like, you can modify the source code to print
+other APPn marker types as well.
+.SH SEE ALSO
+.BR cjpeg (1),
+.BR djpeg (1),
+.BR jpegtran (1),
+.BR wrjpgcom (1)
+.SH AUTHOR
+Independent JPEG Group

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/rdjpgcom.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/rdjpgcom.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/rdjpgcom.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,496 @@
+/*
+ * rdjpgcom.c
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a very simple stand-alone application that displays
+ * the text in COM (comment) markers in a JFIF file.
+ * This may be useful as an example of the minimum logic needed to parse
+ * JPEG markers.
+ */
+
+#define JPEG_CJPEG_DJPEG	/* to get the command-line config symbols */
+#include "jinclude.h"		/* get auto-config symbols, <stdio.h> */
+
+#include <ctype.h>		/* to declare isupper(), tolower() */
+#ifdef USE_SETMODE
+#include <fcntl.h>		/* to declare setmode()'s parameter macros */
+/* If you have setmode() but not <io.h>, just delete this line: */
+#include <io.h>			/* to declare setmode() */
+#endif
+
+#ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
+#ifdef __MWERKS__
+#include <SIOUX.h>              /* Metrowerks needs this */
+#include <console.h>		/* ... and this */
+#endif
+#ifdef THINK_C
+#include <console.h>		/* Think declares it here */
+#endif
+#endif
+
+#ifdef DONT_USE_B_MODE		/* define mode parameters for fopen() */
+#define READ_BINARY	"r"
+#else
+#ifdef VMS			/* VMS is very nonstandard */
+#define READ_BINARY	"rb", "ctx=stm"
+#else				/* standard ANSI-compliant case */
+#define READ_BINARY	"rb"
+#endif
+#endif
+
+#ifndef EXIT_FAILURE		/* define exit() codes if not provided */
+#define EXIT_FAILURE  1
+#endif
+#ifndef EXIT_SUCCESS
+#ifdef VMS
+#define EXIT_SUCCESS  1		/* VMS is very nonstandard */
+#else
+#define EXIT_SUCCESS  0
+#endif
+#endif
+
+
+/*
+ * These macros are used to read the input file.
+ * To reuse this code in another application, you might need to change these.
+ */
+
+static FILE * infile;		/* input JPEG file */
+
+/* Return next input byte, or EOF if no more */
+#define NEXTBYTE()  getc(infile)
+
+
+/* Error exit handler */
+#define ERREXIT(msg)  (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE))
+
+
+/* Read one byte, testing for EOF */
+static int
+read_1_byte (void)
+{
+  int c;
+
+  c = NEXTBYTE();
+  if (c == EOF)
+    ERREXIT("Premature EOF in JPEG file");
+  return c;
+}
+
+/* Read 2 bytes, convert to unsigned int */
+/* All 2-byte quantities in JPEG markers are MSB first */
+static unsigned int
+read_2_bytes (void)
+{
+  int c1, c2;
+
+  c1 = NEXTBYTE();
+  if (c1 == EOF)
+    ERREXIT("Premature EOF in JPEG file");
+  c2 = NEXTBYTE();
+  if (c2 == EOF)
+    ERREXIT("Premature EOF in JPEG file");
+  return (((unsigned int) c1) << 8) + ((unsigned int) c2);
+}
+
+
+/*
+ * JPEG markers consist of one or more 0xFF bytes, followed by a marker
+ * code byte (which is not an FF).  Here are the marker codes of interest
+ * in this program.  (See jdmarker.c for a more complete list.)
+ */
+
+#define M_SOF0  0xC0		/* Start Of Frame N */
+#define M_SOF1  0xC1		/* N indicates which compression process */
+#define M_SOF2  0xC2		/* Only SOF0-SOF2 are now in common use */
+#define M_SOF3  0xC3
+#define M_SOF5  0xC5		/* NB: codes C4 and CC are NOT SOF markers */
+#define M_SOF6  0xC6
+#define M_SOF7  0xC7
+#define M_SOF9  0xC9
+#define M_SOF10 0xCA
+#define M_SOF11 0xCB
+#define M_SOF13 0xCD
+#define M_SOF14 0xCE
+#define M_SOF15 0xCF
+#define M_SOI   0xD8		/* Start Of Image (beginning of datastream) */
+#define M_EOI   0xD9		/* End Of Image (end of datastream) */
+#define M_SOS   0xDA		/* Start Of Scan (begins compressed data) */
+#define M_APP0	0xE0		/* Application-specific marker, type N */
+#define M_APP12	0xEC		/* (we don't bother to list all 16 APPn's) */
+#define M_COM   0xFE		/* COMment */
+
+
+/*
+ * Find the next JPEG marker and return its marker code.
+ * We expect at least one FF byte, possibly more if the compressor used FFs
+ * to pad the file.
+ * There could also be non-FF garbage between markers.  The treatment of such
+ * garbage is unspecified; we choose to skip over it but emit a warning msg.
+ * NB: this routine must not be used after seeing SOS marker, since it will
+ * not deal correctly with FF/00 sequences in the compressed image data...
+ */
+
+static int
+next_marker (void)
+{
+  int c;
+  int discarded_bytes = 0;
+
+  /* Find 0xFF byte; count and skip any non-FFs. */
+  c = read_1_byte();
+  while (c != 0xFF) {
+    discarded_bytes++;
+    c = read_1_byte();
+  }
+  /* Get marker code byte, swallowing any duplicate FF bytes.  Extra FFs
+   * are legal as pad bytes, so don't count them in discarded_bytes.
+   */
+  do {
+    c = read_1_byte();
+  } while (c == 0xFF);
+
+  if (discarded_bytes != 0) {
+    fprintf(stderr, "Warning: garbage data found in JPEG file\n");
+  }
+
+  return c;
+}
+
+
+/*
+ * Read the initial marker, which should be SOI.
+ * For a JFIF file, the first two bytes of the file should be literally
+ * 0xFF M_SOI.  To be more general, we could use next_marker, but if the
+ * input file weren't actually JPEG at all, next_marker might read the whole
+ * file and then return a misleading error message...
+ */
+
+static int
+first_marker (void)
+{
+  int c1, c2;
+
+  c1 = NEXTBYTE();
+  c2 = NEXTBYTE();
+  if (c1 != 0xFF || c2 != M_SOI)
+    ERREXIT("Not a JPEG file");
+  return c2;
+}
+
+
+/*
+ * Most types of marker are followed by a variable-length parameter segment.
+ * This routine skips over the parameters for any marker we don't otherwise
+ * want to process.
+ * Note that we MUST skip the parameter segment explicitly in order not to
+ * be fooled by 0xFF bytes that might appear within the parameter segment;
+ * such bytes do NOT introduce new markers.
+ */
+
+static void
+skip_variable (void)
+/* Skip over an unknown or uninteresting variable-length marker */
+{
+  unsigned int length;
+
+  /* Get the marker parameter length count */
+  length = read_2_bytes();
+  /* Length includes itself, so must be at least 2 */
+  if (length < 2)
+    ERREXIT("Erroneous JPEG marker length");
+  length -= 2;
+  /* Skip over the remaining bytes */
+  while (length > 0) {
+    (void) read_1_byte();
+    length--;
+  }
+}
+
+
+/*
+ * Process a COM marker.
+ * We want to print out the marker contents as legible text;
+ * we must guard against non-text junk and varying newline representations.
+ */
+
+static void
+process_COM (void)
+{
+  unsigned int length;
+  int ch;
+  int lastch = 0;
+
+  /* Get the marker parameter length count */
+  length = read_2_bytes();
+  /* Length includes itself, so must be at least 2 */
+  if (length < 2)
+    ERREXIT("Erroneous JPEG marker length");
+  length -= 2;
+
+  while (length > 0) {
+    ch = read_1_byte();
+    /* Emit the character in a readable form.
+     * Nonprintables are converted to \nnn form,
+     * while \ is converted to \\.
+     * Newlines in CR, CR/LF, or LF form will be printed as one newline.
+     */
+    if (ch == '\r') {
+      printf("\n");
+    } else if (ch == '\n') {
+      if (lastch != '\r')
+	printf("\n");
+    } else if (ch == '\\') {
+      printf("\\\\");
+    } else if (isprint(ch)) {
+      putc(ch, stdout);
+    } else {
+      printf("\\%03o", ch);
+    }
+    lastch = ch;
+    length--;
+  }
+  printf("\n");
+}
+
+
+/*
+ * Process a SOFn marker.
+ * This code is only needed if you want to know the image dimensions...
+ */
+
+static void
+process_SOFn (int marker)
+{
+  unsigned int length;
+  unsigned int image_height, image_width;
+  int data_precision, num_components;
+  const char * process;
+  int ci;
+
+  length = read_2_bytes();	/* usual parameter length count */
+
+  data_precision = read_1_byte();
+  image_height = read_2_bytes();
+  image_width = read_2_bytes();
+  num_components = read_1_byte();
+
+  switch (marker) {
+  case M_SOF0:	process = "Baseline";  break;
+  case M_SOF1:	process = "Extended sequential";  break;
+  case M_SOF2:	process = "Progressive";  break;
+  case M_SOF3:	process = "Lossless";  break;
+  case M_SOF5:	process = "Differential sequential";  break;
+  case M_SOF6:	process = "Differential progressive";  break;
+  case M_SOF7:	process = "Differential lossless";  break;
+  case M_SOF9:	process = "Extended sequential, arithmetic coding";  break;
+  case M_SOF10:	process = "Progressive, arithmetic coding";  break;
+  case M_SOF11:	process = "Lossless, arithmetic coding";  break;
+  case M_SOF13:	process = "Differential sequential, arithmetic coding";  break;
+  case M_SOF14:	process = "Differential progressive, arithmetic coding"; break;
+  case M_SOF15:	process = "Differential lossless, arithmetic coding";  break;
+  default:	process = "Unknown";  break;
+  }
+
+  printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n",
+	 image_width, image_height, num_components, data_precision);
+  printf("JPEG process: %s\n", process);
+
+  if (length != (unsigned int) (8 + num_components * 3))
+    ERREXIT("Bogus SOF marker length");
+
+  for (ci = 0; ci < num_components; ci++) {
+    (void) read_1_byte();	/* Component ID code */
+    (void) read_1_byte();	/* H, V sampling factors */
+    (void) read_1_byte();	/* Quantization table number */
+  }
+}
+
+
+/*
+ * Parse the marker stream until SOS or EOI is seen;
+ * display any COM markers.
+ * While the companion program wrjpgcom will always insert COM markers before
+ * SOFn, other implementations might not, so we scan to SOS before stopping.
+ * If we were only interested in the image dimensions, we would stop at SOFn.
+ * (Conversely, if we only cared about COM markers, there would be no need
+ * for special code to handle SOFn; we could treat it like other markers.)
+ */
+
+static int
+scan_JPEG_header (int verbose)
+{
+  int marker;
+
+  /* Expect SOI at start of file */
+  if (first_marker() != M_SOI)
+    ERREXIT("Expected SOI marker first");
+
+  /* Scan miscellaneous markers until we reach SOS. */
+  for (;;) {
+    marker = next_marker();
+    switch (marker) {
+      /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be,
+       * treated as SOFn.  C4 in particular is actually DHT.
+       */
+    case M_SOF0:		/* Baseline */
+    case M_SOF1:		/* Extended sequential, Huffman */
+    case M_SOF2:		/* Progressive, Huffman */
+    case M_SOF3:		/* Lossless, Huffman */
+    case M_SOF5:		/* Differential sequential, Huffman */
+    case M_SOF6:		/* Differential progressive, Huffman */
+    case M_SOF7:		/* Differential lossless, Huffman */
+    case M_SOF9:		/* Extended sequential, arithmetic */
+    case M_SOF10:		/* Progressive, arithmetic */
+    case M_SOF11:		/* Lossless, arithmetic */
+    case M_SOF13:		/* Differential sequential, arithmetic */
+    case M_SOF14:		/* Differential progressive, arithmetic */
+    case M_SOF15:		/* Differential lossless, arithmetic */
+      if (verbose)
+	process_SOFn(marker);
+      else
+	skip_variable();
+      break;
+
+    case M_SOS:			/* stop before hitting compressed data */
+      return marker;
+
+    case M_EOI:			/* in case it's a tables-only JPEG stream */
+      return marker;
+
+    case M_COM:
+      process_COM();
+      break;
+
+    case M_APP12:
+      /* Some digital camera makers put useful textual information into
+       * APP12 markers, so we print those out too when in -verbose mode.
+       */
+      if (verbose) {
+	printf("APP12 contains:\n");
+	process_COM();
+      } else
+	skip_variable();
+      break;
+
+    default:			/* Anything else just gets skipped */
+      skip_variable();		/* we assume it has a parameter count... */
+      break;
+    }
+  } /* end loop */
+}
+
+
+/* Command line parsing code */
+
+static const char * progname;	/* program name for error messages */
+
+
+static void
+usage (void)
+/* complain about bad command line */
+{
+  fprintf(stderr, "rdjpgcom displays any textual comments in a JPEG file.\n");
+
+  fprintf(stderr, "Usage: %s [switches] [inputfile]\n", progname);
+
+  fprintf(stderr, "Switches (names may be abbreviated):\n");
+  fprintf(stderr, "  -verbose    Also display dimensions of JPEG image\n");
+
+  exit(EXIT_FAILURE);
+}
+
+
+static int
+keymatch (char * arg, const char * keyword, int minchars)
+/* Case-insensitive matching of (possibly abbreviated) keyword switches. */
+/* keyword is the constant keyword (must be lower case already), */
+/* minchars is length of minimum legal abbreviation. */
+{
+  register int ca, ck;
+  register int nmatched = 0;
+
+  while ((ca = *arg++) != '\0') {
+    if ((ck = *keyword++) == '\0')
+      return 0;			/* arg longer than keyword, no good */
+    if (isupper(ca))		/* force arg to lcase (assume ck is already) */
+      ca = tolower(ca);
+    if (ca != ck)
+      return 0;			/* no good */
+    nmatched++;			/* count matched characters */
+  }
+  /* reached end of argument; fail if it's too short for unique abbrev */
+  if (nmatched < minchars)
+    return 0;
+  return 1;			/* A-OK */
+}
+
+
+/*
+ * The main program.
+ */
+
+int
+main (int argc, char **argv)
+{
+  int argn;
+  char * arg;
+  int verbose = 0;
+
+  /* On Mac, fetch a command line. */
+#ifdef USE_CCOMMAND
+  argc = ccommand(&argv);
+#endif
+
+  progname = argv[0];
+  if (progname == NULL || progname[0] == 0)
+    progname = "rdjpgcom";	/* in case C library doesn't provide it */
+
+  /* Parse switches, if any */
+  for (argn = 1; argn < argc; argn++) {
+    arg = argv[argn];
+    if (arg[0] != '-')
+      break;			/* not switch, must be file name */
+    arg++;			/* advance over '-' */
+    if (keymatch(arg, "verbose", 1)) {
+      verbose++;
+    } else
+      usage();
+  }
+
+  /* Open the input file. */
+  /* Unix style: expect zero or one file name */
+  if (argn < argc-1) {
+    fprintf(stderr, "%s: only one input file\n", progname);
+    usage();
+  }
+  if (argn < argc) {
+    if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default input file is stdin */
+#ifdef USE_SETMODE		/* need to hack file mode? */
+    setmode(fileno(stdin), O_BINARY);
+#endif
+#ifdef USE_FDOPEN		/* need to re-open in binary mode? */
+    if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open stdin\n", progname);
+      exit(EXIT_FAILURE);
+    }
+#else
+    infile = stdin;
+#endif
+  }
+
+  /* Scan the JPEG headers. */
+  (void) scan_JPEG_header(verbose);
+
+  /* All done. */
+  exit(EXIT_SUCCESS);
+  return 0;			/* suppress no-return-value warnings */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/rdppm.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/rdppm.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/rdppm.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,458 @@
+/*
+ * rdppm.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to read input images in PPM/PGM format.
+ * The extended 2-byte-per-sample raw PPM/PGM formats are supported.
+ * The PBMPLUS library is NOT required to compile this software
+ * (but it is highly useful as a set of PPM image manipulation programs).
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications.  As they stand, they assume input from
+ * an ordinary stdio stream.  They further assume that reading begins
+ * at the start of the file; start_input may need work if the
+ * user interface has already read some data (e.g., to determine that
+ * the file is indeed PPM format).
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef PPM_SUPPORTED
+
+
+/* Portions of this code are based on the PBMPLUS library, which is:
+**
+** Copyright (C) 1988 by Jef Poskanzer.
+**
+** Permission to use, copy, modify, and distribute this software and its
+** documentation for any purpose and without fee is hereby granted, provided
+** that the above copyright notice appear in all copies and that both that
+** copyright notice and this permission notice appear in supporting
+** documentation.  This software is provided "as is" without express or
+** implied warranty.
+*/
+
+
+/* Macros to deal with unsigned chars as efficiently as compiler allows */
+
+#ifdef HAVE_UNSIGNED_CHAR
+typedef unsigned char U_CHAR;
+#define UCH(x)	((int) (x))
+#else /* !HAVE_UNSIGNED_CHAR */
+#ifdef CHAR_IS_UNSIGNED
+typedef char U_CHAR;
+#define UCH(x)	((int) (x))
+#else
+typedef char U_CHAR;
+#define UCH(x)	((int) (x) & 0xFF)
+#endif
+#endif /* HAVE_UNSIGNED_CHAR */
+
+
+#define	ReadOK(file,buffer,len)	(JFREAD(file,buffer,len) == ((size_t) (len)))
+
+
+/*
+ * On most systems, reading individual bytes with getc() is drastically less
+ * efficient than buffering a row at a time with fread().  On PCs, we must
+ * allocate the buffer in near data space, because we are assuming small-data
+ * memory model, wherein fread() can't reach far memory.  If you need to
+ * process very wide images on a PC, you might have to compile in large-memory
+ * model, or else replace fread() with a getc() loop --- which will be much
+ * slower.
+ */
+
+
+/* Private version of data source object */
+
+typedef struct {
+  struct cjpeg_source_struct pub; /* public fields */
+
+  U_CHAR *iobuffer;		/* non-FAR pointer to I/O buffer */
+  JSAMPROW pixrow;		/* FAR pointer to same */
+  size_t buffer_width;		/* width of I/O buffer */
+  JSAMPLE *rescale;		/* => maxval-remapping array, or NULL */
+} ppm_source_struct;
+
+typedef ppm_source_struct * ppm_source_ptr;
+
+
+LOCAL(int)
+pbm_getc (FILE * infile)
+/* Read next char, skipping over any comments */
+/* A comment/newline sequence is returned as a newline */
+{
+  register int ch;
+
+  ch = getc(infile);
+  if (ch == '#') {
+    do {
+      ch = getc(infile);
+    } while (ch != '\n' && ch != EOF);
+  }
+  return ch;
+}
+
+
+LOCAL(unsigned int)
+read_pbm_integer (j_compress_ptr cinfo, FILE * infile)
+/* Read an unsigned decimal integer from the PPM file */
+/* Swallows one trailing character after the integer */
+/* Note that on a 16-bit-int machine, only values up to 64k can be read. */
+/* This should not be a problem in practice. */
+{
+  register int ch;
+  register unsigned int val;
+
+  /* Skip any leading whitespace */
+  do {
+    ch = pbm_getc(infile);
+    if (ch == EOF)
+      ERREXIT(cinfo, JERR_INPUT_EOF);
+  } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
+
+  if (ch < '0' || ch > '9')
+    ERREXIT(cinfo, JERR_PPM_NONNUMERIC);
+
+  val = ch - '0';
+  while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') {
+    val *= 10;
+    val += ch - '0';
+  }
+  return val;
+}
+
+
+/*
+ * Read one row of pixels.
+ *
+ * We provide several different versions depending on input file format.
+ * In all cases, input is scaled to the size of JSAMPLE.
+ *
+ * A really fast path is provided for reading byte/sample raw files with
+ * maxval = MAXJSAMPLE, which is the normal case for 8-bit data.
+ */
+
+
+METHODDEF(JDIMENSION)
+get_text_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading text-format PGM files with any maxval */
+{
+  ppm_source_ptr source = (ppm_source_ptr) sinfo;
+  FILE * infile = source->pub.input_file;
+  register JSAMPROW ptr;
+  register JSAMPLE *rescale = source->rescale;
+  JDIMENSION col;
+
+  ptr = source->pub.buffer[0];
+  for (col = cinfo->image_width; col > 0; col--) {
+    *ptr++ = rescale[read_pbm_integer(cinfo, infile)];
+  }
+  return 1;
+}
+
+
+METHODDEF(JDIMENSION)
+get_text_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading text-format PPM files with any maxval */
+{
+  ppm_source_ptr source = (ppm_source_ptr) sinfo;
+  FILE * infile = source->pub.input_file;
+  register JSAMPROW ptr;
+  register JSAMPLE *rescale = source->rescale;
+  JDIMENSION col;
+
+  ptr = source->pub.buffer[0];
+  for (col = cinfo->image_width; col > 0; col--) {
+    *ptr++ = rescale[read_pbm_integer(cinfo, infile)];
+    *ptr++ = rescale[read_pbm_integer(cinfo, infile)];
+    *ptr++ = rescale[read_pbm_integer(cinfo, infile)];
+  }
+  return 1;
+}
+
+
+METHODDEF(JDIMENSION)
+get_scaled_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading raw-byte-format PGM files with any maxval */
+{
+  ppm_source_ptr source = (ppm_source_ptr) sinfo;
+  register JSAMPROW ptr;
+  register U_CHAR * bufferptr;
+  register JSAMPLE *rescale = source->rescale;
+  JDIMENSION col;
+
+  if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
+    ERREXIT(cinfo, JERR_INPUT_EOF);
+  ptr = source->pub.buffer[0];
+  bufferptr = source->iobuffer;
+  for (col = cinfo->image_width; col > 0; col--) {
+    *ptr++ = rescale[UCH(*bufferptr++)];
+  }
+  return 1;
+}
+
+
+METHODDEF(JDIMENSION)
+get_scaled_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading raw-byte-format PPM files with any maxval */
+{
+  ppm_source_ptr source = (ppm_source_ptr) sinfo;
+  register JSAMPROW ptr;
+  register U_CHAR * bufferptr;
+  register JSAMPLE *rescale = source->rescale;
+  JDIMENSION col;
+
+  if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
+    ERREXIT(cinfo, JERR_INPUT_EOF);
+  ptr = source->pub.buffer[0];
+  bufferptr = source->iobuffer;
+  for (col = cinfo->image_width; col > 0; col--) {
+    *ptr++ = rescale[UCH(*bufferptr++)];
+    *ptr++ = rescale[UCH(*bufferptr++)];
+    *ptr++ = rescale[UCH(*bufferptr++)];
+  }
+  return 1;
+}
+
+
+METHODDEF(JDIMENSION)
+get_raw_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading raw-byte-format files with maxval = MAXJSAMPLE.
+ * In this case we just read right into the JSAMPLE buffer!
+ * Note that same code works for PPM and PGM files.
+ */
+{
+  ppm_source_ptr source = (ppm_source_ptr) sinfo;
+
+  if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
+    ERREXIT(cinfo, JERR_INPUT_EOF);
+  return 1;
+}
+
+
+METHODDEF(JDIMENSION)
+get_word_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading raw-word-format PGM files with any maxval */
+{
+  ppm_source_ptr source = (ppm_source_ptr) sinfo;
+  register JSAMPROW ptr;
+  register U_CHAR * bufferptr;
+  register JSAMPLE *rescale = source->rescale;
+  JDIMENSION col;
+
+  if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
+    ERREXIT(cinfo, JERR_INPUT_EOF);
+  ptr = source->pub.buffer[0];
+  bufferptr = source->iobuffer;
+  for (col = cinfo->image_width; col > 0; col--) {
+    register int temp;
+    temp  = UCH(*bufferptr++);
+    temp |= UCH(*bufferptr++) << 8;
+    *ptr++ = rescale[temp];
+  }
+  return 1;
+}
+
+
+METHODDEF(JDIMENSION)
+get_word_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading raw-word-format PPM files with any maxval */
+{
+  ppm_source_ptr source = (ppm_source_ptr) sinfo;
+  register JSAMPROW ptr;
+  register U_CHAR * bufferptr;
+  register JSAMPLE *rescale = source->rescale;
+  JDIMENSION col;
+
+  if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
+    ERREXIT(cinfo, JERR_INPUT_EOF);
+  ptr = source->pub.buffer[0];
+  bufferptr = source->iobuffer;
+  for (col = cinfo->image_width; col > 0; col--) {
+    register int temp;
+    temp  = UCH(*bufferptr++);
+    temp |= UCH(*bufferptr++) << 8;
+    *ptr++ = rescale[temp];
+    temp  = UCH(*bufferptr++);
+    temp |= UCH(*bufferptr++) << 8;
+    *ptr++ = rescale[temp];
+    temp  = UCH(*bufferptr++);
+    temp |= UCH(*bufferptr++) << 8;
+    *ptr++ = rescale[temp];
+  }
+  return 1;
+}
+
+
+/*
+ * Read the file header; return image size and component count.
+ */
+
+METHODDEF(void)
+start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  ppm_source_ptr source = (ppm_source_ptr) sinfo;
+  int c;
+  unsigned int w, h, maxval;
+  boolean need_iobuffer, use_raw_buffer, need_rescale;
+
+  if (getc(source->pub.input_file) != 'P')
+    ERREXIT(cinfo, JERR_PPM_NOT);
+
+  c = getc(source->pub.input_file); /* subformat discriminator character */
+
+  /* detect unsupported variants (ie, PBM) before trying to read header */
+  switch (c) {
+  case '2':			/* it's a text-format PGM file */
+  case '3':			/* it's a text-format PPM file */
+  case '5':			/* it's a raw-format PGM file */
+  case '6':			/* it's a raw-format PPM file */
+    break;
+  default:
+    ERREXIT(cinfo, JERR_PPM_NOT);
+    break;
+  }
+
+  /* fetch the remaining header info */
+  w = read_pbm_integer(cinfo, source->pub.input_file);
+  h = read_pbm_integer(cinfo, source->pub.input_file);
+  maxval = read_pbm_integer(cinfo, source->pub.input_file);
+
+  if (w <= 0 || h <= 0 || maxval <= 0) /* error check */
+    ERREXIT(cinfo, JERR_PPM_NOT);
+
+  cinfo->data_precision = BITS_IN_JSAMPLE; /* we always rescale data to this */
+  cinfo->image_width = (JDIMENSION) w;
+  cinfo->image_height = (JDIMENSION) h;
+
+  /* initialize flags to most common settings */
+  need_iobuffer = TRUE;		/* do we need an I/O buffer? */
+  use_raw_buffer = FALSE;	/* do we map input buffer onto I/O buffer? */
+  need_rescale = TRUE;		/* do we need a rescale array? */
+
+  switch (c) {
+  case '2':			/* it's a text-format PGM file */
+    cinfo->input_components = 1;
+    cinfo->in_color_space = JCS_GRAYSCALE;
+    TRACEMS2(cinfo, 1, JTRC_PGM_TEXT, w, h);
+    source->pub.get_pixel_rows = get_text_gray_row;
+    need_iobuffer = FALSE;
+    break;
+
+  case '3':			/* it's a text-format PPM file */
+    cinfo->input_components = 3;
+    cinfo->in_color_space = JCS_RGB;
+    TRACEMS2(cinfo, 1, JTRC_PPM_TEXT, w, h);
+    source->pub.get_pixel_rows = get_text_rgb_row;
+    need_iobuffer = FALSE;
+    break;
+
+  case '5':			/* it's a raw-format PGM file */
+    cinfo->input_components = 1;
+    cinfo->in_color_space = JCS_GRAYSCALE;
+    TRACEMS2(cinfo, 1, JTRC_PGM, w, h);
+    if (maxval > 255) {
+      source->pub.get_pixel_rows = get_word_gray_row;
+    } else if (maxval == MAXJSAMPLE && SIZEOF(JSAMPLE) == SIZEOF(U_CHAR)) {
+      source->pub.get_pixel_rows = get_raw_row;
+      use_raw_buffer = TRUE;
+      need_rescale = FALSE;
+    } else {
+      source->pub.get_pixel_rows = get_scaled_gray_row;
+    }
+    break;
+
+  case '6':			/* it's a raw-format PPM file */
+    cinfo->input_components = 3;
+    cinfo->in_color_space = JCS_RGB;
+    TRACEMS2(cinfo, 1, JTRC_PPM, w, h);
+    if (maxval > 255) {
+      source->pub.get_pixel_rows = get_word_rgb_row;
+    } else if (maxval == MAXJSAMPLE && SIZEOF(JSAMPLE) == SIZEOF(U_CHAR)) {
+      source->pub.get_pixel_rows = get_raw_row;
+      use_raw_buffer = TRUE;
+      need_rescale = FALSE;
+    } else {
+      source->pub.get_pixel_rows = get_scaled_rgb_row;
+    }
+    break;
+  }
+
+  /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */
+  if (need_iobuffer) {
+    source->buffer_width = (size_t) w * cinfo->input_components *
+      ((maxval<=255) ? SIZEOF(U_CHAR) : (2*SIZEOF(U_CHAR)));
+    source->iobuffer = (U_CHAR *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  source->buffer_width);
+  }
+
+  /* Create compressor input buffer. */
+  if (use_raw_buffer) {
+    /* For unscaled raw-input case, we can just map it onto the I/O buffer. */
+    /* Synthesize a JSAMPARRAY pointer structure */
+    /* Cast here implies near->far pointer conversion on PCs */
+    source->pixrow = (JSAMPROW) source->iobuffer;
+    source->pub.buffer = & source->pixrow;
+    source->pub.buffer_height = 1;
+  } else {
+    /* Need to translate anyway, so make a separate sample buffer. */
+    source->pub.buffer = (*cinfo->mem->alloc_sarray)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE,
+       (JDIMENSION) w * cinfo->input_components, (JDIMENSION) 1);
+    source->pub.buffer_height = 1;
+  }
+
+  /* Compute the rescaling array if required. */
+  if (need_rescale) {
+    INT32 val, half_maxval;
+
+    /* On 16-bit-int machines we have to be careful of maxval = 65535 */
+    source->rescale = (JSAMPLE *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  (size_t) (((long) maxval + 1L) * SIZEOF(JSAMPLE)));
+    half_maxval = maxval / 2;
+    for (val = 0; val <= (INT32) maxval; val++) {
+      /* The multiplication here must be done in 32 bits to avoid overflow */
+      source->rescale[val] = (JSAMPLE) ((val*MAXJSAMPLE + half_maxval)/maxval);
+    }
+  }
+}
+
+
+/*
+ * Finish up at the end of the file.
+ */
+
+METHODDEF(void)
+finish_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  /* no work */
+}
+
+
+/*
+ * The module selection routine for PPM format input.
+ */
+
+GLOBAL(cjpeg_source_ptr)
+jinit_read_ppm (j_compress_ptr cinfo)
+{
+  ppm_source_ptr source;
+
+  /* Create module interface object */
+  source = (ppm_source_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(ppm_source_struct));
+  /* Fill in method ptrs, except get_pixel_rows which start_input sets */
+  source->pub.start_input = start_input_ppm;
+  source->pub.finish_input = finish_input_ppm;
+
+  return (cjpeg_source_ptr) source;
+}
+
+#endif /* PPM_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/rdrle.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/rdrle.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/rdrle.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,387 @@
+/*
+ * rdrle.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to read input images in Utah RLE format.
+ * The Utah Raster Toolkit library is required (version 3.1 or later).
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications.  As they stand, they assume input from
+ * an ordinary stdio stream.  They further assume that reading begins
+ * at the start of the file; start_input may need work if the
+ * user interface has already read some data (e.g., to determine that
+ * the file is indeed RLE format).
+ *
+ * Based on code contributed by Mike Lijewski,
+ * with updates from Robert Hutchinson.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef RLE_SUPPORTED
+
+/* rle.h is provided by the Utah Raster Toolkit. */
+
+#include <rle.h>
+
+/*
+ * We assume that JSAMPLE has the same representation as rle_pixel,
+ * to wit, "unsigned char".  Hence we can't cope with 12- or 16-bit samples.
+ */
+
+#if BITS_IN_JSAMPLE != 8
+  Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
+#endif
+
+/*
+ * We support the following types of RLE files:
+ *   
+ *   GRAYSCALE   - 8 bits, no colormap
+ *   MAPPEDGRAY  - 8 bits, 1 channel colomap
+ *   PSEUDOCOLOR - 8 bits, 3 channel colormap
+ *   TRUECOLOR   - 24 bits, 3 channel colormap
+ *   DIRECTCOLOR - 24 bits, no colormap
+ *
+ * For now, we ignore any alpha channel in the image.
+ */
+
+typedef enum
+  { GRAYSCALE, MAPPEDGRAY, PSEUDOCOLOR, TRUECOLOR, DIRECTCOLOR } rle_kind;
+
+
+/*
+ * Since RLE stores scanlines bottom-to-top, we have to invert the image
+ * to conform to JPEG's top-to-bottom order.  To do this, we read the
+ * incoming image into a virtual array on the first get_pixel_rows call,
+ * then fetch the required row from the virtual array on subsequent calls.
+ */
+
+typedef struct _rle_source_struct * rle_source_ptr;
+
+typedef struct _rle_source_struct {
+  struct cjpeg_source_struct pub; /* public fields */
+
+  rle_kind visual;              /* actual type of input file */
+  jvirt_sarray_ptr image;       /* virtual array to hold the image */
+  JDIMENSION row;		/* current row # in the virtual array */
+  rle_hdr header;               /* Input file information */
+  rle_pixel** rle_row;          /* holds a row returned by rle_getrow() */
+
+} rle_source_struct;
+
+
+/*
+ * Read the file header; return image size and component count.
+ */
+
+METHODDEF(void)
+start_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  rle_source_ptr source = (rle_source_ptr) sinfo;
+  JDIMENSION width, height;
+#ifdef PROGRESS_REPORT
+  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+#endif
+
+  /* Use RLE library routine to get the header info */
+  source->header = *rle_hdr_init(NULL);
+  source->header.rle_file = source->pub.input_file;
+  switch (rle_get_setup(&(source->header))) {
+  case RLE_SUCCESS:
+    /* A-OK */
+    break;
+  case RLE_NOT_RLE:
+    ERREXIT(cinfo, JERR_RLE_NOT);
+    break;
+  case RLE_NO_SPACE:
+    ERREXIT(cinfo, JERR_RLE_MEM);
+    break;
+  case RLE_EMPTY:
+    ERREXIT(cinfo, JERR_RLE_EMPTY);
+    break;
+  case RLE_EOF:
+    ERREXIT(cinfo, JERR_RLE_EOF);
+    break;
+  default:
+    ERREXIT(cinfo, JERR_RLE_BADERROR);
+    break;
+  }
+
+  /* Figure out what we have, set private vars and return values accordingly */
+  
+  width  = source->header.xmax - source->header.xmin + 1;
+  height = source->header.ymax - source->header.ymin + 1;
+  source->header.xmin = 0;		/* realign horizontally */
+  source->header.xmax = width-1;
+
+  cinfo->image_width      = width;
+  cinfo->image_height     = height;
+  cinfo->data_precision   = 8;  /* we can only handle 8 bit data */
+
+  if (source->header.ncolors == 1 && source->header.ncmap == 0) {
+    source->visual     = GRAYSCALE;
+    TRACEMS2(cinfo, 1, JTRC_RLE_GRAY, width, height);
+  } else if (source->header.ncolors == 1 && source->header.ncmap == 1) {
+    source->visual     = MAPPEDGRAY;
+    TRACEMS3(cinfo, 1, JTRC_RLE_MAPGRAY, width, height,
+             1 << source->header.cmaplen);
+  } else if (source->header.ncolors == 1 && source->header.ncmap == 3) {
+    source->visual     = PSEUDOCOLOR;
+    TRACEMS3(cinfo, 1, JTRC_RLE_MAPPED, width, height,
+	     1 << source->header.cmaplen);
+  } else if (source->header.ncolors == 3 && source->header.ncmap == 3) {
+    source->visual     = TRUECOLOR;
+    TRACEMS3(cinfo, 1, JTRC_RLE_FULLMAP, width, height,
+	     1 << source->header.cmaplen);
+  } else if (source->header.ncolors == 3 && source->header.ncmap == 0) {
+    source->visual     = DIRECTCOLOR;
+    TRACEMS2(cinfo, 1, JTRC_RLE, width, height);
+  } else
+    ERREXIT(cinfo, JERR_RLE_UNSUPPORTED);
+  
+  if (source->visual == GRAYSCALE || source->visual == MAPPEDGRAY) {
+    cinfo->in_color_space   = JCS_GRAYSCALE;
+    cinfo->input_components = 1;
+  } else {
+    cinfo->in_color_space   = JCS_RGB;
+    cinfo->input_components = 3;
+  }
+
+  /*
+   * A place to hold each scanline while it's converted.
+   * (GRAYSCALE scanlines don't need converting)
+   */
+  if (source->visual != GRAYSCALE) {
+    source->rle_row = (rle_pixel**) (*cinfo->mem->alloc_sarray)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE,
+       (JDIMENSION) width, (JDIMENSION) cinfo->input_components);
+  }
+
+  /* request a virtual array to hold the image */
+  source->image = (*cinfo->mem->request_virt_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+     (JDIMENSION) (width * source->header.ncolors),
+     (JDIMENSION) height, (JDIMENSION) 1);
+
+#ifdef PROGRESS_REPORT
+  if (progress != NULL) {
+    /* count file input as separate pass */
+    progress->total_extra_passes++;
+  }
+#endif
+
+  source->pub.buffer_height = 1;
+}
+
+
+/*
+ * Read one row of pixels.
+ * Called only after load_image has read the image into the virtual array.
+ * Used for GRAYSCALE, MAPPEDGRAY, TRUECOLOR, and DIRECTCOLOR images.
+ */
+
+METHODDEF(JDIMENSION)
+get_rle_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  rle_source_ptr source = (rle_source_ptr) sinfo;
+
+  source->row--;
+  source->pub.buffer = (*cinfo->mem->access_virt_sarray)
+    ((j_common_ptr) cinfo, source->image, source->row, (JDIMENSION) 1, FALSE);
+
+  return 1;
+}
+
+/*
+ * Read one row of pixels.
+ * Called only after load_image has read the image into the virtual array.
+ * Used for PSEUDOCOLOR images.
+ */
+
+METHODDEF(JDIMENSION)
+get_pseudocolor_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  rle_source_ptr source = (rle_source_ptr) sinfo;
+  JSAMPROW src_row, dest_row;
+  JDIMENSION col;
+  rle_map *colormap;
+  int val;
+
+  colormap = source->header.cmap;
+  dest_row = source->pub.buffer[0];
+  source->row--;
+  src_row = * (*cinfo->mem->access_virt_sarray)
+    ((j_common_ptr) cinfo, source->image, source->row, (JDIMENSION) 1, FALSE);
+
+  for (col = cinfo->image_width; col > 0; col--) {
+    val = GETJSAMPLE(*src_row++);
+    *dest_row++ = (JSAMPLE) (colormap[val      ] >> 8);
+    *dest_row++ = (JSAMPLE) (colormap[val + 256] >> 8);
+    *dest_row++ = (JSAMPLE) (colormap[val + 512] >> 8);
+  }
+
+  return 1;
+}
+
+
+/*
+ * Load the image into a virtual array.  We have to do this because RLE
+ * files start at the lower left while the JPEG standard has them starting
+ * in the upper left.  This is called the first time we want to get a row
+ * of input.  What we do is load the RLE data into the array and then call
+ * the appropriate routine to read one row from the array.  Before returning,
+ * we set source->pub.get_pixel_rows so that subsequent calls go straight to
+ * the appropriate row-reading routine.
+ */
+
+METHODDEF(JDIMENSION)
+load_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  rle_source_ptr source = (rle_source_ptr) sinfo;
+  JDIMENSION row, col;
+  JSAMPROW  scanline, red_ptr, green_ptr, blue_ptr;
+  rle_pixel **rle_row;
+  rle_map *colormap;
+  char channel;
+#ifdef PROGRESS_REPORT
+  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+#endif
+
+  colormap = source->header.cmap;
+  rle_row = source->rle_row;
+
+  /* Read the RLE data into our virtual array.
+   * We assume here that (a) rle_pixel is represented the same as JSAMPLE,
+   * and (b) we are not on a machine where FAR pointers differ from regular.
+   */
+  RLE_CLR_BIT(source->header, RLE_ALPHA); /* don't read the alpha channel */
+
+#ifdef PROGRESS_REPORT
+  if (progress != NULL) {
+    progress->pub.pass_limit = cinfo->image_height;
+    progress->pub.pass_counter = 0;
+    (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+  }
+#endif
+
+  switch (source->visual) {
+
+  case GRAYSCALE:
+  case PSEUDOCOLOR:
+    for (row = 0; row < cinfo->image_height; row++) {
+      rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray)
+         ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE);
+      rle_getrow(&source->header, rle_row);
+#ifdef PROGRESS_REPORT
+      if (progress != NULL) {
+        progress->pub.pass_counter++;
+        (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+      }
+#endif
+    }
+    break;
+
+  case MAPPEDGRAY:
+  case TRUECOLOR:
+    for (row = 0; row < cinfo->image_height; row++) {
+      scanline = * (*cinfo->mem->access_virt_sarray)
+        ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE);
+      rle_row = source->rle_row;
+      rle_getrow(&source->header, rle_row);
+
+      for (col = 0; col < cinfo->image_width; col++) {
+        for (channel = 0; channel < source->header.ncolors; channel++) {
+          *scanline++ = (JSAMPLE)
+            (colormap[GETJSAMPLE(rle_row[channel][col]) + 256 * channel] >> 8);
+        }
+      }
+
+#ifdef PROGRESS_REPORT
+      if (progress != NULL) {
+        progress->pub.pass_counter++;
+        (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+      }
+#endif
+    }
+    break;
+
+  case DIRECTCOLOR:
+    for (row = 0; row < cinfo->image_height; row++) {
+      scanline = * (*cinfo->mem->access_virt_sarray)
+        ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE);
+      rle_getrow(&source->header, rle_row);
+
+      red_ptr   = rle_row[0];
+      green_ptr = rle_row[1];
+      blue_ptr  = rle_row[2];
+
+      for (col = cinfo->image_width; col > 0; col--) {
+        *scanline++ = *red_ptr++;
+        *scanline++ = *green_ptr++;
+        *scanline++ = *blue_ptr++;
+      }
+
+#ifdef PROGRESS_REPORT
+      if (progress != NULL) {
+        progress->pub.pass_counter++;
+        (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+      }
+#endif
+    }
+  }
+
+#ifdef PROGRESS_REPORT
+  if (progress != NULL)
+    progress->completed_extra_passes++;
+#endif
+
+  /* Set up to call proper row-extraction routine in future */
+  if (source->visual == PSEUDOCOLOR) {
+    source->pub.buffer = source->rle_row;
+    source->pub.get_pixel_rows = get_pseudocolor_row;
+  } else {
+    source->pub.get_pixel_rows = get_rle_row;
+  }
+  source->row = cinfo->image_height;
+
+  /* And fetch the topmost (bottommost) row */
+  return (*source->pub.get_pixel_rows) (cinfo, sinfo);   
+}
+
+
+/*
+ * Finish up at the end of the file.
+ */
+
+METHODDEF(void)
+finish_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  /* no work */
+}
+
+
+/*
+ * The module selection routine for RLE format input.
+ */
+
+GLOBAL(cjpeg_source_ptr)
+jinit_read_rle (j_compress_ptr cinfo)
+{
+  rle_source_ptr source;
+
+  /* Create module interface object */
+  source = (rle_source_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+                                  SIZEOF(rle_source_struct));
+  /* Fill in method ptrs */
+  source->pub.start_input = start_input_rle;
+  source->pub.finish_input = finish_input_rle;
+  source->pub.get_pixel_rows = load_image;
+
+  return (cjpeg_source_ptr) source;
+}
+
+#endif /* RLE_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/rdswitch.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/rdswitch.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/rdswitch.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,332 @@
+/*
+ * rdswitch.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to process some of cjpeg's more complicated
+ * command-line switches.  Switches processed here are:
+ *	-qtables file		Read quantization tables from text file
+ *	-scans file		Read scan script from text file
+ *	-qslots N[,N,...]	Set component quantization table selectors
+ *	-sample HxV[,HxV,...]	Set component sampling factors
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+#include <ctype.h>		/* to declare isdigit(), isspace() */
+
+
+LOCAL(int)
+text_getc (FILE * file)
+/* Read next char, skipping over any comments (# to end of line) */
+/* A comment/newline sequence is returned as a newline */
+{
+  register int ch;
+  
+  ch = getc(file);
+  if (ch == '#') {
+    do {
+      ch = getc(file);
+    } while (ch != '\n' && ch != EOF);
+  }
+  return ch;
+}
+
+
+LOCAL(boolean)
+read_text_integer (FILE * file, long * result, int * termchar)
+/* Read an unsigned decimal integer from a file, store it in result */
+/* Reads one trailing character after the integer; returns it in termchar */
+{
+  register int ch;
+  register long val;
+  
+  /* Skip any leading whitespace, detect EOF */
+  do {
+    ch = text_getc(file);
+    if (ch == EOF) {
+      *termchar = ch;
+      return FALSE;
+    }
+  } while (isspace(ch));
+  
+  if (! isdigit(ch)) {
+    *termchar = ch;
+    return FALSE;
+  }
+
+  val = ch - '0';
+  while ((ch = text_getc(file)) != EOF) {
+    if (! isdigit(ch))
+      break;
+    val *= 10;
+    val += ch - '0';
+  }
+  *result = val;
+  *termchar = ch;
+  return TRUE;
+}
+
+
+GLOBAL(boolean)
+read_quant_tables (j_compress_ptr cinfo, char * filename,
+		   int scale_factor, boolean force_baseline)
+/* Read a set of quantization tables from the specified file.
+ * The file is plain ASCII text: decimal numbers with whitespace between.
+ * Comments preceded by '#' may be included in the file.
+ * There may be one to NUM_QUANT_TBLS tables in the file, each of 64 values.
+ * The tables are implicitly numbered 0,1,etc.
+ * NOTE: does not affect the qslots mapping, which will default to selecting
+ * table 0 for luminance (or primary) components, 1 for chrominance components.
+ * You must use -qslots if you want a different component->table mapping.
+ */
+{
+  FILE * fp;
+  int tblno, i, termchar;
+  long val;
+  unsigned int table[DCTSIZE2];
+
+  if ((fp = fopen(filename, "r")) == NULL) {
+    fprintf(stderr, "Can't open table file %s\n", filename);
+    return FALSE;
+  }
+  tblno = 0;
+
+  while (read_text_integer(fp, &val, &termchar)) { /* read 1st element of table */
+    if (tblno >= NUM_QUANT_TBLS) {
+      fprintf(stderr, "Too many tables in file %s\n", filename);
+      fclose(fp);
+      return FALSE;
+    }
+    table[0] = (unsigned int) val;
+    for (i = 1; i < DCTSIZE2; i++) {
+      if (! read_text_integer(fp, &val, &termchar)) {
+	fprintf(stderr, "Invalid table data in file %s\n", filename);
+	fclose(fp);
+	return FALSE;
+      }
+      table[i] = (unsigned int) val;
+    }
+    jpeg_add_quant_table(cinfo, tblno, table, scale_factor, force_baseline);
+    tblno++;
+  }
+
+  if (termchar != EOF) {
+    fprintf(stderr, "Non-numeric data in file %s\n", filename);
+    fclose(fp);
+    return FALSE;
+  }
+
+  fclose(fp);
+  return TRUE;
+}
+
+
+#ifdef C_MULTISCAN_FILES_SUPPORTED
+
+LOCAL(boolean)
+read_scan_integer (FILE * file, long * result, int * termchar)
+/* Variant of read_text_integer that always looks for a non-space termchar;
+ * this simplifies parsing of punctuation in scan scripts.
+ */
+{
+  register int ch;
+
+  if (! read_text_integer(file, result, termchar))
+    return FALSE;
+  ch = *termchar;
+  while (ch != EOF && isspace(ch))
+    ch = text_getc(file);
+  if (isdigit(ch)) {		/* oops, put it back */
+    if (ungetc(ch, file) == EOF)
+      return FALSE;
+    ch = ' ';
+  } else {
+    /* Any separators other than ';' and ':' are ignored;
+     * this allows user to insert commas, etc, if desired.
+     */
+    if (ch != EOF && ch != ';' && ch != ':')
+      ch = ' ';
+  }
+  *termchar = ch;
+  return TRUE;
+}
+
+
+GLOBAL(boolean)
+read_scan_script (j_compress_ptr cinfo, char * filename)
+/* Read a scan script from the specified text file.
+ * Each entry in the file defines one scan to be emitted.
+ * Entries are separated by semicolons ';'.
+ * An entry contains one to four component indexes,
+ * optionally followed by a colon ':' and four progressive-JPEG parameters.
+ * The component indexes denote which component(s) are to be transmitted
+ * in the current scan.  The first component has index 0.
+ * Sequential JPEG is used if the progressive-JPEG parameters are omitted.
+ * The file is free format text: any whitespace may appear between numbers
+ * and the ':' and ';' punctuation marks.  Also, other punctuation (such
+ * as commas or dashes) can be placed between numbers if desired.
+ * Comments preceded by '#' may be included in the file.
+ * Note: we do very little validity checking here;
+ * jcmaster.c will validate the script parameters.
+ */
+{
+  FILE * fp;
+  int scanno, ncomps, termchar;
+  long val;
+  jpeg_scan_info * scanptr;
+#define MAX_SCANS  100		/* quite arbitrary limit */
+  jpeg_scan_info scans[MAX_SCANS];
+
+  if ((fp = fopen(filename, "r")) == NULL) {
+    fprintf(stderr, "Can't open scan definition file %s\n", filename);
+    return FALSE;
+  }
+  scanptr = scans;
+  scanno = 0;
+
+  while (read_scan_integer(fp, &val, &termchar)) {
+    if (scanno >= MAX_SCANS) {
+      fprintf(stderr, "Too many scans defined in file %s\n", filename);
+      fclose(fp);
+      return FALSE;
+    }
+    scanptr->component_index[0] = (int) val;
+    ncomps = 1;
+    while (termchar == ' ') {
+      if (ncomps >= MAX_COMPS_IN_SCAN) {
+	fprintf(stderr, "Too many components in one scan in file %s\n",
+		filename);
+	fclose(fp);
+	return FALSE;
+      }
+      if (! read_scan_integer(fp, &val, &termchar))
+	goto bogus;
+      scanptr->component_index[ncomps] = (int) val;
+      ncomps++;
+    }
+    scanptr->comps_in_scan = ncomps;
+    if (termchar == ':') {
+      if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
+	goto bogus;
+      scanptr->Ss = (int) val;
+      if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
+	goto bogus;
+      scanptr->Se = (int) val;
+      if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
+	goto bogus;
+      scanptr->Ah = (int) val;
+      if (! read_scan_integer(fp, &val, &termchar))
+	goto bogus;
+      scanptr->Al = (int) val;
+    } else {
+      /* set non-progressive parameters */
+      scanptr->Ss = 0;
+      scanptr->Se = DCTSIZE2-1;
+      scanptr->Ah = 0;
+      scanptr->Al = 0;
+    }
+    if (termchar != ';' && termchar != EOF) {
+bogus:
+      fprintf(stderr, "Invalid scan entry format in file %s\n", filename);
+      fclose(fp);
+      return FALSE;
+    }
+    scanptr++, scanno++;
+  }
+
+  if (termchar != EOF) {
+    fprintf(stderr, "Non-numeric data in file %s\n", filename);
+    fclose(fp);
+    return FALSE;
+  }
+
+  if (scanno > 0) {
+    /* Stash completed scan list in cinfo structure.
+     * NOTE: for cjpeg's use, JPOOL_IMAGE is the right lifetime for this data,
+     * but if you want to compress multiple images you'd want JPOOL_PERMANENT.
+     */
+    scanptr = (jpeg_scan_info *)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  scanno * SIZEOF(jpeg_scan_info));
+    MEMCOPY(scanptr, scans, scanno * SIZEOF(jpeg_scan_info));
+    cinfo->scan_info = scanptr;
+    cinfo->num_scans = scanno;
+  }
+
+  fclose(fp);
+  return TRUE;
+}
+
+#endif /* C_MULTISCAN_FILES_SUPPORTED */
+
+
+GLOBAL(boolean)
+set_quant_slots (j_compress_ptr cinfo, char *arg)
+/* Process a quantization-table-selectors parameter string, of the form
+ *     N[,N,...]
+ * If there are more components than parameters, the last value is replicated.
+ */
+{
+  int val = 0;			/* default table # */
+  int ci;
+  char ch;
+
+  for (ci = 0; ci < MAX_COMPONENTS; ci++) {
+    if (*arg) {
+      ch = ',';			/* if not set by sscanf, will be ',' */
+      if (sscanf(arg, "%d%c", &val, &ch) < 1)
+	return FALSE;
+      if (ch != ',')		/* syntax check */
+	return FALSE;
+      if (val < 0 || val >= NUM_QUANT_TBLS) {
+	fprintf(stderr, "JPEG quantization tables are numbered 0..%d\n",
+		NUM_QUANT_TBLS-1);
+	return FALSE;
+      }
+      cinfo->comp_info[ci].quant_tbl_no = val;
+      while (*arg && *arg++ != ',') /* advance to next segment of arg string */
+	;
+    } else {
+      /* reached end of parameter, set remaining components to last table */
+      cinfo->comp_info[ci].quant_tbl_no = val;
+    }
+  }
+  return TRUE;
+}
+
+
+GLOBAL(boolean)
+set_sample_factors (j_compress_ptr cinfo, char *arg)
+/* Process a sample-factors parameter string, of the form
+ *     HxV[,HxV,...]
+ * If there are more components than parameters, "1x1" is assumed for the rest.
+ */
+{
+  int ci, val1, val2;
+  char ch1, ch2;
+
+  for (ci = 0; ci < MAX_COMPONENTS; ci++) {
+    if (*arg) {
+      ch2 = ',';		/* if not set by sscanf, will be ',' */
+      if (sscanf(arg, "%d%c%d%c", &val1, &ch1, &val2, &ch2) < 3)
+	return FALSE;
+      if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */
+	return FALSE;
+      if (val1 <= 0 || val1 > 4 || val2 <= 0 || val2 > 4) {
+	fprintf(stderr, "JPEG sampling factors must be 1..4\n");
+	return FALSE;
+      }
+      cinfo->comp_info[ci].h_samp_factor = val1;
+      cinfo->comp_info[ci].v_samp_factor = val2;
+      while (*arg && *arg++ != ',') /* advance to next segment of arg string */
+	;
+    } else {
+      /* reached end of parameter, set remaining components to 1x1 sampling */
+      cinfo->comp_info[ci].h_samp_factor = 1;
+      cinfo->comp_info[ci].v_samp_factor = 1;
+    }
+  }
+  return TRUE;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/rdtarga.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/rdtarga.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/rdtarga.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,500 @@
+/*
+ * rdtarga.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to read input images in Targa format.
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications.  As they stand, they assume input from
+ * an ordinary stdio stream.  They further assume that reading begins
+ * at the start of the file; start_input may need work if the
+ * user interface has already read some data (e.g., to determine that
+ * the file is indeed Targa format).
+ *
+ * Based on code contributed by Lee Daniel Crocker.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef TARGA_SUPPORTED
+
+
+/* Macros to deal with unsigned chars as efficiently as compiler allows */
+
+#ifdef HAVE_UNSIGNED_CHAR
+typedef unsigned char U_CHAR;
+#define UCH(x)	((int) (x))
+#else /* !HAVE_UNSIGNED_CHAR */
+#ifdef CHAR_IS_UNSIGNED
+typedef char U_CHAR;
+#define UCH(x)	((int) (x))
+#else
+typedef char U_CHAR;
+#define UCH(x)	((int) (x) & 0xFF)
+#endif
+#endif /* HAVE_UNSIGNED_CHAR */
+
+
+#define	ReadOK(file,buffer,len)	(JFREAD(file,buffer,len) == ((size_t) (len)))
+
+
+/* Private version of data source object */
+
+typedef struct _tga_source_struct * tga_source_ptr;
+
+typedef struct _tga_source_struct {
+  struct cjpeg_source_struct pub; /* public fields */
+
+  j_compress_ptr cinfo;		/* back link saves passing separate parm */
+
+  JSAMPARRAY colormap;		/* Targa colormap (converted to my format) */
+
+  jvirt_sarray_ptr whole_image;	/* Needed if funny input row order */
+  JDIMENSION current_row;	/* Current logical row number to read */
+
+  /* Pointer to routine to extract next Targa pixel from input file */
+  JMETHOD(void, read_pixel, (tga_source_ptr sinfo));
+
+  /* Result of read_pixel is delivered here: */
+  U_CHAR tga_pixel[4];
+
+  int pixel_size;		/* Bytes per Targa pixel (1 to 4) */
+
+  /* State info for reading RLE-coded pixels; both counts must be init to 0 */
+  int block_count;		/* # of pixels remaining in RLE block */
+  int dup_pixel_count;		/* # of times to duplicate previous pixel */
+
+  /* This saves the correct pixel-row-expansion method for preload_image */
+  JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
+				       cjpeg_source_ptr sinfo));
+} tga_source_struct;
+
+
+/* For expanding 5-bit pixel values to 8-bit with best rounding */
+
+static const UINT8 c5to8bits[32] = {
+    0,   8,  16,  25,  33,  41,  49,  58,
+   66,  74,  82,  90,  99, 107, 115, 123,
+  132, 140, 148, 156, 165, 173, 181, 189,
+  197, 206, 214, 222, 230, 239, 247, 255
+};
+
+
+
+LOCAL(int)
+read_byte (tga_source_ptr sinfo)
+/* Read next byte from Targa file */
+{
+  register FILE *infile = sinfo->pub.input_file;
+  register int c;
+
+  if ((c = getc(infile)) == EOF)
+    ERREXIT(sinfo->cinfo, JERR_INPUT_EOF);
+  return c;
+}
+
+
+LOCAL(void)
+read_colormap (tga_source_ptr sinfo, int cmaplen, int mapentrysize)
+/* Read the colormap from a Targa file */
+{
+  int i;
+
+  /* Presently only handles 24-bit BGR format */
+  if (mapentrysize != 24)
+    ERREXIT(sinfo->cinfo, JERR_TGA_BADCMAP);
+
+  for (i = 0; i < cmaplen; i++) {
+    sinfo->colormap[2][i] = (JSAMPLE) read_byte(sinfo);
+    sinfo->colormap[1][i] = (JSAMPLE) read_byte(sinfo);
+    sinfo->colormap[0][i] = (JSAMPLE) read_byte(sinfo);
+  }
+}
+
+
+/*
+ * read_pixel methods: get a single pixel from Targa file into tga_pixel[]
+ */
+
+METHODDEF(void)
+read_non_rle_pixel (tga_source_ptr sinfo)
+/* Read one Targa pixel from the input file; no RLE expansion */
+{
+  register FILE *infile = sinfo->pub.input_file;
+  register int i;
+
+  for (i = 0; i < sinfo->pixel_size; i++) {
+    sinfo->tga_pixel[i] = (U_CHAR) getc(infile);
+  }
+}
+
+
+METHODDEF(void)
+read_rle_pixel (tga_source_ptr sinfo)
+/* Read one Targa pixel from the input file, expanding RLE data as needed */
+{
+  register FILE *infile = sinfo->pub.input_file;
+  register int i;
+
+  /* Duplicate previously read pixel? */
+  if (sinfo->dup_pixel_count > 0) {
+    sinfo->dup_pixel_count--;
+    return;
+  }
+
+  /* Time to read RLE block header? */
+  if (--sinfo->block_count < 0) { /* decrement pixels remaining in block */
+    i = read_byte(sinfo);
+    if (i & 0x80) {		/* Start of duplicate-pixel block? */
+      sinfo->dup_pixel_count = i & 0x7F; /* number of dups after this one */
+      sinfo->block_count = 0;	/* then read new block header */
+    } else {
+      sinfo->block_count = i & 0x7F; /* number of pixels after this one */
+    }
+  }
+
+  /* Read next pixel */
+  for (i = 0; i < sinfo->pixel_size; i++) {
+    sinfo->tga_pixel[i] = (U_CHAR) getc(infile);
+  }
+}
+
+
+/*
+ * Read one row of pixels.
+ *
+ * We provide several different versions depending on input file format.
+ */
+
+
+METHODDEF(JDIMENSION)
+get_8bit_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading 8-bit grayscale pixels */
+{
+  tga_source_ptr source = (tga_source_ptr) sinfo;
+  register JSAMPROW ptr;
+  register JDIMENSION col;
+  
+  ptr = source->pub.buffer[0];
+  for (col = cinfo->image_width; col > 0; col--) {
+    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
+    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]);
+  }
+  return 1;
+}
+
+METHODDEF(JDIMENSION)
+get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading 8-bit colormap indexes */
+{
+  tga_source_ptr source = (tga_source_ptr) sinfo;
+  register int t;
+  register JSAMPROW ptr;
+  register JDIMENSION col;
+  register JSAMPARRAY colormap = source->colormap;
+
+  ptr = source->pub.buffer[0];
+  for (col = cinfo->image_width; col > 0; col--) {
+    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
+    t = UCH(source->tga_pixel[0]);
+    *ptr++ = colormap[0][t];
+    *ptr++ = colormap[1][t];
+    *ptr++ = colormap[2][t];
+  }
+  return 1;
+}
+
+METHODDEF(JDIMENSION)
+get_16bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading 16-bit pixels */
+{
+  tga_source_ptr source = (tga_source_ptr) sinfo;
+  register int t;
+  register JSAMPROW ptr;
+  register JDIMENSION col;
+  
+  ptr = source->pub.buffer[0];
+  for (col = cinfo->image_width; col > 0; col--) {
+    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
+    t = UCH(source->tga_pixel[0]);
+    t += UCH(source->tga_pixel[1]) << 8;
+    /* We expand 5 bit data to 8 bit sample width.
+     * The format of the 16-bit (LSB first) input word is
+     *     xRRRRRGGGGGBBBBB
+     */
+    ptr[2] = (JSAMPLE) c5to8bits[t & 0x1F];
+    t >>= 5;
+    ptr[1] = (JSAMPLE) c5to8bits[t & 0x1F];
+    t >>= 5;
+    ptr[0] = (JSAMPLE) c5to8bits[t & 0x1F];
+    ptr += 3;
+  }
+  return 1;
+}
+
+METHODDEF(JDIMENSION)
+get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+/* This version is for reading 24-bit pixels */
+{
+  tga_source_ptr source = (tga_source_ptr) sinfo;
+  register JSAMPROW ptr;
+  register JDIMENSION col;
+  
+  ptr = source->pub.buffer[0];
+  for (col = cinfo->image_width; col > 0; col--) {
+    (*source->read_pixel) (source); /* Load next pixel into tga_pixel */
+    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[2]); /* change BGR to RGB order */
+    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[1]);
+    *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]);
+  }
+  return 1;
+}
+
+/*
+ * Targa also defines a 32-bit pixel format with order B,G,R,A.
+ * We presently ignore the attribute byte, so the code for reading
+ * these pixels is identical to the 24-bit routine above.
+ * This works because the actual pixel length is only known to read_pixel.
+ */
+
+#define get_32bit_row  get_24bit_row
+
+
+/*
+ * This method is for re-reading the input data in standard top-down
+ * row order.  The entire image has already been read into whole_image
+ * with proper conversion of pixel format, but it's in a funny row order.
+ */
+
+METHODDEF(JDIMENSION)
+get_memory_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  tga_source_ptr source = (tga_source_ptr) sinfo;
+  JDIMENSION source_row;
+
+  /* Compute row of source that maps to current_row of normal order */
+  /* For now, assume image is bottom-up and not interlaced. */
+  /* NEEDS WORK to support interlaced images! */
+  source_row = cinfo->image_height - source->current_row - 1;
+
+  /* Fetch that row from virtual array */
+  source->pub.buffer = (*cinfo->mem->access_virt_sarray)
+    ((j_common_ptr) cinfo, source->whole_image,
+     source_row, (JDIMENSION) 1, FALSE);
+
+  source->current_row++;
+  return 1;
+}
+
+
+/*
+ * This method loads the image into whole_image during the first call on
+ * get_pixel_rows.  The get_pixel_rows pointer is then adjusted to call
+ * get_memory_row on subsequent calls.
+ */
+
+METHODDEF(JDIMENSION)
+preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  tga_source_ptr source = (tga_source_ptr) sinfo;
+  JDIMENSION row;
+  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+
+  /* Read the data into a virtual array in input-file row order. */
+  for (row = 0; row < cinfo->image_height; row++) {
+    if (progress != NULL) {
+      progress->pub.pass_counter = (long) row;
+      progress->pub.pass_limit = (long) cinfo->image_height;
+      (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+    }
+    source->pub.buffer = (*cinfo->mem->access_virt_sarray)
+      ((j_common_ptr) cinfo, source->whole_image, row, (JDIMENSION) 1, TRUE);
+    (*source->get_pixel_rows) (cinfo, sinfo);
+  }
+  if (progress != NULL)
+    progress->completed_extra_passes++;
+
+  /* Set up to read from the virtual array in unscrambled order */
+  source->pub.get_pixel_rows = get_memory_row;
+  source->current_row = 0;
+  /* And read the first row */
+  return get_memory_row(cinfo, sinfo);
+}
+
+
+/*
+ * Read the file header; return image size and component count.
+ */
+
+METHODDEF(void)
+start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  tga_source_ptr source = (tga_source_ptr) sinfo;
+  U_CHAR targaheader[18];
+  int idlen, cmaptype, subtype, flags, interlace_type, components;
+  unsigned int width, height, maplen;
+  boolean is_bottom_up;
+
+#define GET_2B(offset)	((unsigned int) UCH(targaheader[offset]) + \
+			 (((unsigned int) UCH(targaheader[offset+1])) << 8))
+
+  if (! ReadOK(source->pub.input_file, targaheader, 18))
+    ERREXIT(cinfo, JERR_INPUT_EOF);
+
+  /* Pretend "15-bit" pixels are 16-bit --- we ignore attribute bit anyway */
+  if (targaheader[16] == 15)
+    targaheader[16] = 16;
+
+  idlen = UCH(targaheader[0]);
+  cmaptype = UCH(targaheader[1]);
+  subtype = UCH(targaheader[2]);
+  maplen = GET_2B(5);
+  width = GET_2B(12);
+  height = GET_2B(14);
+  source->pixel_size = UCH(targaheader[16]) >> 3;
+  flags = UCH(targaheader[17]);	/* Image Descriptor byte */
+
+  is_bottom_up = ((flags & 0x20) == 0);	/* bit 5 set => top-down */
+  interlace_type = flags >> 6;	/* bits 6/7 are interlace code */
+
+  if (cmaptype > 1 ||		/* cmaptype must be 0 or 1 */
+      source->pixel_size < 1 || source->pixel_size > 4 ||
+      (UCH(targaheader[16]) & 7) != 0 || /* bits/pixel must be multiple of 8 */
+      interlace_type != 0)	/* currently don't allow interlaced image */
+    ERREXIT(cinfo, JERR_TGA_BADPARMS);
+  
+  if (subtype > 8) {
+    /* It's an RLE-coded file */
+    source->read_pixel = read_rle_pixel;
+    source->block_count = source->dup_pixel_count = 0;
+    subtype -= 8;
+  } else {
+    /* Non-RLE file */
+    source->read_pixel = read_non_rle_pixel;
+  }
+
+  /* Now should have subtype 1, 2, or 3 */
+  components = 3;		/* until proven different */
+  cinfo->in_color_space = JCS_RGB;
+
+  switch (subtype) {
+  case 1:			/* Colormapped image */
+    if (source->pixel_size == 1 && cmaptype == 1)
+      source->get_pixel_rows = get_8bit_row;
+    else
+      ERREXIT(cinfo, JERR_TGA_BADPARMS);
+    TRACEMS2(cinfo, 1, JTRC_TGA_MAPPED, width, height);
+    break;
+  case 2:			/* RGB image */
+    switch (source->pixel_size) {
+    case 2:
+      source->get_pixel_rows = get_16bit_row;
+      break;
+    case 3:
+      source->get_pixel_rows = get_24bit_row;
+      break;
+    case 4:
+      source->get_pixel_rows = get_32bit_row;
+      break;
+    default:
+      ERREXIT(cinfo, JERR_TGA_BADPARMS);
+      break;
+    }
+    TRACEMS2(cinfo, 1, JTRC_TGA, width, height);
+    break;
+  case 3:			/* Grayscale image */
+    components = 1;
+    cinfo->in_color_space = JCS_GRAYSCALE;
+    if (source->pixel_size == 1)
+      source->get_pixel_rows = get_8bit_gray_row;
+    else
+      ERREXIT(cinfo, JERR_TGA_BADPARMS);
+    TRACEMS2(cinfo, 1, JTRC_TGA_GRAY, width, height);
+    break;
+  default:
+    ERREXIT(cinfo, JERR_TGA_BADPARMS);
+    break;
+  }
+
+  if (is_bottom_up) {
+    /* Create a virtual array to buffer the upside-down image. */
+    source->whole_image = (*cinfo->mem->request_virt_sarray)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+       (JDIMENSION) width * components, (JDIMENSION) height, (JDIMENSION) 1);
+    if (cinfo->progress != NULL) {
+      cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+      progress->total_extra_passes++; /* count file input as separate pass */
+    }
+    /* source->pub.buffer will point to the virtual array. */
+    source->pub.buffer_height = 1; /* in case anyone looks at it */
+    source->pub.get_pixel_rows = preload_image;
+  } else {
+    /* Don't need a virtual array, but do need a one-row input buffer. */
+    source->whole_image = NULL;
+    source->pub.buffer = (*cinfo->mem->alloc_sarray)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE,
+       (JDIMENSION) width * components, (JDIMENSION) 1);
+    source->pub.buffer_height = 1;
+    source->pub.get_pixel_rows = source->get_pixel_rows;
+  }
+  
+  while (idlen--)		/* Throw away ID field */
+    (void) read_byte(source);
+
+  if (maplen > 0) {
+    if (maplen > 256 || GET_2B(3) != 0)
+      ERREXIT(cinfo, JERR_TGA_BADCMAP);
+    /* Allocate space to store the colormap */
+    source->colormap = (*cinfo->mem->alloc_sarray)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) maplen, (JDIMENSION) 3);
+    /* and read it from the file */
+    read_colormap(source, (int) maplen, UCH(targaheader[7]));
+  } else {
+    if (cmaptype)		/* but you promised a cmap! */
+      ERREXIT(cinfo, JERR_TGA_BADPARMS);
+    source->colormap = NULL;
+  }
+
+  cinfo->input_components = components;
+  cinfo->data_precision = 8;
+  cinfo->image_width = width;
+  cinfo->image_height = height;
+}
+
+
+/*
+ * Finish up at the end of the file.
+ */
+
+METHODDEF(void)
+finish_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+{
+  /* no work */
+}
+
+
+/*
+ * The module selection routine for Targa format input.
+ */
+
+GLOBAL(cjpeg_source_ptr)
+jinit_read_targa (j_compress_ptr cinfo)
+{
+  tga_source_ptr source;
+
+  /* Create module interface object */
+  source = (tga_source_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(tga_source_struct));
+  source->cinfo = cinfo;	/* make back link for subroutines */
+  /* Fill in method ptrs, except get_pixel_rows which start_input sets */
+  source->pub.start_input = start_input_tga;
+  source->pub.finish_input = finish_input_tga;
+
+  return (cjpeg_source_ptr) source;
+}
+
+#endif /* TARGA_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/structure.doc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/structure.doc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/structure.doc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,948 @@
+IJG JPEG LIBRARY:  SYSTEM ARCHITECTURE
+
+Copyright (C) 1991-1995, Thomas G. Lane.
+This file is part of the Independent JPEG Group's software.
+For conditions of distribution and use, see the accompanying README file.
+
+
+This file provides an overview of the architecture of the IJG JPEG software;
+that is, the functions of the various modules in the system and the interfaces
+between modules.  For more precise details about any data structure or calling
+convention, see the include files and comments in the source code.
+
+We assume that the reader is already somewhat familiar with the JPEG standard.
+The README file includes references for learning about JPEG.  The file
+libjpeg.doc describes the library from the viewpoint of an application
+programmer using the library; it's best to read that file before this one.
+Also, the file coderules.doc describes the coding style conventions we use.
+
+In this document, JPEG-specific terminology follows the JPEG standard:
+  A "component" means a color channel, e.g., Red or Luminance.
+  A "sample" is a single component value (i.e., one number in the image data).
+  A "coefficient" is a frequency coefficient (a DCT transform output number).
+  A "block" is an 8x8 group of samples or coefficients.
+  An "MCU" (minimum coded unit) is an interleaved set of blocks of size
+	determined by the sampling factors, or a single block in a
+	noninterleaved scan.
+We do not use the terms "pixel" and "sample" interchangeably.  When we say
+pixel, we mean an element of the full-size image, while a sample is an element
+of the downsampled image.  Thus the number of samples may vary across
+components while the number of pixels does not.  (This terminology is not used
+rigorously throughout the code, but it is used in places where confusion would
+otherwise result.)
+
+
+*** System features ***
+
+The IJG distribution contains two parts:
+  * A subroutine library for JPEG compression and decompression.
+  * cjpeg/djpeg, two sample applications that use the library to transform
+    JFIF JPEG files to and from several other image formats.
+cjpeg/djpeg are of no great intellectual complexity: they merely add a simple
+command-line user interface and I/O routines for several uncompressed image
+formats.  This document concentrates on the library itself.
+
+We desire the library to be capable of supporting all JPEG baseline, extended
+sequential, and progressive DCT processes.  Hierarchical processes are not
+supported.
+
+The library does not support the lossless (spatial) JPEG process.  Lossless
+JPEG shares little or no code with lossy JPEG, and would normally be used
+without the extensive pre- and post-processing provided by this library.
+We feel that lossless JPEG is better handled by a separate library.
+
+Within these limits, any set of compression parameters allowed by the JPEG
+spec should be readable for decompression.  (We can be more restrictive about
+what formats we can generate.)  Although the system design allows for all
+parameter values, some uncommon settings are not yet implemented and may
+never be; nonintegral sampling ratios are the prime example.  Furthermore,
+we treat 8-bit vs. 12-bit data precision as a compile-time switch, not a
+run-time option, because most machines can store 8-bit pixels much more
+compactly than 12-bit.
+
+For legal reasons, JPEG arithmetic coding is not currently supported, but
+extending the library to include it would be straightforward.
+
+By itself, the library handles only interchange JPEG datastreams --- in
+particular the widely used JFIF file format.  The library can be used by
+surrounding code to process interchange or abbreviated JPEG datastreams that
+are embedded in more complex file formats.  (For example, libtiff uses this
+library to implement JPEG compression within the TIFF file format.)
+
+The library includes a substantial amount of code that is not covered by the
+JPEG standard but is necessary for typical applications of JPEG.  These
+functions preprocess the image before JPEG compression or postprocess it after
+decompression.  They include colorspace conversion, downsampling/upsampling,
+and color quantization.  This code can be omitted if not needed.
+
+A wide range of quality vs. speed tradeoffs are possible in JPEG processing,
+and even more so in decompression postprocessing.  The decompression library
+provides multiple implementations that cover most of the useful tradeoffs,
+ranging from very-high-quality down to fast-preview operation.  On the
+compression side we have generally not provided low-quality choices, since
+compression is normally less time-critical.  It should be understood that the
+low-quality modes may not meet the JPEG standard's accuracy requirements;
+nonetheless, they are useful for viewers.
+
+
+*** Portability issues ***
+
+Portability is an essential requirement for the library.  The key portability
+issues that show up at the level of system architecture are:
+
+1.  Memory usage.  We want the code to be able to run on PC-class machines
+with limited memory.  Images should therefore be processed sequentially (in
+strips), to avoid holding the whole image in memory at once.  Where a
+full-image buffer is necessary, we should be able to use either virtual memory
+or temporary files.
+
+2.  Near/far pointer distinction.  To run efficiently on 80x86 machines, the
+code should distinguish "small" objects (kept in near data space) from
+"large" ones (kept in far data space).  This is an annoying restriction, but
+fortunately it does not impact code quality for less brain-damaged machines,
+and the source code clutter turns out to be minimal with sufficient use of
+pointer typedefs.
+
+3. Data precision.  We assume that "char" is at least 8 bits, "short" and
+"int" at least 16, "long" at least 32.  The code will work fine with larger
+data sizes, although memory may be used inefficiently in some cases.  However,
+the JPEG compressed datastream must ultimately appear on external storage as a
+sequence of 8-bit bytes if it is to conform to the standard.  This may pose a
+problem on machines where char is wider than 8 bits.  The library represents
+compressed data as an array of values of typedef JOCTET.  If no data type
+exactly 8 bits wide is available, custom data source and data destination
+modules must be written to unpack and pack the chosen JOCTET datatype into
+8-bit external representation.
+
+
+*** System overview ***
+
+The compressor and decompressor are each divided into two main sections:
+the JPEG compressor or decompressor proper, and the preprocessing or
+postprocessing functions.  The interface between these two sections is the
+image data that the official JPEG spec regards as its input or output: this
+data is in the colorspace to be used for compression, and it is downsampled
+to the sampling factors to be used.  The preprocessing and postprocessing
+steps are responsible for converting a normal image representation to or from
+this form.  (Those few applications that want to deal with YCbCr downsampled
+data can skip the preprocessing or postprocessing step.)
+
+Looking more closely, the compressor library contains the following main
+elements:
+
+  Preprocessing:
+    * Color space conversion (e.g., RGB to YCbCr).
+    * Edge expansion and downsampling.  Optionally, this step can do simple
+      smoothing --- this is often helpful for low-quality source data.
+  JPEG proper:
+    * MCU assembly, DCT, quantization.
+    * Entropy coding (sequential or progressive, Huffman or arithmetic).
+
+In addition to these modules we need overall control, marker generation,
+and support code (memory management & error handling).  There is also a
+module responsible for physically writing the output data --- typically
+this is just an interface to fwrite(), but some applications may need to
+do something else with the data.
+
+The decompressor library contains the following main elements:
+
+  JPEG proper:
+    * Entropy decoding (sequential or progressive, Huffman or arithmetic).
+    * Dequantization, inverse DCT, MCU disassembly.
+  Postprocessing:
+    * Upsampling.  Optionally, this step may be able to do more general
+      rescaling of the image.
+    * Color space conversion (e.g., YCbCr to RGB).  This step may also
+      provide gamma adjustment [ currently it does not ].
+    * Optional color quantization (e.g., reduction to 256 colors).
+    * Optional color precision reduction (e.g., 24-bit to 15-bit color).
+      [This feature is not currently implemented.]
+
+We also need overall control, marker parsing, and a data source module.
+The support code (memory management & error handling) can be shared with
+the compression half of the library.
+
+There may be several implementations of each of these elements, particularly
+in the decompressor, where a wide range of speed/quality tradeoffs is very
+useful.  It must be understood that some of the best speedups involve
+merging adjacent steps in the pipeline.  For example, upsampling, color space
+conversion, and color quantization might all be done at once when using a
+low-quality ordered-dither technique.  The system architecture is designed to
+allow such merging where appropriate.
+
+
+Note: it is convenient to regard edge expansion (padding to block boundaries)
+as a preprocessing/postprocessing function, even though the JPEG spec includes
+it in compression/decompression.  We do this because downsampling/upsampling
+can be simplified a little if they work on padded data: it's not necessary to
+have special cases at the right and bottom edges.  Therefore the interface
+buffer is always an integral number of blocks wide and high, and we expect
+compression preprocessing to pad the source data properly.  Padding will occur
+only to the next block (8-sample) boundary.  In an interleaved-scan situation,
+additional dummy blocks may be used to fill out MCUs, but the MCU assembly and
+disassembly logic will create or discard these blocks internally.  (This is
+advantageous for speed reasons, since we avoid DCTing the dummy blocks.
+It also permits a small reduction in file size, because the compressor can
+choose dummy block contents so as to minimize their size in compressed form.
+Finally, it makes the interface buffer specification independent of whether
+the file is actually interleaved or not.)  Applications that wish to deal
+directly with the downsampled data must provide similar buffering and padding
+for odd-sized images.
+
+
+*** Poor man's object-oriented programming ***
+
+It should be clear by now that we have a lot of quasi-independent processing
+steps, many of which have several possible behaviors.  To avoid cluttering the
+code with lots of switch statements, we use a simple form of object-style
+programming to separate out the different possibilities.
+
+For example, two different color quantization algorithms could be implemented
+as two separate modules that present the same external interface; at runtime,
+the calling code will access the proper module indirectly through an "object".
+
+We can get the limited features we need while staying within portable C.
+The basic tool is a function pointer.  An "object" is just a struct
+containing one or more function pointer fields, each of which corresponds to
+a method name in real object-oriented languages.  During initialization we
+fill in the function pointers with references to whichever module we have
+determined we need to use in this run.  Then invocation of the module is done
+by indirecting through a function pointer; on most machines this is no more
+expensive than a switch statement, which would be the only other way of
+making the required run-time choice.  The really significant benefit, of
+course, is keeping the source code clean and well structured.
+
+We can also arrange to have private storage that varies between different
+implementations of the same kind of object.  We do this by making all the
+module-specific object structs be separately allocated entities, which will
+be accessed via pointers in the master compression or decompression struct.
+The "public" fields or methods for a given kind of object are specified by
+a commonly known struct.  But a module's initialization code can allocate
+a larger struct that contains the common struct as its first member, plus
+additional private fields.  With appropriate pointer casting, the module's
+internal functions can access these private fields.  (For a simple example,
+see jdatadst.c, which implements the external interface specified by struct
+jpeg_destination_mgr, but adds extra fields.)
+
+(Of course this would all be a lot easier if we were using C++, but we are
+not yet prepared to assume that everyone has a C++ compiler.)
+
+An important benefit of this scheme is that it is easy to provide multiple
+versions of any method, each tuned to a particular case.  While a lot of
+precalculation might be done to select an optimal implementation of a method,
+the cost per invocation is constant.  For example, the upsampling step might
+have a "generic" method, plus one or more "hardwired" methods for the most
+popular sampling factors; the hardwired methods would be faster because they'd
+use straight-line code instead of for-loops.  The cost to determine which
+method to use is paid only once, at startup, and the selection criteria are
+hidden from the callers of the method.
+
+This plan differs a little bit from usual object-oriented structures, in that
+only one instance of each object class will exist during execution.  The
+reason for having the class structure is that on different runs we may create
+different instances (choose to execute different modules).  You can think of
+the term "method" as denoting the common interface presented by a particular
+set of interchangeable functions, and "object" as denoting a group of related
+methods, or the total shared interface behavior of a group of modules.
+
+
+*** Overall control structure ***
+
+We previously mentioned the need for overall control logic in the compression
+and decompression libraries.  In IJG implementations prior to v5, overall
+control was mostly provided by "pipeline control" modules, which proved to be
+large, unwieldy, and hard to understand.  To improve the situation, the
+control logic has been subdivided into multiple modules.  The control modules
+consist of:
+
+1. Master control for module selection and initialization.  This has two
+responsibilities:
+
+   1A.  Startup initialization at the beginning of image processing.
+        The individual processing modules to be used in this run are selected
+        and given initialization calls.
+
+   1B.  Per-pass control.  This determines how many passes will be performed
+        and calls each active processing module to configure itself
+        appropriately at the beginning of each pass.  End-of-pass processing,
+	where necessary, is also invoked from the master control module.
+
+   Method selection is partially distributed, in that a particular processing
+   module may contain several possible implementations of a particular method,
+   which it will select among when given its initialization call.  The master
+   control code need only be concerned with decisions that affect more than
+   one module.
+ 
+2. Data buffering control.  A separate control module exists for each
+   inter-processing-step data buffer.  This module is responsible for
+   invoking the processing steps that write or read that data buffer.
+
+Each buffer controller sees the world as follows:
+
+input data => processing step A => buffer => processing step B => output data
+                      |              |               |
+              ------------------ controller ------------------
+
+The controller knows the dataflow requirements of steps A and B: how much data
+they want to accept in one chunk and how much they output in one chunk.  Its
+function is to manage its buffer and call A and B at the proper times.
+
+A data buffer control module may itself be viewed as a processing step by a
+higher-level control module; thus the control modules form a binary tree with
+elementary processing steps at the leaves of the tree.
+
+The control modules are objects.  A considerable amount of flexibility can
+be had by replacing implementations of a control module.  For example:
+* Merging of adjacent steps in the pipeline is done by replacing a control
+  module and its pair of processing-step modules with a single processing-
+  step module.  (Hence the possible merges are determined by the tree of
+  control modules.)
+* In some processing modes, a given interstep buffer need only be a "strip"
+  buffer large enough to accommodate the desired data chunk sizes.  In other
+  modes, a full-image buffer is needed and several passes are required.
+  The control module determines which kind of buffer is used and manipulates
+  virtual array buffers as needed.  One or both processing steps may be
+  unaware of the multi-pass behavior.
+
+In theory, we might be able to make all of the data buffer controllers
+interchangeable and provide just one set of implementations for all.  In
+practice, each one contains considerable special-case processing for its
+particular job.  The buffer controller concept should be regarded as an
+overall system structuring principle, not as a complete description of the
+task performed by any one controller.
+
+
+*** Compression object structure ***
+
+Here is a sketch of the logical structure of the JPEG compression library:
+
+                                                 |-- Colorspace conversion
+                  |-- Preprocessing controller --|
+                  |                              |-- Downsampling
+Main controller --|
+                  |                            |-- Forward DCT, quantize
+                  |-- Coefficient controller --|
+                                               |-- Entropy encoding
+
+This sketch also describes the flow of control (subroutine calls) during
+typical image data processing.  Each of the components shown in the diagram is
+an "object" which may have several different implementations available.  One
+or more source code files contain the actual implementation(s) of each object.
+
+The objects shown above are:
+
+* Main controller: buffer controller for the subsampled-data buffer, which
+  holds the preprocessed input data.  This controller invokes preprocessing to
+  fill the subsampled-data buffer, and JPEG compression to empty it.  There is
+  usually no need for a full-image buffer here; a strip buffer is adequate.
+
+* Preprocessing controller: buffer controller for the downsampling input data
+  buffer, which lies between colorspace conversion and downsampling.  Note
+  that a unified conversion/downsampling module would probably replace this
+  controller entirely.
+
+* Colorspace conversion: converts application image data into the desired
+  JPEG color space; also changes the data from pixel-interleaved layout to
+  separate component planes.  Processes one pixel row at a time.
+
+* Downsampling: performs reduction of chroma components as required.
+  Optionally may perform pixel-level smoothing as well.  Processes a "row
+  group" at a time, where a row group is defined as Vmax pixel rows of each
+  component before downsampling, and Vk sample rows afterwards (remember Vk
+  differs across components).  Some downsampling or smoothing algorithms may
+  require context rows above and below the current row group; the
+  preprocessing controller is responsible for supplying these rows via proper
+  buffering.  The downsampler is responsible for edge expansion at the right
+  edge (i.e., extending each sample row to a multiple of 8 samples); but the
+  preprocessing controller is responsible for vertical edge expansion (i.e.,
+  duplicating the bottom sample row as needed to make a multiple of 8 rows).
+
+* Coefficient controller: buffer controller for the DCT-coefficient data.
+  This controller handles MCU assembly, including insertion of dummy DCT
+  blocks when needed at the right or bottom edge.  When performing
+  Huffman-code optimization or emitting a multiscan JPEG file, this
+  controller is responsible for buffering the full image.  The equivalent of
+  one fully interleaved MCU row of subsampled data is processed per call,
+  even when the JPEG file is noninterleaved.
+
+* Forward DCT and quantization: Perform DCT, quantize, and emit coefficients.
+  Works on one or more DCT blocks at a time.  (Note: the coefficients are now
+  emitted in normal array order, which the entropy encoder is expected to
+  convert to zigzag order as necessary.  Prior versions of the IJG code did
+  the conversion to zigzag order within the quantization step.)
+
+* Entropy encoding: Perform Huffman or arithmetic entropy coding and emit the
+  coded data to the data destination module.  Works on one MCU per call.
+  For progressive JPEG, the same DCT blocks are fed to the entropy coder
+  during each pass, and the coder must emit the appropriate subset of
+  coefficients.
+
+In addition to the above objects, the compression library includes these
+objects:
+
+* Master control: determines the number of passes required, controls overall
+  and per-pass initialization of the other modules.
+
+* Marker writing: generates JPEG markers (except for RSTn, which is emitted
+  by the entropy encoder when needed).
+
+* Data destination manager: writes the output JPEG datastream to its final
+  destination (e.g., a file).  The destination manager supplied with the
+  library knows how to write to a stdio stream; for other behaviors, the
+  surrounding application may provide its own destination manager.
+
+* Memory manager: allocates and releases memory, controls virtual arrays
+  (with backing store management, where required).
+
+* Error handler: performs formatting and output of error and trace messages;
+  determines handling of nonfatal errors.  The surrounding application may
+  override some or all of this object's methods to change error handling.
+
+* Progress monitor: supports output of "percent-done" progress reports.
+  This object represents an optional callback to the surrounding application:
+  if wanted, it must be supplied by the application.
+
+The error handler, destination manager, and progress monitor objects are
+defined as separate objects in order to simplify application-specific
+customization of the JPEG library.  A surrounding application may override
+individual methods or supply its own all-new implementation of one of these
+objects.  The object interfaces for these objects are therefore treated as
+part of the application interface of the library, whereas the other objects
+are internal to the library.
+
+The error handler and memory manager are shared by JPEG compression and
+decompression; the progress monitor, if used, may be shared as well.
+
+
+*** Decompression object structure ***
+
+Here is a sketch of the logical structure of the JPEG decompression library:
+
+                                               |-- Entropy decoding
+                  |-- Coefficient controller --|
+                  |                            |-- Dequantize, Inverse DCT
+Main controller --|
+                  |                               |-- Upsampling
+                  |-- Postprocessing controller --|   |-- Colorspace conversion
+                                                  |-- Color quantization
+                                                  |-- Color precision reduction
+
+As before, this diagram also represents typical control flow.  The objects
+shown are:
+
+* Main controller: buffer controller for the subsampled-data buffer, which
+  holds the output of JPEG decompression proper.  This controller's primary
+  task is to feed the postprocessing procedure.  Some upsampling algorithms
+  may require context rows above and below the current row group; when this
+  is true, the main controller is responsible for managing its buffer so as
+  to make context rows available.  In the current design, the main buffer is
+  always a strip buffer; a full-image buffer is never required.
+
+* Coefficient controller: buffer controller for the DCT-coefficient data.
+  This controller handles MCU disassembly, including deletion of any dummy
+  DCT blocks at the right or bottom edge.  When reading a multiscan JPEG
+  file, this controller is responsible for buffering the full image.
+  (Buffering DCT coefficients, rather than samples, is necessary to support
+  progressive JPEG.)  The equivalent of one fully interleaved MCU row of
+  subsampled data is processed per call, even when the source JPEG file is
+  noninterleaved.
+
+* Entropy decoding: Read coded data from the data source module and perform
+  Huffman or arithmetic entropy decoding.  Works on one MCU per call.
+  For progressive JPEG decoding, the coefficient controller supplies the prior
+  coefficients of each MCU (initially all zeroes), which the entropy decoder
+  modifies in each scan.
+
+* Dequantization and inverse DCT: like it says.  Note that the coefficients
+  buffered by the coefficient controller have NOT been dequantized; we
+  merge dequantization and inverse DCT into a single step for speed reasons.
+  When scaled-down output is asked for, simplified DCT algorithms may be used
+  that emit only 1x1, 2x2, or 4x4 samples per DCT block, not the full 8x8.
+  Works on one DCT block at a time.
+
+* Postprocessing controller: buffer controller for the color quantization
+  input buffer, when quantization is in use.  (Without quantization, this
+  controller just calls the upsampler.)  For two-pass quantization, this
+  controller is responsible for buffering the full-image data.
+
+* Upsampling: restores chroma components to full size.  (May support more
+  general output rescaling, too.  Note that if undersized DCT outputs have
+  been emitted by the DCT module, this module must adjust so that properly
+  sized outputs are created.)  Works on one row group at a time.  This module
+  also calls the color conversion module, so its top level is effectively a
+  buffer controller for the upsampling->color conversion buffer.  However, in
+  all but the highest-quality operating modes, upsampling and color
+  conversion are likely to be merged into a single step.
+
+* Colorspace conversion: convert from JPEG color space to output color space,
+  and change data layout from separate component planes to pixel-interleaved.
+  Works on one pixel row at a time.
+
+* Color quantization: reduce the data to colormapped form, using either an
+  externally specified colormap or an internally generated one.  This module
+  is not used for full-color output.  Works on one pixel row at a time; may
+  require two passes to generate a color map.  Note that the output will
+  always be a single component representing colormap indexes.  In the current
+  design, the output values are JSAMPLEs, so an 8-bit compilation cannot
+  quantize to more than 256 colors.  This is unlikely to be a problem in
+  practice.
+
+* Color reduction: this module handles color precision reduction, e.g.,
+  generating 15-bit color (5 bits/primary) from JPEG's 24-bit output.
+  Not quite clear yet how this should be handled... should we merge it with
+  colorspace conversion???
+
+Note that some high-speed operating modes might condense the entire
+postprocessing sequence to a single module (upsample, color convert, and
+quantize in one step).
+
+In addition to the above objects, the decompression library includes these
+objects:
+
+* Master control: determines the number of passes required, controls overall
+  and per-pass initialization of the other modules.  This is subdivided into
+  input and output control: jdinput.c controls only input-side processing,
+  while jdmaster.c handles overall initialization and output-side control.
+
+* Marker reading: decodes JPEG markers (except for RSTn).
+
+* Data source manager: supplies the input JPEG datastream.  The source
+  manager supplied with the library knows how to read from a stdio stream;
+  for other behaviors, the surrounding application may provide its own source
+  manager.
+
+* Memory manager: same as for compression library.
+
+* Error handler: same as for compression library.
+
+* Progress monitor: same as for compression library.
+
+As with compression, the data source manager, error handler, and progress
+monitor are candidates for replacement by a surrounding application.
+
+
+*** Decompression input and output separation ***
+
+To support efficient incremental display of progressive JPEG files, the
+decompressor is divided into two sections that can run independently:
+
+1. Data input includes marker parsing, entropy decoding, and input into the
+   coefficient controller's DCT coefficient buffer.  Note that this
+   processing is relatively cheap and fast.
+
+2. Data output reads from the DCT coefficient buffer and performs the IDCT
+   and all postprocessing steps.
+
+For a progressive JPEG file, the data input processing is allowed to get
+arbitrarily far ahead of the data output processing.  (This occurs only
+if the application calls jpeg_consume_input(); otherwise input and output
+run in lockstep, since the input section is called only when the output
+section needs more data.)  In this way the application can avoid making
+extra display passes when data is arriving faster than the display pass
+can run.  Furthermore, it is possible to abort an output pass without
+losing anything, since the coefficient buffer is read-only as far as the
+output section is concerned.  See libjpeg.doc for more detail.
+
+A full-image coefficient array is only created if the JPEG file has multiple
+scans (or if the application specifies buffered-image mode anyway).  When
+reading a single-scan file, the coefficient controller normally creates only
+a one-MCU buffer, so input and output processing must run in lockstep in this
+case.  jpeg_consume_input() is effectively a no-op in this situation.
+
+The main impact of dividing the decompressor in this fashion is that we must
+be very careful with shared variables in the cinfo data structure.  Each
+variable that can change during the course of decompression must be
+classified as belonging to data input or data output, and each section must
+look only at its own variables.  For example, the data output section may not
+depend on any of the variables that describe the current scan in the JPEG
+file, because these may change as the data input section advances into a new
+scan.
+
+The progress monitor is (somewhat arbitrarily) defined to treat input of the
+file as one pass when buffered-image mode is not used, and to ignore data
+input work completely when buffered-image mode is used.  Note that the
+library has no reliable way to predict the number of passes when dealing
+with a progressive JPEG file, nor can it predict the number of output passes
+in buffered-image mode.  So the work estimate is inherently bogus anyway.
+
+No comparable division is currently made in the compression library, because
+there isn't any real need for it.
+
+
+*** Data formats ***
+
+Arrays of pixel sample values use the following data structure:
+
+    typedef something JSAMPLE;		a pixel component value, 0..MAXJSAMPLE
+    typedef JSAMPLE *JSAMPROW;		ptr to a row of samples
+    typedef JSAMPROW *JSAMPARRAY;	ptr to a list of rows
+    typedef JSAMPARRAY *JSAMPIMAGE;	ptr to a list of color-component arrays
+
+The basic element type JSAMPLE will typically be one of unsigned char,
+(signed) char, or short.  Short will be used if samples wider than 8 bits are
+to be supported (this is a compile-time option).  Otherwise, unsigned char is
+used if possible.  If the compiler only supports signed chars, then it is
+necessary to mask off the value when reading.  Thus, all reads of JSAMPLE
+values must be coded as "GETJSAMPLE(value)", where the macro will be defined
+as "((value) & 0xFF)" on signed-char machines and "((int) (value))" elsewhere.
+
+With these conventions, JSAMPLE values can be assumed to be >= 0.  This helps
+simplify correct rounding during downsampling, etc.  The JPEG standard's
+specification that sample values run from -128..127 is accommodated by
+subtracting 128 just as the sample value is copied into the source array for
+the DCT step (this will be an array of signed ints).  Similarly, during
+decompression the output of the IDCT step will be immediately shifted back to
+0..255.  (NB: different values are required when 12-bit samples are in use.
+The code is written in terms of MAXJSAMPLE and CENTERJSAMPLE, which will be
+defined as 255 and 128 respectively in an 8-bit implementation, and as 4095
+and 2048 in a 12-bit implementation.)
+
+We use a pointer per row, rather than a two-dimensional JSAMPLE array.  This
+choice costs only a small amount of memory and has several benefits:
+* Code using the data structure doesn't need to know the allocated width of
+  the rows.  This simplifies edge expansion/compression, since we can work
+  in an array that's wider than the logical picture width.
+* Indexing doesn't require multiplication; this is a performance win on many
+  machines.
+* Arrays with more than 64K total elements can be supported even on machines
+  where malloc() cannot allocate chunks larger than 64K.
+* The rows forming a component array may be allocated at different times
+  without extra copying.  This trick allows some speedups in smoothing steps
+  that need access to the previous and next rows.
+
+Note that each color component is stored in a separate array; we don't use the
+traditional layout in which the components of a pixel are stored together.
+This simplifies coding of modules that work on each component independently,
+because they don't need to know how many components there are.  Furthermore,
+we can read or write each component to a temporary file independently, which
+is helpful when dealing with noninterleaved JPEG files.
+
+In general, a specific sample value is accessed by code such as
+	GETJSAMPLE(image[colorcomponent][row][col])
+where col is measured from the image left edge, but row is measured from the
+first sample row currently in memory.  Either of the first two indexings can
+be precomputed by copying the relevant pointer.
+
+
+Since most image-processing applications prefer to work on images in which
+the components of a pixel are stored together, the data passed to or from the
+surrounding application uses the traditional convention: a single pixel is
+represented by N consecutive JSAMPLE values, and an image row is an array of
+(# of color components)*(image width) JSAMPLEs.  One or more rows of data can
+be represented by a pointer of type JSAMPARRAY in this scheme.  This scheme is
+converted to component-wise storage inside the JPEG library.  (Applications
+that want to skip JPEG preprocessing or postprocessing will have to contend
+with component-wise storage.)
+
+
+Arrays of DCT-coefficient values use the following data structure:
+
+    typedef short JCOEF;		a 16-bit signed integer
+    typedef JCOEF JBLOCK[DCTSIZE2];	an 8x8 block of coefficients
+    typedef JBLOCK *JBLOCKROW;		ptr to one horizontal row of 8x8 blocks
+    typedef JBLOCKROW *JBLOCKARRAY;	ptr to a list of such rows
+    typedef JBLOCKARRAY *JBLOCKIMAGE;	ptr to a list of color component arrays
+
+The underlying type is at least a 16-bit signed integer; while "short" is big
+enough on all machines of interest, on some machines it is preferable to use
+"int" for speed reasons, despite the storage cost.  Coefficients are grouped
+into 8x8 blocks (but we always use #defines DCTSIZE and DCTSIZE2 rather than
+"8" and "64").
+
+The contents of a coefficient block may be in either "natural" or zigzagged
+order, and may be true values or divided by the quantization coefficients,
+depending on where the block is in the processing pipeline.  In the current
+library, coefficient blocks are kept in natural order everywhere; the entropy
+codecs zigzag or dezigzag the data as it is written or read.  The blocks
+contain quantized coefficients everywhere outside the DCT/IDCT subsystems.
+(This latter decision may need to be revisited to support variable
+quantization a la JPEG Part 3.)
+
+Notice that the allocation unit is now a row of 8x8 blocks, corresponding to
+eight rows of samples.  Otherwise the structure is much the same as for
+samples, and for the same reasons.
+
+On machines where malloc() can't handle a request bigger than 64Kb, this data
+structure limits us to rows of less than 512 JBLOCKs, or a picture width of
+4000+ pixels.  This seems an acceptable restriction.
+
+
+On 80x86 machines, the bottom-level pointer types (JSAMPROW and JBLOCKROW)
+must be declared as "far" pointers, but the upper levels can be "near"
+(implying that the pointer lists are allocated in the DS segment).
+We use a #define symbol FAR, which expands to the "far" keyword when
+compiling on 80x86 machines and to nothing elsewhere.
+
+
+*** Suspendable processing ***
+
+In some applications it is desirable to use the JPEG library as an
+incremental, memory-to-memory filter.  In this situation the data source or
+destination may be a limited-size buffer, and we can't rely on being able to
+empty or refill the buffer at arbitrary times.  Instead the application would
+like to have control return from the library at buffer overflow/underrun, and
+then resume compression or decompression at a later time.
+
+This scenario is supported for simple cases.  (For anything more complex, we
+recommend that the application "bite the bullet" and develop real multitasking
+capability.)  The libjpeg.doc file goes into more detail about the usage and
+limitations of this capability; here we address the implications for library
+structure.
+
+The essence of the problem is that the entropy codec (coder or decoder) must
+be prepared to stop at arbitrary times.  In turn, the controllers that call
+the entropy codec must be able to stop before having produced or consumed all
+the data that they normally would handle in one call.  That part is reasonably
+straightforward: we make the controller call interfaces include "progress
+counters" which indicate the number of data chunks successfully processed, and
+we require callers to test the counter rather than just assume all of the data
+was processed.
+
+Rather than trying to restart at an arbitrary point, the current Huffman
+codecs are designed to restart at the beginning of the current MCU after a
+suspension due to buffer overflow/underrun.  At the start of each call, the
+codec's internal state is loaded from permanent storage (in the JPEG object
+structures) into local variables.  On successful completion of the MCU, the
+permanent state is updated.  (This copying is not very expensive, and may even
+lead to *improved* performance if the local variables can be registerized.)
+If a suspension occurs, the codec simply returns without updating the state,
+thus effectively reverting to the start of the MCU.  Note that this implies
+leaving some data unprocessed in the source/destination buffer (ie, the
+compressed partial MCU).  The data source/destination module interfaces are
+specified so as to make this possible.  This also implies that the data buffer
+must be large enough to hold a worst-case compressed MCU; a couple thousand
+bytes should be enough.
+
+In a successive-approximation AC refinement scan, the progressive Huffman
+decoder has to be able to undo assignments of newly nonzero coefficients if it
+suspends before the MCU is complete, since decoding requires distinguishing
+previously-zero and previously-nonzero coefficients.  This is a bit tedious
+but probably won't have much effect on performance.  Other variants of Huffman
+decoding need not worry about this, since they will just store the same values
+again if forced to repeat the MCU.
+
+This approach would probably not work for an arithmetic codec, since its
+modifiable state is quite large and couldn't be copied cheaply.  Instead it
+would have to suspend and resume exactly at the point of the buffer end.
+
+The JPEG marker reader is designed to cope with suspension at an arbitrary
+point.  It does so by backing up to the start of the marker parameter segment,
+so the data buffer must be big enough to hold the largest marker of interest.
+Again, a couple KB should be adequate.  (A special "skip" convention is used
+to bypass COM and APPn markers, so these can be larger than the buffer size
+without causing problems; otherwise a 64K buffer would be needed in the worst
+case.)
+
+The JPEG marker writer currently does *not* cope with suspension.  I feel that
+this is not necessary; it is much easier simply to require the application to
+ensure there is enough buffer space before starting.  (An empty 2K buffer is
+more than sufficient for the header markers; and ensuring there are a dozen or
+two bytes available before calling jpeg_finish_compress() will suffice for the
+trailer.)  This would not work for writing multi-scan JPEG files, but
+we simply do not intend to support that capability with suspension.
+
+
+*** Memory manager services ***
+
+The JPEG library's memory manager controls allocation and deallocation of
+memory, and it manages large "virtual" data arrays on machines where the
+operating system does not provide virtual memory.  Note that the same
+memory manager serves both compression and decompression operations.
+
+In all cases, allocated objects are tied to a particular compression or
+decompression master record, and they will be released when that master
+record is destroyed.
+
+The memory manager does not provide explicit deallocation of objects.
+Instead, objects are created in "pools" of free storage, and a whole pool
+can be freed at once.  This approach helps prevent storage-leak bugs, and
+it speeds up operations whenever malloc/free are slow (as they often are).
+The pools can be regarded as lifetime identifiers for objects.  Two
+pools/lifetimes are defined:
+  * JPOOL_PERMANENT	lasts until master record is destroyed
+  * JPOOL_IMAGE		lasts until done with image (JPEG datastream)
+Permanent lifetime is used for parameters and tables that should be carried
+across from one datastream to another; this includes all application-visible
+parameters.  Image lifetime is used for everything else.  (A third lifetime,
+JPOOL_PASS = one processing pass, was originally planned.  However it was
+dropped as not being worthwhile.  The actual usage patterns are such that the
+peak memory usage would be about the same anyway; and having per-pass storage
+substantially complicates the virtual memory allocation rules --- see below.)
+
+The memory manager deals with three kinds of object:
+1. "Small" objects.  Typically these require no more than 10K-20K total.
+2. "Large" objects.  These may require tens to hundreds of K depending on
+   image size.  Semantically they behave the same as small objects, but we
+   distinguish them for two reasons:
+     * On MS-DOS machines, large objects are referenced by FAR pointers,
+       small objects by NEAR pointers.
+     * Pool allocation heuristics may differ for large and small objects.
+   Note that individual "large" objects cannot exceed the size allowed by
+   type size_t, which may be 64K or less on some machines.
+3. "Virtual" objects.  These are large 2-D arrays of JSAMPLEs or JBLOCKs
+   (typically large enough for the entire image being processed).  The
+   memory manager provides stripwise access to these arrays.  On machines
+   without virtual memory, the rest of the array may be swapped out to a
+   temporary file.
+
+(Note: JSAMPARRAY and JBLOCKARRAY data structures are a combination of large
+objects for the data proper and small objects for the row pointers.  For
+convenience and speed, the memory manager provides single routines to create
+these structures.  Similarly, virtual arrays include a small control block
+and a JSAMPARRAY or JBLOCKARRAY working buffer, all created with one call.)
+
+In the present implementation, virtual arrays are only permitted to have image
+lifespan.  (Permanent lifespan would not be reasonable, and pass lifespan is
+not very useful since a virtual array's raison d'etre is to store data for
+multiple passes through the image.)  We also expect that only "small" objects
+will be given permanent lifespan, though this restriction is not required by
+the memory manager.
+
+In a non-virtual-memory machine, some performance benefit can be gained by
+making the in-memory buffers for virtual arrays be as large as possible.
+(For small images, the buffers might fit entirely in memory, so blind
+swapping would be very wasteful.)  The memory manager will adjust the height
+of the buffers to fit within a prespecified maximum memory usage.  In order
+to do this in a reasonably optimal fashion, the manager needs to allocate all
+of the virtual arrays at once.  Therefore, there isn't a one-step allocation
+routine for virtual arrays; instead, there is a "request" routine that simply
+allocates the control block, and a "realize" routine (called just once) that
+determines space allocation and creates all of the actual buffers.  The
+realize routine must allow for space occupied by non-virtual large objects.
+(We don't bother to factor in the space needed for small objects, on the
+grounds that it isn't worth the trouble.)
+
+To support all this, we establish the following protocol for doing business
+with the memory manager:
+  1. Modules must request virtual arrays (which may have only image lifespan)
+     during the initial setup phase, i.e., in their jinit_xxx routines.
+  2. All "large" objects (including JSAMPARRAYs and JBLOCKARRAYs) must also be
+     allocated during initial setup.
+  3. realize_virt_arrays will be called at the completion of initial setup.
+     The above conventions ensure that sufficient information is available
+     for it to choose a good size for virtual array buffers.
+Small objects of any lifespan may be allocated at any time.  We expect that
+the total space used for small objects will be small enough to be negligible
+in the realize_virt_arrays computation.
+
+In a virtual-memory machine, we simply pretend that the available space is
+infinite, thus causing realize_virt_arrays to decide that it can allocate all
+the virtual arrays as full-size in-memory buffers.  The overhead of the
+virtual-array access protocol is very small when no swapping occurs.
+
+A virtual array can be specified to be "pre-zeroed"; when this flag is set,
+never-yet-written sections of the array are set to zero before being made
+available to the caller.  If this flag is not set, never-written sections
+of the array contain garbage.  (This feature exists primarily because the
+equivalent logic would otherwise be needed in jdcoefct.c for progressive
+JPEG mode; we may as well make it available for possible other uses.)
+
+The first write pass on a virtual array is required to occur in top-to-bottom
+order; read passes, as well as any write passes after the first one, may
+access the array in any order.  This restriction exists partly to simplify
+the virtual array control logic, and partly because some file systems may not
+support seeking beyond the current end-of-file in a temporary file.  The main
+implication of this restriction is that rearrangement of rows (such as
+converting top-to-bottom data order to bottom-to-top) must be handled while
+reading data out of the virtual array, not while putting it in.
+
+
+*** Memory manager internal structure ***
+
+To isolate system dependencies as much as possible, we have broken the
+memory manager into two parts.  There is a reasonably system-independent
+"front end" (jmemmgr.c) and a "back end" that contains only the code
+likely to change across systems.  All of the memory management methods
+outlined above are implemented by the front end.  The back end provides
+the following routines for use by the front end (none of these routines
+are known to the rest of the JPEG code):
+
+jpeg_mem_init, jpeg_mem_term	system-dependent initialization/shutdown
+
+jpeg_get_small, jpeg_free_small	interface to malloc and free library routines
+				(or their equivalents)
+
+jpeg_get_large, jpeg_free_large	interface to FAR malloc/free in MSDOS machines;
+				else usually the same as
+				jpeg_get_small/jpeg_free_small
+
+jpeg_mem_available		estimate available memory
+
+jpeg_open_backing_store		create a backing-store object
+
+read_backing_store,		manipulate a backing-store object
+write_backing_store,
+close_backing_store
+
+On some systems there will be more than one type of backing-store object
+(specifically, in MS-DOS a backing store file might be an area of extended
+memory as well as a disk file).  jpeg_open_backing_store is responsible for
+choosing how to implement a given object.  The read/write/close routines
+are method pointers in the structure that describes a given object; this
+lets them be different for different object types.
+
+It may be necessary to ensure that backing store objects are explicitly
+released upon abnormal program termination.  For example, MS-DOS won't free
+extended memory by itself.  To support this, we will expect the main program
+or surrounding application to arrange to call self_destruct (typically via
+jpeg_destroy) upon abnormal termination.  This may require a SIGINT signal
+handler or equivalent.  We don't want to have the back end module install its
+own signal handler, because that would pre-empt the surrounding application's
+ability to control signal handling.
+
+The IJG distribution includes several memory manager back end implementations.
+Usually the same back end should be suitable for all applications on a given
+system, but it is possible for an application to supply its own back end at
+need.
+
+
+*** Implications of DNL marker ***
+
+Some JPEG files may use a DNL marker to postpone definition of the image
+height (this would be useful for a fax-like scanner's output, for instance).
+In these files the SOF marker claims the image height is 0, and you only
+find out the true image height at the end of the first scan.
+
+We could read these files as follows:
+1. Upon seeing zero image height, replace it by 65535 (the maximum allowed).
+2. When the DNL is found, update the image height in the global image
+   descriptor.
+This implies that control modules must avoid making copies of the image
+height, and must re-test for termination after each MCU row.  This would
+be easy enough to do.
+
+In cases where image-size data structures are allocated, this approach will
+result in very inefficient use of virtual memory or much-larger-than-necessary
+temporary files.  This seems acceptable for something that probably won't be a
+mainstream usage.  People might have to forgo use of memory-hogging options
+(such as two-pass color quantization or noninterleaved JPEG files) if they
+want efficient conversion of such files.  (One could improve efficiency by
+demanding a user-supplied upper bound for the height, less than 65536; in most
+cases it could be much less.)
+
+The standard also permits the SOF marker to overestimate the image height,
+with a DNL to give the true, smaller height at the end of the first scan.
+This would solve the space problems if the overestimate wasn't too great.
+However, it implies that you don't even know whether DNL will be used.
+
+This leads to a couple of very serious objections:
+1. Testing for a DNL marker must occur in the inner loop of the decompressor's
+   Huffman decoder; this implies a speed penalty whether the feature is used
+   or not.
+2. There is no way to hide the last-minute change in image height from an
+   application using the decoder.  Thus *every* application using the IJG
+   library would suffer a complexity penalty whether it cared about DNL or
+   not.
+We currently do not support DNL because of these problems.
+
+A different approach is to insist that DNL-using files be preprocessed by a
+separate program that reads ahead to the DNL, then goes back and fixes the SOF
+marker.  This is a much simpler solution and is probably far more efficient.
+Even if one wants piped input, buffering the first scan of the JPEG file needs
+a lot smaller temp file than is implied by the maximum-height method.  For
+this approach we'd simply treat DNL as a no-op in the decompressor (at most,
+check that it matches the SOF image height).
+
+We will not worry about making the compressor capable of outputting DNL.
+Something similar to the first scheme above could be applied if anyone ever
+wants to make that work.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.bmp
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.bmp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.gif
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.jpg
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.ppm
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.ppm	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/testimg.ppm	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4 @@
+P6
+227 149
+255
+0/-0/-10.21/51.51.62/62/83/83/:3-:3-:3-:3-:3-:3-:2/91.91.80-80-91.91.:2/80-80-80-80-80-80-80-80-6.+6.+6.+5-*5-*4,)4,)4,)4,)4,)4,)4,)4,)4,)4,)2-)/*$/,%/,%0-&1.'2/(30)30)63,63,74-85.85.96/:70:7.A:0B<0D>2F at 4IA4JB5KC6KC6MD5MD5OC3NB2OC3OC3PD4RE5R?1Y?2b at 4nB5}E6‹H8™G9£F7¯G:¸G9¾E:ÅG;ÇG>ÊG?ËH@ÐE@çFLíCLëDKëEIîCIïBDñ>Bô=Aø;A÷:@ô:?ð<?é?@â@>×?<ËA7»=/µ@.µ@.´?-´?-³@-²?-¯@-­@,ªA,¦A-¢B,Ÿ@*›A)˜@*–A,”>-’?/’?/‘>.‘>,=+’<+’<+”?+”?+”=*”=*”=*•>+–?,–@/–?6•>5—=2Ÿ?1©B3³D3¼D4¿D4¹?0µA2¬F8žH;‡H9oA2T8*C3&=5295495473271160050-50-72/72/72/61.61-50,50,41,//-.0-//-//-0/-0/-2.-2.-5,-4+,4*+3)*7(+=.1E69P:<jBC|IHMM•OOŸW[ªdnªoƒŸt”{£‡®€†º~ˆ½sy­`a‘TKvPDhSJgOG^MH^TQbfdo|}‚‘™ž˜£©Ÿ¢¨šž “’{|lfgUXWEQNEUR[UQbUQb0/-0/-10.10.40-51.62/62/83/83/:3-:3-:3-:3-:3-:3-91.91.80-80-80-80-91.91.80-80-80-80-80-80-80-80-6.+6.+5-*5-*5-*4,)4,)4,)5-*5-*5-*5-*5-*5-*5-*3.*0+%0-&0-&1.'2/(30)41*41*63,63,74-74-85.96/:70:7. at 9/A;/C=1E?3H at 3IA4JB5JB5LC4LC4MA1MA1MA1NB2OC3QD4P>0U?1^A3jC4xD6„E4’E5œC3§C4¯A4µA4¼B7ÀD:ÄE<ÅF=ÍC@áEIçBIèCIêDHíDGïBDó@Cö?Cø;A÷:@ô:?ð<?é?@àA>Õ@<Ê@6¹>/µ@.´?-´?-´?-²?,°?-¯@-­@,©@+¦A-¡A+Ÿ@*›A)˜@*–A,”>-’?/‘>.‘>.‘>,=+’<+’<+”?+“>*”=*”=*”=*•>+–?,–@/”@5•>5˜>3 >1«A3µD4½C4¿D5»A2·C6¬F8œI;…G:l at 3S9*B4)>63:6595484382271161.61.72/72/72/61.61-50,50,41,//-.0-//-//-0/-0/-2.-2.-3--5,-4*+3)*5)+<-0C47N8:d>=vEA†JINLšTV¤aj¥l}rŽ‘{¢†€®…¹{„»ou©[[QHuOCiOFeOG_PH_RN_[Yfnotƒ‡ˆ”™•™ž—š ”™‘ƒ~ojkY][LVSJXSZVRaXQa/.,/.,0/-10.40-40-51.51.72.72.72.72.92,92,92,92,91.80.7/-7/-7/-7/-80.91/80.80.80.80.80.80.80.80.6.,5-+5-+5-+4,*4,*4,*4,*5-+5-+5-+5-+5-+5-+5-+3.*2-'1.'2/(30)30)41*41*52+63,63,63,74-85.96/96/:7.?8.@:.B<0D>2G?4H at 5H@3H at 3I@1I at 1K?1K?1K?/L at 0MA1NB2MA1QA1YB2dC2qC3|C2‡B2’A0˜<- :+§;.¯=2µ@6ºD:¿F=ÅD>ÙCEá@FãBGçBFêDFðCEôADø?Dú;@ù:?õ;@ð=@è@@ÜA=Ñ@;Æ@5·=.³@-³@-²?,²?-°?-¯>,­@,ª?-§@-¥@,¡A+A,š?*˜@*•@+”>-‘>.‘>.‘>.=+=+=+=+‘>,‘>,’<+’<+“=,“=,”?+•?.•A6–?5š>3£>2¯A4¹C5¿D5ÁC5ÀD8¸F;®I=™J=G;h at 4Q:,B5,?74=77<66:4494183072/72/62/62/62/51.52-41,41,21,.0-,1-.0-.0-//-//-0/-2.-5//4..5,-4*+4*+9-/>24I56[97l?9|E@†IDOM˜[`›fv”mˆŒwžƒ}­}‚¹u~·fm¤TV‰MEvLAkMAeOFcQHcMH^NK\[[eqty…‰ˆ‡Œ†Šˆ…†Š|xzlfiXZ[MVSLZU[ZT`[S`.-+/.,/.,0/-3/,40-40-40-61-61-61-61-81+81+81+81+7/-7/-6.,6.,6.,6.,7/-7/-80.80.80.80.80.80.80.80.5-+5-+5-+4,*4,*4,*3+)3+)6.,6.,6.,6.,6.,6.,6.,4/,30+30)30)41*41*52+52+52+52+52+63,74-85.85.96/96->7-?9-@:.B<0E=2E=2F>1F>1G=1G>/H<.I=/I=/J>.L at 0JA0KD2NE4UD4^D3iD2sB1~A/†?-Œ9)”9'9*£<-¬@3³E8¸H<ÁF>ÒDCÚACÞBCâDCçCDìBCó@C÷?Aú;@ù:?õ;@î>@åA@ÚB=Í@9Â@3µ=-°@,°@,°@,¯>,®?,®?,¬?+©@-¦?,£@+ @*œ@+˜@*–@)”?*‘>,‘>.‘>.=-=+=+<*<*=+=+<*<*’<+‘>,”>-’?-•A6–?5œ>2¦@4²B6¼C8ÁC7ÂB7ÂF<ºJ?¬L@—K>|F:b at 4L:.A7- at 85>96=77<74:5294183083062/62/62/32.52-21,21,12--2.-2./1./1.00.00.10.10.5106005//5,-4+,6,-:01D22T71c;3qA7{E;‚HD‰RU_l‹i‚ƒs˜}y«x}µowµ`f¢QR‹LEyL at pL@hPEgQFfLC^GBVMLZ^^fjnquyxx}wz€vwzokoa`bTWYLTTL]WY]V]]V^------.-+/.,0/-10.3/,40-3/,3/,4/+4/+4/+4/+6/)6/)4/,4/,3.+3.+3.+3.+4/,4/,50-50-50-50-50-50-50-50-3.+3.+2-*2-*2-*1,)1,)1,)4/,4/,4/,4/,4/,4/,4/,4/,41,41,41,41,41,52-52-52-52-52-63.63.74/85096196/<5-=6,?8. at 9/B:/C;0C;0C;.D:.D:.F:.G;-H<.I=/J>0I at 1JG6MH5RG5YF5bE3jD1uB/}>,‚;)‹:)“:*š=,£B2¬F8²J=»I?ÌGBÔDCØDBÝEBâBBéAAð=@ô<>ù:?ø:<ô<>í?>áB>ÓC:ÅA5¹?0²?-®?,®?,®?,­>-¬>-¬>-ª?-¨>.¤?- ?,ž?+š?,—?+•>*“>*‘>,?.>->->-Ž=,Ž=,Ž=,Ž=,Ž=,Ž=,Ž=,<,>-‘>.?.”B4—A4@1¨@3¶A7¿C9ÅB8ÄA7¾C;·H?¦LCJ at tE;Z>2E9-<5+ at 93@85?75>63=52<4194083/62/43/43/23.32.12-12-02--2.,2.-2.-2./1./1.00.10.3205105104..2,,4+,7./=/.N5.Y9.e=1n at 3sB;yKK€Zeƒg€p—zxªu{·ks´_d¦TT”OGƒLBwNAmNBhMAeJA`GBYGFXKKWMPU]cc`fbbia`f\Z`TW[MUXMXXP^YV`WX`WZ,,,,,,.-+.-+/.,0/-3/,3/,2.+2.+3.*3.*3.*3.*5.(5-*3.+3.+2-*1,)1,)2-*3.+3.+3.+3.+3.+3.+3.+3.+3.+3.+2-*2-*2-*2-*1,)1,)1,)0+(3.+3.+3.+3.+3.+3.+3.+3.+41,41,41,41,41,41,41,41,41,52-52-63.74/85085085.;4,<5+=6,>7- at 7.A9.A9.A9.C9/C9-E9-F:.G;/H<.J>0HA1JG6IH6NG5VF6\E3dC2n at 0v>-{<+‚;)Œ;*”=,œ@1£F5ªJ:´J=ÄH@ÌEAÑFAÖE@ÞCAä@>ì>?ñ:<÷;<ô:;ð<=é@=ÜC=ÍC8¾@2±>,®?,«@,ª?+ª?+ª?-©>,©>,¨?,¥>-¢?, ?,›>,—?+•>*“>)‘?*>+>->->-Ž=,Ž=,Ž=,<+Ž=,‹<+<+‹<+‹<-Œ=,>/Ž?.”B4—A2 @2¬B5¹C9ÂC:ÅB:ÂA;ºA9±I@£NGNEoG=S?4A;/96- at 93A75?74>63<4194083/74/43/43/34/23.23.02-02-.3--3/-3/.3/.3/02/02/11/11/21/32032040/2.-1-,4..8.,G4-O4)X8+`<0e?6mGFyYd‚k…€uŸ||²w|¼nu»dh¯[[¡RMLB~OArL at hI=cH>`HB^ECX at BO;@FBGJDMJJQJJQIIQFKQEOUIVWO^YS`YS`XU++++++,,,---/.,/.,0/-0/-1-*1-*1-*1-*2-)2-)2-)2-)2-*2,,1++1++1++1++2,,2,,1++1++1++1++1++1++1++1++2,,2,,2,,1++1++1++0**0**3--3--3--3--3--3--3--3.+41,41,41,30+30+30+30+30+41,41,52-63.74/74/85085.:3+;4,<5-=6.?6/?6-?6-?7,B8.B8.E8/E9-G;/H<0J>2H at 3HE6GF4KE5QD4XC2_B2f?.n=,v=,|:*…9)Œ;*“=.›B2¢F7¬F8»F<ÂF>ÉF>ÐE>ÙD@âC?ê@@ð>>ò::ñ;:ì<<äA<ÖC;ÆD6µ@/ª=)ª?-©@-©@-¨?,¨>.¨>.§=-¥>-£=. ?.ž?-š?-–?,“>*‘?*>)>+>->-Œ=,Œ=.Œ=.‹<-‹<-‹<-Š=-Š;,‰<,Š</‹>.‹=0Œ?/’C2˜B1¡A1®B6¼C:ÂC<ÄC=ÀC=¹FA²QJ¥XRXQsRIWI>CC7<?6>93 at 72>71=60:5/94.83/63.43.43.34/13.13..3-.3-.3--3/-3/-3/-3/.3/.3/02/02/00.11/22021/0/-/.,2.-4/,?0+D0)K3)T8-Z<4dFFu]jƒs‰€«…„¾~ƒÇtzÆmp½ce¯VSšLC‚K?qI<gG;cE>_FB]DBW?AN;?H:BE>HGDMHGQIGQHJRGNVKUXM^ZOaYNaXO++++++,,,,,,.,-/.,0/-0/-1-*1-*1-*1-*2-)2-)2-)2-*2,,1++1++0**0**1++1++2,,0**0**0**0**0**0**0**0**2,,2,,2,,1++1++0**0**0**2,,2,,2,,2,,2,,2,,2,,2,,3/,30+30+30+30+30+30+30+41,41,52-63.63.74/85085092,:3+;4,<5->5.>5.>5.>5,B8/B8.E8/E8/G:1I=1J>2I?3FC4FC4JB5OA4TA2\@2b>0j<-q<.w9*}8)…8(Œ:,•=/›B4¤B5²F:ºE;ÁF>ÊG?ÔG@ÞFAçCAîB@í;;ë;;ç>;ßB;ÑD:¿D4¯@-¤>(¦A-¦A-¥@,¥@.¥@.¤?-¤?-¤>/¢>.Ÿ@.œ?.˜?-•>+‘?*>)>+>->->-Œ=,Œ=.‹<-‹<-Š=-Š=-ˆ<.ˆ<.ˆ<.ˆ</‡>/ˆ>1‹?1‘D2–C1¢B4­C6ºC;ÁD>ÁD>»EA¹PL²[T¥e\‘f]u_T[UIGMACI?<92?82>71;6094.74-63.43.43.34.24/13./4..3-.3-.3--3/-3/-3/-3/.3/.3/02/02///-00.22022010.0/-0/-3/,8,,;,)C0*K70S<6^IHtbn‡z”Š¶ŒÆ„ˆÏz€ÌrxÆik¶WWŸID„E=nG<dD<aC>^CAY at CV@DP>EKGQRKWUQ^WU`XS_UR^TT^SY_S^[LaZJaZJ,-/,-/,-/,.-------.-+.-+/.,/.,1-*0,)0,)0,)/+(/+(/+*/+*/+*/+*/+*/+*/+*0,+/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*0,+0,+1-,1-,2.-1-,1-,1-,1-,1-,1-,1-,1-,0,)1-*2.+3/,3/,3/,3/,3/,3/,3/,3/,3/,40-51.62/74/80-92,:3-;4.=4/>5.>5.>5.?4.?5,B5-C6.D7/F90G:1F<2G?4H at 5J@6P?5T>3X<1^90b6+m9.t8-|8+ƒ9,;/“=0˜?1ž>0§A3­A4µC8¾E:ÊG=ÔG>ÞE?åC@è@?êBAæDAÚE>ÈD8·B1ªA.¢B,¢A.¡@-¢?,¢>.¡=-¡=-¢>. ?/œ<,š=,˜<-•>-“=,=+Ž=*Œ>*‹<+‹<+Š=-‰<,‰<,‰<,ˆ:-‡;-‰=/†</†</‡=0ˆ>3ˆ@2‰A5‹A4‘E5—D4£E9±I>ºG@»D>»EA¸MG´ZR¯f_£qf‘sh~rdjj^V^SIQFLLBJF=B>5<8/95,74+63,33+43.34.14-14-02-/1,,1+,1+-2.-2.-2.-2./1./1./1./1.02/02/11/11/11/11/11/40/4+0;/3A32C4/J;6]OOymy‹…Ÿ“»”–ϐ•Ùƒ‰ÓtzÆjn·_b§Z[”LItHBdA>]>>X?BUAIVLU\U`bbqnn}xv†|rulyoguh_k_W_P]\Hb\Fc]G,-/,-/,-/,-/------.,-.-+/.,.-+0,)0,)/+(/+(/+(/+(.*).*).*).*)/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*0,+0,+0,+1-,1-,1-,1-,1-,1-,1-,1-,1-,1-,0,+0,)1-*2.+3/,3/,2.+2.+2.+2.+2.+2.+3/,40-51.62/80.91.:2/;4.=4/>50>50=4-?4.?4.A4.B5-C6.E80G:2H;3H>5H>5L=6O>6Q=4V;2Z90_7/h70p7.w7-9-‰9.<1–<1›=1¢@3§A3¬B5´D8¾E:ÉF<ÔE=ÛD=ßD@àE@ÞFAÔG>ÄF8²C2¥B-žB-ŸC.žB-Ÿ@.ž?-ž?-ž?-ž>.ž>.š=,™>,–=-”=,=+>+Œ>*Œ=,‹<+Š=+‰<,‰<,‰<,‡;+‡;-…<-†</…=/…=1ƒ=1„>2†@6‡A7ˆB6“G9—E7£G<¯J@¸IB¸GA·LF³TN±d\ªqfŸ~oo|mmseZfZNXMLNAKI=EC7@=4=:188.44,11)23-23-03,/2+/1,.0+.0+.0+/1.-2./1./1./1./1./1./1.02/02/11/11/11/11/11/2015+49-7<23?53H?:^VTxr|Šˆž““¹”—ʐ–Ô„‹ÏyÂqy¸kt­hnž\_€XZqSUjRWjT^hZgmfvvr‚tˆ~’‡ƒ•‰~Žv†yr€qfteZeT[ZE`Z at b\D,-/,-/,-/,-/,-/,.-------.-+.-+.-+-,*/+(.*'.*'.*',+),*+,*+,*++)*+)*+)*+)*-+,-+,-+,-+,-+,-+,-+,-+,,*+,*+-+,-+,-+,.,-.,-.,-.,-.,-.,-/-./-./-./-./.,0,+0,+1-,2.-2.-2.-2.-1-,1-,1-,1-,1-,2.-3/.40/51.80.91.:2/;30=31=4/=4/=4/?40?4.A4.A4.C60D71F93G:4H;5J;6K<7N=6P;6S:5V72[6.c60k6.t5,}7/‡9/;0”<0–<1?3 @4¢@3¨@3±C6ºD8ÅE:ÍD:ÕF@×H@ÔIBÌI?¾E:®C3¡B.œA.B/œA.œ?.›>-›>-›>-›>/›?0˜<-–=-”<.“=.>-Œ=,‹<+Š=+‰<*‰<*‰<,‡;+‡;-…<-„:-ƒ;-„<0‚<0‚<2‚>3ƒ?4…A8‡C:ˆD9”J=—H; H>¬KD²KF³LG²SM®`V­sg¦qŒz‘Ž{‚‰ws€ocqbXcUNRDMN at HI;DD8@@49;.46+/1&01)01)/0*/0*./*./*//-//-//-.0-//-//-//-//-//-//-00.00.00.00.00.00.00.1/26+97+98/4;63HE>_^Yzz|‹š”±’—¿•Ç„ŽÃ}‰»{‰¶|‹²}Œ«}ˆšwƒq~‡n}‚n~~o‚~yŽ…ƒ™‹¡”‘¨˜¥”ˆŠƒ–ƒ|{j{i\hTXX@]Y<_[@-.0-.0-.0-.0-.0-.0.......-+.-+-,*-,*.*'.*'.*'.*),*++)*+)*+)*+)**()*()*(),*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+-+,-+,-+,-+,.,-.,-.,-.,-/-./-./-./+*0,+1-,1-,1-,1-,0,+0,+0,+0,+0,+0,+1-,2.-3/.40/91/:20;31<41=31=31=31=4/>3/>3/@2/@3-A4.C60D71E82F93H94I:5J;6L:6N94Q83T50^72e60o6/x8/‚90Š:/<1”>1™?4›?4›?2Ÿ?1¥A2®B5¸D7¿E:ÇG>ËH@ÊJAÃI>¶F:ªB5žA0™@.™A-™A-˜?-—>,—>,™>,™=.—>.•<,”=,“=.=-Ž=,Š=+Š=-‰<,ˆ;)ˆ;)‡;+‡;+„;,„;,ƒ;-€;,;/€<1€<1>5ƒ@7ƒC:‡D<ˆE<”L@–H<žG>§JC®LI®QL­]Vªj^§€o¡yšš‚›ƒ†•€z‹xm{jbm]SZJQUFKO at EI:@D6;=057,13(01)/0(./).-(.-).-)/.,0/-/.,/.,/.,/.,/.,..,/.,..,0/-//-0/-//-//-//-//-2-17,:6*83-1961HJ?bfX{€z‹““£–°Œ•¶ƒ²¯…™²¤¶’¨³“¨«¤£Œ ž‡ž˜‚™}˜‰œ‹ˆ£”°š˜±›”­—‹£…›„’|k|iXfOSV;ZV9^Z=+/2+/2+/2+/2-.0-.0......------.-+-,*-,*,+),+),+),*+,*+,*++)*+)**()*()*(),*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*++)*+)*+)*,*+-+,-+,.,-.,-/-./-./-./+*0,+0,+0,+0,+0,+/+*.*)/+*/+*/+*/+*0,+1-,3/.40/901:20;31<42=32=31<20<20=20=2.?1.?1. at 2/A30B5/C60D63C84D95E:6G96H94K84N50X72_60i70r7/}:1†<1Œ>2>2—@6—?5—?5—?3œ@3£C5«C6³E8ºE;½G=¾H>¹G=°D8¦A5›?0—@/—@-—@-–?.•>-”=,•<,–=/–=/•<.“;-’</Ž<.‹<-‰<,‰<,ˆ<,‡;+†:*†:*†:*ƒ:+ƒ:+‚:,€:.€:0€<1€=4?6‚B9ƒD=‡F@ˆH?‘KA’H=šG?£LE¨PL¨XQ©f]¦vh¢Œw›™€•¤‡Œ£‡†ƒ~‘}t‚qjue\eRV_LNUCEL:?F6<@27:/68-01)00(.-(/,'/+(/+*1-,2.-1-,1-,1-,1-,1-,/.,1-,/.,2.-0/-2.-0/-0/-0/-0/-2-18,:5)51++66,GL8`hQzƒpˆ’‡—–š ™¥†–£‡›¢ª©›¹± À³˜·¨š¶§›·¨˜·¥‘±œ‰«’‰«±”’³–•´•­ˆ¢…„›{’xgzdTbIQT9VU9XW;,03,03,03,03./1./1//////....../.,.-+.-+.-+-,*-,*-+,-+,-+,,*++)**()*()*()+)*+)*+)*+)*+)*+)*+)*+)*,*+,*++)*+)*+)**()*()*(),*+,*+,*+-+,.,-.,-/-./-./+*/+*0,+0,+/+*/+*.*)-)(0,+0,+/+*0,+1-,2.-3/.40/:12:12;31<42=32<21<20;1/=20<1/>0->0-?1. at 2/A4.?4. at 51@72 at 93A:4B94C84F74H5/Q51X5/a6/l8-u9.€</†>0‹=1“?5•>5“?5“?4•B4šB4 C4¥D4¬B5°D8´E:±E;ªB7¡?4š>1–>0•?.”?+“=,“=,“<+“<+”<.”<.“;-’<-<.;-Š;,‰<,‡;+‡;+†:*†:*…9)ƒ:)ƒ:+9*9-9-€<1<3?6€A8‚C<…F?ˆIBŠICŽJAG>—HCŸNJ§VR§`Z©pe¤ƒrœ”}–¡ƒ¨Šˆ§ˆƒ „~–~yˆup{jdp\]iSR^JJS at BK:>E5:@29<134,22*1.)/,'/))0**1++2,,1++1++1++1++1++0,+0,+0,+1-,1-,1-,1-,/.,/.,/.,2,.8*75(13+(56&EK1\gGu‚d†“yŽ›Š‘ž”Ÿš‹ž˜¥——´ž¢Å¥©Î­¥É­¦Ê°§Ë±¤È¬—¾Ÿ‹³‘ˆ°²Ž²Ž²¬Š„¡‚€™{wŽrdx]Q_ENR7QQ5SR6,03,03,03,03./1./1./1./1/////////////.,/.,.-+.-+/-..,-.,--+,,*++)*+)**()+)*+)*+)*+)*+)*+)*+)*+)*+)*+)*+)**()*()*())'()'(+)*+)*,*+-+,.,-.,-/-./-./+*/+*/+*/+*/+*.*)-)(,('0,+0,+0,+0,+1-,2.-40/40/:12;23;23<34=32<21<21;10<1/<1/>0/=/.>0->0-?1.>3/=60;60;83<94=:5>93 at 72C60G4.O4+Y4+d5+n8,x:-;.…;.<4‘<5>3@3A2“B1—A2™@0 >1¦@4ªB7ªB9¥@6Ÿ>5—=2•?2’?-’?-‘>,=+‘;*‘;*’<-’<-‘;.‘;.Ž;-;-Š;.ˆ:-†:,„;,…9)…9)ƒ:)‚9(‚9*9*~8,~8,€<1€=4€@7B9„E>…IAˆKFŒMFŒIAŽH@˜JF¡SO¨]X©hb©{n¤Žy™œ’§†‰¬‹‚ªˆ€¡„™€~‹wxnjxadr[ZhQQ]IITCCL;>D6<?467/44,30+0+'1()1()2)*4+,2)*2)*2)*2)*2)*0**0**0**1++1++0,+0,+0,+0,+0,+1+-6)25)-4-%46!AH&Wc;q€W‚’mœ} †¢Œ‹¡Š¨‰•¸Ž È”¤Ð©Ó«¨Ò®§Ñ­¡Ë¥“½—…¯‡‚¬„‡°†ˆ®…Œ±ˆ‹«†Ÿ{{”tqˆk_sWM]BIO3JM0KK/./1,01./1./1.0/.0/.0////00.00.00.0/-0/-0/+/.,1-,2.-1-,1-,0,+/+,,*++)*+)*+)*+)*+)*+)*+)*+)*+),+)*+),+)*-(,*(),())'()'((&'*()+)*,*+,+)-+,.-+/.,/.,-,*-,*/+*/+*.*)-)(,(',('1-,2-*2-*2-*3.+4/,50-61.;31;31<42<42=31<20;1/;1/<1/<1/=/.=/.=/,>0-?1.=2.=4-=6.;819919:29:2;81?6/C2+J1,T2)^3*g7+o9-u=.z</‡=2‹=3‹?2Œ@2Ž@3@1’?1•=/˜</œ>2¢B6¡C7žB7™?4–>2”>1”>/“=.=-<,Ž=,Œ=,Œ=.>/Ž<.Ž<.‹</Š;.ˆ:-ˆ:-†:,„;,‚:+‚:+:*~;*~;+|:*}9,|:.€>2>5€@6‚C:ƒG=…JB‡NE‹OGŒICŽID“PJ˜\Tžg`uiž‡už˜€”¡…ª‰‰¬‹ƒ¨‡€¡„~›zytˆoi}bby]\pUUgOO\HGRAAH8=A388.85.7/,3+)2()2()3)*4*+0*,/+*0*,0**0*,0*,2),2),3*-1+-1+-1+-0,-0,-0,-1+/4)/4*+4-%46!?F%T`8m|Qg‰™tžz¡~ˆ¡zŠ§{‘¶‚›ÄˆŸËŸÉ™žÇÆš˜Á•Œ·Š‚­€…®‚Œµ‰„«‰®…‰©‚~œxvolƒfZnSJZ?GM3FJ1DF./0+.0+/0+01,01,01,12-21-32.43/43/62/51.41,3/,4/,50-50-4/,3.+2,,1-,0,+0,+.,-.,---/--/,,.++-*).))+.)/.)-/(/.)-/)-.)-.*+.*+/+*/+*-,*.-)--+-.)./*./*------.,-/-./.,0/-2.+2.+2-*4,)5-*6.+8/*:1,:1*;2+=4-=4->50>50>50=4/<3.;2-=2.<1-<1/;0.=/.>0/>0/@1.A0)@2);4*77-39-28.56.:3-?-)F*'L)'S*&Z/(`5,d<0k at 0yA0@/†A1‹B3@3“=0“;/’8-“;/“=.”A1•B2”C2’A0‘>.‘;,—;0—:2’;1Œ=0ˆ?0„?/‚?.ƒ>.ˆ@1ˆ?0Š>1Š<0‰;/ˆ:.†:-ƒ;-{9+~@3w<.q7)w>-w>-v;-}?2{;/‚@4‡E9‰I?ˆLA†MB„PC‡NE‘KI—SP”bY‘paŒ}j‰‰q‰–|Šž‚¤‡¦‰Ž§Š§Œ‡¤ˆ~Ÿ‚uš{o—uiib„_[zXZsUZnSWeNPWEJK=C?6 at 93;0.6**3')3'+3'+1&*,*-)+***,*(),'+.(,1(-2'-3(.3(.3(02(00)10)1/*1/*0/)-1++0-(//#<?*V\@pzX‹gœu‹sŒ¡vŒ¦wŠ¨v‰ªuŽ´{™¿†ŸÁ¾–ºŠ³ƒˆ®}…«|ƒª{…ª~ƒ¨}ƒ¦~€ž|y”ur‰mh|cYkUMZFIQ<CH4?B//0*01+01+01+12,12,21,32-43.43.74/74/63.52-50,50,7/,7/,6.,6.,3.+2-*0,+0,+0,-/-./-0--/-,1+*/)*.)(-.)//(//(//(//)-/)-.*+.*+/+*/+*.-).-)./*./*./)./*.....0....../.,/.,1-*3.+5-*5.(7.)8/(:/);0*<2)=3*>5,>5,>5.>5.>5.=4-<3.<3.=2.<1-;0.;0.=/.=/.>0/@1.C0*C0)A2+>4+:6-95,:3-<1-?-+D*)I*(N+'T/)Z5-_:1e>/pA/xA-€A0ˆ@2?4‘=3“:2“;19.‹</‹>.Œ@0A1A1ŽA/‘?1•;2•;2<2‹=0†>0ƒ@/?/‚?.…@1†>/‰=0ˆ<.‡;.„;,‚:,€;,x8,x<1s9-n9+s>.s>.r8*u:,}=1ƒA5‰E:‹I=‰K@†NA„PC‡NE‘JH—SR’f]Œwf„†p€“wž„¥†ˆ§ˆ§Š§§Š¤‰Ÿƒwœ}o˜ve’i`‹`Y‚ZY{X\wXZnSSaJNUCFH;C at 7<737/-3*+2)*1(+.(*,*+**,+),+),-(,/)-2(02(02(02(02(10)1/*1-*3-*3-*12-12.-0,)--%8:,SXBox]€‹i‡–o†™l†žnˆ£p†¤p„¥pŠ­w“¶€™¹‡–¶„“³Œ®{†«x‚¨w‚¨yƒ¨|ƒ¦|‚¤{x’uqˆnh{eYjWMZHEL<@D5;=/12,12,12,12,23-23-43.43.54/54/85085085074/72.61-80-80-7/,6.+4/,3.+2,,1-,1-./-.0.1/-0--/,,.+*/+)./(/1'//)-/)-/)-/)-.*+.*+0,+0,+/.*/.*/.)0/*0/*0/+//-///0./0./0/-/.,1-*2-*6.+70*90+:1*<1+=3*>4+?5,?6-?6- at 7.@7.?6/>5.=4-=4-=2.<1-;0.;0.;0.;0.<1/?1.C2+E0+H/+K--L,/K+.I*/E+.A-, at .*A.(E.(M.)X1*b3-g5,j:,o;-w;0=4‡<6Œ<5:4:4Š<2‡=2†>2…?3†A2‰A3ŒB5C5Ž?2=/Œ>1Š>.‡>/…>,†=.ˆ<,‰;.‰<,ˆ:-†:*ƒ;,<)~=+{<+}=1z<1v:/u;/x at 1x@1v<.v;-?5‚B8‰F=‹H?‰JA‡KA‡NCŠNF‘JH˜TQ–f\ve‡…n‚‘t{¤ƒ…¨‡ˆª‰ªŒ©ŒŽ¥‰ˆŸƒš}y˜xi–ma’e\‹a\†`]‚`[|]UrVPhPFYEBP?:D93:2.3,*/)*,)**(0'(1&*1&*1&*0'*1(+0*.0+//*.-+.,+0+,0)-0(-1(-1)-01/23/..*'**"57*PUAmv[|Ši€k~“j™jƒŸn€ n~ m€¥q‡¬x¯|‹­zˆªx„©v§v§u¦w¦y¤y€¢}}›yw‘tp‡mh|cYkUMZHDH9=?299-23-23-34.34.34.45/54/54/650761961:72:72961940940:2/91.91.80-50-4/,4..4..3/03/01/01/20.1..0--/-+.0)02).0*.0*.0*.0*,/+,/+*1-,1-,0/+0/+10+10+10+10,11/1111/010.10.2.+3.+3.*92,92,;2+<3,>4+ at 6-@6-A7.B8/A8/B90A8/A81 at 70>5.>5.=2.=2.<1/;0.;0.<1/=20=2.B3.E2.L..R+0V'/U&.P'/I).C/.<1+;2)?2)G0(R/)_.*d/)i9/k;/u<3}<6…;8‰;9Š;7ˆ:6‰>8†@8†B9…B9…C7†B7‡A7‰A5ˆ@1ˆA/‡@.‡@.‡>-ˆ<,ˆ;+‰:+Š8*ˆ9*‡:*ƒ:)<){=(x>(x>*‚>1{7.z7.z<1v;-w=/|A3{@2€B7ƒE:†H=ˆJ?†J@‡MBˆODŠQHŒSJŽ\QŽh[‹tb…g€‹m~–vž|ƒ§ƒ„©‡‡ª‰‹ªŠ‹¦‡‡ ‚ƒš~}˜yq•oi”ifgfŒeg‹gd†e_~_Zw[PhPK^JBP?8D62:/.4*,/(+*%2&&5%(4%(2&(1'(/)+/+,.,-+++*+-*+-(,-(,/',/',/*+-.*+1++0+'.+"88,PUAiqYv„c{Œhyh|–iœl}Ÿmyžkz m¥r‚§t€¥q}£p}£p}¥s~¥v~¥x}¤x|¡x}Ÿzz™wuqn‡je|bWkRN[GDF9?=1:8,45/45/45/560560560761761872872;83<94<94<94<73<73<41<41;30;3083072/61.61.5106216213122011/00./1-.2,04+.4+.4+.2,.2,,2,,2,,3/.3/,3/,3/,21,21,32-32.32032032032051051.61.61-;4.<5/=4-?6-A7.B8/E8/C9/D:1D:1E;2D:1C90B8/@5/@5/>3/>3/=2.=2.=20=20>31>31 at 51E31M02T,4X)3W(2R)1K,1B30:6-77+:6*B4)M2)X/)^/)f:1j;3s<7z=:‚<:†<;‡;;†::‚;7>8A8B9ƒC:ƒC:…@9„@7‚C2‚C1ƒB0„?/†=.ˆ<.‰:-‹9-‰7+‡8+…9+‚:+~=+x>*v?*x>*9-|/'‚8/„>4w4+s5*}A6}C7E:€G<‚I>ƒJ?„KB†MD‡QG…WJ|aNzjQ€pYu]‚|bƒ†i†“uˆ|ƒ£~§‚‚ª…‚¬†©„¥€{ž}z™wz’pzlxlwŒkumr‰lm„gkd`rX[iRR[HHL=@@4;7,70&5*$6('5''3''1'&.)&+*(++)+-*',('+*)+*)+***,+),+),-)*,#$2*'50*86*BC5UZFfpWn}^tˆeqŠbuex˜iw›ks™htšiwŸkz¢nx lwŸmx ny£s{¥u{¥w|£wyžuzœww–tsŽom†hd{_WkPN[GCC7>:195,560560671671782782872872983:94=:5>;6>;6>;6>95>95?74?74>63=52;63:5294194184184395484373243151240/6-06-.6-06-.4..4..4..4/,40-40-40-51.32-32-43.43.43/431542540841850940:5/=60>7/@7.A8/C90D:0G:1H;2F<3F<3F<3F<3E;2C90B71A60 at 51@51?40>3/>31?42 at 53?53 at 72C52I35P16T/6S.5P05J22C52=90<:-=:+C7)I6(Q3)W2)]2+d3,l50v64}77‚87ƒ77‚66~75}:4}<6}>5€?9ƒ@8†?9…A8€B3€C1B1ƒ@0…=/‡;.ˆ:.‡9-…9,ƒ9,‚:,<,|=,y>,x?,|=,‡5*‹2,¡LE§XQ‹A8|90‚F;€K=yH:zJ<{M>|N?}OBQE‡UJ‚_LrkOosR|uX‡w]yb˜iŸ‹s ”z––z|‹£ˆ¨…§‚€¤~{Ÿy~™vƒ‘p…ŽoƒŽp€pp{ŽpwŒms‡kj~bfv\_hSV[GOM>GA3 at 6*=0';,'9+(6+'3+(/,',-'+.').().(+-(-,*/+*3)*4(*7'*7'(3($<3,E>4IG8QR@]bKgqVjyZn‚]k„\l‰]p‘bq•eo•do—eršfuŸmrœjq›itžnx¢rz¤vy¢vyŸvvštw™vu”rokj…fc|^UlON\ECC7 at 91;4,671782782782893893983:94:94;:5>;6?<7?<7?<7@;7@;7B:7B:7A96 at 85=84=84<73<73<73<74<74<74;639529338308/09/.8/080.80.80.61.61-61-61-52-52-63.63.74/74/540540841952:63<94=84 at 93@70A8/C90D:0G:1H<0I=1I=1J=4J=4J=4I<3F<3D:1B8/A7.A81 at 70@72?61?61 at 72@72A83?74 at 85B86D97G96H96H96H94E80E8/E9-E9+G9,I9*K9+Q7*Z/&d/'n3-z63ƒ98‰;9‹;:‹=;‹A>‡@:‚=6<3:3‚<4ˆ=7‰@7ƒA5B3‚@2ƒ?2ƒ=1„<0;/€</~<.|=.{=.|>/|>/}>/=/†9/1+¢<8ÍlfÙ~y­ZTŒC<ˆLAN at tJ<qM=pQ?qR at tS@zWD‚[J~eOmsOo{U„y[˜u_©oc¶mf¾qk½wo»‚w±Œz§—~žŸ€–¡¡~…y…™vˆ‘r‹rˆ‘r„“r€–r|–sx“pt’pm‹ii„edx\]kQV^GMP;ED0B;+ at 3+?2,;0*70*30)00(./'./)/0*2/*6,+:*+>(+C&+E$+C&(F5-LC4VQ>[YD`bJgmQiwVj{Wl‚[g‚Wf†WlŽ\o”an”an–bršfsko›jo™irœnw ty¢xxžwu›vs—su—vs’rn‹li„cb{[TmMM]CGH:E<5 at 707827828938938939:4:94:94;:5<;6?<7@=8@=8@=8A<8A<8C;8C;8C;8B:7?:6>95>95=84>95>95>95>95=85<73:51;30:0.:0.91.91.91/91.91.72.61-61-63.63.63.74/74/74/540651952;83<94?:4B;5B;3A8/B:/C9/E;/H<0I=1J>2J>2K>5K>5J=4J=4F<3E;2C90B8/B92B92A83 at 72@72A83B94A:4?82 at 93B;5D=7F=6G<6K<5N;4M6.N6,Q6+Q6+Q7*P9+P9)V6'f6*r6,~;3‰@9•D@›HDŸJGŸLF QJ™LDŽD;…;0„7-…7-Œ91=4ˆ>5‡>7†=6…<5…<5=4}=3z>3x at 3vA3x@3z>3<3ƒ:3ˆ73‘31˜(&³=;ì|zý•’Åhc–G@‰K at xH:nM<jQ=fT>hV>lX at t[E`L€hPysQ„wUžt\´l^É__ÓV\ÙQ[×T\äouÙzx̆|À~µ•€«•}£’xŸvœŠrœŠt™u•u‘‘u‹’s†‘s‚‘r|‹ny†ju{amoWgbN_TBUE5R</O4-M1-I0,D/*>/(9/&7.'6/'81):/)=.+A,+F)+H(+K'+H)'TB4YQ<d^FgeLilOnuVm{Xl~Xk„Zg„Vg‡Vm]p•bq–br™duit›lo™ko–jr™mwvyŸxwšyt–us”uu”usqoŠki„ea|[TmMM]BMN at KB9F=69:49:49:49:49:4:;5=<7=<7=<7=<7@=8@=8A>9B?:D?;D?;E@<E@<E@:D?9D?9C>8E>8D=7B;5B;5B;5B;5B:7B;5A:4A:4A83A83A83 at 72@64>71>71>71<71<71;60:5/85.85.74/74/961961961:70<71=82A:2B;1C:1D<1F<2J>2K?3L at 2N@3N at 5N@7N at 7L?6K>5I<3H;2E;2E;2B90A8/@91?80?80?80 at 93@93<5/MD=M@:K:3T at 9R62O0+a<6\3-`5.`4+^/'^/%f6,m=1q=0‰I=G;—I?ŸKAŸF>›>7š=6žD;¦ND¤PE¨VJ«YK¥OB™A5—;0›>6“98‘98Œ65†52†84„?8|@6r>1rB4oA2q=0v:0‚72Œ43’-1š',ÈHIèbaÅEDÍWUáyv«VO†F<„VFmR=i[AibFjeHj`En^D|dLjT’bL²m]ÑnhÛX]à;Lç-Eò+Hõ0Lö@YìI\ä[eånrâ{|Û€}Ûƒ؉‚Ãv½wº„x¶†x²ˆx­Šw¨‹y¥Œxš€o™~m˜xi“oabY„UM{IBxA>u:<i.2d02a11P&'G%#L0-M51G4.E2,D1-F1.F.,G+*K--Q6/YH4`W:f_BgdEkoNu|Zu„]oYlƒWl‡Zp]r’as•bu—dw™fv›hr–js˜os—qq•os•tw™xz˜|y–zx•ysrm‡jk„fi‚dazZTmMO_DNO?SK at PG>9:49:49:49:4:;5;<6>=8?>9>=8>=8A>9A>9B?:C@;D?;D?;FA=E@<E@:E@:D?9D?9E>8E>8E>8E>8E>8D=5C<6C<4D;4C:1B92B92B92B92A83A83 at 93@93>71<71;60;6096/85.74/74/96196/96/:70<71>:1A:0B<0C;0E;/I=1J>0L at 2L@2N at 3N@3N at 5N@7M?6J=4I<3H;2E;2E;2C:1B90 at 91@91 at 91@91A:4B92D93I81L/+V.,j76u99{;;…ECƒD?„H@…IA†G>ŽIB™NH¡PL¢OG“D7”B4šB6ŸC8 >3œ7-œ7-Ÿ=0£C5›?0™@0 E3¤G6§F6®H:¶NE´LM¯HL¥@D™9;‘98>:ƒ@8x>3o>0zI;…LA„?8„,+’).³9DÒLWÜKNßMMÊ>=À@?Ð`\³YQ„@5‚TDyaIe[@^]?ihIslOvgJ~dK–cN¼dXÖ_[æUZëANò,Eþ%Dÿ&Hÿ'Iÿ.Nù3Nò<RðIZëP^åQ]ãS]àXbÛbiÕflÔjnÒmqÏqrÍutÉxwÇywÊ||ÉyzÈvxÇqtÆkrÅfnÅakÃ_kÅ`n³S_¥KUšGQDK†EIm69HT1-M0*H1+J6/K81K:2O>6UE8[O5cZ9gaAifEnrOz‚]z‰bt†^r‰_p‰_p‹`qŽ`u’dw”dw”dw”fs’ix–rz—xy–x~˜}ƒ„…‡ƒ›…™ƒz’zr‰om„hhd`y[TmMNaERSAVPBUOC8938938939:4;<6<=7?>9@?:@?:@?:C@;C@;C@;C@;D?;D?;FA;FA;FA;E@:E@:E@:G at 8F?7JA:I at 9H?8G>5F=6E<3F<3E;1D:1D:1D:1D:1D;4D;4D;4C<4?80?80<71;60:5/:5/94.94.96/96/:5/;7.>7/@9/B90C;0E;1F<0I=1K?1M?2M at 0NA1M@0P?5M?4L>3K=2I<3H;2E;1D:0C:1C:1A:0A:0?;2@<3@<3D;4UD<R3.j23ŽAG­LWÃU`Ë]fÆ_b›B>—I?–LAœNB¬RJ¾URÌOSÄLK¥@4B0 @0¥?1¥;.£7+¤8+§=/«E6¡>+˜7$:'¥>-¬A/²C2¶D:§02¯:B¹DL½LRºMR­KL–A>‚71{8/v6,x2*„1-œ37¹=GÕGWèM[âFIÏ53Ð:9½31ÈNKÆc]”J?Œ[J}cLj_CgdEtoOpQhJhN°hYäbbõQZôDQö7Iý1Jÿ2Nÿ/Mÿ*Hÿ2Oü0K÷1Jõ5Lò4Mð2Kó3Ló7Pò@XïC[îF]íIaëNcêQeèUhèVkåSjäRiãOiäNiçNlëPoòSsóVuþh…ña|å[tÕUlÍYlÉdr¨R]r-2^&'Y0,W:4Q?5B:-:8)>B1LN9VO3aV6e_?heDquT†e~ŒiwˆdxŒiu‹er‹dr‹cvŒeyhzizj€•v„›~Šž… Š’£—¨–˜©™–¦™‘¢’‡˜†zypƒmg~b^wYTmMPcGSXDXUDYVG7827828939:4;<6=>8@?:A@;BA<BA<DA<DA<DA<DA<E@<E@<GB<GB<GB<FA;FA;FB9HA9HA9LC<KB9JA8I at 7H>5G=3F<2E;1D:0D:0E;1E;2D;2E<3E<5E<5 at 91?80=82<71;60:5/:5/:5/96/96-;7.;7,?8.@:.C;0D</F<0F=.J>0K?/M at 0M@0M@/M at 0O?2O>4L>3K=2J<3G:1E;1D:0D;2D;2B;1@<1@<3A=4B>5F<3S81[*&‰:?¾T`ÙTeæUfãUcËJOŸ30–:/‘>0™A3®F=ÅIGÕBHÍ>@±B7§F5©B3¬@3¯?3°>3³B4´D6²G5©B/£<)¤;(©<(«:(®6&­3(¶97º9=½7>¼7<¿<BÆJLÄTS¾XS™?7Œ4*‰,%61ÃHKÜOWâAQÛ3@Þ:9Í.*Ó84È74ÆE@È]U©WKWFwW at veI~pSpQ„fJdK©o[ÕuiîSWüDP÷;Jø9Iþ=Nÿ@Qÿ:Lù4Hÿ?Sþ9Mú4Ký3Ký1Jÿ/Iÿ0Nÿ6Sÿ3Tý4Vý6Wú7Wø9Zø=\÷>^õ@aøCfö@fõ?eõ?gø?hüCmÿErÿIsÿOuÿQuþUvòSqçTnåaxÖfv·Wb}15j0/X1*P8,G>/>A.;D/?G/PK._T8g`CokN||`ˆŽr‡‘v}‹qzq|s|szozŠm}Œoƒ’uˆ—z•£Šœ©•£®¦±¡¬´§±¹®°·°«µ­¡«¢” ”ƒ‘‚s„qh|c]tXSlNPdHRZCWYDYZH671671782893:;5<=7?>9@?:BA<BA<DA<DA<DA<EB=FA=FA=FC<FC<GB<HC=HD;HD;JC;JC9LC:KB9KA8J at 6J=4I=1H<0G;/E;/E;/E;/E;1E;1E;1D;2D;2 at 9/@9/@91?80<71;60;60:5/;7.;7.;7.<8-?8.A;/C;0D</G=1G>/K?1M at 0M@0NA0O?/O?0O?2N=3N=3J<1I;0G;/D:0D:0D<1D<1B;1@<1A=2A?3B?6K=4\5.w32­LSÛ]iæM_å@Q×6E·&+¨1)7(’:&—<)¬@3ÃD=Ô>?Í;;±?5¨B4ª@2­?2²@5¸C9¼H;»J<¬>/ª?/¨=+¦;)ª9)°:,·;/¼<1ÊFAÎDAÐ>?Ð79Ö7<ÞBEâLNÝROÄC>ÆKCÍTLÔSMÙKJÛ?Bà5>á27Û4.Ú7.Ð1+Ï:4¿84³@9µ[P–UC{N9‚bI†kP„`F’[F­fTËrdçmhêEKò:Dê9Cç<DçBHçFKèGLêFMôJSòBMò9Iö5Hù2Gý/Fÿ2Lÿ8Rÿ9Vÿ9Xÿ:Xý:Zþ;]ÿ=_ÿ@bÿAeÿCiþDkþDmýBmüCoüCoüBqýBoÿGpÿ@hÿGmÿMpòIhéOkå[rÙcs½YcŽ?D`&$Q+"V at 3VO=IL7 at D-RJ3eYCujV€{gŽy™œ‹•œŒˆ“ƒ‚Ž€‰—ˆ›Œ™ˆ‡’‚Š“‚—žŽ¤¨™²¶§¸¼®¿Á¶ÀÁ¹ÂýÅÆÁÃÃþ¾¾°µ±¢©¢—Œy‡vi{e\sYTmORfJQ[BUZCW\F560560671782893:;5=<7>=8@?:@?:C@;DA<EB=EB=GB>GB>GD=GD=HC=ID>IE<IE<KD:LE;LC:KC8LB8KA5L at 4K?3J>2I=1G=1G=1F<0F<0E;1E;1D;2C:1A:0A:0 at 91@91=82<71;60;60;7.;7.;7,<8-?9-A;/D</E=0H?0J>0L?/M at 0NA0NA0O?/O?/O?2N=3M<2L;1I;0G;/F90C9/C;0B<0B;1@<1@>2A?3B?6N;4m84—FEÄY_ÛWbßCQÞ8FÔ3;½++­1'¡8%˜:!—9 ¤;&¶>.Ã:2¾71§7,¢:-¥9-§7,¯:1¸B8ºE;·E:®>2­?0§<,¤6'ª6)¶>0ÃD;ÊG=¾8-Î@6áD?ìBBô=Aó9>ë27Þ.0Û75âGBèSLåNGÜ=9Ù10ã/2ê67Ù1(Þ</Í,"Ð71¾3,°7/Ég\¸l\ŽWC‡ZCƒV?‰R=©\LÎlaágbäTTðEKñ=Fä;@Ù=>ÒA>ÒGBÝOMëWWíNRïDMð:Gö5F÷2Fø.Dû1Gþ7Nþ8Sý8Tý8Vþ9Wÿ;\ÿ>aÿAeÿCkþ;eý<hý>jý?mú>nø>oô=mö:jÿHrÿ;aÿ?dÿKnÿKn÷NmïUoãZnèr‚Âaj˜ILt:8\6-P9+PC2UM:^QAreUˆ|n•‚Ÿ‘¦§Ÿ¡¦Ÿ–œ˜•ž›ž§¤¦¯¬¦¬¨¢§£¦¨£µ´°ÂÁ¼ÌÉÀÑÎÅÕÐÌÕÐÍÔÎÎÕÏÑÑËÏËÆÊ¿½À°²¯˜Ÿ˜€Œ~m~k`t[WnRVjNS`FV`EX`H560560560560671893:94;:5=<7>=8A>9C@;DA<FC>HC?HC?GD=HE>ID>ID>JF=JF=MF<MF<ME:LD9MC9MC7NB6MA3N at 3MA3JA2JA2I@1H?0G=1F<0D<1D<1C:1C:1A:2 at 91?82?82<71<71<8/<8-<8-<8-@:.A;/D</E=0H?0K?1M at 0NA0P@0P at 0O@-O?/O=1O=1M=0L</I;0F:.E8/C9/B:/A;/A:0?;0?=1@>2@@4P91r1/¨JKÁSV»>D½06Â03Á//º1)©1!£9#œ=!™;›< ¡=#¥;%¤6%ž6) 8-¢6,¥4,­81·@:¸C<²@6±B7­A4¨</¦8+¯:0¼C8ÃD=Å@7Ã>-Ï>-Ù5+á*&í"%ú%+ÿ*1ÿ.4í)*ç.+á3,ß4,à3,ã2,é0-ç2+Ú2%Ö6&Ð2&Ï7,Å6.½>7È`UÒq¦eSVBŠM:£WIÈf[ßd_çRTèCIõFMí@Dß??Ô@<É@8Æ@7ÑFAãMLïJNô@Kù9Hý7Hü5Hø3E÷6Gú;Mú8Pü7Rû6Rý6Uÿ6Xÿ9]ÿ;aÿ<gÿ>kÿ?mÿ@qÿBtÿBuþBuüBtùBpÿFmúAaþEeÿKjþKkÿVtÿ_zõ]tòj~æp~Óow®^aƒCAg6/hB7sUJye\Œ}v£–­£¡²®«¶¶¶²¶¹ª¯³°·½¶½Å½ÁÊÀÃÊÃÂÊÉÆÍÕÎÖÝ×ÛâÚØçÝÛéÝÝæÚÜåØßä×ààÔÞÙÏØÊÅ˺ºº¢§£ˆ’‡t‚qexb\sW[oS[jM\iK]gL561561561560561671872983<;6=<7@=8B?:DA<FC<GD=HE>HE>HE>HE<JF=JF;KG;KG;NH:MG;MG;ME:MD;MD;MD=NC?NC=MC7MD5KB3JA2H>2G=1E=2D;2C:1C:3A:2A:4 at 93?74<73<71>7/>7/<8/=90>:1A:2C<2D=3H at 5I?3L at 2MA1NA0P@0O at -O@-L?/L>1M=0L;1J91I81E80C90 at 9/>:/;;/<<0=>0>?1A?0S8-‡<7Ä\[ÊZY®86«.*²1+®.%­2#¬9&¬B*ªF,¦D'£A&£A&¢<#Ÿ9# 9*£;0¦:0¦7.­<4¶C<·E;°@5«=0¨</©;.¬<0»E9ÆLAÅE<¼8,¿6$Í:(Ý;.æ3,ñ+*ù(+ý&+û%'ø**õ.+ï2,ë4,è3*å3)ä2(à3%à:*Ñ2Ü?0Î6)È8-Â?5³A6Ñl`¿gY¥RB¨OAËcZçhbæRRêAFóBJë>Dá;=Ö<<Í@9Á>4¶8,¹6.Ä94âHHé@Eð;Dö:Hú:Iø8G÷;Iû?NþAUÿ?Vþ<Tþ9Tÿ8Uÿ9Zÿ:^ÿ;cÿ>iÿ>lÿ>oÿ>pý>qú@rø@t÷Aq÷CjÿMmÿSs÷Jhë@`ýTsÿg…ÿe‚÷]wï_xçh{Üp}Æqx§gg^X{ZQ—~wª™’¾°­Ä¼ºÆÂÃÈÇÌÇÇÏÃÃÏËÊØÌÊØÑÊÚ×ÎßßÔäæÛéêàëíãëïåæòèæôèèðäæîáèíàéêÝçäØâÑÊÑÁ¿Â««©‘–z†xl{hbu_`rXbpVboScmT21/320431651875984984984;:5<;6==5??7AA9CC9EE;EE;HH at HH>HH<JH;KJ8LK7ML8NK8MJ9JF:GD;JFCNIMNIPGDOD?ENE>LC4J at 4KA5MC9LB8F=4B90E<5C:5 at 93?74 at 85?75<74<42C:5B94A96>95?:7>:7?;8@<9B?:D at 7G@6J at 4L@0O at -O@+L?,G at .F?/I;0K81M53K65J88F;9B?:6904</9D4:A/69$?=(bC1¼j^¹JA¦7,¥5)§7+¥5'¥7&¨=+£8$¥<&ª@*­@)¬=)¬9&®6%«6%¤6'¡7)¢8*¦<.ª@2¬B4¬B2¬A1©>,«=,­<,³=/½C4ÄF8À>1º2&Ç9+Ì8*Ð8+Ö8-Û7-â5.é3/î1-ñ.,ô.-ó0,ñ1,ê5*ã7)Ý:)Û:(Ü9&Ô3Ð3 Ï8'Æ7'¾6(ÂB5ÏSIÈNCÏSKá\Wî]ZðPRí>Cò9?÷?GêAFßCDÕAAÈ?9»<3±;/°</²<0ÊL@ÔKCÜGCá>?ë<A÷?Gý?Iù;GþDQüCQþDRÿDUý@Vü<Uÿ<ZÿBdÿFkÿAjú;gõ:gö<mùCsýIyÿKzÿMyÿMtøPsðOpçMiêMjüYxÿgˆÿ_ƒõGlöWwè_yÃ^n½{‡a^xp§‘„»§œÑÄ»ÝÖÐÝÜÚÜÛàÞÜçâÛëæ×ìëØîñÙñöÝó÷âó÷çôõëôôîòùôñùôðùñïöíîóèìîãééÞäæÝâÖÐÔÍÉÊ»º¸£¥ ‹‰yƒxr}op{k}†sxlv}k0./1/0320542653762873872:94;:5==5??7AA7CC9DD8EE;HH>HH>HH<JH9KJ6LK6MM5NM8KJ8KI=KJEPPRWU`YXjVTjRO`OIKMD?H?:F=8G>9H?:F=8B;5D:8A96?74?74 at 85@85=85;62=4/=4/=52<74=96>:9=<:>=9B?:D?9G at 6J@4M at 0O@-P?+L@*B?,B?.F<0H:1J65I56F35 at 65@<9:=6;>5@@4E<-J9)^B4€L>®QB«;- 2#¡6&£:'ž7$ž9%£>*¡;%§<(®?+³@-¶=,·9*¸6(µ7)ª9)¥:*¤9)¥;+¨>.«A1«B/«@.®?,«:(±<+¿E6ÆH9Á?1¼8+À6)Ë7+Ï7,Ð9.Ñ;-Ô</Ø:.à8/ç4-î1-ô.+ô.+ñ0+ê4)á7(×:'Õ:$Þ<'Ù6#Õ8%Ô=*Ì;*Á5&Ä:/ÏF<ÑF?ÚIDéOMóPQôGIð;@õ:AøCHåBEÚDCÒBAÅ>8·;1®:-ª<-«=.¶E5ÆL?ÔNEÜGCã?>ï?Bú?Fþ@JøCJ÷CLúDPÿFTýBSù>Sü>XÿBaÿFhÿCiü?iù@jùBpüFvþJzÿK{ÿJzÿHtõKpñQsõ\zù_{ûXwüNqýEkúDlïEiÚKgÈ_p±nukLI~t°–‰Ì²¥äÓÉìãÜëçæêéîêçòíâóöãùûáúÿâýÿçÿÿìÿÿòþÿöþÿùûþú÷ýúõü÷ôúõòøïðôëîñèíïæëæÝàÜÖØÊÆų²®ž¡šŽ“Œ‰…ˆƒ•‡‰€†Œ~/.,0/-10.21/43/540762761:94::2<<4>>6@@6BB8CC9DD:IF=IG;JH;LI8MJ7NL7NL7OL9KI:NKBTRS_^fihxmm…lkŠkhƒ`YiYQ\OGRH at KH>GG=EE<A@:<C:;?:7<74<73=82>93>:1=9083-94.;60<92=:3>;4?<5@<3E>4G?4I?3L at 0O?0P?/P?-L?,<;&:=(?<+A;-B71A62>42;30=84B;5H94N2.Y,)l/.‡;= FE£;0¢2$Ÿ1 ¤9'¥<)ž7$ž8"¢<&¤;&ª=)±A-¶A/¹>.»<-¾:-¾</²<.¬<.©9+©9+«<+­>-­>-­<,²?-°8(¹>.ËL=ËG:¼6*º2&É9.Ð6,Ô6+Ô8,Ö:.Ø:/Ü8.ã6/è3,ð0-ô.+ô.+ð1)ç2'Ý6&Ô8"Ò7!Ý8$Ü5#Ú9'Ú>/Ó=.È6)Å9,ËA7É<5Í>8ÙEAåKIêJJéCCì?AëCCÞCAÕD?ÍB=Â=4¶:.®8*«:*¬;+¬8)ÀD8ÔNEÝIEà@@è>A÷BIÿHPôAGô@IùCOýGTþEUú@Uû?XþA_ÿDfÿCiÿCkÿFpÿIwÿK{ÿL|ÿJzÿFxÿHwÿKtúNtÿZ|ÿa€ýUvñCdûIkÿTvÜ?\ÍI`Ø{…¸||aC;|n®ŽÕ³§óÛÑûìåúòðù÷ú÷ôýôìûúëÿÿêÿÿìÿÿîÿÿóÿÿ÷ÿÿûÿÿýüÿþûÿýùÿúøÿøöÿõöýóôûðôùðóðçêåßáÓÏξ½¹­®¨¢¥ž£™£—£«žž¦—›£–/.,/.,0/-10,21-32.54/650880991;;3==5??5AA7BB8CC9HE<JF;KH9MJ9PK8OM8QL8OL;LJ>QPL^]bmlzzz’‚¡€‚¨€€¦{u—rkŠe_{YSmTLdMEZG at PB<HD?F@;?<87;63;60<8/=9.;8/:70991;;3>;2?=1@<1?;/A;-F?/H?.K?/M@/O?0O?/P>0L?/@=*?>,@=.?;/?;2>93=:5:94<94D95M51V-+j)-„28ž8C«>C¦7.¥7(¥:(ª?-¨?, 9&¡8#¤;&¥:&«<)³>,¹@/½>/Á=0Å=1Ä>2½?3¶=2²9.®8*¯9+°:,²:,³9*¶;,¹;-ÄB4ËE9È>3¾1'À2(Í9/Ö5+Ø4*Ú6-Û7-Þ7.á6,æ3,ì1*ó0,ô.+ô/)ï0(ä2&Û4$Ò6 Ð5×2Ú0Ú4$Ü<.Ö=/Ð9.Í=2ÒD:Ä5-Å60Ê;5ØD@âMIåKIÞC?Ö=8Ó@9ÎA8Ç>4¾</µ:+°8*¯9+±;-¬4&½?3ÑH@ÙHCÝB@å@DóFLýNUð?Eð?EöBMþHUþHWüBWú@XüA^ÿAcÿCfÿFmÿIrÿMyÿO|ÿL{ÿIyÿDvÿN~ÿR}þKrøMoÿVuÿUu÷MjðFcïKfÒ>VádtþŸ§ÓŽd92lJ>¥ynÐ¥œõÔËÿéãÿôòÿýÿÿüÿùóÿüïÿÿïÿÿðÿÿòÿÿôÿÿ÷ÿÿûýÿüûÿýúÿüøÿúøÿù÷ÿö÷ÿõöÿôøþó÷öëïìãäÚÕÒÉÆÁº¹´³´¬±´©°¶ª¶¾³°¸­¬´©10,10,0/+0/+10,21,43.54/77/880991;;3==3??5AA7DA8IE:LF:NH:PJ:RK9RM:SL:QK=OJDVTUfdqwx††¨¹“ϐƎ‹À‡ƒ¶{w©pmšid_[~UPnNJaKGXEBM?=B;7895296/85,85,671783891;;1></?<+B=*C<)G?,J?+K@,LA/M at 0M?2L at 4K>5L?6K>5F<3B92=82:946;47<59<5>:1H4-Y2-w78”?D¦>E§9<ª;0ª<+«@.¬A/©@-¥<)¦;'«>*§8$­:'µ<+¼=.Á<-Å;.Ê<0Ê=3Å?6¾>3º:/·7,·7,¸8+º8+º8+»7+ÇA5ÍC8Å8.Á1&Æ3)Ë7-Ï5+Û4+ß3)á4-â6,ã5,ç5+ì1*ð/*õ/,ö/*ò/)ì0'â2#Ù4!Ð5Ï4Ö1Ù/Ø2"Ø6)×9-Ô:0Ö?6ØE=ÖF>Í@7É<5Ë@9ÖKDÙNGÒE>Å;1Å=1Â<0À</º;,·9*´:+¶<-¹?0µ9-¿<2É@:ÒC?ÛCBãDHíJOöOVì?Eí>CòBLûIUÿJYýFXúCYûC]û@_ûBdÿElÿJsÿNzÿO|ÿLyþIvÿJwÿTÿT}ýJqùImÿStÿVtøNiëD^äF]êXkÿ–¢ÿµ¼óžŽHFk.)¦kcÍ–óÈÁÿãÞÿñðÿüýÿýÿü÷þþöÿÿöÿÿ÷ÿÿøÿÿúÿÿüÿÿýýÿýúÿüøÿûøÿùøÿø÷ÿöøÿõ÷ÿôøÿôøýñóóéêäÜÚÖÑÍÍÊÃÉÉ¿ÊÊÀÊÍÂÉÐȾȿ·Á¸65143.32.10+10+21,32-43.66.77/880::2<<2>>4@@6B at 4JD8ME8OH8RK;TK:TM;SL<RKAQLIZW^li|~Œ¸–™Ì™žØšžÞ™˜Ú”‘ÔŒŠÉ†…¿~µxv§nk–fe‡]ZwVTiMKYDAJ><?;:8;74762555457664872<:.?<+C>*F@*G?*H at +IA,IB0IA4HB6HA9G@:K=<I;;C9:=77875384/83/917<574+C1']80~C=–GCž>?ž51§;/ª<+ª?-ª?-©>,©>*¬?+°?-«8%²9(¹:+¿9-Ã9,È:.Í:0Ï<4Ë>5Æ;4Â91Á8.Á8.Â9/Â8.Ã6,Å7-ÑC9Ð@7Ã0&Ã,#Ð7/Ö<4Ó2*à3,ä2(ç2+è3*ê3+í2+ð/*ó-*ö/*õ.)ñ0)ì1(á4$Ú5"Ñ6 Ð5Ø7#Ù3#Ö3$Õ3&Õ5)Ô8,Ô<1Ö?6ìYQáRJÓHAÌC;ÊE<ÌI?ÈE;À>1¼:*¼;(¼:*¹:)·:(¸:+¼>0¿A3ÁA6Á<3Å<6ÏA=×EEÝGHäIMëLPèBFê@CðCIùKTþNYüJZüF\üF_øA_ùBaýEiÿJpÿNwÿOzÿNxÿLvÿQ{ÿRyþOvýOtÿVyÿ]{ÿSoîD^úTlîQd÷dtÿ’žÿ‹•ôƒ‰Ç`d§MMµjgΏŠï¼¸ÿÞÙÿïîÿúùÿüþýûÿýúÿþûÿÿûÿÿûÿÿüÿÿûýÿûûÿûøÿûøÿüùÿûúÿûúÿøúÿöøÿó÷ýñóùíïòææçÝÛßØÒÛ×ÎÝÛÏàÞÒßáÖÜãÛÏØÓÅÎÉ<94;8185052+41*41*52+63,74-85.96/;81=:1?<3A>5C?4JB7MC7PG8SJ;WK;UL=UK?SJCSJK]Wcnl‚‚‚¦‘•Åš ÚŸ¦ê¢©ñ¡¥ïž ë™›å•˜Ý”•Ö‘ʉ‰½‚ƒ±zy¡rq‘fc~XVkPN\IGRFCLCBJ??K==G;:@;9:<94?;/C=-E@,F@*FA+EB/EC4CC7BC;AC>@ACB<FD>LCANEEOCHNAIL>HI>GDCHAA=2L:.gF7ƒOAI<Ž?2”8)¥>/©>,«>*¬?+­@,¯@-°?-±<*±8'¶8)½9*Ã9,È8-Ì8.Ò91Ô;5Ï:4Í:3Ë81Ë81Ì92Í:2Ì70Ë6/Ó<5Õ>5Ò91Ì2(Î4*Ø;2Ú<3×3*ä1*é1'ì1*î2)ð1)ò/)ô-(ö,(÷-)ô/)ð1)é3(â5'Ù6%Ò7!Ï7 Ô9%Õ8%Ó6%Ñ4%Ò4(Ó7+Ò8.Ð7/ãNGèXPçZSÚQIÌG>ÄD9¿@7¹>/¹<*¹<&¹<(¹:'¸9(º;*À>0ÃA4ÉD;Æ@7É@:ÑFCÕIHÖHGØGJßIKæFHèBDíDIõLSüQZûO]ûL]ûK`öD^÷DaùFfýIlÿNuÿOxÿOxÿPw÷VxóUvôTvüYxÿ]{ÿZwûQkòI`ýWköUgêM^ö^mâKZæTaåTa×XaÁefȃ~嫧ÿÔÑÿëèÿóòÿøùÿþÿûüÿûüÿûüÿüüþüúýýùúý÷÷ü÷ôÿú÷ÿûøÿüûÿûúÿøøÿóóýîñúëîðáäéÝÝäÙÕâÙÒæßÕëçÛñíáññåìóìÛæâÎÙÕ@=6=:3:7074-52+52+52+63,74-74-96/;81=:1?<3@=4B>3JB7MC7RF8VJ:WK;XL<WK?TICSJM^Xfpmˆ‚„«‘—Ëœ¤ã£­õ§°ýª±ÿ¦¬ú¡§ó ¤îŸ£ê¡á™›Ö•–Ì’’ĉˆ´yyŸji‹`]|XUpRPhOMeNJcKG^FBS@=H?:>?:6@<1A>/C@/CB0BC3BD7?D=>D@<ED;BJ>CVCIaLRhU\o\br`dobbjd`afXWaJDlG>ƒSE•XF“J7‘@+™>+¨A.®@/®A-¯@-°A.´A/²=+°7&µ7(¼8+Â8+È8-Í6-Ñ7/Õ81Ø;4Ò72Ð72Ð72Ñ82Ô94Ô94Ó83Ó6/ÞA:Õ8/Ñ3*Ö8/Þ=5Þ=5Ú91Ü5,ç2)ë0'ï0(ñ0)ô/)÷-)÷,(÷,(÷-)ô/)î2)é4)á5'Ú7&Ô7$Ï8#Î7"Ï8%Î7$Ï6&Ð7)Ò9+Ñ7+Î4*Ë4+ãNGód\ë`YÕOFÄA7º;2µ9-¸>)¸>'¹<&¹;%º9&½9*À</Ä>2ÊD9ÊA9ÎE?ÕKHÓLIÎGDÍEEÖHGãIIæCDèEHòMSøSZùR\÷O^úOaôH^õG`øGdûIiÿNrÿQxÿRyÿTzðUuïZwù^}ý^|ùUpõMgùOiÿYnÿ[mÿctðM^÷TeôO`üUgõL_äR_À^_»vqל˜úÉÅÿåãÿíëÿôôÿÿýüÿÿûÿÿûÿÿûÿþýýýýüúþùöýøõÿøõÿùöÿúùÿúùÿööüððøéìôææëÝÝèÚÙäÙÓèÞÕðèÝùóåÿúìþþòôúöáëêÓÝÜB>5A=4@<3>:1<8/:6-84+73*62)62)73*84+;60>93A<6E>6I at 7MC7RF8UI9WJ:XK;ZLA[NHTIMXR`gd|~§’Ê— ãžªö¥°ÿª³ÿ«²ÿ¬´ÿ¬²üª±ùª¯ó¨¬ì©«èŸ¡Ú™šÒÁ±tr¡he’]Z‡XR~XQzYQvVOnMH_C?M?:@?;:B?8>>4 at B5BE:?D=<B>:CB>FH?LUDVnQfƒarŽisŽtvx„o€€^lŠ[c’WYžWU¦VM¦M?Ÿ@.œ9$ :$§<(¬=*®?,±@.³@-´?-¶=,¹;,º6'¾6(Ä6*Ë7-Ñ7-Ö8/Ú91Ú83×84Ø95Ù:6Ø93Ø61Ø61Ú83Ý:3æC<à=6Ú70ã@7þ[Rÿlcÿ]Tç?6å3)í2)ñ2*ô/)ô*&õ(%ø(&ø+(÷-+ó0,í2+ã1'Ú0#Ô1"Ô4$Ó:(Ì;&Ê<(Í<)Ï<*Ò:,Ò9+Ò8,Ñ7-Ú@8Ï81ÜGAôc^åXQËB<Å@;·4*·:&¶<$¹<&º<&½:(¿:+Ä<0Æ>2Ç>4ÌC;ÙPJßXRÔOJÃ?:À?:ÏHDÞHGâGEæJKïPTñRWïNVíKXñL\ùRføOf÷Ke÷JfüMlÿQsÿRvýRvôWvîXuõXuû[wÿ\xÿZsÿWnÿVkÿbuýVgÿ\mÿ[lñFXôDXÿQeîVeÆfgªieʏ‹ç¶²øÒÏÿëçýïîüø÷ùýüùÿÿùÿÿúÿþüþýÿþüÿûøþöôþùõÿû÷ÿùöÿöôÿööÿõõöèèæØØãÕÔÞÐÍáÖÐñçÞüôçþøèÿüéÿÿóúÿùèñðØáàC?6B>3A=4?;2=90;7.:6-95,73*73*73*84+:5/=82@;5D=5H?6LB6QE7TH8VI8WJ9YK>ZMEUJNWQ_eby{¤ŠÉ”â›¦õ£®þ«´ÿ¬µÿ®¶ÿ¯·ÿ°·ÿ¯¶ü¯´ø¯²õ©ªë¢£ã˜˜ØŒŠÉ€»uq®ie c^˜`WŽ`Vˆ]TVPtMIbFCTBAIAAC<<:AB=FEACD?A?@DBEOMRWVdch†quš}¢‡}Ÿ’}œ {š¥pŠ¤`u¬Yi¶VaºQU¸HF°@4¬;)¬<&­='¨8$¨7%«8&®9(°8'²9(µ7(¸6(»3%Â4(Ê7-Ó:2Ù<3Þ=5ß<5ß<5á>9ß<7ß<7á>9åB=èC=çB<æA;å@:æB9ä@7Ü8/Õ1(Ø6+ëI>ÿ[Oñ@6î6,ê+#î)#ø-)ÿ/-þ,+ö((ú0.õ4/ï61ç6.Þ3)Ö2&Ô2%Ï6&Ë:'È;'Ê<(Í:(Ï9*Ð7)Ñ5)Ð4(Ó9/Ï5-Ô=6åPJåTQÛLHÍB?·1(¼;(»=&½<'¾;'¾9(À8(Â:,Ä:/È>4ËB8ÕOFÜWPÒRIÃD=¿C;ÌHCÛLHßJFåMLëSRíTWëPVéNVìOZ÷VføUhùSiúRküRmÿSqÿStÿRuòMmøUtÿ\zÿ_{ÿ\vÿUoûRiûReüUf÷RbÿZhÿZhóN^øScþYißS^¶`_—^W¶}Ù©¥îÈÅýáÞùééýøõúüùùÿÿøÿÿ÷ÿýúþýÿÿýÿûûÿ÷õýøôþùõþùõþöóÿ÷öÿõõöêêêÜÛäÖÓÝÐÊßÕÌïåÛüõåÿùçÿýéÿÿïúÿøèñîÛáßEA6EA5C?4A=2?;0=9.<8-;7,84+84+73*84+:5/=82?:4C<4G>5JB7ND8RF6TG6WG7YI<YJCWKKXP]b^ysuœ…ŠÂ™Ü˜¤ð «úª³þ­µþ¯·ÿ±¹ÿ³ºÿ´»ÿµ¹ÿµ¹ÿ¯²ù¬¬ô££ë™—àŽÓƒ€Çxu¼sm³k`¢i]›cZ‘]W…VRwNKhEDV@@L85<A<@KABL at BQ>BZEJpW]‚cs˜r—¥z§®«²{£¸vœÀp“ÂcƒÀTnÂG\ÐK\ÑHPÄ<<º5.¸9*µ<'°<%°;'°;)²:)´;*·<,»<-À<-Ä<.Ä6*Ë8.Ó<1Ù?5ßA8á>7à<3ß:4Ü71Ù4.Ø3-Þ93æA;ìE?éB<ä=5ã<4Û4,Ø4+Û7-Ô2'Ì, Ö6*éG:õK>ò@6ï4-ð-)ö,*ú,,ü,,ø*,ð*)ì/+è2.ã5.Ü4+Ø1(Õ1'Ñ3'Í7(Ë:)Í:(Ð:)Ò;*Ó:*Ô8+Ô8,Ñ4+Ö<4Õ:5Õ<7åONíYWÙEEÂ3/À;,¿<(À;*¿:)Á9)À8(À8*À8,Æ=3ÇA6ÏJAØUKÒRGÆG>ÀD:ÇG>ÖKDØICÝLIäSPåSTâPSâMSåNWòXdöZhý[pþZrüVnúRlûQlÿQpýGmÿPvÿZ}ÿ[{ÿVrýTkþWkÿ\mûYhøZhûamö`kí]gïfnìfmÉ\_ ]W{OF˜mfÁ˜”ݺ¶ðÔÑôàßÿõôùù÷ùÿýùÿÿ÷ÿýúþýÿÿÿÿýÿÿøùüùôüùòüùôýøôÿùöÿøöùîìïäâåÚÖÛÐÊÜÒÈîäØýöäÿûèÿýçÿÿíúýôêðìÞãßIE9HD8FB6D at 4B>3@<1?;0>:/:6-95,95,95,:5/<71>93@;5E>6I at 7LD7OF5RE4UE5WG8WI>XMKXNW^Zqpp–€†ºŒ–Ô•¡é©õ¨°ù©±ù­³ý°·ÿ±·ÿ²¹ÿ´¸ÿ´¸ÿ¯±ü«­ø¥§òŸžê—–⌋ׂÍ}yÅum¶pgªf`ž_ZYX„QQuGGcA>Q=5DH8BT=C`@EnCJ€OU–]d«fx¿kÉnšËo˜ÉiÈ`ƒÉWxÆIgÄ;UÆ2HÙAPàEMÑ;<Æ71Ä?0½@,±:$­6"­5$®5$³5&¶7(¼8+Ã;-È</Ó@6×@7Ú@6Ü?6Þ=5Þ93Ý6.Û4,Ó.(Ò-'Ó.(Ø3-á:4ã<4á81Ü5-Ü5-Ð,"Í)Ù7,âB6Ü?0Ð4%Ë.éF7óI<ýH?ü<7ô-*ñ#%õ')û/2ñ-.ë/.ä2.Þ3,Ú1*×0*Ö/)Ó0'Ó7*Ò9+Ö:+Ø<-Ú>/Û?0Ü@3Ü@3Ò6*æLBåJEÎ50ßGFóZ\ßIKÕA?È</Ä;+Ã:*Ã:*Â:*Â:*Á9+¾9*Â<0Â>2ÈF9ÏOBÎPDÆH<¿C7ÁC7ÎH?ÑF?ÕJEÛPKÝROÙMLÚKMÜKPëX`ó[güaqÿauúXmõOgõMgÿNkÿOuÿRyÿUwÿTqüTmý[pÿcuÿjxÿguúboõamídlãflÙhjÎghµfa^TeG<^U©ˆÍ«©åÇÅïÚÙÿóóùøöùýüøÿÿ÷ÿÿûÿÿÿþÿÿüÿÿùúþûöûûóûúõþûöÿýùÿûøþôòøíéêßÙÞÔËÝÓÉíæÖÿøåÿþèÿÿæÿÿëøúïêïèãæßNH:MG9LF8JD6HB6F at 4D=3C<2?80>7/=6.=6.=60>71 at 93?:4C>8EA8KC8NE6QD3RE2VF6VH;ZMGVMR[Whlk‹~‚±Š“Î’Ÿãš¦î¦®÷©¯ù­°ý¯³ý°³ÿ°´þ°³ÿ¯³ý«®û¨«ø¤§ô ¢ïšœé“•âŠŒÙ†…уÉ{u»mk¬dež_a’Y[„RQsNHbWFY_CQmBLEM˜MT¬U]¼[bÊZhÙRpâRußTuÙPlÒJbÍBWÇ8JÅ.?Ô8EãCKæGKØ>>Í>6ÌF:ÃH6¶?+·>-¸=-º<-½>/Ã?0ÊB4ÐD7ÕE:ÙE9ÚB7Û>5Ù;2Ù6-Ù5,Ú3+×3*Ô1*×4-Ú7.Ý90ß80Þ7/Ý6.Ü5,Ö/&Ù5+×7+Ï2#Í1"Ò9)Õ>-Ô;)Ø<-æD7øJAýD?ù64õ*-ö*-÷/2÷67í55â30Ú1,×0*×/,Ù0-Ù0+ã81ä91â:1â;2à<0ß=0Ü?0Ú>1Ñ7+ïWLøaZÓ;6Ñ;:æPQÜFHæPQÏ<4Ê:/Æ8,Å9,Ä:-Ä<.Ã;-À;,¾:-¾<.ÃA3ÇH9ÇI;ÂD6¾@2¼>0ÉF<ÊE<ÎIBÕPI×RMÕNKÓKK×LOéZ`ð^hüfrÿhxü]qòPeóMeýNkÿVzÿTxÿRrøTmö]qûhxûjw÷erüetó_mì`kêkrßruÃjfªd\žla}fVXH9kXJ”|r½ œÞÂÁîÖÖþîïûõõûûûûÿÿùÿÿýþÿÿþÿÿûÿÿúýÿþùûþõûüöÿþùÿÿúÿþúÿûõÿ÷òñèáäÜÑáÙÌðé×ÿúäÿÿæÿþåÿÿê÷ùëíðçèéáQK=PJ<OI;MG9KE9IC7G at 6G@6B;3A:2 at 91?80?82?82A:4@;5B?8EB9KE9MF6PE3RE2UF3UH7YLCUKLZScii…|«‰“È“žÞš¤ë¦¬ø©¬û¬­ý­°ÿ®±ÿ®±þ­°ý­°ý©¬ù§ª÷¤¨ò¢¦ðŸ£íšžè•™ã’”Þ’’Ú‰ŠÍ|€Àsx²ou©mpigŽj_}y_x‚WjŽP_£O\»S\ÍT]ÖPWÛHRå@Qè?RäCRÜDPÖCKÏ@DÊ9<É46äJLçIJáAAÕ74Î95ÎA8ÈD8¾>1ÃE6ÃE6ÅF7ÉE8ÎF8ÑG:×G<ÚG=Ö>3Õ;1Ö8/Õ4,Ö3*Ø4+Û4,Ú6-Û81Ý<4à=4ß<3Ý90Ü5-Ü5,Û7-Ò.$Ý;0Ú=.Í1"Æ-Î7&Ò=)Í:&Ì9'Ô8)â:/ó=9ÿ@@ÿ<>þ37ó,/ê,.á+*Ø*)Ô+(×/,Þ44ä88é99ï75ð74î73è71ã7-Ü6*×5(Ñ5&Í5(çPEÿmcÛHAÈ42×CCÓ>BêVVÙA<Ò>4Ë8.Æ6+Æ:-Æ</Ã>/Á=.»9+»<-¾?0ÀA2¿A2½@.¼=.»<-ÃC6ÄD9ÈH?ÐPGÓRLÐOIÒNLÕONé^cîagûitÿnzÿduõVjõQiÿUoÿWvÿVtúXpñ^pônyöw€íksÞXañ`mñ`mìboïs}숊́|ªth™yjskXON:_VGƒqg¯–’ÜÀ¿ïÕØüéëþôõýûüýþÿúþÿþýÿÿýÿÿûÿÿùþÿÿûùÿõúýöÿÿúÿÿúÿÿøÿý÷ÿþöùðçíåÚéáÔôïÜÿûåÿþåÿÿãÿÿèùúêòôçîðåSM=RL<QK=OI;MG9KE7JD8IC7E>4D=3B;3A:2 at 93A:4A96@;7A@;CC;IE9MG7OG2RF0UF1UH5WK?RHFXR^jg‚}§‰“Ä’žÚ˜¢ç¤§ö¦§ú«©ü«¬þ¬­ÿ­®þ¬®û¬®û¨¬ö¦ªô¤¨ñ£§ð¡¨î §í¤è›¢æ™žâ’šÛ‹“Ò†ÊƒÂ„ˆ·ƒ¨ˆyšmˆšcz©Xi»Q_ÏMYàIRèAIê=Aé=;ã>8ÝC9ÖH:ÎI8ÅF3ÂC0Å@1äTIàG?Ú;7Ø64Ø88Ø:;Ñ98È74À:/¾<.¿;.À:.Â8+Ã7*Æ4'Æ2&Î4*Ð3*Ñ3(Ô3)Ö3*Ù5,Ý6.Ü8/Þ=3Û=2Ü;1Û8/Û7-Ú6,Ø4*×3)Õ3&Ó3%Ð4%Ï6&Ò=)Ñ>*Ê9$À2È:&Ê4%Õ1'ç51ú<<ÿ=@ÿ7=÷37ê-1á-.Ù--×/.Ü43ã9:é;=ð9=ö26ø03ô01í1/ä1*Þ2(Õ1%Ï3$É1$Ñ=1új_äTLÈ95Ð@?Ë:=äRSäJHÜC=Ñ:3É6.Æ8.Å;0Â<0¿=/º;*¼?-½@.¼?-º;*º;(½;+¾<,¼>0¼>2ÀD8ÈLBÌPHÊNFÌLIÐNLèaeìaføhrÿo{ÿhx÷Zk÷UjþZrÿYsû]tîaræjtë}€ñ‡‰èwyÚ_dñgtþm|óeuëlwö‘•ì¢ŸÄ”Š¢|hjUHQ<WUFth\¤ŒˆÛ¿¾òÕÙùãæÿóöÿúüþþÿüýÿþûÿÿüÿÿúÿÿøýÿÿûùÿõ÷ýóýÿ÷ÿÿøÿýöÿý÷ÿÿöÿùïõïáòìÜúõáÿýçÿýäÿþâÿÿçýþìùúì÷÷ëVO?TN>SK>PJ<OG:LF8LD7JD8H at 5F@4E<3B;1B92A:2C:3A<6C at 9DD:JF:MG7OG2QF0TH2UH5UI=QGEWQ]jh€~‚¨Œ”Å“Ø™¢çŸ ò£ ÷¦£ú§§ý¨ªÿ©«þ©¬ý§­û¥«õ£ªò£§î¢§ë¤©í¦©î¥¨í£§î˜ è”¡å”Ÿß”Ÿ×•›Íš•¾ Œ¯ªƒ ¥e´]pÂQcÐIWÜBNå>Fë<Aì<<ê?8ãA4ÜE4ÔI4ÊI3ÂF.¿B,Â?-âSEÞD<Ý97æ>>êDFå@DÙ8=Î65ÍB;ÈD8ÉC8ÇA5Æ>2Ã9,Â6)Â2'Æ2(Ë3(Î4*Ó5,Ø5.Ù4.Û4.Û4,äB7Ý=1Ù7,Ú6,ß9-ß9-Û5)Õ1%Ø8(Í2 Ê1!Ï9(Î8'Ç4"Ê7%ÔC0È7&Î8*×6,Þ5.æ3/î53ö:9û?>ÿLKúHFòBBì>=ê<=ç7:å26æ,1ô+1ø)/ô,.ï/.è1+à4*Ù5)Ó7(Æ0!À.ôdYë]SÏ@:ÔDCË;;ßMMêRQàHEÓ;6É6/Æ8.Æ9/Ã;-¾:+¾<,Á@-ÀA.»<)·8%¸9&½<)¾?.µ7)³7+¸>1ÁG:ÅK@ÅIAÈIBËJEåa_æ^`ñdjþnwþkuó]iðXeø]mú^sõbtèdoãlrì~ù‹ö†…éqsøryÿy†õaqàXföˆ‘ÿ´´Ð®¢ ›‡]jPDR9QT?jbU›ˆÚÀ¿òØÙöàãÿô÷ÿúýÿþÿýüÿþüÿÿýÿÿûÿþùýûÿúôÿòòþòùÿôüÿöûýòÿýôÿÿôÿÿóûõç÷ñáþùåÿýçþüãþýáÿÿêÿÿñýýóüüòXO at WP@WN?UN>TK<RK;RI:PH;MC7KC6KA5H at 3H>2G?2H>2F at 4GC:GE9JG8NI6RJ5UJ4UJ4VK9XNDULMZTbkhƒ{~§‰Ã‘™×˜Ÿç£¤ö¥¢ù¢¢ü¡¢ü ¤ÿ¢¨ÿ£«ÿ¤­ü¡ªõ¡©ñ¡¨ì¥¨íª©ï­©ó±©ö¬©ø ©ø—§ò’¡â–ŸÖ¦£Î¶ž¾¹…œ¸gz¿L]ÑERß>Mç;Gç<Dæ=Bà@@à@@â>?ß<=ÝEBÉ:4ÊD9ÊF:º1)ÛJEèJIéCEë>Bè;?æ<?á=>Ú<=Ô<;ÏB;È?7ÊD;ÑMAÍK>¿=0¸6)½9,¿7+Ã6,È5-Ë2*Ñ/*Ô/+Û2/Þ5.çA5ß9+Ù1$Ý3&å9+ç;-ß8&Õ2Ï2Ì4Ê5!Ç4"Ç4"Ê4%Í5'Ï5)Ê0&Ï2)Ñ5)Ò6*Ò4(Õ3&×3'Ü4)à2)æ3.ë52ë33é/2ç-2è-4í.5ö-3ö+/ï+,ì/-ê5.ã9,Ù7(Ð4%Ã-Ä3"çXHéYNË;3ßNIÅ41ÚHHáOPÜJJÔC@Ì;6È80Æ8,Ç9+È<+Å<*Â;(¾9&¼;(»<)º=)º=+·<,´8,µ;0¹=1»?3»?3¾@4À@5ÄA7ïjaõpiêc_ômjûqqìadôgmÿpyÿlzûhxðdoébiëdjîlnîqoîqoûy{ÿ}…ùZlücwßbpû¬¯¶ªš}‘u]rQJY:LR8snZ¥•ˆË·°íÕÓÿîðÿö÷ÿ÷ûýøüüüþþÿÿþÿÿÿþÿûÿþðÿôåþéæûêïÿîøÿöüÿôþÿóÿþñÿýñÿûîÿúêÿùæÿùãÿùáÿùáüúåÿÿõÿÿûÿÿûYPAXO at XO@VM>UL=TK<SJ;RI:NE6MD5LC4KB3JA2JA2JA2IA4GC8HD9LF8OH6RJ5SK4VK7TK:XNEULMYUckhƒ{}¦†ŒÀ•Ó–šáŸžìŸñžžôžŸù¢ýŸ¦ÿ ªÿ¡¬û ¬ô «íŸ§è¢¥è¥¤ê©£í« î¤Ÿï §÷š¦ðœ¡á£œÐ±˜À¿ªÂq„ÄTbÑCOâ<Fì8Aï7?ê:=å<?Ü@AÛACà<CÚ9?ÚADË;;ÌB?Ê@=Á31åOPæCFè?Dê;Bç8?â8;Û89Õ:8Ï;7ÔE?Æ=5Å<4ÌG>ÌLAÁC5¸:,·9+¹7*¿7+Æ6-Ë4-Ñ2.Ø3/á53ä84ä>2á;-Þ6)ß5&á5'á5'Ú5"Ó4Ñ9$Ë9"Ç9%Ç:&É<+Ë<,Ì8,Î4*Õ3.Ö5-Ó7+Ï7)É6&Ç4"Ë4!Ï4"Ø2$Þ2&ã0+æ.,æ,-æ,/æ-2è.3ì+.í,-ì0.è2.à4*Û5'Õ8'Ò9'Õ?.»*ÖD5Ð>1ÙF>ëVPÚB?ØBAçUVâRRÜKHÔC>Í=5É9.È9+Ç8(È;*Ä;(¿:'½<)½>+º?-¹@/¶>.²:,´;0·=0¸>1º?0½?1ÁB3ÅC5ëi\òmdçb[ðkfõolèbañklütxÿq~ÿo|öirí]fêY`ñbf÷qpþzxûvwÿx~ùRdþ[pä]nö¦©©¦“jŒkZtON_;SZ;us\©ÖĸöáÜÿõñÿúúÿúûÿûüüüüúþýûÿþúþÿõÿúíÿóáÿéáýæéÿëóÿñøÿòýÿòÿÿñÿýïÿýíÿúéÿöåûóàúòÝüôßü÷äýúóüüúÿÿý\PB[OA[OAYM?XL>WK=VJ<VJ<SG9RF8QE7OC5OC5OC5OC5MC7JC9JF;MG9PI7SK6VK5VK7TK:WMCVMNZWbkiy{¡…‰¹‹‘Ë‘–Ö˜˜Þ™™ã˜™éšî› ô£÷Ÿ§ø ©ô ªï¨èœ¤ãœ¢àžŸàžá™ã›™â–›ßššÚ¤•Ð±ŒÀ¿‚¬Çr“ÉYqÇBS×ALß>Dã=?å==å<?ã=?á>Aá>Cà<C×8=Õ?AÏA@ÊC?Ã<8Ä96éWWàBCä>Bè;?ã9<Ü68Ö66Ñ96Ì;6ÕHAÄ;1¾5+ÅA5ÍK>ÆH:»=/·8)º6)¿7)Ç7,Ï6.×50Þ71æ95é=9×3*×5*Ú6*Ü6*Ý5*Ý7)Ú:*×>,Å4!¿4¹4!¹6"¼8)½8)½3(À-%ã@;å>8Þ=3Õ<.Ì9)È7$È7"Ì7#Ò7%Õ3$×/&Ù.'Û.*Ü.-Û//Ü./Û,)ß0+à5-Ü5,Õ3&Ð4%Ð9&Ñ>*ÔA/Â1 çSEÒ;0ÚA;ÞC?èJIðTUíUTçSQãOMÝJCÖC;Ï<2Ê8+Å6&Ä7&À7%¼7&¹:'¹<*·>-µ=,²=,°:,±;/´<.µ=/·=.¹?0¾C4ÃE7Ü\Qêg]äaYðlgöpmça`ìfgójqàR^ï^kõhqòemñ`gôeiùqqþxwútuÿnuóJ]øRhä[mñœ¡£œŠa€`UoHOd=W`Aww]­¥’áÑÂÿîæÿøñÿüøÿþúþÿúûÿüûÿýûÿýùÿûóÿöèÿîÜþãÚøÞáùáèûåïüèöýëýþìýúéÿúêÿ÷æúñàôèØòçÕöëÙøñáþúñýüøÿþû\PB\PB[OAZN at YM?YM?XL>XL>UI;TH:SG9RF8RF8RF8RF8PF:LE;KG<OI;RK9TL7WL6WL8WK;VLBUMK\V`jh~yy›‚…²ŠÂ”Γ•Ò•”Ö••Û–˜ã˜›è˜žìš¢í›£ëœ¥è˜¢ß–ŸÚ•›Õ”˜Õ“—Ö’“Ö‘Ò…„½‘ƒ¶¥}±·s¢ÈfÒVzÕGaÔ<KÞAJàBCÞCAàB?áAAä?Cç>Eç=Fã?FÖ:>Ñ?@ÑEDÆA<º61Å>:êZYÝABã@Cæ=@ã:=Û89Ó97Ð<8ÎA8ÏE;Â:.»2(À</ÇE7ÄE6½>/¸9(½8)Â9)Ë8.Ò:/Ù80à91è;7ë>8Ø1+Ù2*Ü3,Ý5,à5-ß7.Û9.Ö=/É7(Æ:)Á<+¾<,¿;.Á;0Å<6Î95ëC@í@<ä@7Ù=1Ï9*Ç9%È:&É;%Ï<(Ð7'Ï1%Ñ1%Ô1(Ö3,Ô1,Ñ/*Ó2*Ó5,Ó7+Ð7)Í5'Ê7%Ì;(Ì>*Ì;(Ï<,ô^PàF<Ò3/Ò.,æ@@ûWXÿusÿroÿjgö^YçPGÕA7Ç5(½. Ä8'À8(»8&¸;)·<,µ=-²=,°<-¯;.­<.°</°<-±;-¶>.¼B3ÀF7ËMAß`Wâa[ôpløtræ`aä]aæ]dÖHTçYeógrôgoöelükpþsvþvvûpsûenñDXôKbåXkë’– •ƒ_zYQlCSh?\gEy|_°ª”çÜÊÿõèÿùðÿûñþþôýÿ÷ûÿúùÿúöÿøòüóêûëÚøÞÎóÒÊëÌÏìÎ×îÒàðÖéóÛò÷áöõáûöãüõãõìÛíáÑéÝÍíáÑñèÙüõíü÷ñþùó\PB\PB[OA[OAZN at YM?YM?YM?WK=VJ<UI;UI;TH:UI;UI;SI=OG<OI=QI<SL:UM8XM7YL9XL<UKAUKI\U]hexut“|~¥…‡·ŒÂŽÃÈ’ϐ”Ô’•Ü“—à”˜ß•šÞ•Ü’›ÖŽ”ΉÇ…‹Å‡Ã}ƒÁ~¸}tŸŽp”¨gÁ\„ÖNvâAcè:Uê9KæAGàECÜGAÛGCßEEæAGî<Jí=JæBI×>@Ð@?ÐIE¿>8³2,ÈC<àUPÜDCáACã?@á>?Ú?=Ô@<ÑD;ÏF<Ç=2À8*½5)½9*¿=-¿=-½;+½<)Â:*Ç;*Ï;/Õ;/Û8/à8/ç83é:5æ95ä52ä20æ21ç32æ40Ý2+Ô0'Ë1'Ë7-È:0Ä7.Á4-Ã40Ì:;Ý?@ë8;í76ä71Ø5,Ì4&Æ5"Ä7#Å:%Ë=)Ë8&Ì4&Î5'Ô8,Ô:0Ó9/Ð8-Ð>1Ê;-Å8'Ä7%Æ9'Ç<)Ç<)Ç:(Í>-Í:*Ø>2áC:Ô/-ä::à24ß56×53Ö;6ÞC>åKCêQIêSHèTHäUGË?0Ä?.¾<,¸=-·>-´?.°?/®>0¬<.¬<.¬<.¬=,­<,±=.·A3ºD6ÆLAÞbXâc]ðnlôrrå`cå`eç`g÷kvûoz÷kví`hð_fýlqÿx{ÿy|úmsø^jóAWôC]èUh懍£“ƒg]YtI^uIhwPˆf³²–èâÌÿúéÿýíÿþïýÿòûÿôøÿôôÿñíûêäòáØî×Åèǻ伺޺¿Þ¼ÇàÀÍâÃØæÌãëÓìîØôñÞ÷òßóêÙìàÒèÚÍêÜÏïáÖòèßñèáòéâ[OA[OA[OAZN at ZN@YM?YM?YM?XL>XL>WK=VJ<VJ<WK=WK=XL>QI>QI>SK>UL;XM9XM7YL9XM;WK?ULGYSWe^nnjƒut–~}¥„…±†‰´‡‰¹Š‹Á‹ÈŽÏŽŽÔÕÓ”Ó‹ÊƒˆÀ|¸u|²ov­io«ljœ€lˆ“cy®YvËPoãBdð7Vö4L÷8Hï@EåFBÝJCÛJEáGGèCJò=Nð>LäCI×CCÌA>ÎIDº;4°4,ÉI@ÕLFØBAÚ?=Û;;Ú<;Ø@=ÔE?ÍG<ËG:À8*Á8(À8*¾9(¼9'»8&½:(À;(Ä;)Ê=,Ò<.×;.Ü8.á6.ä6/è50é32è./é,0î02õ47õ77î45æ21Ú.*×4/Õ62Ñ32Ï/1Ò/4Û6=ê:Dí06î02æ3/Ü3,Ñ5)Ê7'È9(É<(Æ8$É6$Î6(Ó:,Ú>2ÝA5ÝA5ØA6ÓG8ÉA1Â;(À9&Ã<)Æ=*Å<*Å8&Ì:+Í7)Í0'æC<Û2/ï?Aã/2Ú*,Õ1/Ò5.Õ81Ö90Ò8.Ì5*Æ2&À1#ÎE5ÆA2¼=.µ:*±9)¯9+«:,ª:,«;/«=0¬>/¬<.«<+­<,²>/µA2ÉSGàg^àc_êjiînoæchðjqõoxúq{ýt~ömuîbködnÿrzÿx~ÿquúipøWfùAYô@[êQfá~ƒ¬—†ykmˆ]o‰ZyŠ`—r¶·˜ßÞÂùôÞüúåÿÿïûÿïõÿïïÿëçúäÜïÙÐãÍÅÞÁ°Ö­¨Ó¦ªÐ§°Ó«¶Ô®¼Ö±ÇÚºÒßÁàæÌèêÔòíÚòéØîâÔìÛÑêÙÏìÛÓéÚÓæÙÑåØÐ[N>[N>[N>[N>ZM=ZM=ZM=ZM=YL<YL<XK;XK;XK;YL<YL<YM?SI?TJ>UL=XL<YN:ZM:ZM:YN<YM?ULEXOR_Wbd_sjfsoyy|~¤~€©‚²ƒ„¼††Æˆ‡Ë‰ˆÌ‰ˆÊˆˆÈƒƒ¿|}µvw­pq§kl¤fg l`Ž‚`q•V^³N^ÒJ^ì@X÷6Kþ3Fþ9Có?BéD@áHBÞICâFIéBJò=Nï>NÝAEÔFDÈA=ÉHB´:/±7,ÎOFÉB<Î=8Ð64Ï10Ð51Ó>8ÏE;ÈF9ÃD5¾9(Ã:(Â:*¿:'½8%¾9&¿:'Á:&Ä9&Ë:)Ó:,Ù9+Ý7+á5+ä3+ê3-ë*+ñ*-ø-3ü/4ÿ17ÿ37ÿ38ý58ù8;õ8<ò9>ò9Aô9D÷7Fû6Hþ5Eô+5ô-2í12ã4/Ù6-Ð8*Î;+Î=,Ë5&Ñ8*Ù;/ß=2â>4ä=4å>5ßA6ÙJ<ÏG7ÉA1Ä<,Â9)Â9'Æ8*È9)É2'Ó9/á@8ëD>Þ0/à..ë46è66Ø3-Õ7.×90×:1Õ;1Ò;0Í:0É;/ÖL?ÌF:¿@1´9*°6)¬6(«7*©8*¬;-­=/®>0­=/«<+«<+­<.±=0ÀKAÚdZÞc^èkiðosêinõrzüvîfp÷oyùryöjsþlvÿwÿv}ùhoùcn÷RbþB[÷<YêKaÝt{µš‰žz}˜k{—f‚•h‘u¬²ŽËÌ­ààÄéìÑîöÞåóÙÙíÑÏæÉÅÞÀ¼Õ·´Ë®ªÈ¤šÁ”–™Ã“¡È™§Ë¬Ë¡µÎ§ÁÒ°ÎÙ»ÙÝÄåãÎìåÕïáÖëÚÒçÒÍãÐÊàÏÈÚÌÃÕǾ[N>ZM=ZM=ZM=ZM=ZM=YL<YL<ZM=YL<YL<XK;XK;YL<ZM=ZL?VJ>VJ>XL>YN<ZM<ZM:ZM:ZM<[OAWMDWML\RZ^Xfb]qjfspwv–xxœ|{§~µ„¿…‚ň‚ȉ„Ç‚}¿y·zu­xq§vo¥tk¢pg za‹„QZ™HE³EHÓHOîBNø:Fþ6Aþ9@õ==îA=æD?ãEBäCHèAKî=Më?MØ?BÑGDÅA<ÃG?²9.³:/ÑUKÃ>5É83Ç/,Å*&È/*Í:3ÌC9ÃC6¼>/À;*Ä;)Ã<)Á:'Â;(Ã<)Â;'Ã8%Ä5$Ê7%Ô8)Ù7*Ý5*á3*å3)ê2*õ33ÿ58ÿ8<ÿ4:ÿ-2ÿ(-ÿ(-þ+1ü-3ö)0ò&1÷)6ÿ,?ÿ*Aü 9ó/ö"0ó(.í,1æ0/Ú1,Ô3+Ñ5)Ð6*Ô6+Ý90æ=6ë>7ë:4è71è50â92ßH=×K<ÓE7Ë=/Ä6(Â3%È6)Ï8-Î4*Ô6-æC<ß82à21Ò  ì89å63Õ1(Ò4)Ò4)Ï5)Î6+Ê6*È5+Å7+ãYNØRFÊH;¾@2·;/µ;.µ<1µ<1¯9-±;/±=0±=.¯;,­9*­9,®:-±<2ÐYQÜb]ìppôvyîmrõq|ör}ÿzƒÿ‰ÿy€ôhq÷epÿq|ÿuÿktø^jöOaÿA^÷8WéG^Ûntº‹™©„‚žn~šg—hœq¡©‚´º–ÈÍ­ÕܽÌÙ»ÁÔ´²Ì©§ÂŸž¼˜š¶–²Œ±†‰³†µ~¹„•À‹œÂŸÄ‘¨Å™²È¡¾ÎªÉÒµÚÙÄæßÍêÞÒéÖÏáÌÉÛÆÃÔÁ»Î½µÈ·°ZM=ZM=ZM=ZM=ZM=ZM=ZM=ZM=XK;XK;XK;YL<YL<ZM=ZM=ZM=ZL?ZL?ZM=[N=]M=^O<\O<\O>YM=WMCWLHXNOZPX]Ub`Yia\rjfokŽsp›vq§{u³ƒ~ÁŠƒÉŠƒÇˆÀŠ~¼ˆy²ƒr¨†r§t«‡l£†\„HL¤B9¶A:ÍC@Þ@?è:;ô<>ÿDE÷><ó=<ì>=ê@AëBIêCMëANãALÐ>>Å@9¾?6·>3°</²<0ÀD8ÒMDÇ61Ô;6Í2.Ì3.ÖC;Ç?3µ6'»>,º7%Á:'Ã<)Â;(À9%Â9&Å:'Ç:(Ë:'Ð9(Ö6(Ø2$Ú."à/%ì7.õ=5õ82÷40÷0-ø**û&(û%'û%'û%'û&*÷!)ø".ÿ'7ÿ(>ÿ!;ÿ6ý1ÿ'8ï#,æ#+ã+-Ý--Ô+(Ò-)Ü41â62è64î66ò65ò12ï./î,,å/,Ü92Ñ:1Ò91ìSK»"Ä+#ßF>È.&Í.(Þ<7èE@â:7Ø/*Ú.*â51å<7ß>4Õ<.Ï5)Ë3&Ì5*Í;.Ë;0Å8.ìbXàZOÈC:¹6,º:/¸8-±3'´6*°0%°2&®2&¯4%°6'²:*´<.³=1°:0ºC;Ö\Wìppñsvöx|ûyƒõq|ÿ|„ýw€út}üs{ÿr~ÿr}ÿmxÿgsü`nôI\ÿ>\ÿ>[äAVÔek´•€’¡zƒm}™f~”c‡—j”Ÿwž¦ ¨ƒœ¨„’£Š£|€Ÿvzšqyšo|r vƒ¤u‚­wƒ³y‹¸‘¼„“¾†—¾‡œ¾Œ¢½§¼“¯½š¾Â§Ï̹ßÓÇãÒÊÜÇÄÔ¿¼Ìº¶Á²«¹ª¥ZM=ZM=ZM=ZM=ZM=ZM=ZM=ZM=XK;XK;XK;YL<YL<ZM=ZM=ZM=ZL?ZM=\L=]M=]N;^O<\O<\O>]P@[OC[NFYNJZPQ\SX_U^_Wfd\tibƒng‘qjxp¬€y¼‡€ÄŠÄ€Á~ºt«Œn¢—q¤¡u¨šjž™W{=Aª5+±5+Â<3Ó@8Ý>8è?:óA=õ=;õ;<ô;@ñ>Bî@IèAIâ@KÚAFÇ<9½=4¶<1±;/«:,®:+½A5ÐJAÚG@ÜA=Ô63Ð51Õ@9ÍC8»9+²5#½8'Â;(Ä=*Ä=*Ä;(Æ;(Ç:(Ê9(Ï9(Ï6&Ô2%Ú2%ã5*ê8.ï80ð91ç1&ç/%ê.%ï,&ö+'û+)þ,+ÿ-.ü*-ú%+ú$.ÿ'7ÿ$;ÿ7ÿ3ü0õ0ö.9õ3<å*1Û(,Ü.0Þ02Û+.ñ:>ô7=÷4:ö26ö/4ø03ù25ô87Û2-Ú;5×82äE?äE?Î/+Ñ2.Á"Ô51á?:èE@à=8Ø3-Ù2,Ý60Ý:1Ô:.Ï9*É5'Ç5(È9+Ê<0Ê<2Æ9/ícYáXNÉ@8º4+Â91Ã:0¿6,Â9/¿5+¾4*½4*»5)¸6)µ5(´6(°6)´;0»B9ÓYTèljïqtöx|þ|„øv€þ|„üyùv~þuÿsÿp}ÿkwüdqý_nöI]ÿ>\ÿ>\éCYÓeh®Žw‰˜oz•bu’\xŽ]cŠ•k˜p‹•p…”mp‡]l‰]h‰\g^k_q•ey›izŸk¬t„±vŠ·|»}¼“¼‚–½†›»‰›µ†¡³‹­¶—¾½¨ÏÆ·ØÇ¿ÖÁ¼Ï¼¸Æ·´º¬©²¤£\L<\L<\L<\L<\L<\L<\L<\L<ZJ:ZJ:ZJ:[K;[K;\L<\L<\L<\L=\L=]K=]M=]N;^O<^O<\O<_RA]QA\PD[NFZOK[PN]QS]RZ_SgcXvh]…kb‘sk¤vµ†}¾‰}½—…Á™€·›v©žpž®u¢ºv¥µi˜±Rt¸<D¾5-º4+À<0ËC7ÓE9ÛC8ä?9ñ=<÷:>ù:Aö=Eï@GæAHÙ@EÏ@BÀ;6¸90±9+­9*©8(­9*»?3ÏF<ÙD>×96Ù74Ú;7ÜC=ÝOEÎH<µ3#¾9(Á:'Ä;)Æ=+É=,È<+É:)Ì9)Ï7)Ï2#Ó/#ß4*î=3ô?6ñ91é4+à4&ß5&â2%å/$ë,$î+%ñ+(ò+(ó+-ð(+ò&/ø(6þ%:ý7ü3ø3ô%7ò0;ó5Aò8Cð;Dð<Eé5>ä,6ð2<ó/;ö.9ö-7õ.3õ.1ó/1í42Ü0,â=9Ú64ß;9ÿmjåCAÑ/-Î/,Ù:7ß@<àA;Û<6Õ7.Ö5-Ö5+Ò6*È6'Ã6%Â6'Ä8)Å;.Æ<1Æ<1Å;1ë`YáTMÉ<3¿0(Ë;3Ñ>6Î;3Ò=6Ø=8×<7Ô=6Ï<2É;1Ã9.¼6*¶6)¹;/¼@6ÏTMãgeíorøz~ÿˆû|ƒû|ƒûyûx€ÿwÿsÿn}ÿgvû`pü[mõG^ÿ<Zÿ>\ìFZÎ`až~ev…Zi„Qh…OmƒRt…X{ˆ]}ˆ^x„\q‚X`zM_Pa…UeYn•`uœg} j~£mƒ¬r„²tˆ¶x‹¹y‹¹y¹z‘º~”º“±•¬€›©†©­’ºµ¢Ç¹®Ë¸²È¶´¸¬¬ª¡¢ —š[K;[K;[K;[K;[K;[K;[K;[K;ZJ:ZJ:ZJ:[K;[K;\L<\L<\L<]K=]K=]L<^M=^M;^O<^O<^O<^Q@^Q@]OB[OC\NE[NF\OI]OO^P_bTmdY{i^‰pgœ|t­…{·ˆ{³™…º¥…´¯€ª¸z¡ÆxŸÑuœÌcŒÈMlÜFRßA@ÕA=ÏE;ÌH;ÍG;ÓE9ÞA:î@Aõ<Aú=Dø?GðAHâAFÒ@AÆ?<¿?6¶<1¯9+«:*ª9)®8*¼>0ÎD:Õ<7Õ31à;9åA?áD?èSLßUJ¿:+Á9)¾7$À7%Ä;)É=,Ê=,Ë9*Î8)Í4&Ò2&Ù2)å9/ñ>7õ>6ð5.ä/&à6)Þ6)à4*ã1'ç.)ê-)ì*(ì**ê),è',ë'1ò)9ö&<÷!;û=û%Aû6Hä(6ç.<ÿP\ÿ`lÿP\ò<Ió9Gè)8í*8ñ-9ô0:ñ27ê01á+*×(%Ø0-Ú72Ô2/åC@ÿspõVSÝ>;åGDÛ=:Ú<9Õ:5Ò80Ñ7-Ð6*Í4&Æ3#¾5#¹6$»8&¿;,À</¿9-À:/Å<2åXQÜMGÊ70Ç0)×<7ÞA:Ú;5ß<5ç>9é=9æ?9á@8Ù?5Ð<2È:.Á9-»9,»=1ËNHàc_ìnoú|ÿ„ˆý~…øy€øy€üyÿx‚ÿt‚ÿn}ýetù^n÷VhóE\ý8Vÿ<ZîH\ÇYZŠlRcrG\tB\yCdzIl}PtVvƒXrXoWm‡ZlŽ\o•buh{¤l¨o„ªq…«p…­q…±tˆ´u‰·v‰·v‰·v‹¸w¹z‘´|«{’¤|›¤…­«–¾²¤È·¯Ç¸µ´«®¡ž¥—’™[K;[K;[K;[K;[K;[K;[K;[K;ZJ:ZJ:ZJ:[K;[K;\L<\L<\L<]L<^K<^K<^M=^M;_N<^O<^O<^O<^N>^N>\O?^NA]OB^PE^OJbNYbQdcTqdZ}le‘xr¢w¨ƒv¤”}§¬†«Â‰©Î‚žÚw”ál‰ÛXwÚD_óBTúDPïJPáIHÐE>ËE<ÐF<ÙD>èBBð@Cõ@GõBHíDGßCDÏA=Â?7¿@7µ=/®:+«:*ª9)®8*»;.Ì?6áFAâ=;îBBëAAÞ;6ãJBæXLÕK>È@2À8(¼3#Á8(È<-É:*Ë7)Ð8+Î0%×3)à8/é;4í:5í60ë0+å,'ã0,ã1-ç10ì31ó25ö37÷48÷6;ì-5ê,6í.=ñ0Có-Fö)Gý+Nÿ3Rô9Lå3?ð@Mÿ_lÿlzÿWfõCSõ>Pî3Dí3Aí3>é6<ã99Û83Î4*Ç/$Ë2*Ç.(Ð72òYTö\ZòXVÛA?âHFÜB@Ô<7Î70Í6-Ï8-Ï9+Ê7'Â5#¹8#³9$µ:(¸=-¹;,¶6)¼7.Æ=5ÛNGÙEAÎ50Ð1-á>9ç@:ã81ç51ë20î21ë52ç83á:2Ø:/Ð9.È:.¾6*º8+ÈIBÜ_Yënlû}€ÿ…‰ýƒõv}öw~üyÿx‚ÿsƒÿk}ýdvù^pôSeôF]ý8Vþ=ZïL]ÀTRz_BWh<Yq?[vCfyKn~QtVx…Zyˆ_wŒay•exšhz m|§qªr„«r…«p†©o‡­rˆ°t‰³tˆµt‡µt…·r‰¸t‹¸w¶{Ž¬xŽ£x™¤‚­­•À¹§ÎÀµÒÄÁ¼¹À¨ª¶œœ¨ZJ:ZJ:ZJ:ZJ:ZJ:ZJ:ZJ:ZJ:ZJ:ZJ:ZJ:[K;[K;\L<\L<]L<^K<^K<^K<_L=^M;_N<^O<^O<]N;]N;^O<_O?_O?`P at aQAbPFbNPcN]_Pe`Usga…to—{t}q—v–®ƒŸÌ‹¡Û‚–ær…ëduéPdé;Rù3Lÿ<QûERéDKÕ?@Î@>ÑC?ÖEBãEFèBDîAEíCFçDEÚEAËB:¿?4»?3±;-©8(¨9(ª9)°8*¼:-Ê;3èIEé??ë=>å78Ú2/ÞA:îZPôh[ÚPCÉA3¾5%Â6'Ç9+È9+Ë7+Ò8,Ñ0&Ú6-æ;4é;4ê40è/,ê-+ë--ó49õ3;ø3=ü3=ÿ1>þ0=ý1=ù1>õ0Aò1Bô4Kõ5Nõ0Nö-Oÿ1Xÿ>_æ3HùO\ÿanÿ_nÿWfûP`ôDXé8JóAQê:GÝ2:Ò/2Ê2-Â8-½;+¼:*Ä:/À2(ÙJBúkcÝLGáPKÏ;9Ï;9àLJÔ@<Ê70Ê7-Î</Í<+Ë:)Ä;(´;&­:%¯<)³>-±9)¯3'º:/ÊD;ÖGAØC=Ô72×2.ç;7ì:6è2.í2-ò,-ô,,ò./ï31è71â:1Ú<1Ò>2Â6)º4)ÅB:×XRçjhú|}ÿ†‰þ€„õv}÷xýz‚ÿx‚ÿqÿi{ûbtø]oòQc÷I`ÿ:Xý?[ðO_ºQNqX:Sf8]uEa|InSv†Y{ˆ]~‹`g‚—l€œl}Ÿm|¤o}¨p€©o‚ªnƒ©l…©lˆ«qˆ®qˆ°r†³r„³oƒµp…·r‰¸t‹µv‰¬tŽ¥wš¨„°´™ÈïØ̾ÚÑÌÂÂÌ«±Á›¡±ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8[L9[L9\M:\M:]L:^K<`J<^K<_L=^M;_N<^O<^O<^O:_P;`O;aP>aP>aP>aP<bOAeMMdMW`O_aUmgb€uq’|v˜€s‘uŽ­€”͆”ß~‡îqyùclúP[ú;Mÿ*Fÿ2Qÿ<Sñ<Mà<E×@EÕCDÔBCÜCEàBCäADâBDÞDBÔC>É@8¾>3¸>1¯9+¨7'©:)­<*´<,Á=1Ï?7ß=:å99ã03â/2à42Û94æMEülaòh[ÙQCÆ</Æ:-È:.É7*Í6+Õ8/Õ4,Þ7/æ93è62é1/è/,î1/õ15ÿ2Cÿ0Eÿ-Fÿ*Bÿ%@ÿ#=ü 9ö 8÷'Aõ+Eõ.Mõ/Pó+Pô)Tÿ2`ÿAhóCXÿ`mÿhuøVeíKZñL\ëBUÚ2Cë@RÝ7CÉ-1º((±.$«8&¥?&¨@'¸?.¼:,ÝYMá]QÍG>ÍD>Á63É;7äUQÕF@É91È8-É:,È9(È9(Ä=)±?'¦<&¨;&¬=*«7(¬3(¼=4ÓLFÖGAÝE@Û96Ü30é73ì51ë0+ô1-ý,/ÿ+-ú./ô1/í4/æ81ß;1Ø>2É9.½3(À;2ÏNHáa^÷yzÿˆŠÿƒ‡ùzû|ƒÿ{†ÿx„ÿn~þew÷^põZlëL`õIaü9Wû=YîM]²JGhQ1Qd6\tDf~Nuˆ[Žc„h†’jˆ—n‰žsˆ¤t„¦t§r}¨p¨n©mƒ©l…©l…¨n‡«n…­o…¯o°l€²k‚¶n…·r‡³t‡­t§wœ¬…²¹šÈƯ×νÙÒÌ»¿Ê¤¬¿’š­[J8ZK8[J8ZK8[J8ZK8[J8ZK8[J8ZK8[J8[L9\K9\M:]L:]L:^K<^K<^K<^M=^M=^O<^O<\O<`Q>aR=aR?bQ?bQ?aP>aO;bL>hOKgNRbP\cWkjfuv”}|œx—‘z–«•Æ„’Ú}…ðuzþlmÿY[ýDLþ/Iÿ5Rÿ<Uó<Né?LãCKÝBHÖ=@ÛACÜ@AÞ@AÛA?ØC?ÐA9Ç>4½=0µ?1¬;+©8(­<,´?.»@1ÊA7ØC=Ù74á85Þ..â30æ:6Ó0'Ï5)ëUGÿwjë[PÑC7Ê<0Ë;0É7*Í6+Ô:0Ú70ß82å63ç32ê01í12ô36ý4<þ%6ÿ#9ÿ"9ÿ"9ÿ!8ÿ6ý5ø6ï2î9ð%Bï(Gî&Jñ'Mÿ3\ÿEhÿbuÿ`l÷WcñQ]òP]ïMZâ@MÔ2=Ú=FÌ7;»/.®/(¦5'¢;(›?&œ>%ª9'²8+ÒVJ»;2Ä?8¾41½2/ÎC@åWSÕHAÈ91Ä6*Å6(Ä5%Æ5$Ã:(±<(§:&¨7%­9*¬4&¯1%Â?5ÛRJÙIAáHBÞ;6Þ2.ê41í1/ï-+ü22þ,/ý+.ù+-ó++í-*æ1*ß4,Ö8,Ñ=1¿2(¼7.ÈIBÙ\Xówwÿ‰‹ÿ‡Šû€…þ†ÿ}ˆÿv„ÿj|þ_s÷XlöTiêD\õD^õ6Uñ:VàLZ¥HC^K-Mc5Uo?b}JtŒ\€–g‡˜lˆ›nŠ r‹¥vŒ¬z†«wªr~§m|¥i}¥g¥g‚¦i‚¥k‚¨mƒ«m‚¬l®h~°i³j„¶o‰¶s‰¯rŽ¬x™°„­»˜¿Å©ËʵËͶ½Åžªº‹—§]K7\K7]K7\K7]K7\K7]K7\K7^L8]L8^L8]L8^L8]L8^L8]L:]J<]K=^L>\L<\L<[N=]P?^SA`SB_R?`P at bQAcRBdQBdNAdLBjMIhKMdPYf[lnk†w{ž€…­‰ˆ²ƒ©¥‡©¾ˆ Ð‚’ây~ðsqújbÿa^ùJWñ>Që:Lî?NïCQê@Kæ<Gå>Fá<Bß<?Ú<=Ö<:Ï>9Ê=4Á;0¸:,§6&¯A0­<,¬6(¿A5ÌF=Ì=5Ð72Ú85Ü71Þ5.Þ6-Þ8*Ý<*×:'Ó6%Ù;0ðSLòZOÙE9Ç8*Í>.ÔB3Ò:-Ô3+ðGBá//î5:ó6=î,7ÿBMñ'3ú&2ÿ)2ÿ(2ù'ý"*ÿ'/þ'/ð&ð)ù+7ê .ì&7ñ-Aç#;ÿXrç-Dÿ]lÿ_iþZcùU\õPWëHMÝ?@Í84Ë>7ÄA7·?1¦7&™2!™6#š;'Ÿ<)§8-®7/ÂE?¿;7½31Ä64Å54ÔDCÛLHÚKEÑD;È:0Ä4)Ç5(Ë4)Å5*¼</³9,­/#«(³-$Ã9/ÒC;ØH?äPFßE=Ú70Ý0*ç0,ò21ù13ý14÷/1ö01ö01ó0.ò0.í2-æ5-Ý9/Õ=0¾2%À>1¹=3Ö_Yésqÿû„†û‡Šÿ„Œÿxˆÿh}ÿ_wÿ[uÿUoøLføEcñ:Yô;[æ?YÛ]i‹@;VF-L^6YuBg†Mw–]}œcg€¡jƒ¦n‚¨o€§n¦m~¥l}¥i|¤h}£f£e£f¥l¦m«l¬k~­g®f±gƒ³i‡µm‹´r°vŽ®|™´‰§½™±Á¤²Á®¦²°˜žz…‹]K7]K7]K7]K7]K7]K7]K7]K7^L8^L8^L8^L8^L8^L8^L8^K:\K;^L>_M?^N>[N=[N=\Q?^RB_SC]QA]OB_OB`NDbPFcOHeNHiMJgNQeS_g_tnny~¨€‡»‡ŠÁž•Ê£‹»«£¹xÓyƒê|{ôvjöi`ø]aóOZìFRòHSøIVõEPï?Jë;Eä9?à:<Ú::Õ=8Î?7Ç>4À</·<,«<+ª?-©8(²:,ÁA6Å<4Ç61Ô<7Ò50Ö5-×5*Ø4(Ù8&Û:&Û;%Ú9'Ý6.æA;ëMDáI<Ð>/Ç8(Ê8)Ó;.Þ;4öJFä01ð6;ö6Añ.<ÿ@Nï'4ó$,÷%(û),ý+,ü*+ø((ö((÷+,ï$'í%(ê%,ý;DÙ'ð4CüARØ&6ÿjuÿbjþZaüW]ôOSåBC×<8Ñ>6¾8,¿D5¹H6©>,™/)(’(ž-%°:6ÑTPÎHGÃ54Æ45Ñ==ëWUØGBÖG?ÐA9Ç9/Æ3)Ê6,Ð7/Î70Ç=3Â91Â5.Ã2-É4.Ñ83Ø?9ÞE=äJ@ÞA8Ú6-Ý0*ç0,ò21û03û03ô02ó12ô01ó/0ó0.î1-ç4-ß9-×=1¿3$¾</·=2Ó^Wévsÿù…ˆø…Šÿ‚Šÿt…ÿf|ÿ\vÿXtÿQoþIhü@aó:Zñ?_áI`ÁS\{?7RF.M_9ZvCe‡Ks•Yxœ_wb{¡f}¥i}¦j|¥i|¥i|¤h{£e{¡d{¡d}¡c~¢e|£j}¦l}©l}ªi|«e}­c¯c‚±c…°h‡²kˆ¯pˆ«s‹«|¬„ª‡Œ¢‹x‡€dppR^^]L8]L8]L8]L8]L8]L8]L8]L8]L8]L8]L8]L8]L8]L8]L8]L8^K:_N>aP@`P@]P?\O>[O?[RC[QE[QG\OG\OI_PMcQOfTTgUUgUUgV\h]nli†sv£|ƒº‚ŠËŠÔ˜‘× ŠÊª‚´¹}ŸÏ€“䄆îvósjûeg÷S\íGQðFOöHR÷EQòAKî=Eä7=à7:Ù99Ô<7Í@7ÅA4¾?0¶>-­>-ª<+«:,¸B6ÇH?À;2»0)Ê:2Í6/Ð6.Õ7,Ø8,Ù7(Ù8&Ü9&à:*Ý4-Û4.âA9éOCÞH:È5%È2#Ù@2â>5õHDè13ò5;ù7@ø4@ÿESø2?ð)0ë#&ì$'ù13õ-/ï''ì&%õ12ë)*ö8:è+1â)1ë3=ÿR^ï=Kÿ[gþ^fñV\îOTðMRêEIÝ:;Õ74Ô?9À6,Á?2¼B5³=1¬7-¥3)¡,#œ' š%©/*ÇECÂ::¼,,È35×ABô^]Ð?:ÒC;ÐA9Ë=3Ì9/Ô=4Ú@8Û@;Û@<Ø=;Ý>;ãA?ä>>à::ã?=ëIDàB9Ý<4Ù5,Ý2+ç1-ð31õ12ø02ô02ô02ô01ó/0ó0.î1-ç4-ß9-Ø>2À4%º8+µ;0Ð[Tízwÿ“’û‡Šúƒ‰ý~‰ÿr‚ÿdyÿ[tÿTqÿNmÿFgû=_ô=\îEbßTg¢AHp;3SH2Qa<]xEf‡Nr“Zu˜^tš_xžc{£g{£gy¢fy¢fy¡cx byŸby a| bz cz¢f{¤h{§h{¨e{©a{©`}«`®`‡²jŠµn‹²s‰¬t†¦w‚žuy“no†lSeYAPM2A>^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^L8`N:aP<`Q>]P?ZN>YOCXPEXOH[QO_UTbXYeX_iYcl\fk^glaildqok‚rtšy~µ†Ê…ŒÚŒŽáŽ‡×Ÿ‹Ó­ŠÄ³€©½yŽÌ{Þzò‚wÿsrÿcgùU\ôMTõGPôCMò>Gï<Bå6;à88Û97Ô<7Í@6ÅA4¼A1·?.«:*­>-±=0¼F:ÌRGÇH?º5.º1)È91Í81Ó;0Ù=1Û;-Ù6'Ü6&à8+à5-Û2+à=4ìNBãK=Ò:,Ñ8*àB6ß7.ð>:é/0ð16÷4<ü8BÿNZÿLUý>Eò38â$&í/1ê,,ð22è**ë/.ò::Ñæ37Ý,2è9@ðEMÿXcóMWØ=CÚADáBFá>AÞ9=Ü89Ø88Ó97É83Â91½:2ÀA:ÍNHÖVSÐNNÃC@²72¶95ÏKIÙMLãQRïYZêRQñYVÉ51Î>6ÒB9Ð@7Ó?5ÙB9àC<â@;é?@ç8=ì9=ò?Cï:?è58ì>=öMJÞ93Û60Ú3+Þ3,å4.ì30ò21ô01ô02ö/2ö01õ/0õ/.ð0-é4-à8-Ù?3Â6'·5(³9.ËVOï|yÿ“’üˆ‹ý‰þz‡ýoücwÿXqÿOlÿFhÿ@cû9\ô?^éKdØZh…35g;0WO8WgCa{Kj‰Ps’Yt•\u˜^wby¡ez¢fw dv awŸavž`xŸ`xŸ`{Ÿaz cz¢fz£gz§fz§bz¨`z¨]|«]~­_†²g‹´nŒ³tŠ­s†¦u€qtŽii€dQcUDSL8G@^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M9]K5_M5`P9_P;\O>ZN at XOFXQKYPQ`W\g`hnfsshysg{sg}qh}ol}pq†rw—v}«z‚Á‡Ò„ŠàŠ‹å“ãŒÚ „¿žuŸ l‚¬nq¼vlÒviòsmÿllÿgiþ^`ûRWõFMï<Bê7=æ5;á78Ý98Ö=7ÎA7ÆB5½B0¸@/­7)´@3¯:0°;1ÈRHÕ\QÉMC»;0¾90Á7-Ì9/Ö>3Û=1Ú6*Ü4'â6*à3,â70ä=5åE9âF9ÞB3ÞA2â>2Û0&ê72ì0/ï.1ñ.4ú7?ÿPXÿ]dÿZ_ÿOSá.1ã03à,-÷EEè66Ü,,Û-.ë>@Ü25Ù37ÿbhà=BË*2Ê-4Á&*Õ;=á@EÛ6:Ù37ß9=Ü7;Í/0Ì43Í;;ÕGFÞRSì`cõilôekê^aÄ@>ÆE@å^[øhgÿopÿjjåKK×=;É40Ñ>7×D<ÖC;Õ>5Õ<4Ø:1Ü41î5;ñ-7ð,6ò.8ï,4ë,3ó9<þJKß3/Ü3.Ú3+Ü3,ã5.ê40ï4/ò21ô02ö/2÷/1ö.0õ/.ð0-ê3-â7-Ù?3Æ8*´2%²8-ÃNGï|yÿ’‘ÿˆŒÿ‰ÿw…úl|øatûTnýHgÿ>bÿ:_ú6\óAaàNeÂWap/+_?0[W>^lIe}Mk‰St’\u–_v™_xžcy¡cx buŸ`uŸ`u_vž_wž_xŸ`{Ÿaz¡bz¢d{¥e|¦d|§`y§^y¨Z{ª\}¬^€¬a…¯g‡®m‡ªp…¥sƒ r{•nrŠjexe[k^RbU_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N:^L4_N4`N8^O:[N>YOEZSMZTT_ZahbprmzuŒ{u‘{q“zp“vp’qt“rxšt}¨w¶zƒÄ~†Ï„‰Ú‹ŒÞ–Ü™ŠÍ›…¶¢ƒ£ª„‘«~yŸl[šQ>¼MBÔQIâWRëWUñSRñKMí>Cå4:é9<æ9;à;9Ø=8Ó@8ÊB6ÀA0º?/³9,ºA6«5+£.$¾I?Ùg\ÙdZËUI¸<2¸6)À3)Î:0Ù;0Ú6,Þ3)ä6-ß1*ä71ã;2Ý9/Þ>0ãF5äB3ß9+ß1(é4-ð31ï-.í*.ô17ÿEJÿV[ÿ]bÿ\aâ9<ã9<Õ+,ôJKâ89×//Û57Ì()Ì'+øXZÝ>BÕ9=Ñ6:º#Ä(+Ü<>æAEÝ49Ù,2Þ17Ù05Í(.Ò37äKNöaeûhnùcl÷`iú`løbkÖLLÕNJê\ZêVTçMMãHFÏ42Î3/ÙA<àKDäOHßJCÙ@8×:3×6.Ü.-õ2:û-:ø*7õ'4õ)4ø0:ÿ>CÿJJà1.Þ3,Ü3,Ý5,á4-ç4/í4/ð3/ô02÷/2ù.1ø-0ö..ñ/-ë2-â7-Ù=1É;-³1$±7,ºC=ìyvÿÿˆÿ|ˆÿqöhxö_rùRlûDcÿ9^ÿ6]ú6\ðFcÑN`¢IMe5+VD0[Y@^lIe|NkˆRt‘[w•_x™`{ždz cvž`s›]rœ\s›\tœ]v^wž_{Ÿaz¡by¡bz¤b|§b{¦_x¦[x§Yz©Y{ªZ~ª_ƒ­e…¬k‡©m‰§s‰¥u„s|”ru‰pnlfwe_P=_P=_P=_P=_P=_P=_P=_P=^O<^O<^O<^O<^O<^O<^O<_N:aP6aP6aO9^O<[OA[RK\VV_Zakgvso†}z—‚~¡|¥}w£{u¥xv§sy©s}°x¸{„¿~†Ä„‰ÉŽÎ”“Íš“Ç •½«›µ¼¦²É­©Å¦”ªˆmœfJœE2¯A4¶@4ÂB9ÖHDèNNîJKì?Cë=?é;=ä<;ß=:Ù@8Ð@5È>1Á=0½:0¾?6¯4,§1'»I?ÑcVÖh[ÕeWÃOBº>2º4)Ç7,Ö90Ù5,ß2+ç60â0,ã4/â7/Þ7.à>1åC4ä>0Þ4%æ4*é0+ð3/ð..ï-.ò14ó78öBEöMRüY^éFKöQWØ37ëFJÝ8<æAEÚ7:Î.0Ñ05äHKÒ7;Ð7:¹#%Õ;=Û8;å;>ë<Aç6<â-6Ý)2á1;ç<DðLSý]eÿksÿjsú`jöZgùXh÷[fôddèZVèWTØ@=Ï10Ô44Ó33áC@ãJEéRKêSLáJAÙ?7Ø93Û81ã33ó.7ÿ0>ÿ0=ú*7ü.:ÿ;EÿCHûABã1/ß4-Ý4-Ý5,â4-æ3,í4/ñ40ô02÷/2ù.1ø-0ö..ñ/-ë2-ã7-Ø:/Í>0µ1%±7,²;5ésqÿŠŠÿ‡ÿv†þi}óató[p÷PjúCbÿ7`ÿ7aù;_ìLf¿O[~86]=0NF1VX at ZeEcxMj…RrŽ[v”^yša{ždxžas›]p˜Yp™WqšXqšXt›\uœ]y_xŸ`x¡_y¢^z¥^y¤\x¤Yx¤Wy¥V{§X©_‚¬d„«h†¨l‡¥o†¢q€šmx‘jq…ij~cbv]_P=_P=_P=_P=_P=_P=_P=_P=^O<^O<^O<^O<^O<^O<^O<_N:cQ9cQ9aP<]P at ZPG\TR_Zaa_mtrŠyx˜€¨ƒ°~~°yy¯yu°wwµw|¾x€Á}…Ä‚ˆÄ…ŠÁ¿—–¾ ¼¬§»¶¬µ¾³±È¸«Ð¾¦ÖÁ¢Ñ»–Ьˆ¯oT®\G¤G5¨>0ÂG?àWQïWVñNOé@Cê=?æ<=â=;ß=:×=5Ñ:1É90Á80Á<5¹:3¸=5ÁOEÇXMÇ]OÑeXÓcUÂL>¼:-Å8.Ò91×4-ß2,ç60æ40á2-à5.ã<3çC7æC4â:-ß3%ê5,æ.&ð0-ï/,ð31ñ54ç-.â24çBF÷X]öW\ÿouåDJëHMà<Cþ[`ÿouÞ=Bÿ}‚ÿmqêQTÔ>@Æ02Ö:=òHKî9>ð7?ø=Fò7Bè-8ô>Jÿ]gÿmwÿjrÿcn÷]gú^kÿaoÿ]nùYeò\]ãPIâJGÕ74Ò/0Ù54Ò0.Ø95ßD?ãJDâIAÙ@8Ó6/Ö4/Ü71è66ê'/ü0<þ2=÷+6ù0:ÿ>Eý?Aì44â3.à5.Þ6-ß4,á3*è3,ï4/ô41ö01÷/2ù.1ø-0ø..ò/-ë2-ã7-×9.Ñ?2¶0%²6,°61èpoÿ‡ˆÿ†Žÿp‚ücxñ\pôXn÷OiûBbÿ9aÿ<döAbäRg°QWd/'WD3GG/RT<U^?btLiQq‹[v’_z˜b|dxœ_r™Zn—Un—Un—Uo˜Vr™Zt›\w›]wž]wž[x¡[y£[w£Xv¢Wv¢Uw£Ty¥Xz¤Z~¦_¦c¡d~œf{—frŒ]i‚X`vRZoPRgH\L<^N>`P@`P at _O?_O?_O?aQAbRB_O?]M=]M=aQAcSCbRB`Q>dS?aP>]P@^QI[QPZSZeapsq‰yxšz|¥~€±€¹}ºxz·rs´lo¶twÈv{Ì€ƒÊ‹Æ–—䤾²°»¼¹´ËƳÓÌ°ÙϬÛϧÜÏ£ÝУÙ˜٘Ѩˆ¸€g ^FËzgÖue½H?×QN÷ccéKLå?Aâ89ä::â:9Ü75Ù61Ö;6Ë81À5.ÇB;»<3¿I?ÆXK¹OAÎdVÑcTÌXIÅG9Ä:/Í6-Ø7/á6/ã4/ß0-ß2,à70ä=4à<0Ý7)ß5(å7,ä/$ê/&ì/)î1-î20ë40è51â64×79æJNõY]íNS×8=×6<ùX`ÿ~„ÿ~†ÿouÿgoÿipÿflõ\añX[ûZ_ÿUZÿDKü8Bû7Aö2>î+9ì0>ñ=HÿS_ÿ`iÿgrÿepþbmÿcnÿ`oý]gíSSßF@Ö85Ö41×11×/.Ø31Û94áD=ÜB:Ù?7Ö<4×90Û81à93æ66ð7<ó4;ó4;ö4<õ6;ò59ë33ã1/Þ3,Þ5.ß7.à5+ä3+é2,ï2,õ20÷12ø03ú/2ù.1ù//ó0.ì3.å7.à?5Ì8,¿6,¯/&¸;7ÒXWÿ˜šþ{ƒÿm€ÿe|ø\rðPhôGeüCeÿ;dù9`õNlÓRd‰=?P, C;&CG.KM5Y_CZjEcxMqˆZx’bx–`t•\r–Yq˜Yl•Sm–Rn—So˜Tr™Xt›Zuœ]uœ[t›XtWv Xw¡Wv¢Wv¢Uu¡Tt S{¥[{£]zž^u—[m‹Ub~MXrCSj>AW0?U/<R,[K;^N>`P@`P@`P at _O?`P at aQAbRB`P at _O?`P at bRBcSCbRB`P at fVG_QF\OG^TSaZad`omkƒvw–wy¢{}®}¸x|¹quµkp´lo¶nq¾uvÐ|~Õ‰‰Ó˜˜Î¨§Ç¸¶ÁÉźÓαÛתâÛ¥çÞ¥æÝ¢äÛ¤âØ£ÛÑ ÔǛӼš»œ€©}dÅ‹wÊ}m´VJÒa[örpìZ[çKLã?@ç=>ë>@ç;;â66Û64Ö=8É83Ê?8¹6.¸>3½K@¶H;È]MÝo`Ô`QÆH:½5)Ä0&Ô6-Ü5-Û0)â51å95ä=7à<3Ü8.Û5)ß4*ã5*ì7.í5+í2+ë0+ç0,ã2,á4.Ý52Ö87Ø>@äJLóW[ú^bü\dþ]eÿaiôS[ïNVñQYÿ_gÿjqÿflõZ`óNTí4:ñ,5ô*6÷-9ñ'5å!-æ'6í7CþPZÿZdÿblÿdmÿenÿcmý[hõQZåEEÞ<7Û64Þ63ß55Ü30Ú2/Û62à>9Û>7Ø;4×:3Û81ß82å95ç:6é9;ê7:ë7:î79î79ì65å31ß2,Ü3,Ý6-ß7,â6,å2+ê1,ò1,õ20÷12÷03ú/2ù.1÷//ó0.ì3.å7.ß<3Ô=2Â8.¶1*·74ØZ[ÿ“ûs}ÿfzÿ^vùWo÷OiùFfû?bü<cô@cåOh¹KVx;8L2#<:#<B(EG/OS8VdA`rJnƒXu_v“]t“Xq“Vp”Tk’Ok”Pl•Qm–Rp—Vr™Xsš[sšYt›XuWuŸWuŸWtžTržQqRpœQn˜Pl”NhŒLbFXu?Ni6F]/@W+ at W-@W-AX.YL<[N>^QA^QA^QA^QA_RB`SCaTD`SC_RB`SCaTDaTD`SC^PCbUM\QM[QRcYbkdtqm„vu•y{¤y{¬y~¶x|»nsµei°`g¯jn¸ruÆ}}ׇ„Ý—”Û©§Ø»¹ÏËÊÈÜØ¿åá´éäªíè¦ðé¥íå¤çá§âÛ§×Ï¡ËÃœ¸¯©››ƒk¨ƒp§o`œRGº]UÝmi÷uuï__äJLå@DëADì>@è8:â66ß=:Ô;6ÔA:Â70·7,·>3®=/¶F8Ûj\ßi[Ù[MÊB6Å2(Ñ4+Ù6-Ù2,Þ52éA>ìGCà=6Õ2)Õ1'Ú2'Þ0%æ4*è1)ç.)æ/)ã2,â7/á=4àB9Æ-(Ê43ÜDCðVXú^b÷ZaóS[ñQ[èFQêHSïOYü\fÿmvÿntôY_ã>Dé.5ô-4û2<ü2>õ+9í'4ö6EÿKW÷ISõPWøW_þ^fÿckÿ`i÷RYéBIÞ97Þ71ã75é<8ë;;æ95á51Ý60Ý:3Ù;2×90×90Ü71á83ç:6é<8ã99ã99å97ç98è88æ74á40Û2+Ú6-Û7-Þ8,â6,ç2)ë0)ó0,÷10õ12õ13ø02÷/1÷//ò0.î3.ç6.Ý90ÜD9Ç80»4.µ/.ä_bÿƒˆølwþbxþWsúPmþLlÿCfö:]ó;_ìIfÔSgDJl;4O>,=<':?(ED/FH0Q\<YkEg|Qr‰[tZqUmRkOiMi‘Ki’Lk”Pm–Tn—Up—Xq˜WuœYuWtœUrœTpšRm—Mk•Mj”LeGaˆE[AUt;Li3E`-AX*>U'B\/E_2Ic6WJ:ZM=\O?^QA]P@^QA_RBaTD`SC`SC`SCaTDaTD`SC_RB\PDZOMZQVbXcjcsqm†vu•xz£z|­w|´sy·mr´bi¯]d¬ag±lr¾x{ʉ‰ß•‘夡䶵áÇÄÙÕÑÎáÝÄçä¹ëæ¯îê­îè¬éâ«ãÛªÚÓ©Ë¡»¶™¥¥›™„“ˆv˜q™rc›bW³i`Ïrmû‹‰õutê[]æLNèCGí@Dì<?é;<ß:8Û<8ÞE?ÓC;Ã:0º:/°6)§1#¿I;ÛaRêk\ÛSEÉ:,Ì4'Ô6+×4-Ù42ñMKþZXíKFÙ80Ö3*Û4+Þ2(ß.&á,%á,%Þ-%Ü1)Ú6,Ù;0×?4Â/'Ä4,Î:6ÙCBßFHàEIäGNêMVñQ]öVbøXbù\eÿgpÿmuôYaÞ;@ê17ñ.4ò-6ð+4ë%2ì(4û=IÿS_í?IèAIêGLôQVÿY`ÿX]ôGMä68á53ä73ê;8ò@>ô@?ï=;æ95à72Ý82Ú91Ù80Ù80Ü71ã73è96é:7â:7à;9ã:7æ:8ç:6å84à5.Ú3+Ú6,Û7-Þ8,â6,ç2)ë0)ò/+ö0/ô22ô23÷12ö01ö0/ò0.î3.ç6.Ü8/àF<É91¾3.¶,,îfjÿy€øgtÿbyýTqþKkÿGjÿ>cò6Yë=^ãQhÄXeˆBBgC7[N;GF1AC-JH3EE-LU6Sc>btLlƒUp‹XnRkPiŽKgIhJh‘Kj“Mk”Pm–To–Wp—Vt›Xs›Uq™So—Pj“MgJeŽHdG`‡D]AWy=Rq8Mi6Lf6Ne7Of8Lf7Oi9Sm>UH8WJ:[N>\O?]P@]P at _RBaTD_RB`SCaTDaTD`SC_RB_RB^QIVMR_Xhnf{tp‰xt—xw¡xz«y{´sy·jr³`g­[c«_g°jr»v|Æ€„Γ•àžžä­®ç»½æËÉßÔÓØÝÛÎáßÆåá¾æâ¼äß¹à׶ÚеÎƱ¾µ¦­§›˜šŒŒŽ€‰…yŠ|q‘vk›si¨meºoi扄î~ósrñedñWYðMNîDEì@@ã:7à;7äB=ÞE?Ì<3Æ=3ÄB5¯1#®0"ÇI;ÜXKÖN@Ì=/Î8*Ð6*Ñ3*Ö42õUUÿkhú]XãD>Ü;3ß;2ã80â4-ã2,â1+Ý0)Ô0'Í/$Æ/$Â0#Å9,À4'Á3)Ë:5×CAÛEGÛBGÚ@HàDOëOZòVaòVaú^iÿgoóYaáBGê:<í57í38ï28ñ3=÷9CÿHSÿV_ä6?Ý4;ß6;ëADùJOüIMô;Aé13è51ë95ï<8ò<9ó;9ð:7é73â70ß;2Ü;1Û:0Ü90ß82ä73è64é75æ:8ä;8æ:8è:9è;7æ95á6/Ü3,Û7-Ü8.ß9-á7*å3)é1)ñ0)ô1-ó32ñ33ô22ô01ô1/ò0.î3.ç6.Þ7/àC:Ê70À1-À13÷jpÿqzúftû]túPmÿCfÿ=dÿ9cõ8^æEdÙZm«V[wE>dJ=aYFTO;KI4PI6GE.GP3L\8ZlFf|Nm…SmŠRlŒMhJfŽHgHg‘Ii’Lj“Ol•Sn•Vo–Ut™Vs˜Un•Rj’LfKcŒHaŠF_ˆFZBX|?St;Pn8Ok:Rl=Wn at ZqCUo?Vq>WqARE5UH8XK;ZM=[N>\O?^QA`SC`SCaTDaTDaTD`SC`SCbUEaVP^Vcje|yu}yšzy¡xy©vy°sw´jr³cj°[c«]e®hp¹v~ǁ‡ÑˆŒÓ™Ý£¥à¯³ã»¿åÆÇãÏÎÞÔÓØ×ÖÑÙ×ËÙÖÇ×ÑÅÒÉÀÌþŹ¹´¨¬£šŠ‹†x{tyvquleleogŽa[`[ÀsmØyuð{ü|yÿrpýccöSTðHGïC?ê>:á<6àA;Ñ:1ÓC:ÝTJÂ>2¸6)½9,Â=.È?/ÏB1×C5Ö@1Ñ7-Ð2/êLMú_]òWSßD?Ù:4Û81à70æ93ç92ç92â:1Ú9/Ñ9,Ê8+Ä8)°(¸3"È@2ÓI>ÒD@Ë;:Ì7;Ï:@Ñ7AâHRíV_ðYbõ^g÷`iêU[ÜAEå@>ì?;ñACúGJÿLTÿQYÿT]ÿV^á4:Ú/5Ü/3ç7:ô=Aø;?÷48ó12í42ï95ð86í42ë20ê20ç40á4.ã<4à=4ß<3Þ;2á83ä73è43è43è88ç98è88ë99ë97é75â5/Þ3,Û7-Ü8,Ý:+ß7*ã2(ç0(ï0(ò1,ñ42ð43ó32ó11ó1/ñ1.ì3.ç6.à91Ù<3Ì71Á0-Ñ@CÿnuýkuùbqðRiõHfÿ;aÿ4^ÿ6bû>däNiÊ\i‹GFjF:]L<]VCXQ>RJ7OG4ID.DJ.GU2Sc>^sHgMj‡OjŠKgŒGgŒFfŽGfHgJi’Nk”Rm”Um”Uq•Uo”Qj‘NgŽKcŒH`‰E_ˆF^†G\‚E[~DWxAVr?Uo at YpB]rG^uG[sCYtAXs at NB2QE5UI9WK;XL<ZN>\P@^RBaUEbVFbVFaUE_SCaUEfZJh]YngwupŽ|x™{y wx¦vw­pu¯jo¯ah¬^f®_g°em¶pxÀ}…͉Ø—Ø™ Ö¡¨Öª±Û´¹ßº¿ßÀÁÝÃÃÛÇÆØÆÃÔÅÁÐÁ»É¼³Ä»°Áµ¨¼¦˜¯–‹œˆ…Œqqqtpopfewhe†nj„_Y•d_›ZT¹f`Ùsnðzvÿ{wÿwsÿhfüZWþRNõHBæ=6çD=Ø;4ÛG=ê\RÅ;0Ä<0½7+¾6(Ç>.ÑD3ÔB3ÔA1×A3Ò86Ø>>ÝCCÜB@Ö=7Õ81Ø7/Þ7/å:3æ93å:3â;3Û>5ÕA5ÑE8ÌG6®-¼;%ÍJ8ÑL=Æ=5»0+À00Ê9>×AJáKTëU`ðZeð]eìYaßLRÔ>@Ï4/Ø7/à;9ê@@òCHõDJñBIî?Fâ5;ß26ã36ï8<õ79ø14û/2ü14ï20ð95ð74ì0.è,*ç0,æ3.à3,ä=5à=4à=4à<3ã:5æ95ê65ì65ì57ì57í57î68î66ë54ä2.Þ1+Þ7.Ý9-Ý:+ß7*á4&æ1&í1(ñ1,ð42î53ñ42ò21ó1/ñ1.ì3.ç6.â;3Ò4+Ò:5Æ20çUXÿpxùcnòZiçI`óEfÿ8bÿ/]ÿ5bÿBhÜLe±PYj5/^G7XK:UN;[P>VI8M at 0JC0@F,AO.K[6Xj at bxGfJhˆIf‹FeŠDc‹BcEeŽHgLh‘Oi‘Rk’Sn’RlPhNd‹JaŠH_ˆF_‡H_‡H_…H_‚H]~G]yF]wH`wKcxOczN]uC[vAZu at JC3MF6QH9TK<WK=YM?\O?^QAdWFeXGdXHbVF_UIaWMg^Ulcfwr‰yušxvžtsŸrr¤tu­lp¯bg©Za©_e¯fl¸ms¿v|ȁ‡Ó“Ý—œÞ›¡Õ §Ó©­Ú®³Ý±´Ý²´Û´´Ú¶´Ûµ±Ö³­Ñ®§É«¡ÄªžÂ¤˜¼™‹¯ˆ~™|x†dbgiefcYZj[X{c_yVP’c]ŠNF¢UM½`XÖkcñwrÿzÿzwÿnjþa\÷TOéGBîOIÝB=ÞG@êWOº,"¾1'¾4'Ç>.ÑE6Ë>-Á2"Ê7'ÛE7ÞE?Ó97Ì3.Í50Ô;5×=5Ý<4á=4ä;4ä92Þ5.×4+Ï5)Ê8+Å<,Â?-ÔS>ÈG2½<)¾:-Ã=2Ä;5Â74Â43ÜKNÞMRáPUåTYèY]åVXÜMOÓD@É5+Ñ7+Ø7/Ý52â24å26æ18æ.6ì4>ì3;ó5?û9Bý4>ú+5ÿ(3ÿ/9ø-3ù57ù59ð./ë*+é0.è51â5/ã<4à=4à=4á=4ä;6ç:6ë76î66ì46ë35ì25í34í55ê41ã1-Û0(Þ8,Ý:+Ý:+Þ8(à4&ã3$é3&ì4*î50î52ð42ð3/ò2/ï2,ì4,ç6.ä=4Í/&×>9Ì35ùbgÿoy÷[iðNcêC]ùEhÿ:eÿ0]ÿ6aöGhÉJ]“CFR,#VI8SL:OH6[O?UI9F?-HF1>B'@J(IU1Sd:_rEe}Ig„JeˆHcˆCa‰BbŠCcEeŽHfMhPiQlPkMfJcŠIaˆG`‡F`‡H`†I^G^F_}G`|Ia{Kd{Mf|Nf~N]xC]z@^{CDB6FD8JF;PG>RH>WI>]M>_O?`Q>aR?`SB_VGbYRgb_ojnso~wq“zt |y¨yw©pp¦gg£`a¢\_¤`b­fhµopÀyzÌ„‚֍‹ß–’眙栞ݡ¡×££Ù¤¤Ú¦£Ø¥¢×¥¡Ô¤ Ó¥žÑ£Í¢šÉ¢™ÈŸ–ٍ»Ž‚°ƒ|žrn}igld^`fZZkYUrWP}WNŒWO•RI¨ZPµXPÁZSØkdìyrù‚|ÿ‹†ùuqÿusí_]ßPLÙEAïZTÌ71Å2*Ä6*Ã7(À7'Ã7&Æ9(Ê;+Ð<.Õ?1Ò8.Ö<2×?4Ó;0Í5(Í3'Ø:/â@5à90á90Þ7.×7+Ï7)É:*Æ?,ÄA/Â=.Æ@4ËE:ÍG<ÌC;Å<4»2,¶+&Ç<7ÐEBÙOLàVSãYVáXRØOIÐC:Ì;*Ó:(Ü8,â5.è./ì*2ð(3ô'6ú->ú+?û*?ý)?ÿ(?ÿ&?ÿ$<ÿ$<ÿ$8ÿ'9ÿ+<þ,9ó+5í.5è45ç;9Ý84Ý:3Þ;4à;5ã:5æ95é73ë54ë35ì46ë54é54ç53â5/Ý5,Û5)Ü8,Û9*Ü9(Þ9&ß8&â7%ã6%æ4&ì5-í4/ð50ñ4.ñ5,í5+ê5*å7,à90Ø7/Õ:6Û?BÿmwÿbsûSjõIcÿKjö6[ÿ6_ÿ<gø>cçNj¯IV^$"D, ?:'HE4PM<PI9EB1>C/?G/BH&EK%KS.S]8[kDavKd~NdƒJb†F`ˆBa‰@c‹BeFhJlPm‘Ql‘LiŽHgŒGf‹HfŠJe‰Ic…HaƒGdƒJdIbGc~GdJdHe~Ga}C[{<\=_‚B=?4?A6FC<JE?PE?TG>[K>]M=`O;`Q<^SA^VIc[Xhcinlyso†tp•vpžtp¢pm¢gfŸaaŸ]^¡\\¤ed°kjºtrÅ}{φ‚ٍ‰à”Žæ˜“å›–Ùœ˜Õ™Öžš×ž˜Ö—Õœ–Ô›•Ñž–Ñœ”Íœ“Ê›’ÇšÄ“‰»ˆ®‚xtk|mdif]^f[YiZSoWM{UJŠVKšVK°\RºYRÁXRÓfaàqjãvoí~wý‡…ÿ‡…÷usîgdãUSëZUÇ2,Â/%Å7)Ã7&À7%Á8&Ä8'È;*Ï;-Ó=/Õ9,Õ9,Ó:,Ò:,Ñ9+Ñ9+Ô8+Ø8,ß;1à90Ü8.Ö8,Ï9*È9(Á:&¾9&¾6*Á80Æ=5É@8ÊA9È?7Å<4Â91¿4-Ç>6ÑH@ØOGÚQI×NFÌC;Ã7*Ê7%Ó8$Ý7)å4,í//ô+3ù)7ý(:ÿ+@ÿ*Aÿ)Aÿ&Aÿ#@ÿ!<ÿ=ÿ:ÿ:ÿ 9ÿ%;ÿ);÷-9ð19ê7:å;;Ü94Ü:5Þ;4à;5ã:5æ95é73ë52ë35ì46ë54è64ä71ß6/Ü5,Ù5)Û9*Û9*Ü9(Ü9&Þ9&ß8%á8%ã6%ç5+ê3+ë4,ë5*ë5*ê6(ä7)á7*ß;1Õ4,Ó54óTYÿesÿ[põGbÿIhÿAdÿ;`ý3[ù;aòMmÍLb‰8?S*$A5'69(;<,B at 1DA0@?-=B.>G,=CKP'\b<eoJhvRezQd~Od‚LaƒFa†Aa‰@cŒ@gDiŽHkMl‘Nl‘KjGhHf‹FgŠJf‰If…JdƒHfƒKdIdHd€FeGeGfEb~A]€>_„?b‡B69.:<1??7DA:KB;OE<VH=YL<^O<\O<\SB^WMc]]helom{sq‰so”qk™jf˜c`•\[”ZZ˜\] \_¦hjµno¿wxÊ€Ò†„ØŠˆÜ‹à‘ŽÝ“Ó“‘Г‘Г‘Ò”Ñ“ŽÑ“ŒÐ’‹Î•ŒÍ“‹Ç”‹Ä”‹À“‹¾Œ„³ƒz¥€r•|ewu^fi[[d[Vd[RfXKrVH„TH£ZQ½`YÉ\YÏYWÛcbákißokãvqûŠ„ÿŠ†ÿ…ÿ}y÷nhîaXÄ4+À2&Ä8)Á:'À9&À9%Â9&Æ;(Ì:+Ð:,Ö:-Ó5)Î5'Ð8*Ô>/Ô>/Î6(Ë/"Ú:.Ú8-Ù7,Ö8,Ð:+É:)Â9&¾7$½5)À6,Â8.Ä:0Ç=3Ê@6ËA7ÌB8Ç:1Ê@6ÏE;ÐF<ÒH>ÑG=Ê@6Å7+Ì6%Ö6&ß7,ç4/ñ03ö-5û+9ÿ*<ü';ü'=û%=ù#;û!:ú7ü7þ6ÿ8ÿ6ÿ$8ý*;÷2<ñ6=ë8;ä::Ü94Ü:5Þ;4à;5å95ç85é73ë52í36î47í55ê65å61á6/Ü5,Ø4(Ú8)Ù9)Ú9'Û8%Ý8%Þ7$à7$á6%á5'â4)ã5*ã6(ã6(á7(Þ6)Û7+Ý<2Ð1+Ø88ÿkrÿ]nþPiñ<[ÿHlÿ7]ÿ>eù5[î>bæVqª?Qa#(L/);7+07'37&9<)@=*A<(@>)BB&?FXa4s~T€Œdw‡`hSa}La€G`ƒC`…?a‰@cŒ@hŽEjJkMl‘Nn“Mk‘HhHgŒGh‹Kh‹KfˆLd†Je„KdƒJc€FdGf‚Hf‚GeFb€Bc†DeŠEhH25*58-;<4A>7G@:KB;RE<VJ<XL<YM=YQD^WOc^bigron€roŒrm•jg”`^WW‹TUŽWX˜\_¢ac­ln»rsÃ{|΂ƒÕˆ†ÙŠˆÛŒˆÜŠ×ŽÒÎŒÏŽ‹Ð‰ÑŽˆÐŽ†Ï…Ώ…ÊŽ…Ə…Á‡¼‡¶‰‚¬€xoŒ€_p|Y`lXYd[T^_Q_\IjWF}SEžUL¾\YÐY[ÙX\äcgçkkáplåxsì}vízsþƒ~ÿ†ÿ{õkaÉ<2Ä8)Â;(¿:'¿;&¾:%Á:&Å:'È9)Î8*Ø:.Ô6*Î5'Î8)Ñ>.Ñ>.Ë8(Ç/!Ò6)Ó5)Ò4(Ò6)Ñ9+Í<+È=*Ä;)Ä:-Ä:/Æ90Æ9/Ç:1È;1É<3Ë=3ÓD<ÓE;ÐA9Ë=3Ë<4ÏA7Ï@8Î;1Î5'Ù5)â5.ë31ò/5÷+6ù)7ü):ù&9÷&;÷&;ø'<û&<ý%:ÿ$:ÿ#:ÿ"7þ#7ú%7ù,;÷5>ò9?è8:à87Ü94Ü:5Þ;4à;5å95ç85é73ë54î47î47î66ê65æ72á6/Ü5,×5*Ø8*Ø8(Ø8(Ù8&Ú7&Ü7$Ý6$Ý6$Û5%Ü6(Ý7'Ü9(Ü9(Û:(Ù9)×:+×:1Ð3.ëHKÿoyÿVjøD_ø<_ÿAgÿ3\ÿ8bø>cèMlÅOe€0=J C1-11'.6'4=,=B.B at +B<$E>$HE$U\0p~MŸr—¨|ƒ˜mj„W_{J]~E_ƒCa†@bŠAfCkJl‘Lm’Om’Oo”Nl’IiŽIhHiŒLiŒLhŠNg‰Mf…LdƒJdGe‚HgƒHh„If‚Gd‚DgŠHiŽIl‘L-3'36+891<;6B=9G@:MD=QG=SI=SK>UNDZUQa^eigumklkŠjhb`XVˆPP†QQXYš`cªfj´orÁuxÉ|Ђ…Ö†‡Ù‡ˆØŠ‰Ù‹ŠÖ‹ŒÏ‹ŠÌŠ‰Í‰‡Ð‰…ш„ÑŠƒÑ‰‚ÐŒ„Ï‹„ȍ…Á†º†°‡¥~w–m…„Yj€SZnVTc\RZaOZ_HeZDxUB’LD¸TRÐSWÛRYå^dèejãklæuqäunâoh÷~vÿ‚{ÿ‡~ôl`É?2Á8(À;(¿='¿='À<'Â;'Å:'Ç8(Í7)Ø:/Ù8.Ò8,Ï9+Ì:+É:*È9)É7(Ï9+Ñ7+Ò8,Ñ7+Ï7*Ì8*Ë<,Ë>-Ê<0É=0Ê<2É;/È:0Æ8,Å7-Å5*Ð@7Ð@5Í=4É9.Ë80Î;1Í:2Ì5,Ð/%Ù0)ä20ì25ô/8ù-9û+;ü,<ü-?û.?ü/@ü/@þ/Aÿ/?ÿ-?ÿ.@ÿ)9ü)8÷+7õ0:ñ6=í8=ã77Ü43Ü94Ü:5Þ;6â:7å95ç85ê65ì44ñ48ñ48ï56í76æ72á6/Ú6,×5*Ø8*Ö9(Ö9(Ø9&Ø9&Ù8&Ú7&Ù8&Õ8%Õ:&Ö;'Õ=(Ô=(Ô=*Ô=,Ô<.Ñ7/Ú;8ÿ^eÿaqÿPi÷<[ÿAiÿ4_ÿ4`û1YôKlÛYq•>NZ%-C),:2/-0)08+7@/:B+<<"A<UH(`[5{…S£lª¾‹¨¾Ž¥wo‹[aK^F`„DcˆBeDj“Go”Np•Po“So“So”Nl’IiŽIgŒGiŒLiŒLi‹OhŠNf…Je„IdƒHe„Ig…Ih†Hg…Ge…DiŽIi‘Kl”N+1%.4*470893>:7B=:HA;KD<NH<NG=OJDWSR_^ffeugggf†ba‰[YŠQQ…NO‡RS“[^£ei³lo¾uwÊz|сփ…؆‡Ù†‡×ˆ‡Õ‰‰Ó‡ˆË†‡È†…Ë…ƒÎ…€Ð…€Ò‡Ò‡€Ð…ÒŒ…ˍ…ÁŒ…¸‹…«„{v|jz„VcPVnUQd^P[eMXbIb^EsXCOE´WRÐUZÚSZç\cèagågjèpoìyræqh÷|tósjþxmæ\QÄ;+¾5#Â;'Á=(Á=(Ã<(Ä;(È;)Ë9*Ï7*Ö5+Ø7-Ô:.Î:,Ç:)Ä8'Æ:)Ê=,Ï=.Ö@2ÙA4Ö>1Î8*È4&Ê8)Ë<,É:,È:,É;/É;-Ê:/È9+È5+Ç5(Ê6,Ï;/Ò>4Ó?3Ö?6Õ>3Î7.É,#Ò+%Ü-*ç02ð39ö1;ú0<ý0?ý0?ù0@÷1@÷1@ö0=÷/<÷-9ú,9ú*7ý/<ù/;õ0:ð3:í6;æ69ß55Ù42Ü94Ý:5ß:6â:7å95ç85ê65ì44ò59ò59ð67í76æ74ß6/Ú6-Ö6*Õ7+Ô8)Ô8)Ô9'Õ8'Õ8%×7'Ô9%Ð9$Î<%Ï=&Ï?'Î@(Î@*Ð?.Ò;0Ñ61ëHIÿfrÿOdÿHfû7[ÿAmý/]ÿ7aò4XãPj¼Ufm19E(*E697325406906=-3;#38CCja:…TŸ®w©Á‡µÎ—¯Ç“’®}v”be†Q`‚F`…BcˆBgFm–Jr˜Or—Rq•Up”To”Nl‘KhHf‹Fh‹KiŒLi‹Ni‹Og†Kf…Je„If…IhˆIi‰Hi‡Gf†CjJk“Mn–P(0#+1'/4-350764<85@=8C>8IE<HE<KHCRPQ[[eabtbb|``‚_^ˆZXŠTTŠTT\] gi³psÄvxÍ{Ø~‚Ûƒ„Þ„†Ý„…؃„Ö…„Ô†…у†Ë‚…ȃƒË‚Íƒ€Ñ…€Ôˆ€Õˆ€Ó…Ò‹„È‹ƒ¾‹ƒ²‰‚¤|“wp€veo~U[|PQnUNf_O]eMZdIaaGq]E‰TF­]TÈZ[ÔVZâ[aæ]déaeîllõzsírj÷xoÞYPå[PÒD8Ã5'Ç:)Å:'Ä<&Å='È=(Ê;*Í:*Ð8*Ô6*Ó0'Ô3)Ò8,Í;,Ç;*Â;(À;(Ã<)È;*ÕC4áK=ÞH:Ó=/Ê4&É5'Í;,È9)È9)È9+È9)Ê8+Ê8)Ë7+Ë7)Í6+Ò<.×?4Ø@3Ú@6ÛA5×:1Ò1)Ü0.å14î49õ6>ù4>ù1>ú0@ø/?ò.<ï/<í/9í07ï-5ï,2ò+2ñ*1õ2:õ3;ò5;ì59å57á55Þ65Ü75Ü86Ý97ß:6ã:7æ87é77ê67ì46ô5:ô5:ñ7:î87æ74à70Ú6-Ô6*Ó7*Ñ8*Ð8*Ð9(Ð9(Ð9&Ñ8(Ð9&Ë9"È:"È>$Ç?%È@(È@*Ì=-Ï;1×96üU\ÿ^qÿGcÿ?aÿ:aÿ7gþ3bû8`íFdÅNa‰@IS12A64@:<:46?56<7179+4="9CSZ.‚‚P¢§q±ÅŠ¯ËŽ°Ì’¦Ã’®}{™egˆQ_E^ƒ@c‰@iDo•Js™Ps˜Sq•Uo“Sn“NkJgŒGeŠEgŠJh‹Ki‹Ni‹NfˆKd†Id†IeˆHgŠJh‹Ii‰Hf‰Ej’Ll–No™Q&.!(0%-2+13.331764:95<;6GD=DD<GFBOOQZZd_ap^`y\\~`_‰\ZŒYX‘\\šgg­qsÀz|р܁„ႅ䅆ㄅჃہ‚Õƒ‚Òƒ‚΄‡Ìƒ†É„„̃‚Î…‚Ó‡‚ÖŠ‚׌ƒÔ…ÐŒƒÄ‹‚·Š‚«…›xˆsnuqbevWUtSLjVKf_MbfM_eIcbFp^FzQ?[M·ZSÅSR×VZâW\êY`òce÷rmñnf÷qhÑD;ÔA7Å1%È4&ÔC2Ç9%Ç:&É;'Í<)Ð:+Ó:,Ø8,Ù7,Ï,#Î0%Î6)Ë<,Ç@-Á>*¾;'¼7$À4#ÑB2ãOAäN@ØB4Ë7)Ë7)Ð>/Ê;+É:*Ç8(Æ7'È6'Ê6(Î8*Ð8+Ó;.Õ;/Õ9-Ò6*Õ7,Ú<1Ý<2Ü71è88ñ8=÷:Aû9Bú4Aõ/<ò,;ï,:í/;ê19ê38ë48í57ñ56ô36ó57ð37ï6;í9<é69â45Ý33ß76à;9Ý86Þ97á96ã:7æ87é77ê67ì46ô5:ô5:ñ7:ì89æ95ß82Ø7/Ó7+Ð8+Í:*Í9+Ì;*Í:*Í:(Í:*Ì;(Å9"Â:"Ã=$Â>%Ã?(Æ?+Ê<.Ï81ß<?ÿ\fÿQhÿIfÿ9]ÿ=hù.]ý<hé;\å\p¦LV^..G83BC><89?48E26C41=:)>E&FU*bs?›a­½±ËŒ«É‹¦Ã‹º„Ž¬z{™ef‡PZ|@^?a‡>hŽCo•Jr˜Or—Rp”Tn’Rn“NjIf‹Fd‰Df‰Ih‹Ki‹Ni‹NfˆKe‡Jd‡GeˆFgŠHh‹Gh‹GeŠDk“Lm—OpšR(0!'/"(-&).(.0-3317839:4==5?@8DE at JLKORYVXeZ\s]^}YX‚[Y‹^]–ee£nn¶wxȁ؄…⌌ðŠŠì†‡ä‚‚Ü€€Ö‚€Óƒ‚΀ƒÈ„ǃƒË„„ΆƒÐˆƒÓ‹„ÒŒ„ÏŠ€ÅŠ€¼‰€¯‡}Ÿ€xwozkegf]Xm[Qm[Mi\Lf^Kd_IeaHhaGo_FoP;…UA¥]O¿aYÑYXÝQTîS[ø\`ùheæYPÔD<Î70Ñ7/×:1Ö=/Ô;+Ï9(Í:&Ï9(Ñ:)Ô8)Ø8*Ü5,Ü5,Ð/%Í3)Ì8,Ê>/Å@/Á@-¾=*¼9'Â9)¾0"éWJßK?Ã/#Ñ=1Î</Ç8(Ê;+É:)È9(Ç8'È7&É6&Ë5&Ì4&Ð7)×;.Ü>2Ü<0Ù7,Ú8-â>4ìC<õBEò9?ð2<ö4?ö2@ñ-;í-:í2=ì7>æ5;ä68å78ë99ð:9ñ78ï77ò;=î<<ê::æ87á85ß74Ü75Ü75Þ97á98ã99æ::é9;ì9<í9<ï8<ô7;ó6:ð8:í9:ç;9à;5×90Ï7,Ê8+È9)Ç9+Æ:)Ç:)Ç:(È;*Ç<)Á9#Ä='¾:#¶4¼9%ÉD3Ï?6Ê1,ÿ^eÿVgÿIbÿ<\ø1X÷0Yû6cõBiçYo¬FQo33N3,B?6>C<@78 at -1L/3K2.A9&DJ(Zn=~š_ž¸w¨Å‚¬ÊŒŸ¾‚˜¶€”²~‚ nf„RXvBY{?]€>c‡AiDn”Im•Ll”Nk’Ol‘NiŽIfŠDc†Bc†Bf‰Ih‹KfŠLdˆJg‹MhŒNg‹Kf‹HeŠEf‹EjIk“Jq›QržSt U*0")/#).').(-/,130561782;<4>?7AD=HJGOPTSUaXYkZ\u\Z^]‰db”kj¤utº~·‡ß‹ŒéïŒŒð‰‰ë…„ ؀~Ҁς‚Ì…†É†‡È‡ˆË‰ˆÎ‹ˆÏŒ†Î†ÌŽ…ÈŠ€¼‰±†|¡‚x‘{s€tknlb`e]Re`Me^Kf^Kh]Ki\Ij^Hk_Gn^Ew_G[C’YF­ZLÇVPÞRSõQXÿX_ðUSãLEÙ>9Õ60Ù6/Ü90Û9,Ö9(Ó8&Ñ8&Ñ8(Ô8)×7)Ü6*ß4,Ý5,Î0'É5)È9+Æ=-ÄA/Á@-¿<*¾9(Ä8)Ë<.äREÜH<È4(Ì:-È:,Â4&Ê=,Ë<+Ê;*Ê;*Ë:)Ì9)Î8)Ï6(Ó7*Ö8,Ù7,×3)Õ1'Ø1(Þ7.ç<5øDGñ8>í/9ï/:ð0=î.;ë1<ë6?ä5:Ü36Ø22ß:8îEBøIFøDCó?>é:7ç98å97â96á85à85á98á98à87â88å99ç9:é9;ì9<í9<î7;ó6:ò59î68ê88ä;8Ü:5Ó9/Ë7+Æ8*Ã:*Â:*À;*À;*Á<)Á<+Á<)½9$Á?)»:%³5¹:'Á;/Ê:2Ø<=ÿ^gÿPdÿA[ù8Wö6[õ;`ô>dãIe«?Lƒ?>_:2G;/:>08>2F<:R>=N0.S8/VK5ciEx[°pÂ}¡Æš¹}š¹€š¶ƒ©xrŽ^YuETp=\{B_@b†@iCm“Hl”Kk“LiMiMgŒGe‰Cc†Bc†DgŠJiŒLhŒNg‹MiOiMiŽKgŒGgŒFfŽEl’Im•LpœQoRt U-1"-1#,/&,.)//-11/34/45-9;0<>1 at B7EHAKMLQRWUUaVWi\Yt^]fdŒpn zx·…ƒÎ‹ßêŽïŽŒíŠ‰ç‡„߁Ó|Ë}ȀƅLjˆÆŠŠÊŒŠÉŒŠÉŒˆÅŒ„¿‹‚·‰€­†|¡€v{p€ujpndbi_Vc]M_aL_aKc^Jg\Jl[In\Ho]Gq]EwaIxX?‡S=£VDÇXOãUSøOTþMSâ><Þ<7Ý84Þ71á6/á6.Ý7+Ú7(Ô7&Ó8$Ó8&Õ8'Ø6)Ý5*à3,Ý5,Ë3(Ä6(Â9)Á<+Â?-Â?-Á<+À8(Ã5'ÜJ=ÚF:ÕA5Î</Ä6(Ä;+¾6&Æ:)Ç:)Ç:)É:*Ê8)Ë7)Ì6(Í3'Õ9-Õ7,Ö3*×3*Ú3+ß6/å:3é<8ð<=í49ë07ì18î3<í4<ë7@ê=CÝ7;áAAìNKøYUýZUúQLïB>å84â62à72à72à72á85â96ä;8ä;8á77ä88æ8:è8;ë8<ë8<ë8<ì8;ï58î47ì57ç77â:7Ù:4Ï8/Ç7,Â8+¿:+½;+»<+»<+»<)»<+»<)¸9&½@*³9$±6$¶;+µ0'Ã40ìPTÿ[iÿJ`õ:Uð7Vñ@]ïHfçHdÍNa‚89e?6R at 2DA09=,57)>6+K9/E-#R=,g]Bˆ_’«t—»{–Áz–¿{”³xœ¸…š´…€šm\uKHb5Nh8[xB_}?cƒ@hŒDl’Gj’Ih’JgLfKd‰Dd‡Cc†DeˆFh‹KkŽNkOjŽNiOiOiMhJgHh’Hl”Ko™Ms¡Vs£Wv¤Y24&04&01)01+12-23.34.46+9;-;>-?A3DF9IJDMONRQWSS]XVd\Zoda~nl”zw¬„‚ÃŒ‰Ö‘ã”‘ꓐ뎋≅قÌ|Ã|¿€~½„‚Á†…Á‰ˆÂŠÃ‹ˆ¿‰…¸‡®…}¤…{€vŽyn~rgmmaak^Vi[Pc\J]`K]aJc^Jh[JmZKqZJtZIv[FsWAxR;ŠQ=ªYFÍ[PãTPðFIñ>AÛ2/Ü5/á51ã60ã5.á5+à6)Û8)Ö7$Ó8$Ñ8&Ô9'Ø6)Ü6*à3,Ú6-È6)½8'¼7&½:(¿>+Â?-Ã;+Ä8)Æ4'éUIÓ<1Ì8,ÑB4¾5%À=+À=+À8(Ä8'Å9(Ç:)È9)Ë7)Ì6(Í3'Ò6*Ô3)Õ2)Û4,ã:3é>7ì?9ì=:è45ì59ï6;î5;ê2:æ39ä7=â<@óUVübbÿmjÿidóVQäA<ß63Ý4/ß61Þ71Þ71ß82á85â96å97æ:8å78æ89è8;é9<ë8<ë8<ë8<ì7<î5:î68ê67å97ß<7Ö<4Ì9/Å9,¾9*º;*¶;)µ<)µ<+´=)³;*³<(³:'·@,­8&­8'³;-«+"Ã54ý`gÿTdúG\ð<Uë=XçG_áOdÒO_´SZvGAXH9KD2FE1BE0=?*:8#;3?3PG*nkHŠ“f•¬t‘´tŽ·s‘ºxž»…¡¸Š§}l‚[K_:AW0Lc7Wr?_{@dƒ@iŠCk‘Fi‘Hg‘GdHeŽJb‡Bc†Bd‡EgŠHjMlOm‘Qn’Rj‘Pj‘Nj’Lh’Jg‘Gi“Gm—KpœOv¥Wv¦Zx¨\78(68*66,56.56056067/68+;>-=@- at C.DG4IK>MNFQPNRRRVUSYX]a_lkius›€}²ˆ†ÇŒŠÓ•’ᔑ␍܋‡Ó„Ä}º|µ|³~·„º‡„¹‰…·Š„²†¨z›€xs‡znzrfjm_^j[Ti[PjZKfZJb_Lb_Le^Li\Kn[Lr[Kw\K{ZG~UA†R=›RA¶VFÎRHÚG@â88å33Ý1-ß3/â5/ã5.á3,ß3)Ý5(Ü9(Ó8$Ð9$Ï:&Ñ:'Ô8)Ù7*Ý5,Ø7-Ä;+¹:)µ6%·8'½;+Â=.Ç;.Ç7,Ð90õ\TÖ=5É5+ÏA5¸3$·:(¼?+¿:)Ã:*Æ:+È:,Ê;-Ì:-Ï8-Ñ7-Ð3*Ò1)Ö1+Þ71å<7ê>:è;7æ74é75ï;<ð<?ê69ä15ä5:èBFíMOÿxwÿqnñ`[ÝJCÑ83Ñ2.Ü73ç@:à93à91à72à72â62ã73å76å76æ68ç79ê7;ë8<ë8>ë8>è7=ê7;î7;î79ê7:ä::ß=:Ö=7Ë;2Ã;/º8*µ:*³;*¯<)¯<*¬<(¬;)¬;)ª;(¬=*¦8'§9*ª8-¬/)Ë@CÿhrôM^óH[íDYåH[ÙO^ÉT]·TWœXUdM?OL9LG4JE1FD-?B'=D#>H#KV.\g<xT‹™f‘¤m©n²r—¹}Ÿ¶ˆ’§€u†dRcC?P0BS1Oa9Vl=b{Be‚BiŠCjEi’Fe‘FbHcŽGb‡Bf†CgŠHiŒJkŽNmPn’Ro“Sj‘Nk’Oj“Mi“Ki“Ij–InšKržOv¥Wv§Xw¨Y?=.=>.==1==3==5;<4;=2;=/?B/@D-CG.FJ3KL:NOAQQIRRHYWJZZN_^\gerqn‰{y¡ƒ€·‡…ďŒÑŒÓŠÏŠ…ǃº~y¯zw¦yv¥{v¬|y®€|®ƒ}©ƒ}£x—|t‹zrvksrffm_\j\Sk[NlZLl[Kk[Ki]Mg^Mi]Mj]Mn]Ms^Mz]MZI“`O›VG§N@¸J=Å@7Ï6.Ø1+Þ1+á51á6/â5.â4-à2)Þ4'Ü6&Ú;(Ñ9$Í;$Ì;&Î;'Ñ:)Õ9*Ù7,Ó9-Á>,´;(°5#²5#»9)Ä<.É;/Ë7-Ù?7ø[TãIAÎ:0Ì@3¸6&¬3 µ<)¼9'¿7'À7'Ã7(Å7)É7*Î7,Ñ7-Ù<3Û:2Þ93å<7ê>:ê=9ç85ã41è96ë<9ì::è8:ì>@øPPÿbcÿppùheâTPÊ=6À1+É40Ö;7ß=:à;7â;5á:2â94á83ã73ä73å55æ66é69é69ê7;ë8<ë8>ê7=è7=é6:ï8<ì89è8:ã;:Ý>:Ó>7É<2À</¶8)²:)®;)ª;(©<(¨;'¥:&¥:(¥<) 9( ;) 9*¢6*µ>8ÛTXûepîK\ïI]éJ\ÛM[ÉQZ´VV ZRŠ`RPI7HM9NI5H at +;567>O%Lf6lŠTw”\„›e‰šd›f£k”­t˜°|ƒ•mn}\Q`C<J09F,AP1O_;Wj=czDe‚Bj‹Dk‘Fi’Fe‘FaFcŽGcˆCi‰FjKlMlOlOm‘Qn’Rm”Qm•Om–Pl–Lk—Jm™JrŸNs¢Q{¬]{¬]z«\DA0DB3DB6CC9CC;CC;BB6BC3DF0EH-GJ-JM2ON9RQ?TREUSD\ZC\\D\]Oaaaihxrq{z¦~µ†‚¿ˆƒÃˆ„Á„º{®ys¡to—om•plžrn¡vpžwršwr’to…skzrinmb`l_Wj\Qk[Lm\Lo\Mo\Kq[Mq[No\Nm]Nl_Om`Os`Oz_N†ZMŸ_S¤PE®B8º;2Æ6-Î1(Ö2)Ý5,â70á6/á4-à3,à4*Ý5(Ø7%Ô9%Ï:"Ê="É=$Ê>'Í<)Ò;*Õ9,Ï;-¿@-±<(¬5!®3!º8(Ä<.Ê:/Î5-Ø93ðNIñTMÙB9ÌB5¾?.¦1³<(¾<,Á9+Á7*Â6)Å7+É9.Ï;1Ô;3áD=ãA<ä?;ç>;é=;é;:è88ç85ç85æ95æ74é;:ôJJÿ\[ÿdcøc_Ì=9Á82½4.Ã81ÕA=ÞE@ß=;Ù42â;5â;3â94â94ä84å84ç77é77ê69ë7:ë6;ë8<ë8>è7=è7=é6:ë7:é69æ89à;9Û>9Ñ>6Æ<1¾<.³8)®;)ª;(¦;'¤;(£:'£:' 9&¡>+–7%œ=+š9)š2'ÃPKíkmî\fìP^éJ\ßHWÍKS¹RS¤[R’cQ€jUJM8DL7JB/H9$B7FH#Up=g“V~³o‚³qƒ¥h}’YƒYŽ–c‰—d|Œ_XfCGT89E-6B*:D,=J0JX7Wh>e|Fh‚Cl‹ElFi“Gc‘Fa‘GaGf‹FlŒImNn‘OlOkŽNkOm‘Qp—Tq™Sp™SpšPo›NqNt£Rw¦U|­^z­^y¬]IC3JD6IE9IE:IG;IG;HF9HG5IH3JJ2LL2NN4RP;TQ>XRDYTA]Y>[Z>\YH^[Tdahnk~xs“}x {§ƒ}«…­ƒ|¦}wunoi…kg‚ieˆjf‹mhˆmi‚mh|lfrkbgj`^g]Th\Nh[Kk\In]Kq_Kq_Kp]Lp]Np]Op]Ns]Ow]N~]N‡\L’XL¡UH¤F<«9/º7-Ê7/Ó6-Ú6-Þ6-ß6/ß4-ß4,ß4,ß7,Ý7)Ø6'Ñ6$Ï:$Ì<$Ê<&Ë='Î;)Ñ;*Ó:,Î<-¾A/¯<'¨3!¬3 ¶9'Á=.É;/Ì8.Ì2*àA;ø[TàI@ÐD7ÊF7«2¹>,ÊF7ÌB5Ê@3Ë?2Í?3ÔA7ÜE<ãF?â@;â=9ã:7â64ã54ä65å97å<9ä?9à=6Ü:5ß@:êMHêQLÓ@9¸)#¸-&¾5-É>7Ñ@;Ö>9Ú;8ã;;ç==â96â96â96ä86å95ç:6é99ê::ê88ê88ë8;ë8;é9<è8;ç7:ç7:é6:æ68â88Þ:8Ö=8Ì=5Â<1¹;-®9(ª;*¦;)¢;( ;'ž;&Ÿ:(›:'˜?-Œ5"™=.˜8*—/&Í\X÷y|ßX_æXdÚQ[ÊKR¹LO©VPž`UgU€nVPW8?J*<;C=UQ+lvDƒ¢f”Á~‡¼v†¸s|žan‚Mu~Q‚‡^u}V[b@;D)4<%5=(=D2<E29C+CP2Ue>g{HiƒFl‹Gm‘Gj“Gf’GbGc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«VO°RJ·QE¯H9¬C0¬=,±9)¾8,Ë80Õ62Ù40Ý6.Ü8.Ü8.Ü8.Û7-Ú8-Ù7,×7+×7+Õ7+Õ7+Õ7+Ô8+Ô8+Ô8+Î:,¾<.¶>.®9(¦1 §2 ²:)¹>.¾<.Æ:-Ç4*Ë4)Ò;0ÜE:áOBßQCÝOCÛF?Ø@;Ó<5Ò;4Ö=7Ú=8Ü86Ý33ç77ë78î79ë78ç77å97â=9ÛB:ÊA7¿?4¸:,±6'¯5&²8)¸=-¿@1ÅA4Í@6×@7ß=8ã:7é77ï56ñ7:é6:ç6<ç7:æ89æ87å95å95ã:5â92ã:3ã:5ä;6ä;8ä;8å99å99ä:;ã;;ß<=Ù?=ÐA;Ä?6·=2¬;-¥;+ =*œ=+—<)–;(’:&“8%Œ:%€9'€8)‰5*<5¿QP×eeÑ^a·MM¬NL¤TMYP˜\Q—^S—^S˜_VŒfQ`_/Sg*^r3zO™¯n¥¾|™²pˆ bj‚HauBTe;JX7FP7?H59?158-:</AB4=?4:=2=A3:C0 at M3Rd>^tEgƒHqMp”Ln’Hk”Hk“Lh‘Km‘Qn’Tm”Sm”Qk“Lk”Hl—Hm˜HpJpJp Ls¢Qu¦Tx©Xx©Xx¨^m—Xb‹QY‚H]TE]TE]TE]TE]TE]TE]TE]TE[RC\SD]TE^UF_VG`WHaXIaXGe]Je]Hd[Jd[Le[Qf[Uh]Yh][i]]j^^k__k__i^\f[YbWS_VQZVMWTKUQHRNCQMBSOCWQCXRB^WG^WEaYFc[Fg\Hi^Hk`JhbLbaMngUy_PˆXN¢[U±VQ²IE¸E@¹@7¸>1·;/¸8+¼8+Ã9,É;/Ñ:/Ù8.Û7-Û7-Û9.Ú8-Ù7,Ù7,×7+×7+Õ7+Õ7+Ô8+Ô8+Ô8+Ò9+Í;,À>0¶>.­:(£2 £3ª:&³>,¹>.Ä?0Ä8+Å2(È4*Ð<0ØF9ÜM?âNDÙ:6Ø43Ô20Ö42Û97á=<æ<<é;<í9<î5:ë27é26è58å99á<:Ù@:¾8-µ:+±6'®4%­5%°8(µ<+»=.ÈD5ÏC6ÖB8Ü=7â94è64í55ï79ê69é69é69ç77ç77æ95å95å:3ã:3ä;4ä;6ã<6ã;8â:9á99Þ88Ý9:Ü<<Ú@>ÓB=È?9¹:1­7+¥7(¡;,<+™<+”;)“:(9&7%Š9&z6#y6%ˆ9, F=¹SOÀWT¸PO«IF¢MHœSL™YP—^S—aW—aW˜_V‹ePsrFzV“¦n¤¹€«À‡ž³{|[[o<?R$AS+AP/?L2:C06<.69058/9;. at A3=?49<1=A39B/@M3Qc=`vGi…Js’Or–Np”Jm–Jm•Nk”Np”Tq•Uo–Sn–Pl”Kl•Il—Hn™IpLpLpŸNu¤Sx©Xyª[u¦Wq X_‰JVEOx>aXIaXIaXIaXIaXIaXIaXIaXI_VG`WH`WHaXIbYJcZKd[Ld[Je]Hf^Gf^Ig_Lg^Of\Pf\Rf\Sh]Wh]Wh]Wh^Ug]Te[QdZPc[N]YMZVJVRFRNBPL at PM>TN at UO?WQAYTA[VC]XDaZGd]Jf_LfaMdcQleUv\OŠ[Q©b\¸ZX¶FD¹<:Ã<8Æ;6Ä:0Â8-½8)¼:*¾?.Ç?/Ó9-Ù7,Ú8-Ù9-Ú8-Ø8,Ø8,Õ7+Õ7+Ô8+Ô8+Ô8+Ô8+Ô8+Ò9+Í;,Á?1¶>.¬9'¢3 3¢8"¬=)µ@.¼?-¿:+Ã7*Å5*Ë7+Î:.Î</Ó:2Þ65à24Û12Ý34à88å;<ê=?ì<>î7<ì38é06æ25å58á77Ú65Î61·5(¯7'®6&¬7&¬7&®9(²:)µ:*ÃA1ÊB4ÔA7Ü?8â;5æ95ë76î87í68ë78ë78ê86ê86è94ç:4æ;4â92á:2ß:4à;7Þ:8Ü:8Û97Ù99Ö<:Õ@<ÒC=ÊA;»;2¯6+¤6'ž7(œ;*˜;)”;)’;(:&8$Œ7#‡9%€=*v5#5'™E:ªPH¬MG©LG¦QLPJ˜UL”ZO”^R•aV•aV—aWgT‰…_™©x­½Ž¦¸ˆ¡ts†YN`8/A->3B%:F.=F3;A3:=2:=4<=599-?@2<>39<1<@29B/?L2Pb<awHj†Kt“Ps—Or–Lo˜Lo—Pm—Op—Ts˜Up˜Ro—Pm–Jm–Hn™Jp›KqžMrŸNt£Sy¨X{¬]w§[mSe’M[…FS|BNw=cZKcZKcZKcZKcZKcZKcZKcZKcZKcZKd[Ld[Le\Mf]Nf]Nf]Lf^Gg_Hh`IiaLiaNi`Oh_Pg^Oj`Ti`Qi`Qh_Nh_Nh`Mh`MhaNd^N`ZL[UGVPBPM>NK:NK:NK:PM<RO>TQ at VS@XWC[ZF]\H^]Kb`Qf^QmWJ†[R¬ic¾c`ÁMMÈBCÐ;=Ô89Ó84Ì70Á9+º=)µC+¼B+Î;+×7)Ø8*×:+Ù9+Ö9*Ö9*Ô8)Ô8)Ô8)Ô8)Ò9)Ò9)Ò9)Ò9)Í;,Á?1¶>0«:(¡6"š4›7 £=&¯B-³;*º;,Â:,Ç9-Ë8.Î:0Ð<0Ù:4é9<ì4<æ39ã28â38á48â38â25é6<é49ç4:ç7:ã9<Û76Ð21À0(´6(­:(­:(«:(«:(«:(¬9&¯7&¸:+Á;/Î>3Ø?7à=8ä;8è96ì87î66î66î66í74ê84è:3ç:3ä<3á:2ß;2ß<5Ü=7Û=:Ù><×=;Ô>=Ï@<ËB<ÅB:¹=5­7-£5(ž7(š:*–;)“<)‘;*:(Š9&‰8%ˆ7$ƒ8%ƒ@-u4"{3%“G:¤QI¡NFžNG¡WN˜UL’XLZN\N]R”`U—aWhW‰f˜¥z©€Žj]kHDS42@&$2-:&0;*5=.9?3<?4=?4:;3::099->?1;=28;0;?18A.>K1Pb<bxIk‡Lu”Qt˜Ps—MqšNq™Ro™QršSršSršQp™Mm—Km˜Ip›LsžOt Qv¢Sx§Y{©^z¨_qŸVd’JY†C]†JW~GRyBe\Me\Me\Me\Me\Me\Me\Me\Me\Mf]Nf]Nf]Ng^Og^Oh_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ñ:)Ñ:)Ñ:)Ñ:)Ñ:)Ñ:)Í;,Á=0µ=/¬=,£<)˜8 4•9 ¡A)­C-¶A/¿=/À6+Â/%Ç0'Ð6.Þ:8è59î6>ì;Aê@CæAEàBCÜ@AÙ??Í12Ð66Ó:<Ñ=;É;9¾71µ4.­4)ª<-¥>+¥>+¥@,¥>+¤>(¦;'©:'ª7%²7'¼8+Å8.Ì70Ô94Ü=9æ>;é:7ì95ì95ë:4é;4è;4å=4â>4àB7ÝC9ÚC<ÕB;ÏA=Ê?<Ç=;¿>9±<3©:/¢8+œ6(˜7'”8)‘:):(‹=)‰<*‡<)ƒ:'‚9(€7&6%}6$x3#x5%…B2˜UEWK”PCPD•ZL“YMZN\Q\Q’[T•\U˜[VŽbUkbEV`=JS4=G,6?*2=,4>35?66=68?8=B;CF=EG<CD6@>/;9*78*=>0:<17:/:>06?,=J0N`:awHk‡Lu”Qu™Qt˜Nr›OršSpšPq›OrNqœMp›LošKrNu¡Ty¥X«`~©az¥]qœUf‘L_‰G]‡E^ˆIb‰PY€ISzCh_Ph_Ph_Ph_Ph_Ph_Ph_Ph_Pg^Oh_Ph_Ph_Ph_Ph_Pi`Qi`QmdUlcTjaRi`Qh_Pg^Og^Mh`MiaNiaLiaLiaLh`Ih`IhaGh`IgaKf_Le^Kb[H\WDUR?PM<ML:EF4DG4DH7DH7BI9BK:BK:CJ:IK>SQDSPAXL<eK:tE5•H>ÂYSÙROàDEà::Ü75Õ;3Ê>/º=)µ8"É:)Ï8'Ð9(Ò;*Ò;*Ò;*Ò;*Ò;*Ñ:)Ñ:)Ñ:)Ñ:)Ñ:)Ñ:)Ñ:)Í;,Á;0¶:.­<,§>+™9#3“7Ÿ?'£9#°;)À>0Æ<1Ì8.Ð7/Ù<5ã?=ì=Bî?DéCEâDCØ@?Ê;7À50»1.¹/,¼51¾:6»<6³:2ª8.¤8,¡:+¡=-Ÿ>+ ?,¡@-¡@-¡A+£>*¦=*©;*­:(²7(¹5)¿5+É90Ô?9àC>ä=7è;5è;5ç<4å<5ä=4á>5Þ@5ÜD9ØD:ÒC;ÊA9Ä?:¼;6¸85°93¢7-™8(•5'“6'‘:)<*‹:)…8&ˆ=*…<+ƒ<*€<)~:'|8%{6&{6&y1#€8*ŒG8–SC’PB‹L=RE™_S‘WL’YN”[R–]T–]V—\V–YTŒ^QaX;EM(6@8A&>G2<E43=2-7.1817>6BE<GJ?HI;BC1?>*;:&78(=>09;069.:>06?,<I/N`:awHj†Ku”Qt˜Pt˜Nr›OršSpšPqœMqœLqœLp›Kp›LsžOw£V{§\‚­e€«dx£\j•P]‡EYƒA^ˆHePcŠQZJSzCi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`Qi_Sj`Wj`Wj`Wj`Wj`Vj`Vj`TjaRjaRjaPjaPjbOjbOjbOjbMjbMg_Jg_Jf^Ie_Ib]IZXCSP=ML:HI7EH7AE6 at D5?E7?G8?G8>F7GK=IK=AE4KJ6\Q;aE/ƒJ9Àj]Üg`ãUSäFEåA@àA=Õ>5É=0Æ=-Æ4%Ë5&Ì6'Í7(Í7(Î8)Ñ;,Ó=.Ò<-Ò<-Ò<-Ò<-Ñ;,Ñ;,Ñ;,Î<-»2(¶7.±;/¨:)š7"”5•7œ9"®A-³;+º6)Á4*Í6/×<7âC?êHEèDEèEHÝCCÉ:6»61´80®8.©4+«9/©9.¤8. 8-›9,–:+“<+’<+–=+˜=*™>+š?,›@-A, A-£@-¢;*¥:(«7(°6)¶6+¾8-Ä;3Ì<4Ú=6à=6â?8âA7âA9ÞB6Ú@6×@5ØH=ÒE;ÇA8»;2²5/ª3-¦1*Ÿ2+™9-’;*‘9+:*‹:)ˆ;)‡;+…<+€9'}8(|9(|9(|9({8'y6&x3$w- ‹A4—OC“MAŽL@‘QE“UJŽRG˜\R˜\R‘UMTL—ZU•XS”WT“gZ]T5IQ*AK(BK,>H/7 at +2=-4?14<1HPCZ^PW[JMO:DF.AA'==%:;)>?1;=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MGäIEäGBâC?àA=ÛB=ÕFBÉD?º?7«=0Ÿ>.šC0•G3”I6F4ŒE3ˆC3…B1€A0}@.zA.|?-‚:,†8,…9+†:,†:,‡;-‡;+ˆ;+‰:+‹:)Ž8)8*•9,™;/=/¢<0ª:/­8.¯9/°:.°:.°:,¯9+®8*¨7)¥7(ž6)›6*•7+’8-‘9/Ž<0ˆ<.…<-ƒ;,9*:*~9*}:*};+|:,z;,y;,w9*s8*q6(r7)u5)ŒD8’H=‘K?ŠH:‡I<‹OD“TK—TL–QL›TP˜QO”SO–\X_Xh^—~j””p…’fu‚WYh?CR+?O*P`<crQetU\iKNX=CL1?E+>B)=A(;='78(:;-79.9<1=A37 at -<I/Oa;bxIlˆMv•Ru™Qt˜Nr›OršSo›Pq OožMožMs¢Rz¨]|ªaz¥^u [cŒJ^‡E[ƒD_‡HgŽOj‘PfL`‡Hb‡QY~KRwDi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`QjaRjaRjaRjaRjaRjaRjaRj`Tk`Zk`\k`ZkaXkaWkaUkbSkbSkbSkbSkbSkaUkaWkaWkaXkaWocUnbRkbQkbQkbQhaOd]M`ZJXRBRO>NK<IG8GE6DE5BC3>B1=I1?G/LG1S>+g=-•ZL­_Sœ>4ž3+¶?9ØXUóigödeëRUæJNèNPÙIAÓF<Í@6Ë>4Î@6ÒD:ÕG=×G>ÚJAÚJAÝJBÝJBÞKCÞKCàKDàKEëSRèTTãSRÜROØSLØSLÛULàUNàLHáIFãEBâC@äB@âC@äEBàFDÙJFÊE@¹>7¬=2¡?2˜B1’E3G4ŒE3ˆC3‡B3ƒ@0?1~?0z?/|>/€:.ƒ9.ƒ9.ƒ9.ƒ;-ƒ;-ƒ;-ƒ;-9*‚9*…9+‡:*‰:+;-<.“;/›;/ž9-Ÿ9- :,¡9,¢8+¢8*¢8*Ÿ8)œ8)˜8(”8)9*Œ:,‰:-‡;-„:-‚:,9+€8*}8)}7+|8+{9+z8,y9-x:-v8+q5*o5)q7+t9+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?áC@ßECÖBBÅ98¶50°;4¦?6š>3=/?2ˆ</‡:0‡:0‡81‡83‡83ˆ94ˆ;5‚92€:2€:2;2~<0~<0|<0|<0x8,y9-z:.z:.{<-{<-z;,z;,};/9/€7.7,„6*…5*†7*†7(Š8*ˆ9*ˆ;+…<-„<-€=,~<,};+}9,}7-|6,y5*z4*x4)x4)x5,r2(u5+v8-r6+n4)n5*t;0xB6ŠUG„PB€O@„SDˆWIŒVJŒRGNG•TN”UN‹RK„XMdSeZDGK2=J,IX9ZkIgxTcxQYnESh=Nc8J_4:L&0?,95>)=C5<B8:<79<5;=2;=079.9<1?C58?-8B)EU1Uh;azCnŠMr“Nr–NršQsSqRr Uu£Xv¤[t¢ZošUfN^ˆH[ƒDdŒNa‰K`‡HcŠIfJgŽKeŠEa…E`ƒMWyGPr at i`Qi`Qi`QjaRjaRkbSkbSkbSjaRjaRjaRjaRjaRjaRjaRjaRkbSkbSkbSkbSkbQkbQkbQkbQlcRlcRlcRlcRlcTlcTlcTnbTk]Pp`QtdWrdWnbVj`Th`ShbTgaSgaQc]M[VCVQ=SN8NH2GA)KG,I?$bI3‘gW¶xm»le¸YW¹OO¶BE½BEÂDGÈFHÍHKÐJKÒLMÓKMÏEEÐDEÓEDÖFEÕFBÒC=ÎC<ÏF<ÈD8ÉE9ÊE<ÌE?ÒD@×CCÚADÛ?CáBFâBDáCDàDEàDEáFDãEDäDDãCCäB@ä@?ã?>ã?>â@=â@=ÞC?ÓB?Å>:¶93ª70Ÿ:0—=2Ž>3†>2ƒ?2?3=2;3„93†93ˆ81ˆ92…;0„<.„<.ƒ;-;/€:.€:.€:.~:-~:-~:-~:-};/};/};/};/}90}90~80~8.€7.€7.€7.~8,€8,~8,}9,|8-{9-z8,x8,x8,x8.x8.w7-v8-v6,t6+s5*q5+m1'r6,n4)m3(o6+m4)q8-I=…SH…SJ†RGˆRH‹PHQJ”QK•RL“TMTK‰[N‚cQo_HYU:MV7O_;j~YbxQYoHUjCRg at Mb;IY5CR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4>D69A208+/7*6<247058157247025.06,08-19,6A3:E5=J9>K9<I77F32A,1>-,6..400511606718:/:<.:?+<E*IW4YoAg‚Mp’Vv\užXp™U`†IX{CSv>WzB[~FY|DY|D\G_‚J_‚J^I^I^I]€H]€H]LStIHhA?]7icSicSicSicSicSicSicSicSicSicSicSicSicSicSicSjcSkbSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUmdUmdUmdUmdUldWibZgd]vsn“’Ž¯¯­ÄÆÅÚÜÛêîïóôöö÷ùüüþÿÿÿÿÿýÿûúü÷ôýòì÷áÔòØÇàʵƶŸª ‡ˆ„ibbFEH-DH/CG0FE1GD5F<3C60F42H:9>=9>?:B:7I75cGF’jjÅ“’è­©Ò‹‡ÇtnÀ]XÆSPÕONßJLçFKéFKßEGßIKÚDFÔ;>Ø>@áGIàDGÖ:=Ú@@Ú@@ÙA@ÖB>ÔC>ÑB<ÐA;ÑA9ÞC>ÛA9Ó@9ÊA9¾B8°@5Ÿ:.8*Œ=0‡>/ƒ>.>-€=,<+=*<,:+9-9-~8,~8.|8-|8-|8-|90|90|90|90z:1z:1z:1z:1y=5w<4w;3u:2t91q8/p7.p7.o6-m7-m7-l8-m7-l8-m7-m7-i2+m6/p92o81k4-g2*g2*h3+e0(i7.d2)]-#`0&_/%b2(s>6ŒOJPKˆQJRJ}YMv_QfYITN>DE5>E5:C25 at 04</3;04:04:068378366446135016//6..6+.9+2=-6C2:G6:I68G44C.1?.*4+,2.-2..3-45/79.:</:?+6>&DR1WlCh‚Rs”]wž_r›Wk”R[~DXyDTu at Tu@WxCZ{F[|GZ{F^JbƒNbƒN^J\}H_€K`L^~MTsJFd@<W4icSicSicSicSicSicSicSicSicSicSicSicSicSicSicSicSkbSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUmdUmdUmdUmdUldYgd]onj†…ƒ¤¤¢ÁÃÂÖÚÛêîï÷ûü÷ûþøüÿüýÿþþþÿÿýÿþúÿüùÿúóÿðàûëÔíßÅ×ͲÀ»¤£„‚ƒcgjKLQ3GJ/EC.GB/H>2I:3L95K<9?:7BA?MHE]RPyjg£Ž‹Î²®èÅ¿ÿ×Ñ쳪͂|Àc^ÊVVØRSßHMÚADÖDEÕEEØHHÜJKÛEFÕ<>Ö<>ÛACÙ??Ù??ÙA@×A@ÖB>ÓB=ÒA<Ó@9ÜA<Û@;Ó@9ËB:¿C;±A6 ;1’8-Œ=0‡>/ƒ>.>-€=,<+<,<,:+9-9-~8,}9.|8-|8-|8-|90|90|90|90z:1{;2{;2z;2w<4u<3u:2s:1r90n8.o6-m7-m7-l8-l8-l8-l8-j8-l8-l8-k6.n70o81n91l7/i4,g2*e3*c1(d4*_/%^.$b2(^.$`0&p>5JE‡RL‡XR~XOrVKdRDQJ:>?/:A16A05 at 03>04<14<15;17:379477577557246116//6./7,.9+1<.4A08E49H58G44E24B1.8/.5..3--2+23+46+8:-9=,7?(DQ3WlEh‚Ut•`wbp˜YgPY|DWxCTu at Tu@VwBYzEYzEYzE[|G_€K_€K\}H[|G^J^J^{MSnKF_A9R4icSicSicSicSicSicSicSicSicSicSicSicSicSicSicSicSkbSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUmdUmdUneVneVlfZed_y{x—™˜²¶·ÍÑÒäéìôùüúÿÿûÿÿüÿÿýþÿþþþÿþüÿÿûÿÿúÿÿôþüçúùÝïðÑáåÄÒØ´¼ÄŸ ¨ƒ‡‘l`gEQX7DG,DC.JD4LD7KA8I>:C;9SJKia_wvœ’¾³¯ÙÎÈêÜÓþèÝÿóéÿäÛð©£ÃecµBEÇDIÚRVÛUTÑMKÊDAÍCAÔFE×EFØDDÙCDÖ=?×>@Ø@?Ö@?ÖB@ÓB?ÓB=ÔA:Ù@:Ù@:ÒB:ËE<ÀD<²B7¡<2“9.Ž<0‰=0ƒ>/>.=-~<,€=-€=-9-9-~:/}9.}9.|8-{8/{8/}:1}:1{;2{;2{;2{;2z;4x<4t;2q;1r90o9/n8.l8-l6,k7,l8-j8-j8-j8-j8-i9-j8-j8-n91m80m80m80m80i7.f4+c1(d2)a1']-#_0&c4*\-#_0&sD<}PJVP~YQpTI^J?OC7?<-46(2;*0;+1<.2=/4<14<15;17:379479668357257227007/08-.9+0;-2?.6C27E48G48G49F54>33:2/4-,2(/0(13(57*6:)6>'DQ5YmJk„Zw—fwœfl“Z_‡KWxCWuCTr at Tr@VtBXvDYwEYwEZxF]{I_}K]{I]{I_}K^|JZwKPgJAW at 3I2icSicSicSicSicSicSicSicSicSicSicSicSicSicSicSicSjcSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUneVneVneVneVmg[jkfƒ‡ˆ£§¨¹¾ÁÐÕØåíïóûýõýÿûÿÿûÿÿüÿÿüþûýþùþýøÿþ÷ÿÿóøýæôýÞî÷ØæòÎÝéÃÎÚ´¶Á™¡«†€‡efmLMQ6FH0HJ5KI:HD9D at 7OGDj`_‹€¤š™·¯¬ËÆÂÞÛÔêæÝúñèÿûñÿ÷íÿÝÕû¶±åŽÊcd°@?ÃPKÉTMÉPHÃF@ÈGBÔMJÖKHÐ@?Ò>>Ó??Õ?>ÕA?ÕA?ÓB?ÓB=ÓB=Ö>9Õ@:ÒC=ÌE?ÀE>²A9¢=5•;2Ž<1‰=0ƒ>/>.=/~<,€=-€=-9-9-~:/}9.}9.|8-{8/{8/~;2~;2|<3{;2{;2{;2z;4x<4r90o9/o9/m9.l8-k7,j6+h6+i7,i7,i7,h8,h8,h8,h8,h8,m;2l7/j5-i7.j8/j8/f4+a1'e5+a2(].$a2(b3)Y* a2(yNE\VvWRiNGWC:I<3@:.:;-8<.08)/:*3;.4</5=25;169069079468368349238139/19.19..9+/:,0=,2?.5B17E4;H6<I89C87?428.-3'.0%/1$24&48'4<'ER8]pPr‹d{šnwœifXU|ESsATr at Sq?Sq?Tr at UsAVtBVtBWuC[yG]{I\zH^|J_}K\zHWrIJ^E<M;.?-gdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSicSjcSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUneVneVofWofWng]qqo‡Œ¤©¬·¿ÂÍÕØãíïòüþôþÿøÿÿúÿÿûÿüýÿúüýõúüñùùíöøêöÿèóÿäðýáîùÙéôÒÞèÅÊÒ­¶¾™£}‚bY]BGL5FK7FJ9CG9AC8c^X…}z«¡ŸÁ·µÌÂÁ×ÏÍæáÝñîéú÷ðüõëÿñæÿòéÿôìÿåß騤·hc¦LAµPDÁYNÇ[QÆQH¿D=ÂA<ËDAË@=Î@>Ð@?ÑA@ÒC?ÑC?ÑC?ÒC=Ó?;ÒA<ÐE@ÉE@½C>¯@9 >5•=3Ž<1‰<2ƒ=1=0=1~<.=/=/~:/~:/~:/}9.|90{8/{8/{8/|<3|<3|<3{;2z;4y:3y:3w;3n70m80l7/l7/k6.h6-h6-h6-i7.h8.h8.g8.g8.g8.g8.h8.k92h6/f4-g5.i70h70e4-b1*c2+b3+_0(]1(]1(V*!b6-{ULtYRaNHN?8A7.=6,;9-9;.9<139-3;.5;/6<06<07:/58-47.69049238139/39/2:/19.19,.9+.9+/:,0;-3>.6C2:E5<G7=E8:B55;/06(02%/1$13%15$2:%GS;buWwk|›rq•g\‚QJp=Oo>Qn>Qn>Qn>Qn>Qn>Sp at Sp@WtD[xH]zJ]zJ_|L_|LZwGRlECU?6D7(6)gdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSicSjcSkbSkbSlcTlcTmdUmdUmdUmdUmdUneVneVofWpgXpgXng]lnmz‚…“š «µ·ÄÎÐÜæèí÷ùôþÿõþýöÿüúÿúûÿùûþóøúíõöèñôãôýêôýèôüåóùßòöÛéìÍØ×¹ÅÄ¥±°’ŽregOMP;GK:FM=GOBKQG{{sŸš”ž¸ØÎÌßÓÓçÛÛóëéü÷ôðïêüüôÿÿöÿýóÿùïÿóêÿçÞÿ×ËØ“ƒ¸eS£J:´TF½WIµF;·@8ÈKEÇC>ÊC?ÌB?ÎC@ÎC>ÎC>ÍD>ÍB=ÑB<ÒC?ÎDAÅD?¸A=ª=8ž;5•<4Ž;3‰<2ƒ=3=2=1~<0=1=/~:/~:/~:/}9.|90{8/{8/{8/|<3{;2{;2z:1y:3x92w81u91n70l7/l7/j8/i7.i7.h6-g7-g7-g7-f7-f7-f7-f7-f7-f7-h70h6/g5.g5.g6/h70g6/f5.a2*e6.^2)\0'`4+a5,i=4uSJXG at E>6<5/95,;8/8:/57,36+69.5;/7:/69.69.58-57,36+28,19,28.19,19.19,19,19,.9+.9+.9+/:,0;+3>.6A17B2<D5:C28?/5;-46)24'13%04%07%HT>ex\umt’lf‰_RwKBh9Kk<Nk;Pm=Pm=Nk;Nk;Ol<Qn>VsCZwG]zJ^{K_|L_|LVsCNg@<J9/:2$.&gdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSicSjcSkbSkbSlcTlcTmdUmdUmdUmdUmdUneVneVofWpgXqhYoh^hikmtz…Œ”£¬±¿ÈÍÓÞâåðòðüüòüûõþùøÿ÷úÿöüÿòúýìøùçö÷çööê÷÷ëú÷èüöæýõâ÷ìÖçØÃÕƯÀ±šž“}un[ZWFPQCSVK[bZeld•˜²²¨ÕÎÆèÝÙóããúêëÿñôÿ÷ùÿþûþýùùúôøúïüüðÿÿóÿÿñÿûêÿæÑñª”¼o[©VD®RCµPD»LA¿JAÂG?ÆE?ÉE@ÊE@ÊE>ÉD=ÈC<ÉB<ÑC?ÐE@ÌEAÂC=³=9¦;5œ;5•<6Œ<3‡=4…<5=4<3~<0=1=1~:/~:/~:/}9.|90{8/{8/{8/{;2{;2y:3x92w81v70v70s7/n70j8/j8/j8/j8/h8.h8.h8.g7-f7-f7-f7-d8-d8-d8-f7-g6/h70i81i81h70i81j;3l=5g80k<4b6-a5,oC:xLCtI at nMDC9056.45/8918;247.14+25,58-58-57,46+46+46+46)37)/7(.9)08+.9).9+.9)08)08)19*08)08+/7*08+19,3;.4<-9B1:C0;B0:A1:<.68*24&/3$29'IU?cu[m„gf„bWyTInE?d8Hg;Li;Nk=Nk=Li;Li;Mj<Ol>UrDYvH[xJ]zL^{M\yKQn at G_;6B4+4/#)%gdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSicSjcSjcSjbUlbVlbVmcWmdUmdUmdUleUmfVngWogZnh\oh^mjekormtzƒŠ¥®³ÃÌÑÕßáæîñôüþôýú÷ýùùþ÷úÿôüÿòüÿñüÿîýþðûøïþúñÿùïÿúíÿùéÿòßïàËÝηÁ²›¢—|ubb_NXZL]cWmwn|†}¦¬¢¾ÀµÚÕÏîäâüîîÿôôÿô÷þôõÿùùûúøûýøüÿúøÿõôüñ÷ýñÿÿñÿùèÿôãÿÌ»½p›QD©SFµSH²C:ÀJ@ÄH@ÇG>ÉF>ÈE=ÇD<ÆC;ÆC;ÍG>ÌG>ÇG>¼C;­>5Ÿ:2—:3‘>6Š=5†=4ƒ=5=4€<3;0;1;1~:/~:/~:1}90|90{8/{8/{8/z:1z:1x92w81v70u6/u6/q6.m80k90j8/j8/i9/i9/i9/h8.g7-f7-g7-f7-f7-f7-f7-f7-f5.j81m;4k:3j92j:0m>4oC8l at 5oD;d<2c=2zVJ†dZyWMbLA>:13814927<54:0/5+25,9<336+25*24)03(13(25*46+47,.6),7)/7*-8*/7*/7*/7*/7*19,08+08-/7,/7,/7,08-08+7?09B1<E4=D4;A38<.26'-4$2;*JVBcr[h|a]vXOmKFfAAa:Hd;Kh<Nk?Nk?Kh<Jg9Li=Nk=TqEWtHZwK[xL]zNZvMNjAC[;2>4*00!''heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjdVjdVjdXldYlcZmeZmeXmfVg`NjeRnkXol]he\feasqr‚†Š“–ž¡«³¶ÃÈËØÝàêîïö÷ùùûúüþýþþüÿÿúýþöúýòùüñúýòûþóùúòúúòùùíüúëþüçù÷ÞéåÊÕÔ¶º¹›˜˜|qtY_dMbkXr}l„‚‘›´¹²ËÌÇãâÞòîë÷óòû÷öýùøüø÷ÿþüþþüþþüýÿúýÿúýÿúýÿúýÿúúü÷ÿÿúÿûöÿêåا £`X›D=µNE¿MCÂF<ÄD9ÊE<ÎI@ÎKAËH@ÇG<ÆG8ÃH8½J8³H8¦E5šB4‘B5‹C5†B5„B6‚@4‚>3‚<2„:1†91†9191~:1|91{80z7/z7/w7.v6-w7.w7.w8/w8/v7.u6-q5+n3+l7/i81i81h70h70g6/g6/g6/f5.g6/i70i81h70g6/e4-e3,h3-j5/m80k90j:0i;.i=0kA3gB2jI:dH:v_O~k\ŠxjŒoRJ=79.4:04:039/39/39/28.28.17-17-36-06,25,/5+14+/5+/4-.5-/4-.5-/4-/4-/4-/4-05./4-/4-.3,.3,/4-/4-/6.1;23=26 at 58B79D67B45@03>-4?.DQ=WeN[kQPbHEX<@T8BW6Ic>Ke>Kf=Kf=Je<Je:Lg>Oj?UpGYtK\vO]wP]wRWqNHb?;O6&1+&+.$),heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVidQjhSmjWjk[gg_lll~„“š¨¯µ¸ÂÄÑÖÙâçêòóõûüþÿþÿÿþÿþýûÿþúÿÿúþÿùûüôøûòöüò÷ýó÷úñøúïøúí÷úéùûåòõÚßâÃÌЯ´¸—‘–vkqUYaI_kUtoŒ˜Š§œ¿Á¼ÓÓÑççåóóñ÷÷õûûùüüúûûùþþüþþüþþüþþüþþüþþüþþüûÿþõÿÿõÿÿþÿÿÿûúÿíêð¿ºÂ~uŸKA¯M@¹K>ÂL@ÅK>ÃE9¼=4¾?6ÃE9ÄF7ÃJ7½L:³J7¦F6™C2‘C6E7…C7‚B8A7>5‚<4ƒ:3†91„93~92}:2z:1z:1y90x8/v7.v7.u6-v7.t8.t8.t8.r6,o5*m4+l7/i81j81h70i70h70g6/g6/e3,e3,g5.h6/j81j81j81k92k60l71k90k;1k;/j>1j at 0iD2gH6kP=gRAufSueŒ…s†ƒrKL<69.39/39/39/28.28.28.17-17-17-17-06,06,/5+/5+/5+/4./4./4./4./4./4./4./4.05//4..3-.3-.3-.3-/4./6/.80/:21=34 at 66B66B66B45B16C1CP>P]IR`IIW at AO6BP7EU:Jb at Jd?Ke at Ke>Ic<Hc:Id;Je<SnEXrK\vQ]wT[tTTmOC\>6I5&1-',0$)-heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVmhUkiTmjWjk[kkcwww‘’—§¬²¿ÆÌÒÜÞìñô÷üÿþÿÿþÿÿÿþÿÿþÿþýûÿþúÿÿúýþøúûóõøïñ÷ëñ÷ëô÷ìõùëöøêõøåõ÷áîîÔÛÛ¿ÉÊ«°±’“–yuy`kpZt{iˆŸ§œ®µ­ÍÏÊÞÞÜïïíøøöûûùþþüþþüýýûþþüþþüþþüþþüþþüþþüþþüýÿþûÿÿûÿÿÿÿÿÿûùÿúôÿ÷íýÑÆØž”L=¥RB©L;§@1·G;ÏYMÏUJ¼@4ÄD7ÆH:ÃK=¹I;ªB7?3—@7“E;‰@9„A9A8?6~>5}=4<4}=4z;4x<4w;3w;3u:2t91t91t91r90r90r90r90o9/n8.l6,k5+l7/j81l71j81k60i70i70h6/g5.g5.f5.g6/h70i81k:3k:3l;4j;3i:0h<1k?2jC4iD2fE2fI7lVAjYGujV†m‘Ž{€mEF658-28.28.28.17-17-17-06,17-17-17-06,06,/5+/5+/5+/4./4./4./4./4./4./4./4./4./4..3--2,-2,.3-/4..5.+5-+6.-9//;12>24 at 46B47D38E3?L:ER>CQ:;I28F->L3DT9J_ at Jb@LdBKc?Ia=G`9F_8G`9RkDXpL]uS^vVZqTPgK=T8.A.&1-',0%*.heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVniVljUlkWlm]pqi€‚ž¡¦¹¾ÄÄËÑÛåçõúýûÿÿüýÿüýÿþüýüûùÿþüÿÿûÿþùûüôõöîîñæéïãçíßíñâðôåñôãñôßòñÜêêÐØؼÇÇ«²±•¡¡‰‘“}“€œž‘ª­¢¶»´ÀÅ¿ÜÜÚééçööôûûùýýûÿÿýÿÿýýýûþþüþþüþþüþþüþþüþþüþþüþþþûûýÿþÿÿþÿ÷òïüóìÿüóÿûíÿôäìñ¹p•P@¢O?¸XJ·M?µE9ÀG<ÁA6ÈE;ÅI?½G=¯@9¡<4š=6–A<?;‡@<@:}@;z?9y at 9x?8x?8v=4v=4v=4u<3s=3r<2r<2q;1o;0o;0o;0n:/k9.j8-j8-i7.m82n72m61l71l71k60i70i70l:3j92h70f7/f7/f7/h91f:1j?6f>4e=1f>2hC3iE5fG3cG2cJ6hV at i\IskV…‚oŽzpq_9=,47,28.17-17-17-06,06,06,17-17-17-06,06,/5+/5+/5+.3-.3-.3-.3-.3-.3-.3-.3-.3-.3--2,-2,-2,-2,.3--4-*4,)4,*6,+7-.:.1=14 at 25A36C2:G5<I78E12?+2@)8F/>N4DX<E]=K`AJb at K`?G_;H^:F^:SiEXpN`uV^uXZnSLcI9M4):(%.+%*.$)-heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVlgTkiTnmYop`tum…‡†¤§¬¿ÄÊÎÕÛæðòûÿÿûÿÿûüþýþÿÿþÿþýûÿÿýÿÿûþýø÷øðïðèçêßàæÚÞåÕçëÚêïÛíðÛìðÙîîÖèèÐÚØ¿Ìʱ½§·µ ±®¶´§Á¾µÉÈÃÒÓÎÙÙ×èèæòòðúúøüüúýýûÿÿýÿÿýüüúþþüþþüþþüþþüþþüþþüþþüÿþüÿüÿÿüÿÿûúüû÷ýÿùþÿøþÿôÿÿíÿþìøßËÅœŠbP–J:¥L<´P@¼L>¿@7ÆC;ÅF?¿D=±>;¦:7ž:8™>;‘=;Š?<„@=}@=xA<tB;rC;rC;q?6s>6s>6r=5r=5r=5p>5o=4n>4m=3l<2k;1j;1i:0i:0j:0n72p62p62m61m61l71i70i70l;4k:3h91e90e90e90e:1d<2fB6cA5cC4dD5dG5dI6bI3_I2^L6eV?jbMrmW„ƒo„‡r[`L3:(28,28.17-17-17-06,06,06,17-17-17-06,06,/5+/5+/5+.3-.3-.3-.3-.3-.3-.3-.3--2,-2,,1+,1+,1+,1+-2,,3,,6.+5-*4+*4++5,.8-0;-2=/2=-5@/6A05A-1=)1=)5A-8F/=O5 at T8FY=H\@J]?I^=K^>K`?TgG[pQcvZauZYkSJ]G6G4&4%$-*$),"'*heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZlfVjgTkjUlnYorasvm…„Ÿ¤¨¸¿ÇÖßäí÷ùûÿÿûÿÿûüÿþÿÿÿþÿþýûÿÿûÿÿúüüôóõêëíâãçÙÝãÕÜãÑäéÓçìÕéíÖêìÔëëÓèæÏßÚÄÓθÓκÌƶËøÐÉÁ×ÒÎàÛØêæåðïíóòðùù÷ýýûýýûýýûÿÿýþþüüüúþþüþþüþþüþþüþþüþþüþþüÿýüÿûüÿøùÿþýþÿýùÿýôÿøïÿõ÷ÿöð÷çÿÿíÿîÛͧ”¤kX¢[GªWE­L;¹D:ÀD<ÀE>¼E?´A>ª=:¢:9š;9•=<?=…?=}@;wB<rC;oD;oD;p?8q?6q?6q?6q?6p>5o?5o?5o at 6n?5m>4k<2h<1h<1h<1l<2o83q62p62p62m61l71j81i81h70g80e90e:1d<2e?4f at 5dB6^B4aG8cL:dM;cM8`K6]K3]M4]Q9bX?mhRss[€ƒnv{eFO:4=*39-28.28.28.17-17-17-06,17-17-17-06,06,/5+/5+/5+-2,-2,-2,-2,-2,-2,-2,-2,-2,,1++0*+0*+0*+0*,1+,3,.5.,6.*4+*4+*4++5,-7,.9+-8*0;+4?/5@/4?.3?+3>-3@,7F/9K3 at O8BT:GW<H[?M]BM`DUeJ\oSdtZ`rZXgRGXE4B1$2%$-*$),"'*heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjdVjdVjcYkdZlc\md[lfZlfVliVlkVkmXkn]lrhy}• ®·¾ÒÛàêóøûÿÿùþÿùúþþÿÿÿþÿúù÷ÿÿûþýøùùññóèéëÞãçØßæÖàèÓäéÒçíÓèìÓçéÑèèÐçåÎàÛÇ×оÚÓÃÙÑÆÞÔËæÝØîäãóéêúñôÿùûúù÷þþüÿÿýýýûýýûÿÿýÿÿýüüúþþüþþüþþüþþüþþüþþüþþüÿýüÿùøÿúùÿþýüÿý÷ÿþîÿùñÿÿòÿýõÿúóùëÿýíÿúèôλ«wbQ:ª\H²N>¸J=¹I>¸I@´G@¯D>¥=:œ:7–=9>:ˆ?9€A:xA:tD:pF:pE<p?8q?8q?8q?8q?8q?8p?8p?8qB:pA9n?7l=5i=4j>5j>5n=6o83r73p62p62n72l71j81i81d8/d90c;1d>3d at 4cA5cA5_C5ZE4_N<gVBhWCcS<^O8[O5\R7]V<]Y>nlUtv^|kcmU2>(6B.3;.39/39/39/28.28.28.17-17-17-17-06,06,/5+/5+/5+-2,-2,-2,-2,-2,-2,-2,-2,,1+,1++0**/)*/)+0*,1++2+-4-+5-*4,*4,+5,+5,,6+-7,,6+/:,2=/6A17B27B15 at 04?.2?-4C.:G3=L5AO8DT:JX?L\BTbI\kTcqZ^mXUbPDRA2>0#/%&/,&,,$**heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjdVjdVjcYkdZlc\md[lfZlfVolYmlWjlWgkZflbr{xŽ˜š¨±¸ÊÓØãìñøýÿ÷üÿúûÿþÿÿÿþÿúùõÿÿúýýõøøîðòåéëÝåéØãêØåíÖæìÒéíÒêíÒèèÎèæÏèãÏáÚÈØÐÃØÎÄÝÒÌêßÛøíëÿôöÿõùÿõûÿùüþüýÿÿýÿÿýþþüþþüÿÿýÿÿýýýûþþüþþüþþüþþüþþüþþüþþüÿþúÿýûÿýûýüúùýüøÿÿõÿÿóÿÿíýúóÿûûÿúÿÿôÿöæÿóßÿãÍ×­•©oY¨WD®Q@¬O>¯OA±OB­K@¤C<™<5•>7?6ˆ?8A7{B7uD6qE8qE8p?8q?8s>8q?8q?8q?8q?8p?8sB;qB:o at 8m>6l=5j>5m>6o>7o83q73o83m82m82i81h91f:1f;2d>3d at 4bB5`C5]A3\@2WB1TG4[S>f^Gi^HbX?ZS9ZS7\W:ZV;XW;kmUsw^u}fUaI&28D03;.4:04:039/39/39/28.28.17-17-17-06,06,/5+/5+/5+-2,-2,-2,-2,-2,-2,-2,-2,,1++0*+0**/)*/)+0*+0*,1++2+)3+*4,+5-+5,,6--7.-7,,6+.8-2<16A39D69D47B46A10;+2?-5B09F2<I5 at N7FT=JX?R`I[hTanZ\iWQ^MBN@/;/",#+1-(.,&,,heVheVheVheVheVheVheVheVifWifWifWifWifWifWifWifWkeWkeWkdZle[md]ne\mg[mgWqn[kmWknYkr`jrgpyv‡‘“Ÿª°»ÄÉÐÙÞêïóöûþüýÿþÿÿÿþÿþýùÿÿúþþöúúðöøëôöèðôãêñßçïØðöÚíòÔëîÑììÒèæÑáÜÉÝÕÈÞÔÊáÔÎèÚÙòääúëîþòôÿ÷ûÿùÿÿüÿÿýþþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþÿúÿþúÿþúþþüýÿþûÿÿúÿÿúÿÿûÿÿþÿÿÿÿýÿûõÿûñÿüìÿûåÿóÛÿêѺ‚i¦bK—O9ŸT?¨ZF£RAJ: M?Ž<0‹=0†>2=/x=/t?/sB3tD6r=5r=7t=8s>8u@:u@:t?9q?8sA:q at 9q@9q at 9p?8n?7o>7o>7k92m82l:3l;4l;4h<3g<3c=2c?3^>1dG9cG9T=-N9(M8'@1WQ;PN7KI0OK2]Y>ieJeaDVU7XX<]`CosZz€fdlU=I1-9#2>*4</5;14:04:04:039/39/39/39/39/39/28.17-17-17-06,16016005/05//4./4./4./4.,1+,1+,1+,1+,1+,1++0*+0*.5.-4--4-,3,-4--4,.5-.5-+2*-4,07/5=29A6=E8?G<?J<7B25@/3>-1=)2>*9E/BN8IU?O[GVbN]hWYdTLWI<F;/9.)3*)/+(.*'-+heVheVheVheVheVheVheVheVifWifWifWifWifWifWifWifWkeWkeWkdZle[md]ne\mg[khWonZjlVknYkr`jtiq|x‰”–£®´¾ÇÌÒÛàëðô÷üÿýþÿþÿÿÿþüþýùÿÿúþþôûûï÷ùëô÷æðõáêòÝèíÖêïÑæëËäçÊææÌãáÌßÙÉÞÔÊßÔÎçÙØíßßöçêûïóÿôøÿ÷ûÿúþÿüÿÿþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüýÿüûÿúûÿúýÿüýþÿþýÿÿüÿÿüÿÿûÿÿüÿÿüÿÿûùÿüõÿþñÿÿíÿûåÿòÙÿëÑà±—§u\‘[C–ZBšYCšVC™R@ŽG5‹F6ˆE4ƒD3|C2wB0s@/o>/u at 8s>8u>9u@:t?9o=6p>7sA:q?8p?8p?8n?7o>7m>6n=6m>6k<4l=5m>6k?6j?6gA6eA5bB5dG9[A2^G7^I8N=+F7$G8%>6!LL4GK2DG,DD*MM1\[?baC`aBYY=dgJsw^sy_X`I:D,/;%7C/6>16<26<26<25;15;15;15;15;15;15;14:04:039/39/39/27127127116016016005/05/.3-.3--2,-2,,1+,1++0*+0**1**1*)0))0))0)*1*+2*,3+.5--4,.5-07/4;39A6?F>BJ?;F8:E57B14?.3?+6B.<H2 at L6LXDS_KYdTWbRLVK=G<1;2+5,+2+*0,)/+heVheVheVheVheVheVheVheVifWifWifWifWifWifWifWifWkeWkeWlcZmd[md]ne\mg[khWmlXimVjoYktaiuiq}yŠ˜™¥²¸¿ÊÐÔÝâíòö÷üÿüýÿýÿþÿþüþýøÿÿ÷ýýóúûí÷úéô÷äïôÞçïØåëÑâçÉÞáÂÝÝÁÞÞÆÞÛÈÝ×ËàÕÏäÙ×îââóçëúîòÿôøÿ÷ûÿùüÿúýÿýýÿþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüýÿüøÿüøÿüûÿþþþþÿüÿÿúÿÿùÿÿøÿÿùÿÿúÿÿúúÿýøÿÿöÿÿóýÿïÿúæÿôÜÿøàÿìÓ㿧¬‚j‡YB…Q;’[F—]IS?F2u>)r>)s at +tD0vE4q?4n<3q<4tB9sA8o?5qA7xH>n>4m>4m>4k?4l=3j>3l=3j>3g?5gA6gA6gC7eC7cC6`C5^D5bK;UB1ZI7`S at RG3C;&E=(FA+AE,BH.AE*<@%?B%NN2_`AijKaaEnqTvzagmSJO94<%4=(=F38>28>48>48>47=37=37=36<28>48>47=37=37=36<26<26<25:449349349338238238227105/05//4..3--2,,1++0*+0*).().().().().(*/)+0*,1+160/4.,1+,1+/4.6;4=B<AH@@K=>K:<I78E34A-2?+3A*5C,DQ=KXDQ^MQ^MHTH<H<2>4.8/-4--4-,3,gdUgdUheVheVheVheVifWifWifWifWifWifWifWifWifWifWkeWkeWlcZmd[md]mf\mg[jiWkmXimVjoYjs`hthm|wˆ˜˜¦³¹¿ÊÐÓÜãëðööûÿüýÿýÿþÿÿýÿþùþþöýýñúûí÷úçô÷âîóÜåíÕâèÎÛàÀ×Ú»ÖÖ¼Ù×ÂÝ×ÇÞ×ÍåÛÙìààøìðûðöÿõûÿùþÿúýÿûûÿûûÿýüÿþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüýÿüøÿþøÿþûÿþþþþÿüþÿúÿÿùÿÿøþÿúýÿùüÿùùÿýúÿÿøÿÿøûÿõüþðÿÿíÿüéÿñßÿðÝÿïÚñÒ½´z{R>tJ4uH3vI4zM8}P;yL7nA.e7'{M at sD:qB8sD:oC8g;0d8-g=1i?3i?3i?3g?3f>2f>2f>2e?2b at 4bB5`C5_C5_C5[D4ZE4WD3XI6OB/\T?oiSc^HMK4IG0IK3>D*?H- at F*<B&<A#FI,XY:deFmmQxx\tv^[_F at C.6;%8 at +<C19?39?59?58>48>47=37=37=39?58>48>48>48>48>48>48>47<67<67<66;56;56;55:45:438238216005//4.-2,,1+,1++0*+0**/)*/)+0*,1+-2,-2,05/.3-+0*+0*-2.2718=9;B:@K=@M;@M;=J68E13@,1?(0>'<I5BO;HUCIVEDPB;G;2>4.:0,6..5.-4-gdUgdUgdUheVheVifWifWifWifWifWifWifWifWifWifWifWkeWldWlcZmd[md]mf\mg[jiWkmXinWiqZgs_drejyt…••£²·½ÈÎÒÛâêïõôùýûüÿýÿþÿÿýÿÿúÿÿøÿÿóþÿñûþë÷úåðõÞæîÖâèÌÙÜ¿ÕÕ¹ÒйÔѾÚÔÈàÙÑêàßôéíþóùÿ÷üÿûÿÿýÿÿþÿÿþüÿþúÿþúþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüýÿþúÿÿúÿÿûÿÿþþþÿýþÿüüÿûüÿûúÿúøÿù÷ÿú÷ÿýøÿÿûÿÿûýÿúýþùùôîÿþöÿýôÿüóÿûîÿ÷çûæÕéÒÀÏ´¡¶š…”uawVCjI6lI6rM;uP>mF7iB3gB2jE5nI9nJ:oK;oK;eA1cB1cB1cB1cB1cB1bC1`C3]F6\G6\G6ZG6ZG6WH5TG4RG3PH3NH2fdM~~frrZVX at JL4GM3<E*<F+?H+AG+AF(DG*MN/TU6xw[{z^nnVUU=CB.?A,>A.:>-;>39?59?58>48>47=37=37=38>48>48>48>48>48>48>48>49>89>89>88=78=78=77<67<66;55:449338227105//4./4.-2.-2.,1-+0,+0,,1--2.-2.,1-,1-,1-,1-.210513764;4;G9=L9 at O<@O:<K67F/4C,2A*6E.:I4 at O<BP??M>8F71?2-9-,6--4,,3+fcTfcTgdUheVheVifWjgXjgXifWifWifWifWifWifWifWifWldWldWlcZmd[md]mf\mg[jiWkmXinWiqZgs_bpcgxr‚””£²·ÀËÑÔÝäëðöõúþûüÿýÿþÿÿýÿÿúÿÿøÿÿôÿÿóÿÿïúýèò÷àçðÕâèÌ×Ú½ÑѵÍË´Î˺ÖÏÅÞ×Ñìâã÷îóÿöþÿúÿÿýÿÿþÿÿÿýþÿúþÿùþÿúþÿúþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþþýþÿýþÿýþÿýÿþýÿüþÿúþÿùÿÿ÷ýýóýýõþýøþýùÿþüþþþÿýÿÿþÿþùÿÿüÿÿûüûöóÿøòÿýôÿþñÿýíÿúéÿòà÷äÓçÒ¿Ò»©¹ŸŽŸ„srb|]K}^LtUCaD2W:(Y<*[>,X=*`E2`E2`E2_F2`G3`G3`G3]H3\K7\M:\M:YL9XM9UM8RL6QL6NL5QQ9ikS|€gmqXSY?FL2>G,<F+<F+?H+DJ.EJ,DG*HI*LM.yx\tsWfdMTR;LI6KJ6FE3<=-<?49?59?59?58>48>48>48>47=37=38>48>48>48>49?59?5:?9:?9:?9:?99>89>89>88=78=78=77<66;55:4493382382/40.3/-2.,1-+0,+0,+0,+0,+0,,1--10.21/32/32/32-4-3?17F3=L7 at O:?N7<K49H18G05D-8G0<K6>M:<J97E61?2-9-+5,-4,,3+fcTfcTgdUheVheVifWjgXjgXifWifWifWifWifWifWifWifWldWldWlcZmd[md]mf\mg[jiWjlWhmVhrZfs_cqdhys…——¥·»ÇÒØÚãêðõûøýÿüýÿýÿþÿÿýÿþùÿÿõÿÿòÿÿðüÿìøûæïôÝâëÐÝãÇÕÕ¹Î̳ÉÄ°ÊÄ´ÐÉ¿ÚÒÏéàãöíòÿ÷ÿÿúÿÿýÿÿþÿÿÿýýÿúüÿøüÿøýÿúþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþþÿüÿÿüÿþýÿýÿþúÿúøÿùøÿõøÿóøÿóøÿõüÿøýÿúÿýþÿüÿÿüÿÿûÿý÷ÿÿúÿÿüÿÿýÿÿþÿþýûûûóúøìÿÿñÿÿïÿÿíÿþíÿýíÿöçÿîàýêÛúãÑÿæÐãÊ´¥xt^GeO8bL5\H0^J2\J2\J2]K3]K3^L4^L4\M6YN8WO:WO:VP:UO9SN8PN7NN6MO7PT;`fLfoTU^CEO4AK0<F+?I.?I.CL/HN2HM/FI,OP1YX:qmRjfKa\F[V at YTATQ>MJ9BC3=@5;A7;A7;A7:@6:@6:@69?58>48>48>49?59?5:@6:@6:@6;@:;@:;@::?9:?99>89>89>8:?9:?99>89>88=78=77<67<6495273162/40-2.,1-+/.+/.,0/,0/-10.21.23.23-12+1-+9*/@-6H2;M7=O7<N4:L2:L25G/7I1:L6<M::K96G70 at 3-;.,6--4,,3+cdRcdRdeSefTgeVhfWigXigXhfWifWifWifWifWifWifWkeWkeWkeWldYle[md]mf\kg[jiWikVhmWhrZgt`dqgj{u‰›ª¼ÀÍØÞàçíôùÿúÿÿûÿÿýÿüþÿúþþöúúîúûíúûéøúåóöáêî×ßãÊÙÜÁÓѸÌDZž¬Æ¾±ÌüÖÎËæÝàôêòþ÷ÿÿúÿÿþÿÿÿÿþþþýÿúüÿúüÿúýÿüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüÿþüÿþüÿþüÿýþÿüÿÿüÿÿýÿýÿþûÿüøÿù÷ÿ÷÷ÿõøÿöùÿöüÿøÿÿûÿþýÿüÿÿûÿÿúÿÿúÿÿûÿÿüÿÿþÿþýÿûýüüþûþÿúùúòúüñýûïþúîÿùìÿûìÿýïÿýìÿðÛÿûâìÜÞŽu`P7RB)XH/XH.[M3[M3ZN4ZN4[O5[O5\P6[Q8UO7TO9TO9QO8PN7NN6KM5IM4JN5LR8S\APY<@I,;F(AL.?J,DM0EN1JQ2MR4JM0LL0YY=kjNhdIb^E^ZA_ZD`[GZUAQO:KJ8AB4 at B5@B5>A6>A6>A6=@7=@79?59?59?5:@6:@6:B7:B7:B7;@9;@9;@::?8:?99>79>89>7;@:;@9;@:;@9:?9:?8:?9:?98?87=94;4382160/4..3/.3/.21.21,2.,2.+2++2*,4))6%$6)=!2F+8L1;O6;M5;M5;M58J29K3;M5<N6<N87H51B0.<--7,.5--4,]eN^fO_gP`hQdiUfiVgjWijXfgUhgUheVheVjdVkeWkeYlfXlfXkhYmg[kg\mf^jf[ieYgeVghVfkUenYbo]dqhsƒ€–¨¬¹ÈÏÒÛââéïò÷û÷üÿùýüüþùüÿöüþñ÷øêùúêø÷åòñÝîíÙëêÖàßÊ×Ò¾×ϼËÀ®½´¥½³©Â·±ÌÂÁÛÒ×êàèúóûüöÿþûÿÿþÿþýÿüýÿüþýüþýþþþþþþþþþþþþþþþþþþÿþüÿþüÿþüÿþüþýùþýùÿüùÿýúÿþûÿþûÿþÿÿýþÿüýÿýþÿÿÿþÿýýÿüûýøÿÿûüý÷ÿýøÿþúÿýøÿúöÿ÷ôÿùùÿúÿÿüÿÿýÿÿÿÿÿÿÿýÿüýÿþüþýþÿÿÿÿÿÿþüÿþùÿþóÿþîÿýêÿýæúôÜÿúàçàƏˆlUN2WN1TK.SJ+WN1WN1UN1UN1TO2TO2TN4SO4QM2RN5QO6PP6MO7KO6HM6GL5JP6FO4AJ-=F'>H&DK*FM+EL*PV4PT3KN/HK,TT8bbFccIZZ@[Y@\ZA][B][B[Y at XV=US:SQ8HF1GD1DA0A?0@>1>>2??5>@5;>59?59?59A69A48C58C58C5:B79A69 at 88@58?79A69 at 8:B7:A9:B79 at 8:B7;B:<D9=D<>E=8B:8B:7A88 at 56>14</39/271.40/51-7/-9-.;)0@&6G'7M';V+:W+;U0;T4;R8=P:>O<>P::L6 at R8EW=FY=DX=@T;5H2+<),6+,3++2*ZgM[hN\hP]iQbjSckTglXhkXghVghVifWifWkeWlfXmeZmgYmgYkhYkg[kg\jf]jf[hfZefVhiWglVfo\erajwnzŠ‰œ«²ºÈÑÐÙàáéìò÷ûøþþùþúúÿøûþóùýïøùë÷øæõôâíìØéæÓåâÏÜ×ÄÒ˹ʿ­Á´¤¹­¡¼¯¦Á¶²ËÁÀÛÐÖæßæûóþý÷ÿþûÿÿþÿþýÿüýÿüýÿüýÿþþþþþþþþþþþþþþþþþþÿþüÿþüÿþüÿþüÿýúÿüùÿüùÿýúÿýùÿþúÿþýÿýüÿüýÿýþÿþÿÿþÿÿýþýûüÿþýÿþûÿüúÿøóøíçòåÝöèßûðêÿúýÿüÿÿýþÿÿýÿÿûýÿüýÿþüýÿýþÿýþÿÿýÿÿþüÿþõÿÿîÿþèÿÿäúöÝýûâäàÇ‹‡lRM0SN0QK+QK+UO/UO/TO1TO1SO2SO2QP4QP4QM2PO3PN5NQ6MO7JP6HM6EM5HQ6EN1BK.?I'BI(FM+JP,KQ-NR/PT1VZ7^bA_bCY\?TW<UU=VV>WU>XV=YW>XV=XW;WV:XT9QK3OI3LG4ID1DA2B at 3A?3>@5<=59?59?59A67B48C57D37D3:B79A69A68 at 58@59A69A6:B7:B7:B7:B7:B7;C8<D9=E:<F;=G?<H><F;;F6<D5:B39?38=67>74>63=40>-3C)9M*BY/Ga1Op;Ln;Li=Fa>BY?<R=;L::K8=O9DV<K^BM`BL`DH\@:Q71D.+5*+2*)0(ZgM[hN\hP^jRbjSdlUglXilYijXijXkhYkhYlfXmgYnf[nhZmgYkhYkg[jf[jf]ieZhfZfgWhiWejTdmZgtco|sŽ¬³¶ÄÍÍÖÝÞæéñöúøþþúþýùþøøûòôøêóôæðñßêé×áàÌÜÙÆ×ÔÁÐ˸ÇÀ®¿³£½° ¼°¤Ã¶®ËÀ¼ÕËÊãØÞëäëüôÿý÷ÿþûÿÿþÿþýÿüýÿüýÿýÿþþþþþþþþþþþþþþþþþþþÿþüÿþüÿþüÿþüÿýúÿýúÿüùÿüùÿüøÿüøÿýüÿüûÿûüÿüýÿþÿÿþÿÿýþþüýÿþýÿþûÿýûüóîêßÙâÕÍëÝÔ÷ìæÿúýÿüÿÿýþÿÿýÿÿûýÿüýÿþüýÿýþÿýþÿÿþÿÿÿýÿþõÿþíÿýçÿþãû÷ÞþüããßƉ…jPK.QL.QK+QK+TN.UO/TO1UP2TP3SO2QP4PO3QM2ON2PN5MP5MO7JP6IN7FN6HQ6FO2CL/CM+FM,JQ/OU1SY5QY2W_8jpJy[qvVY^@KO4MP5QQ9QQ9RP9SQ8TR9UT8YU:ZV;XR:VP:RM:NI6HE6DB5CA5?A6<=59?5:@69A67B47B47D37D3:B7:B79A69A69A69A6:B7:B7:B7:B7:B7:B7;C8<D9>F;<F;?IA>J@?I>>I9?G8>F7>D8=B;>E>9C;6 at 74B19I/BV3Pg=XrB^J[}JXuIMhECZ at 9O:6G54E2<N8EW=NaESfHSgKNbF at W=6I3/9./6.-4,ZgM[hN\hP^jRblTemVhmYinZklZklZlj[liZnhZnhZog\oi[liZkhYjfZjf[ie\ieZhfZfgWfgUbgQajWerao|s~Ž–¥¬«¹ÂÇÐ×Úáçîó÷öüüøüûõúôóöíîòäéêÜãäÒÜÛÉÓÒ¾Î˸ÉƳþ«½¶¤Ã·§Ç¹¬ÍÁµÖÉÁßÔÐéßÞóèîøñøýõÿþøÿÿüÿþýÿýüÿüýÿüþýýÿþþþþþþþþþþþþþþþþþþþÿþüÿþüþýûÿþüÿýúÿýúÿýúÿüùÿû÷ÿû÷ÿýüÿüûþúûÿûüÿýþÿþÿÿýþþüýÿüûÿþûÿýûýôïíâÜæÙÑðâÙüñëÿúýÿüÿÿýþÿÿýÿÿûýÿúýÿþüýÿýþÿýþÿÿþÿÿÿýÿþõÿþíÿüæÿüáþùãÿþçäßÉŠ†mPJ0RM0SL/SM-TN.UO/UP2UP2TP3SO2PO3ON2PL1NM1OM4LO4LN6JP6JO8HP8JS8GP3GP3IS1MT3OV4V\8\d=grHtUˆ“i›s…lnuTZaBRV;LN6NN6MM5NL5OM6RP7WS:YU<ZT>XR<TO<QL9KH9GE8EC7 at B7=>6:@6:@69A67B47B46C26C2;C8:B79A69A69A69A6:B7;C8;C8:B7:B7;C8;C8=E:>F;=G<=G?<H>>H=>I9?G8>F7>D8=B;=D=9C;6 at 74B19I/DX5Ri?[uEZ{FWyFTqEIdA=T:2H3/@.->+6H2 at R8L_CReGSgKOcG@W=6I30:/07/-4,YgMZhN\hP^jRblTemVinZjo[mn\lm[mk\mj[nhZnhZoi]oi[liZkhYjfZieZie\ieZig[ghXghVchRajWerao|s{‹ŠŸ¦¢°¹ÁËÔÔÝäéñôòúüôúøñöðíðçèìÞâãÕÚÛÉÒÑ¿ÌɶÉıþ«¿¸¦¼³¢Ê¾®ÓŸÜÐÄæÙÑíâàöìíÿôúÿùÿÿ÷ÿÿúÿÿüÿþýÿýüÿûüþüþýþÿÿþþþþþþþþþþþþþþþþþþÿþüÿþüþýûþýûÿýúÿýúÿýúÿûøÿúöþùõÿýüÿûúýùúþúûþüýÿýþÿþÿÿýþÿüûÿýúÿüúÿøó÷ìæòåÝøêáÿôîÿúýÿüÿÿýþÿÿýÿÿûýÿúýÿþüýÿüýÿýþÿÿþÿÿÿýÿþõÿýìÿûãþúßÿüæÿÿéçâÌŒˆoRL2TO2TM0UN1TN.UO/VQ3VQ3UQ4SO2ON2NM1PL1NM1NL3KN3LN6KQ7KP9JR:LU:IR5JS6OY7SZ9T[9]c?fnG‚’c’¦sŸ±›ª’¡zˆ”pr{\\bFLP7KM5LK6KI4LJ5PK5TN8VP:WQ;VP:SN;QL9LI:IG:GE9CE:=>6:@6:@69A67B47B46C26C2;C8;C8:B79A69A6:B7;C8;C8;C8;C8;C8;C8<D9=E:>F;=G<=G?<H>=G<=H8>F7=E6=C7=B;:A:7A95?64B19I/BV3Ne;Uo?Tu at RtAPmAE`=9P6-C.+<*+<)1C-<N4H[?PcERfJNbF at W=5H2,6++2*'.&
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/testimgp.jpg
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/testimgp.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/testorig.jpg
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/testorig.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/testprog.jpg
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/jpeg/testprog.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/transupp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/transupp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/transupp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,928 @@
+/*
+ * transupp.c
+ *
+ * Copyright (C) 1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains image transformation routines and other utility code
+ * used by the jpegtran sample application.  These are NOT part of the core
+ * JPEG library.  But we keep these routines separate from jpegtran.c to
+ * ease the task of maintaining jpegtran-like programs that have other user
+ * interfaces.
+ */
+
+/* Although this file really shouldn't have access to the library internals,
+ * it's helpful to let it call jround_up() and jcopy_block_row().
+ */
+#define JPEG_INTERNALS
+
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "transupp.h"		/* My own external interface */
+
+
+#if TRANSFORMS_SUPPORTED
+
+/*
+ * Lossless image transformation routines.  These routines work on DCT
+ * coefficient arrays and thus do not require any lossy decompression
+ * or recompression of the image.
+ * Thanks to Guido Vollbeding for the initial design and code of this feature.
+ *
+ * Horizontal flipping is done in-place, using a single top-to-bottom
+ * pass through the virtual source array.  It will thus be much the
+ * fastest option for images larger than main memory.
+ *
+ * The other routines require a set of destination virtual arrays, so they
+ * need twice as much memory as jpegtran normally does.  The destination
+ * arrays are always written in normal scan order (top to bottom) because
+ * the virtual array manager expects this.  The source arrays will be scanned
+ * in the corresponding order, which means multiple passes through the source
+ * arrays for most of the transforms.  That could result in much thrashing
+ * if the image is larger than main memory.
+ *
+ * Some notes about the operating environment of the individual transform
+ * routines:
+ * 1. Both the source and destination virtual arrays are allocated from the
+ *    source JPEG object, and therefore should be manipulated by calling the
+ *    source's memory manager.
+ * 2. The destination's component count should be used.  It may be smaller
+ *    than the source's when forcing to grayscale.
+ * 3. Likewise the destination's sampling factors should be used.  When
+ *    forcing to grayscale the destination's sampling factors will be all 1,
+ *    and we may as well take that as the effective iMCU size.
+ * 4. When "trim" is in effect, the destination's dimensions will be the
+ *    trimmed values but the source's will be untrimmed.
+ * 5. All the routines assume that the source and destination buffers are
+ *    padded out to a full iMCU boundary.  This is true, although for the
+ *    source buffer it is an undocumented property of jdcoefct.c.
+ * Notes 2,3,4 boil down to this: generally we should use the destination's
+ * dimensions and ignore the source's.
+ */
+
+
+LOCAL(void)
+do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	   jvirt_barray_ptr *src_coef_arrays)
+/* Horizontal flip; done in-place, so no separate dest array is required */
+{
+  JDIMENSION MCU_cols, comp_width, blk_x, blk_y;
+  int ci, k, offset_y;
+  JBLOCKARRAY buffer;
+  JCOEFPTR ptr1, ptr2;
+  JCOEF temp1, temp2;
+  jpeg_component_info *compptr;
+
+  /* Horizontal mirroring of DCT blocks is accomplished by swapping
+   * pairs of blocks in-place.  Within a DCT block, we perform horizontal
+   * mirroring by changing the signs of odd-numbered columns.
+   * Partial iMCUs at the right edge are left untouched.
+   */
+  MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
+
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    compptr = dstinfo->comp_info + ci;
+    comp_width = MCU_cols * compptr->h_samp_factor;
+    for (blk_y = 0; blk_y < compptr->height_in_blocks;
+	 blk_y += compptr->v_samp_factor) {
+      buffer = (*srcinfo->mem->access_virt_barray)
+	((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y,
+	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+	for (blk_x = 0; blk_x * 2 < comp_width; blk_x++) {
+	  ptr1 = buffer[offset_y][blk_x];
+	  ptr2 = buffer[offset_y][comp_width - blk_x - 1];
+	  /* this unrolled loop doesn't need to know which row it's on... */
+	  for (k = 0; k < DCTSIZE2; k += 2) {
+	    temp1 = *ptr1;	/* swap even column */
+	    temp2 = *ptr2;
+	    *ptr1++ = temp2;
+	    *ptr2++ = temp1;
+	    temp1 = *ptr1;	/* swap odd column with sign change */
+	    temp2 = *ptr2;
+	    *ptr1++ = -temp2;
+	    *ptr2++ = -temp1;
+	  }
+	}
+      }
+    }
+  }
+}
+
+
+LOCAL(void)
+do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	   jvirt_barray_ptr *src_coef_arrays,
+	   jvirt_barray_ptr *dst_coef_arrays)
+/* Vertical flip */
+{
+  JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y;
+  int ci, i, j, offset_y;
+  JBLOCKARRAY src_buffer, dst_buffer;
+  JBLOCKROW src_row_ptr, dst_row_ptr;
+  JCOEFPTR src_ptr, dst_ptr;
+  jpeg_component_info *compptr;
+
+  /* We output into a separate array because we can't touch different
+   * rows of the source virtual array simultaneously.  Otherwise, this
+   * is a pretty straightforward analog of horizontal flip.
+   * Within a DCT block, vertical mirroring is done by changing the signs
+   * of odd-numbered rows.
+   * Partial iMCUs at the bottom edge are copied verbatim.
+   */
+  MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
+
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    compptr = dstinfo->comp_info + ci;
+    comp_height = MCU_rows * compptr->v_samp_factor;
+    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+	 dst_blk_y += compptr->v_samp_factor) {
+      dst_buffer = (*srcinfo->mem->access_virt_barray)
+	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
+	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+      if (dst_blk_y < comp_height) {
+	/* Row is within the mirrorable area. */
+	src_buffer = (*srcinfo->mem->access_virt_barray)
+	  ((j_common_ptr) srcinfo, src_coef_arrays[ci],
+	   comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor,
+	   (JDIMENSION) compptr->v_samp_factor, FALSE);
+      } else {
+	/* Bottom-edge blocks will be copied verbatim. */
+	src_buffer = (*srcinfo->mem->access_virt_barray)
+	  ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y,
+	   (JDIMENSION) compptr->v_samp_factor, FALSE);
+      }
+      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+	if (dst_blk_y < comp_height) {
+	  /* Row is within the mirrorable area. */
+	  dst_row_ptr = dst_buffer[offset_y];
+	  src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1];
+	  for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+	       dst_blk_x++) {
+	    dst_ptr = dst_row_ptr[dst_blk_x];
+	    src_ptr = src_row_ptr[dst_blk_x];
+	    for (i = 0; i < DCTSIZE; i += 2) {
+	      /* copy even row */
+	      for (j = 0; j < DCTSIZE; j++)
+		*dst_ptr++ = *src_ptr++;
+	      /* copy odd row with sign change */
+	      for (j = 0; j < DCTSIZE; j++)
+		*dst_ptr++ = - *src_ptr++;
+	    }
+	  }
+	} else {
+	  /* Just copy row verbatim. */
+	  jcopy_block_row(src_buffer[offset_y], dst_buffer[offset_y],
+			  compptr->width_in_blocks);
+	}
+      }
+    }
+  }
+}
+
+
+LOCAL(void)
+do_transpose (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	      jvirt_barray_ptr *src_coef_arrays,
+	      jvirt_barray_ptr *dst_coef_arrays)
+/* Transpose source into destination */
+{
+  JDIMENSION dst_blk_x, dst_blk_y;
+  int ci, i, j, offset_x, offset_y;
+  JBLOCKARRAY src_buffer, dst_buffer;
+  JCOEFPTR src_ptr, dst_ptr;
+  jpeg_component_info *compptr;
+
+  /* Transposing pixels within a block just requires transposing the
+   * DCT coefficients.
+   * Partial iMCUs at the edges require no special treatment; we simply
+   * process all the available DCT blocks for every component.
+   */
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    compptr = dstinfo->comp_info + ci;
+    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+	 dst_blk_y += compptr->v_samp_factor) {
+      dst_buffer = (*srcinfo->mem->access_virt_barray)
+	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
+	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+	     dst_blk_x += compptr->h_samp_factor) {
+	  src_buffer = (*srcinfo->mem->access_virt_barray)
+	    ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
+	     (JDIMENSION) compptr->h_samp_factor, FALSE);
+	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
+	    src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
+	    dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
+	    for (i = 0; i < DCTSIZE; i++)
+	      for (j = 0; j < DCTSIZE; j++)
+		dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+	  }
+	}
+      }
+    }
+  }
+}
+
+
+LOCAL(void)
+do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	   jvirt_barray_ptr *src_coef_arrays,
+	   jvirt_barray_ptr *dst_coef_arrays)
+/* 90 degree rotation is equivalent to
+ *   1. Transposing the image;
+ *   2. Horizontal mirroring.
+ * These two steps are merged into a single processing routine.
+ */
+{
+  JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y;
+  int ci, i, j, offset_x, offset_y;
+  JBLOCKARRAY src_buffer, dst_buffer;
+  JCOEFPTR src_ptr, dst_ptr;
+  jpeg_component_info *compptr;
+
+  /* Because of the horizontal mirror step, we can't process partial iMCUs
+   * at the (output) right edge properly.  They just get transposed and
+   * not mirrored.
+   */
+  MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
+
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    compptr = dstinfo->comp_info + ci;
+    comp_width = MCU_cols * compptr->h_samp_factor;
+    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+	 dst_blk_y += compptr->v_samp_factor) {
+      dst_buffer = (*srcinfo->mem->access_virt_barray)
+	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
+	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+	     dst_blk_x += compptr->h_samp_factor) {
+	  src_buffer = (*srcinfo->mem->access_virt_barray)
+	    ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
+	     (JDIMENSION) compptr->h_samp_factor, FALSE);
+	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
+	    src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
+	    if (dst_blk_x < comp_width) {
+	      /* Block is within the mirrorable area. */
+	      dst_ptr = dst_buffer[offset_y]
+		[comp_width - dst_blk_x - offset_x - 1];
+	      for (i = 0; i < DCTSIZE; i++) {
+		for (j = 0; j < DCTSIZE; j++)
+		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+		i++;
+		for (j = 0; j < DCTSIZE; j++)
+		  dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];
+	      }
+	    } else {
+	      /* Edge blocks are transposed but not mirrored. */
+	      dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
+	      for (i = 0; i < DCTSIZE; i++)
+		for (j = 0; j < DCTSIZE; j++)
+		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+	    }
+	  }
+	}
+      }
+    }
+  }
+}
+
+
+LOCAL(void)
+do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	    jvirt_barray_ptr *src_coef_arrays,
+	    jvirt_barray_ptr *dst_coef_arrays)
+/* 270 degree rotation is equivalent to
+ *   1. Horizontal mirroring;
+ *   2. Transposing the image.
+ * These two steps are merged into a single processing routine.
+ */
+{
+  JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y;
+  int ci, i, j, offset_x, offset_y;
+  JBLOCKARRAY src_buffer, dst_buffer;
+  JCOEFPTR src_ptr, dst_ptr;
+  jpeg_component_info *compptr;
+
+  /* Because of the horizontal mirror step, we can't process partial iMCUs
+   * at the (output) bottom edge properly.  They just get transposed and
+   * not mirrored.
+   */
+  MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
+
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    compptr = dstinfo->comp_info + ci;
+    comp_height = MCU_rows * compptr->v_samp_factor;
+    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+	 dst_blk_y += compptr->v_samp_factor) {
+      dst_buffer = (*srcinfo->mem->access_virt_barray)
+	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
+	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+	     dst_blk_x += compptr->h_samp_factor) {
+	  src_buffer = (*srcinfo->mem->access_virt_barray)
+	    ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
+	     (JDIMENSION) compptr->h_samp_factor, FALSE);
+	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
+	    dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
+	    if (dst_blk_y < comp_height) {
+	      /* Block is within the mirrorable area. */
+	      src_ptr = src_buffer[offset_x]
+		[comp_height - dst_blk_y - offset_y - 1];
+	      for (i = 0; i < DCTSIZE; i++) {
+		for (j = 0; j < DCTSIZE; j++) {
+		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+		  j++;
+		  dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];
+		}
+	      }
+	    } else {
+	      /* Edge blocks are transposed but not mirrored. */
+	      src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
+	      for (i = 0; i < DCTSIZE; i++)
+		for (j = 0; j < DCTSIZE; j++)
+		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+	    }
+	  }
+	}
+      }
+    }
+  }
+}
+
+
+LOCAL(void)
+do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	    jvirt_barray_ptr *src_coef_arrays,
+	    jvirt_barray_ptr *dst_coef_arrays)
+/* 180 degree rotation is equivalent to
+ *   1. Vertical mirroring;
+ *   2. Horizontal mirroring.
+ * These two steps are merged into a single processing routine.
+ */
+{
+  JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;
+  int ci, i, j, offset_y;
+  JBLOCKARRAY src_buffer, dst_buffer;
+  JBLOCKROW src_row_ptr, dst_row_ptr;
+  JCOEFPTR src_ptr, dst_ptr;
+  jpeg_component_info *compptr;
+
+  MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
+  MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
+
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    compptr = dstinfo->comp_info + ci;
+    comp_width = MCU_cols * compptr->h_samp_factor;
+    comp_height = MCU_rows * compptr->v_samp_factor;
+    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+	 dst_blk_y += compptr->v_samp_factor) {
+      dst_buffer = (*srcinfo->mem->access_virt_barray)
+	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
+	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+      if (dst_blk_y < comp_height) {
+	/* Row is within the vertically mirrorable area. */
+	src_buffer = (*srcinfo->mem->access_virt_barray)
+	  ((j_common_ptr) srcinfo, src_coef_arrays[ci],
+	   comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor,
+	   (JDIMENSION) compptr->v_samp_factor, FALSE);
+      } else {
+	/* Bottom-edge rows are only mirrored horizontally. */
+	src_buffer = (*srcinfo->mem->access_virt_barray)
+	  ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y,
+	   (JDIMENSION) compptr->v_samp_factor, FALSE);
+      }
+      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+	if (dst_blk_y < comp_height) {
+	  /* Row is within the mirrorable area. */
+	  dst_row_ptr = dst_buffer[offset_y];
+	  src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1];
+	  /* Process the blocks that can be mirrored both ways. */
+	  for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) {
+	    dst_ptr = dst_row_ptr[dst_blk_x];
+	    src_ptr = src_row_ptr[comp_width - dst_blk_x - 1];
+	    for (i = 0; i < DCTSIZE; i += 2) {
+	      /* For even row, negate every odd column. */
+	      for (j = 0; j < DCTSIZE; j += 2) {
+		*dst_ptr++ = *src_ptr++;
+		*dst_ptr++ = - *src_ptr++;
+	      }
+	      /* For odd row, negate every even column. */
+	      for (j = 0; j < DCTSIZE; j += 2) {
+		*dst_ptr++ = - *src_ptr++;
+		*dst_ptr++ = *src_ptr++;
+	      }
+	    }
+	  }
+	  /* Any remaining right-edge blocks are only mirrored vertically. */
+	  for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
+	    dst_ptr = dst_row_ptr[dst_blk_x];
+	    src_ptr = src_row_ptr[dst_blk_x];
+	    for (i = 0; i < DCTSIZE; i += 2) {
+	      for (j = 0; j < DCTSIZE; j++)
+		*dst_ptr++ = *src_ptr++;
+	      for (j = 0; j < DCTSIZE; j++)
+		*dst_ptr++ = - *src_ptr++;
+	    }
+	  }
+	} else {
+	  /* Remaining rows are just mirrored horizontally. */
+	  dst_row_ptr = dst_buffer[offset_y];
+	  src_row_ptr = src_buffer[offset_y];
+	  /* Process the blocks that can be mirrored. */
+	  for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) {
+	    dst_ptr = dst_row_ptr[dst_blk_x];
+	    src_ptr = src_row_ptr[comp_width - dst_blk_x - 1];
+	    for (i = 0; i < DCTSIZE2; i += 2) {
+	      *dst_ptr++ = *src_ptr++;
+	      *dst_ptr++ = - *src_ptr++;
+	    }
+	  }
+	  /* Any remaining right-edge blocks are only copied. */
+	  for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
+	    dst_ptr = dst_row_ptr[dst_blk_x];
+	    src_ptr = src_row_ptr[dst_blk_x];
+	    for (i = 0; i < DCTSIZE2; i++)
+	      *dst_ptr++ = *src_ptr++;
+	  }
+	}
+      }
+    }
+  }
+}
+
+
+LOCAL(void)
+do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	       jvirt_barray_ptr *src_coef_arrays,
+	       jvirt_barray_ptr *dst_coef_arrays)
+/* Transverse transpose is equivalent to
+ *   1. 180 degree rotation;
+ *   2. Transposition;
+ * or
+ *   1. Horizontal mirroring;
+ *   2. Transposition;
+ *   3. Horizontal mirroring.
+ * These steps are merged into a single processing routine.
+ */
+{
+  JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;
+  int ci, i, j, offset_x, offset_y;
+  JBLOCKARRAY src_buffer, dst_buffer;
+  JCOEFPTR src_ptr, dst_ptr;
+  jpeg_component_info *compptr;
+
+  MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
+  MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
+
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    compptr = dstinfo->comp_info + ci;
+    comp_width = MCU_cols * compptr->h_samp_factor;
+    comp_height = MCU_rows * compptr->v_samp_factor;
+    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+	 dst_blk_y += compptr->v_samp_factor) {
+      dst_buffer = (*srcinfo->mem->access_virt_barray)
+	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
+	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+	     dst_blk_x += compptr->h_samp_factor) {
+	  src_buffer = (*srcinfo->mem->access_virt_barray)
+	    ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
+	     (JDIMENSION) compptr->h_samp_factor, FALSE);
+	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
+	    if (dst_blk_y < comp_height) {
+	      src_ptr = src_buffer[offset_x]
+		[comp_height - dst_blk_y - offset_y - 1];
+	      if (dst_blk_x < comp_width) {
+		/* Block is within the mirrorable area. */
+		dst_ptr = dst_buffer[offset_y]
+		  [comp_width - dst_blk_x - offset_x - 1];
+		for (i = 0; i < DCTSIZE; i++) {
+		  for (j = 0; j < DCTSIZE; j++) {
+		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+		    j++;
+		    dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];
+		  }
+		  i++;
+		  for (j = 0; j < DCTSIZE; j++) {
+		    dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];
+		    j++;
+		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+		  }
+		}
+	      } else {
+		/* Right-edge blocks are mirrored in y only */
+		dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
+		for (i = 0; i < DCTSIZE; i++) {
+		  for (j = 0; j < DCTSIZE; j++) {
+		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+		    j++;
+		    dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];
+		  }
+		}
+	      }
+	    } else {
+	      src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
+	      if (dst_blk_x < comp_width) {
+		/* Bottom-edge blocks are mirrored in x only */
+		dst_ptr = dst_buffer[offset_y]
+		  [comp_width - dst_blk_x - offset_x - 1];
+		for (i = 0; i < DCTSIZE; i++) {
+		  for (j = 0; j < DCTSIZE; j++)
+		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+		  i++;
+		  for (j = 0; j < DCTSIZE; j++)
+		    dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];
+		}
+	      } else {
+		/* At lower right corner, just transpose, no mirroring */
+		dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
+		for (i = 0; i < DCTSIZE; i++)
+		  for (j = 0; j < DCTSIZE; j++)
+		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+	      }
+	    }
+	  }
+	}
+      }
+    }
+  }
+}
+
+
+/* Request any required workspace.
+ *
+ * We allocate the workspace virtual arrays from the source decompression
+ * object, so that all the arrays (both the original data and the workspace)
+ * will be taken into account while making memory management decisions.
+ * Hence, this routine must be called after jpeg_read_header (which reads
+ * the image dimensions) and before jpeg_read_coefficients (which realizes
+ * the source's virtual arrays).
+ */
+
+GLOBAL(void)
+jtransform_request_workspace (j_decompress_ptr srcinfo,
+			      jpeg_transform_info *info)
+{
+  jvirt_barray_ptr *coef_arrays = NULL;
+  jpeg_component_info *compptr;
+  int ci;
+
+  if (info->force_grayscale &&
+      srcinfo->jpeg_color_space == JCS_YCbCr &&
+      srcinfo->num_components == 3) {
+    /* We'll only process the first component */
+    info->num_components = 1;
+  } else {
+    /* Process all the components */
+    info->num_components = srcinfo->num_components;
+  }
+
+  switch (info->transform) {
+  case JXFORM_NONE:
+  case JXFORM_FLIP_H:
+    /* Don't need a workspace array */
+    break;
+  case JXFORM_FLIP_V:
+  case JXFORM_ROT_180:
+    /* Need workspace arrays having same dimensions as source image.
+     * Note that we allocate arrays padded out to the next iMCU boundary,
+     * so that transform routines need not worry about missing edge blocks.
+     */
+    coef_arrays = (jvirt_barray_ptr *)
+      (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE,
+	SIZEOF(jvirt_barray_ptr) * info->num_components);
+    for (ci = 0; ci < info->num_components; ci++) {
+      compptr = srcinfo->comp_info + ci;
+      coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
+	((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE,
+	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
+				(long) compptr->h_samp_factor),
+	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
+				(long) compptr->v_samp_factor),
+	 (JDIMENSION) compptr->v_samp_factor);
+    }
+    break;
+  case JXFORM_TRANSPOSE:
+  case JXFORM_TRANSVERSE:
+  case JXFORM_ROT_90:
+  case JXFORM_ROT_270:
+    /* Need workspace arrays having transposed dimensions.
+     * Note that we allocate arrays padded out to the next iMCU boundary,
+     * so that transform routines need not worry about missing edge blocks.
+     */
+    coef_arrays = (jvirt_barray_ptr *)
+      (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE,
+	SIZEOF(jvirt_barray_ptr) * info->num_components);
+    for (ci = 0; ci < info->num_components; ci++) {
+      compptr = srcinfo->comp_info + ci;
+      coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
+	((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE,
+	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
+				(long) compptr->v_samp_factor),
+	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
+				(long) compptr->h_samp_factor),
+	 (JDIMENSION) compptr->h_samp_factor);
+    }
+    break;
+  }
+  info->workspace_coef_arrays = coef_arrays;
+}
+
+
+/* Transpose destination image parameters */
+
+LOCAL(void)
+transpose_critical_parameters (j_compress_ptr dstinfo)
+{
+  int tblno, i, j, ci, itemp;
+  jpeg_component_info *compptr;
+  JQUANT_TBL *qtblptr;
+  JDIMENSION dtemp;
+  UINT16 qtemp;
+
+  /* Transpose basic image dimensions */
+  dtemp = dstinfo->image_width;
+  dstinfo->image_width = dstinfo->image_height;
+  dstinfo->image_height = dtemp;
+
+  /* Transpose sampling factors */
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    compptr = dstinfo->comp_info + ci;
+    itemp = compptr->h_samp_factor;
+    compptr->h_samp_factor = compptr->v_samp_factor;
+    compptr->v_samp_factor = itemp;
+  }
+
+  /* Transpose quantization tables */
+  for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
+    qtblptr = dstinfo->quant_tbl_ptrs[tblno];
+    if (qtblptr != NULL) {
+      for (i = 0; i < DCTSIZE; i++) {
+	for (j = 0; j < i; j++) {
+	  qtemp = qtblptr->quantval[i*DCTSIZE+j];
+	  qtblptr->quantval[i*DCTSIZE+j] = qtblptr->quantval[j*DCTSIZE+i];
+	  qtblptr->quantval[j*DCTSIZE+i] = qtemp;
+	}
+      }
+    }
+  }
+}
+
+
+/* Trim off any partial iMCUs on the indicated destination edge */
+
+LOCAL(void)
+trim_right_edge (j_compress_ptr dstinfo)
+{
+  int ci, max_h_samp_factor;
+  JDIMENSION MCU_cols;
+
+  /* We have to compute max_h_samp_factor ourselves,
+   * because it hasn't been set yet in the destination
+   * (and we don't want to use the source's value).
+   */
+  max_h_samp_factor = 1;
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    int h_samp_factor = dstinfo->comp_info[ci].h_samp_factor;
+    max_h_samp_factor = MAX(max_h_samp_factor, h_samp_factor);
+  }
+  MCU_cols = dstinfo->image_width / (max_h_samp_factor * DCTSIZE);
+  if (MCU_cols > 0)		/* can't trim to 0 pixels */
+    dstinfo->image_width = MCU_cols * (max_h_samp_factor * DCTSIZE);
+}
+
+LOCAL(void)
+trim_bottom_edge (j_compress_ptr dstinfo)
+{
+  int ci, max_v_samp_factor;
+  JDIMENSION MCU_rows;
+
+  /* We have to compute max_v_samp_factor ourselves,
+   * because it hasn't been set yet in the destination
+   * (and we don't want to use the source's value).
+   */
+  max_v_samp_factor = 1;
+  for (ci = 0; ci < dstinfo->num_components; ci++) {
+    int v_samp_factor = dstinfo->comp_info[ci].v_samp_factor;
+    max_v_samp_factor = MAX(max_v_samp_factor, v_samp_factor);
+  }
+  MCU_rows = dstinfo->image_height / (max_v_samp_factor * DCTSIZE);
+  if (MCU_rows > 0)		/* can't trim to 0 pixels */
+    dstinfo->image_height = MCU_rows * (max_v_samp_factor * DCTSIZE);
+}
+
+
+/* Adjust output image parameters as needed.
+ *
+ * This must be called after jpeg_copy_critical_parameters()
+ * and before jpeg_write_coefficients().
+ *
+ * The return value is the set of virtual coefficient arrays to be written
+ * (either the ones allocated by jtransform_request_workspace, or the
+ * original source data arrays).  The caller will need to pass this value
+ * to jpeg_write_coefficients().
+ */
+
+GLOBAL(jvirt_barray_ptr *)
+jtransform_adjust_parameters (j_decompress_ptr srcinfo,
+			      j_compress_ptr dstinfo,
+			      jvirt_barray_ptr *src_coef_arrays,
+			      jpeg_transform_info *info)
+{
+  /* If force-to-grayscale is requested, adjust destination parameters */
+  if (info->force_grayscale) {
+    /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed
+     * properly.  Among other things, the target h_samp_factor & v_samp_factor
+     * will get set to 1, which typically won't match the source.
+     * In fact we do this even if the source is already grayscale; that
+     * provides an easy way of coercing a grayscale JPEG with funny sampling
+     * factors to the customary 1,1.  (Some decoders fail on other factors.)
+     */
+    if ((dstinfo->jpeg_color_space == JCS_YCbCr &&
+	 dstinfo->num_components == 3) ||
+	(dstinfo->jpeg_color_space == JCS_GRAYSCALE &&
+	 dstinfo->num_components == 1)) {
+      /* We have to preserve the source's quantization table number. */
+      int sv_quant_tbl_no = dstinfo->comp_info[0].quant_tbl_no;
+      jpeg_set_colorspace(dstinfo, JCS_GRAYSCALE);
+      dstinfo->comp_info[0].quant_tbl_no = sv_quant_tbl_no;
+    } else {
+      /* Sorry, can't do it */
+      ERREXIT(dstinfo, JERR_CONVERSION_NOTIMPL);
+    }
+  }
+
+  /* Correct the destination's image dimensions etc if necessary */
+  switch (info->transform) {
+  case JXFORM_NONE:
+    /* Nothing to do */
+    break;
+  case JXFORM_FLIP_H:
+    if (info->trim)
+      trim_right_edge(dstinfo);
+    break;
+  case JXFORM_FLIP_V:
+    if (info->trim)
+      trim_bottom_edge(dstinfo);
+    break;
+  case JXFORM_TRANSPOSE:
+    transpose_critical_parameters(dstinfo);
+    /* transpose does NOT have to trim anything */
+    break;
+  case JXFORM_TRANSVERSE:
+    transpose_critical_parameters(dstinfo);
+    if (info->trim) {
+      trim_right_edge(dstinfo);
+      trim_bottom_edge(dstinfo);
+    }
+    break;
+  case JXFORM_ROT_90:
+    transpose_critical_parameters(dstinfo);
+    if (info->trim)
+      trim_right_edge(dstinfo);
+    break;
+  case JXFORM_ROT_180:
+    if (info->trim) {
+      trim_right_edge(dstinfo);
+      trim_bottom_edge(dstinfo);
+    }
+    break;
+  case JXFORM_ROT_270:
+    transpose_critical_parameters(dstinfo);
+    if (info->trim)
+      trim_bottom_edge(dstinfo);
+    break;
+  }
+
+  /* Return the appropriate output data set */
+  if (info->workspace_coef_arrays != NULL)
+    return info->workspace_coef_arrays;
+  return src_coef_arrays;
+}
+
+
+/* Execute the actual transformation, if any.
+ *
+ * This must be called *after* jpeg_write_coefficients, because it depends
+ * on jpeg_write_coefficients to have computed subsidiary values such as
+ * the per-component width and height fields in the destination object.
+ *
+ * Note that some transformations will modify the source data arrays!
+ */
+
+GLOBAL(void)
+jtransform_execute_transformation (j_decompress_ptr srcinfo,
+				   j_compress_ptr dstinfo,
+				   jvirt_barray_ptr *src_coef_arrays,
+				   jpeg_transform_info *info)
+{
+  jvirt_barray_ptr *dst_coef_arrays = info->workspace_coef_arrays;
+
+  switch (info->transform) {
+  case JXFORM_NONE:
+    break;
+  case JXFORM_FLIP_H:
+    do_flip_h(srcinfo, dstinfo, src_coef_arrays);
+    break;
+  case JXFORM_FLIP_V:
+    do_flip_v(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
+    break;
+  case JXFORM_TRANSPOSE:
+    do_transpose(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
+    break;
+  case JXFORM_TRANSVERSE:
+    do_transverse(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
+    break;
+  case JXFORM_ROT_90:
+    do_rot_90(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
+    break;
+  case JXFORM_ROT_180:
+    do_rot_180(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
+    break;
+  case JXFORM_ROT_270:
+    do_rot_270(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
+    break;
+  }
+}
+
+#endif /* TRANSFORMS_SUPPORTED */
+
+
+/* Setup decompression object to save desired markers in memory.
+ * This must be called before jpeg_read_header() to have the desired effect.
+ */
+
+GLOBAL(void)
+jcopy_markers_setup (j_decompress_ptr srcinfo, JCOPY_OPTION option)
+{
+#ifdef SAVE_MARKERS_SUPPORTED
+  int m;
+
+  /* Save comments except under NONE option */
+  if (option != JCOPYOPT_NONE) {
+    jpeg_save_markers(srcinfo, JPEG_COM, 0xFFFF);
+  }
+  /* Save all types of APPn markers iff ALL option */
+  if (option == JCOPYOPT_ALL) {
+    for (m = 0; m < 16; m++)
+      jpeg_save_markers(srcinfo, JPEG_APP0 + m, 0xFFFF);
+  }
+#endif /* SAVE_MARKERS_SUPPORTED */
+}
+
+/* Copy markers saved in the given source object to the destination object.
+ * This should be called just after jpeg_start_compress() or
+ * jpeg_write_coefficients().
+ * Note that those routines will have written the SOI, and also the
+ * JFIF APP0 or Adobe APP14 markers if selected.
+ */
+
+GLOBAL(void)
+jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+		       JCOPY_OPTION option)
+{
+  jpeg_saved_marker_ptr marker;
+
+  /* In the current implementation, we don't actually need to examine the
+   * option flag here; we just copy everything that got saved.
+   * But to avoid confusion, we do not output JFIF and Adobe APP14 markers
+   * if the encoder library already wrote one.
+   */
+  for (marker = srcinfo->marker_list; marker != NULL; marker = marker->next) {
+    if (dstinfo->write_JFIF_header &&
+	marker->marker == JPEG_APP0 &&
+	marker->data_length >= 5 &&
+	GETJOCTET(marker->data[0]) == 0x4A &&
+	GETJOCTET(marker->data[1]) == 0x46 &&
+	GETJOCTET(marker->data[2]) == 0x49 &&
+	GETJOCTET(marker->data[3]) == 0x46 &&
+	GETJOCTET(marker->data[4]) == 0)
+      continue;			/* reject duplicate JFIF */
+    if (dstinfo->write_Adobe_marker &&
+	marker->marker == JPEG_APP0+14 &&
+	marker->data_length >= 5 &&
+	GETJOCTET(marker->data[0]) == 0x41 &&
+	GETJOCTET(marker->data[1]) == 0x64 &&
+	GETJOCTET(marker->data[2]) == 0x6F &&
+	GETJOCTET(marker->data[3]) == 0x62 &&
+	GETJOCTET(marker->data[4]) == 0x65)
+      continue;			/* reject duplicate Adobe */
+#ifdef NEED_FAR_POINTERS
+    /* We could use jpeg_write_marker if the data weren't FAR... */
+    {
+      unsigned int i;
+      jpeg_write_m_header(dstinfo, marker->marker, marker->data_length);
+      for (i = 0; i < marker->data_length; i++)
+	jpeg_write_m_byte(dstinfo, marker->data[i]);
+    }
+#else
+    jpeg_write_marker(dstinfo, marker->marker,
+		      marker->data, marker->data_length);
+#endif
+  }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/transupp.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/transupp.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/transupp.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,135 @@
+/*
+ * transupp.h
+ *
+ * Copyright (C) 1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains declarations for image transformation routines and
+ * other utility code used by the jpegtran sample application.  These are
+ * NOT part of the core JPEG library.  But we keep these routines separate
+ * from jpegtran.c to ease the task of maintaining jpegtran-like programs
+ * that have other user interfaces.
+ *
+ * NOTE: all the routines declared here have very specific requirements
+ * about when they are to be executed during the reading and writing of the
+ * source and destination files.  See the comments in transupp.c, or see
+ * jpegtran.c for an example of correct usage.
+ */
+
+/* If you happen not to want the image transform support, disable it here */
+#ifndef TRANSFORMS_SUPPORTED
+#define TRANSFORMS_SUPPORTED 1		/* 0 disables transform code */
+#endif
+
+/* Short forms of external names for systems with brain-damaged linkers. */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jtransform_request_workspace		jTrRequest
+#define jtransform_adjust_parameters		jTrAdjust
+#define jtransform_execute_transformation	jTrExec
+#define jcopy_markers_setup			jCMrkSetup
+#define jcopy_markers_execute			jCMrkExec
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+
+/*
+ * Codes for supported types of image transformations.
+ */
+
+typedef enum {
+	JXFORM_NONE,		/* no transformation */
+	JXFORM_FLIP_H,		/* horizontal flip */
+	JXFORM_FLIP_V,		/* vertical flip */
+	JXFORM_TRANSPOSE,	/* transpose across UL-to-LR axis */
+	JXFORM_TRANSVERSE,	/* transpose across UR-to-LL axis */
+	JXFORM_ROT_90,		/* 90-degree clockwise rotation */
+	JXFORM_ROT_180,		/* 180-degree rotation */
+	JXFORM_ROT_270		/* 270-degree clockwise (or 90 ccw) */
+} JXFORM_CODE;
+
+/*
+ * Although rotating and flipping data expressed as DCT coefficients is not
+ * hard, there is an asymmetry in the JPEG format specification for images
+ * whose dimensions aren't multiples of the iMCU size.  The right and bottom
+ * image edges are padded out to the next iMCU boundary with junk data; but
+ * no padding is possible at the top and left edges.  If we were to flip
+ * the whole image including the pad data, then pad garbage would become
+ * visible at the top and/or left, and real pixels would disappear into the
+ * pad margins --- perhaps permanently, since encoders & decoders may not
+ * bother to preserve DCT blocks that appear to be completely outside the
+ * nominal image area.  So, we have to exclude any partial iMCUs from the
+ * basic transformation.
+ *
+ * Transpose is the only transformation that can handle partial iMCUs at the
+ * right and bottom edges completely cleanly.  flip_h can flip partial iMCUs
+ * at the bottom, but leaves any partial iMCUs at the right edge untouched.
+ * Similarly flip_v leaves any partial iMCUs at the bottom edge untouched.
+ * The other transforms are defined as combinations of these basic transforms
+ * and process edge blocks in a way that preserves the equivalence.
+ *
+ * The "trim" option causes untransformable partial iMCUs to be dropped;
+ * this is not strictly lossless, but it usually gives the best-looking
+ * result for odd-size images.  Note that when this option is active,
+ * the expected mathematical equivalences between the transforms may not hold.
+ * (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim
+ * followed by -rot 180 -trim trims both edges.)
+ *
+ * We also offer a "force to grayscale" option, which simply discards the
+ * chrominance channels of a YCbCr image.  This is lossless in the sense that
+ * the luminance channel is preserved exactly.  It's not the same kind of
+ * thing as the rotate/flip transformations, but it's convenient to handle it
+ * as part of this package, mainly because the transformation routines have to
+ * be aware of the option to know how many components to work on.
+ */
+
+typedef struct {
+  /* Options: set by caller */
+  JXFORM_CODE transform;	/* image transform operator */
+  boolean trim;			/* if TRUE, trim partial MCUs as needed */
+  boolean force_grayscale;	/* if TRUE, convert color image to grayscale */
+
+  /* Internal workspace: caller should not touch these */
+  int num_components;		/* # of components in workspace */
+  jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */
+} jpeg_transform_info;
+
+
+#if TRANSFORMS_SUPPORTED
+
+/* Request any required workspace */
+EXTERN(void) jtransform_request_workspace
+	JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info));
+/* Adjust output image parameters */
+EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters
+	JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	     jvirt_barray_ptr *src_coef_arrays,
+	     jpeg_transform_info *info));
+/* Execute the actual transformation, if any */
+EXTERN(void) jtransform_execute_transformation
+	JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	     jvirt_barray_ptr *src_coef_arrays,
+	     jpeg_transform_info *info));
+
+#endif /* TRANSFORMS_SUPPORTED */
+
+
+/*
+ * Support for copying optional markers from source to destination file.
+ */
+
+typedef enum {
+	JCOPYOPT_NONE,		/* copy no optional markers */
+	JCOPYOPT_COMMENTS,	/* copy only comment (COM) markers */
+	JCOPYOPT_ALL		/* copy all optional markers */
+} JCOPY_OPTION;
+
+#define JCOPYOPT_DEFAULT  JCOPYOPT_COMMENTS	/* recommended default */
+
+/* Setup decompression object to save desired markers in memory */
+EXTERN(void) jcopy_markers_setup
+	JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option));
+/* Copy markers saved in the given source object to the destination object */
+EXTERN(void) jcopy_markers_execute
+	JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+	     JCOPY_OPTION option));

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/usage.doc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/usage.doc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/usage.doc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,562 @@
+USAGE instructions for the Independent JPEG Group's JPEG software
+=================================================================
+
+This file describes usage of the JPEG conversion programs cjpeg and djpeg,
+as well as the utility programs jpegtran, rdjpgcom and wrjpgcom.  (See
+the other documentation files if you wish to use the JPEG library within
+your own programs.)
+
+If you are on a Unix machine you may prefer to read the Unix-style manual
+pages in files cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1.
+
+
+INTRODUCTION
+
+These programs implement JPEG image compression and decompression.  JPEG
+(pronounced "jay-peg") is a standardized compression method for full-color
+and gray-scale images.  JPEG is designed to handle "real-world" scenes,
+for example scanned photographs.  Cartoons, line drawings, and other
+non-realistic images are not JPEG's strong suit; on that sort of material
+you may get poor image quality and/or little compression.
+
+JPEG is lossy, meaning that the output image is not necessarily identical to
+the input image.  Hence you should not use JPEG if you have to have identical
+output bits.  However, on typical real-world images, very good compression
+levels can be obtained with no visible change, and amazingly high compression
+is possible if you can tolerate a low-quality image.  You can trade off image
+quality against file size by adjusting the compressor's "quality" setting.
+
+
+GENERAL USAGE
+
+We provide two programs, cjpeg to compress an image file into JPEG format,
+and djpeg to decompress a JPEG file back into a conventional image format.
+
+On Unix-like systems, you say:
+	cjpeg [switches] [imagefile] >jpegfile
+or
+	djpeg [switches] [jpegfile]  >imagefile
+The programs read the specified input file, or standard input if none is
+named.  They always write to standard output (with trace/error messages to
+standard error).  These conventions are handy for piping images between
+programs.
+
+On most non-Unix systems, you say:
+	cjpeg [switches] imagefile jpegfile
+or
+	djpeg [switches] jpegfile  imagefile
+i.e., both the input and output files are named on the command line.  This
+style is a little more foolproof, and it loses no functionality if you don't
+have pipes.  (You can get this style on Unix too, if you prefer, by defining
+TWO_FILE_COMMANDLINE when you compile the programs; see install.doc.)
+
+You can also say:
+	cjpeg [switches] -outfile jpegfile  imagefile
+or
+	djpeg [switches] -outfile imagefile  jpegfile
+This syntax works on all systems, so it is useful for scripts.
+
+The currently supported image file formats are: PPM (PBMPLUS color format),
+PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit
+format).  (RLE is supported only if the URT library is available.)
+cjpeg recognizes the input image format automatically, with the exception
+of some Targa-format files.  You have to tell djpeg which format to generate.
+
+JPEG files are in the defacto standard JFIF file format.  There are other,
+less widely used JPEG-based file formats, but we don't support them.
+
+All switch names may be abbreviated; for example, -grayscale may be written
+-gray or -gr.  Most of the "basic" switches can be abbreviated to as little as
+one letter.  Upper and lower case are equivalent (-BMP is the same as -bmp).
+British spellings are also accepted (e.g., -greyscale), though for brevity
+these are not mentioned below.
+
+
+CJPEG DETAILS
+
+The basic command line switches for cjpeg are:
+
+	-quality N	Scale quantization tables to adjust image quality.
+			Quality is 0 (worst) to 100 (best); default is 75.
+			(See below for more info.)
+
+	-grayscale	Create monochrome JPEG file from color input.
+			Be sure to use this switch when compressing a grayscale
+			BMP file, because cjpeg isn't bright enough to notice
+			whether a BMP file uses only shades of gray.  By
+			saying -grayscale, you'll get a smaller JPEG file that
+			takes less time to process.
+
+	-optimize	Perform optimization of entropy encoding parameters.
+			Without this, default encoding parameters are used.
+			-optimize usually makes the JPEG file a little smaller,
+			but cjpeg runs somewhat slower and needs much more
+			memory.  Image quality and speed of decompression are
+			unaffected by -optimize.
+
+	-progressive	Create progressive JPEG file (see below).
+
+	-targa		Input file is Targa format.  Targa files that contain
+			an "identification" field will not be automatically
+			recognized by cjpeg; for such files you must specify
+			-targa to make cjpeg treat the input as Targa format.
+			For most Targa files, you won't need this switch.
+
+The -quality switch lets you trade off compressed file size against quality of
+the reconstructed image: the higher the quality setting, the larger the JPEG
+file, and the closer the output image will be to the original input.  Normally
+you want to use the lowest quality setting (smallest file) that decompresses
+into something visually indistinguishable from the original image.  For this
+purpose the quality setting should be between 50 and 95; the default of 75 is
+often about right.  If you see defects at -quality 75, then go up 5 or 10
+counts at a time until you are happy with the output image.  (The optimal
+setting will vary from one image to another.)
+
+-quality 100 will generate a quantization table of all 1's, minimizing loss
+in the quantization step (but there is still information loss in subsampling,
+as well as roundoff error).  This setting is mainly of interest for
+experimental purposes.  Quality values above about 95 are NOT recommended for
+normal use; the compressed file size goes up dramatically for hardly any gain
+in output image quality.
+
+In the other direction, quality values below 50 will produce very small files
+of low image quality.  Settings around 5 to 10 might be useful in preparing an
+index of a large image library, for example.  Try -quality 2 (or so) for some
+amusing Cubist effects.  (Note: quality values below about 25 generate 2-byte
+quantization tables, which are considered optional in the JPEG standard.
+cjpeg emits a warning message when you give such a quality value, because some
+other JPEG programs may be unable to decode the resulting file.  Use -baseline
+if you need to ensure compatibility at low quality values.)
+
+The -progressive switch creates a "progressive JPEG" file.  In this type of
+JPEG file, the data is stored in multiple scans of increasing quality.  If the
+file is being transmitted over a slow communications link, the decoder can use
+the first scan to display a low-quality image very quickly, and can then
+improve the display with each subsequent scan.  The final image is exactly
+equivalent to a standard JPEG file of the same quality setting, and the total
+file size is about the same --- often a little smaller.  CAUTION: progressive
+JPEG is not yet widely implemented, so many decoders will be unable to view a
+progressive JPEG file at all.
+
+Switches for advanced users:
+
+	-dct int	Use integer DCT method (default).
+	-dct fast	Use fast integer DCT (less accurate).
+	-dct float	Use floating-point DCT method.
+			The float method is very slightly more accurate than
+			the int method, but is much slower unless your machine
+			has very fast floating-point hardware.  Also note that
+			results of the floating-point method may vary slightly
+			across machines, while the integer methods should give
+			the same results everywhere.  The fast integer method
+			is much less accurate than the other two.
+
+	-restart N	Emit a JPEG restart marker every N MCU rows, or every
+			N MCU blocks if "B" is attached to the number.
+			-restart 0 (the default) means no restart markers.
+
+	-smooth N	Smooth the input image to eliminate dithering noise.
+			N, ranging from 1 to 100, indicates the strength of
+			smoothing.  0 (the default) means no smoothing.
+
+	-maxmemory N	Set limit for amount of memory to use in processing
+			large images.  Value is in thousands of bytes, or
+			millions of bytes if "M" is attached to the number.
+			For example, -max 4m selects 4000000 bytes.  If more
+			space is needed, temporary files will be used.
+
+	-verbose	Enable debug printout.  More -v's give more printout.
+	or  -debug	Also, version information is printed at startup.
+
+The -restart option inserts extra markers that allow a JPEG decoder to
+resynchronize after a transmission error.  Without restart markers, any damage
+to a compressed file will usually ruin the image from the point of the error
+to the end of the image; with restart markers, the damage is usually confined
+to the portion of the image up to the next restart marker.  Of course, the
+restart markers occupy extra space.  We recommend -restart 1 for images that
+will be transmitted across unreliable networks such as Usenet.
+
+The -smooth option filters the input to eliminate fine-scale noise.  This is
+often useful when converting dithered images to JPEG: a moderate smoothing
+factor of 10 to 50 gets rid of dithering patterns in the input file, resulting
+in a smaller JPEG file and a better-looking image.  Too large a smoothing
+factor will visibly blur the image, however.
+
+Switches for wizards:
+
+	-baseline	Force baseline-compatible quantization tables to be
+			generated.  This clamps quantization values to 8 bits
+			even at low quality settings.  (This switch is poorly
+			named, since it does not ensure that the output is
+			actually baseline JPEG.  For example, you can use
+			-baseline and -progressive together.)
+
+	-qtables file	Use the quantization tables given in the specified
+			text file.
+
+	-qslots N[,...] Select which quantization table to use for each color
+			component.
+
+	-sample HxV[,...]  Set JPEG sampling factors for each color component.
+
+	-scans file	Use the scan script given in the specified text file.
+
+The "wizard" switches are intended for experimentation with JPEG.  If you
+don't know what you are doing, DON'T USE THEM.  These switches are documented
+further in the file wizard.doc.
+
+
+DJPEG DETAILS
+
+The basic command line switches for djpeg are:
+
+	-colors N	Reduce image to at most N colors.  This reduces the
+	or -quantize N	number of colors used in the output image, so that it
+			can be displayed on a colormapped display or stored in
+			a colormapped file format.  For example, if you have
+			an 8-bit display, you'd need to reduce to 256 or fewer
+			colors.  (-colors is the recommended name, -quantize
+			is provided only for backwards compatibility.)
+
+	-fast		Select recommended processing options for fast, low
+			quality output.  (The default options are chosen for
+			highest quality output.)  Currently, this is equivalent
+			to "-dct fast -nosmooth -onepass -dither ordered".
+
+	-grayscale	Force gray-scale output even if JPEG file is color.
+			Useful for viewing on monochrome displays; also,
+			djpeg runs noticeably faster in this mode.
+
+	-scale M/N	Scale the output image by a factor M/N.  Currently
+			the scale factor must be 1/1, 1/2, 1/4, or 1/8.
+			Scaling is handy if the image is larger than your
+			screen; also, djpeg runs much faster when scaling
+			down the output.
+
+	-bmp		Select BMP output format (Windows flavor).  8-bit
+			colormapped format is emitted if -colors or -grayscale
+			is specified, or if the JPEG file is gray-scale;
+			otherwise, 24-bit full-color format is emitted.
+
+	-gif		Select GIF output format.  Since GIF does not support
+			more than 256 colors, -colors 256 is assumed (unless
+			you specify a smaller number of colors).  If you
+			specify -fast, the default number of colors is 216.
+
+	-os2		Select BMP output format (OS/2 1.x flavor).  8-bit
+			colormapped format is emitted if -colors or -grayscale
+			is specified, or if the JPEG file is gray-scale;
+			otherwise, 24-bit full-color format is emitted.
+
+	-pnm		Select PBMPLUS (PPM/PGM) output format (this is the
+			default format).  PGM is emitted if the JPEG file is
+			gray-scale or if -grayscale is specified; otherwise
+			PPM is emitted.
+
+	-rle		Select RLE output format.  (Requires URT library.)
+
+	-targa		Select Targa output format.  Gray-scale format is
+			emitted if the JPEG file is gray-scale or if
+			-grayscale is specified; otherwise, colormapped format
+			is emitted if -colors is specified; otherwise, 24-bit
+			full-color format is emitted.
+
+Switches for advanced users:
+
+	-dct int	Use integer DCT method (default).
+	-dct fast	Use fast integer DCT (less accurate).
+	-dct float	Use floating-point DCT method.
+			The float method is very slightly more accurate than
+			the int method, but is much slower unless your machine
+			has very fast floating-point hardware.  Also note that
+			results of the floating-point method may vary slightly
+			across machines, while the integer methods should give
+			the same results everywhere.  The fast integer method
+			is much less accurate than the other two.
+
+	-dither fs	Use Floyd-Steinberg dithering in color quantization.
+	-dither ordered	Use ordered dithering in color quantization.
+	-dither none	Do not use dithering in color quantization.
+			By default, Floyd-Steinberg dithering is applied when
+			quantizing colors; this is slow but usually produces
+			the best results.  Ordered dither is a compromise
+			between speed and quality; no dithering is fast but
+			usually looks awful.  Note that these switches have
+			no effect unless color quantization is being done.
+			Ordered dither is only available in -onepass mode.
+
+	-map FILE	Quantize to the colors used in the specified image
+			file.  This is useful for producing multiple files
+			with identical color maps, or for forcing a predefined
+			set of colors to be used.  The FILE must be a GIF
+			or PPM file.  This option overrides -colors and
+			-onepass.
+
+	-nosmooth	Use a faster, lower-quality upsampling routine.
+
+	-onepass	Use one-pass instead of two-pass color quantization.
+			The one-pass method is faster and needs less memory,
+			but it produces a lower-quality image.  -onepass is
+			ignored unless you also say -colors N.  Also,
+			the one-pass method is always used for gray-scale
+			output (the two-pass method is no improvement then).
+
+	-maxmemory N	Set limit for amount of memory to use in processing
+			large images.  Value is in thousands of bytes, or
+			millions of bytes if "M" is attached to the number.
+			For example, -max 4m selects 4000000 bytes.  If more
+			space is needed, temporary files will be used.
+
+	-verbose	Enable debug printout.  More -v's give more printout.
+	or  -debug	Also, version information is printed at startup.
+
+
+HINTS FOR CJPEG
+
+Color GIF files are not the ideal input for JPEG; JPEG is really intended for
+compressing full-color (24-bit) images.  In particular, don't try to convert
+cartoons, line drawings, and other images that have only a few distinct
+colors.  GIF works great on these, JPEG does not.  If you want to convert a
+GIF to JPEG, you should experiment with cjpeg's -quality and -smooth options
+to get a satisfactory conversion.  -smooth 10 or so is often helpful.
+
+Avoid running an image through a series of JPEG compression/decompression
+cycles.  Image quality loss will accumulate; after ten or so cycles the image
+may be noticeably worse than it was after one cycle.  It's best to use a
+lossless format while manipulating an image, then convert to JPEG format when
+you are ready to file the image away.
+
+The -optimize option to cjpeg is worth using when you are making a "final"
+version for posting or archiving.  It's also a win when you are using low
+quality settings to make very small JPEG files; the percentage improvement
+is often a lot more than it is on larger files.  (At present, -optimize
+mode is always selected when generating progressive JPEG files.)
+
+GIF input files are no longer supported, to avoid the Unisys LZW patent.
+Use a Unisys-licensed program if you need to read a GIF file.  (Conversion
+of GIF files to JPEG is usually a bad idea anyway.)
+
+
+HINTS FOR DJPEG
+
+To get a quick preview of an image, use the -grayscale and/or -scale switches.
+"-grayscale -scale 1/8" is the fastest case.
+
+Several options are available that trade off image quality to gain speed.
+"-fast" turns on the recommended settings.
+
+"-dct fast" and/or "-nosmooth" gain speed at a small sacrifice in quality.
+When producing a color-quantized image, "-onepass -dither ordered" is fast but
+much lower quality than the default behavior.  "-dither none" may give
+acceptable results in two-pass mode, but is seldom tolerable in one-pass mode.
+
+If you are fortunate enough to have very fast floating point hardware,
+"-dct float" may be even faster than "-dct fast".  But on most machines
+"-dct float" is slower than "-dct int"; in this case it is not worth using,
+because its theoretical accuracy advantage is too small to be significant
+in practice.
+
+Two-pass color quantization requires a good deal of memory; on MS-DOS machines
+it may run out of memory even with -maxmemory 0.  In that case you can still
+decompress, with some loss of image quality, by specifying -onepass for
+one-pass quantization.
+
+To avoid the Unisys LZW patent, djpeg produces uncompressed GIF files.  These
+are larger than they should be, but are readable by standard GIF decoders.
+
+
+HINTS FOR BOTH PROGRAMS
+
+If more space is needed than will fit in the available main memory (as
+determined by -maxmemory), temporary files will be used.  (MS-DOS versions
+will try to get extended or expanded memory first.)  The temporary files are
+often rather large: in typical cases they occupy three bytes per pixel, for
+example 3*800*600 = 1.44Mb for an 800x600 image.  If you don't have enough
+free disk space, leave out -progressive and -optimize (for cjpeg) or specify
+-onepass (for djpeg).
+
+On MS-DOS, the temporary files are created in the directory named by the TMP
+or TEMP environment variable, or in the current directory if neither of those
+exist.  Amiga implementations put the temp files in the directory named by
+JPEGTMP:, so be sure to assign JPEGTMP: to a disk partition with adequate free
+space.
+
+The default memory usage limit (-maxmemory) is set when the software is
+compiled.  If you get an "insufficient memory" error, try specifying a smaller
+-maxmemory value, even -maxmemory 0 to use the absolute minimum space.  You
+may want to recompile with a smaller default value if this happens often.
+
+On machines that have "environment" variables, you can define the environment
+variable JPEGMEM to set the default memory limit.  The value is specified as
+described for the -maxmemory switch.  JPEGMEM overrides the default value
+specified when the program was compiled, and itself is overridden by an
+explicit -maxmemory switch.
+
+On MS-DOS machines, -maxmemory is the amount of main (conventional) memory to
+use.  (Extended or expanded memory is also used if available.)  Most
+DOS-specific versions of this software do their own memory space estimation
+and do not need you to specify -maxmemory.
+
+
+JPEGTRAN
+
+jpegtran performs various useful transformations of JPEG files.
+It can translate the coded representation from one variant of JPEG to another,
+for example from baseline JPEG to progressive JPEG or vice versa.  It can also
+perform some rearrangements of the image data, for example turning an image
+from landscape to portrait format by rotation.
+
+jpegtran works by rearranging the compressed data (DCT coefficients), without
+ever fully decoding the image.  Therefore, its transformations are lossless:
+there is no image degradation at all, which would not be true if you used
+djpeg followed by cjpeg to accomplish the same conversion.  But by the same
+token, jpegtran cannot perform lossy operations such as changing the image
+quality.
+
+jpegtran uses a command line syntax similar to cjpeg or djpeg.
+On Unix-like systems, you say:
+	jpegtran [switches] [inputfile] >outputfile
+On most non-Unix systems, you say:
+	jpegtran [switches] inputfile outputfile
+where both the input and output files are JPEG files.
+
+To specify the coded JPEG representation used in the output file,
+jpegtran accepts a subset of the switches recognized by cjpeg:
+	-optimize	Perform optimization of entropy encoding parameters.
+	-progressive	Create progressive JPEG file.
+	-restart N	Emit a JPEG restart marker every N MCU rows, or every
+			N MCU blocks if "B" is attached to the number.
+	-scans file	Use the scan script given in the specified text file.
+See the previous discussion of cjpeg for more details about these switches.
+If you specify none of these switches, you get a plain baseline-JPEG output
+file.  The quality setting and so forth are determined by the input file.
+
+The image can be losslessly transformed by giving one of these switches:
+	-flip horizontal	Mirror image horizontally (left-right).
+	-flip vertical		Mirror image vertically (top-bottom).
+	-rotate 90		Rotate image 90 degrees clockwise.
+	-rotate 180		Rotate image 180 degrees.
+	-rotate 270		Rotate image 270 degrees clockwise (or 90 ccw).
+	-transpose		Transpose image (across UL-to-LR axis).
+	-transverse		Transverse transpose (across UR-to-LL axis).
+
+The transpose transformation has no restrictions regarding image dimensions.
+The other transformations operate rather oddly if the image dimensions are not
+a multiple of the iMCU size (usually 8 or 16 pixels), because they can only
+transform complete blocks of DCT coefficient data in the desired way.
+
+jpegtran's default behavior when transforming an odd-size image is designed
+to preserve exact reversibility and mathematical consistency of the
+transformation set.  As stated, transpose is able to flip the entire image
+area.  Horizontal mirroring leaves any partial iMCU column at the right edge
+untouched, but is able to flip all rows of the image.  Similarly, vertical
+mirroring leaves any partial iMCU row at the bottom edge untouched, but is
+able to flip all columns.  The other transforms can be built up as sequences
+of transpose and flip operations; for consistency, their actions on edge
+pixels are defined to be the same as the end result of the corresponding
+transpose-and-flip sequence.
+
+For practical use, you may prefer to discard any untransformable edge pixels
+rather than having a strange-looking strip along the right and/or bottom edges
+of a transformed image.  To do this, add the -trim switch:
+	-trim		Drop non-transformable edge blocks.
+Obviously, a transformation with -trim is not reversible, so strictly speaking
+jpegtran with this switch is not lossless.  Also, the expected mathematical
+equivalences between the transformations no longer hold.  For example,
+"-rot 270 -trim" trims only the bottom edge, but "-rot 90 -trim" followed by
+"-rot 180 -trim" trims both edges.
+
+Another not-strictly-lossless transformation switch is:
+	-grayscale	Force grayscale output.
+This option discards the chrominance channels if the input image is YCbCr
+(ie, a standard color JPEG), resulting in a grayscale JPEG file.  The
+luminance channel is preserved exactly, so this is a better method of reducing
+to grayscale than decompression, conversion, and recompression.  This switch
+is particularly handy for fixing a monochrome picture that was mistakenly
+encoded as a color JPEG.  (In such a case, the space savings from getting rid
+of the near-empty chroma channels won't be large; but the decoding time for
+a grayscale JPEG is substantially less than that for a color JPEG.)
+
+jpegtran also recognizes these switches that control what to do with "extra"
+markers, such as comment blocks:
+	-copy none	Copy no extra markers from source file.  This setting
+			suppresses all comments and other excess baggage
+			present in the source file.
+	-copy comments	Copy only comment markers.  This setting copies
+			comments from the source file, but discards
+			any other inessential data. 
+	-copy all	Copy all extra markers.  This setting preserves
+			miscellaneous markers found in the source file, such
+			as JFIF thumbnails and Photoshop settings.  In some
+			files these extra markers can be sizable.
+The default behavior is -copy comments.  (Note: in IJG releases v6 and v6a,
+jpegtran always did the equivalent of -copy none.)
+
+Additional switches recognized by jpegtran are:
+	-outfile filename
+	-maxmemory N
+	-verbose
+	-debug
+These work the same as in cjpeg or djpeg.
+
+
+THE COMMENT UTILITIES
+
+The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file.
+Although the standard doesn't actually define what COM blocks are for, they
+are widely used to hold user-supplied text strings.  This lets you add
+annotations, titles, index terms, etc to your JPEG files, and later retrieve
+them as text.  COM blocks do not interfere with the image stored in the JPEG
+file.  The maximum size of a COM block is 64K, but you can have as many of
+them as you like in one JPEG file.
+
+We provide two utility programs to display COM block contents and add COM
+blocks to a JPEG file.
+
+rdjpgcom searches a JPEG file and prints the contents of any COM blocks on
+standard output.  The command line syntax is
+	rdjpgcom [-verbose] [inputfilename]
+The switch "-verbose" (or just "-v") causes rdjpgcom to also display the JPEG
+image dimensions.  If you omit the input file name from the command line,
+the JPEG file is read from standard input.  (This may not work on some
+operating systems, if binary data can't be read from stdin.)
+
+wrjpgcom adds a COM block, containing text you provide, to a JPEG file.
+Ordinarily, the COM block is added after any existing COM blocks, but you
+can delete the old COM blocks if you wish.  wrjpgcom produces a new JPEG
+file; it does not modify the input file.  DO NOT try to overwrite the input
+file by directing wrjpgcom's output back into it; on most systems this will
+just destroy your file.
+
+The command line syntax for wrjpgcom is similar to cjpeg's.  On Unix-like
+systems, it is
+	wrjpgcom [switches] [inputfilename]
+The output file is written to standard output.  The input file comes from
+the named file, or from standard input if no input file is named.
+
+On most non-Unix systems, the syntax is
+	wrjpgcom [switches] inputfilename outputfilename
+where both input and output file names must be given explicitly.
+
+wrjpgcom understands three switches:
+	-replace		 Delete any existing COM blocks from the file.
+	-comment "Comment text"	 Supply new COM text on command line.
+	-cfile name		 Read text for new COM block from named file.
+(Switch names can be abbreviated.)  If you have only one line of comment text
+to add, you can provide it on the command line with -comment.  The comment
+text must be surrounded with quotes so that it is treated as a single
+argument.  Longer comments can be read from a text file.
+
+If you give neither -comment nor -cfile, then wrjpgcom will read the comment
+text from standard input.  (In this case an input image file name MUST be
+supplied, so that the source JPEG file comes from somewhere else.)  You can
+enter multiple lines, up to 64KB worth.  Type an end-of-file indicator
+(usually control-D or control-Z) to terminate the comment text entry.
+
+wrjpgcom will not add a COM block if the provided comment string is empty.
+Therefore -replace -comment "" can be used to delete all COM blocks from a
+file.
+
+These utility programs do not depend on the IJG JPEG library.  In
+particular, the source code for rdjpgcom is intended as an illustration of
+the minimum amount of code required to parse a JPEG file header correctly.

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/wizard.doc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/wizard.doc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/wizard.doc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,211 @@
+Advanced usage instructions for the Independent JPEG Group's JPEG software
+==========================================================================
+
+This file describes cjpeg's "switches for wizards".
+
+The "wizard" switches are intended for experimentation with JPEG by persons
+who are reasonably knowledgeable about the JPEG standard.  If you don't know
+what you are doing, DON'T USE THESE SWITCHES.  You'll likely produce files
+with worse image quality and/or poorer compression than you'd get from the
+default settings.  Furthermore, these switches must be used with caution
+when making files intended for general use, because not all JPEG decoders
+will support unusual JPEG parameter settings.
+
+
+Quantization Table Adjustment
+-----------------------------
+
+Ordinarily, cjpeg starts with a default set of tables (the same ones given
+as examples in the JPEG standard) and scales them up or down according to
+the -quality setting.  The details of the scaling algorithm can be found in
+jcparam.c.  At very low quality settings, some quantization table entries
+can get scaled up to values exceeding 255.  Although 2-byte quantization
+values are supported by the IJG software, this feature is not in baseline
+JPEG and is not supported by all implementations.  If you need to ensure
+wide compatibility of low-quality files, you can constrain the scaled
+quantization values to no more than 255 by giving the -baseline switch.
+Note that use of -baseline will result in poorer quality for the same file
+size, since more bits than necessary are expended on higher AC coefficients.
+
+You can substitute a different set of quantization values by using the
+-qtables switch:
+
+	-qtables file	Use the quantization tables given in the named file.
+
+The specified file should be a text file containing decimal quantization
+values.  The file should contain one to four tables, each of 64 elements.
+The tables are implicitly numbered 0,1,etc. in order of appearance.  Table
+entries appear in normal array order (NOT in the zigzag order in which they
+will be stored in the JPEG file).
+
+Quantization table files are free format, in that arbitrary whitespace can
+appear between numbers.  Also, comments can be included: a comment starts
+with '#' and extends to the end of the line.  Here is an example file that
+duplicates the default quantization tables:
+
+	# Quantization tables given in JPEG spec, section K.1
+
+	# This is table 0 (the luminance table):
+	  16  11  10  16  24  40  51  61
+	  12  12  14  19  26  58  60  55
+	  14  13  16  24  40  57  69  56
+	  14  17  22  29  51  87  80  62
+	  18  22  37  56  68 109 103  77
+	  24  35  55  64  81 104 113  92
+	  49  64  78  87 103 121 120 101
+	  72  92  95  98 112 100 103  99
+
+	# This is table 1 (the chrominance table):
+	  17  18  24  47  99  99  99  99
+	  18  21  26  66  99  99  99  99
+	  24  26  56  99  99  99  99  99
+	  47  66  99  99  99  99  99  99
+	  99  99  99  99  99  99  99  99
+	  99  99  99  99  99  99  99  99
+	  99  99  99  99  99  99  99  99
+	  99  99  99  99  99  99  99  99
+
+If the -qtables switch is used without -quality, then the specified tables
+are used exactly as-is.  If both -qtables and -quality are used, then the
+tables taken from the file are scaled in the same fashion that the default
+tables would be scaled for that quality setting.  If -baseline appears, then
+the quantization values are constrained to the range 1-255.
+
+By default, cjpeg will use quantization table 0 for luminance components and
+table 1 for chrominance components.  To override this choice, use the -qslots
+switch:
+
+	-qslots N[,...]		Select which quantization table to use for
+				each color component.
+
+The -qslots switch specifies a quantization table number for each color
+component, in the order in which the components appear in the JPEG SOF marker.
+For example, to create a separate table for each of Y,Cb,Cr, you could
+provide a -qtables file that defines three quantization tables and say
+"-qslots 0,1,2".  If -qslots gives fewer table numbers than there are color
+components, then the last table number is repeated as necessary.
+
+
+Sampling Factor Adjustment
+--------------------------
+
+By default, cjpeg uses 2:1 horizontal and vertical downsampling when
+compressing YCbCr data, and no downsampling for all other color spaces.
+You can override this default with the -sample switch:
+
+	-sample HxV[,...]	Set JPEG sampling factors for each color
+				component.
+
+The -sample switch specifies the JPEG sampling factors for each color
+component, in the order in which they appear in the JPEG SOF marker.
+If you specify fewer HxV pairs than there are components, the remaining
+components are set to 1x1 sampling.  For example, the default YCbCr setting
+is equivalent to "-sample 2x2,1x1,1x1", which can be abbreviated to
+"-sample 2x2".
+
+There are still some JPEG decoders in existence that support only 2x1
+sampling (also called 4:2:2 sampling).  Compatibility with such decoders can
+be achieved by specifying "-sample 2x1".  This is not recommended unless
+really necessary, since it increases file size and encoding/decoding time
+with very little quality gain.
+
+
+Multiple Scan / Progression Control
+-----------------------------------
+
+By default, cjpeg emits a single-scan sequential JPEG file.  The
+-progressive switch generates a progressive JPEG file using a default series
+of progression parameters.  You can create multiple-scan sequential JPEG
+files or progressive JPEG files with custom progression parameters by using
+the -scans switch:
+
+	-scans file	Use the scan sequence given in the named file.
+
+The specified file should be a text file containing a "scan script".
+The script specifies the contents and ordering of the scans to be emitted.
+Each entry in the script defines one scan.  A scan definition specifies
+the components to be included in the scan, and for progressive JPEG it also
+specifies the progression parameters Ss,Se,Ah,Al for the scan.  Scan
+definitions are separated by semicolons (';').  A semicolon after the last
+scan definition is optional.
+
+Each scan definition contains one to four component indexes, optionally
+followed by a colon (':') and the four progressive-JPEG parameters.  The
+component indexes denote which color component(s) are to be transmitted in
+the scan.  Components are numbered in the order in which they appear in the
+JPEG SOF marker, with the first component being numbered 0.  (Note that these
+indexes are not the "component ID" codes assigned to the components, just
+positional indexes.)
+
+The progression parameters for each scan are:
+	Ss	Zigzag index of first coefficient included in scan
+	Se	Zigzag index of last coefficient included in scan
+	Ah	Zero for first scan of a coefficient, else Al of prior scan
+	Al	Successive approximation low bit position for scan
+If the progression parameters are omitted, the values 0,63,0,0 are used,
+producing a sequential JPEG file.  cjpeg automatically determines whether
+the script represents a progressive or sequential file, by observing whether
+Ss and Se values other than 0 and 63 appear.  (The -progressive switch is
+not needed to specify this; in fact, it is ignored when -scans appears.)
+The scan script must meet the JPEG restrictions on progression sequences.
+(cjpeg checks that the spec's requirements are obeyed.)
+
+Scan script files are free format, in that arbitrary whitespace can appear
+between numbers and around punctuation.  Also, comments can be included: a
+comment starts with '#' and extends to the end of the line.  For additional
+legibility, commas or dashes can be placed between values.  (Actually, any
+single punctuation character other than ':' or ';' can be inserted.)  For
+example, the following two scan definitions are equivalent:
+	0 1 2: 0 63 0 0;
+	0,1,2 : 0-63, 0,0 ;
+
+Here is an example of a scan script that generates a partially interleaved
+sequential JPEG file:
+
+	0;			# Y only in first scan
+	1 2;			# Cb and Cr in second scan
+
+Here is an example of a progressive scan script using only spectral selection
+(no successive approximation):
+
+	# Interleaved DC scan for Y,Cb,Cr:
+	0,1,2: 0-0,   0, 0 ;
+	# AC scans:
+	0:     1-2,   0, 0 ;	# First two Y AC coefficients
+	0:     3-5,   0, 0 ;	# Three more
+	1:     1-63,  0, 0 ;	# All AC coefficients for Cb
+	2:     1-63,  0, 0 ;	# All AC coefficients for Cr
+	0:     6-9,   0, 0 ;	# More Y coefficients
+	0:     10-63, 0, 0 ;	# Remaining Y coefficients
+
+Here is an example of a successive-approximation script.  This is equivalent
+to the default script used by "cjpeg -progressive" for YCbCr images:
+
+	# Initial DC scan for Y,Cb,Cr (lowest bit not sent)
+	0,1,2: 0-0,   0, 1 ;
+	# First AC scan: send first 5 Y AC coefficients, minus 2 lowest bits:
+	0:     1-5,   0, 2 ;
+	# Send all Cr,Cb AC coefficients, minus lowest bit:
+	# (chroma data is usually too small to be worth subdividing further;
+	#  but note we send Cr first since eye is least sensitive to Cb)
+	2:     1-63,  0, 1 ;
+	1:     1-63,  0, 1 ;
+	# Send remaining Y AC coefficients, minus 2 lowest bits:
+	0:     6-63,  0, 2 ;
+	# Send next-to-lowest bit of all Y AC coefficients:
+	0:     1-63,  2, 1 ;
+	# At this point we've sent all but the lowest bit of all coefficients.
+	# Send lowest bit of DC coefficients
+	0,1,2: 0-0,   1, 0 ;
+	# Send lowest bit of AC coefficients
+	2:     1-63,  1, 0 ;
+	1:     1-63,  1, 0 ;
+	# Y AC lowest bit scan is last; it's usually the largest scan
+	0:     1-63,  1, 0 ;
+
+It may be worth pointing out that this script is tuned for quality settings
+of around 50 to 75.  For lower quality settings, you'd probably want to use
+a script with fewer stages of successive approximation (otherwise the
+initial scans will be really bad).  For higher quality settings, you might
+want to use more stages of successive approximation (so that the initial
+scans are not too large).

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/wrbmp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/wrbmp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/wrbmp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,442 @@
+/*
+ * wrbmp.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to write output images in Microsoft "BMP"
+ * format (MS Windows 3.x and OS/2 1.x flavors).
+ * Either 8-bit colormapped or 24-bit full-color format can be written.
+ * No compression is supported.
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications.  As they stand, they assume output to
+ * an ordinary stdio stream.
+ *
+ * This code contributed by James Arthur Boucher.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef BMP_SUPPORTED
+
+
+/*
+ * To support 12-bit JPEG data, we'd have to scale output down to 8 bits.
+ * This is not yet implemented.
+ */
+
+#if BITS_IN_JSAMPLE != 8
+  Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
+#endif
+
+/*
+ * Since BMP stores scanlines bottom-to-top, we have to invert the image
+ * from JPEG's top-to-bottom order.  To do this, we save the outgoing data
+ * in a virtual array during put_pixel_row calls, then actually emit the
+ * BMP file during finish_output.  The virtual array contains one JSAMPLE per
+ * pixel if the output is grayscale or colormapped, three if it is full color.
+ */
+
+/* Private version of data destination object */
+
+typedef struct {
+  struct djpeg_dest_struct pub;	/* public fields */
+
+  boolean is_os2;		/* saves the OS2 format request flag */
+
+  jvirt_sarray_ptr whole_image;	/* needed to reverse row order */
+  JDIMENSION data_width;	/* JSAMPLEs per row */
+  JDIMENSION row_width;		/* physical width of one row in the BMP file */
+  int pad_bytes;		/* number of padding bytes needed per row */
+  JDIMENSION cur_output_row;	/* next row# to write to virtual array */
+} bmp_dest_struct;
+
+typedef bmp_dest_struct * bmp_dest_ptr;
+
+
+/* Forward declarations */
+LOCAL(void) write_colormap
+	JPP((j_decompress_ptr cinfo, bmp_dest_ptr dest,
+	     int map_colors, int map_entry_size));
+
+
+/*
+ * Write some pixel data.
+ * In this module rows_supplied will always be 1.
+ */
+
+METHODDEF(void)
+put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+		JDIMENSION rows_supplied)
+/* This version is for writing 24-bit pixels */
+{
+  bmp_dest_ptr dest = (bmp_dest_ptr) dinfo;
+  JSAMPARRAY image_ptr;
+  register JSAMPROW inptr, outptr;
+  register JDIMENSION col;
+  int pad;
+
+  /* Access next row in virtual array */
+  image_ptr = (*cinfo->mem->access_virt_sarray)
+    ((j_common_ptr) cinfo, dest->whole_image,
+     dest->cur_output_row, (JDIMENSION) 1, TRUE);
+  dest->cur_output_row++;
+
+  /* Transfer data.  Note destination values must be in BGR order
+   * (even though Microsoft's own documents say the opposite).
+   */
+  inptr = dest->pub.buffer[0];
+  outptr = image_ptr[0];
+  for (col = cinfo->output_width; col > 0; col--) {
+    outptr[2] = *inptr++;	/* can omit GETJSAMPLE() safely */
+    outptr[1] = *inptr++;
+    outptr[0] = *inptr++;
+    outptr += 3;
+  }
+
+  /* Zero out the pad bytes. */
+  pad = dest->pad_bytes;
+  while (--pad >= 0)
+    *outptr++ = 0;
+}
+
+METHODDEF(void)
+put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+	       JDIMENSION rows_supplied)
+/* This version is for grayscale OR quantized color output */
+{
+  bmp_dest_ptr dest = (bmp_dest_ptr) dinfo;
+  JSAMPARRAY image_ptr;
+  register JSAMPROW inptr, outptr;
+  register JDIMENSION col;
+  int pad;
+
+  /* Access next row in virtual array */
+  image_ptr = (*cinfo->mem->access_virt_sarray)
+    ((j_common_ptr) cinfo, dest->whole_image,
+     dest->cur_output_row, (JDIMENSION) 1, TRUE);
+  dest->cur_output_row++;
+
+  /* Transfer data. */
+  inptr = dest->pub.buffer[0];
+  outptr = image_ptr[0];
+  for (col = cinfo->output_width; col > 0; col--) {
+    *outptr++ = *inptr++;	/* can omit GETJSAMPLE() safely */
+  }
+
+  /* Zero out the pad bytes. */
+  pad = dest->pad_bytes;
+  while (--pad >= 0)
+    *outptr++ = 0;
+}
+
+
+/*
+ * Startup: normally writes the file header.
+ * In this module we may as well postpone everything until finish_output.
+ */
+
+METHODDEF(void)
+start_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  /* no work here */
+}
+
+
+/*
+ * Finish up at the end of the file.
+ *
+ * Here is where we really output the BMP file.
+ *
+ * First, routines to write the Windows and OS/2 variants of the file header.
+ */
+
+LOCAL(void)
+write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest)
+/* Write a Windows-style BMP file header, including colormap if needed */
+{
+  char bmpfileheader[14];
+  char bmpinfoheader[40];
+#define PUT_2B(array,offset,value)  \
+	(array[offset] = (char) ((value) & 0xFF), \
+	 array[offset+1] = (char) (((value) >> 8) & 0xFF))
+#define PUT_4B(array,offset,value)  \
+	(array[offset] = (char) ((value) & 0xFF), \
+	 array[offset+1] = (char) (((value) >> 8) & 0xFF), \
+	 array[offset+2] = (char) (((value) >> 16) & 0xFF), \
+	 array[offset+3] = (char) (((value) >> 24) & 0xFF))
+  INT32 headersize, bfSize;
+  int bits_per_pixel, cmap_entries;
+
+  /* Compute colormap size and total file size */
+  if (cinfo->out_color_space == JCS_RGB) {
+    if (cinfo->quantize_colors) {
+      /* Colormapped RGB */
+      bits_per_pixel = 8;
+      cmap_entries = 256;
+    } else {
+      /* Unquantized, full color RGB */
+      bits_per_pixel = 24;
+      cmap_entries = 0;
+    }
+  } else {
+    /* Grayscale output.  We need to fake a 256-entry colormap. */
+    bits_per_pixel = 8;
+    cmap_entries = 256;
+  }
+  /* File size */
+  headersize = 14 + 40 + cmap_entries * 4; /* Header and colormap */
+  bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height;
+  
+  /* Set unused fields of header to 0 */
+  MEMZERO(bmpfileheader, SIZEOF(bmpfileheader));
+  MEMZERO(bmpinfoheader, SIZEOF(bmpinfoheader));
+
+  /* Fill the file header */
+  bmpfileheader[0] = 0x42;	/* first 2 bytes are ASCII 'B', 'M' */
+  bmpfileheader[1] = 0x4D;
+  PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */
+  /* we leave bfReserved1 & bfReserved2 = 0 */
+  PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */
+
+  /* Fill the info header (Microsoft calls this a BITMAPINFOHEADER) */
+  PUT_2B(bmpinfoheader, 0, 40);	/* biSize */
+  PUT_4B(bmpinfoheader, 4, cinfo->output_width); /* biWidth */
+  PUT_4B(bmpinfoheader, 8, cinfo->output_height); /* biHeight */
+  PUT_2B(bmpinfoheader, 12, 1);	/* biPlanes - must be 1 */
+  PUT_2B(bmpinfoheader, 14, bits_per_pixel); /* biBitCount */
+  /* we leave biCompression = 0, for none */
+  /* we leave biSizeImage = 0; this is correct for uncompressed data */
+  if (cinfo->density_unit == 2) { /* if have density in dots/cm, then */
+    PUT_4B(bmpinfoheader, 24, (INT32) (cinfo->X_density*100)); /* XPels/M */
+    PUT_4B(bmpinfoheader, 28, (INT32) (cinfo->Y_density*100)); /* XPels/M */
+  }
+  PUT_2B(bmpinfoheader, 32, cmap_entries); /* biClrUsed */
+  /* we leave biClrImportant = 0 */
+
+  if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14)
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+  if (JFWRITE(dest->pub.output_file, bmpinfoheader, 40) != (size_t) 40)
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+
+  if (cmap_entries > 0)
+    write_colormap(cinfo, dest, cmap_entries, 4);
+}
+
+
+LOCAL(void)
+write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest)
+/* Write an OS2-style BMP file header, including colormap if needed */
+{
+  char bmpfileheader[14];
+  char bmpcoreheader[12];
+  INT32 headersize, bfSize;
+  int bits_per_pixel, cmap_entries;
+
+  /* Compute colormap size and total file size */
+  if (cinfo->out_color_space == JCS_RGB) {
+    if (cinfo->quantize_colors) {
+      /* Colormapped RGB */
+      bits_per_pixel = 8;
+      cmap_entries = 256;
+    } else {
+      /* Unquantized, full color RGB */
+      bits_per_pixel = 24;
+      cmap_entries = 0;
+    }
+  } else {
+    /* Grayscale output.  We need to fake a 256-entry colormap. */
+    bits_per_pixel = 8;
+    cmap_entries = 256;
+  }
+  /* File size */
+  headersize = 14 + 12 + cmap_entries * 3; /* Header and colormap */
+  bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height;
+  
+  /* Set unused fields of header to 0 */
+  MEMZERO(bmpfileheader, SIZEOF(bmpfileheader));
+  MEMZERO(bmpcoreheader, SIZEOF(bmpcoreheader));
+
+  /* Fill the file header */
+  bmpfileheader[0] = 0x42;	/* first 2 bytes are ASCII 'B', 'M' */
+  bmpfileheader[1] = 0x4D;
+  PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */
+  /* we leave bfReserved1 & bfReserved2 = 0 */
+  PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */
+
+  /* Fill the info header (Microsoft calls this a BITMAPCOREHEADER) */
+  PUT_2B(bmpcoreheader, 0, 12);	/* bcSize */
+  PUT_2B(bmpcoreheader, 4, cinfo->output_width); /* bcWidth */
+  PUT_2B(bmpcoreheader, 6, cinfo->output_height); /* bcHeight */
+  PUT_2B(bmpcoreheader, 8, 1);	/* bcPlanes - must be 1 */
+  PUT_2B(bmpcoreheader, 10, bits_per_pixel); /* bcBitCount */
+
+  if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14)
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+  if (JFWRITE(dest->pub.output_file, bmpcoreheader, 12) != (size_t) 12)
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+
+  if (cmap_entries > 0)
+    write_colormap(cinfo, dest, cmap_entries, 3);
+}
+
+
+/*
+ * Write the colormap.
+ * Windows uses BGR0 map entries; OS/2 uses BGR entries.
+ */
+
+LOCAL(void)
+write_colormap (j_decompress_ptr cinfo, bmp_dest_ptr dest,
+		int map_colors, int map_entry_size)
+{
+  JSAMPARRAY colormap = cinfo->colormap;
+  int num_colors = cinfo->actual_number_of_colors;
+  FILE * outfile = dest->pub.output_file;
+  int i;
+
+  if (colormap != NULL) {
+    if (cinfo->out_color_components == 3) {
+      /* Normal case with RGB colormap */
+      for (i = 0; i < num_colors; i++) {
+	putc(GETJSAMPLE(colormap[2][i]), outfile);
+	putc(GETJSAMPLE(colormap[1][i]), outfile);
+	putc(GETJSAMPLE(colormap[0][i]), outfile);
+	if (map_entry_size == 4)
+	  putc(0, outfile);
+      }
+    } else {
+      /* Grayscale colormap (only happens with grayscale quantization) */
+      for (i = 0; i < num_colors; i++) {
+	putc(GETJSAMPLE(colormap[0][i]), outfile);
+	putc(GETJSAMPLE(colormap[0][i]), outfile);
+	putc(GETJSAMPLE(colormap[0][i]), outfile);
+	if (map_entry_size == 4)
+	  putc(0, outfile);
+      }
+    }
+  } else {
+    /* If no colormap, must be grayscale data.  Generate a linear "map". */
+    for (i = 0; i < 256; i++) {
+      putc(i, outfile);
+      putc(i, outfile);
+      putc(i, outfile);
+      if (map_entry_size == 4)
+	putc(0, outfile);
+    }
+  }
+  /* Pad colormap with zeros to ensure specified number of colormap entries */ 
+  if (i > map_colors)
+    ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, i);
+  for (; i < map_colors; i++) {
+    putc(0, outfile);
+    putc(0, outfile);
+    putc(0, outfile);
+    if (map_entry_size == 4)
+      putc(0, outfile);
+  }
+}
+
+
+METHODDEF(void)
+finish_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  bmp_dest_ptr dest = (bmp_dest_ptr) dinfo;
+  register FILE * outfile = dest->pub.output_file;
+  JSAMPARRAY image_ptr;
+  register JSAMPROW data_ptr;
+  JDIMENSION row;
+  register JDIMENSION col;
+  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+
+  /* Write the header and colormap */
+  if (dest->is_os2)
+    write_os2_header(cinfo, dest);
+  else
+    write_bmp_header(cinfo, dest);
+
+  /* Write the file body from our virtual array */
+  for (row = cinfo->output_height; row > 0; row--) {
+    if (progress != NULL) {
+      progress->pub.pass_counter = (long) (cinfo->output_height - row);
+      progress->pub.pass_limit = (long) cinfo->output_height;
+      (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+    }
+    image_ptr = (*cinfo->mem->access_virt_sarray)
+      ((j_common_ptr) cinfo, dest->whole_image, row-1, (JDIMENSION) 1, FALSE);
+    data_ptr = image_ptr[0];
+    for (col = dest->row_width; col > 0; col--) {
+      putc(GETJSAMPLE(*data_ptr), outfile);
+      data_ptr++;
+    }
+  }
+  if (progress != NULL)
+    progress->completed_extra_passes++;
+
+  /* Make sure we wrote the output file OK */
+  fflush(outfile);
+  if (ferror(outfile))
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+}
+
+
+/*
+ * The module selection routine for BMP format output.
+ */
+
+GLOBAL(djpeg_dest_ptr)
+jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2)
+{
+  bmp_dest_ptr dest;
+  JDIMENSION row_width;
+
+  /* Create module interface object, fill in method pointers */
+  dest = (bmp_dest_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(bmp_dest_struct));
+  dest->pub.start_output = start_output_bmp;
+  dest->pub.finish_output = finish_output_bmp;
+  dest->is_os2 = is_os2;
+
+  if (cinfo->out_color_space == JCS_GRAYSCALE) {
+    dest->pub.put_pixel_rows = put_gray_rows;
+  } else if (cinfo->out_color_space == JCS_RGB) {
+    if (cinfo->quantize_colors)
+      dest->pub.put_pixel_rows = put_gray_rows;
+    else
+      dest->pub.put_pixel_rows = put_pixel_rows;
+  } else {
+    ERREXIT(cinfo, JERR_BMP_COLORSPACE);
+  }
+
+  /* Calculate output image dimensions so we can allocate space */
+  jpeg_calc_output_dimensions(cinfo);
+
+  /* Determine width of rows in the BMP file (padded to 4-byte boundary). */
+  row_width = cinfo->output_width * cinfo->output_components;
+  dest->data_width = row_width;
+  while ((row_width & 3) != 0) row_width++;
+  dest->row_width = row_width;
+  dest->pad_bytes = (int) (row_width - dest->data_width);
+
+  /* Allocate space for inversion array, prepare for write pass */
+  dest->whole_image = (*cinfo->mem->request_virt_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+     row_width, cinfo->output_height, (JDIMENSION) 1);
+  dest->cur_output_row = 0;
+  if (cinfo->progress != NULL) {
+    cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+    progress->total_extra_passes++; /* count file input as separate pass */
+  }
+
+  /* Create decompressor output buffer. */
+  dest->pub.buffer = (*cinfo->mem->alloc_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, row_width, (JDIMENSION) 1);
+  dest->pub.buffer_height = 1;
+
+  return (djpeg_dest_ptr) dest;
+}
+
+#endif /* BMP_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/wrgif.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/wrgif.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/wrgif.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,399 @@
+/*
+ * wrgif.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to write output images in GIF format.
+ *
+ **************************************************************************
+ * NOTE: to avoid entanglements with Unisys' patent on LZW compression,   *
+ * this code has been modified to output "uncompressed GIF" files.        *
+ * There is no trace of the LZW algorithm in this file.                   *
+ **************************************************************************
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications.  As they stand, they assume output to
+ * an ordinary stdio stream.
+ */
+
+/*
+ * This code is loosely based on ppmtogif from the PBMPLUS distribution
+ * of Feb. 1991.  That file contains the following copyright notice:
+ *    Based on GIFENCODE by David Rowley <mgardi at watdscu.waterloo.edu>.
+ *    Lempel-Ziv compression based on "compress" by Spencer W. Thomas et al.
+ *    Copyright (C) 1989 by Jef Poskanzer.
+ *    Permission to use, copy, modify, and distribute this software and its
+ *    documentation for any purpose and without fee is hereby granted, provided
+ *    that the above copyright notice appear in all copies and that both that
+ *    copyright notice and this permission notice appear in supporting
+ *    documentation.  This software is provided "as is" without express or
+ *    implied warranty.
+ *
+ * We are also required to state that
+ *    "The Graphics Interchange Format(c) is the Copyright property of
+ *    CompuServe Incorporated. GIF(sm) is a Service Mark property of
+ *    CompuServe Incorporated."
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef GIF_SUPPORTED
+
+
+/* Private version of data destination object */
+
+typedef struct {
+  struct djpeg_dest_struct pub;	/* public fields */
+
+  j_decompress_ptr cinfo;	/* back link saves passing separate parm */
+
+  /* State for packing variable-width codes into a bitstream */
+  int n_bits;			/* current number of bits/code */
+  int maxcode;			/* maximum code, given n_bits */
+  INT32 cur_accum;		/* holds bits not yet output */
+  int cur_bits;			/* # of bits in cur_accum */
+
+  /* State for GIF code assignment */
+  int ClearCode;		/* clear code (doesn't change) */
+  int EOFCode;			/* EOF code (ditto) */
+  int code_counter;		/* counts output symbols */
+
+  /* GIF data packet construction buffer */
+  int bytesinpkt;		/* # of bytes in current packet */
+  char packetbuf[256];		/* workspace for accumulating packet */
+
+} gif_dest_struct;
+
+typedef gif_dest_struct * gif_dest_ptr;
+
+/* Largest value that will fit in N bits */
+#define MAXCODE(n_bits)	((1 << (n_bits)) - 1)
+
+
+/*
+ * Routines to package finished data bytes into GIF data blocks.
+ * A data block consists of a count byte (1..255) and that many data bytes.
+ */
+
+LOCAL(void)
+flush_packet (gif_dest_ptr dinfo)
+/* flush any accumulated data */
+{
+  if (dinfo->bytesinpkt > 0) {	/* never write zero-length packet */
+    dinfo->packetbuf[0] = (char) dinfo->bytesinpkt++;
+    if (JFWRITE(dinfo->pub.output_file, dinfo->packetbuf, dinfo->bytesinpkt)
+	!= (size_t) dinfo->bytesinpkt)
+      ERREXIT(dinfo->cinfo, JERR_FILE_WRITE);
+    dinfo->bytesinpkt = 0;
+  }
+}
+
+
+/* Add a character to current packet; flush to disk if necessary */
+#define CHAR_OUT(dinfo,c)  \
+	{ (dinfo)->packetbuf[++(dinfo)->bytesinpkt] = (char) (c);  \
+	    if ((dinfo)->bytesinpkt >= 255)  \
+	      flush_packet(dinfo);  \
+	}
+
+
+/* Routine to convert variable-width codes into a byte stream */
+
+LOCAL(void)
+output (gif_dest_ptr dinfo, int code)
+/* Emit a code of n_bits bits */
+/* Uses cur_accum and cur_bits to reblock into 8-bit bytes */
+{
+  dinfo->cur_accum |= ((INT32) code) << dinfo->cur_bits;
+  dinfo->cur_bits += dinfo->n_bits;
+
+  while (dinfo->cur_bits >= 8) {
+    CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF);
+    dinfo->cur_accum >>= 8;
+    dinfo->cur_bits -= 8;
+  }
+}
+
+
+/* The pseudo-compression algorithm.
+ *
+ * In this module we simply output each pixel value as a separate symbol;
+ * thus, no compression occurs.  In fact, there is expansion of one bit per
+ * pixel, because we use a symbol width one bit wider than the pixel width.
+ *
+ * GIF ordinarily uses variable-width symbols, and the decoder will expect
+ * to ratchet up the symbol width after a fixed number of symbols.
+ * To simplify the logic and keep the expansion penalty down, we emit a
+ * GIF Clear code to reset the decoder just before the width would ratchet up.
+ * Thus, all the symbols in the output file will have the same bit width.
+ * Note that emitting the Clear codes at the right times is a mere matter of
+ * counting output symbols and is in no way dependent on the LZW patent.
+ *
+ * With a small basic pixel width (low color count), Clear codes will be
+ * needed very frequently, causing the file to expand even more.  So this
+ * simplistic approach wouldn't work too well on bilevel images, for example.
+ * But for output of JPEG conversions the pixel width will usually be 8 bits
+ * (129 to 256 colors), so the overhead added by Clear symbols is only about
+ * one symbol in every 256.
+ */
+
+LOCAL(void)
+compress_init (gif_dest_ptr dinfo, int i_bits)
+/* Initialize pseudo-compressor */
+{
+  /* init all the state variables */
+  dinfo->n_bits = i_bits;
+  dinfo->maxcode = MAXCODE(dinfo->n_bits);
+  dinfo->ClearCode = (1 << (i_bits - 1));
+  dinfo->EOFCode = dinfo->ClearCode + 1;
+  dinfo->code_counter = dinfo->ClearCode + 2;
+  /* init output buffering vars */
+  dinfo->bytesinpkt = 0;
+  dinfo->cur_accum = 0;
+  dinfo->cur_bits = 0;
+  /* GIF specifies an initial Clear code */
+  output(dinfo, dinfo->ClearCode);
+}
+
+
+LOCAL(void)
+compress_pixel (gif_dest_ptr dinfo, int c)
+/* Accept and "compress" one pixel value.
+ * The given value must be less than n_bits wide.
+ */
+{
+  /* Output the given pixel value as a symbol. */
+  output(dinfo, c);
+  /* Issue Clear codes often enough to keep the reader from ratcheting up
+   * its symbol size.
+   */
+  if (dinfo->code_counter < dinfo->maxcode) {
+    dinfo->code_counter++;
+  } else {
+    output(dinfo, dinfo->ClearCode);
+    dinfo->code_counter = dinfo->ClearCode + 2;	/* reset the counter */
+  }
+}
+
+
+LOCAL(void)
+compress_term (gif_dest_ptr dinfo)
+/* Clean up at end */
+{
+  /* Send an EOF code */
+  output(dinfo, dinfo->EOFCode);
+  /* Flush the bit-packing buffer */
+  if (dinfo->cur_bits > 0) {
+    CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF);
+  }
+  /* Flush the packet buffer */
+  flush_packet(dinfo);
+}
+
+
+/* GIF header construction */
+
+
+LOCAL(void)
+put_word (gif_dest_ptr dinfo, unsigned int w)
+/* Emit a 16-bit word, LSB first */
+{
+  putc(w & 0xFF, dinfo->pub.output_file);
+  putc((w >> 8) & 0xFF, dinfo->pub.output_file);
+}
+
+
+LOCAL(void)
+put_3bytes (gif_dest_ptr dinfo, int val)
+/* Emit 3 copies of same byte value --- handy subr for colormap construction */
+{
+  putc(val, dinfo->pub.output_file);
+  putc(val, dinfo->pub.output_file);
+  putc(val, dinfo->pub.output_file);
+}
+
+
+LOCAL(void)
+emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap)
+/* Output the GIF file header, including color map */
+/* If colormap==NULL, synthesize a gray-scale colormap */
+{
+  int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte;
+  int cshift = dinfo->cinfo->data_precision - 8;
+  int i;
+
+  if (num_colors > 256)
+    ERREXIT1(dinfo->cinfo, JERR_TOO_MANY_COLORS, num_colors);
+  /* Compute bits/pixel and related values */
+  BitsPerPixel = 1;
+  while (num_colors > (1 << BitsPerPixel))
+    BitsPerPixel++;
+  ColorMapSize = 1 << BitsPerPixel;
+  if (BitsPerPixel <= 1)
+    InitCodeSize = 2;
+  else
+    InitCodeSize = BitsPerPixel;
+  /*
+   * Write the GIF header.
+   * Note that we generate a plain GIF87 header for maximum compatibility.
+   */
+  putc('G', dinfo->pub.output_file);
+  putc('I', dinfo->pub.output_file);
+  putc('F', dinfo->pub.output_file);
+  putc('8', dinfo->pub.output_file);
+  putc('7', dinfo->pub.output_file);
+  putc('a', dinfo->pub.output_file);
+  /* Write the Logical Screen Descriptor */
+  put_word(dinfo, (unsigned int) dinfo->cinfo->output_width);
+  put_word(dinfo, (unsigned int) dinfo->cinfo->output_height);
+  FlagByte = 0x80;		/* Yes, there is a global color table */
+  FlagByte |= (BitsPerPixel-1) << 4; /* color resolution */
+  FlagByte |= (BitsPerPixel-1);	/* size of global color table */
+  putc(FlagByte, dinfo->pub.output_file);
+  putc(0, dinfo->pub.output_file); /* Background color index */
+  putc(0, dinfo->pub.output_file); /* Reserved (aspect ratio in GIF89) */
+  /* Write the Global Color Map */
+  /* If the color map is more than 8 bits precision, */
+  /* we reduce it to 8 bits by shifting */
+  for (i=0; i < ColorMapSize; i++) {
+    if (i < num_colors) {
+      if (colormap != NULL) {
+	if (dinfo->cinfo->out_color_space == JCS_RGB) {
+	  /* Normal case: RGB color map */
+	  putc(GETJSAMPLE(colormap[0][i]) >> cshift, dinfo->pub.output_file);
+	  putc(GETJSAMPLE(colormap[1][i]) >> cshift, dinfo->pub.output_file);
+	  putc(GETJSAMPLE(colormap[2][i]) >> cshift, dinfo->pub.output_file);
+	} else {
+	  /* Grayscale "color map": possible if quantizing grayscale image */
+	  put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift);
+	}
+      } else {
+	/* Create a gray-scale map of num_colors values, range 0..255 */
+	put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1));
+      }
+    } else {
+      /* fill out the map to a power of 2 */
+      put_3bytes(dinfo, 0);
+    }
+  }
+  /* Write image separator and Image Descriptor */
+  putc(',', dinfo->pub.output_file); /* separator */
+  put_word(dinfo, 0);		/* left/top offset */
+  put_word(dinfo, 0);
+  put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); /* image size */
+  put_word(dinfo, (unsigned int) dinfo->cinfo->output_height);
+  /* flag byte: not interlaced, no local color map */
+  putc(0x00, dinfo->pub.output_file);
+  /* Write Initial Code Size byte */
+  putc(InitCodeSize, dinfo->pub.output_file);
+
+  /* Initialize for "compression" of image data */
+  compress_init(dinfo, InitCodeSize+1);
+}
+
+
+/*
+ * Startup: write the file header.
+ */
+
+METHODDEF(void)
+start_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  gif_dest_ptr dest = (gif_dest_ptr) dinfo;
+
+  if (cinfo->quantize_colors)
+    emit_header(dest, cinfo->actual_number_of_colors, cinfo->colormap);
+  else
+    emit_header(dest, 256, (JSAMPARRAY) NULL);
+}
+
+
+/*
+ * Write some pixel data.
+ * In this module rows_supplied will always be 1.
+ */
+
+METHODDEF(void)
+put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+		JDIMENSION rows_supplied)
+{
+  gif_dest_ptr dest = (gif_dest_ptr) dinfo;
+  register JSAMPROW ptr;
+  register JDIMENSION col;
+
+  ptr = dest->pub.buffer[0];
+  for (col = cinfo->output_width; col > 0; col--) {
+    compress_pixel(dest, GETJSAMPLE(*ptr++));
+  }
+}
+
+
+/*
+ * Finish up at the end of the file.
+ */
+
+METHODDEF(void)
+finish_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  gif_dest_ptr dest = (gif_dest_ptr) dinfo;
+
+  /* Flush "compression" mechanism */
+  compress_term(dest);
+  /* Write a zero-length data block to end the series */
+  putc(0, dest->pub.output_file);
+  /* Write the GIF terminator mark */
+  putc(';', dest->pub.output_file);
+  /* Make sure we wrote the output file OK */
+  fflush(dest->pub.output_file);
+  if (ferror(dest->pub.output_file))
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+}
+
+
+/*
+ * The module selection routine for GIF format output.
+ */
+
+GLOBAL(djpeg_dest_ptr)
+jinit_write_gif (j_decompress_ptr cinfo)
+{
+  gif_dest_ptr dest;
+
+  /* Create module interface object, fill in method pointers */
+  dest = (gif_dest_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(gif_dest_struct));
+  dest->cinfo = cinfo;		/* make back link for subroutines */
+  dest->pub.start_output = start_output_gif;
+  dest->pub.put_pixel_rows = put_pixel_rows;
+  dest->pub.finish_output = finish_output_gif;
+
+  if (cinfo->out_color_space != JCS_GRAYSCALE &&
+      cinfo->out_color_space != JCS_RGB)
+    ERREXIT(cinfo, JERR_GIF_COLORSPACE);
+
+  /* Force quantization if color or if > 8 bits input */
+  if (cinfo->out_color_space != JCS_GRAYSCALE || cinfo->data_precision > 8) {
+    /* Force quantization to at most 256 colors */
+    cinfo->quantize_colors = TRUE;
+    if (cinfo->desired_number_of_colors > 256)
+      cinfo->desired_number_of_colors = 256;
+  }
+
+  /* Calculate output image dimensions so we can allocate space */
+  jpeg_calc_output_dimensions(cinfo);
+
+  if (cinfo->output_components != 1) /* safety check: just one component? */
+    ERREXIT(cinfo, JERR_GIF_BUG);
+
+  /* Create decompressor output buffer. */
+  dest->pub.buffer = (*cinfo->mem->alloc_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->output_width, (JDIMENSION) 1);
+  dest->pub.buffer_height = 1;
+
+  return (djpeg_dest_ptr) dest;
+}
+
+#endif /* GIF_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/wrjpgcom.1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/wrjpgcom.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/wrjpgcom.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,103 @@
+.TH WRJPGCOM 1 "15 June 1995"
+.SH NAME
+wrjpgcom \- insert text comments into a JPEG file
+.SH SYNOPSIS
+.B wrjpgcom
+[
+.B \-replace
+]
+[
+.BI \-comment " text"
+]
+[
+.BI \-cfile " name"
+]
+[
+.I filename
+]
+.LP
+.SH DESCRIPTION
+.LP
+.B wrjpgcom
+reads the named JPEG/JFIF file, or the standard input if no file is named,
+and generates a new JPEG/JFIF file on standard output.  A comment block is
+added to the file.
+.PP
+The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file.
+Although the standard doesn't actually define what COM blocks are for, they
+are widely used to hold user-supplied text strings.  This lets you add
+annotations, titles, index terms, etc to your JPEG files, and later retrieve
+them as text.  COM blocks do not interfere with the image stored in the JPEG
+file.  The maximum size of a COM block is 64K, but you can have as many of
+them as you like in one JPEG file.
+.PP
+.B wrjpgcom
+adds a COM block, containing text you provide, to a JPEG file.
+Ordinarily, the COM block is added after any existing COM blocks; but you
+can delete the old COM blocks if you wish.
+.SH OPTIONS
+Switch names may be abbreviated, and are not case sensitive.
+.TP
+.B \-replace
+Delete any existing COM blocks from the file.
+.TP
+.BI \-comment " text"
+Supply text for new COM block on command line.
+.TP
+.BI \-cfile " name"
+Read text for new COM block from named file.
+.PP
+If you have only one line of comment text to add, you can provide it on the
+command line with
+.BR \-comment .
+The comment text must be surrounded with quotes so that it is treated as a
+single argument.  Longer comments can be read from a text file.
+.PP
+If you give neither
+.B \-comment
+nor
+.BR \-cfile ,
+then
+.B wrjpgcom
+will read the comment text from standard input.  (In this case an input image
+file name MUST be supplied, so that the source JPEG file comes from somewhere
+else.)  You can enter multiple lines, up to 64KB worth.  Type an end-of-file
+indicator (usually control-D) to terminate the comment text entry.
+.PP
+.B wrjpgcom
+will not add a COM block if the provided comment string is empty.  Therefore
+\fB\-replace \-comment ""\fR can be used to delete all COM blocks from a file.
+.SH EXAMPLES
+.LP
+Add a short comment to in.jpg, producing out.jpg:
+.IP
+.B wrjpgcom \-c
+\fI"View of my back yard" in.jpg
+.B >
+.I out.jpg
+.PP
+Attach a long comment previously stored in comment.txt:
+.IP
+.B wrjpgcom
+.I in.jpg
+.B <
+.I comment.txt
+.B >
+.I out.jpg
+.PP
+or equivalently
+.IP
+.B wrjpgcom
+.B -cfile
+.I comment.txt
+.B <
+.I in.jpg
+.B >
+.I out.jpg
+.SH SEE ALSO
+.BR cjpeg (1),
+.BR djpeg (1),
+.BR jpegtran (1),
+.BR rdjpgcom (1)
+.SH AUTHOR
+Independent JPEG Group

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/wrjpgcom.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/wrjpgcom.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/wrjpgcom.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,583 @@
+/*
+ * wrjpgcom.c
+ *
+ * Copyright (C) 1994-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains a very simple stand-alone application that inserts
+ * user-supplied text as a COM (comment) marker in a JFIF file.
+ * This may be useful as an example of the minimum logic needed to parse
+ * JPEG markers.
+ */
+
+#define JPEG_CJPEG_DJPEG	/* to get the command-line config symbols */
+#include "jinclude.h"		/* get auto-config symbols, <stdio.h> */
+
+#ifndef HAVE_STDLIB_H		/* <stdlib.h> should declare malloc() */
+extern void * malloc ();
+#endif
+#include <ctype.h>		/* to declare isupper(), tolower() */
+#ifdef USE_SETMODE
+#include <fcntl.h>		/* to declare setmode()'s parameter macros */
+/* If you have setmode() but not <io.h>, just delete this line: */
+#include <io.h>			/* to declare setmode() */
+#endif
+
+#ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
+#ifdef __MWERKS__
+#include <SIOUX.h>              /* Metrowerks needs this */
+#include <console.h>		/* ... and this */
+#endif
+#ifdef THINK_C
+#include <console.h>		/* Think declares it here */
+#endif
+#endif
+
+#ifdef DONT_USE_B_MODE		/* define mode parameters for fopen() */
+#define READ_BINARY	"r"
+#define WRITE_BINARY	"w"
+#else
+#ifdef VMS			/* VMS is very nonstandard */
+#define READ_BINARY	"rb", "ctx=stm"
+#define WRITE_BINARY	"wb", "ctx=stm"
+#else				/* standard ANSI-compliant case */
+#define READ_BINARY	"rb"
+#define WRITE_BINARY	"wb"
+#endif
+#endif
+
+#ifndef EXIT_FAILURE		/* define exit() codes if not provided */
+#define EXIT_FAILURE  1
+#endif
+#ifndef EXIT_SUCCESS
+#ifdef VMS
+#define EXIT_SUCCESS  1		/* VMS is very nonstandard */
+#else
+#define EXIT_SUCCESS  0
+#endif
+#endif
+
+/* Reduce this value if your malloc() can't allocate blocks up to 64K.
+ * On DOS, compiling in large model is usually a better solution.
+ */
+
+#ifndef MAX_COM_LENGTH
+#define MAX_COM_LENGTH 65000L	/* must be <= 65533 in any case */
+#endif
+
+
+/*
+ * These macros are used to read the input file and write the output file.
+ * To reuse this code in another application, you might need to change these.
+ */
+
+static FILE * infile;		/* input JPEG file */
+
+/* Return next input byte, or EOF if no more */
+#define NEXTBYTE()  getc(infile)
+
+static FILE * outfile;		/* output JPEG file */
+
+/* Emit an output byte */
+#define PUTBYTE(x)  putc((x), outfile)
+
+
+/* Error exit handler */
+#define ERREXIT(msg)  (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE))
+
+
+/* Read one byte, testing for EOF */
+static int
+read_1_byte (void)
+{
+  int c;
+
+  c = NEXTBYTE();
+  if (c == EOF)
+    ERREXIT("Premature EOF in JPEG file");
+  return c;
+}
+
+/* Read 2 bytes, convert to unsigned int */
+/* All 2-byte quantities in JPEG markers are MSB first */
+static unsigned int
+read_2_bytes (void)
+{
+  int c1, c2;
+
+  c1 = NEXTBYTE();
+  if (c1 == EOF)
+    ERREXIT("Premature EOF in JPEG file");
+  c2 = NEXTBYTE();
+  if (c2 == EOF)
+    ERREXIT("Premature EOF in JPEG file");
+  return (((unsigned int) c1) << 8) + ((unsigned int) c2);
+}
+
+
+/* Routines to write data to output file */
+
+static void
+write_1_byte (int c)
+{
+  PUTBYTE(c);
+}
+
+static void
+write_2_bytes (unsigned int val)
+{
+  PUTBYTE((val >> 8) & 0xFF);
+  PUTBYTE(val & 0xFF);
+}
+
+static void
+write_marker (int marker)
+{
+  PUTBYTE(0xFF);
+  PUTBYTE(marker);
+}
+
+static void
+copy_rest_of_file (void)
+{
+  int c;
+
+  while ((c = NEXTBYTE()) != EOF)
+    PUTBYTE(c);
+}
+
+
+/*
+ * JPEG markers consist of one or more 0xFF bytes, followed by a marker
+ * code byte (which is not an FF).  Here are the marker codes of interest
+ * in this program.  (See jdmarker.c for a more complete list.)
+ */
+
+#define M_SOF0  0xC0		/* Start Of Frame N */
+#define M_SOF1  0xC1		/* N indicates which compression process */
+#define M_SOF2  0xC2		/* Only SOF0-SOF2 are now in common use */
+#define M_SOF3  0xC3
+#define M_SOF5  0xC5		/* NB: codes C4 and CC are NOT SOF markers */
+#define M_SOF6  0xC6
+#define M_SOF7  0xC7
+#define M_SOF9  0xC9
+#define M_SOF10 0xCA
+#define M_SOF11 0xCB
+#define M_SOF13 0xCD
+#define M_SOF14 0xCE
+#define M_SOF15 0xCF
+#define M_SOI   0xD8		/* Start Of Image (beginning of datastream) */
+#define M_EOI   0xD9		/* End Of Image (end of datastream) */
+#define M_SOS   0xDA		/* Start Of Scan (begins compressed data) */
+#define M_COM   0xFE		/* COMment */
+
+
+/*
+ * Find the next JPEG marker and return its marker code.
+ * We expect at least one FF byte, possibly more if the compressor used FFs
+ * to pad the file.  (Padding FFs will NOT be replicated in the output file.)
+ * There could also be non-FF garbage between markers.  The treatment of such
+ * garbage is unspecified; we choose to skip over it but emit a warning msg.
+ * NB: this routine must not be used after seeing SOS marker, since it will
+ * not deal correctly with FF/00 sequences in the compressed image data...
+ */
+
+static int
+next_marker (void)
+{
+  int c;
+  int discarded_bytes = 0;
+
+  /* Find 0xFF byte; count and skip any non-FFs. */
+  c = read_1_byte();
+  while (c != 0xFF) {
+    discarded_bytes++;
+    c = read_1_byte();
+  }
+  /* Get marker code byte, swallowing any duplicate FF bytes.  Extra FFs
+   * are legal as pad bytes, so don't count them in discarded_bytes.
+   */
+  do {
+    c = read_1_byte();
+  } while (c == 0xFF);
+
+  if (discarded_bytes != 0) {
+    fprintf(stderr, "Warning: garbage data found in JPEG file\n");
+  }
+
+  return c;
+}
+
+
+/*
+ * Read the initial marker, which should be SOI.
+ * For a JFIF file, the first two bytes of the file should be literally
+ * 0xFF M_SOI.  To be more general, we could use next_marker, but if the
+ * input file weren't actually JPEG at all, next_marker might read the whole
+ * file and then return a misleading error message...
+ */
+
+static int
+first_marker (void)
+{
+  int c1, c2;
+
+  c1 = NEXTBYTE();
+  c2 = NEXTBYTE();
+  if (c1 != 0xFF || c2 != M_SOI)
+    ERREXIT("Not a JPEG file");
+  return c2;
+}
+
+
+/*
+ * Most types of marker are followed by a variable-length parameter segment.
+ * This routine skips over the parameters for any marker we don't otherwise
+ * want to process.
+ * Note that we MUST skip the parameter segment explicitly in order not to
+ * be fooled by 0xFF bytes that might appear within the parameter segment;
+ * such bytes do NOT introduce new markers.
+ */
+
+static void
+copy_variable (void)
+/* Copy an unknown or uninteresting variable-length marker */
+{
+  unsigned int length;
+
+  /* Get the marker parameter length count */
+  length = read_2_bytes();
+  write_2_bytes(length);
+  /* Length includes itself, so must be at least 2 */
+  if (length < 2)
+    ERREXIT("Erroneous JPEG marker length");
+  length -= 2;
+  /* Skip over the remaining bytes */
+  while (length > 0) {
+    write_1_byte(read_1_byte());
+    length--;
+  }
+}
+
+static void
+skip_variable (void)
+/* Skip over an unknown or uninteresting variable-length marker */
+{
+  unsigned int length;
+
+  /* Get the marker parameter length count */
+  length = read_2_bytes();
+  /* Length includes itself, so must be at least 2 */
+  if (length < 2)
+    ERREXIT("Erroneous JPEG marker length");
+  length -= 2;
+  /* Skip over the remaining bytes */
+  while (length > 0) {
+    (void) read_1_byte();
+    length--;
+  }
+}
+
+
+/*
+ * Parse the marker stream until SOFn or EOI is seen;
+ * copy data to output, but discard COM markers unless keep_COM is true.
+ */
+
+static int
+scan_JPEG_header (int keep_COM)
+{
+  int marker;
+
+  /* Expect SOI at start of file */
+  if (first_marker() != M_SOI)
+    ERREXIT("Expected SOI marker first");
+  write_marker(M_SOI);
+
+  /* Scan miscellaneous markers until we reach SOFn. */
+  for (;;) {
+    marker = next_marker();
+    switch (marker) {
+      /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be,
+       * treated as SOFn.  C4 in particular is actually DHT.
+       */
+    case M_SOF0:		/* Baseline */
+    case M_SOF1:		/* Extended sequential, Huffman */
+    case M_SOF2:		/* Progressive, Huffman */
+    case M_SOF3:		/* Lossless, Huffman */
+    case M_SOF5:		/* Differential sequential, Huffman */
+    case M_SOF6:		/* Differential progressive, Huffman */
+    case M_SOF7:		/* Differential lossless, Huffman */
+    case M_SOF9:		/* Extended sequential, arithmetic */
+    case M_SOF10:		/* Progressive, arithmetic */
+    case M_SOF11:		/* Lossless, arithmetic */
+    case M_SOF13:		/* Differential sequential, arithmetic */
+    case M_SOF14:		/* Differential progressive, arithmetic */
+    case M_SOF15:		/* Differential lossless, arithmetic */
+      return marker;
+
+    case M_SOS:			/* should not see compressed data before SOF */
+      ERREXIT("SOS without prior SOFn");
+      break;
+
+    case M_EOI:			/* in case it's a tables-only JPEG stream */
+      return marker;
+
+    case M_COM:			/* Existing COM: conditionally discard */
+      if (keep_COM) {
+	write_marker(marker);
+	copy_variable();
+      } else {
+	skip_variable();
+      }
+      break;
+
+    default:			/* Anything else just gets copied */
+      write_marker(marker);
+      copy_variable();		/* we assume it has a parameter count... */
+      break;
+    }
+  } /* end loop */
+}
+
+
+/* Command line parsing code */
+
+static const char * progname;	/* program name for error messages */
+
+
+static void
+usage (void)
+/* complain about bad command line */
+{
+  fprintf(stderr, "wrjpgcom inserts a textual comment in a JPEG file.\n");
+  fprintf(stderr, "You can add to or replace any existing comment(s).\n");
+
+  fprintf(stderr, "Usage: %s [switches] ", progname);
+#ifdef TWO_FILE_COMMANDLINE
+  fprintf(stderr, "inputfile outputfile\n");
+#else
+  fprintf(stderr, "[inputfile]\n");
+#endif
+
+  fprintf(stderr, "Switches (names may be abbreviated):\n");
+  fprintf(stderr, "  -replace         Delete any existing comments\n");
+  fprintf(stderr, "  -comment \"text\"  Insert comment with given text\n");
+  fprintf(stderr, "  -cfile name      Read comment from named file\n");
+  fprintf(stderr, "Notice that you must put quotes around the comment text\n");
+  fprintf(stderr, "when you use -comment.\n");
+  fprintf(stderr, "If you do not give either -comment or -cfile on the command line,\n");
+  fprintf(stderr, "then the comment text is read from standard input.\n");
+  fprintf(stderr, "It can be multiple lines, up to %u characters total.\n",
+	  (unsigned int) MAX_COM_LENGTH);
+#ifndef TWO_FILE_COMMANDLINE
+  fprintf(stderr, "You must specify an input JPEG file name when supplying\n");
+  fprintf(stderr, "comment text from standard input.\n");
+#endif
+
+  exit(EXIT_FAILURE);
+}
+
+
+static int
+keymatch (char * arg, const char * keyword, int minchars)
+/* Case-insensitive matching of (possibly abbreviated) keyword switches. */
+/* keyword is the constant keyword (must be lower case already), */
+/* minchars is length of minimum legal abbreviation. */
+{
+  register int ca, ck;
+  register int nmatched = 0;
+
+  while ((ca = *arg++) != '\0') {
+    if ((ck = *keyword++) == '\0')
+      return 0;			/* arg longer than keyword, no good */
+    if (isupper(ca))		/* force arg to lcase (assume ck is already) */
+      ca = tolower(ca);
+    if (ca != ck)
+      return 0;			/* no good */
+    nmatched++;			/* count matched characters */
+  }
+  /* reached end of argument; fail if it's too short for unique abbrev */
+  if (nmatched < minchars)
+    return 0;
+  return 1;			/* A-OK */
+}
+
+
+/*
+ * The main program.
+ */
+
+int
+main (int argc, char **argv)
+{
+  int argn;
+  char * arg;
+  int keep_COM = 1;
+  char * comment_arg = NULL;
+  FILE * comment_file = NULL;
+  unsigned int comment_length = 0;
+  int marker;
+
+  /* On Mac, fetch a command line. */
+#ifdef USE_CCOMMAND
+  argc = ccommand(&argv);
+#endif
+
+  progname = argv[0];
+  if (progname == NULL || progname[0] == 0)
+    progname = "wrjpgcom";	/* in case C library doesn't provide it */
+
+  /* Parse switches, if any */
+  for (argn = 1; argn < argc; argn++) {
+    arg = argv[argn];
+    if (arg[0] != '-')
+      break;			/* not switch, must be file name */
+    arg++;			/* advance over '-' */
+    if (keymatch(arg, "replace", 1)) {
+      keep_COM = 0;
+    } else if (keymatch(arg, "cfile", 2)) {
+      if (++argn >= argc) usage();
+      if ((comment_file = fopen(argv[argn], "r")) == NULL) {
+	fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
+	exit(EXIT_FAILURE);
+      }
+    } else if (keymatch(arg, "comment", 1)) {
+      if (++argn >= argc) usage();
+      comment_arg = argv[argn];
+      /* If the comment text starts with '"', then we are probably running
+       * under MS-DOG and must parse out the quoted string ourselves.  Sigh.
+       */
+      if (comment_arg[0] == '"') {
+	comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH);
+	if (comment_arg == NULL)
+	  ERREXIT("Insufficient memory");
+	strcpy(comment_arg, argv[argn]+1);
+	for (;;) {
+	  comment_length = (unsigned int) strlen(comment_arg);
+	  if (comment_length > 0 && comment_arg[comment_length-1] == '"') {
+	    comment_arg[comment_length-1] = '\0'; /* zap terminating quote */
+	    break;
+	  }
+	  if (++argn >= argc)
+	    ERREXIT("Missing ending quote mark");
+	  strcat(comment_arg, " ");
+	  strcat(comment_arg, argv[argn]);
+	}
+      }
+      comment_length = (unsigned int) strlen(comment_arg);
+    } else
+      usage();
+  }
+
+  /* Cannot use both -comment and -cfile. */
+  if (comment_arg != NULL && comment_file != NULL)
+    usage();
+  /* If there is neither -comment nor -cfile, we will read the comment text
+   * from stdin; in this case there MUST be an input JPEG file name.
+   */
+  if (comment_arg == NULL && comment_file == NULL && argn >= argc)
+    usage();
+
+  /* Open the input file. */
+  if (argn < argc) {
+    if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
+      exit(EXIT_FAILURE);
+    }
+  } else {
+    /* default input file is stdin */
+#ifdef USE_SETMODE		/* need to hack file mode? */
+    setmode(fileno(stdin), O_BINARY);
+#endif
+#ifdef USE_FDOPEN		/* need to re-open in binary mode? */
+    if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
+      fprintf(stderr, "%s: can't open stdin\n", progname);
+      exit(EXIT_FAILURE);
+    }
+#else
+    infile = stdin;
+#endif
+  }
+
+  /* Open the output file. */
+#ifdef TWO_FILE_COMMANDLINE
+  /* Must have explicit output file name */
+  if (argn != argc-2) {
+    fprintf(stderr, "%s: must name one input and one output file\n",
+	    progname);
+    usage();
+  }
+  if ((outfile = fopen(argv[argn+1], WRITE_BINARY)) == NULL) {
+    fprintf(stderr, "%s: can't open %s\n", progname, argv[argn+1]);
+    exit(EXIT_FAILURE);
+  }
+#else
+  /* Unix style: expect zero or one file name */
+  if (argn < argc-1) {
+    fprintf(stderr, "%s: only one input file\n", progname);
+    usage();
+  }
+  /* default output file is stdout */
+#ifdef USE_SETMODE		/* need to hack file mode? */
+  setmode(fileno(stdout), O_BINARY);
+#endif
+#ifdef USE_FDOPEN		/* need to re-open in binary mode? */
+  if ((outfile = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) {
+    fprintf(stderr, "%s: can't open stdout\n", progname);
+    exit(EXIT_FAILURE);
+  }
+#else
+  outfile = stdout;
+#endif
+#endif /* TWO_FILE_COMMANDLINE */
+
+  /* Collect comment text from comment_file or stdin, if necessary */
+  if (comment_arg == NULL) {
+    FILE * src_file;
+    int c;
+
+    comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH);
+    if (comment_arg == NULL)
+      ERREXIT("Insufficient memory");
+    comment_length = 0;
+    src_file = (comment_file != NULL ? comment_file : stdin);
+    while ((c = getc(src_file)) != EOF) {
+      if (comment_length >= (unsigned int) MAX_COM_LENGTH) {
+	fprintf(stderr, "Comment text may not exceed %u bytes\n",
+		(unsigned int) MAX_COM_LENGTH);
+	exit(EXIT_FAILURE);
+      }
+      comment_arg[comment_length++] = (char) c;
+    }
+    if (comment_file != NULL)
+      fclose(comment_file);
+  }
+
+  /* Copy JPEG headers until SOFn marker;
+   * we will insert the new comment marker just before SOFn.
+   * This (a) causes the new comment to appear after, rather than before,
+   * existing comments; and (b) ensures that comments come after any JFIF
+   * or JFXX markers, as required by the JFIF specification.
+   */
+  marker = scan_JPEG_header(keep_COM);
+  /* Insert the new COM marker, but only if nonempty text has been supplied */
+  if (comment_length > 0) {
+    write_marker(M_COM);
+    write_2_bytes(comment_length + 2);
+    while (comment_length > 0) {
+      write_1_byte(*comment_arg++);
+      comment_length--;
+    }
+  }
+  /* Duplicate the remainder of the source file.
+   * Note that any COM markers occuring after SOF will not be touched.
+   */
+  write_marker(marker);
+  copy_rest_of_file();
+
+  /* All done. */
+  exit(EXIT_SUCCESS);
+  return 0;			/* suppress no-return-value warnings */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/wrppm.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/wrppm.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/wrppm.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,268 @@
+/*
+ * wrppm.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to write output images in PPM/PGM format.
+ * The extended 2-byte-per-sample raw PPM/PGM formats are supported.
+ * The PBMPLUS library is NOT required to compile this software
+ * (but it is highly useful as a set of PPM image manipulation programs).
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications.  As they stand, they assume output to
+ * an ordinary stdio stream.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef PPM_SUPPORTED
+
+
+/*
+ * For 12-bit JPEG data, we either downscale the values to 8 bits
+ * (to write standard byte-per-sample PPM/PGM files), or output
+ * nonstandard word-per-sample PPM/PGM files.  Downscaling is done
+ * if PPM_NORAWWORD is defined (this can be done in the Makefile
+ * or in jconfig.h).
+ * (When the core library supports data precision reduction, a cleaner
+ * implementation will be to ask for that instead.)
+ */
+
+#if BITS_IN_JSAMPLE == 8
+#define PUTPPMSAMPLE(ptr,v)  *ptr++ = (char) (v)
+#define BYTESPERSAMPLE 1
+#define PPM_MAXVAL 255
+#else
+#ifdef PPM_NORAWWORD
+#define PUTPPMSAMPLE(ptr,v)  *ptr++ = (char) ((v) >> (BITS_IN_JSAMPLE-8))
+#define BYTESPERSAMPLE 1
+#define PPM_MAXVAL 255
+#else
+/* The word-per-sample format always puts the LSB first. */
+#define PUTPPMSAMPLE(ptr,v)			\
+	{ register int val_ = v;		\
+	  *ptr++ = (char) (val_ & 0xFF);	\
+	  *ptr++ = (char) ((val_ >> 8) & 0xFF);	\
+	}
+#define BYTESPERSAMPLE 2
+#define PPM_MAXVAL ((1<<BITS_IN_JSAMPLE)-1)
+#endif
+#endif
+
+
+/*
+ * When JSAMPLE is the same size as char, we can just fwrite() the
+ * decompressed data to the PPM or PGM file.  On PCs, in order to make this
+ * work the output buffer must be allocated in near data space, because we are
+ * assuming small-data memory model wherein fwrite() can't reach far memory.
+ * If you need to process very wide images on a PC, you might have to compile
+ * in large-memory model, or else replace fwrite() with a putc() loop ---
+ * which will be much slower.
+ */
+
+
+/* Private version of data destination object */
+
+typedef struct {
+  struct djpeg_dest_struct pub;	/* public fields */
+
+  /* Usually these two pointers point to the same place: */
+  char *iobuffer;		/* fwrite's I/O buffer */
+  JSAMPROW pixrow;		/* decompressor output buffer */
+  size_t buffer_width;		/* width of I/O buffer */
+  JDIMENSION samples_per_row;	/* JSAMPLEs per output row */
+} ppm_dest_struct;
+
+typedef ppm_dest_struct * ppm_dest_ptr;
+
+
+/*
+ * Write some pixel data.
+ * In this module rows_supplied will always be 1.
+ *
+ * put_pixel_rows handles the "normal" 8-bit case where the decompressor
+ * output buffer is physically the same as the fwrite buffer.
+ */
+
+METHODDEF(void)
+put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+		JDIMENSION rows_supplied)
+{
+  ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
+
+  (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
+}
+
+
+/*
+ * This code is used when we have to copy the data and apply a pixel
+ * format translation.  Typically this only happens in 12-bit mode.
+ */
+
+METHODDEF(void)
+copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+		 JDIMENSION rows_supplied)
+{
+  ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
+  register char * bufferptr;
+  register JSAMPROW ptr;
+  register JDIMENSION col;
+
+  ptr = dest->pub.buffer[0];
+  bufferptr = dest->iobuffer;
+  for (col = dest->samples_per_row; col > 0; col--) {
+    PUTPPMSAMPLE(bufferptr, GETJSAMPLE(*ptr++));
+  }
+  (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
+}
+
+
+/*
+ * Write some pixel data when color quantization is in effect.
+ * We have to demap the color index values to straight data.
+ */
+
+METHODDEF(void)
+put_demapped_rgb (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+		  JDIMENSION rows_supplied)
+{
+  ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
+  register char * bufferptr;
+  register int pixval;
+  register JSAMPROW ptr;
+  register JSAMPROW color_map0 = cinfo->colormap[0];
+  register JSAMPROW color_map1 = cinfo->colormap[1];
+  register JSAMPROW color_map2 = cinfo->colormap[2];
+  register JDIMENSION col;
+
+  ptr = dest->pub.buffer[0];
+  bufferptr = dest->iobuffer;
+  for (col = cinfo->output_width; col > 0; col--) {
+    pixval = GETJSAMPLE(*ptr++);
+    PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map0[pixval]));
+    PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map1[pixval]));
+    PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map2[pixval]));
+  }
+  (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
+}
+
+
+METHODDEF(void)
+put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+		   JDIMENSION rows_supplied)
+{
+  ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
+  register char * bufferptr;
+  register JSAMPROW ptr;
+  register JSAMPROW color_map = cinfo->colormap[0];
+  register JDIMENSION col;
+
+  ptr = dest->pub.buffer[0];
+  bufferptr = dest->iobuffer;
+  for (col = cinfo->output_width; col > 0; col--) {
+    PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map[GETJSAMPLE(*ptr++)]));
+  }
+  (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
+}
+
+
+/*
+ * Startup: write the file header.
+ */
+
+METHODDEF(void)
+start_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
+
+  /* Emit file header */
+  switch (cinfo->out_color_space) {
+  case JCS_GRAYSCALE:
+    /* emit header for raw PGM format */
+    fprintf(dest->pub.output_file, "P5\n%ld %ld\n%d\n",
+	    (long) cinfo->output_width, (long) cinfo->output_height,
+	    PPM_MAXVAL);
+    break;
+  case JCS_RGB:
+    /* emit header for raw PPM format */
+    fprintf(dest->pub.output_file, "P6\n%ld %ld\n%d\n",
+	    (long) cinfo->output_width, (long) cinfo->output_height,
+	    PPM_MAXVAL);
+    break;
+  default:
+    ERREXIT(cinfo, JERR_PPM_COLORSPACE);
+  }
+}
+
+
+/*
+ * Finish up at the end of the file.
+ */
+
+METHODDEF(void)
+finish_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  /* Make sure we wrote the output file OK */
+  fflush(dinfo->output_file);
+  if (ferror(dinfo->output_file))
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+}
+
+
+/*
+ * The module selection routine for PPM format output.
+ */
+
+GLOBAL(djpeg_dest_ptr)
+jinit_write_ppm (j_decompress_ptr cinfo)
+{
+  ppm_dest_ptr dest;
+
+  /* Create module interface object, fill in method pointers */
+  dest = (ppm_dest_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(ppm_dest_struct));
+  dest->pub.start_output = start_output_ppm;
+  dest->pub.finish_output = finish_output_ppm;
+
+  /* Calculate output image dimensions so we can allocate space */
+  jpeg_calc_output_dimensions(cinfo);
+
+  /* Create physical I/O buffer.  Note we make this near on a PC. */
+  dest->samples_per_row = cinfo->output_width * cinfo->out_color_components;
+  dest->buffer_width = dest->samples_per_row * (BYTESPERSAMPLE * SIZEOF(char));
+  dest->iobuffer = (char *) (*cinfo->mem->alloc_small)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width);
+
+  if (cinfo->quantize_colors || BITS_IN_JSAMPLE != 8 ||
+      SIZEOF(JSAMPLE) != SIZEOF(char)) {
+    /* When quantizing, we need an output buffer for colormap indexes
+     * that's separate from the physical I/O buffer.  We also need a
+     * separate buffer if pixel format translation must take place.
+     */
+    dest->pub.buffer = (*cinfo->mem->alloc_sarray)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE,
+       cinfo->output_width * cinfo->output_components, (JDIMENSION) 1);
+    dest->pub.buffer_height = 1;
+    if (! cinfo->quantize_colors)
+      dest->pub.put_pixel_rows = copy_pixel_rows;
+    else if (cinfo->out_color_space == JCS_GRAYSCALE)
+      dest->pub.put_pixel_rows = put_demapped_gray;
+    else
+      dest->pub.put_pixel_rows = put_demapped_rgb;
+  } else {
+    /* We will fwrite() directly from decompressor output buffer. */
+    /* Synthesize a JSAMPARRAY pointer structure */
+    /* Cast here implies near->far pointer conversion on PCs */
+    dest->pixrow = (JSAMPROW) dest->iobuffer;
+    dest->pub.buffer = & dest->pixrow;
+    dest->pub.buffer_height = 1;
+    dest->pub.put_pixel_rows = put_pixel_rows;
+  }
+
+  return (djpeg_dest_ptr) dest;
+}
+
+#endif /* PPM_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/wrrle.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/wrrle.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/wrrle.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,305 @@
+/*
+ * wrrle.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to write output images in RLE format.
+ * The Utah Raster Toolkit library is required (version 3.1 or later).
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications.  As they stand, they assume output to
+ * an ordinary stdio stream.
+ *
+ * Based on code contributed by Mike Lijewski,
+ * with updates from Robert Hutchinson.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef RLE_SUPPORTED
+
+/* rle.h is provided by the Utah Raster Toolkit. */
+
+#include <rle.h>
+
+/*
+ * We assume that JSAMPLE has the same representation as rle_pixel,
+ * to wit, "unsigned char".  Hence we can't cope with 12- or 16-bit samples.
+ */
+
+#if BITS_IN_JSAMPLE != 8
+  Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
+#endif
+
+
+/*
+ * Since RLE stores scanlines bottom-to-top, we have to invert the image
+ * from JPEG's top-to-bottom order.  To do this, we save the outgoing data
+ * in a virtual array during put_pixel_row calls, then actually emit the
+ * RLE file during finish_output.
+ */
+
+
+/*
+ * For now, if we emit an RLE color map then it is always 256 entries long,
+ * though not all of the entries need be used.
+ */
+
+#define CMAPBITS	8
+#define CMAPLENGTH	(1<<(CMAPBITS))
+
+typedef struct {
+  struct djpeg_dest_struct pub; /* public fields */
+
+  jvirt_sarray_ptr image;	/* virtual array to store the output image */
+  rle_map *colormap;	 	/* RLE-style color map, or NULL if none */
+  rle_pixel **rle_row;		/* To pass rows to rle_putrow() */
+
+} rle_dest_struct;
+
+typedef rle_dest_struct * rle_dest_ptr;
+
+/* Forward declarations */
+METHODDEF(void) rle_put_pixel_rows
+    JPP((j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+	 JDIMENSION rows_supplied));
+
+
+/*
+ * Write the file header.
+ *
+ * In this module it's easier to wait till finish_output to write anything.
+ */
+
+METHODDEF(void)
+start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  rle_dest_ptr dest = (rle_dest_ptr) dinfo;
+  size_t cmapsize;
+  int i, ci;
+#ifdef PROGRESS_REPORT
+  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+#endif
+
+  /*
+   * Make sure the image can be stored in RLE format.
+   *
+   * - RLE stores image dimensions as *signed* 16 bit integers.  JPEG
+   *   uses unsigned, so we have to check the width.
+   *
+   * - Colorspace is expected to be grayscale or RGB.
+   *
+   * - The number of channels (components) is expected to be 1 (grayscale/
+   *   pseudocolor) or 3 (truecolor/directcolor).
+   *   (could be 2 or 4 if using an alpha channel, but we aren't)
+   */
+
+  if (cinfo->output_width > 32767 || cinfo->output_height > 32767)
+    ERREXIT2(cinfo, JERR_RLE_DIMENSIONS, cinfo->output_width, 
+	     cinfo->output_height);
+
+  if (cinfo->out_color_space != JCS_GRAYSCALE &&
+      cinfo->out_color_space != JCS_RGB)
+    ERREXIT(cinfo, JERR_RLE_COLORSPACE);
+
+  if (cinfo->output_components != 1 && cinfo->output_components != 3)
+    ERREXIT1(cinfo, JERR_RLE_TOOMANYCHANNELS, cinfo->num_components);
+
+  /* Convert colormap, if any, to RLE format. */
+
+  dest->colormap = NULL;
+
+  if (cinfo->quantize_colors) {
+    /* Allocate storage for RLE-style cmap, zero any extra entries */
+    cmapsize = cinfo->out_color_components * CMAPLENGTH * SIZEOF(rle_map);
+    dest->colormap = (rle_map *) (*cinfo->mem->alloc_small)
+      ((j_common_ptr) cinfo, JPOOL_IMAGE, cmapsize);
+    MEMZERO(dest->colormap, cmapsize);
+
+    /* Save away data in RLE format --- note 8-bit left shift! */
+    /* Shifting would need adjustment for JSAMPLEs wider than 8 bits. */
+    for (ci = 0; ci < cinfo->out_color_components; ci++) {
+      for (i = 0; i < cinfo->actual_number_of_colors; i++) {
+        dest->colormap[ci * CMAPLENGTH + i] =
+          GETJSAMPLE(cinfo->colormap[ci][i]) << 8;
+      }
+    }
+  }
+
+  /* Set the output buffer to the first row */
+  dest->pub.buffer = (*cinfo->mem->access_virt_sarray)
+    ((j_common_ptr) cinfo, dest->image, (JDIMENSION) 0, (JDIMENSION) 1, TRUE);
+  dest->pub.buffer_height = 1;
+
+  dest->pub.put_pixel_rows = rle_put_pixel_rows;
+
+#ifdef PROGRESS_REPORT
+  if (progress != NULL) {
+    progress->total_extra_passes++;  /* count file writing as separate pass */
+  }
+#endif
+}
+
+
+/*
+ * Write some pixel data.
+ *
+ * This routine just saves the data away in a virtual array.
+ */
+
+METHODDEF(void)
+rle_put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+		    JDIMENSION rows_supplied)
+{
+  rle_dest_ptr dest = (rle_dest_ptr) dinfo;
+
+  if (cinfo->output_scanline < cinfo->output_height) {
+    dest->pub.buffer = (*cinfo->mem->access_virt_sarray)
+      ((j_common_ptr) cinfo, dest->image,
+       cinfo->output_scanline, (JDIMENSION) 1, TRUE);
+  }
+}
+
+/*
+ * Finish up at the end of the file.
+ *
+ * Here is where we really output the RLE file.
+ */
+
+METHODDEF(void)
+finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  rle_dest_ptr dest = (rle_dest_ptr) dinfo;
+  rle_hdr header;		/* Output file information */
+  rle_pixel **rle_row, *red, *green, *blue;
+  JSAMPROW output_row;
+  char cmapcomment[80];
+  int row, col;
+  int ci;
+#ifdef PROGRESS_REPORT
+  cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
+#endif
+
+  /* Initialize the header info */
+  header = *rle_hdr_init(NULL);
+  header.rle_file = dest->pub.output_file;
+  header.xmin     = 0;
+  header.xmax     = cinfo->output_width  - 1;
+  header.ymin     = 0;
+  header.ymax     = cinfo->output_height - 1;
+  header.alpha    = 0;
+  header.ncolors  = cinfo->output_components;
+  for (ci = 0; ci < cinfo->output_components; ci++) {
+    RLE_SET_BIT(header, ci);
+  }
+  if (cinfo->quantize_colors) {
+    header.ncmap   = cinfo->out_color_components;
+    header.cmaplen = CMAPBITS;
+    header.cmap    = dest->colormap;
+    /* Add a comment to the output image with the true colormap length. */
+    sprintf(cmapcomment, "color_map_length=%d", cinfo->actual_number_of_colors);
+    rle_putcom(cmapcomment, &header);
+  }
+
+  /* Emit the RLE header and color map (if any) */
+  rle_put_setup(&header);
+
+  /* Now output the RLE data from our virtual array.
+   * We assume here that (a) rle_pixel is represented the same as JSAMPLE,
+   * and (b) we are not on a machine where FAR pointers differ from regular.
+   */
+
+#ifdef PROGRESS_REPORT
+  if (progress != NULL) {
+    progress->pub.pass_limit = cinfo->output_height;
+    progress->pub.pass_counter = 0;
+    (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+  }
+#endif
+
+  if (cinfo->output_components == 1) {
+    for (row = cinfo->output_height-1; row >= 0; row--) {
+      rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray)
+        ((j_common_ptr) cinfo, dest->image,
+	 (JDIMENSION) row, (JDIMENSION) 1, FALSE);
+      rle_putrow(rle_row, (int) cinfo->output_width, &header);
+#ifdef PROGRESS_REPORT
+      if (progress != NULL) {
+        progress->pub.pass_counter++;
+        (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+      }
+#endif
+    }
+  } else {
+    for (row = cinfo->output_height-1; row >= 0; row--) {
+      rle_row = (rle_pixel **) dest->rle_row;
+      output_row = * (*cinfo->mem->access_virt_sarray)
+        ((j_common_ptr) cinfo, dest->image,
+	 (JDIMENSION) row, (JDIMENSION) 1, FALSE);
+      red = rle_row[0];
+      green = rle_row[1];
+      blue = rle_row[2];
+      for (col = cinfo->output_width; col > 0; col--) {
+        *red++ = GETJSAMPLE(*output_row++);
+        *green++ = GETJSAMPLE(*output_row++);
+        *blue++ = GETJSAMPLE(*output_row++);
+      }
+      rle_putrow(rle_row, (int) cinfo->output_width, &header);
+#ifdef PROGRESS_REPORT
+      if (progress != NULL) {
+        progress->pub.pass_counter++;
+        (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
+      }
+#endif
+    }
+  }
+
+#ifdef PROGRESS_REPORT
+  if (progress != NULL)
+    progress->completed_extra_passes++;
+#endif
+
+  /* Emit file trailer */
+  rle_puteof(&header);
+  fflush(dest->pub.output_file);
+  if (ferror(dest->pub.output_file))
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+}
+
+
+/*
+ * The module selection routine for RLE format output.
+ */
+
+GLOBAL(djpeg_dest_ptr)
+jinit_write_rle (j_decompress_ptr cinfo)
+{
+  rle_dest_ptr dest;
+
+  /* Create module interface object, fill in method pointers */
+  dest = (rle_dest_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+                                  SIZEOF(rle_dest_struct));
+  dest->pub.start_output = start_output_rle;
+  dest->pub.finish_output = finish_output_rle;
+
+  /* Calculate output image dimensions so we can allocate space */
+  jpeg_calc_output_dimensions(cinfo);
+
+  /* Allocate a work array for output to the RLE library. */
+  dest->rle_row = (*cinfo->mem->alloc_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE,
+     cinfo->output_width, (JDIMENSION) cinfo->output_components);
+
+  /* Allocate a virtual array to hold the image. */
+  dest->image = (*cinfo->mem->request_virt_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+     (JDIMENSION) (cinfo->output_width * cinfo->output_components),
+     cinfo->output_height, (JDIMENSION) 1);
+
+  return (djpeg_dest_ptr) dest;
+}
+
+#endif /* RLE_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/jpeg/wrtarga.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/jpeg/wrtarga.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/jpeg/wrtarga.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,253 @@
+/*
+ * wrtarga.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to write output images in Targa format.
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications.  As they stand, they assume output to
+ * an ordinary stdio stream.
+ *
+ * Based on code contributed by Lee Daniel Crocker.
+ */
+
+#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
+
+#ifdef TARGA_SUPPORTED
+
+
+/*
+ * To support 12-bit JPEG data, we'd have to scale output down to 8 bits.
+ * This is not yet implemented.
+ */
+
+#if BITS_IN_JSAMPLE != 8
+  Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
+#endif
+
+/*
+ * The output buffer needs to be writable by fwrite().  On PCs, we must
+ * allocate the buffer in near data space, because we are assuming small-data
+ * memory model, wherein fwrite() can't reach far memory.  If you need to
+ * process very wide images on a PC, you might have to compile in large-memory
+ * model, or else replace fwrite() with a putc() loop --- which will be much
+ * slower.
+ */
+
+
+/* Private version of data destination object */
+
+typedef struct {
+  struct djpeg_dest_struct pub;	/* public fields */
+
+  char *iobuffer;		/* physical I/O buffer */
+  JDIMENSION buffer_width;	/* width of one row */
+} tga_dest_struct;
+
+typedef tga_dest_struct * tga_dest_ptr;
+
+
+LOCAL(void)
+write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors)
+/* Create and write a Targa header */
+{
+  char targaheader[18];
+
+  /* Set unused fields of header to 0 */
+  MEMZERO(targaheader, SIZEOF(targaheader));
+
+  if (num_colors > 0) {
+    targaheader[1] = 1;		/* color map type 1 */
+    targaheader[5] = (char) (num_colors & 0xFF);
+    targaheader[6] = (char) (num_colors >> 8);
+    targaheader[7] = 24;	/* 24 bits per cmap entry */
+  }
+
+  targaheader[12] = (char) (cinfo->output_width & 0xFF);
+  targaheader[13] = (char) (cinfo->output_width >> 8);
+  targaheader[14] = (char) (cinfo->output_height & 0xFF);
+  targaheader[15] = (char) (cinfo->output_height >> 8);
+  targaheader[17] = 0x20;	/* Top-down, non-interlaced */
+
+  if (cinfo->out_color_space == JCS_GRAYSCALE) {
+    targaheader[2] = 3;		/* image type = uncompressed gray-scale */
+    targaheader[16] = 8;	/* bits per pixel */
+  } else {			/* must be RGB */
+    if (num_colors > 0) {
+      targaheader[2] = 1;	/* image type = colormapped RGB */
+      targaheader[16] = 8;
+    } else {
+      targaheader[2] = 2;	/* image type = uncompressed RGB */
+      targaheader[16] = 24;
+    }
+  }
+
+  if (JFWRITE(dinfo->output_file, targaheader, 18) != (size_t) 18)
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+}
+
+
+/*
+ * Write some pixel data.
+ * In this module rows_supplied will always be 1.
+ */
+
+METHODDEF(void)
+put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+		JDIMENSION rows_supplied)
+/* used for unquantized full-color output */
+{
+  tga_dest_ptr dest = (tga_dest_ptr) dinfo;
+  register JSAMPROW inptr;
+  register char * outptr;
+  register JDIMENSION col;
+
+  inptr = dest->pub.buffer[0];
+  outptr = dest->iobuffer;
+  for (col = cinfo->output_width; col > 0; col--) {
+    outptr[0] = (char) GETJSAMPLE(inptr[2]); /* RGB to BGR order */
+    outptr[1] = (char) GETJSAMPLE(inptr[1]);
+    outptr[2] = (char) GETJSAMPLE(inptr[0]);
+    inptr += 3, outptr += 3;
+  }
+  (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
+}
+
+METHODDEF(void)
+put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+	       JDIMENSION rows_supplied)
+/* used for grayscale OR quantized color output */
+{
+  tga_dest_ptr dest = (tga_dest_ptr) dinfo;
+  register JSAMPROW inptr;
+  register char * outptr;
+  register JDIMENSION col;
+
+  inptr = dest->pub.buffer[0];
+  outptr = dest->iobuffer;
+  for (col = cinfo->output_width; col > 0; col--) {
+    *outptr++ = (char) GETJSAMPLE(*inptr++);
+  }
+  (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
+}
+
+
+/*
+ * Write some demapped pixel data when color quantization is in effect.
+ * For Targa, this is only applied to grayscale data.
+ */
+
+METHODDEF(void)
+put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
+		   JDIMENSION rows_supplied)
+{
+  tga_dest_ptr dest = (tga_dest_ptr) dinfo;
+  register JSAMPROW inptr;
+  register char * outptr;
+  register JSAMPROW color_map0 = cinfo->colormap[0];
+  register JDIMENSION col;
+
+  inptr = dest->pub.buffer[0];
+  outptr = dest->iobuffer;
+  for (col = cinfo->output_width; col > 0; col--) {
+    *outptr++ = (char) GETJSAMPLE(color_map0[GETJSAMPLE(*inptr++)]);
+  }
+  (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
+}
+
+
+/*
+ * Startup: write the file header.
+ */
+
+METHODDEF(void)
+start_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  tga_dest_ptr dest = (tga_dest_ptr) dinfo;
+  int num_colors, i;
+  FILE *outfile;
+
+  if (cinfo->out_color_space == JCS_GRAYSCALE) {
+    /* Targa doesn't have a mapped grayscale format, so we will */
+    /* demap quantized gray output.  Never emit a colormap. */
+    write_header(cinfo, dinfo, 0);
+    if (cinfo->quantize_colors)
+      dest->pub.put_pixel_rows = put_demapped_gray;
+    else
+      dest->pub.put_pixel_rows = put_gray_rows;
+  } else if (cinfo->out_color_space == JCS_RGB) {
+    if (cinfo->quantize_colors) {
+      /* We only support 8-bit colormap indexes, so only 256 colors */
+      num_colors = cinfo->actual_number_of_colors;
+      if (num_colors > 256)
+	ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, num_colors);
+      write_header(cinfo, dinfo, num_colors);
+      /* Write the colormap.  Note Targa uses BGR byte order */
+      outfile = dest->pub.output_file;
+      for (i = 0; i < num_colors; i++) {
+	putc(GETJSAMPLE(cinfo->colormap[2][i]), outfile);
+	putc(GETJSAMPLE(cinfo->colormap[1][i]), outfile);
+	putc(GETJSAMPLE(cinfo->colormap[0][i]), outfile);
+      }
+      dest->pub.put_pixel_rows = put_gray_rows;
+    } else {
+      write_header(cinfo, dinfo, 0);
+      dest->pub.put_pixel_rows = put_pixel_rows;
+    }
+  } else {
+    ERREXIT(cinfo, JERR_TGA_COLORSPACE);
+  }
+}
+
+
+/*
+ * Finish up at the end of the file.
+ */
+
+METHODDEF(void)
+finish_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
+{
+  /* Make sure we wrote the output file OK */
+  fflush(dinfo->output_file);
+  if (ferror(dinfo->output_file))
+    ERREXIT(cinfo, JERR_FILE_WRITE);
+}
+
+
+/*
+ * The module selection routine for Targa format output.
+ */
+
+GLOBAL(djpeg_dest_ptr)
+jinit_write_targa (j_decompress_ptr cinfo)
+{
+  tga_dest_ptr dest;
+
+  /* Create module interface object, fill in method pointers */
+  dest = (tga_dest_ptr)
+      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				  SIZEOF(tga_dest_struct));
+  dest->pub.start_output = start_output_tga;
+  dest->pub.finish_output = finish_output_tga;
+
+  /* Calculate output image dimensions so we can allocate space */
+  jpeg_calc_output_dimensions(cinfo);
+
+  /* Create I/O buffer.  Note we make this near on a PC. */
+  dest->buffer_width = cinfo->output_width * cinfo->output_components;
+  dest->iobuffer = (char *)
+    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+				(size_t) (dest->buffer_width * SIZEOF(char)));
+
+  /* Create decompressor output buffer. */
+  dest->pub.buffer = (*cinfo->mem->alloc_sarray)
+    ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width, (JDIMENSION) 1);
+  dest->pub.buffer_height = 1;
+
+  return (djpeg_dest_ptr) dest;
+}
+
+#endif /* TARGA_SUPPORTED */

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/HDFIOTrace.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/HDFIOTrace.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/HDFIOTrace.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,419 @@
+/*
+ * This file is part of the Pablo Performance Analysis Environment
+ *
+ *          (R)
+ * The Pablo    Performance Analysis Environment software is NOT in
+ * the public domain.  However, it is freely available without fee for
+ * education, research, and non-profit purposes.  By obtaining copies
+ * of this and other files that comprise the Pablo Performance Analysis
+ * Environment, you, the Licensee, agree to abide by the following
+ * conditions and understandings with respect to the copyrighted software:
+ * 
+ * 1.  The software is copyrighted in the name of the Board of Trustees
+ *     of the University of Illinois (UI), and ownership of the software
+ *     remains with the UI. 
+ *
+ * 2.  Permission to use, copy, and modify this software and its documentation
+ *     for education, research, and non-profit purposes is hereby granted
+ *     to Licensee, provided that the copyright notice, the original author's
+ *     names and unit identification, and this permission notice appear on
+ *     all such copies, and that no charge be made for such copies.  Any
+ *     entity desiring permission to incorporate this software into commercial
+ *     products should contact:
+ *
+ *          Professor Daniel A. Reed                 reed at cs.uiuc.edu
+ *          University of Illinois
+ *          Department of Computer Science
+ *          2413 Digital Computer Laboratory
+ *          1304 West Springfield Avenue
+ *          Urbana, Illinois  61801
+ *          USA
+ *
+ * 3.  Licensee may not use the name, logo, or any other symbol of the UI
+ *     nor the names of any of its employees nor any adaptation thereof in
+ *     advertizing or publicity pertaining to the software without specific
+ *     prior written approval of the UI.
+ *
+ * 4.  THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE
+ *     SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS
+ *     OR IMPLIED WARRANTY.
+ *
+ * 5.  The UI shall not be liable for any damages suffered by Licensee from
+ *     the use of this software.
+ *
+ * 6.  The software was developed under agreements between the UI and the
+ *     Federal Government which entitle the Government to certain rights.
+ *
+ **************************************************************************
+ *
+ * Developed by: The Pablo Research Group
+ *               University of Illinois at Urbana-Champaign
+ *               Department of Computer Science
+ *               1304 W. Springfield Avenue
+ *               Urbana, IL     61801
+ *
+ *               http://www-pablo.cs.uiuc.edu
+ *
+ * Send comments to: pablo-feedback at guitar.cs.uiuc.edu
+ *
+ * Copyright (c) 1991-1996
+ * The University of Illinois Board of Trustees.
+ *      All Rights Reserved.
+ *
+ * PABLO is a registered trademark of
+ * The Board of Trustees of the University of Illinois
+ * registered in the U.S. Patent and Trademark Office.
+ *
+ * Author:  Ruth A. Aydt (aydt at cs.uiuc.edu)
+ * Author:  Tara M. Madhyastha (tara at cs.uiuc.edu)
+ *
+ * Project Manager and Principal Investigator:
+ *      Daniel A. Reed (reed at cs.uiuc.edu)
+ *
+ * Funded in part by National Science Foundation grants NSF CCR87-06653
+ * and NSF CDA87-22836 (Tapestry), DARPA contracts DABT63-91-K-0004,
+ * DABT63-93-C-0040, DABT63-94-C-0049 (SIO), and F30602-96-C-0161, NASA
+ * contracts NAG-1-613 (ICLASS), USRA 5555-22, and NGT-51023, and a
+ * collaborative research agreement with the Intel Supercomputer
+ * Systems Division
+ */
+
+/*
+ * HDFIOTrace.h:  This header file can be included in c source files to
+ *	       automatically redefine the I/O function calls to the
+ *	       tracing versions when "IOTRACE" is defined.   
+ *
+ *	       It also contains function declarations for the I/O trace
+ *	       routines called from user code and constant values that may
+ *	       be needed by the user.
+ *
+ */
+#ifndef HDFIOTrace_h
+#define HDFIOTrace_h
+
+ 
+/************************************************************************/
+/* These defines and the external variable OUTPUT_SWITCH are used in    */
+/* for HDF and MPI-IO tracing to govern the type of output produced.    */
+/************************************************************************/
+extern int OUTPUT_SWITCH;        /* default is SDDF records      */
+ 
+#if defined(__STDC__) || defined(__cplusplus)
+#define PROTO(x) x
+#else
+#define PROTO(x) ()
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* #include <stdio.h> */
+#include <sys/types.h>
+
+void startHDFtraceEvent (int );
+void endHDFtraceEvent (int , int , char *, int );
+
+FILE *HDFtraceFOPEN( const char *filename, const char *type ) ;
+#ifndef HDFtrace3OPEN__
+	int HDFtrace3OPEN( const char *path, int flags, ... ) ;
+#endif
+int HDFtraceCREAT( const char *path, mode_t mode );
+int HDFtraceFFLUSH( FILE *stream ) ;
+int HDFtraceFCLOSE( FILE *stream ) ;
+int HDFtraceCLOSE( int fd ) ;
+ssize_t HDFtraceREAD( int fd, void *buf, size_t nbyte );
+size_t HDFtraceFREAD( void *ptr, size_t size, size_t nitems, FILE *stream );
+void *HDFtraceMALLOC( size_t );
+off_t HDFtraceLSEEK( int fd, off_t offset, int whence ) ;
+int HDFtraceFSEEK( FILE *stream, long offset, int whence ) ;
+int HDFtraceFSETPOS( FILE *stream, const fpos_t *position ) ;
+void HDFtraceREWIND( FILE *stream ) ;
+ssize_t HDFtraceWRITE( int fd, const void *buf, size_t nbytes );
+size_t HDFtraceFWRITE( const void *, size_t , size_t , FILE * );
+int HDFtracePUTS( char *s ) ;
+int HDFtraceFPUTC( int c, FILE *stream ) ;
+int HDFtraceFPUTS( const char *s, FILE *stream ) ;
+
+#ifdef HDFIOTRACE
+/*
+ * If IOTRACE is defined, then redefine standard I/O routines to tracing
+ * versions.  Also include the appropriate .h files so the function
+ * declarations from them will be redefined to traced versions.
+ */
+
+#ifdef fopen 
+#   undef fopen
+#endif
+#ifdef open 
+#   undef open
+#endif
+#ifdef creat 
+#   undef creat
+#endif
+ 
+#ifdef fflush 
+#   undef fflush
+#endif
+#ifdef fclose 
+#   undef fclose
+#endif
+#ifdef close 
+#   undef close
+#endif
+ 
+#ifdef read 
+#   undef read
+#endif
+#ifdef fread 
+#   undef fread
+#endif
+#ifdef fgetc 
+#   undef fgetc
+#endif
+#ifdef fgets 
+#   undef fgets
+#endif
+#ifdef gets 
+#   undef gets
+#endif
+#ifdef getw 
+#   undef getw
+#endif
+ 
+#ifdef lseek 
+#   undef lseek
+#endif
+#ifdef fseek 
+#   undef fseek
+#endif
+#ifdef rewind 
+#   undef rewind
+#endif
+#ifdef fsetpos 
+#   undef fsetpos
+#endif
+ 
+#ifdef write 
+#   undef write
+#endif
+#ifdef fwrite 
+#   undef fwrite
+#endif
+#ifdef fputc 
+#   undef fputc
+#endif
+#ifdef fputs 
+#   undef fputs
+#endif
+#ifdef puts 
+#   undef puts
+#endif
+#ifdef putw 
+#   undef putw
+#endif
+ 
+#ifdef malloc 
+#   undef malloc
+#endif
+
+#define fopen		(FILE *)HDFtraceFOPEN
+#define open		HDFtrace3OPEN
+#define creat		HDFtraceCREAT
+
+#define fflush		HDFtraceFFLUSH
+#define fclose		HDFtraceFCLOSE
+#define close		HDFtraceCLOSE
+
+#define read		HDFtraceREAD
+#define fread		HDFtraceFREAD
+#define fgetc		HDFtraceFGETC
+#define fgets		HDFtraceFGETS
+#define gets		HDFtraceGETS
+#define getw		HDFtraceGETW
+
+#define lseek		HDFtraceLSEEK
+#define fseek		HDFtraceFSEEK
+#define rewind		HDFtraceREWIND
+#define fsetpos		HDFtraceFSETPOS
+
+#define write		HDFtraceWRITE
+#define fwrite		HDFtraceFWRITE
+#define fputc		HDFtraceFPUTC
+#define fputs		HDFtraceFPUTS
+#define puts		HDFtracePUTS
+#define putw		HDFtracePUTW
+
+#define malloc		HDFtraceMALLOC
+
+#include <stdio.h>
+#include <fcntl.h>
+
+/*
+ * On the iPSC/860 we don't include unistd.h or we get warnings about
+ * SEEK_* multiply defined.
+ */
+#ifndef __NX
+#include <unistd.h>
+#endif
+
+
+#include <stdio.h>
+/*
+ * Function declarations for routines that can be called from user code.
+ */
+void  enableIOtracing( void );
+void  disableIOtracing( void );
+
+void  enableIOdetail( void );
+void  disableIOdetail( void );
+
+void  enableLifetimeSummaries( void );
+void  disableLifetimeSummaries( void );
+
+void  enableTimeWindowSummaries ( double );
+void  disableTimeWindowSummaries( void );
+void  setTimeWindowSize ( double );
+void  outputTimeWindowSummaries( void );
+
+void  enableFileRegionSummaries ( int );
+void  disableFileRegionSummaries( void );
+void  setFileRegionSize ( int );
+void  outputFileRegionSummaries( void );
+
+int   HDFtrace2OPEN ( char*, int );
+void  HDFtraceReadBegin ( int, int, int );
+void  HDFtraceReadEnd ( int );
+void  HDFtraceWriteBegin ( int, int, int );
+void  HDFtraceWriteEnd ( int );
+void  HDFtraceIOBegin ( int, int );
+void  HDFtraceIOEnd ( int, double, char * );
+
+#ifdef HAVE_PARALLEL
+
+#include "HDFmpioProtos.h"
+
+#ifdef MPI_File_open 		
+#undef MPI_File_open 		
+#endif
+#ifdef MPI_File_close 		
+#undef MPI_File_close 		
+#endif
+#ifdef MPI_File_delete 	
+#undef MPI_File_delete 	
+#endif
+#ifdef MPI_File_set_size 	
+#undef MPI_File_set_size 	
+#endif
+#ifdef MPI_File_preallocate 	
+#undef MPI_File_preallocate 	
+#endif
+#ifdef MPI_File_get_size 	
+#undef MPI_File_get_size 	
+#endif
+#ifdef MPI_File_get_group 	
+#undef MPI_File_get_group 	
+#endif
+#ifdef MPI_File_get_amode 	
+#undef MPI_File_get_amode 	
+#endif
+#ifdef MPI_File_set_view 	
+#undef MPI_File_set_view 	
+#endif
+#ifdef MPI_File_get_view 	
+#undef MPI_File_get_view 	
+#endif
+#ifdef MPI_File_read_at 	
+#undef MPI_File_read_at 	
+#endif
+#ifdef MPI_File_read_at_all 	
+#undef MPI_File_read_at_all 	
+#endif
+#ifdef MPI_File_write_at 	
+#undef MPI_File_write_at 	
+#endif
+#ifdef MPI_File_write_at_all 	
+#undef MPI_File_write_at_all 	
+#endif
+#ifdef MPI_File_iread_at 	
+#undef MPI_File_iread_at 	
+#endif
+#ifdef MPI_File_iwrite_at 	
+#undef MPI_File_iwrite_at 	
+#endif
+#ifdef MPI_File_read 		
+#undef MPI_File_read 		
+#endif
+#ifdef MPI_File_read_all 	
+#undef MPI_File_read_all 	
+#endif
+#ifdef MPI_File_write 		
+#undef MPI_File_write 		
+#endif
+#ifdef MPI_File_write_all 	
+#undef MPI_File_write_all 	
+#endif
+#ifdef MPI_File_iread 		
+#undef MPI_File_iread 		
+#endif
+#ifdef MPI_File_iwrite 	
+#undef MPI_File_iwrite 	
+#endif
+#ifdef MPI_File_seek 		
+#undef MPI_File_seek 		
+#endif
+#ifdef MPI_File_get_position 	
+#undef MPI_File_get_position 	
+#endif
+#ifdef MPI_File_get_byte_offset
+#undef MPI_File_get_byte_offset
+#endif
+#ifdef MPI_File_get_type_extent
+#undef MPI_File_get_type_extent
+#endif
+#ifdef MPI_File_set_atomicity 	
+#undef MPI_File_set_atomicity 	
+#endif
+#ifdef MPI_File_get_atomicity 	
+#undef MPI_File_get_atomicity 	
+#endif
+#ifdef MPI_File_sync 		
+#undef MPI_File_sync 		
+#endif
+
+#define MPI_File_open 		 HDF_MPI_File_open
+#define MPI_File_close 		 HDF_MPI_File_close
+#define MPI_File_delete 	 HDF_MPI_File_delete
+#define MPI_File_set_size 	 HDF_MPI_File_set_size
+#define MPI_File_preallocate 	 HDF_MPI_File_preallocate
+#define MPI_File_get_size 	 HDF_MPI_File_get_size
+#define MPI_File_get_group 	 HDF_MPI_File_get_group
+#define MPI_File_get_amode 	 HDF_MPI_File_get_amode
+#define MPI_File_set_view 	 HDF_MPI_File_set_view
+#define MPI_File_get_view 	 HDF_MPI_File_get_view
+#define MPI_File_read_at 	 HDF_MPI_File_read_at
+#define MPI_File_read_at_all 	 HDF_MPI_File_read_at_all
+#define MPI_File_write_at 	 HDF_MPI_File_write_at
+#define MPI_File_write_at_all 	 HDF_MPI_File_write_at_all
+#define MPI_File_iread_at 	 HDF_MPI_File_iread_at
+#define MPI_File_iwrite_at 	 HDF_MPI_File_iwrite_at
+#define MPI_File_read 		 HDF_MPI_File_read
+#define MPI_File_read_all 	 HDF_MPI_File_read_all
+#define MPI_File_write 		 HDF_MPI_File_write
+#define MPI_File_write_all 	 HDF_MPI_File_write_all
+#define MPI_File_iread 		 HDF_MPI_File_iread
+#define MPI_File_iwrite 	 HDF_MPI_File_iwrite
+#define MPI_File_seek 		 HDF_MPI_File_seek
+#define MPI_File_get_position 	 HDF_MPI_File_get_position
+#define MPI_File_get_byte_offset HDF_MPI_File_get_byte_offset
+#define MPI_File_get_type_extent HDF_MPI_File_get_type_extent
+#define MPI_File_set_atomicity 	 HDF_MPI_File_set_atomicity
+#define MPI_File_get_atomicity 	 HDF_MPI_File_get_atomicity
+#define MPI_File_sync 		 HDF_MPI_File_sync
+#endif /* HAVE_PARALLEL */
+#endif /* HAVE_PARALLEL */
+#ifdef __cplusplus
+}
+#endif
+
+#endif		/* HDFIOTRACE conditional */

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/HDFTrace.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/HDFTrace.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/HDFTrace.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,139 @@
+/*  This file is part of the Pablo Performance Analysis Environment
+// 
+//           (R)
+//  The Pablo    Performance Analysis Environment software is NOT in
+//  the public domain.  However, it is freely available without fee for
+//  education, research, and non-profit purposes.  By obtaining copies
+//  of this and other files that comprise the Pablo Performance Analysis
+//  Environment, you, the Licensee, agree to abide by the following
+//  conditions and understandings with respect to the copyrighted software:
+//  
+//  1.  The software is copyrighted in the name of the Board of Trustees
+//      of the University of Illinois (UI), and ownership of the software
+//      remains with the UI. 
+// 
+//  2.  Permission to use, copy, and modify this software and its documentation
+//      for education, research, and non-profit purposes is hereby granted
+//      to Licensee, provided that the copyright notice, the original author's
+//      names and unit identification, and this permission notice appear on
+//      all such copies, and that no charge be made for such copies.  Any
+//      entity desiring permission to incorporate this software into commercial
+//      products should contact:
+// 
+//           Professor Daniel A. Reed                 reed at cs.uiuc.edu
+//           University of Illinois
+//           Department of Computer Science
+//           2413 Digital Computer Laboratory
+//           1304 West Springfield Avenue
+//           Urbana, Illinois  61801
+//           USA
+// 
+//  3.  Licensee may not use the name, logo, or any other symbol of the UI
+//      nor the names of any of its employees nor any adaptation thereof in
+//      advertizing or publicity pertaining to the software without specific
+//      prior written approval of the UI.
+// 
+//  4.  THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE
+//      SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS
+//      OR IMPLIED WARRANTY.
+// 
+//  5.  The UI shall not be liable for any damages suffered by Licensee from
+//      the use of this software.
+// 
+//  6.  The software was developed under agreements between the UI and the
+//      Federal Government which entitle the Government to certain rights.
+// 
+// *************************************************************************
+// 
+//  Developed by: The Pablo Research Group
+//                University of Illinois at Urbana-Champaign
+//                Department of Computer Science
+//                1304 W. Springfield Avenue
+//                Urbana, IL     61801
+// 
+//                http://www-pablo.cs.uiuc.edu
+// 
+//  Send comments to: pablo-feedback at guitar.cs.uiuc.edu
+// 
+//  Copyright (c) 1987-1998
+//  The University of Illinois Board of Trustees.
+//       All Rights Reserved.
+// 
+//  PABLO is a registered trademark of
+//  The Board of Trustees of the University of Illinois
+//  registered in the U.S. Patent and Trademark Office.
+// 
+//  Project Manager and Principal Investigator:
+//       Daniel A. Reed (reed at cs.uiuc.edu)
+// 
+// Funded in part by the Defense Advanced Research Projects Agency under 
+// DARPA contracts DABT63-94-C0049 (SIO Initiative), F30602-96-C-0161,
+// and DABT63-96-C-0027 by the National Science Foundation under the PACI 
+// program and grants NSF CDA 94-01124 and ASC 97-20202, and by the 
+// Department of Energy under contracts DOE B-341494, W-7405-ENG-48, and 
+// 1-B-333164.
+//======================================================================*/
+#ifndef HDFTRACE_H
+#define HDFTRACE_H
+/************************************************************************/
+/* A shared char * pointer (defined in HDF_Descriptors.c) and Macro 	*/
+/* definitions								*/
+/************************************************************************/
+extern char *hdfRecordPointer;
+/************************************************************************/
+/* The following are used in tagging HDF packets.  Avoid using FAMILY   */
+/* tags in the range 0100000 to 0200000					*/
+/************************************************************************/
+#define HDF_FAMILY 	 	0100000
+#define HDF_SUMMARY_FAMILY  	0140000
+/************************************************************************/
+/* Number of fields in the packets.					*/
+/************************************************************************/
+#define NUM_FIELDS	17
+/* 
+ * "WRITE_HDF_ATTR" macro to output an attribute pair. 
+ */
+#ifndef WRITE_HDF_ATTR
+#define WRITE_HDF_ATTR( attrKey, attrValue ) \
+    sddfWriteString( &hdfRecordPointer, attrKey ); \
+    sddfWriteString( &hdfRecordPointer, attrValue ); 
+#endif /* WRITE_HDF_ATTR */
+
+/* 
+ * "WRITE_HDF_FIELD" macro to output a field with a single attribute pair. 
+ */
+#ifndef WRITE_HDF_FIELD
+#define WRITE_HDF_FIELD( name, attrKey, attrValue, type, dimension ) \
+    sddfWriteString( &hdfRecordPointer, name ); \
+    sddfWriteInteger( &hdfRecordPointer, 1 ); \
+    sddfWriteString( &hdfRecordPointer, attrKey ); \
+    sddfWriteString( &hdfRecordPointer, attrValue ); \
+    sddfWriteInteger( &hdfRecordPointer, type ); \
+    sddfWriteInteger( &hdfRecordPointer, dimension ); 
+#endif /* WRITE_HDF_FIELD */
+
+/* 
+ * "WRITE_HDF_FIELD2" to output a field with two attribute pairs. 
+ */
+#ifndef WRITE_HDF_FIELD2
+#define WRITE_HDF_FIELD2( name, aKey1, aValue1, aKey2, aValue2, type, dimension ) \
+    sddfWriteString( &hdfRecordPointer, name ); \
+    sddfWriteInteger( &hdfRecordPointer, 2 ); \
+    sddfWriteString( &hdfRecordPointer, aKey1 ); \
+    sddfWriteString( &hdfRecordPointer, aValue1 ); \
+    sddfWriteString( &hdfRecordPointer, aKey2 ); \
+    sddfWriteString( &hdfRecordPointer, aValue2 ); \
+    sddfWriteInteger( &hdfRecordPointer, type ); \
+    sddfWriteInteger( &hdfRecordPointer, dimension ); 
+#endif /* WRITE_HDF_FIELD2*/
+
+#define FAMILY_NAME         	0260            /* Data Set Name Record */
+#define FAMILY_MISC      	0270
+#define FAMILY_HDFPROCNAME     	0300
+
+typedef struct {
+        long setID;
+        char *setName;
+} HDFsetInfo ;
+
+#endif /* HDFTRACE_H */

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/HDFrecord_RT.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/HDFrecord_RT.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/HDFrecord_RT.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,176 @@
+/*
+ * This file is part of the Pablo Performance Analysis Environment
+ *
+ *          (R)
+ * The Pablo    Performance Analysis Environment software is NOT in
+ * the public domain.  However, it is freely available without fee for
+ * education, research, and non-profit purposes.  By obtaining copies
+ * of this and other files that comprise the Pablo Performance Analysis
+ * Environment, you, the Licensee, agree to abide by the following
+ * conditions and understandings with respect to the copyrighted software:
+ * 
+ * 1.  The software is copyrighted in the name of the Board of Trustees
+ *     of the University of Illinois (UI), and ownership of the software
+ *     remains with the UI. 
+ *
+ * 2.  Permission to use, copy, and modify this software and its documentation
+ *     for education, research, and non-profit purposes is hereby granted
+ *     to Licensee, provided that the copyright notice, the original author's
+ *     names and unit identification, and this permission notice appear on
+ *     all such copies, and that no charge be made for such copies.  Any
+ *     entity desiring permission to incorporate this software into commercial
+ *     products should contact:
+ *
+ *          Professor Daniel A. Reed                 reed at cs.uiuc.edu
+ *          University of Illinois
+ *          Department of Computer Science
+ *          2413 Digital Computer Laboratory
+ *          1304 West Springfield Avenue
+ *          Urbana, Illinois  61801
+ *          USA
+ *
+ * 3.  Licensee may not use the name, logo, or any other symbol of the UI
+ *     nor the names of any of its employees nor any adaptation thereof in
+ *     advertizing or publicity pertaining to the software without specific
+ *     prior written approval of the UI.
+ *
+ * 4.  THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE
+ *     SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS
+ *     OR IMPLIED WARRANTY.
+ *
+ * 5.  The UI shall not be liable for any damages suffered by Licensee from
+ *     the use of this software.
+ *
+ * 6.  The software was developed under agreements between the UI and the
+ *     Federal Government which entitle the Government to certain rights.
+ *
+ **************************************************************************
+ *
+ * Developed by: The Pablo Research Group
+ *               University of Illinois at Urbana-Champaign
+ *               Department of Computer Science
+ *               1304 W. Springfield Avenue
+ *               Urbana, IL     61801
+ *
+ *               http://www-pablo.cs.uiuc.edu
+ *
+ * Send comments to: pablo-feedback at guitar.cs.uiuc.edu
+ *
+ * Copyright (c) 1987-1996
+ * The University of Illinois Board of Trustees.
+ *      All Rights Reserved.
+ *
+ * PABLO is a registered trademark of
+ * The Board of Trustees of the University of Illinois
+ * registered in the U.S. Patent and Trademark Office.
+ *
+ * Author: Dan Wells (dwells at cs.uiuc.edu)
+ *
+ * Project Manager and Principal Investigator:
+ *      Daniel A. Reed (reed at cs.uiuc.edu)
+ *
+ * Funded in part by National Science Foundation grants NSF CCR87-06653
+ * and NSF CDA87-22836 (Tapestry), DARPA contracts DABT63-91-K-0004,
+ * DABT63-93-C-0040, DABT63-94-C-0049 (SIO), and F30602-96-C-0161, NASA
+ * contracts NAG-1-613 (ICLASS), USRA 5555-22, and NGT-51023, and a
+ * collaborative research agreement with the Intel Supercomputer
+ * Systems Division
+ */
+/*
+ * HDFrecord.h: Class to represent HDF records.
+ *
+ *	$Header: /afs/ncsa/projects/hdf/cvs/dist/hdf/pablo/HDFrecord_RT.h,v 1.1 1999/06/16 19:18:26 dwells Exp $
+ */
+
+#ifndef HDFRECORD_RT_H
+#define HDFRECORD_RT_H
+#ifndef NULL
+#define NULL 0
+#endif 
+
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include "ProcIDs.h"
+ 
+#ifndef min
+#define min( x , y ) ( x <= y ? x : y )
+#endif
+#ifndef max
+#define max( x , y ) ( x >= y ? x : y )
+#endif
+/*======================================================================*
+// Enumeration of time fields in an HDFrec_t below			*
+//======================================================================*/
+enum TimeFields { HDF_, MPI, Malloc, AllIO, Open, Close, Read, Write, ARead,
+                  AWrite, Seek, Wait, Misc, nTallyFields };
+/*======================================================================*
+// Enumeration of byte fields in an HDFrec_t below			*
+//======================================================================*/
+enum ByteFields{ MallocBytes, ReadBytes, WriteBytes, AReadBytes, AWriteBytes,
+                 nByteFields };
+/*======================================================================*
+// Definition of first and last IO event.         	 		*
+//======================================================================*/
+#define FirstIO Open
+#define LastIO Misc
+#define nBkts 4
+#define ONEK 1024
+int BktLim[] = { 1, 4*ONEK, 64*ONEK, 256*ONEK, INT_MAX } ;
+/*======================================================================*
+// Definition of structure used to account activity in an HDF call	*
+//======================================================================*/
+typedef struct {
+  	int     nCalls;   		/* number of proc calls		*/
+  	CLOCK   lastCall;		/* time of last call		*/
+  	CLOCK   incDur;			/* inclusive duration		*/
+  	CLOCK   excDur;			/* exclusive duration		*/
+	CLOCK   times[nTallyFields];	/* Tally op/calls times		*/
+	int     counts[nTallyFields];	/* Tally op/calls counts	*/
+	int     bytes[nByteFields];	/* Tally bytes transferred	*/
+	int     Hists[nByteFields][nBkts];  /* Historgrams		*/
+	long	hdfID;			/* data set ID			*/
+	long	xRef;			/* data set cross reference	*/
+} HDFrec_t;
+/*======================================================================*
+// Node used to maintain linked lists of HDF procedure activity.       	*
+//======================================================================*/
+typedef struct HDFnode {
+  	CLOCK   lastIOtime;		/* last IO time stamp		*/
+	HDFrec_t record;	        /* data				*/
+	struct HDFnode *ptr;		/* link pointer			*/
+	int	eventID;		/* event ID			*/
+} HDFnode_t;
+/*======================================================================*
+// Structure used to produce SDDF packets for Named identifiers.       	*
+//======================================================================*/
+typedef struct {
+        int packetLength;       /* bytes in packet			*/
+        int packetType;         /* == PKT_DATA				*/
+        int packetTag;          /* == FAMILY_<name>                	*/
+        int fileType;           /* Type of data set          		*/
+	int fileID;     	/* File ID             			*/
+        int nameLen;		/* length of file			*/
+} HDFNamePacket_t;
+/*======================================================================*
+// Node used to form linked lists to track named identifiers.          	*
+//======================================================================*/
+typedef struct fileRec {
+	struct fileRec *ptr;
+	long    hdfID;
+	long    PabloID;
+	char   *fileName;
+} fileRec_t;
+/*=======================================================================
+//	Utility programs to determine field index for a given eventID	* 
+//=====================================================================*/
+int getHDFFieldIndex( int eventID );
+int getHDFByteFieldIndex( int eventID );
+
+/*
+ * Define flags to distinguish misc i/o begin from misc i/o end
+ */
+#define MISC_BEGIN		0
+#define MISC_END		1
+
+#endif /* HDFRECORD_RT_H */

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,362 @@
+# ****************************************************************************
+# * 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: Makefile.in,v 1.16 2000/08/22 18:47:01 dwells Exp $
+#
+# ##################################################################
+#
+#           MAKEFILE for creating the Pablo Instrumentation code
+#
+#
+### Start of system configuration section. ####
+# Set shell so we know what it is
+SHELL = /bin/sh
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+#Compilier defaults overriden by top level make
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install scripts.
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install include files.
+includedir = $(prefix)/include
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# Pablo Instrumentation Library support files
+PCHDRS=ProcIDs.h ProcTrace.h
+PCSRCS=PabloHDF.c PabloHDF_RT.c PabloHDF_SDDF.c
+PCOBJS=PabloHDF.o PabloHDF_RT.o PabloHDF_SDDF.o
+PFSRCS=PabloHDFff.f
+PFOBJS=PabloHDFff.o
+PFINCS=PabloHDF.inc ProcTrace.inc
+POBJS=PabloHDF.o PabloHDF_RT.o PabloHDF_SDDF.o PabloHDFff.o
+PSRCS= $(PCHDRS) $(PCSRCS) $(PFINCS) $(PFSRCS)
+
+TARGETLIB = libdf-inst.a
+
+PABLO_INCDIR = .
+PABLO_INCLUDE= -I$(PABLO_INCDIR)
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+
+# ############# End of system configuration section. ###############
+HDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        FMPOOL_FLAGS="$(FMPOOL_FLAGS)" \
+        MACHINE="$(MACHINE)" 
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ==> specify directories where to find inludes and library
+#     HDF library, and HDF utilities
+HDFINC= $(srcdir)/../src
+HDFLIB= $(srcdir)/../src
+HDFBIN= $(srcdir)/../bin
+HDFSRC= $(srcdir)/../src
+
+# ==> specify where to find the JPEG include files and library
+JPEGINC=$(srcdir)/../jpeg
+JPEGLIB=$(srcdir)/../jpeg
+
+# ==> specify where to find the FMPOOL include and source files 
+FMPOOL_INC=$(srcdir)/../fmpool
+FMPOOL_SRC=$(srcdir)/../fmpool
+
+# ==> specify where to find the gzip zlib include files and library
+ZLIBINC=$(srcdir)/../zlib
+ZLIBLIB=$(srcdir)/../zlib
+
+ALL_CFLAGS= $(CFLAGS) $(PABLO_FLAGS) $(FMPOOL_FLAGS) -I. $(PABLO_INCLUDE) -I$(HDFINC) -I$(JPEGINC) -I$(ZLIBINC) -I$(FMPOOL_INC)
+
+LINTFLAGS=
+SHAR=shar
+ARCHIVE=pablo.shar
+
+MANIFEST = $(DISTFILES)
+DISTFILES = Makefile.in $(PSRCS) 
+
+# to extract all the object files out of libdf.a 
+HOBJS=`ar xv $(HDFLIB)/libdf.a | sed 's/x -//'`
+
+PINCS = HDFentryNames.h ProcTrace.h ProcTrace.inc HDFidList.h HDFTrace.h
+
+#
+#include the HDF source file definitions
+#
+include $(HDFSRC)/src.inc
+
+.SUFFIXES: .c.o .f.o 
+
+# This rule causes ansi2knr to be invoked.
+#@ISANSICOM at .c.o:
+#@ISANSICOM@	./ansi2knr $(srcdir)/$*.c T$*.c
+#@ISANSICOM@	$(CC) $(CFLAGS) -c T$*.c
+#@ISANSICOM@	$(RM) $(RMFLAGS) T$*.c $*.o
+#@ISANSICOM@	$(MV) T$*.o $*.o
+
+#ansi2knr: ansi2knr.c
+#	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+.c.o: 
+	$(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $(HDFSRC)/$*.c
+
+.f.o:
+	$(FC) $(FFLAGS) -c $(HDFSRC)/$*.f
+
+.PHONY : all nofortran clean distclean debug saber lint
+
+#all::
+
+all::         FORCE
+	@if test -z "$(PABLO_FLAGS)"; then \
+	  : true; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) pablohdf; \
+	fi
+
+pablohdf::		FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) pablonofortran;; \
+	*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) libdf-inst.a;; \
+	esac
+
+libdf-inst.a: $(PABLO_INCLUDES) $(COBJS) $(FOBJS) $(PCOBJS) $(PFOBJS)
+	-$(RM) $(RMFLAGS) libdf-inst.a
+	$(AR) $(ARFLAGS) libdf-inst.a $(COBJS) $(FOBJS) $(PCOBJS) $(PFOBJS)
+	$(RANLIB) libdf-inst.a
+
+pablonofortran: $(PABLO_INCLUDES) $(COBJS) $(PCOBJS) 
+	-$(RM) $(RMFLAGS) libdf-inst.a
+	$(AR) $(ARFLAGS) libdf-inst.a $(COBJS) $(PCOBJS)
+	$(RANLIB) libdf-inst.a
+
+
+nofortran: all
+
+rebuild:
+	@$(MAKE) all $(HDF_FLAGS) FRC=force_rebuild
+
+rebuildnofortran:
+	@$(MAKE) nofortran $(MFLAGS) $(HDF_FLAGS) FRC=force_rebuild
+
+# Leave this target blank with no actions, the rebuild macros above depend on it
+force_rebuild:
+
+$(FOBJS): $(FRC)
+
+debug: libdf-inst.a
+
+saber:
+	#load -D$(MACHINE) $(CSRCS) $(TSRCS) -lc
+
+install::  FORCE
+	@if test -z "$(PABLO_FLAGS)"; then \
+	  : true; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) pinstall-lib; \
+	fi
+
+install-lib:: install
+
+install-includes:: FORCE
+	@if test -z "$(PABLO_FLAGS)"; then \
+	  : true; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) pinstall-headers; \
+	fi
+
+pinstall-lib: pinstall-headers
+	$(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n
+	( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n )
+	mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
+
+pinstall-headers:
+	for p in $(PINCS); do \
+	    $(INSTALL_DATA) \
+		`pwd`/$$p $(includedir)/$$p; \
+	done
+
+depend:
+	makedepend -fMakefile -- $(CSRCS)
+
+clean:
+	-$(RM) $(RMFLAGS) *.o  libdf-inst.a
+
+distclean:
+	-$(RM) $(RMFLAGS) *.o  libdf-inst.a config.status Makefile
+
+lint: $(CSRCS) 
+	$(LINT) $(LINTFLAGS) $(CSRCS)
+
+TAGS: $(CSRCS) $(CHDRS)
+	etags $(CSRCS) $(CHDRS)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = hdf/src
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# for auto remaking, see toplevel Makefile
+#Makefile: $(TOP_SRCDIR)/config.status Makefile.in
+#	CONFIG_FILES=$@ CONFIG_HEADERS= $(TOP_SRCDIR)/config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+help:
+	@echo ""
+	@echo "Make supports the following targets"
+	@echo "make help    - prints this usage section"
+	@echo "make all     - (DEFAULT) makes Pablo stubs"
+	@echo "make pablohdf       - makes Pablo stubs "
+	@echo "make pablonofortran - makes Pablo stubs excluding fortran support"
+	@echo "make rebuild      - rebuilds Pablo stubs "
+	@echo "make rebuildnofortran - rebuilds Pablo stubs excluding"
+	@echo "                        fortran support "
+	@echo "make install          - install Pablo includes, "
+	@echo "make clean     - cleans up Pablo stubs (*.o,..)"
+	@echo "make distclean - cleans up Pablo stubs including"
+	@echo "                 configuration(Makefiles,config.status,..)"
+	@echo ""
+
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+ 
+PABLO_INCLUDES = HDFentryNames.h HDFidList.h ProcIDs.h HDFTrace.h ProcTrace.h \
+		 ProcTrace.inc
+
+HDFentries.txt: ../src/*.c
+	grep "TRACE_ON" ../src/*.c ../../mfhdf/libsrc/*.c | sed "s/.*ID_//;s/[ ]*).*//" | sort -u > $@
+
+HDFentryNames.h: HDFentries.txt
+	sed "s/.*/\"&\",/" $? > $@
+
+HDFidList.h: HDFentries.txt
+	sed "s/.*/ID_&,/" $? > $@
+	echo ID_ALLHDF, >> $@
+	grep "#define[ 	]*PABLO_mask" ../src/*.c ../../mfhdf/libsrc/*.c | \
+	sed "s/.*ID_/ID_/;s/.*/&,/" | sort -u >> $@
+
+ProcIDs.h: HDFidList.h
+
+ProcTrace.inc: HDFidList.h
+	sed "=" $? | sed -f PabloSedscr > $@
+	echo "      integer RuntimeTrace"  >> $@
+	echo "      integer SummaryTrace"  >> $@
+	echo "      integer MPIRuntimeTrace"  >> $@
+	echo "      integer MPISummaryTrace"  >> $@
+	echo "      integer NoTrace"  >> $@
+	echo "      parameter (RuntimeTrace = 0)"  >> $@
+	echo "      parameter (SummaryTrace = 1)"  >> $@
+	echo "      parameter (MPIRuntimeTrace = 2)"  >> $@
+	echo "      parameter (MPISummaryTrace = 3)"  >> $@
+	echo "      parameter (NoTrace = 4)"  >> $@
+
+PabloHDF.o: PabloHDF.c $(PABLO_INCLUDES)
+	$(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $<
+PabloHDF_RT.o: PabloHDF_RT.c $(PABLO_INCLUDES)
+	$(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $<
+PabloHDF_SDDF.o: PabloHDF_SDDF.c $(PABLO_INCLUDES)
+	$(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $<
+PabloHDFff.o: PabloHDFff.f ProcTrace.inc
+	$(FC) $(FFLAGS) -c $<
+ 
+#get all the source dependecies.....
+# the dependencies don't work well
+include depend
+

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1743 @@
+/*  This file is part of the Pablo Performance Analysis Environment
+// 
+//           (R)
+//  The Pablo    Performance Analysis Environment software is NOT in
+//  the public domain.  However, it is freely available without fee for
+//  education, research, and non-profit purposes.  By obtaining copies
+//  of this and other files that comprise the Pablo Performance Analysis
+//  Environment, you, the Licensee, agree to abide by the following
+//  conditions and understandings with respect to the copyrighted software:
+//  
+//  1.  The software is copyrighted in the name of the Board of Trustees
+//      of the University of Illinois (UI), and ownership of the software
+//      remains with the UI. 
+// 
+//  2.  Permission to use, copy, and modify this software and its documentation
+//      for education, research, and non-profit purposes is hereby granted
+//      to Licensee, provided that the copyright notice, the original author's
+//      names and unit identification, and this permission notice appear on
+//      all such copies, and that no charge be made for such copies.  Any
+//      entity desiring permission to incorporate this software into commercial
+//      products should contact:
+// 
+//           Professor Daniel A. Reed                 reed at cs.uiuc.edu
+//           University of Illinois
+//           Department of Computer Science
+//           2413 Digital Computer Laboratory
+//           1304 West Springfield Avenue
+//           Urbana, Illinois  61801
+//           USA
+// 
+//  3.  Licensee may not use the name, logo, or any other symbol of the UI
+//      nor the names of any of its employees nor any adaptation thereof in
+//      advertizing or publicity pertaining to the software without specific
+//      prior written approval of the UI.
+// 
+//  4.  THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE
+//      SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS
+//      OR IMPLIED WARRANTY.
+// 
+//  5.  The UI shall not be liable for any damages suffered by Licensee from
+//      the use of this software.
+// 
+//  6.  The software was developed under agreements between the UI and the
+//      Federal Government which entitle the Government to certain rights.
+// 
+// *************************************************************************
+// 
+//  Developed by: The Pablo Research Group
+//                University of Illinois at Urbana-Champaign
+//                Department of Computer Science
+//                1304 W. Springfield Avenue
+//                Urbana, IL     61801
+// 
+//                http://www-pablo.cs.uiuc.edu
+// 
+//  Send comments to: pablo-feedback at guitar.cs.uiuc.edu
+// 
+//  Copyright (c) 1987-1998
+//  The University of Illinois Board of Trustees.
+//       All Rights Reserved.
+// 
+//  PABLO is a registered trademark of
+//  The Board of Trustees of the University of Illinois
+//  registered in the U.S. Patent and Trademark Office.
+// 
+//  Project Manager and Principal Investigator:
+//       Daniel A. Reed (reed at cs.uiuc.edu)
+// 
+// Funded in part by the Defense Advanced Research Projects Agency under 
+// DARPA contracts DABT63-94-C0049 (SIO Initiative), F30602-96-C-0161,
+// and DABT63-96-C-0027 by the National Science Foundation under the PACI 
+// program and grants NSF CDA 94-01124 and ASC 97-20202, and by the 
+// Department of Energy under contracts DOE B-341494, W-7405-ENG-48, and 
+// 1-B-333164.
+//========================================================================*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#ifndef fileno
+int fileno ( FILE * );
+#endif
+/* on ipsc/860 don't include this or you'll get multiply defined SEEK_* */
+#ifndef __NX
+#include <unistd.h>
+#endif
+
+
+#define HDFtrace3OPEN__
+int HDFtrace3OPEN( const char *, int, mode_t );
+
+#include "SDDFparam.h" 
+#include "TraceParam.h"
+
+#include "SystemDepend.h"
+#include "Trace.h"
+
+#include "IO_TraceParams.h"
+#include "HDFIOTrace.h"
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+/* mode_t is not defined on the ipsc/860 so we define it here */
+#ifdef __NX
+typedef unsigned int mode_t;
+#endif
+
+int OUTPUT_SWITCH = 1;
+int *procTrace;
+extern void preInitIOTrace( void ); 
+
+#include "ProcIDs.h"
+#include "HDFTrace.h"
+#include "IOTrace.h"
+
+#define	ID_HDFprocName		9996
+#define	ID_malloc		9997
+#define	ID_free			9998
+#define	ID_timeStamp		9999
+#define	DUMMY_HDF		10000
+
+#ifdef HAVE_PARALLEL
+#include "mpio.h"
+#endif /* HAVE_PARALLEL*/
+
+void HDFinitTrace_RT ( const char *, int );
+void HDFinitTrace_SDDF ( const char *, int );
+void hdfendtracef_ ( void ) ;
+void HDFendTrace_RT (int);
+void HDFendTrace_SDDF(int);
+void HDFfinalTimeStamp( void );
+void startHDFtraceEvent (int );
+int computeProcMask (int eventID);
+int computePacketTag(int eventID);
+void endHDFtraceEvent (int , int , char *, int );
+void traceEvent ( int , char *, unsigned );
+void HDFtraceEvent_RT ( int , HDFsetInfo *, unsigned );
+void HDFtraceIOEvent( int , void *, unsigned );
+extern int IOtracingEnabled;
+char *hdfRecordPointer;
+double WriteTotals = 0.0;
+double ReadTotals = 0.0;
+/*======================================================================*
+// NAME									*
+//     HDFinitTrace -- initialize HDF tracing				*
+// USAGE								*
+//     VOID HDFinitTrace( traceFileName, out_sw )			*
+//     char    *traceFileName;	IN: name of the generated trace output  *
+//				    file				*
+//     int     ...   		IN: indicates which routines to trace	*
+//				    The list is terminated by the 	*
+//				    OUTPUT_SWITCH value indicating	*
+//				    whether to do RunTime or Summary	*
+//				    tracing.				*
+// RETURNS								*
+//     None.								*
+//======================================================================*/
+/*======================================================================*
+// fortran to C interface.  						*
+// This program is called from hdfinittracef in PabloHDFf.f which 	*
+// turns the FORTRAN character string into an array.			*
+//======================================================================*/
+void hinittracex_( char *file, int *len, int flags[], int *nflags,
+                                                       unsigned *out_sw )
+{
+        char *traceFileName;
+	int i;
+	traceFileName = (char *)malloc(*len+1);
+	for ( i = 0; i < *len; ++i ) {
+	   traceFileName[i] = file[i];
+	}
+	traceFileName[*len+1] = 0;
+	/*==============================================================*
+	// Allocate space for trace indicators.				*
+	//==============================================================*/
+        procTrace = ( int * ) malloc( NUM_HDF_IDS*sizeof(int) );
+        if ( procTrace == NULL ) {
+           fprintf(stderr,">> Error: Unable to allocate procTrace ");
+           fprintf(stderr,"array in program HDFinitTrace. <<<\n");
+           fprintf(stderr,">>> Exiting program! <<<\n");
+           exit (-1);
+	}
+	/*==============================================================*
+	// Initialize to 0.						*
+	//==============================================================*/
+	for ( i = 0; i <= NUM_HDF_IDS; ++i ) {
+	   procTrace[i] = 0;      
+	}
+	/*==============================================================*
+	// Read in the flags indicating which procedures to trace.	*
+	// The last parameter passed is an indicator of the type of 	*
+	// tracing to do.  This indicator has a value larger than any   *
+	// of the flags.						*
+	//==============================================================*/
+	for ( i = 0; i < *nflags; ++i ) {
+	   procTrace[flags[i]] = 1;
+	}
+	OUTPUT_SWITCH = *out_sw;
+	/*==============================================================*
+	// if no flags were passed, the default is to trace all of the  *
+	// procedures.							*
+	//==============================================================*/
+	if ( *nflags == 0 || procTrace[ID_ALLHDF] ) {
+	   for ( i = ID_HDF_Last_Entry + 1; i < NUM_HDF_IDS; ++i ) {
+	      procTrace[i] = 1;      
+	   }
+   	}
+	if ( OUTPUT_SWITCH == RUNTIME_TRACE 
+	                     || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) {
+	   HDFinitTrace_SDDF( traceFileName, OUTPUT_SWITCH );
+	   IOtracingEnabled = 1;
+	} else if ( OUTPUT_SWITCH == SUMMARY_TRACE 
+	                     || OUTPUT_SWITCH == MPI_SUMMARY_TRACE ) {
+	   HDFinitTrace_RT( traceFileName, OUTPUT_SWITCH );
+	   IOtracingEnabled = 1;
+	} else if ( OUTPUT_SWITCH == NO_TRACE ) {
+	   IOtracingEnabled = 0;
+	} else {
+	   fprintf(stderr,">> Error in HDFinitTrace: the third argument ");
+           fprintf(stderr,"must have a value between %4d<<\n",RUNTIME_TRACE);
+	   fprintf(stderr,">> and %4d, inclusive.",NO_TRACE);
+	   fprintf(stderr,"  The value received was %4u.", OUTPUT_SWITCH);
+	   fprintf(stderr," Exiting Program.     <<\n");
+	   exit (-1);
+	}
+}
+void HDFinitTrace( const char *traceFileName, int id_flag, ... )
+{
+	int i, nIDs;
+	va_list ap;
+
+	/*==============================================================*
+	// Allocate space for trace indicators.				*
+	//==============================================================*/
+        procTrace = ( int * ) malloc( NUM_HDF_IDS*sizeof(int) );
+        if ( procTrace == NULL ) {
+           fprintf(stderr,">> Error: Unable to allocate procTrace ");
+           fprintf(stderr,"array in program HDFinitTrace. <<<\n");
+           fprintf(stderr,">>> Exiting program! <<<\n");
+           exit (-1);
+	}
+	/*==============================================================*
+	// Initialize to 0.						*
+	//==============================================================*/
+	for ( i = 0; i < NUM_HDF_IDS; ++i ) {
+	   procTrace[i] = 0;      
+	}
+	/*==============================================================*
+	// Read in the flags indicating which procedures to trace.	*
+	// The last parameter passed is an indicator of the type of 	*
+	// tracing to do.  This indicator has a value larger than any   *
+	// of the flags.						*
+	//==============================================================*/
+	nIDs = 0;
+	va_start( ap, id_flag );
+	while ( id_flag > NO_TRACE ) {
+	   procTrace[id_flag] = 1;
+	   ++nIDs;
+           id_flag = va_arg ( ap, int );
+	}
+	OUTPUT_SWITCH = id_flag;
+	/*==============================================================*
+	// if no flags were passed, the default is to trace all of the  *
+	// procedures.							*
+	//==============================================================*/
+	if ( nIDs == 0 || procTrace[ID_ALLHDF] ) {
+	   for ( i = ID_HDF_Last_Entry + 1; i < NUM_HDF_IDS; ++i ) {
+	      procTrace[i] = 1;      
+	   }
+   	}
+	if ( OUTPUT_SWITCH == RUNTIME_TRACE 
+	                     || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) {
+	   HDFinitTrace_SDDF( traceFileName, OUTPUT_SWITCH );
+	   IOtracingEnabled = 1;
+	} else if ( OUTPUT_SWITCH == SUMMARY_TRACE 
+	                     || OUTPUT_SWITCH == MPI_SUMMARY_TRACE ) {
+	   HDFinitTrace_RT( traceFileName, OUTPUT_SWITCH );
+	   IOtracingEnabled = 1;
+        } else if ( OUTPUT_SWITCH == NO_TRACE ) {
+           IOtracingEnabled = 0;
+        } else {
+           fprintf(stderr,">> Error in HDFinitTrace: the third argument ");
+           fprintf(stderr,"must have a value between %4d<<\n",RUNTIME_TRACE);
+           fprintf(stderr,">> and %4d, inclusive.",NO_TRACE);
+           fprintf(stderr,"  The value received was %4u.", OUTPUT_SWITCH);
+           fprintf(stderr," Exiting Program.     <<\n");
+           exit (-1);
+        }
+}
+/*======================================================================*
+// NAME									*
+//     HDFendTrace -- end HDF tracing					*
+// USAGE								*
+//     VOID HDFendTrace(VOID)						*
+// RETURNS								*
+//     None.								*
+//======================================================================*/
+void hdfendtracef_( void ) 
+{
+	HDFendTrace ();
+}
+void HDFendTrace(void)
+{
+	if ( OUTPUT_SWITCH == RUNTIME_TRACE 
+	                     || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) {
+	   HDFendTrace_SDDF( OUTPUT_SWITCH );
+	} else if ( OUTPUT_SWITCH == SUMMARY_TRACE 
+	                     || OUTPUT_SWITCH == MPI_SUMMARY_TRACE ) {
+	   HDFendTrace_RT( OUTPUT_SWITCH );
+	}
+}
+void startHDFtraceEvent(int eventID)
+{
+	if ( OUTPUT_SWITCH == RUNTIME_TRACE 
+	                     || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) {
+	   traceEvent( eventID, NULL, 0 ) ;
+	} else {
+	   HDFtraceEvent_RT( eventID, NULL, 0 ) ;
+	} 
+}
+void endHDFtraceEvent(int eventID, int setID, char *setName, int IDtype )
+{
+	HDFsetInfo info;
+	info.setID = setID;
+	info.setName = setName;
+	if ( OUTPUT_SWITCH == RUNTIME_TRACE 
+	                     || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) {
+	   traceEvent( eventID, (char *)&info, 0 ) ;
+	} else if ( OUTPUT_SWITCH == SUMMARY_TRACE 
+	                     || OUTPUT_SWITCH == MPI_SUMMARY_TRACE ) {
+	   HDFtraceEvent_RT( eventID, &info, 0 ) ;
+	} else if ( OUTPUT_SWITCH != NO_TRACE ) {
+	   fprintf(stderr,"endHDFtraceEvent: ");
+	   fprintf(stderr,"invalid OUTPUT_SWITCH %d, IDtype = %d\n",
+                                                  OUTPUT_SWITCH, IDtype ) ;
+	}
+}
+/******************************************************************************/
+
+/*+	Open routines      			                             +*/
+/*+     -------------            				             +*/
+/*+	                                                                     +*/
+/*+ Routine:  FILE *HDFtraceFOPEN( const char *filename, const char *type )  +*/
+/*+		  substitute for fopen()                                     +*/
+/*+     	  generates fopenBeginID, fopenEndID		             +*/
+/*+		  record Open (fopenBegin)                                   +*/
+/*+			Mode = -1                                            +*/
+/*+									     +*/
+FILE *HDFtraceFOPEN( const char *filename, const char *type )
+{
+    FILE *fp;
+    int fd, id;
+    int flags = 0;
+    struct open_args openArgs;
+    size_t typeLen;
+	
+    if ( IOtracingEnabled ) {
+        strcpy( openArgs.filename, filename );
+	 
+	/* check for 'b' - usually if 2 chars, second is '+' */
+	typeLen = strlen( type );
+	if ( ( typeLen == 2 ) && ( type [1] == 'b' ) ) {
+	    typeLen = 1;
+	}
+
+        if ( typeLen == 1 ) {
+            switch( type[0] ) {
+              case 'r':
+                  flags = flags | O_RDONLY;
+                  break;
+              case 'w':
+                  flags = O_TRUNC | O_CREAT | O_WRONLY;
+                  break;
+              case 'a':
+                  flags = flags | O_APPEND | O_CREAT | O_WRONLY;
+                  break;
+            }
+        } else {
+            switch( type[0] ) {
+              case 'r':
+                  flags = O_RDWR;
+                  break;
+              case 'w':
+                  flags = O_TRUNC | O_CREAT | O_RDWR;
+                  break;
+              case 'a':
+                  flags = O_APPEND | O_CREAT | O_RDWR;
+                  break;    
+            }
+        }
+        openArgs.flags = flags;
+        openArgs.mode= -1;
+
+        HDFtraceIOEvent( fopenBeginID, (void *)&openArgs, sizeof(openArgs) );
+    }
+
+    fp = fopen( filename, type );
+    if ( fp != NULL ) {
+	fd = fileno( fp );
+        id = set_c_mappedID( fd );
+    } else {
+        id = -1;
+    }
+
+    if ( IOtracingEnabled ) {
+        HDFtraceIOEvent( fopenEndID, (void *) &id, int_SIZE );   
+    }
+
+    return( fp );
+}
+
+/*+	Routine:  int HDFtraceCREAT( const char *path, mode_t mode )         +*/
+/*+		  substitute for creat()                                     +*/
+/*+     	  generates openBeginID, openEndID		             +*/
+/*+		  record Open (openBeginID)                                  +*/
+/*+									     +*/
+int HDFtraceCREAT( const char *path, mode_t mode )
+{
+    struct open_args openArgs;
+    int fd;
+    int id;
+
+    if ( IOtracingEnabled ) {
+        strcpy( openArgs.filename, path );
+        openArgs.flags = O_WRONLY | O_CREAT | O_TRUNC;
+        openArgs.mode = (int) mode;
+
+        HDFtraceIOEvent( openBeginID, (void *)&openArgs, sizeof(openArgs) );
+    }
+
+    fd = creat( path, mode );
+    id = set_c_mappedID( fd );
+
+    if ( IOtracingEnabled ) {
+        HDFtraceIOEvent( openEndID, (void *) &id, int_SIZE );
+    }
+
+    return( fd );
+}
+
+/******************************************************************************/
+
+/*+	Flush routines				                             +*/
+/*+     --------------				                             +*/
+/*+	                                                                     +*/
+/*+	Routine:  int HDFtraceFFLUSH( FILE *stream )                         +*/
+/*+		  substitute for fflush()                                    +*/
+/*+               generates fflushBeginID, fflushEndID                       +*/
+/*+	          record Flush (fflushBeginID)                               +*/
+/*+									     +*/
+int HDFtraceFFLUSH( FILE *stream )
+{
+    int ret;
+    int id;
+    int fd;
+
+    if ( IOtracingEnabled ) {
+	/*
+	 * If stream is NULL, all files open for write are flushed.
+	 * We show this with a -2 in the trace record as too much overhead
+	 * to try and tell what files those are and generate individual
+	 * trace records.
+	 */
+        if ( stream == NULL ) {   
+	    id = -2;
+        } else {
+            fd = fileno( stream );
+	    id = c_mappedID( fd );
+            HDFtraceIOEvent( fflushBeginID, (void *) 0, int_SIZE );
+        }
+    }
+
+    ret = fflush( stream );
+
+    if ( IOtracingEnabled ) {
+        HDFtraceIOEvent( fflushEndID, (void *) &id, 0 );
+    }
+
+    /* 
+     * Note that if fflush called on stream open for reading, the file pointer
+     * is moved to EOF if it isn't there already.  We don't account for that
+     * in our file positioning information.
+     */
+
+    return( ret );
+}
+
+/******************************************************************************/
+/*+	Close routines				                             +*/
+/*+     --------------				                             +*/
+/*+	                                                                     +*/
+/*+	Routine:  int HDFtraceFCLOSE( FILE *stream )                         +*/
+/*+		  substitute for fclose()                                    +*/
+/*+               generates fcloseBeginID, fcloseEndID                       +*/
+/*+	          record Close (fcloseBeginID)                               +*/
+/*+									     +*/
+int HDFtraceFCLOSE( FILE *stream )
+{
+    int ret;
+    int id;
+    int fd = fileno( stream );
+
+    if ( IOtracingEnabled ) {
+	id = c_mappedID( fd );
+        HDFtraceIOEvent( fcloseBeginID, (void *) &id, int_SIZE );
+    }
+
+    ret = fclose( stream );
+
+    if ( IOtracingEnabled ) {
+        HDFtraceIOEvent( fcloseEndID, (void *) 0, 0 );
+    }
+
+    return( ret );
+}
+
+/*+     Routine:  int HDFtrace3OPEN( char *path, int flags, mode_t mode )    +*/
+/*+               substitute for open() when called with 3 arguments         +*/
+/*+               generates openBeginID, openEndID                           +*/
+/*+               record Open (openBeginID)                                  +*/
+/*+                                                                          +*/
+int HDFtrace3OPEN( const char *path, int flags, mode_t mode )
+{
+    struct open_args openArgs;
+    int fd;
+    int id;
+
+    if ( IOtracingEnabled ) {
+        strcpy( openArgs.filename, path );
+        openArgs.flags = flags;
+        openArgs.mode = (int) mode;
+
+        HDFtraceIOEvent( openBeginID, (char *)&openArgs, sizeof(openArgs) );
+    }
+
+    fd = open( path, flags, mode );
+    id = set_c_mappedID( fd );
+
+    if ( IOtracingEnabled ) {
+        HDFtraceIOEvent( openEndID, (char *) &id, int_SIZE );
+    }
+
+    return( fd );
+}
+
+/*+	Routine:  int HDFtraceCLOSE( int fd )	                             +*/
+/*+		  substitute for close()              			     +*/
+/*+               generates closeBeginID, closeEndID 		             +*/
+/*+		  record Close (closeBeginID)                                +*/
+/*+									     +*/
+int HDFtraceCLOSE( int fd )
+{
+    int ret;
+    int id;
+
+    if ( IOtracingEnabled ) {
+	id = c_mappedID( fd );
+        HDFtraceIOEvent( closeBeginID, (void *) &id, int_SIZE );
+    }
+
+    ret = close( fd );
+
+    if ( IOtracingEnabled ) {
+        HDFtraceIOEvent( closeEndID, (void *) 0, 0 );
+    }
+
+    return( ret );
+}
+
+/******************************************************************************/
+/*+	Read routines	            			                     +*/
+/*+     -------------			            	                     +*/
+/*+	                                                                     +*/
+/*+	Routine:  int HDFtraceREAD( int fd, char *buf, int nbyte )           +*/
+/*+		  substitute for read()                                      +*/
+/*+               generates readBeginID, readEndID                           +*/
+/*+	          record Read (readBeginID)                                  +*/
+/*+                      Number Variables = 1                                +*/
+/*+			 Cause = -1                                          +*/
+/*+									     +*/
+ssize_t HDFtraceREAD( int fd, void *buf, size_t nbyte )
+{
+    struct read_write_args readArgs;  
+    ssize_t ret;
+    int bytes;
+    CLOCK t1, t2, incDur;
+
+    if ( IOtracingEnabled ) {
+        readArgs.fileID = c_mappedID( fd );
+        readArgs.numVariables = 1;
+        readArgs.cause = -1;   
+
+        HDFtraceIOEvent( readBeginID, (void *) &readArgs, sizeof(readArgs) );
+    }
+
+    t1 = getClock();
+    ret = read( fd, buf, nbyte );
+    t2 = getClock();
+    incDur = clockSubtract(t2,t1);
+    ReadTotals += clockToSeconds( incDur );
+
+    if ( IOtracingEnabled ) {
+        if ( ret > 0 ) {
+           bytes = (int)ret;
+	} else { 
+           bytes = 0;
+	} 
+        HDFtraceIOEvent( readEndID, (void *) &bytes, int_SIZE );
+    }
+
+    return( ret );
+}
+       
+/*+	Routine:  int HDFtraceFREAD( char *ptr, int size, int nitems,        +*/
+/*+			          FILE *stream)                              +*/
+/*+		  substitute for fread()                                     +*/
+/*+               generates freadBeginID, freadEndID                         +*/
+/*+	          record Read (freadBeginID)                                 +*/
+/*+                      Number Variables = nitems                           +*/
+/*+			 Cause = -1                                          +*/
+/*+									     +*/
+size_t HDFtraceFREAD( void *ptr, size_t size, size_t nitems, FILE *stream )
+{
+    struct read_write_args readArgs;  
+    size_t ret;
+    int nbytes;
+    int fd = fileno( stream );
+	CLOCK t1, t2, incDur;
+
+    if ( IOtracingEnabled ) {
+        readArgs.fileID = c_mappedID( fd );
+        readArgs.numVariables = nitems;
+        readArgs.cause = -1;
+        HDFtraceIOEvent( freadBeginID, (void *) &readArgs, sizeof(readArgs) );
+    }
+
+    t1 = getClock();
+    ret = fread( ptr, size, nitems, stream );
+    t2 = getClock();
+    incDur = clockSubtract(t2,t1);
+    ReadTotals += clockToSeconds( incDur );
+
+    if ( IOtracingEnabled ) {
+        if ( ret > 0 ) {
+           nbytes = (int)(ret * size) ;
+	} else {
+           nbytes = 0;
+	}
+        HDFtraceIOEvent( freadEndID, (void *) &nbytes, int_SIZE );
+    }
+
+    return( ret );
+}
+
+       
+/******************************************************************************/
+/*+	Seek routines            			                     +*/
+/*+     -------------			            	                     +*/
+/*+	                                                                     +*/
+/*+	Routine:  off_t HDFtraceLSEEK( int fd, off_t offset, int whence )    +*/
+/*+		  substitute for lseek()                                     +*/
+/*+               generates lseekBeginID, lseekEndID                         +*/
+/*+	          record Seek (lseekBeginID)                                 +*/
+/*+									     +*/
+off_t HDFtraceLSEEK( int fd, off_t offset, int whence )
+{
+    struct seek_args seekArgs;
+    off_t ret;
+    long  arg;
+
+    if ( IOtracingEnabled ) {
+        seekArgs.fileID = c_mappedID( fd );
+        seekArgs.offset = (int) offset;
+        seekArgs.whence = whence;
+
+        HDFtraceIOEvent( lseekBeginID, (void *) &seekArgs, sizeof(seekArgs) );
+    }
+
+    ret = lseek( fd, offset, whence );
+
+    if ( IOtracingEnabled ) {
+	arg = (long) ret;
+        HDFtraceIOEvent( lseekEndID, (void *)&arg, long_SIZE );
+    }
+
+    return( ret );
+}
+
+/*+ routine:  int HDF traceFSEEK( FILE *stream, long offset, int whence )    +*/
+/*+		  substitute for fseek()                                     +*/
+/*+               generates fseekBeginID, fseekEndID                         +*/
+/*+	          record Seek (fseekBeginID)                                 +*/
+/*+									     +*/
+int HDFtraceFSEEK( FILE *stream, long offset, int whence )
+{
+    struct seek_args seekArgs;
+    int ret;
+    long arg;
+    int fd = fileno( stream );
+
+    if ( IOtracingEnabled ) {
+        seekArgs.fileID = c_mappedID( fd );;
+        seekArgs.offset = (int) offset;
+        seekArgs.whence = whence;
+
+        HDFtraceIOEvent( fseekBeginID, (void *) &seekArgs, sizeof(seekArgs) );
+    }
+
+    ret = fseek( stream, offset, whence );
+
+    if ( IOtracingEnabled ) {
+	arg = ftell( stream );
+        HDFtraceIOEvent( fseekEndID, (void *)&arg, long_SIZE );
+    }
+
+    return( ret );
+}
+
+#ifdef fpos_t
+/*+ Routine:  int HDFtraceFSETPOS( FILE *stream, const fpos_t *position )   +*/
+/*+		  substitute for fsetpos()                                   +*/
+/*+               generates fsetposBeginID, fsetposEndID                     +*/
+/*+	          record Seek (fsetposBeginID)                               +*/
+/*+									     +*/
+int HDFtraceFSETPOS( FILE stream, const fpos_t *position )
+{
+    struct seek_args seekArgs;
+    int ret;
+    long arg;
+    int fd = fileno( stream );
+
+    if ( IOtracingEnabled ) {
+        seekArgs.fileID = c_mappedID( fd );;
+        seekArgs.offset = (int) *position;
+        seekArgs.whence = SEEK_SET;
+
+        HDFtraceIOEvent( fsetposBeginID, (void *) &seekArgs, sizeof(seekArgs) );
+    }
+
+    ret = fsetpos( stream, position );
+
+    if ( IOtracingEnabled ) {
+	arg = (long) *position;
+        HDFtraceIOEvent( fsetposEndID, (void *)&arg, long_SIZE );
+    }
+
+    return( ret );
+}
+#endif /* fpos_t */
+
+/*+	Routine:  void HDFtraceREWIND ( FILE *stream )                       +*/
+/*+		  substitute for rewind()                                    +*/
+/*+               generates rewindBeginID, rewindEndID                       +*/
+/*+	          record Seek (rewindBeginID)                                +*/
+/*+                    	 Offset = 0                                          +*/
+/*+			 Whence = SEEK_SET                                   +*/
+/*+									     +*/
+void HDFtraceREWIND( FILE *stream )
+{
+    struct seek_args seekArgs;
+    long arg;
+    int fd = fileno( stream );
+
+    if ( IOtracingEnabled ) {
+        seekArgs.fileID = c_mappedID( fd );
+        seekArgs.offset = 0;
+        seekArgs.whence = SEEK_SET;
+
+        HDFtraceIOEvent( rewindBeginID, (void *) &seekArgs, sizeof(seekArgs) );
+    }
+
+    rewind( stream );
+
+    if ( IOtracingEnabled ) {
+	arg = 0;
+        HDFtraceIOEvent( rewindEndID, (void *)&arg, long_SIZE );
+    }
+
+    return;
+}
+
+/******************************************************************************/
+/*+	Write routines            			                     +*/
+/*+     --------------			            	                     +*/
+/*+	                                                                     +*/
+/*+  Routine:  int HDFtraceWRITE( int fd, char *buf, int nbyte )             +*/
+/*+		  substitute for write()                                     +*/
+/*+               generates writeBeginID, writeEndID                         +*/
+/*+	          record Write (writeBeginID)                                +*/
+/*+                    	 Number Variables = 1                                +*/
+/*+			 Cause = -1                                          +*/
+/*+									     +*/
+ssize_t HDFtraceWRITE( int fd, const void *buf, size_t nbyte )
+{
+    struct read_write_args writeArgs;
+    ssize_t ret;
+    int bytes;
+    CLOCK t1, t2, incDur;
+
+    if ( IOtracingEnabled ) {
+        writeArgs.fileID = c_mappedID( fd );
+        writeArgs.numVariables = 1;
+        writeArgs.cause = -1;
+
+        HDFtraceIOEvent( writeBeginID, (void *) &writeArgs, sizeof(writeArgs) );
+    }
+
+    t1 = getClock();
+    ret = write( fd, buf, nbyte );
+    t2 = getClock();
+    incDur = clockSubtract(t2,t1);
+    WriteTotals += clockToSeconds( incDur );
+
+    if ( IOtracingEnabled ) {
+        if ( ret > 0 ) {
+           bytes =  (int)ret;
+	} else {
+	   bytes = 0;
+	}
+        HDFtraceIOEvent( writeEndID, (void *) &bytes, int_SIZE );
+    }
+    return( ret );
+}  
+
+/*+  Routine:  size_t HDFtraceFWRITE( const char *ptr, int size, int nitems, +*/
+/*+                                FILE *stream )                            +*/
+/*+		  substitute for fwrite()                                    +*/
+/*+               generates fwriteBeginID, fwriteEndID                       +*/
+/*+	          record Write (fwriteBeginID)                               +*/
+/*+                    	 Number Variables = nitems                           +*/
+/*+			 Cause = -1                                          +*/
+/*+									     +*/
+size_t HDFtraceFWRITE(const void *ptr,size_t size,size_t nitems,FILE *stream )
+
+{
+    struct read_write_args writeArgs;
+    size_t ret;
+    int nbytes;
+    int fd = fileno( stream );
+    CLOCK t1, t2, incDur;
+
+    if ( IOtracingEnabled ) {
+        writeArgs.fileID = c_mappedID( fd );
+        writeArgs.numVariables = nitems;
+        writeArgs.cause = -1;
+
+      HDFtraceIOEvent( fwriteBeginID, (void *) &writeArgs, sizeof(writeArgs) );
+    }
+
+    t1 = getClock();
+    ret = fwrite( ptr, size, nitems, stream );
+    t2 = getClock();
+    incDur = clockSubtract(t2,t1);
+    WriteTotals += clockToSeconds( incDur );
+
+
+    if ( IOtracingEnabled ) {
+        if ( ret > 0 ) {
+           nbytes = (int)(ret * size) ;
+	} else {
+           nbytes = 0;
+	} 
+        HDFtraceIOEvent( fwriteEndID, (void *) &nbytes, int_SIZE );
+    }
+
+    return( ret );
+}
+
+/*+  Routine:  int HDFtracePUTS( char *s )                                   +*/
+/*+		  substitute for puts()                                      +*/
+/*+               generates fwriteBeginID, fwriteEndID                       +*/
+/*+	          record Write (fwriteBeginID)                               +*/
+/*+                    	 Number Variables = 1                                +*/
+/*+			 Cause = -1                                          +*/
+/*+									     +*/
+int HDFtracePUTS( char *s )
+{
+    struct read_write_args writeArgs;
+    int ret;
+    int fd = fileno( stdout );
+
+    if ( IOtracingEnabled ) {
+        writeArgs.fileID = c_mappedID( fd );
+        writeArgs.numVariables = 1;
+        writeArgs.cause = -1;
+
+        HDFtraceIOEvent( fwriteBeginID, (void *) &writeArgs, sizeof(writeArgs) );
+    }
+
+    ret = puts( s );
+
+    if ( IOtracingEnabled ) {
+        HDFtraceIOEvent( fwriteEndID, (void *) &ret, int_SIZE );
+    }
+
+    return( ret );
+}
+       
+/*+	Routine:  int HDFtraceFPUTC( int c, FILE *stream )                   +*/
+/*+		  substitute for fputc()                                     +*/
+/*+               generates fwriteBeginID, fwriteEndID                       +*/
+/*+	          record Write (fwriteBeginID)                               +*/
+/*+                    	 Number Variables = 1                                +*/
+/*+			 Cause = -1                                          +*/
+/*+									     +*/
+int HDFtraceFPUTC( int c, FILE *stream )
+{
+    struct read_write_args writeArgs;
+    int ret; 
+    int nbytes = char_SIZE;
+    int fd = fileno( stream );
+
+    if ( IOtracingEnabled ) {
+        writeArgs.fileID = c_mappedID( fd );
+        writeArgs.numVariables = 1;
+        writeArgs.cause = -1;
+
+        HDFtraceIOEvent( fwriteBeginID, (void *) &writeArgs, sizeof(writeArgs) );
+    }
+
+    ret = fputc( c, stream );
+
+    if ( IOtracingEnabled ) {
+	if ( ret == EOF ) {
+	    nbytes = 0;
+            HDFtraceIOEvent( fwriteEndID, (void *) &nbytes, int_SIZE );
+	}
+    }
+
+    return( ret );
+}
+/*+  Routine:  int HDFtraceFPUTS( char *s, FILE *stream )                    +*/
+/*+		  substitute for fputs()                                     +*/
+/*+               generates fwriteBeginID, fwriteEndID                       +*/
+/*+	          record Write (fwriteBeginID)                               +*/
+/*+                    	 Number Variables = 1                                +*/
+/*+			 Cause = -1                                          +*/
+/*+									     +*/
+int HDFtraceFPUTS( const char *s, FILE *stream )
+{
+    struct read_write_args writeArgs;
+    int ret;
+    int fd = fileno( stream );
+
+    if ( IOtracingEnabled ) {
+        writeArgs.fileID = c_mappedID( fd );
+        writeArgs.numVariables = 1;
+        writeArgs.cause = -1;
+
+        HDFtraceIOEvent(fwriteBeginID, (void *)&writeArgs, sizeof(writeArgs));
+    }
+
+    ret = fputs( s, stream );
+
+    if ( IOtracingEnabled ) {
+        HDFtraceIOEvent( fwriteEndID, (void *) &ret, int_SIZE );
+    }
+
+    return( ret );
+}
+void *HDFtraceMALLOC(size_t bytes )
+{
+	void *ptr;
+	int byte_req;
+	byte_req = (int)bytes;
+	if ( IOtracingEnabled ) {
+	   HDFtraceIOEvent ( ID_malloc, NULL, 0 );
+	}
+	
+	ptr = malloc( bytes );
+
+	if ( IOtracingEnabled ) {
+	   HDFtraceIOEvent ( -ID_malloc, &byte_req, sizeof(int) );
+	}
+	
+	return ptr ;
+
+}
+	
+void HDFtraceIOEvent( int eventType, void *dataPtr, unsigned dataLen )
+{
+	if ( OUTPUT_SWITCH == RUNTIME_TRACE 
+	                     || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) {
+           traceEvent( eventType, dataPtr, dataLen );
+        } else {
+           HDFtraceEvent_RT( eventType, (HDFsetInfo *)dataPtr, dataLen );
+        }
+}
+/*======================================================================*
+// record the final time stamp                                          *
+//======================================================================*/
+void HDFfinalTimeStamp( void )
+{
+        CLOCK   currentTime;
+        double  seconds;
+        struct {
+                int packetLength,
+                    packetType,
+                    packetTag,
+                    timeDim;
+                double Seconds;
+                int eventID,
+                    node,
+                    dataLen;
+        } Packet;
+
+        currentTime = getClock();
+        seconds = clockToSeconds( currentTime );
+
+        Packet.packetLength = sizeof(Packet);
+        Packet.packetType   = PKT_DATA;
+        Packet.packetTag    = FAMILY_EXTERNAL | RECORD_TRACE;
+        Packet.timeDim      = 0;        /* use fp time stamp only */
+        Packet.Seconds      = seconds;  /* fp time stamp          */
+        Packet.eventID      = ID_timeStamp;
+        Packet.node         = TRgetNode();
+        Packet.dataLen      = 0;
+        putBytes( (void *)&Packet , sizeof(Packet) );
+}
+/*======================================================================*
+// This Program is called to specify which routines are to be traced.	*
+// On first entry, the program allocates storage for and initializes a  *
+// global array procTrace.  The array has one element for each possible *
+// HDF procedure and HDF library file.  If a procedure or all of the  *
+// procedure in an HDF file are to be traced, then the elemen in the 	*
+// array corresponding to the procedure or file is turned on.  This is  *
+// used by the macros TRACE_ON and TRACE_OFF to enable tracing.  If     *
+// this procedure is not called prior to initialization, then all of    *
+// the elements of procTrace corresponding to HDF files will be 	*
+// turned on, in which case all HDF procedures will be traced.	*
+//======================================================================*/
+void PabloHDFTrace( int ID ) 
+{
+	int i;
+	if ( procTrace == NULL ) {
+	   procTrace = ( int * ) malloc( NUM_HDF_IDS*sizeof(int) );
+	   if ( procTrace == NULL ) {
+              fprintf(stderr,">> Error: Unable to allocate procTrace ");
+              fprintf(stderr,"array in program PabloHDFTrace. <<<\n");
+              fprintf(stderr," Exiting program.                  <<<\n");
+              exit (-1);
+	   }
+	   for ( i = 0; i < NUM_HDF_IDS; ++i ) {
+	       procTrace[i] = 0;      
+	   }
+	}
+	if ( ID >= 0 && ID < NUM_HDF_IDS ) {
+	   procTrace[ID] = 1;      
+	} else {
+           fprintf(stderr,">> Error: Value passed to PabloHDFTrace, ");
+           fprintf(stderr,"%d, is out of range. <<<\n",ID);
+           fprintf(stderr," Exiting program.                  <<<\n");
+           exit (-1);
+	}
+}
+#ifdef HAVE_PARALLEL
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_open( MPI_Comm comm, char *filename, int amode, 
+                                    MPI_Info info, MPI_File *fh )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+   
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+           returnVal = MPI_File_open( comm, filename, amode, info, fh );
+        } else {
+	   dataLen = sizeof( HDFsetInfo );
+	   dataPtr.setID = (long)fh;
+	   dataPtr.setName = (char *)malloc( strlen(filename) + 1);
+	   strcpy( dataPtr.setName , filename );
+           HDFtraceEvent_RT( HDFmpiOpenID, &dataPtr, dataLen );
+           returnVal = PMPI_File_open( comm, filename, amode, info, fh );
+           HDFtraceEvent_RT( -HDFmpiOpenID, &dataPtr, dataLen );
+        }
+   	return returnVal;
+}
+
+   
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_close( MPI_File *fh )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+   
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+           returnVal = MPI_File_close( fh );
+        } else {
+	   dataLen = sizeof( HDFsetInfo );
+	   dataPtr.setID = (long)fh;
+	   dataPtr.setName = NULL;
+           HDFtraceEvent_RT( HDFmpiCloseID, &dataPtr, dataLen );
+           returnVal = PMPI_File_close( fh );
+           HDFtraceEvent_RT( -HDFmpiCloseID, &dataPtr, dataLen );
+	   free( dataPtr.setName );
+        }
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_delete( char *filename, MPI_Info info )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+   
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_delete( filename, info );
+        } else {
+	   dataLen = sizeof( HDFsetInfo );
+	   dataPtr.setID = 0;
+	   dataPtr.setName = (char *)malloc( sizeof(filename) );
+	   strcpy( dataPtr.setName , filename );
+           HDFtraceEvent_RT( HDFmpiDeleteID, &dataPtr, dataLen );
+   	   returnVal = PMPI_File_delete( filename, info );
+           HDFtraceEvent_RT( -HDFmpiDeleteID, &dataPtr, dataLen );
+	   free( dataPtr.setName );
+        }
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_set_size( MPI_File fh, MPI_Offset size )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+   
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_set_size( fh, size );
+        } else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiSetSizeID,&dataPtr,dataLen );
+   	   returnVal = PMPI_File_set_size( fh, size );
+           HDFtraceEvent_RT( -HDFmpiSetSizeID, &dataPtr, dataLen );
+        }
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_preallocate( MPI_File fh, MPI_Offset size)
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+   
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_preallocate( fh, size);
+        } else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiPreallocateID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_preallocate( fh, size);
+           HDFtraceEvent_RT( -HDFmpiPreallocateID, 
+                             &dataPtr, dataLen );
+        }
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_get_size( MPI_File fh, MPI_Offset *size )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+           returnVal = MPI_File_get_size( fh, size);
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiGetSizeID,
+                             &dataPtr,dataLen );
+           returnVal = PMPI_File_get_size( fh, size);
+           HDFtraceEvent_RT( -HDFmpiGetSizeID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_get_group( MPI_File fh, MPI_Group *group )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+   
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_get_group( fh, group);
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiGetGroupID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_get_group( fh, group);
+           HDFtraceEvent_RT( -HDFmpiGetGroupID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_get_amode( MPI_File fh, int *amode )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_get_amode( fh, amode);
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiGetAmodeID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_get_amode( fh, amode);
+           HDFtraceEvent_RT( -HDFmpiGetAmodeID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_set_view( MPI_File fh, MPI_Offset disp, MPI_Datatype etype, 
+                           MPI_Datatype filetype, char *datarep, MPI_Info info )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_set_view( fh, disp, etype, filetype, 
+                                                      datarep, info );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiSetViewID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_set_view( fh, disp, etype, filetype, 
+                                                      datarep, info );
+           HDFtraceEvent_RT( -HDFmpiSetViewID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_get_view( MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, 
+                           MPI_Datatype *filetype, char *datarep )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_get_view(fh, disp, etype, filetype, datarep);
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiSetViewID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_get_view(fh, disp, etype, filetype, datarep);
+           HDFtraceEvent_RT( -HDFmpiSetViewID,
+                             &dataPtr,dataLen );
+     	   returnVal = PMPI_File_get_view(fh, disp, etype, filetype, datarep);
+
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_read_at( MPI_File fh, MPI_Offset offset, void *buf,
+		         int count, MPI_Datatype datatype, MPI_Status *status )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_read_at( fh, offset, buf, count, datatype, 
+	                                                            status );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiReadAtID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_read_at( fh, offset, buf, count, datatype, 
+	                                                            status );
+           HDFtraceEvent_RT( -HDFmpiReadAtID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_read_at_all( MPI_File fh, MPI_Offset offset, void *buf,
+   			int count, MPI_Datatype datatype, MPI_Status *status )
+{
+   
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_read_at_all( fh, offset, buf, 
+				      count, datatype, status );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiReadAtAllID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_read_at_all( fh, offset, buf, 
+				      count, datatype, status );
+           HDFtraceEvent_RT( -HDFmpiReadAtAllID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_write_at( MPI_File fh, MPI_Offset offset, void *buf,
+                      int count, MPI_Datatype datatype, MPI_Status *status )
+{
+   
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_write_at( fh, offset, buf, count, datatype, 
+	                                                           status );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiWriteAtID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_write_at( fh, offset, buf, count, datatype, 
+	                                                            status );
+           HDFtraceEvent_RT( -HDFmpiWriteAtID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_write_at_all( MPI_File fh, MPI_Offset offset, void *buf,
+                  int count, MPI_Datatype datatype, MPI_Status *status )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_write_at_all( fh, offset, buf, 
+	 	 	       		count, datatype, status );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiWriteAtAllID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_write_at_all( fh, offset, buf, 
+	 			       count, datatype, status );
+           HDFtraceEvent_RT( -HDFmpiWriteAtAllID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_iread_at( MPI_File fh, MPI_Offset offset, void *buf,
+   int count, MPI_Datatype datatype, MPIO_Request *request )
+{
+   return MPI_File_iread_at( fh, offset, buf, count, datatype, request );
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_iwrite_at( MPI_File fh, MPI_Offset offset, void *buf, 
+		int count, MPI_Datatype datatype, MPIO_Request *request)
+{
+   return MPI_File_iwrite_at( fh, offset, buf, count, datatype, request );
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_read( MPI_File fh, void *buf, int count, 
+                       MPI_Datatype datatype, MPI_Status *status)
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_read( fh, buf, count, datatype, status );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiReadID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_read( fh, buf, count, datatype, status );
+           HDFtraceEvent_RT( -HDFmpiReadID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_read_all( MPI_File fh, void *buf, int count, 
+                           MPI_Datatype datatype, MPI_Status *status)
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_read_all( fh, buf, count, datatype, status );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiReadAllID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_read_all( fh, buf, count, datatype, status );
+           HDFtraceEvent_RT( -HDFmpiReadAllID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_write( MPI_File fh, void *buf, int count, 
+                        MPI_Datatype datatype, MPI_Status *status )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+           returnVal = MPI_File_write( fh, buf, count, datatype, status );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiWriteID,
+                             &dataPtr,dataLen );
+           returnVal = PMPI_File_write( fh, buf, count, datatype, status );
+           HDFtraceEvent_RT( -HDFmpiWriteID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_write_all( MPI_File fh, void *buf, int count, 
+                            MPI_Datatype datatype, MPI_Status *status )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal =MPI_File_write_all( fh, buf, count, datatype, status );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiWriteAllID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_write_all( fh, buf, count, datatype, status );
+           HDFtraceEvent_RT( -HDFmpiWriteAllID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_iread( MPI_File fh, void *buf, int count, 
+                        MPI_Datatype datatype, MPIO_Request *request )
+{
+	return MPI_File_iread( fh, buf, count, datatype, request );
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_iwrite( MPI_File fh, void *buf, int count, 
+	                 MPI_Datatype datatype, MPIO_Request *request )
+{
+   return MPI_File_iwrite( fh, buf, count, datatype, request );
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_seek( MPI_File fh, MPI_Offset offset, int whence )
+{
+   
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_seek( fh, offset, whence );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiSeekID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_seek( fh, offset, whence );
+           HDFtraceEvent_RT( -HDFmpiSeekID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_get_position( MPI_File fh, MPI_Offset *offset )
+{
+   
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_get_position( fh, offset );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiGetPositionID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_get_position( fh, offset );
+           HDFtraceEvent_RT( -HDFmpiGetPositionID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_get_byte_offset( MPI_File fh, MPI_Offset offset, 
+                                             MPI_Offset *disp )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_get_byte_offset( fh, offset, disp );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiGetByteOffsetID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_get_byte_offset( fh, offset, disp );
+           HDFtraceEvent_RT( -HDFmpiGetByteOffsetID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_get_type_extent( MPI_File fh, MPI_Datatype datatype, 
+                                               MPI_Aint *extent )
+{
+   
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_get_type_extent( fh, datatype, extent );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiGetTypeExtentID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_get_type_extent( fh, datatype, extent );
+           HDFtraceEvent_RT( -HDFmpiGetTypeExtentID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_set_atomicity( MPI_File fh, int flag )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_set_atomicity( fh, flag );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiSetAtomicityID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_set_atomicity( fh, flag );
+           HDFtraceEvent_RT( -HDFmpiSetAtomicityID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_get_atomicity( MPI_File fh, int *flag )
+{
+   
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+   	   returnVal = MPI_File_get_atomicity( fh, flag );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiGetAtomicityID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_get_atomicity( fh, flag );
+           HDFtraceEvent_RT( -HDFmpiGetAtomicityID,
+                             &dataPtr,dataLen );
+	}
+   	return returnVal;
+}
+
+/*======================================================================* 
+// Pass call through to regular MPIO entry except in case of Real Time	* 
+// tracing.  								* 
+// Note: The regular MPIO entry may or may not be instrumented.		*
+//======================================================================*/
+int HDF_MPI_File_sync( MPI_File fh )
+{
+   	int returnVal;
+   	HDFsetInfo dataPtr;
+   	int dataLen;
+
+        if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { 
+   	   returnVal = MPI_File_sync ( fh );
+	} else {
+	   dataLen = 0;
+           HDFtraceEvent_RT( HDFmpiSyncID,
+                             &dataPtr,dataLen );
+   	   returnVal = PMPI_File_sync ( fh );
+           HDFtraceEvent_RT( -HDFmpiSyncID,
+                             &dataPtr,dataLen );
+	} 
+   	return returnVal;
+}
+
+#endif /* HAVE_PARALLEL */

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,503 @@
+C *
+C * This file is an extension to NCSA HDF to enable the use of the
+C * Pablo trace library.
+C *
+C * Developed by: The TAPESTRY Parallel Computing Laboratory
+C *		  University of Illinois at Urbana-Champaign
+C *		  Department of Computer Science
+C *		  1304 W. Springfield Avenue
+C *		  Urbana, IL	61801
+C *
+C * Copyright (c) 1995
+C * The University of Illinois Board of Trustees.
+C *      All Rights Reserved.
+C *
+C * PABLO is a registered trademark of
+C * The Board of Trustees of the University of Illinois
+C * registered in the U.S. Patent and Trademark Office.
+C *
+C * Author: Jonathan M. Reid (jreid at cs.uiuc.edu)
+C *
+C * Project Manager and Principal Investigator:
+C *	Daniel A. Reed (reed at cs.uiuc.edu)
+C *
+C * Funded by: National Aeronautics and Space Administration under NASA
+C * Contracts NAG-1-613 and USRA 5555-22 and by the Advanced Research
+C * Projects Agency under ARPA contracts DAVT63-91-C-0029 and
+C * DABT63-93-C-0040.
+C *
+
+C *---------------------------------------------------------------------------
+C * File: 	PabloHDF.inc
+C * Purpose:	Fortran header file for Pablo routines
+C * Contents: 
+C *    	Procedure IDs - obtained from ProcIDs.h
+C * Remarks: This file can be included with Fortran user programs who 
+C *          want to enable Pablo tracing.  
+C *---------------------------------------------------------------------------
+
+C IDs for annotation procedures
+
+      integer ID_DFANaddfds,ID_DFANaddfid,ID_DFANgetdesc,ID_DFANgetdesclen
+      integer ID_DFANgetfds,ID_DFANgetfdslen,ID_DFANgetfid,ID_DFANgetfidlen
+      integer ID_DFANgetlabel,ID_DFANgetlablen,ID_DFANlablist,ID_DFANlastref
+      integer ID_DFANputdesc,ID_DFANputlabel, ID_DFANclear
+
+      integer ID_DFPaddpal,ID_DFPgetpal,ID_DFPlastref,ID_DFPnpals
+      integer ID_DFPputpal,ID_DFPreadref,ID_DFPrestart,ID_DFPwriteref
+
+      integer ID_DFR8addimage,ID_DFR8getdims,ID_DFR8getimage,ID_DFR8lastref
+      integer ID_DFR8nimages,ID_DFR8putimage,ID_DFR8readref,ID_DFR8restart
+      integer ID_DFR8setcompress,ID_DFR8setpalette,ID_DFR8writeref
+      integer ID_DFR8Istart
+
+      integer ID_DFSDadddata,ID_DFSDclear,ID_DFSDendslab,ID_DFSDendslice
+      integer ID_DFSDgetcal,ID_DFSDgetdata,ID_DFSDgetdatalen
+      integer ID_DFSDgetdatastrs,ID_DFSDgetdimlen,ID_DFSDgetdims
+      integer ID_DFSDgetdimscale,ID_DFSDgetdimstrs,ID_DFSDgetfillvalue
+      integer ID_DFSDgetNT,ID_DFSDgetrange,ID_DFSDgetslice,ID_DFSDlastref
+      integer ID_DFSDndatasets,ID_DFSDpre32sdg,ID_DFSDputdata,ID_DFSDputslice
+      integer ID_DFSDreadref,ID_DFSDreadslab,ID_DFSDrestart,ID_DFSDsetcal
+      integer ID_DFSDsetdatastrs,ID_DFSDsetdims,ID_DFSDsetdimscale
+      integer ID_DFSDsetdimstrs,ID_DFSDsetfillvalue,ID_DFSDsetlengths
+      integer ID_DFSDsetNT,ID_DFSDsetrange,ID_DFSDstartslab,ID_DFSDstartslice
+      integer ID_DFSDwriteref,ID_DFSDwriteslab
+
+      integer ID_DF24addimage,ID_DF24getdims,ID_DF24getimage,ID_DF24lastref
+      integer ID_DF24nimages,ID_DF24putimage,ID_DF24readref,ID_DF24reqil
+      integer ID_DF24restart,ID_DF24setcompress,ID_DF24setdims,ID_DF24setil
+
+      integer ID_Happendable,ID_Hclose,ID_Hdeldd,ID_Hdupdd,ID_Hendaccess
+      integer ID_Hfind,ID_Hgetelement,ID_Hgetfileversion,ID_Hgetlibversion
+      integer ID_Hinquire,ID_Hishdf,ID_HLcreate,ID_Hlength,ID_Hnewref
+      integer ID_Hnextread,ID_Hnumber,ID_Hoffset,ID_Hopen,ID_Hputelement
+      integer ID_Hread,ID_Hseek,ID_Hstartread,ID_Hstartwrite,ID_Hsync
+      integer ID_Htrunc,ID_Hwrite,ID_HXcreate, ID_HXsetcreatedir,
+      integer ID_HXsetdir, ID_HLconvert, ID_Hstartaccess, ID_Hisappendable
+      integer ID_Htell, ID_Htagnewref, ID_Hcaceh, ID_Hsetaccesstype
+      integer ID_Hexist, ID_Hsetlength, ID_Hfidinquire
+      integer ID_HDdont_atexit, ID_HDreuse_tagref, ID_HIstart 
+      integer ID_HPregister_term_func
+      integer ID_HIbitstart, ID_HMCcreate, ID_HMCsetMaxcache
+      integer ID_HMCPstread, ID_HMCPstwrite, ID_HMCPseek, ID_HMCPchunkread
+      integer ID_HMCreadChunk, ID_HMCPread, ID_HMCPchunkwrite
+      integer ID_HMCwriteChunk, ID_HMCPwrite, ID_HMCPendaccess
+      integer ID_HMCPinfo, ID_HMCPinquire
+
+      integer ID_HEclear,ID_HEprint,ID_HEpush,ID_HEreport,ID_HEstring
+
+      integer ID_SDattrinfo,ID_SDcreate,ID_SDdiminfo,ID_SDend,ID_SDendaccess
+      integer ID_SDfileinfo,ID_SDfindattr,ID_SDgetcal,ID_SDgetdatastrs
+      integer ID_SDgetdimid,ID_SDgetdimscale,ID_SDgetdimstrs,ID_SDgetfillvalue
+      integer ID_SDgetinfo,ID_SDgetrange,ID_SDidtoref,ID_SDiscoordvar
+      integer ID_SDnametoindex,ID_SDreadattr,ID_SDreaddata,ID_SDreftoindex
+      integer ID_SDselect,ID_SDsetattr,ID_SDsetcal,ID_SDsetdatastrs
+      integer ID_SDsetdimname,ID_SDsetdimscale,ID_SDsetdimstrs
+      integer ID_SDsetexternalfile,ID_SDsetfillvalue,ID_SDsetrange,ID_SDstart
+      integer ID_SDwritedata, ID_SDcheckempty
+
+      integer ID_VFfieldesize,ID_VFfieldisize,ID_VFfieldname,ID_VFfieldorder
+      integer ID_VFfieldtype,ID_VFnfields
+
+      integer ID_Vaddtagref,ID_Vattach, ID_Vdeletetagref
+
+      integer ID_Vdetach,ID_Vgetclass,ID_Vgetid
+      integer ID_Vgetname,ID_Vgettagref,ID_Vgettagrefs,ID_Vinqtagref
+      integer ID_Vinquire,ID_Vinsert,ID_Vlone,ID_Vntagrefs,ID_Vsetclass
+      integer ID_Vsetname, ID_Vinitialize, ID_Vfinish, ID_Vfind
+      integer ID_Vfindclass, ID_vpackvs, ID_vunpackvs, ID_vpackvg
+      integer ID_vunpackvg, ID_Vsetattr, ID_Vgetversion, ID_vnattrs
+      integer ID_Vfindattr, ID_Vattrinfo, ID_Vgetattr
+
+      integer ID_VHmakegroup,ID_VHstoredata,ID_VHstoredatam
+
+      integer ID_VSattach,ID_VSdetach,ID_VSelts,ID_VSfdefine,ID_VSfexist
+      integer ID_VSfind,ID_VSgetclass,ID_VSgetfields,ID_VSgetid
+      integer ID_VSgetinterlace,ID_VSgetname,ID_VSinquire,ID_VSlone,ID_VSread
+      integer ID_VSseek,ID_VSsetclass,ID_VSsetfields,ID_VSsetinterlace
+      integer ID_VSsetname,ID_VSsizeof,ID_VSwrite, ID_VSappendable
+      integer ID_VSdelete, ID_VSfindclass, ID_VSfpack, ID_VSfindex
+      integer ID_VSsetattr, ID_VSnattrs, ID_VSfnattrs, ID_VSfindattr
+      integer ID_VSattrinfo, ID_VSgetattr, ID_VSisattr
+
+      integer ID_ANstart, ID_ANfileinfo, ID_ANend, ID_ANcreate, ID_ANcreatef
+      integer ID_ANselect, ID_ANnumann, ID_ANannlist, ID_ANannlen
+      integer ID_ANreadann, ID_ANwriteann, ID_ANendaccess
+
+      integer ID_GRstart, ID_GRfileinfo, ID_GRend, ID_GRcreate, ID_GRselect
+      integer ID_GRnametoindex, ID_GRgetiminfo, ID_GRwriteimage
+      integer ID_GRreadimage, ID_GRendaccess, ID_GRgetdimid
+      integer ID_GRsetdimname, ID_GRdiminfo, ID_GRidtoref, ID_GRreftoindex
+      integer ID_GRreqlutil, ID_GRreqimageil, ID_GRgetlutid
+      integer ID_GRgetlutinfo, ID_GRwritelut, ID_GRreadlut
+      integer ID_GRsetexternalfile, ID_GRsetaccesstype, ID_GRsetcompress
+      integer ID_GRsetattr, ID_GRattrinfo, ID_GRgetattr, ID_GRfindattr
+      integer ID_GRluttoref, ID_GRsetchunk, ID_GRgetchunkinfo
+      integer ID_GRsetchunkcache
+
+      integer ID_HAinit_group, ID_HAdestroy_group, ID_HAregister_atom,
+      integer ID_HAatom_object, ID_HAatom_group, ID_HAremove_atom 
+      integer ID_HAsearch_atom
+
+      integer ID_DAcreate_array, ID_DAdestroy_array, ID_DAsize_array, 
+      integer ID_DAget_elem, ID_DAset_elem, ID_DAdel_elem 
+
+      integer ID_HULcreate_list, ID_HULdestroy_list, ID_HULaddnode
+      integer ID_HULsearch_node, ID_HULfirst_node, ID_HULnext_node
+      integer ID_HULremove_node, ID_HDFnewentry
+
+      parameter(DUMMY_HDF		= 1000,
+     *          BEGIN_HDF		= 1001)
+      parameter(ID_DFAN 		= BEGIN_HDF,
+     *          ID_DFANaddfds           = ID_DFAN,
+     *          ID_DFANaddfid           = ID_DFAN+1,
+     *          ID_DFANgetdesc          = ID_DFAN+2,
+     *          ID_DFANgetdesclen       = ID_DFAN+3,
+     *          ID_DFANgetfds           = ID_DFAN+4,
+     *          ID_DFANgetfdslen        = ID_DFAN+5,
+     *          ID_DFANgetfid           = ID_DFAN+6,
+     *          ID_DFANgetfidlen        = ID_DFAN+7,
+     *          ID_DFANgetlabel         = ID_DFAN+8,
+     *          ID_DFANgetlablen        = ID_DFAN+9,
+     *          ID_DFANlablist          = ID_DFAN+10, 
+     *          ID_DFANlastref          = ID_DFAN+11,
+     *          ID_DFANputdesc          = ID_DFAN+12,
+     *          ID_DFANputlabel         = ID_DFAN+13,
+     *          ID_DFANclear            = ID_DFAN+14)
+
+      parameter(ID_DFP  		= ID_DFAN+15,
+     *          ID_DFPaddpal            = ID_DFP,
+     *          ID_DFPgetpal            = ID_DFP+1,
+     *          ID_DFPlastref           = ID_DFP+2,
+     *          ID_DFPnpals             = ID_DFP+3,
+     *          ID_DFPputpal            = ID_DFP+4,
+     *          ID_DFPreadref           = ID_DFP+5,   
+     *          ID_DFPrestart           = ID_DFP+6,   
+     *          ID_DFPwriteref          = ID_DFP+7)
+
+      parameter(ID_DFR8 		= ID_DFP+8,
+     *          ID_DFR8addimage         = ID_DFR8,
+     *          ID_DFR8getdims          = ID_DFR8+1,
+     *          ID_DFR8getimage         = ID_DFR8+2,
+     *          ID_DFR8lastref          = ID_DFR8+3,
+     *          ID_DFR8nimages          = ID_DFR8+4,
+     *          ID_DFR8putimage         = ID_DFR8+5,
+     *          ID_DFR8readref          = ID_DFR8+6,
+     *          ID_DFR8restart          = ID_DFR8+7,
+     *          ID_DFR8setcompress      = ID_DFR8+8,
+     *          ID_DFR8setpalette       = ID_DFR8+9,
+     *          ID_DFR8writeref         = ID_DFR8+10,
+     *          ID_DFR8Istart           = ID_DFR8+11)
+
+      parameter(ID_DFSD                 = ID_DFR8+12,
+     *          ID_DFSDadddata          = ID_DFSD,
+     *          ID_DFSDclear            = ID_DFSD+1,
+     *          ID_DFSDendslab          = ID_DFSD+2,
+     *          ID_DFSDendslice         = ID_DFSD+3,
+     *          ID_DFSDgetcal           = ID_DFSD+4,
+     *          ID_DFSDgetdata          = ID_DFSD+5,
+     *          ID_DFSDgetdatalen       = ID_DFSD+6,
+     *          ID_DFSDgetdatastrs      = ID_DFSD+7,
+     *          ID_DFSDgetdimlen        = ID_DFSD+8,
+     *          ID_DFSDgetdims          = ID_DFSD+9,
+     *          ID_DFSDgetdimscale      = ID_DFSD+10,
+     *          ID_DFSDgetdimstrs       = ID_DFSD+11,
+     *          ID_DFSDgetfillvalue     = ID_DFSD+12,
+     *          ID_DFSDgetNT            = ID_DFSD+13,
+     *          ID_DFSDgetrange         = ID_DFSD+14,
+     *          ID_DFSDgetslice         = ID_DFSD+15,
+     *          ID_DFSDlastref          = ID_DFSD+16,
+     *          ID_DFSDndatasets        = ID_DFSD+17,
+     *          ID_DFSDpre32sdg         = ID_DFSD+18,
+     *          ID_DFSDputdata          = ID_DFSD+19,
+     *          ID_DFSDputslice         = ID_DFSD+20,
+     *          ID_DFSDreadref          = ID_DFSD+21,
+     *          ID_DFSDreadslab         = ID_DFSD+22,
+     *          ID_DFSDrestart          = ID_DFSD+23,
+     *          ID_DFSDsetcal           = ID_DFSD+24,
+     *          ID_DFSDsetdatastrs      = ID_DFSD+25,
+     *          ID_DFSDsetdims          = ID_DFSD+26,
+     *          ID_DFSDsetdimscale      = ID_DFSD+27,
+     *          ID_DFSDsetdimstrs       = ID_DFSD+28,
+     *          ID_DFSDsetfillvalue     = ID_DFSD+29,
+     *          ID_DFSDsetlengths       = ID_DFSD+30,
+     *          ID_DFSDsetNT            = ID_DFSD+31,
+     *          ID_DFSDsetrange         = ID_DFSD+32,
+     *          ID_DFSDstartslab        = ID_DFSD+33,
+     *          ID_DFSDstartslice       = ID_DFSD+34,
+     *          ID_DFSDwriteref         = ID_DFSD+35,
+     *          ID_DFSDwriteslab        = ID_DFSD+36)
+
+      parameter(ID_DF24                 = ID_DFSD+37,
+     *          ID_DF24addimage         = ID_DF24,
+     *          ID_DF24getdims          = ID_DF24+1,
+     *          ID_DF24getimage         = ID_DF24+2,
+     *          ID_DF24lastref          = ID_DF24+3,
+     *          ID_DF24nimages          = ID_DF24+4,
+     *          ID_DF24putimage         = ID_DF24+5,
+     *          ID_DF24readref          = ID_DF24+6,
+     *          ID_DF24reqil            = ID_DF24+7,
+     *          ID_DF24restart          = ID_DF24+8,
+     *          ID_DF24setcompress      = ID_DF24+9,
+     *          ID_DF24setdims          = ID_DF24+10,
+     *          ID_DF24setil            = ID_DF24+11)
+
+      parameter(ID_H                    = ID_DF24+12,
+     *          ID_Happendable          = ID_H
+     *          ID_Hclose               = ID_H+1,
+     *          ID_Hdeldd               = ID_H+2,
+     *          ID_Hdupdd               = ID_H+3,
+     *          ID_Hendaccess           = ID_H+4,
+     *          ID_Hfind                = ID_H+5,
+     *          ID_Hgetelement          = ID_H+6,
+     *          ID_Hgetfileversion      = ID_H+7,
+     *          ID_Hgetlibversion       = ID_H+8,
+     *          ID_Hinquire             = ID_H+9,
+     *          ID_Hishdf               = ID_H+10,
+     *          ID_HLcreate             = ID_H+11,
+     *          ID_Hlength              = ID_H+12,
+     *          ID_Hnewref              = ID_H+13,
+     *          ID_Hnextread            = ID_H+14,
+     *          ID_Hnumber              = ID_H+15,
+     *          ID_Hoffset              = ID_H+16,
+     *          ID_Hopen                = ID_H+17,
+     *          ID_Hputelement          = ID_H+18,
+     *          ID_Hread                = ID_H+19,
+     *          ID_Hseek                = ID_H+20,
+     *          ID_Hstartread           = ID_H+21,
+     *          ID_Hstartwrite          = ID_H+22,
+     *          ID_Hsync                = ID_H+23,
+     *          ID_Htrunc               = ID_H+24,
+     *          ID_Hwrite               = ID_H+25,
+     *          ID_HXcreate             = ID_H+26,
+     *          ID_HXsetcreatedir       = ID_H+27,
+     *          ID_HXsetdir             = ID_H+28,
+     *          ID_HLconvert            = ID_H+29,
+     *          ID_Hstartaccess         = ID_H+30,
+     *          ID_Hisappendable        = ID_H+31,
+     *          ID_Htell                = ID_H+32,
+     *          ID_Htagnewref           = ID_H+33,
+     *          ID_Hcache               = ID_H+34,
+     *          ID_Hsetaccesstype       = ID_H+35,
+     *          ID_Hexist               = ID_H+36,
+     *          ID_Hsetlength           = ID_H+37,
+     *          ID_Hfindinquire         = ID_H+38,
+     *          ID_HDdont_atexit        = ID_H+39,
+     *          ID_HDreuse_tagref       = ID_H+40,
+     *          ID_HIstart              = ID_H+41,
+     *          ID_HPregister_term_func  = ID_H+42,
+     *          ID_HIbitstart           = ID_H+43,
+     *          ID_HMCcreate            = ID_H+44,
+     *          ID_HMCsetMaxcache       = ID_H+45,
+     *          ID_HMCPstread           = ID_H+46,
+     *          ID_HMCPstwrite          = ID_H+47,
+     *          ID_HMCPseek             = ID_H+48,
+     *          ID_HMCPchunkread        = ID_H+49,
+     *          ID_HMCreadChunk         = ID_H+50,
+     *          ID_HMCPread             = ID_H+51,
+     *          ID_HMCPchunkwrite       = ID_H+52,
+     *          ID_HMCwriteChunk        = ID_H+53,
+     *          ID_HMCPwrite            = ID_H+54,
+     *          ID_HMCPendaccess        = ID_H+55,
+     *          ID_HMCPinfo             = ID_H+56,
+     *          ID_HMCPinquire          = ID_H+57)
+
+      parameter(ID_HE                   = ID_H+58,
+     *          ID_HEclear              = ID_HE,
+     *          ID_HEprint              = ID_HE+1,
+     *          ID_HEpush               = ID_HE+2,
+     *          ID_HEreport             = ID_HE+3,
+     *          ID_HEstring             = ID_HE+4)
+
+      parameter(ID_SD                   = ID_HE+5,
+     *          ID_SDattrinfo           = ID_SD,
+     *          ID_SDcreate             = ID_SD+1,
+     *          ID_SDdiminfo            = ID_SD+2,
+     *          ID_SDend                = ID_SD+3,
+     *          ID_SDendaccess          = ID_SD+4,
+     *          ID_SDfileinfo           = ID_SD+5,
+     *          ID_SDfindattr           = ID_SD+6,
+     *          ID_SDgetcal             = ID_SD+7,
+     *          ID_SDgetdatastrs        = ID_SD+8,
+     *          ID_SDgetdimid           = ID_SD+9,
+     *          ID_SDgetdimscale        = ID_SD+10,
+     *          ID_SDgetdimstrs         = ID_SD+11,
+     *          ID_SDgetfillvalue       = ID_SD+12,
+     *          ID_SDgetinfo            = ID_SD+13,
+     *          ID_SDgetrange           = ID_SD+14,
+     *          ID_SDidtoref            = ID_SD+15,
+     *          ID_SDiscoordvar         = ID_SD+16,
+     *          ID_SDnametoindex        = ID_SD+17,
+     *          ID_SDreadattr           = ID_SD+18,
+     *          ID_SDreaddata           = ID_SD+19,
+     *          ID_SDreftoindex         = ID_SD+20,
+     *          ID_SDselect             = ID_SD+21,
+     *          ID_SDsetattr            = ID_SD+22,
+     *          ID_SDsetcal             = ID_SD+23,
+     *          ID_SDsetdatastrs        = ID_SD+24,
+     *          ID_SDsetdimname         = ID_SD+25,
+     *          ID_SDsetdimscale        = ID_SD+26,
+     *          ID_SDsetdimstrs         = ID_SD+27,
+     *          ID_SDsetexternalfile    = ID_SD+28,
+     *          ID_SDsetfillvalue       = ID_SD+29,
+     *          ID_SDsetrange           = ID_SD+30,
+     *          ID_SDstart              = ID_SD+31,
+     *          ID_SDwritedata          = ID_SD+32)
+
+      parameter(ID_VF                   = ID_SD+33,
+     *          ID_VFfieldesize         = ID_VF,
+     *          ID_VFfieldisize         = ID_VF+1,
+     *          ID_VFfieldname          = ID_VF+2,
+     *          ID_VFfieldorder         = ID_VF+3,
+     *          ID_VFfieldtype          = ID_VF+4,
+     *          ID_VFnfields            = ID_VF+5)
+
+      parameter(ID_V                    = ID_VF+6,
+     *          ID_Vaddtagref           = ID_V,
+     *          ID_Vattach              = ID_V+1,
+     *		ID_Vdeletetagref	= ID_V+2
+     *          ID_Vdetach              = ID_V+3,
+     *          ID_Vgetclass            = ID_V+4,
+     *          ID_Vgetid               = ID_V+5,
+     *          ID_Vgetname             = ID_V+6,
+     *          ID_Vgettagref           = ID_V+7,
+     *          ID_Vgettagrefs          = ID_V+8,
+     *          ID_Vinqtagref           = ID_V+9,
+     *          ID_Vinquire             = ID_V+10,
+     *          ID_Vinsert              = ID_V+11,
+     *          ID_Vlone                = ID_V+12,
+     *          ID_Vntagrefs            = ID_V+13,
+     *          ID_Vsetclass            = ID_V+14,
+     *          ID_Vsetname             = ID_V+15,
+     *          ID_Vinitialize          = ID_V+16,
+     *          ID_Vfinish              = ID_V+17,
+     *          ID_Vfind                = ID_V+18,
+     *          ID_Vfindclass           = ID_V+19,
+     *          ID_vpackvs              = ID_V+20,
+     *          ID_vunpackvs            = ID_V+21,
+     *          ID_vpackvg              = ID_V+22,
+     *          ID_vunpackvg            = ID_V+23,
+     *          ID_Vsetattr             = ID_V+24,
+     *          ID_Vgetversion          = ID_V+25,
+     *          ID_Vnattrs              = ID_V+26,
+     *          ID_Vfindattr            = ID_V+27,
+     *          ID_Vattrinfo            = ID_V+28,
+     *          ID_Vgetattr             = ID_V+29)
+
+      parameter(ID_VH                   = ID_V+30,
+     *          ID_VHmakegroup          = ID_VH,
+     *          ID_VHstoredata          = ID_VH+1,
+     *          ID_VHstoredatam         = ID_VH+2)
+
+      parameter(ID_VS                   = ID_VH+3,
+     *          ID_VSattach             = ID_VS,
+     *          ID_VSdetach             = ID_VS+1,
+     *          ID_VSelts               = ID_VS+2,
+     *          ID_VSfdefine            = ID_VS+3,
+     *          ID_VSfexist             = ID_VS+4,
+     *          ID_VSfind               = ID_VS+5,
+     *          ID_VSgetclass           = ID_VS+6,
+     *          ID_VSgetfields          = ID_VS+7,
+     *          ID_VSgetid              = ID_VS+8,
+     *          ID_VSgetinterlace       = ID_VS+9,
+     *          ID_VSgetname            = ID_VS+10,
+     *          ID_VSinquire            = ID_VS+11,
+     *          ID_VSlone               = ID_VS+12,
+     *          ID_VSread               = ID_VS+13,
+     *          ID_VSseek               = ID_VS+14,
+     *          ID_VSsetclass           = ID_VS+15,
+     *          ID_VSsetfields          = ID_VS+16,
+     *          ID_VSsetinterlace       = ID_VS+17,
+     *          ID_VSsetname            = ID_VS+18,
+     *          ID_VSsizeof             = ID_VS+19,
+     *          ID_VSwrite              = ID_VS+20,
+     *          ID_VSappendable         = ID_VS+21,
+     *          ID_VSdelete             = ID_VS+22,
+     *          ID_VSfindclass          = ID_VS+23,
+     *          ID_VSfpack              = ID_VS+24,
+     *          ID_VSfindex             = ID_VS+25,
+     *          ID_VSsetattr            = ID_VS+26,
+     *          ID_VSnattrs             = ID_VS+27,
+     *          ID_VSfnattrs            = ID_VS+28,
+     *          ID_VSfindattr           = ID_VS+29,
+     *          ID_VSattrinfo           = ID_VS+30,
+     *          ID_VSgetattr            = ID_VS+31,
+     *          ID_VSisattr             = ID_VS+32)
+
+      parameter(ID_AN                   = ID_VS+33,
+     *          ID_ANstart              = ID_AN+0,
+     *          ID_ANfileinfo           = ID_AN+1,
+     *          ID_ANend                = ID_AN+2,
+     *          ID_ANcreate             = ID_AN+3,
+     *          ID_ANcreatef            = ID_AN+4,
+     *          ID_ANselect             = ID_AN+5,
+     *          ID_ANnumann             = ID_AN+6,
+     *          ID_ANannlist            = ID_AN+7,
+     *          ID_ANannlen             = ID_AN+8,
+     *          ID_ANreadann            = ID_AN+9,
+     *          ID_ANwriteann           = ID_AN+10,
+     *          ID_ANendaccess          = ID_AN+11)
+
+      parameter(ID_GR                   = ID_AN+12,
+     *          ID_GRstart              = ID_GR,
+     *          ID_GRfileinfo           = ID_GR+1,
+     *          ID_GRend                = ID_GR+2,
+     *          ID_GRcreate             = ID_GR+3,
+     *          ID_GRselect             = ID_GR+4,
+     *          ID_GRnametoindex        = ID_GR+5,
+     *          ID_GRgetiminfo          = ID_GR+6,
+     *          ID_GRwriteimage         = ID_GR+7,
+     *          ID_GRreadimage          = ID_GR+8,
+     *          ID_GRendaccess          = ID_GR+9,
+     *          ID_GRgetdimid           = ID_GR+10,
+     *          ID_GRsetdimname         = ID_GR+11,
+     *          ID_GRdiminfo            = ID_GR+12,
+     *          ID_GRidtoref            = ID_GR+13,
+     *          ID_GRreftoindex         = ID_GR+14,
+     *          ID_GRreqlutil           = ID_GR+15,
+     *          ID_GRreqimageil         = ID_GR+16,
+     *          ID_GRgetlutid           = ID_GR+17,
+     *          ID_GRgetlutinfo         = ID_GR+18,
+     *          ID_GRwritelut           = ID_GR+19,
+     *          ID_GRreadlut            = ID_GR+20,
+     *          ID_GRsetexternalfile    = ID_GR+21,
+     *          ID_GRsetaccesstype      = ID_GR+22,
+     *          ID_GRsetcompress        = ID_GR+23,
+     *          ID_GRsetattr            = ID_GR+24,
+     *          ID_GRattrinfo           = ID_GR+25,
+     *          ID_GRgetattr            = ID_GR+26,
+     *          ID_GRfindattr           = ID_GR+27,
+     *          ID_GRluttoref           = ID_GR+28,
+     *	   	ID_GRsetchunk		= ID_GR+29, 
+     *		ID_GRgetchunkinfo	= ID_GR+30,
+     *		ID_GRsetchunkcache	= ID_GR+31)
+
+
+      parameter(ID_HA                   = ID_GR+32,
+     *          ID_HAinit_group         = ID_HA+0,
+     *          ID_HAdestroy_group      = ID_HA+1,
+     *          ID_HAregister_atom      = ID_HA+2,
+     *          ID_HAatom_object        = ID_HA+3,
+     *          ID_HAatom_group         = ID_HA+4,
+     *          ID_HAremove_atom        = ID_HA+5,
+     *          ID_HAsearch_atom        = ID_HA+6)
+
+      parameter(ID_DA                   = ID_HA+7,
+     *          ID_DAcreate_array       = ID_DA,
+     *          ID_DAdestroy_array      = ID_DA+1,
+     *          ID_DAsize_array         = ID_DA+2,
+     *          ID_DAget_elem           = ID_DA+3,
+     *          ID_DAset_elem           = ID_DA+4,
+     *          ID_DAdel_elem           = ID_DA+5)
+
+      parameter(ID_HUL                  = ID_DA+6,
+     *          ID_HULcreate_list       = ID_HUL,
+     *          ID_HULdestroy_list      = ID_HUL+1,
+     *          ID_HULadd_node          = ID_HUL+2,
+     *          ID_HULsearch_node       = ID_HUL+3,
+     *          ID_HULfirst_node        = ID_HUL+4,
+     *          ID_HULnext_node         = ID_HUL+5,
+     *          ID_HULremove_node       = ID_HUL+6)
+
+      parameter ( ID_HDFnewentry 	= ID_HUL+7,
+		  ID_SDcheckempty	= ID_HUL+8)

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF_RT.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF_RT.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF_RT.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1507 @@
+/*  This file is part of the Pablo Performance Analysis Environment
+// 
+//           (R)
+//  The Pablo    Performance Analysis Environment software is NOT in
+//  the public domain.  However, it is freely available without fee for
+//  education, research, and non-profit purposes.  By obtaining copies
+//  of this and other files that comprise the Pablo Performance Analysis
+//  Environment, you, the Licensee, agree to abide by the following
+//  conditions and understandings with respect to the copyrighted software:
+//  
+//  1.  The software is copyrighted in the name of the Board of Trustees
+//      of the University of Illinois (UI), and ownership of the software
+//      remains with the UI. 
+// 
+//  2.  Permission to use, copy, and modify this software and its documentation
+//      for education, research, and non-profit purposes is hereby granted
+//      to Licensee, provided that the copyright notice, the original author's
+//      names and unit identification, and this permission notice appear on
+//      all such copies, and that no charge be made for such copies.  Any
+//      entity desiring permission to incorporate this software into commercial
+//      products should contact:
+// 
+//           Professor Daniel A. Reed                 reed at cs.uiuc.edu
+//           University of Illinois
+//           Department of Computer Science
+//           2413 Digital Computer Laboratory
+//           1304 West Springfield Avenue
+//           Urbana, Illinois  61801
+//           USA
+// 
+//  3.  Licensee may not use the name, logo, or any other symbol of the UI
+//      nor the names of any of its employees nor any adaptation thereof in
+//      advertizing or publicity pertaining to the software without specific
+//      prior written approval of the UI.
+// 
+//  4.  THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE
+//      SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS
+//      OR IMPLIED WARRANTY.
+// 
+//  5.  The UI shall not be liable for any damages suffered by Licensee from
+//      the use of this software.
+// 
+//  6.  The software was developed under agreements between the UI and the
+//      Federal Government which entitle the Government to certain rights.
+// 
+// *************************************************************************
+// 
+//  Developed by: The Pablo Research Group
+//                University of Illinois at Urbana-Champaign
+//                Department of Computer Science
+//                1304 W. Springfield Avenue
+//                Urbana, IL     61801
+// 
+//                http://www-pablo.cs.uiuc.edu
+// 
+//  Send comments to: pablo-feedback at guitar.cs.uiuc.edu
+// 
+//  Copyright (c) 1987-1998
+//  The University of Illinois Board of Trustees.
+//       All Rights Reserved.
+// 
+//  PABLO is a registered trademark of
+//  The Board of Trustees of the University of Illinois
+//  registered in the U.S. Patent and Trademark Office.
+// 
+//  Project Manager and Principal Investigator:
+//       Daniel A. Reed (reed at cs.uiuc.edu)
+//
+// Funded in part by the Defense Advanced Research Projects Agency 
+// under DARPA contracts DABT63-94-C0049 (SIO Initiative), 
+// F30602-96-C-0161, and DABT63-96-C-0027 by the National Science 
+// Foundation under the PACI program and grants NSF CDA 94-01124 and
+// ASC 97-20202, and by the Department of Energy under contracts
+// DOE B-341494, W-7405-ENG-48, and 1-B-333164.
+*/ 
+/*======================================================================*
+// File:  PabloHDF_RT							*
+// Purpose: support use of Pablo trace library to analyze HDF 		*
+//	    performance							*
+// Contents:								*
+//  HDFinitTrace_RT        : initialize real-time tracing		*
+//  HDFendTrace_RT         : complete trace 				*
+//  initHDFProcTrace_RT    : sets up data structures at init time.	*
+//  initproctracert_()	   : fortran interface				*
+//  HDFtraceEvent_RT	   : called to record event information		*
+//  HDFrecordSum 	   : adds fields of one record to those of 	*
+//			     another					*
+//  HDFnodeInit 	   : initializes linked list node		*
+//  HDFrecordFileName	   : records named HDF identifiers 		*
+//  BeginIOEventRecord     : initialize before I/O call			*
+//  EndIOEventRecord 	   : finalize after I/O call			*
+//  BeginMPIOEventRecord   : initialize before MPI-I/O call		*
+//  EndMPIOEventRecord 	   : finalize after MPI-I/O call		*
+//  BeginHDFEventRecord    : initialize before HDF call			*
+//  EndHDFEventRecord 	   : finalizie after HDF call			*
+//  HDFrecordFileName	   : record named identifier information	*
+//  HDFassignPabloIDs	   : assigns a number to named identifiers	*
+//  writeHDFNamePacketsRT  : write SDDF packets for identifier names	*
+//  HDFupdateProcLists     : adds records in queue to entries in 	*
+//			     tables					*
+//  HDFupdateProcs	   : called by HDFupdateProcLists to do 	*
+//			     addition					*
+//  HDFSummarySDDF	   : write SDDF event summary packets		*
+//  HDFnodeInit 	   : initialize event node			*
+//  HDFrecordSum 	   : add one event record to another		*
+//  getHDFFieldIndex	   : get Field Index for counts and times	*
+//  getHDFByteFieldIndex   : get field index for bytes 			*
+//  writeHDFRecDescrptrsRT : write HDF Record Descriptor packets	*
+//  printFileMappingsRT	   : print map of named identifiers		*
+//  _hdfNameDescriptor()   : writes SDDF descriptor packet for names	*
+//======================================================================*/
+#ifdef _HDF5_
+#include "H5config.h"
+#endif
+#include "SystemDepend.h"
+#include "Trace.h"
+#include "TraceParam.h"
+#include "ProcIDs.h"
+#include "IO_TraceParams.h"
+#include "HDFTrace.h"
+#include "SDDFparam.h"
+#include <string.h>
+#include <stdio.h>
+#include <fcntl.h>
+/*======================================================================* 
+// on ipsc/860 don't include this or you'll get multiply defined SEEK_  *
+//======================================================================*/
+#ifndef __NX
+#include <unistd.h>
+#endif
+ 
+#ifndef SUCCESS
+#define SUCCESS 0
+#define FAILURE	1
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE	0
+#endif
+#define NEG_THREAD_ID -999
+
+#include "HDFrecord_RT.h"
+
+#ifdef HAVE_PARALLEL
+#include "mpio.h"
+#include "MPIO_EventArgs.h"
+#endif
+
+#ifndef TRgetThreadID
+#define TRgetThreadID  TRgetNode
+#endif
+
+#ifndef TRnumNodes
+#define TRnumNodes 1
+#endif
+
+#define AllThreads -1
+
+/*======================================================================*
+//  User output file pointer.						*
+//======================================================================*/
+FILE *outP;
+/*======================================================================*
+// Data Structures:							*
+//									*
+// HDFQueues:   an array of linked list.  Each list corresponds to an	*
+//              HDF event and contains an entry for each different 	*
+//		thread and data set referenced by a call to that event  *
+//									*
+// CallStack: 	a stack of HDFnode_t objects.  At any given time, the   *
+//		stack represents the calling stack of the HDF routines 	*
+//									*
+// HDFfileList: a linked list of named identifiers and identifier 	*
+//		numbers.  This is processed later to assign a single 	*
+//		numbers to identifiers with the same name.		*
+//======================================================================*/
+HDFnode_t **HDFQueues;
+HDFnode_t *CallStack;
+HDFnode_t *TagQueue;
+fileRec_t *HDFfileList;
+/*======================================================================*
+// Internal Function prototypes						*
+//======================================================================*/
+void HDFinitTrace_RT( char *, int );
+void HDFendTrace_RT( int );
+int initproctracert_( void );
+int initHDFProcTrace_RT( void );
+void HDFtraceEvent_RT( int , char *, unsigned ) ;
+void BeginIOEventRecord ( int, CLOCK , void * );
+void EndIOEventRecord ( int , CLOCK , void * );
+void BeginMPIOEventRecord ( int, CLOCK , void *, int ); 
+void EndMPIOEventRecord ( int , CLOCK  , void *, int);
+void BeginHDFEventRecord( int , CLOCK  );
+void EndHDFEventRecord ( CLOCK  ,void *);
+void HDFrecordFileName( HDFsetInfo * );
+void HDFassignPabloIDs( int *, char *** );
+void writeHDFNamePacketsRT( char **, int );
+void HDFupdateProcLists( void );
+void HDFupdateProcs( HDFnode_t * );
+void HDFSummarySDDF( HDFnode_t *, int );
+void HDFnodeInit ( HDFnode_t * ) ;
+void HDFrecordSum ( HDFrec_t *, HDFrec_t * );
+int getHDFFieldIndex( int );
+int getHDFByteFieldIndex( int );
+void writeHDFRecDescrptrsRT( void );
+void printFileMappingsRT( char *, char **, int );
+void _hdfNameDescriptor( void );
+void _hdfDescriptorRT( char *, char *, int );
+void HDFfinalTimeStamp( void );
+/*======================================================================*
+// Global variables           						*
+//======================================================================*/
+HDFnode_t InitNode;		/* Node used in initialization		*/
+HDFrec_t Tally;			/* Node used to get total		*/
+char *FileName;			/* Name of Trace file			*/
+HDFsetInfo openInfo;		/* Info about file opened		*/
+char openName[256];		/* Name of opened file			*/
+extern char *hdfRecordPointer;
+/*======================================================================*
+// NAME									*
+//     HDFinitTrace_RT-- initialize HDF real-time tracing		*
+// USAGE								*
+//     VOID HDFinitTrace_RT( fileName, OUTSW )				*
+//									*
+//     char *fileName;		IN: name of output file			*
+//     int OUTSW        ;	IN: Type of tracing                	*
+// RETURNS								*
+//     None.								*
+//======================================================================*/
+void HDFinitTrace_RT( char *fileName, int OUTSW )
+{
+#ifdef  HAVE_PARALLEL
+	int myNode;
+#endif
+	int error;
+	TRgetClock( &epoch );
+	error = initHDFProcTrace_RT() ;
+	if ( error != SUCCESS ) {
+	   fprintf (stderr,"Unable to Initialize properly.  Exiting program\n");
+	   exit(-1);
+	}
+	FileName = ( char * ) malloc ( strlen( fileName ) + 10 );
+#ifdef  HAVE_PARALLEL
+	/*==============================================================*
+	// Here the library was built to linked with the MPI and MPIO	*
+	// libraries.  However, the use may chose not to run with MPI.	*
+	// A check is made to see if MPI has been initialized.  If so,  *
+	// a trace file is assigned to the current node with the number *
+	// of the node as a suffix; if not, only one file is opened  	*
+	// and it is not given a suffix.				*
+	//==============================================================*/
+	if ( OUTSW == MPI_SUMMARY_TRACE ) {
+           MPI_Comm_rank( MPI_COMM_WORLD, &myNode );
+           setTraceProcessorNumber( myNode );
+	   sprintf(FileName,"%s.nd%d",fileName,myNode);
+	} else {
+	   strcpy( FileName, fileName ) ;
+	}
+#else
+	/*==============================================================*
+	// In the non-parallel case, set the trace file name and 	*
+	// initialize the trace library.				*
+	//==============================================================*/
+	strcpy( FileName, fileName ) ;
+#endif	/* HAVE_PARALLEL */
+        setTraceFileName(FileName);
+        basicLibraryInit( );         
+}
+/*======================================================================*
+// NAME									*
+//     HDFendTrace-- end HDF tracing					*
+// USAGE								*
+//     VOID HDFendTrace_RT(void)					*
+// RETURNS								*
+//     None.								*
+//======================================================================*/
+void HDFendTrace_RT( int OUTSW )
+{
+	int j, numSetIDs;
+	HDFnode_t *P;
+	char **Names;
+	char* mapFile;
+
+	HDFfinalTimeStamp();
+	/*==============================================================*
+	//  Assing pablo ids to named identifiers and tag records	*
+	//==============================================================*/
+	HDFassignPabloIDs( &numSetIDs, &Names );
+	/*==============================================================*
+	//  Create a file name for the File map file.			*
+	//==============================================================*/
+	mapFile = (char *)malloc( strlen(FileName) + 4 );
+	strcpy(mapFile,FileName);
+	strcat(mapFile,".map");
+	/*==============================================================*
+	//  print the file mappings.					*
+	//==============================================================*/
+        printFileMappingsRT( mapFile, Names, numSetIDs ); 
+	/*==============================================================*
+	// Print SDDF summary records					*
+	//==============================================================*/
+	writeHDFRecDescrptrsRT();
+	writeHDFNamePacketsRT( Names, numSetIDs );
+     	for ( j = 0; j < NumHDFProcs; ++j ) {
+	   HDFSummarySDDF( HDFQueues[j], j );
+	}  
+	endTracing();
+}
+/*======================================================================*
+// initHFDProcTrace_RT							*
+//	This function initializes data structures specific to		* 
+//	the HDF real-time procedure entry/exit tracing extensions of 	*
+//      the Pablo instrumentation library.  				*
+//======================================================================*/
+int initproctracert_( void )
+
+{
+	return initHDFProcTrace_RT();
+}
+
+int initHDFProcTrace_RT( void )
+
+{
+	int i, j, size;
+	int numProcs = NumHDFProcs;
+
+        if ( traceProcessorNumber == -1 ) {
+            traceProcessorNumber = TRgetDefaultProcessor();
+        }
+	/*==============================================================*
+	// Initialize InitNode used for node initialization.		*
+	//==============================================================*/
+	InitNode.ptr = NULL;
+        InitNode.eventID = 0;             
+        InitNode.lastIOtime = zeroClock;
+        InitNode.record.nCalls = 0;             
+        InitNode.record.lastCall = zeroClock;
+        InitNode.record.incDur = zeroClock;              
+        InitNode.record.excDur = zeroClock;              
+        InitNode.record.hdfID = 0;             
+        InitNode.record.xRef = 0;             
+	for ( j = 0; j < nTallyFields; ++j ) {
+           InitNode.record.times[j] = zeroClock; 
+	}
+	for ( j = 0; j < nTallyFields; ++j ) {
+           InitNode.record.counts[j] = 0; 
+	}
+	for ( j = 0; j < nByteFields; ++j ) {
+           InitNode.record.bytes[j] = 0; 
+	}
+	for ( i = 0; i < nByteFields; ++i ) {
+	   for ( j = 0; j < nBkts; ++j ) {
+	      InitNode.record.Hists[i][j] = 0;
+	   }
+	}
+	/*==============================================================*
+	// initialize linked list used to keep track of named hdf 	*
+	// identifiers.							*
+	//==============================================================*/
+	HDFfileList = NULL;
+	/*==============================================================*
+	// Allocate a one dimensional array of pointers to queues of 	*
+	// HDFnodes.  There is one queue for each thread and one for 	*
+	// each HDF procedure.  Each queue will be a list of summary 	*
+	// records distinquished by file type and 			*
+	//==============================================================*/
+	size = (int)(numProcs*sizeof( HDFnode_t * ));
+	HDFQueues = (HDFnode_t **)malloc( size );
+	if ( HDFQueues == NULL ) {
+	   fprintf(stderr,"Failed to allocate HDFQueues in initHDFProcTrace\n");
+	   return FAILURE;
+	}
+	for ( j = 0; j < numProcs; ++j ) {
+	   HDFQueues[j] = NULL;
+	}
+	/*==============================================================*
+	// Initialize call stack to a dummy node and TagQueue to NULL   *
+	//==============================================================*/
+	CallStack = (HDFnode_t *)malloc( sizeof(HDFnode_t) );
+	*CallStack = InitNode;
+	TagQueue = NULL ;
+	return SUCCESS;
+}
+/*======================================================================*
+// This is called from the HDF and I/O routines when real-time summary	*
+// tracing is used.  It sets up a call stack for the specific thread in *
+// use if no stack is yet set up.  It then calls calls a routine to 	*
+// handle the event based on whether it is an I/O or HDF call.		*
+//======================================================================*/
+void HDFtraceEvent_RT( int eventType, char *dataPtr, unsigned dataLen ) 
+{
+	CLOCK	seconds;
+
+	seconds = getClock();
+
+	if ( isBeginIOEvent ( eventType ) || eventType == ID_malloc ) {
+	   BeginIOEventRecord ( eventType, seconds, dataPtr ) ;
+	} else if ( isEndIOEvent( eventType )  || eventType == -ID_malloc) {
+	   EndIOEventRecord ( eventType, seconds, dataPtr );
+	} else if ( isBeginHDFEvent( eventType ) ) { 
+	   BeginHDFEventRecord ( eventType , seconds ) ;
+	} else if ( isEndHDFEvent( eventType ) ) {
+	   EndHDFEventRecord ( seconds, dataPtr );
+#ifdef  HAVE_PARALLEL
+	} else if ( isBeginMPIOEvent( eventType ) ) { 
+	   BeginMPIOEventRecord ( eventType, seconds, dataPtr, dataLen ) ;
+	} else if ( isEndMPIOEvent( eventType ) ) {
+	   EndMPIOEventRecord ( eventType, seconds, dataPtr, dataLen );
+#endif  /* HAVE_PARALLEL */
+	} else {
+	   fprintf(stderr,"eventType %d, dataLen = %u\n",eventType,dataLen);
+	} 
+}
+/*======================================================================* 
+// BeginIOEventRecord:                                               	*
+//  This routine simply records the time in the record on the top of 	*
+//  the stack.								*
+//======================================================================*/ 
+void BeginIOEventRecord ( int eventType, CLOCK seconds, void *dataPtr  )
+{
+	char *name;
+	/*==============================================================*
+	// save the time value temporarily in top of stack		*
+	// When the end record is received, the duration can be 	*
+	// computed.							*
+	//==============================================================*/
+	CallStack->lastIOtime = seconds;
+	/*==============================================================*
+	// get the ID or name of the file accessed from the structure	*
+	// passed as dataPtr.  						*
+	//==============================================================*/
+	switch ( eventType )
+	{
+		case fopenBeginID:
+		case openBeginID:
+		   name = (char *)(dataPtr) + 2*sizeof(int);
+  	   	   strcpy( openName, name );
+		   break;
+		case fcloseBeginID:
+		case closeBeginID:
+	   	   CallStack->record.hdfID = *( long *)dataPtr;
+		   break;
+		case readBeginID:
+		case freadBeginID:
+		case writeBeginID:
+		case fwriteBeginID:
+		case lseekBeginID:
+		case fseekBeginID:
+		case fsetposBeginID:
+		case rewindBeginID:
+	   	   CallStack->record.hdfID = *(int *)dataPtr;
+		   break;
+		default:
+		   break;
+	}
+}
+/*======================================================================* 
+// EndIOEventRecord:							*
+//  This routine retrieves the entry time saved on the top of the stack *
+//  and computes the duration of the I/O event.  This is added to the   *
+//  record field corresponding to this type of I/O.  The Bytes field in *
+//  the record is updated if this is a read or write operation.		*
+//======================================================================*/ 
+void EndIOEventRecord ( int eventType, CLOCK secs, void *dataPtr )
+{
+	CLOCK incDur;
+	int i, Field, ByteField, bytes;
+
+	incDur = clockSubtract(secs,CallStack->lastIOtime) ;
+	Field = getHDFFieldIndex( eventType ) ;
+        CallStack->record.times[Field] 
+            = clockAdd ( CallStack->record.times[Field] , incDur ) ;
+        ++CallStack->record.counts[Field];
+	ByteField = getHDFByteFieldIndex( Field ) ;
+	switch ( eventType ) 
+	{
+		case readEndID:
+		case freadEndID:
+		case writeEndID:
+		case fwriteEndID:
+		case -ID_malloc:
+	   	   bytes = *((int *)dataPtr);
+	      	   CallStack->record.bytes[ByteField] += bytes;
+	           /*====================================================
+		   // update histogram					*
+	           //===================================================*/
+                   i = -1;
+                   while ( bytes >= BktLim[i+1] ) ++i  ;
+                   if ( i >= 0 ) ++CallStack->record.Hists[ByteField][i];
+		   break;
+		case fopenEndID:
+		case openEndID:
+		   openInfo.setName = openName;
+		   openInfo.setID = (int)(*((long *)dataPtr));
+		   CallStack->record.hdfID = openInfo.setID;
+	           HDFrecordFileName ( &openInfo );
+		   break;
+		default:
+		   break;
+	}
+			
+}
+#ifdef HAVE_PARALLEL
+/*======================================================================*
+// BeginMPIOEventRecord:                                               	*
+//  This routine simply records the time in the record on the top of 	*
+//  the stack.								*
+//======================================================================*/ 
+void BeginMPIOEventRecord( int eventType, 
+	                   CLOCK seconds, 
+	                   void *dataPtr,
+	                   int dataLen )
+{
+	/*==============================================================*
+	// save the time value temporarily in top of stack		*
+	// When the end record is received, the duration can be 	*
+	// computed.							*
+	//==============================================================*/
+	CallStack->lastIOtime = seconds;
+	/*==============================================================*
+	// get useful info from the structure pointed to by dataPtr.	*
+	// in most cases, this is the file ID.  For mpiOpen, it is the	*
+	// name of the file.  For mpiDelete, no information is of any	*
+	// use.								*
+	//==============================================================*/
+        if ( dataLen == 0 ) return;
+	switch ( eventType ) 
+	{
+	   case HDFmpiGetSizeID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiGetSizeBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiGetGroupID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiGetGroupBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiGetAmodeID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiGetAmodeBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiGetViewID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiGetViewBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiGetPositionID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiGetPositionBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiGetByteOffsetID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiGetByteOffsetBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiGetTypeExtentID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiGetTypeExtentBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiGetAtomicityID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiGetAtomicityBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiOpenID:
+	      strcpy( openName,
+		     ((struct mpiOpenBeginArgs *)dataPtr)->fileName);
+	      break;
+	   case HDFmpiCloseID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiCloseBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiDeleteID:
+	      break;
+	   case HDFmpiSetSizeID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiSetSizeBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiPreallocateID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiPreallocateBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiSetViewID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiSetViewBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiReadAtID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiReadAtBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiReadAtAllID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiReadAtAllBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiWriteAtID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiWriteAtBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiWriteAtAllID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiWriteAtAllBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiIreadAtID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiIreadAtBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiIwriteAtID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiIwriteAtBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiReadID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiReadBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiReadAllID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiReadAllBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiWriteID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiWriteBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiWriteAllID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiWriteAllBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiIreadID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiIreadBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiIwriteID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiIwriteBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiSeekID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiSeekBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiSetAtomicityID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiSetAtomicityBeginArgs *)dataPtr)->fileID;
+	      break;
+	   case HDFmpiSyncID:
+	      CallStack->record.hdfID 
+		 = ((struct mpiSyncBeginArgs *)dataPtr)->fileID;
+	      break;
+	   default:
+	      break;
+	}
+}
+/*======================================================================*
+// EndMPIOEventRecord:							*
+//  This routine retrieves the entry time saved on the top of the stack *
+//  and computes the duration of the MPI-I/O event.  This is added to   *
+//  the record field corresponding MPI-I/O.  				*
+//======================================================================*/ 
+void EndMPIOEventRecord ( int eventType, 
+	                  CLOCK secs, 
+	                  void *dataPtr,
+	                  int dataLen )
+{
+	CLOCK incDur;
+
+	incDur = clockSubtract(secs,CallStack->lastIOtime) ;
+        CallStack->record.times[MPI] 
+           = clockAdd ( CallStack->record.times[MPI], incDur );
+        ++CallStack->record.counts[MPI];
+	if ( eventType == -HDFmpiOpenID && dataLen != 0 ) {
+	   /*===========================================================*
+	   // complete the file information for the case of a file 	*
+	   // open and record the information.				*
+	   //===========================================================*/
+	   openInfo.setName = openName;
+	   openInfo.setID = ((struct mpiOpenEndArgs *)dataPtr)->fileID;
+	   CallStack->record.hdfID = openInfo.setID;
+	   HDFrecordFileName ( &openInfo );
+	}
+}
+#endif /* HAVE_PARALLEL */
+/*======================================================================*
+//   BeginHDFEventRecord:						* 
+// 	This function puts a trace record on the stack corresponding to	*
+//   	this thread.  If no stack exists, one is created.  If no record	* 
+//   	exist, a record is created.                                   	* 
+//======================================================================*/ 
+void BeginHDFEventRecord( int eventID, CLOCK secs )
+{
+	HDFnode_t *HDFrec;
+	/*==============================================================*
+	// Create a record. Push it onto the call stack.                *
+	//==============================================================*/
+        HDFrec = (HDFnode_t *)malloc( sizeof(HDFnode_t) );
+        HDFnodeInit( HDFrec ) ;
+	HDFrec->eventID = eventID;
+	HDFrec->ptr = CallStack;
+	CallStack = HDFrec ;
+	/*==============================================================*
+	// save time stamp in record.					*
+	//==============================================================*/
+	HDFrec->record.lastCall = secs;
+}
+/*======================================================================* 
+// EndHDFEventRecord:							*
+//  This routine pops the HDF record from the top of the stack 		*
+//  corresponding to this thread and computes the inclusive duration    *
+//  and adds it to the inclusive duration field of this record and to   *
+//  the HDF time field of the calling routines record.			*
+//======================================================================*/ 
+void EndHDFEventRecord ( CLOCK secs, void *dataPtr )
+{
+        HDFsetInfo 	*info;
+	HDFnode_t	*HDFrec;
+	CLOCK  		incSecs;
+	static int	dummyIDs = -4;
+	/*==============================================================*
+	// pop record from top of the stack, compute inclusive duration	*
+	// and set the corresponding record field and increment nCalls.	*
+	//==============================================================*/
+	HDFrec = CallStack;
+	CallStack = CallStack->ptr;
+	if ( CallStack == NULL ) {
+	   fprintf(stderr,">>> EndHDFEventRecord: Call Stack is empty. <<<\n");
+	   return;
+	}
+	incSecs = clockSubtract(secs,HDFrec->record.lastCall) ;
+                  
+	HDFrec->record.incDur = incSecs;
+	++HDFrec->record.nCalls;
+   	/*==============================================================*
+	// add old record to chain to have its xRef field tagged.	*
+	//==============================================================*/
+	HDFrec->ptr = TagQueue;
+	TagQueue = HDFrec;
+	/*==============================================================*
+	// Add set ID information.					*
+	//==============================================================*/
+	if ( dataPtr != NULL ) {
+	   info = (HDFsetInfo *)dataPtr;
+	   if ( info->setName != NULL ) {
+	      if ( info->setID == 0 ) {
+	         info->setID = dummyIDs--;
+	      }
+	      HDFrecordFileName ( info );
+	   }
+	   HDFrec->record.hdfID = info->setID;
+	}
+	/*==============================================================*
+	// Update the HDF totals for the calling program.		*
+	//==============================================================*/
+        CallStack->record.times[ HDF_ ] 
+           = clockAdd( CallStack->record.times[ HDF_ ] , incSecs ) ;
+        ++CallStack->record.counts[ HDF_ ] ;
+	/*==============================================================*
+	// If the stack has only one record it represents the main 	* 
+	// program.  Tag all of the records on the TagQueue and tally   * 
+	// them up.							* 
+	//==============================================================*/
+        if ( CallStack->ptr == NULL ) {
+           HDFupdateProcLists( );
+	}
+}
+/*======================================================================* 
+// This routine keeps track of the identifier names and tags.  Some	*
+// names may be associated with more than one tag.  This will be 	*
+// rectified when final tallies are done.				*
+//======================================================================*/
+void HDFrecordFileName( HDFsetInfo *info )
+{
+	fileRec_t *P;
+	char *t;
+	int match; 
+	long id;
+	P = HDFfileList;
+	match = FALSE;
+	id = info->setID;
+	while ( P != NULL && match == FALSE ) {
+	   if ( strcmp( P->fileName, info->setName ) != 0 && P->hdfID == id ) {
+	      match = TRUE;
+	   } else {
+	      P = P->ptr;
+	   }
+	}
+	if ( match == FALSE ) {
+	   P = ( fileRec_t *) malloc( sizeof( fileRec_t ) );
+	   P->ptr = HDFfileList;
+	   HDFfileList = P;
+	   t = (char *)malloc( strlen( info->setName ) + 1 );
+	   strcpy ( t, info->setName ) ;
+	   P->fileName = t;
+	   P->hdfID = info->setID;
+	   P->PabloID = 0;
+	} 
+}  
+/*======================================================================* 
+// This routine assigns a unique Pablo ID to each unique name 		*
+// regardless of the HDF tag.						*
+// It then goes through the HDFRecordQueue and marks each record with   *
+// the PabloID corresponding to the hdfID and xRef fields or 0.		*
+//======================================================================*/
+void HDFassignPabloIDs( int *nSetIDs, char ***Names )
+{
+	fileRec_t *F, *G;
+	HDFnode_t *P;
+	int j; 
+	long PabloID = 1;
+	long hdfID, xRef;
+	char *fName, **T;
+
+	F = HDFfileList;
+        /*==============================================================*
+        // Assign the same ID to identical names.			*
+        //==============================================================*/
+	while ( F != NULL ) {
+	   if ( F->PabloID == 0 ) {
+	      F->PabloID = PabloID++;
+	      fName = F->fileName;
+	      G = F->ptr;
+	      while ( G != NULL ) {
+	         if ( strcmp( G->fileName , fName ) == 0 ) {
+	            G->PabloID = F->PabloID;
+	         }
+	         G = G->ptr;
+	      }
+	   }
+	   F = F->ptr;
+	}
+	*nSetIDs = (int)(PabloID - 1);
+        if ( *nSetIDs <= 0 ) return;
+        /*==============================================================*
+	// Repace hdfID and xRef fields with corresponding Pablo ID	*
+        //==============================================================*/
+   	for ( j = 0; j < NumHDFProcs; ++j ) {
+   	   P = HDFQueues[j] ;
+   	   while ( P != NULL ) {
+   	      hdfID = P->record.hdfID;
+   	      if ( hdfID != 0 ) {
+   	         PabloID = 0;
+                 F = HDFfileList;
+   	         while ( F != NULL && PabloID == 0 ) {
+                    if ( hdfID == F->hdfID ) {
+   	               PabloID = F->PabloID;
+   	            }
+   	            F = F->ptr;
+   	         }
+   	         P->record.hdfID = PabloID;
+   	      }
+   	      xRef = P->record.xRef;
+   	      if ( xRef != 0 ) {
+   	         PabloID = 0;
+                 F = HDFfileList;
+   	         while ( F != NULL && PabloID == 0 ) {
+                    if ( xRef == F->hdfID ) {
+   	               PabloID = F->PabloID;
+   	            }
+   	            F = F->ptr;
+   	         }
+   	         P->record.xRef = PabloID;
+   	      }
+              P = P->ptr;
+   	   } /* end while ( P != NULL ) */
+        } /* end for */
+	/*==============================================================*
+	// get a list of all the unique names and order them according  *
+	// to their Pablo IDs.						*
+	//==============================================================*/
+	T = ( char ** )malloc( (*nSetIDs+1) * sizeof( char * ) );
+	for ( j = 0; j <= *nSetIDs; ++j ) {
+	   T[j] = NULL;
+	}
+	F = HDFfileList;
+	while ( F != NULL ) {
+	   PabloID = F->PabloID  ;
+	   if ( T[PabloID] == NULL ) {
+	      T[PabloID] = ( char * )malloc( strlen( F->fileName ) + 1 );
+	      strcpy( T[PabloID], F->fileName ) ;
+	   }
+	   free((void *)(F->fileName));
+	   G = F;
+	   F = F->ptr;
+	   free ( (void *)G );
+	}
+	*Names = T;
+}
+/*======================================================================* 
+// This routine writes SDDF packets to SDDF file containing information	*
+// about the named identifiers found in the program.			*
+//======================================================================*/
+void writeHDFNamePacketsRT( char **Names, int numSetIDs )
+{
+	int j;
+	HDFNamePacket_t NamePkt;
+	char *BUFF, *fName;
+	int buffSize;
+	/*==============================================================*
+	// Allocate a buffer to hold the packet.  Allow 80 chars for 	*
+	// identifier name.						*
+	//==============================================================*/
+	buffSize = sizeof(HDFNamePacket_t) + 80;
+	BUFF = (char *)malloc(buffSize);
+	/*==============================================================*
+	// Fill in constant information					*
+	//==============================================================*/
+	NamePkt.packetType = PKT_DATA;
+	NamePkt.packetTag = FAMILY_NAME;
+	/*==============================================================*
+	// Fill in named identifier information and write to SDDF file	*
+	//==============================================================*/
+	for ( j = 1; j <= numSetIDs; ++j ) {
+	   fName = Names[j];
+	   NamePkt.packetLength = (int)(sizeof(NamePkt) + strlen(fName));
+	   NamePkt.fileType = 0;		/* not currently used	*/
+	   NamePkt.fileID = j;
+	   NamePkt.nameLen = (int)strlen(fName) ;
+	   if ( buffSize < NamePkt.packetLength ) {
+	      free((void *)BUFF) ;
+	      buffSize = NamePkt.packetLength + 80;
+	      BUFF = (char *)malloc( buffSize ) ;
+	   }
+	   /*===========================================================*
+	   // Copy packet data and tack on identifier name		*
+	   //===========================================================*/
+	   memcpy( BUFF, &NamePkt, sizeof(NamePkt) );
+	   memcpy( BUFF + sizeof(NamePkt) , fName, strlen(fName) );
+	   putBytes( BUFF , NamePkt.packetLength ) ;
+	}
+	free((void *)BUFF);
+}
+/*======================================================================*
+// Tag xRef field of all records in this queue with the hdfID of the 	*
+// highest level caller. Also						*
+// This routine takes the records after they have been tagged and adds  *
+// their fields to the apporopriate position in the HDFQueues structure *
+//======================================================================*/
+void HDFupdateProcLists( void )
+{
+	HDFnode_t *P, *Q;
+	long hdfID;
+
+	hdfID = TagQueue->record.hdfID;
+	P = TagQueue;
+	while ( P != NULL ) {
+	   P->record.xRef = hdfID;
+	   Q = P->ptr;
+	   HDFupdateProcs( P );
+	   P = Q;
+	}
+        TagQueue = NULL;
+}
+/*======================================================================*
+// This routine takes as input a node pointer P  and looks for a Total  *
+// record with this same eventID, hdfID and xRef.  If such a record     *
+// exists, P is added to the record, otherwise a record is created and  *
+// its values are set to P's.						*
+//======================================================================*/
+void HDFupdateProcs( HDFnode_t *P )
+{
+	int procIndex, eventID;
+	long hdfID, xRef;
+	HDFnode_t *Q;
+	eventID = P->eventID;
+	procIndex = ProcIndexForHDFEntry( eventID );
+        hdfID = P->record.hdfID;
+        xRef = P->record.xRef;
+	Q = HDFQueues[ procIndex ];
+	/*==============================================================*
+	// First determine if a tally node exists that matches the     	*
+	// eventID, hdfID and xRef of P.				*
+	//==============================================================*/
+	while ( Q != NULL && 
+            (( Q->record.hdfID != hdfID ) || ( Q->record.xRef != xRef )) ) {
+           Q = Q->ptr;
+	}
+	if ( Q == NULL ) {
+	   /*===========================================================*
+	   // No tally record matches the hdfID and xRef so put P in    *
+	   // the queue.                 				*
+	   //===========================================================*/
+	   P->ptr = HDFQueues[ procIndex ];
+	   HDFQueues[ procIndex ] = P;
+	} else {
+	   /*===========================================================*
+	   // add P to the exiting record and free it.			*
+	   //===========================================================*/
+           HDFrecordSum ( &Q->record , &P->record );
+	   free((void *)P);
+	}
+}
+/*======================================================================*
+// Print SDDF records for all records in this linked list.		*
+//======================================================================*/
+void HDFSummarySDDF( HDFnode_t *P, int procIndex )
+{
+	int i, j, arrayLen, nodeID, nCalls;
+	int allIOCount;
+	CLOCK allIOTime, excDur;
+	double t;
+	char buff[1024];
+	char *Packet;
+	HDFnode_t *Q;
+	struct {
+		int packetLen,
+		    packetType,
+		    packetTag,
+	            eventID;
+                 double Seconds, 
+                        IncDur,
+                        ExcDur;
+	         long HDFid,
+	              XREFid;
+	} Header;
+
+	Header.packetLen = sizeof(Header) 
+	                 + sizeof(int)                   /* n Calls     */
+	                 + sizeof(int)			 /* array len   */
+			 + nTallyFields*sizeof(double)	 /* times array */
+	                 + sizeof(int)			 /* array len   */
+	                 + nTallyFields*sizeof(int) 	 /* count array */
+	                 + sizeof(int)			 /* array len   */
+	                 + nByteFields*sizeof(int) 	 /* bytes array */
+	                 + nByteFields*sizeof(int)	 /* array lens  */
+	                 + nByteFields*nBkts*sizeof(int) /* byte hist   */
+	                 + sizeof(int)                   /* nodeID      */
+	                 + sizeof(int) ;                 /* Name len    */
+	Header.packetTag = HDF_SUMMARY_FAMILY +
+			   ( procIndex + 1 )*8 + RECORD_TRACE ;
+	Header.packetType = PKT_DATA;
+	nodeID = TRgetNode();
+        while ( P != NULL ) {
+	   Q = P->ptr;
+	   /*===========================================================*
+	   // Total the I/O time and counts                        	*
+	   //===========================================================*/
+           allIOTime = zeroClock;
+           for ( j = FirstIO; j <= LastIO; ++j ) {
+              allIOTime = clockAdd( allIOTime, P->record.times[j] );
+           }
+           P->record.times[AllIO] = allIOTime;
+ 
+           allIOCount = 0;
+           for ( j = FirstIO; j <= LastIO; ++j ) {
+              allIOCount += P->record.counts[j];
+           }
+           P->record.counts[AllIO] = allIOCount;
+	   /*===========================================================*
+	   // compute exclusive duration.				*
+	   //===========================================================*/
+	   excDur = clockSubtract(P->record.incDur,allIOTime);
+	   excDur = clockSubtract(excDur,P->record.times[HDF_]);
+	   excDur = clockSubtract(excDur,P->record.times[MPI]);
+	   /*===========================================================*
+	   // print header information.					*
+	   //===========================================================*/
+	   Header.eventID = P->eventID;
+           Header.Seconds = clockToSeconds(P->record.lastCall);
+	   Header.IncDur  = clockToSeconds( P->record.incDur );
+	   Header.ExcDur  = clockToSeconds(excDur);
+	   Header.HDFid   = P->record.hdfID;
+	   Header.XREFid  = P->record.xRef;
+	   Packet = buff;
+	   memcpy( Packet, &Header, sizeof(Header) );
+	   Packet += sizeof(Header);
+	   /*===========================================================*
+	   // copy number of calls to Packet.				*
+	   //===========================================================*/
+	   nCalls  = P->record.nCalls;
+	   memcpy( Packet, &nCalls, sizeof(int) );
+	   Packet += sizeof(int);
+	   /*===========================================================*
+	   // copy length of times array and times array to Packet.	*
+	   //===========================================================*/
+	   arrayLen = nTallyFields;
+	   memcpy( Packet, &arrayLen, sizeof(int) );
+	   Packet += sizeof(int);
+           for ( j = 0; j < nTallyFields; ++j ) {
+	      t = clockToSeconds(P->record.times[j]); 
+	      memcpy( Packet, &t, sizeof(double) );
+	      Packet += sizeof(double);
+	   }
+	   /*===========================================================*
+	   // copy length of counts array and counts array to Packet.	*
+	   //===========================================================*/
+	   arrayLen = nTallyFields;
+	   memcpy( Packet, &arrayLen, sizeof(int) );
+	   Packet += sizeof(int);
+	   memcpy( Packet, P->record.counts, nTallyFields*sizeof(int) );
+	   Packet += nTallyFields*sizeof(int);
+	   /*===========================================================*
+	   // copy length of bytes array and bytes array to Packet.	*
+	   //===========================================================*/
+	   arrayLen = nByteFields;
+	   memcpy( Packet, &arrayLen, sizeof(int) );
+	   Packet += sizeof(int);
+	   memcpy( Packet, P->record.bytes, nByteFields*sizeof(int) );
+	   Packet += nByteFields*sizeof(int);
+	   /*===========================================================*
+	   // copy length of historgram arrays and arrays to Packet.	*
+	   //===========================================================*/
+	   arrayLen = nBkts;
+	   for ( i = 0; i < nByteFields; ++i ) {
+	      memcpy( Packet, &arrayLen, sizeof(int) );
+	      Packet += sizeof(int);
+	      memcpy( Packet, P->record.Hists[i], nBkts*sizeof(int) );
+	      Packet += nBkts*sizeof(int);
+	   }
+	   memcpy( Packet, &nodeID, sizeof(int) );
+	   Packet += sizeof(int);
+	   arrayLen = 0;	/* name length */
+	   memcpy( Packet, &arrayLen, sizeof(int) );
+	   putBytes( buff, Header.packetLen ); 
+           P = Q;
+	} 
+}
+/*======================================================================*
+// Initialize a node.							*
+//======================================================================*/
+void HDFnodeInit ( HDFnode_t *S ) 
+{
+	*S = InitNode;
+}
+/*======================================================================*
+//      Compute IO totals, exclusive durations of the input record T    *
+//      then add the fields of T to that of S.                          *
+//======================================================================*/
+void HDFrecordSum ( HDFrec_t *S, HDFrec_t *T )
+{
+        int i, j;
+	
+        S->nCalls    += T->nCalls;
+	if ( clockCompare ( S->lastCall, T->lastCall ) < 0 ) {
+           S->lastCall  =  T->lastCall ;
+	}
+        S->incDur    = clockAdd ( S->incDur, T->incDur );
+        for ( j = 0; j < nTallyFields; ++j ) {
+           S->times[j] =  clockAdd( S->times[j] , T->times[j] ) ;
+        }
+        for ( j = 0; j < nTallyFields; ++j ) {
+           S->counts[j] += T->counts[j] ;
+        }
+        for ( j = 0; j < nByteFields; ++j ) {
+           S->bytes[j] += T->bytes[j] ;
+        }
+        for ( j = 0; j < nByteFields; ++j ) {
+           for ( i = 0; i < nBkts; ++i ) {
+              S->Hists[j][i] += T->Hists[j][i] ;
+           }
+        }
+}
+/*======================================================================*
+// Return the field index corresponding to an IO event ID.  The fields  *
+// are specified in an enum statement in an include file.		*
+//======================================================================*/
+int getHDFFieldIndex( int eventID )
+{
+	int result = -1;
+	switch ( eventID )
+	{
+	        case ID_malloc:
+	        case -ID_malloc:
+			result = Malloc;
+			break;
+		case openBeginID:
+		case openEndID:
+		case fopenBeginID:
+		case fopenEndID:
+			result = Open;
+			break;
+		case closeBeginID:
+		case closeEndID:
+		case fcloseBeginID:
+		case fcloseEndID:
+			result = Close;
+			break;
+		case readBeginID:
+		case readEndID:
+		case freadBeginID:
+		case freadEndID:
+			result = Read;
+			break;
+		case lseekBeginID:
+		case lseekEndID:
+		case fseekBeginID:
+		case fseekEndID:
+			result = Seek;
+			break;
+		case writeBeginID:
+		case writeEndID:
+		case fwriteBeginID:
+		case fwriteEndID:
+			result = Write;
+			break;
+		case fflushBeginID:
+		case fflushEndID:
+		case flushBeginID:
+		case flushEndID:
+			result = Misc;
+			break;
+		case rewindBeginID:
+		case rewindEndID:
+		case fsetposBeginID:
+		case fsetposEndID:
+			result = Misc;
+			break;
+#ifdef	creadBeginID
+		case creadBeginID:
+		case creadEndID:
+		case creadvBeginID:
+		case creadvEndID:
+			result = Read;
+ 			break;
+		case cwriteBeginID:
+		case cwriteEndID:
+		case cwritevBeginID:
+		case cwritevEndID:
+			result = Write;
+ 			break;
+		case ireadBeginID:
+		case ireadEndID:
+		case ireadvBeginID:
+		case ireadvEndID:
+			result = ARead;
+ 			break;
+		case iwriteBeginID:
+		case iwriteEndID:
+		case iwritevBeginID:
+		case iwritevEndID:
+			result = AWrite;
+ 			break;
+		case iowaitBeginID:
+		case iowaitEndID:
+			result = Wait;
+ 			break;
+		case iodoneBeginID:
+		case iodoneEndID:
+			result = Misc;
+ 			break;
+		case gopenBeginID:
+		case gopenEndID:
+			result = Open;
+ 			break;
+		case iomodeBeginID:
+		case iomodeEndID:
+		case setiomodeBeginID:
+		case setiomodeEndID:
+		case lsizeBeginID:
+		case lsizeEndID:
+		case forflushBeginID:
+		case forflushEndID:
+			result = Misc;
+ 			break;
+#endif	
+	}
+	return result;
+}
+/*======================================================================*
+// This routine determines the field index in the bytes array of the 	*
+// HDF records which correspond to a given IO operation.  If the  	*
+// operation does not transfer bytes, (e.g., open operation), -1 is	*
+// returned.								*
+//======================================================================*/
+int getHDFByteFieldIndex( int Operation ) 
+{
+	int result;
+	switch ( Operation )
+	{
+		case Malloc:
+	 		result = MallocBytes;
+			break;
+		case Read:
+	 		result = ReadBytes;
+			break;
+		case Write:
+	 		result = WriteBytes;
+			break;
+		case ARead:
+	 		result = AReadBytes;
+			break;
+		case AWrite:
+	 		result = AWriteBytes;
+			break;
+		default:
+			result = -1;
+			break;
+	}
+	return result;
+}
+/*======================================================================*
+// This routine writes the SDDF packet descriptors for the HDF summary	*
+// records to the output file.						*
+//======================================================================*/
+void _hdfDescriptorRT( char *recordName, char *recordDescription, 
+                                                       int recordFamily )
+{
+    static char	recordBuffer[ 4096 ];
+    int		recordLength;
+
+    hdfRecordPointer = recordBuffer;
+    /*==================================================================*
+    // Allow space at the beginning of the record for the packet 	*
+    //length which will be computed after the packet is complete.	*
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, 0 );
+    /*==================================================================* 
+    // The record type, tag, and name 					* 
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR );
+    sddfWriteInteger( &hdfRecordPointer, ( recordFamily | RECORD_TRACE ) );
+    sddfWriteString( &hdfRecordPointer, recordName );
+    /*==================================================================* 
+    // The record attribute count and string pair 			* 
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, 1 );
+    sddfWriteString( &hdfRecordPointer, "description" );
+    sddfWriteString( &hdfRecordPointer, recordDescription );
+    /*==================================================================*
+    // The record field count 						*
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, 17 );
+    WRITE_HDF_FIELD( "Event Identifier", 
+	             "Event ID",
+                     "Corresponding Event",
+	             INTEGER, 0 );
+    WRITE_HDF_FIELD( "Seconds", 
+	   	     "Seconds", 
+                     "Floating Point Timestamp", 
+		      DOUBLE, 0 );
+    WRITE_HDF_FIELD( "Inclusive Duration", 
+  	             "Inclusive Duration", 
+	             "Inclusive Duration of this Procedure",
+		      DOUBLE, 0 );
+    WRITE_HDF_FIELD( "Exclusive Duration", 
+  	             "Exclusive Duration", 
+	             "Excludes IO, MPI-IO and other HDF calls",
+		      DOUBLE, 0 );
+    WRITE_HDF_FIELD2("HDF ID",
+                     "HDF ID", "Identifier number",
+                     "0", "No HDF ID specified",
+                     LONG, 0 );
+    WRITE_HDF_FIELD( "Xref ID",
+                     "Cross Reference", 
+                     "Index of related HDF ID or 0 if none",
+		     LONG, 0 );
+    WRITE_HDF_FIELD( "N Calls", 
+		     "N Calls", 
+		     "Number of Calls to this Proc", 
+		     INTEGER, 0 );
+    WRITE_HDF_FIELD( "Times Array",
+                     "Times Array",
+	             "Array of Total Operation Times",
+		     DOUBLE, 1 );
+    WRITE_HDF_FIELD( "Counts Array",
+                     "Counts Array",
+	             "Array of Total Operation Counts",
+		     INTEGER, 1 );
+    WRITE_HDF_FIELD( "Bytes Array",
+                     "Bytes Array",
+	             "Array of Total Bytes Transferred",
+		     INTEGER, 1 );
+    WRITE_HDF_FIELD( "Malloc Histogram",
+                     "Malloc Histogram",
+	             "Historgram of size Malloc Requests",
+		     INTEGER, 1 );
+    WRITE_HDF_FIELD( "Read Histogram",
+                     "Read Histogram",
+	             "Historgram of size Read Requests",
+		     INTEGER, 1 );
+    WRITE_HDF_FIELD( "Write Histogram",
+                     "Write Histogram",
+	             "Historgram of size Write Requests",
+		     INTEGER, 1 );
+    WRITE_HDF_FIELD( "ARead Histogram",
+                     "ARead Histogram",
+	             "Historgram of size Asynch Read Requests",
+		     INTEGER, 1 );
+    WRITE_HDF_FIELD( "AWrite Histogram",
+                     "AWrite Histogram",
+	             "Historgram of size Asynch Write Requests",
+		     INTEGER, 1 );
+    WRITE_HDF_FIELD( "Processor Number", 
+		     "Node", 
+		     "Processor number", 
+		     INTEGER, 0 );
+    WRITE_HDF_FIELD( "HDF Name",
+                     "HDF Name", 
+	             "Name of File,Data Set or Dim accessed",
+                     CHARACTER, 1 ); 
+    /*=================================================================== 
+    // The entire record descriptor packet has been written.		* 
+    // Compute and update the record length.				* 
+    // Write the completed record.					* 
+    //==================================================================*/
+    recordLength = (int)(hdfRecordPointer - recordBuffer);
+
+    hdfRecordPointer = recordBuffer;
+    sddfWriteInteger( &hdfRecordPointer, recordLength );
+
+    putBytes( recordBuffer, (unsigned) recordLength );
+}
+
+/*======================================================================* 
+//   Internal Routine:  writeHDFRecDescrptrsRT	                        * 
+//                      Writes record descriptors for the HDF events.   * 
+//======================================================================*/
+void writeHDFRecDescrptrsRT( void ) 
+{
+	char HDFProcNames[][40] = {
+	"noName",
+	"noName",
+	"noName",
+	"noName",
+	"noName",
+#	include "HDFentryNames.h"
+	"HDF_Last_Entry"
+	};
+	int j, FAMILY;
+        char BUF1[256], BUF2[256] ;
+	_hdfNameDescriptor();	/* Descriptor for named identifiers	*/
+        for ( j = 0; j < NumHDFProcs; ++j ) {
+           if ( HDFQueues[j] != NULL ) {
+              strcpy( BUF2, "HDF ");
+              strcat( BUF2, HDFProcNames[j] );
+              strcat( BUF2, " Procedure Summary");
+              strcpy( BUF1, BUF2 );
+              strcat( BUF1, " Trace");
+	      FAMILY = HDF_SUMMARY_FAMILY + (j + 1)*8;
+              _hdfDescriptorRT( BUF1, BUF2, FAMILY );
+           }
+        }
+        return;
+}
+/*======================================================================*
+// This routine prints the Pablo IDs assigned to named HDF identifiers  *
+//======================================================================*/
+void printFileMappingsRT( char *mapFile, char **Names, int nPabloIDs )
+{
+	int i;
+	FILE *ptr;
+	ptr = fopen( mapFile, "w" );
+ 
+        if ( ptr == NULL ) {
+	    fprintf(stderr,
+                    "Couldn't open map file %s - none created.\n",mapFile);
+            return;
+        }
+ 
+	fprintf(ptr,"\n\nPablo ID to HDF Name mappings:\n");
+	fprintf(ptr,"------------------------------\n");
+        for ( i = 1; i <= nPabloIDs; i++ ) {
+	     fprintf(ptr,"%4d %s\n",i,Names[i] );
+	}
+	fprintf(ptr,"\n\n");
+	fclose( ptr );
+}
+/************************************************************************/
+/*	_hdfNameDescriptor	     					*/
+/*	   Generate a SDDF binary format record descriptor for the	*/
+/*	   named identifiers used during execution.              	*/
+/************************************************************************/
+void _hdfNameDescriptor( void )
+{
+    static char recordBuffer[ 4096 ];
+    int         recordLength;
+
+#ifdef DEBUG
+	fprintf( debugFile, "_hdfExitTraceDescriptor entered\n" );
+	fflush( debugFile );
+#endif /* DEBUG */
+    hdfRecordPointer = recordBuffer;
+    /********************************************************************/
+    /* Allow space at the beginning of the record for the packet        */
+    /*length which will be computed after the packet is complete.       */
+    /********************************************************************/
+    sddfWriteInteger( &hdfRecordPointer, 0 );
+    /********************************************************************/
+    /* The record type, tag, and name                                   */
+    /********************************************************************/
+    sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR );
+    sddfWriteInteger( &hdfRecordPointer, ( FAMILY_NAME ) );
+    sddfWriteString( &hdfRecordPointer, "HDF Name Identifier Record" );
+    /********************************************************************/
+    /* The record attribute count and string pair                       */
+    /********************************************************************/
+    sddfWriteInteger( &hdfRecordPointer, 1 );
+    sddfWriteString( &hdfRecordPointer, "description" );
+    sddfWriteString( &hdfRecordPointer, "HDF Name Identifier Record" );
+    /********************************************************************/
+    /* The record field count                                           */
+    /********************************************************************/
+    sddfWriteInteger( &hdfRecordPointer, 3);
+    /********************************************************************/
+    /* Create fields                                               	*/
+    /********************************************************************/
+    WRITE_HDF_FIELD(  "Identifier Type", 
+		      "Data Set Type", 
+		      "Data Set Identifier Type", 
+		      INTEGER, 0 );
+    WRITE_HDF_FIELD2( "HDF ID",
+                      "HDF ID", "File, Data Set or Dim Identifier number",
+                      "0", "No HDF ID specified",
+                      INTEGER, 0 ); 
+    WRITE_HDF_FIELD( "HDF Name",
+                     "HDF Name", "Name of File, Data Set or Dim",
+                      CHARACTER, 1 );
+
+    recordLength = (int)(hdfRecordPointer - recordBuffer);
+
+    hdfRecordPointer = recordBuffer;
+    sddfWriteInteger( &hdfRecordPointer, recordLength );
+
+    putBytes( recordBuffer, (unsigned) recordLength );
+}

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF_SDDF.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF_SDDF.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDF_SDDF.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,829 @@
+/*
+ * This file is an extension to NCSA HDF to enable the use of the
+ * Pablo trace library.
+ *
+ * Developed by: The TAPESTRY Parallel Computing Laboratory
+ *		 University of Illinois at Urbana-Champaign
+ *		 Department of Computer Science
+ *		 1304 W. Springfield Avenue
+ *		 Urbana, IL	61801
+ *
+ * Copyright (c) 1995
+ * The University of Illinois Board of Trustees.
+ *      All Rights Reserved.
+ *
+ * PABLO is a registered trademark of
+ * The Board of Trustees of the University of Illinois
+ * registered in the U.S. Patent and Trademark Office.
+ *
+ * Author: George Xin Zhou (xzhou at cs.uiuc.edu)
+ * Contributing Author: Jonathan M. Reid (jreid at cs.uiuc.edu)
+ *
+ * Project Manager and Principal Investigator:
+ *	Daniel A. Reed (reed at cs.uiuc.edu)
+ *
+ * Funded by: National Aeronautics and Space Administration under NASA
+ * Contracts NAG-1-613 and USRA 5555-22 and by the Advanced Research
+ * Projects Agency under ARPA contracts DAVT63-91-C-0029 and
+ * DABT63-93-C-0040.
+ *
+ */
+/*======================================================================*
+// File:  PabloHDF_SDDF.c						*
+// Purpose: support use of Pablo trace library to analyze HDF 		*
+// performance								*
+// Contents:							 	*
+// HDFinitTrace_SDDF:   initialize SDDF tracing	 	 		*
+// HDFendTrace_SDDF:    end SDDF tracing		 		*	
+// startHDFtraceEvent:  record start of HDF procedure    		*
+// endHDFtraceEvent:    record end of HDF proc	 			*
+// preInitHDFProcTrace: called by HDFinitTrace_SDDF to set up SDDF 	*
+//                      interface function calls			*
+// initHDFProcTrace:    called by HDFinitTrace_SDDF to initialize data 	*
+//		        structures used in tracing HDF procedures.	*
+// writeHDFProcRecordDescriptors:       				*
+//	                generates the record descriptors for the HDF	*
+//	                procedure entry/exit event families.  		*
+// HDFprocEventRecord:  generates trace records for events which are	*
+//   	                to produce procedure entry or exit event family *
+//			trace records.					*
+// findHDFProcEvent:    retruns procedure entry/exit index		*
+// _hdfTraceEntryDescriptor:						* 
+//	                Generate a SDDF binary format record descriptor *
+//                      for HDF procedure entries 			*
+// _hdfTraceExitDescriptor:	     					* 
+//	                Generate a SDDF binary format record descriptor *
+//                      for the	HDF procedure exits			*
+//======================================================================*/
+#include <stdio.h>
+
+#ifdef HAVE_PARALLEL
+#include "mpi.h"
+#endif
+
+#include "ProcIDs.h"
+
+#include "SystemDepend.h"
+#include "SDDFparam.h"
+#include "TraceParam.h"
+#include "Trace.h"
+#include "HDFTrace.h"
+void HDFendTrace_SDDF(int);
+void startHDFtraceEvent(int eventID);
+void endHDFtraceEvent(int , int , char *, int );
+int preInitHDFProcTrace( void );
+int initHDFProcTrace( int , int * );
+int  writeHDFProcRecordDescriptors( void );
+int findHDFProcEvent( int ) ;
+TR_RECORD *HDFprocEventRecord( int, TR_EVENT *, CLOCK, HDFsetInfo *, unsigned );
+TR_RECORD *miscEventRecord( int , TR_EVENT *, CLOCK, void *, unsigned );
+void _hdfMiscDescriptor( void );
+void _hdfProcNameDescriptor( void );
+/*int setEventRecordFunction( int, void *(*)() );*/
+int setEventRecordFunction( int, TR_RECORD *(*)() );
+void HDFtraceIOEvent( int, void *, unsigned );
+void initIOTrace( void );
+void enableIOdetail( void );
+void disableLifetimeSummaries( void );
+void disableTimeWindowSummaries( void );
+void disableFileRegionSummaries( void );
+void _hdfTraceDescriptor( char *, char *, int );
+void createHDFTraceDescriptor( int );
+void HDFfinalTimeStamp( void );
+
+void initIOTrace( void );
+void endIOTrace( void );
+#define PABLO 1
+/* on the ipsc/860 we don't include unistd.h */
+#ifndef __NX
+#include <unistd.h>
+#endif
+
+#define returnRecord(x)    return x;
+
+#ifdef HAVE_MPIOTRACE
+	int initMPIOTrace( char *, int );
+	void endMPIOTrace( void ) ;
+#else
+	void endMPIOTrace( void ) {return;} 
+#endif
+extern char *hdfRecordPointer;
+/*======================================================================*
+// Prototypes of functions in this file.				*
+//======================================================================*/
+void HDFinitTrace_SDDF( char *, int );
+/*======================================================================* 
+// Each procedure being traced has associated with it a distinct pair 	* 
+// of entry and exit event IDs.  This code maintains a vector of such  	* 
+// matchings which permits the ready identification of an event ID as  	* 
+// being either an entry event or an exit event and for which procedure.* 
+//======================================================================*/
+typedef struct procEventMatch {
+	int			entryID;  /* procedure entry event ID 	*/
+	int			exitID;	  /* procedure exit event ID  	*/
+} PROC_EVENTS;
+
+static PROC_EVENTS	*procEvents =	   /* array of event ID pairs 	*/
+			(PROC_EVENTS *) 0;
+/*======================================================================* 
+// For each procedure being traced this code maintains a stack of	* 
+// procedure entry times.  Each procedure entry event causes the	* 
+// corresponding procedure's stack to be pushed, each procedure exit	* 
+// event causes the corresponding procedure's stack to be popped, and	* 
+// from the difference in time between entry and exit the procedure	* 
+// duration may be calculated in a very straightforward subtraction.  	* 
+// The above procedure entry-exit event ID matching is used to map 	* 
+// events to their corresponding procedures.  In addition, the 		* 
+// cumulative total of these procedure durations is maintained for all 	* 
+// traced subprocedures	of each traced procedure.  That is, when a 	* 
+// traced procedure exits, it increases this duration sum for its most 	* 
+// immediate traced ancestor procedure.  By subtracting this 		* 
+// subprocedure duration sum from the traced procedure's inclusive 	* 
+// duration, we arrive at the exclusive duration of the procedure.	* 
+//======================================================================*/
+typedef struct procEntryTime {
+	CLOCK			entryTime;	/* when proc entered 	*/
+	CLOCK			subProcTime;	/* subproc duration    	*/
+	struct procEntryTime	*nextTime;	/* stack pointer down	*/
+	struct procEntryTime	*ancestorProc;	/* traced ancestor	*/
+} PROC_ENTRY;
+
+/*
+static PROC_ENTRY	**procEntryStack =*/	/* array of pointers to	*/
+/*	(PROC_ENTRY **) 0;*/	/* stack top elements	*/
+/*======================================================================*
+// Define data structure types for procedure entry and exit trace 	* 
+// records, similarly to record data structures in Trace.h	 	* 
+//======================================================================*/
+
+/*======================================================================* 
+// TraceRecord Data packets:						* 
+//======================================================================*/
+struct procTraceRecordData {
+	int	packetLength;	   /* bytes in packet		    	*/
+	int	packetType;	   /* == PKT_DATA		    	*/
+	int	packetTag;	   /* FAMILY_PROCEXIT | RECORD_TRACE   	*/
+	int	eventID;	   /* ID of corresponding event	    	*/
+	double	seconds;	   /* floating-point timestamp	    	*/
+	long	setID;	           /* index of file | Data Set accessed	*/
+	int	nodeNumber;	   /* occurred on which node	    	*/
+	int	nameLen;	   /* Length of file or data set name	*/
+	/* name comes next, but no space is allocated	*/
+};
+#define procTraceRecLen 6*sizeof(int) + sizeof(double) +sizeof(long)
+/*======================================================================*
+// misc Record Data packets:						* 
+//======================================================================*/
+struct miscTraceRecordData {
+	int	packetLength;	/* bytes in packet		    	*/
+	int	packetType;	/* == PKT_DATA			    	*/
+	int	packetTag;	/* FAMILY_MISC | RECORD_TRACE  		*/
+	int	eventID;	/* ID of corresponding event	    	*/
+	double	seconds;	/* floating-point timestamp	    	*/
+	double	duration;	/* floating-point operation duration	*/
+	unsigned long	bytes;	/* number of bytes requested        	*/
+	int	nodeNumber;	/* occurred on which node	    	*/
+};
+#define miscTraceLen 5*sizeof(int) + 2*sizeof(double) +sizeof(long)
+/*======================================================================*
+// The procEntries array specifies the event IDs of procedure entry 	*
+// events. 								*
+//======================================================================*/
+int procEntries[] = {
+0, 0, 0, 0, 0,
+#include "HDFidList.h"
+ID_HDF_Last_Entry
+};
+/*======================================================================*
+// The procEntryCalled array indicates whether or not a procedure entry *
+// was called.					*
+//======================================================================*/
+int *procEntryCalled;
+/*======================================================================*
+// The HDFProcNames array holds the names of the HDF entries.       	*
+//======================================================================*/
+static char HDFProcNames[][40] = {
+"noName",
+"noName",
+"noName",
+"noName",
+"noName",
+#include "HDFentryNames.h"
+"HDF_LAST_ENTRY"
+};
+/*=======================================================================
+// NAME									*
+//     	HDFinitTrace_SDDF -- initalize HDF tracing with SDDF records	*
+// USAGE								*
+//     	HDFinitTrace_SDDF( traceFileName, procTraceMask )		*
+// PARAMETERS								*
+//	char *traceFileName  -- name of trace file to hold output	*
+//	uint32 prcoTraceMask -- mask indicating classes of HDF procs to *
+//				be traced				*
+// RETURNS								*
+//     	None 								*
+//======================================================================*/
+void HDFinitTrace_SDDF( char *traceFileName, int OUTSW )
+{
+	/*===============================================================
+        // set traceFileName and set IO tracing switches.  If MPIO 	*
+	// tracing is available, MPIO tracing will also be initialized. *
+	//==============================================================*/
+#ifdef HAVE_PARALLEL
+	/*===============================================================
+	// The code is built to handle parallel processing using MPI.	*	
+	// However, the code may or may not be run using MPI and there  *
+	// may or may not be support for MPIO tracing in the Pablo	*
+	// Trace libraries.  The type of initialization performed 	*
+	// depends on these factors.					*
+	//==============================================================*/
+	int myNode;
+	char *buff;
+	/*===============================================================
+	// Determine if MPI is running the program.			*
+	//==============================================================*/
+	if ( OUTSW == MPI_RUNTIME_TRACE ) {
+	   /*============================================================
+	   // in the parallel case, initialize MPI-IO tracing. This  	*
+	   // will initialize the traceFileName and set the I/O tracing	*
+	   // switches.							*
+	   //===========================================================*/
+           MPI_Comm_rank( MPI_COMM_WORLD, &myNode );
+	   setTraceProcessorNumber( myNode );
+#ifdef HAVE_MPIOTRACE
+	   /*============================================================
+	   // MPIO Tracing is supported in the Pablo Library.  Let the  *
+	   // MPIO initialization be performed and handle the naming of *
+	   // trace files.						*
+	   //===========================================================*/
+           initMPIOTrace( traceFileName, RUNTIME_TRACE ); 
+#else 
+	   /*============================================================
+	   // MPIO tracing is not supported.				*
+	   // Set up the trace file names depending on the number of    *
+	   // current node.						*
+	   //===========================================================*/
+	   buff = (char *)malloc( strlen(traceFileName)+12);
+	   sprintf( buff, "%s.nd%.4d\0",traceFileName,myNode);
+	   setTraceFileName( buff );
+	   free( buff );
+    	   initIOTrace();
+    	   enableIOdetail();
+    	   disableLifetimeSummaries();
+           disableTimeWindowSummaries();
+	   disableFileRegionSummaries();
+#endif
+	} else {
+	   /*============================================================
+	   // The HDF library was built to run with MPI, but the	*
+	   // application is being run in serial mode.  Initialization	*
+	   // is done as in the serial case.				*
+	   //===========================================================*/
+	   setTraceFileName(traceFileName);
+    	   initIOTrace();
+    	   enableIOdetail();
+    	   disableLifetimeSummaries();
+           disableTimeWindowSummaries();
+	   disableFileRegionSummaries();
+	} 
+#else 
+	/*===============================================================
+	// in the non-parallel case, set the trace file name and the 	*
+	// I/O tracing switches.					*
+	//==============================================================*/
+	setTraceFileName(traceFileName);
+    	initIOTrace();
+    	enableIOdetail();
+    	disableLifetimeSummaries();
+        disableTimeWindowSummaries();
+	disableFileRegionSummaries();
+#endif /* HAVE_PARALLEL */
+	/*===============================================================
+	// complete HDF initiailization.				*
+	//==============================================================*/
+	preInitHDFProcTrace();
+        initHDFProcTrace( sizeof(procEntries)/sizeof(int), procEntries );
+}
+/*=======================================================================
+// NAME									*
+//     HDFendTrace_SDDF -- end HDF tracing				*
+// USAGE								*
+//     HDFendTrace_SDDF()      						*
+// RETURNS								*
+//     None.								*
+//======================================================================*/
+void HDFendTrace_SDDF(int OUTSW)
+{
+	HDFfinalTimeStamp();
+	if ( OUTSW == MPI_RUNTIME_TRACE ) {
+	   /*============================================================
+	   // termintate MPI-IO tracing in the parallel case.  This 	*
+	   // will terminate the I/O tracing and close tracing as well.	*
+	   //===========================================================*/
+	   endMPIOTrace(); 
+	} else {
+	   /*============================================================
+	   // terminate tracing						*
+	   //===========================================================*/
+       	   endIOTrace();
+       	   endTracing();
+	} 
+}
+/*=======================================================================
+// NAME									*
+//   initHDFProcTrace:							*
+//     This function initializes data structures specific to		* 
+//     the procedure entry/exit tracing extensions of the Pablo		* 
+//     instrumentation library.  The argument numProcs specifies	* 
+//     how many procedures are to be traced.  The argument procEntryID	* 
+//     is a vector specifying the event IDs to be use as entry events	*
+//     for each of the procedures.  The negative value is used for 	*
+//     the exit event ID.  						*
+// USAGE								*
+//   result = initHDFProcTrace(numProcs,procEntryID)			*
+// PARAMETERS								*
+//   int numProcs     -- number of Procedures to be initialized		*
+//   int *procEntryID -- array of id entry codes for these procedures	*
+// RETURNS								*
+//   SUCCESS or FAILURE							*
+//======================================================================*/
+int initHDFProcTrace( int numProcs, int *procEntryID )
+{
+	int			procIndex, IX, ID;
+
+  	if (( numProcs <= 0 ) || ( procEntryID == (int *) 0 )  )
+		return FAILURE; 
+	/*===============================================================
+	// Allocate space to store a copy of the procedure entry-exit	*
+	// event ID matchings and also the procedure entry stacks.	*
+	//==============================================================*/
+	procEvents = (PROC_EVENTS *) TRgetBuffer(
+					   (numProcs+4)*sizeof(PROC_EVENTS) );
+
+	if ( procEvents == (PROC_EVENTS *) 0 )
+		TRfailure( "cannot allocate procedure events matching" );
+
+	procEntryCalled = ( int *)malloc( numProcs*sizeof(int) );
+	if ( procEvents == NULL )
+	   TRfailure( "cannot allocate procedure Called indicators" );
+	/*===============================================================
+	// Initialize the procedure events matching from the arguments	*
+	// passed.  Configure the trace record-generating function for  *
+	// these events.  Initialize the flags indicating whether or	*
+	// not the procedure was called.				*
+	//==============================================================*/
+	for ( procIndex = 0; procIndex < numProcs; procIndex++ ) {
+
+	        IX = procEntryID[ procIndex ];
+		ID = HDFIXtoEventID( IX );
+		procEvents[ procIndex ].entryID = ID;
+		procEvents[ procIndex ].exitID = -ID;
+
+		setEventRecordFunction( ID, HDFprocEventRecord );
+		setEventRecordFunction( -ID, HDFprocEventRecord );
+		procEntryCalled[ procIndex ] = 0;
+
+	}
+
+	/*===============================================================
+	// Initialize the procedure events for malloc.  		*
+	// Configure the trace record-generating function for this  	*
+	// event.							*
+	//==============================================================*/
+	procEvents[ numProcs ].entryID = ID_malloc;
+	procEvents[ numProcs ].exitID = -ID_malloc;
+	setEventRecordFunction( ID_malloc, miscEventRecord );
+	setEventRecordFunction( -ID_malloc, miscEventRecord );
+	procEvents[ numProcs+1 ].entryID = ID_free;
+	procEvents[ numProcs+1 ].exitID = -ID_free;
+	setEventRecordFunction( ID_free, miscEventRecord );
+	setEventRecordFunction( -ID_free, miscEventRecord );
+
+	return SUCCESS;
+}
+/*=======================================================================
+// NAME									*
+//   preInitHDFProcTrace:						*
+//   	This function calls the trace library interface function	* 
+//	setRecordDescriptor, which records the address of the		* 
+//	procedure that generates the record descriptors for the		* 
+//	procedure trace event families.  It is automatically		* 
+//	invoked by HDFinitTrace_SDDF. 					*
+// USAGE								*
+//   result = preInitHDFProcTrace();					*
+// RESULT								*
+//   SUCCESS or FAILURE							*
+/=======================================================================*/
+int preInitHDFProcTrace( void )
+{
+	static int	preInitDone = FALSE;
+
+	if ( preInitDone == TRUE )
+		return SUCCESS;
+	/*===============================================================
+	// Give the instrumentation library a pointer to the functions	*
+	// in which we output the specialized record descriptors for	*
+	// procedure entry/exit.					*
+        //==============================================================*/
+	setRecordDescriptor( writeHDFProcRecordDescriptors );
+
+	preInitDone = TRUE;
+	return SUCCESS;
+}
+/*=======================================================================
+// NAME									*
+//   writeHDFProcRecordDescriptors:					*
+//	   This function generates the record descriptors for the HDF	*
+//	   procedure entry/exit event families.  It will be invoked	*
+//	   by the instrumentation library initialization routines.	*
+//	   Patterned after instrumentation library internal function	*
+//	   writeRecordDescriptors.					*
+// USAGE								*
+//   result = writeHDFProcRecordDescriptors();				*
+// RESULT								*
+//   SUCCESS 								*
+/=======================================================================*/
+int  writeHDFProcRecordDescriptors( void )
+{
+#ifdef DEBUG
+	fprintf( debugFile, "writeHDFProcRecordDescriptors\n" );
+	fflush( debugFile );
+#endif /* DEBUG */
+
+	_hdfMiscDescriptor();
+
+#ifdef DEBUG
+	fprintf( debugFile, "writeHDFProcRecordDescriptors done\n" );
+	fflush( debugFile );
+#endif /* DEBUG */
+	return SUCCESS;
+}
+/*=======================================================================
+// NAME									*
+//   HDFprocEventRecord:						*
+// 	This function generates trace records for events which are	*
+//   	to produce procedure entry or exit event family trace records.	*
+//   	Patterned after the instrumentation library internal functions	*
+//	externalEventRecord and sddfRecord.				*
+// USAGE								*
+//   REC = HDFprocEventRecord( recordType, eventPointer, timeStamp,	*
+//                             dataPointer, dataLength)			*
+// PARAMETERS								*
+//   int recordType 	    -- type of event record			*
+//   TR_EVENT eventPointer  -- pointer to event data structure		*
+//   CLOCK timeStamp	    -- time event is recorded			*
+//   HDFsetInfo dataPointer -- information about HDF data set accessed	*
+//   unsigned dataLength    -- dummy for compatability			*
+// RETURNS								*
+//   pointer to trace record for this event 				*
+//======================================================================*/
+TR_RECORD *
+HDFprocEventRecord( int recordType, TR_EVENT *eventPointer, CLOCK timeStamp,
+		    HDFsetInfo *dataPointer, unsigned dataLength )
+{
+	static TR_RECORD		traceRecord;
+	static void			*recordBuffer = NULL;
+	static int			bufferLength = 0;
+	struct procTraceRecordData	*TraceRecordHeader;
+	int				procIndex;
+	int				recordFamily;
+	char				*namePtr;
+		
+	#ifdef DEBUG
+		fprintf( debugFile, "HDFprocEventRecord\n" );
+		fflush( debugFile );
+	#endif /* DEBUG */
+
+	/*==============================================================* 
+	// Find the index in the tables for the procedure corresponding *
+	// to this eventID.						*
+	//==============================================================*/
+	procIndex = findHDFProcEvent( eventPointer->eventID );
+	if ( procIndex < 0 ) {
+	   return nullRecordFunction( recordType, eventPointer,
+				timeStamp, (char *)dataPointer, dataLength );
+	}
+	/*==============================================================* 
+	// Produce a packet for the name of the procedure if one has 	*
+	// not already been produced.					*
+	//==============================================================*/
+	if ( procEntryCalled[procIndex] == 0 ) {
+	   createHDFTraceDescriptor( procIndex );
+	   procEntryCalled[procIndex] = 1;
+	}
+	/*==============================================================* 
+	// Determine whether this is a procedure entry or a procedure 	* 
+	// exit family event by lookup in the procedure event ID 	* 
+	// matching.  							* 
+	//==============================================================*/
+	recordFamily = HDF_FAMILY + ( procIndex + 1)*8;
+	/*==============================================================* 
+	// The time stamp stored in the event descriptor will be used	*  
+	// unless one is specified in the timeStamp parameter.	    	*  
+	//==============================================================*/
+	if ( clockCompare( timeStamp, noSuchClock ) == 0 ) {
+	   timeStamp = eventPointer->eventLast;
+	}
+	/*==============================================================* 
+	// Determine how many bytes of storage will be needed for the 	*  
+	// contents of the trace record.			    	* 
+	//==============================================================*/
+	traceRecord.recordLength = sizeof *TraceRecordHeader;
+        if ( dataPointer != NULL && dataPointer->setName != NULL ) {
+	   traceRecord.recordLength += strlen( dataPointer->setName );
+        }
+	/*==============================================================* 
+	// If there is a previously-allocated buffer and its size will	* 
+	// hold this record, re-use the buffer.  Otherwise, deallocate	* 
+	// the buffer (if allocated) and allocate a bigger one.	    	* 
+	//==============================================================*/
+	if ( bufferLength < traceRecord.recordLength ) {
+
+	   if ( recordBuffer != NULL ) {
+	      TRfreeBuffer( recordBuffer );
+	   }
+
+	   recordBuffer = (char *)TRgetBuffer( traceRecord.recordLength );
+
+	   if ( recordBuffer == NULL ) {
+	      TRfailure( "cannot allocate storage for trace record" );
+	   }
+	   bufferLength = traceRecord.recordLength;
+	}
+
+	traceRecord.recordContents = recordBuffer;
+	/*==============================================================* 
+	// Load the trace record fields into the allocated buffer 	* 
+	//==============================================================*/
+	TraceRecordHeader = (struct procTraceRecordData *)recordBuffer;
+	TraceRecordHeader->packetLength = traceRecord.recordLength;
+	TraceRecordHeader->packetType = PKT_DATA;
+	TraceRecordHeader->packetTag = recordFamily | recordType;
+	TraceRecordHeader->seconds = clockToSeconds( timeStamp );
+	TraceRecordHeader->eventID = eventPointer->eventID;
+	TraceRecordHeader->nodeNumber = TRgetNode();
+
+	if ( dataPointer != 0 ) {
+	  TraceRecordHeader->setID = dataPointer->setID;
+	  if (dataPointer->setName != NULL ) {
+	     TraceRecordHeader->nameLen = (int)strlen( dataPointer->setName );
+ 	     /*================================================* 
+	     // copy name directly into the end of the buffer.	*
+	     //================================================*/
+	     namePtr = (char *)TraceRecordHeader + procTraceRecLen;
+	     memcpy(namePtr, dataPointer->setName, TraceRecordHeader->nameLen);
+	  } else {
+	     TraceRecordHeader->nameLen = 0;
+	  }   
+	} else {
+	  TraceRecordHeader->setID = 0;
+	  TraceRecordHeader->nameLen = 0;
+        } 
+
+#ifdef DEBUG
+	fprintf( debugFile, "HDFprocEventRecord done\n" );
+	fflush( debugFile );
+#endif /* DEBUG */
+	returnRecord(&traceRecord);
+}
+/*======================================================================*
+// Internal Routine:  miscEventRecord					*
+//	  Called for misc start and end events.		       		*
+//======================================================================*/
+TR_RECORD *miscEventRecord( int recordType, 
+			      TR_EVENT *eventPointer, 
+                              CLOCK timeStamp, 
+			      void *dataPointer, 
+			      unsigned dataLength )
+{
+    static TR_RECORD traceRecord;
+    static struct miscTraceRecordData miscRecord;
+    static int initialized = FALSE;
+    int eventID;
+
+    if ( clockCompare( timeStamp, noSuchClock ) == 0 ) {
+        timeStamp = eventPointer->eventLast;
+    }
+
+    eventID =  eventPointer->eventID;
+    if ( ! initialized ) {
+       miscRecord.packetLength = sizeof( miscRecord );
+       miscRecord.packetType = PKT_DATA;
+       miscRecord.packetTag = FAMILY_MISC | RECORD_TRACE;
+       miscRecord.nodeNumber = traceProcessorNumber;
+
+       traceRecord.recordLength = miscRecord.packetLength;
+       traceRecord.recordContents = (char *) &miscRecord;
+       initialized = TRUE;
+    }
+
+    switch ( eventID ) {
+       case ID_malloc:
+       case ID_free:
+	  miscRecord.seconds = clockToSeconds( timeStamp ) ;
+          miscRecord.eventID = eventID ;
+	  break;
+       case -ID_malloc:
+       case -ID_free:
+	  miscRecord.bytes = *(int *)dataPointer;
+          miscRecord.duration = clockToSeconds( timeStamp) 
+                                      - miscRecord.seconds;
+          return &traceRecord;		/* generate trace record */
+       default:
+          fprintf( stderr, "miscEventRecord: unknown eventID %d\n", eventID );
+	  break;
+    }
+    /*==================================================================*
+    // If we get here then no trace record generated.  Normally we 	*	
+    // should get here if this is an entry call.			*
+    //==================================================================*/
+    return( nullRecordFunction( recordType, eventPointer, timeStamp,
+				            dataPointer, dataLength ) );
+}
+/*======================================================================*
+// NAME									*
+//   findHDFProcEvent:							*
+//	   Search the procedure entry/exit event ID matching data	*
+//	   structure for an event ID (either entry or exit) which is	*
+//	   the same as the argument eventID.  If found, return the	*
+//	   index from that table, which will be between 0 and		*
+//	   numberProcedures - 1, inclusive.  If not found, return -1;	*
+// USAGE								*
+//   index = findHDFProcEvent						*
+// RETURNS								*
+//   index of the procedure corresponding to this ID			*
+//======================================================================*/
+int findHDFProcEvent( int eventID )
+{
+	int	procIndex;
+
+#ifdef DEBUG
+	fprintf( debugFile, "findHDFProcEvent\n" );
+	fflush( debugFile );
+#endif /* DEBUG */
+        if ( isBeginHDFEvent(eventID) ) {
+	   procIndex = eventID - BEGIN_HDF;
+        } else if ( isEndHDFEvent( eventID ) ) {
+	   procIndex = -eventID - BEGIN_HDF;
+	} else {
+	   procIndex = -1 ;
+	}
+	return procIndex;
+}
+void createHDFTraceDescriptor( int Inx )
+{
+        char BUF1[256], BUF2[256] ;
+	int FAMILY;
+        strcpy( BUF2, "HDF ");
+        strcat( BUF2, HDFProcNames[Inx] );
+        strcat( BUF2, " Procedure");
+        strcpy( BUF1, BUF2 );
+        strcat( BUF1, " Trace");
+
+	FAMILY = HDF_FAMILY + (Inx + 1)*8;
+        _hdfTraceDescriptor( BUF1, BUF2, FAMILY );
+}
+/*======================================================================*
+// NAME									*
+//	_hdfTraceDescriptor						* 
+//	   Generate a SDDF binary format record descriptor for the	* 
+//	   full trace class of events in the HDF procedure entry 	* 
+// USAGE								*
+//   _hdfTraceDescriptro( recordName, recordDescription, recordFamily )	*
+// RETURNS								*
+//      void								*
+//======================================================================*/
+void _hdfTraceDescriptor( char *recordName,
+                    	  char *recordDescription,
+                          int recordFamily )
+{
+    static char recordBuffer[ 4096 ];
+    int         recordLength;
+
+    hdfRecordPointer = recordBuffer;
+    /*===================================================================
+    // Allow space at the beginning of the record for the packet        *
+    //length which will be computed after the packet is complete.       *
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, 0 );
+    /*===================================================================
+    // The record type, tag, and name                                   *
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR );
+    sddfWriteInteger( &hdfRecordPointer, ( recordFamily | RECORD_TRACE ) );
+    sddfWriteString( &hdfRecordPointer, recordName );
+    /*===================================================================
+    // The record attribute count and string pair                       *
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, 1 );
+    sddfWriteString( &hdfRecordPointer, "description" );
+    sddfWriteString( &hdfRecordPointer, recordDescription );
+    /*==================================================================*
+    // The record field count                                           * 
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, 5);
+    /*==================================================================* 
+    // Create fields                                               	*
+    //==================================================================*/
+    WRITE_HDF_FIELD(  "Event Identifier", 
+		      "Event ID", 
+		      "Event Identifier Number", 
+		      INTEGER, 0 );
+    WRITE_HDF_FIELD(  "Seconds", 
+		      "Seconds", 
+		      "Floating Point Timestamp", 
+		      DOUBLE, 0 );
+    WRITE_HDF_FIELD2( "HDF ID",
+                      "HDF ID", "File, Data Set or Dim Identifier number",
+                      "0", "No HDF ID specified",
+                      LONG, 0 ); 
+    WRITE_HDF_FIELD(  "Processor Number", 
+		      "Node", 
+		      "Processor number", 
+		      INTEGER, 0 );
+    WRITE_HDF_FIELD(  "HDF Name",
+                      "HDF Name", "Name of File, Data Set or Dim",
+                      CHARACTER, 1 );
+
+
+    recordLength = (int)(hdfRecordPointer - recordBuffer);
+
+    hdfRecordPointer = recordBuffer;
+    sddfWriteInteger( &hdfRecordPointer, recordLength );
+
+    putBytes( recordBuffer, (unsigned) recordLength );
+}
+/*======================================================================*
+// NAME									*
+//	_hdfMiscDescriptor						* 
+//	   Generate a SDDF binary format record descriptor for the	* 
+//	   misc procedure                                        	* 
+// USAGE								*
+//      _hdfMiscDescriptor()					*
+// RETURNS								*
+//      void								*
+//======================================================================*/
+void _hdfMiscDescriptor( void )
+{
+    static char recordBuffer[ 4096 ];
+    int         recordLength;
+
+#ifdef DEBUG
+	fprintf( debugFile, "_hdfMiscDescriptor entered\n" );
+	fflush( debugFile );
+#endif /* DEBUG */
+    hdfRecordPointer = recordBuffer;
+    /*==================================================================* 
+    // Allow space at the beginning of the record for the packet        *
+    //length which will be computed after the packet is complete.       *
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, 0 );
+    /*==================================================================* 
+    // The record type, tag, and name                                   * 
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR );
+    sddfWriteInteger( &hdfRecordPointer, ( FAMILY_MISC | RECORD_TRACE ) );
+    sddfWriteString( &hdfRecordPointer, "Misc Trace" );
+    /*==================================================================*
+    // The record attribute count and string pair                       *
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, 1 );
+    sddfWriteString( &hdfRecordPointer, "description" );
+    sddfWriteString( &hdfRecordPointer, "Misc Trace Record" );
+    /*==================================================================*
+    // The record field count                                           * 
+    //==================================================================*/
+    sddfWriteInteger( &hdfRecordPointer, 5);
+    /*==================================================================* 
+    // Create fields                                               	*
+    //==================================================================*/
+    WRITE_HDF_FIELD( "Event Identifier", 
+		     "Event ID", 
+		     "Event Identifier Number", 
+		     INTEGER, 0 );
+    WRITE_HDF_FIELD( "Seconds", 
+		     "Seconds", 
+		     "Floating Point Timestamp", 
+		     DOUBLE, 0 );
+    WRITE_HDF_FIELD( "Duration", 
+		     "Duration", 
+		     "Operation Duration", 
+		     DOUBLE, 0 );
+    WRITE_HDF_FIELD( "Bytes", 
+		     "Bytes", 
+		     "Bytes Requested", 
+		     LONG, 0 );
+    WRITE_HDF_FIELD( "Processor Number", 
+		     "Node", 
+		     "Processor number", 
+		     INTEGER, 0 );
+
+    recordLength = (int)(hdfRecordPointer - recordBuffer);
+
+    hdfRecordPointer = recordBuffer;
+    sddfWriteInteger( &hdfRecordPointer, recordLength );
+
+    putBytes( recordBuffer, (unsigned) recordLength );
+}
+
+/*#endif */ /* HAVE_PABLO */ 

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDFff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDFff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/PabloHDFff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,62 @@
+C *
+C * This file is an extension to NCSA HDF to enable the use of the
+C * Pablo trace library.
+C *
+C * Developed by: The TAPESTRY Parallel Computing Laboratory
+C *		  University of Illinois at Urbana-Champaign
+C *		  Department of Computer Science
+C *		  1304 W. Springfield Avenue
+C *		  Urbana, IL	61801
+C *
+C * Copyright (c) 1995
+C * The University of Illinois Board of Trustees.
+C *      All Rights Reserved.
+C *
+C * PABLO is a registered trademark of
+C * The Board of Trustees of the University of Illinois
+C * registered in the U.S. Patent and Trademark Office.
+C *
+C * Author: Jonathan M. Reid (jreid at cs.uiuc.edu)
+C *
+C * Project Manager and Principal Investigator:
+C *	Daniel A. Reed (reed at cs.uiuc.edu)
+C *
+C * Funded by: National Aeronautics and Space Administration under NASA
+C * Contracts NAG-1-613 and USRA 5555-22 and by the Advanced Research
+C * Projects Agency under ARPA contracts DAVT63-91-C-0029 and
+C * DABT63-93-C-0040.
+C *
+
+C-----------------------------------------------------------------------------
+C File:     PabloHDFff.f
+C Purpose:  Fortran stubs for Pablo routines
+C Invokes:  PabloHDFf.c 
+C Contents: 
+C   hinitiotrace :   Call ihinitiotrace to initialize Pablo tracing
+C Remarks: none
+C-----------------------------------------------------------------------------
+
+C-----------------------------------------------------------------------------
+C Name: hdfinittrace
+C Purpose:  call hdfinittracex to initialize tracing
+C Inputs:   tracefn: Trace file name
+C           proctmask:
+C Returns: 0 on success, FAIL on failure 
+C Users:   
+C Invokes: ihinitiotrace
+C-----------------------------------------------------------------------------
+
+      subroutine hdfinittracef(tracefn,traceids,nids,out_sw)
+
+      character*(*) tracefn
+      integer       traceids(*), out_sw, nids
+      character filename(1024)
+      integer  i, length
+
+      length = len(tracefn)
+      do i = 1, length
+	 filename(i) = tracefn(i:i) 
+      end do
+      call  hinittracex(filename,length,traceids,nids,out_sw)
+      return
+      end

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/PabloSedscr
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/PabloSedscr	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/PabloSedscr	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,15 @@
+s/_//g
+s/,//g
+/^[0-9]/,/ID/{
+/^[0-9]/h
+/^[0-9]/d
+s/$/ = /
+G
+s/\n//
+s/ID/      parameter ( &/
+s/$/ )/
+h
+s/parameter (/integer/
+s/=.*//
+G
+}

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/ProcIDs.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/ProcIDs.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/ProcIDs.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,156 @@
+/*  This file is part of the Pablo Performance Analysis Environment
+// 
+//           (R)
+//  The Pablo    Performance Analysis Environment software is NOT in
+//  the public domain.  However, it is freely available without fee for
+//  education, research, and non-profit purposes.  By obtaining copies
+//  of this and other files that comprise the Pablo Performance Analysis
+//  Environment, you, the Licensee, agree to abide by the following
+//  conditions and understandings with respect to the copyrighted software:
+//  
+//  1.  The software is copyrighted in the name of the Board of Trustees
+//      of the University of Illinois (UI), and ownership of the software
+//      remains with the UI. 
+// 
+//  2.  Permission to use, copy, and modify this software and its documentation
+//      for education, research, and non-profit purposes is hereby granted
+//      to Licensee, provided that the copyright notice, the original author's
+//      names and unit identification, and this permission notice appear on
+//      all such copies, and that no charge be made for such copies.  Any
+//      entity desiring permission to incorporate this software into commercial
+//      products should contact:
+// 
+//           Professor Daniel A. Reed                 reed at cs.uiuc.edu
+//           University of Illinois
+//           Department of Computer Science
+//           2413 Digital Computer Laboratory
+//           1304 West Springfield Avenue
+//           Urbana, Illinois  61801
+//           USA
+// 
+//  3.  Licensee may not use the name, logo, or any other symbol of the UI
+//      nor the names of any of its employees nor any adaptation thereof in
+//      advertizing or publicity pertaining to the software without specific
+//      prior written approval of the UI.
+// 
+//  4.  THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE
+//      SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS
+//      OR IMPLIED WARRANTY.
+// 
+//  5.  The UI shall not be liable for any damages suffered by Licensee from
+//      the use of this software.
+// 
+//  6.  The software was developed under agreements between the UI and the
+//      Federal Government which entitle the Government to certain rights.
+// 
+// *************************************************************************
+// 
+//  Developed by: The Pablo Research Group
+//                University of Illinois at Urbana-Champaign
+//                Department of Computer Science
+//                1304 W. Springfield Avenue
+//                Urbana, IL     61801
+// 
+//                http://www-pablo.cs.uiuc.edu
+// 
+//  Send comments to: pablo-feedback at guitar.cs.uiuc.edu
+// 
+//  Copyright (c) 1987-1998
+//  The University of Illinois Board of Trustees.
+//       All Rights Reserved.
+// 
+//  PABLO is a registered trademark of
+//  The Board of Trustees of the University of Illinois
+//  registered in the U.S. Patent and Trademark Office.
+// 
+//  Project Manager and Principal Investigator:
+//       Daniel A. Reed (reed at cs.uiuc.edu)
+// 
+// Funded in part by the Defense Advanced Research Projects Agency under 
+// DARPA contracts DABT63-94-C0049 (SIO Initiative), F30602-96-C-0161,
+// and DABT63-96-C-0027 by the National Science Foundation under the PACI 
+// program and grants NSF CDA 94-01124 and ASC 97-20202, and by the 
+// Department of Energy under contracts DOE B-341494, W-7405-ENG-48, and 
+// 1-B-333164.
+//-------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------
+ * File:  ProcIDs.h
+ * Purpose: define IDs for identifying procedures in traces
+ *-------------------------------------------------------------------------*/
+
+#ifndef PROCIDS_H		/* avoid re-inclusion */
+#define PROCIDS_H
+
+extern int *procTrace;
+/*
+ * Define the event IDs that will be used for the various HDF events
+ */
+#include "ProcTrace.h"
+
+#define	ID_HDFprocName		9996
+#define	ID_malloc		9997
+#define	ID_free			9998
+#define	ID_timeStamp		9999
+#define	DUMMY_HDF		10000
+
+#define BEGIN_HDF (DUMMY_HDF + 1)
+#define END_HDF (ID_HDF_Last_Entry + DUMMY_HDF)
+#define NumHDFProcs ( ID_HDF_Last_Entry )
+
+enum MPIeventIDs {
+	BEGIN_MPIO = END_HDF+1,
+	HDFmpiOpenID = BEGIN_MPIO,
+	HDFmpiCloseID,
+	HDFmpiDeleteID,
+	HDFmpiSetSizeID,
+	HDFmpiPreallocateID,
+	HDFmpiGetSizeID,
+	HDFmpiGetGroupID,
+	HDFmpiGetAmodeID,
+	HDFmpiGetViewID,
+	HDFmpiSetViewID,
+	HDFmpiReadAtID,
+	HDFmpiReadAtAllID,
+	HDFmpiWriteAtID,
+	HDFmpiWriteAtAllID,
+	HDFmpiReadID,
+	HDFmpiReadAllID,
+	HDFmpiWriteID,
+	HDFmpiWriteAllID,
+	HDFmpiSeekID,
+	HDFmpiGetPositionID,
+	HDFmpiGetByteOffsetID,
+	HDFmpiGetTypeExtentID,
+	HDFmpiSetAtomicityID,
+	HDFmpiGetAtomicityID,
+	HDFmpiIreadID,
+	HDFmpiIwriteID,
+	HDFmpiIreadAtID,
+	HDFmpiIwriteAtID,
+	HDFmpiSyncID,
+	END_MPIO 
+};
+
+/*======================================================================*/
+/* Macros to tell if the ID is that of an HDF Entry or Exit             */
+/*======================================================================*/
+#define isBeginHDFEvent( ID ) ( BEGIN_HDF <= (ID) && (ID) <= END_HDF )
+#define isEndHDFEvent( ID )   isBeginHDFEvent(-(ID))
+#define isBeginMPIOEvent( ID ) \
+            ( BEGIN_MPIO <= (ID) && (ID) <= END_MPIO  )
+#define isEndMPIOEvent( ID ) isBeginMPIOEvent(-(ID))
+#define isBeginIOEvent( ID )  \
+        ( IOerrorID < (ID) && (ID) <= fsetposEndID && (ID)%2 == 1 )
+#define isEndIOEvent( ID ) \
+        ( IOerrorID < (ID) && (ID) <= fsetposEndID && (ID)%2 == 0 )
+#define ProcIndex( ID ) ( (ID) - BEGIN_HDF )
+#define ProcIndexForHDFEntry( ID ) ( (ID) - BEGIN_HDF )
+#define ProcIndexForHDFExit( ID )  ProcIndexForHDFEntry(-ID)
+#define HDFIXtoEventID( ID ) ( (ID) + BEGIN_HDF )
+
+#define TRACE_ON(mask, ID) \
+if ( procTrace[mask] || procTrace[ID] ) startHDFtraceEvent( HDFIXtoEventID( ID ) )
+#define TRACE_OFF(mask, ID ) \
+if ( procTrace[mask] || procTrace[ID] ) endHDFtraceEvent(-HDFIXtoEventID(ID), 0, NULL, 0 )
+ 
+#endif /* PROCIDS_H */

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/ProcTrace.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/ProcTrace.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/ProcTrace.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,103 @@
+/*  This file is part of the Pablo Performance Analysis Environment
+// 
+//           (R)
+//  The Pablo    Performance Analysis Environment software is NOT in
+//  the public domain.  However, it is freely available without fee for
+//  education, research, and non-profit purposes.  By obtaining copies
+//  of this and other files that comprise the Pablo Performance Analysis
+//  Environment, you, the Licensee, agree to abide by the following
+//  conditions and understandings with respect to the copyrighted software:
+//  
+//  1.  The software is copyrighted in the name of the Board of Trustees
+//      of the University of Illinois (UI), and ownership of the software
+//      remains with the UI. 
+// 
+//  2.  Permission to use, copy, and modify this software and its documentation
+//      for education, research, and non-profit purposes is hereby granted
+//      to Licensee, provided that the copyright notice, the original author's
+//      names and unit identification, and this permission notice appear on
+//      all such copies, and that no charge be made for such copies.  Any
+//      entity desiring permission to incorporate this software into commercial
+//      products should contact:
+// 
+//           Professor Daniel A. Reed                 reed at cs.uiuc.edu
+//           University of Illinois
+//           Department of Computer Science
+//           2413 Digital Computer Laboratory
+//           1304 West Springfield Avenue
+//           Urbana, Illinois  61801
+//           USA
+// 
+//  3.  Licensee may not use the name, logo, or any other symbol of the UI
+//      nor the names of any of its employees nor any adaptation thereof in
+//      advertizing or publicity pertaining to the software without specific
+//      prior written approval of the UI.
+// 
+//  4.  THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE
+//      SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS
+//      OR IMPLIED WARRANTY.
+// 
+//  5.  The UI shall not be liable for any damages suffered by Licensee from
+//      the use of this software.
+// 
+//  6.  The software was developed under agreements between the UI and the
+//      Federal Government which entitle the Government to certain rights.
+// 
+// *************************************************************************
+// 
+//  Developed by: The Pablo Research Group
+//                University of Illinois at Urbana-Champaign
+//                Department of Computer Science
+//                1304 W. Springfield Avenue
+//                Urbana, IL     61801
+// 
+//                http://www-pablo.cs.uiuc.edu
+// 
+//  Send comments to: pablo-feedback at guitar.cs.uiuc.edu
+// 
+//  Copyright (c) 1987-1998
+//  The University of Illinois Board of Trustees.
+//       All Rights Reserved.
+// 
+//  PABLO is a registered trademark of
+//  The Board of Trustees of the University of Illinois
+//  registered in the U.S. Patent and Trademark Office.
+// 
+//  Project Manager and Principal Investigator:
+//       Daniel A. Reed (reed at cs.uiuc.edu)
+// 
+// Funded in part by the Defense Advanced Research Projects Agency under 
+// DARPA contracts DABT63-94-C0049 (SIO Initiative), F30602-96-C-0161,
+// and DABT63-96-C-0027 by the National Science Foundation under the PACI 
+// program and grants NSF CDA 94-01124 and ASC 97-20202, and by the 
+// Department of Energy under contracts DOE B-341494, W-7405-ENG-48, and 
+// 1-B-333164.
+//-------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------
+ * File:  ProcTrace.h
+ * Purpose: define entities for tracing HDF procedures
+ *-------------------------------------------------------------------------*/
+
+#ifndef PROCTRACE_H		/* avoid re-inclusion */
+#define PROCTRACE_H
+#include <stdarg.h>
+/*======================================================================*/
+/* Assign HDF identifier routine tags					*/
+/*======================================================================*/
+#ifdef RUNTIME_TRACE
+#undef RUNTIME_TRACE
+#endif
+enum HDF_IDS {
+RUNTIME_TRACE,
+SUMMARY_TRACE,
+MPI_RUNTIME_TRACE,
+MPI_SUMMARY_TRACE,
+NO_TRACE,
+#include "HDFidList.h"
+NUM_HDF_IDS
+} ;
+
+#define ID_HDF_Last_Entry ID_ALLHDF
+void HDFinitTrace( const char *, int trace_id, ... ); 
+void HDFendTrace( void ); 
+#endif /* PROCTRACE_H */

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/README.Pablo
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/README.Pablo	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/README.Pablo	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,100 @@
+		     HDF Performance Data Capture
+			     README.Pablo
+			   September 16, 1998
+
+
+This file briefly summarizes how to use the instrumented version of
+HDF and the Pablo performance data capture libraries to gather data
+about I/O behavior and procedure execution times.  More detailed
+documentation is provided in a PostScript Pablo.ps. The same information
+is also provided in Microsoft Word format in Pablo.doc and in PDF format in
+Pablo.pdf.
+				 ---
+
+The Pablo software, including the performance data capture libraries
+and analysis tools, are available via anonymous FTP on
+
+	www-pablo.cs.uiuc.edu (128.174.237.148)
+
+Version 5.1 or higher of the Pablo TraceLibrary is required.
+				 ---
+
+When linking your application, the instrumented HDF library must come
+first, followed by PabloTraceExt, and finally PabloTrace.  For
+example:
+
+	-ldf-inst -lPabloTraceExt -lPabloTrace
+
+				 ---
+
+To gather performance data, your application must call HDFinitIOTrace
+to initialize tracing, and HDFendIOTrace to terminate tracing.
+
+C:	
+	void HDFinitTrace(char *traceFName, unsigned procMask, int traceType );
+
+
+	traceFName	IN:	name of the generated trace output file
+	procMask	IN:	families of HDF procedures to trace
+	traceType	IN:	an integer indicating the type of tracing
+ 				to be performed:
+			        traceType = 0, no trace file is produced
+				          = 1, perform Runtime Tracing
+					  = 2, perform Summary Tracing
+	(see the document Pablo.ps, Pablo.doc or Pablo.pdf for further 
+         information)
+
+	Purpose		Initializes tracing.
+
+	Return value	None.
+
+	Description	This routine causes HDF to generate trace
+			events for I/O operations and procedure calls.
+
+		        Runtime Tracing produces an SDDF file containing
+  		 	a packet of information produced for each entry and
+ 			each exit from HDF traced routines.
+
+	  		Summary Tracing produces an SDDF file containing one
+			packet of information for each traced routine 
+			summarizing all calls to that procedure.
+	
+			See Pablo.ps, Pablo.pdf, or Pablo.doc for further 
+			explanation.
+
+	Example		#include "ProcMasks.h"
+
+			HDFinitTrace("trace.bin", DFP_mask + DFR8_mask, 1 )
+
+	void HDFendTrace( void );
+
+	Purpose		Terminates tracing.
+
+	Return value	None.
+
+	Description	This routine causes Pablo to cleanup files and end
+                        tracing
+			
+FORTRAN:
+	subroutine HDFinitTrace(tracefn, procMask, traceType )
+
+	character*(*) tracefn	
+	integer procMask
+	integer traceType
+
+	see description under C above
+
+	Example 	include 'ProcMasks.inc'
+			
+			call HDFinitTrace( 'tracefn', dfp_mask + dfr8_mask, 22)
+
+	subroutine HDFendTrace( )
+
+	see description under C above
+
+				 ---
+
+The performance data can be manipulated by a variety of analysis tools
+in the Pablo software.  The Pablo HDFanalysis component contains tools  
+specifically for this analysis.
+

Added: packages/libhdf4/branches/upstream/current/hdf/pablo/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/pablo/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/pablo/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,386 @@
+hfile.c: $(HDFSRC)/hfile.c
+hfile.o: ./ProcIDs.h
+hfile.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hfile.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h 
+hfile.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hfile.o: $(HDFSRC)/hfile.h $(FRC)
+hfilef.c: $(HDFSRC)/hfilef.c $(HDFSRC)/hfile.c
+hfilef.o: ./ProcIDs.h
+hfilef.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hfilef.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h 
+hfilef.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hfilef.o: $(HDFSRC)/hfile.h $(FRC)
+hfileff.f: $(HDFSRC)/hfileff.f 
+herr.c: $(HDFSRC)/herr.c
+herr.o: ./ProcIDs.h
+herr.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+herr.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+herr.o: $(FRC)
+herrf.c: $(HDFSRC)/herrf.c
+herrf.o: ./ProcIDs.h
+herrf.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+herrf.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+herrf.o: $(FRC)
+hblocks.c: $(HDFSRC)/hblocks.c
+hblocks.o: ./ProcIDs.h
+hblocks.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hblocks.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hblocks.o: $(HDFSRC)/hfile.h $(FRC)
+hbuffer.c: $(HDFSRC)/hbuffer.c
+hbuffer.o: ./ProcIDs.h
+hbuffer.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hbuffer.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hbuffer.o: $(HDFSRC)/hfile.h $(FRC)
+hcompri.c: $(HDFSRC)/hcompri.c
+hcompri.o: ./ProcIDs.h
+hcompri.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hcompri.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hcompri.o: $(HDFSRC)/hfile.h $(FRC)
+hextelt.c: $(HDFSRC)/hextelt.c
+hextelt.o: ./ProcIDs.h
+hextelt.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hextelt.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hextelt.o: $(HDFSRC)/hfile.h $(FRC)
+cmextelt.c: $(HDFSRC)/cmextelt.c
+cmextelt.o: ./ProcIDs.h
+cmextelt.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+cmextelt.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+cmextelt.o: $(HDFSRC)/hfile.h $(FRC)
+hkit.c: $(HDFSRC)/hkit.c
+hkit.o: ./ProcIDs.h
+hkit.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hkit.o: $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hkit.o: $(HDFSRC)/hfile.h $(HDFSRC)/hkit.h
+hkit.o: $(HDFSRC)/hbitio.h $(FRC)
+dfan.c: $(HDFSRC)/dfan.c 
+dfan.o: ./ProcIDs.h
+dfan.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfan.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfan.o: $(HDFSRC)/hfile.h $(HDFSRC)/dfan.h $(FRC)
+dfanf.c: $(HDFSRC)/dfanf.c 
+dfanf.o: ./ProcIDs.h
+dfanf.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfanf.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfanf.o: $(HDFSRC)/hfile.h $(HDFSRC)/dfan.h $(FRC)
+dfanff.f: $(HDFSRC)/dfanff.f 
+dfr8.c: $(HDFSRC)/dfr8.c 
+dfr8.o: ./ProcIDs.h
+dfr8.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h  
+dfr8.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfr8.o: $(HDFSRC)/dfrig.h $(FRC)
+dfr8f.c: $(HDFSRC)/dfr8f.c 
+dfr8f.o: ./ProcIDs.h
+dfr8f.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h  
+dfr8f.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfr8f.o: $(HDFSRC)/dfrig.h $(FRC)
+dfr8ff.f: $(HDFSRC)/dfr8ff.f 
+dfcomp.c: $(HDFSRC)/dfcomp.c 
+dfcomp.o: ./ProcIDs.h
+dfcomp.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h  
+dfcomp.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfcomp.o: $(FRC)
+dfrle.c: $(HDFSRC)/dfrle.c 
+dfrle.o: ./ProcIDs.h
+dfrle.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfrel.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfrle.o: $(FRC)
+dfimcomp.c: $(HDFSRC)/dfimcomp.c 
+dfimcomp.o: ./ProcIDs.h
+dfimcomp.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h 
+dfimcomp.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h
+dfimcomp.o: $(HDFSRC)/hproto.h $(HDFSRC)/hdfi.h $(FRC)
+dfjpeg.c: $(HDFSRC)/dfjpeg.c 
+dfjpeg.o: ./ProcIDs.h
+dfjpeg.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfjpeg.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfjpeg.o:  $(FRC)
+dfunjpeg.c: $(HDFSRC)/dfunjpeg.c 
+dfunjpeg.o: ./ProcIDs.h
+dfunjpeg.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfunjpeg.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h
+dfunjpeg.o: $(HDFSRC)/hproto.h  $(FRC)
+dfp.c: $(HDFSRC)/dfp.c 
+dfp.o: ./ProcIDs.h
+dfp.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfp.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfp.o: $(HDFSRC)/hfile.h $(FRC)
+dfpf.c: $(HDFSRC)/dfpf.c 
+dfpf.o: ./ProcIDs.h
+dfpf.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfpf.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfpf.o: $(HDFSRC)/hfile.h $(FRC)
+dfpff.f: $(HDFSRC)/dfpff.f 
+dfgr.c: $(HDFSRC)/dfgr.c 
+dfgr.o: ./ProcIDs.h
+dfgr.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfgr.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfgr.o: $(HDFSRC)/dfgr.h $(FRC)
+df24.c: $(HDFSRC)/df24.c 
+df24.o: ./ProcIDs.h
+df24.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+df24.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+df24.o: $(HDFSRC)/dfgr.h $(FRC)
+df24f.c: $(HDFSRC)/df24f.c 
+df24f.o: ./ProcIDs.h
+df24f.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+df24f.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+df24f.o: $(HDFSRC)/dfgr.h $(FRC)
+df24ff.f: $(HDFSRC)/df24ff.f 
+dfsd.c: $(HDFSRC)/dfsd.c 
+dfsd.o: ./ProcIDs.h
+dfsd.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfsd.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfsd.o: $(HDFSRC)/dfsd.h $(HDFSRC)/hfile.h $(FRC)
+dfsdf.c: $(HDFSRC)/dfsdf.c 
+dfsdf.o: ./ProcIDs.h
+dfsdf.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfsdf.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfsdf.o: $(HDFSRC)/dfsd.h $(HDFSRC)/hfile.h $(FRC)
+dfsdff.f: $(HDFSRC)/dfsdff.f 
+dfgroup.c: $(HDFSRC)/dfgroup.c
+dfgroup.o: ./ProcIDs.h
+dfgroup.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfgroup.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfgroup.o: $(HDFSRC)/hfile.h $(FRC)
+dfconv.c: $(HDFSRC)/dfconv.c
+dfconv.o: ./ProcIDs.h
+dfconv.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfconv.o: $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+dfconv.o: $(HDFSRC)/hconv.h $(HDFSRC)/hbitio.h $(FRC)
+dfufp2i.c: $(HDFSRC)/dfufp2i.c 
+dfufp2i.o: ./ProcIDs.h
+dfufp2i.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfufp2i.o: $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+dfufp2i.o: $(HDFSRC)/dfufp2i.h $(HDFSRC)/dfsd.h 
+dfufp2i.o: $(HDFSRC)/hbitio.h $(FRC)
+dfufp2if.f: $(HDFSRC)/dfufp2if.f 
+vg.c: $(HDFSRC)/vg.c 
+vg.o: ./ProcIDs.h
+vg.o: $(HDFSRC)/vg.h $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h 
+vg.o: $(HDFSRC)/hdfi.h  $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h 
+vg.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+vg.o: $(HDFSRC)/tbbt.h $(FRC)
+vgf.c: $(HDFSRC)/vgf.c 
+vgf.o: ./ProcIDs.h
+vgf.o: $(HDFSRC)/vg.h $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h 
+vgf.o: $(HDFSRC)/hdfi.h  $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h 
+vgf.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+vgf.o: $(HDFSRC)/tbbt.h $(FRC)
+vgff.f: $(HDFSRC)/vgff.f 
+vrw.c: $(HDFSRC)/vrw.c 
+vrw.o: ./ProcIDs.h
+vrw.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+vrw.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+vrw.o: $(HDFSRC)/vg.h $(HDFSRC)/tbbt.h $(HDFSRC)/hfile.h $(FRC)
+vio.c: $(HDFSRC)/vio.c 
+vio.o: ./ProcIDs.h
+vio.o: $(HDFSRC)/vg.h $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h 
+vio.o: $(HDFSRC)/hdfi.h  $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h
+vio.o: $(HDFSRC)/hproto.h $(HDFSRC)/tbbt.h $(HDFSRC)/hfile.h $(FRC)
+vparse.c: $(HDFSRC)/vparse.c 
+vparse.o: ./ProcIDs.h
+vparse.o: $(HDFSRC)/vg.h $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h 
+vparse.o: $(HDFSRC)/hdfi.h $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h
+vparse.o: $(HDFSRC)/hproto.h $(HDFSRC)/tbbt.h $(FRC)
+vconv.c: $(HDFSRC)/vconv.c 
+vconv.o: ./ProcIDs.h
+vconv.o: $(HDFSRC)/vg.h $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h 
+vconv.o: $(HDFSRC)/hdfi.h $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h
+vconv.o: $(HDFSRC)/hproto.h $(HDFSRC)/tbbt.h $(FRC)
+vsfld.c: $(HDFSRC)/vsfld.c 
+vsfld.o: ./ProcIDs.h
+vsfld.o: $(HDFSRC)/vg.h $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h 
+vsfld.o: $(HDFSRC)/hdfi.h $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h
+vsfld.o: $(HDFSRC)/hproto.h $(HDFSRC)/tbbt.h $(FRC)
+vgp.c: $(HDFSRC)/vgp.c 
+vgp.o: ./ProcIDs.h
+vgp.o: $(HDFSRC)/vg.h $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h 
+vgp.o: $(HDFSRC)/hdfi.h $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h
+vgp.o: $(HDFSRC)/hproto.h $(HDFSRC)/tbbt.h $(HDFSRC)/hfile.h $(FRC)
+vhi.c: $(HDFSRC)/vhi.c 
+vhi.o: ./ProcIDs.h
+vhi.o: $(HDFSRC)/vg.h $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h 
+vhi.o: $(HDFSRC)/hdfi.h $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h
+vhi.o: $(HDFSRC)/hproto.h $(HDFSRC)/tbbt.h $(FRC)
+dfutil.c: $(HDFSRC)/dfutil.c 
+dfutil.o: ./ProcIDs.h
+dfutil.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfutil.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfutil.o: $(FRC)
+dfutilf.c: $(HDFSRC)/dfutilf.c 
+dfutilf.o: ./ProcIDs.h
+dfutilf.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfutilf.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfutilf.o: $(FRC)
+dfstubs.c: $(HDFSRC)/dfstubs.c 
+dfstubs.o: ./ProcIDs.h
+dfstubs.o: $(HDFSRC)/dfstubs.h $(HDFSRC)/df.h $(HDFSRC)/hdf.h 
+dfstubs.o: $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h
+dfstubs.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h $(FRC)
+dfknat.c: $(HDFSRC)/dfknat.c 
+dfknat.o: ./ProcIDs.h
+dfknat.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfknat.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfknat.o: $(HDFSRC)/hconv.h $(FRC)
+dfkswap.c: $(HDFSRC)/dfkswap.c 
+dfkswap.o: ./ProcIDs.h
+dfkswap.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfkswap.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfkswap.o: $(HDFSRC)/hconv.h $(FRC)
+dfkcray.c: $(HDFSRC)/dfkcray.c 
+dfkcray.o: ./ProcIDs.h
+dfkcray.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfkcray.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfkcray.o: $(HDFSRC)/hconv.h $(FRC)
+dfkvms.c: $(HDFSRC)/dfkvms.c 
+dfkvms.o: ./ProcIDs.h
+dfkvms.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfkvms.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfkvms.o: $(HDFSRC)/hconv.h $(FRC)
+dfkconv.c: $(HDFSRC)/dfkconv.c 
+dfkconv.o: ./ProcIDs.h
+dfkconv.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfkconv.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfkconv.o: $(HDFSRC)/hconv.h $(FRC)
+dfkfuji.c: $(HDFSRC)/dfkfuji.c 
+dfkfuji.o: ./ProcIDs.h
+dfkfuji.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dfkfuji.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+dfkfuji.o: $(HDFSRC)/hconv.h $(FRC)
+hbitio.c: $(HDFSRC)/hbitio.c 
+hbitio.o: ./ProcIDs.h
+hbitio.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hbitio.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hbitio.o: $(HDFSRC)/hfile.h $(FRC)
+tbbt.c: $(HDFSRC)/tbbt.c 
+tbbt.o: ./ProcIDs.h
+tbbt.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+tbbt.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+tbbt.o: $(HDFSRC)/tbbt.h $(FRC)
+hdfalloc.c: $(HDFSRC)/hdfalloc.c 
+hdfalloc.o: ./ProcIDs.h
+hdfalloc.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h  
+hdfalloc.o: $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+hdfalloc.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hfile.h $(FRC)
+hcomp.c: $(HDFSRC)/hcomp.c 
+hcomp.o: ./ProcIDs.h
+hcomp.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hcomp.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hcomp.o: $(HDFSRC)/hfile.h $(HDFSRC)/hcompi.h 
+hcomp.o: $(HDFSRC)/mstdio.h $(HDFSRC)/cnone.h $(HDFSRC)/crle.h 
+hcomp.o: $(HDFSRC)/cnbit.h $(HDFSRC)/cskphuff.h $(FRC)
+crle.c: $(HDFSRC)/crle.c 
+crle.o: ./ProcIDs.h
+crle.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+crle.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+crle.o: $(HDFSRC)/hfile.h $(HDFSRC)/hcompi.h 
+crle.o: $(HDFSRC)/mstdio.h $(HDFSRC)/crle.h  $(FRC)
+cnbit.c: $(HDFSRC)/cnbit.c 
+cnbit.o: ./ProcIDs.h
+cnbit.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+cnbit.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+cnbit.o: $(HDFSRC)/hfile.h $(HDFSRC)/hcompi.h 
+cnbit.o: $(HDFSRC)/mstdio.h $(HDFSRC)/cnbit.h $(FRC)
+mstdio.c: $(HDFSRC)/mstdio.c 
+mstdio.o: ./ProcIDs.h
+mstdio.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+mstdio.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+mstdio.o: $(HDFSRC)/hfile.h $(HDFSRC)/hcompi.h 
+mstdio.o: $(HDFSRC)/mstdio.h $(FRC)
+cnone.c: $(HDFSRC)/cnone.c 
+cnone.o: ./ProcIDs.h
+cnone.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+cnone.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+cnone.o: $(HDFSRC)/hfile.h $(HDFSRC)/hcompi.h 
+cnone.o: $(HDFSRC)/mstdio.h $(HDFSRC)/cnone.h $(FRC)
+cskphuff.c: $(HDFSRC)/cskphuff.c 
+cskphuff.o: ./ProcIDs.h
+cskphuff.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+cskphuff.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+cskphuff.o: $(HDFSRC)/hfile.h $(HDFSRC)/hcompi.h 
+cskphuff.o: $(HDFSRC)/mstdio.h $(HDFSRC)/cskphuff.h $(FRC)
+hvblocks.c: $(HDFSRC)/hvblocks.c 
+hvblocks.o: ./ProcIDs.h
+hvblocks.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hvblocks.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+hvblocks.o: $(HDFSRC)/hfile.h $(FRC)
+mfan.c: $(HDFSRC)/mfan.c 
+mfan.o: ./ProcIDs.h
+mfan.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+mfan.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+mfan.o: $(HDFSRC)/hfile.h $(HDFSRC)/mfan.h $(FRC)
+mfanf.c: $(HDFSRC)/mfanf.c 
+mfanf.o: ./ProcIDs.h
+mfanf.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+mfanf.o: $(HDFSRC)/hbitio.h $(HDFSRC)/hcomp.h $(HDFSRC)/herr.h $(HDFSRC)/hproto.h
+mfanf.o: $(HDFSRC)/hfile.h $(HDFSRC)/mfan.h $(FRC)
+mfgr.c: $(HDFSRC)/mfgr.c 
+mfgr.o: ./ProcIDs.h
+mfgr.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+mfgr.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+mfgr.o: $(HDFSRC)/hfile.h $(HDFSRC)/mfgr.h $(FRC)
+mfgrf.c: $(HDFSRC)/mfgrf.c 
+mfgrf.o: ./ProcIDs.h
+mfgrf.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+mfgrf.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+mfgrf.o: $(HDFSRC)/hfile.h $(HDFSRC)/mfgr.h $(FRC)
+mfgrff.f: $(HDFSRC)/mfgrff.f 
+cgzip.c: $(HDFSRC)/cgzip.c 
+cgzip.o: ./ProcIDs.h
+cgzip.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+cgzip.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+cgzip.o: $(HDFSRC)/hfile.h $(HDFSRC)/hcompi.h $(FRC)
+dff.c: $(HDFSRC)/dff.c
+dff.o: ./ProcIDs.h
+dfff.f: $(HDFSRC)/dfff.f
+cdeflate.c: $(HDFSRC)/cdeflate.c $(HDFSRC)/cdeflate.h
+cdeflate.o: ./ProcIDs.h
+cdeflate.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+cdeflate.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+cdeflate.o: $(HDFSRC)/hfile.h $(HDFSRC)/hcompi.h $(FRC)
+bitvect.c: $(HDFSRC)/bitvect.c $(HDFSRC)/bitvect.h
+bitvect.o: ./ProcIDs.h
+bitvect.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+bitvect.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+bitvect.o: $(HDFSRC)/hfile.h $(FRC)
+atom.c: $(HDFSRC)/atom.c $(HDFSRC)/atom.h
+atom.o: ./ProcIDs.h
+atom.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+atom.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+atom.o: $(HDFSRC)/hfile.h $(FRC)
+dynarray.c: $(HDFSRC)/dynarray.c $(HDFSRC)/dynarray.h
+dynarray.o: ./ProcIDs.h
+dynarray.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+dynarray.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+dynarray.o: $(HDFSRC)/hfile.h $(FRC)
+hfiledd.c: $(HDFSRC)/hfiledd.c
+hfiledd.o: ./ProcIDs.h
+hfiledd.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hfiledd.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+hfiledd.o: $(HDFSRC)/hfile.h $(FRC)
+linklist.c: $(HDFSRC)/linklist.c $(HDFSRC)/linklist.h
+linklist.o: ./ProcIDs.h
+linklist.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+linklist.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+linklist.o: $(HDFSRC)/hfile.h $(FRC)
+glist.c: $(HDFSRC)/glist.c $(HDFSRC)/glist.h
+glist.o: ./ProcIDs.h
+glist.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+glist.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+mcache.c: $(HDFSRC)/mcache.c $(HDFSRC)/mcache.h
+mcache.o: ./ProcIDs.h
+mcache.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+mcache.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+hchunks.c: $(HDFSRC)/hchunks.c $(HDFSRC)/hchunks.h
+hchunks.o: ./ProcIDs.h
+hchunks.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+hchunks.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+vattr.c: $(HDFSRC)/vattr.c $(HDFSRC)/vattr.h
+vattr.o: ./ProcIDs.h
+vattr.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+vattr.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+vattrf.c: $(HDFSRC)/vattrf.c $(HDFSRC)/vattr.h
+vattrf.o: ./ProcIDs.h
+vattrf.o: $(HDFSRC)/hdf.h $(HDFSRC)/hlimits.h $(HDFSRC)/hdfi.h 
+vattrf.o: $(HDFSRC)/herr.h $(HDFSRC)/hproto.h 
+vattrff.f: $(HDFSRC)/vattrff.f

Added: packages/libhdf4/branches/upstream/current/hdf/src/.indent.pro
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/.indent.pro	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/.indent.pro	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/hdf/src/MAKEFS.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/MAKEFS.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/MAKEFS.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,37 @@
+$! ****************************************************************************
+$! * 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: MAKEFS.COM,v 1.5 1996/01/18 05:02:09 sxu Exp $
+$! Add the Fortran stubs to the HDF library
+$! 
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC"
+$ else
+$ ccopt = ""
+$ endif
+$ ccc := cc 'ccopt /opt/nodebug/include=([-.jpeg],[-.zlib])/define=VMS
+$ type sys$input
+	Compiling Fortran stubs
+$ ffiles="df24ff.f, dfff.f, dfpff.f, dfr8ff.f, dfanff.f, dfsdff.f, "+-
+"hfileff.f, vgff.f, dfufp2if.f, mfgrff.f, vattrff"
+$ fobj="dfff, dfsdff, dfr8ff, df24ff, dfanff, dfpff, vgff, hfileff, "+-
+       "dfufp2if, mfgrff, vattrff "
+$ cobj="dff,  dfsdf,  dfr8f,  df24f,  dfanf,  dfpf,  vgf,  hfilef, "+-
+       "dfutilf, herrf, mfgrf, mfanf, vattrf"
+$ fortran/opt/nodebug 'ffiles
+$ ccc 'cobj
+$ library/replace []df 'cobj
+$ library/replace []df 'fobj
+$ type sys$input
+	Added Fortran stubs to HDF library
+$!

Added: packages/libhdf4/branches/upstream/current/hdf/src/MAKENOF.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/MAKENOF.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/MAKENOF.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,40 @@
+$! ****************************************************************************
+$! * 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: MAKENOF.COM,v 1.10 1999/04/27 19:52:13 epourmal Exp $
+$! Makefile for VAX/VMX systems.
+$!
+$! Make a no-fortran-stub HDF library
+$!
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC"
+$ else
+$ ccopt = ""
+$ endif
+$ ccc := cc 'ccopt /opt/nodebug/include=([-.jpeg],[-.zlib])/define=VMS
+$ type sys$input
+	Creating base HDF library
+$!
+$ cobj="df24,dfan,dfcomp, dfgr, dfgroup, dfimcomp, dfp, dfr8, dfsd, "+-
+"dfstubs, dfutil,hblocks, herr, hextelt, hfile, hkit, vg, vgp, vhi, "+-
+"vio, vparse, vrw, vsfld, dfconv, vconv, dfrle, dfjpeg, dfunjpeg, "+-
+"dfufp2i,dfknat,dfkswap,dfkcray, dfkvms, dfkconv, dfkfuji,hbitio, "+-
+"tbbt,hdfalloc,mfgr,cdeflate,cnbit,cnone,crle,cskphuff,hcomp,mfan," +-
+"mstdio,atom, bitvect, dynarray, hfiledd, glist,hchunks,mcache, " +- 
+"vattr, hbuffer, hcompri"
+$!
+$ ccc 'cobj 
+$ library/create []df  'cobj
+$ type sys$input
+	Created base HDF library
+$!

Added: packages/libhdf4/branches/upstream/current/hdf/src/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,501 @@
+# ****************************************************************************
+# * 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: Makefile.in,v 1.28 2000/08/29 11:04:27 acheng Exp $
+#
+# ##################################################################
+#
+#           MAKEFILE for creating the HDF library, libdf.a,
+#
+# This makefile creates the following FORTRAN and C interfaces 
+# for HDF in a library called "libdf.a": 
+#
+#              DFR8   (8-bit raster image sets)
+#              DF24   (24-bit raster image sets)
+#              DFP    (palettes)
+#              DFSD   (scientific data sets)
+#              DFAN   (annotations)
+#              V      (vsets)
+#
+# See the file INSTALL for further information on how to invoke
+# this makefile.
+#
+# This release of HDF marks the first use of a new set of lower
+# level routines.  The makefile also creates these interfaces,
+# which are available in C only.  These routines are categorized 
+# as follows:
+#
+#              H      (new lower level i/o)
+#              DF     (emulation of old lower level i/o routines)
+#              HD     (lower level utilities for developers)
+#              HE     (lower level error-handling)
+#              HD     (lower level utilities, for developers)
+#              DFK    (conversion routines)
+#
+# ##################################################################
+#
+#
+# PORTING INSTRUCTIONS
+# You must modify the lines marked "# ==>".
+#
+#
+# These values will typically be over ridden by values passed 
+#   down from the top level HDF makefile
+#
+#
+### Start of system configuration section. ####
+# Set shell so we know what it is
+SHELL = /bin/sh
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+#Compilier defaults overriden by top level make
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install scripts.
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install include files.
+includedir = $(prefix)/include
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+TARGETLIB = libdf.a
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+
+# ############# End of system configuration section. ###############
+HDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        MACHINE="$(MACHINE)" 
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ==> specify directories where to find inludes and library
+#     HDF library, and HDF utilities
+HDFINC= $(srcdir)/../src
+HDFLIB= $(srcdir)/../src
+HDFBIN= $(srcdir)/../bin
+
+# ==> specify where to find the JPEG include files and library
+JPEGINC=$(srcdir)/../jpeg
+JPEGLIB=$(srcdir)/../jpeg
+
+# ==> specify where to find the Pablo include and source files 
+PABLO_HINC=$(srcdir)/../pablo
+PABLO_SRC=$(srcdir)/../pablo
+
+# ==> specify where to find the FMPOOL include and source files 
+FMPOOL_INC=$(srcdir)/../fmpool
+FMPOOL_SRC=$(srcdir)/../fmpool
+
+# ==> specify where to find the gzip zlib include files and library
+ZLIBINC=$(srcdir)/../zlib
+ZLIBLIB=$(srcdir)/../zlib
+
+ALL_CFLAGS = -I. $(CFLAGS) $(FMPOOL_FLAGS) -I$(JPEGINC) -I$(ZLIBINC)
+LINTFLAGS=
+SHAR=shar
+ARCHIVE=hdf.shar
+
+MANIFEST = $(DISTFILES)
+DISTFILES = Makefile.in src.inc $(HDRS) $(CSRCS) $(FSRCS) $(FINCS) \
+	win32hdf.mak hdfnof.bld hdfnofw3.lbc hdfnofwc.lbc \
+	hdfw386.lbc hdfwcc.lbc makepc.msc makepc.386 makepc.wcc makewin.msc
+
+#
+#include the source file definitions
+#
+include src.inc
+
+HINCS = $(HDRS) $(FINCS)
+
+#.SUFFIXES:
+.SUFFIXES: .c.o .f.o .installed .finstalled
+
+# This rule causes ansi2knr to be invoked.
+#@ISANSICOM at .c.o:
+#@ISANSICOM@	./ansi2knr $(srcdir)/$*.c T$*.c
+#@ISANSICOM@	$(CC) $(CFLAGS) -c T$*.c
+#@ISANSICOM@	$(RM) $(RMFLAGS) T$*.c $*.o
+#@ISANSICOM@	$(MV) T$*.o $*.o
+
+#ansi2knr: ansi2knr.c
+#	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+.c.o:
+	$(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $<
+
+.f.o:
+	$(FC) $(FFLAGS) -c $<
+
+# Rules to make Free format Fortran90 include files from F77 include files
+# 1) change all col. 1 [Cc] to '!'
+# 2) change all col. 6 continuation character to '&'
+#
+.SUFFIXES:	.inc .f90
+
+.inc.f90:
+	sed -e 's/^[cC]/!/' -e 's/^     [^ ]/     \&/' < $< > $*.f90
+
+.PHONY : all nofortran libnostub clean distclean debug saber lint
+
+
+all::		FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) libnofortran ;; \
+	*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) rall ; \
+	esac
+
+rall::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) libdf.a; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" libdf.a; \
+	fi
+
+libnofortran::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) nofort-libdf.a; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" nofort-libdf.a; \
+	fi
+
+
+libdf.a: $(COBJS) $(FOBJS)
+	-$(RM) $(RMFLAGS) libdf.a
+#	$(AR) $(ARFLAGS) libdf.a `lorder '$(COBJS) $(FOBJS)' | tsort `
+	$(AR) $(ARFLAGS) libdf.a $(COBJS) $(FOBJS)
+	$(RANLIB) libdf.a
+#	$(LD) -b -o libdf.sl $(COBJS) $(FOBJS)
+
+nofort-libdf.a: $(COBJS)
+	-$(RM) $(RMFLAGS) libdf.a
+#	$(AR) $(ARFLAGS) libdf.a `lorder $(COBJS) | tsort `
+	$(AR) $(ARFLAGS) libdf.a $(COBJS)
+	$(RANLIB) libdf.a
+
+nofort-libdf-inst.a:   $(COBJS) $(PCOBJS)
+	-$(RM) $(RMFLAGS) libdf-inst.a libdf.a
+	$(AR) $(ARFLAGS) libdf-inst.a  $(COBJS) $(PCOBJS)
+	$(RANLIB) libdf-inst.a
+	ln -s libdf-inst.a libdf.a
+
+
+#libnostub nofortran: libnofortran .finstalled
+libnostub nofortran: libnofortran 
+
+rebuild:
+	@$(MAKE) all $(HDF_FLAGS) FRC=force_rebuild
+
+rebuildnofortran:
+	@$(MAKE) nofortran $(MFLAGS) $(HDF_FLAGS) FRC=force_rebuild
+
+# Leave this target blank with no actions, the rebuild macros above depend on it
+force_rebuild:
+
+$(FOBJS): $(FRC)
+
+#debug: libdf.a .installed
+debug: libdf.a 
+
+saber:
+	#load -D$(MACHINE) $(CSRCS) $(TSRCS) -lc
+
+install: install-lib install-headers
+
+install-includes: install-headers
+
+install-lib: install-headers
+	$(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n
+	( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n )
+	mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
+
+install-headers: FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) install-headers-nofort;; \
+	*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) install-headers-all; \
+	esac
+
+install-headers-all: $(HDRS) $(FINCS)
+	for p in $(HDRS) $(FINCS); do \
+	    $(INSTALL_DATA) \
+		`pwd`/$$p $(includedir)/$$p; \
+	done
+
+install-headers-nofort: $(HDRS)
+	for p in $(HDRS); do \
+	    $(INSTALL_DATA) \
+		`pwd`/$$p $(includedir)/$$p; \
+	done
+
+.installed: libdf.a
+	-if (test \! -d $(HDFINC)) then (mkdir $(HDFINC) ) fi
+	-cp $(HDRS) $(FINCS) $(HDFINC)
+	-if (test \! -d $(HDFLIB)) then (mkdir $(HDFLIB) ) fi
+	-cp libdf.a $(HDFLIB)
+	-$(RANLIB) $(HDFLIB)/libdf.a
+	-touch .installed
+
+.finstalled: libnofortran
+	-if (test \! -d $(HDFINC)) then (mkdir $(HDFINC) ) fi
+	-cp $(HDRS) $(FINCS) $(HDFINC)
+	-if (test \! -d $(HDFLIB)) then (mkdir $(HDFLIB) ) fi
+	-cp libdf.a $(HDFLIB)
+	-$(RANLIB) $(HDFLIB)/libdf.a
+	-touch .finstalled
+
+depend:
+	makedepend -fMakefile -- $(CSRCS)
+
+clean:
+	-$(RM) $(RMFLAGS) *.o $(F90INCS)
+
+distclean:
+	-$(RM) $(RMFLAGS) *.o libdf.a config.status Makefile $(F90INCS)
+
+lint: $(SRCS) $(R8SRCS)
+	$(LINT) $(LINTFLAGS) $(SRCS)
+
+TAGS: $(SRCS) $(HDRS)
+	etags $(SRCS) $(HDRS)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = hdf/src
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# for auto remaking, see toplevel Makefile
+#Makefile: $(TOP_SRCDIR)/config.status Makefile.in
+#	CONFIG_FILES=$@ CONFIG_HEADERS= $(TOP_SRCDIR)/config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+help:
+	@echo ""
+	@echo "Make supports the following targets"
+	@echo "make help    - prints this usage section"
+	@echo "make all     - (DEFAULT) makes HDF library"
+	@echo "make libdf.a      - makes HDF library "
+	@echo "make libnofortran - makes HDF library excluding fortran support"
+	@echo "make rebuild      - rebuilds HDF library "
+	@echo "make rebuildnofortran - rebuilds HDF library excluding"
+	@echo "                        fortran support "
+	@echo "make install          - install HDF library, "
+	@echo "                        and includes " 
+	@echo "make install-includes - install HDF includes "
+	@echo "make clean     - cleans up HDF library(*.o,libdf.a,..)"
+	@echo "make distclean - cleans up HDF library including"
+	@echo "                 configuration(Makefiles,config.status,..)"
+	@echo ""
+
+#$(ARCHIVE): ChangeLog Makefile $(SRCS) $(HDRS) $(TSRCS) $(USRCS)
+#       $(RM) $(RMFLAGS) $(ARCHIVE)
+#       $(SHAR) $(ARCHIVE) ChangeLog Makefile $(SRCS) $(HDRS) \
+#               $(TSRCS) $(USRCS)
+
+#archive: $(ARCHIVE)
+
+#backup: ChangeLog Makefile $(SRCS) $(HDRS) $(TSRCS) $(USRCS)
+#       cp ChangeLog Makefile $(SRCS) $(HDRS) $(TSRCS) $(USRCS) $(BDIR)
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+hfile.o: hdf.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+hfile.o: hfile.h $(FRC)
+herr.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+herr.o: $(FRC)
+hblocks.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+hblocks.o: hfile.h $(FRC)
+hextelt.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+hextelt.o: hfile.h $(FRC)
+hkit.o: hdf.h hlimits.h hdfi.h hbitio.h
+hkit.o: hcomp.h herr.h hproto.h hfile.h hkit.h $(FRC)
+dfan.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfan.o: hfile.h dfan.h $(FRC)
+dfr8.o: hdf.h hlimits.h hdfi.h  hbitio.h hcomp.h herr.h hproto.h
+dfr8.o: dfrig.h $(FRC)
+dfcomp.o: hdf.h hlimits.h hdfi.h  hbitio.h hcomp.h herr.h hproto.h
+dfcomp.o: $(FRC)
+dfrle.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfrle.o: $(FRC)
+dfimcomp.o: hdf.h hlimits.h hdfi.h  hbitio.h hcomp.h herr.h
+dfimcomp.o: hproto.h $(FRC)
+dfjpeg.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfjpeg.o: $(FRC)
+dfunjpeg.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h
+dfunjpeg.o: hproto.h $(FRC)
+dfp.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfp.o: hfile.h $(FRC)
+dfgr.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfgr.o: dfgr.h $(FRC)
+df24.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+df24.o: dfgr.h $(FRC)
+dfsd.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfsd.o: dfsd.h hfile.h $(FRC)
+dfgroup.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfgroup.o: hfile.h $(FRC)
+dfconv.o: hdf.h hlimits.h hdfi.h hbitio.h
+dfconv.o: hcomp.h herr.h hproto.h hconv.h $(FRC)
+dfufp2i.o: hdf.h hlimits.h hdfi.h hbitio.h
+dfufp2i.o: hcomp.h herr.h hproto.h dfufp2i.h dfsd.h $(FRC)
+vg.o: vg.h hdf.h hlimits.h hdfi.h  hbitio.h hcomp.h herr.h hproto.h
+vg.o: tbbt.h $(FRC)
+vrw.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+vrw.o: vg.h tbbt.h hfile.h $(FRC)
+vio.o: vg.h hdf.h hlimits.h hdfi.h  hbitio.h hcomp.h herr.h
+vio.o: hproto.h tbbt.h hfile.h $(FRC)
+vparse.o: vg.h hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h
+vparse.o: hproto.h tbbt.h $(FRC)
+vconv.o: vg.h hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h
+vconv.o: hproto.h tbbt.h $(FRC)
+vsfld.o: vg.h hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h
+vsfld.o: hproto.h tbbt.h $(FRC)
+vgp.o: vg.h hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h
+vgp.o: hproto.h tbbt.h hfile.h $(FRC)
+vhi.o: vg.h hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h
+vhi.o: hproto.h tbbt.h $(FRC)
+dfutil.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfutil.o: $(FRC)
+dfstubs.o: dfstubs.h df.h hdf.h hlimits.h hdfi.h hbitio.h hcomp.h
+dfstubs.o: herr.h hproto.h $(FRC)
+dfknat.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfknat.o: hconv.h $(FRC)
+dfkswap.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfkswap.o: hconv.h $(FRC)
+dfkcray.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfkcray.o: hconv.h $(FRC)
+dfkvms.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfkvms.o: hconv.h $(FRC)
+dfkconv.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfkconv.o: hconv.h $(FRC)
+dfkfuji.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+dfkfuji.o: hconv.h $(FRC)
+hbitio.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+hbitio.o: hfile.h $(FRC)
+tbbt.o:  hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+tbbt.o: tbbt.h $(FRC)
+atom.o:  hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+atom.o: atom.h $(FRC)
+hdfalloc.o: hdf.h hlimits.h hdfi.h  hbitio.h
+hdfalloc.o: hcomp.h herr.h hproto.h hfile.h $(FRC)
+hcomp.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+hcomp.o: hfile.h hcompi.h mstdio.h cnone.h crle.h cnbit.h cskphuff.h cdeflate.h $(FRC)
+crle.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+crle.o: hfile.h hcompi.h mstdio.h crle.h  $(FRC)
+cnbit.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+cnbit.o: hfile.h hcompi.h mstdio.h cnbit.h $(FRC)
+mstdio.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+mstdio.o: hfile.h hcompi.h mstdio.h $(FRC)
+cnone.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+cnone.o: hfile.h hcompi.h mstdio.h cnone.h $(FRC)
+cskphuff.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+cskphuff.o: hfile.h hcompi.h mstdio.h cskphuff.h $(FRC)
+cdeflate.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+cdeflate.o: hfile.h hcompi.h mstdio.h cdeflate.h $(FRC)
+hblocks.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+hblocks.o: hfile.h $(FRC)
+mfan.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+mfan.o: hfile.h mfan.h $(FRC)
+mfanf.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+mfanf.o: hfile.h mfan.h $(FRC)
+mfgr.o: hdf.h hlimits.h hdfi.h herr.h hproto.h hfile.h mfgr.h $(FRC)
+hchunks.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+hchunks.o: hfile.h hchunks.h mcache.h hqueue.h $(FRC)
+mcache.o: hdf.h hlimits.h hdfi.h hbitio.h hcomp.h herr.h hproto.h
+mcache.o: hfile.h mcache.h hqueue.h
+vattr.o:  hdf.h hlimits.h hdfi.h herr.h hproto.h vg.h

Added: packages/libhdf4/branches/upstream/current/hdf/src/atom.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/atom.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/atom.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,750 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.7 $";
+#endif
+
+
+/* $Id: atom.c,v 1.7 1999/06/16 21:10:38 dwells Exp $ */
+
+/*
+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>
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_atom_c
+#endif
+/* 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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_HAinit_group);
+#endif /* HAVE_PABLO */
+
+    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 anyone knows a faster test for a power of two, please change this silly code -QAK */
+    if(!(hash_size==2 || hash_size==4 || hash_size==8 || hash_size==16
+            || hash_size==32 || hash_size==64 || hash_size==128 || hash_size==256
+            || hash_size==512 || hash_size==1024 || hash_size==2048
+            || hash_size==4096 || hash_size==8192 || hash_size==16374
+            || hash_size==32768 || hash_size==65536 || hash_size==131072
+            || hash_size==262144 || hash_size==524288 || hash_size==1048576
+            || hash_size==2097152 || hash_size==4194304 || hash_size==8388608
+            || hash_size==16777216 || hash_size==33554432 || hash_size==67108864
+            || hash_size==134217728 || hash_size==268435456))
+        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++;
+
+#ifdef QAK
+printf("%s: group ID=%d, count=%d, current # of active atoms=%d\n",FUNC,grp,grp_ptr->count,grp_ptr->atoms);
+#endif /* QAK */
+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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HAinit_group);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_HAdestroy_group);
+#endif /* HAVE_PABLO */
+
+    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);
+
+#ifdef QAK
+printf("%s: group ID=%d, count=%d, current # of active atoms=%d\n",FUNC,grp,grp_ptr->count,grp_ptr->atoms);
+#endif /* QAK */
+    /* 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);
+      } /* end if */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HAdestroy_group);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_HAregister_atom);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HAregister_atom);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_HAatom_object);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HAatom_object);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_HAatom_group);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HAatom_group);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_HAremove_atom);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HAremove_atom);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_HAsearch_atom);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HAsearch_atom);
+#endif /* HAVE_PABLO */
+
+  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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/atom.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/atom.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/atom.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,300 @@
+/****************************************************************************
+ * 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: atom.h,v 1.7 1997/11/13 14:50:41 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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
+
+/* 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 */
+atom_t atom_id_cache[ATOM_CACHE_SIZE]={-1,-1,-1,-1};
+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
+extern atom_t atom_id_cache[];
+extern 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
+
+*******************************************************************************/
+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
+
+*******************************************************************************/
+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
+
+*******************************************************************************/
+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
+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 */
+
+/******************************************************************************
+ 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
+
+*******************************************************************************/
+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
+
+*******************************************************************************/
+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
+
+*******************************************************************************/
+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
+
+*******************************************************************************/
+intn HAshutdown(void);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif /* __ATOM_H */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/bitvect.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/bitvect.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/bitvect.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,537 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 1.2 $";
+#endif
+
+/* $Id: bitvect.c,v 1.2 1996/10/28 15:20:46 koziol Exp $ */
+
+/*
+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 QAK
+{
+    static intn count=0;
+
+    printf("count=%d, u=%lu, b->last_zero=%ld, bytes_used=%ld\n",count,u,(long)b->last_zero,(long)bytes_used);
+    count++;
+}
+#endif /* QAK */
+#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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/bitvect.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/bitvect.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/bitvect.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,385 @@
+/****************************************************************************
+ * 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: bitvect.h,v 1.2 1996/03/28 21:57:06 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 "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 */
+extern bv_ptr bv_new(int32 num_bits, uint32 flags);
+
+extern intn bv_delete(bv_ptr b);
+
+extern intn bv_set(bv_ptr b, int32 bit_num, bv_bool value);
+
+extern intn bv_get(bv_ptr b, int32 bit_num);
+
+extern intn bv_clear(bv_ptr b, bv_bool value);
+
+extern int32 bv_size(bv_ptr b);
+
+extern uint32 bv_flags(bv_ptr b);
+
+extern 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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/cdeflate.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/cdeflate.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/cdeflate.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,912 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 1.11 $";
+#endif
+
+/* $Id: cdeflate.c,v 1.11 1999/01/13 19:18:12 koziol Exp $ */
+
+/*
+   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)
+      {
+#ifdef QAK
+int32 t1, t2;
+
+if(t1!=deflate_info->deflate_context.avail_out ||
+    t2!=deflate_info->deflate_context.avail_in)
+  {
+    printf("%s: avail_out=%d, avail_in=%d\n",FUNC,(int)deflate_info->deflate_context.avail_out,(int) deflate_info->deflate_context.avail_in);
+    t1=deflate_info->deflate_context.avail_out;
+    t2=deflate_info->deflate_context.avail_in;
+  }
+#endif
+          /* Get more bytes from the file, if we've run out */
+          if(deflate_info->deflate_context.avail_in==0)
+            {
+                int32 file_bytes;
+
+#ifdef QAK
+printf("%s: reading from file\n",FUNC);
+#endif /* QAK */
+                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;
+#ifdef QAK
+printf("%s: after reading from file, file_bytes=%d\n",FUNC,(int)file_bytes);
+#endif /* QAK */
+            } /* end if */
+
+#ifdef QAK
+printf("%s: before call to inflate, avail_in=%d, avail_out=%d\n",FUNC,(int)deflate_info->deflate_context.avail_in,(int)deflate_info->deflate_context.avail_out);
+#endif /* QAK */
+          /* break out if we've reached the end of the compressed data somehow */
+          if((zstat=inflate(&(deflate_info->deflate_context),Z_NO_FLUSH))==Z_STREAM_END)
+              break;
+#ifdef QAK
+printf("%s: after call to inflate, zstat=%d\n",FUNC,zstat);
+#endif /* QAK */
+      } /* end while */
+    bytes_read=(int32)length-(int32)deflate_info->deflate_context.avail_out;
+#ifdef QAK
+printf("%s: length=%d, deflate_info->offset=%d\n",FUNC,(int)length,(int)deflate_info->offset);
+printf("%s: bytes_read=%d, deflate_info->deflate_context.avail_out=%d\n",FUNC,(int)bytes_read,(int)deflate_info->deflate_context.avail_out);
+#endif /* QAK */
+    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;
+#ifdef QAK
+printf("%s: length=%d\n",FUNC,(int)length);
+#endif /* QAK */
+    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 */
+
+#ifdef QAK
+printf("%s: before call to deflate, avail_in=%d, avail_out=%d\n",FUNC,(int)deflate_info->deflate_context.avail_in,(int)deflate_info->deflate_context.avail_out);
+#endif /* QAK */
+          /* break out if we've reached the end of the compressed data somehow */
+          if(deflate(&(deflate_info->deflate_context),Z_NO_FLUSH)!=Z_OK) {
+#ifdef QAK
+printf("%s: call to deflate failed\n",FUNC);
+#endif /* QAK */
+              HRETURN_ERROR(DFE_CENCODE,FAIL);
+          }
+#ifdef QAK
+printf("%s: after call to deflate, avail_in=%d, avail_out=%d\n",FUNC,(int)deflate_info->deflate_context.avail_in,(int)deflate_info->deflate_context.avail_out);
+#endif /* QAK */
+      } /* 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;
+
+#ifdef QAK
+printf("%s: check 1.0, avail_out=%d\n",FUNC,(int)deflate_info->deflate_context.avail_out);
+#endif /* QAK */
+              do
+                {
+                  /* Write more bytes from the file, if we've filled our buffer */
+                  if(deflate_info->deflate_context.avail_out==0)
+                    {
+#ifdef QAK
+printf("%s: check 2.0\n",FUNC);
+#endif /* QAK */
+                        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);
+#ifdef QAK
+printf("%s: check 3.0\n",FUNC);
+#endif /* QAK */
+              if(status!=Z_STREAM_END)
+                  HRETURN_ERROR(DFE_CENCODE,FAIL);
+#ifdef QAK
+printf("%s: check 4.0, avail_out=%d\n",FUNC,(int)deflate_info->deflate_context.avail_out);
+#endif /* QAK */
+              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);
+
+#ifdef QAK
+printf("%s: check 5.0\n",FUNC);
+#endif /* QAK */
+              /* Close down the deflation buffer */
+              if(deflateEnd(&(deflate_info->deflate_context))!=Z_OK)
+                  HRETURN_ERROR(DFE_CTERM,FAIL);
+#ifdef QAK
+printf("%s: check 6.0\n",FUNC);
+#endif /* QAK */
+          } /* 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 */
+#ifdef QAK
+printf("%s: acc_mode=%u\n",FUNC,(unsigned)acc_mode);
+#endif /* QAK */
+    if (!(acc_mode&DFACC_WRITE)) {
+#ifdef QAK
+printf("%s: before opening for read access\n",FUNC);
+#endif /* QAK */
+        info->aid = Hstartread(access_rec->file_id, DFTAG_COMPRESSED,
+                                  info->comp_ref);
+      } /* end if */
+    else {
+#ifdef QAK
+printf("%s: before opening for write access\n",FUNC);
+#endif /* QAK */
+        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)
+      {
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+        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
+      {
+#ifdef QAK
+printf("%s: check 2.0\n",FUNC);
+#endif /* QAK */
+        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");
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    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");
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    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);
+
+#ifdef QAK
+printf("%s: check 1.0, deflate_info->offset=%d, offset=%d\n",FUNC,(int)deflate_info->offset,(int)offset);
+#endif /* QAK */
+    /* Check if second stage of initialization has been performed */
+    if(deflate_info->acc_init==0)
+      {
+#ifdef QAK
+printf("%s: check 2.0\n",FUNC);
+#endif /* QAK */
+        if (HCIcdeflate_staccess2(access_rec, DFACC_READ) == FAIL)
+            HRETURN_ERROR(DFE_CINIT, FAIL);
+      } /* end if */
+
+#ifdef QAK
+    /* Don't allow seeks when writing (currently) -QAK */
+    if (access_rec->access&DFACC_WRITE)
+        HRETURN_ERROR(DFE_UNSUPPORTED, FAIL);
+#endif /* QAK */
+
+    if (offset < deflate_info->offset)
+      {     /* need to seek from the beginning */
+#ifdef QAK
+printf("%s: check 3.0\n",FUNC);
+#endif /* QAK */
+#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);
+
+#ifdef QAK
+printf("%s: check 3.5\n",FUNC);
+#endif /* QAK */
+        /* 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 */
+
+#ifdef QAK
+printf("%s: check 4.0, deflate_info->offset=%d, offset=%d\n",FUNC,(int)deflate_info->offset,(int)offset);
+#endif /* QAK */
+    while (deflate_info->offset + DEFLATE_TMP_BUF_SIZE < offset) {    /* grab chunks */
+#ifdef QAK
+printf("%s: check 4.1\n",FUNC);
+#endif /* QAK */
+        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 */
+#ifdef QAK
+printf("%s: check 5.0, deflate_info->offset=%d, offset=%d\n",FUNC,(int)deflate_info->offset,(int)offset);
+#endif /* QAK */
+    if (deflate_info->offset < offset) {  /* grab the last chunk */
+#ifdef QAK
+printf("%s: check 5.1\n",FUNC);
+#endif /* QAK */
+        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 QAK
+printf("%s: check 6.0, deflate_info->offset=%d, offset=%d\n",FUNC,(int)deflate_info->offset,(int)offset);
+#endif /* QAK */
+
+#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);
+
+#ifdef QAK
+printf("%s: access_rec->posn=%d, info->length=%d, length=%d, data=%p\n",FUNC,(int)access_rec->posn,(int)info->length,(int)length,data);
+#endif /* QAK */
+    /* 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);
+#ifdef QAK
+printf("%s: check 0.3\n",FUNC);
+#endif /* QAK */
+
+        /* Terminate the previous method of access */
+        if (HCIcdeflate_term(info, deflate_info->acc_mode) == FAIL)
+            HRETURN_ERROR(DFE_CTERM, FAIL);
+
+#ifdef QAK
+printf("%s: check 0.5\n",FUNC);
+#endif /* QAK */
+        /* Restart access */
+        if (HCIcdeflate_staccess2(access_rec, DFACC_READ) == FAIL)
+            HRETURN_ERROR(DFE_CINIT, FAIL);
+
+#ifdef QAK
+printf("%s: check 0.7\n",FUNC);
+#endif /* QAK */
+        /* Go back to the beginning of the data-stream */
+        if(Hseek(info->aid,0,0)==FAIL)
+            HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+      } /* end if */
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    if ((length=HCIcdeflate_decode(info, length, data)) == FAIL)
+        HRETURN_ERROR(DFE_CDECODE, FAIL);
+#ifdef QAK
+printf("%s: check 2.0, deflate_info->offset=%d\n",FUNC,(int)deflate_info->offset);
+#endif /* QAK */
+
+    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);
+
+#ifdef QAK
+printf("%s: length=%d\n",FUNC,(int)length);
+#endif /* QAK */
+    /* 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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/cdeflate.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/cdeflate.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/cdeflate.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,102 @@
+/****************************************************************************
+ * 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: cdeflate.h,v 1.4 1997/10/24 21:00:17 koziol Exp $ */
+
+ /*-----------------------------------------------------------------------------
+ * 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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/cnbit.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/cnbit.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/cnbit.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,822 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.25 $";
+#endif
+
+/* $Id: cnbit.c,v 1.25 1997/10/24 21:00:19 koziol Exp $ */
+
+/*
+   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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/cnbit.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/cnbit.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/cnbit.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * 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: cnbit.h,v 1.16 1997/10/24 21:00:20 koziol Exp $ */
+
+ /*-----------------------------------------------------------------------------
+ * 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/cnone.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/cnone.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/cnone.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,343 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.6 $";
+#endif
+
+/* $Id: cnone.c,v 1.6 1997/10/24 21:00:21 koziol Exp $ */
+
+/*
+   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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/cnone.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/cnone.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/cnone.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,88 @@
+/****************************************************************************
+ * 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: cnone.h,v 1.4 1997/10/24 21:00:22 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/crle.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/crle.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/crle.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,748 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.24 $";
+#endif
+
+/* $Id: crle.c,v 1.24 1997/10/24 21:00:23 koziol Exp $ */
+
+/*
+   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 write */
+    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);
+#ifdef QAK
+printf("%s: c=%u\n",FUNC,(unsigned)c);
+#endif /* QAK */
+                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 */
+#ifdef QAK
+printf("length=%ld, state=%d, *buf=%u\n",(long)length, (int)rle_info->rle_state,(unsigned)*buf);
+#endif /* QAK */
+          switch (rle_info->rle_state)
+            {
+                case RLE_INIT:      /* initial encoding state */
+#ifdef QAK
+printf("%s: RLE_INIT state\n",FUNC);
+#endif /* QAK */
+                    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:
+#ifdef QAK
+printf("%s: RLE_RUN state\n",FUNC);
+#endif /* QAK */
+                    /* 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 */
+#ifdef QAK
+printf("%s: RLE_MIX state\n",FUNC);
+#endif /* QAK */
+                    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:
+#ifdef QAK
+printf("%s: bad state!\n",FUNC);
+#endif /* QAK */
+                    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:
+#ifdef QAK
+printf("%s: RLE_RUN state\n",FUNC);
+#endif /* QAK */
+              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 */
+#ifdef QAK
+printf("%s: RLE_MIX state\n",FUNC);
+#endif /* QAK */
+              if (HDputc((uint8) ((rle_info->buf_length - RLE_MIN_MIX)), info->aid) == FAIL)
+                  HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+#ifdef QAK
+printf("%s: check 0\n",FUNC);
+#endif /* QAK */
+              if (Hwrite(info->aid, rle_info->buf_length, rle_info->buffer) == FAIL)
+                  HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+#ifdef QAK
+printf("%s: check 1\n",FUNC);
+#endif /* QAK */
+              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);
+
+#ifdef QAK
+printf("%s: *data=%u\n",FUNC,*(uint8 *)data);
+#endif /* QAK */
+    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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/crle.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/crle.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/crle.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,113 @@
+
+/****************************************************************************
+ * 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: crle.h,v 1.13 1997/10/24 21:00:24 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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
+
+/* 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
+                                   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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/cskphuff.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/cskphuff.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/cskphuff.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,795 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.17 $";
+#endif
+
+/* $Id: cskphuff.c,v 1.17 1997/10/24 21:00:25 koziol Exp $ */
+
+/*
+   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++)
+      {
+#ifdef UNICOS
+#pragma novector
+#endif /* UNICOS */
+          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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/cskphuff.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/cskphuff.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/cskphuff.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,104 @@
+/****************************************************************************
+ * 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: cskphuff.h,v 1.6 1997/10/24 21:00:27 koziol Exp $ */
+
+ /*-----------------------------------------------------------------------------
+ * 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/df.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/df.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/df.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,212 @@
+/****************************************************************************
+ * 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: df.h,v 1.14 1996/03/28 21:57:07 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 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 */
+    extern DF  *DFopen
+                (char *name, int acc_mode, int ndds);
+
+    extern int  DFclose
+                (DF * dfile);
+
+    extern int  DFdescriptors
+                (DF * dfile, DFdesc ptr[], int begin, int num);
+
+    extern int  DFnumber
+                (DF * dfile, uint16 tag);
+
+    extern int  DFsetfind
+                (DF * dfile, uint16 tag, uint16 ref);
+
+    extern int  DFfind
+                (DF * dfile, DFdesc * ptr);
+
+    extern int  DFaccess
+                (DF * dfile, uint16 tag, uint16 ref, char *acc_mode);
+
+    extern int  DFstart
+                (DF * dfile, uint16 tag, uint16 ref, char *acc_mode);
+
+    extern int32 DFread
+                (DF * dfile, char *ptr, int32 len);
+
+    extern int32 DFseek
+                (DF * dfile, int32 offset);
+
+    extern int32 DFwrite
+                (DF * dfile, char *ptr, int32 len);
+
+    extern int  DFupdate
+                (DF * dfile);
+
+    extern int  DFstat
+                (DF * dfile, DFdata * dfinfo);
+
+    extern int32 DFgetelement
+                (DF * dfile, uint16 tag, uint16 ref, char *ptr);
+
+    extern int32 DFputelement
+                (DF * dfile, uint16 tag, uint16 ref, char *ptr, int32 len);
+
+    extern int  DFdup
+                (DF * dfile, uint16 itag, uint16 iref, uint16 otag, uint16 oref);
+
+    extern int  DFdel
+                (DF * dfile, uint16 tag, uint16 ref);
+
+    extern uint16 DFnewref
+                (DF * dfile);
+
+    extern int  DFishdf
+                (char *filename);
+
+    extern int  DFerrno
+                (void);
+
+    extern int  DFIerr
+                (DF * dfile);
+
+    extern int  DFImemcopy
+                (char *from, char *to, int length);
+
+    extern void *DFIgetspace
+                (uint32 qty);
+
+    extern void *DFIfreespace
+                (void *ptr);
+
+    extern int  DFIc2fstr
+                (char *str, int len);
+
+    extern char *DFIf2cstring
+                (_fcd fdesc, intn len);
+
+/* prototypes for dfconv.c */
+    extern 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
+extern
+#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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/df24.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/df24.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/df24.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,615 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.25 $";
+#endif
+
+/* $Id: df24.c,v 1.25 1999/06/16 21:10:40 dwells Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_df24_c
+#endif
+
+/*--------------------------------------------------------------------------
+ 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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DF24getdims);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DF24getdims);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DF24reqil);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFGRIreqil(il, IMAGE));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DF24reqil);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DF24getimage);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_DF24getimage);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_DF24setdims);
+#endif /* HAVE_PABLO */
+
+  dimsset = 1;
+  ret_value = (DFGRIsetdims(xdim, ydim, 3, IMAGE));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_DF24setdims);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DF24setil);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFGRIsetil(il, IMAGE));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_DF24setil);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_DF24setcompress);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFGRsetcompress(type, cinfo));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DF24setcompress);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask, ID_DF24restart);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFGRIrestart());
+
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask, ID_DF24restart);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DF24addimage);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask, ID_DF24addimage);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_DF24putimage);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DF24putimage);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_DF24nimages);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DF24nimages);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_DF24readref);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFGRreadref(filename, ref));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DF24readref);
+#endif /* HAVE_PABLO */
+  
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_DF24lastref );
+#endif /* HAVE_PABLO */
+ 
+  ret_value = (DFGRIlastref());
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DF24lastref);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}   /* end DF24lastref() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/df24f.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/df24f.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/df24f.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,435 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.24 $";
+#endif
+
+/* $Id: df24f.c,v 1.24 1996/10/28 15:20:51 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+#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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/df24ff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/df24ff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/df24ff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,255 @@
+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: df24ff.f,v 1.7 1995/05/07 21:32:01 sxu Exp $
+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
+
+      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
+
+      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
+
+      df24readref = d2irref(name, ref, len(name))
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name: df24nimages
+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----------------------------------------------------------------------------*/
+C
+C      integer function df24nimages(name)
+C      character*(*) name
+C
+C      df24nimages = d2inimg(name, len(name))
+C      return
+C      end
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfan.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfan.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfan.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1833 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.41 $";
+#endif
+
+/* $Id: dfan.c,v 1.41 1999/06/16 21:10:41 dwells Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+/****************************************************************************/
+/* define Pablo trace hooks                                                 */
+/****************************************************************************/
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_dfan_c
+#endif
+
+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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANgetlablen);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIgetannlen(filename, tag, ref, DFAN_LABEL));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANgetlablen);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANgetlabel);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIgetann(filename, tag, ref, (uint8 *) label, maxlen, DFAN_LABEL));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANgetlabel);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANgetdesclen);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIgetannlen(filename, tag, ref, DFAN_DESC));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANgetdesclen);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANgetdesc);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIgetann(filename, tag, ref, (uint8 *) desc, maxlen, DFAN_DESC));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANgetdesc);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANgetfidlen);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIgetfannlen(file_id, DFAN_LABEL, isfirst));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANgetfidlen);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANgetfid);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIgetfann(file_id, label, maxlen, DFAN_LABEL, isfirst));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANgetfid);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANgetfdslen);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIgetfannlen(file_id, DFAN_DESC, isfirst));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANgetfdslen);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANgetfds);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIgetfann(file_id, desc, maxlen, DFAN_DESC, isfirst));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANgetfds);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANputlabel);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIputann(filename, tag, ref, (uint8 *) label,
+                           (int32) HDstrlen(label), DFAN_LABEL));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANputlabel);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANputdesc);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIputann(filename, tag, ref, (uint8 *) desc, desclen, DFAN_DESC));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANputdesc);
+#endif /* HAVE_PABLO */
+  
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANaddfid);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIaddfann(file_id, id, (int32) HDstrlen(id), DFAN_LABEL));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANaddfid);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANaddfds);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIaddfann(file_id, desc, desclen, DFAN_DESC));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANaddfds);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANlastref);
+#endif /* HAVE_PABLO */
+
+  ret_value = (Lastref);
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANlastref);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,  ID_DFANlablist);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFANIlablist(filename, tag, reflist, (uint8 *) labellist,
+                            listsize, maxlen, startpos, 0));
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANlablist);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON (PABLO_mask,ID_DFANclear);
+#endif /* HAVE_PABLO */
+
+  ret_value = DFANIclear();
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFANclear);
+#endif /* HAVE_PABLO */
+
+  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;
+    HDfree((VOIDP) p);
+  }
+  for (p=DFANdir[1]; p!=NULL; p=q) {
+    q = p->next;
+    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;
+          HDfree((VOIDP) p);
+        }
+      for (p = DFANdir[1]; p != NULL; p = q)
+        {
+          q = p->next;
+          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.  Note head struct includes 1 entry */
+      DFANdir[type] = (DFANdirhead *)
+        HDmalloc(((uint32) sizeof(DFANdirhead) +
+                  (size_t)(nanns - 1) * sizeof(DFANdirentry)));
+      if (DFANdir[type] == 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.  Note head struct includes 1 entry */
+  if ((q = (DFANdirhead *) HDmalloc((uint32) sizeof(DFANdirhead) +
+               (DFAN_DEFENTRIES - 1) * sizeof(DFANdirentry))) == 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
+
+ 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
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+intn
+DFANIgetann(const char *filename, uint16 tag, uint16 ref, uint8 *ann,
+            int32 maxlen, int type)
+{
+  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 */
+  /* labels need space for null terminator, descriptions don't */
+  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);
+    }
+  if (type == DFAN_LABEL)
+    ann[annlen] = '\0';     /* terminate string properly */
+
+  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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfan.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfan.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfan.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,65 @@
+
+/****************************************************************************
+ * 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: dfan.h,v 1.9 1994/06/29 13:03:51 koziol Exp $ */
+
+/*------------------------------------------------------------------------------
+ * 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[1];  /* actually an arbitrary size array */
+  }
+DFANdirhead;
+
+#endif /* DFAN_H */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfanf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfanf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfanf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,502 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.14 $";
+#endif
+
+/* $Id: dfanf.c,v 1.14 1996/10/28 15:20:53 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+#ifndef DFAN_FNAMES
+#   define  DFAN_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndaiganl  FNAME(DAIGANL)
+#   define ndaigann  FNAME(DAIGANN)
+#   define ndaipann  FNAME(DAIPANN)
+#   define ndailist  FNAME(DAILIST)
+#   define ndalref   FNAME(DALREF)
+#   define ndaclear  FNAME(DACLEAR)
+#   define ndfanlastref  FNAME(DFANLASTREF)
+
+#   define ndfanaddfds      FNAME(DFANADDFDS)
+#   define ndfangetfidlen   FNAME(DFANGETFIDLEN)
+#   define ndfangetfdslen   FNAME(DFANGETFDSLEN)
+#   define ndfangetfid      FNAME(DFANGETFID)
+#   define ndfangetfds      FNAME(DFANGETFDS)
+#   define ndaafds          FNAME(DAAFDS)
+#   define ndagfidl         FNAME(DAGFIDL)
+#   define ndagfdsl         FNAME(DAGFDSL)
+#   define ndagfid          FNAME(DAGFID)
+#   define ndagfds          FNAME(DAGFDS)
+#   define ndaiafid         FNAME(DAIAFID)
+#else  /* !DF_CAPFNAMES */
+#   define ndaiganl  FNAME(daiganl)
+#   define ndaigann  FNAME(daigann)
+#   define ndaipann  FNAME(daipann)
+#   define ndailist  FNAME(dailist)
+#   define ndalref   FNAME(dalref)
+#   define ndaclear  FNAME(daclear)
+#   define ndfanlastref  FNAME(dfanlastref)
+
+#   define ndfanaddfds      FNAME(dfanaddfds)
+#   define ndfangetfidlen   FNAME(dfangetfidlen)
+#   define ndfangetfdslen   FNAME(dfangetfdslen)
+#   define ndfangetfid      FNAME(dfangetfid)
+#   define ndfangetfds      FNAME(dfangetfds)
+#   define ndaafds          FNAME(daafds)
+#   define ndagfidl         FNAME(dagfidl)
+#   define ndagfdsl         FNAME(dagfdsl)
+#   define ndagfid          FNAME(dagfid)
+#   define ndagfds          FNAME(dagfds)
+#   define ndaiafid         FNAME(daiafid)
+#endif /* DF_CAPFNAMES */
+#endif /* DFAN_FNAMES */
+
+/* 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);
+    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));
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfanff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfanff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfanff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,401 @@
+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: dfanff.f,v 1.3 1993/10/25 23:38:34 georgev Exp $
+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
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfcomp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfcomp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfcomp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,353 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.22 $";
+#endif
+
+/* $Id: dfcomp.c,v 1.22 1997/10/25 00:55:47 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfconv.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfconv.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfconv.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,586 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.29 $";
+#endif
+
+/* $Id: dfconv.c,v 1.29 1999/02/24 17:23:32 koziol Exp $ */
+
+/*------------------------------------------------------------------
+ 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
+    dfkcray.c
+    DFKui2i -  Unicos routine for importing 16 bit unsigned integers
+    DFKui2s -  Unicos routine for importing 16 bit signed integers
+    DFKuo2i -  Unicos routine for exporting 16 bit integers (both)
+    DFKui4i -  Unicos routine for importing unsigned 32bit integers
+    DFKui4s -  Unicos routine for importing signed 32bit integers
+    DFKuo4i -  Unicos routine for exporting 4 byte integers (both)
+    DFKui4f -  Unicos routine for importing 32 bit floats
+    DFKuo4f -  Unicos routine for exporting 32 bit floats
+    DFKui8f -  Unicos routine for importing 64 bit floats
+    DFKuo8f -  Unicos routine for exporting 64 bit floats
+    DFKlui2i-  Unicos routine for importing little-endian 16 bit unsigned ints
+    DFKlui2s-  Unicos routine for importing little-endian 16 bit signed ints
+    DFKluo2i-  Unicos routine for exporting little-endian 16 bit ints (both)
+    DFKlui4i-  Unicos routine for importing little-endian unsigned 32bit ints
+    DFKlui4s-  Unicos routine for importing little-endian signed 32bit ints
+    DFKluo4i-  Unicos routine for exporting little-endian 4 byte ints (both)
+    DFKlui4f-  Unicos routine for importing little-endian 32 bit floats
+    DFKluo4f-  Unicos routine for exporting little-endian 32 bit floats
+    DFKlui8f-  Unicos routine for importing little-endian 64 bit floats
+    DFKluo8f-  Unicos routine for exporting little-endian 64 bit floats
+    dfkvms.c
+    DFKvi4f -  VMS routine for importing 32 bit floats
+    DFKvo4f -  VMS routine for exporting 32 bit floats
+    DFKvi8f -  VMS routine for importing 64 bit floats
+    DFKvo8f -  VMS routine for exporting 64 bit floats
+    DFKlvi4f-  VMS routine for importing little-endian 32 bit floats
+    DFKlvo4f-  VMS routine for exporting little-endian 32 bit floats
+    DFKlvi8f-  VMS routine for importing little-endian 64 bit floats
+    DFKlvo8f-  VMS routine for exporting little-endian 64 bit floats
+    dfkconv.c
+    DFKci4f -  Convex routine for importing 32 bit floats
+    DFKco4f -  Convex routine for exporting 32 bit floats
+    DFKci8f -  Convex routine for importing 64 bit floats
+    DFKco8f -  Convex routine for exporting 64 bit floats
+    DFKlci4f-  Convex routine for importing little-endian 32 bit floats
+    DFKlco4f-  Convex routine for exporting little-endian 32 bit floats
+    DFKlci8f-  Convex routine for importing little-endian 64 bit floats
+    DFKlco8f-  Convex routine for exporting little-endian 64 bit floats
+    dfkfuji.c
+    DFKpi4f -  VP routine for importing 32 bit floats
+    DFKpo4f -  VP routine for exporting 32 bit floats
+    DFKpi8f -  VP routine for importing 64 bit floats
+    DFKpo8f -  VP routine for exporting 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
+ *****************************************************************************/

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfconvrt.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfconvrt.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfconvrt.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,101 @@
+
+/****************************************************************************
+ * 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: dfconvrt.h,v 1.8 1994/10/19 20:55:12 koziol Exp $ */
+
+/* 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dff.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dff.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dff.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,485 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.19 $";
+#endif
+
+/* $Id: dff.c,v 1.19 1997/11/15 20:24:20 acheng Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+#ifndef DF_FNAMES
+#   define DF_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndfiaccess   FNAME(DFIACCESS)
+#   define ndfiopen  FNAME(DFIOPEN)
+#   define ndfclose  FNAME(DFCLOSE)
+#   define ndfdesc   FNAME(DFDESC)
+#   define ndfdup    FNAME(DFDUP)
+#   define ndfdel    FNAME(DFDEL)
+#   define ndfstart  FNAME(DFSTART)
+#   define ndfread   FNAME(DFREAD)
+#   define ndfseek   FNAME(DFSEEK)
+#   define ndfwrite  FNAME(DFWRITE)
+#   define ndfupdate FNAME(DFUPDATE)
+#   define ndfget    FNAME(DFGET)
+#   define ndfput    FNAME(DFPUT)
+#   define ndfsfind  FNAME(DFSFIND)
+#   define ndffind   FNAME(DFFIND)
+#   define ndferrno  FNAME(DFERRNO)
+#   define ndfnewref FNAME(DFNEWREF)
+#   define ndfnumber FNAME(DFNUMBER)
+#   define ndfstat   FNAME(DFSTAT)
+#   define ndfiishdf FNAME(DFIISHDF)
+#else  /* !DF_CAPFNAMES */
+#   define ndfiaccess   FNAME(dfiaccess)
+#   define ndfiopen  FNAME(dfiopen)
+#   define ndfclose  FNAME(dfclose)
+#   define ndfdesc   FNAME(dfdesc)
+#   define ndfdup    FNAME(dfdup)
+#   define ndfdel    FNAME(dfdel)
+#   define ndfstart  FNAME(dfstart)
+#   define ndfread   FNAME(dfread)
+#   define ndfseek   FNAME(dfseek)
+#   define ndfwrite  FNAME(dfwrite)
+#   define ndfupdate FNAME(dfupdate)
+#   define ndfget    FNAME(dfget)
+#   define ndfput    FNAME(dfput)
+#   define ndfsfind  FNAME(dfsfind)
+#   define ndffind   FNAME(dffind)
+#   define ndferrno  FNAME(dferrno)
+#   define ndfnewref FNAME(dfnewref)
+#   define ndfnumber FNAME(dfnumber)
+#   define ndfstat   FNAME(dfstat)
+#   define ndfiishdf FNAME(dfiishdf)
+#endif /* DF_CAPFNAMES */
+#endif /* DF_FNAMES */
+
+/*-----------------------------------------------------------------------------
+ * 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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,80 @@
+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: dfff.f,v 1.4 1993/11/03 19:58:15 koziol Exp $ 
+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

Added: packages/libhdf4/branches/upstream/current/hdf/src/dffunc.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dffunc.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dffunc.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,687 @@
+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,v 1.39 2000/02/29 20:31:45 epourmal Exp $
+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  DFSDgetmaxmin,		dsgmaxm
+      external DFSDgetmaxmin,		dsgmaxm
+      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  DFSDsetmaxmin,		dssmaxm
+      external DFSDsetmaxmin,		dssmaxm
+      integer  DFSDsetorder,		dssodr
+      external DFSDsetorder,		dssodr
+      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  DF24nimages,		d2nimg
+      external DF24nimages,		d2nimg
+
+      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  DFindnextref,		dfindnr
+      external DFindnextref,		dfindnr
+      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       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  sfisrcrd
+      external sfisrcrd
+      integer  sfsblsz
+      external sfsblsz
+      integer  sfchempty
+      external sfchempty
+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
+
+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
+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
+      integer  vsqnfld
+      external vsqnfld
+
+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
+      
+
+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  mgssctp     
+      external mgssctp     
+      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  mglt2rf
+      external mglt2rf
+
+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 End of declarations
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfgr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfgr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfgr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1652 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.41 $";
+#endif
+
+/* $Id: dfgr.c,v 1.41 1997/12/18 16:50:40 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfgr.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfgr.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfgr.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,73 @@
+/****************************************************************************
+ * 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: dfgr.h,v 1.12 1994/06/29 13:04:12 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfgroup.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfgroup.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfgroup.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,338 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.30 $";
+#endif
+
+/* $Id: dfgroup.c,v 1.30 1998/12/08 21:37:22 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfi.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfi.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfi.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,220 @@
+
+/****************************************************************************
+ * 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: dfi.h,v 1.12 1998/02/02 21:44:54 smitchel Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 */
+
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+#undef DF_BUFFIO    /* use unbuffered i/o */
+#include <memory.h>     /* malloc stuff for MPW 3.0 */
+#include <fcntl.h>  /* unbuffered IO stuff for MPW 3.0 */
+#ifdef SYMANTEC_C  /* for LightSpeed C */
+#include <unix.h>
+#else  /*SYMANTEC_C                   MPW, possibly others */
+#include <Files.h>  /* for unbuffered i/o stuff */
+#endif /*SYMANTEC_C */
+#define DF_CAPFNAMES    /* fortran names are in all caps */
+#define DF_DYNAMIC  /* use dynamic allocation */
+#ifdef SYMANTEC_C  /* LightSpeed C does not have memcpy */
+#define DFmovmem(from, to, len) DFImemcopy(from, to, len)
+#else  /*SYMANTEC_C */
+#define DFmovmem(from, to, len) memcpy(to, from, len)
+#endif /*SYMANTEC_C */
+#define malloc(x)   NewPtr((Size)   (x))    /* don't use malloc on the Mac */
+#define free(x)     DisposPtr((Ptr) (x))    /* don't use free on the Nac   */
+#undef 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; }
+#define DF_CREAT(name, prot) mopen(name, O_WRONLY|O_TRUNC|O_CREAT)
+#define DF_MT   DFMT_MAC
+#endif /*MAC */
+
+#ifdef VMS
+/*#undef DF_BUFFIO should be buff !!!! */
+   /* use only unbuff i/o - buff doesn't work! */
+#ifndef DFopen  /* avoid double includes */
+/* #include "dfivms.h" */
+#endif /*DFopen */
+#undef DF_STRUCTOK
+#define DF_CAPFNAMES    /* fortran names are in all caps */
+#include <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_VAX
+#endif /*VMS */
+
+#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                              */
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)  /* MAC specific file manager calls */
+#   define DF_OPEN(x,y) mopen(x,y)
+#   define DF_CLOSE(x) mclose(x)
+#   define DF_SEEK(x,y,z) mlseek(x,y,z)
+#   define DF_SKEND(x,y,z) mlseek(x,-1*y,z)
+#   define DF_TELL(x) mlseek(x,0L,1)
+#   define DF_READ(a,b,c,d) mread(d,a,b*c)
+#   define DF_WRITE(a,b,c,d) mwrite(d,a,b*c)
+#   define DF_FLUSH(a)  /* no need to flush */
+#   define DF_RDACCESS 0    /* dummy */
+#   define DF_WRACCESS 0    /* dummy */
+#   define DF_OPENERR(f)    ((f) == -1)
+#else  /* !MAC */
+#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 */
+#endif /* !MAC */
+
+#ifndef FILE
+#include <stdio.h>
+#endif /*FILE */
+
+#endif /* DFI_H */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfimcomp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfimcomp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfimcomp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1123 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.24 $";
+#endif
+
+/* $Id: dfimcomp.c,v 1.24 1998/02/02 21:38:40 smitchel Exp $ */
+
+/************************************************************************/
+/*  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
+
+#if (!defined MAC && !defined macintosh && !defined SYMANTEC_C )
+#define MAXCOLOR 32768
+#else  /*MAC */
+#define MAXCOLOR 768
+#endif /*MAC */
+
+#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;
+  };
+
+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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfivms.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfivms.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfivms.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,184 @@
+/****************************************************************************
+ * 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: dfivms.h,v 1.12 1996/01/18 05:02:09 sxu Exp $ */
+
+#ifndef DFIVMS_H
+#define DFIVMS_H
+
+#define DFANIaddentry   _DFANIaddentry
+#define DFANIgetann     _DFANIgetann
+#define DFANIgetannlen  _DFANIgetannlen
+#define DFANIlablist    _DFANIlablist
+#define DFANIlocate     _DFANIlocate
+#define DFANIopen       _DFANIopen
+#define DFANIclear      _DFANIclear
+#define DFANIputann     _DFANIputann
+#define DFANclear       _DFANclear
+#define DFANgetdesc     _DFANgetdesc
+#define DFANgetdesclen  _DFANgetdesclen
+#define DFANgetlabel    _DFANgetlabel
+#define DFANgetlablen   _DFANgetlablen
+#define DFANlablist     _DFANlablist
+#define DFANlastref     _DFANlastref
+#define DFANputdesc     _DFANputdesc
+#define DFANputlabel    _DFANputlabel
+#define DFANaddfid      _DFANaddfid
+#define DFANgetfidlen   _DFANgetfidlen
+#define DFANgetfid      _DFANgetfid
+#define DFANgetfdslen   _DFANgetfdslen
+#define DFANgetfds      _DFANgetfds
+#define DFANaddfds      _DFANaddfds
+#define DFCimcomp       _DFCimcomp
+#define DFCrle          _DFCrle
+#define DFCunimcomp     _DFCunimcomp
+#define DFCunrle        _DFCunrle
+#define DFDIgetgroup    _DFDIgetgroup
+#define DFDIputgroup    _DFDIputgroup
+#define DFIc2fstr       _DFIc2fstr
+#define DFIcheck        _DFIcheck
+#define DFIemptyDD      _DFIemptyDD
+#define DFIerr          _DFIerr
+#define DFIf2cstring    _DFIf2cstring
+#define DFIfind         _DFIfind
+#define DFIfreespace    _DFIfreespace
+#define DFIgetspace     _DFIgetspace
+#define DFImemcopy      _DFImemcopy
+#define DFIseedDDs      _DFIseedDDs
+#define DFIstrncpy      _DFIstrncpy
+#define DFPgetpal       _DFPgetpal
+#define DFPlastref      _DFPlastref
+#define DFPnpals        _DFPnpals
+#define DFPputpal       _DFPputpal
+#define DFPaddpal       _DFPaddpal
+#define DFPreadref      _DFPreadref
+#define DFPrestart      _DFPrestart
+#define DFPwriteref     _DFPwriteref
+#define DFR8Iopen       _DFR8Iopen
+#define DFR8Iputimage   _DFR8Iputimage
+#define DFR8Iriginfo    _DFR8Iriginfo
+#define DFR8addimage    _DFR8addimage
+#define DFR8getdims     _DFR8getdims
+#define DFR8getimage    _DFR8getimage
+#define DFR8getrig      _DFR8getrig
+#define DFR8lastref     _DFR8lastref
+#define DFR8nimages     _DFR8nimages
+#define DFR8putimage    _DFR8putimage
+#define DFR8putrig      _DFR8putrig
+#define DFR8readref     _DFR8readref
+#define DFR8restart     _DFR8restart
+#define DFR8setpalette  _DFR8setpalette
+#define DFR8writeref    _DFR8writeref
+#define DFSDIclear      _DFSDIclear
+#define DFSDIgetdata    _DFSDIgetdata
+#define DFSDIgetslice   _DFSDIgetslice
+#define DFSDIopen       _DFSDIopen
+#define DFSDIputdata    _DFSDIputdata
+#define DFSDIputslice   _DFSDIputslice
+#define DFSDIsdginfo    _DFSDIsdginfo
+#define DFSDadddata     _DFSDadddata
+#define DFSDclear       _DFSDclear
+#define DFSDendslice    _DFSDendslice
+#define DFSDgetNT       _DFSDgetNT
+#define DFSDgetdata     _DFSDgetdata
+#define DFSDgetdatalen  _DFSDgetdatalen
+#define DFSDgetdatastrs _DFSDgetdatastrs
+#define DFSDgetdimlen   _DFSDgetdimlen
+#define DFSDgetdims     _DFSDgetdims
+#define DFSDgetdimscale _DFSDgetdimscale
+#define DFSDgetdimstrs  _DFSDgetdimstrs
+#define DFSDgetrange    _DFSDgetrange
+#define DFSDgetsdg      _DFSDgetsdg
+#define DFSDgetslice    _DFSDgetslice
+#define DFSDlastref     _DFSDlastref
+#define DFSDndatasets   _DFSDndatasets
+#define DFSDpre32       _DFSDpre32
+#define DFSDputdata     _DFSDputdata
+#define DFSDputsdg      _DFSDputsdg
+#define DFSDputslice    _DFSDputslice
+#define DFSDrestart     _DFSDrestart
+#define DFSDsetNT       _DFSDsetNT
+#define DFSDsetdatastrs _DFSDsetdatastrs
+#define DFSDsetdims     _DFSDsetdims
+#define DFSDsetdimscale _DFSDsetdimscale
+#define DFSDsetdimstrs  _DFSDsetdimstrs
+#define DFSDsetlengths  _DFSDsetlengths
+#define DFSDsetorder    _DFSDsetorder
+#define DFSDsetrange    _DFSDsetrange
+#define DFSDsettype     _DFSDsettype
+#define DFSDstartslice  _DFSDstartslice
+#define DFSDreadref     _DFSDreadref
+#define DFaccess        _DFaccess
+#define DFIaccess       _DFIaccess
+#define DFclose         _DFclose
+#define DFdel           _DFdel
+#define DFdescriptors   _DFdescriptors
+#define DFdiget         _DFdiget
+#define DFdiput         _DFdiput
+#define DFdiread        _DFdiread
+#define DFdisetup       _DFdisetup
+#define DFdiwrite       _DFdiwrite
+#define DFdup           _DFdup
+#define DFerrno         _DFerrno
+#define DFfind          _DFfind
+#define DFgetcomp       _DFgetcomp
+#define DFgetelement    _DFgetelement
+#define DFishdf         _DFishdf
+#define DFnewref        _DFnewref
+#define DFnumber        _DFnumber
+#define DFopen          _DFopen
+#define DFputcomp       _DFputcomp
+#define DFputelement    _DFputelement
+#define DFread          _DFread
+#define DFseek          _DFseek
+#define DFsetfind       _DFsetfind
+#define DFstart         _DFstart
+#define DFstat          _DFstat
+#define DFupdate        _DFupdate
+#define DFwrite         _DFwrite
+#define DFfindnextref   _DFfindnextref
+#define DF24putimage    _DF24putimage
+#define DF24addimage    _DF24addimage
+#define DF24getdims     _DF24getdims
+#define DF24getimage    _DF24getimage
+#define DF24reqil       _DF24reqil
+#define DF24setdims     _DF24setdims
+#define DF24setil       _DF24setil
+#define DF24restart     _DF24restart
+#define DF24readref     _DF24readref
+#define DFGRIgetdims    _DFGRIgetdims
+#define DFGRIgetimlut   _DFGRIgetimlut
+#define DFGRIopen       _DFGRIopen
+#define DFGRIreqil      _DFGRIreqil
+#define DFGRIriginfo    _DFGRIriginfo
+#define DFGRaddimage    _DFGRaddimage
+#define DFGRaddlut      _DFGRaddlut
+#define DFGRaddrig      _DFGRaddrig
+#define DFGRgetimage    _DFGRgetimage
+#define DFGRgetimdims   _DFGRgetimdims
+#define DFGRgetlut      _DFGRgetlut
+#define DFGRgetlutdims  _DFGRgetlutdims
+#define DFGRgetrig      _DFGRgetrig
+#define DFGRreqimil     _DFGRreqimil
+#define DFGRreqlutil    _DFGRreqlutil
+#define DFGRsetcompress _DFGRsetcompress
+#define DFGRsetimdims   _DFGRsetimdims
+#define DFGRsetlut      _DFGRsetlut
+#define DFGRsetlutdims  _DFGRsetlutdims
+#define DFUfptoimage    _DFUfptoimage
+#define Hclose          _Hclose
+#define Hopen           _Hopen
+#define Hnumber         _Hnumber
+#define Vdelete         _Vdelete
+#define Vnrefs          _Vnrefs
+#define Vfind           _Vfind
+#endif /* DFIVMS_H */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfjpeg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfjpeg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfjpeg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,309 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.24 $";
+#endif
+
+/* $Id: dfjpeg.c,v 1.24 2000/02/29 21:34:04 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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);
+
+/*-----------------------------------------------------------------------------
+ * 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);
+
+    /* 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,
+                 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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfkconv.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfkconv.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfkconv.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,821 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.11 $";
+#endif
+
+/* $Id: dfkconv.c,v 1.11 1995/10/31 16:37:23 koziol Exp $ */
+
+/*------------------------------------------------------------------
+ File:  dfkconv.c
+
+ Purpose:
+    Routines to support Convex-Native conversion to and from HDF format
+
+ Invokes:
+
+ PRIVATE conversion functions:
+    DFKci4f -  Convex routine for importing 32 bit floats
+    DFKco4f -  Convex routine for exporting 32 bit floats
+    DFKci8f -  Convex routine for importing 64 bit floats
+    DFKco8f -  Convex routine for exporting 64 bit floats
+    DFKlci4f-  Convex routine for importing little-endian 32 bit floats
+    DFKlco4f-  Convex routine for exporting little-endian 32 bit floats
+    DFKlci8f-  Convex routine for importing little-endian 64 bit floats
+    DFKlco8f-  Convex routine for exporting little-endian 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"
+
+#ifdef CONVEXNATIVE
+
+/****************************************************************
+ * NUMBER CONVERSION ROUTINES FOR CONVEX ARCHITECTURES          *
+ * Most of the CONVEX number types can be handled with the      *
+ * generic routines.  Only the floating point                   *
+ * conversion routines need to be customized.                   *
+ * Routines written by J.W. de Bruijn,                          *
+ * DELPHI project, Laboratory of Seismics and Acoustics,        *
+ * Delft University of Technology.                              *
+ * Based on the VAX <-> IEEE routines from NCSA.                *
+ ****************************************************************/
+
+/************************************************************/
+/* DFKci4f()                                                */
+/* --> Import routine for 4 byte CONVEX floats              */
+/************************************************************/
+int
+DFKci4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKci4f";
+    uint8       exp;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 4;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+          /* extract exponent */
+          exp = (uint8) (source[0] << 1) | (uint8) (source[1] >> 7);
+          if (exp)
+            {
+                /*
+                 * non-zero exponent
+                 */
+
+                /* copy mantissa, last bit of exponent */
+                dest[1] = source[1];
+                dest[3] = source[3];
+                dest[2] = source[2];
+                if (exp < 254)
+                    /* normal value */
+                    dest[0] = source[0] + (uint8) 1;    /* actually adds two to exp */
+                else
+                  {
+                      /* infinity or NaN */
+                      if (exp == 254)   /* unrepresentable - OFL */
+                          /* set mant = 0 for overflow */
+                          dest[0] = dest[1] = dest[2] = dest[3] = 0;
+                      dest[1] &= 0x7f;  /* set last bit of exp to 0 */
+                      dest[0] = 0x80;   /* sign=1 exp=0 -> OFL or NaN */
+                  }
+            }
+          else if (source[1] & 0x60)
+            {   /* denormalized value */
+                int shft;
+
+                shft = (source[1] & 0x40) ? 1 : 2;  /* shift needed to normalize */
+                /* shift mantissa */
+                /* note last bit of exp set to 1 implicitly */
+                dest[1] = (uint8) (source[1] << shft) | (uint8) (source[2] >> (8 - shft));
+                dest[2] = (uint8) (source[2] << shft) | (uint8) (source[3] >> (8 - shft));
+                dest[3] = (uint8) (source[3] << shft);
+                dest[0] = (uint8) (source[0] & 0x80);   /* sign */
+                if (shft == 1)
+                  {     /* set exp to 2 */
+                      dest[0] |= 0x01;
+                      dest[1] &= 0x7f;  /* set LSB of exp to 0 */
+                  }
+            }
+          else
+              dest[0] = dest[1] = dest[2] = dest[3] = 0;
+
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+
+}
+
+/************************************************************/
+/* DFKco4f()                                                */
+/* --> Export routine for 4 byte CONVEX floats              */
+/************************************************************/
+int
+DFKco4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKco4f";
+    intn        exp;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 4;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+          /* extract exponent */
+          exp = (source[0] << 1) | (source[1] >> 7);
+
+          if (!exp && !source[0])
+            {
+                /*
+                 * zero value
+                 */
+                dest[0] = dest[1] = dest[2] = dest[3] = 0;
+            }
+          else if (exp > 2)
+            {
+                /*
+                 * Normal value
+                 */
+
+                dest[0] = source[0] - (uint8) 1;    /* subtracts 2 from exponent */
+                /* copy mantissa, LSB of exponent */
+                dest[1] = source[1];
+                dest[2] = source[2];
+                dest[3] = source[3];
+
+            }
+          else if (exp)
+            {
+                intn shft;
+                /*
+                 * denormalized number
+                 */
+
+                /* keep sign, zero exponent */
+                dest[0] = source[0] & 0x80;
+
+                shft = 3 - exp;
+
+                /* shift original mant by 1 or 2 to get denormalized mant */
+                /* prefix mantissa with '1'b or '01'b as appropriate */
+                dest[1] = (uint8) ((source[1] & 0x7f) >> shft) | (uint8) (0x10 << exp);
+                dest[2] = (uint8) (source[1] << (8 - shft)) | (uint8) (source[2] >> shft);
+                dest[3] = (uint8) (source[2] << (8 - shft)) | (uint8) (source[3] >> shft);
+            }
+          else
+            {
+                /*
+                 * sign=1 -> infinity or NaN
+                 */
+
+                dest[0] = 0xff;     /* set exp to 255 */
+                /* copy mantissa */
+                dest[1] = source[1] | (uint8) 0x80;     /* LSB of exp = 1 */
+                dest[2] = source[2];
+                dest[3] = source[3];
+            }
+
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+
+}
+
+/************************************************************/
+/* DFKci8f()                                                */
+/* --> Import routine for 8 byte CONVEX floats              */
+/************************************************************/
+int
+DFKci8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+  int in_place = 0;                     /* Inplace must be detected */
+  uint32 i;            
+  uint8 buf[8];                          /* Inplace processing buffer */
+  uint8 * source = (uint8*)s;
+  uint8 * dest = (uint8*)d;
+  char *FUNC="DFKci8f";
+  intn exp;
+
+  HEclear();
+
+  if(source == dest)
+      in_place = TRUE;
+
+  if(num_elm == 0 || in_place){   /* No elements is an error as is in place. */
+    HERROR(DFE_BADCONV);
+    return FAIL;
+  }
+
+  if(source_stride == 0 && dest_stride == 0)
+      source_stride = dest_stride = 8;
+
+  for(i = 0; i < num_elm; i++) {
+
+      /* extract exponent */
+      exp = (source[0] << 1) | (source[1] >> 4); 
+      if (exp) {
+          /* 
+           * non-zero exponent 
+           */
+
+          /* copy mantissa, sign and first bits of exponent */
+          dest[2] = source[2];
+          dest[3] = source[3];
+          dest[4] = source[4];
+          dest[5] = source[5];
+          dest[6] = source[6];
+          dest[7] = source[7];
+          dest[0] = source[0];
+          if (exp < 2046) {
+              /* normal value */
+	      dest[1] = source[1] + 0x20;	/* add two to exp */
+	      if (dest[1] < 0x20) dest[0] += 1;	/* carry */
+	  }
+          else {                              
+              /* infinity or NaN */
+              if (exp == 2046)                      /* unrepresentable - OFL */
+                  /* set mant = 0 for overflow */
+                  dest[0] = dest[1] = dest[2] = dest[3] = 0;
+              dest[0] = 0x80;               /* sign=1 exp=0 -> OFL or NaN */
+              dest[1] &= 0x0f;              /* set last bit of exp to 0 */
+          }
+      }
+      else if (source[1] & 0x0C) {               /* denormalized value */
+          int shft;
+          
+          shft = (source[1] & 0x08) ? 1 : 2;  /* shift needed to normalize */
+          /* shift mantissa */
+          /* note last bit of exp set to 1 implicitly */
+          dest[1] = (uint8)(source[1] << shft) | (uint8)(source[2] >> (8-shft));
+          dest[2] = (uint8)(source[2] << shft) | (uint8)(source[3] >> (8-shft));
+          dest[3] = (uint8)(source[3] << shft) | (uint8)(source[4] >> (8-shft));
+          dest[4] = (uint8)(source[4] << shft) | (uint8)(source[5] >> (8-shft));
+          dest[5] = (uint8)(source[5] << shft) | (uint8)(source[6] >> (8-shft));
+          dest[6] = (uint8)(source[6] << shft) | (uint8)(source[7] >> (8-shft));
+          dest[7] = (uint8)(source[7] << shft);
+          dest[0] = (uint8)(source[0] & 0x80);    /* sign */
+          if (shft==1) {                          /* set exp to 2 */
+            dest[1] |= 0x20;                  /* set LSB of exp to 0 */
+          }
+      }
+      else {
+      	dest[0] = dest[1] = dest[2] = dest[3] = 0;
+      	dest[4] = dest[5] = dest[6] = dest[7] = 0;
+      }
+      
+      source += source_stride;
+      dest   += dest_stride;
+  }
+
+    return 0;
+}
+
+/************************************************************/
+/* DFKco8f()                                                */
+/* --> Export routine for 8 byte CONVEX floats              */
+/************************************************************/
+int
+DFKco8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+  int in_place = 0;                     /* Inplace must be detected */
+  uint32 i;            
+  uint8 buf[8];                          /* Inplace processing buffer */
+  uint8 * source = (uint8*)s;
+  uint8 * dest = (uint8*)d;
+  char *FUNC="DFKco8f";
+  intn  exp;
+
+  HEclear();
+
+  if(source == dest) 
+      in_place = TRUE;
+
+  if(num_elm == 0 || in_place){  /* No elements is an error as is in place*/
+    HERROR(DFE_BADCONV);
+    return FAIL;
+  }
+
+  if(source_stride == 0 && dest_stride == 0)
+      source_stride = dest_stride = 8;
+
+  for(i = 0; i < num_elm; i++) {
+      
+      /* extract exponent */
+      exp = (source[0] << 1) | (source[1] >> 4); 
+
+      if(!exp && !source[0]) {
+          /* 
+           * zero value 
+           */
+          dest[0] = dest[1] = dest[2] = dest[3] = 0;
+          dest[4] = dest[5] = dest[6] = dest[7] = 0;
+      }
+      else if(exp > 2) {
+          /*
+           * Normal value
+           */
+          /* copy sign, MSBs of exponent */
+          dest[0] = source[0];
+	  dest[1] = source[1] - 0x20;	/* subtracts 2 from exponent */
+	  if(dest[1]>=0xe0) dest[0]--;  /* borrow from next exp. byte */
+          /* copy mantissa */
+          dest[2] = source[2];
+          dest[3] = source[3];
+          dest[4] = source[4];
+          dest[5] = source[5];
+          dest[6] = source[6];
+          dest[7] = source[7];
+      }
+      else if(exp) {
+          intn shft;
+          /* 
+           * denormalized number 
+           */
+
+          /* keep sign, zero exponent */
+          dest[0] = source[0] & 0x80;
+
+          shft = 3 - exp;
+
+          /* shift original mant by 1 or 2 to get denormalized mant */
+          /* prefix mantissa with '1'b or '01'b as appropriate */
+          dest[1] = (uint8)((source[1] & 0x0f) >> shft) | (uint8)(0x02 << exp);
+          dest[2] = (uint8)(source[1] << (8-shft)) | (uint8)(source[2] >> shft);
+          dest[3] = (uint8)(source[2] << (8-shft)) | (uint8)(source[3] >> shft);  
+          dest[4] = (uint8)(source[3] << (8-shft)) | (uint8)(source[4] >> shft);  
+          dest[5] = (uint8)(source[4] << (8-shft)) | (uint8)(source[5] >> shft);  
+          dest[6] = (uint8)(source[5] << (8-shft)) | (uint8)(source[6] >> shft);  
+          dest[7] = (uint8)(source[6] << (8-shft)) | (uint8)(source[7] >> shft);  
+      }
+      else {
+          /* 
+           * sign=1 -> infinity or NaN 
+           */
+          
+          dest[0] = 0xff;                /* set exp to 255 */
+          /* copy mantissa */
+          dest[1] = source[1] | (uint8)0xF0;  /* LSBs of exp = 1 */
+          dest[2] = source[2];
+          dest[3] = source[3];
+          dest[4] = source[4];
+          dest[5] = source[5];
+          dest[6] = source[6];
+          dest[7] = source[7];
+      }
+      
+      source += source_stride;
+      dest   += dest_stride;
+  }
+  
+  return 0;
+
+}
+
+/************************************************************/
+/* DFKlci4f()                                                */
+/* --> Import routine for 4 byte CONVEX floats              */
+/************************************************************/
+int
+DFKlci4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+  int in_place = 0;                     /* Inplace must be detected */
+  uint32 i;            
+  uint8 buf[4];                          /* Inplace processing buffer */
+  uint8 * source = (uint8*)s;
+  uint8 * dest = (uint8*)d;
+  char *FUNC="DFKci4f";
+  uint8 exp;
+
+  HEclear();
+
+  if(source == dest)
+      in_place = TRUE;
+
+  if(num_elm == 0 || in_place){   /* No elements is an error as is in place. */
+    HERROR(DFE_BADCONV);
+    return FAIL;
+  }
+
+  if(source_stride == 0 && dest_stride == 0)
+      source_stride = dest_stride = 4;
+
+  for(i = 0; i < num_elm; i++) {
+
+      /* extract exponent */
+      exp = (uint8)(source[3] << 1) | (uint8)(source[2] >> 7);
+      if (exp) {       
+          /* 
+           * non-zero exponent 
+           */
+
+          /* copy mantissa, last bit of exponent */
+          dest[1] = source[2];
+          dest[3] = source[0];
+          dest[2] = source[1];
+          if (exp < 254) 
+              /* normal value */
+              dest[0] = source[3] + (uint8)1;   /* actually adds two to exp */
+          else {                              
+              /* infinity or NaN */
+              if (exp == 254)                      /* unrepresentable - OFL */
+                  /* set mant = 0 for overflow */
+                  dest[0] = dest[1] = dest[2] = dest[3] = 0;
+              dest[1] &= 0x7f;              /* set last bit of exp to 0 */
+              dest[0] = 0x80;               /* sign=1 exp=0 -> OFL or NaN */
+          }
+      }
+      else if (source[2] & 0x60) {               /* denormalized value */
+          int shft;
+          
+          shft = (source[2] & 0x40) ? 1 : 2;  /* shift needed to normalize */
+          /* shift mantissa */
+          /* note last bit of exp set to 1 implicitly */
+          dest[1] = (uint8)(source[2] << shft) | (uint8)(source[1] >> (8-shft));
+          dest[2] = (uint8)(source[1] << shft) | (uint8)(source[0] >> (8-shft));
+          dest[3] = (uint8)(source[0] << shft);
+          dest[0] = (uint8)(source[3] & 0x80);    /* sign */
+          if (shft==1) {                          /* set exp to 2 */
+            dest[0] |= 0x01;
+            dest[1] &= 0x7f;                  /* set LSB of exp to 0 */
+          }
+      }
+      else dest[0] = dest[1] = dest[2] = dest[3] = 0;
+      
+      source += source_stride;
+      dest   += dest_stride;
+  }
+
+  return 0;
+}
+
+/************************************************************/
+/* DFKlco4f()                                                */
+/* --> Export routine for 4 byte CONVEX floats              */
+/************************************************************/
+int
+DFKlco4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+  int in_place = 0;                     /* Inplace must be detected */
+  uint32 i;            
+  uint8 buf[4];                          /* Inplace processing buffer */
+  uint8 * source = (uint8*)s;
+  uint8 * dest = (uint8*)d;
+  char *FUNC="DFKco4f";
+  intn  exp;
+
+  HEclear();
+
+  if(source == dest) 
+      in_place = TRUE;
+
+  if(num_elm == 0 || in_place){  /* No elements is an error as is in place*/
+    HERROR(DFE_BADCONV);
+    return FAIL;
+  }
+
+  if(source_stride == 0 && dest_stride == 0)
+      source_stride = dest_stride = 4;
+
+  for(i = 0; i < num_elm; i++) {
+      
+      /* extract exponent */
+      exp = (source[0] << 1) | (source[1] >> 7);
+
+      if(!exp && !source[3]) {
+          /* 
+           * zero value 
+           */
+          dest[0] = dest[1] = dest[2] = dest[3] = 0;
+      }
+      else if(exp > 2) {
+          /*
+           * Normal value
+           */
+
+          /* copy mantissa, LSB of exponent */
+          dest[0] = source[3];
+          dest[1] = source[2];
+          dest[2] = source[1];
+          dest[3] = source[0] - (uint8)1; /* subtracts 2 from exponent */
+
+      }
+      else if(exp) {
+          intn shft;
+          /* 
+           * denormalized number 
+           */
+
+          /* keep sign, zero exponent */
+          dest[0] = source[3] & 0x80;
+
+          shft = 3 - exp;
+
+          /* shift original mant by 1 or 2 to get denormalized mant */
+          /* prefix mantissa with '1'b or '01'b as appropriate */
+          dest[1] = (uint8)((source[2] & 0x7f) >> shft) | (uint8)(0x10 << exp);
+          dest[2] = (uint8)(source[2] << (8-shft)) | (uint8)(source[1] >> shft);
+          dest[3] = (uint8)(source[1] << (8-shft)) | (uint8)(source[0] >> shft);
+      }
+      else {
+          /* 
+           * sign=1 -> infinity or NaN 
+           */
+          
+          dest[0] = 0xff;                /* set exp to 255 */
+          /* copy mantissa */
+          dest[1] = source[2] | (uint8)0x80;  /* LSB of exp = 1 */
+          dest[2] = source[1];
+          dest[3] = source[0];
+      }
+      
+      source += source_stride;
+      dest   += dest_stride;
+  }
+  
+  return 0;
+
+}
+
+/************************************************************/
+/* DFKlci8f()                                                */
+/* --> Import routine for 8 byte CONVEX floats              */
+/************************************************************/
+int
+DFKlci8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[8];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKci8f";
+    intn        exp;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 8;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+          /* extract exponent */
+          exp = (source[7] << 1) | (source[6] >> 4);
+          if (exp)
+            {
+                /*
+                 * non-zero exponent
+                 */
+
+                /* copy mantissa, sign and first bits of exponent */
+                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[0] = source[7];
+                if (exp < 2046)
+                  {
+                      /* normal value */
+                      dest[1] = source[6] + 0x20;   /* add two to exp */
+                      if (dest[1] < 0x20)
+                          dest[0] += 1;     /* carry */
+                  }
+                else
+                  {
+                      /* infinity or NaN */
+                      if (exp == 2046)  /* unrepresentable - OFL */
+                          /* set mant = 0 for overflow */
+                          dest[0] = dest[1] = dest[2] = dest[3] = 0;
+                      dest[0] = 0x80;   /* sign=1 exp=0 -> OFL or NaN */
+                      dest[1] &= 0x0f;  /* set last bit of exp to 0 */
+                  }
+            }
+          else if (source[6] & 0x0C)
+            {   /* denormalized value */
+                int shft;
+
+                shft = (source[6] & 0x08) ? 1 : 2;  /* shift needed to normalize */
+                /* shift mantissa */
+                /* note last bit of exp set to 1 implicitly */
+                dest[1] = (uint8) (source[6] << shft) | (uint8) (source[5] >> (8 - shft));
+                dest[2] = (uint8) (source[5] << shft) | (uint8) (source[4] >> (8 - shft));
+                dest[3] = (uint8) (source[4] << shft) | (uint8) (source[3] >> (8 - shft));
+                dest[4] = (uint8) (source[3] << shft) | (uint8) (source[2] >> (8 - shft));
+                dest[5] = (uint8) (source[2] << shft) | (uint8) (source[1] >> (8 - shft));
+                dest[6] = (uint8) (source[1] << shft) | (uint8) (source[0] >> (8 - shft));
+                dest[7] = (uint8) (source[0] << shft);
+                dest[0] = (uint8) (source[7] & 0x80);   /* sign */
+                if (shft == 1)
+                  {     /* set exp to 2 */
+                      dest[1] |= 0x20;  /* set LSB of exp to 0 */
+                  }
+            }
+          else
+            {
+                dest[0] = dest[1] = dest[2] = dest[3] = 0;
+                dest[4] = dest[5] = dest[6] = dest[7] = 0;
+            }
+
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+
+}
+
+/************************************************************/
+/* DFKlco8f()                                                */
+/* --> Export routine for 8 byte CONVEX floats              */
+/************************************************************/
+int
+DFKlco8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+  int in_place = 0;                     /* Inplace must be detected */
+  uint32 i;            
+  uint8 buf[8];                          /* Inplace processing buffer */
+  uint8 * source = (uint8*)s;
+  uint8 * dest = (uint8*)d;
+  char *FUNC="DFKco8f";
+  intn  exp;
+
+  HEclear();
+
+  if(source == dest) 
+      in_place = TRUE;
+
+  if(num_elm == 0 || in_place){  /* No elements is an error as is in place*/
+    HERROR(DFE_BADCONV);
+    return FAIL;
+  }
+
+  if(source_stride == 0 && dest_stride == 0)
+      source_stride = dest_stride = 8;
+
+  for(i = 0; i < num_elm; i++) {
+      
+      /* extract exponent */
+      exp = (source[0] << 1) | (source[1] >> 4);
+
+      if(!exp && !source[7]) {
+          /* 
+           * zero value 
+           */
+          dest[0] = dest[1] = dest[2] = dest[3] = 0;
+          dest[4] = dest[5] = dest[6] = dest[7] = 0;
+      }
+      else if(exp > 2) {
+          /*
+           * Normal value
+           */
+          /* copy mantissa */
+          dest[0] = source[7];
+          dest[1] = source[6];
+          dest[2] = source[5];
+          dest[3] = source[4];
+          dest[4] = source[3];
+          dest[5] = source[2];
+          /* copy sign, MSBs of exponent */
+          dest[6] = source[1] - 0x20;   /* subtracts 2 from exponent */
+          dest[7] = source[0];
+	  if(dest[6]>=0xe0) dest[7]--;  /* borrow from next exp. byte */
+      }
+      else if(exp) {
+          intn shft;
+          /* 
+           * denormalized number 
+           */
+
+          /* keep sign, zero exponent */
+          dest[0] = source[7] & 0x80;
+
+          shft = 3 - exp;
+
+          /* shift original mant by 1 or 2 to get denormalized mant */
+          /* prefix mantissa with '1'b or '01'b as appropriate */
+          dest[1] = (uint8)((source[6] & 0x0f) >> shft) | (uint8)(0x02 << exp);
+          dest[2] = (uint8)(source[6] << (8-shft)) | (uint8)(source[5] >> shft);
+          dest[3] = (uint8)(source[5] << (8-shft)) | (uint8)(source[4] >> shft);
+          dest[4] = (uint8)(source[4] << (8-shft)) | (uint8)(source[3] >> shft);
+          dest[5] = (uint8)(source[3] << (8-shft)) | (uint8)(source[2] >> shft);
+          dest[6] = (uint8)(source[2] << (8-shft)) | (uint8)(source[1] >> shft);
+          dest[7] = (uint8)(source[1] << (8-shft)) | (uint8)(source[0] >> shft);
+      }
+      else {
+          /* 
+           * sign=1 -> infinity or NaN 
+           */
+          
+          dest[0] = 0xff;                /* set exp to 255 */
+          /* copy mantissa */
+          dest[1] = source[6] | (uint8)0xF0;  /* LSBs of exp = 1 */
+          dest[2] = source[5];
+          dest[3] = source[4];
+          dest[4] = source[3];
+          dest[5] = source[2];
+          dest[6] = source[1];
+          dest[7] = source[0];
+      }
+      
+      source += source_stride;
+      dest   += dest_stride;
+  }
+  
+  return 0;
+
+}
+
+#else
+
+int         convex_dummy;       /* prevent empty symbol table messages */
+
+#endif /* CONVEXNATIVE */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfkcray.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfkcray.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfkcray.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4445 @@
+/****************************************************************************
+ 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.27 $";
+#endif
+
+/* $Id: dfkcray.c,v 1.27 1998/03/05 16:38:53 pharten Exp $ */
+
+/*------------------------------------------------------------------
+ File:  dfkcray.c
+
+ Purpose:
+    Routines to support Cray conversion to and from HDF format
+
+ Invokes:
+
+ PRIVATE conversion functions:
+    Cray UNICOS
+    DFKui2i -  Unicos routine for importing 16 bit unsigned integers
+    DFKui2s -  Unicos routine for importing 16 bit signed integers
+    DFKuo2i -  Unicos routine for exporting 16 bit unsigned integers
+    DFKuo2s -  Unicos routine for exporting 16 bit signed integers
+    DFKui4i -  Unicos routine for importing 32 bit unsigned integers
+    DFKui4s -  Unicos routine for importing 32 bit signed integers
+    DFKuo4i -  Unicos routine for exporting 32 bit unsigned integers
+    DFKuo4s -  Unicos routine for exporting 32 bit signed integers
+    DFKui4f -  Unicos routine for importing 32 bit floats
+    DFKuo4f -  Unicos routine for exporting 32 bit floats
+    DFKui8f -  Unicos routine for importing 64 bit floats
+    DFKuo8f -  Unicos routine for exporting 64 bit floats
+    DFKlui2i-  Unicos routine for importing little-endian 16 bit unsigned ints
+    DFKlui2s-  Unicos routine for importing little-endian 16 bit signed ints
+    DFKluo2i-  Unicos routine for exporting little-endian 16 bit unsigned ints
+    DFKluo2s-  Unicos routine for exporting little-endian 16 bit signed ints
+    DFKlui4i-  Unicos routine for importing little-endian 32 bit unsigned ints
+    DFKlui4s-  Unicos routine for importing little-endian 32 bit signed ints
+    DFKluo4i-  Unicos routine for exporting little-endian 32 bit unsigned ints
+    DFKluo4s-  Unicos routine for exporting little-endian 32 bit signed ints
+    DFKlui4f-  Unicos routine for importing little-endian 32 bit floats
+    DFKluo4f-  Unicos routine for exporting little-endian 32 bit floats
+    DFKlui8f-  Unicos routine for importing little-endian 64 bit floats
+    DFKluo8f-  Unicos routine for exporting little-endian 64 bit floats
+
+    Cray MPP (T3D)
+    DFKmi2i -  CRAYMPP routine for importing 16 bit unsigned integers
+    DFKmi2s -  CRAYMPP routine for importing 16 bit signed integers
+    DFKmo2i -  CRAYMPP routine for exporting 16 bit unsigned integers
+    DFKmo2s -  CRAYMPP routine for exporting 16 bit signed integers
+    DFKlmi2i-  CRAYMPP routine for importing little-endian 16 bit unsigned ints
+    DFKlmi2s-  CRAYMPP routine for importing little-endian 16 bit signed ints
+    DFKlmo2i-  CRAYMPP routine for exporting little-endian 16 bit unsigned ints
+    DFKlmo2s-  CRAYMPP routine for exporting little-endian 16 bit signed ints
+
+ 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 THE UNICOS OPERATING SYSTEM                */
+/* Parameter dest_stride is used because source buffer and dest buffer will  */
+/* be different sizes for all data types except char.                        */
+/*****************************************************************************/
+
+#if defined(UNICOS)
+
+#define BITOFF 58
+#define NOINTCRAY2IEG
+/* #define NOFLOATCRAY2IEG */
+
+/* When on a Cray T90, if _CRAYIEEE is not defined, floating point numbers    */
+/* are in CRAY format.  Cray Research supplies the routines IEG2CRAY() and    */
+/* CRAY2IEG() to convert numbers from 32-bit IEEE format to CRAY format.      */
+/* These routines are used throughout the local conversion routines.          */
+
+/* If _CRAYIEEE is defined, Cray floating point numbers are in IEEE format.   */
+/* Cray Research no longer supplies the routines IEG2CRAY/CRAY2IEG.  Instead, */
+/* these function calls are replaced by the macro calls to IEG2CRAY/CRAY2IEG2 */
+/* defined below.  The macro call replaces the Cray format conversion routine */
+/* call with those supplied by Cray Research IEG2CRI/CRI2IEG for the T90-IEEE */
+/* format.                                                                    */
+
+/* On the Cray T90 there are man-pages availabe for IEG2CRAY/CRAY2IEG, and on */
+/* the Cray T90-IEEE there are man-pages available for IEG2CRI/CRI2IEG.       */
+
+/* Steven G. Johnson(stevenj at alum.mit.edu) of the Joannopoulous Group,        */
+/* Condensed Matter Theory, MIT Physics Department gets credit for the effort */
+/* spent and ideas enclosed within the #ifdef _CRAYIEEE block of code.        */
+/* A few comments were added to futher describe local situations.             */
+
+#ifdef _CRAYIEEE /* IEEE T90 */
+
+#undef DUFF_luo4i  /* there is a weird Heisenbug in this code */
+
+/* Currently, CRI2IEG has a bug when converting 64-bit ints into 16-bit ints. */
+#define BUGGY_CRI2IEG
+
+/* This function get_correct_cri_type() is used to translate from parameters  */
+/* used in CRAY2IEG/IEG2CRAY conversion routines to parameters used in new    */
+/* CRI2IEG/IEG2CRI conversion routines.                                       */
+
+static void get_correct_cri_type(int *type, int *newtype, int *forlen)
+{
+	switch (*type) {
+		case 1:
+			*newtype = 2;
+			*forlen = 4 * 8;
+			break;
+		case 2:
+			*newtype = 3;
+			*forlen = 4 * 8;
+			break;
+		case 7:
+			*newtype = 2;
+			*forlen = 2 * 8;
+			break;
+		case 8:
+			*newtype = 3;
+			*forlen = 8 * 8;
+			break;
+		default:
+			*newtype = -1;
+			*forlen = -1;
+			break;
+	}
+}
+
+/* The macros have a zero value set after the last parenthesis enclosing the  */
+/* list of arguments.  Since the macros are taking the place of functions of  */
+/* the form ierr = IEG2CRAY(), it is my interpretation that this zero value   */
+/* is an initial value for ierr.  ierr is reset to a real value 3 lines later.*/
+
+#define IEG2CRAY(type_p, num_p, for_p, bitoff_p, nat_p) 0; \
+{	\
+	int cri2ieg_type, natlen = 8*8, forlen, stride = 1; \
+	get_correct_cri_type(type_p, &cri2ieg_type, &forlen); \
+	ierr = IEG2CRI(&cri2ieg_type, num_p, for_p, bitoff_p, nat_p, &stride, &natlen, &forlen); \
+}
+
+#ifndef BUGGY_CRI2IEG
+
+#define CRAY2IEG(type_p, num_p, for_p, bitoff_p, nat_p) 0; \
+{	\
+	int cri2ieg_type, natlen = 8*8, forlen, stride = 1; \
+	get_correct_cri_type(type_p, &cri2ieg_type, &forlen); \
+	ierr = CRI2IEG(&cri2ieg_type, num_p, for_p, bitoff_p, nat_p, &stride, &natlen, &forlen); \
+}
+
+#else /* BUGGY_CRI2IEG */
+
+
+/* It was found by Steven G. Johnson that the CRI2IEG() routine has bugs in.  */
+/* In particular the part of the routine which converts from 64-bit Cray int  */
+/* into 16-bit integer.  So he wrote a routine which would do just that.  It  */
+/* is used if the BUGGY_CRI2IEG switch is defined.                            */
+
+static void my_convert_64_to_16(int n, int *source, char *dest)
+{
+	int i;
+	for (i = 0; i < n; ++i) {
+		dest[0] = (char) (((*source) >> 8) & 0xFF);
+		dest[1] = (char) ((*source) & 0xFF);
+		dest += 2;
+		++source;
+	}
+}
+
+#define CRAY2IEG(type_p, num_p, for_p, bitoff_p, nat_p) 0; \
+{	\
+	int cri2ieg_type, natlen = 8*8, forlen, stride = 1; \
+	if (*(type_p) == 7) \
+		my_convert_64_to_16(*(num_p),(int*)(nat_p),(char*)(for_p)); \
+	else { \
+		get_correct_cri_type(type_p, &cri2ieg_type, &forlen); \
+		ierr = CRI2IEG(&cri2ieg_type, num_p, for_p, bitoff_p, nat_p, &stride, &natlen, &forlen); \
+	} \
+}
+
+#endif /* BUGGY_CRI2IEG */
+
+#else /* Not IEEE T90 */
+
+#define NOSTRIDEFLOATCRAY2IEG
+
+#endif /* Not IEEE T90 */
+
+
+PRIVATE VOID DFKswap
+            (VOIDP s, VOIDP d, uintn elem_size, uintn num_elem);
+
+#define SWAP_MASKA  0xffffffff00000000
+#define SWAP_MASKB  0x00000000ffffffff
+#define SWAP_MASKC  0xffff0000ffff0000
+#define SWAP_MASKD  0x0000ffff0000ffff
+#define SWAP_MASKE  0xff00ff00ff00ff00
+#define SWAP_MASKF  0x00ff00ff00ff00ff
+
+/************************************************************/
+/* DFKswap()                                                */
+/* -->Swap groups of 'n' bytes                              */
+/*  !NOTE!: This routine does not handle overlapping memory */
+/*              blocks properly, but that condition should  */
+/*              be caught by the converion routines...      */
+/*          Also, there in no provision for source or       */
+/*          destination strides other than 1.               */
+/************************************************************/
+PRIVATE     VOID
+DFKswap(VOIDP s, VOIDP d, uintn elem_size, uintn num_elem)
+{
+    uintn i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    unsigned long *lp_dest, *lp_src;
+    intn        odd_man_out;
+    uintn       n;
+    char       *FUNC = "DFKswap";
+
+    switch (elem_size)
+      {
+          case 2:   /* 2 byte elements */
+              odd_man_out = num_elem % 4;   /* check for odd number of elem. */
+              n = num_elem / 4;
+              for (i = 0, lp_src = (unsigned long *) source, lp_dest = (unsigned long *) dest; i < n; i++, lp_dest++, lp_src++)
+                {
+                    *lp_dest = ((*lp_src & SWAP_MASKE) >> 8) |
+                        ((*lp_src & SWAP_MASKF) << 8);
+                }   /* end for */
+              if (odd_man_out)
+                {
+                    source = (uint8 *) lp_src;
+                    dest = (uint8 *) lp_dest;
+                    switch (odd_man_out)
+                      {
+                          case 3:
+                              dest[0] = source[1];
+                              dest[1] = source[0];
+                              dest[2] = source[3];
+                              dest[3] = source[2];
+                              dest[4] = source[5];
+                              dest[5] = source[4];
+                              break;
+
+                          case 2:
+                              dest[0] = source[1];
+                              dest[1] = source[0];
+                              dest[2] = source[3];
+                              dest[3] = source[2];
+                              break;
+
+                          case 1:
+                              dest[0] = source[1];
+                              dest[1] = source[0];
+                              break;
+
+                      }     /* end switch */
+                }   /* end if */
+              break;
+
+          case 4:   /* 4 byte elements */
+              odd_man_out = num_elem % 2;   /* check for odd number of elem. */
+              n = num_elem / 2;
+              for (i = 0, lp_src = (unsigned long *) source, lp_dest = (unsigned long *) dest; i < n; i++, lp_dest++, lp_src++)
+                {
+                    *lp_dest = ((*lp_src & SWAP_MASKC) >> 16) |
+                        ((*lp_src & SWAP_MASKD) << 16);
+                    *lp_dest = ((*lp_dest & SWAP_MASKE) >> 8) |
+                        ((*lp_dest & SWAP_MASKF) << 8);
+                }   /* end for */
+              if (odd_man_out)
+                {
+                    source = (uint8 *) lp_src;
+                    dest = (uint8 *) lp_dest;
+                    dest[0] = source[3];
+                    dest[1] = source[2];
+                    dest[2] = source[1];
+                    dest[3] = source[0];
+                }   /* end if */
+              break;
+
+          case 8:   /* 8 byte elements */
+              for (i = 0, lp_src = (unsigned long *) source, lp_dest = (unsigned long *) dest; i < num_elem; i++, lp_dest++, lp_src++)
+                {
+                    *lp_dest = ((*lp_src & SWAP_MASKA) >> 32) |
+                        ((*lp_src & SWAP_MASKB) << 32);
+                    *lp_dest = ((*lp_dest & SWAP_MASKC) >> 16) |
+                        ((*lp_dest & SWAP_MASKD) << 16);
+                    *lp_dest = ((*lp_dest & SWAP_MASKE) >> 8) |
+                        ((*lp_dest & SWAP_MASKF) << 8);
+                }   /* end for */
+              break;
+      }     /* end switch */
+}   /* end DFKswap() */
+
+#define UI2I_MASKA  0xffff000000000000
+#define UI2I_MASKB  0x0000ffff00000000
+#define UI2I_MASKC  0x00000000ffff0000
+#define UI2I_MASKD  0x000000000000ffff
+
+/************************************************************/
+/* DFKui2i()                                                */
+/* -->Unicos routine for importing 2 byte data items        */
+/* (**) This routine converts two byte IEEE to eight byte   */
+/*      Cray big endian integer.                            */
+/************************************************************/
+int
+DFKui2i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    uint32 i;
+    int         fast_processing = 0;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lptr_dest = (long *) dest;
+    long       *lp_dest;
+    unsigned long *lp_src;
+    char       *FUNC = "DFKui2i";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 7;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements is an error */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+#ifdef DOESNT_WORK
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, source, &bitoff, dest);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#else
+#ifndef DUFF_ui2i
+#if defined TEST2_ui2i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 4;
+
+          n = num_elm / 4;
+          lp_dest = (long *) dest;
+          lp_src = (unsigned long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));
+          for (i = 0; i < n; i++)
+            {
+                lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                lp_dest += 4;
+                lp_src++;
+            }   /* end for */
+          switch (odd_man_out)
+            {
+                case 3:
+                    lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                    lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                    lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                    break;
+
+                case 2:
+                    lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                    lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                    break;
+
+                case 1:
+                    lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                    break;
+
+                default:
+                    break;
+            }   /* end switch */
+#elif defined TEST1_ui2i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 4;
+
+          n = num_elm / 4;
+          lp_dest = (long *) dest;
+          lp_src = (unsigned long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));
+          for (i = 0; i < n; i++)
+            {
+                *lp_dest++ = (lp_src[0] & UI2I_MASKA) >> 48;
+                *lp_dest++ = (lp_src[0] & UI2I_MASKB) >> 32;
+                *lp_dest++ = (lp_src[0] & UI2I_MASKC) >> 16;
+                *lp_dest++ = lp_src[0] & UI2I_MASKD;
+                lp_src++;
+            }   /* end for */
+          switch (odd_man_out)
+            {
+                case 3:
+                    *lp_dest++ = (lp_src[0] & UI2I_MASKA) >> 48;
+                    *lp_dest++ = (lp_src[0] & UI2I_MASKB) >> 32;
+                    *lp_dest++ = (lp_src[0] & UI2I_MASKC) >> 16;
+                    break;
+
+                case 2:
+                    *lp_dest++ = (lp_src[0] & UI2I_MASKA) >> 48;
+                    *lp_dest++ = (lp_src[0] & UI2I_MASKB) >> 32;
+                    break;
+
+                case 1:
+                    *lp_dest++ = (lp_src[0] & UI2I_MASKA) >> 48;
+                    break;
+
+                default:
+                    break;
+            }   /* end switch */
+#else
+          for (i = 0; i < num_elm; i++)
+            {
+                lptr_dest[0] = 0x0000000000000000;
+                dest[6] = source[0];
+                dest[7] = source[1];
+                source += 2;
+                lptr_dest++;
+                dest = (uint8 *) lptr_dest;
+            }
+#endif
+#else  /* DUFF_ui2i */
+          uintn       n;
+          int         odd_man_out;  /* By default there are even num_elm */
+          uintn       orig_num_elm = num_elm;
+
+          lp_dest = (long *) dest;
+          lp_src = (unsigned long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));
+
+          odd_man_out = num_elm % 4;
+
+          num_elm /= 4;
+          n = (num_elm + 7) / 8;
+          if (orig_num_elm > 3)
+              switch (num_elm % 8)
+                {
+                    case 0:
+                        do
+                          {
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+#ifdef QAK
+                    case 15:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 14:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 13:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 12:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 11:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 10:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 9:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 8:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+#endif
+                    case 7:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 6:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 5:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 4:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 3:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 2:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                    case 1:
+                              lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                              lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                              lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                              lp_dest[3] = lp_src[0] & UI2I_MASKD;
+                              lp_dest += 4;
+                              lp_src++;
+                          }
+                        while (--n > 0);
+                }
+          switch (odd_man_out)
+            {
+                case 3:
+                    lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                    lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                    lp_dest[2] = (lp_src[0] & UI2I_MASKC) >> 16;
+                    break;
+
+                case 2:
+                    lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                    lp_dest[1] = (lp_src[0] & UI2I_MASKB) >> 32;
+                    break;
+
+                case 1:
+                    lp_dest[0] = (lp_src[0] & UI2I_MASKA) >> 48;
+                    break;
+
+                default:
+                    break;
+            }   /* end switch */
+#endif /* DUFF_ui2i */
+#endif
+      }     /* end if */
+    else
+      {     /* Generic stride processing */
+          for (i = 0; i < num_elm; i++)
+            {
+#ifdef NOINTCRAY2IEG
+                dest[0] = 0x00;
+                dest[1] = 0x00;
+                dest[2] = 0x00;
+                dest[3] = 0x00;
+                dest[4] = 0x00;
+                dest[5] = 0x00;
+                dest[6] = source[0];
+                dest[7] = source[1];
+#else
+                bitoff = ((unsigned int)source) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, source, &bitoff, dest);
+                if (ierr != 0)
+                    HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+#endif
+                source += source_stride;
+                dest += dest_stride;
+            }
+      }     /* end if */
+    return (SUCCEED);
+}
+
+#define UI2S_MASKA  0xffff000000000000
+#define UI2S_MASKB  0x0000ffff00000000
+#define UI2S_MASKC  0x00000000ffff0000
+#define UI2S_MASKD  0x000000000000ffff
+#define UI2S_MASKE  0x8000000000000000
+#define UI2S_MASKF  0x0000800000000000
+#define UI2S_MASKG  0x0000000080000000
+#define UI2S_MASKH  0x0000000000008000
+#define UI2S_MASKI  0xffffffffffff0000
+
+/************************************************************/
+/* DFKui2s()                                                */
+/* -->Unicos routine for importing 2 byte signed ints       */
+/* (**) This routine converts two byte IEEE to eight byte   */
+/*      Cray.                                               */
+/************************************************************/
+int
+DFKui2s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    uint32 i;
+    int         fast_processing = 0;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lptr_dest = (long *) dest;
+    long       *lp_dest;
+    unsigned long *lp_src;
+    char       *FUNC = "DFKui2s";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 7;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, source, &bitoff, dest);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+      {     /* Generic stride processing */
+          for (i = 0; i < num_elm; i++)
+            {
+#ifdef NOINTCRAY2IEG
+                if ((source[0] & 0x80))
+                  {     /* Can't forget to extend sign */
+                      dest[0] = 0xff;
+                      dest[1] = 0xff;
+                      dest[2] = 0xff;
+                      dest[3] = 0xff;
+                      dest[4] = 0xff;
+                      dest[5] = 0xff;
+                  }     /* end if */
+                else
+                  {
+                      dest[0] = 0x00;
+                      dest[1] = 0x00;
+                      dest[2] = 0x00;
+                      dest[3] = 0x00;
+                      dest[4] = 0x00;
+                      dest[5] = 0x00;
+                  }     /* end else */
+                dest[6] = source[0];
+                dest[7] = source[1];
+#else
+                bitoff = ((unsigned int)source) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, source, &bitoff, dest);
+                if (ierr != 0)
+                    HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+#endif
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+      }     /* end if */
+    return (SUCCEED);
+}
+
+#define UO2I_MASK 0x000000000000ffff
+
+/************************************************************/
+/* DFKuo2i()                                                */
+/* -->Unicos routine for exporting 2 byte data items        */
+/************************************************************/
+int
+DFKuo2i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    uintn i;
+    int         fast_processing = 0;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKuo2i";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 7;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+#ifdef DOESNT_WORK
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, dest, &bitoff, source);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#else
+#ifndef DUFF_uo2i
+#if defined TEST1_uo2i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 4;
+
+          n = num_elm / 4;
+          lp_dest = (long *) dest;
+          lp_src = (long *) source;
+          for (i = 0; i < n; i++)
+            {
+                *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                    ((lp_src[1] & UO2I_MASK) << 32) |
+                    ((lp_src[2] & UO2I_MASK) << 16) |
+                    (lp_src[3] & UO2I_MASK);
+                lp_src += 4;
+            }
+          switch (odd_man_out)
+            {   /* clean up leftovers */
+                case 3:
+                    *lp_dest = ((lp_src[0] & UO2I_MASK) << 48) |
+                        ((lp_src[1] & UO2I_MASK) << 32) |
+                        ((lp_src[2] & UO2I_MASK) << 16);
+                    break;
+
+                case 2:
+                    *lp_dest = ((lp_src[0] & UO2I_MASK) << 48) |
+                        ((lp_src[1] & UO2I_MASK) << 32);
+                    break;
+
+                case 1:
+                    *lp_dest = (lp_src[0] & UO2I_MASK) << 48;
+                    break;
+
+                default:
+                    break;
+            }   /* end switch */
+#else
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = source[6];
+                dest[1] = source[7];
+                dest += 2;
+                source += 8;
+            }
+#endif
+#else  /* DUFF_uo2i */
+          uintn       n;
+          int         odd_man_out;  /* By default there are even num_elm */
+          uintn       orig_num_elm = num_elm;
+
+          odd_man_out = num_elm % 4;
+
+          num_elm /= 4;
+          n = (num_elm + 7) / 8;
+          lp_dest = (long *) dest;
+          lp_src = (long *) source;
+          if (orig_num_elm > 3)
+              switch (num_elm % 8)
+                {
+                    case 0:
+                        do
+                          {
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+#ifdef QAK
+                    case 15:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 14:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 13:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 12:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 11:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 10:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 9:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 8:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+#endif
+                    case 7:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 6:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 5:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 4:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 3:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 2:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                    case 1:
+                              *lp_dest++ = ((lp_src[0] & UO2I_MASK) << 48) |
+                                  ((lp_src[1] & UO2I_MASK) << 32) |
+                                  ((lp_src[2] & UO2I_MASK) << 16) |
+                                  (lp_src[3] & UO2I_MASK);
+                              lp_src += 4;
+                          }
+                        while (--n > 0);
+                }
+
+          switch (odd_man_out)
+            {   /* clean up leftovers */
+                case 3:
+                    *lp_dest = ((lp_src[0] & UO2I_MASK) << 48) |
+                        ((lp_src[1] & UO2I_MASK) << 32) |
+                        ((lp_src[2] & UO2I_MASK) << 16);
+                    break;
+
+                case 2:
+                    *lp_dest = ((lp_src[0] & UO2I_MASK) << 48) |
+                        ((lp_src[1] & UO2I_MASK) << 32);
+                    break;
+
+                case 1:
+                    *lp_dest = (lp_src[0] & UO2I_MASK) << 48;
+                    break;
+
+                default:
+                    break;
+            }   /* end switch */
+#endif /* DUFF_uo2i */
+#endif
+      }     /* end if */
+    else
+      {     /* Generic Stride processing */
+          for (i = 0; i < num_elm; i++)
+            {
+#ifdef NOINTCRAY2IEG
+                dest[0] = source[6];
+                dest[1] = source[7];
+#else
+                bitoff = ((unsigned int)dest) >> BITOFF;
+                ierr = CRAY2IEG(&type, &n_elem, dest, &bitoff, source);
+                if (ierr != 0)
+                    HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+#endif
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define UO2S_MASK 0x000000000000ffff
+
+/************************************************************/
+/* DFKuo2s()                                                */
+/* -->Unicos routine for exporting signed 2 byte data items */
+/************************************************************/
+int
+DFKuo2s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    uintn i;
+    int         fast_processing = 0;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKuo2s";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 7;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, dest, &bitoff, source);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+      {     /* Generic Stride processing */
+          for (i = 0; i < num_elm; i++)
+            {
+#ifdef NOINTCRAY2IEG
+                dest[0] = source[6];
+                dest[1] = source[7];
+#else
+                bitoff = ((unsigned int)dest) >> BITOFF;
+                ierr = CRAY2IEG(&type, &n_elem, dest, &bitoff, source);
+                if (ierr != 0)
+                    HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+#endif
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define UI4I_MASKA 0xffffffff00000000
+#define UI4I_MASKB 0x00000000ffffffff
+
+/************************************************************/
+/* DFKui4i()                                                */
+/* -->Unicos routine for importing 4 byte unsigned ints     */
+/************************************************************/
+int
+DFKui4i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;
+    uint32 i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lptr_dest = (long *) dest;
+    long       *lp_dest;
+    unsigned long *lp_src;
+    char       *FUNC = "DFKui4i";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 1;       /* type of conversion to perform 1=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+#ifdef DOESNT_WORK
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, source, &bitoff, dest);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#else
+#ifndef DUFF_ui4i
+#if defined TEST2_ui4i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 2;
+
+          n = num_elm / 2;
+          lp_dest = (long *) dest;
+          lp_src = (unsigned long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));     /* initialize to zeros */
+          for (i = 0; i < n; i++)
+            {
+                lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                lp_dest += 2;
+                lp_src++;
+            }   /* end for */
+          if (odd_man_out)
+              *lp_dest = (lp_src[0] & UI4I_MASKA) >> 32;
+#elif defined TEST1_ui4i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 2;
+
+          n = num_elm / 2;
+          lp_dest = (long *) dest;
+          lp_src = (unsigned long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));     /* initialize to zeros */
+          for (i = 0; i < n; i++)
+            {
+                *lp_dest++ = (lp_src[0] & UI4I_MASKA) >> 32;
+                *lp_dest++ = lp_src[0] & UI4I_MASKB;
+                lp_src++;
+            }   /* end for */
+          if (odd_man_out)
+              *lp_dest++ = (lp_src[0] & UI4I_MASKA) >> 32;
+#else
+          for (i = 0; i < num_elm; i++)
+            {
+                lptr_dest[0] = 0;
+                dest[4] = source[0];
+                dest[5] = source[1];
+                dest[6] = source[2];
+                dest[7] = source[3];
+                source += 4;
+                lptr_dest++;
+                dest = (uint8 *) lptr_dest;
+            }   /* end for */
+#endif
+#else  /* DUFF_ui4i */
+          uintn       n;
+          int         odd_man_out;  /* By default there are even num_elm */
+          uintn       orig_num_elm = num_elm;
+
+          lp_dest = (long *) dest;
+          lp_src = (unsigned long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));     /* initialize to zeros */
+
+          odd_man_out = num_elm % 2;
+
+          num_elm /= 2;
+          n = (num_elm + 7) / 8;
+          if (orig_num_elm > 1)
+              switch (num_elm % 8)
+                {
+                    case 0:
+                        do
+                          {
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+#ifdef QAK
+                    case 15:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 14:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 13:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 12:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 11:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 10:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 9:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 8:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+#endif
+                    case 7:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 6:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 5:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 4:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 3:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 2:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                    case 1:
+                              lp_dest[0] = (lp_src[0] & UI4I_MASKA) >> 32;
+                              lp_dest[1] = lp_src[0] & UI4I_MASKB;
+                              lp_dest += 2;
+                              lp_src++;
+                          }
+                        while (--n > 0);
+                }
+          if (odd_man_out)
+              *lp_dest = (lp_src[0] & UI4I_MASKA) >> 32;
+#endif /* DUFF_ui4i */
+#endif
+      }     /* end if */
+    else
+      {
+          for (i = 0; i < num_elm; i++)
+            {
+#ifdef NOINTCRAY2IEG
+                dest[0] = 0;
+                dest[1] = 0;
+                dest[2] = 0;
+                dest[3] = 0;
+                dest[4] = source[0];
+                dest[5] = source[1];
+                dest[6] = source[2];
+                dest[7] = source[3];
+#else
+                bitoff = ((unsigned int)source) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, source, &bitoff, dest);
+                if (ierr != 0)
+                    HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+#endif
+                dest += dest_stride;
+                source += source_stride;
+            }   /* end for */
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define UI4S_MASKA 0xffffffff00000000
+#define UI4S_MASKB 0x00000000ffffffff
+#define UI4S_MASKC 0x8000000000000000
+#define UI4S_MASKD 0x0000000080000000
+#define UI4S_MASKE 0xffffffff00000000
+
+/************************************************************/
+/* DFKui4s()                                                */
+/* -->Unicos routine for importing 4 signed ints            */
+/************************************************************/
+int
+DFKui4s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;
+    uint32 i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lptr_dest = (long *) dest;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKui4s";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 1;       /* type of conversion to perform 1=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, source, &bitoff, dest);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+#ifdef NOINTCRAY2IEG
+              if (source[0] & 0x80)
+                {   /* Can't forget to sign extend */
+                    dest[0] = 0xff;
+                    dest[1] = 0xff;
+                    dest[2] = 0xff;
+                    dest[3] = 0xff;
+                }   /* end if */
+              else
+                {
+                    dest[0] = 0;
+                    dest[1] = 0;
+                    dest[2] = 0;
+                    dest[3] = 0;
+                }   /* end else */
+              dest[4] = source[0];
+              dest[5] = source[1];
+              dest[6] = source[2];
+              dest[7] = source[3];
+#else
+              bitoff = ((unsigned int)source) >> BITOFF;
+              ierr = IEG2CRAY(&type, &n_elem, source, &bitoff, dest);
+              if (ierr != 0)
+                  HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#endif
+              dest += dest_stride;
+              source += source_stride;
+          }     /* end for */
+    return (SUCCEED);
+}
+
+#define UO4I_MASK 0x00000000ffffffff
+
+/************************************************************/
+/* DFKuo4i()                                                */
+/* -->Unicos routine for exporting 4 byte data items        */
+/************************************************************/
+
+int
+DFKuo4i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;
+    uintn i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKuo4i";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 1;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+#ifdef DOESNT_WORK
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, dest, &bitoff, source);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#else
+#ifndef DUFF_uo4i
+#if defined TEST1_uo4i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 2;
+
+          n = num_elm / 2;
+          lp_dest = (long *) dest;
+          lp_src = (long *) source;
+          for (i = 0; i < n; i++)
+            {
+                *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                lp_src += 2;
+            }
+          if (odd_man_out)
+              *lp_dest = (lp_src[0] & UO4I_MASK) << 32;
+#else
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = source[4];
+                dest[1] = source[5];
+                dest[2] = source[6];
+                dest[3] = source[7];
+                dest += 4;
+                source += 8;
+            }
+#endif
+#else  /* DUFF_uo4i */
+          uintn       n;
+          int         odd_man_out;  /* By default there are even num_elm */
+          uintn       orig_num_elm = num_elm;
+
+          odd_man_out = num_elm % 2;
+
+          num_elm /= 2;
+          n = (num_elm + 7) / 8;
+          lp_dest = (long *) dest;
+          lp_src = (long *) source;
+
+          if (orig_num_elm > 1)
+              switch (num_elm % 8)
+                {
+                    case 0:
+                        do
+                          {
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+#ifdef QAK
+                    case 15:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 14:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 13:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 12:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 11:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 10:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 9:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 8:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+#endif
+                    case 7:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 6:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 5:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 4:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 3:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 2:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                    case 1:
+                              *lp_dest++ = ((lp_src[0] & UO4I_MASK) << 32) | (lp_src[1] & UO4I_MASK);
+                              lp_src += 2;
+                          }
+                        while (--n > 0);
+                }
+          if (odd_man_out)
+              *lp_dest++ = (lp_src[0] & UO4I_MASK) << 32;
+
+#endif /* DUFF_uo4i */
+#endif
+      }     /* end if */
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+#ifdef NOINTCRAY2IEG
+              dest[0] = source[4];
+              dest[1] = source[5];
+              dest[2] = source[6];
+              dest[3] = source[7];
+#else
+              bitoff = ((unsigned int)dest) >> BITOFF;
+              ierr = CRAY2IEG(&type, &n_elem, dest, &bitoff, source);
+              if (ierr != 0)
+                  HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#endif
+              dest += dest_stride;
+              source += source_stride;
+          }     /* end for */
+    return (SUCCEED);
+}
+
+#define UO4S_MASK 0x00000000ffffffff
+
+/************************************************************/
+/* DFKuo4s()                                                */
+/* -->Unicos routine for exporting signed 4 byte data items */
+/************************************************************/
+int
+DFKuo4s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;
+    uintn i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKuo4s";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 1;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, dest, &bitoff, source);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+#ifdef NOINTCRAY2IEG
+              dest[0] = source[4];
+              dest[1] = source[5];
+              dest[2] = source[6];
+              dest[3] = source[7];
+#else
+              bitoff = ((unsigned int)dest) >> BITOFF;
+              ierr = CRAY2IEG(&type, &n_elem, dest, &bitoff, source);
+              if (ierr != 0)
+                  HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#endif
+              dest += dest_stride;
+              source += source_stride;
+          }     /* end for */
+    return (SUCCEED);
+}
+
+#define UI4F_MASKA 0x8000000000000000
+#define UI4F_MASKB 0x7f80000000000000
+#define UI4F_MASKC 0x007fffff00000000
+#define UI4F_MASKD 0x0000800000000000
+#define UI4F_MASKE 0x0000000080000000
+#define UI4F_MASKF 0x000000007f800000
+#define UI4F_MASKG 0x00000000007fffff
+#define UI4F_MASKH 0x0000000000008000
+#define UI4F_MASKI 0x7fffffff00000000
+#define UI4F_MASKJ 0x000000007fffffff
+
+/************************************************************/
+/* DFKui4f()                                                */
+/* -->Unicos routine for importing 32 bit floats            */
+/************************************************************/
+
+/************************************************************
+
+                     <<<< WARNING >>>>
+
+    The nature of converting between 64 bit floating point
+  numbers and 32 bit floating point numbers LOSES PRECISION.
+  Taking a number in 64bit cray format, converting to IEEE
+  (internal HDF format) and back will round the number at
+  about the 7th decimal place.
+
+ ************************************************************/
+
+int
+DFKui4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* By default not array processed */
+    int         odd_man_out = 0;    /* By default there are even num_elm */
+    int         i, j, n;
+    long        buf1;           /* This is a temporary stride buf */
+    long        buf2;           /* This is a temporary stride buf */
+    uint8      *dud1 = (uint8 *) &buf1;     /* Dummy pointer to buf1 for strides */
+    uint8      *dud2 = (uint8 *) &buf2;     /* Dummy pointer to buf2 for strides */
+    uint8      *source = (uint8 *) s;   /* Cray does not like certain   */
+    uint8      *dest = (uint8 *) d;     /* void and void* constructions */
+    long       *lptr_src = (long *) source;
+    long       *lptr_dest = (long *) dest;
+    char       *FUNC = "DFKui4f";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 2;       /* type of conversion to perform 2=32-bit float */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    /* Check for conversion errors */
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* under UNICOS */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, source, &bitoff, dest);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+      {     /* We end up here if we are doing stride based processing */
+#ifdef NOSTRIDEFLOATCRAY2IEG
+          buf1 = 0;
+          for (i = 0; i < num_elm; i++)
+            {
+                dud1[0] = source[0];    /* Loop would be less efficient */
+                dud1[1] = source[1];
+                dud1[2] = source[2];
+                dud1[3] = source[3];
+
+                if ((float) buf1 != 0)
+                  {
+                      buf2 = (((buf1 & UI4F_MASKA) | ((buf1 & UI4F_MASKB) >> 7) +
+                               (16258 << 48)) |
+                              (((buf1 & UI4F_MASKC) >> 8) | (UI4F_MASKD)));
+                      if ((buf1 << 1) == 0)
+                          buf2 = 0;
+                  }     /* end if */
+                else
+                    buf2 = buf1;
+
+                dest[0] = dud2[0];  /* Loop would be less efficient */
+                dest[1] = dud2[1];
+                dest[2] = dud2[2];
+                dest[3] = dud2[3];
+                dest[4] = dud2[4];
+                dest[5] = dud2[5];
+                dest[6] = dud2[6];
+                dest[7] = dud2[7];
+
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          uint8       tmp_dst[8];
+          float32     tmp_src;
+
+          for (i = 0; i < num_elm; i++)
+            {
+                HDmemcpy(&tmp_src, source, sizeof(float32));
+                bitoff = ((unsigned int)&tmp_src) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, &tmp_src, &bitoff, tmp_dst);
+                if (ierr != 0)
+                    HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+                HDmemcpy(dest, tmp_dst, 8);
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define UO4F_MASKA 0x8000000000000000
+#define UO4F_MASKB 0x7fff000000000000
+#define UO4F_MASKC 0x00007fffff000000
+#define UO4F_MASKD 0x0000000000800000
+#define UO4F_MASKE 0xffffffff00000000
+
+/************************************************************/
+/* DFKuo4f()                                                */
+/* -->Unicos routine for exporting 32 bit floats            */
+/************************************************************/
+
+/************************************************************
+
+                     <<<< WARNING >>>>
+
+    The nature of converting between 64 bit floating point
+  numbers and 32 bit floating point numbers LOSES PRECISION.
+  Taking a number in 64bit cray format, converting to IEEE
+  (internal HDF format) and back will round the number at
+  about the 7th decimal place.
+
+ ************************************************************/
+
+int
+DFKuo4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* By default not array processed */
+    int         odd_man_out = 0;    /* By default there are even num_elm */
+    int         i, j, n;
+    long        buf1;           /* This is a temporary stride buf */
+    long        buf2;           /* This is a temporary stride buf */
+    uint8      *dud1 = (uint8 *) &buf1;     /* Dummy pointer to buf1 for strides */
+    uint8      *dud2 = (uint8 *) &buf2;     /* Dummy pointer to buf2 for strides */
+    uint8      *source = (uint8 *) s;   /* Cray does not like certain   */
+    uint8      *dest = (uint8 *) d;     /* void and void* constructions */
+    long       *lptr_src = (long *) source;
+    long       *lptr_dest = (long *) dest;
+    char       *FUNC = "DFKuo4f";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 2;       /* type of conversion to perform 2=32-bit float */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    /* Check for conversion errors */
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* under UNICOS */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, dest, &bitoff, source);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+      {     /* We end up here if we are doing stride based processing */
+#ifdef NOSTRIDEFLOATCRAY2IEG
+          buf1 = 0;
+          for (i = 0; i < num_elm; i++)
+            {
+                dud1[0] = source[0];    /* Loop would be less efficient */
+                dud1[1] = source[1];
+                dud1[2] = source[2];
+                dud1[3] = source[3];
+                dud1[4] = source[4];
+                dud1[5] = source[5];
+                dud1[6] = source[6];
+                dud1[7] = source[7];
+
+                if ((float) buf1 != 0)
+                    buf2 = (((buf1 & UO4F_MASKA) |
+                             ((((buf1 & UO4F_MASKB) >> 48) - 16258) << 55)) +
+                            (((buf1 & UO4F_MASKC) +
+                              ((buf1 & UO4F_MASKD) << 1)) << 8));
+                else
+                    buf2 = buf1;
+
+                dest[0] = dud2[0];  /* Loop would be less efficient */
+                dest[1] = dud2[1];
+                dest[2] = dud2[2];
+                dest[3] = dud2[3];
+
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          uint8       tmp_dst[8];
+          float32     tmp_src;
+
+          for (i = 0; i < num_elm; i++)
+            {
+                HDmemcpy(&tmp_src, source, sizeof(float32));
+                bitoff = ((unsigned int)&tmp_src) >> BITOFF;
+                ierr = CRAY2IEG(&type, &n_elem, tmp_dst, &bitoff, &tmp_src);
+                if (ierr != 0)
+                    HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+                HDmemcpy(dest, tmp_dst, 4);
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define UI8F_MASKA 0x8000000000000000
+#define UI8F_MASKB 0x7ff0000000000000
+#define UI8F_MASKC 0x000fffffffffffff
+#define UI8F_MASKD 0x0000000000000008
+#define UI8F_MASKE 0x0000800000000000
+#define UI8F_MASKG 0x7fffffffffffffff
+
+/************************************************************/
+/* DFKui8f()                                                */
+/* -->Unicos routine for importing 64 bit floats            */
+/************************************************************/
+
+int
+DFKui8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* By default not array processed */
+    int         i, j, n;
+    long        buf;            /* This is a temporary stride buf */
+    uint8      *dud = (uint8 *) &buf;   /* Dummy pointer to buf1 for strides */
+    uint8      *source = (uint8 *) s;   /* Cray does not like certain   */
+    uint8      *dest = (uint8 *) d;     /* void and void* constructions */
+    long       *lptr_src = (long *) source;
+    long       *lptr_dest = (long *) dest;
+    char       *FUNC = "DFKui8f";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 8;       /* type of conversion to perform 8=64-bit float */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    /* Check for conversion errors */
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* under UNICOS */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {  
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, source, &bitoff, dest);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+#ifdef NOSTRIDEFLOATCRAY2IEG
+              dud[0] = source[0];
+              dud[1] = source[1];
+              dud[2] = source[2];
+              dud[3] = source[3];
+              dud[4] = source[4];
+              dud[5] = source[5];
+              dud[6] = source[6];
+              dud[7] = source[7];
+
+              if (buf != 0)
+                {
+                    buf = (((buf & UI8F_MASKA) |
+                            ((buf & UI8F_MASKB) >> 4) + (15362 << 48)) |
+                           ((((buf & UI8F_MASKC) + ((buf & UI8F_MASKD) << 1)) >> 5) |
+                            (UI8F_MASKE)));
+                    if ((buf << 1) == 0)
+                        buf = 0;
+                }   /* end if */
+              else
+                  buf = 0;
+
+              dest[0] = dud[0];
+              dest[1] = dud[1];
+              dest[2] = dud[2];
+              dest[3] = dud[3];
+              dest[4] = dud[4];
+              dest[5] = dud[5];
+              dest[6] = dud[6];
+              dest[7] = dud[7];
+
+#else
+              bitoff = ((unsigned int)source) >> BITOFF;
+              ierr = IEG2CRAY(&type, &n_elem, source, &bitoff, dest);
+              if (ierr != 0)
+                  HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#endif
+              source += source_stride;
+              dest += dest_stride;
+          }     /* end for */
+    return (SUCCEED);
+}
+
+#define UO8F_MASKA 0x8000000000000000
+#define UO8F_MASKB 0x7fff000000000000
+#define UO8F_MASKC 0x00007fffffffffff
+
+/************************************************************/
+/* DFKuo8f()                                                */
+/* -->Unicos routine for exporting 64 bit floats            */
+/************************************************************/
+
+int
+DFKuo8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* By default not array processed */
+    int         odd_man_out = 0;    /* By default there are even num_elm */
+    int         i, j, n;
+    long        buf;            /* This is a temporary stride buf */
+    uint8      *dud = (uint8 *) &buf;   /* Dummy pointer to buf1 for strides */
+    uint8      *source = (uint8 *) s;   /* Cray does not like certain   */
+    uint8      *dest = (uint8 *) d;     /* void and void* constructions */
+    long       *lptr_src = (long *) source;
+    long       *lptr_dest = (long *) dest;
+    char       *FUNC = "DFKuo8f";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 8;       /* type of conversion to perform 8=64-bit float */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    /* Check for conversion errors */
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* under UNICOS */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, dest, &bitoff, source);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+#ifdef NOSTRIDEFLOATCRAY2IEG
+              dud[0] = source[0];
+              dud[1] = source[1];
+              dud[2] = source[2];
+              dud[3] = source[3];
+              dud[4] = source[4];
+              dud[5] = source[5];
+              dud[6] = source[6];
+              dud[7] = source[7];
+
+              if (buf != 0)
+                {
+                    buf = (((buf & UO8F_MASKA) |    /* sign bit */
+                      (((((buf & UO8F_MASKB) >> 48) - 15362) << 53) >> 1)) |    /* exp */
+                           ((buf & UO8F_MASKC) << 5));  /* mantissa */
+                }   /* end if */
+              else
+                  buf = 0;
+
+              dest[0] = dud[0];
+              dest[1] = dud[1];
+              dest[2] = dud[2];
+              dest[3] = dud[3];
+              dest[4] = dud[4];
+              dest[5] = dud[5];
+              dest[6] = dud[6];
+              dest[7] = dud[7];
+
+#else
+              bitoff = ((unsigned int)dest) >> BITOFF;
+              ierr = CRAY2IEG(&type, &n_elem, dest, &bitoff, source);
+              if (ierr != 0)
+                  HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#endif
+              source += source_stride;
+              dest += dest_stride;
+          }     /* end for */
+    return (SUCCEED);
+}
+
+#define LUI2I_MASKA1 0xff00000000000000
+#define LUI2I_MASKA2 0x00ff000000000000
+#define LUI2I_MASKB1 0x0000ff0000000000
+#define LUI2I_MASKB2 0x000000ff00000000
+#define LUI2I_MASKC1 0x00000000ff000000
+#define LUI2I_MASKC2 0x0000000000ff0000
+#define LUI2I_MASKD1 0x000000000000ff00
+#define LUI2I_MASKD2 0x00000000000000ff
+
+/************************************************************/
+/* DFKlui2i()                                               */
+/* -->Unicos routine for importing 2 byte data items        */
+/* (**) This routine converts two byte little-endian IEEE   */
+/*      to eight byte Cray big endian integer.              */
+/************************************************************/
+int
+DFKlui2i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    uint32 i;
+    int         fast_processing = 0;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lptr_dest = (long *) dest;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKui2i";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 7;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements is an error */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+#ifdef DOESNT_WORK
+          tmp_dst = (uint8 *) HDmalloc(2 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          DFKswap(source, tmp_dst, 2, num_elm);
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, tmp_dst, &bitoff, dest);
+          HDfree(tmp_dst);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#else
+#ifndef DUFF_lui2i
+#if defined TEST2_lui2i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 4;
+
+          n = num_elm / 4;
+          lp_dest = (long *) dest;
+          lp_src = (long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));
+          for (i = 0; i < n; i++)
+            {
+                lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                    ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                    ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                    ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                    ((lp_src[0] & LUI2I_MASKD2) << 8);
+                lp_dest += 4;
+                lp_src++;
+            }   /* end for */
+          switch (odd_man_out)
+            {
+                case 3:
+                    lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                        ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                    lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                        ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                    lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                        ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                    break;
+
+                case 2:
+                    lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                        ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                    lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                        ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                    break;
+
+                case 1:
+                    lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                        ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                    break;
+
+                default:
+                    break;
+            }   /* end switch */
+#elif defined TEST1_lui2i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 4;
+
+          n = num_elm / 4;
+          lp_dest = (long *) dest;
+          lp_src = (long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));
+          for (i = 0; i < n; i++)
+            {
+                *lp_dest++ = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                    ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                *lp_dest++ = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                    ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                *lp_dest++ = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                    ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                *lp_dest++ = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                    ((lp_src[0] & LUI2I_MASKD2) << 8);
+                lp_src++;
+            }   /* end for */
+          switch (odd_man_out)
+            {
+                case 3:
+                    *lp_dest++ = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                        ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                    *lp_dest++ = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                        ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                    *lp_dest++ = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                        ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                    break;
+
+                case 2:
+                    *lp_dest++ = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                        ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                    *lp_dest++ = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                        ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                    break;
+
+                case 1:
+                    *lp_dest++ = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                        ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                    break;
+
+                default:
+                    break;
+            }   /* end switch */
+#else
+          for (i = 0; i < num_elm; i++)
+            {
+                lptr_dest[0] = 0x0000000000000000;
+                dest[6] = source[1];
+                dest[7] = source[0];
+                source += 2;
+                lptr_dest++;
+                dest = (uint8 *) lptr_dest;
+            }
+#endif
+#else  /* DUFF_lui2i */
+          uintn       n;
+          int         odd_man_out;  /* By default there are even num_elm */
+          uintn       orig_num_elm = num_elm;
+
+          lp_dest = (long *) dest;
+          lp_src = (long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));
+
+          odd_man_out = num_elm % 4;
+
+          num_elm /= 4;
+          n = (num_elm + 7) / 8;
+          if (orig_num_elm > 3)
+              switch (num_elm % 8)
+                {
+                    case 0:
+                        do
+                          {
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+#ifdef QAK
+                    case 15:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 14:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 13:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 12:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 11:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 10:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 9:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 8:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+#endif
+                    case 7:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 6:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 5:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 4:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 3:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 2:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                    case 1:
+                              lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                                  ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                              lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                                  ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                              lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                                  ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                              lp_dest[3] = ((lp_src[0] & LUI2I_MASKD1) >> 8) |
+                                  ((lp_src[0] & LUI2I_MASKD2) << 8);
+                              lp_dest += 4;
+                              lp_src++;
+                          }
+                        while (--n > 0);
+                }
+          switch (odd_man_out)
+            {
+                case 3:
+                    lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                        ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                    lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                        ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                    lp_dest[2] = ((lp_src[0] & LUI2I_MASKC1) >> 24) |
+                        ((lp_src[0] & LUI2I_MASKC2) >> 8);
+                    break;
+
+                case 2:
+                    lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                        ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                    lp_dest[1] = ((lp_src[0] & LUI2I_MASKB1) >> 40) |
+                        ((lp_src[0] & LUI2I_MASKB2) >> 24);
+                    break;
+
+                case 1:
+                    lp_dest[0] = ((lp_src[0] & LUI2I_MASKA1) >> 56) |
+                        ((lp_src[0] & LUI2I_MASKA2) >> 40);
+                    break;
+
+                default:
+                    break;
+            }   /* end switch */
+#endif /* DUFF_lui2i */
+#endif
+      }     /* end for */
+    else
+      {     /* Generic stride processing */
+#ifdef NOINTCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = 0x00;
+                dest[1] = 0x00;
+                dest[2] = 0x00;
+                dest[3] = 0x00;
+                dest[4] = 0x00;
+                dest[5] = 0x00;
+                dest[6] = source[1];
+                dest[7] = source[0];
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(2);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                DFKswap(source, tmp_dst, 2, 1);
+                bitoff = ((unsigned int)source) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, tmp_dst, &bitoff, dest);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUI2S_MASKA1 0xff00000000000000
+#define LUI2S_MASKA2 0x00ff000000000000
+#define LUI2S_MASKB1 0x0000ff0000000000
+#define LUI2S_MASKB2 0x000000ff00000000
+#define LUI2S_MASKC1 0x00000000ff000000
+#define LUI2S_MASKC2 0x0000000000ff0000
+#define LUI2S_MASKD1 0x000000000000ff00
+#define LUI2S_MASKD2 0x00000000000000ff
+#define LUI2S_MASKE  0x0080000000000000
+#define LUI2S_MASKF  0x0000008000000000
+#define LUI2S_MASKG  0x0000000000800000
+#define LUI2S_MASKH  0x0000000000000080
+#define LUI2S_MASKI  0xffffffffffff0000
+
+/************************************************************/
+/* DFKlui2s()                                                */
+/* -->Unicos routine for importing 2 byte signed ints       */
+/* (**) This routine converts two byte IEEE to eight byte   */
+/*      Cray.                                               */
+/************************************************************/
+int
+DFKlui2s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    uint32 i;
+    int         fast_processing = 0;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lptr_dest = (long *) dest;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKui2s";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 7;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          tmp_dst = (uint8 *) HDmalloc(2 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          DFKswap(source, tmp_dst, 2, num_elm);
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, tmp_dst, &bitoff, dest);
+          HDfree(tmp_dst);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end for */
+    else
+      {     /* Generic stride processing */
+#ifdef NOINTCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                if ((source[1] & 0x80))
+                  {     /* Can't forget to extend sign */
+                      dest[0] = 0xff;
+                      dest[1] = 0xff;
+                      dest[2] = 0xff;
+                      dest[3] = 0xff;
+                      dest[4] = 0xff;
+                      dest[5] = 0xff;
+                  }     /* end if */
+                else
+                  {
+                      dest[0] = 0x00;
+                      dest[1] = 0x00;
+                      dest[2] = 0x00;
+                      dest[3] = 0x00;
+                      dest[4] = 0x00;
+                      dest[5] = 0x00;
+                  }     /* end else */
+                dest[6] = source[1];
+                dest[7] = source[0];
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(2);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                DFKswap(source, tmp_dst, 2, 1);
+                bitoff = ((unsigned int)source) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, tmp_dst, &bitoff, dest);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUO2I_MASKA 0x00000000000000ff
+#define LUO2I_MASKB 0x000000000000ff00
+
+/************************************************************/
+/* DFKluo2i()                                               */
+/* -->Unicos routine for exporting 2 byte little-endian     */
+/*      data items                                          */
+/************************************************************/
+int
+DFKluo2i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    uint32 i;
+    int         fast_processing = 0;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKuo2i";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 7;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+#ifdef DOESNT_WORK
+          tmp_dst = (uint8 *) HDmalloc(2 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, tmp_dst, &bitoff, source);
+          if (ierr != 0)
+            {
+                HDfree(tmp_dst);
+                HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+            }   /* end if */
+          DFKswap(tmp_dst, dest, 2, num_elm);
+          HDfree(tmp_dst);
+#else
+#ifndef DUFF_luo2i
+#if defined TEST1_luo2i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 4;
+
+          n = num_elm / 4;
+          lp_dest = (long *) dest;
+          lp_src = (long *) source;
+          for (i = 0; i < n; i++)
+            {
+                *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                    ((lp_src[0] & LUO2I_MASKB) << 40) |
+                    ((lp_src[1] & LUO2I_MASKA) << 40) |
+                    ((lp_src[1] & LUO2I_MASKB) << 24) |
+                    ((lp_src[2] & LUO2I_MASKA) << 24) |
+                    ((lp_src[2] & LUO2I_MASKB) << 8) |
+                    ((lp_src[3] & LUO2I_MASKA) << 8) |
+                    ((lp_src[3] & LUO2I_MASKB) >> 8);
+                lp_src += 4;
+            }
+          switch (odd_man_out)
+            {   /* clean up leftovers */
+                case 3:
+                    *lp_dest = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                        ((lp_src[0] & LUO2I_MASKB) << 40) |
+                        ((lp_src[1] & LUO2I_MASKA) << 40) |
+                        ((lp_src[1] & LUO2I_MASKB) << 24) |
+                        ((lp_src[2] & LUO2I_MASKA) << 24) |
+                        ((lp_src[2] & LUO2I_MASKB) << 8);
+                    break;
+
+                case 2:
+                    *lp_dest = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                        ((lp_src[0] & LUO2I_MASKB) << 40) |
+                        ((lp_src[1] & LUO2I_MASKA) << 40) |
+                        ((lp_src[1] & LUO2I_MASKB) << 24);
+                    break;
+
+                case 1:
+                    *lp_dest = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                        ((lp_src[0] & LUO2I_MASKB) << 40);
+                    break;
+
+                case 0:
+                    break;
+            }   /* end switch */
+#else
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = source[7];
+                dest[1] = source[6];
+                dest += 2;
+                source += 8;
+            }
+#endif
+#else  /* DUFF_luo2i */
+          uintn       n;
+          int         odd_man_out;  /* By default there are even num_elm */
+          uintn       orig_num_elm = num_elm;
+
+          odd_man_out = num_elm % 4;
+
+          num_elm /= 4;
+          n = (num_elm + 7) / 8;
+          lp_dest = (long *) dest;
+          lp_src = (long *) source;
+          if (orig_num_elm > 3)
+              switch (num_elm % 8)
+                {
+                    case 0:
+                        do
+                          {
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+#ifdef QAK
+                    case 15:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 14:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 13:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 12:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 11:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 10:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 9:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 8:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+#endif
+                    case 7:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 6:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 5:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 4:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 3:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 2:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                    case 1:
+                              *lp_dest++ = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                                  ((lp_src[0] & LUO2I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKA) << 40) |
+                                  ((lp_src[1] & LUO2I_MASKB) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKA) << 24) |
+                                  ((lp_src[2] & LUO2I_MASKB) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKA) << 8) |
+                                  ((lp_src[3] & LUO2I_MASKB) >> 8);
+                              lp_src += 4;
+                          }
+                        while (--n > 0);
+                }
+          switch (odd_man_out)
+            {   /* clean up leftovers */
+                case 3:
+                    *lp_dest = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                        ((lp_src[0] & LUO2I_MASKB) << 40) |
+                        ((lp_src[1] & LUO2I_MASKA) << 40) |
+                        ((lp_src[1] & LUO2I_MASKB) << 24) |
+                        ((lp_src[2] & LUO2I_MASKA) << 24) |
+                        ((lp_src[2] & LUO2I_MASKB) << 8);
+                    break;
+
+                case 2:
+                    *lp_dest = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                        ((lp_src[0] & LUO2I_MASKB) << 40) |
+                        ((lp_src[1] & LUO2I_MASKA) << 40) |
+                        ((lp_src[1] & LUO2I_MASKB) << 24);
+                    break;
+
+                case 1:
+                    *lp_dest = ((lp_src[0] & LUO2I_MASKA) << 56) |
+                        ((lp_src[0] & LUO2I_MASKB) << 40);
+                    break;
+
+                default:
+                    break;
+            }   /* end switch */
+#endif /* DUFF_luo2i */
+#endif
+      }     /* end if */
+    else
+      {     /* Generic Stride processing */
+#ifdef NOINTCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = source[7];
+                dest[1] = source[6];
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(2);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                bitoff = ((unsigned int)dest) >> BITOFF;
+                ierr = CRAY2IEG(&type, &n_elem, tmp_dst, &bitoff, source);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                DFKswap(tmp_dst, dest, 2, 1);
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUO2S_MASKA 0x00000000000000ff
+#define LUO2S_MASKB 0x000000000000ff00
+
+/************************************************************/
+/* DFKluo2s()                                               */
+/* -->Unicos routine for exporting signed 2 byte            */
+/*      little-endian data items                            */
+/************************************************************/
+int
+DFKluo2s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    uint32 i;
+    int         fast_processing = 0;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKuo2s";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 7;       /* type of conversion to perform 7=short integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          tmp_dst = (uint8 *) HDmalloc(2 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, tmp_dst, &bitoff, source);
+          if (ierr != 0)
+            {
+                HDfree(tmp_dst);
+                HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+            }   /* end if */
+          DFKswap(tmp_dst, dest, 2, num_elm);
+          HDfree(tmp_dst);
+      }     /* end if */
+    else
+      {     /* Generic Stride processing */
+#ifdef NOINTCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = source[7];
+                dest[1] = source[6];
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(2);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                bitoff = ((unsigned int)dest) >> BITOFF; 
+                ierr = CRAY2IEG(&type, &n_elem, tmp_dst, &bitoff, source);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                DFKswap(tmp_dst, dest, 2, 1);
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUI4I_MASKA 0xff00000000000000
+#define LUI4I_MASKB 0x00ff000000000000
+#define LUI4I_MASKC 0x0000ff0000000000
+#define LUI4I_MASKD 0x000000ff00000000
+#define LUI4I_MASKE 0x00000000ff000000
+#define LUI4I_MASKF 0x0000000000ff0000
+#define LUI4I_MASKG 0x000000000000ff00
+#define LUI4I_MASKH 0x00000000000000ff
+
+/************************************************************/
+/* DFKlui4i()                                               */
+/* -->Unicos routine for importing 4 byte little-endian     */
+/*      unsigned ints                                       */
+/************************************************************/
+int
+DFKlui4i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         fast_processing = 0;
+    uint32 i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    unsigned long       *lptr_dest = (unsigned long *) dest;
+    unsigned long       *lp_dest;
+    unsigned long       *lp_src;
+    char       *FUNC = "DFKui4i";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 1;       /* type of conversion to perform 1=integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+#ifdef DOESNT_WORK
+          tmp_dst = (uint8 *) HDmalloc(4 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          DFKswap(source, tmp_dst, 4, num_elm);
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, tmp_dst, &bitoff, dest);
+          HDfree(tmp_dst);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+#else
+#ifndef DUFF_lui4i
+#if defined TEST2_lui4i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 2;
+
+          n = num_elm / 2;
+          lp_dest = (unsigned long *) dest;
+          lp_src = (unsigned long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));     /* initialize to zeros */
+          for (i = 0; i < n; i++)
+            {
+                lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                    (lp_src[0] & LUI4I_MASKB) >> 40 |
+                    (lp_src[0] & LUI4I_MASKC) >> 24 |
+                    (lp_src[0] & LUI4I_MASKD) >> 8;
+                lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                    (lp_src[0] & LUI4I_MASKF) >> 8 |
+                    (lp_src[0] & LUI4I_MASKG) << 8 |
+                    (lp_src[0] & LUI4I_MASKH) << 24;
+                lp_dest += 2;
+                lp_src++;
+            }   /* end for */
+          if (odd_man_out)
+              *lp_dest = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                  (lp_src[0] & LUI4I_MASKD) >> 8;
+#elif defined TEST1_lui4i
+          int         odd_man_out;  /* By default there are even num_elm */
+          intn        n;
+
+          odd_man_out = num_elm % 2;
+
+          n = num_elm / 2;
+          lp_dest = (unsigned long *) dest;
+          lp_src = (unsigned long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));     /* initialize to zeros */
+          for (i = 0; i < n; i++)
+            {
+                *lp_dest++ = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                    (lp_src[0] & LUI4I_MASKB) >> 40 |
+                    (lp_src[0] & LUI4I_MASKC) >> 24 |
+                    (lp_src[0] & LUI4I_MASKD) >> 8;
+                *lp_dest++ = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                    (lp_src[0] & LUI4I_MASKF) >> 8 |
+                    (lp_src[0] & LUI4I_MASKG) << 8 |
+                    (lp_src[0] & LUI4I_MASKH) << 24;
+                lp_src++;
+            }   /* end for */
+          if (odd_man_out)
+              *lp_dest++ = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                  (lp_src[0] & LUI4I_MASKD) >> 8;
+#else
+          for (i = 0; i < num_elm; i++)
+            {
+                lptr_dest[0] = 0;
+                dest[4] = source[3];
+                dest[5] = source[2];
+                dest[6] = source[1];
+                dest[7] = source[0];
+                source += 4;
+                lptr_dest++;
+                dest = (uint8 *) lptr_dest;
+            }
+#endif
+#else  /* DUFF_lui4i */
+          uintn       n;
+          int         odd_man_out;  /* By default there are even num_elm */
+          uintn       orig_num_elm = num_elm;
+
+          lp_dest = (unsigned long *) dest;
+          lp_src = (unsigned long *) source;
+          HDmemset(lp_dest, 0, num_elm * sizeof(long));     /* initialize to zeros */
+
+          odd_man_out = num_elm % 2;
+
+          if (orig_num_elm > 1) {
+		num_elm /= 2;
+
+		/* The loop below has been unrolled in interations of 8 */
+		while (num_elm > 7) {
+                              lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKD) >> 8;
+                              lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKF) >> 8 |
+                                  (lp_src[0] & LUI4I_MASKG) << 8 |
+                                  (lp_src[0] & LUI4I_MASKH) << 24;
+                              lp_dest += 2;
+                              lp_src++;
+
+                              lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKD) >> 8;
+                              lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKF) >> 8 |
+                                  (lp_src[0] & LUI4I_MASKG) << 8 |
+                                  (lp_src[0] & LUI4I_MASKH) << 24;
+                              lp_dest += 2;
+                              lp_src++;
+
+                              lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKD) >> 8;
+                              lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKF) >> 8 |
+                                  (lp_src[0] & LUI4I_MASKG) << 8 |
+                                  (lp_src[0] & LUI4I_MASKH) << 24;
+                              lp_dest += 2;
+                              lp_src++;
+
+                              lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKD) >> 8;
+                              lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKF) >> 8 |
+                                  (lp_src[0] & LUI4I_MASKG) << 8 |
+                                  (lp_src[0] & LUI4I_MASKH) << 24;
+                              lp_dest += 2;
+                              lp_src++;
+
+                              lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKD) >> 8;
+                              lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKF) >> 8 |
+                                  (lp_src[0] & LUI4I_MASKG) << 8 |
+                                  (lp_src[0] & LUI4I_MASKH) << 24;
+                              lp_dest += 2;
+                              lp_src++;
+
+                              lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKD) >> 8;
+                              lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKF) >> 8 |
+                                  (lp_src[0] & LUI4I_MASKG) << 8 |
+                                  (lp_src[0] & LUI4I_MASKH) << 24;
+                              lp_dest += 2;
+                              lp_src++;
+
+                              lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKD) >> 8;
+                              lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKF) >> 8 |
+                                  (lp_src[0] & LUI4I_MASKG) << 8 |
+                                  (lp_src[0] & LUI4I_MASKH) << 24;
+                              lp_dest += 2;
+                              lp_src++;
+
+                              lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKD) >> 8;
+                              lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKF) >> 8 |
+                                  (lp_src[0] & LUI4I_MASKG) << 8 |
+                                  (lp_src[0] & LUI4I_MASKH) << 24;
+                              lp_dest += 2;
+                              lp_src++;
+			num_elm -= 8;
+                };
+
+		/* The loop below is a cleanup of iterations leftover modulo 8 */
+		while (num_elm > 0) {
+                              lp_dest[0] = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKD) >> 8;
+                              lp_dest[1] = (lp_src[0] & LUI4I_MASKE) >> 24 |
+                                  (lp_src[0] & LUI4I_MASKF) >> 8 |
+                                  (lp_src[0] & LUI4I_MASKG) << 8 |
+                                  (lp_src[0] & LUI4I_MASKH) << 24;
+                              lp_dest += 2;
+                              lp_src++;
+			num_elm -= 1;
+                };
+          }
+          if (odd_man_out)
+              *lp_dest = (lp_src[0] & LUI4I_MASKA) >> 56 |
+                  (lp_src[0] & LUI4I_MASKB) >> 40 |
+                  (lp_src[0] & LUI4I_MASKC) >> 24 |
+                  (lp_src[0] & LUI4I_MASKD) >> 8;
+#endif /* DUFF_lui4i */
+#endif
+      }     /* end if */
+    else
+      {
+#ifdef NOINTCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = 0;
+                dest[1] = 0;
+                dest[2] = 0;
+                dest[3] = 0;
+                dest[4] = source[3];
+                dest[5] = source[2];
+                dest[6] = source[1];
+                dest[7] = source[0];
+                dest += dest_stride;
+                source += source_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(4);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                DFKswap(source, tmp_dst, 4, 1);
+                bitoff = ((unsigned int)source) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, tmp_dst, &bitoff, dest);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                dest += dest_stride;
+                source += source_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUI4S_MASKA 0xff00000000000000
+#define LUI4S_MASKB 0x00ff000000000000
+#define LUI4S_MASKC 0x0000ff0000000000
+#define LUI4S_MASKD 0x000000ff00000000
+#define LUI4S_MASKE 0x00000000ff000000
+#define LUI4S_MASKF 0x0000000000ff0000
+#define LUI4S_MASKG 0x000000000000ff00
+#define LUI4S_MASKH 0x00000000000000ff
+#define LUI4S_MASKI 0x0000008000000000
+#define LUI4S_MASKJ 0x0000000000000080
+#define LUI4S_MASKK 0xffffffff00000000
+
+/************************************************************/
+/* DFKlui4s()                                                */
+/* -->Unicos routine for importing 4 signed ints            */
+/************************************************************/
+int
+DFKlui4s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         fast_processing = 0;
+    uint32 i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    long       *lptr_dest = (long *) dest;
+    long       *lp_dest;
+    long       *lp_src;
+    char       *FUNC = "DFKui4s";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 1;       /* type of conversion to perform 1=integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          tmp_dst = (uint8 *) HDmalloc(4 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          DFKswap(source, tmp_dst, 4, num_elm);
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, tmp_dst, &bitoff, dest);
+          HDfree(tmp_dst);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+      {
+#ifdef NOINTCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                if ((source[3] & 0x80))
+                  {     /* Can't forget to sign extend */
+                      dest[0] = 0xff;
+                      dest[1] = 0xff;
+                      dest[2] = 0xff;
+                      dest[3] = 0xff;
+                  }     /* end if */
+                else
+                  {
+                      dest[0] = 0;
+                      dest[1] = 0;
+                      dest[2] = 0;
+                      dest[3] = 0;
+                  }     /* end else */
+                dest[4] = source[3];
+                dest[5] = source[2];
+                dest[6] = source[1];
+                dest[7] = source[0];
+                dest += dest_stride;
+                source += source_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(4);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                DFKswap(source, tmp_dst, 4, 1);
+                bitoff = ((unsigned int)source) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, tmp_dst, &bitoff, dest);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                dest += dest_stride;
+                source += source_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUO4I_MASKA 0x00000000ff00ff00
+#define LUO4I_MASKB 0x0000000000ff00ff
+#define LUO4I_MASKC 0xffff0000ffff0000
+#define LUO4I_MASKD 0x0000ffff0000ffff
+
+/************************************************************/
+/* DFKluo4i()                                                */
+/* -->Unicos routine for exporting 4 byte data items        */
+/************************************************************/
+int
+DFKluo4i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         fast_processing = 0;
+    uintn i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    unsigned long *lp_dest;
+    unsigned long *lp_src;
+    char       *FUNC = "DFKuo4i";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 1;       /* type of conversion to perform 1=integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+#ifdef DOESNT_WORK
+          tmp_dst = (uint8 *) HDmalloc(4 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, tmp_dst, &bitoff, source);
+          if (ierr != 0)
+            {
+                HDfree(tmp_dst);
+                HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+            }   /* end if */
+          DFKswap(tmp_dst, dest, 4, num_elm);
+          HDfree(tmp_dst);
+#else
+#ifndef DUFF_luo4i
+#define TEST2_luo4i
+#if defined TEST2_luo4i
+          int         odd_man_out = 0;  /* By default there are even num_elm */
+          intn        n;
+
+          if (num_elm % 2)  /* If this is true, we have odd num */
+              odd_man_out = 1;
+
+          n = num_elm / 2;
+          lp_dest = (unsigned long *) dest;
+          lp_src = (unsigned long *) source;
+          for (i = 0; i < n; i++)
+            {
+                *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) | ((lp_src[0] & LUO4I_MASKB) << 40) |
+                    ((lp_src[1] & LUO4I_MASKA) >> 8) | ((lp_src[1] & LUO4I_MASKB) << 8);
+                *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) | ((*lp_dest & LUO4I_MASKD) << 16);
+                lp_dest++;
+                lp_src += 2;
+            }
+          if (odd_man_out)
+            {
+                *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) | ((lp_src[0] & LUO4I_MASKB) << 40);
+                *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) | ((*lp_dest & LUO4I_MASKD) << 16);
+            }   /* end if */
+#else
+          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 += 8;
+            }
+#endif
+#else  /* DUFF_luo4i */
+       uintn n;
+       int         odd_man_out = 0;  /* By default there are even num_elm */
+       uintn       orig_num_elm = num_elm;
+
+       if (num_elm % 2)  /* If this is true, we have odd num */
+              odd_man_out = 1;
+
+        lp_dest = (unsigned long *) dest;
+        lp_src = (unsigned long *) source;
+	if (orig_num_elm > 1) {
+		num_elm /= 2;
+
+		/* The loop below has been unrolled in interations of 8 */
+		while (num_elm > 7) {
+                              *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                                  ((lp_src[0] & LUO4I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO4I_MASKA) >> 8) |
+                                  ((lp_src[1] & LUO4I_MASKB) << 8);
+                              *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                                  ((*lp_dest & LUO4I_MASKD) << 16);
+                              lp_dest++;
+                              lp_src += 2;
+
+                              *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                                  ((lp_src[0] & LUO4I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO4I_MASKA) >> 8) |
+                                  ((lp_src[1] & LUO4I_MASKB) << 8);
+                              *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                                  ((*lp_dest & LUO4I_MASKD) << 16);
+                              lp_dest++;
+                              lp_src += 2;
+
+                              *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                                  ((lp_src[0] & LUO4I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO4I_MASKA) >> 8) |
+                                  ((lp_src[1] & LUO4I_MASKB) << 8);
+                              *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                                  ((*lp_dest & LUO4I_MASKD) << 16);
+                              lp_dest++;
+                              lp_src += 2;
+
+                              *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                                  ((lp_src[0] & LUO4I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO4I_MASKA) >> 8) |
+                                  ((lp_src[1] & LUO4I_MASKB) << 8);
+                              *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                                  ((*lp_dest & LUO4I_MASKD) << 16);
+                              lp_dest++;
+                              lp_src += 2;
+
+                              *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                                  ((lp_src[0] & LUO4I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO4I_MASKA) >> 8) |
+                                  ((lp_src[1] & LUO4I_MASKB) << 8);
+                              *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                                  ((*lp_dest & LUO4I_MASKD) << 16);
+                              lp_dest++;
+                              lp_src += 2;
+
+                              *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                                  ((lp_src[0] & LUO4I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO4I_MASKA) >> 8) |
+                                  ((lp_src[1] & LUO4I_MASKB) << 8);
+                              *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                                  ((*lp_dest & LUO4I_MASKD) << 16);
+                              lp_dest++;
+                              lp_src += 2;
+
+                              *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                                  ((lp_src[0] & LUO4I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO4I_MASKA) >> 8) |
+                                  ((lp_src[1] & LUO4I_MASKB) << 8);
+                              *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                                  ((*lp_dest & LUO4I_MASKD) << 16);
+                              lp_dest++;
+                              lp_src += 2;
+
+                              *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                                  ((lp_src[0] & LUO4I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO4I_MASKA) >> 8) |
+                                  ((lp_src[1] & LUO4I_MASKB) << 8);
+                              *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                                  ((*lp_dest & LUO4I_MASKD) << 16);
+                              lp_dest++;
+                              lp_src += 2;
+
+			num_elm -= 8;
+		};
+
+		/* The loop below is a cleanup of iterations leftover modulo 8 */
+		while (num_elm > 0) {
+                              *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                                  ((lp_src[0] & LUO4I_MASKB) << 40) |
+                                  ((lp_src[1] & LUO4I_MASKA) >> 8) |
+                                  ((lp_src[1] & LUO4I_MASKB) << 8);
+                              *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                                  ((*lp_dest & LUO4I_MASKD) << 16);
+                              lp_dest++;
+                              lp_src += 2;
+			num_elm--;
+		};
+	}
+          if (odd_man_out)
+            {
+                *lp_dest = ((lp_src[0] & LUO4I_MASKA) << 24) |
+                    ((lp_src[0] & LUO4I_MASKB) << 40);
+                *lp_dest = ((*lp_dest & LUO4I_MASKC) >> 16) |
+                    ((*lp_dest & LUO4I_MASKD) << 16);
+            }   /* end if */
+#endif /* DUFF_luo4i */
+#endif
+      }     /* end if */
+    else
+      {
+#ifdef NOINTCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = source[7];
+                dest[1] = source[6];
+                dest[2] = source[5];
+                dest[3] = source[4];
+                dest += dest_stride;
+                source += source_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(4);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                bitoff = ((unsigned int)dest) >> BITOFF;
+                ierr = CRAY2IEG(&type, &n_elem, tmp_dst, &bitoff, source);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                DFKswap(tmp_dst, dest, 4, num_elm);
+                dest += dest_stride;
+                source += source_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUO4S_MASKA 0x00000000ff00ff00
+#define LUO4S_MASKB 0x0000000000ff00ff
+#define LUO4S_MASKC 0xffff0000ffff0000
+#define LUO4S_MASKD 0x0000ffff0000ffff
+
+/************************************************************/
+/* DFKluo4s()                                               */
+/* -->Unicos routine for exporting signed 4 byte            */
+/*      little-endian data items                            */
+/************************************************************/
+int
+DFKluo4s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         fast_processing = 0;
+    uintn i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    unsigned long *lp_dest;
+    unsigned long *lp_src;
+    char       *FUNC = "DFKuo4s";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 1;       /* type of conversion to perform 1=integer */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    if (source == dest || num_elm == 0)     /* Inplace conversions  not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* No elements to convert is an error */
+
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          tmp_dst = (uint8 *) HDmalloc(4 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, tmp_dst, &bitoff, source);
+          if (ierr != 0)
+            {
+                HDfree(tmp_dst);
+                HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+            }   /* end if */
+          DFKswap(tmp_dst, dest, 4, num_elm);
+          HDfree(tmp_dst);
+      }     /* end if */
+    else
+      {
+#ifdef NOINTCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = source[7];
+                dest[1] = source[6];
+                dest[2] = source[5];
+                dest[3] = source[4];
+                dest += dest_stride;
+                source += source_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(4);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                bitoff = ((unsigned int)dest) >> BITOFF; 
+                ierr = CRAY2IEG(&type, &n_elem, tmp_dst, &bitoff, source);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                DFKswap(tmp_dst, dest, 4, num_elm);
+                dest += dest_stride;
+                source += source_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUI4F_MASKA  0x0000008000000000
+#define LUI4F_MASKB1 0x0000007f00000000
+#define LUI4F_MASKB2 0x0000800000000000
+#define LUI4F_MASKC1 0x00007f0000000000
+#define LUI4F_MASKC2 0x00ff000000000000
+#define LUI4F_MASKC3 0xff00000000000000
+#define LUI4F_MASKD  0x0000800000000000
+
+#define LUI4F_MASKE  0x0000000000000080
+#define LUI4F_MASKF1 0x000000000000007f
+#define LUI4F_MASKF2 0x0000000000008000
+#define LUI4F_MASKG1 0x0000000000007f00
+#define LUI4F_MASKG2 0x0000000000ff0000
+#define LUI4F_MASKG3 0x00000000ff000000
+
+#define LUI4F_MASKH  0xffffff7f00000000
+#define LUI4F_MASKI  0x00000000ffffff7f
+
+/***************************************************************/
+/* DFKlui4f()                                                  */
+/* -->Unicos routine for importing little-endian 32 bit floats */
+/***************************************************************/
+
+/************************************************************
+
+                     <<<< WARNING >>>>
+
+    The nature of converting between 64 bit floating point
+  numbers and 32 bit floating point numbers LOSES PRECISION.
+  Taking a number in 64bit cray format, converting to IEEE
+  (internal HDF format) and back will round the number at
+  about the 7th decimal place.
+
+ ************************************************************/
+
+int
+DFKlui4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* By default not array processed */
+    int         odd_man_out = 0;    /* By default there are even num_elm */
+    int         i, j, n;
+    long        buf1;           /* This is a temporary stride buf */
+    long        buf2;           /* This is a temporary stride buf */
+    uint8      *dud1 = (uint8 *) &buf1;     /* Dummy pointer to buf1 for strides */
+    uint8      *dud2 = (uint8 *) &buf2;     /* Dummy pointer to buf2 for strides */
+    uint8      *source = (uint8 *) s;   /* Cray does not like certain   */
+    uint8      *dest = (uint8 *) d;     /* void and void* constructions */
+    long       *lptr_src = (long *) source;
+    long       *lptr_dest = (long *) dest;
+    char       *FUNC = "DFKui4f";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 2;       /* type of conversion to perform 2=32-bit float */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    /* Check for conversion errors */
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* under UNICOS */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          tmp_dst = (uint8 *) HDmalloc(4 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          DFKswap(source, tmp_dst, 4, num_elm);
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, tmp_dst, &bitoff, dest);
+          HDfree(tmp_dst);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+      {     /* We end up here if we are doing stride based processing */
+#ifdef NOSTRIDEFLOATCRAY2IEG
+          buf1 = 0;
+          for (i = 0; i < num_elm; i++)
+            {
+                dud1[0] = source[3];    /* Loop would be less efficient */
+                dud1[1] = source[2];
+                dud1[2] = source[1];
+                dud1[3] = source[0];
+
+                if ((float) buf1 != 0)
+                  {
+                      buf2 = (((buf1 & UI4F_MASKA) |
+                               ((buf1 & UI4F_MASKB) >> 7) +
+                               (16258 << 48)) |
+                              (((buf1 & UI4F_MASKC) >> 8) | (UI4F_MASKD)));
+                      if ((buf1 << 1) == 0)
+                          buf2 = 0;
+                  }
+                else
+                    buf2 = buf1;
+
+                dest[0] = dud2[0];  /* Loop would be less efficient */
+                dest[1] = dud2[1];
+                dest[2] = dud2[2];
+                dest[3] = dud2[3];
+                dest[4] = dud2[4];
+                dest[5] = dud2[5];
+                dest[6] = dud2[6];
+                dest[7] = dud2[7];
+
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          float32     tmp_dst2;
+
+          tmp_dst = (uint8 *) HDmalloc(4);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                DFKswap(source, tmp_dst, 4, 1);
+                bitoff = ((unsigned int)source) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, tmp_dst, &bitoff, &tmp_dst2);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                HDmemcpy(dest, &tmp_dst2, 4);
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUO4F_MASKA 0x8000000000000000
+#define LUO4F_MASKB 0x7fff000000000000
+#define LUO4F_MASKC 0x00007fffff000000
+#define LUO4F_MASKD 0x0000000000800000
+#define LUO4F_MASKE 0xff00ff00ff00ff00
+#define LUO4F_MASKF 0x00ff00ff00ff00ff
+#define LUO4F_MASKG 0xffff0000ffff0000
+#define LUO4F_MASKH 0x0000ffff0000ffff
+
+/***************************************************************/
+/* DFKluo4f()                                                  */
+/* -->Unicos routine for exporting little-endian 32 bit floats */
+/***************************************************************/
+
+/************************************************************
+
+                     <<<< WARNING >>>>
+
+    The nature of converting between 64 bit floating point
+  numbers and 32 bit floating point numbers LOSES PRECISION.
+  Taking a number in 64bit cray format, converting to IEEE
+  (internal HDF format) and back will round the number at
+  about the 7th decimal place.
+
+ ************************************************************/
+
+int
+DFKluo4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* By default not array processed */
+    int         odd_man_out = 0;    /* By default there are even num_elm */
+    int         i, j, n;
+    long        buf1;           /* This is a temporary stride buf */
+    long        buf2;           /* This is a temporary stride buf */
+    uint8      *dud1 = (uint8 *) &buf1;     /* Dummy pointer to buf1 for strides */
+    uint8      *dud2 = (uint8 *) &buf2;     /* Dummy pointer to buf2 for strides */
+    uint8      *source = (uint8 *) s;   /* Cray does not like certain   */
+    uint8      *dest = (uint8 *) d;     /* void and void* constructions */
+    long       *lptr_src = (long *) source;
+    long       *lptr_dest = (long *) dest;
+    char       *FUNC = "DFKuo4f";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 2;       /* type of conversion to perform 2=32-bit float */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    /* Check for conversion errors */
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* under UNICOS */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          tmp_dst = (uint8 *) HDmalloc(4 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, tmp_dst, &bitoff, source);
+          if (ierr != 0)
+            {
+                HDfree(tmp_dst);
+                HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+            }   /* end if */
+          DFKswap(tmp_dst, dest, 4, num_elm);
+          HDfree(tmp_dst);
+      }     /* end if */
+    else
+      {     /* We end up here if we are doing stride based processing */
+#ifdef NOSTRIDEFLOATCRAY2IEG
+          buf1 = 0;
+          for (i = 0; i < num_elm; i++)
+            {
+                dud1[0] = source[0];    /* Loop would be less efficient */
+                dud1[1] = source[1];
+                dud1[2] = source[2];
+                dud1[3] = source[3];
+                dud1[4] = source[4];
+                dud1[5] = source[5];
+                dud1[6] = source[6];
+                dud1[7] = source[7];
+
+                if ((float) buf1 != 0)
+                    buf2 = (((buf1 & LUO4F_MASKA) |
+                           ((((buf1 & LUO4F_MASKB) >> 48) - 16258) << 55)) +
+                            (((buf1 & LUO4F_MASKC) + ((buf1 & LUO4F_MASKD) << 1)) << 8));
+                else
+                    buf2 = buf1;
+
+                dest[3] = dud2[0];  /* Loop would be less efficient */
+                dest[2] = dud2[1];
+                dest[1] = dud2[2];
+                dest[0] = dud2[3];
+
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          float32     tmp_src;
+
+          tmp_dst = (uint8 *) HDmalloc(4);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                HDmemcpy(&tmp_src, source, sizeof(float32));
+                bitoff = ((unsigned int)dest) >> BITOFF;
+                ierr = CRAY2IEG(&type, &n_elem, tmp_dst, &bitoff, &tmp_src);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                DFKswap(tmp_dst, dest, 4, 1);
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUI8F_MASKA  0x0000000000000080
+#define LUI8F_MASKB1 0x000000000000007f
+#define LUI8F_MASKB2 0x000000000000f000
+#define LUI8F_MASKC1 0x0000000000000f00
+#define LUI8F_MASKC2 0x0000000000ff0000
+#define LUI8F_MASKC3 0x00000000ff000000
+#define LUI8F_MASKC4 0x000000ff00000000
+#define LUI8F_MASKC5 0x0000ff0000000000
+#define LUI8F_MASKC6 0x00ff000000000000
+#define LUI8F_MASKC7 0xff00000000000000
+#define LUI8F_MASKD  0x0800000000000000
+#define LUI8F_MASKE  0x0000800000000000
+#define LUI8F_MASKF 0xff00ff00ff00ff00
+#define LUI8F_MASKG 0x00ff00ff00ff00ff
+#define LUI8F_MASKH 0xffff0000ffff0000
+#define LUI8F_MASKI 0x0000ffff0000ffff
+#define LUI8F_MASKJ 0xffffffff00000000
+#define LUI8F_MASKK 0x00000000ffffffff
+#define LUI8F_MASKL 0xffffffffffffff7f
+
+/************************************************************/
+/* DFKlui8f()                                               */
+/* -->Unicos routine for importing 64 bit floats            */
+/************************************************************/
+int
+DFKlui8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* By default not array processed */
+    int         i, j, n;
+    long        buf;            /* This is a temporary stride buf */
+    uint8      *dud = (uint8 *) &buf;   /* Dummy pointer to buf1 for strides */
+    uint8      *source = (uint8 *) s;   /* Cray does not like certain   */
+    uint8      *dest = (uint8 *) d;     /* void and void* constructions */
+    long       *lptr_src = (long *) source;
+    long       *lptr_dest = (long *) dest;
+    char       *FUNC = "DFKui8f";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 8;       /* type of conversion to perform 8=64-bit float */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    /* Check for conversion errors */
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* under UNICOS */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          tmp_dst = (uint8 *) HDmalloc(8 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          DFKswap(source, tmp_dst, 8, num_elm);
+          bitoff = ((unsigned int)source) >> BITOFF;
+          ierr = IEG2CRAY(&type, &num_elm, tmp_dst, &bitoff, dest);
+          HDfree(tmp_dst);
+          if (ierr != 0)
+              HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+      }     /* end if */
+    else
+      {
+#ifdef NOSTRIDEFLOATCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                dud[0] = source[7];
+                dud[1] = source[6];
+                dud[2] = source[5];
+                dud[3] = source[4];
+                dud[4] = source[3];
+                dud[5] = source[2];
+                dud[6] = source[1];
+                dud[7] = source[0];
+
+                if (buf != 0)
+                  {
+                      buf = (((buf & UI8F_MASKA) | ((buf & UI8F_MASKB) >> 4) +
+                              (15362 << 48)) |
+                             ((((buf & UI8F_MASKC) + ((buf & UI8F_MASKD) << 1)) >> 5) |
+                              (UI8F_MASKE)));
+                      if ((buf << 1) == 0)
+                          buf = 0;
+                  }
+                else
+                    buf = 0;
+
+                dest[0] = dud[0];
+                dest[1] = dud[1];
+                dest[2] = dud[2];
+                dest[3] = dud[3];
+                dest[4] = dud[4];
+                dest[5] = dud[5];
+                dest[6] = dud[6];
+                dest[7] = dud[7];
+
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(8);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                DFKswap(source, tmp_dst, 8, 1);
+                bitoff = ((unsigned int)source) >> BITOFF;
+                ierr = IEG2CRAY(&type, &n_elem, tmp_dst, &bitoff, dest);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#define LUO8F_MASKA 0x8000000000000000
+#define LUO8F_MASKB 0x7fff000000000000
+#define LUO8F_MASKC 0x00007fffffffffff
+#define LUO8F_MASKD 0xff00ff00ff00ff00
+#define LUO8F_MASKE 0x00ff00ff00ff00ff
+#define LUO8F_MASKF 0xffff0000ffff0000
+#define LUO8F_MASKG 0x0000ffff0000ffff
+#define LUO8F_MASKH 0xffffffff00000000
+#define LUO8F_MASKI 0x00000000ffffffff
+
+/************************************************************/
+/* DFKluo8f()                                               */
+/* -->Unicos routine for exporting 64 bit floats            */
+/************************************************************/
+int
+DFKluo8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* By default not array processed */
+    int         odd_man_out = 0;    /* By default there are even num_elm */
+    int         i, j, n;
+    long        buf;            /* This is a temporary stride buf */
+    uint8      *dud = (uint8 *) &buf;   /* Dummy pointer to buf1 for strides */
+    uint8      *source = (uint8 *) s;   /* Cray does not like certain   */
+    uint8      *dest = (uint8 *) d;     /* void and void* constructions */
+    long       *lptr_src = (long *) source;
+    long       *lptr_dest = (long *) dest;
+    char       *FUNC = "DFKuo8f";
+    int         ierr;           /* error from IEG2CRAY */
+    int         type = 8;       /* type of conversion to perform 8=64-bit float */
+    int         bitoff = 0;     /* bit offset in the IEEE stream */
+    uint8      *tmp_dst;        /* temporary buffer to hold byte swapped values */
+    intn        n_elem = 1;     /* the number of elements for stride-based processing */
+
+    HEclear();
+
+    /* Check for conversion errors */
+    if (source == dest || num_elm == 0)     /* Inplace conversions not permitted */
+        HRETURN_ERROR(DFE_BADCONV, FAIL);   /* under UNICOS */
+
+    /* Find out if it is OK to use faster array processing */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    if (fast_processing)
+      {
+          tmp_dst = (uint8 *) HDmalloc(8 * num_elm);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          bitoff = ((unsigned int)dest) >> BITOFF;
+          ierr = CRAY2IEG(&type, &num_elm, tmp_dst, &bitoff, source);
+          if (ierr != 0)
+            {
+                HDfree(tmp_dst);
+                HRETURN_ERROR(DFE_BADCONV, FAIL);   /* error in Cray conversion */
+            }   /* end if */
+          DFKswap(tmp_dst, dest, 8, num_elm);
+          HDfree(tmp_dst);
+      }     /* end if */
+    else
+      {
+#ifdef NOSTRIDEFLOATCRAY2IEG
+          for (i = 0; i < num_elm; i++)
+            {
+                dud[0] = source[0];
+                dud[1] = source[1];
+                dud[2] = source[2];
+                dud[3] = source[3];
+                dud[4] = source[4];
+                dud[5] = source[5];
+                dud[6] = source[6];
+                dud[7] = source[7];
+
+                if (buf != 0)
+                  {
+                      buf = (((buf & LUO8F_MASKA) |     /* sign bit */
+                      (((((buf & LUO8F_MASKB) >> 48) - 15362) << 53) >> 1)) |   /* exp */
+                             ((buf & LUO8F_MASKC) << 5));   /* mantissa */
+                  }
+                else
+                    buf = 0;
+
+                dest[7] = dud[0];
+                dest[6] = dud[1];
+                dest[5] = dud[2];
+                dest[4] = dud[3];
+                dest[3] = dud[4];
+                dest[2] = dud[5];
+                dest[1] = dud[6];
+                dest[0] = dud[7];
+
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+#else
+          tmp_dst = (uint8 *) HDmalloc(8);
+	  if (!tmp_dst)
+	      HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < num_elm; i++)
+            {
+                bitoff = ((unsigned int)dest) >> BITOFF;
+                ierr = CRAY2IEG(&type, &n_elem, tmp_dst, &bitoff, source);
+                if (ierr != 0)
+                  {
+                      HDfree(tmp_dst);
+                      HRETURN_ERROR(DFE_BADCONV, FAIL);     /* error in Cray conversion */
+                  }     /* end if */
+                DFKswap(tmp_dst, dest, 8, 1);
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+          HDfree(tmp_dst);
+#endif
+      }     /* end else */
+    return (SUCCEED);
+}
+
+#else  /* i.e. not on a cray */
+
+int         cray_dummy;         /* prevent empty symbol table messages */
+
+#endif /* UNICOS */
+
+/* =============================================================*/
+/* CRAY-MPP (T3D) routines 					*/
+/* ============================================================ */
+#if defined(CRAYMPP)
+
+/************************************************************/
+/* DFKmi2i()                                                */
+/* -->CRAY-MPP routine for importing 2 byte data items      */
+/* (**) This routine converts two byte IEEE to 4 bytes      */
+/*      CRAY-MPP big endian integer unsigned.               */
+/************************************************************/
+int
+DFKmi2i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    intn	i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKmi2i";
+
+    HEclear();
+
+    if (source_stride == 0 && dest_stride == 0){
+	source_stride = 2;
+	dest_stride   = 4;
+    }
+
+    /* parameters check */
+    if (source == dest			/* Inplace conversions not permitted */
+	|| num_elm == 0			/* No elements is an error */
+	|| source_stride == 0		/* only positive stride allowed */
+	|| dest_stride == 0		/* only positive stride allowed */
+	)
+        HRETURN_ERROR(DFE_BADCONV, FAIL);
+
+  for (i = 0; i < num_elm; i++)
+    {
+	dest[0] = 0x00;
+	dest[1] = 0x00;
+	dest[2] = source[0];
+	dest[3] = source[1];
+	source += source_stride;
+	dest += dest_stride;
+    }
+    return (SUCCEED);
+}
+
+/************************************************************/
+/* DFKmi2s()                                                */
+/* -->CRAY-MPP routine for importing 2 byte signed ints     */
+/* (**) This routine converts two byte IEEE to 4 bytes      */
+/*      Cray-MPP big endian integers.                       */
+/************************************************************/
+int
+DFKmi2s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    intn	i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKmi2i";
+
+    HEclear();
+
+    if (source_stride == 0 && dest_stride == 0){
+	source_stride = 2;
+	dest_stride   = 4;
+    }
+
+    /* parameters check */
+    if (source == dest			/* Inplace conversions not permitted */
+	|| num_elm == 0			/* No elements is an error */
+	|| source_stride == 0		/* only positive stride allowed */
+	|| dest_stride == 0		/* only positive stride allowed */
+	)
+        HRETURN_ERROR(DFE_BADCONV, FAIL);
+
+    for (i = 0; i < num_elm; i++)
+    {
+	if ((source[0] & 0x80))
+	{   /* Need to extend sign */
+	    dest[0] = 0xff;
+	    dest[1] = 0xff;
+	} 
+	else
+	{
+	    dest[0] = 0x00;
+	    dest[1] = 0x00;
+	}
+	dest[2] = source[0];
+	dest[3] = source[1];
+	source += source_stride;
+	dest += dest_stride;
+    }
+    return (SUCCEED);
+}
+
+/************************************************************/
+/* DFKmo2b()                                                */
+/* -->CRAY-MPP routine for exporting 4 byte data as 2 byte  */
+/*    data items.  This works for signed and unsigned data. */
+/************************************************************/
+int
+DFKmo2b(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    uintn	i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKmo2b";
+
+    HEclear();
+
+    if (source_stride == 0 && dest_stride == 0){
+	source_stride = 4;
+	dest_stride   = 2;
+    }
+
+    /* parameters check */
+    if (source == dest			/* Inplace conversions not permitted */
+	|| num_elm == 0			/* No elements is an error */
+	|| source_stride == 0		/* only positive stride allowed */
+	|| dest_stride == 0		/* only positive stride allowed */
+	)
+        HRETURN_ERROR(DFE_BADCONV, FAIL);
+
+    for (i = 0; i < num_elm; i++)
+    {
+	dest[0] = source[2];
+	dest[1] = source[3];
+	source += source_stride;
+	dest += dest_stride;
+    }
+    return (SUCCEED);
+}
+
+/************************************************************/
+/* DFKlmi2i()                                               */
+/* -->CRAY-MPP routine for importing 2 byte data items        */
+/* (**) This routine converts two byte little-endian IEEE   */
+/*      to 4 byte Cray-MPP big endian integer.              */
+/************************************************************/
+int
+DFKlmi2i(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    uintn	i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKlmi2i";
+
+    HEclear();
+
+    if (source_stride == 0 && dest_stride == 0){
+	source_stride = 2;
+	dest_stride   = 4;
+    }
+
+    /* parameters check */
+    if (source == dest			/* Inplace conversions not permitted */
+	|| num_elm == 0			/* No elements is an error */
+	|| source_stride == 0		/* only positive stride allowed */
+	|| dest_stride == 0		/* only positive stride allowed */
+	)
+        HRETURN_ERROR(DFE_BADCONV, FAIL);
+
+
+          for (i = 0; i < num_elm; i++)
+            {
+                dest[0] = 0x00;
+                dest[1] = 0x00;
+                dest[2] = source[1];
+                dest[3] = source[0];
+                source += source_stride;
+                dest += dest_stride;
+            }   /* end for */
+    return (SUCCEED);
+}
+
+/************************************************************/
+/* DFKlmi2s()                                                */
+/* -->CRAY-MPP routine for importing 2 byte signed ints       */
+/* (**) This routine converts two byte IEEE to 4 bytes   */
+/*      Cray-MPP big endian integer.              */
+/************************************************************/
+int
+DFKlmi2s(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+
+    uintn	i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKlmi2s";
+
+    HEclear();
+
+    if (source_stride == 0 && dest_stride == 0){
+	source_stride = 2;
+	dest_stride   = 4;
+    }
+
+    /* parameters check */
+    if (source == dest			/* Inplace conversions not permitted */
+	|| num_elm == 0			/* No elements is an error */
+	|| source_stride == 0		/* only positive stride allowed */
+	|| dest_stride == 0		/* only positive stride allowed */
+	)
+        HRETURN_ERROR(DFE_BADCONV, FAIL);
+
+    for (i = 0; i < num_elm; i++)
+    {
+	if ((source[1] & 0x80))
+	  {   /* Need to extend sign */
+	      dest[0] = 0xff;
+	      dest[1] = 0xff;
+	  }     /* end if */
+	else
+	  {
+	      dest[0] = 0x00;
+	      dest[1] = 0x00;
+	  }     /* end else */
+	dest[2] = source[1];
+	dest[3] = source[0];
+	source += source_stride;
+	dest += dest_stride;
+    }
+    return (SUCCEED);
+}
+
+/************************************************************/
+/* DFKlmo2b()                                               */
+/* -->CRAY-MPP routine for exporting 4 bytes signed int as  */
+/*    2 bytes little-endian data items                      */
+/************************************************************/
+int
+DFKlmo2b(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    uint32 i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKlmo2b";
+
+
+    HEclear();
+
+    if (source_stride == 0 && dest_stride == 0){
+	source_stride = 4;
+	dest_stride   = 2;
+    }
+
+    /* parameters check */
+    if (source == dest			/* Inplace conversions not permitted */
+	|| num_elm == 0			/* No elements is an error */
+	|| source_stride == 0		/* only positive stride allowed */
+	|| dest_stride == 0		/* only positive stride allowed */
+	)
+        HRETURN_ERROR(DFE_BADCONV, FAIL);
+
+    for (i = 0; i < num_elm; i++)
+    {
+	dest[0] = source[3];
+	dest[1] = source[2];
+	source += source_stride;
+	dest += dest_stride;
+    }   /* end for */
+    return (SUCCEED);
+}
+
+#else  /* i.e. not on a craympp */
+
+int         craympp_dummy;         /* prevent empty symbol table messages */
+
+#endif /* CRAYMPP */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfkfuji.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfkfuji.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfkfuji.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,786 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.14 $";
+#endif
+
+/* $Id: dfkfuji.c,v 1.14 1996/01/19 01:13:21 koziol Exp $ */
+
+/*------------------------------------------------------------------
+ File:  dfkfuji.c
+
+ Purpose:
+    Routines to support Fujitsu-Native (VP) conversion to and from HDF format
+
+ Invokes:
+
+ PRIVATE conversion functions:
+    DFKpi4f -  VP routine for importing 32 bit floats
+    DFKpo4f -  VP routine for exporting 32 bit floats
+    DFKpi8f -  VP routine for importing 64 bit floats
+    DFKpo8f -  VP routine for exporting 64 bit floats
+    DFKlpi4f - VP routine for importing little-endian 32 bit floats
+    DFKlpo4f - VP routine for exporting little-endian 32 bit floats
+    DFKlpi8f - VP routine for importing little-endian 64 bit floats
+    DFKlpo8f - VP routine for exporting little-endian 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"
+
+#if defined(VP)
+
+/*
+ * NUMBER CONVERSION ROUTINES FOR Fujitsu VP series
+ * (IBM floating point, BIG-ENDIAN integer types, ASCII
+ *  chars...)
+ *
+ * Drew Whitehouse,
+ * Australian National University Supercomputer Facility.
+ * Dec 92.
+ *
+ * Routines used were adapted from routines provided for
+ * anon. ftp by the Cornell National Supercomputer
+ * Facility. The following copyright was attached.....
+ *
+ */
+
+/*---------------------------------------------------------------------*
+ * Val I. Garger, Technology Integration                               *
+ * Group, CNSF, Cornell University                                     *
+ * vig at eagle.cnsf.cornell.edu                                          *
+ *-------------------------------------------------------------------- *
+ *                                                                     *
+ *  COPYRIGHT -  VAL GARGER, CORNELL NATIONAL SUPERCOMPUTER FACILITY,  *
+ *               (JUNE 1990) CORNELL UNIVERSITY, ITHACA, NY.           *
+ *               CONTAINS RESTRICTED MATERIALS OF CORNELL UNIVERSITY,  *
+ *               (C) COPYRIGHT CORNELL UNIVERSITY 1990                 *
+ *---------------------------------------------------------------------*/
+
+/************************************************************/
+/* DFKpi4f()                                                */
+/* --> Import routine for 4 byte IBM floats                 */
+/* ie IEEE32->IBM32                                         */
+/************************************************************/
+
+#define pi4f_last 0x000000ff
+#define pi4f_impl 0x00800000
+#define pi4f_sign 0x80000000
+#define pi4f_tiss 0x007fffff
+
+int
+DFKpi4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+  intn i,k;
+  int32 ibs, ibe, ibt;
+
+  uint8 * source = (uint8*)s;
+  uint8 * dest = (uint8*)d;
+  uint32 *buf;
+  char *FUNC="DFKpi4f";
+
+  HEclear();
+
+  if(num_elm == 0)   /* No elements is an error */
+    HRETURN_ERROR(DFE_BADCONV,FAIL);
+
+  if(source_stride == 0 && dest_stride == 0)
+      source_stride = dest_stride = 4;
+
+  for(i = 0; i < num_elm; i++) {
+
+    buf = (uint32*)source;
+    ibt =   *buf;
+    ibs =   *buf          &  pi4f_sign;
+    ibe  = ( *buf >> 23 )  &  pi4f_last;
+
+    if( ibe != 0 )  {
+      if( ibe == 255 ) { 
+	ibe = 378;
+	ibt = pi4f_tiss;
+      } 
+      ibe = ibe - 127 + 256 +1;
+      k = ibe%4;
+      ibe = ibe/4;
+      if( k != 0 ) 
+	ibe = ibe + 1;
+      ibe = ibe << 24 ;
+      ibt = (ibt & pi4f_tiss) | pi4f_impl ;
+      if (k != 0)
+	ibt = ( ibt + (1 << (3-k) )  ) >> (4-k);
+    }
+
+    buf = (uint32*)dest;
+    *buf = ibs | ibe | ibt;                            
+    source += source_stride;
+    dest   += dest_stride;
+  }
+  return 0;
+}
+
+/************************************************************/
+/* DFKpo4f()                                                */
+/* --> Export routine for 4 byte IBM floats                 */
+/* IBM->IEEE                                                */
+/************************************************************/
+
+#define   po4f_exp   0x7F000000
+#define   po4f_sign  0x80000000
+#define   po4f_tis   0x00FFFFFF
+#define   po4f_etis  0x007FFFFF
+
+int
+DFKpo4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+  intn i, k;
+  int32 ibs, ibe, ibt, it;
+
+  uint8 * source = (uint8*)s;
+  uint8 * dest = (uint8*)d;
+  char *FUNC="DFKpi4f";
+  uint32 *buf;
+  uint8 exp;
+
+  HEclear();
+
+  if(num_elm == 0 )		/* No elements is an error */
+    HRETURN_ERROR(DFE_BADCONV,FAIL);
+
+  if(source_stride == 0 && dest_stride == 0)
+    source_stride = dest_stride = 4;
+
+  for(i = 0; i < num_elm; i++) {
+
+    buf = (uint32*)source;
+    ibs = *buf  & po4f_sign;
+    ibe = *buf  & po4f_exp;
+    ibt = *buf  & po4f_tis;
+    it = ibt << 8;
+
+    for(k = 0;  (k < 5) && (it >= 0);  k++ ) 
+      it = it << 1;
+
+    if( k < 4 ) {
+      ibt = (it >> 8) & po4f_etis;
+      ibe = (ibe >> 22) - 256 + 127 - k - 1;
+      if( ibe < 0 )
+	ibe = ibt = 0;
+      if( ibe >= 255 ) {
+	ibe = 255;                                                
+	ibt = 0;                                                 
+      }                                                              
+      ibe = ibe << 23;
+    }
+
+    /* put result into dest */
+    buf = (uint32*)dest;
+    *buf = ibs | ibe | ibt;                            
+    source += source_stride;
+    dest   += dest_stride;
+  }
+  return 0;
+
+}
+
+/************************************************************/
+/* DFKpi8f()                                                */
+/* --> Import routine for 8 byte VP floats                  */
+/* ie IEEE64->IBM64                                         */
+/************************************************************/
+
+#define pi8f_impl 0x00100000
+#define pi8f_sign 0x80000000
+#define pi8f_maxl 0x00ffffff
+#define pi8f_expn 0x7ff00000
+#define pi8f_tiss 0x000fffff
+#define pi8f_maxr 0xffffffff
+
+int
+DFKpi8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+  uint8 * source = (uint8*)s;
+  uint8 * dest   = (uint8*)d;
+  char *FUNC="DFKpi8f"; 
+  intn i,k;
+  uint32 ibs,ibe,ibt1,ibt2,isht;
+  uint32 *buf;
+
+  HEclear();
+
+  if(num_elm == 0) {		/* No elements is an error */ 
+    HERROR(DFE_BADCONV);
+    return FAIL;
+  }
+
+  if(source_stride == 0 && dest_stride == 0)
+    source_stride = dest_stride = 8;
+
+  for ( i = 0; i < num_elm ; i++) {
+
+    buf  = (uint32*)source;
+    ibs  = *buf & pi8f_sign;
+    ibe  = *buf & pi8f_expn;
+    ibt1 = *buf & pi8f_tiss;
+    ibt2 = *(buf+1);
+
+    if (ibe != 0) {
+
+      ibe = (ibe >> 20) - 1023 + 256 + 1;
+      k = 0;                                                                    
+      if (ibe > 508) k = 2;                                                     
+      if (ibe <   0) k = 1; 
+
+      switch (k) {
+
+      case 1:
+	ibe = ibt1 = ibt2 = 0;
+	break;
+
+      case 2:
+	ibe = 127;
+	ibt1 = pi8f_maxl;
+	ibt2 = pi8f_maxr;
+	break;
+
+      default:
+	isht = ibe % 4 -  1;
+	ibe = ibe >> 2 ; 
+	if ( isht != -1)
+	  ibe += 1;
+	else
+	  isht = 3;
+
+	ibt1 |=  pi8f_impl;
+	if (isht != 0 ) {
+	  ibt1 = ( ibt1 << isht ) |  (ibt2 >> 32-isht);
+	  ibt2 = ibt2 << isht;
+	}
+	break;
+      }
+      ibe = ibe << 24;
+
+    } /* ibe != 0 */
+
+    /* put number into destination array */
+    buf  = (uint32*)dest;
+
+    *buf = ibs | ibe | ibt1;
+    *(buf+1) = ibt2;
+
+    source += source_stride;
+    dest   += dest_stride;
+  }
+  return 0;
+}
+
+/************************************************************/
+/* DFKpo8f()                                                */
+/* --> Export routine for 8 byte VP floats                  */
+/* IBM64->IEEE64                                            */
+/************************************************************/
+#define  po8f_exp   0x7f000000
+#define  po8f_sign  0x80000000
+#define  po8f_tiss  0x00FFFFFF
+#define  po8f_nrm   0x00f00000
+static uint32 take[4] = {0x007fffff, 0x003fffff, 0x001fffff, 0x000fffff};
+static uint32 look[4] = {0x00800000, 0x00400000, 0x00200000, 0x00100000};
+int
+DFKpo8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+  uint8 * source = (uint8*)s;
+  uint8 * dest = (uint8*)d;
+  uint32 ibs, ibe, ibt1, ibt2, it, isht;
+  intn i,k;
+  uint32 *buf;
+  double *tmp;
+  char *FUNC="DFKpo8f";
+  union {
+    struct { 
+      unsigned long i1;
+      unsigned long i2;
+    } sti;
+    struct { 
+      double r;
+    } str;
+  } un;
+
+  HEclear();
+
+  if(num_elm == 0)		/* No elements is an error */
+    HRETURN_ERROR(DFE_BADCONV,FAIL);
+
+  if(source_stride == 0 && dest_stride == 0)
+    source_stride = dest_stride = 8;
+
+  for (i = 0; i < num_elm; i++) {
+
+    buf = (uint32*)source;
+    ibs  = *buf & po8f_sign;
+    ibe  = *buf & po8f_exp;
+    ibt1 = *buf & po8f_tiss;
+    ibt2 = *(buf+1);
+
+    if  ( (ibt1 == 0) && (ibt2 == 0) )                                          
+      ibe = 0 ;                                                                
+    else {
+
+      if ( (ibe != 0) && ( (ibt1 & po8f_nrm) == 0 ) ) {
+	un.sti.i1 = *buf;
+	un.sti.i2 = *(buf+1) ;
+	un.str.r  = un.str.r + 0e0 ;
+	ibe  = un.sti.i1 & po8f_exp ;
+	ibt1 = un.sti.i1 & po8f_tiss ;
+	ibt2 = un.sti.i2 ;
+      }
+
+      if      ((ibt1 & look[0]) != 0 )
+	{ k = 3 ; ibt1 =  ibt1 & take[0] ; }
+      else if ((ibt1 & look[1]) != 0 )
+	{ k = 2 ; ibt1 =  ibt1 & take[1] ; }
+      else if ((ibt1 & look[2]) != 0 )
+	{ k = 1 ; ibt1 =  ibt1 & take[2] ; }
+      else if ((ibt1 & look[3]) != 0 )
+	{ k = 0 ;  ibt1 =  ibt1 & take[3] ; }
+      else k = 4;
+
+      /* mantissa */
+      if  (k < 4) {
+	if (k != 0) {
+	  /* shift with rounding */
+	    it   = (ibt2 & 65535) + (1 << (k-1)) ;
+	    ibt2 = ( (ibt2 >> 16) & 65535 )  +  (it >> 16) ;
+	    ibt1 = ibt1 + (ibt2 >> 16) ;
+	    /* rounded */
+	    ibt2 = ( (ibt2 & 65535) << (16-k) ) | ( (it & 65535) >> k) ;
+	    it   = ibt1 << (32 - k) ;
+	    ibt1 = ibt1 >> k ;
+	    ibt2 = ibt2 | it;
+	  }                                                                      
+
+	/*  exponent */                                                       
+	ibe = ( (ibe >> 22)  - 256 + 1023 + k - 4 ) << 20 ;                    
+      } 
+    }
+    /* put number into destination array */
+    buf = (uint32*)dest;
+    *buf     = ibs | ibe | ibt1;
+    *(buf+1) = ibt2;
+    source += source_stride;
+    dest   += dest_stride;
+  }
+  return 0;
+}
+
+/************************************************************/
+/* DFKlpi4f()                                               */
+/* --> Import routine for 4 byte IBM floats                 */
+/* ie little-endian IEEE32->IBM32                           */
+/************************************************************/
+
+#define lpi4f_last  0x000000ff
+#define lpi4f_impl  0x00800000
+#define lpi4f_sign  0x80000000
+#define lpi4f_tiss  0x007fffff
+#define LPI4F_MASKA 0xff00ff00
+#define LPI4F_MASKB 0x00ff00ff
+#define LPI4F_MASKC 0xffff0000
+#define LPI4F_MASKD 0x0000ffff
+
+int
+DFKlpi4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    intn i,k;
+    int32 ibs, ibe, ibt;
+    uint8 * source = (uint8*)s;
+    uint8 * dest = (uint8*)d;
+    uint32 *buf;
+    uint32 temp;
+    char *FUNC="DFKpi4f";
+
+    HEclear();
+
+    if(num_elm == 0)   /* No elements is an error */
+        HRETURN_ERROR(DFE_BADCONV,FAIL);
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 4;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+          buf = (uint32 *) source;
+          temp = ((*buf & LPI4F_MASKA) >> 8) | ((*buf & LPI4F_MASKB) << 8);
+          temp = ((temp & LPI4F_MASKC) >> 16) | ((temp & LPI4F_MASKD) << 16);
+
+          ibt = temp;
+          ibs = temp & lpi4f_sign;
+          ibe = (temp >> 23) & lpi4f_last;
+
+          if (ibe != 0)
+            {
+                if (ibe == 255)
+                  {
+                      ibe = 378;
+                      ibt = lpi4f_tiss;
+                  }     /* end if */
+                ibe = ibe - 127 + 256 + 1;
+                k = ibe % 4;
+                ibe = ibe / 4;
+                if (k != 0)
+                    ibe = ibe + 1;
+                ibe = ibe << 24;
+                ibt = (ibt & lpi4f_tiss) | lpi4f_impl;
+                if (k != 0)
+                    ibt = (ibt + (1 << (3 - k))) >> (4 - k);
+            }   /* end if */
+
+          buf = (uint32 *) dest;
+          *buf = ibs | ibe | ibt;
+          source += source_stride;
+          dest += dest_stride;
+      }     /* end for */
+    return 0;
+}
+
+/************************************************************/
+/* DFKlpo4f()                                               */
+/* --> Export routine for 4 byte IBM floats                 */
+/* IBM->little-endian IEEE                                  */
+/************************************************************/
+
+#define lpo4f_exp   0x7F000000
+#define lpo4f_sign  0x80000000
+#define lpo4f_tis   0x00FFFFFF
+#define lpo4f_etis  0x007FFFFF
+#define LPO4F_MASKA 0xff00ff00
+#define LPO4F_MASKB 0x00ff00ff
+#define LPO4F_MASKC 0xffff0000
+#define LPO4F_MASKD 0x0000ffff
+
+int
+DFKlpo4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    intn i, k;
+    int32 ibs, ibe, ibt, it;
+    uint8 * source = (uint8*)s;
+    uint8 * dest = (uint8*)d;
+    char *FUNC="DFKpi4f";
+    uint32 *buf;
+    uint32 temp;
+    uint8 exp;
+
+    HEclear();
+
+    if(num_elm == 0 )        /* No elements is an error */
+        HRETURN_ERROR(DFE_BADCONV,FAIL);
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 4;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+          buf = (uint32 *) source;
+          ibs = *buf & lpo4f_sign;
+          ibe = *buf & lpo4f_exp;
+          ibt = *buf & lpo4f_tis;
+          it = ibt << 8;
+
+          for (k = 0; (k < 5) && (it >= 0); k++)
+              it = it << 1;
+
+          if (k < 4)
+            {
+                ibt = (it >> 8) & lpo4f_etis;
+                ibe = (ibe >> 22) - 256 + 127 - k - 1;
+                if (ibe < 0)
+                    ibe = ibt = 0;
+                if (ibe >= 255)
+                  {
+                      ibe = 255;
+                      ibt = 0;
+                  }     /* end if */
+                ibe = ibe << 23;
+            }   /* end if */
+
+          /* put result into dest */
+          buf = (uint32 *) dest;
+          temp = ibs | ibe | ibt;
+          temp = ((temp & LPO4F_MASKA) >> 8) | ((temp & LPO4F_MASKB) << 8);
+          temp = ((temp & LPO4F_MASKC) >> 16) | ((temp & LPO4F_MASKD) << 16);
+          *buf = temp;
+          source += source_stride;
+          dest += dest_stride;
+      }     /* end for */
+    return 0;
+}
+
+/************************************************************/
+/* DFKlpi8f()                                               */
+/* --> Import routine for 8 byte VP floats                  */
+/* ie little-endian IEEE64->IBM64                           */
+/************************************************************/
+
+#define lpi8f_impl 0x00100000
+#define lpi8f_sign 0x80000000
+#define lpi8f_maxl 0x00ffffff
+#define lpi8f_expn 0x7ff00000
+#define lpi8f_tiss 0x000fffff
+#define lpi8f_maxr 0xffffffff
+#define LPI8F_MASKA 0xff00ff00
+#define LPI8F_MASKB 0x00ff00ff
+#define LPI8F_MASKC 0xffff0000
+#define LPI8F_MASKD 0x0000ffff
+
+int
+DFKlpi8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    uint8 * source = (uint8*)s;
+    uint8 * dest   = (uint8*)d;
+    char *FUNC="DFKpi8f";
+    intn i,k;
+    uint32 ibs,ibe,ibt1,ibt2,isht;
+    uint32 *buf;
+    uint32 temp;
+
+    HEclear();
+
+    if(num_elm == 0)         /* No elements is an error */
+        HRETURN_ERROR(DFE_BADCONV,FAIL);
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 8;
+
+    for (i = 0; i < num_elm; i++)
+      {
+        buf  = (uint32*)source; /* be careful of 32-bit word swapping below */
+        temp = ((*(buf+1) & LPI8F_MASKA)>>8) | ((*(buf+1) & LPI8F_MASKB)<<8);
+        temp = ((temp & LPI8F_MASKC)>>16) | ((temp & LPI8F_MASKD)<<16);
+        ibs  = temp & lpi8f_sign;
+        ibe  = temp & lpi8f_expn;
+        ibt1 = temp & lpi8f_tiss;
+
+        temp = ((*buf & LPI8F_MASKA)>>8) | ((*buf & LPI8F_MASKB)<<8);
+        temp = ((temp & LPI8F_MASKC)>>16) | ((temp & LPI8F_MASKD)<<16);
+        ibt2 = temp;
+
+          if (ibe != 0)
+            {
+
+                ibe = (ibe >> 20) - 1023 + 256 + 1;
+                k = 0;
+                if (ibe > 508)
+                    k = 2;
+                if (ibe < 0)
+                    k = 1;
+
+                switch (k)
+                  {
+
+                      case 1:
+                          ibe = ibt1 = ibt2 = 0;
+                          break;
+
+                      case 2:
+                          ibe = 127;
+                          ibt1 = lpi8f_maxl;
+                          ibt2 = lpi8f_maxr;
+                          break;
+
+                      default:
+                          isht = ibe % 4 - 1;
+                          ibe = ibe >> 2;
+                          if (isht != -1)
+                              ibe += 1;
+                          else
+                              isht = 3;
+
+                          ibt1 |= lpi8f_impl;
+                          if (isht != 0)
+                            {
+                                ibt1 = (ibt1 << isht) | (ibt2 >> 32 - isht);
+                                ibt2 = ibt2 << isht;
+                            }   /* end if */
+                          break;
+                  }     /* end switch */
+                ibe = ibe << 24;
+            }   /* ibe != 0 */
+
+          /* put number into destination array */
+          buf = (uint32 *) dest;
+          *buf = ibs | ibe | ibt1;
+          *(buf + 1) = ibt2;
+
+          source += source_stride;
+          dest += dest_stride;
+      }     /* end for */
+    return 0;
+}
+
+/************************************************************/
+/* DFKlpo8f()                                               */
+/* --> Export routine for 8 byte VP floats                  */
+/* IBM64->little-endian IEEE64                              */
+/************************************************************/
+
+#define lpo8f_exp   0x7f000000
+#define lpo8f_sign  0x80000000
+#define lpo8f_tiss  0x00FFFFFF
+#define lpo8f_nrm   0x00f00000
+#define LPO8F_MASKA 0xff00ff00
+#define LPO8F_MASKB 0x00ff00ff
+#define LPO8F_MASKC 0xffff0000
+#define LPO8F_MASKD 0x0000ffff
+
+static int32 ltake[4] =
+{0x007fffff, 0x003fffff, 0x001fffff, 0x000fffff};
+static int32 llook[4] =
+{0x00800000, 0x00400000, 0x00200000, 0x00100000};
+
+int
+DFKlpo8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    uint8 * source = (uint8*)s;
+    uint8 * dest = (uint8*)d;
+    uint32 ibs, ibe, ibt1, ibt2, it, isht;
+    intn i,k;
+    uint32 *buf;
+    uint32 temp;
+    double *tmp;
+    char *FUNC="DFKpo8f";
+    union {
+        struct {
+          unsigned long i1;
+          unsigned long i2;
+        } sti;
+        struct {
+          double r;
+        } str;
+    } un;
+
+    HEclear();
+
+    if(num_elm == 0)      /* No elements is an error */
+        HRETURN_ERROR(DFE_BADCONV,FAIL);
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 8;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+        buf = (uint32*)source;
+        ibs  = *buf & lpo8f_sign;
+        ibe  = *buf & lpo8f_exp;
+        ibt1 = *buf & lpo8f_tiss;
+        ibt2 = *(buf+1);
+
+        if  ( (ibt1 == 0) && (ibt2 == 0) )
+            ibe = 0 ;
+        else {
+
+            if ( (ibe != 0) && ( (ibt1 & lpo8f_nrm) == 0 ) ) {
+                un.sti.i1 = *buf;
+                un.sti.i2 = *(buf+1) ;
+                un.str.r  = un.str.r + 0e0 ;
+                ibe  = un.sti.i1 & lpo8f_exp ;
+                ibt1 = un.sti.i1 & lpo8f_tiss ;
+                ibt2 = un.sti.i2 ;
+              } /* end if */
+
+            if((ibt1 & llook[0]) != 0 ) {
+                k = 3 ;
+                ibt1 =  ibt1 & ltake[0] ;
+              } /* end if */
+            else if((ibt1 & llook[1]) != 0 ) {
+                k = 2 ;
+                ibt1 =  ibt1 & ltake[1] ;
+              } /* end if */
+            else if((ibt1 & llook[2]) != 0 ) {
+                k = 1 ;
+                ibt1 =  ibt1 & ltake[2] ;
+              } /* end if */
+            else if((ibt1 & llook[3]) != 0 ) {
+                k = 0 ;
+                ibt1 =  ibt1 & ltake[3] ;
+              } /* end if */
+            else
+                k = 4;
+
+            /* mantissa */
+            if  (k < 4) {
+                if (k != 0) {   /* shift with rounding */
+                    it   = (ibt2 & 65535) + (1 << (k-1)) ;
+                    ibt2 = ( (ibt2 >> 16) & 65535 )  +  (it >> 16) ;
+                    ibt1 = ibt1 + (ibt2 >> 16) ;
+                    /* rounded */
+                    ibt2 = ( (ibt2 & 65535) << (16-k) ) | ( (it & 65535) >> k) ;
+                    it   = ibt1 << (32 - k) ;
+                    ibt1 = ibt1 >> k ;
+                    ibt2 = ibt2 | it;
+                  } /* end if */
+
+                /*  exponent */
+                ibe = ( (ibe >> 22)  - 256 + 1023 + k - 4 ) << 20 ;
+              } /* end if */
+          } /* end else */
+        /* put number into destination array */
+        buf = (uint32*)dest;
+          temp = ibs | ibe | ibt1;
+          temp = ((temp & LPO8F_MASKA) >> 8) | ((temp & LPO8F_MASKB) << 8);
+          temp = ((temp & LPO8F_MASKC) >> 16) | ((temp & LPO8F_MASKD) << 16);
+          *(buf + 1) = temp;    /* make certain to swap this also! */
+          temp = ibt2;
+          temp = ((temp & LPO8F_MASKA) >> 8) | ((temp & LPO8F_MASKB) << 8);
+          temp = ((temp & LPO8F_MASKC) >> 16) | ((temp & LPO8F_MASKD) << 16);
+          *buf = temp;
+          source += source_stride;
+          dest += dest_stride;
+      }     /* end for */
+    return 0;
+}
+
+#else
+
+int         fuji_dummy;         /* prevent empty symbol table messages */
+
+#endif /* VP */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfknat.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfknat.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfknat.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,328 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.13 $";
+#endif
+
+/* $Id: dfknat.c,v 1.13 2000/08/29 13:55:34 koziol Exp $ */
+
+/*------------------------------------------------------------------
+ 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;
+}
+
+#if !defined(UNICOS)    /* UNICOS does not need these routines */
+
+/************************************************************/
+/* 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;
+}
+
+#endif /* UNICOS */
+
+/************************************************************/
+/* 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;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfkswap.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfkswap.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfkswap.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,439 @@
+
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.12 $";
+#endif
+
+/* $Id: dfkswap.c,v 1.12 2000/08/29 13:55:35 koziol Exp $ */
+
+/*------------------------------------------------------------------
+ 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;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfkvms.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfkvms.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfkvms.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1141 @@
+
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)1.13";
+#endif
+
+/* dfkvms.c,v 1.13 1994/10/19 20:55:46 koziol Exp */
+
+/*------------------------------------------------------------------
+ File:  dfkvms.c
+
+ Purpose:
+    Routines to support Vax-native conversion to and from HDF format
+
+ Invokes:
+
+ PRIVATE conversion functions:
+    DFKvi4f -  VMS routine for importing 32 bit floats
+    DFKvo4f -  VMS routine for exporting 32 bit floats
+    DFKvi8f -  VMS routine for importing 64 bit floats
+    DFKvo8f -  VMS routine for exporting 64 bit floats
+    DFKlvi4f-  VMS routine for importing little-endian 32 bit floats
+    DFKlvo4f-  VMS routine for exporting little-endian 32 bit floats
+    DFKlvi8f-  VMS routine for importing little-endian 64 bit floats
+    DFKlvo8f-  VMS routine for exporting little-endian 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
+
+ Modifications:
+    Lawrence Fisher, Digital Equipment Corp, October 29, 1997
+    Added routines to support OpenVMS Alpha.  The default 64 bit floating point
+    type for OpenVMS Alpha is Vax G-Float, not Vax D-float, as a result the
+    VAX VMS designed conversion routines were in error.  Substituted
+    the OpenVMS routine CVT$FTOF (convert float to float) to optimize
+    throughput.
+
+    Lawrence Fisher, Digital Eqipment Corp, January 30th, 1998
+    Rewrote conversion routines to use OpenVMS routine CVT$CONVERT_FLOAT
+    to provide compatibility back to version 6.2 of OpenVMS Alpha.
+
+ *------------------------------------------------------------------*/
+
+/*****************************************************************************/
+/*                                                                           */
+/*    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"
+
+#if defined(VMS)
+#ifdef __ALPHA
+#include <cvt$routines.h>
+#include <cvtdef.h>
+
+#endif /* __ALPHA */
+
+/************************************************************/
+/* NUMBER CONVERSION ROUTINES FOR VAX ARCHITECTURES         */
+/* Most of the VAX number types can be handled with the     */
+/* generic byte swapping routines.  Only the floating point */
+/* conversion routines need to be customized.               */
+/************************************************************/
+
+/************************************************************/
+/* DFKvi4f()                                                */
+/* --> Import routine for 4 byte VAX floats                 */
+/************************************************************/
+int
+DFKvi4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKvi4f";
+    uint8       exp;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 4;
+
+    for (i = 0; i < num_elm; i++)
+      {
+#ifdef __ALPHA
+
+        {
+	uint32 *s1 = (uint32 *)source;
+        uint32 *d1 = (uint32 *)dest;
+        uint32 input = *s1;
+	uint32 output= *d1;
+/*          (void)cvt$ftof(&input,CVT$K_BIG_ENDIAN_IEEE_S,&output,CVT$K_VAX_F,0);
+*/
+	(void)CVT$CONVERT_FLOAT(&input,CVT$K_IEEE_S,&output,CVT$K_VAX_F,
+				CVT$M_ROUND_TO_NEAREST+CVT$M_BIG_ENDIAN);
+	*d1 = output;
+        }
+
+#else
+
+          /* extract exponent */
+          exp = (source[0] << 1) | (source[1] >> 7);
+          if (exp)
+            {
+                /*
+                 * non-zero exponent
+                 */
+
+                /* copy mantissa, last bit of exponent */
+                dest[0] = source[1];
+                dest[2] = source[3];
+                dest[3] = source[2];
+                if (exp < 254)
+                    /* normal value */
+                    dest[1] = source[0] + (uint8) 1;    /* actually adds two to exp */
+                else
+                  {
+                      /* infinity or NaN */
+                      if (exp == 254)   /* unrepresentable - OFL */
+                          /* set mant = 0 for overflow */
+                          dest[0] = dest[1] = dest[2] = dest[3] = 0;
+                      dest[0] &= 0x7f;  /* set last bit of exp to 0 */
+                      dest[1] = 0x80;   /* sign=1 exp=0 -> OFL or NaN */
+                  }
+            }
+          else if (source[1] & 0x60)
+            {   /* denormalized value */
+                int shft;
+
+                shft = (source[1] & 0x40) ? 1 : 2;  /* shift needed to normalize */
+                /* shift mantissa */
+                /* note last bit of exp set to 1 implicitly */
+                dest[0] = (uint8) (source[1] << shft)
+                    | (uint8) (source[2] >> (8 - shft));
+                dest[3] = (uint8) (source[2] << shft)
+                    | (uint8) (source[3] >> (8 - shft));
+                dest[2] = (uint8) (source[3] << shft);
+                dest[1] = (uint8) (source[0] & 0x80);   /* sign */
+                if (shft == 1)
+                  {     /* set exp to 2 */
+                      dest[1] |= 0x01;
+                      dest[0] &= 0x7f;  /* set LSB of exp to 0 */
+                  }
+            }
+          else
+              dest[0] = dest[1] = dest[2] = dest[3] = 0;
+
+#endif /* __ALPHA */
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+
+#ifdef DFKIT
+    for (i = 0; i < size; i++)
+      {
+          /* extract exponent */
+          exp = (uint8) (in[i].c[0] << 1) | (uint8) (in[i].c[1] >> 7);
+          if (exp)
+            {   /* non-zero exponent */
+                /* copy mantissa, last bit of exponent */
+                out[i].c[0] = in[i].c[1];
+                out[i].c[2] = in[i].c[3];
+                out[i].c[3] = in[i].c[2];
+                if (exp < 254)  /* normal value */
+                    out[i].c[1] = in[i].c[0] + (uint8) 1;   /* adds two to exp */
+                else
+                  {     /* infinity or NaN */
+                      if (exp == 254)   /* unrepresentable - OFL */
+                          out[i].i = 0;     /* set mant=0 for overflow */
+                      out[i].c[0] &= 0x7f;  /* set last bit of exp to 0 */
+                      out[i].c[1] = 0x80;   /* sign=1 exp=0 -> OFL or NaN */
+                  }
+            }
+          else if (in[i].c[1] & 0x60)
+            {   /* denormalized value */
+                int shft;
+
+                /* shift needed to normalize */
+                shft = (in[i].c[1] & 0x40) ? 1 : 2;
+
+                /* shift mantissa */
+                /* note last bit of exp set to 1 implicitly */
+                out[i].c[0] = (uint8) (in[i].c[1] << shft)
+                    | (uint8) (in[i].c[2] >> (8 - shft));
+                out[i].c[3] = (uint8) (in[i].c[2] << shft)
+                    | (uint8) (in[i].c[3] >> (8 - shft));
+                out[i].c[2] = (uint8) (in[i].c[3] << shft);
+                out[i].c[1] = (uint8) (in[i].c[0] & 0x80);  /* sign */
+                if (shft == 1)
+                  {     /* set exp to 2 */
+                      out[i].c[1] |= 0x01;
+                      out[i].c[0] &= 0x7f;  /* set LSB of exp to 0 */
+                  }
+            }
+          else
+              out[i].i = 0;     /* zero */
+      }
+    return (0);
+#endif /* DFKIT */
+
+}
+
+/************************************************************/
+/* DFKvo4f()                                                */
+/* --> Export routine for 4 byte VAX floats                 */
+/************************************************************/
+int
+DFKvo4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKvo4f";
+    intn        exp;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 4;
+
+    for (i = 0; i < num_elm; i++)
+      {
+#ifdef __ALPHA
+
+	 {
+	 uint32 *s1 = (uint32 *)source;
+	 uint32 *d1 = (uint32 *)dest;
+	 uint32 input = *s1;
+	 uint32 output = *d1;
+/*        
+(void)cvt$ftof(&input,CVT$K_VAX_F,&output,CVT$K_BIG_ENDIAN_IEEE_S,0); */
+	(void)CVT$CONVERT_FLOAT(&input,CVT$K_VAX_F,&output,CVT$K_IEEE_S,
+				CVT$M_ROUND_TO_NEAREST+CVT$M_BIG_ENDIAN);
+	 *d1 = output;
+	 }
+
+#else
+
+          /* extract exponent */
+          exp = (source[1] << 1) | (source[0] >> 7);
+
+          if (!exp && !source[1])
+            {
+                /*
+                 * zero value
+                 */
+                dest[0] = dest[1] = dest[2] = dest[3] = 0;
+            }
+          else if (exp > 2)
+            {
+                /*
+                 * Normal value
+                 */
+
+                dest[0] = source[1] - (uint8) 1;    /* subtracts 2 from exponent */
+                /* copy mantissa, LSB of exponent */
+                dest[1] = source[0];
+                dest[2] = source[3];
+                dest[3] = source[2];
+
+            }
+          else if (exp)
+            {
+                intn shft;
+                /*
+                 * denormalized number
+                 */
+
+                /* keep sign, zero exponent */
+                dest[0] = source[1] & 0x80;
+
+                shft = 3 - exp;
+
+                /* shift original mant by 1 or 2 to get denormalized mant */
+                /* prefix mantissa with '1'b or '01'b as appropriate */
+                dest[1] = (uint8) ((source[0] & 0x7f) >> shft)
+                    | (uint8) (0x10 << exp);
+                dest[2] = (uint8) (source[0] << (8 - shft))
+                    | (uint8) (source[3] >> shft);
+                dest[3] = (uint8) (source[3] << (8 - shft))
+                    | (uint8) (source[2] >> shft);
+            }
+          else
+            {
+                /*
+                 * sign=1 -> infinity or NaN
+                 */
+
+                dest[0] = 0xff;     /* set exp to 255 */
+                /* copy mantissa */
+                dest[1] = source[0] | (uint8) 0x80;     /* LSB of exp = 1 */
+                dest[2] = source[3];
+                dest[3] = source[2];
+            }
+
+#endif /* __ALPHA */
+
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+
+#ifdef DFKIT
+    uint8       exp;
+    int         i;
+
+    for (i = 0; i < size; i++)
+      {
+          /* extract exponent */
+          exp = (uint8) (in[i].c[1] << 1) | (uint8) (in[i].c[0] >> 7);
+          if (!exp && !in[i].c[1])
+              out[i].i = 0;     /* zero value */
+          else if (exp > 2)
+            {   /* normal value */
+                out[i].c[0] = in[i].c[1] - (uint8) 1;   /* subtracts 2 from expent */
+                /* copy mantissa, LSB of exponent */
+                out[i].c[1] = in[i].c[0];
+                out[i].c[2] = in[i].c[3];
+                out[i].c[3] = in[i].c[2];
+            }
+          else if (exp)
+            {   /* denormalized number */
+                int shft;
+
+                /* keep sign, zero exponent */
+                out[i].c[0] = in[i].c[1] & (uint8) 0x80;
+                shft = 3 - exp;
+                /* shift original mant by 1 or 2 to get denormalized mant */
+                /* prefix mantissa with '1'b or '01'b as appropriate */
+                out[i].c[1] = (uint8) ((in[i].c[0] & 0x7f) >> shft)
+                    | (uint8) (0x10 << exp);
+                out[i].c[2] = (uint8) (in[i].c[0] << (8 - shft))
+                    | (uint8) (in[i].c[3] >> shft);
+                out[i].c[3] = (uint8) (in[i].c[3] << (8 - shft))
+                    | (uint8) (in[i].c[2] >> shft);
+            }
+          else
+            {   /* sign=1 -> infinity or NaN */
+                out[i].c[0] = 0xff;     /* set exp to 255 */
+                /* copy mantissa */
+                out[i].c[1] = in[i].c[0] | (uint8) 0x80;    /* LSB of exp = 1 */
+                out[i].c[2] = in[i].c[3];
+                out[i].c[3] = in[i].c[2];
+            }
+      }
+    return (0);
+
+#endif /* DFKIT */
+
+}
+
+/*
+ * Define structures to encode and decode Vax numbers
+ * The following code is based on the methods of reading / writing
+ *  doubles from Vaxen developed by Sun Microsystems as part of
+ *  the XDR library.
+ */
+
+/* How an IEEE double looks */
+struct ieee_double
+{
+    unsigned int mantissa1:20;
+    unsigned int exp:11;
+    unsigned int sign:1;
+    unsigned int mantissa2:32;
+};
+
+/* How a Vax double looks */
+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)
+
+struct dbl_limits
+  {
+      struct vax_double vaxx;
+      struct ieee_double ieee;
+  };
+
+static struct dbl_limits dbl_lim[2] =
+{
+    {
+        {0x7f, 0xff, 0x0, 0xffff, 0xffff, 0xfff},   /* Max Vax */
+        {0x0, 0x7ff, 0x0, 0x0}},    /* Max IEEE */
+    {
+        {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},     /* Min Vax */
+        {0x0, 0x0, 0x0, 0x0}}   /* Min IEEE */
+};
+
+/************************************************************/
+/* DFKvi8f()                                                */
+/* --> Import routine for 8 byte VAX floats                 */
+/************************************************************/
+int
+DFKvi8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKvi8f";
+    intn        exp;
+
+    struct dbl_limits *lim;
+    struct ieee_double id;
+    struct vax_double *vd;
+    intn        found, j;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 8;
+
+    for (i = 0; i < num_elm; i++)
+      {
+#ifdef __ALPHA
+
+/*        
+(void)cvt$ftof(&source[0],CVT$K_BIG_ENDIAN_IEEE_T,&dest[0],CVT$K_VAX_G,0); */
+	(void)CVT$CONVERT_FLOAT(&source[0],CVT$K_IEEE_T,&dest[0],CVT$K_VAX_G,
+				CVT$M_ROUND_TO_NEAREST+CVT$M_BIG_ENDIAN);
+
+#else
+        shipit: /* In VAX, bytes in a word are counted from right to left */
+          {
+              int j, k;
+              uint8      *bufi, *i3e;
+
+              i3e = source;
+              bufi = (uint8 *) &(id);
+              for (j = 0; j < 2; j++)
+                {
+                    for (k = 0; k < 4; k++)
+                        bufi[k] = i3e[3 - k];
+                    bufi += 4;
+                    i3e += 4;
+                }
+          }     /* shipit   */
+
+          vd = (struct vax_double *) dest;
+
+          found = FALSE;
+
+          for (j = 0, lim = dbl_lim;
+               j < sizeof(dbl_lim) / sizeof(struct dbl_limits);
+               j++, lim++)
+            {
+                if ((id.mantissa2 == lim->ieee.mantissa2) &&
+                    (id.mantissa1 == lim->ieee.mantissa1) &&
+                    (id.exp == lim->vaxx.exp))
+                  {
+                      *vd = lim->vaxx;
+                      found = TRUE;
+                      break;
+                  }
+            }
+
+          if (!found)
+            {
+                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;
+            }
+
+          vd->sign = id.sign;
+
+#endif /* __ALPHA */
+
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+}
+
+/************************************************************/
+/* DFKvo8f()                                                */
+/* --> Export routine for 8 byte VAX floats                 */
+/************************************************************/
+int
+DFKvo8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    intn i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKvo8f";
+    intn        exp;
+
+    struct dbl_limits *lim;
+    struct ieee_double id;
+    struct vax_double vd;
+    intn        found, j;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 8;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+#ifdef __ALPHA
+
+/*        
+(void)cvt$ftof(&source[0],CVT$K_VAX_G,&dest[0],CVT$K_BIG_ENDIAN_IEEE_T,0); */
+	(void)CVT$CONVERT_FLOAT(&source[0],CVT$K_VAX_G,&dest[0],CVT$K_IEEE_T,
+				CVT$M_ROUND_TO_NEAREST+CVT$M_BIG_ENDIAN);
+
+#else
+          vd = *((struct vax_double *) source);
+
+          found = FALSE;
+
+          for (j = 0, lim = dbl_lim;
+               j < sizeof(dbl_lim) / sizeof(struct dbl_limits);
+               j++, lim++)
+            {
+                if ((vd.mantissa4 == lim->vaxx.mantissa4) &&
+                    (vd.mantissa3 == lim->vaxx.mantissa3) &&
+                    (vd.mantissa2 == lim->vaxx.mantissa2) &&
+                    (vd.mantissa1 == lim->vaxx.mantissa1) &&
+                    (vd.exp == lim->vaxx.exp))
+                  {
+                      id = lim->ieee;
+                      found = TRUE;
+                      break;
+                  }
+            }
+
+          if (!found)
+            {
+                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));
+            }
+
+          id.sign = vd.sign;
+
+        shipit: /* In VAX the bytes in a word are counted from right to left */
+          {
+              int j, k;
+              uint8      *i3e, *bufo;
+
+              i3e = (uint8 *) &(id);
+              bufo = dest;
+              for (j = 0; j < 2; j++)
+                {
+                    for (k = 0; k < 4; k++)
+                        bufo[k] = i3e[3 - k];
+                    bufo += 4;
+                    i3e += 4;
+                }
+          }
+
+#endif /* __ALPHA */
+
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+}
+
+/************************************************************/
+/* DFKlvi4f()                                                */
+/* --> Import routine for 4 byte VAX floats                 */
+/************************************************************/
+int
+DFKlvi4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKvi4f";
+    uint8       exp;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 4;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+#ifdef __ALPHA
+
+        {
+	uint32 *s1 = (uint32 *)source;
+        uint32 *d1 = (uint32 *)dest;
+        uint32 input = *s1;
+	uint32 output= *d1;
+/*          (void)cvt$ftof(&input,CVT$K_IEEE_S,&output,CVT$K_VAX_F,0); */
+	(void)CVT$CONVERT_FLOAT(&input,CVT$K_IEEE_S,&output,CVT$K_VAX_F,
+				CVT$M_ROUND_TO_NEAREST);
+	*d1 = output;
+        }
+
+#else
+
+          /* extract exponent */
+          exp = (source[3] << 1) | (source[2] >> 7);
+          if (exp)
+            {
+                /*
+                 * non-zero exponent
+                 */
+
+                /* copy mantissa, last bit of exponent */
+                dest[0] = source[2];
+                dest[2] = source[0];
+                dest[3] = source[1];
+                if (exp < 254)
+                    /* normal value */
+                    dest[1] = source[3] + (uint8) 1;    /* actually adds two to exp */
+                else
+                  {
+                      /* infinity or NaN */
+                      if (exp == 254)   /* unrepresentable - OFL */
+                          /* set mant = 0 for overflow */
+                          dest[0] = dest[1] = dest[2] = dest[3] = 0;
+                      dest[0] &= 0x7f;  /* set last bit of exp to 0 */
+                      dest[1] = 0x80;   /* sign=1 exp=0 -> OFL or NaN */
+                  }
+            }
+          else if (source[2] & 0x60)
+            {   /* denormalized value */
+                int shft;
+
+                shft = (source[2] & 0x40) ? 1 : 2;  /* shift needed to normalize */
+                /* shift mantissa */
+                /* note last bit of exp set to 1 implicitly */
+                dest[0] = (uint8) (source[2] << shft) | (uint8) (source[1] >> (8 - shft));
+                dest[3] = (uint8) (source[1] << shft) | (uint8) (source[0] >> (8 - shft));
+                dest[2] = (uint8) (source[0] << shft);
+                dest[1] = (uint8) (source[3] & 0x80);   /* sign */
+                if (shft == 1)
+                  {     /* set exp to 2 */
+                      dest[1] |= 0x01;
+                      dest[0] &= 0x7f;  /* set LSB of exp to 0 */
+                  }
+            }
+          else
+            {
+                dest[0] = dest[1] = dest[2] = dest[3] = 0;
+            }
+
+#endif /* __ALPHA */
+
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+
+#ifdef DFKIT
+    for (i = 0; i < size; i++)
+      {
+          /* extract exponent */
+          exp = (uint8) (in[i].c[0] << 1) | (uint8) (in[i].c[1] >> 7);
+          if (exp)
+            {   /* non-zero exponent */
+                /* copy mantissa, last bit of exponent */
+                out[i].c[0] = in[i].c[1];
+                out[i].c[2] = in[i].c[3];
+                out[i].c[3] = in[i].c[2];
+                if (exp < 254)  /* normal value */
+                    out[i].c[1] = in[i].c[0] + (uint8) 1;   /* adds two to exp */
+                else
+                  {     /* infinity or NaN */
+                      if (exp == 254)   /* unrepresentable - OFL */
+                          out[i].i = 0;     /* set mant=0 for overflow */
+                      out[i].c[0] &= 0x7f;  /* set last bit of exp to 0 */
+                      out[i].c[1] = 0x80;   /* sign=1 exp=0 -> OFL or NaN */
+                  }
+            }
+          else if (in[i].c[1] & 0x60)
+            {   /* denormalized value */
+                int shft;
+
+                /* shift needed to normalize */
+                shft = (in[i].c[1] & 0x40) ? 1 : 2;
+
+                /* shift mantissa */
+                /* note last bit of exp set to 1 implicitly */
+                out[i].c[0] = (uint8) (in[i].c[1] << shft)
+                    | (uint8) (in[i].c[2] >> (8 - shft));
+                out[i].c[3] = (uint8) (in[i].c[2] << shft)
+                    | (uint8) (in[i].c[3] >> (8 - shft));
+                out[i].c[2] = (uint8) (in[i].c[3] << shft);
+                out[i].c[1] = (uint8) (in[i].c[0] & 0x80);  /* sign */
+                if (shft == 1)
+                  {     /* set exp to 2 */
+                      out[i].c[1] |= 0x01;
+                      out[i].c[0] &= 0x7f;  /* set LSB of exp to 0 */
+                  }
+            }
+          else
+              out[i].i = 0;     /* zero */
+      }
+    return (0);
+#endif /* DFKIT */
+
+}
+
+/************************************************************/
+/* DFKlvo4f()                                                */
+/* --> Export routine for 4 byte VAX floats                 */
+/************************************************************/
+int
+DFKlvo4f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKvo4f";
+    intn        exp;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 4;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+#ifdef __ALPHA
+
+	 {
+	 uint32 *s1 = (uint32 *)source;
+	 uint32 *d1 = (uint32 *)dest;
+	 uint32 input = *s1;
+	 uint32 output = *d1;
+/*         (void)cvt$ftof(&input,CVT$K_VAX_F,&output,CVT$K_IEEE_S,0); */
+	(void)CVT$CONVERT_FLOAT(&input,CVT$K_VAX_F,&output,CVT$K_IEEE_S,
+				CVT$M_ROUND_TO_NEAREST);
+	 *d1 = output;
+	 }
+
+#else
+          /* extract exponent */
+          exp = (source[1] << 1) | (source[0] >> 7);
+
+          if (!exp && !source[1])
+            {
+                /*
+                 * zero value
+                 */
+                dest[0] = dest[1] = dest[2] = dest[3] = 0;
+            }
+          else if (exp > 2)
+            {
+                /*
+                 * Normal value
+                 */
+
+                dest[3] = source[1] - (uint8) 1;    /* subtracts 2 from exponent */
+                /* copy mantissa, LSB of exponent */
+                dest[2] = source[0];
+                dest[1] = source[3];
+                dest[0] = source[2];
+
+            }
+          else if (exp)
+            {
+                intn shft;
+                /*
+                 * denormalized number
+                 */
+
+                /* keep sign, zero exponent */
+                dest[3] = source[1] & 0x80;
+
+                shft = 3 - exp;
+
+                /* shift original mant by 1 or 2 to get denormalized mant */
+                /* prefix mantissa with '1'b or '01'b as appropriate */
+                dest[2] = (uint8) ((source[0] & 0x7f) >> shft)
+                    | (uint8) (0x10 << exp);
+                dest[1] = (uint8) (source[0] << (8 - shft))
+                    | (uint8) (source[3] >> shft);
+                dest[0] = (uint8) (source[3] << (8 - shft))
+                    | (uint8) (source[2] >> shft);
+            }
+          else
+            {
+                /*
+                 * sign=1 -> infinity or NaN
+                 */
+
+                dest[3] = 0xff;     /* set exp to 255 */
+                /* copy mantissa */
+                dest[2] = source[0] | (uint8) 0x80;     /* LSB of exp = 1 */
+                dest[1] = source[3];
+                dest[0] = source[2];
+            }
+
+#endif /* __ALPHA */
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+
+#ifdef DFKIT
+    uint8       exp;
+    int         i;
+
+    for (i = 0; i < size; i++)
+      {
+          /* extract exponent */
+          exp = (uint8) (in[i].c[1] << 1) | (uint8) (in[i].c[0] >> 7);
+          if (!exp && !in[i].c[1])
+              out[i].i = 0;     /* zero value */
+          else if (exp > 2)
+            {   /* normal value */
+                out[i].c[0] = in[i].c[1] - (uint8) 1;   /* subtracts 2 from expent */
+                /* copy mantissa, LSB of exponent */
+                out[i].c[1] = in[i].c[0];
+                out[i].c[2] = in[i].c[3];
+                out[i].c[3] = in[i].c[2];
+            }
+          else if (exp)
+            {   /* denormalized number */
+                int shft;
+
+                /* keep sign, zero exponent */
+                out[i].c[0] = in[i].c[1] & (uint8) 0x80;
+                shft = 3 - exp;
+                /* shift original mant by 1 or 2 to get denormalized mant */
+                /* prefix mantissa with '1'b or '01'b as appropriate */
+                out[i].c[1] = (uint8) ((in[i].c[0] & 0x7f) >> shft)
+                    | (uint8) (0x10 << exp);
+                out[i].c[2] = (uint8) (in[i].c[0] << (8 - shft))
+                    | (uint8) (in[i].c[3] >> shft);
+                out[i].c[3] = (uint8) (in[i].c[3] << (8 - shft))
+                    | (uint8) (in[i].c[2] >> shft);
+            }
+          else
+            {   /* sign=1 -> infinity or NaN */
+                out[i].c[0] = 0xff;     /* set exp to 255 */
+                /* copy mantissa */
+                out[i].c[1] = in[i].c[0] | (uint8) 0x80;    /* LSB of exp = 1 */
+                out[i].c[2] = in[i].c[3];
+                out[i].c[3] = in[i].c[2];
+            }
+      }
+    return (0);
+
+#endif /* DFKIT */
+
+}
+
+/************************************************************/
+/* DFKlvi8f()                                                */
+/* --> Import routine for 8 byte VAX floats                 */
+/************************************************************/
+int
+DFKlvi8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKvi8f";
+    intn        exp;
+
+    struct dbl_limits *lim;
+    struct ieee_double id;
+    struct vax_double *vd;
+    intn        found, j;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 8;
+
+    for (i = 0; i < num_elm; i++)
+      {
+#ifdef __ALPHA
+
+/*         (void)cvt$ftof(&source[0],CVT$K_IEEE_T,&dest[0],CVT$K_VAX_G,0); */
+	(void)CVT$CONVERT_FLOAT(&source[0],CVT$K_IEEE_T,&dest[0],CVT$K_VAX_G,
+				CVT$M_ROUND_TO_NEAREST);
+
+#else
+          HDmemcpy(&(id), &source[4], 4);   /* swap the two 4-byte words */
+          HDmemcpy(((uint8 *) &(id)) + 4, source, 4);
+
+          vd = (struct vax_double *) dest;
+
+          found = FALSE;
+
+          for (j = 0, lim = dbl_lim;
+               j < sizeof(dbl_lim) / sizeof(struct dbl_limits); j++, lim++)
+            {
+                if ((id.mantissa2 == lim->ieee.mantissa2) &&
+                    (id.mantissa1 == lim->ieee.mantissa1) &&
+                    (id.exp == lim->vaxx.exp))
+                  {
+                      *vd = lim->vaxx;
+                      found = TRUE;
+                      break;
+                  }
+            }
+
+          if (!found)
+            {
+                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;
+            }
+
+          vd->sign = id.sign;
+
+#endif /* __ALPHA */
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+}
+
+/************************************************************/
+/* DFKlvo8f()                                                */
+/* --> Export routine for 8 byte VAX floats                 */
+/************************************************************/
+int
+DFKlvo8f(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+         uint32 dest_stride)
+{
+    int         in_place = 0;   /* Inplace must be detected */
+    intn i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    char       *FUNC = "DFKvo8f";
+    intn        exp;
+
+    struct dbl_limits *lim;
+    struct ieee_double id;
+    struct vax_double vd;
+    intn        found, j;
+
+    HEclear();
+
+    if (source == dest)
+        in_place = TRUE;
+
+    if (num_elm == 0 || in_place)
+      {     /* No elements is an error as is in place. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (source_stride == 0 && dest_stride == 0)
+        source_stride = dest_stride = 8;
+
+    for (i = 0; i < num_elm; i++)
+      {
+
+#ifdef __ALPHA
+
+/*         (void)cvt$ftof(&source[0],CVT$K_VAX_G,&dest[0],CVT$K_IEEE_T,0); */
+	(void)CVT$CONVERT_FLOAT(&source[0],CVT$K_VAX_G,&dest[0],CVT$K_IEEE_T,
+				CVT$M_ROUND_TO_NEAREST);
+
+#else
+          vd = *((struct vax_double *) source);
+
+          found = FALSE;
+
+          for (j = 0, lim = dbl_lim;
+               j < sizeof(dbl_lim) / sizeof(struct dbl_limits);
+               j++, lim++)
+            {
+                if ((vd.mantissa4 == lim->vaxx.mantissa4) &&
+                    (vd.mantissa3 == lim->vaxx.mantissa3) &&
+                    (vd.mantissa2 == lim->vaxx.mantissa2) &&
+                    (vd.mantissa1 == lim->vaxx.mantissa1) &&
+                    (vd.exp == lim->vaxx.exp))
+                  {
+                      id = lim->ieee;
+                      found = TRUE;
+                      break;
+                  }
+            }
+
+          if (!found)
+            {
+                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));
+            }
+
+          id.sign = vd.sign;
+
+          HDmemcpy(dest, ((uint8 *) &(id)) + 4, 4);     /* swap the two 4-byte words */
+          HDmemcpy(&dest[4], &(id), 4);
+
+#endif /* __ALPHA */
+
+          source += source_stride;
+          dest += dest_stride;
+      }
+
+    return 0;
+}
+
+#else
+
+int         vms_dummy;          /* prevent empty symbol table messages */
+
+#endif /* VMS */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,638 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.29 $";
+#endif
+
+/* $Id: dfp.c,v 1.29 1999/06/16 21:10:42 dwells Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+/*****************************************************************************/
+/* Define Pablo Hooks                                                        */
+/*****************************************************************************/
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_dfp_c
+#endif
+
+/* 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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFPgetpal);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFPgetpal);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFPputpal);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFPputpal);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFPaddpal);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFPputpal(filename, palette, 0, "a"));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFPaddpal);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFPnpals);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFPnpals);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFPreadref);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFPreadref);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFPwriteref);
+#endif /* HAVE_PABLO */
+
+  /* shut compiler up */
+  filename = filename;
+  Writeref = ref;
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFPwriteref);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFPrestart);
+#endif /* HAVE_PABLO */
+
+  Lastfile[0] = '\0';
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFPrestart);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFPlastref);
+#endif /* HAVE_PABLO */
+
+  ret_value = Lastref;
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFPlastref);
+#endif /* HAVE_PABLO */
+
+  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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfpf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfpf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfpf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,259 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.14 $";
+#endif
+
+/* $Id: dfpf.c,v 1.14 1997/09/11 00:16:37 acheng Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+#ifndef DFP_FNAMES
+#   define DFP_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndpigpal  FNAME(DPIGPAL)
+#   define ndpippal  FNAME(DPIPPAL)
+#   define ndpinpal  FNAME(DPINPAL)
+#   define ndpiwref  FNAME(DPIWREF)
+#   define ndpirref  FNAME(DPIRREF)
+#   define ndprest   FNAME(DPREST)
+#   define ndplref   FNAME(DPLREF)
+#   define ndfprestart   FNAME(DFPRESTART)
+#   define ndfplastref   FNAME(DFPLASTREF)
+#else  /* !DF_CAPNAMES */
+#   define ndpigpal  FNAME(dpigpal)
+#   define ndpippal  FNAME(dpippal)
+#   define ndpinpal  FNAME(dpinpal)
+#   define ndpiwref  FNAME(dpiwref)
+#   define ndpirref  FNAME(dpirref)
+#   define ndprest   FNAME(dprest)
+#   define ndplref   FNAME(dplref)
+#   define ndfprestart   FNAME(dfprestart)
+#   define ndfplastref   FNAME(dfplastref)
+#endif /* DF_CAPFNAMES */
+#endif /* DFP_FNAMES */
+
+/*-----------------------------------------------------------------------------
+ * 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());
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfpff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfpff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfpff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,284 @@
+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: dfpff.f,v 1.5 1993/11/03 19:59:16 koziol Exp $
+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

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfr8.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfr8.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfr8.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1784 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.44 $";
+#endif
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_dfr8_c
+#endif
+
+/* $Id: dfr8.c,v 1.44 1999/06/16 21:10:42 dwells Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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;
+
+#ifdef HAVE_PABLO
+ TRACE_ON(PABLO_mask,ID_DFR8setcompress); 
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+ 	TRACE_OFF(PABLO_mask, ID_DFR8setcompress);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+ 	TRACE_ON(PABLO_mask,ID_DFR8getdims);
+#endif /* HAVE_PABLO */
+
+  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);
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8getdims);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFR8getimage);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8getimage);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFR8setpalette);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8setpalette);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+   TRACE_ON(PABLO_mask,ID_DFR8putimage);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8putimage);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFR8addimage);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8addimage);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFR8nimages);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8nimages);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFR8readref);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8readref);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFR8writeref);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8writeref);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFR8restart);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8restart);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFR8lastref);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8lastref);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFR8Istart);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFR8Istart);
+#endif /* HAVE_PABLO */
+
+    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() */
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfr8f.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfr8f.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfr8f.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,462 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.19 $";
+#endif
+
+/* $Id: dfr8f.c,v 1.19 1997/09/11 00:16:35 acheng Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+#ifndef DFR8_FNAMES
+#   define DFR8_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nd8spal   FNAME(D8SPAL)
+#   define nd8first  FNAME(D8FIRST)
+#   define nd8igdim  FNAME(D8IGDIM)
+#   define nd8igimg  FNAME(D8IGIMG)
+#   define nd8ipimg  FNAME(D8IPIMG)
+#   define nd8iaimg  FNAME(D8IAIMG)
+#   define nd8irref  FNAME(D8IRREF)
+#   define nd8iwref  FNAME(D8IWREF)
+#   define nd8inims  FNAME(D8INIMS)
+#   define nd8lref   FNAME(D8LREF)
+#   define ndfr8lastref      FNAME(DFR8LASTREF)
+#   define ndfr8setpalette   FNAME(DFR8SETPALETTE)
+#   define ndfr8restart  FNAME(DFR8RESTART)
+#else  /* !DF_CAPFNAMES */
+#   define nd8spal   FNAME(d8spal)
+#   define nd8first  FNAME(d8first)
+#   define nd8igdim  FNAME(d8igdim)
+#   define nd8igimg  FNAME(d8igimg)
+#   define nd8ipimg  FNAME(d8ipimg)
+#   define nd8iaimg  FNAME(d8iaimg)
+#   define nd8irref  FNAME(d8irref)
+#   define nd8iwref  FNAME(d8iwref)
+#   define nd8inims  FNAME(d8inims)
+#   define nd8lref   FNAME(d8lref)
+#   define ndfr8lastref      FNAME(dfr8lastref)
+#   define ndfr8setpalette   FNAME(dfr8setpalette)
+#   define ndfr8restart  FNAME(dfr8restart)
+#endif /* DF_CAPFNAMES */
+#endif /* DFR8_FNAMES */
+
+/*-----------------------------------------------------------------------------
+ * 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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfr8ff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfr8ff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfr8ff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,336 @@
+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: dfr8ff.f,v 1.4 1993/11/03 19:59:25 koziol Exp $
+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

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfrig.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfrig.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfrig.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,73 @@
+
+/****************************************************************************
+ * 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: dfrig.h,v 1.9 1994/06/29 13:05:02 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfrle.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfrle.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfrle.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,169 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.11 $";
+#endif
+
+/* $Id: dfrle.c,v 1.11 1997/10/25 00:55:53 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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));
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfsd.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfsd.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfsd.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,6057 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.77 $";
+#endif
+
+/* $Id: dfsd.c,v 1.77 1999/06/16 21:10:44 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_dfsd_c
+#endif
+ 
+/*-----------------------------------------------------------------------------
+ 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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetdims);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetdims);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetdatastrs);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetdatastrs);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetdimstrs);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetdimstrs);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetdatalen);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetdatalen);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetdimlen);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetdimlen);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetdimscale);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetdimscale);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetrange);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetrange);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetdata);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFSDIgetdata(filename, rank, maxsizes, data, 0));   /* 0 == C */
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetdata);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDsetlengths);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDsetlengths);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDsetdims);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFSDsetdims);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDsetdatastrs);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFSDIsetdatastrs(label, unit, format, coordsys));
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDsetdatastrs);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDsetdimstrs);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFSDIsetdimstrs(dim, label, unit, format));
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDsetdimstrs);
+#endif /* HAVE_PABLO */
+  
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDsetdimscale);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDsetdimscale);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDsetrange);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDsetrange);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDputdata);
+#endif /* HAVE_PABLO */
+
+  /* 0, 0 specify create mode, C style array (row major) */
+  ret_value = (DFSDIputdata(filename, rank, dimsizes, data, 0, 0));
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDputdata);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDadddata);
+#endif /* HAVE_PABLO */
+
+  /* 1, 0 specifies append mode, C style array (row major) */
+  ret_value = (DFSDIputdata(filename, rank, dimsizes, data, 1, 0));
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDadddata);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDrestart);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDrestart);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDndatasets);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDndatasets);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDclear);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDclear);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDlastref);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDlastref);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDreadref);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDreadref);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetslice);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFSDIgetslice(filename, winst, windims, data, dims, 0));
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetslice);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDstartslice);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDstartslice);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDputslice);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFSDIputslice(winend, data, dims, 0));
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDputslice);
+#endif /* HAVE_PABLO */
+  
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDendslice);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFSDIendslice(0));
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDendslice);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDsetNT);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDsetNT);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDgetNT);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDgetNT);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDpre32sdg);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDpre32sdg);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef UNICOS
+#pragma ivdep
+#endif
+              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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFSDgetcal);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFSDgetcal);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDsetcal);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFSDsetcal);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDwriteref);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DFSDwriteref);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DFSDsetfillvalue);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFSDsetfillvalue);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFSDgetfillvalue);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFSDgetfillvalue);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFSDreadslab);
+#endif /* HAVE_PABLO */
+
+  ret_value = (DFSDgetslice(filename, start, slab_size, buffer, buffer_size));
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFSDreadslab);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFSDstartslab);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFSDstartslab);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFSDwriteslab);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFSDwriteslab);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_DFSDendslab);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DFSDendslab);
+#endif /* HAVE_PABLO */
+
+  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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfsd.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfsd.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfsd.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -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: dfsd.h,v 1.22 1996/03/28 21:57:10 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 "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 */
+
+    extern int32 DFSDIopen
+                (const char * filename, int acc_mode);
+
+    extern int  DFSDIsdginfo
+                (int32 file_id);
+
+    extern int  DFSDIclear
+                (DFSsdg * sdg);
+
+    extern int  DFSDIclearNT
+                (DFSsdg * sdg);
+
+    extern int  DFSDIgetdata
+                (const char * filename, intn rank, int32 maxsizes[], VOIDP data,
+                 int isfortran);
+
+    extern int  DFSDIputdata
+                (const char * filename, intn rank, int32 * dimsizes, VOIDP data,
+                 int accmode, int isfortran);
+
+    extern int  DFSDIgetslice
+                (const char * filename, int32 winst[], int32 windims[], VOIDP data,
+                 int32 dims[], int isfortran);
+
+    extern int  DFSDIputslice
+                (int32 windims[], VOIDP data, int32 dims[], int isfortran);
+
+    extern int  DFSDIendslice
+                (int isfortran);
+
+    extern intn DFSDIrefresh
+                (char * filename);
+
+    extern int  DFSDIisndg
+                (intn * isndg);
+
+    extern int  DFSDIgetrrank
+                (intn * rank);
+
+    extern int  DFSDIgetwrank
+                (intn * rank);
+
+    extern int  DFSDIsetdimstrs
+                (int dim, const char * label, const char * unit, const char * format);
+
+    extern 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfsdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfsdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfsdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1637 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.40 $";
+#endif
+
+/* $Id: dfsdf.c,v 1.40 1997/02/21 18:30:28 acheng Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+
+/*-----------------------------------------------------------------------------
+ * 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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfsdff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfsdff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfsdff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,624 @@
+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: dfsdff.f,v 1.10 1994/01/13 21:15:36 georgev Exp $ 
+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
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfstubs.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfstubs.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfstubs.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1477 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.24 $";
+#endif
+
+/* $Id: dfstubs.c,v 1.24 1996/10/28 15:21:11 koziol Exp $ */
+
+/*
+   ** 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); } }
+
+#ifdef VMS
+#define CKREAD(x,y,z,f, ret)    { \
+                int32 currfileposn; \
+                currfileposn = DF_TELL(f); \
+                if (DF_READ( (char*)x, (int)(y), (int)(z), (f))<0) \
+                { DFerror = DFE_READERROR; return(ret); } \
+                DF_SEEK(f, (long) (currfileposn + y*z), 0); \
+                }
+#else  /*VMS */
+#define CKREAD(x,y,z,f, ret)    { \
+                if (DF_READ( (char*)x, (int)(y), (int)(z), (f))<0) \
+                { DFerror = DFE_READERROR; return(ret); } \
+                }
+#endif /*VMS */
+
+#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;
+#ifdef VMS
+    int32       totalread;
+    int32       readsize;
+#endif /*VMS */
+    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);
+      }
+
+#ifdef VMS
+    totalread = 0;
+    while (totalread < len)
+      {
+          readsize = len - totalread;
+          if (readsize > 512)
+              readsize = 512;
+          CKREAD(&ptr[totalread], (int) readsize, 1, dfile->file, -1);
+          totalread += readsize;
+      }
+
+#else  /*VMS */
+    if (len)
+      {     /* NOTE: cast to (int) will limit to 64K on 16 bit m/cs */
+          CKREAD(ptr, (int) len, 1, dfile->file, -1);
+      }
+#endif /*VMS */
+
+    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));
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfstubs.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfstubs.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfstubs.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,75 @@
+/****************************************************************************
+ * 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: dfstubs.h,v 1.10 1996/03/28 21:57:12 koziol Exp $ */
+
+/*
+   ** 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) & !defined(VMS)
+#include <memory.h>
+#endif /* !__GNUC__ & !CONVEX & !VMS */
+
+#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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfufp2i.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfufp2i.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfufp2i.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,735 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.16 $";
+#endif
+
+/* $Id: dfufp2i.c,v 1.16 1996/10/28 15:21:12 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------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 */
+
+#ifndef DFUFP2I_FNAMES
+#   define DFUFP2I_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nduif2i       FNAME(DUIF2I)
+#else
+#   define nduif2i       FNAME(duif2i)
+#endif /* DF_CAPFNAMES */
+#endif /* DFUFP2I_FNAMES */
+
+/*-----------------------------------------------------------------------------
+ * 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);
+}
+
+/*-----------------------------------------------------------------------------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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfufp2i.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfufp2i.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfufp2i.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,85 @@
+
+/****************************************************************************
+ * 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: dfufp2i.h,v 1.9 1996/03/27 23:15:22 acheng Exp $ */
+
+#ifndef DFUFP2IM_H  /* avoid re-inclusion */
+#define DFUFP2IM_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
+    extern 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);
+    extern 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
+    extern int  process
+                (Input * in, Output * out);
+    extern int  generate_scale
+                (int32 dim, float32 *scale);
+    extern int  convert_interp
+                (Input * in, Output * out);
+    extern int  pixrep_scaled
+                (Input * in, Output * out);
+    extern int  compute_offsets
+                (float32 *scale, int32 dim, int32 *offsets, int32 res);
+    extern int  pixrep_simple
+                (Input * in, Output * out);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* DFUFP2IM_H */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfufp2if.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfufp2if.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfufp2if.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,94 @@
+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: dfufp2if.f,v 1.5 1994/01/13 21:15:37 georgev Exp $
+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
+
+      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
+
+      dfufptoimage = 
+     *             duif2i(hdim,vdim,max,min,hscale,vscale,data,palette,
+     *              outfile,ctmethod,hres,vres,compress, len(outfile))        
+      return
+      end
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfunjpeg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfunjpeg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfunjpeg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,385 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.21 $";
+#endif
+
+/* $Id: dfunjpeg.c,v 1.21 2000/04/14 20:43:30 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 */
+#ifdef QAK
+    VOIDP 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) */
+#endif /* QAK */
+
+    /* 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;
+#ifdef QAK
+    src->image = image;
+    src->xdim = xdim;
+    src->ydim = ydim;
+    src->scheme = scheme;
+#endif /* QAK */
+
+    /* 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)&image;
+        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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfutil.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfutil.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfutil.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,82 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.13 $";
+#endif
+
+/* $Id: dfutil.c,v 1.13 1996/10/28 15:21:14 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dfutilf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dfutilf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dfutilf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,78 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.10 $";
+#endif
+
+/* $Id: dfutilf.c,v 1.10 1996/10/28 15:21:14 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+#ifndef DFUTIL_FNAMES
+#   define DFUTIL_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndfindnr          FNAME(DFINDNR)
+#   define ndffindnextref    FNAME(DFFINDNEXTREF)
+#else
+#   define ndfindnr          FNAME(dfindnr)
+#   define ndffindnextref    FNAME(dffindnextref)
+#endif /* DF_CAPFNAMES */
+#endif /* DFUTIL_FNAMES */
+
+/*-----------------------------------------------------------------------------
+ * 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));
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/dir_mac.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dir_mac.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dir_mac.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,686 @@
+/****************************************************************************************
+ *
+ *	File:		dirent.c
+ *	Created:	7/3/93		By:	George T. Talbot
+ *	Purpose:	Implements UNIX-like directory reading for the Macintosh.
+ *
+ *	Modifications:
+ *
+ *	Notes:
+ *			1) These routines will NOT work under A/UX.
+ *			2) WD = working directory
+ *			3) CD = change directory
+ *			4) FS = file system
+ *			5) Mac filesystems allow spaces as part of pathnames!
+ *			6) All routines which return a path use the default Macintosh path separator,
+ *			   a colon (":").
+ *
+ ****************************************************************************************/
+
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+
+/*
+ * Added to HDF core library for directory reading on the Macintosh
+ *
+ * 1996/03/01 - GeorgeV.
+ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.11 $";
+#endif
+
+/* $Id: dir_mac.c,v 1.11 1999/05/26 16:39:47 epourmal Exp $ */
+
+#include "dir_mac.h"
+#if 0
+#include <pascal.h>
+#endif
+#include <string.h>
+#include <ctype.h>
+#include <Errors.h>
+
+OSErr	dd_errno;				/*	Global errno to check after calls to dirent routines	*/
+char	*dd_separator = ":";	/*	If you're feeling brave, change this to "/"	*/
+int		dd_xform_seps = false;
+
+/****************************************************************************************
+ *
+ *	This function, given a Macintosh-style pathname, will open a directory to that path.
+ *	NOTES:	1)	passing in nil will get you the current directory.
+ *			2)	".:", "..:" & ":" are supported at the beginning of paths ONLY
+ *				by this routine.
+ *			3)	"/" will be turned into ":" by this routine.
+ *
+ *	Calls:			PBHGetVol(), PBHGetCatInfo(), PBHSetVol(), hopendir(), CtoPstr()
+ *	Called By:		<general purpose>
+ *	Globals Used:	dd_errno
+ *	Parameters:		pointer to C-string pathname or nil for current directory
+ *	Returns:		pointer to directory management block or nil & dd_errno will be set
+ *
+ ****************************************************************************************/
+
+DIR	*
+opendir(char *dirname)
+{
+	WDPBRec			pb;
+	CInfoPBRec		cpb;
+	short			vRefNum;
+	long			dirID;
+	char			*dname;
+	DIR				*temp = NULL;
+	char			path_temp[MAXPATHLEN+1];	/*	Temporary area for building pathname	*/
+
+	/*	Save the current path	*/
+	pb.ioCompletion	= nil;
+	pb.ioNamePtr	= nil;
+	
+	if ((dd_errno = PBHGetVolSync(&pb)) != noErr)
+		return nil;
+
+	vRefNum	= pb.ioWDVRefNum;
+	dirID	= pb.ioWDDirID;
+
+	/*	dname points to the desired pathname	*/
+	dname	= dirname;
+
+	/*	If no pathname was passed in, or there are no ".", ".." or "" special directory
+	 *	names, then handle the pathname as normal.
+	 */
+	if (dirname == nil)
+		goto opendir_fallthrough;
+
+	/*	If there's not '.', '..' or '', fall through	*/
+	if ((dirname[0] != '.') && (dirname[0] != ''))
+		goto opendir_fallthrough;
+
+	/*	If there's a '', treat it like '..'	*/
+	if (dirname[0] == '')
+      {
+          dname = &(dirname[1]);
+          goto path_dotdot;
+      }
+
+	/*	If the pathname has "." (current directory) in front of it...	*/
+	if (dirname[1] != '.')
+      {
+          /*	Skip over the "." and fall through	*/
+          dname	= &(dirname[1]);
+          goto opendir_fallthrough;
+      }
+
+	/*	Skip over the ".."	*/
+	dname	= &(dirname[2]);
+
+  path_dotdot:
+	/*	If we get here, the directory has ".." in front of it...	*/
+	
+	/*	First, get the directory info on the current directory.  We do this so
+	 *	that we can get the directory's parent
+	 */
+	cpb.dirInfo.ioCompletion	= nil;
+	cpb.dirInfo.ioNamePtr		= (unsigned char *)path_temp;	/* Unused, but must be set because of
+                                                                 * bug in Apple File Sharing.
+                                                                 */
+	cpb.dirInfo.ioVRefNum		= vRefNum;
+	cpb.dirInfo.ioFDirIndex		= -1;
+	cpb.dirInfo.ioDrDirID		= dirID;
+
+	if ((dd_errno = PBGetCatInfoSync(&cpb)) != noErr)
+		return nil;
+
+	/*	Temporarily CD to the parent directory	*/
+	pb.ioCompletion				= nil;
+	pb.ioNamePtr				= nil;
+	pb.ioVRefNum				= pb.ioWDVRefNum;
+	pb.ioWDDirID				= cpb.dirInfo.ioDrParID;
+	
+	if ((dd_errno = PBHSetVolSync(&pb)) != noErr)
+		return nil;
+
+	/*	This is the common code for all three cases above	*/
+  opendir_fallthrough:
+	/*	If the pathname is too long (this is a Macintosh FS constraint), then return	*/
+	if (strlen(dname) > MAXPATHLEN)
+      {
+          /*	Set the error	*/
+          dd_errno	= bdNamErr; /* -37 */
+          temp		= nil;
+		
+          /*	Go to the common exit, where we CD back to the saved WD	*/
+          goto opendir_exit;
+      }
+
+	/*	If this call was passed a pathname	*/
+	if (dname != nil)
+      {
+          /*	Copy the pathname into a temp	*/
+          strcpy(path_temp, dname);
+		
+          /*	Turn it into a Pascal string for the Mac FS	*/
+          c2pstr(path_temp);
+
+          /*	Change any "/" to ":" for the Mac FS	*/
+          if (dd_xform_seps)
+			{
+                int i;
+			
+                for (i=1; i<= path_temp[0]; ++i)
+                    if (path_temp[i] == '/')
+                        path_temp[i] = ':';
+			}
+
+          /*	Try and open the directory	*/
+          if ((vRefNum != 0) && (dirID != 0))		{
+	          temp = hopendir(path_temp, vRefNum, dirID);
+	      }
+	      if (temp == NULL)
+	          temp = hopendir(path_temp, 0, 0);
+      }
+	else
+		/*	If this call wasn't passed a pathname, then we call hopendir() with nil to
+		 *	tell it to open the current working directory.
+		 */
+		temp = hopendir(nil, 0, 0);
+
+	/*	This is the common exit code which restores the current WD	*/
+  opendir_exit:
+	pb.ioCompletion				= nil;
+	pb.ioNamePtr				= nil;
+	pb.ioVRefNum				= vRefNum;
+	pb.ioWDDirID				= dirID;
+	
+	if ((dd_errno = PBHSetVolSync(&pb)) != noErr)
+      {
+          /*	If this call failed, then get rid of the structures created by hopendir()	*/
+          closedir(temp);
+          return nil;
+      }
+
+	return temp;
+}
+
+/****************************************************************************************
+ *
+ *	This function actually opens the directory.  If you feel brave, you can call it.
+ *	If you pass in a dirname, then set vRefNum and dirID to 0.  All named opens are
+ *	relative to the current WD.  If you pass in vRefNum and dirID, then don't bother
+ *	passing in a name.  This routine WILL CHANGE YOUR CURRENT WORKING DIRECTORY!
+ *
+ *	Calls:			NewHandle(), PBHGetCatInfo(), PBHSetVol(), PtoCstr(), BlockMove(),
+ *					DisposeHandle(), MoveHHi(), HLock(), MemError()
+ *	Called By:		opendir(), and you if you feel brave.
+ *	Globals Used:	dd_errno
+ *	Parameters:		pointer to Pascal-string pathname, vRefNum, dirID of desired
+ *					directory.  If you pass in a WDRefNum as the vRefNum, set dirID to 0
+ *	Returns:		pointer to directory management block or nil & dd_errno will be set
+ *
+ ****************************************************************************************/
+
+DIR	*
+hopendir(char *dirname, short vRefNum, long dirID)
+{
+	DIR				**curh, *cur;
+	CInfoPBRec		cpb;
+	WDPBRec			pb;
+	Str63			name;
+
+	/*	Get memory for the directory structure	*/
+	curh	= (DIR **) NewHandle(sizeof(DIR));
+
+	/*	Did we get it?	*/
+	if (curh == nil)
+      {
+          dd_errno	= MemError();
+          return nil;
+      }
+
+	/*	Move it high and lock it	*/
+	MoveHHi((char **)curh);
+	HLock((char **)curh);
+	cur		= *curh;
+
+	/*	If we're supposed to open anything but the current directory, set the current
+	 *	working directory to the desired directory.
+	 */
+	if ((dirname != nil) || (vRefNum != 0) || (dirID != 0))
+      {
+          pb.ioCompletion				= nil;
+          pb.ioNamePtr				= (unsigned char *)dirname;
+          pb.ioVRefNum				= vRefNum;
+          pb.ioWDDirID				= dirID;
+		
+          if ((dd_errno = PBHSetVolSync(&pb)) != noErr)		{
+              /* a trailing colon could cause trouble */
+	          if (dirname[dirname[0]] == ':')		{
+	              dirname[0]--;
+		          dd_errno = PBHSetVolSync(&pb);
+		          dirname[0]++;
+		      }
+		  }
+
+          if (dd_errno == noErr)	
+            {  /* make vRefNum and dirId valid & up-to-date */
+            	pb.ioNamePtr = NULL;
+         		dd_errno = PBHGetVolSync(&pb);
+                vRefNum = pb.ioVRefNum;
+                dirID = pb.ioWDDirID;
+            }
+      }
+
+
+	cur->dd_buf	= nil;
+	
+	/*	Get info on the desired directory (its name, etc.)	*/
+	cpb.dirInfo.ioCompletion	= nil;
+	cpb.dirInfo.ioNamePtr		= name;
+	cpb.dirInfo.ioVRefNum		= vRefNum;
+	cpb.dirInfo.ioFDirIndex		= -1;
+	cpb.dirInfo.ioDrDirID		= dirID;
+	
+	if ((dd_errno = PBGetCatInfoSync(&cpb)) != noErr)
+		goto failure_exit;
+
+	/*	Save the directory info	*/
+	cur->dir_fsp.vRefNum	= vRefNum;
+	cur->dd_fd				= cpb.dirInfo.ioDrDirID;
+	cur->dd_parent			= cpb.dirInfo.ioDrParID;
+
+	BlockMove(name, cur->dir_fsp.name, sizeof(Str63));
+
+	/*	Convert the name to a C-style string	*/
+	p2cstr(cur->dir_fsp.name);
+
+	/*	Set up our directory structure to read the first entry	*/
+	cur->dd_off				= 1;
+	cur->dd_numents			= cpb.dirInfo.ioDrNmFls;
+	cur->dd_cached			= false;
+
+	return cur;
+
+	/*	This code is branched-to in case of error.  It frees up the memory and returns.	*/
+  failure_exit:
+	DisposeHandle((char **) curh);
+	return nil;
+}
+
+/****************************************************************************************
+ *
+ *	This function returns the index of the directory entry to be next read.
+ *
+ *	Calls:			nothing
+ *	Called By:		<general purpose>
+ *	Globals Used:	none
+ *	Parameters:		pointer to the directory management block
+ *	Returns:		index of the next directory entry to be read.
+ *
+ ****************************************************************************************/
+
+long	
+telldir(DIR *dirp)
+{
+	if (dirp->dd_off > dirp->dd_numents)
+		return -1;
+	else
+		return dirp->dd_off-1;	/* The -1 is because Macs start at 1 & not 0 for dir index,
+								 * and this is a little more POSIX.
+								 */
+}
+
+/****************************************************************************************
+ *
+ *	This function closes the directory opened with opendir() or hopendir()
+ *
+ *	Calls:			DisposeHandle(), RecoverHandle()
+ *	Called By:		<general purpose>
+ *	Globals Used:	none
+ *	Parameters:		pointer to the directory management block
+ *	Returns:		0 (always successful)
+ *
+ ****************************************************************************************/
+
+int	
+closedir(DIR *dirp)
+{
+	struct dirent	**cur;
+	
+	/*	Dispose of any directory entries read in.	*/
+	cur	= dirp->dd_buf;
+	
+	dd_errno	= noErr;
+
+	while (cur)
+      {
+          struct dirent	**next;
+		
+          next	= (*cur)->next;
+		
+          DisposeHandle((Handle) cur);
+		
+          if (dd_errno == noErr)
+              dd_errno	= MemError();
+
+          cur		= next;
+      }
+
+	/*	Dispose of the directory managment block	*/
+	DisposeHandle(RecoverHandle((Ptr) dirp));
+
+	if (dd_errno == noErr)
+		dd_errno	= MemError();
+
+	return dd_errno?-1:0;
+}
+
+/****************************************************************************************
+ *
+ *	This function sets the index of the next-read directory entry.  It will also search
+ *	the list of read entries so that an entry won't be read from disk more than once.
+ *
+ *	Calls:			nothing
+ *	Called By:		<general purpose>
+ *	Globals Used:	none
+ *	Parameters:		pointer to the directory management block, index of directory
+ *	Returns:		nothing
+ *
+ ****************************************************************************************/
+
+void	
+seekdir(DIR *dirp, long loc)
+{
+	struct dirent	**cur;
+	
+	dirp->dd_off		= loc+1;	/* The +1 is because the Mac indexes directories
+									 * from 1 and not 0 and we want to be a little bit
+									 * POSIX
+									 */
+
+	/*	Search through the entries that we've read already	*/
+	cur	= dirp->dd_buf;
+	
+	while (cur)
+      {
+          /*	If we find the entry that we've seeked to, set up so that readdir() will
+           *	return this one instead of reading a new one.
+           */
+          if (loc == (*cur)->d_off)
+			{
+                dirp->dd_cached		= true;
+                dirp->dd_cache_hint	= cur;
+
+                return;
+			}
+
+          cur	= (*cur)->next;
+      }
+
+	/*	If we didn't find it, then tell readdir() to get the entry from the FS	*/
+	dirp->dd_cached	= false;
+}
+
+/****************************************************************************************
+ *
+ *	This function will read the next directory entry from disk.  It will return nil and
+ *	set dd_errno to noErr when the end of the directory is reached.  It will avoid
+ *	reading directory entries from disk more than once.
+ *
+ *	Calls:			nothing
+ *	Called By:		<general purpose>
+ *	Globals Used:	none
+ *	Parameters:		pointer to the directory management block
+ *	Returns:		pointer to directory entry or nil if an error occurred and dd_errno
+ *					will be set.  If the last entry has already been read, this will
+ *					return nil and dd_errno will be set to noErr.
+ *
+ ****************************************************************************************/
+
+struct dirent	*
+readdir(DIR *dirp)
+{
+	CInfoPBRec		cpb;
+	struct dirent	**meh, *me;
+	
+	/*	If the entry has been read already, then return the already present entry	*/
+	if (dirp->dd_cached)
+		me	= *(dirp->dd_cache_hint);
+	else
+		/*	Otherwise, read it from disk...	*/
+      {
+          /*	Past the end of the directory?	*/
+          if (dirp->dd_off > dirp->dd_numents)
+			{
+                dd_errno	= noErr;
+                return nil;
+			}
+
+          /*	Allocate space for a new entry	*/
+          meh	= (struct dirent **) NewHandle(sizeof(struct dirent));
+		
+          /*	Enough memory?	*/
+          if (meh == nil)
+			{
+                dd_errno	= MemError();
+                return nil;
+			}
+
+          /*	Lock the entry	*/
+          MoveHHi((Handle) meh);
+          HLock((Handle) meh);
+
+          me	= *meh;
+
+          /*	Get the entry's info from disk	*/
+          me->fsp.name[0]				= 0;
+
+          cpb.dirInfo.ioCompletion	= nil;
+          cpb.dirInfo.ioNamePtr		= me->fsp.name;
+          cpb.dirInfo.ioVRefNum		= dirp->dir_fsp.vRefNum;
+          cpb.dirInfo.ioFDirIndex		= dirp->dd_off;
+          cpb.dirInfo.ioDrDirID		= dirp->dd_fd;
+
+          if ((dd_errno = PBGetCatInfoSync(&cpb)) != noErr)
+			{
+                DisposeHandle((Handle) meh);
+                return nil;
+			}
+	
+          /*	Set up the dirent structure	*/
+          me->d_off			= dirp->dd_off-1;
+          me->fsp.vRefNum		= cpb.dirInfo.ioVRefNum;
+          me->d_fileno		= cpb.dirInfo.ioDrDirID;
+          me->d_parent		= cpb.dirInfo.ioDrParID;
+		
+          /*	C strings only!	*/
+          p2cstr(me->fsp.name);
+
+          /*	Add it to the list for this directory	*/
+          me->next			= dirp->dd_buf;
+		
+          dirp->dd_buf		= meh;
+      }
+
+	/*	Seek to the next entry	*/
+	seekdir(dirp, dirp->dd_off);
+
+	/*	Return what we've found	*/
+	return me;
+}
+
+/****************************************************************************************
+ *
+ *	This function will give an absolute pathname to a given directory.
+ *
+ *	Calls:			NewPtr(), DisposePtr(), PBGetCatInfo()
+ *	Called By:		<general purpose>
+ *	Globals Used:	none
+ *	Parameters:		vRefNum and startDirID of desired path, pointer to path name storage,
+ *					length of path name storage, pointer to C-string separator.
+ *	Returns:		bdNamErr if the path would overflow the storage,
+ *					some other error code if something else happened,
+ *					or noErr on success.
+ *
+ ****************************************************************************************/
+
+OSErr	
+hgetwd(short vRefNum, long startDirID, char *path, int max_path_len, char *sep)
+{
+	long		curDirID;
+	OSErr		err;
+	CInfoPBRec	pb;
+	Str63		name;
+	char		*temp_path;
+
+	/*	Start with an empty path	*/
+	path[0]	= 0;
+
+	/*	Get memory for a temporary path	*/
+	temp_path	= (char *) NewPtr(max_path_len);
+	
+	if (temp_path == nil)
+		return MemError();
+
+	/*	Start at the given directory	*/
+	curDirID	= startDirID;
+
+	do	{
+		/*	Get cat info for the current directory	*/
+		name[0]	= 0;
+
+		pb.dirInfo.ioCompletion	= nil;
+		pb.dirInfo.ioNamePtr	= name;
+		pb.dirInfo.ioVRefNum	= vRefNum;
+		pb.dirInfo.ioFDirIndex	= -1;
+		pb.dirInfo.ioDrDirID	= curDirID;
+		
+		if ((err = PBGetCatInfoSync(&pb)) != noErr)
+          {
+              DisposePtr((Ptr) temp_path);
+              return err;
+          }
+
+		/*	Convert name to a C string	*/
+		p2cstr(name);
+
+		/*	Check that we don't overflow storage	*/
+		if ((strlen((char const *)name) + strlen(path) + strlen(sep)) >= max_path_len)
+          {
+              DisposePtr((Ptr) temp_path);
+              return bdNamErr; /* -37 */
+          }
+
+		/*	Prepend the name and separator	*/
+		strcpy(temp_path, path);
+		strcpy(path, (char const *)name);
+		strcat(path, sep);
+		strcat(path, temp_path);
+
+		/*	Move "up" one directory	*/
+		curDirID	= pb.dirInfo.ioDrParID;
+    }
+	/*	Until we hit the root directory	*/
+	while (pb.dirInfo.ioDrDirID != fsRtDirID);
+
+	/*	Get rid of our temp storage and return	*/
+	DisposePtr((Ptr) temp_path);
+
+	return MemError();
+}
+
+/****************************************************************************************
+ *
+ *	This function will change the current working directory.
+ *
+ *	Calls:			opendir(), closedir(), PBHSetVol()
+ *	Called By:		<general purpose>
+ *	Globals Used:	none
+ *	Parameters:		C-string pathname.
+ *	Returns:		-1 on failure, 0 on success.  Sets dd_errno on failure.
+ *
+ ****************************************************************************************/
+
+int	
+chdir(char *path)
+{
+	DIR		*d;
+	short	vRefNum;
+	long	dirID;
+	WDPBRec	pb;
+
+	/*	Open the directory	*/
+	d	= opendir(path);
+	
+	if (d == nil)
+		return -1;
+
+	/*	Get the Mac FS identification for this directory	*/
+	vRefNum	= d->dd_volume;
+	dirID	= d->dd_fd;
+	
+	/*	Close the directory	*/
+	closedir(d);
+
+	/*	CD to the new directory	*/
+	pb.ioCompletion	= nil;
+	pb.ioNamePtr	= nil;
+	pb.ioVRefNum	= vRefNum;
+	pb.ioWDDirID	= dirID;
+	
+	dd_errno = PBHSetVolSync(&pb);
+	
+	return dd_errno?-1:0;
+}
+
+/****************************************************************************************
+ *
+ *	This function will get the current working directory's path.
+ *
+ *	Calls:			PBHGetVol(), hgetwd()
+ *	Called By:		<general purpose>
+ *	Globals Used:	none
+ *	Parameters:		pointer to a buffer of MAXPATHLEN bytes.
+ *	Returns:		pointer to the buffer on success, on failure, nil and dd_errno will
+ *					be set.
+ *
+ ****************************************************************************************/
+
+char *
+getwd(char *path)
+{
+	WDPBRec	pb;
+
+	/*	Get the current working directory	*/
+	pb.ioCompletion	= nil;
+	pb.ioNamePtr	= nil;
+	
+	if ((dd_errno = PBHGetVolSync(&pb)) != noErr)
+		return nil;
+
+	/*	Transform it into a path	*/
+	if ((dd_errno = hgetwd(pb.ioWDVRefNum, pb.ioWDDirID, path, MAXPATHLEN-1, dd_separator)) != noErr)
+		return nil;
+
+	return path;
+}
+
+/****************************************************************************************
+ *
+ *	This function will get the path to a given (already opened) directory.
+ *
+ *	Calls:			hgetwd()
+ *	Called By:		<general purpose>
+ *	Globals Used:	none
+ *	Parameters:		pointer to a buffer of MAXPATHLEN bytes.
+ *	Returns:		pointer to the buffer on success, on failure, nil and dd_errno will
+ *					be set.
+ *
+ ****************************************************************************************/
+
+char *
+pathdir(DIR *dirp, char *path)
+{
+	if ((dd_errno = hgetwd(dirp->dd_volume, dirp->dd_fd, path, MAXPATHLEN-1, dd_separator)) != noErr)
+		return nil;
+
+	return path;
+}
+
+#endif /* defined(MAC) || defined(macintosh) || defined(SYMANTEC_C) */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dir_mac.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dir_mac.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dir_mac.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,99 @@
+/****************************************************************************************
+ *
+ *	File:		dirent.h
+ *	Created:	7/3/93		By:	George T. Talbot
+ *	Purpose:	Implements UNIX-like directory reading for the Macintosh.
+ *				This file describes Filesystem-independent directory information.
+ *	Modifications:
+ *
+ *	Notes:
+ *			1) These routines will NOT work under A/UX.
+ *			2) WD = working directory
+ *			3) CD = change directory
+ *			4) FS = file system
+ *			5) Mac filesystems allow spaces as part of pathnames!
+ *			6) All routines which return a path use the default Macintosh path separator,
+ *			   a colon (":").
+ *
+ ****************************************************************************************/
+
+/* $Id: dir_mac.h,v 1.4 1998/02/02 21:38:43 smitchel Exp $ */
+
+#ifndef	__dirent_h
+#define	__dirent_h
+
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+/*
+ * Added to HDF core library for directory reading on the Macintosh
+ *
+ * 1996/03/01 - GeorgeV.
+ */
+
+#include <Files.h>
+
+/*	Maximum path length for opendir()	*/
+#define	MAXPATHLEN	255
+
+/*
+ * Definitions for library routines operating on directories.
+ */
+typedef	struct __dirdesc {
+	/*	PRIVATE FIELDS.  Use the fields & defines below PUBLIC */
+	FSSpec	dir_fsp;
+	long	dd_off;		/* Current offset (ioWDIndex) in dir (for telldir) */
+	int		dd_cached;	/* true if dd_cache_hint points to the next dir to be read	*/
+
+	struct dirent	**dd_cache_hint;
+	struct dirent	**dd_buf;	/* directory data buffer */
+
+	/*	PUBLIC	*/
+	long	dd_fd;							/* file descriptor (dirID) of this dir	*/
+
+#define	dd_parent	dir_fsp.parID			/* dirID of parent	*/
+#define	dd_bsize	1						/* amount of entries read at a time */
+#define	dd_size		sizeof(struct dirent)	/* amount of valid data in buffer */
+#define	dd_loc		1
+#define	dd_name		dir_fsp.name
+#define	dd_volume	dir_fsp.vRefNum
+
+	long	dd_numents;	/* Number of files/directories in this directory	*/
+} DIR;
+
+/*	See dirent.c for descriptions of these routines	*/
+extern	DIR	*opendir(char *dirname);
+extern	struct dirent *readdir(DIR *dirp);
+extern	int closedir(DIR *dirp);
+extern	void seekdir(DIR *dirp, long loc);
+extern	long telldir(DIR *dirp);
+
+#ifndef	lint
+	#define	rewinddir(dirp)	seekdir((dirp), (long)0)
+#else
+	extern	void rewinddir(DIR *dirp);
+#endif
+
+/*	Convenient routines	*/
+extern char	*getwd(char *path);
+extern int	chdir(char *path);
+extern char	*pathdir(DIR *dirp, char *path);
+
+/*	Any errors in above routines (and hopendir()) are put here	*/
+extern OSErr	dd_errno;
+extern char		*dd_separator;	/*	If you're feeling brave, change this to "/"	*/
+extern int		dd_xform_seps;
+
+/*	In case you like errno instead	*/
+#ifdef UNCOMMENT_ME_IF_YOUVE_GOT_TO_HAVE_ERRNO
+#define	errno	dd_errno
+#endif
+
+/*	This routine is Mac-specific, but very convenient in certain situations	*/
+OSErr	hgetwd(short vRefNum, long startDirID, char *path, int max_path_len, char *sep);
+
+/*	You probably don't want to call this.	*/
+extern	DIR	*hopendir(char *dirname, short vRefNum, long dirID);
+
+#include "sys_dir_mac.h"
+
+#endif /* defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)  */
+#endif	/* !__dirent_h */

Added: packages/libhdf4/branches/upstream/current/hdf/src/dynarray.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dynarray.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dynarray.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,404 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.4 $";
+#endif
+
+/* $Id: dynarray.c,v 1.4 1999/06/16 21:10:49 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_dynarray_c
+#endif
+
+/*
+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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DAcreate_array);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DAcreate_array);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DAdestroy_array);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DAdestroy_array);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DAsize_array);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DAsize_array);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DAget_elem);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DAget_elem);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DAset_elem);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_DAset_elem);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_DAdel_elem);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_DAdel_elem);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}   /* end DAdel_elem() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/dynarray.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/dynarray.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/dynarray.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,156 @@
+/****************************************************************************
+ * 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: dynarray.h,v 1.1 1996/01/19 01:13:40 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/herrpf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/herrpf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/herrpf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,89 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.1 $";
+#endif
+
+/* $Id: herrpf.c,v 1.1 2000/04/17 20:44:23 epourmal Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+/*
+#ifndef HERR_FNAMES
+#   define HERR_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nheprnt   FNAME(HEPRNT)
+#else
+#   define nheprnt   FNAME(heprnt) */
+/*#endif*/ /* DF_CAPFNAMES */
+/*#endif*/ /* HERR_FNAMES */
+
+/*-----------------------------------------------------------------------------
+ * 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(VOID)
+nheprntc(intf * print_levels)
+{
+    HEprint(stderr, *print_levels);
+}
+/*-----------------------------------------------------------------------------
+ * 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;
+ 
+ 
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/herrpff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/herrpff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/herrpff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,51 @@
+C-----------------------------------------------------------------------------
+C Name: hestring
+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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hestringf
+	!MS$endif
+      integer error_code 
+      character*(*) error_message 
+C      integer hestringc 
+
+      INTERFACE
+        INTEGER FUNCTION hestringc(error_code, error_message, length)
+          !MS$ATTRIBUTES C,reference,alias:'_HESTRINGC' :: hestringc
+          integer error_code, length
+	    character*(*) error_message
+        END FUNCTION hestringc
+      END INTERFACE
+      hestringf = hestringc(error_code, error_message,
+     +                      len(error_message))
+      return
+      end
+C-----------------------------------------------------------------------------
+C Name: heprnt
+C Purpose: prints values from the error stack 
+C Inputs:  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 heprnt(print_levels)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: heprnt
+	!MS$endif
+      integer print_levels 
+
+      INTERFACE
+        INTEGER FUNCTION heprntc(print_levels)
+          !MS$ATTRIBUTES C,reference,alias:'_HEPRNTC' :: heprntc
+          integer print_levels 
+        END FUNCTION heprntc
+      END INTERFACE
+      heprnt = heprntc(print_levels)
+      return
+      end

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hfilepf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hfilepf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hfilepf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,323 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.5 $";
+#endif
+
+/* $Id: hfilepf.c,v 1.5 2000/08/22 20:35:14 epourmal Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    hfilepf.c. based on hfilef.c,v 1.19
+ * Purpose: C stubs for Fortran PowerStation low level routines
+ * Invokes: hfile.c
+ * Contents:
+ *  hiopen_:   call Hopen to open HDF file
+ *  hclose_:   call Hclose to close HDF file
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+
+#ifndef HFILE_FNAMES
+#   define HFILE_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nhiopen   FNAME(HIOPEN)
+#   define nhiclose   FNAME(HICLOSE)
+#   define nhinumbr   FNAME(HINUMBR)
+#   define nhxisdir  FNAME(HXISDIR)
+#   define nhxiscdir FNAME(HXISCDIR)
+#   define nhddontatexit FNAME(HDDONTATEXIT)
+#   define nhglibverc FNAME(HGLIBVERC)
+#   define nhgfilverc FNAME(HGFILVERC)
+#else
+#   define nhiopen   FNAME(hiopen)
+#   define nhiclose   FNAME(hiclose)
+#   define nhinumbr   FNAME(hinumbr)
+#   define nhxisdir  FNAME(hxisdir)
+#   define nhxiscdir FNAME(hxiscdir)
+#   define nhddontatexit FNAME(hddontatexit)
+#   define nhglibverc FNAME(hglibverc)
+#   define nhgfilverc FNAME(hgfilverc)
+#endif /* DF_CAPFNAMES */
+#endif /* HFILE_FNAMES */
+
+/*-----------------------------------------------------------------------------
+ * 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:    hiclose
+ * 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:   hclose
+ * Invokes: Hclose
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhiclose(intf * file_id)
+{
+    return (Hclose(*file_id));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    hinumbr
+ * Purpose: Get numer of elements with tag
+ * Inputs:  file_id: handle to HDF file to close
+ *          tag: the tag which the elements have.
+ * Returns: number of elements on success, FAIL on failure with error set
+ * Users:   hnumber
+ * Invokes: Hnumber
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhinumbr(int32 file_id, uint16 tag)
+{
+    return (Hnumber(file_id, 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: 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;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hfilepff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hfilepff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hfilepff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,288 @@
+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: hfilepff.f,v 1.6 2000/08/01 20:51:51 epourmal Exp $
+C
+C------------------------------------------------------------------------------
+C File:     hfilepFf.f, based on hfileff.f,v 1.7
+C Purpose:  Fortran stubs for H Fortran PowerStation routines
+C Invokes:  hfilepF.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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hopen
+	!MS$endif
+
+      character*(*) filename
+      integer       access, defdds
+C      integer       hiopen
+      INTERFACE 
+        INTEGER FUNCTION hiopen(filename,access, defdds, nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_HIOPEN' :: hiopen
+	    !DEC$ ATTRIBUTES reference :: filename
+          integer access, defdds, nmlen
+          character*(*) filename
+        END FUNCTION hiopen
+      END INTERFACE
+
+      hopen = hiopen(filename, access, defdds, len(filename))
+      return
+      end
+
+C------------------------------------------------------------------
+C Name: hclose
+C Purpose:  call hiclose, close file
+C           fid:  handle to HDF file to close
+C Returns: 0 on success, FAIL on failure with error set
+C Users:    Fortran stub routine
+C Invokes: hiclose
+C-------------------------------------------------------------------
+
+      integer function hclose(fid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hclose
+	!MS$endif
+
+      integer       fid
+C      integer       hiclose
+      INTERFACE 
+        INTEGER FUNCTION hiclose(fid)
+          !MS$ATTRIBUTES C, reference, alias: '_HICLOSE' :: hiclose
+          integer fid
+        END FUNCTION hiclose
+      END INTERFACE
+
+      hclose = hiclose(fid)
+      return
+      end
+
+C------------------------------------------------------------------
+C Name: hnumber
+C Purpose:  call hinumbr, get number of elements with tag 
+C           fid:  handle to HDF file to close
+C           tag: the tag which the elements have
+C Returns: number of element on success, FAIL on failure with error set
+C Users:    Fortran stub routine
+C Invokes: hinumbr
+C-------------------------------------------------------------------
+
+      integer function hnumber(fid, tag)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hnumber
+	!MS$endif
+
+      integer       fid, tag
+C      integer       hinumbr
+      INTERFACE 
+        INTEGER FUNCTION hinumbr(fid, tag)
+          !MS$ATTRIBUTES C, reference, alias: '_HINUMBR' :: hinumbr
+          integer fid, tag
+        END FUNCTION hinumbr
+      END INTERFACE
+
+      hnumber = hinumbr(fid, tag)
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hxsdir
+	!MS$endif
+
+      character*(*) dir
+C      integer       hxisdir
+      INTERFACE
+        INTEGER FUNCTION hxisdir(dir, dirlen)
+          !MS$ATTRIBUTES C, reference, alias: '_HXISDIR' :: hxisdir
+	    !DEC$ ATTRIBUTES reference :: dir
+          character*(*) dir
+          integer dirlen
+        END FUNCTION hxisdir
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hxscdir
+	!MS$endif
+
+      character*(*) dir
+C      integer       hxiscdir
+      INTERFACE
+        INTEGER FUNCTION hxiscdir(dir, dirlen)
+          !MS$ATTRIBUTES C, reference, alias: '_HXISCDIR' :: hxiscdir
+	    !DEC$ ATTRIBUTES reference :: dir
+          character*(*) dir
+          integer dirlen
+        END FUNCTION hxiscdir
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hglibver
+	!MS$endif
+
+      integer major_v, minor_v, release
+      character*(*) string
+C      integer hglibverc 
+      INTERFACE
+        INTEGER FUNCTION hglibverc(major_v, minor_v, release, string,
+     +	   stringlen)
+          !MS$ATTRIBUTES C, reference, alias: '_HGLIBVERC' :: hglibverc
+	    !DEC$ ATTRIBUTES reference :: string
+          integer major_v, minor_v, release, stringlen
+          character*(*) string
+        END FUNCTION hglibverc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hgfilver
+	!MS$endif
+
+      integer file_id, major_v, minor_v, release
+      character*(*) string
+C      integer hgfilverc 
+      INTERFACE
+        INTEGER FUNCTION hgfilverc(file_id, major_v, minor_v, release,
+     +	                             string, stringlen)
+          !MS$ATTRIBUTES C, reference, alias: '_HGFILVERC' :: hgfilverc
+	    !DEC$ ATTRIBUTES reference :: string
+          integer file_id, major_v, minor_v, release, stringlen
+          character*(*) string
+        END FUNCTION hgfilverc
+      END INTERFACE
+
+      hgfilver = hgfilverc(file_id, major_v, minor_v, release, string,
+     .                     len(string))
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name: hishdf
+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 hishdf(filename)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hishdf
+	!MS$endif
+      character*(*) filename
+C      integer       hiishdf
+	INTERFACE
+        INTEGER FUNCTION hiishdf(filename, length)
+          !MS$ATTRIBUTES C,reference,alias:'_HIISHDF' :: hiishdf
+          integer length
+	    character*(*) filename
+        END FUNCTION hiishdf
+      END INTERFACE
+      hishdf = hiishdf(filename, len(filename))
+      return
+      end
+C-----------------------------------------------------------------------------
+C Name: hestring
+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 hestring(error_code, error_message)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: hestring
+	!MS$endif
+      integer error_code 
+      character*(*) error_message 
+C      integer hestringc 
+
+      INTERFACE
+        INTEGER FUNCTION hestringc(error_code, error_message, length)
+          !MS$ATTRIBUTES C,reference,alias:'_HESTRINGC' :: hestringc
+          integer error_code, length
+	    character*(*) error_message
+        END FUNCTION hestringc
+      END INTERFACE
+      hestring = hestringc(error_code, error_message,len(error_message))
+      return
+      end

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hprotop.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hprotop.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/hprotop.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,3784 @@
+/****************************************************************************
+ * 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: hprotop.h,v 1.3 1998/02/02 21:46:23 smitchel Exp $ */
+
+#ifndef _H_PROTO
+#define _H_PROTO
+
+/* 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
+ */
+    extern int32 Hopen
+                (const char *path, intn acc_mode, int16 ndds);
+
+    extern intn Hclose
+                (int32 file_id);
+
+    extern int32 Hstartread
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    extern intn Hnextread
+                (int32 access_id, uint16 tag, uint16 ref, intn origin);
+
+    extern intn Hexist
+                (int32 file_id, uint16 search_tag, uint16 search_ref);
+
+    extern intn Hinquire
+                (int32 access_id, int32 * pfile_id, uint16 * ptag,
+          uint16 * pref, int32 * plength, int32 * poffset,
+        int32 * pposn, int16 * paccess, int16 * pspecial);
+
+    extern int32 Hstartwrite
+                (int32 file_id, uint16 tag, uint16 ref, int32 length);
+
+    extern int32 Hstartaccess
+                (int32 file_id, uint16 tag, uint16 ref, uint32 flags);
+
+    extern intn Hsetlength
+                (int32 file_id, int32 length);
+
+    extern intn Happendable
+                (int32 aid);
+
+    extern intn HPisappendable
+                (int32 aid);
+
+    extern intn HPregister_term_func
+                (hdf_termfunc_t term_func);
+
+    extern intn Hseek
+                (int32 access_id, int32 offset, intn origin);
+
+    extern int32 Htell
+                (int32 access_id);
+
+    extern int32 Hread
+                (int32 access_id, int32 length, VOIDP data);
+
+    extern int32 Hwrite
+                (int32 access_id, int32 length, const VOIDP data);
+
+    extern int32 Htrunc
+                (int32 access_id, int32 trunc_len);
+
+    extern intn Hendaccess
+                (int32 access_id);
+
+    extern intn HDgetc
+                (int32 access_id);
+
+    extern intn HDputc
+                (uint8 c, int32 access_id);
+
+    extern int32 Hgetelement
+                (int32 file_id, uint16 tag, uint16 ref, uint8 * data);
+
+    extern int32 Hputelement
+                (int32 file_id, uint16 tag, uint16 ref, const uint8 * data, int32 length);
+
+    extern int32 Hlength
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    extern int32 Hoffset
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    extern intn Hsync
+                (int32 file_id);
+
+    extern intn Hcache
+                (int32 file_id, intn cache_on);
+
+    extern intn Hgetlibversion
+                (uint32 * majorv, uint32 * minorv,
+                 uint32 * releasev, char * string);
+
+    extern intn Hgetfileversion
+                (int32 file_id, uint32 * majorv, uint32 * minorv,
+                 uint32 * release, char * string);
+
+    extern intn Hsetaccesstype(int32 access_id, uintn accesstype);
+
+    extern uint16 HDmake_special_tag
+                (uint16 tag);
+
+    extern intn HDis_special_tag
+                (uint16 tag);
+
+    extern uint16 HDbase_tag
+                (uint16 tag);
+
+    extern int  HDerr
+                (int32 file_id);
+
+    extern intn HDvalidfid
+                (int32 file_id);
+
+    extern const char *HDgettagdesc
+                (uint16 tag);
+
+    extern char *HDgettagsname
+                (uint16 tag);
+
+    extern intn HDgettagnum
+                (const char *tag_name);
+
+    extern char *HDgetNTdesc
+                (int32 nt);
+
+    extern const char *HDfidtoname
+                (int32 fid);
+
+    extern intn Hishdf
+                (const char * filename);
+
+    extern intn Hfidinquire
+                (int32 file_id, char ** fname, intn * acc_mode,
+                 intn * attach);
+    
+    extern intn Hshutdown(void);
+
+    extern void HPend(void);
+
+    extern 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
+
+*******************************************************************************/
+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
+
+*******************************************************************************/
+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
+
+*******************************************************************************/
+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
+
+*******************************************************************************/
+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
+
+*******************************************************************************/
+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
+     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
+
+*******************************************************************************/
+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
+ */
+
+    extern VOIDP HDmemfill
+                (VOIDP dest, const VOIDP src, uint32 item_size, uint32 num_items);
+
+    extern char *HIstrncpy
+                (char * dest, const char * source, int32 len);
+
+    extern int32 HDspaceleft
+                (void);
+
+#if defined MALLOC_CHECK
+    extern VOIDP HDmalloc
+                (uint32 qty);
+
+    extern VOIDP HDrealloc
+                (VOIDP where, uint32 qty);
+
+    extern VOIDP HDcalloc
+                (uint32 n, uint32 size);
+
+    extern void HDfree
+                (VOIDP ptr);
+
+#endif /* defined MALLOC_CHECK */
+
+#if defined VMS || defined macintosh || defined MAC || defined SYMANTEC_C || defined MIPSEL || defined NEXT || defined CONVEX || defined IBM6000 || defined SUN || defined IRIX
+    extern char *HDstrdup
+                (const char *s);
+
+#endif
+
+    extern intn HDc2fstr
+                (char * str, intn len);
+
+    extern char *HDf2cstring
+                (_fcd fdesc, intn len);
+
+    extern intn HDflush
+                (int32 file_id);
+
+    extern intn HDpackFstring
+                (char * src, char * dest, intn len);
+
+/*
+   ** from hblocks.c
+ */
+    extern int32 HLcreate
+                (int32 file_id, uint16 tag, uint16 ref, int32 block_length,
+                 int32 number_blocks);
+
+    extern intn HLconvert
+                (int32 aid, int32 block_length, int32 number_blocks);
+
+    extern int  HDinqblockinfo
+                (int32 aid, int32 *length, int32 *first_length, int32 *block_length,
+                 int32 *number_blocks);
+
+/*
+   ** from hextelt.c
+ */
+    extern int32 HXcreate
+                (int32 file_id, uint16 tag, uint16 ref, const char * extern_file_name,
+                 int32 offset, int32 start_len);
+
+    extern intn HXsetcreatedir
+                (const char *dir);
+
+    extern intn HXsetdir
+                (const char *dir);
+
+/*
+   ** from hcomp.c
+ */
+    extern 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);
+
+    extern int32 HCPquery_encode_header(comp_model_t model_type, model_info * m_info,
+             comp_coder_t coder_type, comp_info * c_info);
+
+    extern intn HCPencode_header(uint8 *p, comp_model_t model_type, model_info * m_info,
+             comp_coder_t coder_type, comp_info * c_info);
+
+    extern intn HCPdecode_header(uint8 *p, comp_model_t *model_type, model_info * m_info,
+             comp_coder_t *coder_type, comp_info * c_info);
+
+
+/*
+   ** from hvblocks.c
+ */
+    extern int32 HVcreate
+                (int32 file_id, uint16 tag, uint16 ref);
+
+/*
+   ** from herr.c
+ */
+    extern const char *HEstring
+                (hdf_err_code_t error_code);
+
+    extern VOID HEpush
+                (hdf_err_code_t error_code, const char * function_name,
+                 const char * file_name, intn line);
+
+    extern VOID HEreport
+                (const char *,...);
+
+    extern VOID HEprint
+                (FILE * stream, int32 print_level);
+
+    extern int16 HEvalue
+                (int32 level);
+
+    extern VOID HEPclear
+                (void);
+
+ 	extern intn HEshutdown(void);
+
+/*
+   ** from hbitio.c
+ */
+    extern int32 Hstartbitread
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    extern int32 Hstartbitwrite
+                (int32 file_id, uint16 tag, uint16 ref, int32 length);
+
+    extern intn Hbitappendable
+                (int32 bitid);
+
+    extern intn Hbitwrite
+                (int32 bitid, intn count, uint32 data);
+
+    extern intn Hbitread
+                (int32 bitid, intn count, uint32 *data);
+
+    extern intn Hbitseek
+                (int32 bitid, int32 byte_offset, intn bit_offset);
+
+    extern intn Hgetbit
+                (int32 bitid);
+
+    extern int32 Hendbitaccess
+                (int32 bitfile_id, intn flushbit);
+
+    extern intn HPbitshutdown(void);
+
+/*
+   ** from dfcomp.c
+ */
+    extern intn DFputcomp
+                (int32 file_id, uint16 tag, uint16 ref, uint8 * image,
+        int32 xdim, int32 ydim, uint8 * palette, uint8 * newpal,
+                 int16 scheme, comp_info * cinfo);
+
+    extern int  DFgetcomp
+                (int32 file_id, uint16 tag, uint16 ref, uint8 * image,
+                 int32 xdim, int32 ydim, uint16 scheme);
+
+/*
+   ** from dfrle.c
+ */
+    extern int32 DFCIrle
+                (VOIDP buf, VOIDP bufto, int32 len);
+
+    extern int32 DFCIunrle
+                (uint8 * buf, uint8 *bufto, int32 outlen, int resetsave);
+
+/*
+   ** from dfimcomp.c
+ */
+    extern VOID DFCIimcomp
+                (int32 xdim, int32 ydim, uint8 in[], uint8 out[],
+                 uint8 in_pal[], uint8 out_pal[], int mode);
+
+    extern VOID DFCIunimcomp
+                (int32 xdim, int32 ydim, uint8 in[], uint8 out[]);
+
+/*
+   ** from dfjpeg.c
+ */
+
+    extern intn DFCIjpeg
+                (int32 file_id, uint16 tag, uint16 ref, int32 xdim, int32 ydim,
+                 VOIDP image, int16 scheme, comp_info * scheme_info);
+
+/*
+   ** from dfunjpeg.c
+ */
+
+    extern intn DFCIunjpeg
+                (int32 file_id, uint16 tag, uint16 ref, VOIDP image, int32 xdim,
+                 int32 ydim, int16 scheme);
+
+/*
+   ** from dfgroup.c
+ */
+    extern int32 DFdiread
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    extern intn DFdiget
+                (int32 list, uint16 * ptag, uint16 * pref);
+
+    extern intn DFdinobj
+                (int32 list);
+
+    extern int32 DFdisetup
+                (int maxsize);
+
+    extern intn DFdiput
+                (int32 list, uint16 tag, uint16 ref);
+
+    extern intn DFdiwrite
+                (int32 file_id, int32 list, uint16 tag, uint16 ref);
+
+/*
+   ** from dfp.c
+ */
+    extern intn DFPgetpal
+                (const char * filename, VOIDP palette);
+
+    extern intn DFPputpal
+                (const char * filename, const VOIDP palette, intn overwrite, const char * filemode);
+
+    extern intn DFPaddpal
+                (const char * filename, const VOIDP palette);
+
+    extern intn DFPnpals
+                (const char * filename);
+
+    extern intn DFPreadref
+                (const char * filename, uint16 ref);
+
+    extern intn DFPwriteref
+                (const char * filename, uint16 ref);
+
+    extern intn DFPrestart
+                (void);
+
+    extern uint16 DFPlastref
+                (void);
+
+/*
+   ** from dfr8.c
+ */
+    extern int  DFR8setcompress
+                (int32 scheme, comp_info * cinfo);
+
+    extern intn DFR8getdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 int * pispal);
+
+    extern intn DFR8getimage
+                (const char * filename, uint8 * image, int32 xdim, int32 ydim,
+                 uint8 * pal);
+
+    extern intn DFR8setpalette
+                (uint8 * pal);
+
+    extern intn DFR8putimage
+                (const char * filename, VOIDP image, int32 xdim, int32 ydim, uint16 compress);
+
+    extern intn DFR8addimage
+                (const char * filename, VOIDP image, int32 xdim, int32 ydim, uint16 compress);
+
+    extern intn DFR8nimages
+                (const char * filename);
+
+    extern intn DFR8readref
+                (const char * filename, uint16 ref);
+
+    extern intn DFR8writeref
+                (const char * filename, uint16 ref);
+
+    extern intn DFR8restart
+                (void);
+
+    extern uint16 DFR8lastref
+                (void);
+
+    extern intn DFR8getpalref(uint16 *pal_ref);
+
+    extern intn DFR8Pshutdown(void);
+
+/*
+   ** from dfgr.c
+ */
+    extern intn DFGRgetlutdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 intn * pncomps, intn * pil);
+
+    extern intn DFGRreqlutil
+                (intn il);
+
+    extern intn DFGRgetlut
+                (const char * filename, VOIDP lut, int32 xdim, int32 ydim);
+
+    extern intn DFGRgetimdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 intn * pncomps, intn * pil);
+
+    extern intn DFGRreqimil
+                (intn il);
+
+    extern intn DFGRgetimage
+                (const char * filename, VOIDP image, int32 xdim, int32 ydim);
+
+    extern intn DFGRsetcompress
+                (int32 scheme, comp_info * cinfo);
+
+    extern intn DFGRsetlutdims
+                (int32 xdim, int32 ydim, intn ncomps, intn il);
+
+    extern intn DFGRsetlut
+                (VOIDP lut, int32 xdim, int32 ydim);
+
+    extern intn DFGRaddlut
+                (const char * filename, VOIDP lut, int32 xdim, int32 ydim);
+
+    extern intn DFGRsetimdims
+                (int32 xdim, int32 ydim, intn ncomps, intn il);
+
+    extern intn DFGRaddimage
+                (const char * filename, VOIDP image, int32 xdim, int32 ydim);
+
+    extern intn DFGRputimage
+                (const char * filename, VOIDP image, int32 xdim, int32 ydim);
+
+    extern intn DFGRreadref
+                (const char * filename, uint16 ref);
+
+    extern uint16 DFGRIlastref
+                (void);
+
+    extern intn DFGRIgetdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 intn * pncomps, intn * pil, intn type);
+
+    extern intn DFGRIreqil
+                (intn il, intn type);
+
+    extern intn DFGRIgetimlut
+                (const char * filename, VOIDP imlut, int32 xdim, int32 ydim, intn type,
+                 intn isfortran, int *compressed, uint16 *compr_type, int *has_pal);
+
+    extern intn DFGRIsetdims
+                (int32 xdim, int32 ydim, intn ncomps, intn type);
+
+    extern intn DFGRIsetil
+                (intn il, intn type);
+
+    extern intn DFGRIrestart
+                (void);
+
+    extern intn DFGRIaddimlut
+                (const char * filename, VOIDP imlut, int32 xdim, int32 ydim, intn type,
+                 intn isfortran, intn newfile);
+
+    extern intn DFGRPshutdown(void);
+
+/*
+   ** from df24.c
+ */
+    extern intn DF24getdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 intn * pil);
+
+    extern intn DF24reqil
+                (intn il);
+
+    extern intn DF24getimage
+                (const char * filename, VOIDP image, int32 xdim, int32 ydim);
+
+    extern intn DF24setdims
+                (int32 xdim, int32 ydim);
+
+    extern intn DF24setil
+                (intn il);
+
+    extern intn DF24setcompress
+                (int32 type, comp_info * cinfo);
+
+    extern intn DF24restart
+                (void);
+
+    extern intn DF24addimage
+                (const char * filename, VOIDP image, int32 xdim, int32 ydim);
+
+    extern intn DF24putimage
+                (const char * filename, VOIDP image, int32 xdim, int32 ydim);
+
+    extern intn DF24nimages
+                (const char * filename);
+
+    extern intn DF24readref
+                (const char * filename, uint16 ref);
+
+    extern uint16 DF24lastref
+                (void);
+
+/*
+   ** from dfan.c
+ */
+
+    extern int32 DFANgetlablen
+                (const char * filename, uint16 tag, uint16 ref);
+
+    extern intn DFANgetlabel
+                (const char * filename, uint16 tag, uint16 ref, char * label,
+                 int32 maxlen);
+
+    extern int32 DFANgetdesclen
+                (const char * filename, uint16 tag, uint16 ref);
+
+    extern intn DFANgetdesc
+                (const char * filename, uint16 tag, uint16 ref, char * desc,
+                 int32 maxlen);
+
+    extern int32 DFANgetfidlen
+                (int32 file_id, intn isfirst);
+
+    extern int32 DFANgetfid
+                (int32 file_id, char * id, int32 maxlen, intn isfirst);
+
+    extern int32 DFANgetfdslen
+                (int32 file_id, intn isfirst);
+
+    extern int32 DFANgetfds
+                (int32 file_id, char * desc, int32 maxlen, intn isfirst);
+
+    extern intn DFANputlabel
+                (const char * filename, uint16 tag, uint16 ref, char * label);
+
+    extern intn DFANputdesc
+                (const char * filename, uint16 tag, uint16 ref, char * desc,
+                 int32 desclen);
+
+    extern intn DFANaddfid
+                (int32 file_id, char * id);
+
+    extern intn DFANaddfds
+                (int32 file_id, char * desc, int32 desclen);
+
+    extern uint16 DFANlastref
+                (void);
+
+    extern intn DFANlablist
+                (const char * filename, uint16 tag, uint16 reflist[],
+         char * labellist, intn listsize, intn maxlen, intn startpos);
+
+    extern intn DFANclear
+                (void);
+
+    extern intn DFANIclear
+                (void);
+
+    extern uint16 DFANIlocate
+                (int32 file_id, int type, uint16 tag, uint16 ref);
+
+    extern int  DFANIaddentry
+                (int type, uint16 annref, uint16 datatag, uint16 dataref);
+
+    extern int32 DFANIgetannlen
+                (const char * filename, uint16 tag, uint16 ref, int type);
+
+    extern intn DFANIgetann
+                (const char * filename, uint16 tag, uint16 ref, uint8 * ann,
+                 int32 maxlen, int type);
+
+    extern intn DFANIputann
+                (const char * filename, uint16 tag, uint16 ref, uint8 * ann,
+                 int32 annlen, int type);
+
+    extern int  DFANIlablist
+                (const char * filename, uint16 tag, uint16 reflist[],
+            uint8 * labellist, int listsize, int maxlen, int startpos,
+                 int isfortran);
+
+    extern int  DFANIaddfann
+                (int32 file_id, char * ann, int32 annlen, int type);
+
+    extern int32 DFANIgetfannlen
+                (int32 file_id, int type, int isfirst);
+
+    extern int32 DFANIgetfann
+                (int32 file_id, char * ann, int32 maxlen, int type, int isfirst);
+
+    extern intn DFANPshutdown(void);
+
+/*
+   ** from dfsd.c
+ */
+
+    extern int  DFSDgetdims
+                (const char * filename, intn * prank, int32 sizes[], intn maxrank);
+
+    extern int  DFSDgetdatastrs
+                (char * label, char * unit, char * format, char * coordsys);
+
+    extern int  DFSDgetdimstrs
+                (int dim, char * label, char * unit, char * format);
+
+    extern int  DFSDgetdatalen
+                (int * llabel, int * lunit, int * lformat, int * lcoordsys);
+
+    extern int  DFSDgetdimlen
+                (int dim, int * llabel, int * lunit, int * lformat);
+
+    extern int  DFSDgetdimscale
+                (intn dim, int32 maxsize, VOIDP scale);
+
+    extern int  DFSDgetrange
+                (VOIDP pmax, VOIDP pmin);
+
+    extern int  DFSDgetdata
+                (const char * filename, intn rank, int32 maxsizes[], VOIDP data);
+
+    extern int  DFSDsetlengths
+                (int maxlen_label, int maxlen_unit, int maxlen_format,
+                 int maxlen_coordsys);
+
+    extern int  DFSDsetdims
+                (intn rank, int32 dimsizes[]);
+
+    extern int  DFSDsetdatastrs
+                (const char * label, const char * unit, const char * format, const char * coordsys);
+
+    extern int  DFSDsetdimstrs
+                (int dim, const char * label, const char * unit, const char * format);
+
+    extern int  DFSDsetdimscale
+                (intn dim, int32 dimsize, VOIDP scale);
+
+    extern int  DFSDsetrange
+                (VOIDP maxi, VOIDP mini);
+
+    extern int  DFSDputdata
+                (const char * filename, intn rank, int32 dimsizes[], VOIDP data);
+
+    extern int  DFSDadddata
+                (const char * filename, intn rank, int32 dimsizes[], VOIDP data);
+
+    extern int  DFSDrestart
+                (void);
+
+    extern int32 DFSDndatasets
+                (char * filename);
+
+    extern int  DFSDclear
+                (void);
+
+    extern uint16 DFSDlastref
+                (void);
+
+    extern int  DFSDreadref
+                (char * filename, uint16 ref);
+
+    extern int  DFSDgetslice
+                (const char * filename, int32 winst[], int32 windims[], VOIDP data,
+                 int32 dims[]);
+
+    extern int  DFSDstartslice
+                (const char * filename);
+
+    extern int  DFSDputslice
+                (int32 winend[], VOIDP data, int32 dims[]);
+
+    extern int  DFSDendslice
+                (void);
+
+    extern int  DFSDsetNT
+                (int32 numbertype);
+
+    extern int  DFSDsetorder
+                (int arrayorder);
+
+    extern int  DFSDgetNT
+                (int32 * pnumbertype);
+
+    extern intn DFSDpre32sdg
+                (char * filename, uint16 ref, intn * ispre32);
+
+    extern int  DFSDsetcal
+                (float64 cal, float64 cal_err, float64 ioff,
+                 float64 ioff_err, int32 cal_nt);
+
+    extern int  DFSDgetcal
+                (float64 * pcal, float64 * pcal_err, float64 * pioff,
+                 float64 * pioff_err, int32 * cal_nt);
+
+    extern int  DFSDwriteref
+                (const char * filename, uint16 ref);
+
+    extern int  DFSDsetfillvalue
+                (VOIDP fill_value);
+
+    extern int  DFSDgetfillvalue
+                (VOIDP fill_value);
+
+    extern int  DFSDstartslab
+                (const char * filename);
+
+    extern int  DFSDwriteslab
+                (int32 start[], int32 stride[], int32 count[],
+                 VOIDP data);
+
+    extern int  DFSDendslab
+                (void);
+
+    extern int  DFSDreadslab
+                (const char *filename, int32 start[], int32 slab_size[],
+             int32 stride[], VOIDP buffer, int32 buffer_size[]);
+
+    extern intn DFSDPshutdown(void);
+
+/*
+   ** from dfconv.c
+ */
+
+    extern int  DFKNTsize
+                (int32 number_type);
+
+    extern int32 DFKisnativeNT
+                (int32 numbertype);
+
+    extern int32 DFKislitendNT
+                (int32 numbertype);
+
+    extern int8 DFKgetPNSC
+                (int32 numbertype, int32 machinetype);
+
+    extern intn DFKsetNT
+                (int32 ntype);
+
+    extern int32 DFKconvert
+                (VOIDP source, VOIDP dest, int32 ntype, int32 num_elm,
+                 int16 acc_mode, int32 source_stride, int32 dest_stride);
+
+/*
+   ** from dfknat.c
+ */
+
+    extern intn DFKnb1b
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKnb2b
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKnb4b
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKnb8b
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/*
+   ** from dfkswap.c
+ */
+
+    extern intn DFKsb2b
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKsb4b
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKsb8b
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/*
+   ** from dfkcray.c
+ */
+
+    extern intn DFKui2i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKui2s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKuo2i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKuo2s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKui4i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKui4s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKuo4i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKuo4s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKui4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKuo4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKui8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKuo8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlui2i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlui2s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKluo2i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKluo2s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlui4i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlui4s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKluo4i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKluo4s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlui4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKluo4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlui8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKluo8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/* CRAY-MPP */
+    extern intn DFKmi2i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKmi2s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKmo2b
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlmi2i
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlmi2s
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlmo2b
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+
+/*
+   ** from dfkvms.c
+ */
+
+    extern intn DFKvi4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKvo4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKvi8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKvo8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlvi4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlvo4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlvi8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlvo8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/*
+   ** from dfkconv.c
+ */
+
+    extern intn DFKci4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKco4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKci8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKco8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlci4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlco4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlci8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlco8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/*
+   ** from dfkfuji.c
+ */
+
+    extern intn DFKpi4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKpo4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKpi8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKpo8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlpi4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlpo4f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlpi8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    extern intn DFKlpo8f
+                (VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/*
+   ** from dfanF.c
+ */
+#ifndef DFAN_FNAMES
+#   define  DFAN_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndaiganl  FNAME(DAIGANL)
+#   define ndaigann  FNAME(DAIGANN)
+#   define ndaipann  FNAME(DAIPANN)
+#   define ndailist  FNAME(DAILIST)
+#   define ndalref   FNAME(DALREF)
+#   define ndaclear  FNAME(DACLEAR)
+#   define ndfanlastref     FNAME(DFANLASTREF)
+
+#   define ndfanaddfds      FNAME(DFANADDFDS)
+#   define ndfangetfidlen   FNAME(DFANGETFIDLEN)
+#   define ndfangetfdslen   FNAME(DFANGETFDSLEN)
+#   define ndfangetfid      FNAME(DFANGETFID)
+#   define ndfangetfds      FNAME(DFANGETFDS)
+#   define ndaafds          FNAME(DAAFDS)
+#   define ndagfidl         FNAME(DAGFIDL)
+#   define ndagfdsl         FNAME(DAGFDSL)
+#   define ndagfid          FNAME(DAGFID)
+#   define ndagfds          FNAME(DAGFDS)
+#   define ndaiafid         FNAME(DAIAFID)
+#else                           /* DF_CAPFNAMES */
+#   define ndaiganl  FNAME(daiganl)
+#   define ndaigann  FNAME(daigann)
+#   define ndaipann  FNAME(daipann)
+#   define ndailist  FNAME(dailist)
+#   define ndalref   FNAME(dalref)
+#   define ndaclear  FNAME(daclear)
+#   define ndfanlastref     FNAME(dfanlastref)
+
+#   define ndfanaddfds      FNAME(dfanaddfds)
+#   define ndfangetfidlen   FNAME(dfangetfidlen)
+#   define ndfangetfdslen   FNAME(dfangetfdslen)
+#   define ndfangetfid      FNAME(dfangetfid)
+#   define ndfangetfds      FNAME(dfangetfds)
+#   define ndaafds          FNAME(daafds)
+#   define ndagfidl         FNAME(dagfidl)
+#   define ndagfdsl         FNAME(dagfdsl)
+#   define ndagfid          FNAME(dagfid)
+#   define ndagfds          FNAME(dagfds)
+#   define ndaiafid         FNAME(daiafid)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFAN_FNAMES */
+
+    extern      FRETVAL(intf) ndaiganl
+                (_fcd filename, intf * tag, intf * ref, intf * type,
+                 intf * fnlen);
+
+    extern      FRETVAL(intf) ndaigann
+                (_fcd filename, intf * tag, intf * ref, _fcd annotation,
+                 intf * maxlen, intf * type, intf * fnlen);
+
+    extern      FRETVAL(intf) ndaipann
+                (_fcd filename, intf * tag, intf * ref, _fcd annotation,
+                 intf * annlen, intf * type, intf * fnlen);
+
+    extern      FRETVAL(intf) ndailist
+                (_fcd filename, intf * tag, intf reflist[], _fcd labellist,
+          intf * listsize, intf * maxlen, intf * startpos,
+                 intf * fnlen);
+
+    extern      FRETVAL(intf) ndalref
+                (void);
+
+    extern      FRETVAL(intf) ndaclear
+                (void);
+
+    extern      FRETVAL(intf) ndfanlastref
+                (void);
+
+    extern      FRETVAL(intf) ndfanaddfds
+                (intf * dfile, _fcd desc, intf * desclen);
+
+    extern      FRETVAL(intf) ndfangetfidlen
+                (intf * dfile, intf * isfirst);
+
+    extern      FRETVAL(intf) ndfangetfdslen
+                (intf * dfile, intf * isfirst);
+
+    extern      FRETVAL(intf) ndfangetfid
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    extern      FRETVAL(intf) ndfangetfds
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    extern      FRETVAL(intf) ndaafds
+                (intf * dfile, _fcd desc, intf * desclen);
+
+    extern      FRETVAL(intf) ndagfidl
+                (intf * dfile, intf * isfirst);
+
+    extern      FRETVAL(intf) ndagfdsl
+                (intf * dfile, intf * isfirst);
+
+    extern      FRETVAL(intf) ndagfid
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    extern      FRETVAL(intf) ndagfds
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    extern      FRETVAL(intf) ndaiafid
+                (intf * dfile, _fcd id, intf * idlen);
+
+/*
+   ** from dfr8F.c
+ */
+#ifndef DFR8_FNAMES
+#   define DFR8_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nd8spal   FNAME(D8SPAL)
+#   define nd8first  FNAME(D8FIRST)
+#   define nd8igdim  FNAME(D8IGDIM)
+#   define nd8igimg  FNAME(D8IGIMG)
+#   define nd8ipimg  FNAME(D8IPIMG)
+#   define nd8iaimg  FNAME(D8IAIMG)
+#   define nd8irref  FNAME(D8IRREF)
+#   define nd8iwref  FNAME(D8IWREF)
+#   define nd8inims  FNAME(D8INIMS)
+#   define nd8lref   FNAME(D8LREF)
+#   define ndfr8lastref      FNAME(DFR8LASTREF)
+#   define ndfr8setpalette   FNAME(DFR8SETPALETTE)
+#   define ndfr8restart  FNAME(DFR8RESTART)
+#   define nd8scomp  FNAME(D8SCOMP)
+#   define ndfr8scompress FNAME(DFR8SCOMPRESS)
+#   define nd8sjpeg  FNAME(D8SJPEG)
+#   define ndfr8sjpeg FNAME(DFR8SJPEG)
+#else                           /* !DF_CAPFNAMES */
+#   define nd8spal   FNAME(d8spal)
+#   define nd8first  FNAME(d8first)
+#   define nd8igdim  FNAME(d8igdim)
+#   define nd8igimg  FNAME(d8igimg)
+#   define nd8ipimg  FNAME(d8ipimg)
+#   define nd8iaimg  FNAME(d8iaimg)
+#   define nd8irref  FNAME(d8irref)
+#   define nd8iwref  FNAME(d8iwref)
+#   define nd8inims  FNAME(d8inims)
+#   define nd8lref   FNAME(d8lref)
+#   define ndfr8lastref      FNAME(dfr8lastref)
+#   define ndfr8setpalette   FNAME(dfr8setpalette)
+#   define ndfr8restart  FNAME(dfr8restart)
+#   define nd8scomp  FNAME(d8scomp)
+#   define ndfr8scompress FNAME(dfr8scompress)
+#   define nd8sjpeg  FNAME(d8sjpeg)
+#   define ndfr8sjpeg FNAME(dfr8sjpeg)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFR8_FNAMES */
+
+    extern      FRETVAL(intf) nd8spal
+                (_fcd pal);
+
+    extern      FRETVAL(intf) nd8first
+                (void);
+
+    extern      FRETVAL(intf) nd8igdim
+                (_fcd filename, intf * xdim, intf * ydim, intf * ispal,
+                 intf * lenfn);
+
+    extern      FRETVAL(intf) nd8igimg
+                (_fcd filename, _fcd image, intf * xdim, intf * ydim,
+                 _fcd pal, intf * lenfn);
+
+    extern      FRETVAL(intf) nd8ipimg
+                (_fcd filename, _fcd image, intf * xdim, intf * ydim,
+                 intf * compress, intf * lenfn);
+
+    extern      FRETVAL(intf) nd8iaimg
+                (_fcd filename, _fcd image, intf * xdim, intf * ydim,
+                 intf * compress, intf * lenfn);
+
+    extern      FRETVAL(intf) nd8irref
+                (_fcd filename, intf * ref, intf * fnlen);
+
+    extern      FRETVAL(intf) nd8iwref
+                (_fcd filename, intf * ref, intf * fnlen);
+
+    extern      FRETVAL(intf) nd8inims
+                (_fcd filename, intf * fnlen);
+
+    extern      FRETVAL(intf) nd8lref
+                (void);
+
+    extern      FRETVAL(intf) ndfr8lastref
+                (void);
+
+    extern      FRETVAL(intf) ndfr8setpalette
+                (_fcd pal);
+
+    extern      FRETVAL(intf) ndfr8restart
+                (void);
+
+    extern      FRETVAL(intf) nd8scomp
+                (intf * scheme);
+
+    extern      FRETVAL(intf) ndfr8scompress
+                (intf * scheme);
+
+    extern      FRETVAL(intf) nd8sjpeg
+                (intf * quality, intf * force_baseline);
+
+    extern      FRETVAL(intf) ndfr8sjpeg
+                (intf * quality, intf * force_baseline);
+
+/*
+   ** from dfsdF.c
+ */
+#ifndef DFSD_FNAMES
+#   define DFSD_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndsgdast  FNAME(DSGDAST)
+#   define ndsgdisc  FNAME(DSGDISC)
+#   define ndsgrang  FNAME(DSGRANG)
+#   define ndssdims  FNAME(DSSDIMS)
+#   define ndssdisc  FNAME(DSSDISC)
+#   define ndssrang  FNAME(DSSRANG)
+#   define ndsclear  FNAME(DSCLEAR)
+#   define ndsslens  FNAME(DSSLENS)
+#   define ndsgdiln  FNAME(DSGDILN)
+#   define ndsgdaln  FNAME(DSGDALN)
+#   define ndsfirst  FNAME(DSFIRST)
+#   define ndspslc   FNAME(DSPSLC)
+#   define ndseslc   FNAME(DSESLC)
+#   define ndsgnt    FNAME(DSGNT)
+#   define ndssnt    FNAME(DSSNT)
+#   define ndsigdim  FNAME(DSIGDIM)
+#   define ndsigdat  FNAME(DSIGDAT)
+#   define ndsipdat  FNAME(DSIPDAT)
+#   define ndsiadat  FNAME(DSIADAT)
+#   define ndsigdas  FNAME(DSIGDAS)
+#   define ndsigslc  FNAME(DSIGSLC)
+#   define ndsigdis  FNAME(DSIGDIS)
+#   define ndsisslc  FNAME(DSISSLC)
+#   define ndsisdas  FNAME(DSISDAS)
+#   define ndsisdis  FNAME(DSISDIS)
+#   define ndsirref  FNAME(DSIRREF)
+#   define ndslref   FNAME(DSLREF)
+#   define ndsinum   FNAME(DSINUM)
+#   define ndsip32s  FNAME(DSIP32S)
+#   define ndsscal   FNAME(DSSCAL)
+#   define ndsgcal   FNAME(DSGCAL)
+#   define ndfsdgetdatastrs  FNAME(DFSDGETDATASTRS)
+#   define ndfsdgetdimscale  FNAME(DFSDGETDIMSCALE)
+#   define ndfsdgetrange     FNAME(DFSDGETRANGE)
+#   define ndfsdsetdims      FNAME(DFSDSETDIMS)
+#   define ndfsdsetdimscale  FNAME(DFSDSETDIMSCALE)
+#   define ndfsdsetrange     FNAME(DFSDSETRANGE)
+#   define ndfsdclear        FNAME(DFSDCLEAR)
+#   define ndfsdsetlengths   FNAME(DFSDSETLENGTHS)
+#   define ndfsdgetdimlen    FNAME(DFSDGETDIMLEN)
+#   define ndfsdgetdatalen   FNAME(DFSDGETDATALEN)
+#   define ndfsdrestart      FNAME(DFSDRESTART)
+#   define ndfsdputslice     FNAME(DFSDPUTSLICE)
+#   define ndfsdendslice     FNAME(DFSDENDSLICE)
+#   define ndfsdsetnt        FNAME(DFSDSETNT)
+#   define ndfsdgetnt        FNAME(DFSDGETNT)
+#   define ndfsdlastref      FNAME(DFSDLASTREF)
+#   define ndsiwref          FNAME(DSIWREF)
+#   define ndssfill          FNAME(DSSFILL)
+#   define ndsgfill          FNAME(DSGFILL)
+#   define ndsisslab         FNAME(DSISSLAB)
+#   define ndswslab          FNAME(DSWSLAB)
+#   define ndseslab          FNAME(DSESLAB)
+#   define ndsirslab         FNAME(DSIRSLAB)
+#else
+#   define ndsgdast  FNAME(dsgdast)
+#   define ndsgdisc  FNAME(dsgdisc)
+#   define ndsgrang  FNAME(dsgrang)
+#   define ndssdims  FNAME(dssdims)
+#   define ndssdisc  FNAME(dssdisc)
+#   define ndssrang  FNAME(dssrang)
+#   define ndsclear  FNAME(dsclear)
+#   define ndsslens  FNAME(dsslens)
+#   define ndsgdiln  FNAME(dsgdiln)
+#   define ndsgdaln  FNAME(dsgdaln)
+#   define ndsfirst  FNAME(dsfirst)
+#   define ndspslc   FNAME(dspslc)
+#   define ndseslc   FNAME(dseslc)
+#   define ndsgnt    FNAME(dsgnt)
+#   define ndssnt    FNAME(dssnt)
+#   define ndsigdim  FNAME(dsigdim)
+#   define ndsigdat  FNAME(dsigdat)
+#   define ndsipdat  FNAME(dsipdat)
+#   define ndsiadat  FNAME(dsiadat)
+#   define ndsigdas  FNAME(dsigdas)
+#   define ndsigslc  FNAME(dsigslc)
+#   define ndsigdis  FNAME(dsigdis)
+#   define ndsisslc  FNAME(dsisslc)
+#   define ndsisdas  FNAME(dsisdas)
+#   define ndsisdis  FNAME(dsisdis)
+#   define ndsirref  FNAME(dsirref)
+#   define ndslref   FNAME(dslref)
+#   define ndsinum   FNAME(dsinum)
+#   define ndsip32s  FNAME(dsip32s)
+#   define ndsscal   FNAME(dsscal)
+#   define ndsgcal   FNAME(dsgcal)
+#   define ndfsdgetdatastrs  FNAME(dfsdgetdatastrs)
+#   define ndfsdgetdimscale  FNAME(dfsdgetdimscale)
+#   define ndfsdgetrange     FNAME(dfsdgetrange)
+#   define ndfsdsetdims      FNAME(dfsdsetdims)
+#   define ndfsdsetdimscale  FNAME(dfsdsetdimscale)
+#   define ndfsdsetrange     FNAME(dfsdsetrange)
+#   define ndfsdclear        FNAME(dfsdclear)
+#   define ndfsdsetlengths   FNAME(dfsdsetlengths)
+#   define ndfsdgetdimlen    FNAME(dfsdgetdimlen)
+#   define ndfsdgetdatalen   FNAME(dfsdgetdatalen)
+#   define ndfsdrestart      FNAME(dfsdrestart)
+#   define ndfsdputslice     FNAME(dfsdputslice)
+#   define ndfsdendslice     FNAME(dfsdendslice)
+#   define ndfsdsetnt        FNAME(dfsdsetnt)
+#   define ndfsdgetnt        FNAME(dfsdgetnt)
+#   define ndfsdlastref      FNAME(dfsdlastref)
+#   define ndsiwref          FNAME(dsiwref)
+#   define ndssfill          FNAME(dssfill)
+#   define ndsgfill          FNAME(dsgfill)
+#   define ndsisslab         FNAME(dsisslab)
+#   define ndswslab          FNAME(dswslab)
+#   define ndseslab          FNAME(dseslab)
+#   define ndsirslab         FNAME(dsirslab)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFSD_FNAMES */
+
+    extern      FRETVAL(intf) ndsgdisc
+                (intf * dim, intf * maxsize, VOIDP scale);
+
+    extern      FRETVAL(intf) ndsgrang
+                (VOIDP pmax, VOIDP pmin);
+
+    extern      FRETVAL(intf) ndssdims
+                (intf * rank, intf dimsizes[]);
+
+    extern      FRETVAL(intf) ndssdisc
+                (intf * dim, intf * dimsize, VOIDP scale);
+
+    extern      FRETVAL(intf) ndssrang
+                (VOIDP max, VOIDP min);
+
+    extern      FRETVAL(intf) ndsclear
+                (void);
+
+    extern      FRETVAL(intf) ndsslens
+                (intf * maxlen_label, intf * maxlen_unit,
+                 intf * maxlen_format, intf * maxlen_coordsys);
+
+    extern      FRETVAL(intf) ndsgdiln
+                (intf * dim, intf * llabel, intf * lunit,
+                 intf * lformat);
+
+    extern      FRETVAL(intf) ndsgdaln
+                (intf * llabel, intf * lunit, intf * lformat,
+                 intf * lcoordsys);
+
+    extern      FRETVAL(intf) ndsfirst
+                (void);
+
+    extern      FRETVAL(intf) ndspslc
+                (intf windims[], VOIDP data, intf dims[]);
+
+    extern      FRETVAL(intf) ndseslc
+                (void);
+
+    extern      FRETVAL(intf) ndssnt
+                (intf * numbertype);
+
+    extern      FRETVAL(intf) ndsgnt
+                (intf * pnumbertype);
+
+    extern      FRETVAL(intf) ndsigdim
+                (_fcd filename, intf * prank, intf sizes[],
+                 intf * maxrank, intf * lenfn);
+
+    extern      FRETVAL(intf) ndsigdat
+                (_fcd filename, intf * rank, intf maxsizes[],
+                 VOIDP data, intf * fnlen);
+
+    extern      FRETVAL(intf) ndsipdat
+                (_fcd filename, intf * rank, intf dimsizes[],
+                 VOIDP data, intf * fnlen);
+
+    extern      FRETVAL(intf) ndsiadat
+                (_fcd filename, intf * rank, intf dimsizes[],
+                 VOIDP data, intf * fnlen);
+
+    extern      FRETVAL(intf) ndsigslc
+                (_fcd filename, intf winst[], intf windims[],
+                 VOIDP data, intf dims[], intf * fnlen);
+
+    extern      FRETVAL(intf) ndsisslc
+                (_fcd filename, intf * fnlen);
+
+    extern      FRETVAL(intf) ndsirref
+                (_fcd filename, intf * ref, intf * fnlen);
+
+    extern      FRETVAL(intf) ndslref
+                (void);
+
+    extern      FRETVAL(intf) ndsinum
+                (_fcd filename, intf * len);
+
+    extern      FRETVAL(intf) ndsip32s
+                (_fcd filename, intf * ref, intf * ispre32, intf * len);
+
+    extern      FRETVAL(intf) ndfsdgetdatastrs
+                (_fcd label, _fcd unit, _fcd format, _fcd coordsys);
+
+    extern      FRETVAL(intf) ndfsdgetdimstrs
+                (intf * dim, _fcd label, _fcd unit, _fcd format);
+
+    extern      FRETVAL(intf) ndfsdgetdimscale
+                (intf * dim, intf * maxsize, VOIDP scale);
+
+    extern      FRETVAL(intf) ndfsdgetrange
+                (VOIDP pmax, VOIDP pmin);
+
+    extern      FRETVAL(intf) ndfsdsetdims
+                (intf * rank, intf dimsizes[]);
+
+    extern      FRETVAL(intf) ndfsdsetdimscale
+                (intf * dim, intf * dimsize, VOIDP scale);
+
+    extern      FRETVAL(intf) ndfsdsetrange
+                (VOIDP max, VOIDP min);
+
+    extern      FRETVAL(intf) ndfsdclear
+                (void);
+
+    extern      FRETVAL(intf) ndfsdsetlengths
+                (intf * maxlen_label, intf * maxlen_unit,
+                 intf * maxlen_format, intf * maxlen_coordsys);
+
+    extern      FRETVAL(intf) ndfsdgetdimlen
+                (intf * dim, intf * llabel, intf * lunit,
+                 intf * lformat);
+
+    extern      FRETVAL(intf) ndfsdgetdatalen
+                (intf * llabel, intf * lunit, intf * lformat,
+                 intf * lcoordsys);
+
+    extern      FRETVAL(intf) ndfsdrestart
+                (void);
+
+    extern      FRETVAL(intf) ndfsdputslice
+                (intf windims[], VOIDP data, intf dims[]);
+
+    extern      FRETVAL(intf) ndfsdendslice
+                (void);
+
+    extern      FRETVAL(intf) ndfsdsetnt
+                (intf * numbertype);
+
+    extern      FRETVAL(intf) ndfsdgetnt
+                (intf * pnumbertype);
+
+    extern      FRETVAL(intf) ndfsdlastref
+                (void);
+
+    extern      FRETVAL(intf) ndsisdis
+                (intf * dim, _fcd flabel, _fcd funit, _fcd fformat,
+             intf * llabel, intf * lunit, intf * lformat);
+
+    extern      FRETVAL(intf) ndsigdis
+                (intf * dim, _fcd label, _fcd unit, _fcd format,
+             intf * llabel, intf * lunit, intf * lformat);
+
+    extern      FRETVAL(intf) ndsisdas
+                (_fcd flabel, _fcd funit, _fcd fformat, _fcd fcoordsys,
+            intf * isfortran, intf * llabel, intf * lunit,
+                 intf * lformat, intf * lcoordsys);
+
+    extern      FRETVAL(intf) ndsigdas
+                (_fcd label, _fcd unit, _fcd format, _fcd coordsys, intf * llabel,
+             intf * lunit, intf * lformat, intf * lcoord);
+
+    extern      FRETVAL(intf) ndsscal
+                (float64 * cal, float64 * cal_err, float64 * ioff,
+                 float64 * ioff_err, intf * cal_type);
+
+    extern      FRETVAL(intf) ndsgcal
+                (float64 * cal, float64 * cal_err, float64 * ioff,
+                 float64 * ioff_err, intf * cal_type);
+
+    extern      FRETVAL(intf) ndswref
+                (_fcd filename, intf * fnlen, intf * ref);
+
+    extern      FRETVAL(intf) ndssfill
+                (VOIDP fill_value);
+
+    extern      FRETVAL(intf) ndsgfill
+                (VOIDP fill_value);
+
+    extern      FRETVAL(intf) ndssslab
+                (_fcd filename, intf * fnlen);
+
+    extern      FRETVAL(intf) ndswslab
+                (intf start[], intf  stride[],
+                 intf  cont[], VOIDP data);
+
+    extern      FRETVAL(intf) ndseslab
+                (void);
+
+    extern	FRETVAL(intf) ndsiwref
+		(_fcd filename, intf * fnlen, intf * ref);
+
+    extern	FRETVAL(intf) ndsisslab
+		(_fcd filename, intf * fnlen);
+
+    extern	FRETVAL(intf) ndsirslab
+		(_fcd filename, intf * fnlen, intf start[], intf slab_size[],
+	         intf stride[], VOIDP buffer, intf buffer_size[]);
+
+/*
+   ** from dfpF.c
+ */
+
+#ifndef DFP_FNAMES
+#   define DFP_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndpigpal  FNAME(DPIGPAL)
+#   define ndpippal  FNAME(DPIPPAL)
+#   define ndpinpal  FNAME(DPINPAL)
+#   define ndpiwref  FNAME(DPIWREF)
+#   define ndpirref  FNAME(DPIRREF)
+#   define ndprest   FNAME(DPREST)
+#   define ndplref   FNAME(DPLREF)
+#   define ndfprestart   FNAME(DFPRESTART)
+#   define ndfplastref   FNAME(DFPLASTREF)
+#else                           /* !DF_CAPNAMES */
+#   define ndpigpal  FNAME(dpigpal)
+#   define ndpippal  FNAME(dpippal)
+#   define ndpinpal  FNAME(dpinpal)
+#   define ndpiwref  FNAME(dpiwref)
+#   define ndpirref  FNAME(dpirref)
+#   define ndprest   FNAME(dprest)
+#   define ndplref   FNAME(dplref)
+#   define ndfprestart   FNAME(dfprestart)
+#   define ndfplastref   FNAME(dfplastref)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFP_FNAMES */
+
+    extern      FRETVAL(intf) ndpigpal
+                (_fcd filename, _fcd pal, intf  * fnlen);
+
+    extern      FRETVAL(intf) ndpippal
+                (_fcd filename, _fcd pal, intf  * overwrite, _fcd filemode,
+                 intf  * fnlen);
+
+    extern      FRETVAL(intf) ndpinpal
+                (_fcd filename, intf  * fnlen);
+
+    extern      FRETVAL(intf) ndpirref
+                (_fcd filename, uint16  * ref, intf  * fnlen);
+
+    extern      FRETVAL(intf) ndpiwref
+                (_fcd filename, uint16  * ref, intf  * fnlen);
+
+    extern      FRETVAL(intf) ndprest
+                (void);
+
+    extern      FRETVAL(intf) ndplref
+                (void);
+
+    extern      FRETVAL(intf) ndfprestart
+                (void);
+
+    extern      FRETVAL(intf) ndfplastref
+                (void);
+
+/*
+   ** from df24F.c
+ */
+#ifndef DF24_FNAMES
+#   define DF24_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nd2reqil  FNAME(D2REQIL)
+#   define ndf24reqil    FNAME(DF24REQIL)
+#   define nd2sdims  FNAME(D2SDIMS)
+#   define ndf24setdims  FNAME(DF24SETDIMS)
+#   define nd2setil  FNAME(D2SETIL)
+#   define ndf24setil    FNAME(DF24SETIL)
+#   define nd2first  FNAME(D2FIRST)
+#   define ndf24restart  FNAME(DF24RESTART)
+#   define nd2igdim  FNAME(D2IGDIM)
+#   define nd2igimg  FNAME(D2IGIMG)
+#   define nd2iaimg  FNAME(D2IAIMG)
+#   define nd2irref  FNAME(D2IRREF)
+#   define nd2inimg  FNAME(D2INIMG)
+#   define nd2lref   FNAME(D2LREF)
+#   define nd2scomp  FNAME(D2SCOMP)
+#   define ndf24scompress FNAME(DF24SCOMPRESS)
+#   define nd2sjpeg  FNAME(D2SJPEG)
+#   define ndf24sjpeg FNAME(DF24SJPEG)
+#else
+#   define nd2reqil  FNAME(d2reqil)
+#   define ndf24reqil    FNAME(df24reqil)
+#   define nd2sdims  FNAME(d2sdims)
+#   define ndf24setdims  FNAME(df24setdims)
+#   define nd2setil  FNAME(d2setil)
+#   define ndf24setil    FNAME(df24setil)
+#   define nd2first  FNAME(d2first)
+#   define ndf24restart  FNAME(df24restart)
+#   define nd2igdim  FNAME(d2igdim)
+#   define nd2igimg  FNAME(d2igimg)
+#   define nd2iaimg  FNAME(d2iaimg)
+#   define nd2irref  FNAME(d2irref)
+#   define nd2inimg  FNAME(d2inimg)
+#   define nd2lref   FNAME(d2lref)
+#   define nd2scomp  FNAME(d2scomp)
+#   define ndf24scompress FNAME(df24scompress)
+#   define nd2sjpeg  FNAME(d2sjpeg)
+#   define ndf24sjpeg FNAME(df24sjpeg)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DF24_FNAMES */
+
+    extern      FRETVAL(intf) nd2reqil
+                (intf  * il);
+
+    extern      FRETVAL(intf) nd2sdims
+                (intf  * xdim, intf  * ydim);
+
+    extern      FRETVAL(intf) nd2igdim
+                (_fcd filename, intf  * pxdim, intf  * pydim, intf  * pil,
+                 intf  * fnlen);
+
+    extern      FRETVAL(intf) nd2igimg
+                (_fcd filename, _fcd image, intf  * xdim, intf  * ydim,
+                 intf  * fnlen);
+
+    extern      FRETVAL(intf) nd2iaimg
+                (_fcd filename, _fcd image, intf  * xdim, intf  * ydim,
+                 intf  * fnlen, intf  * newfile);
+
+    extern      FRETVAL(intf) nd2setil
+                (intf  * il);
+
+    extern      FRETVAL(intf) nd2first
+                (void);
+
+    extern      FRETVAL(intf) ndf24reqil
+                (intf  * il);
+
+    extern      FRETVAL(intf) ndf24setdims
+                (intf  * xdim, intf  * ydim);
+
+    extern      FRETVAL(intf) ndf24setil
+                (intf  * il);
+
+    extern      FRETVAL(intf) ndf24restart
+                (void);
+
+    extern      FRETVAL(intf) nd2irref
+                (_fcd filename, intf  * ref, intf  * fnlen);
+
+    extern      FRETVAL(intf) nd2inimg
+                (_fcd filename, intf  * fnlen);
+
+    extern      FRETVAL(intf) nd2lref
+                (void);
+
+    extern      FRETVAL(intf) nd2scomp
+                (intf * scheme);
+
+    extern      FRETVAL(intf) ndf24scompress
+                (intf * scheme);
+
+    extern      FRETVAL(intf) nd2sjpeg
+                (intf * quality, intf * force_baseline);
+
+    extern      FRETVAL(intf) ndf24sjpeg
+                (intf * quality, intf * force_baseline);
+
+/*
+   ** from dfF.c
+ */
+#ifndef DF_FNAMES
+#   define DF_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndfiaccess FNAME(DFIACCESS)
+#   define ndfiopen  FNAME(DFIOPEN)
+#   define ndfclose  FNAME(DFCLOSE)
+#   define ndfdesc   FNAME(DFDESC)
+#   define ndfdup    FNAME(DFDUP)
+#   define ndfdel    FNAME(DFDEL)
+#   define ndfstart  FNAME(DFSTART)
+#   define ndfread   FNAME(DFREAD)
+#   define ndfseek   FNAME(DFSEEK)
+#   define ndfwrite  FNAME(DFWRITE)
+#   define ndfupdate FNAME(DFUPDATE)
+#   define ndfget    FNAME(DFGET)
+#   define ndfput    FNAME(DFPUT)
+#   define ndfsfind  FNAME(DFSFIND)
+#   define ndffind   FNAME(DFFIND)
+#   define ndferrno  FNAME(DFERRNO)
+#   define ndfnewref FNAME(DFNEWREF)
+#   define ndfnumber FNAME(DFNUMBER)
+#   define ndfstat   FNAME(DFSTAT)
+#   define ndfiishdf FNAME(DFIISHDF)
+#else                           /* !DF_CAPFNAMES */
+#   define ndfiaccess FNAME(dfiaccess)
+#   define ndfiopen  FNAME(dfiopen)
+#   define ndfclose  FNAME(dfclose)
+#   define ndfdesc   FNAME(dfdesc)
+#   define ndfdup    FNAME(dfdup)
+#   define ndfdel    FNAME(dfdel)
+#   define ndfstart  FNAME(dfstart)
+#   define ndfread   FNAME(dfread)
+#   define ndfseek   FNAME(dfseek)
+#   define ndfwrite  FNAME(dfwrite)
+#   define ndfupdate FNAME(dfupdate)
+#   define ndfget    FNAME(dfget)
+#   define ndfput    FNAME(dfput)
+#   define ndfsfind  FNAME(dfsfind)
+#   define ndffind   FNAME(dffind)
+#   define ndferrno  FNAME(dferrno)
+#   define ndfnewref FNAME(dfnewref)
+#   define ndfnumber FNAME(dfnumber)
+#   define ndfstat   FNAME(dfstat)
+#   define ndfiishdf FNAME(dfiishdf)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DF_FNAMES */
+
+    extern      FRETVAL(intf) ndfiopen
+                (_fcd name, intf  * acc_mode, intf  * defdds, intf  * namelen);
+
+    extern      FRETVAL(intf) ndfclose
+                (intf  * dfile);
+
+    extern      FRETVAL(intf) ndfdesc
+                (intf  * dfile, intf  ptr[][4], intf  * begin,
+                 intf  * num);
+
+    extern      FRETVAL(intf) ndfdup
+                (intf  * dfile, intf  * tag, intf  * ref, intf  * otag,
+                 intf  * oref);
+
+    extern      FRETVAL(intf) ndfdel
+                (intf  * dfile, intf  * tag, intf  * ref);
+
+    extern      FRETVAL(intf) ndfiaccess
+                (intf  * dfile, intf  * tag, intf  * ref, _fcd acc_mode, intf  * acclen);
+
+    extern      FRETVAL(intf) ndfstart
+                (intf  * dfile, intf  * tag, intf  * ref, char  * acc_mode);
+
+    extern      FRETVAL(intf) ndfread
+                (intf  * dfile, _fcd ptr, intf  * len);
+
+    extern      FRETVAL(intf) ndfseek
+                (intf  * dfile, intf  * offset);
+
+    extern      FRETVAL(intf) ndfwrite
+                (intf  * dfile, _fcd ptr, intf  * len);
+
+    extern      FRETVAL(intf) ndfupdate
+                (intf  * dfile);
+
+    extern      FRETVAL(intf) ndfget
+                (intf  * dfile, intf  * tag, intf  * ref, _fcd ptr);
+
+    extern      FRETVAL(intf) ndfput
+                (intf  * dfile, intf  * tag, intf  * ref, _fcd ptr, intf  * len);
+
+    extern      FRETVAL(intf) ndfsfind
+                (intf  * dfile, intf  * tag, intf  * ref);
+
+    extern      FRETVAL(intf) ndffind
+                (intf  * dfile, intf  * itag, intf  * iref, intf  * len);
+
+    extern      FRETVAL(intf) ndferrno
+                (void);
+
+    extern      FRETVAL(intf) ndfnewref
+                (intf  * dfile);
+
+    extern      FRETVAL(intf) ndfnumber
+                (intf  * dfile, intf  * tag);
+
+    extern      FRETVAL(intf) ndfiishdf
+                (_fcd name, intf  * namelen);
+
+/*
+   ** from dfutil.c
+ */
+    extern uint16 DFfindnextref
+                (int32 file_id, uint16 tag, uint16 lref);
+
+/*
+   ** from dfutilF.c
+ */
+#ifndef DFUTIL_FNAMES
+#   define DFUTIL_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndfindnr          FNAME(DFINDNR)
+#   define ndffindnextref    FNAME(DFFINDNEXTREF)
+#else
+#   define ndfindnr          FNAME(dfindnr)
+#   define ndffindnextref    FNAME(dffindnextref)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFUTIL_FNAMES */
+
+    extern      FRETVAL(intf) ndfindnr
+                (intf  * dfile, intf  * tag, intf  * lref);
+
+    extern      FRETVAL(intf) ndffindnextref
+                (intf  * dfile, intf  * tag, intf  * lref);
+
+/*
+   ** from herrF.c
+ */
+#ifndef HERR_FNAMES
+#   define HERR_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nheprnt   FNAME(HEPRNT)
+#else
+#   define nheprnt   FNAME(heprnt)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* HERR_FNAMES */
+
+    extern      FRETVAL(VOID) nheprnt
+                (intf  * print_levels);
+
+/*
+   ** from hfileF.c
+ */
+#ifndef HFILE_FNAMES
+#   define HFILE_FNAMES
+#ifdef DF_CAPFNAMES
+#  if !(defined INTEL86) && !(defined WIN32)
+#   define nhiopen   FNAME(HIOPEN)
+#   define nhclose   FNAME(HCLOSE)
+#   define nhnumber  FNAME(HNUMBER)
+#   define nhxisdir  FNAME(HXISDIR)
+#   define nhxiscdir FNAME(HXISCDIR)
+#  else
+#   define nhiopen   FNAME(HIOPEN)
+#   define nhiclose   FNAME(HICLOSE)
+#   define nhinumbr  FNAME(HINUMBR)
+#   define nhxisdir  FNAME(HXISDIR)
+#   define nhxiscdir FNAME(HXISCDIR)
+#  endif
+#else
+#  if !(defined INTEL86) && !(defined WIN32)
+#   define nhiopen   FNAME(hiopen)
+#   define nhclose   FNAME(hclose)
+#   define nhnumber  FNAME(hnumber)
+#   define nhxisdir  FNAME(hxisdir)
+#   define nhxiscdir FNAME(hxiscdir)
+#  else
+#   define nhiopen   FNAME(hiopen)
+#   define nhiclose   FNAME(hiclose)
+#   define nhinumbr  FNAME(hinumbr)
+#   define nhxisdir  FNAME(hxisdir)
+#   define nhxiscdir FNAME(hxiscdir)
+#  endif
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* HFILE_FNAMES */
+
+    extern      FRETVAL(intf) nhiopen
+                (_fcd name, intf  * acc_mode, intf  * defdds, intf  * namelen);
+
+    extern      FRETVAL(intf) nhclose
+                (intf  * file_id);
+
+    extern      FRETVAL(intf) nhiclose
+                (intf  * file_id);
+
+    extern	FRETVAL(intf) nhnumber
+		(int32 file_id, uint16 tag);
+
+    extern	FRETVAL(intf) nhinumbr
+		(int32 file_id, uint16 tag);
+
+    extern	FRETVAL(intf) nhxisdir
+		(_fcd dir, intf * dirlen);
+
+    extern	FRETVAL(intf) nhxiscdir
+		(_fcd dir, intf * dirlen);
+    
+/*
+   ** from dfufp2im.c
+ */
+#ifndef DFUFP2I_FNAMES
+#   define DFUFP2I_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nduif2i       FNAME(DUIF2I)
+#else
+#   define nduif2i       FNAME(duif2i)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFUFP2I_FNAMES */
+
+    extern      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);
+
+    extern 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 */
+#ifndef MFAN_FNAMES
+#   define  MFAN_FNAMES
+#ifdef DF_CAPFNAMES
+# if !(defined INTEL86) && !(defined WIN32)
+#  define nafstart      FNAME(AFSTART)
+#  define naffileinfo   FNAME(AFFILEINFO)
+#  define nafend        FNAME(AFEND)
+#  define nafcreate     FNAME(AFCREATE)
+#  define naffcreate    FNAME(AFFCREATE)
+#  define nafselect     FNAME(AFSELECT)
+#  define nafnumann     FNAME(AFNUMANN)
+#  define nafannlist    FNAME(AFANNLIST)
+#  define nafannlen     FNAME(AFANNLEN)
+#  define nafwriteann   FNAME(AFWRITEANN)
+#  define nafreadann    FNAME(AFREADANN)
+#  define nafendaccess  FNAME(AFENDACCESS)
+#  define nafgettagref  FNAME(AFGETTAGREF)
+#  define nafidtagref   FNAME(AFIDTAGREF)
+#  define naftagrefid   FNAME(AFTAGREFID)
+#  define nafatypetag   FNAME(AFATYPETAG)
+#  define naftagatype   FNAME(AFTAGATYPE)
+# else
+#  define nafistart     FNAME(AFISTART)
+#  define nafifinf      FNAME(AFIFINF)
+#  define nafiend       FNAME(AFIEND)
+#  define naficreat     FNAME(AFICREAT)
+#  define nafifcreat    FNAME(AFIFCREAT)
+#  define nafiselct     FNAME(AFISELCT)
+#  define nafinann      FNAME(AFINANN)
+#  define nafialst      FNAME(AFIALST)
+#  define nafialen      FNAME(AFIALEN)
+#  define nafiwann      FNAME(AFIWANN)
+#  define nafirann      FNAME(AFIRANN)
+#  define nafiendac     FNAME(AFIENDAC)
+#  define nafigtr       FNAME(AFIGTR)
+#  define nafiid2tr     FNAME(AFIID2TR)
+#  define nafitr2id     FNAME(AFITR2ID)
+#  define nafitp2tg     FNAME(AFITP2TG)
+#  define nafitg2tp     FNAME(AFITG2TP)
+# endif
+#else  /* !DF_CAPFNAMES */
+# if !(defined INTEL86) && !(defined WIN32)
+#  define nafstart      FNAME(afstart)
+#  define naffileinfo   FNAME(affileinfo)
+#  define nafend        FNAME(afend)
+#  define nafcreate     FNAME(afcreate)
+#  define naffcreate    FNAME(affcreate)
+#  define nafselect     FNAME(afselect)
+#  define nafnumann     FNAME(afnumann)
+#  define nafannlist    FNAME(afannlist)
+#  define nafannlen     FNAME(afannlen)
+#  define nafwriteann   FNAME(afwriteann)
+#  define nafreadann    FNAME(afreadann)
+#  define nafendaccess  FNAME(afendaccess)
+#  define nafgettagref  FNAME(afgettagref)
+#  define nafidtagref   FNAME(afidtagref)
+#  define naftagrefid   FNAME(aftagrefid)
+#  define nafatypetag   FNAME(afatypetag)
+#  define naftagatype   FNAME(aftagatype)
+# else
+#  define nafistart     FNAME(afistart)
+#  define nafifinf      FNAME(afifinf)
+#  define nafiend       FNAME(afiend)
+#  define naficreat     FNAME(aficreat)
+#  define nafifcreat    FNAME(afifcreat)
+#  define nafiselct     FNAME(afiselct)
+#  define nafinann      FNAME(afinamm)
+#  define nafialst      FNAME(afialst)
+#  define nafialen      FNAME(afialen)
+#  define nafiwann      FNAME(afiwann)
+#  define nafirann      FNAME(afirann)
+#  define nafiendac     FNAME(afiendac)
+#  define nafigtr       FNAME(afigtr)
+#  define nafiid2tr     FNAME(afiid2tr)
+#  define nafitr2id     FNAME(afitr2id)
+#  define nafitp2tg     FNAME(afitp2tg)
+#  define nafitg2tp     FNAME(afitg2tp)
+# endif
+#endif /* DF_CAPFNAMES */
+#endif /* MFAN_FNAMES */
+
+/* Multi-file Annotation C-stubs for fortan interface found in mfanf.c */
+
+extern FRETVAL(intf)
+nafistart(intf *file_id);
+
+extern FRETVAL(intf)
+nafifinf(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel,
+            intf *num_odesc);
+
+extern FRETVAL(intf)
+nafiend(intf *an_id);
+
+extern FRETVAL(intf)
+naficreat(intf *an_id, intf *etag, intf *eref, intf *atype);
+
+extern FRETVAL(intf)
+nafifcreat(intf *an_id, intf *atype);
+
+extern FRETVAL(intf)
+nafiselct(intf *an_id, intf *index, intf *atype);
+
+extern FRETVAL(intf)
+nafinann(intf *an_id, intf *atype, intf *etag, intf *eref);
+
+extern FRETVAL(intf)
+nafialst(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]);
+
+extern FRETVAL(intf)
+nafialen(intf *ann_id);
+
+extern FRETVAL(intf)
+nafiwann(intf *ann_id,_fcd ann, intf *annlen);
+
+extern FRETVAL(intf)
+nafirann(intf *ann_id,_fcd ann, intf *maxlen);
+
+extern FRETVAL(intf)
+nafiendac(intf *ann_id);
+
+extern FRETVAL(intf)
+nafigtr(intf *an_id, intf *index, intf *type, intf *tag, intf *ref);
+
+extern FRETVAL(intf)
+nafiid2tr(intf *ann_id, intf *tag, intf *ref);
+
+extern FRETVAL(intf)
+nafitr2id(intf *an_id, intf *tag, intf *ref);
+
+extern FRETVAL(intf)
+nafitp2tg(intf *atype);
+
+extern FRETVAL(intf)
+nafitg2tp(intf *tag);
+
+/* Multi-file Annotation C-routines found in mfan.c */
+extern int32 ANstart(int32 file_id);
+
+extern intn  ANfileinfo(int32 an_id, int32 *n_file_label, int32 *n_file_desc,
+                        int32 *n_obj_label, int32 *n_obj_desc);
+
+extern int32 ANend(int32 an_id);
+
+extern int32 ANcreate(int32 an_id, uint16 elem_tag, uint16 elem_ref, 
+                      ann_type type);
+
+extern int32 ANcreatef(int32 an_id, ann_type type);
+
+extern int32 ANselect(int32 an_id, int32 index, ann_type type);
+
+extern intn  ANnumann(int32 an_id, ann_type type, uint16 elem_tag, 
+                      uint16 elem_ref);
+
+extern intn  ANannlist(int32 an_id, ann_type type, uint16 elem_tag, 
+                       uint16 elem_ref, int32 ann_list[]);
+
+extern int32 ANannlen(int32 ann_id);
+
+extern int32 ANwriteann(int32 ann_id, const char *ann, int32 annlen);
+
+extern int32 ANreadann(int32 ann_id, char *ann, int32 maxlen);
+
+extern intn  ANendaccess(int32 ann_id);
+
+extern int32 ANget_tagref(int32 an_id, int32 index, ann_type type,
+                          uint16 *ann_tag, uint16 *ann_ref);
+
+extern int32 ANid2tagref(int32 an_id, uint16 *ann_tag, uint16 *ann_ref);
+
+extern int32 ANtagref2id(int32 an_id, uint16 ann_tag, uint16 ann_ref);
+
+extern uint16 ANatype2tag(ann_type atype);
+
+extern ann_type ANtag2atype(uint16 atag);
+
+extern intn ANdestroy(void);
+
+/* for Multi-file fortran GR interface */
+#ifndef MFGR_FNAMES
+#   define  MFGR_FNAMES
+#ifdef DF_CAPFNAMES
+# if !(defined INTEL86) && !(defined WIN32)
+#  define nmgstart      FNAME(MGSTART)
+#  define nmgfinfo      FNAME(MGFINFO)
+#  define nmgend        FNAME(MGEND)
+#  define nmgicreat     FNAME(MGICREAT)
+#  define nmgselct      FNAME(MGSELCT)
+#  define nmgin2ndx     FNAME(MGIN2NDX)
+#  define nmggiinf      FNAME(MGGIINF)
+#  define nmgwcimg      FNAME(MGWCIMG)
+#  define nmgrcimg      FNAME(MGRCIMG)
+#  define nmgwrimg      FNAME(MGWRIMG)
+#  define nmgrdimg      FNAME(MGRDIMG)
+#  define nmgendac      FNAME(MGENDAC)
+#  define nmgid2rf      FNAME(MGID2RF)
+#  define nmgr2idx      FNAME(MGR2IDX)
+#  define nmgrltil      FNAME(MGRLTIL)
+#  define nmgrimil      FNAME(MGRIMIL)
+#  define nmggltid      FNAME(MGGLTID)
+#  define nmgglinf      FNAME(MGGLINF)
+#  define nmgwrlut      FNAME(MGWRLUT)
+#  define nmgwclut      FNAME(MGWCLUT)
+#  define nmgrdlut      FNAME(MGRDLUT)
+#  define nmgrclut      FNAME(MGRCLUT)
+#  define nmgisxfil     FNAME(MGISXFIL)
+#  define nmgssctp      FNAME(MGSACTP)
+#  define nmgiscatt     FNAME(MGISCATT)
+#  define nmgisattr     FNAME(MGISATTR)
+#  define nmgatinf      FNAME(MGATINF)
+#  define nmggcatt      FNAME(MGGCATT)
+#  define nmggnatt      FNAME(MGGNATT)
+#  define nmggattr      FNAME(MGGATTR)
+#  define nmgifndat     FNAME(MGIFNDAT)
+# else
+#  define nmgistrt      FNAME(MGISTRT)
+#  define nmgifinf      FNAME(MGIFINF)
+#  define nmgiend       FNAME(MGIEND)
+#  define nmgicreat     FNAME(MGICREAT)
+#  define nmgislct      FNAME(MGISLCT)
+#  define nmgin2ndx     FNAME(MGIN2NDX)
+#  define nmgigiinf     FNAME(MGIGIINF)
+#  define nmgiwcim      FNAME(MGIWCIM)
+#  define nmgircim      FNAME(MGIRCIM)
+#  define nmgiwimg      FNAME(MGIWIMG)
+#  define nmgirimg      FNAME(MGIRIMG)
+#  define nmgiendac     FNAME(MGIENDAC)
+#  define nmgiid2r      FNAME(MGIID2R)
+#  define nmgir2dx      FNAME(MGIR2DX)
+#  define nmgiltil      FNAME(MGILTIL)
+#  define nmgiimil      FNAME(MGIIMIL)
+#  define nmgiglid      FNAME(MGIGLID)
+#  define nmgiglinf     FNAME(MGIGLINF)
+#  define nmgiwrlt      FNAME(MGIWRLT)
+#  define nmgiwclt      FNAME(MGIWCLT)
+#  define nmgirdlt      FNAME(MGIRDLT)
+#  define nmgirclt      FNAME(MGIRCLT)
+#  define nmgisxfil     FNAME(MGISXFIL)
+#  define nmgiactp      FNAME(MGIACTP)
+#  define nmgiscatt     FNAME(MGISCATT)
+#  define nmgisattr     FNAME(MGISATTR)
+#  define nmgiainf      FNAME(MGIAINF)
+#  define nmgigcat      FNAME(MGIGCAT)
+#  define nmgignat      FNAME(MGIGNAT)
+#  define nmgigatt      FNAME(MGIGATT)
+#  define nmgifndat     FNAME(MGIFNDAT)
+# endif
+#else  /* !DF_CAPFNAMES */
+# if !(defined INTEL86) && !(defined WIN32)
+#  define nmgstart      FNAME(mgstart)
+#  define nmgfinfo      FNAME(mgfinfo)
+#  define nmgend        FNAME(mgend)
+#  define nmgicreat     FNAME(mgicreat)
+#  define nmgselct      FNAME(mgselct)
+#  define nmgin2ndx     FNAME(mgin2ndx)
+#  define nmggiinf      FNAME(mggiinf)
+#  define nmgwcimg      FNAME(mgwcimg)
+#  define nmgrcimg      FNAME(mgrcimg)
+#  define nmgwrimg      FNAME(mgwrimg)
+#  define nmgrdimg      FNAME(mgrdimg)
+#  define nmgendac      FNAME(mgendac)
+#  define nmgid2rf      FNAME(mgid2rf)
+#  define nmgr2idx      FNAME(mgr2idx)
+#  define nmgrltil      FNAME(mgrltil)
+#  define nmgrimil      FNAME(mgrimil)
+#  define nmggltid      FNAME(mggltid)
+#  define nmgglinf      FNAME(mgglinf)
+#  define nmgwrlut      FNAME(mgwrlut)
+#  define nmgwclut      FNAME(mgwclut)
+#  define nmgrdlut      FNAME(mgrdlut)
+#  define nmgrclut      FNAME(mgrclut)
+#  define nmgisxfil     FNAME(mgisxfil)
+#  define nmgssctp      FNAME(mgsactp)
+#  define nmgiscatt     FNAME(mgiscatt)
+#  define nmgisattr     FNAME(mgisattr)
+#  define nmgatinf      FNAME(mgatinf)
+#  define nmggcatt      FNAME(mggcatt)
+#  define nmggnatt      FNAME(mggnatt)
+#  define nmggattr      FNAME(mggattr)
+#  define nmgifndat     FNAME(mgifndat)
+# else
+#  define nmgistrt      FNAME(mgistrt)
+#  define nmgifinf      FNAME(mgifinf)
+#  define nmgiend        FNAME(mgiend)
+#  define nmgicreat     FNAME(mgicreat)
+#  define nmgislct      FNAME(mgislct)
+#  define nmgin2ndx     FNAME(mgin2ndx)
+#  define nmgigiinf      FNAME(mgigiinf)
+#  define nmgiwcim      FNAME(mgiwcim)
+#  define nmgircim      FNAME(mgircim)
+#  define nmgwimg      FNAME(mgiwimg)
+#  define nmgrimg      FNAME(mgirimg)
+#  define nmgiendac      FNAME(mgiendac)
+#  define nmgiid2r      FNAME(mgiid2r)
+#  define nmgir2dx      FNAME(mgir2dx)
+#  define nmgiltil      FNAME(mgiltil)
+#  define nmgiimil      FNAME(mgiimil)
+#  define nmgiglid      FNAME(mgiglid)
+#  define nmgiglinf     FNAME(mgiglinf)
+#  define nmgiwrlt      FNAME(mgiwrlt)
+#  define nmgiwclt      FNAME(mgiwclt)
+#  define nmgirdlt      FNAME(mgirdlt)
+#  define nmgirclt      FNAME(mgirclt)
+#  define nmgisxfil     FNAME(mgisxfil)
+#  define nmgiactp      FNAME(mgiactp)
+#  define nmgiscatt     FNAME(mgiscatt)
+#  define nmgisattr     FNAME(mgisattr)
+#  define nmgiainf      FNAME(mgiainf)
+#  define nmgigcat      FNAME(mgigcat)
+#  define nmgignat      FNAME(mgignat)
+#  define nmgigatt      FNAME(mgigatt)
+#  define nmgifndat     FNAME(mgifndat)
+# endif
+#endif /* DF_CAPFNAMES */
+#endif /* MFGR_FNAMES */
+
+/* Multi-file GR C-stubs for FORTRAN interface found in mfgrf.c */
+
+extern FRETVAL(intf)
+nmgistrt(intf * fid);
+
+extern FRETVAL(intf)
+nmgifinf(intf * grid,intf *n_datasets,intf *n_attrs);
+
+extern FRETVAL(intf)
+nmgiend(intf * grid);
+
+extern FRETVAL(intf)
+nmgicreat(intf * grid, _fcd name, intf *ncomp, intf *nt, intf *il, intf dimsizes[2], intf *nlen);
+
+extern FRETVAL(intf)
+nmgislct(intf * grid, intf *index);
+
+extern FRETVAL(intf)
+nmgin2ndx(intf * grid, _fcd name, intf *nlen);
+
+extern FRETVAL(intf)
+nmgigiinf(intf * riid, _fcd name, intf *ncomp, intf *nt, intf *il, intf *dimsizes, intf *nattr);
+
+
+extern FRETVAL(intf)
+nmgiwcim(intf * riid, intf *start, intf *stride, intf *count, _fcd data);
+
+extern FRETVAL(intf)
+nmgircim(intf * riid, intf *start, intf *stride, intf *count, _fcd data);
+
+extern FRETVAL(intf)
+nmgiwimg(intf * riid, intf *start, intf *stride, intf *count, VOIDP data);
+
+extern FRETVAL(intf)
+nmgirimg(intf * riid, intf *start, intf *stride, intf *count, VOIDP data);
+
+extern FRETVAL(intf)
+nmgiendac(intf * riid);
+
+extern FRETVAL(intf)
+nmgiid2r(intf * riid);
+
+extern FRETVAL(intf)
+nmgir2dx(intf * grid, intf *ref);
+
+extern FRETVAL(intf)
+nmgiltil(intf * riid, intf *il);
+
+extern FRETVAL(intf)
+nmgiimil(intf * riid, intf *il);
+
+extern FRETVAL(intf)
+nmgiglid(intf * riid, intf *lut_index);
+
+extern FRETVAL(intf)
+nmgiglinf(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries);
+
+extern FRETVAL(intf)
+nmgiwrlt(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, VOIDP data);
+
+extern FRETVAL(intf)
+nmgiwclt(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, _fcd data);
+
+extern FRETVAL(intf)
+nmgirdlt(intf * lutid, VOIDP data);
+
+extern FRETVAL(intf)
+nmgirclt(intf * lutid, _fcd data);
+
+extern FRETVAL(intf)
+nmgisxfil(intf * riid, _fcd filename, intf *offset, intf *nlen);
+
+extern FRETVAL(intf)
+nmgiactp(intf * riid, intf *accesstype);
+
+extern FRETVAL(intf)
+nmgiscatt(intf * riid, _fcd name, intf *nt, intf *count, _fcd data, intf *nlen);
+
+extern FRETVAL(intf)
+nmgisattr(intf * riid, _fcd name, intf *nt, intf *count, VOIDP data, intf *nlen);
+
+extern FRETVAL(intf)
+nmgiainf(intf * riid, intf *index, _fcd name, intf *nt, intf *count);
+
+extern FRETVAL(intf)
+nmgigcat(intf * riid, intf *index, _fcd data);
+
+extern FRETVAL(intf)
+nmgignat(intf * riid, intf *index, VOIDP data);
+
+extern FRETVAL(intf)
+nmgigatt(intf * riid, intf *index, VOIDP data);
+
+extern FRETVAL(intf)
+nmgifndat(intf * riid, _fcd name, intf *nlen);
+
+/* Multi-file Raster C-routines found in mfgr.c */
+extern intn rigcompare(VOIDP k1, VOIDP k2, intn cmparg);
+
+extern int32 GRstart(int32 hdf_file_id);
+
+extern intn GRfileinfo(int32 grid,int32 *n_datasets,int32 *n_attrs);
+
+extern intn GRend(int32 grid);
+
+extern int32 GRcreate(int32 grid,const char *name,int32 ncomp,int32 nt,int32 il,
+    int32 dimsizes[2]);
+
+extern int32 GRselect(int32 grid,int32 index);
+
+extern int32 GRnametoindex(int32 grid,const char *name);
+
+extern intn GRgetiminfo(int32 riid,char *name,int32 *ncomp,int32 *nt,int32 *il,
+    int32 dimsizes[2],int32 *n_attr);
+
+extern intn GRwriteimage(int32 riid,int32 start[2],int32 stride[2],
+    int32 count[2],VOIDP data);
+
+extern intn GRreadimage(int32 riid,int32 start[2],int32 stride[2],
+    int32 count[2],VOIDP data);
+
+extern intn GRendaccess(int32 riid);
+
+extern uint16 GRidtoref(int32 riid);
+
+extern int32 GRreftoindex(int32 grid,uint16 ref);
+
+extern intn GRreqlutil(int32 riid,intn il);
+
+extern intn GRreqimageil(int32 riid,intn il);
+
+extern int32 GRgetlutid(int32 riid,int32 index);
+
+extern uint16 GRluttoref(int32 lutid);
+
+extern intn GRgetlutinfo(int32 riid,int32 *ncomp,int32 *nt,
+    int32 *il,int32 *nentries);
+
+extern intn GRwritelut(int32 riid,int32 ncomps,int32 nt,
+    int32 il,int32 nentries,VOIDP data);
+
+extern intn GRreadlut(int32 lutid,VOIDP data);
+
+extern intn GRsetexternalfile(int32 riid,const char *filename,int32 offset);
+
+extern intn GRsetaccesstype(int32 riid,uintn accesstype);
+
+extern intn GRsetcompress(int32 riid,int32 comp_type,comp_info *cinfo);
+
+extern intn GRsetattr(int32 id,const char *name,int32 attr_nt,int32 count,const VOIDP data);
+
+extern intn GRattrinfo(int32 id,int32 index,char *name,int32 *attr_nt,int32 *count);
+
+extern intn GRgetattr(int32 id,int32 index,VOIDP data);
+
+extern int32 GRfindattr(int32 id,const char *name);
+
+extern intn GRPshutdown(void);
+
+/* For Pablo wrapper functions */
+
+#if defined HAVE_PABLO || defined PABLO
+extern int HDFinitIOTrace(char *traceFileName, intn detail, intn lifetime,
+                          intn timeWindow, float64 timeWindowSize,
+                          intn regionTrace, intn regionSize,
+                          uint16 procTraceMask );
+extern int HDFendIOTrace(VOID);
+
+#ifndef PABLO_FNAMES
+#   define PABLO_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nihinitiotrace FNAME(IHINITIOTRACE)
+#   define nhendiotrace   FNAME(HENDIOTRACE)
+#else  /* !DF_CAPFNAMES */
+#   define nihinitiotrace FNAME(ihinitiotrace)
+#   define nhendiotrace   FNAME(hendiotrace)
+#endif /* DF_CAPFNAMES */
+#endif /* PABLO_FNAMES */
+
+#endif /* HAVE_PABLO || PABLO*/
+
+#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. 
+
+******************************************************************************/
+extern 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().
+******************************************************************************/
+extern 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
+ */
+   extern intn Vsetattr
+                (int32 vgid,  char *attrname, int32 datatype,
+                 int32 count, VOIDP values);
+   extern intn Vnattrs
+                (int32 vgid);
+   extern intn Vfindattr
+                (int32 vgid, char *attrname);
+   extern intn Vattrinfo
+                (int32 vgid, intn attrindex, char *name, 
+                 int32 *datatype, int32 *count, int32 *size);
+   extern intn Vgetattr
+                (int32 vgid, intn attrindex, VOIDP values);
+   extern int32 Vgetversion
+                (int32 vgid);
+   extern intn VSfindex
+                 (int32 vsid, char *fieldname, int32 *fldindex);
+   extern intn VSsetattr
+                (int32 vsid, int32 findex, char *attrname,
+                 int32 datatype, int32 count, VOIDP values);
+   extern intn VSnattrs
+                (int32 vsid);
+   extern intn VSfnattrs
+                (int32 vsid, int32 findex);
+   extern intn VSfindattr
+                (int32 vsid, int32 findex, char *attrname);
+   extern intn VSattrinfo
+                (int32 vsid, int32 findex, intn attrindex,
+                 char *name, int32 *datatype, int32 *count, 
+                 int32 *size);
+   extern intn VSgetattr
+                (int32 vsid, int32 findex, intn attrindex,
+                  VOIDP values);
+   extern intn VSisattr
+                (int32 vsid);
+/*
+   ** from vconv.c
+ */
+    extern int32 vicheckcompat
+                (HFILEID f);
+
+    extern int32 vimakecompat
+                (HFILEID f);
+
+    extern int32 vcheckcompat
+                (char  * fs);
+
+    extern int32 vmakecompat
+                (char  * fs);
+
+/*
+   ** from vg.c
+ */
+    extern int32 VSelts
+                (int32 vkey);
+
+    extern int32 VSgetinterlace
+                (int32 vkey);
+
+    extern intn VSsetinterlace
+                (int32 vkey, int32 interlace);
+
+    extern int32 VSgetfields
+                (int32 vkey, char  * fields);
+
+    extern intn VSfexist
+                (int32 vkey, char  * fields);
+
+    extern int32 VSsizeof
+                (int32 vkey, char  * fields);
+
+    extern VOID VSdump
+                (int32 vkey);
+
+    extern int32 VSsetname
+                (int32 vkey, const char  * vsname);
+
+    extern int32 VSsetclass
+                (int32 vkey, const char  * vsclass);
+
+    extern int32 VSgetname
+                (int32 vkey, char  * vsname);
+
+    extern int32 VSgetclass
+                (int32 vkey, char  * vsclass);
+
+    extern intn VSinquire
+                (int32 vkey, int32  * nelt, int32  * interlace,
+           char  * fields, int32  * eltsize, char  * vsname);
+
+    extern int32 VSlone
+                (HFILEID f, int32  * idarray, int32 asize);
+
+    extern int32 Vlone
+                (HFILEID f, int32  * idarray, int32 asize);
+
+    extern int32 Vfind
+                (HFILEID f, const char  * vgname);
+
+    extern int32 VSfind
+                (HFILEID f, const char  * vsname);
+
+    extern int32 Vfindclass
+                (HFILEID f, const char  * vgclass);
+
+    extern int32 VSfindclass
+                (HFILEID f, const char  * vsclass);
+
+    extern VOID Vsetzap
+                (void);
+
+/*
+   ** from vgp.c
+ */
+    extern intn vcompare
+                (VOIDP k1, VOIDP k2, intn cmparg);
+
+    extern intn vcompareref
+                (VOIDP k1, VOIDP k2, intn cmparg);
+
+    extern VOID vdestroynode
+                (VOIDP n);
+
+    extern VOID vtfreekey
+                (VOIDP k);
+
+    extern intn Vinitialize
+                (HFILEID f);
+
+    extern intn Vfinish
+                (HFILEID f);
+
+    extern HFILEID Vopen
+                (char *path, intn acc_mode, int16 ndds);
+
+    extern intn Vclose
+                (HFILEID f);
+
+    extern int32 vexistvg
+                (HFILEID f, uint16 vgid);
+
+    extern int32 Vattach
+                (HFILEID f, int32 vgid, const char  * accesstype);
+
+    extern int32 Vdetach
+                (int32 vkey);
+
+    extern int32 Vinsert
+                (int32 vkey, int32 vskey);
+    /* note: 2nd arg of Vinsert can also be (VGROUP *) */
+
+    extern int32 Vflocate
+                (int32 vkey, char  * field);
+
+    extern intn Vinqtagref
+                (int32 vkey, int32 tag, int32 ref);
+
+    extern int32 Vntagrefs
+                (int32 vkey);
+
+    extern int32 Vnrefs
+                (int32 vkey,int32 tag);
+
+    extern int32 Vgettagrefs
+                (int32 vkey, int32  tagarray[], int32  refarray[], int32 n);
+
+    extern intn Vgettagref
+                (int32 vkey, int32 which, int32  * tag, int32  * ref);
+
+    extern int32 VQueryref
+                (int32 vkey);
+
+    extern int32 VQuerytag
+                (int32 vkey);
+
+    extern int32 Vaddtagref
+                (int32 vkey, int32 tag, int32 ref);
+
+    extern int32 Ventries
+                (HFILEID f, int32 vgid);
+
+    extern int32 Vsetname
+                (int32 vkey, const char  * vgname);
+
+    extern int32 Vsetclass
+                (int32 vkey, const char  * vgclass);
+
+    extern intn Visvg
+                (int32 vkey, int32 id);
+
+    extern intn Visvs
+                (int32 vkey, int32 id);
+
+    extern int32 Vgetid
+                (HFILEID f, int32 vgid);
+
+    extern int32 Vgetnext
+                (int32 vkey, int32 id);
+
+    extern int32 Vgetname
+                (int32 vkey, char  * vgname);
+
+    extern int32 Vgetclass
+                (int32 vkey, char  * vgclass);
+
+    extern intn Vinquire
+                (int32 vkey, int32  * nentries, char  * vgname);
+
+    extern int32 Vdelete
+                (int32 f, int32 ref);
+
+    extern intn VPshutdown(void);
+
+/*
+   ** from vparse.c
+ */
+    extern int32 scanattrs
+                (const char  * attrs, int32  * attrc, char  *** attrv);
+
+/*
+   ** from vhi.c
+ */
+    extern int32 VHstoredata
+                (HFILEID f, char  * field, uint8  buf[], int32 n, int32 datatype,
+                 const char  * vsname, const char  * vsclass);
+
+    extern int32 VHstoredatam
+                (HFILEID f, const char * field, const uint8  buf[], int32 n, int32 datatype,
+                 const char  * vsname, const char  * vsclass, int32 order);
+
+    extern int32 VHmakegroup
+                (HFILEID f, int32  tagarray[], int32  refarray[], int32 n, char  * vgname,
+                 char  * vgclass);
+
+/*
+   ** from vio.c
+ */
+
+    extern intn VSPhshutdown(void);
+
+    extern int32 vexistvs
+                (HFILEID f, uint16 vsref);
+
+    extern VOID vsdestroynode
+                (VOIDP n);
+
+    extern VOID vfdestroynode
+                (VOIDP n);
+
+    extern int32 VSattach
+                (HFILEID f, int32 vsref, const char  * accesstype);
+
+    extern int32 VSdetach
+                (int32 vkey);
+
+    extern int32 VSQuerytag
+                (int32 vkey);
+
+    extern int32 VSQueryref
+                (int32 vkey);
+ 
+    extern int32 VSgetid
+                (HFILEID f, int32 vsref);
+
+    extern int32 VSgetversion
+                (int32 vkey);
+
+    extern int32 VSdelete
+                (int32 f, int32 ref);
+
+    extern int32 VSappendable
+                (int32 vkey, int32 blk);
+
+/*
+   ** from vsfld.c
+ */
+
+    extern intn VSsetfields
+                (int32 vkey, const char  * fields);
+
+    extern intn VSfdefine
+                (int32 vkey, const char  * field, int32 localtype, int32 order);
+
+    extern int32 VFnfields
+                (int32 vkey);
+
+    extern char *VFfieldname
+                (int32 vkey, int32 index);
+
+    extern int32 VFfieldtype
+                (int32 vkey, int32 index);
+
+    extern int32 VFfieldisize
+                (int32 vkey, int32 index);
+
+    extern int32 VFfieldesize
+                (int32 vkey, int32 index);
+
+    extern int32 VFfieldorder
+                (int32 vkey, int32 index);
+
+    extern intn VSsetexternalfile
+		(int32 vkey, const char *filename, int32 offset);
+
+    extern intn VSfpack
+                (int32 vsid, intn packtype, char *fields_in_buf,
+                VOIDP buf, intn bufsz, intn n_records, 
+                char *fields, VOIDP fldbufpt[]);
+
+/*
+   ** from vrw.c
+ */
+    extern intn VSPshutdown(void);
+
+    extern int32 VSseek
+                (int32 vkey, int32 eltpos);
+
+    extern int32 VSread
+                (int32 vkey, uint8  buf[], int32 nelt, int32 interlace);
+
+    extern int32 VSwrite
+                (int32 vkey, const uint8  buf[], int32 nelt, int32 interlace);
+
+/*
+   ** from vgF.c
+ */
+#ifndef VG_FNAMES
+#   define VG_FNAMES
+#ifdef DF_CAPFNAMES
+#  if !(defined INTEL86) && !(defined WIN32)
+#   define  ndfivopn FNAME(DFIVOPN)
+#   define  ndfvclos FNAME(DFVCLOS)
+#   define  nvatchc  FNAME(VATCHC)
+#   define  nvdtchc  FNAME(VDTCHC)
+#   define  nvgnamc  FNAME(VGNAMC)
+#   define  nvgclsc  FNAME(VGCLSC)
+#   define  nvinqc   FNAME(VINQC)
+#   define  nvdelete FNAME(VDELETE)
+#   define  nvgidc   FNAME(VGIDC)
+#   define  nvgnxtc  FNAME(VGNXTC)
+#   define  nvsnamc  FNAME(VSNAMC)
+#   define  nvsclsc  FNAME(VSCLSC)
+#   define  nvinsrtc FNAME(VINSRTC)
+#   define  nvisvgc  FNAME(VISVGC)
+#   define  nvfstart FNAME(VFSTART)
+#   define  nvfend   FNAME(VFEND)
+#   define  nvisvsc  FNAME(VISVSC)
+#   define  nvsatchc FNAME(VSATCHC)
+#   define  nvsdtchc FNAME(VSDTCHC)
+#   define  nvsqref  FNAME(VSQREF)
+#   define  nvsqtag  FNAME(VSQTAG)
+#   define  nvsgver  FNAME(VSGVER)
+#   define  nvsseekc FNAME(VSSEEKC)
+#   define  nvsgnamc FNAME(VSGNAMC)
+#   define  nvsgclsc FNAME(VSGCLSC)
+#   define  nvsinqc  FNAME(VSINQC)
+#   define  nvsfexc  FNAME(VSFEXC)
+#   define  nvsfndc  FNAME(VSFNDC)
+#   define  nvsgidc  FNAME(VSGIDC)
+#   define  nvsdltc  FNAME(VSDLTC)
+#   define  nvsapp   FNAME(VSAPP)
+#   define  nvssnamc FNAME(VSSNAMC)
+#   define  nvssclsc FNAME(VSSCLSC)
+#   define  nvssfldc FNAME(VSSFLDC)
+#   define  nvssintc FNAME(VSSINTC)
+#   define  nvsfdefc FNAME(VSFDEFC)
+#   define  nvssextfc FNAME(VSSEXTFC)
+#   define  nvfnflds FNAME(VFNFLDS)
+#   define  nvffname FNAME(VFFNAME)
+#   define  nvfftype FNAME(VFFTYPE)
+#   define  nvffisiz FNAME(VFFISIZ)
+#   define  nvffesiz FNAME(VFFESIZ)
+#   define  nvffordr FNAME(VFFORDR)
+#   define  nvsfrdc  FNAME(VSFRDC)
+#   define  nvsfrd   FNAME(VSFRD)
+#   define  nvsreadc FNAME(VSREADC)
+#   define  nvsfwrtc FNAME(VSFWRTC)
+#   define  nvsfwrt  FNAME(VSFWRT)
+#   define  nvswritc FNAME(VSWRITC)
+#   define  nvsgintc FNAME(VSGINTC)
+#   define  nvseltsc FNAME(VSELTSC)
+#   define  nvsgfldc FNAME(VSGFLDC)
+#   define  nvssizc  FNAME(VSSIZC)
+#   define  nventsc  FNAME(VENTSC)
+#   define  nvlonec  FNAME(VLONEC)
+#   define  nvslonec FNAME(VSLONEC)
+#   define  nvfindc  FNAME(VFINDC)
+#   define  nvfndclsc FNAME(VFNDCLSC)
+#   define  nvhsdc   FNAME(VHSDC)
+#   define  nvhscdc  FNAME(VHSCDC)
+#   define  nvhscdmc FNAME(VHSCDMC)
+#   define  nvhsdmc  FNAME(VHSDMC)
+#   define  nvhmkgpc FNAME(VHMKGPC)
+#   define  nvffloc  FNAME(VFFLOC)
+#   define  nvnrefs  FNAME(VNREFS)
+#   define  nvqref   FNAME(VQREF)
+#   define  nvqtag   FNAME(VQTAG)
+#   define  nvinqtrc FNAME(VINQTRC)
+#   define  nvntrc   FNAME(VNTRC)
+#   define  nvgttrsc FNAME(VGTTRSC)
+#   define  nvgttrc  FNAME(VGTTRC)
+#   define  nvadtrc  FNAME(VADTRC)
+#   define  nvsqintr FNAME(VSIQINTR)
+#   define  nvsqfnelt   FNAME(VSQFNELT)
+#   define  nvsqfintr   FNAME(VSQFINTR)
+#   define  nvsqfldsc   FNAME(VSQFLDSC)
+#   define  nvsqfvsiz   FNAME(VSQVSIZ)
+#   define  nvsqnamec   FNAME(VSQNAMEC)
+#   define  nvsfccpk    FNAME(VSFCCPK)
+#   define  nvsfncpk    FNAME(VSFNCPK)
+#  else /* PowerStation */
+#   define  ndfivopn FNAME(DFIVOPN)
+#   define  ndfvclos FNAME(DFVCLOS)
+#   define  nvatchc  FNAME(VATCHC)
+#   define  nvdtchc  FNAME(VDTCHC)
+#   define  nvgnamc  FNAME(VGNAMC)
+#   define  nvgclsc  FNAME(VGCLSC)
+#   define  nvinqc   FNAME(VINQC)
+#   define  nvdelete FNAME(VDELETE)
+#   define  nvgidc   FNAME(VGIDC)
+#   define  nvgnxtc  FNAME(VGNXTC)
+#   define  nvsnamc  FNAME(VSNAMC)
+#   define  nvsclsc  FNAME(VSCLSC)
+#   define  nvinsrtc FNAME(VINSRTC)
+#   define  nvisvgc  FNAME(VISVGC)
+#   define  nvfistart FNAME(VFISTART)
+#   define  nvfiend  FNAME(VFIEND)
+#   define  nvisvsc  FNAME(VISVSC)
+#   define  nvsatchc FNAME(VSATCHC)
+#   define  nvsdtchc FNAME(VSDTCHC)
+#   define  nvsiqref FNAME(VSIQREF)
+#   define  nvsiqtag FNAME(VSIQTAG)
+#   define  nvsigver FNAME(VSIGVER)
+#   define  nvsseekc FNAME(VSSEEKC)
+#   define  nvsgnamc FNAME(VSGNAMC)
+#   define  nvsgclsc FNAME(VSGCLSC)
+#   define  nvsinqc  FNAME(VSINQC)
+#   define  nvsfexc  FNAME(VSFEXC)
+#   define  nvsfndc  FNAME(VSFNDC)
+#   define  nvsgidc  FNAME(VSGIDC)
+#   define  nvsdltc  FNAME(VSDLTC)
+#   define  nvsapp   FNAME(VSAPP)
+#   define  nvssnamc FNAME(VSSNAMC)
+#   define  nvssclsc FNAME(VSSCLSC)
+#   define  nvssfldc FNAME(VSSFLDC)
+#   define  nvssintc FNAME(VSSINTC)
+#   define  nvsfdefc FNAME(VSFDEFC)
+#   define  nvssextfc FNAME(VSSEXTFC)
+#   define  nvfinflds FNAME(VFINFLDS)
+#   define  nvfifnm  FNAME(VFIFNM)
+#   define  nvfiftp  FNAME(VFIFTP)
+#   define  nvfifisz FNAME(VFIFISZ)
+#   define  nvfifesz FNAME(VFIFESZ)
+#   define  nvfifodr FNAME(VFIFODR)
+#   define  nvsfirdc FNAME(VSFIRDC)
+#   define  nvsfird  FNAME(VSFIRD)
+#   define  nvsreadc FNAME(VSREADC)
+#   define  nvsfiwrc FNAME(VSFIWRC)
+#   define  nvsfiwr  FNAME(VSFIWR)
+#   define  nvswritc FNAME(VSWRITC)
+#   define  nvsgintc FNAME(VSGINTC)
+#   define  nvseltsc FNAME(VSELTSC)
+#   define  nvsgfldc FNAME(VSGFLDC)
+#   define  nvssizc  FNAME(VSSIZC)
+#   define  nventsc  FNAME(VENTSC)
+#   define  nvlonec  FNAME(VLONEC)
+#   define  nvslonec FNAME(VSLONEC)
+#   define  nvfindc  FNAME(VFINDC)
+#   define  nvfndclsc FNAME(VFNDCLSC)
+#   define  nvhsdc   FNAME(VHSDC)
+#   define  nvhscdc  FNAME(VHSCDC)
+#   define  nvhscdmc FNAME(VHSCDMC)
+#   define  nvhsdmc  FNAME(VHSDMC)
+#   define  nvhmkgpc FNAME(VHMKGPC)
+#   define  nvflocc  FNAME(VFLOCC)
+#   define  nvfirefs FNAME(VFIREFS)
+#   define  nvfiqref  FNAME(VFIQREF)
+#   define  nvfiqtag  FNAME(VFIQTAG)
+#   define  nvinqtrc FNAME(VINQTRC)
+#   define  nvntrc   FNAME(VNTRC)
+#   define  nvgttrsc FNAME(VGTTRSC)
+#   define  nvgttrc  FNAME(VGTTRC)
+#   define  nvadtrc  FNAME(VADTRC)
+#   define  nvsiqintr FNAME(VSIQINTR)
+#   define  nvsiqnelt FNAME(VSIQNELT)
+#   define  nvsqfldsc   FNAME(VSQFLDSC)
+#   define  nvsiqvsz    FNAME(VSIQVSZ)
+#   define  nvsqnamec   FNAME(VSQNAMEC)
+#   define  nvsfccpk    FNAME(VSFCCPK)
+#   define  nvsfncpk    FNAME(VSFNCPK)
+#  endif
+#else                    /* !DF_CAPFNAMES */
+#  if !(defined INTEL86) && !(defined WIN32)
+#   define  ndfivopn FNAME(dfivopn)
+#   define  ndfvclos FNAME(dfvclos)
+#   define  nvatchc  FNAME(vatchc)
+#   define  nvdtchc  FNAME(vdtchc)
+#   define  nvgnamc  FNAME(vgnamc)
+#   define  nvgclsc  FNAME(vgclsc)
+#   define  nvinqc   FNAME(vinqc)
+#   define  nvdelete FNAME(vdelete)
+#   define  nvgidc   FNAME(vgidc)
+#   define  nvgnxtc  FNAME(vgnxtc)
+#   define  nvsnamc  FNAME(vsnamc)
+#   define  nvsclsc  FNAME(vsclsc)
+#   define  nvinsrtc FNAME(vinsrtc)
+#   define  nvisvgc  FNAME(visvgc)
+#   define  nvfstart FNAME(vfstart)
+#   define  nvfend   FNAME(vfend)
+#   define  nvisvsc  FNAME(visvsc)
+#   define  nvsatchc FNAME(vsatchc)
+#   define  nvsdtchc FNAME(vsdtchc)
+#   define  nvsqref  FNAME(vsqref)
+#   define  nvsqtag  FNAME(vsqtag)
+#   define  nvsgver  FNAME(vsgver)
+#   define  nvsseekc FNAME(vsseekc)
+#   define  nvsgnamc FNAME(vsgnamc)
+#   define  nvsgclsc FNAME(vsgclsc)
+#   define  nvsinqc  FNAME(vsinqc)
+#   define  nvsfexc  FNAME(vsfexc)
+#   define  nvsfndc  FNAME(vsfndc)
+#   define  nvsgidc  FNAME(vsgidc)
+#   define  nvsdltc  FNAME(vsdltc)
+#   define  nvsapp   FNAME(vsapp)
+#   define  nvssnamc FNAME(vssnamc)
+#   define  nvssclsc FNAME(vssclsc)
+#   define  nvssfldc FNAME(vssfldc)
+#   define  nvssintc FNAME(vssintc)
+#   define  nvsfdefc FNAME(vsfdefc)
+#   define  nvssextfc FNAME(vssextfc)
+#   define  nvfnflds FNAME(vfnflds)
+#   define  nvffname FNAME(vffname)
+#   define  nvfftype FNAME(vfftype)
+#   define  nvffisiz FNAME(vffisiz)
+#   define  nvffesiz FNAME(vffesiz)
+#   define  nvffordr FNAME(vffordr)
+#   define  nvsfrdc  FNAME(vsfrdc)
+#   define  nvsfrd   FNAME(vsfrd)
+#   define  nvsreadc FNAME(vsreadc)
+#   define  nvsfwrtc FNAME(vsfwrtc)
+#   define  nvsfwrt  FNAME(vsfwrt)
+#   define  nvswritc FNAME(vswritc)
+#   define  nvsgintc FNAME(vsgintc)
+#   define  nvseltsc FNAME(vseltsc)
+#   define  nvsgfldc FNAME(vsgfldc)
+#   define  nvssizc  FNAME(vssizc)
+#   define  nventsc  FNAME(ventsc)
+#   define  nvlonec  FNAME(vlonec)
+#   define  nvslonec FNAME(vslonec)
+#   define  nvfindc  FNAME(vfindc)
+#   define  nvfndclsc FNAME(vfndclsc)
+#   define  nvhscdc  FNAME(vhscdc)
+#   define  nvhsdc   FNAME(vhsdc)
+#   define  nvhscdmc  FNAME(vhscdmc)
+#   define  nvhsdmc  FNAME(vhsdmc)
+#   define  nvhmkgpc FNAME(vhmkgpc)
+#   define  nvflocc  FNAME(vflocc)
+#   define  nvinqtrc FNAME(vinqtrc)
+#   define  nvntrc   FNAME(vntrc)
+#   define  nvnrefs  FNAME(vnrefs)
+#   define  nvgttrsc FNAME(vgttrsc)
+#   define  nvqref   FNAME(vqref)
+#   define  nvqtag   FNAME(vqtag)
+#   define  nvgttrc  FNAME(vgttrc)
+#   define  nvadtrc  FNAME(vadtrc)
+#   define  nvfstart FNAME(vfstart)
+#   define  nvfend   FNAME(vfend)
+#   define  nvsqfnelt   FNAME(vsqfnelt)
+#   define  nvsqfintr   FNAME(vsqfintr)
+#   define  nvsqfldsc   FNAME(vsqfldsc)
+#   define  nvsqfvsiz   FNAME(vsqfvsiz)
+#   define  nvsqnamec   FNAME(vsqnamec)
+#   define  nvsfccpk    FNAME(vsfccpk)
+#   define  nvsfncpk    FNAME(vsfncpk)
+#  else  /* PowerStation */
+#   define  ndfivopn FNAME(dfivopn)
+#   define  ndfvclos FNAME(dfvclos)
+#   define  nvatchc  FNAME(vatchc)
+#   define  nvdtchc  FNAME(vdtchc)
+#   define  nvgnamc  FNAME(vgnamc)
+#   define  nvgclsc  FNAME(vgclsc)
+#   define  nvinqc   FNAME(vinqc)
+#   define  nvdelete FNAME(vdelete)
+#   define  nvgidc   FNAME(vgidc)
+#   define  nvgnxtc  FNAME(vgnxtc)
+#   define  nvsnamc  FNAME(vsnamc)
+#   define  nvsclsc  FNAME(vsclsc)
+#   define  nvinsrtc FNAME(vinsrtc)
+#   define  nvisvgc  FNAME(visvgc)
+#   define  nvfistart FNAME(vfistart)
+#   define  nvfiend  FNAME(vfiend)
+#   define  nvisvsc  FNAME(visvsc)
+#   define  nvsatchc FNAME(vsatchc)
+#   define  nvsdtchc FNAME(vsdtchc)
+#   define  nvsiqref FNAME(vsiqref)
+#   define  nvsiqtag FNAME(vsiqtag)
+#   define  nvsigver FNAME(vsigver)
+#   define  nvsseekc FNAME(vsseekc)
+#   define  nvsgnamc FNAME(vsgnamc)
+#   define  nvsgclsc FNAME(vsgclsc)
+#   define  nvsinqc  FNAME(vsinqc)
+#   define  nvsfexc  FNAME(vsfexc)
+#   define  nvsfndc  FNAME(vsfndc)
+#   define  nvsgidc  FNAME(vsgidc)
+#   define  nvsdltc  FNAME(vsdltc)
+#   define  nvsapp   FNAME(vsapp)
+#   define  nvssnamc FNAME(vssnamc)
+#   define  nvssclsc FNAME(vssclsc)
+#   define  nvssfldc FNAME(vssfldc)
+#   define  nvssintc FNAME(vssintc)
+#   define  nvsfdefc FNAME(vsfdefc)
+#   define  nvssextfc FNAME(vssextfc)
+#   define  nvfinflds FNAME(vfinflds)
+#   define  nvfifnm  FNAME(vfifnm)
+#   define  nvfiftp  FNAME(vfiftp)
+#   define  nvfifisz FNAME(vfifisz)
+#   define  nvfifesz FNAME(vfifesz)
+#   define  nvfifodr FNAME(vfifodr)
+#   define  nvsfirdc FNAME(vsfirdc)
+#   define  nvsfird  FNAME(vsfird)
+#   define  nvsreadc FNAME(vsreadc)
+#   define  nvsfiwrc FNAME(vsfiwrc)
+#   define  nvsfiwr  FNAME(vsfiwr)
+#   define  nvswritc FNAME(vswritc)
+#   define  nvsgintc FNAME(vsgintc)
+#   define  nvseltsc FNAME(vseltsc)
+#   define  nvsgfldc FNAME(vsgfldc)
+#   define  nvssizc  FNAME(vssizc)
+#   define  nventsc  FNAME(ventsc)
+#   define  nvlonec  FNAME(vlonec)
+#   define  nvslonec FNAME(vslonec)
+#   define  nvfindc  FNAME(vfindc)
+#   define  nvfndclsc FNAME(vfndclsc)
+#   define  nvhsdc   FNAME(vhsdc)
+#   define  nvhscdc  FNAME(vhscdc)
+#   define  nvhscdmc FNAME(vhscdmc)
+#   define  nvhsdmc  FNAME(vhsdmc)
+#   define  nvhmkgpc FNAME(vhmkgpc)
+#   define  nvflocc  FNAME(vflocc)
+#   define  nvfirefs FNAME(vfirefs)
+#   define  nvfiqref  FNAME(vfiqref)
+#   define  nvfiqtag  FNAME(vfiqtag)
+#   define  nvinqtrc FNAME(vinqtrc)
+#   define  nvntrc   FNAME(vntrc)
+#   define  nvgttrsc FNAME(vgttrsc)
+#   define  nvgttrc  FNAME(vgttrc)
+#   define  nvadtrc  FNAME(vadtrc)
+#   define  nvsiqintr FNAME(vsiqintr)
+#   define  nvsiqnelt FNAME(vsiqnelt)
+#   define  nvsqfldsc   FNAME(vsqfldsc)
+#   define  nvsiqvsz   FNAME(vsiqvsz)
+#   define  nvsqnamec   FNAME(vsqnamec)
+#   define  nvsfccpk    FNAME(vsfccpk)
+#   define  nvsfncpk    FNAME(vsfncpk)
+#  endif
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* VG_FNAMES */
+
+    extern      FRETVAL(intf) ndfivopn
+                (_fcd filename, intf  * acc_mode, intf  * defdds, intf  * namelen);
+
+    extern      FRETVAL(intf) ndfvclos
+                (intf  * file_id);
+
+    extern      FRETVAL(intf) nvatchc
+                (HFILEID  * f, intf  * vgid, _fcd accesstype);
+
+    extern      FRETVAL(intf) nvdtchc
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvgnamc
+                (intf  * vkey, _fcd vgname);
+
+    extern      FRETVAL(intf) nvgclsc
+                (intf  * vkey, _fcd vgclass);
+
+    extern      FRETVAL(intf) nvinqc
+                (intf  * vkey, intf  * nentries, _fcd vgname);
+
+    extern      FRETVAL(intf) nvdelete
+                (intf  *f, intf  * vkey);
+
+    extern      FRETVAL(intf) nvgidc
+                (HFILEID  * f, intf  * vgid);
+
+    extern      FRETVAL(intf) nvgnxtc
+                (intf  * vkey, intf  * id);
+
+    extern      FRETVAL(intf) nvsnamc
+                (intf  * vkey, _fcd vgname, intf  * vgnamelen);
+
+    extern      FRETVAL(intf) nvsclsc
+                (intf  * vkey, _fcd vgclass, intf  * vgclasslen);
+
+    extern      FRETVAL(intf) nvinsrtc
+                (intf  * vkey, intf  * vobjptr);
+
+    extern      FRETVAL(intf) nvisvgc
+                (intf  * vkey, intf  * id);
+
+    extern      FRETVAL(intf) nvfistart
+                (intf  * f);
+
+    extern      FRETVAL(intf) nvfiend
+                (intf  * f);
+
+    extern      FRETVAL(intf) nvisvsc
+                (intf  * vkey, intf  * id);
+
+    extern      FRETVAL(intf) nvsatchc
+                (HFILEID  * f, intf  * vsref, _fcd accesstype);
+
+    extern      FRETVAL(intf) nvsdtchc
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvsqref
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvsiqref
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvsqtag
+                (intf  * vkey);
+  
+    extern      FRETVAL(intf) nvsiqtag
+                (intf  * vkey);
+  
+    extern      FRETVAL(intf) nvsigver
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvsgver
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvsseekc
+                (intf  * vkey, intf  * eltpos);
+
+    extern      FRETVAL(intf) nvsgnamc
+                (intf  * vkey, _fcd vsname, intf *vsnamelen);
+
+    extern      FRETVAL(intf) nvsgclsc
+                (intf  * vkey, _fcd vsclass, intf *vsclasslen);
+
+    extern      FRETVAL(intf) nvsinqc
+                (intf  * vkey, intf  * nelt, intf  * interlace, _fcd fields,
+		intf  * eltsize, _fcd vsname, intf *fieldslen, intf *vsnamelen);
+
+    extern      FRETVAL(intf) nvsfexc
+                (intf  * vkey, _fcd fields, intf  * fieldslen);
+
+    extern      FRETVAL(intf) nvsfndc
+                (HFILEID  * f, _fcd name, intf  * namelen);
+
+    extern      FRETVAL(intf) nvsgidc
+                (HFILEID  * f, intf  * vsref);
+
+    extern      FRETVAL(intf) nvsdltc
+                (HFILEID  * f, intf  * vsref);
+
+    extern      FRETVAL(intf) nvsapp
+                (intf  * vkey, intf  *blk);
+
+    extern      FRETVAL(intf) nvssnamc
+                (intf  * vkey, _fcd vsname, intf  * vsnamelen);
+
+    extern      FRETVAL(intf) nvssclsc
+                (intf  * vkey, _fcd vsclass, intf  * vsclasslen);
+
+    extern      FRETVAL(intf) nvssfldc
+                (intf  * vkey, _fcd fields, intf  * fieldslen);
+
+    extern      FRETVAL(intf) nvssintc
+                (intf  * vkey, intf  * interlace);
+
+    extern      FRETVAL(intf) nvsfdefc
+                (intf  * vkey, _fcd field, intf  * localtype,
+                 intf  * order, intf  * fieldlen);
+
+    extern      FRETVAL(intf) nvssextfc
+                (intf  * vkey, _fcd fname, intf  * offset,
+                 intf  * fnamelen);
+
+    extern      FRETVAL(intf) nvfinflds
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvfnflds
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvffname
+                (intf  * vkey, intf  *index, _fcd fname);
+
+    extern      FRETVAL(intf) nvfifnm
+                (intf  * vkey, intf  *index, _fcd fname);
+
+    extern      FRETVAL(intf) nvfftype
+                (intf  * vkey, intf  *index);
+
+    extern      FRETVAL(intf) nvfiftp
+                (intf  * vkey, intf  *index);
+
+    extern      FRETVAL(intf) nvffisiz
+                (intf  * vkey, intf  *index);
+
+    extern      FRETVAL(intf) nvfifisz
+                (intf  * vkey, intf  *index);
+
+    extern      FRETVAL(intf) nvffesiz
+                (intf  * vkey, intf  *index);
+
+    extern      FRETVAL(intf) nvfifesz
+                (intf  * vkey, intf  *index);
+
+    extern      FRETVAL(intf) nvffordr
+                (intf  * vkey, intf  *index);
+
+    extern      FRETVAL(intf) nvfifodr
+                (intf  * vkey, intf  *index);
+
+    extern      FRETVAL(intf) nvsfrdc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvsfirdc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvsfrd
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvsfird
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvsreadc
+                (intf  * vkey, uint8  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvsfwrtc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvsfiwrc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvsfwrt
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvsfiwr
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvswritc
+                (intf  * vkey, uint8  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    extern      FRETVAL(intf) nvsgintc
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvseltsc
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvsgfldc
+                (intf  * vkey, _fcd fields);
+
+    extern      FRETVAL(intf) nvssizc
+                (intf  * vkey, _fcd fields, intf  * fieldslen);
+
+    extern      FRETVAL(intf) nventsc
+                (HFILEID  * f, intf  * vgid);
+
+    extern      FRETVAL(intf) nvlonec
+                (HFILEID  * f, intf  * idarray, intf  * asize);
+
+    extern      FRETVAL(intf) nvslonec
+                (HFILEID  * f, intf  * idarray, intf  * asize);
+
+    extern      FRETVAL(intf) nvfindc
+                (HFILEID  * f, _fcd name, intf  * namelen);
+
+    extern      FRETVAL(intf) nvfndclsc
+                (HFILEID  * f, _fcd vgclass, intf  * classlen);
+
+    extern      FRETVAL(intf) nvhscdc
+                (HFILEID  * f, _fcd field, _fcd  cbuf, intf  * n, 
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * fieldlen, intf  * vsnamelen,
+                 intf  * vsclasslen);
+
+    extern      FRETVAL(intf) nvhsdc
+                (HFILEID  * f, _fcd field, uint8  * buf, intf  * n, 
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * fieldlen, intf  * vsnamelen,
+                 intf  * vsclasslen);
+
+    extern      FRETVAL(intf) nvhscdmc
+                (HFILEID  * f, _fcd field, _fcd  cbuf, intf  * n,
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * order, intf  * fieldlen, intf * vsnamelen,
+                 intf  * vsclasslen);
+
+    extern      FRETVAL(intf) nvhsdmc
+                (HFILEID  * f, _fcd field, uint8  * buf, intf  * n,
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * order, intf  * fieldlen, intf * vsnamelen,
+                 intf  * vsclasslen);
+
+    extern      FRETVAL(intf) nvhmkgpc
+                (HFILEID  * f, intf  * tagarray, intf  * refarray, intf  * n,
+                 _fcd vgname, _fcd vgclass, intf  * vgnamelen, intf  * vgclasslen);
+
+    extern      FRETVAL(intf) nvflocc
+                (intf  * vkey, _fcd field, intf  * fieldlen);
+
+    extern      FRETVAL(intf) nvinqtrc
+                (intf  * vkey, intf  * tag, intf  * ref);
+
+    extern      FRETVAL(intf) nvntrc
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvnrefs
+                (intf  * vkey, intf  *tag);
+
+    extern      FRETVAL(intf) nvfirefs
+                (intf  * vkey, intf  *tag);
+
+    extern      FRETVAL(intf) nvqref
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvfiqref
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvqtag
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvfiqtag
+                (intf  * vkey);
+
+    extern      FRETVAL(intf) nvgttrsc
+                (intf  * vkey, intf  * tagarray, intf  * refarray, intf  * n);
+
+    extern      FRETVAL(intf) nvgttrc
+                (intf  * vkey, intf  * which, intf  * tag, intf  * ref);
+
+    extern      FRETVAL(intf) nvadtrc
+                (intf  * vkey, intf  * tag, intf  * ref);
+
+    extern      FRETVAL(intf) nvsiqnelt
+                (intf * vkey, intf *nelt);
+
+    extern      FRETVAL(intf) nvsiqintr
+                (intf * vkey, intf *interlace);
+
+    extern      FRETVAL(intf) nvsqfldsc
+                (intf * vkey, _fcd fields, intf *fieldslen);
+
+    extern      FRETVAL(intf) nvsiqvsz
+                (intf * vkey, intf *ret_size);
+
+    extern      FRETVAL(intf) nvsqnamec
+                (intf * vkey, _fcd name, intf *namelen);
+
+    extern      FRETVAL(intf) nvsfccpk
+                (intf * vkey, intf *packtype, _fcd buflds, intf *buf,
+                intf *bufsz,intf *nrecs, _fcd pckfld, _fcd fldbuf, 
+                intf *buflds_len, intf *fld_len);
+
+    extern      FRETVAL(intf) nvsfncpk
+                (intf * vkey, intf *packtype, _fcd buflds, intf *buf,
+                 intf *bufsz, intf *nrecs, _fcd pckfld, intf *fldbuf, 
+                 intf *buflds_len, intf *fld_len);
+
+
+/* 
+  ** from vattrf.c
+ */
+#ifndef VATTR_FNAMES
+#  define VATTR_FNAMES
+#ifdef DF_CAPFNAMES
+# if !(defined INTEL86) && !(defined WIN32)
+#  define nvsfcfdx   FNAME(VSFCFDX)
+#  define nvsfcsat   FNAME(VSFCSAT)
+#  define nvsfcsca   FNAME(VSFCSCA)
+#  define nvsfnats   FNAME(VSFNATS)
+#  define nvsffnas   FNAME(VSFFNAS)
+#  define nvsfcfda   FNAME(VSFCFDA)
+#  define nvsfainf   FNAME(VSFAINF)
+#  define nvsfgnat   FNAME(VSFGNAT)
+#  define nvsfgcat   FNAME(VSFGCAT)
+#  define nvsfisat   FNAME(VSFISAT)
+#  define nvfcsatt   FNAME(VFCSATT)
+#  define nvfcscat   FNAME(VFCSCAT)
+#  define nvfnatts   FNAME(VFNATTS)
+#  define nvfcfdat   FNAME(VFCFDAT)
+#  define nvfainfo   FNAME(VFAINFO)
+#  define nvfgnatt   FNAME(VFGNATT)
+#  define nvfgcatt   FNAME(VFGCATT)
+#  define nvfgver    FNAME(VFGVER)
+# else  /* PowerStation */
+#  define nvsfcfdx   FNAME(VSFCFDX)
+#  define nvsfcsat   FNAME(VSFCSAT)
+#  define nvsfcsca   FNAME(VSFCSCA)
+#  define nvsfcnats  FNAME(VSFCNATS)
+#  define nvsfcfnas  FNAME(VSFCFNAS)
+#  define nvsfcfda   FNAME(VSFCFDA)
+#  define nvsfcainf  FNAME(VSFCAINF)
+#  define nvsfcgna   FNAME(VSFCGNA)
+#  define nvsfcgca   FNAME(VSFCGCA)
+#  define nvsfcisa   FNAME(VSFCISA)
+#  define nvfcsatt   FNAME(VFCSATT)
+#  define nvfcscat   FNAME(VFCSCAT)
+#  define nvfcnats   FNAME(VFCNATS)
+#  define nvfcfdat   FNAME(VFCFDAT)
+#  define nvfcainf   FNAME(VFCAINF)
+#  define nvfcgnat   FNAME(VFCGNAT)
+#  define nvfcgcat   FNAME(VFCGCAT)
+#  define nvfcgver   FNAME(VFCGVER)
+# endif
+#else       /* !DF_CAPFNAMES  */
+# if !(defined INTEL86) && !(defined WIN32)
+#  define nvsfcfdx   FNAME(vsfcfdx)
+#  define nvsfcsat   FNAME(vsfcsat)
+#  define nvsfcsca   FNAME(vsfcsca)
+#  define nvsfnats   FNAME(vsfnats)
+#  define nvsffnas   FNAME(vsffnas)
+#  define nvsfcfda   FNAME(vsfcfda)
+#  define nvsfainf   FNAME(vsfainf)
+#  define nvsfgnat   FNAME(vsfgnat)
+#  define nvsfgcat   FNAME(vsfgcat)
+#  define nvsfisat   FNAME(vsfisat)
+#  define nvfcsatt   FNAME(vfcsatt)
+#  define nvfcscat   FNAME(vfcscat)
+#  define nvfnatts   FNAME(vfnatts)
+#  define nvfcfdat   FNAME(vfcfdat)
+#  define nvfainfo   FNAME(vfainfo)
+#  define nvfgnatt   FNAME(vfgnatt)
+#  define nvfgcatt   FNAME(vfgcatt)
+#  define nvfgver    FNAME(vfgver)
+# else  /* PowerStation */
+#  define nvsfcfdx   FNAME(vsfcfdx)
+#  define nvsfcsat   FNAME(vsfcsat)
+#  define nvsfcsca   FNAME(vsfcsca)
+#  define nvsfcnats  FNAME(vsfcnats)
+#  define nvsfcfnas  FNAME(vsfcfnas)
+#  define nvsfcfda   FNAME(vsfcfda)
+#  define nvsfcainf  FNAME(vsfcainf)
+#  define nvsfcgna   FNAME(vsfcgna)
+#  define nvsfcgca   FNAME(vsfcgca)
+#  define nvsfcisa   FNAME(vsfcisa)
+#  define nvfcsatt   FNAME(vfcsatt)
+#  define nvfcscat   FNAME(vfcscat)
+#  define nvfcnats   FNAME(vfcnats)
+#  define nvfcfdat   FNAME(vfcfdat)
+#  define nvfcainf   FNAME(vfcainf)
+#  define nvfcgnat   FNAME(vfcgnat)
+#  define nvfcgcat   FNAME(vfcgcat)
+#  define nvfcgver   FNAME(vfcgver)
+# endif
+#endif   /* DF_CAPFNAMES */
+#endif   /* VATTR_FNAMES  */
+   extern   FRETVAL(intf) nvsfcfdx
+            (intf *vsid, _fcd fldnm, intf *findex,
+             intf *fldnmlen);
+   extern   FRETVAL(intf) nvsfcsat
+            (intf *vsid, intf *findex, _fcd attrnm, intf *dtype,
+             intf *count, intf *values, intf *attrnmlen);
+   extern   FRETVAL(intf) nvsfcsca
+            (intf *vsid, intf *findex, _fcd attrnm, intf *dtype,
+             intf *count, _fcd values, intf *attrnmlen);
+   extern   FRETVAL(intf) nvsfnats
+            (intf *vsid);
+   extern   FRETVAL(intf) nvsfcnats
+            (intf *vsid);
+   extern   FRETVAL(intf) nvsffnas
+            (intf *vsid, intf *findex);
+   extern   FRETVAL(intf) nvsfcfnas
+            (intf *vsid, intf *findex);
+   extern   FRETVAL(intf) nvsfcfda
+            (intf *vsid, intf *findex, _fcd attrnm, intf *attrnmlen);
+   extern   FRETVAL(intf) nvsfainf
+            (intf *vsid, intf *findex, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size);
+   extern   FRETVAL(intf) nvsfcainf
+            (intf *vsid, intf *findex, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size);
+   extern   FRETVAL(intf) nvsfgnat
+            (intf *vsid, intf *findex, intf *aindex, intf *values);
+   extern   FRETVAL(intf) nvsfcgna
+            (intf *vsid, intf *findex, intf *aindex, intf *values);
+   extern   FRETVAL(intf) nvsfgcat
+            (intf *vsid, intf *findex, intf *aindex, _fcd values);
+   extern   FRETVAL(intf) nvsfcgca
+            (intf *vsid, intf *findex, intf *aindex, _fcd values);
+   extern   FRETVAL(intf) nvsfisat
+            (intf *vsid);
+   extern   FRETVAL(intf) nvsfcisa
+            (intf *vsid);
+   extern   FRETVAL(intf) nvfcsatt
+            (intf *vgid, _fcd attrnm, intf *dtype,
+             intf *count, intf *values, intf *attrnmlen);
+   extern   FRETVAL(intf) nvfcscat
+            (intf *vgid, _fcd attrnm, intf *dtype, intf *count,
+             _fcd values, intf *attrnmlen);
+   extern   FRETVAL(intf) nvfnatts
+            (intf *vgid);
+   extern   FRETVAL(intf) nvfcnats
+            (intf *vgid);
+   extern   FRETVAL(intf) nvfcfdat
+            (intf *vgid, _fcd attrnm, intf *attrnmlen);
+   extern   FRETVAL(intf) nvfainfo
+            (intf *vgid, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size);
+   extern   FRETVAL(intf) nvfcainf
+            (intf *vgid, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size);
+   extern   FRETVAL(intf) nvfgnatt
+            (intf *vgid, intf *aindex, intf *values);
+   extern   FRETVAL(intf) nvfcgnat
+            (intf *vgid, intf *aindex, intf *values);
+   extern   FRETVAL(intf) nvfgcatt
+            (intf *vgid, intf *aindex, _fcd values);
+   extern   FRETVAL(intf) nvfcgcat
+            (intf *vgid, intf *aindex, _fcd values);
+   extern   FRETVAL(intf) nvfgver
+            (intf *vgid);
+   extern   FRETVAL(intf) nvfcgver
+            (intf *vgid);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* _H_PROTO */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfanpf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfanpf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfanpf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,501 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.1 $";
+#endif
+
+/* $Id: mfanpf.c,v 1.1 1997/05/22 23:21:24 sxu Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * File:     mfanpf.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
+ *  ------------------------------------------
+ *    afistart    - start annotation access on file and return annotaton id
+ *    afifinf - get number of file/data annotations in file. 
+ *                 Indices returned are used in afselect() calls.
+ *    afiend      - end access to annotation handling on file
+ *    aficreat   - create a new data annotation and return a handle
+ *    afifcreat  - create a new file annotation and return a handle
+ *    afiselct   - 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
+ *    afinann   - return number of annotations that match TYPE/tag/ref
+ *    afialst  - return list of handles that match TYPE/tag/ref
+ *    afialen   - get length of annotation given handle
+ *    afiwann - write annotation given handle
+ *    afirann  - read annotation given handle
+ *    afiendac - end access to annotation using handle
+ *    afigtr  - get tag/ref pair to annotation ID
+ *    afiid2tr  - get tag/ref given annotation id 
+ *    afitr2id  - get annotation id given tag/ref
+ *    afitp2tg  - annotation type to corresponding annotation TAG
+ *    afitg2tp  - annotation TAG to corresponding annotation type
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "mfan.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:    afistart
+ * 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)
+nafistart(intf *file_id)
+{
+  intf ret;
+
+  ret = ANstart((int32)*file_id);
+
+  return (ret);
+} /* nafistart() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afifinf
+ * 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)
+nafifinf(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel,
+            intf *num_odesc)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afifinf");
+#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;
+} /* nafifinf() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afiend    
+ * Purpose: End access to annotation handling on file
+ * Inputs:  file_id:
+ * Returns: see ANend()
+ * Users:   Fortran Users
+ * Invokes: ANend()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafiend(intf *an_id)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afiend");
+#endif /* LATER */
+
+  return (intf)ANend((int32) *an_id);
+} /* nafiend() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    aficreat
+ * 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)
+naficreat(intf *an_id, intf *etag, intf *eref, intf *atype)
+{
+#ifdef LATER
+  CONSTR(FUNC, "aficreat");
+#endif /* LATER */
+
+  return (intf)ANcreate((int32)*an_id,(uint16)*etag,(uint16)*eref,(ann_type)*atype);
+} /* naficreat() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afifcreat
+ * 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)
+nafifcreat(intf *an_id, intf *atype)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afifcreat");
+#endif /* LATER */
+
+  return (intf)ANcreatef((int32)*an_id,(ann_type)*atype);
+} /* nafifcreat() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afiselct
+ * 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)
+nafiselct(intf *an_id, intf *index, intf *atype)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afiselct");
+#endif /* LATER */
+
+  return (intf)ANselect((int32)*an_id,(int32)*index, (ann_type)*atype);
+} /* nafiselct() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afinann
+ * 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)
+nafinann(intf *an_id, intf *atype, intf *etag, intf *eref)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afinann");
+#endif /* LATER */
+
+  return (intf)ANnumann((int32)*an_id,(ann_type)*atype,(uint16)*etag,(uint16)*eref);
+} /* nafinann() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afialst
+ * 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)
+nafialst(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[])
+{
+  CONSTR(FUNC, "afialst");
+  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;
+} /* nafialst() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afialen
+ * Purpose: Get length of annotation given handle
+ * Inputs:  an_id:annotation handle
+ * Returns: see ANannlen()
+ * Users:   Fortran Users
+ * Invokes: ANannlen()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafialen(intf *an_id)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afialen");
+#endif /* LATER */
+
+    return (intf)ANannlen((int32)*an_id);
+} /* nafialen() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afiwann
+ * 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)
+nafiwann(intf *ann_id,_fcd ann, intf *annlen)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afiwann");
+#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;
+} /* nafiwann() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afirann
+ * 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)
+nafirann(intf *ann_id,_fcd ann, intf *maxlen)
+{
+    CONSTR(FUNC, "afirann");
+    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;
+} /* nafirann() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afiendac
+ * Purpose: End access to annotation using handle
+ * Inputs:  ann_id:annotation handle
+ * Returns: see ANendaccess()
+ * Users:   Fortran Users
+ * Invokes: ANendaccess()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafiendac(intf *ann_id)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afiendac");
+#endif /* LATER */
+
+  return (intf)ANendaccess((int32)*ann_id);
+} /* nafiendac() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afigtgr 
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANget_tagref()
+ * Users:   Fortran Users
+ * Invokes: ANget_tagref()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafigtr(intf *an_id, intf *index, intf *type, intf *tag, intf *ref)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afigtr");
+#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;
+} /* nafigtr() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afiid2tr
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANid2tagref()
+ * Users:   Fortran Users
+ * Invokes: ANid2tagerf()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafiid2tr(intf *ann_id, intf *tag, intf *ref)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afiid2tr");
+#endif /* LATER */
+  intf   ret;
+  uint16 otag, oref;
+
+  ret = (intf)ANid2tagref((int32)*ann_id, &otag, &oref);
+
+  *tag = otag;
+  *ref = oref;
+
+  return ret;
+} /* nafiid2tr() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afitr2id
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANtagref2id()
+ * Users:   Fortran Users
+ * Invokes: ANtagref2id()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafitr2id(intf *an_id, intf *tag, intf *ref)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afitr2id");
+#endif /* LATER */
+  
+  return (intf)ANtagref2id((int32)*an_id, (uint16)*tag, (uint16)*ref);
+
+} /* nafitr2id() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afitp2tg
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANatype2tag()
+ * Users:   Fortran Users
+ * Invokes: ANatype2tag()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafitp2tg(intf *atype)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afitp2tg");
+#endif /* LATER */
+
+  return (intf)ANatype2tag((ann_type)*atype);
+
+} /* nafitp2tg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afitg2tp
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANtag2atype()
+ * Users:   Fortran Users
+ * Invokes: ANtag2atype()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafitg2tp(intf *tag)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afitg2tp");
+#endif /* LATER */
+
+  return (intf)ANtag2atype((uint16)*tag);
+
+} /* nafitg2tp() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfanpff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfanpff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfanpff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,503 @@
+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 $Id: mfanpff.f,v 1.3 1998/07/20 13:30:20 epourmal Exp $
+C
+C-----------------------------------------------------------------------
+C File:     mfanpff.f
+C Purpose:  Fortran stubs for Fortran PowerStation AN routines
+C Invokes:  mfanpf.c
+C Contents:
+C  afstart    - start annotation access on file and return annotaton id
+C  affileinfo - get number of file/data annotations in file.
+C                 Indices returned are used in afselect() calls.
+C  afend      - end access to annotation handling on file
+C  afcreate   - create a new data annotation and return a handle
+C  affcreate  - create a new file annotation and return a handle
+C  afselect   - returns an annotation handle(ann_id) from index for
+C             a particular annotation TYPE. This handle is then used for
+C              calls like afwriteann(), afreadann(), afannlen(),..etc
+C  afnumann   - return number of annotations that match TYPE/tag/ref
+C  afannlist  - return list of handles that match TYPE/tag/ref
+C  afannlen   - get length of annotation given handle
+C  afwriteann - write annotation given handle
+C  afreadann  - read annotation given handle
+C  afendaccess - end access to annotation using handle
+C  afgettagref - get tag/ref pair to annotation ID
+C  afidtagref  - get tag/ref given annotation id
+C  aftagrefid  - get annotation id given tag/ref
+C  afatypetag  - annotation type to corresponding annotation TAG
+C  aftagatype  - annotation TAG to corresponding annotation type
+C
+C Remarks: none
+C------------------------------------------------------------------
+C----------------------------------------------------------------
+C Name: afstart
+C Purpose: Open file for annoation handling
+C Inputs:  file_id: id of HDF file
+C Returns: annotation interface handle on SUCCEED and FAIL otherwise
+C Users:
+C Invokes:  afistart
+C----------------------------------------------------------------
+
+      integer function afstart(file_id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afstart
+	!MS$endif
+      integer file_id
+C     integer  afistart
+      INTERFACE
+         INTEGER FUNCTION afistart(file_id)
+            !MS$ATTRIBUTES C,reference,alias:'_AFISTART' :: afistart
+            integer file_id
+         END FUNCTION afistart
+      END INTERFACE
+
+      afstart = afistart(file_id)
+      return
+      end
+C----------------------------------------------------------------
+C Name:    affileinfo
+C Purpose: Get number of file/data annotations in file.
+C Inputs:  IN an_id:     annotation interface handle
+C          OUT num_flabel: number of file labels in file
+C          OUT num_fdesc:  number of file descriptions in file
+C          OUT num_olabel: number of data labels in file
+C          OUT num_odesc:  number of data descriptions in file
+C Returns: see ANfileinfo()
+C Users:   Fortran Users
+C Invokes: afifinf()
+C----------------------------------------------------------------
+
+      integer function affileinfo(an_id, num_flabel, num_fdesc,
+     +                 num_olabel, num_odesc)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: affileinfo
+	!MS$endif
+      integer an_id,num_flabel,num_fdesc,num_olabel,num_odesc
+C     integer  afifinf
+      INTERFACE
+         INTEGER FUNCTION afifinf(an_id,n_flable,n_fdesc,
+     +                      n_olabel, n_odesc) 
+            !MS$ATTRIBUTES C,reference,alias:'_AFIFINF' :: afifinf
+            integer an_id, n_flable,n_fdesc,n_olabel, n_odesc
+         END FUNCTION afifinf
+      END INTERFACE
+
+      affileinfo = afifinf(an_id,num_flabel,num_fdesc,
+     +                 num_olabel,num_odesc)
+      return
+      end
+C----------------------------------------------------------------
+C Name: afend
+C Purpose: End access to annotation handling on file
+C Inputs:  file_id:
+C Returns: see ANend()
+C Users:   Fortran Users
+C Invokes: afiend()
+C----------------------------------------------------------------
+
+      integer function afend(an_id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afend
+	!MS$endif
+      integer an_id
+C     integer  afiend
+      INTERFACE
+         INTEGER FUNCTION afiend(an_id)
+            !MS$ATTRIBUTES C,reference,alias:'_AFIEND' :: afiend
+            integer an_id
+         END FUNCTION afiend
+      END INTERFACE
+
+      afend = afiend(an_id)
+      return
+      end
+C----------------------------------------------------------------
+C Name: afcreate
+C Purpose:  Create a new data annotation and return an annotation handle
+C Inputs:
+C          an_id: annotation interface handle
+C          etag:    tag of data to annotate
+C          eref:    ref of data to annotate
+C          atype:   annotation type AN_DATA_LABEL, AN_DATA_DESC
+C Returns: see ANcreate()
+C Users:   Fortran Users
+C Invokes: aficreat()
+C----------------------------------------------------------------
+
+      integer function afcreate(an_id, etag, eref, atype)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afcreate
+	!MS$endif
+      integer an_id, etag, eref, atype
+C     integer  aficreat
+      INTERFACE
+         INTEGER FUNCTION aficreat(an_id, etag, eref, atype)
+            !MS$ATTRIBUTES C,reference,alias:'_AFICREAT' :: aficreat
+            integer an_id, etag, eref, atype
+         END FUNCTION aficreat
+      END INTERFACE
+
+      afcreate = aficreat(an_id, etag, eref, atype)
+      return
+      end
+C----------------------------------------------------------------
+C Name: affcreate
+C Purpose: Create a new file annotation and return an annotation handle
+C Inputs:  an_id: annottion inteface handle
+C          atype:   annotation type AN_FILE_LABEL, AN_DATA_DESC
+C Returns: see ANcreatef()
+C Users:   Fortran Users
+C Invokes: afifcreat()
+C----------------------------------------------------------------
+
+      integer function affcreate(an_id,  atype)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: affcreate
+	!MS$endif
+      integer an_id, atype
+C     integer  afifcreat
+      INTERFACE
+         INTEGER FUNCTION afifcreat(an_id, atype)
+            !MS$ATTRIBUTES C,reference,alias:'_AFIFCREAT' :: afifcreat
+            integer an_id, atype
+         END FUNCTION afifcreat
+      END INTERFACE
+
+      affcreate = afifcreat(an_id, atype)
+      return
+      end
+C---------------------------------------------------------------
+C Name:    afselect
+C Purpose: returns an annotation handle(an_id) from index for
+C          a particular annotation TYPE. This handle is then 
+C          used for calls like afwriteann(), afreadann(), 
+C          afannlen(),..etc
+C Inputs:  an_id: annotation interface handle
+C          index: index for particular annoation type. Usually 
+C                 based on number of a particular type 
+C                 obtained from affileinfo()call. ZERO based.
+C          atype: annotation type AN_FILE_LABEL, AN_FILE_DESC, 
+C                 AN_DATA_LABEL, AN_DATA_DESC
+C Returns: see ANselect()
+C Users:   Fortran Users
+C Invokes: afiselct()
+C----------------------------------------------------------------
+
+      integer function afselect(an_id, index, atype)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afselect
+	!MS$endif
+      integer an_id, index, atype
+C     integer  afiselct
+      INTERFACE
+         INTEGER FUNCTION afiselct(an_id, index, atype)
+            !MS$ATTRIBUTES C,reference,alias:'_AFISELCT' :: afiselct
+            integer an_id, index, atype
+         END FUNCTION afiselct
+      END INTERFACE
+
+      afselect = afiselct(an_id, index, atype)
+      return
+      end
+
+C-------------------------------------------------------------
+C Name:    afnumann
+C Purpose: Return number of annotations that match TYPE/tag/ref
+C Inputs:  an_id: annotation interface handle
+C          atype:   annotation type AN_DATA_LABEL, AN_DATA_DESC
+C          etag:    data tag to match
+C          eref:    data ref to match
+C Returns: see ANnumann()
+C Users:   Fortran Users
+C Invokes: afinann()
+C-------------------------------------------------------------
+      integer function afnumann(an_id, atype, etag, eref)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afnumann
+	!MS$endif
+      integer an_id, atype, etag, eref
+C      integer afinann
+      INTERFACE
+         INTEGER FUNCTION afinann(an_id, atype, etag, eref)
+            !MS$ATTRIBUTES C,reference,alias:'_AFINANN' :: afinann
+            integer an_id, atype, etag, eref
+         END FUNCTION afinann
+      END INTERFACE
+      afnumann = afinann(an_id, atype, etag, eref)
+      return
+      end
+
+C-------------------------------------------------------------
+C Name:    afannlist
+C Purpose: Return list of handles that match TYPE/tag/ref
+C Inputs:  IN an_id: annotation inteface handle
+C          IN atype:   annotation type AN_DATA_LABEL, 
+C                      AN_DATA_DESC
+C          IN etag:    data tag to match
+C          IN eref:    data ref to match
+C          OUT alist[]: list of annotation handles found that 
+C                       match tag/ref
+C Returns: number of annoations found that match else FAIL. 
+C          see ANannlist()
+C Users:   Fortran Users
+C Invokes: anialst
+C-------------------------------------------------------------
+      integer function afannlist(an_id,atype,etag,eref,alist)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afannlist
+	!MS$endif
+      integer an_id, atype, etag, eref, alist(*)
+C      integer afialst
+      INTERFACE
+         INTEGER FUNCTION afialst(an_id,atype,etag,eref,alist)
+            !MS$ATTRIBUTES C,reference,alias:'_AFIALST' :: afialst
+            integer an_id, atype, etag, eref, alist(*)
+         END FUNCTION afialst
+      END INTERFACE
+      afannlist = afialst(an_id, atype, etag, eref,alist)
+      return
+      end
+C-------------------------------------------------------------
+C Name:    afannlen
+C Purpose: Get length of annotation given handle
+C Inputs:  ann_id:annotation handle
+C Returns: see ANannlen()
+C Users:   Fortran Users
+C Invokes: afialen()
+C---------------------------------------------------------------------
+      integer function afannlen(ann_id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afannlen
+	!MS$endif
+      integer ann_id
+C      integer afialen
+      INTERFACE
+         INTEGER FUNCTION afialen(ann_id)
+            !MS$ATTRIBUTES C,reference,alias:'_AFIALEN' :: afialen
+            integer ann_id
+         END FUNCTION afialen
+      END INTERFACE
+      afannlen = afialen(ann_id)
+      return
+      end
+C--------------------------------------------------------------
+C Name:    afwriteann
+C Purpose: Write annotation given handle
+C Inputs:  ann_id: annotation handle
+C          ann:   annotation to write out
+C          annlen:length of annotation
+C Returns: see ANwriteann()
+C Users:   Fortran Users
+C Invokes: aniwann()
+C--------------------------------------------------------------
+      integer function afwriteann(ann_id,ann,annlen)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afwriteann
+	!MS$endif
+      integer ann_id, annlen
+      character*(*) ann
+C      integer afiwann
+      INTERFACE
+         INTEGER FUNCTION afiwann(ann_id, ann, annlen)
+            !MS$ATTRIBUTES C,reference,alias:'_AFIWANN' :: afiwann
+   	      !DEC$ ATTRIBUTES reference :: ann
+            integer ann_id, annlen
+            character*(*) ann
+         END FUNCTION afiwann
+      END INTERFACE
+      afwriteann = afiwann(ann_id, ann, annlen)
+      return
+      end
+
+C--------------------------------------------------------------
+C Name:    afreadann
+C Purpose: Read annotation given handle
+C Inputs:  ann_id: annotation handle
+C          ann:   annotation read
+C          maxlen:maximum space allocated for "ann" 
+C Returns: see ANreadann(), SUCCEED (0) if successful, else FAIL
+C Users:   Fortran Users
+C Invokes: anirann()
+C--------------------------------------------------------------
+      integer function afreadann(ann_id,ann,maxlen)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afreadann
+	!MS$endif
+      integer ann_id, maxlen
+      character*(*) ann
+C      integer afirann
+      INTERFACE
+         INTEGER FUNCTION afirann(ann_id, ann, maxlen)
+            !MS$ATTRIBUTES C,reference,alias:'_AFIRANN' :: afirann
+	      !DEC$ ATTRIBUTES reference :: ann
+            integer ann_id, maxlen
+            character*(*) ann
+         END FUNCTION afirann
+      END INTERFACE
+      afreadann = afirann(ann_id, ann, maxlen)
+      return
+      end
+C-------------------------------------------------------------
+C Name:    afendaccess
+C Purpose: End access to annotation using handle
+C Inputs:  ann_id:annotation handle
+C Returns: see ANendaccess()
+C Users:   Fortran Users
+C Invokes: aniendac()
+C------------------------------------------------------------
+      integer function afendaccess(ann_id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afendaccess
+	!MS$endif
+      integer ann_id
+C      integer afiendac
+      INTERFACE
+         INTEGER FUNCTION afiendac(ann_id)
+            !MS$ATTRIBUTES C,reference,alias:'_AFIENDAC' :: afiendac
+            integer ann_id
+         END FUNCTION afiendac
+      END INTERFACE
+      afendaccess = afiendac(ann_id)
+      return
+      end
+
+C------------------------------------------------------------
+C Name:    afgettagref
+C Purpose: get tag/ref pair to annotation ID
+C Inputs: int32 an_id  IN: annotation interface ID 
+C         int32 index  IN: index of annottion to get tag/ref for
+C         ann_type type IN: AN_DATA_LABEL for data labels,
+C                           AN_DATA_DESC for data descriptions,
+C                           AN_FILE_LABEL for file labels,
+C                           AN_FILE_DESC for file descritpions.
+C         uint16 *tag  OUT: Tag for annotation 
+C         uint16 *ref  OUT: ref for annotation 
+C Returns: see ANget_tagref(), tag/ref pair
+C Users:   Fortran Users
+C Invokes: afigtr
+C-----------------------------------------------------------
+      integer function afgettagref(an_id,index,type,tag,ref)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afgettagref
+	!MS$endif
+      integer an_id,index,type,tag,ref
+C      integer afigtr
+      INTERFACE
+         INTEGER FUNCTION afigtr(an_id,index,type,tag,ref)
+            !MS$ATTRIBUTES C,reference,alias:'_AFIGTR' :: afigtr
+            integer an_id,index,type,tag,ref
+         END FUNCTION afigtr
+      END INTERFACE
+      afgettagref = afigtr(an_id,index,type,tag,ref)
+      return
+      end
+C-----------------------------------------------------------
+C Name:    afidtagref
+C Purpose: get tag/ref given annotation id
+C Inputs: int32 ann_id IN: annotation id 
+C            uint16 *tag OUT: Tag for annotation 
+C            uint16 *ref OUT: ref for annotation 
+C Returns: see ANid2tagref(),SUCCEED(0) if successful 
+C              and FAIL (-1) otherwise
+C Users:   Fortran Users
+C Invokes: afiid2tr()
+C------------------------------------------------------------
+      integer function afidtagref(ann_id,tag,ref)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afidtagref
+	!MS$endif
+      integer ann_id,tag,ref
+C      integer afiid2tr
+      INTERFACE
+         INTEGER FUNCTION afiid2tr(ann_id,tag,ref)
+            !MS$ATTRIBUTES C,reference,alias:'_AFIID2TR' :: afiid2tr
+            integer ann_id,tag,ref
+         END FUNCTION afiid2tr
+      END INTERFACE
+      afidtagref = afiid2tr(ann_id,tag,ref)
+      return
+      end
+C-----------------------------------------------------------
+C Name:    aftagrefid
+C Purpose: get annotation id given tag/ref
+C Inputs: int32 an_id   IN  Annotation interface id 
+C            uint16 ann_tag IN: Tag for annotation
+C            uint16 ann_ref IN: ref for annotation 
+C Returns: see ANtagref2id(),annotation id if succeed, 
+C             FAIL otherwise.
+C Users:   Fortran Users
+C Invokes: afitr2id()
+C------------------------------------------------------------
+      integer function aftagrefid(an_id,tag,ref)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: aftagrefid
+	!MS$endif
+      integer an_id,tag,ref
+C      integer afitr2id
+      INTERFACE
+         INTEGER FUNCTION afitr2id(an_id,tag,ref)
+            !MS$ATTRIBUTES C,reference,alias:'_AFITR2ID' :: afitr2id
+            integer an_id,tag,ref
+         END FUNCTION afitr2id
+      END INTERFACE
+      aftagrefid = afitr2id(an_id,tag,ref)
+      return
+      end
+
+C-----------------------------------------------------------
+C Name:    afatypetag
+C Purpose: Translate annotation type to corresponding TAG.
+C Inputs: integer atype   IN  Annotation type 
+C Returns: see ANtype2tag(), TAG corresponding to anno type.
+C Users:   Fortran Users
+C Invokes: afitp2tg()
+C------------------------------------------------------------
+      integer function afatypetag(atype)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: afatypetag
+	!MS$endif
+      integer atype
+C      integer afitp2tg
+      INTERFACE
+         INTEGER FUNCTION afitp2tg(atype)
+            !MS$ATTRIBUTES C,reference,alias:'_AFITP2TG' :: afitp2tg
+            integer atype
+         END FUNCTION afitp2tg
+      END INTERFACE
+      afatypetag = afitp2tg(atype)
+      return
+      end
+C-----------------------------------------------------------
+C Name:    aftagatype
+C Purpose: anno TAG to corresponding anno type
+C Inputs: int32 tag   IN  Annotation TAG
+C Returns: see ANtag2atype(),TAG id if succeed, 
+C             FAIL otherwise.
+C Users:   Fortran Users
+C Invokes: afitg2tp()
+C------------------------------------------------------------
+      integer function aftagatype(tag)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: aftagatype
+	!MS$endif
+      integer tag
+C      integer afitg2tp
+      INTERFACE
+         INTEGER FUNCTION afitg2tp(tag)
+            !MS$ATTRIBUTES C,reference,alias:'_AFITG2TP' :: afitg2tp
+            integer tag
+         END FUNCTION afitg2tp
+      END INTERFACE
+      aftagatype = afitg2tp(tag)
+      return
+      end

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfgrpf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfgrpf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfgrpf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1202 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.4 $";
+#endif
+
+/* $Id: mfgrpf.c,v 1.4 2000/08/01 20:51:51 epourmal Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    mfgrpf.c, based on mfgrf.c,v 1.7
+ * Purpose: C stubs for Fortran PowerStation GR routines
+ * Invokes: mfgr.c
+ * Contents:
+ *  mgistrt:    Call GRstart to initialize the GR interface for a file
+ *  mgifinf:    Call GRfileinfo for information about the file
+ *  mgiend:     Call GRend to close down the GR interface to a file
+ *  mgicreat:    Call GRcreate to create a raster image
+ *  mgislct:    Call GRselect to select an existing raster image for I/O
+ *  mgin2ndx:    Call GRnametoindex to map an image's name into a index in a file
+ *  mgigiinf:    Call GRgetiminfo to get information about an image 
+ *  mgiwimg:    Call GRwriteimage to write image data to the file
+ *  mgirimg:    Call GRreadimage to read image data from the file
+ *  mgiendac:    Call GRendaccess to end access to a raster image
+ *  mgigdid:     Call GRgetdimid to get a dimension ID for an image 
+ *                [Later]
+ *  mgisdnam:    Call GRsetdimname to set a dimension's name [Later]
+ *  mgigdinf:    Call GRgetdiminfo to get information about a dimension [Later]
+ *  mgiid2r:    Call GRidtoref to map an RI ID into a ref. # for annotating
+ *  mgir2dx:    Call GRreftoindex to map a ref. # into an index for the image
+ *  mgiltil:    Call GRreqlutil to request the interlace of the next LUT read
+ *  mgiimil:    Call GRreqimageil to request the interlace of the next image read
+ *  mgiglid:    Call GRgetlutid to get a palette ID for an image
+ *  mgilinf:    Call GRgetlutinfo to get information about a palette
+ *  mgiwrlt:    Call GRwritelut to write a palette to the file
+ *  mgiwclt:    Call GRwritelut to write a character palette to the file
+ *  mgirdlt:    Call GRreadlut to read a palette from the file
+ *  mgirclt:    Call GRreadlut to read a character palette from the file
+ *  mgisxfil:    Call GRsetexternalfile to move an image into an external file
+ *  mgiactp:    Call GRsetaccesstype to set the access type for an image
+ *  mgiscomp:    Call GRsetcompress to compress an image in the file [Later]
+ *  mgisattr:    Call GRsetattr to write an attribute for an object
+ *  mgiscatt:   Call GRsetattr to write a char attribute for an obj.
+ *  mgiainf:    Call GRattrinfo get information about an attribute
+ *  mgigcat:    Call GRgetattr to read a char attribute from the file
+ *  mgignat:    Call GRgetattr to read a numeric attribute from the file
+ *  mgigatt:    Call GRgetattr to read an attribute from the file
+ *  mgifndat:    Call GRfindattr to get the index of an attribute for a name
+ * Remarks: 
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "mfgr.h"
+
+/* Local pre-processor macros */
+#define XDIM    0
+#define YDIM    1
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgistrt
+ * 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:   mgstart
+ * Invokes: GRstart
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgistrt(intf * fid)
+{
+    return((intf)GRstart((int32)*fid));
+}   /* end mgistrt() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgifinf
+ * 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:   mgfinfo
+ * Invokes: GRfileinfo
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgifinf(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 mgifinf() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiend
+ * 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:   mgend
+ * Invokes: GRend
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiend(intf * grid)
+{
+    return((intf)GRend((int32)*grid));
+}   /* end mgiend() */
+
+/*-----------------------------------------------------------------------------
+ * 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:   mgcreat
+ * 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:    mgislct
+ * 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:   mgselct
+ * Invokes: GRselect
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgislct(intf * grid, intf *index)
+{
+    return((intf)GRselect((int32)*grid,(int32)*index));
+}   /* end mgislct() */
+
+/*-----------------------------------------------------------------------------
+ * 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:   mgn2ndx
+ * 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:    mgigiinf
+ * 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:   mggiimf
+ * Invokes: GRgetiminfo
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgigiinf(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 mgigiinf() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiwcim
+ * 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:   mgwcimg
+ * Invokes: GRwriteimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiwcim(intf * riid, intf *start, intf *stride, intf *count, _fcd data)
+{
+    return(nmgiwimg(riid, start, stride, count, (VOIDP)_fcdtocp(data)));
+}   /* end mgiwcim() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiwimg
+ * 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:   mgiwcim, mgwrimg
+ * Invokes: GRwriteimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiwimg(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 mgiwimg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgircim
+ * 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:   mgrcimg
+ * Invokes: GRreadimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgircim(intf * riid, intf *start, intf *stride, intf *count, _fcd data)
+{
+    return(nmgirimg(riid,start,stride,count,(VOIDP)_fcdtocp(data)));
+}   /* end mgircim() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgirimg
+ * 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:   mgircim, mgrdimg
+ * Invokes: GRreadimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgirimg(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 mgirimg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiendac
+ * 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:   mgendac
+ * Invokes: GRendaccess
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiendac(intf * riid)
+{
+    return((intf)GRendaccess((int32)*riid));
+}   /* end mgiendac() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiid2r
+ * 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)
+nmgiid2r(intf * riid)
+{
+    return((intf)GRidtoref((int32)*riid));
+}   /* end mgiid2r() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgir2dx
+ * 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)
+nmgir2dx(intf * grid, intf *ref)
+{
+    return((intf)GRreftoindex((int32)*grid,(uint16)*ref));
+}   /* end mgir2dx() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiltil
+ * 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:   mgrltil
+ * Invokes: GRreqlutil
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiltil(intf * riid, intf *il)
+{
+    return((intf)GRreqlutil((int32)*riid,(intn)*il));
+}   /* end mgiltil() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiimil
+ * 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:   mgrimil
+ * Invokes: GRreqimageil
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiimil(intf * riid, intf *il)
+{
+    return((intf)GRreqimageil((int32)*riid,(intn)*il));
+}   /* end mgiimil() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiglid
+ * 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:   mggltid
+ * Invokes: GRgetlutid
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiglid(intf * riid, intf *lut_index)
+{
+    return((intf)GRgetlutid((int32)*riid,(intn)*lut_index));
+}   /* end mgiglid() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiglinf
+ * 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:   mgglinf
+ * Invokes: GRgetlutinfo
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiglinf(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 mgiglinf() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiwclt
+ * 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:   mgwclut
+ * Invokes: GRwritelut
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiwclt(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 mgiwclt() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiwrlt
+ * 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:   mgwrlut
+ * Invokes: GRwritelut
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiwrlt(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 mgiwrlt() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgirclt
+ * 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:   mgrclut
+ * Invokes: GRreadlut
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgirclt(intf * lutid, _fcd data)
+{
+    return((intf)GRreadlut((int32)*lutid,(VOIDP)_fcdtocp(data)));
+}   /* end mgirclt() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgirdlt
+ * 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:   mgrdlut
+ * Invokes: GRreadlut
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgirdlt(intf * lutid, VOIDP data)
+{
+    return((intf)GRreadlut((int32)*lutid,data));
+}   /* end mgirdlt() */
+
+/*-----------------------------------------------------------------------------
+ * 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:   mgsxfil
+ * 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:    mgiactp
+ * 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:   mgsactp
+ * Invokes: GRsetaccesstype
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiactp(intf * riid, intf *accesstype)
+{
+    return((intf)GRsetaccesstype((int32)*riid,(uintn)*accesstype));
+}   /* end mgiactp() */
+
+/*-----------------------------------------------------------------------------
+ * 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:    mgiainf
+ * 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:   mgainf
+ * Invokes: GRattrinfo
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgiainf(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 mgiainf() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgigcat
+ * Purpose: Call mgignat 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)
+nmgigcat(intf * riid, intf *index, _fcd data)
+{
+    return(nmgignat(riid, index, (VOIDP) _fcdtocp(data)));
+}   /* end mgigcat() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgignat
+ * 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:   mgigcat, mggnatt
+ * Invokes: GRgetattr
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgignat(intf * riid, intf *index, VOIDP data)
+{
+    return((intf)GRgetattr((int32)*riid,(int32)*index,data));
+}   /* end mgignat() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgigattr
+ * 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:   mggattr
+ * Invokes: GRgetattr
+ * Remarks: This routine is replaced by mggcatt and mggmatt
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgigatt(intf * riid, intf *index, VOIDP data)
+{
+    return((intf)GRgetattr((int32)*riid,(int32)*index,data));
+}   /* end mgigatt() */
+
+/*-----------------------------------------------------------------------------
+ * 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:   mgfndat
+ * 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               */
+comp_info cinfo;          /* compression info     */
+int   i;
+int32 rank, status, cflags, comp_type;
+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;
+            
+  }
+
+
+}   
+//#if 0 /* Commented out for now  -EIP 12/29/97 */ 
+/*-----------------------------------------------------------------------------
+ * 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, status, 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);
+
+} 
+
+//#endif /*Commented out for now -EIP 12/29/97 */
+/*-----------------------------------------------------------------------------
+ * 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          */
+comp_info cinfo;          /* compression info     */
+int   i, CASE;
+int32 rank, status;
+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);
+
+}   
+//#if 0 /* Commented out for now  -EIP 12/29/97 */ 
+/*-----------------------------------------------------------------------------
+ * 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, status, 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);
+
+} 
+//#endif /*Commented out for now -EIP 12/29/97 */
+/*-------------------------------------------------------------------------
+ * 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    = 6 
+ *          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     */
+int32 c_type;              /* compression type definition */
+
+int   i, 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);
+
+}   

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfgrpff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfgrpff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/mfgrpff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1027 @@
+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 $Id: mfgrpff.f,v 1.5 2000/08/01 20:51:51 epourmal Exp $
+C
+C------------------------------------------------------------------------------
+C File:     mfgrpff.f
+C Purpose:  Fortran stubs for Fortran PowerStation GR routines
+C Invokes:  mfgrpf.c
+C Contents: 
+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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgcreat 
+	!MS$endif
+      character*(*) name
+      integer grid, ncomp, nt, il, dimsizes
+C     integer  mgicreat
+      INTERFACE 
+         INTEGER FUNCTION mgicreat(grid,name,ncomp,nt,il,dimsizes,
+     +                             nmlen)
+            !MS$ATTRIBUTES C,reference,alias:'_MGICREAT' :: mgicreat
+	      !DEC$ ATTRIBUTES reference :: name
+            integer grid, ncomp,nt,il,dimsizes, nmlen
+            character*(*) name
+         END FUNCTION mgicreat
+      END INTERFACE
+ 
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgn2ndx
+	!MS$endif
+      character*(*) name
+      integer grid
+C     integer mgin2ndx
+      INTERFACE
+        INTEGER FUNCTION mgin2ndx(grid,name,nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIN2NDX' :: mgin2ndx
+	    !DEC$ ATTRIBUTES reference :: name
+          integer grid, nmlen
+          character*(*) name
+        END FUNCTION mgin2ndx
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgsxfil
+	!MS$endif
+      character*(*) filename
+      integer riid, offset
+C      integer mgisxfil
+      INTERFACE
+        INTEGER FUNCTION mgisxfil(riid,filename,offset, nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_MGISXFIL' :: mgisxfil
+	    !DEC$ ATTRIBUTES reference :: filename
+          integer riid, offset, nmlen
+          character*(*) filename
+        END FUNCTION mgisxfil
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgscatt
+	!MS$endif
+      character*(*) name
+      character*(*) data
+      integer riid, nt, count
+C      integer mgiscatt
+      INTERFACE
+        INTEGER FUNCTION mgiscatt(riid,name,nt,count,data,
+     +                             nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_MGISCATT' :: mgiscatt
+	    !DEC$ ATTRIBUTES reference :: name, data
+          integer riid,nt,count, nmlen
+          character*(*) name, data
+         END FUNCTION mgiscatt
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgsnatt
+	!MS$endif
+      character*(*) name
+      integer data
+      integer riid, nt, count
+C      integer mgisattr
+      INTERFACE
+        INTEGER FUNCTION mgisattr(riid,name,nt,count,data,
+     +                             nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_MGISATTR' :: mgisattr
+	    !DEC$ ATTRIBUTES reference :: name
+          integer riid, nt,count,data, nmlen
+          character*(*) name
+        END FUNCTION mgisattr
+      END INTERFACE
+
+      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-------------------------------------------------------------
+
+C      integer function mgsattr(riid, name, nt, count, data)
+C	!MS$if defined(BUILD_HDF_DLL)
+C	!MS$attributes dllexport :: mgsattr
+C	!MS$endif
+C      character*(*) name
+C      character*(*) data
+C      integer riid, nt, count
+C      integer mgisattr
+C      INTERFACE
+C        INTEGER FUNCTION mgisattr(riid,name,nt,count,data,
+C     +                             nmlen)
+C          !MS$ATTRIBUTES C,reference,alias:'_MGISATTR' :: mgisattr
+C  	     !DEC$ ATTRIBUTES reference :: name, data
+C          integer riid, nt,count, nmlen
+C          character*(*) name, data
+C        END FUNCTION mgisattr
+C      END INTERFACE
+
+C      mgsattr = mgisattr(riid, name, nt, count, data, len(name))
+C      return
+C      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgfndat
+	!MS$endif
+      character*(*) name
+      integer riid
+C      integer mgifndat
+      INTERFACE
+        INTEGER FUNCTION mgifndat(riid,name,nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIFNDAT' :: mgifndat
+	    !DEC$ ATTRIBUTES reference :: name
+          integer riid, nmlen
+          character*(*) name
+        END FUNCTION mgifndat
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mggichnk
+	!MS$endif
+
+         INTEGER riid, dim_length(*), comp_type
+C         INTEGER mgcgichnk 
+      INTERFACE
+        INTEGER FUNCTION mgcgichnk(riid, dim_length, comp_type)
+          !MS$ATTRIBUTES C,reference,alias:'_MGCGICHNK' :: mgcgichnk
+          integer riid, dim_length(*), comp_type
+        END FUNCTION mgcgichnk
+      END INTERFACE
+
+         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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgrcchnk
+	!MS$endif
+         INTEGER riid, start(*)
+         CHARACTER*(*) char_data(*)
+C         INTEGER mgcrcchnk 
+      INTERFACE
+        INTEGER FUNCTION mgcrcchnk(riid, start, char_data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGCRCCHNK' :: mgcrcchnk
+          integer riid, start(*)
+	    CHARACTER*(*) char_data(*)
+        END FUNCTION mgcrcchnk
+      END INTERFACE
+         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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgrchnk
+	!MS$endif
+         INTEGER riid, start(*), num_data(*)
+C         INTEGER mgcrchnk 
+      INTERFACE
+        INTEGER FUNCTION mgcrchnk(riid, start, num_data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGCRCHNK' :: mgcrchnk
+          integer riid, start(*), num_data(*)
+        END FUNCTION mgcrchnk
+      END INTERFACE
+         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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgscchnk
+	!MS$endif
+C
+         INTEGER riid, maxcache, flags 
+C         INTEGER mgcscchnk 
+      INTERFACE
+        INTEGER FUNCTION mgcscchnk(riid,name,nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_MGCSCCHNK' :: mgcscchnk
+          integer riid, maxcache, flags
+        END FUNCTION mgcscchnk
+      END INTERFACE
+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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgschnk
+	!MS$endif
+
+         INTEGER riid, dim_length(*), comp_type, comp_prm(*)
+C         INTEGER mgcschnk 
+      INTERFACE
+        INTEGER FUNCTION mgcschnk(riid, dim_length, comp_type, comp_prm)
+          !MS$ATTRIBUTES C,reference,alias:'_MGCSCHNK' :: mgcschnk
+          integer riid, dim_length(*), comp_type, comp_prm(*)
+        END FUNCTION mgcschnk
+      END INTERFACE
+
+         mgschnk = mgcschnk(riid, dim_length, comp_type,
+     .                      comp_prm)
+         return
+         end
+
+C---------------------------------------------------------------
+      integer function mgstart(fid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgstart
+	!MS$endif
+        integer fid
+C        integer mgistrt
+      INTERFACE
+        INTEGER FUNCTION mgistrt(fid)
+          !MS$ATTRIBUTES C,reference,alias:'_MGISTRT' :: mgistrt
+          integer fid
+        END FUNCTION mgistrt
+      END INTERFACE
+     
+      mgstart = mgistrt(fid)
+      return
+      end
+C------------------------------------------------------------------
+     
+      integer function mgfinfo(grid,datasets,attrs)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgfinfo
+	!MS$endif
+        integer grid, datasets,attrs
+C        integer mgifinf
+      INTERFACE
+        INTEGER FUNCTION mgifinf(grid,datasets,attrs)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIFINF' :: mgifinf
+          integer grid,datasets,attrs
+        END FUNCTION mgifinf
+      END INTERFACE
+     
+      mgfinfo = mgifinf(grid, datasets, attrs)
+      return
+      end
+C------------------------------------------------------------------
+     
+      integer function mgend(grid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgend
+	!MS$endif
+        integer grid
+C        integer mgiend
+      INTERFACE
+        INTEGER FUNCTION mgiend(grid)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIEND' :: mgiend
+          integer grid
+        END FUNCTION mgiend
+      END INTERFACE
+     
+      mgend = mgiend(grid)
+      return
+      end
+C------------------------------------------------------------------
+     
+      integer function mgselct(grid,index)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgselct
+	!MS$endif
+        integer grid, index
+C        integer mgislct
+      INTERFACE
+        INTEGER FUNCTION mgislct(grid,index)
+          !MS$ATTRIBUTES C,reference,alias:'_MGISLCT' :: mgislct
+          integer grid,index
+        END FUNCTION mgislct
+      END INTERFACE
+     
+      mgselct = mgislct(grid, index)
+      return
+      end
+C------------------------------------------------------------------
+     
+      integer function mggiinf(riid,name,ncomp,nt,il,dimsizes,attrs)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mggiinf
+	!MS$endif
+        integer riid, ncomp,nt,il,dimsizes,attrs
+        character*(*) name
+C        integer mgigiinf
+      INTERFACE
+        INTEGER FUNCTION mgigiinf(riid,name,ncomp,nt,il,
+     +                            dimsizes,attrs)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIGIINF' :: mgigiinf
+	    !DEC$ ATTRIBUTES reference :: name
+          integer riid,ncomp,nt,il,dimsizes,attrs
+          character*(*) name
+        END FUNCTION mgigiinf
+      END INTERFACE
+     
+      mggiinf = mgigiinf(riid,name,ncomp,nt,il,dimsizes,attrs)
+      return
+      end
+C------------------------------------------------------------------
+    
+      integer function mgwcimg(riid,start,stride,count,cdata)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgwcimg
+	!MS$endif
+        integer riid, start,stride,count
+        character*(*) cdata
+C        integer mgiwcim
+      INTERFACE
+        INTEGER FUNCTION mgiwcim(riid,start,stride,count,
+     +                            cdata)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIWCIM' :: mgiwcim
+	    !DEC$ ATTRIBUTES reference :: cdata
+          integer riid,start,stride,count
+          character*(*) cdata
+        END FUNCTION mgiwcim
+      END INTERFACE
+
+      mgwcimg = mgiwcim(riid,start,stride,count,cdata)
+      return
+      end
+C------------------------------------------------------------------
+    
+      integer function mgwrimg(riid,start,stride,count,data)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgwrimg
+	!MS$endif
+        integer riid, start,stride,count,data
+C        integer mgiwimg
+      INTERFACE
+        INTEGER FUNCTION mgiwimg(riid,start,stride,count,
+     +                            data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIWIMG' :: mgiwimg
+          integer riid,start,stride,count,data
+        END FUNCTION mgiwimg
+      END INTERFACE
+
+      mgwrimg = mgiwimg(riid,start,stride,count,data)
+      return
+      end
+
+C------------------------------------------------------------------
+    
+      integer function mgrcimg(riid,start,stride,count,cdata)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgrcimg 
+	!MS$endif
+        integer riid, start,stride,count
+        character*(*) cdata
+C        integer mgircim
+      INTERFACE
+        INTEGER FUNCTION mgircim(riid,start,stride,count,
+     +                            cdata)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIRCIM' :: mgircim
+	    !DEC$ ATTRIBUTES reference :: cdata
+          integer riid,start,stride,count
+          character*(*) cdata
+        END FUNCTION mgircim
+      END INTERFACE
+
+      mgrcimg = mgircim(riid,start,stride,count,cdata)
+      return
+      end
+C------------------------------------------------------------------
+    
+      integer function mgrdimg(riid,start,stride,count,data)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgrdimg
+	!MS$endif
+        integer riid, start,stride,count,data
+C        integer mgirimg
+      INTERFACE
+        INTEGER FUNCTION mgirimg(riid,start,stride,count,
+     +                            data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIRIMG' :: mgirimg
+          integer riid,start,stride,count,data
+        END FUNCTION mgirimg
+      END INTERFACE
+
+      mgrdimg = mgirimg(riid,start,stride,count,data)
+      return
+      end
+
+C------------------------------------------------------------------
+    
+      integer function mgendac(riid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgendac
+	!MS$endif
+        integer riid
+C        integer mgiendac
+      INTERFACE
+        INTEGER FUNCTION mgiendac(riid)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIENDAC' :: mgiendac
+          integer riid
+        END FUNCTION mgiendac
+      END INTERFACE
+
+      mgendac = mgiendac(riid)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgid2rf(riid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgid2rf
+	!MS$endif
+        integer riid
+C        integer mgiid2r
+      INTERFACE
+        INTEGER FUNCTION mgiid2r(riid)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIID2R' :: mgiid2r
+          integer riid
+        END FUNCTION mgiid2r
+      END INTERFACE
+
+      mgid2rf = mgiid2r(riid)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgr2idx(grid, ref)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgr2idx
+	!MS$endif
+        integer grid, ref
+C        integer mgir2dx
+      INTERFACE
+        INTEGER FUNCTION mgir2dx(grid,ref)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIR2DX' :: mgir2dx
+          integer grid, ref
+        END FUNCTION mgir2dx
+      END INTERFACE
+
+      mgr2idx = mgir2dx(grid, ref)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgrltil(riid, il)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgrltil
+	!MS$endif
+        integer riid, il
+C        integer mgiltil
+      INTERFACE
+        INTEGER FUNCTION mgiltil(riid, il)
+          !MS$ATTRIBUTES C,reference,alias:'_MGILTIL' :: mgiltil
+          integer riid, il
+        END FUNCTION mgiltil
+      END INTERFACE
+
+      mgrltil = mgiltil(riid, il)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgrimil(riid, il)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgrimil
+	!MS$endif
+        integer riid, il
+C        integer mgiimil
+      INTERFACE
+        INTEGER FUNCTION mgiimil(riid, il)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIIMIL' :: mgiimil
+          integer riid, il
+        END FUNCTION mgiimil
+      END INTERFACE
+
+      mgrimil = mgiimil(riid, il)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mggltid(riid, lut_index)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mggltid
+	!MS$endif
+        integer riid, lut_index
+C        integer mgiglid
+      INTERFACE
+        INTEGER FUNCTION mgiglid(riid, lut_index)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIGLID' :: mgiglid
+          integer riid, lut_index
+        END FUNCTION mgiglid
+      END INTERFACE
+
+      mggltid = mgiglid(riid, lut_index)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgglinf(lutid,ncomp,nt,il,nentries)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgglinf
+	!MS$endif
+        integer lutid,ncomp,nt,il,nentries
+C        integer mgiglinf
+      INTERFACE
+        INTEGER FUNCTION mgiglinf(lutid,ncomp,nt,il,nentries)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIGLINF' :: mgiglinf
+          integer lutid, ncomp, nt, il, nentries
+        END FUNCTION mgiglinf
+      END INTERFACE
+
+      mgglinf = mgiglinf(lutid,ncomp,nt,il,nentries)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgwclut(lutid,ncomp,nt,il,nentries,cdata)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgwclut
+	!MS$endif
+        integer lutid,ncomp,nt,il,nentries
+        character*(*) cdata
+C        integer mgiwclt
+      INTERFACE
+        INTEGER FUNCTION mgiwclt(lutid,ncomp,nt,il,nentries,cdata)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIWCLT' :: mgiwclt
+	    !DEC$ ATTRIBUTES reference :: cdata
+          integer lutid, ncomp, nt, il, nentries
+          character*(*) cdata
+        END FUNCTION mgiwclt
+      END INTERFACE
+
+      mgwclut = mgiwclt(lutid,ncomp,nt,il,nentries,cdata)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgwrlut(lutid,ncomp,nt,il,nentries,data)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgwrlut
+	!MS$endif
+        integer lutid,ncomp,nt,il,nentries, data
+C        integer mgiwrlt
+      INTERFACE
+        INTEGER FUNCTION mgiwrlt(lutid,ncomp,nt,il,nentries,data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIWRLT' :: mgiwrlt
+          integer lutid, ncomp, nt, il, nentries, data
+        END FUNCTION mgiwrlt
+      END INTERFACE
+
+      mgwrlut = mgiwrlt(lutid,ncomp,nt,il,nentries,data)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgrclut(lutid,cdata)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgrclut
+	!MS$endif
+        integer lutid
+        character*(*) cdata
+C        integer mgirclt
+      INTERFACE
+        INTEGER FUNCTION mgirclt(lutid,cdata)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIRCLT' :: mgirclt
+	    !DEC$ ATTRIBUTES reference :: cdata
+          integer lutid
+          character*(*) cdata
+        END FUNCTION mgirclt
+      END INTERFACE
+
+      mgrclut = mgirclt(lutid,cdata)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgrdlut(lutid,data)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgrdlut
+	!MS$endif
+        integer lutid, data
+C        integer mgirdlt
+      INTERFACE
+        INTEGER FUNCTION mgirdlt(lutid,data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIRDLT' :: mgirdlt
+          integer lutid, data
+        END FUNCTION mgirdlt
+      END INTERFACE
+
+      mgrdlut = mgirdlt(lutid,data)
+      return
+      end
+C------------------------------------------------------------------
+   
+      integer function mgsactp(riid,acctype)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgsactp
+	!MS$endif
+        integer riid, acctype
+C        integer mgiactp
+      INTERFACE
+        INTEGER FUNCTION mgiactp(riid,acctype)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIACTP' :: mgiactp
+          integer riid,acctype
+        END FUNCTION mgiactp
+      END INTERFACE
+
+      mgsactp = mgiactp(riid,acctype)
+      return
+      end
+C------------------------------------------------------------------
+
+      integer function mgatinf(riid,index,name,nt,count)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgatinf
+	!MS$endif
+        integer riid, index,nt,count
+        character*(*) name
+C        integer mgiainf
+      INTERFACE
+        INTEGER FUNCTION mgiainf(riid,index,name,nt,count)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIAINF' :: mgiainf
+	    !DEC$ ATTRIBUTES reference :: name
+          integer riid,index,nt,count
+          character*(*) name
+        END FUNCTION mgiainf
+      END INTERFACE
+
+      mgatinf = mgiainf(riid,index,name,nt,count)
+      return
+      end
+
+C-------------------------------------------------------------
+C Name: mggcatt
+C Purpose:  Get a char type attribute of a raster image
+C Inputs:   
+C       riid: RI ID of image
+C       index: the index of the attribute
+C       cdata: buffer to hold the data of the attribute
+C Returns: SUCCEED/FAIL
+C Users:    HDF Fortran programmers
+C Invokes: mgigcat
+C-------------------------------------------------------------
+
+      integer function mggcatt(riid, index, cdata)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mggcatt
+	!MS$endif
+      integer riid, index
+      character*(*) cdata
+C      integer mgigcat
+      INTERFACE
+        INTEGER FUNCTION mgigcat(riid,index,cdata)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIGCAT' :: mgigcat
+	    !DEC$ ATTRIBUTES reference :: cdata
+          integer riid,index
+          character*(*)  cdata
+         END FUNCTION mgigcat
+      END INTERFACE
+
+      mggcatt = mgigcat(riid, index, cdata)
+      return
+      end
+
+C-------------------------------------------------------------
+C Name: mggnatt
+C Purpose:  Get a numeric attribute of a raster image
+C Inputs:   
+C       riid: RI ID of image
+C       index: the index of the attribute
+C       data: the data of the attribute
+C Returns: SUCCEED/FAIL
+C Users:    HDF Fortran programmers
+C Invokes: mgignat
+C-------------------------------------------------------------
+
+      integer function mggnatt(riid, index, data)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mggnatt
+	!MS$endif
+      integer data
+      integer riid, index
+C      integer mgignat
+      INTERFACE
+        INTEGER FUNCTION mgignat(riid,index,data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIGNAT' :: mgignat
+          integer riid, index,data
+        END FUNCTION mgignat
+      END INTERFACE
+
+      mggnatt = mgignat(riid, index, data)
+      return
+      end
+
+C-------------------------------------------------------------
+C Name: mggatt
+C Purpose:  Get an attribute of a raster image
+C Inputs:   
+C       riid: RI ID of image
+C       index: the index of the attribute
+C       data: the data for the attribute
+C Returns: SUCCEED/FAIL
+C Users:    HDF Fortran programmers
+C Invokes: mgisattr
+C-------------------------------------------------------------
+      integer function mggattr(riid, index, data)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mggattr
+	!MS$endif
+      integer data
+      integer riid, index
+C      integer mgigatt
+      INTERFACE
+        INTEGER FUNCTION mgigatt(riid,index,data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGIGATT' :: mgigatt
+          integer riid, index,data
+        END FUNCTION mgigatt
+      END INTERFACE
+
+      mggattr = mgigatt(riid, index, data)
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgwcchnk
+	!MS$endif
+         INTEGER riid, start(*) 
+         CHARACTER*(*) char_data(*)
+C         INTEGER mgcwcchnk 
+      INTERFACE
+        INTEGER FUNCTION mgcwcchnk(riid,start,char_data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGCWCCHNK' :: mgcwcchnk
+          INTEGER riid, start(*)
+	    CHARACTER*(*) char_data(*)
+        END FUNCTION mgcwcchnk
+      END INTERFACE
+         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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgwchnk
+	!MS$endif
+         INTEGER riid, start(*), num_data(*)
+C         INTEGER mymgcwchnk 
+	INTERFACE
+        INTEGER FUNCTION mgcwchnk(riid,start,num_data)
+          !MS$ATTRIBUTES C,reference,alias:'_MGCWCHNK' :: mgcwchnk
+          INTEGER riid, start(*), num_data(*)
+        END FUNCTION mgcwchnk
+      END INTERFACE
+         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    = 6 
+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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: mgscompress
+	!MS$endif
+
+         INTEGER riid, comp_type, comp_prm
+C         INTEGER mgcscompress 
+      INTERFACE
+        INTEGER FUNCTION mgcscompress(riid, comp_type, comp_prm)
+          !MS$ATTRIBUTES C,reference,alias:'_MGCSCOMPRESS'::mgcscompress
+          integer riid, comp_type, comp_prm
+        END FUNCTION mgcscompress
+      END INTERFACE
+
+         mgscompress = mgcscompress(riid, comp_type,
+     .                              comp_prm)
+         return
+         end

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vattrpf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vattrpf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vattrpf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,343 @@
+/****************************************************************
+ * 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.                                            *
+ *                                                              *
+ ****************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.2 $";
+#endif
+
+/* $Id: vattrpf.c,v 1.2 1998/06/26 14:46:23 epourmal Exp $ */
+/*
+   *
+   * vattrpf.c -- based on vattrf.c,v 1.9
+   * Part of the HDF Vset attribute interface.
+   *
+   * C routines (short names) to be called from fortran
+   *
+   *
+   ******************************************************/
+
+#include "hdf.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 == -1) ? (int32)_HDF_VDATA : *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 == -1)? (int32)_HDF_VDATA : *findex;
+    ret = (intf) VSsetattr((int32) *vsid, (int32) cfindex, attrname,
+          (int32) *dtype, (int32) *count, (VOIDP) _fcdtocp(values));
+    HDfree(attrname);
+    return(ret);
+}
+
+/* -------------------------------------------------------
+ * vsfcnats -- get total number of attributes of a vdata and
+ *             its fields
+ * VSnattrs -- vsfcnats -- vsfnats
+ */
+
+FRETVAL(intf)
+nvsfcnats(intf *vsid)
+{
+   intf ret;
+
+   ret = (intf) VSnattrs((int32) *vsid); 
+   return(ret);
+}
+
+/* -------------------------------------------------------
+ * vsfcfnas -- get number of attributes of a vdata or of a field
+ *
+ * VSfnattrs -- vsfcfnas -- vsffnas
+ */
+
+FRETVAL(intf)
+nvsfcfnas(intf *vsid, intf *findex)
+{ 
+    intf ret;
+    int32 cfindex;
+
+    cfindex = (*findex == -1)? (int32)_HDF_VDATA : *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 == -1)? (int32)_HDF_VDATA : *findex;
+    
+    ret = (intf) VSfindattr((int32) *vsid, (int32) cfindex, attrname);
+    HDfree(attrname);
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vsfcainf -- get attribute info
+ * VSattrinfo -- vsfcainf -- vsfainf
+ */
+
+FRETVAL(intf)
+nvsfcainf(intf *vsid, intf *findex, intf *aindex, _fcd attrname,
+         intf *dtype, intf *count, intf *size)
+{
+    intf ret;
+    int32 cfindex;
+
+    cfindex = (*findex == -1)? (int32)_HDF_VDATA : *findex;
+    ret = (intf) VSattrinfo((int32) *vsid, (int32) cfindex, (int32) *aindex,
+          _fcdtocp(attrname), (int32 *) dtype, (int32 *) count, 
+          (int32 *) size);
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vsfcgna -- get values of a numeric attribute 
+ * VSgetattr -- vsfcgna -- vsfgnat
+ */
+
+FRETVAL(intf)
+nvsfcgna(intf *vsid, intf *findex, intf *aindex, intf *values)
+{
+    intf ret;
+    int32 cfindex;
+
+    cfindex = (*findex == -1)? (int32)_HDF_VDATA : *findex;
+    ret = (intf) VSgetattr((int32) *vsid,(int32) cfindex,(int32) *aindex,
+                           (VOIDP) values);
+    return(ret);
+}
+
+/* --------------------------------------------------------
+ * vsfcgca -- get values of a char type attribute 
+ * VSgetattr -- vsfcgca -- vsfgcat
+ */
+
+FRETVAL(intf)
+nvsfcgca(intf *vsid,intf *findex,intf *aindex,_fcd values)
+{
+    intf ret;
+    int32 cfindex;
+
+    cfindex = (*findex == -1)? (int32)_HDF_VDATA : *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 -- vsfcisa -- vsfisat
+ */
+
+FRETVAL(intf)
+nvsfcisa(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);
+}
+
+/* -------------------------------------------------------
+ * vfcnats -- get number of attributes of a vgroup 
+ * Vnattrs -- vfcnats -- vfnatts
+ */
+
+FRETVAL(intf)
+nvfcnats(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);
+}
+
+/* ---------------------------------------------------------
+ * vfcainf -- get attribute info
+ * Vattrinfo -- vfcainf -- vfainfo
+ */
+
+FRETVAL(intf)
+nvfcainf(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);
+}
+
+/* ---------------------------------------------------------
+ * vfcgnat -- get values of a numeric attribute 
+ * Vgetattr -- vfcgnat -- vfgnatt
+ */
+
+FRETVAL(intf)
+nvfcgnat(intf *vgid, intf *aindex, intf *values)
+{
+    intf ret;
+    ret = (intf) Vgetattr((int32) *vgid, (int32) *aindex,
+                    (VOIDP) values);
+    return(ret);
+}
+
+/* --------------------------------------------------------
+ * vfcgcat -- get values of a char type attribute 
+ * Vgetattr -- vfcgcat -- vfgcatt
+ */
+
+FRETVAL(intf)
+nvfcgcat(intf *vgid, intf *aindex, _fcd values)
+{
+    intf ret;
+    ret = (intf) Vgetattr((int32) *vgid,(int32) *aindex,(VOIDP) _fcdtocp(values));
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vfcgver -- get version number of a vgroup
+ * Vgetversion -- vfcgver -- vfgver
+ */
+
+FRETVAL(intf)
+nvfcgver(intf *vgid)
+{
+    intf ret;
+    ret = (intf) Vgetversion((int32) *vgid);
+    return(ret);
+}
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vattrpff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vattrpff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vattrpff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,443 @@
+C***********************************************************
+C * NCSA HDF
+C   *
+C * Software Development Group
+C   *
+C * National Center for Supercomputing Applications
+C   *
+C * University of Illinois at Urbana-Champaign
+C   *
+C * 605 E. Springfield, Champaign IL 61820
+C   *
+C *
+C   *
+C * For conditions of distribution and use, see the accompanying
+C   *
+C * hdf/COPYING file.
+C   *
+C *
+C   *
+C***************************************************
+C
+C $Id: vattrpff.f,v 1.3 1998/07/20 13:30:22 epourmal Exp $
+C
+C **************************************************
+C *
+C * vattrpff.f -- based upon vattrff.f,v 1.5
+C * Vset attribute Fortran routines for Fortran PowerStation
+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, findex) 
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsffidx
+	!MS$endif
+       integer vsid
+       character*(*) fldnm
+       integer findex
+C       integer vsfcfdx
+       INTERFACE
+         INTEGER FUNCTION vsfcfdx(vsid,fldnm,findex,fldnmlen)
+           !MS$ATTRIBUTES C,reference,alias:'_VSFCFDX' :: vsfcfdx
+	     !DEC$ ATTRIBUTES reference :: fldnm
+           integer vsid, findex, fldnmlen
+           character*(*) fldnm
+         END FUNCTION vsfcfdx
+       END INTERFACE
+
+       vsffidx = vsfcfdx(vsid, fldnm, findex, 
+     +                  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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfsnat
+	!MS$endif
+       integer vsid, findex, dtype, count
+       character*(*) attrnm
+       integer  values
+C       integer vsfcsat
+       INTERFACE
+         INTEGER FUNCTION vsfcsat(vsid,findex,attrnm,dtype,count,
+     +                            values, attnmlen)
+           !MS$ATTRIBUTES C,reference,alias:'_VSFCSAT' :: vsfcsat
+	     !DEC$ ATTRIBUTES reference :: attrnm
+           integer vsid, findex, dtype,count,values, attnmlen
+           character*(*) attrnm
+         END FUNCTION vsfcsat
+       END INTERFACE
+     
+       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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfscat
+	!MS$endif
+       integer vsid, findex, dtype, count
+       character*(*) attrnm
+       character*(*) values
+C       integer vsfcsca
+       INTERFACE
+         INTEGER FUNCTION vsfcsca(vsid, findex, attrnm,dtype,
+     +                            count, values, attnmlen)
+         !MS$ATTRIBUTES C,reference,alias:'_VSFCSCA' :: vsfcsca
+	   !DEC$ ATTRIBUTES reference :: attrnm, values
+         integer vsid, findex, dtype,count,attnmlen
+         character*(*) attrnm, values
+         END FUNCTION vsfcsca
+       END INTERFACE
+       vsfscat = vsfcsca(vsid, findex, attrnm, dtype,
+     +         count, values, len(attrnm))
+       end
+C ------------- vsfnats ------------------------
+C     vsfnats -- get total number of attributes of a vdata and
+C             its fields
+C     VSnattrs -- vsfcnats -- vsfnats
+C
+       integer function vsfnats(vsid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfnats
+	!MS$endif
+       integer vsid
+C       integer vsfcnats
+       INTERFACE 
+         INTEGER FUNCTION vsfcnats(vsid)
+           !MS$ATTRIBUTES C,reference,alias:'_VSFCNATS' :: vsfcnats
+           integer vsid
+         END FUNCTION vsfcnats
+       END INTERFACE
+
+       vsfnats = vsfcnats(vsid)
+       end       
+C ------------- vsffnas ------------------------
+C     vsfnats -- get total number of attributes of a vdata and
+C             its fields
+C     VSnattrs -- vsfcfnas -- vsffnas
+C
+       integer function vsffnas(vsid, findex)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsffnas
+	!MS$endif
+       integer vsid, findex
+C       integer vsfcfnas
+       INTERFACE
+         INTEGER FUNCTION vsfcfnas(vsid, findex)
+           !MS$ATTRIBUTES C,reference,alias:'_VSFCFNAS' :: vsfcfnas
+           integer vsid, findex
+         END FUNCTION vsfcfnas
+       END INTERFACE
+
+       vsffnas = vsfcfnas(vsid, findex)
+       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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsffdat
+	!MS$endif
+       integer vsid, findex
+       character*(*) attrnm
+C       integer vsfcfda
+       INTERFACE
+         INTEGER FUNCTION vsfcfda(vsid, findex, attrnm, nmlen)
+           !MS$ATTRIBUTES C,reference,alias:'_VSFCFDA' :: vsfcfda
+	     !DEC$ ATTRIBUTES reference :: attrnm
+           integer vsid, findex, nmlen
+           character*(*) attrnm
+         END FUNCTION vsfcfda
+       END INTERFACE
+
+       vsffdat = vsfcfda(vsid, findex, attrnm, 
+     +                   len(attrnm))
+       end 
+
+C --------------- vsfainf -------------------------
+C    vsffdat -- get info of an attribute 
+C    VSattrinfo -- vsfcainf -- vsfainf
+C
+       integer function vsfainf(vsid, findex, aindex, attrnm,
+     +                   dtype,count,size)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfainf
+	!MS$endif
+       integer vsid, findex, aindex, dtype, count, size
+       character*(*) attrnm
+C       integer vsfcainf
+       INTERFACE
+         INTEGER FUNCTION vsfcainf(vsid, findex, aindex, attrnm,
+     +                   dtype, count, size, nmlen)
+           !MS$ATTRIBUTES C,reference,alias:'_VSFCAINF' :: vsfcainf
+	     !DEC$ ATTRIBUTES reference :: attrnm
+           integer vsid, findex, aindex, dtype, count, size, nmlen
+           character*(*) attrnm
+         END FUNCTION vsfcainf
+       END INTERFACE
+
+       vsfainf = vsfcainf(vsid, findex, aindex, attrnm, dtype,
+     +                   count, size, len(attrnm))
+       end
+
+C --------------- vsfgnat -------------------------
+C    vsfgnat -- get values of a numeric attribute 
+C    VSgetattr -- vsfcgna -- vsfgnat
+C
+       integer function vsfgnat(vsid, findex, aindex, values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfgnat
+	!MS$endif
+       integer vsid, findex, aindex, values(*)
+C       integer vsfcgna
+       INTERFACE
+         INTEGER FUNCTION vsfcgna(vsid, findex, aindex, values)
+           !MS$ATTRIBUTES C,reference,alias:'_VSFCGNA' :: vsfcgna
+           integer vsid, findex, aindex, values(*)
+         END FUNCTION vsfcgna
+       END INTERFACE
+
+       vsfgnat = vsfcgna(vsid, findex, aindex, values)
+       end
+
+C --------------- vsfgcat -------------------------
+C    vsfgcat -- get values of a character type attribute 
+C    VSgetattr -- vsfcgca -- vsfgcat
+C
+       integer function vsfgcat(vsid, findex, aindex, values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfgcat
+	!MS$endif
+       integer vsid, findex, aindex
+       character*(*) values
+C       integer vsfcgca
+       INTERFACE
+         INTEGER FUNCTION vsfcgca(vsid, findex, aindex, values)
+           !MS$ATTRIBUTES C,reference,alias:'_VSFCGCA' :: vsfcgca
+	     !DEC$ ATTRIBUTES reference :: values
+           integer vsid, findex, aindex
+           character*(*) values
+         END FUNCTION vsfcgca
+       END INTERFACE
+
+       vsfgcat = vsfcgca(vsid, findex, aindex, values)
+       end
+
+C --------------- vsfisat -------------------------
+C    vsfisat --  test if a vdata is an attribute of other object
+C    VSisattr -- vsfcisa -- vsfisat
+C
+       integer function vsfisat(vsid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfisat
+	!MS$endif
+       integer vsid
+C       integer vsfcisa
+       INTERFACE
+         INTEGER FUNCTION vsfcisa(vsid)
+           !MS$ATTRIBUTES C,reference,alias:'_VSFCISA' :: vsfcisa
+           integer vsid
+         END FUNCTION vsfcisa
+       END INTERFACE
+
+       vsfisat = vsfcisa(vsid)
+       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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfsnatt
+	!MS$endif
+       integer vgid, dtype, count, values
+       character*(*) attrnm
+C       integer vfcsatt
+       INTERFACE
+         INTEGER FUNCTION vfcsatt(vgid, attrnm, dtype, count,
+     +                       values, nmlen)
+           !MS$ATTRIBUTES C,reference,alias:'_VFCSATT' :: vfcsatt
+	     !DEC$ ATTRIBUTES reference :: attrnm
+           integer vgid, dtype, count, values, nmlen
+           character*(*)  attrnm
+         END FUNCTION vfcsatt
+       END INTERFACE
+
+       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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfscatt
+	!MS$endif
+       integer vgid, dtype, count
+       character*(*) attrnm, values
+c       integer vfcscat
+       INTERFACE
+         INTEGER FUNCTION vfcscat(vgid, attrnm, dtype, count,
+     +                       values, nmlen)
+           !MS$ATTRIBUTES C,reference,alias:'_VFCSCAT' :: vfcscat
+	     !DEC$ ATTRIBUTES reference :: attrnm, values
+           integer vgid, dtype, count, nmlen
+           character*(*)  attrnm, values
+         END FUNCTION vfcscat
+       END INTERFACE
+
+       vfscatt = vfcscat(vgid, attrnm, dtype,count,
+     +                  values, len(attrnm))
+       end
+
+C ------------- vfnatts ------------------------
+C     vfnatts -- get total number of attributes of a vgroup 
+C     Vnattrs -- vfcnats -- vfnatts
+C
+       integer function vfnatts(vgid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfnatts
+	!MS$endif
+       integer vgid
+C       integer vfcnats
+       INTERFACE 
+         INTEGER FUNCTION vfcnats(vgid)
+           !MS$ATTRIBUTES C,reference,alias:'_VFCNATS' :: vfcnats
+           integer vgid
+         END FUNCTION vfcnats
+       END INTERFACE
+
+       vfnatts = vfcnats(vgid)
+       end       
+
+C --------------- vffdatt ---------------------
+C    vffdatt -- find an attribute of a vgroup
+C    Vfindattr -- vfcfdat -- vffdatt
+C
+       integer function vffdatt(vg, attrnm)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vffdatt
+	!MS$endif
+       integer vg
+       character*(*)   attrnm
+C       integer vfcfdat
+       INTERFACE
+         INTEGER FUNCTION vfcfdat(vg, attrnm, nmlen)
+           !MS$ATTRIBUTES C,reference,alias:'_VFCFDAT' :: vfcfdat
+	     !DEC$ ATTRIBUTES reference :: attrnm
+           integer vg, nmlen
+           character*(*) attrnm
+         END FUNCTION vfcfdat
+       END INTERFACE
+
+       vffdatt = vfcfdat(vg, attrnm, len(attrnm))
+       end
+C --------------- vfainfo -------------------------
+C    vfainfo -- get info of an attribute 
+C    Vattrinfo -- vfcainf -- vfainfo
+C
+       integer function vfainfo(vgid, aindex, attrnm,
+     +                   dtype,count,size)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfainfo
+	!MS$endif
+       integer vgid, aindex, dtype, count, size
+       character*(*) attrnm
+C       integer vfcainf
+       INTERFACE
+         INTEGER FUNCTION vfcainf(vgid, aindex, attrnm,
+     +                   dtype, count, size, nmlen)
+           !MS$ATTRIBUTES C,reference,alias:'_VFCAINF' :: vfcainf
+	     !DEC$ ATTRIBUTES reference :: attrnm
+           integer vgid, aindex, dtype, count, size, nmlen
+           character*(*) attrnm
+         END FUNCTION vfcainf
+       END INTERFACE
+
+       vfainfo = vfcainf(vgid, aindex, attrnm, dtype,
+     +                   count, size, len(attrnm))
+       end
+
+C --------------- vfgnatt -------------------------
+C    vfgnatt -- get values of a numeric attribute 
+C    Vgetattr -- vfcgnat -- vfgnatt
+C
+       integer function vfgnatt(vgid, aindex, values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfgnatt
+	!MS$endif
+       integer vgid, aindex, values
+C       integer vfcgnat
+       INTERFACE
+         INTEGER FUNCTION vfcgnat(vgid, aindex, values)
+           !MS$ATTRIBUTES C,reference,alias:'_VFCGNAT' :: vfcgnat
+           integer vgid, aindex, values
+         END FUNCTION vfcgnat
+       END INTERFACE
+
+       vfgnatt = vfcgnat(vgid, aindex, values)
+       end
+
+C --------------- vfgcatt -------------------------
+C    vfgcatt -- get values of a character type attribute 
+C    Vgetattr -- vfcgcat -- vfgcatt
+C
+       integer function vfgcatt(vgid, aindex, values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfgcatt
+	!MS$endif
+       integer vgid, aindex
+       character*(*) values
+C       integer vfcgcat
+       INTERFACE
+         INTEGER FUNCTION vfcgcat(vgid, aindex, values)
+           !MS$ATTRIBUTES C,reference,alias:'_VFCGCAT' :: vfcgcat
+	     !DEC$ ATTRIBUTES reference :: values
+           integer vgid, aindex
+           character*(*) values
+         END FUNCTION vfcgcat
+       END INTERFACE
+
+       vfgcatt = vfcgcat(vgid, aindex, values)
+       end
+ 
+C --------------- vfgver -------------------------
+C    vfgver -- get version number of a vgroup
+C    Vgetversion -- vfcgver -- vfgver
+C
+       integer function vfgver(vgid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfgver
+	!MS$endif
+       integer vgid
+C       integer vfcgver
+       INTERFACE
+         INTEGER FUNCTION vfcgver(vgid)
+           !MS$ATTRIBUTES C,reference,alias:'_VFCGVER' :: vfcgver
+           integer vgid
+         END FUNCTION vfcgver
+       END INTERFACE
+
+       vfgver = vfcgver(vgid)
+       end

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vgpf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vgpf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vgpf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1437 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.3 $";
+#endif
+
+/* $Id: vgpf.c,v 1.3 1998/06/23 20:27:46 epourmal Exp $ */
+
+/*
+   *
+   * vgpf.c
+   * Part of the HDF VSet interface.
+   *
+   * C routines (short names) to be called from fortran
+   *
+   *
+   *********************************************************************** */
+
+#include "hdf.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(*file_id));
+}   /* ndfvclos() */
+
+/*
+   **  attach to a vgroup and returns its ptr
+   **  related: Vattach--vatchc--VFATCH
+ */
+
+FRETVAL(intf)
+nvatchc(HFILEID * f, intf * vgid, _fcd accesstype)
+{
+    int32       vkey;
+    char       *acc;
+
+    acc = HDf2cstring(accesstype, 1);
+    if (!acc) return(FAIL);
+
+    vkey = Vattach(*f, *vgid, acc);
+    HDfree(acc);
+
+    return (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)
+nvdeletec(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(HFILEID * f, intf * vgid)
+{
+    return ((intf) Vgetid(*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)
+nvfistart(HFILEID * f)
+{
+    return (Vstart(*f));
+}   /* nvfistart */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  wrapper for Vend
+ */
+
+FRETVAL(intf)
+nvfiend(HFILEID * f)
+{
+    return ((intf) Vend(*f));
+}   /* nvfiend */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  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(HFILEID * f, intf * vsid, _fcd accesstype)
+{
+    /* need not HDf2cstring since only first char is accessed. */
+    return(VSattach(*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 -- vsiqref -- vsqref
+ */
+
+FRETVAL(intf)
+nvsiqref(intf * vkey)
+{
+    return ((intf)VSQueryref((int32)*vkey));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the tag # of a vdata
+   **  related: VSQuerytag -- vsiqtag -- vsqtag
+ */
+
+FRETVAL(intf)
+nvsiqtag(intf * vkey)
+{
+    return ((intf)VSQuerytag((int32)*vkey));
+}
+
+/* ----------------------------------------------------------------- */
+/*
+   **  get the version # of a vdata
+   **  related: VSgetversion -- vsigver -- vsgver
+ */
+
+FRETVAL(intf)
+nvsigver(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;
+
+    /* Allocate space for fortran strings */
+    tfields = (char *) HDmalloc(*fieldslen + 1);
+    if (!tfields)
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+    tvsname = (char *) HDmalloc(*vsnamelen + 1);
+    if (!tfields){
+        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, (int32 *) nelt, (int32 *) interlace,
+                  tfields, (int32 *) eltsize, tvsname);
+    
+    /* 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(HFILEID * 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(HFILEID * f, intf * vsid)
+{
+    return ((intf) VSgetid(*f, *vsid));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  removes the vdata with id from the file
+   **  related: VSdelete--vsdltc--VSFDLTE
+ */
+
+FRETVAL(intf)
+nvsdltc(HFILEID * 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, VSsetexternalfile -- vssextfc -- vsfsextf
+ * 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 -- vfinflds -- vfnflds
+ */
+
+FRETVAL(intf)
+nvfinflds(intf * vkey)
+{
+    return((intf) VFnfields((int32)*vkey));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the name of a given field in a vdata
+   **  related: VFfieldname -- vfifnm -- vffname
+ */
+
+FRETVAL(intf)
+nvfifnm(intf * vkey, intf * index, _fcd fname)
+{
+    char *fieldname;
+
+    if((fieldname=VFfieldname((int32)*vkey,(int32)*index))!=NULL)
+      {
+        HDstrcpy(_fcdtocp(fname),fieldname);
+        return(SUCCEED);
+      } /* end if */
+    else
+        return(FAIL);
+}   /* vfifnm */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the number-type of a given field in a vdata
+   **  related: VFfieldtype -- vfiftp -- vfftype
+ */
+
+FRETVAL(intf)
+nvfiftp(intf * vkey, intf * index)
+{
+    return((intf)VFfieldtype((int32)*vkey,(int32)*index));
+}   /* vfiftp */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the internal (in memory) size of a given field in a vdata
+   **  related: VFfieldisize -- vfifisz -- vffisiz
+ */
+
+FRETVAL(intf)
+nvfifisz(intf * vkey, intf * index)
+{
+    return((intf)VFfieldisize((int32)*vkey,(int32)*index));
+}   /* vfifisz */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the external (on disk) size of a given field in a vdata
+   **  related: VFfieldesize -- vfifesz -- vffesiz
+ */
+
+FRETVAL(intf)
+nvfifesz(intf * vkey, intf * index)
+{
+    return((intf)VFfieldesize((int32)*vkey,(int32)*index));
+}   /* vfifesz */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the order of a given field in a vdata
+   **  related: VFfieldorder -- vfifodr -- vffordr
+ */
+
+FRETVAL(intf)
+nvfifodr(intf * vkey, intf * index)
+{
+    return((intf)VFfieldorder((int32)*vkey,(int32)*index));
+}   /* vfifodr */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  reads records from a vdata into a char buffer
+   **  related: VSread -- vsfirdc -- vsfrdc
+ */
+
+FRETVAL(intf)
+nvsfirdc(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 -- vsfird -- vsfrd
+ */
+
+FRETVAL(intf)
+nvsfird(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 -- vsfiwrc -- vsfwrtc
+ */
+
+FRETVAL(intf)
+nvsfiwrc(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 -- vsfiwr -- vsfwrt
+ */
+
+FRETVAL(intf)
+nvsfiwr(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(HFILEID * 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(HFILEID * 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(HFILEID * 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(HFILEID * 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--vfndclsc--VFNDCLS
+ */
+
+FRETVAL(intf)
+nvfndclsc(HFILEID * 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(HFILEID * 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(HFILEID * 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(HFILEID * 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(HFILEID * 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(HFILEID * 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 -- vfirefs -- vnrefs
+ */
+
+FRETVAL(intf)
+nvfirefs(intf * vkey, intf *tag)
+{
+    return((intf) Vnrefs((int32)*vkey, (int32)*tag));
+} /* end nvnirefs() */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  Return the ref of this vgroup
+   **  related: VQueryref -- vfiqref -- vqref
+ */
+
+FRETVAL(intf)
+nvfiqref(intf * vkey)
+{
+    return((intf) VQueryref((int32)*vkey));
+} /* end nviqref() */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  Return the ref of this vgroup
+   **  related: VQuerytag -- vfiqtag -- vqtag
+ */
+
+FRETVAL(intf)
+nvfiqtag(intf * vkey)
+{
+    return((intf) VQuerytag((int32)*vkey));
+} /* end nviqtag() */
+
+/* ------------------------------------------------------------------ */
+
+/*
+   **  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: Vaddtagref -- vadtrc -- vfadtr
+ */
+
+FRETVAL(intf)
+nvadtrc(intf * vkey, intf * tag, intf * ref)
+{
+    return ((intf) Vaddtagref(*vkey, *tag, *ref));
+}
+/* ------------------------------------------------------------------ */
+
+/*
+   **  checks the number of records in a vdata
+   **  related: VSQuerycount -- vsiqnelt -- vsqfnelt
+ */
+
+FRETVAL(intf)
+nvsiqnelt(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 vdata
+   **  related: VSQueryinterlace -- vsiqintr -- vsqfintr
+ */
+
+FRETVAL(intf)
+nvsiqintr(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 -- vsqfldsc -- 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 record size of a vdata on local machine
+   **  related: VSQueryvsize -- vsiqvsz -- vsqfvsiz
+ */
+
+FRETVAL(intf)
+nvsiqvsz(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 vdata
+   **  related: VSQueryname -- vsqnamec -- 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);
+}
+
+/* ------------------------------------------------------------------ *//* 
+   ** pack a char field from fldbuf to buf, or vice versa.
+   ** related: VSfpack -- vsfccpk -- vsfcpak
+ */
+
+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);
+}
+
+
+/* ------------------------------------------------------------------ */
+/* 
+   ** pack a numeric field from fldbuf to buf, or vice versa.
+   ** related: VSfpack -- vsfncpk -- vsfnpak
+ */
+
+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);
+} 

Added: packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vgpff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vgpff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/fort_ps/vgpff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1796 @@
+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: vgpff.f,v 1.3 1998/07/20 13:30:24 epourmal Exp $ 
+C     
+c **************************************************************************
+c *
+c * vgpff.f, based on vgff.f,v 1.20
+c * Part of the HDF VSet interface. For Fortran PowerStation 
+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, vgref, accesstype)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfatch
+	!MS$endif
+      integer     f, vgref
+      character*1 accesstype
+C      integer     vatchc
+      INTERFACE
+        INTEGER FUNCTION vatchc(f, vgref, accesstype)
+          !MS$ATTRIBUTES C,reference,alias:'_VATCHC' :: vatchc
+	    !DEC$ ATTRIBUTES reference :: accesstype
+          integer f, vgref
+          character*1 accesstype
+        END FUNCTION vatchc
+      END INTERFACE
+
+      vfatch = vatchc (f, vgref, accesstype)
+      end
+
+c	------------------------------------------------------------
+c	detaches from a vgroup
+c	related: Vdetach--vdtchc--VFDTCH
+
+      integer function vfdtch (vgid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfdtch
+	!MS$endif
+      integer     vgid
+c      integer   vdtchc
+      INTERFACE
+        INTEGER FUNCTION vdtchc(vgid)
+          !MS$ATTRIBUTES C,reference,alias:'_VDTCHC' :: vdtchc
+          integer vgid
+        END FUNCTION vdtchc
+      END INTERFACE
+
+      vfdtch = vdtchc (vgid)
+      end
+
+c	------------------------------------------------------------
+c	general inquiry on a vgroup
+c	related: Vgetname--vgnamc--VFGNAM
+
+      integer function vfgnam (vg, vgname)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfgnam 
+	!MS$endif
+      integer         vg
+      character*(*)   vgname
+c      integer         vgnamc
+      INTERFACE
+        INTEGER FUNCTION vgnamc(vg, vgname)
+          !MS$ATTRIBUTES C,reference,alias:'_VGNAMC' :: vgnamc
+	    !DEC$ ATTRIBUTES reference :: vgname
+          integer vg
+          character*(*) vgname
+        END FUNCTION vgnamc
+      END INTERFACE
+
+      vfgnam = vgnamc (vg, vgname)
+      end
+c	------------------------------------------------------------
+c	get the class name of a vgroup
+c	related: Vgetclass--vgclsc--VFGCLS
+
+      integer function vfgcls (vg, vgclass)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfgcls
+	!MS$endif
+
+      integer			vg
+      character*(*)	vgclass
+c      integer       vgclsc
+      INTERFACE
+        INTEGER FUNCTION vgclsc(vg, vgclass)
+          !MS$ATTRIBUTES C,reference,alias:'_VGCLSC' :: vgclsc
+	    !DEC$ ATTRIBUTES reference :: vgclass
+          integer vg
+          character*(*) vgclass
+        END FUNCTION vgclsc
+      END INTERFACE
+
+      vfgcls = vgclsc  (vg, vgclass)
+      end
+c   ------------------------------------------------------------
+c	general inquiry on a vgroup
+c	related: Vinquire--vinqc--VFINQ
+
+      integer   function    vfinq (vg, nentries, vgname)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfinq
+	!MS$endif
+      integer			vg, nentries
+      character*(*)	vgname
+c      integer			vinqc
+      INTERFACE
+        INTEGER FUNCTION vinqc(vg, nentries, vgname)
+          !MS$ATTRIBUTES C,reference,alias:'_VINQC' :: vinqc
+	    !DEC$ ATTRIBUTES reference :: vgname
+          integer vg, nentries
+          character*(*) vgname
+        END FUNCTION vinqc
+      END INTERFACE
+
+      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, vgref)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfgid
+	!MS$endif
+      integer		f, vgref
+c      integer		vgidc
+      INTERFACE
+        INTEGER FUNCTION vgidc(f, vgref)
+          !MS$ATTRIBUTES C,reference,alias:'_VGIDC' :: vgidc
+          integer f, vgref 
+        END FUNCTION vgidc
+      END INTERFACE
+
+      vfgid = vgidc (f, vgref)
+      end
+
+c	------------------------------------------------------------
+c	gets the ref of the next vgroup or vdata entry in the vgroup
+c	related: Vgetnext--vgnxtc--VFGNXT
+
+      integer   function    vfgnxt (vg, vref)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfgnxt
+	!MS$endif
+      integer		vg, vref
+c      integer		vgnxtc
+      INTERFACE
+        INTEGER FUNCTION vgnxtc(vg, vref)
+          !MS$ATTRIBUTES C,reference,alias:'_VGNXTC' :: vgnxtc
+          integer vg, vref
+        END FUNCTION vgnxtc
+      END INTERFACE
+
+      vfgnxt = vgnxtc (vg, vref)
+      end
+
+c	------------------------------------------------------------
+c	sets the name of the vgroup
+c	related: Vsetname--vsnamc--VFSNAM
+
+      integer function vfsnam (vg, vgname)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfsnam
+	!MS$endif
+      integer			vg
+      character*(*)	vgname
+c      integer       vsnamc
+      INTERFACE
+        INTEGER FUNCTION vsnamc(vg, vgname, nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSNAMC' :: vsnamc
+	    !DEC$ ATTRIBUTES reference :: vgname
+          integer vg, nmlen
+          character*(*) vgname
+        END FUNCTION vsnamc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfscls
+	!MS$endif
+      integer			vg
+      character*(*)	vgclass
+c      integer      vsclsc
+      INTERFACE
+        INTEGER FUNCTION vsclsc(vg, vgclass, clslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSCLSC' :: vsclsc
+	    !DEC$ ATTRIBUTES reference :: vgclass
+          integer vg, clslen
+          character*(*) vgclass
+        END FUNCTION vsclsc
+      END INTERFACE
+
+      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, vid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfinsrt
+	!MS$endif
+      integer		vg, vid
+c      integer		vinsrtc
+      INTERFACE
+        INTEGER FUNCTION vinsrtc(vg, vid)
+          !MS$ATTRIBUTES C,reference,alias:'_VINSRTC' :: vinsrtc
+          integer vg, vid
+        END FUNCTION vinsrtc
+      END INTERFACE
+
+      vfinsrt = vinsrtc (vg, vid)
+      end
+
+c     ------------------------------------------------------------
+c     tests if an id in a vgroup is a vgroup
+c     related: Visvg--visvgc--vfisvg
+
+      integer	function	vfisvg (vg, id) 									
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfisvg
+	!MS$endif
+      integer		vg, id
+c      integer		visvgc
+      INTERFACE
+         INTEGER FUNCTION visvgc(vg, id)
+          !MS$ATTRIBUTES C,reference,alias:'_VISVGC' :: visvgc
+          integer vg, id
+        END FUNCTION visvgc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfisvs
+	!MS$endif
+      integer		vg, id
+c      integer		visvsc
+      INTERFACE
+         INTEGER FUNCTION visvsc(vg, id)
+          !MS$ATTRIBUTES C,reference,alias:'_VISVSC' :: visvsc
+          integer vg, id
+        END FUNCTION visvsc
+      END INTERFACE
+
+      vfisvs = visvsc (vg, id)
+      end
+
+c     ------------------------------------------------------------
+c     start Vset interface
+C     related:  Vstart -- vfistart -- vfstart
+
+      integer function vfstart(file_id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfstart
+	!MS$endif
+      integer file_id
+C      integer vfistart
+      INTERFACE 
+        INTEGER FUNCTION vfistart(file_id)
+          !MS$ATTRIBUTES C,reference,alias:'_VFISTART' :: vfistart
+          integer file_id
+        END FUNCTION vfistart
+      END INTERFACE
+   
+      vfstart = vfistart(file_id)
+      end
+
+c     ------------------------------------------------------------
+c     end Vset interface
+C     related:  Vend -- vfiend -- vfend
+
+      integer function vfend(file_id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfend
+	!MS$endif
+      integer file_id
+C      integer vfiend
+      INTERFACE 
+        INTEGER FUNCTION vfiend(file_id)
+          !MS$ATTRIBUTES C,reference,alias:'_VFIEND' :: vfiend
+          integer file_id
+        END FUNCTION vfiend
+      END INTERFACE
+   
+      vfend = vfiend(file_id)
+      end
+
+c     ============================================================
+c      VDATA ROUTINES
+c     ============================================================
+
+c     attach to a vdata
+c     related: VSattach--vsatchc--vfatch
+
+      integer	function	vsfatch (f, vsid, accesstype)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfatch
+	!MS$endif
+      integer		f, vsid
+      character*1	accesstype
+c      integer		vsatchc
+      INTERFACE
+         INTEGER FUNCTION vsatchc(f, vsid, accesstype)
+          !MS$ATTRIBUTES C,reference,alias:'_VSATCHC' :: vsatchc
+	    !DEC$ ATTRIBUTES reference :: accesstype
+          integer f, vsid
+          character*1   accesstype
+        END FUNCTION vsatchc
+      END INTERFACE
+
+      vsfatch = vsatchc (f, vsid, accesstype)
+      end
+
+c     ------------------------------------------------------------
+c     detach from a vdata
+c     related: VSdetach--vsdtchc--vfdtch
+
+      integer function vsfdtch (vs)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfdtch
+	!MS$endif
+      integer		vs
+c      integer       vsdtchc
+      INTERFACE
+         INTEGER FUNCTION vsdtchc(vs)
+          !MS$ATTRIBUTES C,reference,alias:'_VSDTCHC' :: vsdtchc
+          integer vs
+        END FUNCTION vsdtchc
+      END INTERFACE
+
+      vsfdtch = vsdtchc (vs)
+      end
+
+c     ------------------------------------------------------------
+c     get the ref # of a vdata
+c     related: VSQueryref -- vsiqref -- vsqref
+
+      integer function vsqref(vsid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsqref
+	!MS$endif
+      integer vsid
+C     integer vsiqref
+      INTERFACE
+        INTEGER FUNCTION vsiqref(vsid)
+          !MS$ATTRIBUTES C,reference,alias:'_VSIQREF' :: vsiqref
+          integer vsid
+        END FUNCTION vsiqref
+      END INTERFACE 
+
+      vsqref = vsiqref(vsid)
+      end
+c     ------------------------------------------------------------
+c     get the tag of a vdata
+c     related: VSQuerytag -- vsiqtag -- vsqtag
+
+      integer function vsqtag(vsid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsqtag
+	!MS$endif
+      integer vsid
+C     integer vsiqtag
+      INTERFACE
+        INTEGER FUNCTION vsiqtag(vsid)
+          !MS$ATTRIBUTES C,reference,alias:'_VSIQTAG' :: vsiqtag
+          integer vsid
+        END FUNCTION vsiqtag
+      END INTERFACE
+
+      vsqtag = vsiqtag(vsid)
+      end
+
+c     ------------------------------------------------------------
+c     get the ver # of a vdata
+c     related: VSgetversion -- vsigver -- vsgver
+
+      integer function vsgver(vsid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsgver
+	!MS$endif
+      integer vsid
+C     integer vsigver
+      INTERFACE
+        INTEGER FUNCTION vsigver(vsid)
+          !MS$ATTRIBUTES C,reference,alias:'_VSIGVER' :: vsigver
+          integer vsid
+        END FUNCTION vsigver
+      END INTERFACE
+
+      vsgver = vsigver(vsid)
+      end
+c     ------------------------------------------------------------
+c     seeks to a given element position in a vadata
+c     related: VSseek--vsseekc--vsfseek
+
+      integer	function	vsfseek (vs, eltpos )
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfseek
+	!MS$endif
+      integer		vs, eltpos
+c      integer		vsseekc
+      INTERFACE
+        INTEGER FUNCTION vsseekc(vs, eltpos)
+          !MS$ATTRIBUTES C,reference,alias:'_VSSEEKC' :: vsseekc
+          integer vs, eltpos
+        END FUNCTION vsseekc
+      END INTERFACE
+
+      vsfseek = vsseekc (vs, eltpos)
+      end
+
+c     ------------------------------------------------------------
+c     gets the name of a vdata
+c     related: VSgetname--vsgnamc--vsfgnam
+
+      integer function vsfgnam (vs, vsname)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfgnam
+	!MS$endif
+      integer			vs
+      character*(*)	vsname
+c      integer       vsgnamc
+      INTERFACE
+        INTEGER FUNCTION vsgnamc(vs, vsname, nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSGNAMC' :: vsgnamc
+	    !DEC$ ATTRIBUTES reference :: vsname
+          integer vs, nmlen
+          character*(*) vsname
+        END FUNCTION vsgnamc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfgcls
+	!MS$endif
+      integer			vs
+      character*(*)	vsclass
+c      integer       vsgclsc
+      INTERFACE
+        INTEGER FUNCTION vsgclsc(vs, vsclass, clslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSGCLSC' :: vsgclsc
+	    !DEC$ ATTRIBUTES reference :: vsclass
+          integer vs, clslen
+          character*(*) vsclass
+        END FUNCTION vsgclsc
+      END INTERFACE
+
+      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) 
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfinq
+	!MS$endif
+      integer			vs, nvs, ilace, vsize
+      character*(*)	fields, vsname
+c      integer			vsinqc
+      INTERFACE
+        INTEGER FUNCTION vsinqc(vs,nvs,il,flds,vsize, vsname,
+     +                          fldlen, nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSINQC' :: vsinqc
+	    !DEC$ ATTRIBUTES reference :: vsname, flds
+          integer vs,nvs,il,vsize, fldlen, nmlen
+          character*(*) vsname, flds
+        END FUNCTION vsinqc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfex
+	!MS$endif
+      integer			vs
+      character*(*)	fields
+c      integer			vsfexc
+      INTERFACE
+        INTEGER FUNCTION vsfexc(vs, fields, fldslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSFEXC' :: vsfexc
+	    !DEC$ ATTRIBUTES reference :: fields
+          integer vs, fldslen
+          character*(*) fields
+        END FUNCTION vsfexc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsffnd
+	!MS$endif
+      integer			vs
+      character*(*)	name
+c      integer vsfndc
+      INTERFACE
+        INTEGER FUNCTION vsfndc(vs, name, nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSFNDC' :: vsfndc
+	    !DEC$ ATTRIBUTES reference :: name
+          integer vs, nmlen
+          character*(*) name
+        END FUNCTION vsfndc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfgid
+	!MS$endif
+      integer     f, vsid
+c      integer     vsgidc
+      INTERFACE
+        INTEGER FUNCTION vsgidc(f, vsid)
+          !MS$ATTRIBUTES C,reference,alias:'_VSGIDC' :: vsgidc
+          integer f, vsid
+        END FUNCTION vsgidc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfdlte
+	!MS$endif
+      integer     f, vsid
+c      integer     vsdltc
+      INTERFACE
+        INTEGER FUNCTION vsdltc(f, vsid)
+          !MS$ATTRIBUTES C,reference,alias:'_VSDLTC' :: vsdltc
+          integer f, vsid
+        END FUNCTION vsdltc
+      END INTERFACE
+
+      vsfdlte = vsdltc (f, vsid)
+      end
+
+c     ------------------------------------------------------------
+c     sets the name of a vdata
+c     related: VSsetname--vssnamc--vsfsnam
+
+      integer function vsfsnam (vs, vsname)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfsnam
+	!MS$endif
+      integer			vs
+      character*(*)	vsname
+c       integer       vssnamc
+      INTERFACE
+        INTEGER FUNCTION vssnamc(vs, vsname, nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSSNAMC' :: vssnamc
+	    !DEC$ ATTRIBUTES reference :: vsname
+          integer vs, nmlen
+          character*(*) vsname
+        END FUNCTION vssnamc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfscls
+	!MS$endif
+      integer			vs
+      character*(*)	vsclass
+c      integer vssclsc
+      INTERFACE
+        INTEGER FUNCTION vssclsc(vs, vsclass, clslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSSCLSC' :: vssclsc
+	    !DEC$ ATTRIBUTES reference :: vsclass
+          integer vs, clslen
+          character*(*) vsclass
+        END FUNCTION vssclsc
+      END INTERFACE
+
+      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)		
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfsfld
+	!MS$endif
+      integer			vs
+      character*(*)	fields
+c      integer		vssfldc
+      INTERFACE
+        INTEGER FUNCTION vssfldc(vs, fields, fldlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSSFLDC' :: vssfldc
+	    !DEC$ ATTRIBUTES reference :: fields
+          integer vs, fldlen
+          character*(*) fields
+        END FUNCTION vssfldc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfsint
+	!MS$endif
+      integer 		vs, interlace
+c      integer		vssintc
+      INTERFACE
+        INTEGER FUNCTION vssintc(vs, interlace)
+          !MS$ATTRIBUTES C,reference,alias:'_VSSINTC' :: vssintc
+          integer vs, interlace
+        END FUNCTION vssintc
+      END INTERFACE
+
+      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)	
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsffdef
+	!MS$endif
+
+      integer			vs, localtype, order
+      character*(*)	field
+c      integer			vsfdefc
+      INTERFACE
+        INTEGER FUNCTION vsfdefc(vs, field, localtype, order, fldlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSFDEFC' :: vsfdefc
+	    !DEC$ ATTRIBUTES reference :: field
+          integer vs, localtype, order, fldlen
+          character*(*) field
+        END FUNCTION vsfdefc
+      END INTERFACE
+
+      vsffdef = vsfdefc ( vs, field, localtype, order, len(field))
+
+      end
+
+c     ------------------------------------------------------------
+C     this function should be replaced by vsfrdc and vsfrd
+c     reads from a vdata 
+c     related: VSread--vsreadc--vsfread
+
+      integer	function	vsfread (vs, buf, nelts , interlace)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfread
+	!MS$endif
+      integer			vs, nelts , interlace
+      character*(*)	buf
+c      integer			vsreadc
+      INTERFACE
+        INTEGER FUNCTION vsreadc(vs, buf, nelts, interlace)
+          !MS$ATTRIBUTES C,reference,alias:'_VSREADC' :: vsreadc
+	    !DEC$ ATTRIBUTES reference :: buf
+          integer vs, nelts, interlace
+          character*(*) buf
+        END FUNCTION vsreadc
+      END INTERFACE
+
+      vsfread = vsreadc (vs, buf, nelts, interlace)
+      end
+
+c     ------------------------------------------------------------
+c     reads records from a vdata into a char buffer
+c     related: VSread -- vsfirdc -- vsfrdc
+
+      integer   function        vsfrdc (vsid, buf, nelts , interlace)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfrdc
+	!MS$endif
+      integer                   vsid, nelts , interlace
+      character*(*)     buf
+c      integer          vsfirdc
+      INTERFACE 
+        INTEGER FUNCTION vsfirdc(vsid, buf, nelts, interlace)
+          !MS$ATTRIBUTES C,reference,alias:'_VSFIRDC' :: vsfirdc
+	    !DEC$ ATTRIBUTES reference :: buf
+          integer vsid, nelts, interlace
+		  character*(*)  buf
+        END FUNCTION vsfirdc
+      END INTERFACE
+
+      vsfrdc = vsfirdc (vsid, buf, nelts, interlace)
+      end
+
+c     ------------------------------------------------------------
+c     reads records from a vdata into a numeric buffer
+c     related: VSread--vsfird--vsfrd
+
+      integer   function        vsfrd (vsid, buf, nelts , interlace)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfrd
+	!MS$endif
+      integer                   vsid, nelts , interlace
+      integer     buf(*)
+C      integer                   vsfird
+      INTERFACE 
+        INTEGER FUNCTION vsfird(vsid, buf, nelts, interlace)
+          !MS$ATTRIBUTES C,reference,alias:'_VSFIRD' :: vsfird
+          integer vsid, nelts, interlace
+          integer buf(*)
+        END FUNCTION vsfird
+      END INTERFACE
+
+      vsfrd = vsfird (vsid, buf, nelts, interlace)
+      end
+
+c     ------------------------------------------------------------
+c     writes records to a vdata from a char buffer
+c     related: VSwrite -- vsfiwrc -- vsfwrtc
+
+      integer   function        vsfwrtc(vsid, buf, nelts, interlace)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfwrtc
+	!MS$endif
+      integer                   vsid, nelts , interlace
+      character*(*)     buf
+c      integer          vsfiwrc
+      INTERFACE
+        INTEGER FUNCTION vsfiwrc(vsid, buf, nelts, interlace)
+          !MS$ATTRIBUTES C,reference,alias:'_VSFIWRC' :: vsfiwrc
+	    !DEC$ ATTRIBUTES reference :: buf
+          integer vsid, nelts, interlace
+		  character*(*) buf
+        END FUNCTION vsfiwrc
+      END INTERFACE
+
+      vsfwrtc = vsfiwrc (vsid, buf, nelts, interlace)
+      end
+
+c     ------------------------------------------------------------
+c     writes records to a vdata from a numeric buffer
+c     related: VSwrite -- vsfiwr -- vsfwrt
+
+      integer   function        vsfwrt(vsid, buf, nelts, interlace)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfwrt
+	!MS$endif
+      integer         vsid, nelts , interlace, buf(*)
+c      integer          vsfiwr
+      INTERFACE
+        INTEGER FUNCTION vsfiwr(vsid, buf, nelts, interlace)
+          !MS$ATTRIBUTES C,reference,alias:'_VSFIWR' :: vsfiwr
+          integer vsid, nelts, interlace, buf(*)
+        END FUNCTION vsfiwr
+      END INTERFACE
+
+      vsfwrt = vsfiwr (vsid, buf, nelts, interlace)
+      end
+
+c     ------------------------------------------------------------
+c     This function should replaced by vsfwrtc and vsfwrt
+c     writes to a vdata
+c     related: VSwrite--vswritc--vsfwrit
+
+      integer	function	vsfwrit (vs, buf, nelts, interlace)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfwrit
+	!MS$endif
+
+      integer			vs, nelts, interlace
+      character*(*)		buf	
+C      integer			vswritc
+      INTERFACE
+        INTEGER FUNCTION vswritc(vsid, buf, nelts, interlace)
+          !MS$ATTRIBUTES C,reference,alias:'_VSWRITC' :: vswritc
+	    !DEC$ ATTRIBUTES reference :: buf
+          integer vsid, nelts, interlace
+          character*(*)     buf
+        END FUNCTION vswritc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfsextf
+	!MS$endif
+
+      character*(*) fname
+
+      integer       vid, offset
+c      integer       vssextfc
+      INTERFACE
+        INTEGER FUNCTION vssextfc(vid, fname, offset, nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSSEXTFC' :: vssextfc
+	    !DEC$ ATTRIBUTES reference :: fname
+          integer vid, offset, nmlen
+          character*(*) fname
+        END FUNCTION vssextfc
+      END INTERFACE
+
+      vsfsextf = vssextfc(vid, fname, offset, len(fname))
+      return
+      end
+
+c     ===========================================
+c     VDATA FIELD MANIPULATION ROUTINES
+c     ===========================================
+C-----------------------------------------------------------
+C     vfnflds -- number of fields in a vdata
+C     related: VFnfields -- vfinflds -- vfnflds
+
+      integer function vfnflds(vsid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfnflds
+	!MS$endif
+      integer vsid
+C      integer vfinflds
+      INTERFACE 
+        INTEGER FUNCTION vfinflds(vsid)
+          !MS$ATTRIBUTES C,reference,alias:'_VFINFLDS' :: vfinflds
+          integer vsid
+        END FUNCTION vfinflds
+      END INTERFACE
+
+      vfnflds = vfinflds(vsid)
+      end
+
+C-----------------------------------------------------------
+C     vffname -- name of a field in a vdata
+C     related: VFfieldname -- vfifnm -- vffname
+
+      integer function vffname(vsid, findex, fname)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vffname
+	!MS$endif
+      integer vsid, findex
+      character*(*) fname
+C      integer vfifnm
+      INTERFACE 
+        INTEGER FUNCTION vfifnm(vsid, findex, fname)
+          !MS$ATTRIBUTES C,reference,alias:'_VFIFNM' :: vfifnm
+	    !DEC$ ATTRIBUTES reference :: fname
+          integer vsid, findex
+          character*(*) fname
+        END FUNCTION vfifnm
+      END INTERFACE
+
+      vffname = vfifnm(vsid, findex, fname)
+      end
+
+C-----------------------------------------------------------
+C     vfftype -- type of a field in a vdata
+C     related: VFfieldtype -- vfiftp -- vfftype
+
+      integer function vfftype(vsid, findex)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfftype
+	!MS$endif
+      integer vsid, findex
+C      integer vfifnm
+      INTERFACE 
+        INTEGER FUNCTION vfiftp(vsid, findex)
+          !MS$ATTRIBUTES C,reference,alias:'_VFIFTP' :: vfiftp
+          integer vsid, findex
+        END FUNCTION vfiftp
+      END INTERFACE
+
+      vfftype = vfiftp(vsid, findex)
+      end
+
+C-----------------------------------------------------------
+C     vffisiz -- HDF size of a field in a vdata
+C     related: VFfieldisize -- vfifisz -- vffisiz
+
+      integer function vffisiz(vsid, findex)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vffisiz
+	!MS$endif
+      integer vsid, findex
+C      integer vfifisz
+      INTERFACE 
+        INTEGER FUNCTION vfifisz(vsid, findex)
+          !MS$ATTRIBUTES C,reference,alias:'_VFIFISZ' :: vfifisz
+          integer vsid, findex
+        END FUNCTION vfifisz
+      END INTERFACE
+
+      vffisiz = vfifisz(vsid, findex)
+      end
+
+C-----------------------------------------------------------
+C     vffesiz -- memory size of a field in a vdata
+C     related: VFfieldesize -- vfifesz -- vffesiz
+
+      integer function vffesiz(vsid, findex)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vffesiz
+	!MS$endif
+      integer vsid, findex
+C      integer vfifesz
+      INTERFACE 
+        INTEGER FUNCTION vfifesz(vsid, findex)
+          !MS$ATTRIBUTES C,reference,alias:'_VFIFESZ' :: vfifesz
+          integer vsid, findex
+        END FUNCTION vfifesz
+      END INTERFACE
+
+      vffesiz = vfifesz(vsid, findex)
+      end
+
+C-----------------------------------------------------------
+C     vffordr -- order of a field in a vdata
+C     related: VFfieldorder -- vfifodr -- vffordr
+
+      integer function vffordr(vsid, findex)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vffordr
+	!MS$endif
+      integer vsid, findex
+C      integer vfifodr
+      INTERFACE 
+        INTEGER FUNCTION vfifodr(vsid, findex)
+          !MS$ATTRIBUTES C,reference,alias:'_VFIFODR' :: vfifodr
+          integer vsid, findex
+        END FUNCTION vfifodr
+      END INTERFACE
+
+      vffordr = vfifodr(vsid, findex)
+      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)					
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfgint
+	!MS$endif
+      integer 		vs
+c      integer		vsgintc
+      INTERFACE
+        INTEGER FUNCTION vsgintc(vs)
+          !MS$ATTRIBUTES C,reference,alias:'_VSGINTC' :: vsgintc
+          integer vs
+        END FUNCTION vsgintc
+      END INTERFACE
+
+      vsfgint = vsgintc (vs)
+      end
+
+c     ------------------------------------------------------------
+c     gets the number of elements in a vdata
+c     related: VSelts--vseltsc--vsfelts
+
+      integer 	function vsfelts (vs)			
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfelts
+	!MS$endif
+      integer  vs	
+c      integer	vseltsc
+      INTERFACE
+        INTEGER FUNCTION vseltsc(vs)
+          !MS$ATTRIBUTES C,reference,alias:'_VSELTSC' :: vseltsc
+          integer vs
+        END FUNCTION vseltsc
+      END INTERFACE
+
+      vsfelts = vseltsc (vs)
+      end
+
+c     ------------------------------------------------------------
+c     gets the fields in the vdata
+c     related: VSgetfields--vsgfldc--vsfgfld
+
+      integer	function vsfgfld (vs, fields)	
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfgfld
+	!MS$endif
+      integer			vs
+      character*(*) 	fields
+c      integer			vsgfldc
+      INTERFACE
+        INTEGER FUNCTION vsgfldc(vs, fields)
+          !MS$ATTRIBUTES C,reference,alias:'_VSGFLDC' :: vsgfldc
+	    !DEC$ ATTRIBUTES reference :: fields
+          integer vs
+          character*(*)   fields
+        END FUNCTION vsgfldc
+      END INTERFACE
+
+      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)		
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfsiz 
+	!MS$endif
+      integer			vs
+      character*(*) 	fields
+c      integer			vssizc
+      INTERFACE
+        INTEGER FUNCTION vssizc(vs, fields, fldslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSSIZC' :: vssizc
+	    !DEC$ ATTRIBUTES reference :: fields
+          integer vs, fldslen
+          character*(*) fields
+        END FUNCTION vssizc
+      END INTERFACE
+
+      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)		
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfents
+	!MS$endif
+      integer	f, vgid
+c      integer	ventsc 
+      INTERFACE
+        INTEGER FUNCTION ventsc(f, vgid)
+          !MS$ATTRIBUTES C,reference,alias:'_VENTSC' :: ventsc
+          integer f, vgid
+        END FUNCTION ventsc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vflone 
+	!MS$endif
+      integer	f, asize
+      integer	idarray(*) 
+c      integer	vlonec
+      INTERFACE
+        INTEGER FUNCTION vlonec(f, idarray, asize)
+          !MS$ATTRIBUTES C,reference,alias:'_VLONEC' :: vlonec
+          integer f, idarray(*), asize
+        END FUNCTION vlonec
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsflone
+	!MS$endif
+      integer   f, asize
+      integer   idarray(*)
+c      integer	vslonec
+      INTERFACE
+        INTEGER FUNCTION vslonec(f, idarray, asize)
+          !MS$ATTRIBUTES C,reference,alias:'_VSLONEC' :: vslonec
+          integer f, idarray(*), asize
+        END FUNCTION vslonec
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfind
+	!MS$endif
+      integer		f
+      character*(*)  name
+C      integer vfindc 	
+      INTERFACE
+        INTEGER FUNCTION vfindc(f, name, namelen)
+          !MS$ATTRIBUTES C,reference,alias:'_VFINDC' :: vfindc
+	    !DEC$ ATTRIBUTES reference :: name
+          integer f, namelen
+          character*(*) name
+        END FUNCTION vfindc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfndcls
+	!MS$endif
+      integer		f
+      character*(*)  class
+c      integer vfndclsc 	
+      INTERFACE
+        INTEGER FUNCTION vfndclsc(f, class, clslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VFNDCLSC' :: vfndclsc
+	    !DEC$ ATTRIBUTES reference :: class
+          integer f, clslen
+          character*(*) class
+        END FUNCTION vfndclsc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vhfsd
+	!MS$endif
+      integer		f
+      character*(*)  field
+      integer		buf(*)	
+      integer		n, dtype
+      character*(*)  vsname, vsclass
+c      integer vhsdc 	
+      INTERFACE
+        INTEGER FUNCTION vhsdc(f,field,buf,n,dtype,vsname,vsclass,
+     +                         fldlen, nmlen, clslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VHSDC' :: vhsdc
+	    !DEC$ ATTRIBUTES reference :: field, vsname, vsclass
+          integer f, buf(*),n,dtype,fldlen,nmlen, clslen
+          character*(*) field,vsname,vsclass
+        END FUNCTION vhsdc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vhfsdm
+	!MS$endif
+      integer			f
+      character*(*)  field
+      integer			buf(*)	
+      integer			n, dtype, order
+      character*(*)  vsname, vsclass
+c      integer vhsdmc 		
+      INTERFACE
+        INTEGER FUNCTION vhsdmc(f,field,buf,n,dtype,vsname,vsclass,
+     +                         order, fldlen, nmlen, clslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VHSDMC' :: vhsdmc
+	    !DEC$ ATTRIBUTES reference :: field,vsname,vsclass
+          integer f, buf(*),n,dtype,order, fldlen,nmlen, clslen
+          character*(*) field,vsname,vsclass
+        END FUNCTION vhsdmc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vhfscd
+	!MS$endif
+      integer           f
+      character*(*)  field
+      character      cbuf(*)
+      integer           n, dtype
+      character*(*)  vsname, vsclass
+c      integer vhscdc
+      INTERFACE
+        INTEGER FUNCTION vhscdc(f,field,cbuf,n,dtype,vsname,vsclass,
+     +                         fldlen, nmlen, clslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VHSCDC' :: vhscdc
+	    !DEC$ ATTRIBUTES reference :: field,vsname,vsclass,cbuf
+          integer f, n,dtype,fldlen,nmlen, clslen
+          character*(*) field,vsname,vsclass
+          character cbuf(*)
+        END FUNCTION vhscdc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vhfscdm
+	!MS$endif
+      integer                   f
+      character*(*)  field
+      character              cbuf(*)
+      integer                   n, dtype, order
+      character*(*)  vsname, vsclass
+c      integer vhscdmc
+      INTERFACE
+        INTEGER FUNCTION vhscdmc(f,field,cbuf,n,dtype,vsname,vsclass,
+     +                         order, fldlen, nmlen, clslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VHSCDMC' :: vhscdmc
+	    !DEC$ ATTRIBUTES reference :: field,vsname,vsclass, cbuf
+          integer f, n,dtype,order, fldlen,nmlen, clslen
+          character*(*) field,vsname,vsclass
+          character   cbuf(*)
+        END FUNCTION vhscdmc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vhfmkgp
+	!MS$endif
+      integer		f, n
+      integer		tagarray(*), refarray(*)
+      character*(*)  vgname, vgclass
+c      integer 		vhmkgpc 	
+      INTERFACE
+        INTEGER FUNCTION vhmkgpc(f,tagarray, refarray,n,vgname,
+     +                         vgclass, nmlen, clslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VHMKGPC' :: vhmkgpc
+	    !DEC$ ATTRIBUTES reference :: vgname,vgclass
+          integer f, tagarray(*), refarray(*),n,nmlen,clslen
+          character*(*) vgname,vgclass
+        END FUNCTION vhmkgpc
+      END INTERFACE
+
+      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--vflocc--vffloc
+
+      integer function vffloc  (vg, field)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vffloc
+	!MS$endif
+      integer			vg
+      character*(*)	field
+c      integer 			vflocc
+      INTERFACE
+        INTEGER FUNCTION vflocc(vg, field, fldlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VFLOCC' :: vflocc
+	    !DEC$ ATTRIBUTES reference :: field
+          integer vg, fldlen
+          character*(*) field
+        END FUNCTION vflocc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfinqtr
+	!MS$endif
+      integer		vg, tag, ref
+c      integer		vinqtrc
+      INTERFACE
+        INTEGER FUNCTION vinqtrc(vg, tag,ref)
+          !MS$ATTRIBUTES C,reference,alias:'_VINQTRC' :: vinqtrc
+          integer vg, tag,ref
+        END FUNCTION vinqtrc
+      END INTERFACE
+
+      vfinqtr = vinqtrc (vg, tag, ref)
+      end
+
+c     ------------------------------------------------------------
+c     gets the number of tag/refs stored in a vgroup
+c     related: Vntagrefs -- vntrc -- vfntr
+
+      integer function vfntr (vg)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfntr
+	!MS$endif
+      integer		vg
+c      integer vntrc 
+      INTERFACE
+        INTEGER FUNCTION vntrc(vg)
+          !MS$ATTRIBUTES C,reference,alias:'_VNTRC' :: vntrc
+          integer vg
+        END FUNCTION vntrc
+      END INTERFACE
+
+      vfntr = vntrc (vg)
+      end
+c     ------------------------------------------------------------
+c     gets the number of tags of a given type in a vgroup
+c     related: Vnrefs -- vfirefs -- vnrefs
+
+      integer function vnrefs(vgid, tag)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vnrefs
+	!MS$endif
+      integer           vgid, tag
+C      integer vfirefs
+      INTERFACE
+        INTEGER FUNCTION vfirefs(vgid, tag)
+          !MS$ATTRIBUTES C,reference,alias:'_VFIREFS' :: vfirefs
+          integer vgid, tag
+        END FUNCTION vfirefs
+      END INTERFACE
+      
+      vnrefs = vfirefs(vgid, tag)
+      end
+
+c     ------------------------------------------------------------
+c     gets the reference number of this vgroup
+c     related: VQueryref -- vfiqref -- vqref
+
+      integer function vqref(vgid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vqref
+	!MS$endif
+      integer           vgid
+C      integer vfiqref
+      INTERFACE
+        INTEGER FUNCTION vfiqref(vgid)
+          !MS$ATTRIBUTES C,reference,alias:'_VFIQREF' :: vfiqref
+          integer vgid
+        END FUNCTION vfiqref
+      END INTERFACE
+
+      vqref = vfiqref(vgid)
+      end
+
+c     ------------------------------------------------------------
+c     gets the tag of this vgroup
+c     related: VQuerytag -- vfiqtag -- vqtag
+
+      integer function vqtag(vgid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vqtag
+	!MS$endif
+      integer           vgid
+C      integer vfiqtag
+      INTERFACE
+        INTEGER FUNCTION vfiqtag(vgid)
+          !MS$ATTRIBUTES C,reference,alias:'_VFIQTAG' :: vfiqtag
+          integer vgid
+        END FUNCTION vfiqtag
+      END INTERFACE
+
+      vqtag = vfiqtag(vgid)
+      end
+
+
+c     ------------------------------------------------------------
+c     returns all the tag/ref pairs in a vgroup
+c     related: Vgettagrefs--vgttrsc--vfgttrs
+
+      integer function vfgttrs (vg, tagarray, refarray, n)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfgttrs
+	!MS$endif
+      integer		vg, n
+      integer		tagarray(*), refarray(*)
+c      integer		vgttrsc
+      INTERFACE
+        INTEGER FUNCTION vgttrsc(vg, tagarray,refarray, n)
+          !MS$ATTRIBUTES C,reference,alias:'_VGTTRSC' :: vgttrsc
+          integer vg, tagarray(*),refarray(*)
+        END FUNCTION vgttrsc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfgttr
+	!MS$endif
+      integer		vg, which
+      integer		tag, ref
+c      integer		vgttrc
+      INTERFACE
+        INTEGER FUNCTION vgttrc(vg, which, tag,ref)
+          !MS$ATTRIBUTES C,reference,alias:'_VGTTRC' :: vgttrc
+          integer vg, which, tag,ref
+        END FUNCTION vgttrc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfadtr
+	!MS$endif
+      integer		vg, tag, ref
+c      integer vadtrc				
+      INTERFACE
+        INTEGER FUNCTION vadtrc(vg, tag,ref)
+          !MS$ATTRIBUTES C,reference,alias:'_VADTRC' :: vadtrc
+          integer vg, tag,ref
+        END FUNCTION vadtrc
+      END INTERFACE
+
+      vfadtr = vadtrc  ( vg, tag, ref)
+      end
+
+c     ------------------------------------------------------------
+c     specific inquiry on a vdata, gets number of records
+c     related: VSQuerycount -- vsiqnelt -- vsqfnelt
+
+      integer function vsqfnelt(vsid, nelts)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsqfnelt
+	!MS$endif
+      integer                   vsid, nelts
+c      integer                   vsiqnelt
+      INTERFACE 
+        INTEGER FUNCTION vsiqnelt(vsid, nelts)
+          !MS$ATTRIBUTES C,reference,alias:'_VSIQNELT' :: vsiqnelt
+          integer vsid, nelts
+        END FUNCTION vsiqnelt
+      END INTERFACE
+      vsqfnelt = vsiqnelt (vsid,nelts)
+      end
+
+c     ------------------------------------------------------------
+c     specific inquiry on a vdata, gets interlace
+c     related: VSQueryinterlace -- vsiqintr -- vsqfintr
+
+      integer function vsqfintr(vsid,interlace)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsqfintr
+	!MS$endif
+      integer                   vsid, interlace
+c      integer                   vsiqintr
+      INTERFACE
+        INTEGER FUNCTION vsiqintr(vsid, interlace)
+          !MS$ATTRIBUTES C,reference,alias:'_VSIQINTR' :: vsiqintr
+          integer vsid, interlace
+        END FUNCTION vsiqintr
+      END INTERFACE
+
+      vsqfintr = vsiqintr (vsid,interlace)
+      end
+
+c     ------------------------------------------------------------
+c     specific inquiry on a vdata, gets record size on local machine
+c     related: VSQueryvsize -- vsiqvsz -- vsqfvsiz 
+
+      integer function vsqfvsiz(vsid,size)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsqfvsiz
+	!MS$endif
+      integer                   vsid, size
+c      integer                   vsiqvsz
+      INTERFACE 
+        INTEGER FUNCTION vsiqvsz(vsid, size)
+          !MS$ATTRIBUTES C,reference,alias:'_VSIQVSZ' :: vsiqvsz
+          integer vsid, size
+        END FUNCTION vsiqvsz
+      END INTERFACE
+
+      vsqfvsiz = vsiqvsz (vsid,size)
+      end
+
+c     ------------------------------------------------------------
+c     specific inquiry on a vdata, gets fields
+c     related: VSQueryfields--vsqfldsc--vsqfflds
+
+      integer function vsqfflds (vs,fields) 
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsqfflds
+	!MS$endif
+      integer			vs
+      character*(*)	fields
+c      integer			vsqfldsc
+      INTERFACE
+        INTEGER FUNCTION vsqfldsc(vs, fields, fldslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSQFLDSC' :: vsqfldsc
+	    !DEC$ ATTRIBUTES reference :: fields
+          integer vs, fldslen
+          character*(*) fields
+        END FUNCTION vsqfldsc
+      END INTERFACE
+
+      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) 
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsqfname
+	!MS$endif
+      integer			vs
+      character*(*)	name
+c      integer			vsqnamec
+      INTERFACE
+        INTEGER FUNCTION vsqnamec(vs, name, nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSQNAMEC' :: vsqnamec
+	    !DEC$ ATTRIBUTES reference :: name
+          integer vs, nmlen
+          character*(*) name
+        END FUNCTION vsqnamec
+      END INTERFACE
+
+      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     In Fortran paktype = HDF_VSPACK(0) for packing
+c                          HDF_VSUNPACK(1) for unpacking
+
+      integer function vsfnpak(vs,packtype,buflds,buf,bufsz,
+     +                        nrecs,pckfld,fldbuf)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfnpak
+	!MS$endif
+      integer vs, bufsz, nrecs, packtype
+      integer buf, fldbuf
+      character*(*) buflds, pckfld
+c      integer vsfncpk
+      INTERFACE
+        INTEGER FUNCTION vsfncpk(vs,ptype,buflds,buf,bufsz,
+     +               nrecs,pckfld, fldbuf, bfldslen,pfldlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSFNCPK' :: vsfncpk
+	    !DEC$ ATTRIBUTES reference :: buflds, pckfld
+          integer vs,ptype,buf, bufsz,nrecs,fldbuf,bfldslen
+          integer pfldlen
+          character*(*) buflds, pckfld
+        END FUNCTION vsfncpk
+      END INTERFACE
+      
+      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     In Fortran paktype = HDF_VSPACK(0) for packing
+c                          HDF_VSUNPACK(1) for unpacking
+
+      integer function vsfcpak(vs,packtype,buflds,buf,bufsz,
+     +                        nrecs,pckfld,fldbuf)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsfcpak
+	!MS$endif
+      integer vs, packtype, bufsz, nrecs
+      integer buf
+      character*(*) buflds, pckfld, fldbuf
+c      integer vsfccpk
+      INTERFACE
+        INTEGER FUNCTION vsfccpk(vs,ptype,buflds,buf,bufsz,
+     +               nrecs,pckfld, fldbuf, bfldslen,pfldlen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSFCCPK' :: vsfccpk
+	    !DEC$ ATTRIBUTES reference :: buflds,fldbuf,  pckfld
+          integer vs,ptype,buf, bufsz,nrecs,bfldslen
+          integer pfldlen
+          character*(*) buflds,fldbuf,  pckfld
+        END FUNCTION vsfccpk
+      END INTERFACE
+      
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vfdtr
+	!MS$endif
+      integer		vg, tag, ref
+C      integer vdtrc				
+      INTERFACE
+        INTEGER FUNCTION vdtrc(vg, tag, ref)
+          !MS$ATTRIBUTES C,reference,alias:'_VDTRC' :: vdtrc
+          integer vg, tag, ref
+        END FUNCTION vdtrc
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vsffcls
+	!MS$endif
+C
+         INTEGER id
+         CHARACTER*(*) vdclass
+C         INTEGER vscfcls 
+      INTERFACE
+        INTEGER FUNCTION vscfcls(id, vdclass, vdclasslen)
+          !MS$ATTRIBUTES C,reference,alias:'_VSCFCLS' :: vscfcls
+	    !DEC$ ATTRIBUTES reference :: vdclass
+          integer id, vdclasslen
+          character*(*) vdclass
+        END FUNCTION vscfcls
+      END INTERFACE
+C
+         vsffcls = vscfcls(id,vdclass, len(vdclass)) 
+
+C
+         return 
+         end
+C-------------------------------------------------------------------------
+C        Name:      vdelete
+C        Purpose:   deletes vgroup from the file
+C        Inputs:    id       -  file ID
+C                   vgid     -  vgroup identifier
+C        Returns:   returns 0 if successfull, -1 on error
+C        Calls:     vdeletec (C stub for Vdelete function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+         INTEGER function vdelete(id, vgid)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: vdelete
+	!MS$endif
+C
+         INTEGER id, vgid
+ 
+      INTERFACE
+        INTEGER FUNCTION vdeletec(id, vgid)
+          !MS$ATTRIBUTES C,reference,alias:'_VDELETEC' :: vdeletec
+          integer id, vgid
+        END FUNCTION vdeletec
+      END INTERFACE
+C
+         vdelete = vdeletec(id, vgid)
+ 
+C
+         return
+         end
+ 
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/glist.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/glist.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/glist.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1207 @@
+/****************************************************************************
+ * 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             *
+ * COPYING file.                                                            *
+ *                                                                          *
+ ****************************************************************************/
+
+/************************************************************************
+  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,v 1.7 1998/02/02 21:38:44 smitchel Exp $";
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "glist.h"
+
+/* Commmented out the following */
+#if 0
+/* Macintosh */
+#if defined SYMANTEC_C || defined macintosh
+#define malloc NewPtr
+#define free   DisposePtr
+#endif /* SYMANTEC_C || macintosh */
+
+#define NEW(x) ((x *) emalloc(sizeof(x)))
+static void *emalloc(unsigned int n);
+static char *module = "generic_list";
+#endif /* Commented out */
+
+/*+
+****************************************************************************
+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

Added: packages/libhdf4/branches/upstream/current/hdf/src/glist.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/glist.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/glist.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,669 @@
+/****************************************************************************
+ * 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             *
+ * COPYING file.                                                            *
+ *                                                                          *
+ ****************************************************************************/
+
+/************************************************************************
+  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,v 1.2 1996/10/02 18:45:09 georgev Exp $ */
+
+#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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hbitio.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hbitio.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hbitio.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1004 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.41 $";
+#endif
+
+/* $Id: hbitio.c,v 1.41 1999/06/16 21:10:51 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_hbitio_c
+#endif
+ 
+/*
+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();
+
+#ifdef QAK
+{
+    static int total=0;
+    total+=count;
+printf("%s: total=%d\n",FUNC,total);
+}
+#endif /* QAK */
+    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;
+#ifdef QAK
+printf("%s: check 1.0, new_block=%d\n",FUNC,new_block);
+#endif /* QAK */
+    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);
+
+#ifdef QAK
+printf("%s: flushbit=%d\n",FUNC,flushbit);
+#endif /* QAK */
+    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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_HIbitstart);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask,ID_HIbitstart);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef QAK
+printf("%s: byte_offset=%d, max_offset=%d, bitfile_rec->count=%d\n",FUNC,(int)bitfile_rec->byte_offset,(int)bitfile_rec->max_offset,(int)bitfile_rec->count);
+#endif /* QAK */
+          if (bitfile_rec->byte_offset > bitfile_rec->max_offset)
+            {
+#ifdef QAK
+printf("%s: flushing bits, flushbit=%d, count=%d\n",FUNC,flushbit,bitfile_rec->count);
+#endif /* QAK */
+                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 */
+#ifdef QAK
+printf("%s: merging bits, bytea=%p, bytep=%p, bytez=%p\n",FUNC,bitfile_rec->bytea,bitfile_rec->bytep,bitfile_rec->bytez);
+#endif /* QAK */
+                /* 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);
+#ifdef QAK
+printf("%s: write_size=%d\n",FUNC,write_size);
+#endif /* QAK */
+          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;
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hbitio.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hbitio.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hbitio.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,85 @@
+
+/****************************************************************************
+ * 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: hbitio.h,v 1.14 1996/10/28 22:48:26 koziol Exp $ */
+
+/*
+   **  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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hblocks.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hblocks.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hblocks.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1802 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.63 $";
+#endif
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_hblocks_c
+#endif
+
+/* $Id: hblocks.c,v 1.63 1999/06/16 21:10:52 dwells Exp $ */
+
+/*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 - 22 bytes)
+   ===============================================
+   <-  4 bytes -> <- 4 bytes  -> <-   4 bytes  -> <- 4bytes ->
+   --------------------------------------------------------------
+   |ext_tag_desc | elem_tot_len | blk_first_len  | blk_length |   ... cont'd
+   --------------------------------------------------------------
+    
+   <- 4 bytes -> <- 2 bytes ->
+   --------------------------
+...  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_first_len  - Length of the first data block(32 bit field)
+   blk_length     - Length of successive data blocks(32 bit field)
+   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
+   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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_HLcreate);
+#endif /* HAVE_PABLO */
+
+#ifdef QAK
+printf("%s: block_length=%ld, number_blocks=%ld\n",FUNC,block_length,number_blocks);
+#endif /* QAK */
+    /* 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 */
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask,ID_HLcreate);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_HLconvert);
+#endif /* HAVE_PABLO */
+
+#ifdef QAK
+printf("%s: block_length=%ld, number_blocks=%ld\n",FUNC,block_length,number_blocks);
+#endif /* QAK */
+    /* 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 */
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask,ID_HLconvert);
+#endif /* HAVE_PABLO */
+
+  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);
+    }
+
+    /* 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 */
+
+/* ------------------------------ 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 */
+#ifdef QAK
+printf("%s: length=%ld, info->length=%d, access_rec->posn=%d\n",FUNC,(long)length,(int)info->length,(int)access_rec->posn);
+#endif /* QAK */
+    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;
+
+#ifdef QAK
+printf("%s: check 0\n",FUNC);
+#endif /* QAK */
+    /* search for linked block to start reading from */
+    if (relative_posn < info->first_length)
+      { /* first block */
+#ifdef QAK
+printf("%s: check 1\n",FUNC);
+#endif /* QAK */
+          block_idx = 0;
+          current_length = info->first_length;
+      }
+    else /* not first block? */
+      {
+#ifdef QAK
+printf("%s: check 2\n",FUNC);
+#endif /* QAK */
+          relative_posn -= info->first_length;
+          block_idx = relative_posn / info->block_length + 1;
+          relative_posn %= info->block_length;
+          current_length = info->block_length;
+      }
+#ifdef QAK
+printf("%s: check 3\n",FUNC);
+#endif /* QAK */
+
+/* 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;
+
+#ifdef QAK
+printf("%s: check 4, block_idx=%d\n",FUNC,block_idx);
+#endif /* QAK */
+    /* 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;
+#ifdef QAK
+printf("%s: check 5, remaining=%d\n",FUNC,remaining);
+#endif /* QAK */
+          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]);
+
+#ifdef QAK
+printf("%s: check 6, relative_posn=%d\n",FUNC,(int)relative_posn);
+#endif /* QAK */
+                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 */
+#ifdef QAK
+printf("%s: check 7\n",FUNC);
+#endif /* QAK */
+                HDmemset(data, 0, (size_t)remaining);
+                bytes_read += nbytes;
+            }
+
+#ifdef QAK
+printf("%s: check 7.2\n",FUNC);
+#endif /* QAK */
+          /* 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 */
+
+#ifdef QAK
+printf("%s: check 8, bytes_read=%d\n",FUNC,bytes_read);
+#endif /* QAK */
+    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 */
+        HAatom_object(access_rec->file_id);
+    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;
+
+#ifdef QAK
+printf("%s: length=%d\n",FUNC,(int)length);
+printf("%s: info->first_length=%d\n",FUNC,(int)info->first_length);
+printf("%s: info->block_length=%d\n",FUNC,(int)info->block_length);
+printf("%s: info->number_blocks=%d\n",FUNC,(int)info->number_blocks);
+printf("%s: info->length=%d\n",FUNC,(int)info->length);
+printf("%s: access_rec->posn=%d\n",FUNC,(int)access_rec->posn);
+#endif /* QAK */
+    /* 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;
+      }
+#ifdef QAK
+printf("%s: relative_posn=%d\n",FUNC,(int)relative_posn);
+printf("%s: current_length=%d\n",FUNC,(int)current_length);
+printf("%s: (a) block_idx=%d\n",FUNC,(int)block_idx);
+#endif /* QAK */
+    {
+        /* 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--)
+          {
+#ifdef QAK
+printf("%s: num_links=%d\n",FUNC,num_links);
+#endif /* QAK */
+              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;
+#ifdef QAK
+printf("%s: (b) block_idx=%d\n",FUNC,(int)block_idx);
+#endif /* QAK */
+
+    /* 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;
+
+#ifdef QAK
+printf("%s: remaining=%d\n",FUNC,(int)remaining);
+#endif /* QAK */
+          /* 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;
+#ifdef QAK
+printf("%s: ret_value=%ld\n",FUNC,(long)bytes_written);
+#endif /* QAK */
+
+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);
+
+        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 */
+        HAatom_object(access_rec->file_id);
+    intn      ret_value = SUCCEED;
+
+    /* 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hbuffer.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hbuffer.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hbuffer.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,659 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.6 $";
+#endif
+
+/* $Id: hbuffer.c,v 1.6 1999/06/16 21:10:55 dwells Exp $ */
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_hbuffer_c
+#endif
+
+/*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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HBconvert);
+#endif /* HAVE_PABLO */
+    /* clear error stack and validate args */
+    HEclear();
+    if ((access_rec = HAatom_object(aid)) == NULL)	/* get the access_rec pointer */
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    /* 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);
+
+#ifdef QAK
+printf("%s: check 2.0, data_off=%d, data_len=%d\n",FUNC,(int)data_off,(int)data_len);
+#endif /* QAK */
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_HBconvert);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    /* 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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hchunks.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hchunks.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hchunks.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,3753 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.31 $";
+#endif
+
+/* $Id: hchunks.c,v 1.31 1999/06/16 21:10:55 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_hchunks_c
+#endif
+
+/*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
+
+   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[4];      /* 4 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       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        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 specail chunk info */
+          if ((info = 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 specail 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*/
+          if ((info->chk_cache = 
+               mcache_open(&access_rec->file_id,                   /* cache key */
+                           access_aid,                             /* object id */
+                           (info->chunk_size*info->nt_size),       /* chunk size */
+                           info->ddims[info->ndims -1].num_chunks, /* 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       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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCcreate);
+#endif /* HAVE_PABLO */
+
+    /* 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);
+
+    /* 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 */
+                     info->ddims[info->ndims -1].num_chunks, /* 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);
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCcreate);
+#endif /* HAVE_PABLO */
+
+    return ret_value;
+} /* HMCcreate() */
+
+
+/*--------------------------------------------------------------------------
+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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCsetMaxcache);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCsetMaxcache);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCPstread);
+#endif /* HAVE_PABLO */
+
+    ret_value = HMCIstaccess(access_rec, DFACC_READ);
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPstread);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCPstwrite);
+#endif /* HAVE_PABLO */
+
+    ret_value = HMCIstaccess(access_rec, DFACC_WRITE);
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPstwrite);
+#endif /* HAVE_PABLO */
+
+    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 HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCPseek);
+#endif /* HAVE_PABLO */
+
+#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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPseek);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCPchunkread);
+#endif /* HAVE_PABLO */
+
+    /* 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 HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPchunkread);
+#endif /* HAVE_PABLO */
+#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 HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCreadChunk);
+#endif /* HAVE_PABLO */
+#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 HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCreadChunk);
+#endif /* HAVE_PABLO */
+#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 HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCPread);
+#endif /* HAVE_PABLO */
+
+#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
+          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);
+#ifdef CHK_DEBUG_3
+          printf("  reading chunk(%d) with %d bytes\n", chunk_num, chunk_size);
+#endif
+
+          /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPread);
+#endif /* HAVE_PABLO */
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCPchunkwrite);
+#endif /* HAVE_PABLO */
+
+    /* 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
+
+          /* 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 HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPchunkwrite);
+#endif /* HAVE_PABLO */
+#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 HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCwriteChunk);
+#endif /* HAVE_PABLO */
+#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 HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCwriteChunk);
+#endif /* HAVE_PABLO */
+#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 HAVE_PABLO_4
+    TRACE_ON(PABLO_mask,ID_HMCPwrite);
+#endif /* HAVE_PABLO */
+
+#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 HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPwrite);
+#endif /* HAVE_PABLO */
+#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_CANTFLUSH, 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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCPendaccess);
+#endif /* HAVE_PABLO */
+
+    /* 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_CANTFLUSH, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPendaccess);
+#endif /* HAVE_PABLO */
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCPinfo);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPinfo);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HMCPinquire);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HMCPinquire);
+#endif /* HAVE_PABLO */
+
+    return ret_value;
+}   /* HMCPinquire */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hchunks.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hchunks.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hchunks.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,285 @@
+/****************************************************************************
+ * 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: hchunks.h,v 1.18 1998/07/22 16:06:56 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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
+
+/* 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 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 */);
+
+/* 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hcomp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hcomp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hcomp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1387 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.57 $";
+#endif
+
+/* $Id: hcomp.c,v 1.57 1999/03/27 19:44:01 epourmal Exp $ */
+
+/*
+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"
+
+/* HDF compression includes */
+#include "hcompi.h"     /* Internal definitions for compression */
+
+/* Local defines */
+#define COMP_HEADER_VERSION 0
+#define COMP_HEADER_LENGTH  14
+#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
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIinit_coder(int16 acc_mode, comp_coder_info_t * cinfo, comp_coder_t coder_type,
+              comp_info * c_info)
+{
+    CONSTR(FUNC, "HCIinit_coder");  /* for HERROR */
+
+    switch (coder_type)
+      {     /* determin 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)
+
+              cinfo->coder_type = COMP_CODE_SKPHUFF;    /* set the coding type */
+              cinfo->coder_funcs = cskphuff_funcs;  /* set the skipping huffman func. ptrs */
+
+              /* 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)
+
+              cinfo->coder_type = COMP_CODE_DEFLATE;    /* set the coding type */
+              cinfo->coder_funcs = cdeflate_funcs;  /* set the gzip 'deflate' func. ptrs */
+
+              /* copy encoding info */
+              if(acc_mode&DFACC_WRITE)
+                  cinfo->coder_info.deflate_info.deflate_level = c_info->deflate.level;
+              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;
+
+          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;
+
+          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:      /* N-bit coding needs info */
+              {
+                  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 */
+
+                  /* specify 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;
+                  /* the flag to indicate whether to fill with 1's or 0's */
+                  UINT16DECODE(p, f_one);
+                  c_info->nbit.fill_one = (intn) f_one;
+                  /* the offset of the bits extracted */
+                  INT32DECODE(p, m_off);
+                  c_info->nbit.start_bit = (intn) m_off;
+                  /* the number of bits extracted */
+                  INT32DECODE(p, m_len);
+                  c_info->nbit.bit_len = (intn) m_len;
+              }     /* end case */
+              break;
+
+          case COMP_CODE_SKPHUFF:   /* Skipping Huffman  coding needs info */
+              {
+                  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:   /* Deflation coding stores deflation level */
+              {
+                  uint16      level;    /* deflation level */
+
+                  /* specify deflation level */
+                  UINT16DECODE(p, level);
+                  c_info->deflate.level = (intn) level;
+              }     /* end case */
+              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 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;
+
+          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 */
+    uint16      ctag, cref;     /* tag/ref for the object */
+    int32       temp_aid;       /* temporary AID for header info */
+    int32       data_len;		/* offset of the data we are checking */
+    uint8      *p;              /* pointer to the temporary buffer */
+    uint8      *local_ptbuf;
+    int32       ret_value=SUCCEED;
+
+    /* shut compiler up */
+    m_info = m_info;
+
+    /* get the info for the dataset */
+    if(HTPinquire(access_rec->ddid,&ctag,&cref,NULL,&data_len)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    if((local_ptbuf=(uint8 *)HDmalloc(data_len))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* Get the compression header */
+    if ((temp_aid=Hstartaccess(access_rec->file_id,MKSPECIALTAG(ctag),cref,DFACC_READ)) == FAIL)
+        HGOTO_ERROR(DFE_BADAID, FAIL);
+    if (Hread(temp_aid,0,local_ptbuf) == FAIL)
+        HGOTO_ERROR(DFE_READERROR, FAIL);
+    if(Hendaccess(temp_aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    p = local_ptbuf+2;
+    UINT16DECODE(p, header_version);    /* get header length */
+    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
+    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 */
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    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 */
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    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);
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    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;
+#ifdef QAK
+printf("%s: check 1.0: access_rec->posn=%d, info->length=%d\n",FUNC,(int)access_rec->posn,(int)info->length);
+#endif /* QAK */
+
+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;
+
+#ifdef QAK
+printf("%s: length=%d, data=%p\n",FUNC,(int)length,data);
+#endif /* QAK */
+    /* 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);
+
+#ifdef QAK
+printf("%s: check 1.0: access_rec->posn=%d, info->length=%d\n",FUNC,(int)access_rec->posn,(int)info->length);
+#endif /* QAK */
+    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 */
+                           HAatom_object(access_rec->file_id);  
+    int32       ret_value;
+
+    /* validate length */
+    if (length < 0)
+        HRETURN_ERROR(DFE_RANGE, FAIL);
+
+#ifdef QAK
+printf("%s: length=%d\n",FUNC,(int)length);
+#endif /* QAK */
+    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;
+#ifdef QAK
+printf("%s: check 1.0: access_rec->posn=%d, info->length=%d\n",FUNC,(int)access_rec->posn,(int)info->length);
+#endif /* QAK */
+    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 */
+#ifdef QAK
+printf("%s: check 2.0: access_rec->posn=%d, info->length=%d\n",FUNC,(int)access_rec->posn,(int)info->length);
+#endif /* QAK */
+
+    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 = HAatom_object(access_rec->file_id);    /* file record */
+    intn      ret_value = SUCCEED;
+
+    /* 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hcomp.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hcomp.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hcomp.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,128 @@
+/****************************************************************************
+ * 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: hcomp.h,v 1.19 1999/02/12 23:37:11 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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_INVALID,        /* invalid last code, for range checking */
+      COMP_CODE_JPEG            /* _Ugly_ hack to allow JPEG images to be created with GRsetcompress */
+  }
+comp_coder_t;
+
+/* Compression types available */
+#define COMP_NONE       0
+#define COMP_JPEG       2
+#define COMP_RLE        11
+#define COMP_IMCOMP     12
+
+#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;
+  }
+comp_info;
+
+#endif /* __HCOMP_H */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hcompi.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hcompi.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hcompi.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * 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: hcompi.h,v 1.13 1995/10/25 17:51:45 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 */
+
+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 */
+        }
+      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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hcompri.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hcompri.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hcompri.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,580 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.4 $";
+#endif
+
+/* $Id: hcompri.c,v 1.4 2000/02/29 21:34:46 koziol Exp $ */
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_hcompri_c
+#endif
+
+/*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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HRPconvert);
+#endif /* HAVE_PABLO */
+    /* clear error stack and validate args */
+    HEclear();
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    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) {
+#ifdef QAK
+printf("%s: check 2.0\n",FUNC);
+#endif /* QAK */
+        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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_HRPconvert);
+#endif /* HAVE_PABLO */
+  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 */
+#ifdef QAK
+printf("%s: length=%d, image_size=%d\n",FUNC,(int)length,(int)info->image_size);
+#endif /* QAK */
+    if (length!=0 && length!=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!=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 */
+        HAatom_object(access_rec->file_id);
+    intn     ret_value = SUCCEED;
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    /* 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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hconv.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hconv.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hconv.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,272 @@
+
+/****************************************************************************
+ * 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: hconv.h,v 1.20 2000/05/23 18:03:29 acheng Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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
+
+#ifndef VMS
+#define DUFF
+#else
+#ifdef DUFF
+#undef DUFF
+#endif
+#endif
+#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(VMS) && !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !defined(IA64)
+#   if !defined(UNICOS)
+#       define UI8_IN     DFKnb1b   /* Unsigned Integer, 8 bits */
+#       define UI8_OUT    DFKnb1b
+#   if defined(CRAYMPP)
+#       define SI16_IN    DFKmi2s
+#       define SI16_OUT   DFKmo2b
+#       define UI16_IN    DFKmi2i
+#       define UI16_OUT   DFKmo2b
+#   else
+#       define SI16_IN    DFKnb2b   /* S = Signed */
+#       define SI16_OUT   DFKnb2b
+#       define UI16_IN    DFKnb2b
+#       define UI16_OUT   DFKnb2b
+#   endif
+#       define SI32_IN    DFKnb4b
+#       define SI32_OUT   DFKnb4b
+#       define UI32_IN    DFKnb4b
+#       define UI32_OUT   DFKnb4b
+#   if defined(CONVEXNATIVE)
+#       define F32_IN     DFKci4f   /* CONVEX stuff */
+#       define F32_OUT    DFKco4f
+#       define F64_IN     DFKci8f
+#       define F64_OUT    DFKco8f
+#   elif defined(VP)
+#       define F32_IN     DFKpi4f   /* Fujitsu VP stuff */
+#       define F32_OUT    DFKpo4f
+#       define F64_IN     DFKpi8f
+#       define F64_OUT    DFKpo8f
+#   else    /* !CONVEXNATIVE */
+#       define F32_IN     DFKnb4b   /* Float, 32 bits */
+#       define F32_OUT    DFKnb4b
+#       define F64_IN     DFKnb8b
+#       define F64_OUT    DFKnb8b
+#   endif   /* CONVEXNATIVE */
+
+#       define LUI8_IN    DFKnb1b   /* Little Endian Unsigned Integer, 8 bits */
+#       define LUI8_OUT   DFKnb1b
+#   if defined(CRAYMPP)
+#       define LSI16_IN   DFKlmi2s
+#       define LSI16_OUT  DFKlmo2b
+#       define LUI16_IN   DFKlmi2i
+#       define LUI16_OUT  DFKlmo2b
+#   else
+#       define LSI16_IN   DFKsb2b
+#       define LSI16_OUT  DFKsb2b
+#       define LUI16_IN   DFKsb2b
+#       define LUI16_OUT  DFKsb2b
+#   endif
+#       define LSI32_IN   DFKsb4b
+#       define LSI32_OUT  DFKsb4b
+#       define LUI32_IN   DFKsb4b
+#       define LUI32_OUT  DFKsb4b
+#       if defined(CONVEXNATIVE)
+#           define LF32_IN  DFKlci4f    /* CONVEX little-endian routines */
+#           define LF32_OUT DFKlco4f
+#           define LF64_IN  DFKlci8f
+#           define LF64_OUT DFKlco8f
+#       elif defined(VP)
+#           define LF32_IN   DFKlpi4f   /* Fujitsu VP little-endian routines */
+#           define LF32_OUT  DFKlpo4f
+#           define LF64_IN   DFKlpi8f
+#           define LF64_OUT  DFKlpo8f
+#       else    /* !CONVEXNATIVE */
+#           define LF32_IN  DFKsb4b
+#           define LF32_OUT DFKsb4b
+#           define LF64_IN  DFKsb8b
+#           define LF64_OUT DFKsb8b
+#       endif   /* CONVEXNATIVE */
+
+#   else    /* UNICOS */
+#       define UI8_IN     DFKnb1b   /* Big-Endian IEEE support */
+#       define UI8_OUT    DFKnb1b
+#       define SI16_IN    DFKui2s
+#       define SI16_OUT   DFKuo2s
+#       define UI16_IN    DFKui2i
+#       define UI16_OUT   DFKuo2i
+#       define SI32_IN    DFKui4s
+#       define SI32_OUT   DFKuo4s
+#       define UI32_IN    DFKui4i
+#       define UI32_OUT   DFKuo4i
+#       define F32_IN     DFKui4f
+#       define F32_OUT    DFKuo4f
+#       define F64_IN     DFKui8f
+#       define F64_OUT    DFKuo8f
+
+#       define LUI8_IN    DFKnb1b   /* Little-endian IEEE support */
+#       define LUI8_OUT   DFKnb1b
+#       define LSI16_IN   DFKlui2s
+#       define LSI16_OUT  DFKluo2s
+#       define LUI16_IN   DFKlui2i
+#       define LUI16_OUT  DFKluo2i
+#       define LSI32_IN   DFKlui4s
+#       define LSI32_OUT  DFKluo4s
+#       define LUI32_IN   DFKlui4i
+#       define LUI32_OUT  DFKluo4i
+#       define LF32_IN    DFKlui4f
+#       define LF32_OUT   DFKluo4f
+#       define LF64_IN    DFKlui8f
+#       define LF64_OUT   DFKluo8f
+
+#   endif   /* !UNICOS */
+#else  /* must be VMS || INTEL86 || MIPSEL || DEC_ALPHA || I860 || SUN386 || IA64 (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
+#   if defined(VMS)
+#       define F32_IN     DFKvi4f
+#       define F32_OUT    DFKvo4f
+#       define F64_IN     DFKvi8f
+#       define F64_OUT    DFKvo8f
+#   else    /* !VMS */
+#       define F32_IN     DFKsb4b
+#       define F32_OUT    DFKsb4b
+#       define F64_IN     DFKsb8b
+#       define F64_OUT    DFKsb8b
+#   endif   /* VMS */
+
+#   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
+#   if defined(VMS)
+#       define LF32_IN     DFKlvi4f
+#       define LF32_OUT    DFKlvo4f
+#       define LF64_IN     DFKlvi8f
+#       define LF64_OUT    DFKlvo8f
+#   else    /* !VMS */
+#       define LF32_IN    DFKnb4b
+#       define LF32_OUT   DFKnb4b
+#       define LF64_IN    DFKnb8b
+#       define LF64_OUT   DFKnb8b
+#   endif   /* VMS */
+
+#endif /* !VMS && !INTEL86 && !MIPS && !DEC_ALPHA && !I860 && !SUN386 && !IA64 */
+
+/* All Machines (except the Cray) currently use the same routines */
+/* for Native mode "conversions" */
+#ifndef UNICOS
+#     define NUI8_IN    DFKnb1b
+#     define NUI8_OUT   DFKnb1b
+#   if defined(CRAYMPP)
+#     define NSI16_IN   DFKmi2s
+#     define NSI16_OUT  DFKmo2b
+#     define NUI16_IN   DFKmi2i
+#     define NUI16_OUT  DFKmo2b
+#   else
+#     define NSI16_IN   DFKnb2b
+#     define NSI16_OUT  DFKnb2b
+#     define NUI16_IN   DFKnb2b
+#     define NUI16_OUT  DFKnb2b
+#   endif
+#     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
+#else  /* UNICOS */
+#     define NUI8_IN    DFKnb1b
+#     define NUI8_OUT   DFKnb1b
+#     define NSI16_IN   DFKnb8b
+#     define NSI16_OUT  DFKnb8b
+#     define NUI16_IN   DFKnb8b
+#     define NUI16_OUT  DFKnb8b
+#     define NSI32_IN   DFKnb8b
+#     define NSI32_OUT  DFKnb8b
+#     define NUI32_IN   DFKnb8b
+#     define NUI32_OUT  DFKnb8b
+#     define NF32_IN    DFKnb8b
+#     define NF32_OUT   DFKnb8b
+#     define NF64_IN    DFKnb8b
+#     define NF64_OUT   DFKnb8b
+#endif /* UNICOS */
+
+/*****************************************************************************/
+/* STRUCTURE DEFINTIONS                                                      */
+/*****************************************************************************/
+union fpx
+  {
+      float       f;
+      long        l;
+  };
+
+union float_uint_uchar
+  {
+      float32     f;
+      int32       i;
+      unsigned char c[4];
+  };
+
+#endif /* _HCONV_H */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdf.bld
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdf.bld	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdf.bld	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,88 @@
++hfile &
++hbitio &
++herr &
++hblocks &
++hextelt &
++hcomp &
++hkit &
++dfan &
++dfr8 &
++dfcomp &
++dfrle &
++dfimcomp &
++dfjpeg &
++dfunjpeg &
++dfp &
++dfgr &
++df24 &
++dfsd &
++dfgroup &
++dfconv &
++dfknat &
++dfkswap &
++dfkcray &
++dfkvms &
++dfkconv &
++dfkfuji &
++dfufp2i &
++vg &
++vrw &
++vio &
++vparse &
++vconv &
++vsfld &
++vgp &
++vhi &
++tbbt &
++dfutil &
++dfstubs &
++hdfalloc &
++mstdio &
++crle &
++cnbit &
++hfilef &
++herrf &
++dfanf &
++dfr8f &
++dfpf &
++df24f &
++dfsdf &
++vgf &
++dff &
++dfutilf &
++hfileff &
++dfanff &
++df24ff &
++dfpff &
++dfr8ff &
++dfsdff &
++vgff &
++dfff &
++dfufp2if &
++jutils &
++jerror &
++jmemmgr &
++jmemsys &
++jmemdosa &
++jcmaster &
++jcdeflts &
++jcarith &
++jccolor &
++jcexpand &
++jchuff &
++jcmcu &
++jcpipe &
++jcsample &
++jfwddct &
++jdmaster &
++jddeflts &
++jbsmooth &
++jdarith &
++jdcolor &
++jdhuff &
++jdmcu &
++jdpipe &
++jdsample &
++jquant1 &
++jquant2 &
++jrevdct

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdf.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdf.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdf.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,172 @@
+
+/****************************************************************************
+ * 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: hdf.h,v 1.60 1998/09/02 21:09:17 acheng Exp $ */
+
+#ifndef HDF_H
+#define HDF_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
+
+#ifndef NULL
+#   define NULL (void *)0
+#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
+
+/* 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 "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 */
+
+/* For Pablo Instrumentation */
+#ifdef HAVE_PABLO
+#include "ProcIDs.h"
+#include "trace.h"
+#endif /* PABLO */
+
+/* these may eventaully evolve into real-life functions but not yet */
+#define HDFopen(f,a,d)      Hopen((f), (a), (d))
+#define HDFclose(f,a,d)     Hclose((f), (a), (d))
+#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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdf.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdf.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdf.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,456 @@
+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,v 1.24 2000/02/15 19:50:10 epourmal Exp $
+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
+      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_JPEG = 6)
+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***************************

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdfalloc.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdfalloc.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdfalloc.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,288 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.33 $";
+#endif
+
+/* $Id: hdfalloc.c,v 1.33 1998/02/02 21:38:45 smitchel Exp $ */
+
+#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
+--------------------------------------------------------------------------*/
+char *
+HIstrncpy(char *dest, const char *source, int32 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 VMS || defined macintosh || defined MAC || defined SYMANTEC_C || defined MIPSEL || defined NEXT || defined CONVEX || 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 /* VMS | macinosh */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdfi.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdfi.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdfi.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1464 @@
+/****************************************************************************
+ * 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: hdfi.h,v 1.146 2000/08/22 20:26:57 epourmal Exp $ */
+
+#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_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_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_CRAYMPP        0x1171
+#define     DFMT_IA64           0x4441
+
+/* I/O library constants */
+#define UNIXUNBUFIO 1
+#define UNIXBUFIO   2
+#define MACIO       3
+#define PCIO        4    /* 16-bit MS-DOS File I/O (deprecated) */
+#define WINIO       5    /* 16-bit Windows File I/O (deprecated) */
+#define PAGEBUFIO   6    /* page buffering - fmpool */
+#define WINNTIO     7    /* 32-bit Windows File I/O (deprecated, WinNT now uses UNIXBUFIO) */ 
+
+/* IBM RS6000 AIX hack */
+#if defined(IBM6000) || defined(_AIX)
+#define _POSIX_SOURCE
+#endif 
+
+/* Standard header files needed all the time */
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+
+/* PABLO support files */
+#ifdef HAVE_PABLO
+#define HDFIOTRACE
+#include "HDFIOTrace.h"
+#endif  /* HAVE_PABLO */
+
+/**
+ * Provide the macros to adapt the HDF public functions to
+ * dll entry points.
+ * In addition it provides error lines if the configuration is incorrect.
+ **/
+
+#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 ment 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 multithreaded project, you must use the HDF DLLs
+#		error Use the Mutlithreaded DLL runtime libraries (prefered), or define the macro "_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(_HDFDLL_)
+#		pragma warning( disable: 4273 )	/* Disable the stupid dll linkage warnings */
+
+#		if !defined(_HDFLIB_)
+#			define HDFPUBLIC __declspec(dllimport)
+#		else
+#			define HDFPUBLIC __declspec(dllexport)
+#		endif
+
+#		if !defined(_MFHDFLIB_) && !defined(_HDFLIB_)
+#			define HDFLIBAPI __declspec(dllimport) extern
+#		else
+#			define HDFLIBAPI __declspec(dllexport) extern
+#		endif 
+#	else
+#		define HDFPUBLIC
+#		define HDFLIBAPI extern
+#	endif
+#else	/* !defined( WIN32 ) */
+#	define HDFPUBLIC
+#	define HDFLIBAPI extern
+#endif
+
+
+/*-------------------------------------------------------------------------
+ * 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>
+#define DF_MT             DFMT_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;
+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)
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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 /* 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)
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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
+
+#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 long int          int32; 
+#endif  
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef unsigned char     uint8;
+typedef unsigned short int uint16;
+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)
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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 /* 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;
+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)
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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
+
+#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)
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#endif
+#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 */
+
+#if (defined(UNICOS) || defined(_UNICOS)) && !defined(_CRAYMPP)
+
+#ifndef UNICOS
+#define UNICOS
+#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 <fortran.h>
+#ifndef O_RDONLY
+#include <fcntl.h>              /* for unbuffered i/o stuff */
+#define L_INCR  1
+#include <sys/stat.h>
+#endif /*O_RDONLY*/
+
+#ifdef _CRAYIEEE
+#define DF_MT   DFMT_UNICOSIEEE
+#else
+#define DF_MT   DFMT_UNICOS
+#endif
+typedef void            VOID;
+typedef void            *VOIDP;
+#ifdef OLD_WAY /* May need to be included on other machines than the C-90 */
+typedef char            *_fcd;
+#endif /* OLD_WAY */
+typedef signed char     char8;
+typedef unsigned char   uchar8;
+typedef signed char     int8;
+typedef unsigned char   uint8;
+typedef int             int16;
+typedef unsigned 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 int               hdf_pint_t;   /* an integer the same size as a pointer */
+
+#define DF_CAPFNAMES            /* fortran names are in all caps */
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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 RIGHT_SHIFT_IS_UNSIGNED
+#define CHAR_IS_UNSIGNED
+
+#endif /* UNICOS */
+
+#if defined(_CRAYMPP)
+
+#ifndef CRAYMPP
+#define CRAYMPP
+#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 <string.h>
+#include <limits.h>
+#include <memory.h>
+#include <fortran.h>
+#ifndef O_RDONLY
+#include <fcntl.h>              /* for unbuffered i/o stuff */
+#define L_INCR  1
+#include <sys/stat.h>
+#endif /*O_RDONLY*/
+
+#define DF_MT   DFMT_CRAYMPP
+typedef void            VOID;
+typedef void            *VOIDP;
+#ifdef OLD_WAY /* May need to be included on other machines than the C-90 */
+typedef char            *_fcd;
+#endif /* OLD_WAY */
+typedef signed char     char8;
+typedef unsigned char   uchar8;
+typedef signed char     int8;
+typedef unsigned char   uint8;
+typedef short           int16;
+typedef unsigned short  uint16;
+typedef short           int32;
+typedef unsigned short  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 _HUGE              /* This should only be defined to a value on the PC */
+#define DF_CAPFNAMES            /* fortran names are in all caps */
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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 RIGHT_SHIFT_IS_UNSIGNED
+#define CHAR_IS_UNSIGNED
+
+#endif /* CRAYMPP */
+
+#if defined(VMS) || defined(vms)
+
+#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 <file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT              DFMT_VAX
+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 __alpha
+typedef int                int32;
+typedef unsigned int       uint32;
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#else
+typedef long int           int32;
+typedef unsigned long int  uint32;
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#endif
+typedef int                intn;
+typedef unsigned int       uintn;
+typedef float              float32;
+typedef double             float64;
+typedef int                intf;     /* size of INTEGERs in Fortran compiler */
+#define _fcdtocp(desc)  ((char *) *((char **) &desc[4]))
+
+/* 
+  Redef a couple of C routine names to avoid conflicts
+  since the VMS link command is case-insensitive
+*/
+#define FILELIB UNIXBUFIO
+#define DF_CAPFNAMES            /* fortran names are in all caps */
+#include "dfivms.h"
+
+
+/* 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 /* VMS */
+
+#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)
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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 RIGHT_SHIFT_IS_UNSIGNED
+#define INCLUDES_ARE_ANSI
+#define HAVE_STDC
+
+#endif /* CONVEX */
+
+
+#if defined(MIPSEL) || ((defined(mips) || defined(__mips)) && (defined(ultrix) || defined(__ultrix)))
+
+#ifndef MIPSEL
+#define MIPSEL
+#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>
+#define DF_MT   DFMT_MIPSEL
+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
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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
+
+#endif /* MIPSEL */
+
+#if defined(MAC) || defined(macintosh) || defined (SYMANTEC_C)
+
+#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>             /* malloc stuff for MPW */
+#include <fcntl.h>              /* unbuffered I/O stuff for MPW */
+#ifdef __MWERKS__				/* Metrowerks */
+#include <sioux.h>
+#include <console.h>
+#endif
+#ifdef SYMANTEC_C				/* for SYMANTEC C */
+#include <unix.h>
+#define isascii(c)  (isprint(c) || iscntrl(c))
+#else  /* MPW, possibly others */
+#include <Files.h>              /* for unbuffered I/O stuff */
+#endif /* SYMANTEC_C*/
+#ifndef ABSOFT
+#define DF_CAPFNAMES            /* fortran names are in all caps */
+#endif /* ABSOFT */
+#define DF_DYNAMIC              /* use dynamic allocation */
+#define DF_MT   DFMT_MAC
+
+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)
+void exit(int status);
+
+#define FILELIB MACIO
+
+/* 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 /*MAC*/
+
+/* Metrowerks Mac compiler defines some PC stuff so need to exclude this on the Mac */
+#if !(defined(macintosh) || defined(MAC))
+
+#if defined _M_ALPHA || 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(_MSC_VER) && !defined(_MFHDFLIB_) && !defined(_HDFLIB_)	/* Auto-link when possible */
+#	define HDF_LIB_VER	"414"
+#	if !defined(_DEBUG)
+#		if !defined(_HDFDLL_)
+#			define HDF_LIB_NAME	"HD" HDF_LIB_VER ".lib"
+#			pragma message( "Automatic linking with the static single-threaded HDF library - " HDF_LIB_NAME )
+#		else
+#			define HDF_LIB_NAME	"HD" HDF_LIB_VER "m.lib"
+#			pragma message( "Automatic linking with the multithreaded HDF DLL - " HDF_LIB_NAME )
+#		endif
+#	else
+#		if !defined(_HDFDLL_)
+#			define HDF_LIB_NAME	"HD" HDF_LIB_VER "d.lib"
+#			pragma message( "Automatic linking with the debug static single-threaded HDF library - " HDF_LIB_NAME  )
+#		else
+#			define HDF_LIB_NAME	"HD" HDF_LIB_VER "md.lib"
+#			pragma message( "Automatic linking with the debug multithreaded HDF DLL - " HDF_LIB_NAME  )
+#		endif
+#	endif
+#	pragma comment(lib, HDF_LIB_NAME )
+#endif /* defined(_MSC_VER) && !defined(_MFHDFLIB_) && !defined(_HDFLIB_) */
+
+#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 */
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+
+#if defined _M_ALPHA
+#define FNAME_PRE_UNDERSCORE
+#endif
+
+#if defined UNIX386
+#define FNAME_POST_UNDERSCORE
+#elif defined INTEL386
+#define DF_CAPFNAMES
+#endif
+#define _fcdtocp(desc) (desc)
+
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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 /* INTEL86 */
+#endif /* !(defined(macintosh) || defined(MAC)) */
+
+#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)
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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 /* 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)
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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
+
+#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 */
+
+
+/* IA64 running Linux */
+#if defined IA64
+
+#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)
+#ifdef  HAVE_FMPOOL
+#define FILELIB PAGEBUFIO  /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#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
+
+#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) = ((*(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
+**
+** MacIntosh MPW LS-fortran needs pascal since it can interface
+**  best with pascal functions.
+** 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
+
+#if defined(MAC)                /* with LS FORTRAN */
+#ifndef ABSOFT
+#   define FCALLKEYW    pascal
+#   define FRETVAL(x)   pascal x
+#endif /* ABSOFT */
+#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) && !defined(_HDFDLL_)
+#  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 VMS || defined macintosh || defined MAC || defined SYMANTEC_C || defined MIPSEL || defined NEXT || defined CONVEX || defined IBM6000 || defined ANSISUN || defined IRIX || defined _HDFDLL_ )
+#  define HDstrdup(s)      ((char *)strdup((const char *)(s)))
+#endif /* !(VMS | 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
+**************************************************************************/
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+#define HDstat(path, result)	(mstat(path))
+#else /* !macintosh */
+#define HDstat(path, result)	(stat(path, result))
+#endif /* !macintosh */
+#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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdflib.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdflib.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdflib.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2588 @@
+(This file must be converted with BinHex 4.0)
+
+:$QKNCQaTBLj`FQpUC at 0d!%e08(*$9dP&!!!!!H4c!!!!!'h$Bfp[E!!!!!)!!!!
+S!!(@P3!"eVd!!!ff!!!!K`%!!!!!!!!!!!!!!!!&!3$rr`!!!!!!!!!!rrm"!3%
+"!3!!!!!H!3%!!!!!!!!!!*QC!!!rrcrr2rm!!3!*"Ne[EQ&ME`!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!%!#J!#J(#!S!!+!!+!F)#J!!!!!!!!!!!!!!!!!!
+!!!!"!!!"!#X"f3,i!eN!!`!$X+N!!2Te!!!!b3!!!-S!!!$,!!!!c!!!!-8!!!$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F!!!!!!!!!!#$N3!
+!%PK`FQ9Q!!6QI3!!!0d!!!!!!!!!!'Q"!!!#C("bC at B!"!-A!!!!hJ!!!!!!!!!
+!kL8!!#ifF(*PCJ!%bI3!!!$I!!!!!!!!!!!3R!!!!!4`FQ9Q!!4k&!!!!1!!!!!
+!!!!!!"cQ!!!!'("bC at B!"*9T!!!!i3!!!!!!!!!!&$i!!!!+F(*PCJ!%[H3!!!$
+L!!!!!!!!!!!EqJ!!!!j`FQ9Q!!4H53!!!1-!!!!!!!!!!$!l!!!!aR"bC at B!",C
+f!!!!j!!!!!!!!!!!,#m!!!!iF(*PCJ!%P4N!!!$P!!!!!!!!!!!FH!!!!!a`FQ9
+Q!!3m``!!!1B!!!!!!!!!!%&p!!!"fR"bC at B!"-kL!!!!j`!!!!!!!!!!(FX!!!!
+-F(*PCJ!%JCN!!!$S!!!!!!!!!!!bI`!!!'*`FQ9Q!!3MU`!!!1N!!!!!!!!!!$F
+K!!!!1("bC at B!"'d9!!!!kJ!!!!!!!!!!+XS!!!!0F(*PCJ!%bGF!!!$V!!!!!!!
+!!!!Ue`!!!"4`FQ9Q!!5dC3!!!1`!!!!!!!!!!"hA!!!!#R"bC at B!"+4c!!!!l3!
+!!!!!!!!!0eN!!!$%F(*PCJ!$m3`!!!$Z!!!!!!!!!!"Vj3!!!4C`FQ9Q!!5i+!!
+!!1m!!!!!!!!!!$lM!!!!ZR"bC at B!"+"@!!!!m!!!!!!!!!!!,'F!!!!ZF(*PCJ!
+$lp)!!!$a!!!!!!!!!!#9k3!!!Ja`FQ9Q!!3(A3!!!2)!!*J2!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdfnof.bld
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdfnof.bld	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdfnof.bld	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,69 @@
++hfile &
++hbitio &
++herr &
++hblocks &
++hextelt &
++hcomp &
++hkit &
++dfan &
++dfr8 &
++dfcomp &
++dfrle &
++dfimcomp &
++dfjpeg &
++dfunjpeg &
++dfp &
++dfgr &
++df24 &
++dfsd &
++dfgroup &
++dfconv &
++dfknat &
++dfkswap &
++dfkcray &
++dfkvms &
++dfkconv &
++dfkfuji &
++dfufp2i &
++vg &
++vrw &
++vio &
++vparse &
++vconv &
++vsfld &
++vgp &
++vhi &
++tbbt &
++dfutil &
++dfstubs &
++hdfalloc &
++mstdio &
++crle &
++cnbit &
++jutils &
++jerror &
++jmemmgr &
++jmemsys &
++jmemdosa &
++jcmaster &
++jcdeflts &
++jcarith &
++jccolor &
++jcexpand &
++jchuff &
++jcmcu &
++jcpipe &
++jcsample &
++jfwddct &
++jdmaster &
++jddeflts &
++jbsmooth &
++jdarith &
++jdcolor &
++jdhuff &
++jdmcu &
++jdpipe &
++jdsample &
++jquant1 &
++jquant2 &
++jrevdct

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdfnofw3.lbc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdfnofw3.lbc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdfnofw3.lbc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,8 @@
++hfile +herr +hblocks +hextelt +hkit +dfan +dfr8 +dfcomp +dfrle +dfimcomp
++dfjpeg +dfunjpeg +dfp +dfgr +df24 +dfsd +dfgroup +dfconv +dfknat +dfkswap
++dfkcray +dfkvms +dfkconv +dfkfuji +dfufp2i +vg +vrw +vio +vparse +vconv +vsfld
++vgp +vhi +tbbt +hbitio +hcomp +mstdio +crle +cnbit +dfutil +dfstubs +hdfalloc
++jutils +jerror +jmemmgr +jmemsys +jcmaster +jcdeflts +jcarith +jccolor
++jcexpand +jchuff +jcmcu +jcpipe +jcsample +jfwddct +jdmaster +jddeflts
++jbsmooth +jdarith +jdcolor +jdhuff +jdmcu +jdpipe +jdsample +jquant1 +jquant2
++jrevdct

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdfnofwc.lbc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdfnofwc.lbc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdfnofwc.lbc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,8 @@
++hfile +herr +hblocks +hextelt +hkit +dfan +dfr8 +dfcomp +dfrle +dfimcomp
++dfjpeg +dfunjpeg +dfp +dfgr +df24 +dfsd +dfgroup +dfconv +dfknat +dfkswap
++dfkcray +dfkvms +dfkconv +dfkfuji +dfufp2i +vg +vrw +vio +vparse +vconv
++vsfld +vgp +vhi +tbbt +dfutil +dfstubs +hdfalloc +jutils +jerror +jmemmgr
++jmemsys +jmemdosa +jcmaster +jcdeflts +jcarith +jccolor +jcexpand +jchuff
++jcmcu +jcpipe +jcsample +jfwddct +jdmaster +jddeflts +jbsmooth +jdarith
++jdcolor +jdhuff +jdmcu +jdpipe +jdsample +jquant1 +jquant2 +jrevdct
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdfw386.lbc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdfw386.lbc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdfw386.lbc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,10 @@
++hfile +herr +hblocks +hextelt +hkit +dfan +dfr8 +dfcomp +dfrle +dfimcomp
++dfjpeg +dfunjpeg +dfp +dfgr +df24 +dfsd +dfgroup +dfconv +dfknat +dfkswap
++dfkcray +dfkvms +dfkconv +dfkfuji +dfufp2i +vg +vrw +vio +vparse +vconv
++vsfld +vgp +vhi +tbbt +hbitio +hcomp +mstdio +crle +cnbit +dfutil +dfstubs
++hdfalloc +hfilef +herrf +dfanf +dfr8f +dfpf +df24f +dfsdf +vgf +dff +dfutilf
++hfileff +dfanff +df24ff +dfpff +dfr8ff +dfsdff +vgff +dfff +dfufp2if +maldebug
++jutils +jerror +jmemmgr +jmemsys +jcmaster +jcdeflts +jcarith +jccolor
++jcexpand +jchuff +jcmcu +jcpipe +jcsample +jfwddct +jdmaster +jddeflts
++jbsmooth +jdarith +jdcolor +jdhuff +jdmcu +jdpipe +jdsample +jquant1 +jquant2
++jrevdct
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/hdf/src/hdfwcc.lbc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hdfwcc.lbc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hdfwcc.lbc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,10 @@
++hfile +herr +hblocks +hextelt +hkit +dfan +dfr8 +dfcomp +dfrle +dfimcomp
++dfjpeg +dfunjpeg +dfp +dfgr +df24 +dfsd +dfgroup +dfconv +dfknat
++dfkswap +dfkcray +dfkvms +dfkconv +dfkfuji +dfufp2i +vg +vrw +vio
++vparse +vconv +vsfld +vgp +vhi +tbbt +dfutil +dfstubs +hdfalloc +hfilef
++herrf +dfanf +dfr8f +dfpf +df24f +dfsdf +vgf +dff +dfutilf +hfileff
++dfanff +df24ff +dfpff +dfr8ff +dfsdff +vgff +dfff +dfufp2if +maldebug
++jutils +jerror +jmemmgr +jmemsys +jmemdosa +jcmaster +jcdeflts +jcarith
++jccolor +jcexpand +jchuff +jcmcu +jcpipe +jcsample +jfwddct +jdmaster
++jddeflts +jbsmooth +jdarith +jdcolor +jdhuff +jdmcu +jdpipe +jdsample
++jquant1 +jquant2 +jrevdct
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/hdf/src/herr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/herr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/herr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,358 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.34 $";
+#endif
+
+/* $Id: herr.c,v 1.34 1999/06/16 21:10:58 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_herr_c
+#endif
+
+/*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 */
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HEstring);
+#endif /* HAVE_PABLO */
+
+    /* 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)
+          {
+#ifdef HAVE_PABLO
+            TRACE_OFF(PABLO_mask, ID_HEstring);
+#endif /* HAVE_PABLO */
+            return error_messages[i].str;
+          }
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HEstring);
+#endif /* HAVE_PABLO */
+    /* 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)
+{
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_HEclear);
+#endif /* HAVE_PABLO */
+    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:
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HEclear);
+#endif /* HAVE_PABLO */
+  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;
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HEpush);
+#endif /* HAVE_PABLO */
+
+    /* 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++;
+      }
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HEpush);
+#endif /* HAVE_PABLO */
+}   /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HEreport);
+#endif /* HAVE_PABLO */
+
+    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:
+#ifdef HAVE_PABLO
+     TRACE_OFF(PABLO_mask, ID_HEreport);
+#endif /* HAVE_PABLO */
+    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)
+{
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_HEprint);
+#endif /* HAVE_PABLO */
+    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);
+      }
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HEprint);
+#endif /* HAVE_PABLO */
+} /* 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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/herr.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/herr.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/herr.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,443 @@
+/****************************************************************************
+ * 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: herr.h,v 1.36 1996/08/27 15:05:59 sxu Exp $ */
+
+/*+ 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) */
+#ifndef _H_ERR_MASTER_
+extern
+#endif /* _H_ERR_MASTER_ */
+int32       error_top
+#ifdef _H_ERR_MASTER_
+= 0
+#endif /* _H_ERR_MASTER_ */
+;
+
+/* 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 */
+
+/* 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 */
+
+/* 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 */
+
+/* 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 */
+/* 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"},
+
+/* 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"},
+
+/* 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"},
+
+/* 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/herrf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/herrf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/herrf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,89 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.10 $";
+#endif
+
+/* $Id: herrf.c,v 1.10 2000/02/29 20:31:46 epourmal Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+#ifndef HERR_FNAMES
+#   define HERR_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nheprnt   FNAME(HEPRNT)
+#else
+#   define nheprnt   FNAME(heprnt)
+#endif /* DF_CAPFNAMES */
+#endif /* HERR_FNAMES */
+
+/*-----------------------------------------------------------------------------
+ * 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: 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;
+ 
+ 
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/hextelt.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hextelt.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hextelt.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1548 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.82 $";
+#endif
+
+/* $Id: hextelt.c,v 1.82 1999/06/16 21:10:58 dwells Exp $ */
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_hextelt_c
+#endif
+
+/*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 (MAC) || defined (macintosh) || defined (SYMANTEC_C) 
+#define DIR_SEPC  58  /* Integer value of ':' */
+#define DIR_SEPS  ":"
+#else /* not Macintosh */
+#if defined WIN386 | defined DOS386
+/* DOS-Windows seperator */
+#define DIR_SEPC  92  /* Integer value of '\' */
+#define DIR_SEPS  "\\"
+#else 
+#if defined VMS
+/* VMS -made it the same as POSIX for now eventhought it should be '.' */
+#define DIR_SEPC  47  /* Integer value of '/' */
+#define DIR_SEPS  "/"
+#else
+/* Unix - POSIX */
+#define DIR_SEPC  47  /* Integer value of '/' */
+#define DIR_SEPS  "/"
+#endif /* !VMS */
+#endif /* !WIN386 & !DOS386 */
+#endif /* !Macintosh */
+
+/* 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
+   successiful 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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HXcreate);
+#endif /* HAVE_PABLO */
+    /* 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 fill */
+    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);
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HXcreate);
+#endif /* HAVE_PABLO */
+  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 */
+                          HAatom_object(access_rec->file_id);
+    int32      ret_value = SUCCEED;
+
+    /* 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 */
+        HAatom_object(access_rec->file_id);
+    intn     ret_value = SUCCEED;
+
+    /* 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->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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HXsetcreatedir);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HXsetcreatedir);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HXsetdir);
+#endif /* HAVE_PABLO */
+  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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_HXsetdir);
+#endif /* HAVE_PABLO */
+  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;
+#if !(defined (MAC) || defined (macintosh) || defined (SYMANTEC_C))
+    struct	stat filestat;	/* for checking pathname existence */
+#endif
+    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 */
+#ifndef macintosh
+        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;
+        }
+#else		/* macintosh */
+
+		/* Absolute Pathname */
+		char* dirptr;
+        if ( ( *fname != DIR_SEPC ) && ((dirptr = strchr(fname, DIR_SEPC)) != NULL) )	 {	
+        	/* This may seem a bit of overkill, but without it we can't determine if the mac path   */
+        	/* (testdir:test.hdf) is absolute or relative. For example, myHD:testdir:test.hdf would */
+        	/* be absolute. How do you tell without checking it out?                                */
+        	FSSpec tmpSpec;
+        	Str255 VolName;
+        	memset(VolName, 0, sizeof(Str255));
+        	strncpy((char*)VolName, fname, dirptr-fname+1);
+        	c2pstr((char*)VolName);
+        	/* verify that the first item is a good volume name*/
+        	if (FSMakeFSSpec(0,0,VolName, &tmpSpec) == noErr)		{
+	            ret_value = (HDstrcpy(finalpath, fname));
+	            goto done;
+	        }
+	    }
+        
+        /* Relative Pathname */
+
+        /* try function variable */
+        if (extcreatedir) {
+            path_len = (int)HDstrlen(extcreatedir);
+
+            if (1 + fname_len + 1 + path_len + 1 > MAX_PATH_LEN )
+                HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+            ret_value = (HDstrcpy4(finalpath, DIR_SEPS, extcreatedir, DIR_SEPS, fname));
+
+            goto done;
+        }
+
+        /* try Envrironment Variable */
+        if (HDFEXTCREATEDIR) {
+            path_len = (int)HDstrlen(HDFEXTCREATEDIR);
+
+            if (1 + fname_len + 1 + path_len + 1 > MAX_PATH_LEN )
+                HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+            ret_value = (HDstrcpy4(finalpath, DIR_SEPS, 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;
+
+#endif		/* macintosh */
+        /* break; */
+    } /*DFACC_CREATE */
+    case DFACC_OLD:{			/* Locating an old external element */
+#ifndef macintosh
+        if ( *fname == DIR_SEPC ) {	/* Absolute Pathname */
+#else
+		char* dirptr;
+        if ( ( *fname != DIR_SEPC ) && ((dirptr = strchr(fname, DIR_SEPC)) != NULL) )	 {	
+#endif
+            if (HDstat(fname, &filestat) == 0){
+                ret_value = (HDstrcpy(finalpath, fname));
+                goto done;
+            }
+#ifndef macintosh
+            else if (!extdir && !HDFEXTDIR) {
+                HGOTO_ERROR(DFE_FNF, NULL);
+            }
+            /* strip the pathname component */
+            fname = HDstrrchr(fname, DIR_SEPC) + 1;
+            fname_len = (int)HDstrlen(fname);
+#else
+			/* don't do this on the mac... it could be a relative path. */
+#endif
+            /* 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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hfile.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hfile.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hfile.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4995 @@
+/****************************************************************************
+* 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.                                                        *
+*                                                                          *
+****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.154 $";
+#endif
+
+/* $Id: hfile.c,v 1.154 1999/06/16 21:10:59 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_hfile_c
+#endif
+ 
+/*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.
+   HDget_special_info -- get information about a special element
+   HDset_special_info -- reset information about a special element
+
+   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 "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 a 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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Hopen);
+#endif /* HAVE_PABLO */
+
+  /* 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=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 (setvbuf(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=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))
+            HGOTO_ERROR(DFE_BADOPEN, FAIL);
+          file_rec->f_cur_off=0;
+          file_rec->last_op=OP_UNKNOWN;
+#ifdef STDIO_BUF
+	/* Testing stdio buffered i/o */
+          if (setvbuf(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)
+          HIrelease_filerec_node(file_rec);
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_Hopen);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hclose);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_Hclose);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Hexist);
+#endif /* HAVE_PABLO */
+
+  ret_value = (Hfind(file_id, search_tag, search_ref, &find_tag, &find_ref,
+                &find_offset, &find_length, DF_FORWARD));
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_Hexist);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hinquire);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_Hinquire);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Hfidinquire);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_Hfidinquire);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hstartread);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hstartread);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hnextread);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hnextread);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hstartwrite);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hstartwrite);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hstartaccess);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hstartaccess);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+   TRACE_ON(PABLO_mask,ID_Hsetlength);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hsetlength);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Happendable);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Happendable);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hisappendable);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hisappendable);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hseek);
+#endif /* HAVE_PABLO */
+
+  /* clear error stack and check validity of this access id */
+  HEclear();
+
+#ifdef QAK
+printf("%s: entering\n",FUNC);
+#endif /* QAK */
+  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 */
+#ifdef QAK
+printf("%s: access ID is special\n",FUNC);
+#endif /* QAK */
+      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);
+      
+#ifdef QAK
+printf("%s: check 1.0, offset=%d, origin=%d, data_len=%d\n",FUNC,(int)offset,(int)origin,(int)data_len);
+#endif /* QAK */
+  /* calculate real offset based on the origin */
+  if (origin == DF_CURRENT)
+    offset += access_rec->posn;
+  if (origin == DF_END)
+    offset += data_len;
+
+#ifdef QAK
+printf("%s: check 1.5, offset=%d, origin=%d, data_len=%d\n",FUNC,(int)offset,(int)origin,(int)data_len);
+printf("%s: check 1.6, access_rec->posn=%d\n",FUNC,(int)access_rec->posn);
+#endif /* QAK */
+  /* 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);
+    }
+
+#ifdef QAK
+printf("%s: check 2.0\n",FUNC);
+#endif /* QAK */
+/* 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, HDF_APPENDABLE_BLOCK_LEN, HDF_APPENDABLE_BLOCK_NUM) == 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:
+#ifdef QAK
+printf("%s: exiting\n",FUNC);
+#endif /* QAK */
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hseek);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Htell);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Htell);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hread);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hread);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hwrite);
+#endif /* HAVE_PABLO */
+
+  /* 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);
+
+#ifdef QAK
+printf("%s: length=%ld\n",FUNC,(long)length);
+#endif /* QAK */
+
+  /* if special elt, call special write function */
+  if (access_rec->special)
+    {
+#ifdef QAK
+printf("%s: access record is special\n",FUNC);
+#endif /* QAK */
+      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 */
+
+#ifdef QAK
+printf("%s: before HTPinquire\n",FUNC);
+#endif /* QAK */
+
+  /* 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);
+
+#ifdef QAK
+printf("%s: length=%ld, data_len=%ld, access_rec->posn=%ld\n",FUNC,(long)length,(long)data_len,(long)access_rec->posn);
+#endif /* QAK */
+  /* 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, HDF_APPENDABLE_BLOCK_LEN, HDF_APPENDABLE_BLOCK_NUM) == 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 */
+
+#ifdef QAK
+printf("%s: offset=%ld\n",FUNC,(long)(access_rec->posn+data_off));
+#endif /* QAK */
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hwrite);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef QAK
+printf("%s: c=%u\n",FUNC,(unsigned)c);
+#endif /* QAK */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Hendaccess);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hendaccess);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hgetelement);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hgetelement);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hputelement);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hputelement);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hlength);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hlength);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hlength);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hlength);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hoffset);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hoffset);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#if defined(VMS) || defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+  int32       fid;
+  intn   ret_value = TRUE;
+
+#ifdef HAVE_PABLO
+   TRACE_ON(PABLO_mask,ID_Hishdf);
+#endif /* HAVE_PABLO */
+
+  fid = Hopen(filename, DFACC_READ, 0);
+  if (fid == FAIL)
+    {
+      ret_value= FALSE;
+      goto done;
+    }
+
+  Hclose(fid);
+
+done:
+  if(ret_value == FALSE)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hishdf);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+#else
+  intn        ret;
+  hdf_file_t  fp;
+  intn   ret_value = TRUE;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hishdf);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hishdf);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+#endif
+}	/* 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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Htrunc);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Htrunc);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hsync);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+   TRACE_OFF(PABLO_mask, ID_Hsync);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hcache);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hcache);
+#endif /* HAVE_PABLO */
+
+  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 = HAatom_object(file_id);
+  intn        ret_value = TRUE;
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hsetaccesstype);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hsetaccesstype);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_HDdont_atexit);
+#endif /* HAVE_PABLO */
+
+    if(install_atexit == TRUE)
+        install_atexit=FALSE;
+
+#ifdef LATER
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+#endif /* LATER */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HPregister_term_func);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_HIstart);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HIstart);
+#endif /* HAVE_PABLO */
+
+    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;
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_HPregister_term_func);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_HPregister_term_func);
+#endif /* HAVE_PABLO */
+
+    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
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hgetlibversion);
+#endif /* HAVE_PABLO */
+
+  HEclear();
+
+  *majorv = LIBVER_MAJOR;
+  *minorv = LIBVER_MINOR;
+  *releasev = LIBVER_RELEASE;
+  HIstrncpy(string, LIBVER_STRING, LIBVSTR_LEN + 1);
+
+#ifdef HAVE_PABLO
+	TRACE_OFF(PABLO_mask, ID_Hgetlibversion);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hgetfileversion);
+#endif /* HAVE_PABLO */
+
+  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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hgetfileversion);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+    /* 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;
+}	/* HIget_filerec_node */
+
+/*--------------------------------------------------------------------------
+ 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 speical 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==OP_WRITE || file_rec->last_op==OP_UNKNOWN)
+    {
+#ifdef HFILE_SEEKINFO
+      read_force_seek++;
+#endif /* HFILE_SEEKINFO */
+      file_rec->last_op=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=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==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=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==OP_READ || file_rec->last_op==OP_UNKNOWN)
+    {
+#ifdef HFILE_SEEKINFO
+      write_force_seek++;
+#endif /* HFILE_SEEKINFO */
+      file_rec->last_op=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=OP_WRITE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end HP_write() */
+
+#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 */
+
+/* -------------------------- MAC Specific Stuff -------------------------- */
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+/*
+   *  Macintosh file stubs for HDF
+   *
+   *  Implement a subset of the C unbuffered file I/O stubs in the
+   *  Mac toolbox.
+ */
+
+#include <Errors.h>
+#ifdef SYMANTEC_C
+#include <IntEnv.h>
+#include <MacRuntime.h>
+#endif
+#include <Files.h>
+#include <Strings.h>
+#include <stdarg.h> 
+#include "dir_mac.h" /* Directory scanning stuff by George Talbot */
+
+PRIVATE int32 hdfc = 1061109567L; /* equal to 4 '?' in a row in ascii */
+                                  /* yes, I am deliberately avoiding the trigraph :-) */
+PRIVATE int32 hdft = 1600085855L; /* equal to '_HDF' in ascii */
+
+#ifndef MAC_OLD_WAY
+/* The routines have been updated for HFS */
+
+/* NOTE:
+ * The following routines are utility routines that do not
+ * have to reside here but since the Mac routines are the
+ * only ones that use them, they reside here..
+ */
+
+extern  char *mk_compound_str(int nstr, ...);
+extern  char *base_name(char *path_name, char seperator);
+extern  char *path_name(char *path_name, char seperator);
+extern  char *path_name_destr(char *path_name, char seperator);
+
+/*
+ * This returns a compound string created
+ * from strings given. We assume each string is NULL terminated.
+ */
+char *mk_compound_str(int nstr, ...)
+{
+  va_list  pargs;
+  register unsigned str_len = 0;
+  register unsigned i;
+  register char *sptr = NULL;
+  register char *cptr = NULL;
+  char *compound_string = NULL;
+
+  /* make sure number of strings is greater than 0 */
+  if (nstr == 0)
+    return(NULL);
+
+  /* Process arguement strings to find total length */
+  va_start(pargs, nstr) ;
+  for (i = 0; i < nstr; i++)
+    {
+      if ((sptr = va_arg(pargs, char *)) == NULL)
+        continue;
+      str_len += HDstrlen(sptr);
+    }
+  va_end(pargs) ;
+
+  /* Allocate space for compound string */
+  if ((compound_string = (char *)HDmalloc((str_len+1)*sizeof(char))) == NULL)
+    return(NULL);
+
+  /* Copy each string into new string */
+  cptr = compound_string;
+  va_start(pargs, nstr);
+  for (i = 0; i < nstr; i++)
+    {
+      if ((sptr = va_arg(pargs, char *)) == NULL)
+        continue;
+      while (*cptr++ = *sptr++);  /* copy string */
+      cptr--;
+    }
+  va_end(pargs);
+  return(compound_string);
+} /* mk_compound_string */
+
+/*
+ * Return the base name in a path given the seperator.
+ * Note that we don't handle empty input strings.
+ */
+char *base_name(char *path_name, char seperator)
+{
+  char *sptr = NULL; /* pointer to last seperator */
+
+  if ((sptr = (char *)HDstrrchr(path_name, seperator)) == NULL)
+     return(path_name);
+  else
+     return(sptr + 1);
+} /* base_name */
+
+/*
+ * Return the path in path name excluding the base
+ * If the path only contains a "seperator" we return the seperator.
+ * If their is no directory path we return "."
+ * to distinguish between a failure(i.e. NULL return)
+ * NOTE that this routine always returns malloced memeory.
+ *      This not a good routine to use nested 
+ *      e.g.
+ *         base_name(path_name(target,':'),'/');
+ *      since the memory will be leaked. It would work
+ *      better if there was a nice garbage collector:-)...
+ *
+ * Modified for Macintosh as suggested by Fortner 8/26/97
+ */
+char *
+path_name(char *path_name, char seperator)
+{
+  int  path_len ;    /* path name length */
+  char *sptr = NULL; /* pointer to last seperator */
+  char *dptr = NULL; /* pointer to path */ 
+
+  /* If no path return "." to distinguish between failure */
+  if ((sptr = (char *)HDstrrchr(path_name, (int)seperator)) == NULL)
+    return(mk_compound_str(1,"."));
+
+  /* If only seperator in path, return that */
+  if ((path_len = sptr - path_name) == 0)
+    return(mk_compound_str(1,seperator));
+
+  /* Allocate space for directory path and copy path over. 
+     pathlen + 1(for ':') + 1(for NULL). 
+     Note Macintosh specific now. */
+  if ((dptr = (char *)HDmalloc((path_len+2)*sizeof(char))) == NULL)
+    return(NULL);
+  else
+    {
+      HDstrncpy(dptr, path_name, path_len);
+      dptr[path_len] = ':';  /* for macintosh */
+      dptr[path_len + 1] = '\0';
+      return(dptr) ;
+    }
+} /* path_name */
+
+/*
+ * Return the path in path name excluding the base
+ * If the path only contains a "seperator" we return the seperator.
+ * NOTE that this routine destroys the original pathname.
+ *      It insertsa '\0' character where the last seperator was.
+ *      reminds me of "strtok()".....
+ */
+char *
+path_name_destr(char *path_name, char seperator)
+{
+  int  path_len ;    /* path name length */
+  char *sptr = NULL; /* pointer to last seperator */
+
+  /* If no path return NULL, not good since can't distinguish failure
+   * oh well.....*/
+  if ((sptr = (char *)HDstrrchr(path_name, (int)seperator)) == NULL)
+    return(NULL);
+
+  /* If only seperator in path, return that */
+  if ((path_len = sptr - path_name) == 0)
+    return(path_name);
+
+  /* Replace last seperator with NULL */
+  sptr = '\0';
+  return(sptr) ;
+
+} /* path_name_destr */
+
+PRIVATE Str255 pname; /* Pacal pointer to file name */
+
+hdf_file_t
+mopen(char *name, intn flags)
+{
+  hdf_file_t  ret_value;
+  short       volRefNum;
+  FSSpec      sfFile;
+  OSErr       result;
+  Str255      volName;
+  long        fBytes;
+  FInfo       fndrInfo;
+  char        perm;
+  char        *target_dir = NULL;
+  char        *target_file = NULL;
+  DIR         *cur_dirp = NULL; /* current directory */
+
+  /* get target file */
+  target_file = base_name(name,':');
+
+#ifdef MAC_DEBUG
+  printf("mopen: target_file %s\n",target_file);
+#endif
+  /* get target directory if one is specified 
+     this routine mallocs space so free it at the end */
+  if ((target_dir = path_name(name,':')) == NULL)
+   {
+     ret_value = FAIL;
+     goto done;
+   }
+
+  /* check if we have a directory in path name */
+  if (HDstrcmp(target_dir, ".") == 0)
+    { /* default to current directory */
+        /* open current working directory */
+        if ((cur_dirp = opendir(NULL)) == NULL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+    }
+  else
+    { /* open specified directory */
+        if ((cur_dirp = opendir(target_dir)) == NULL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+    }
+#ifdef MAC_DEBUG
+  printf("mopen: opened target_dir %s\n",target_dir);
+#endif
+  /* get ready to convert target file C string to Pascal string */
+  HDstrcpy((char *) pname, (char *) target_file);
+  c2pstr((char *)pname); /* Convert C string to Pascal string */
+
+
+  /* Create FSSpec record for file */
+  result = FSMakeFSSpec((short)(cur_dirp->dd_volume),
+                        (long)(cur_dirp->dd_fd),pname,(FSSpecPtr)&sfFile);
+
+#ifdef MAC_DEBUG
+  printf("mopen: made FSspec for %s\n",name);
+#endif
+
+  /* Do we need to create file */
+  if (flags == DFACC_CREATE)
+    { /* yes, we need to create it */
+		
+      /* Does file exist */
+      switch(result)
+        {
+        case noErr: /* file exists, so delete */
+            if (noErr != (result = FSpDelete(&sfFile)))
+              {
+                  ret_value = FAIL;
+                  goto done;
+              }
+            break;
+        case nsvErr:
+#ifdef MAC_DEBUG
+            printf("mopen: Error volume not found(nsvErr)\n");
+#endif
+            ret_value = FAIL;
+            goto done;
+            break;
+        case fnfErr:
+        default:
+            /* okay we can create it */
+            break;
+        }
+
+      /* Create new file 
+      * Note: '-1' argument -> 'sySystemScript' - Script.h */
+      result = FSpCreate(&sfFile,hdfc,hdft,-1);
+      if (noErr != result)
+        {
+          ret_value =  FAIL;
+          goto done;
+        }
+    } /* end if */
+
+
+  /* Set correct permission flag */
+  switch(flags)
+    {
+    case DFACC_READ:
+         perm = fsRdPerm; /* fsRdPerm read permission */
+      break;
+    case DFACC_WRITE:
+         perm = fsWrPerm; /* fsWrPerm - write permission */
+      break;
+    case DFACC_CREATE:
+    case DFACC_RDWR:
+    case DFACC_ALL:
+         perm = fsRdWrPerm; /* fsRdWrPerm - exclusive read/write permission */
+      break;
+    default:
+         perm = fsRdPerm; /* fsRdPerm read permission */
+      break;
+    } /* end switch 'flags' */
+
+  /* Now open file */
+  result = FSpOpenDF(&sfFile, perm, &ret_value);
+  if (noErr != result)
+    {
+      ret_value = FAIL;    
+      goto done;
+    }
+
+  /* Truncate file if creation is also specified*/
+  if (flags & O_CREAT)
+    {	
+     if ((result = SetEOF(ret_value, 0L)) != noErr)
+       {
+         ret_value = FAIL;    
+         goto done;
+       }
+    }
+
+#ifdef MAC_DEBUG
+  fprintf(stdout,"mopen: opened/created file %s\n",name);
+#endif
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+#ifdef MAC_DEBUG
+  fprintf(stdout,"mopen: Failed open/create file %s\n",name);
+#endif
+    } /* end if */
+
+  /* Normal function cleanup */
+  /* close directory */
+  if (cur_dirp != NULL)
+      closedir(cur_dirp);
+  if (target_dir != NULL)
+      HDfree(target_dir);
+
+  return (ret_value);
+} /* mopen() */
+
+
+int32
+mclose(hdf_file_t rn)
+{
+  return (FSClose(rn));
+} /* mclose() */
+
+int32
+mread(hdf_file_t rn, char *buf, int32 n)
+{
+  OSErr       result;
+
+  if (noErr != (result = FSRead(rn, &n, buf)))
+    return (FAIL);
+
+  return (n);
+} /* mread() */
+
+int32
+mwrite(hdf_file_t rn, char *buf, int32 n)
+{
+  OSErr       result;
+
+  if (noErr != (result = FSWrite(rn, &n, buf)))
+    return (FAIL);
+
+  return (n);
+} /* mwrite() */
+
+int32
+mlseek(hdf_file_t rn, int32 n, intn m)
+{
+  OSErr       result;
+  int32       newEOF;
+  short       posMode;
+  int32       ret_value;
+
+  /* set the positioning mode */
+  switch (m)
+    {
+    case 0:
+    default:
+      posMode = fsFromStart;
+      break;
+    case 1:
+      posMode = fsFromMark;
+      break;
+    case 2:
+      posMode = fsFromLEOF;
+      break;
+    } /* end switch 'm' */
+
+  /* Set file postion marker */
+  if (noErr != (result = SetFPos(rn, posMode, n)))
+    { /* Are we at logical end of file */
+      if (result == eofErr)
+        { /* yes, at logical end of file */
+          /* If we are at begening of file then return error */
+          if (posMode != fsFromStart)
+            {
+              ret_value = FAIL;
+              goto done;
+	    }
+
+          /* Else, lets set End-of-File marker here */
+          newEOF = n;
+          if (noErr != (result = SetEOF(rn, newEOF)))
+            {
+              ret_value = FAIL;
+              goto done;
+	    }
+
+          /* Now try reseting the file Postiion maker */
+          if (noErr != (result = SetFPos(rn, fsFromStart, n)))
+            {
+              ret_value = FAIL;
+              goto done;
+	    }
+        }
+      else 
+        { /* we have a real error we can't handle */
+          ret_value = FAIL;
+          goto done;
+        }
+    } /* end if */
+
+  /* Get new file marker postion */
+  if (noErr != (result = GetFPos(rn, &n)))
+    {
+      ret_value = FAIL;
+      goto done;
+    }
+
+  /* If postioned from current mark return current postion
+   * else return SUCCEED */
+  if (m == fsFromMark)
+    ret_value = (n);
+  else
+    ret_value = (SUCCEED);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return (ret_value);
+} /* mlseek() */
+
+intn
+mstat(char *path)
+{
+  short       volRefNum;
+  FSSpec      sfFile;
+  OSErr       result;
+  Str255      volName;
+  long        fBytes;
+  intn        ret_value;
+  char        *target_dir = NULL;
+  char        *target_file = NULL;
+  DIR         *cur_dirp; /* current directory */
+
+  /* get target file */
+  target_file = base_name(path,':');
+
+  /* get target directory if one is specified 
+     this routine mallocs space so free it at the end */
+  if ((target_dir = path_name(path,':')) == NULL)
+   {
+     ret_value = FAIL;
+     goto done;
+   }
+  /* check if we have a directory in path name */
+  if (target_dir == ".")
+    { /* default to current directory */
+        /* open current working directory */
+        if ((cur_dirp = opendir(NULL)) == NULL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+    }
+  else
+    { /* open specified directory */
+        if ((cur_dirp = opendir(target_dir)) == NULL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+    }
+#ifdef MAC_DEBUG
+  printf("mstat: target_dir %s\n",target_dir);
+  printf("mstat: target_file %s\n",target_file);
+#endif
+  /* get ready to convert target file C string to Pascal string */
+  HDstrcpy((char *) pname, (char *)target_file);
+  c2pstr((char *)pname); /* Convert C string to Pascal string */
+
+  result = FSMakeFSSpec((short)(cur_dirp->dd_volume),
+                        (long)(cur_dirp->dd_fd),pname,(FSSpecPtr)&sfFile);
+
+
+ /* Does file exist */
+ if (result != fnfErr)
+  { /* file exists*/
+    ret_value = 0;
+  }
+ else
+    ret_value = FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef MAC_DEBUG
+  fprintf(stdout,"mstat: opened file %s\n",path);
+#endif
+ /* close directory */
+  if (cur_dirp != NULL)
+      closedir(cur_dirp);
+  if (target_dir != NULL)
+      HDfree(target_dir);
+
+  return (ret_value);
+} /* mstat() */
+
+#else /* MAC_OLD_WAY */
+
+PRIVATE Str255 pname; /* Pacal pointer to file name */
+
+#ifdef MPW
+hdf_file_t
+mopen(char *name, intn flags)
+{
+  hdf_file_t  volref, rn;
+  OSErr       result;
+  FInfo       fndrInfo;
+
+  GetVol(NULL, &volref);
+
+  if (flags == DFACC_CREATE)
+    {	/* we need to create it */
+      result = getfinfo(name, volref, &fndrInfo);
+      if (result != fnfErr)
+        if (noErr != (result = fsdelete(name, volref)))
+          return FAIL;
+
+      if (noErr != (result = create(name, volref, hdfc, hdft)))
+        return FAIL;
+
+    }
+
+  if (noErr != (result = fsopen(name, volref, &rn)))
+    return FAIL;
+
+  if (flags & O_CREAT)	/* and truncate it */
+    SetEOF(rn, 0);
+#ifdef MAC_DEBUG
+  fprintf(stdout,"mopen: opened/created file %s\n",name);
+#endif
+  return (rn);
+}
+
+#else /* ! MPW */
+
+hdf_file_t
+mopen(char *name, intn flags)
+{
+  hdf_file_t  volref, rn;
+  OSErr       result;
+  FInfo       fndrInfo;
+
+  HDstrcpy((char *) pname, (char *) name);
+  CtoPstr(pname);
+
+  result = GetVol(NULL, &volref);
+
+  if (flags == DFACC_CREATE)
+    {	/* we need to create it */
+      result = GetFInfo(name, volref, &fndrInfo);
+      if (result != fnfErr)
+        if (noErr != (result = FSDelete(pname, volref)))
+          return FAIL;
+
+      if (noErr != (result = Create(pname, volref, hdfc, hdft)))
+        return FAIL;
+
+    }
+
+  if (noErr != (result = FSOpen(pname, volref, &rn)))
+    return FAIL;
+
+  if (flags & O_CREAT)	/* and truncate it */
+    SetEOF(rn, 0L);
+
+#ifdef MAC_DEBUG
+  fprintf(stdout,"mopen: opened/created file %s\n",name);
+#endif
+  return (rn);
+}
+
+#endif
+
+int32
+mclose(hdf_file_t rn)
+{
+  return (FSClose(rn));
+}
+
+int32
+mread(hdf_file_t rn, char *buf, int32 n)
+{
+  OSErr       result;
+
+  if (noErr != (result = FSRead(rn, &n, buf)))
+    return (FAIL);
+
+  return (n);
+}
+
+int32
+mwrite(hdf_file_t rn, char *buf, int32 n)
+{
+  OSErr       result;
+
+  if (noErr != (result = FSWrite(rn, &n, buf)))
+    return (FAIL);
+
+  return (n);
+}
+
+int32
+mlseek(hdf_file_t rn, int32 n, intn m)
+{
+  OSErr       result;
+  int32       newEOF;
+
+#ifdef OLD_EXTD
+  long        pos, oldpos, logEOF;
+  Ptr         buffy;
+#endif
+
+  switch (m)
+    {
+    case 0:
+    default:
+      m = fsFromStart;
+      break;
+    case 1:
+      m = fsFromMark;
+      break;
+    case 2:
+      m = fsFromLEOF;
+      break;
+    }
+
+  if (noErr != (result = SetFPos(rn, m, n)))
+    {
+      if (result == eofErr)
+        {
+#ifdef OLD_EXTD
+          if (noErr != (result = GetEOF(rn, &logEOF)))
+            return FAIL;
+
+          oldpos = pos = n - logEOF;
+          if (NULL == (buffy = NewPtr((Size) pos)))
+            return FAIL;
+          if (noErr != (result = FSWrite(rn, &pos, buffy)))
+            {
+              DisposPtr(buffy);
+              return FAIL;
+            }
+          DisposPtr(buffy);
+#else
+
+          if (m != fsFromStart)
+            return FAIL;
+
+          newEOF = n;
+          if (noErr != (result = SetEOF(rn, newEOF)))
+            return FAIL;
+
+#endif
+
+          if (noErr != (result = SetFPos(rn, fsFromStart, n)))
+            return FAIL;
+        }
+      else
+        return FAIL;
+    }
+
+  if (noErr != (result = GetFPos(rn, &n)))
+    return FAIL;
+
+  if (m == fsFromMark)
+    {
+      return (n);
+    }
+  else
+    {
+      return (SUCCEED);
+    }
+
+}
+
+intn
+mstat(char *path)
+{
+  short       volRefNum;
+  FSSpec      sfFile;
+  OSErr       result;
+  Str255      volName;
+  long        fBytes;
+  intn        ret_value;
+
+  HDstrcpy((char *) pname, (char *) path);
+  c2pstr((char *)pname); /* Convert C string to Pascal string */
+
+  /* get the info on the default volume */
+  if ((result = GetVol(NULL, &volRefNum)) != noErr)
+   {
+     ret_value = FAIL;
+     goto done;
+   }
+
+  /* Create FSSpec record for file */
+  result = FSMakeFSSpec(volRefNum,0,pname, &sfFile);
+
+ /* Does file exist */
+ if (result != fnfErr)
+  { /* file exists*/
+    ret_value = 0;
+  }
+ else
+    ret_value = FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef MAC_DEBUG
+  fprintf(stdout,"mstat: opened file %s\n",path);
+#endif
+  return (ret_value);
+} /* mstat() */
+
+#endif /* MAC_OLD_WAY */
+
+#endif /* MAC */
+/* --------------------- (end of) MAC Specific Stuff ---------------------- */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hfile.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hfile.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hfile.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1008 @@
+/****************************************************************************
+ * 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: hfile.h,v 1.117 2000/11/20 15:35:18 epourmal Exp $ */
+
+/*+ hfile.h
+   *** Header for hfile.c, routines for low level data element I/O
+   + */
+
+#ifndef HFILE_H
+#define HFILE_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    1 
+#define LIBVER_RELEASE  4 
+#define LIBVER_STRING   "NCSA HDF Version 4.1 Release 4, December 2000"
+#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;
+#ifdef VMS
+/* For VMS, use "mbc=64" to improve performance     */
+#   define HI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                fopen((p), "r+", "mbc=64") : \
+                                fopen((p), "r", "mbc=64"))
+#   define HI_CREATE(p)        (fopen((p), "w+", "mbc=64"))
+#else  /*  !VMS  */
+#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 */
+#endif /* VMS */
+#   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)   (fclose(f))
+#   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)          (close(f))
+#   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)          mclose(x)
+#   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 */
+
+#ifdef NOT_USED     /* Deprecated routines, not supported any more */
+#if (FILELIB == PCIO)
+/* using special PC functions to enable reading/writing large chunks */
+typedef FILE *hdf_file_t;
+#   define HI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                fopen((p), "rb+") : fopen((p), "rb"))
+#   define HI_CREATE(p)        (fopen((p), "wb+"))
+/* Alias the HI_READ and HI_WRITE macros to functions which can handle */
+/*  32-bits of data to read/write */
+#   define HI_READ(f, b, n)    (((int32)(n) == HDfreadbig((b), (n), (f))) ? \
+                                SUCCEED : FAIL)
+#   define HI_WRITE(f, b, n)   (((int32)(n) == HDfwritebig((b), (n), (f))) ? \
+                                SUCCEED : FAIL)
+#   define HI_CLOSE(f)          (fclose(f))
+#   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_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 == PCIO */
+
+#if (FILELIB == WINIO)
+/* using special MS Windows functions to enable reading/writing large chunks */
+typedef HFILE hdf_file_t;
+#   define HI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                _lopen((p), READ_WRITE) : _lopen((p), READ))
+#   define HI_CREATE(p)        (_lcreat((p), 0))
+/* Alias the HI_READ and HI_WRITE macros to functions which can handle */
+/*  32-bits of data to read/write */
+#   define HI_READ(f, b, n)    (((int32)(n) == HDfreadbig((b), (n), (f))) ? \
+                                SUCCEED : FAIL)
+#   define HI_WRITE(f, b, n)   (((int32)(n) == HDfwritebig((b), (n), (f))) ? \
+                                SUCCEED : FAIL)
+#   define HI_CLOSE(f)          (_lclose(f))
+#   define HI_FLUSH(f)          (0)
+#   define HI_SEEK(f, o)        (_llseek((f), (long)(o), SEEK_SET))
+#   define HI_SEEKEND(f)        (_llseek((f), (long)0, SEEK_END))
+#   define HI_TELL(f)           (_llseek((f),0l,SEEK_CUR))
+#   define OPENERR(f)           ((f) == (HFILE)HFILE_ERROR)
+#endif /* FILELIB == WINIO */
+
+#if (FILELIB == WINNTIO)
+/* using special Windows NT functions to enable reading/writing large chunks */
+typedef HFILE hdf_file_t;
+#   define HI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                        _lopen((p), OF_READWRITE) : _lopen((p), OF_READ))
+#   define HI_CREATE(p)        (_lcreat((p), 0))
+#   define HI_READ(f, b, n)    (((int32)(n) == _hread((f), (b), (n))) ? \
+                                SUCCEED : FAIL)
+#   define HI_WRITE(f, b, n)   (((int32)(n) == _hwrite((f), (b), (n))) ? \
+                                SUCCEED : FAIL)
+#   define HI_CLOSE(f) (_lclose(f)==0 ? SUCCEED : FAIL)
+#   define HI_FLUSH(f) (0)
+#   define HI_SEEK(f, o)       (_llseek((f), (long)(o), 0))
+#   define HI_SEEKEND(f) (_llseek((f), (long)0, 2))
+#   define HI_TELL(f)  (_llseek((f),0l,1))
+#   define OPENERR(f)  ((f) == (HFILE)HFILE_ERROR)
+#endif /* FILELIB == WINNTIO */
+#endif /* NOT_USED */
+
+#if (FILELIB == PAGEBUFIO)
+#include "fmpio.h"
+/* using page buffered file I/O routines to access files */
+typedef MPFILE *hdf_file_t;
+#   define HI_OPEN(p, a)        (MPopen((p), (a)))
+#   define HI_CREATE(p)         (MPopen((p), DFACC_CREATE))
+#   define HI_CLOSE(f)          (MPclose(f))
+#   define HI_FLUSH(f)          (MPflush(f))
+#   define HI_READ(f, b, n)     (MPread((f), (char *)(b), (n)))
+#   define HI_WRITE(f, b, n)    (MPwrite((f), (char *)(b), (n)))
+#   define HI_SEEK(f, o)        (MPseek((f), (off_t)(o), SEEK_SET))
+#   define HI_SEEKEND(f)        (MPseek((f), (off_t)0, SEEK_END))
+#   define HI_TELL(f)           (MPseek((f), (off_t)0, SEEK_CUR))
+#   define OPENERR(f)           ((f) == (MPFILE *)NULL)
+#endif /* FILELIB == PAGEBUFIO */
+
+/* ----------------------- 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
+  {
+      OP_UNKNOWN = 0,   /* Don't know what the last operation was (after fopen frex) */
+      OP_SEEK,          /* Last operation was a seek */
+      OP_WRITE,         /* Last operation was a write */
+      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) */
+      
+      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. */
+typedef struct sp_info_block_t
+  {
+      int16       key;          /* type of special element this is */
+
+      /* external elements */
+      int32       offset;       /* offset in the file */
+      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 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 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);
+
+/*
+   ** from hchunks.c - should be the same as found in 'hchunks.h'
+ */
+#include "hchunks.h"
+
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+    HDFLIBAPI hdf_file_t mopen
+                (char *filename, intn access);
+
+    HDFLIBAPI int32 mclose
+                (hdf_file_t rn);
+
+    HDFLIBAPI int32 mlseek
+                (hdf_file_t rn, int32 n, intn m);
+
+    HDFLIBAPI int32 mread
+                (hdf_file_t rn, char *buf, int32 n);
+
+    HDFLIBAPI int32 mwrite
+                (hdf_file_t rn, char *buf, int32 n);
+    HDFLIBAPI intn mstat
+                (char *path);
+
+#endif  /* macintosh */
+
+/*
+   ** 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hfiledd.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hfiledd.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hfiledd.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2386 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.14 $";
+#endif
+
+/* $Id: hfiledd.c,v 1.14 1999/06/16 21:11:06 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_filedd_c
+#endif
+
+/*
+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
+
+/******************************************************************************
+ 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++)
+          {
+            UINT16DECODE(p, curr_dd_ptr->tag);
+            UINT16DECODE(p, curr_dd_ptr->ref);
+            INT32DECODE(p, curr_dd_ptr->offset);
+            INT32DECODE(p, 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 = 0; /* invalid ref */
+    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;
+    UINT16ENCODE(p, (uint16) DFTAG_NULL);
+    UINT16ENCODE(p, (uint16) 0); /* invalid ref */
+    INT32ENCODE(p, (int32) INVALID_LENGTH);
+    INT32ENCODE(p, (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++)
+              {
+                UINT16ENCODE(p, list->tag);
+                UINT16ENCODE(p, list->ref);
+                INT32ENCODE(p, list->offset);
+                INT32ENCODE(p, list->length);
+              }	/* end for */
+
+            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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hdupdd);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hdupdd);
+#endif /* HAVE_PABLO */
+
+  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 = HAatom_object(file_id);
+    int32 ret_value=SUCCEED;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hnumber);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hnumber);
+#endif /* HAVE_PABLO */
+
+  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 = 0; /* 0 is invalid ref */
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hnewref);
+#endif /* HAVE_PABLO */
+
+    /* 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 (ref = 1; ref <= MAX_REF; ref++)
+          {
+            dd_t *dd_ptr=NULL;
+      
+            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 == 0)   /* Zero is invalid ref */
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Hnewref);
+#endif /* HAVE_PABLO */
+
+  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 = 0; /* 0 is invalid ref */
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Htagnewref);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_Htagnewref);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Hfind);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+     TRACE_OFF(PABLO_mask, ID_Hfind);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_HDreuse_tagref);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask, ID_HDreuse_tagref);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Hdeldd);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask, ID_Hdeldd);
+#endif /* HAVE_PABLO */
+
+  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 = 0; /* invalid ref */
+    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;
+        UINT16ENCODE(p, (uint16) DFTAG_NULL);
+        UINT16ENCODE(p, (uint16) 0); /* invalid ref */
+        INT32ENCODE(p, (int32) INVALID_LENGTH);
+        INT32ENCODE(p, (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;
+        UINT16ENCODE(p, dd_ptr->tag);
+        UINT16ENCODE(p, dd_ptr->ref);
+        INT32ENCODE(p, dd_ptr->offset);
+        INT32ENCODE(p, 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 */
+
+    } /* 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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hfilef.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hfilef.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hfilef.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,264 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.24 $";
+#endif
+
+/* $Id: hfilef.c,v 1.24 1999/03/13 18:21:37 epourmal Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+/*-----------------------------------------------------------------------------
+ * 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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/hfileff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hfileff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hfileff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,157 @@
+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: hfileff.f,v 1.11 1999/04/27 19:58:49 epourmal Exp $
+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

Added: packages/libhdf4/branches/upstream/current/hdf/src/hkit.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hkit.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hkit.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,348 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.70 $";
+#endif
+
+/* $Id: hkit.c,v 1.70 1998/02/02 21:44:00 smitchel Exp $ */
+
+#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 */
+
+#if !(defined (MAC) || defined (macintosh) || defined (SYMANTEC_C))
+    filerec_t  *file_rec;
+
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    HI_FLUSH(file_rec->file);
+#endif /* MAC */
+
+    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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hkit.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hkit.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hkit.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,171 @@
+
+/****************************************************************************
+ * 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: hkit.h,v 1.15 1996/10/10 18:43:27 koziol Exp $ */
+
+/*+ 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 */
+#if defined MIPSEL | defined KNRSUN | defined __SUNPRO_C
+#define string(x) #x
+#else
+#define string(x) "x"
+#endif /* MIPSEL */
+
+/*  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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hlimits.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hlimits.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hlimits.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,253 @@
+/****************************************************************************
+ * 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: hlimits.h,v 1.17 2000/05/05 20:51:11 epourmal Exp $ */
+
+/*+ 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
+
+/**************************************************************************
+*  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
+#if defined(macintosh) || defined(MAC) || defined(SYMANTEC_C)
+#   define TBUF_SZ      256
+#else  /* !macintosh */
+#   define TBUF_SZ     1024
+#endif /* !macintosh */
+#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 */
+
+/*
+ * 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
+
+/* ----------------- 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 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 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 */
+/* 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 MAX_NC_NAME MIN(256,MIN(VSNAMELENMAX,VGNAMELENMAX)) */
+
+#define MAX_NC_NAME 256		 /* max length of a name */
+#define MAX_VAR_DIMS 32          /* max per variable dimensions */
+
+/* ----------------- Constants for MFGR interface --------------------- */
+#define 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_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 */
+#ifdef   _HCHUNKS_MAIN_
+/* Private to 'hchunks.c' */
+#define _HDF_CHK_TBL_CLASS "_HDF_CHK_TBL_" /* 13 bytes */
+#define _HDF_CHK_TBL_CLASS_VER  0          /* zero version number for class */
+#endif /* _HCHUNKS_MAIN_ */
+
+
+/* ------------  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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/hntdefs.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hntdefs.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hntdefs.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,275 @@
+/****************************************************************************
+ * 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: hntdefs.h,v 1.5 2000/05/23 18:03:30 acheng Exp $ */
+
+/*+ 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  /* uchar=uchar8 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 */
+#define        DFNTF_CRAYMPP   7    /* Cray MPP 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 */
+/* Cray (UNICOS) native number sizes:
+	Char = 8 bits, unsigned
+	Short=64 int=64 long=64 float=64 double=64 bits
+	Long double=128 bits
+	Char pointers = 64 bits
+	Int pointers = 64 bits
+*/
+/* T3D/T3E (CRAYMPP) native number sizes:
+	Char = 8 bits, unsigned
+	Short=32 int=64 long=64 float=32 double=64 bits
+	Long double=64 bits
+	Char pointers = 64 bits
+	Int pointers = 64 bits
+	Big endian, IEEE floating point
+*/
+/* 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
+*/
+
+#if !defined(UNICOS)
+#    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
+#if defined(CRAYMPP)
+#    define SIZE_NINT16      4
+#    define SIZE_NUINT16     4
+#else
+#    define SIZE_NINT16      2
+#    define SIZE_NUINT16     2
+#endif
+#    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 */
+#if defined(CRAYMPP)
+#    define SIZE_NCHAR16     4  /* No current plans for support */
+#    define SIZE_NUCHAR16    4  /* No current plans for support */
+#else
+#    define SIZE_NCHAR16     2  /* No current plans for support */
+#    define SIZE_NUCHAR16    2  /* No current plans for support */
+#endif
+#else  /* !!!!!! SOMEBODY NEEDS TO CHECK THESE !!!!! */
+#    define SIZE_NFLOAT32    8
+#    define SIZE_NFLOAT64    8
+#    define SIZE_NFLOAT128  16  /* No current plans for support */
+
+#    define SIZE_NINT8       1
+#    define SIZE_NUINT8      1
+#    define SIZE_NINT16      8
+#    define SIZE_NUINT16     8
+#    define SIZE_NINT32      8
+#    define SIZE_NUINT32     8
+#    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
+#    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 */
+#endif /* UNICOS */
+
+/* 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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hproto.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hproto.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hproto.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4174 @@
+/****************************************************************************
+ * 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: hproto.h,v 1.184 2000/02/25 19:13:02 epourmal Exp $ */
+
+#ifndef _H_PROTO
+#define _H_PROTO
+
+/* 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 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, int32 len);
+
+    HDFLIBAPI int32 HDspaceleft
+                (void);
+
+#if defined(MALLOC_CHECK) || defined(_HDFDLL_)
+    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 VMS || defined macintosh || defined MAC || defined SYMANTEC_C || defined MIPSEL || defined NEXT || defined CONVEX || defined IBM6000 || defined SUN || defined IRIX || defined _HDFDLL_
+    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);
+
+/*
+   ** 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 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 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 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);
+
+    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);
+
+/*
+   ** from dfkcray.c
+ */
+
+    HDFLIBAPI intn DFKui2i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKui2s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKuo2i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKuo2s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKui4i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKui4s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKuo4i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKuo4s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKui4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKuo4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKui8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKuo8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlui2i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlui2s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKluo2i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKluo2s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlui4i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlui4s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKluo4i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKluo4s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlui4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKluo4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlui8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKluo8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/* CRAY-MPP */
+    HDFLIBAPI intn DFKmi2i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKmi2s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKmo2b
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlmi2i
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlmi2s
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlmo2b
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+
+/*
+   ** from dfkvms.c
+ */
+
+    HDFLIBAPI intn DFKvi4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKvo4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKvi8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKvo8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlvi4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlvo4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlvi8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlvo8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/*
+   ** from dfkconv.c
+ */
+
+    HDFLIBAPI intn DFKci4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKco4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKci8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKco8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlci4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlco4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlci8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlco8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/*
+   ** from dfkfuji.c
+ */
+
+    HDFLIBAPI intn DFKpi4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKpo4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKpi8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKpo8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlpi4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlpo4f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlpi8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKlpo8f
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/*
+   ** from dfanF.c
+ */
+#ifndef DFAN_FNAMES
+#   define  DFAN_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndaiganl  FNAME(DAIGANL)
+#   define ndaigann  FNAME(DAIGANN)
+#   define ndaipann  FNAME(DAIPANN)
+#   define ndailist  FNAME(DAILIST)
+#   define ndalref   FNAME(DALREF)
+#   define ndaclear  FNAME(DACLEAR)
+#   define ndfanlastref     FNAME(DFANLASTREF)
+
+#   define ndfanaddfds      FNAME(DFANADDFDS)
+#   define ndfangetfidlen   FNAME(DFANGETFIDLEN)
+#   define ndfangetfdslen   FNAME(DFANGETFDSLEN)
+#   define ndfangetfid      FNAME(DFANGETFID)
+#   define ndfangetfds      FNAME(DFANGETFDS)
+#   define ndaafds          FNAME(DAAFDS)
+#   define ndagfidl         FNAME(DAGFIDL)
+#   define ndagfdsl         FNAME(DAGFDSL)
+#   define ndagfid          FNAME(DAGFID)
+#   define ndagfds          FNAME(DAGFDS)
+#   define ndaiafid         FNAME(DAIAFID)
+#else                           /* DF_CAPFNAMES */
+#   define ndaiganl  FNAME(daiganl)
+#   define ndaigann  FNAME(daigann)
+#   define ndaipann  FNAME(daipann)
+#   define ndailist  FNAME(dailist)
+#   define ndalref   FNAME(dalref)
+#   define ndaclear  FNAME(daclear)
+#   define ndfanlastref     FNAME(dfanlastref)
+
+#   define ndfanaddfds      FNAME(dfanaddfds)
+#   define ndfangetfidlen   FNAME(dfangetfidlen)
+#   define ndfangetfdslen   FNAME(dfangetfdslen)
+#   define ndfangetfid      FNAME(dfangetfid)
+#   define ndfangetfds      FNAME(dfangetfds)
+#   define ndaafds          FNAME(daafds)
+#   define ndagfidl         FNAME(dagfidl)
+#   define ndagfdsl         FNAME(dagfdsl)
+#   define ndagfid          FNAME(dagfid)
+#   define ndagfds          FNAME(dagfds)
+#   define ndaiafid         FNAME(daiafid)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFAN_FNAMES */
+
+    HDFLIBAPI      FRETVAL(intf) ndaiganl
+                (_fcd filename, intf * tag, intf * ref, intf * type,
+                 intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndaigann
+                (_fcd filename, intf * tag, intf * ref, _fcd annotation,
+                 intf * maxlen, intf * type, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndaipann
+                (_fcd filename, intf * tag, intf * ref, _fcd annotation,
+                 intf * annlen, intf * type, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndailist
+                (_fcd filename, intf * tag, intf reflist[], _fcd labellist,
+          intf * listsize, intf * maxlen, intf * startpos,
+                 intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndalref
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndaclear
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfanlastref
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfanaddfds
+                (intf * dfile, _fcd desc, intf * desclen);
+
+    HDFLIBAPI      FRETVAL(intf) ndfangetfidlen
+                (intf * dfile, intf * isfirst);
+
+    HDFLIBAPI      FRETVAL(intf) ndfangetfdslen
+                (intf * dfile, intf * isfirst);
+
+    HDFLIBAPI      FRETVAL(intf) ndfangetfid
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    HDFLIBAPI      FRETVAL(intf) ndfangetfds
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    HDFLIBAPI      FRETVAL(intf) ndaafds
+                (intf * dfile, _fcd desc, intf * desclen);
+
+    HDFLIBAPI      FRETVAL(intf) ndagfidl
+                (intf * dfile, intf * isfirst);
+
+    HDFLIBAPI      FRETVAL(intf) ndagfdsl
+                (intf * dfile, intf * isfirst);
+
+    HDFLIBAPI      FRETVAL(intf) ndagfid
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    HDFLIBAPI      FRETVAL(intf) ndagfds
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    HDFLIBAPI      FRETVAL(intf) ndaiafid
+                (intf * dfile, _fcd id, intf * idlen);
+
+/*
+   ** from dfr8F.c
+ */
+#ifndef DFR8_FNAMES
+#   define DFR8_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nd8spal   FNAME(D8SPAL)
+#   define nd8first  FNAME(D8FIRST)
+#   define nd8igdim  FNAME(D8IGDIM)
+#   define nd8igimg  FNAME(D8IGIMG)
+#   define nd8ipimg  FNAME(D8IPIMG)
+#   define nd8iaimg  FNAME(D8IAIMG)
+#   define nd8irref  FNAME(D8IRREF)
+#   define nd8iwref  FNAME(D8IWREF)
+#   define nd8inims  FNAME(D8INIMS)
+#   define nd8lref   FNAME(D8LREF)
+#   define ndfr8lastref      FNAME(DFR8LASTREF)
+#   define ndfr8setpalette   FNAME(DFR8SETPALETTE)
+#   define ndfr8restart  FNAME(DFR8RESTART)
+#   define nd8scomp  FNAME(D8SCOMP)
+#   define ndfr8scompress FNAME(DFR8SCOMPRESS)
+#   define nd8sjpeg  FNAME(D8SJPEG)
+#   define ndfr8sjpeg FNAME(DFR8SJPEG)
+#else                           /* !DF_CAPFNAMES */
+#   define nd8spal   FNAME(d8spal)
+#   define nd8first  FNAME(d8first)
+#   define nd8igdim  FNAME(d8igdim)
+#   define nd8igimg  FNAME(d8igimg)
+#   define nd8ipimg  FNAME(d8ipimg)
+#   define nd8iaimg  FNAME(d8iaimg)
+#   define nd8irref  FNAME(d8irref)
+#   define nd8iwref  FNAME(d8iwref)
+#   define nd8inims  FNAME(d8inims)
+#   define nd8lref   FNAME(d8lref)
+#   define ndfr8lastref      FNAME(dfr8lastref)
+#   define ndfr8setpalette   FNAME(dfr8setpalette)
+#   define ndfr8restart  FNAME(dfr8restart)
+#   define nd8scomp  FNAME(d8scomp)
+#   define ndfr8scompress FNAME(dfr8scompress)
+#   define nd8sjpeg  FNAME(d8sjpeg)
+#   define ndfr8sjpeg FNAME(dfr8sjpeg)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFR8_FNAMES */
+
+    HDFLIBAPI      FRETVAL(intf) nd8spal
+                (_fcd pal);
+
+    HDFLIBAPI      FRETVAL(intf) nd8first
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) nd8igdim
+                (_fcd filename, intf * xdim, intf * ydim, intf * ispal,
+                 intf * lenfn);
+
+    HDFLIBAPI      FRETVAL(intf) nd8igimg
+                (_fcd filename, _fcd image, intf * xdim, intf * ydim,
+                 _fcd pal, intf * lenfn);
+
+    HDFLIBAPI      FRETVAL(intf) nd8ipimg
+                (_fcd filename, _fcd image, intf * xdim, intf * ydim,
+                 intf * compress, intf * lenfn);
+
+    HDFLIBAPI      FRETVAL(intf) nd8iaimg
+                (_fcd filename, _fcd image, intf * xdim, intf * ydim,
+                 intf * compress, intf * lenfn);
+
+    HDFLIBAPI      FRETVAL(intf) nd8irref
+                (_fcd filename, intf * ref, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) nd8iwref
+                (_fcd filename, intf * ref, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) nd8inims
+                (_fcd filename, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) nd8lref
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfr8lastref
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfr8setpalette
+                (_fcd pal);
+
+    HDFLIBAPI      FRETVAL(intf) ndfr8restart
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) nd8scomp
+                (intf * scheme);
+
+    HDFLIBAPI      FRETVAL(intf) ndfr8scompress
+                (intf * scheme);
+
+    HDFLIBAPI      FRETVAL(intf) nd8sjpeg
+                (intf * quality, intf * force_baseline);
+
+    HDFLIBAPI      FRETVAL(intf) ndfr8sjpeg
+                (intf * quality, intf * force_baseline);
+
+/*
+   ** from dfsdF.c
+ */
+#ifndef DFSD_FNAMES
+#   define DFSD_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndsgdast  FNAME(DSGDAST)
+#   define ndsgdisc  FNAME(DSGDISC)
+#   define ndsgrang  FNAME(DSGRANG)
+#   define ndssdims  FNAME(DSSDIMS)
+#   define ndssdisc  FNAME(DSSDISC)
+#   define ndssrang  FNAME(DSSRANG)
+#   define ndsclear  FNAME(DSCLEAR)
+#   define ndsslens  FNAME(DSSLENS)
+#   define ndsgdiln  FNAME(DSGDILN)
+#   define ndsgdaln  FNAME(DSGDALN)
+#   define ndsfirst  FNAME(DSFIRST)
+#   define ndspslc   FNAME(DSPSLC)
+#   define ndseslc   FNAME(DSESLC)
+#   define ndsgnt    FNAME(DSGNT)
+#   define ndssnt    FNAME(DSSNT)
+#   define ndsigdim  FNAME(DSIGDIM)
+#   define ndsigdat  FNAME(DSIGDAT)
+#   define ndsipdat  FNAME(DSIPDAT)
+#   define ndsiadat  FNAME(DSIADAT)
+#   define ndsigdas  FNAME(DSIGDAS)
+#   define ndsigslc  FNAME(DSIGSLC)
+#   define ndsigdis  FNAME(DSIGDIS)
+#   define ndsisslc  FNAME(DSISSLC)
+#   define ndsisdas  FNAME(DSISDAS)
+#   define ndsisdis  FNAME(DSISDIS)
+#   define ndsirref  FNAME(DSIRREF)
+#   define ndslref   FNAME(DSLREF)
+#   define ndsinum   FNAME(DSINUM)
+#   define ndsip32s  FNAME(DSIP32S)
+#   define ndsscal   FNAME(DSSCAL)
+#   define ndsgcal   FNAME(DSGCAL)
+#   define ndfsdgetdatastrs  FNAME(DFSDGETDATASTRS)
+#   define ndfsdgetdimscale  FNAME(DFSDGETDIMSCALE)
+#   define ndfsdgetrange     FNAME(DFSDGETRANGE)
+#   define ndfsdsetdims      FNAME(DFSDSETDIMS)
+#   define ndfsdsetdimscale  FNAME(DFSDSETDIMSCALE)
+#   define ndfsdsetrange     FNAME(DFSDSETRANGE)
+#   define ndfsdclear        FNAME(DFSDCLEAR)
+#   define ndfsdsetlengths   FNAME(DFSDSETLENGTHS)
+#   define ndfsdgetdimlen    FNAME(DFSDGETDIMLEN)
+#   define ndfsdgetdatalen   FNAME(DFSDGETDATALEN)
+#   define ndfsdrestart      FNAME(DFSDRESTART)
+#   define ndfsdputslice     FNAME(DFSDPUTSLICE)
+#   define ndfsdendslice     FNAME(DFSDENDSLICE)
+#   define ndfsdsetnt        FNAME(DFSDSETNT)
+#   define ndfsdgetnt        FNAME(DFSDGETNT)
+#   define ndfsdlastref      FNAME(DFSDLASTREF)
+#   define ndsiwref          FNAME(DSIWREF)
+#   define ndssfill          FNAME(DSSFILL)
+#   define ndsgfill          FNAME(DSGFILL)
+#   define ndsisslab         FNAME(DSISSLAB)
+#   define ndswslab          FNAME(DSWSLAB)
+#   define ndseslab          FNAME(DSESLAB)
+#   define ndsirslab         FNAME(DSIRSLAB)
+#else
+#   define ndsgdast  FNAME(dsgdast)
+#   define ndsgdisc  FNAME(dsgdisc)
+#   define ndsgrang  FNAME(dsgrang)
+#   define ndssdims  FNAME(dssdims)
+#   define ndssdisc  FNAME(dssdisc)
+#   define ndssrang  FNAME(dssrang)
+#   define ndsclear  FNAME(dsclear)
+#   define ndsslens  FNAME(dsslens)
+#   define ndsgdiln  FNAME(dsgdiln)
+#   define ndsgdaln  FNAME(dsgdaln)
+#   define ndsfirst  FNAME(dsfirst)
+#   define ndspslc   FNAME(dspslc)
+#   define ndseslc   FNAME(dseslc)
+#   define ndsgnt    FNAME(dsgnt)
+#   define ndssnt    FNAME(dssnt)
+#   define ndsigdim  FNAME(dsigdim)
+#   define ndsigdat  FNAME(dsigdat)
+#   define ndsipdat  FNAME(dsipdat)
+#   define ndsiadat  FNAME(dsiadat)
+#   define ndsigdas  FNAME(dsigdas)
+#   define ndsigslc  FNAME(dsigslc)
+#   define ndsigdis  FNAME(dsigdis)
+#   define ndsisslc  FNAME(dsisslc)
+#   define ndsisdas  FNAME(dsisdas)
+#   define ndsisdis  FNAME(dsisdis)
+#   define ndsirref  FNAME(dsirref)
+#   define ndslref   FNAME(dslref)
+#   define ndsinum   FNAME(dsinum)
+#   define ndsip32s  FNAME(dsip32s)
+#   define ndsscal   FNAME(dsscal)
+#   define ndsgcal   FNAME(dsgcal)
+#   define ndfsdgetdatastrs  FNAME(dfsdgetdatastrs)
+#   define ndfsdgetdimscale  FNAME(dfsdgetdimscale)
+#   define ndfsdgetrange     FNAME(dfsdgetrange)
+#   define ndfsdsetdims      FNAME(dfsdsetdims)
+#   define ndfsdsetdimscale  FNAME(dfsdsetdimscale)
+#   define ndfsdsetrange     FNAME(dfsdsetrange)
+#   define ndfsdclear        FNAME(dfsdclear)
+#   define ndfsdsetlengths   FNAME(dfsdsetlengths)
+#   define ndfsdgetdimlen    FNAME(dfsdgetdimlen)
+#   define ndfsdgetdatalen   FNAME(dfsdgetdatalen)
+#   define ndfsdrestart      FNAME(dfsdrestart)
+#   define ndfsdputslice     FNAME(dfsdputslice)
+#   define ndfsdendslice     FNAME(dfsdendslice)
+#   define ndfsdsetnt        FNAME(dfsdsetnt)
+#   define ndfsdgetnt        FNAME(dfsdgetnt)
+#   define ndfsdlastref      FNAME(dfsdlastref)
+#   define ndsiwref          FNAME(dsiwref)
+#   define ndssfill          FNAME(dssfill)
+#   define ndsgfill          FNAME(dsgfill)
+#   define ndsisslab         FNAME(dsisslab)
+#   define ndswslab          FNAME(dswslab)
+#   define ndseslab          FNAME(dseslab)
+#   define ndsirslab         FNAME(dsirslab)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFSD_FNAMES */
+
+    HDFLIBAPI      FRETVAL(intf) ndsgdisc
+                (intf * dim, intf * maxsize, void * scale);
+
+    HDFLIBAPI      FRETVAL(intf) ndsgrang
+                (void * pmax, void * pmin);
+
+    HDFLIBAPI      FRETVAL(intf) ndssdims
+                (intf * rank, intf dimsizes[]);
+
+    HDFLIBAPI      FRETVAL(intf) ndssdisc
+                (intf * dim, intf * dimsize, void * scale);
+
+    HDFLIBAPI      FRETVAL(intf) ndssrang
+                (void * max, void * min);
+
+    HDFLIBAPI      FRETVAL(intf) ndsclear
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndsslens
+                (intf * maxlen_label, intf * maxlen_unit,
+                 intf * maxlen_format, intf * maxlen_coordsys);
+
+    HDFLIBAPI      FRETVAL(intf) ndsgdiln
+                (intf * dim, intf * llabel, intf * lunit,
+                 intf * lformat);
+
+    HDFLIBAPI      FRETVAL(intf) ndsgdaln
+                (intf * llabel, intf * lunit, intf * lformat,
+                 intf * lcoordsys);
+
+    HDFLIBAPI      FRETVAL(intf) ndsfirst
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndspslc
+                (intf windims[], void * data, intf dims[]);
+
+    HDFLIBAPI      FRETVAL(intf) ndseslc
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndssnt
+                (intf * numbertype);
+
+    HDFLIBAPI      FRETVAL(intf) ndsgnt
+                (intf * pnumbertype);
+
+    HDFLIBAPI      FRETVAL(intf) ndsigdim
+                (_fcd filename, intf * prank, intf sizes[],
+                 intf * maxrank, intf * lenfn);
+
+    HDFLIBAPI      FRETVAL(intf) ndsigdat
+                (_fcd filename, intf * rank, intf maxsizes[],
+                 void * data, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndsipdat
+                (_fcd filename, intf * rank, intf dimsizes[],
+                 void * data, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndsiadat
+                (_fcd filename, intf * rank, intf dimsizes[],
+                 void * data, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndsigslc
+                (_fcd filename, intf winst[], intf windims[],
+                 void * data, intf dims[], intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndsisslc
+                (_fcd filename, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndsirref
+                (_fcd filename, intf * ref, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndslref
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndsinum
+                (_fcd filename, intf * len);
+
+    HDFLIBAPI      FRETVAL(intf) ndsip32s
+                (_fcd filename, intf * ref, intf * ispre32, intf * len);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdgetdatastrs
+                (_fcd label, _fcd unit, _fcd format, _fcd coordsys);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdgetdimstrs
+                (intf * dim, _fcd label, _fcd unit, _fcd format);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdgetdimscale
+                (intf * dim, intf * maxsize, void * scale);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdgetrange
+                (void * pmax, void * pmin);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdsetdims
+                (intf * rank, intf dimsizes[]);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdsetdimscale
+                (intf * dim, intf * dimsize, void * scale);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdsetrange
+                (void * max, void * min);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdclear
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdsetlengths
+                (intf * maxlen_label, intf * maxlen_unit,
+                 intf * maxlen_format, intf * maxlen_coordsys);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdgetdimlen
+                (intf * dim, intf * llabel, intf * lunit,
+                 intf * lformat);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdgetdatalen
+                (intf * llabel, intf * lunit, intf * lformat,
+                 intf * lcoordsys);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdrestart
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdputslice
+                (intf windims[], void * data, intf dims[]);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdendslice
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdsetnt
+                (intf * numbertype);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdgetnt
+                (intf * pnumbertype);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsdlastref
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndsisdis
+                (intf * dim, _fcd flabel, _fcd funit, _fcd fformat,
+             intf * llabel, intf * lunit, intf * lformat);
+
+    HDFLIBAPI      FRETVAL(intf) ndsigdis
+                (intf * dim, _fcd label, _fcd unit, _fcd format,
+             intf * llabel, intf * lunit, intf * lformat);
+
+    HDFLIBAPI      FRETVAL(intf) ndsisdas
+                (_fcd flabel, _fcd funit, _fcd fformat, _fcd fcoordsys,
+            intf * isfortran, intf * llabel, intf * lunit,
+                 intf * lformat, intf * lcoordsys);
+
+    HDFLIBAPI      FRETVAL(intf) ndsigdas
+                (_fcd label, _fcd unit, _fcd format, _fcd coordsys, intf * llabel,
+             intf * lunit, intf * lformat, intf * lcoord);
+
+    HDFLIBAPI      FRETVAL(intf) ndsscal
+                (float64 * cal, float64 * cal_err, float64 * ioff,
+                 float64 * ioff_err, intf * cal_type);
+
+    HDFLIBAPI      FRETVAL(intf) ndsgcal
+                (float64 * cal, float64 * cal_err, float64 * ioff,
+                 float64 * ioff_err, intf * cal_type);
+
+    HDFLIBAPI      FRETVAL(intf) ndswref
+                (_fcd filename, intf * fnlen, intf * ref);
+
+    HDFLIBAPI      FRETVAL(intf) ndssfill
+                (void * fill_value);
+
+    HDFLIBAPI      FRETVAL(intf) ndsgfill
+                (void * fill_value);
+
+    HDFLIBAPI      FRETVAL(intf) ndssslab
+                (_fcd filename, intf * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndswslab
+                (intf start[], intf  stride[],
+                 intf  cont[], void * data);
+
+    HDFLIBAPI      FRETVAL(intf) ndseslab
+                (void);
+
+    HDFLIBAPI	FRETVAL(intf) ndsiwref
+		(_fcd filename, intf * fnlen, intf * ref);
+
+    HDFLIBAPI	FRETVAL(intf) ndsisslab
+		(_fcd filename, intf * fnlen);
+
+    HDFLIBAPI	FRETVAL(intf) ndsirslab
+		(_fcd filename, intf * fnlen, intf start[], intf slab_size[],
+	         intf stride[], void * buffer, intf buffer_size[]);
+
+/*
+   ** from dfpF.c
+ */
+
+#ifndef DFP_FNAMES
+#   define DFP_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndpigpal  FNAME(DPIGPAL)
+#   define ndpippal  FNAME(DPIPPAL)
+#   define ndpinpal  FNAME(DPINPAL)
+#   define ndpiwref  FNAME(DPIWREF)
+#   define ndpirref  FNAME(DPIRREF)
+#   define ndprest   FNAME(DPREST)
+#   define ndplref   FNAME(DPLREF)
+#   define ndfprestart   FNAME(DFPRESTART)
+#   define ndfplastref   FNAME(DFPLASTREF)
+#else                           /* !DF_CAPNAMES */
+#   define ndpigpal  FNAME(dpigpal)
+#   define ndpippal  FNAME(dpippal)
+#   define ndpinpal  FNAME(dpinpal)
+#   define ndpiwref  FNAME(dpiwref)
+#   define ndpirref  FNAME(dpirref)
+#   define ndprest   FNAME(dprest)
+#   define ndplref   FNAME(dplref)
+#   define ndfprestart   FNAME(dfprestart)
+#   define ndfplastref   FNAME(dfplastref)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFP_FNAMES */
+
+    HDFLIBAPI      FRETVAL(intf) ndpigpal
+                (_fcd filename, _fcd pal, intf  * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndpippal
+                (_fcd filename, _fcd pal, intf  * overwrite, _fcd filemode,
+                 intf  * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndpinpal
+                (_fcd filename, intf  * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndpirref
+                (_fcd filename, intf  * ref, intf  * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndpiwref
+                (_fcd filename, intf  * ref, intf  * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) ndprest
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndplref
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfprestart
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfplastref
+                (void);
+
+/*
+   ** from df24F.c
+ */
+#ifndef DF24_FNAMES
+#   define DF24_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nd2reqil  FNAME(D2REQIL)
+#   define ndf24reqil    FNAME(DF24REQIL)
+#   define nd2sdims  FNAME(D2SDIMS)
+#   define ndf24setdims  FNAME(DF24SETDIMS)
+#   define nd2setil  FNAME(D2SETIL)
+#   define ndf24setil    FNAME(DF24SETIL)
+#   define nd2first  FNAME(D2FIRST)
+#   define ndf24restart  FNAME(DF24RESTART)
+#   define nd2igdim  FNAME(D2IGDIM)
+#   define nd2igimg  FNAME(D2IGIMG)
+#   define nd2iaimg  FNAME(D2IAIMG)
+#   define nd2irref  FNAME(D2IRREF)
+#   define nd2inimg  FNAME(D2INIMG)
+#   define nd2lref   FNAME(D2LREF)
+#   define nd2scomp  FNAME(D2SCOMP)
+#   define ndf24scompress FNAME(DF24SCOMPRESS)
+#   define nd2sjpeg  FNAME(D2SJPEG)
+#   define ndf24sjpeg FNAME(DF24SJPEG)
+#else
+#   define nd2reqil  FNAME(d2reqil)
+#   define ndf24reqil    FNAME(df24reqil)
+#   define nd2sdims  FNAME(d2sdims)
+#   define ndf24setdims  FNAME(df24setdims)
+#   define nd2setil  FNAME(d2setil)
+#   define ndf24setil    FNAME(df24setil)
+#   define nd2first  FNAME(d2first)
+#   define ndf24restart  FNAME(df24restart)
+#   define nd2igdim  FNAME(d2igdim)
+#   define nd2igimg  FNAME(d2igimg)
+#   define nd2iaimg  FNAME(d2iaimg)
+#   define nd2irref  FNAME(d2irref)
+#   define nd2inimg  FNAME(d2inimg)
+#   define nd2lref   FNAME(d2lref)
+#   define nd2scomp  FNAME(d2scomp)
+#   define ndf24scompress FNAME(df24scompress)
+#   define nd2sjpeg  FNAME(d2sjpeg)
+#   define ndf24sjpeg FNAME(df24sjpeg)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DF24_FNAMES */
+
+    HDFLIBAPI      FRETVAL(intf) nd2reqil
+                (intf  * il);
+
+    HDFLIBAPI      FRETVAL(intf) nd2sdims
+                (intf  * xdim, intf  * ydim);
+
+    HDFLIBAPI      FRETVAL(intf) nd2igdim
+                (_fcd filename, intf  * pxdim, intf  * pydim, intf  * pil,
+                 intf  * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) nd2igimg
+                (_fcd filename, _fcd image, intf  * xdim, intf  * ydim,
+                 intf  * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) nd2iaimg
+                (_fcd filename, _fcd image, intf  * xdim, intf  * ydim,
+                 intf  * fnlen, intf  * newfile);
+
+    HDFLIBAPI      FRETVAL(intf) nd2setil
+                (intf  * il);
+
+    HDFLIBAPI      FRETVAL(intf) nd2first
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndf24reqil
+                (intf  * il);
+
+    HDFLIBAPI      FRETVAL(intf) ndf24setdims
+                (intf  * xdim, intf  * ydim);
+
+    HDFLIBAPI      FRETVAL(intf) ndf24setil
+                (intf  * il);
+
+    HDFLIBAPI      FRETVAL(intf) ndf24restart
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) nd2irref
+                (_fcd filename, intf  * ref, intf  * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) nd2inimg
+                (_fcd filename, intf  * fnlen);
+
+    HDFLIBAPI      FRETVAL(intf) nd2lref
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) nd2scomp
+                (intf * scheme);
+
+    HDFLIBAPI      FRETVAL(intf) ndf24scompress
+                (intf * scheme);
+
+    HDFLIBAPI      FRETVAL(intf) nd2sjpeg
+                (intf * quality, intf * force_baseline);
+
+    HDFLIBAPI      FRETVAL(intf) ndf24sjpeg
+                (intf * quality, intf * force_baseline);
+
+/*
+   ** from dfF.c
+ */
+#ifndef DF_FNAMES
+#   define DF_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndfiaccess FNAME(DFIACCESS)
+#   define ndfiopen  FNAME(DFIOPEN)
+#   define ndfclose  FNAME(DFCLOSE)
+#   define ndfdesc   FNAME(DFDESC)
+#   define ndfdup    FNAME(DFDUP)
+#   define ndfdel    FNAME(DFDEL)
+#   define ndfstart  FNAME(DFSTART)
+#   define ndfread   FNAME(DFREAD)
+#   define ndfseek   FNAME(DFSEEK)
+#   define ndfwrite  FNAME(DFWRITE)
+#   define ndfupdate FNAME(DFUPDATE)
+#   define ndfget    FNAME(DFGET)
+#   define ndfput    FNAME(DFPUT)
+#   define ndfsfind  FNAME(DFSFIND)
+#   define ndffind   FNAME(DFFIND)
+#   define ndferrno  FNAME(DFERRNO)
+#   define ndfnewref FNAME(DFNEWREF)
+#   define ndfnumber FNAME(DFNUMBER)
+#   define ndfstat   FNAME(DFSTAT)
+#   define ndfiishdf FNAME(DFIISHDF)
+#else                           /* !DF_CAPFNAMES */
+#   define ndfiaccess FNAME(dfiaccess)
+#   define ndfiopen  FNAME(dfiopen)
+#   define ndfclose  FNAME(dfclose)
+#   define ndfdesc   FNAME(dfdesc)
+#   define ndfdup    FNAME(dfdup)
+#   define ndfdel    FNAME(dfdel)
+#   define ndfstart  FNAME(dfstart)
+#   define ndfread   FNAME(dfread)
+#   define ndfseek   FNAME(dfseek)
+#   define ndfwrite  FNAME(dfwrite)
+#   define ndfupdate FNAME(dfupdate)
+#   define ndfget    FNAME(dfget)
+#   define ndfput    FNAME(dfput)
+#   define ndfsfind  FNAME(dfsfind)
+#   define ndffind   FNAME(dffind)
+#   define ndferrno  FNAME(dferrno)
+#   define ndfnewref FNAME(dfnewref)
+#   define ndfnumber FNAME(dfnumber)
+#   define ndfstat   FNAME(dfstat)
+#   define ndfiishdf FNAME(dfiishdf)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DF_FNAMES */
+
+    HDFLIBAPI      FRETVAL(intf) ndfiopen
+                (_fcd name, intf  * acc_mode, intf  * defdds, intf  * namelen);
+
+    HDFLIBAPI      FRETVAL(intf) ndfclose
+                (intf  * dfile);
+
+    HDFLIBAPI      FRETVAL(intf) ndfdesc
+                (intf  * dfile, intf  ptr[][4], intf  * begin,
+                 intf  * num);
+
+    HDFLIBAPI      FRETVAL(intf) ndfdup
+                (intf  * dfile, intf  * tag, intf  * ref, intf  * otag,
+                 intf  * oref);
+
+    HDFLIBAPI      FRETVAL(intf) ndfdel
+                (intf  * dfile, intf  * tag, intf  * ref);
+
+    HDFLIBAPI      FRETVAL(intf) ndfiaccess
+                (intf  * dfile, intf  * tag, intf  * ref, _fcd acc_mode, intf  * acclen);
+
+    HDFLIBAPI      FRETVAL(intf) ndfstart
+                (intf  * dfile, intf  * tag, intf  * ref, char  * acc_mode);
+
+    HDFLIBAPI      FRETVAL(intf) ndfread
+                (intf  * dfile, _fcd ptr, intf  * len);
+
+    HDFLIBAPI      FRETVAL(intf) ndfseek
+                (intf  * dfile, intf  * offset);
+
+    HDFLIBAPI      FRETVAL(intf) ndfwrite
+                (intf  * dfile, _fcd ptr, intf  * len);
+
+    HDFLIBAPI      FRETVAL(intf) ndfupdate
+                (intf  * dfile);
+
+    HDFLIBAPI      FRETVAL(intf) ndfget
+                (intf  * dfile, intf  * tag, intf  * ref, _fcd ptr);
+
+    HDFLIBAPI      FRETVAL(intf) ndfput
+                (intf  * dfile, intf  * tag, intf  * ref, _fcd ptr, intf  * len);
+
+    HDFLIBAPI      FRETVAL(intf) ndfsfind
+                (intf  * dfile, intf  * tag, intf  * ref);
+
+    HDFLIBAPI      FRETVAL(intf) ndffind
+                (intf  * dfile, intf  * itag, intf  * iref, intf  * len);
+
+    HDFLIBAPI      FRETVAL(intf) ndferrno
+                (void);
+
+    HDFLIBAPI      FRETVAL(intf) ndfnewref
+                (intf  * dfile);
+
+    HDFLIBAPI      FRETVAL(intf) ndfnumber
+                (intf  * dfile, intf  * tag);
+
+    HDFLIBAPI      FRETVAL(intf) ndfiishdf
+                (_fcd name, intf  * namelen);
+
+/*
+   ** from dfutil.c
+ */
+    HDFLIBAPI uint16 DFfindnextref
+                (int32 file_id, uint16 tag, uint16 lref);
+
+/*
+   ** from dfutilF.c
+ */
+#ifndef DFUTIL_FNAMES
+#   define DFUTIL_FNAMES
+#ifdef DF_CAPFNAMES
+#   define ndfindnr          FNAME(DFINDNR)
+#   define ndffindnextref    FNAME(DFFINDNEXTREF)
+#else
+#   define ndfindnr          FNAME(dfindnr)
+#   define ndffindnextref    FNAME(dffindnextref)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFUTIL_FNAMES */
+
+    HDFLIBAPI      FRETVAL(intf) ndfindnr
+                (intf  * dfile, intf  * tag, intf  * lref);
+
+    HDFLIBAPI      FRETVAL(intf) ndffindnextref
+                (intf  * dfile, intf  * tag, intf  * lref);
+
+/*
+   ** from herrF.c
+ */
+#ifndef HERR_FNAMES
+#   define HERR_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nheprnt   FNAME(HEPRNT)
+#   define nhestringc FNAME(HESTRINGC)
+#else
+#   define nheprnt   FNAME(heprnt)
+#   define nhestringc FNAME(hestringc)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* HERR_FNAMES */
+
+    HDFLIBAPI      FRETVAL(void) nheprnt
+                (intf  * print_levels);
+
+    HDFLIBAPI      FRETVAL(intf) nhestringc
+				(intf *error_code,_fcd error_message, intf *len);
+/*
+   ** from hfileF.c
+ */
+#ifndef HFILE_FNAMES
+#   define HFILE_FNAMES
+#ifdef DF_CAPFNAMES
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#   define nhiopen   FNAME(HIOPEN)
+#   define nhclose   FNAME(HCLOSE)
+#   define nhnumber  FNAME(HNUMBER)
+#   define nhxisdir  FNAME(HXISDIR)
+#   define nhxiscdir FNAME(HXISCDIR)
+#   define nhddontatexit FNAME(HDDONTATEXIT)
+#   define nhglibverc FNAME(HGLIBVERC)
+#   define nhgfilverc FNAME(HGFILVERC)
+#   define nhiishdf   FNAME(HIISHDF)
+#  else                                   /* !sl */
+#   define nhiopen   FNAME(HIOPEN)
+#   define nhiclose   FNAME(HICLOSE)
+#   define nhinumbr  FNAME(HINUMBR)
+#   define nhxisdir  FNAME(HXISDIR)
+#   define nhxiscdir FNAME(HXISCDIR)
+#   define nhddontatexit FNAME(HDDONTATEXIT)
+#   define nhglibverc FNAME(HGLIBVERC)
+#   define nhgfilverc FNAME(HGFILVERC)
+#   define nhiishdf   FNAME(HIISHDF)
+#  endif
+
+#else
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#   define nhiopen   FNAME(hiopen)
+#   define nhclose   FNAME(hclose)
+#   define nhnumber  FNAME(hnumber)
+#   define nhxisdir  FNAME(hxisdir)
+#   define nhxiscdir FNAME(hxiscdir)
+#   define nhddontatexit FNAME(hddontatexit)
+#   define nhglibverc FNAME(hglibverc)
+#   define nhgfilverc FNAME(hgfilverc)
+#   define nhiishdf   FNAME(hiishdf)
+#  else                                   /* !sl */
+#   define nhiopen   FNAME(hiopen)
+#   define nhiclose   FNAME(hiclose)
+#   define nhinumbr  FNAME(hinumbr)
+#   define nhxisdir  FNAME(hxisdir)
+#   define nhxiscdir FNAME(hxiscdir)
+#   define nhddontatexit FNAME(hddontatexit)
+#   define nhglibverc FNAME(hglibverc)
+#   define nhgfilverc FNAME(hgfilverc)
+#   define nhiishdf   FNAME(hiishdF)
+#  endif
+
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* HFILE_FNAMES */
+
+    HDFLIBAPI      FRETVAL(intf) nhiopen
+                (_fcd name, intf  * acc_mode, intf  * defdds, intf  * namelen);
+
+    HDFLIBAPI      FRETVAL(intf) nhclose
+                (intf  * file_id);
+
+    HDFLIBAPI	FRETVAL(intf) nhnumber
+		(intf  * file_id, intf  * tag);
+
+    HDFLIBAPI	FRETVAL(intf) nhxisdir
+		(_fcd dir, intf * dirlen);
+
+    HDFLIBAPI	FRETVAL(intf) nhxiscdir
+		(_fcd dir, intf * dirlen);
+ 
+    HDFLIBAPI      FRETVAL(intf)
+                nhddontatexit(void);
+
+    HDFLIBAPI      FRETVAL(intf)   
+                nhglibverc(intf *major_v, intf *minor_v, intf *release,
+                _fcd string, intf *len);
+
+    HDFLIBAPI      FRETVAL(intf)
+                nhgfilverc(intf *file_id, intf *major_v, intf *minor_v,
+                intf *release, _fcd string, intf *len);
+
+    HDFLIBAPI      FRETVAL(intf) nhiishdf
+                (_fcd name, intf  * namelen);
+
+
+    
+/*
+   ** from dfufp2im.c
+ */
+#ifndef DFUFP2I_FNAMES
+#   define DFUFP2I_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nduif2i       FNAME(DUIF2I)
+#else
+#   define nduif2i       FNAME(duif2i)
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* DFUFP2I_FNAMES */
+
+    HDFLIBAPI      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);
+
+    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);
+
+/* for Multi-file fortran Annotation inteface */
+#ifndef MFAN_FNAMES
+#   define  MFAN_FNAMES
+#ifdef DF_CAPFNAMES
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#  define nafstart      FNAME(AFSTART)
+#  define naffileinfo   FNAME(AFFILEINFO)
+#  define nafend        FNAME(AFEND)
+#  define nafcreate     FNAME(AFCREATE)
+#  define naffcreate    FNAME(AFFCREATE)
+#  define nafselect     FNAME(AFSELECT)
+#  define nafnumann     FNAME(AFNUMANN)
+#  define nafannlist    FNAME(AFANNLIST)
+#  define nafannlen     FNAME(AFANNLEN)
+#  define nafwriteann   FNAME(AFWRITEANN)
+#  define nafreadann    FNAME(AFREADANN)
+#  define nafendaccess  FNAME(AFENDACCESS)
+#  define nafgettagref  FNAME(AFGETTAGREF)
+#  define nafidtagref   FNAME(AFIDTAGREF)
+#  define naftagrefid   FNAME(AFTAGREFID)
+#  define nafatypetag   FNAME(AFATYPETAG)
+#  define naftagatype   FNAME(AFTAGATYPE)
+# else                                     /* !sl */
+#  define nafistart     FNAME(AFISTART)
+#  define nafifinf      FNAME(AFIFINF)
+#  define nafiend       FNAME(AFIEND)
+#  define naficreat     FNAME(AFICREAT)
+#  define nafifcreat    FNAME(AFIFCREAT)
+#  define nafiselct     FNAME(AFISELCT)
+#  define nafinann      FNAME(AFINANN)
+#  define nafialst      FNAME(AFIALST)
+#  define nafialen      FNAME(AFIALEN)
+#  define nafiwann      FNAME(AFIWANN)
+#  define nafirann      FNAME(AFIRANN)
+#  define nafiendac     FNAME(AFIENDAC)
+#  define nafigtr       FNAME(AFIGTR)
+#  define nafiid2tr     FNAME(AFIID2TR)
+#  define nafitr2id     FNAME(AFITR2ID)
+#  define nafitp2tg     FNAME(AFITP2TG)
+#  define nafitg2tp     FNAME(AFITG2TP)
+# endif
+#else  /* !DF_CAPFNAMES */
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#  define nafstart      FNAME(afstart)
+#  define naffileinfo   FNAME(affileinfo)
+#  define nafend        FNAME(afend)
+#  define nafcreate     FNAME(afcreate)
+#  define naffcreate    FNAME(affcreate)
+#  define nafselect     FNAME(afselect)
+#  define nafnumann     FNAME(afnumann)
+#  define nafannlist    FNAME(afannlist)
+#  define nafannlen     FNAME(afannlen)
+#  define nafwriteann   FNAME(afwriteann)
+#  define nafreadann    FNAME(afreadann)
+#  define nafendaccess  FNAME(afendaccess)
+#  define nafgettagref  FNAME(afgettagref)
+#  define nafidtagref   FNAME(afidtagref)
+#  define naftagrefid   FNAME(aftagrefid)
+#  define nafatypetag   FNAME(afatypetag)
+#  define naftagatype   FNAME(aftagatype)
+# else                                       /* !sl */
+#  define nafistart     FNAME(afistart)
+#  define nafifinf      FNAME(afifinf)
+#  define nafiend       FNAME(afiend)
+#  define naficreat     FNAME(aficreat)
+#  define nafifcreat    FNAME(afifcreat)
+#  define nafiselct     FNAME(afiselct)
+#  define nafinann      FNAME(afinamm)
+#  define nafialst      FNAME(afialst)
+#  define nafialen      FNAME(afialen)
+#  define nafiwann      FNAME(afiwann)
+#  define nafirann      FNAME(afirann)
+#  define nafiendac     FNAME(afiendac)
+#  define nafigtr       FNAME(afigtr)
+#  define nafiid2tr     FNAME(afiid2tr)
+#  define nafitr2id     FNAME(afitr2id)
+#  define nafitp2tg     FNAME(afitp2tg)
+#  define nafitg2tp     FNAME(afitg2tp)
+# endif
+#endif /* DF_CAPFNAMES */
+#endif /* MFAN_FNAMES */
+
+/* Multi-file Annotation C-stubs for fortan interface found in mfanf.c */
+
+HDFLIBAPI FRETVAL(intf)
+nafstart(intf *file_id);
+
+HDFLIBAPI FRETVAL(intf)
+naffileinfo(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel,
+            intf *num_odesc);
+
+HDFLIBAPI FRETVAL(intf)
+nafend(intf *an_id);
+
+HDFLIBAPI FRETVAL(intf)
+nafcreate(intf *an_id, intf *etag, intf *eref, intf *atype);
+
+HDFLIBAPI FRETVAL(intf)
+naffcreate(intf *an_id, intf *atype);
+
+HDFLIBAPI FRETVAL(intf)
+nafselect(intf *an_id, intf *index, intf *atype);
+
+HDFLIBAPI FRETVAL(intf)
+nafnumann(intf *an_id, intf *atype, intf *etag, intf *eref);
+
+HDFLIBAPI FRETVAL(intf)
+nafannlist(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]);
+
+HDFLIBAPI FRETVAL(intf)
+nafannlen(intf *ann_id);
+
+HDFLIBAPI FRETVAL(intf)
+nafwriteann(intf *ann_id,_fcd ann, intf *annlen);
+
+HDFLIBAPI FRETVAL(intf)
+nafreadann(intf *ann_id,_fcd ann, intf *maxlen);
+
+HDFLIBAPI FRETVAL(intf)
+nafendaccess(intf *ann_id);
+
+HDFLIBAPI FRETVAL(intf)
+nafgettagref(intf *an_id, intf *index, intf *type, intf *tag, intf *ref);
+
+HDFLIBAPI FRETVAL(intf)
+nafidtagref(intf *ann_id, intf *tag, intf *ref);
+
+HDFLIBAPI FRETVAL(intf)
+naftagrefid(intf *an_id, intf *tag, intf *ref);
+
+HDFLIBAPI FRETVAL(intf)
+nafatypetag(intf *atype);
+
+HDFLIBAPI FRETVAL(intf)
+naftagatype(intf *tag);
+
+/* 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 index, 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 index, 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);
+
+HDFLIBAPI intn ANdestroy(void);
+
+/* for Multi-file fortran GR interface */
+#ifndef MFGR_FNAMES
+#   define  MFGR_FNAMES
+#ifdef DF_CAPFNAMES
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#  define nmgstart      FNAME(MGSTART)
+#  define nmgfinfo      FNAME(MGFINFO)
+#  define nmgend        FNAME(MGEND)
+#  define nmgicreat     FNAME(MGICREAT)
+#  define nmgselct      FNAME(MGSELCT)
+#  define nmgin2ndx     FNAME(MGIN2NDX)
+#  define nmggiinf      FNAME(MGGIINF)
+#  define nmgwcimg      FNAME(MGWCIMG)
+#  define nmgrcimg      FNAME(MGRCIMG)
+#  define nmgwrimg      FNAME(MGWRIMG)
+#  define nmgrdimg      FNAME(MGRDIMG)
+#  define nmgendac      FNAME(MGENDAC)
+#  define nmgid2rf      FNAME(MGID2RF)
+#  define nmgr2idx      FNAME(MGR2IDX)
+#  define nmgrltil      FNAME(MGRLTIL)
+#  define nmgrimil      FNAME(MGRIMIL)
+#  define nmggltid      FNAME(MGGLTID)
+#  define nmgglinf      FNAME(MGGLINF)
+#  define nmgwrlut      FNAME(MGWRLUT)
+#  define nmgwclut      FNAME(MGWCLUT)
+#  define nmgrdlut      FNAME(MGRDLUT)
+#  define nmgrclut      FNAME(MGRCLUT)
+#  define nmgisxfil     FNAME(MGISXFIL)
+#  define nmgssctp      FNAME(MGSACTP)
+#  define nmgiscatt     FNAME(MGISCATT)
+#  define nmgisattr     FNAME(MGISATTR)
+#  define nmgatinf      FNAME(MGATINF)
+#  define nmggcatt      FNAME(MGGCATT)
+#  define nmggnatt      FNAME(MGGNATT)
+#  define nmggattr      FNAME(MGGATTR)
+#  define nmgifndat     FNAME(MGIFNDAT)
+# define nmgcgichnk        FNAME(MGCGICHNK)
+# define nmgcrcchnk        FNAME(MGCRCCHNK)
+# define nmgcrchnk         FNAME(MGCRCHNK)
+# define nmgcscchnk        FNAME(MGCSCCHNK)
+# define nmgcschnk         FNAME(MGCSCHNK)
+# define nmgcwcchnk        FNAME(MGCWCCHNK)
+# define nmgcwchnk         FNAME(MGCWCHNK)
+# define nmgcscompress     FNAME(MGCSCOMPRESS)
+# define nmglt2rf         FNAME(MGLT2RF)
+# else                                  /* !sl */
+#  define nmgistrt      FNAME(MGISTRT)
+#  define nmgifinf      FNAME(MGIFINF)
+#  define nmgiend       FNAME(MGIEND)
+#  define nmgicreat     FNAME(MGICREAT)
+#  define nmgislct      FNAME(MGISLCT)
+#  define nmgin2ndx     FNAME(MGIN2NDX)
+#  define nmgigiinf     FNAME(MGIGIINF)
+#  define nmgiwcim      FNAME(MGIWCIM)
+#  define nmgircim      FNAME(MGIRCIM)
+#  define nmgiwimg      FNAME(MGIWIMG)
+#  define nmgirimg      FNAME(MGIRIMG)
+#  define nmgiendac     FNAME(MGIENDAC)
+#  define nmgiid2r      FNAME(MGIID2R)
+#  define nmgir2dx      FNAME(MGIR2DX)
+#  define nmgiltil      FNAME(MGILTIL)
+#  define nmgiimil      FNAME(MGIIMIL)
+#  define nmgiglid      FNAME(MGIGLID)
+#  define nmgiglinf     FNAME(MGIGLINF)
+#  define nmgiwrlt      FNAME(MGIWRLT)
+#  define nmgiwclt      FNAME(MGIWCLT)
+#  define nmgirdlt      FNAME(MGIRDLT)
+#  define nmgirclt      FNAME(MGIRCLT)
+#  define nmgisxfil     FNAME(MGISXFIL)
+#  define nmgiactp      FNAME(MGIACTP)
+#  define nmgiscatt     FNAME(MGISCATT)
+#  define nmgisattr     FNAME(MGISATTR)
+#  define nmgiainf      FNAME(MGIAINF)
+#  define nmgigcat      FNAME(MGIGCAT)
+#  define nmgignat      FNAME(MGIGNAT)
+#  define nmgigatt      FNAME(MGIGATT)
+#  define nmgifndat     FNAME(MGIFNDAT)
+# define nmgcgichnk        FNAME(MGCGICHNK)
+# define nmgcrcchnk        FNAME(MGCRCCHNK)
+# define nmgcrchnk         FNAME(MGCRCHNK)
+# define nmgcscchnk        FNAME(MGCSCCHNK)
+# define nmgcschnk         FNAME(MGCSCHNK)
+# define nmgcwcchnk        FNAME(MGCWCCHNK)
+# define nmgcwchnk         FNAME(MGCWCHNK)
+# define nmgcscompress     FNAME(MGCSCOMPRESS)
+# define nmglt2rf         FNAME(MGLT2RF)
+# endif
+#else  /* !DF_CAPFNAMES */
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#  define nmgstart      FNAME(mgstart)
+#  define nmgfinfo      FNAME(mgfinfo)
+#  define nmgend        FNAME(mgend)
+#  define nmgicreat     FNAME(mgicreat)
+#  define nmgselct      FNAME(mgselct)
+#  define nmgin2ndx     FNAME(mgin2ndx)
+#  define nmggiinf      FNAME(mggiinf)
+#  define nmgwcimg      FNAME(mgwcimg)
+#  define nmgrcimg      FNAME(mgrcimg)
+#  define nmgwrimg      FNAME(mgwrimg)
+#  define nmgrdimg      FNAME(mgrdimg)
+#  define nmgendac      FNAME(mgendac)
+#  define nmgid2rf      FNAME(mgid2rf)
+#  define nmgr2idx      FNAME(mgr2idx)
+#  define nmgrltil      FNAME(mgrltil)
+#  define nmgrimil      FNAME(mgrimil)
+#  define nmggltid      FNAME(mggltid)
+#  define nmgglinf      FNAME(mgglinf)
+#  define nmgwrlut      FNAME(mgwrlut)
+#  define nmgwclut      FNAME(mgwclut)
+#  define nmgrdlut      FNAME(mgrdlut)
+#  define nmgrclut      FNAME(mgrclut)
+#  define nmgisxfil     FNAME(mgisxfil)
+#  define nmgssctp      FNAME(mgsactp)
+#  define nmgiscatt     FNAME(mgiscatt)
+#  define nmgisattr     FNAME(mgisattr)
+#  define nmgatinf      FNAME(mgatinf)
+#  define nmggcatt      FNAME(mggcatt)
+#  define nmggnatt      FNAME(mggnatt)
+#  define nmggattr      FNAME(mggattr)
+#  define nmgifndat     FNAME(mgifndat)
+# define nmgcgichnk        FNAME(mgcgichnk)
+# define nmgcrcchnk        FNAME(mgcrcchnk)
+# define nmgcrchnk         FNAME(mgcrchnk)
+# define nmgcscchnk        FNAME(mgcscchnk)
+# define nmgcschnk         FNAME(mgcschnk)
+# define nmgcwcchnk        FNAME(mgcwcchnk)
+# define nmgcwchnk         FNAME(mgcwchnk)
+# define nmgcscompress     FNAME(mgcscompress)
+# define nmglt2rf         FNAME(mglt2rf)
+# else                                    /* !sl */
+#  define nmgistrt      FNAME(mgistrt)
+#  define nmgifinf      FNAME(mgifinf)
+#  define nmgiend        FNAME(mgiend)
+#  define nmgicreat     FNAME(mgicreat)
+#  define nmgislct      FNAME(mgislct)
+#  define nmgin2ndx     FNAME(mgin2ndx)
+#  define nmgigiinf      FNAME(mgigiinf)
+#  define nmgiwcim      FNAME(mgiwcim)
+#  define nmgircim      FNAME(mgircim)
+#  define nmgwimg      FNAME(mgiwimg)
+#  define nmgrimg      FNAME(mgirimg)
+#  define nmgiendac      FNAME(mgiendac)
+#  define nmgiid2r      FNAME(mgiid2r)
+#  define nmgir2dx      FNAME(mgir2dx)
+#  define nmgiltil      FNAME(mgiltil)
+#  define nmgiimil      FNAME(mgiimil)
+#  define nmgiglid      FNAME(mgiglid)
+#  define nmgiglinf     FNAME(mgiglinf)
+#  define nmgiwrlt      FNAME(mgiwrlt)
+#  define nmgiwclt      FNAME(mgiwclt)
+#  define nmgirdlt      FNAME(mgirdlt)
+#  define nmgirclt      FNAME(mgirclt)
+#  define nmgisxfil     FNAME(mgisxfil)
+#  define nmgiactp      FNAME(mgiactp)
+#  define nmgiscatt     FNAME(mgiscatt)
+#  define nmgisattr     FNAME(mgisattr)
+#  define nmgiainf      FNAME(mgiainf)
+#  define nmgigcat      FNAME(mgigcat)
+#  define nmgignat      FNAME(mgignat)
+#  define nmgigatt      FNAME(mgigatt)
+#  define nmgifndat     FNAME(mgifndat)
+# define nmgcgichnk        FNAME(mgcgichnk)
+# define nmgcrcchnk        FNAME(mgcrcchnk)
+# define nmgcrchnk         FNAME(mgcrchnk)
+# define nmgcscchnk        FNAME(mgcscchnk)
+# define nmgcschnk         FNAME(mgcschnk)
+# define nmgcwcchnk        FNAME(mgcwcchnk)
+# define nmgcwchnk         FNAME(mgcwchnk)
+# define nmgcscompress     FNAME(mgcscompress)
+# define nmglt2rf         FNAME(mglt2rf)
+# endif
+
+#endif /* DF_CAPFNAMES */
+#endif /* MFGR_FNAMES */
+
+/* Multi-file GR C-stubs for FORTRAN interface found in mfgrf.c */
+HDFLIBAPI FRETVAL(intf)     /* !sl */
+nmgiwimg(intf * riid, intf *start, intf *stride, intf *count, VOIDP data);
+
+HDFLIBAPI FRETVAL(intf)     /* !sl */
+nmgirimg(intf * riid, intf *start, intf *stride, intf *count, VOIDP data);
+
+HDFLIBAPI FRETVAL(intf)     /* !sl */
+nmgignat(intf * riid, intf *index, VOIDP data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgstart(intf * fid);
+
+HDFLIBAPI FRETVAL(intf)
+nmgfinfo(intf * grid,intf *n_datasets,intf *n_attrs);
+
+HDFLIBAPI FRETVAL(intf)
+nmgend(intf * grid);
+
+HDFLIBAPI FRETVAL(intf)
+nmgicreat(intf * grid, _fcd name, intf *ncomp, intf *nt, intf *il, intf dimsizes[2], intf *nlen);
+
+HDFLIBAPI FRETVAL(intf)
+nmgselct(intf * grid, intf *index);
+
+HDFLIBAPI FRETVAL(intf)
+nmgin2ndx(intf * grid, _fcd name, intf *nlen);
+
+HDFLIBAPI FRETVAL(intf)
+nmggiinf(intf * riid, _fcd name, intf *ncomp, intf *nt, intf *il, intf *dimsizes, intf *nattr);
+
+
+HDFLIBAPI FRETVAL(intf)
+nmgwcimg(intf * riid, intf *start, intf *stride, intf *count, _fcd data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgrcimg(intf * riid, intf *start, intf *stride, intf *count, _fcd data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgwrimg(intf * riid, intf *start, intf *stride, intf *count, void * data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgrdimg(intf * riid, intf *start, intf *stride, intf *count, void * data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgendac(intf * riid);
+
+HDFLIBAPI FRETVAL(intf)
+nmgid2rf(intf * riid);
+
+HDFLIBAPI FRETVAL(intf)
+nmgr2idx(intf * grid, intf *ref);
+
+HDFLIBAPI FRETVAL(intf)
+nmgrltil(intf * riid, intf *il);
+
+HDFLIBAPI FRETVAL(intf)
+nmgrimil(intf * riid, intf *il);
+
+HDFLIBAPI FRETVAL(intf)
+nmggltid(intf * riid, intf *lut_index);
+
+HDFLIBAPI FRETVAL(intf)
+nmgglinf(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries);
+
+HDFLIBAPI FRETVAL(intf)
+nmgwrlut(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, void * data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgwclut(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, _fcd data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgrdlut(intf * lutid, void * data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgrclut(intf * lutid, _fcd data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgisxfil(intf * riid, _fcd filename, intf *offset, intf *nlen);
+
+HDFLIBAPI FRETVAL(intf)
+nmgsactp(intf * riid, intf *accesstype);
+
+HDFLIBAPI FRETVAL(intf)
+nmgiscatt(intf * riid, _fcd name, intf *nt, intf *count, _fcd data, intf *nlen);
+
+HDFLIBAPI FRETVAL(intf)
+nmgisattr(intf * riid, _fcd name, intf *nt, intf *count, void * data, intf *nlen);
+
+HDFLIBAPI FRETVAL(intf)
+nmgatinf(intf * riid, intf *index, _fcd name, intf *nt, intf *count);
+
+HDFLIBAPI FRETVAL(intf)
+nmggcatt(intf * riid, intf *index, _fcd data);
+
+HDFLIBAPI FRETVAL(intf)
+nmggnatt(intf * riid, intf *index, void * data);
+
+HDFLIBAPI FRETVAL(intf)
+nmggattr(intf * riid, intf *index, void * data);
+
+HDFLIBAPI FRETVAL(intf)
+nmgifndat(intf * riid, _fcd name, intf *nlen);
+
+     HDFLIBAPI FRETVAL (intf)
+     nmgcgichnk(intf *id, intf *dim_length, intf *flags);
+
+    HDFLIBAPI FRETVAL (intf)
+       nmgcrcchnk(intf *id, intf *start, _fcd char_data);
+
+    HDFLIBAPI FRETVAL (intf)
+       nmgcrchnk(intf *id, intf *start, VOIDP num_data);
+
+    HDFLIBAPI FRETVAL (intf)
+       nmgcscchnk(intf *id, intf *maxcache, intf *flags);
+
+    HDFLIBAPI FRETVAL (intf)
+      nmgcschnk(intf *id, intf *dim_length, intf *comp_type,
+                intf *comp_prm);
+    HDFLIBAPI FRETVAL (intf)
+       nmgcwcchnk(intf *id, intf *start, _fcd char_data);
+
+    HDFLIBAPI FRETVAL (intf)
+       nmgcwchnk(intf *id, intf *start, VOIDP num_data);
+
+    HDFLIBAPI FRETVAL (intf)
+       nmgcscompress(intf *id, intf *comp_type, intf *comp_prm);
+
+    HDFLIBAPI FRETVAL (intf)
+       nmglt2rf(intf *id);
+
+/* 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 index);
+
+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 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 index);
+
+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,int32 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 index,char *name,int32 *attr_nt,int32 *count);
+
+HDFLIBAPI intn GRgetattr(int32 id,int32 index,void * data);
+
+HDFLIBAPI int32 GRfindattr(int32 id,const char *name);
+
+HDFLIBAPI intn GRPshutdown(void);
+
+/*=== 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[MAX_VAR_DIMS]; /* chunk lengths along each dimension */
+
+    struct 
+    {   /* For Compression info */
+        int32      chunk_lengths[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[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 */);
+
+
+/* For Pablo wrapper functions */
+
+#if defined HAVE_PABLO || defined PABLO
+HDFLIBAPI int HDFinitIOTrace(char *traceFileName, intn detail, intn lifetime,
+                          intn timeWindow, float64 timeWindowSize,
+                          intn regionTrace, intn regionSize,
+                          uint16 procTraceMask );
+HDFLIBAPI int HDFendIOTrace(void);
+
+#ifndef PABLO_FNAMES
+#   define PABLO_FNAMES
+#ifdef DF_CAPFNAMES
+#   define nihinitiotrace FNAME(IHINITIOTRACE)
+#   define nhendiotrace   FNAME(HENDIOTRACE)
+#else  /* !DF_CAPFNAMES */
+#   define nihinitiotrace FNAME(ihinitiotrace)
+#   define nhendiotrace   FNAME(hendiotrace)
+#endif /* DF_CAPFNAMES */
+#endif /* PABLO_FNAMES */
+
+#endif /* HAVE_PABLO || PABLO*/
+
+#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 Vfindattr
+                (int32 vgid, const char *attrname);
+   HDFLIBAPI intn Vattrinfo
+                (int32 vgid, intn attrindex, char *name, 
+                 int32 *datatype, int32 *count, int32 *size);
+   HDFLIBAPI intn Vgetattr
+                (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 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 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 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 Vgetclass
+                (int32 vkey, char  * vgclass);
+
+    HDFLIBAPI intn Vinquire
+                (int32 vkey, int32  * nentries, char  * vgname);
+
+    HDFLIBAPI int32 Vdelete
+                (int32 f, int32 ref);
+
+/*******************************************************************************
+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 index);
+
+    HDFLIBAPI int32 VFfieldtype
+                (int32 vkey, int32 index);
+
+    HDFLIBAPI int32 VFfieldisize
+                (int32 vkey, int32 index);
+
+    HDFLIBAPI int32 VFfieldesize
+                (int32 vkey, int32 index);
+
+    HDFLIBAPI int32 VFfieldorder
+                (int32 vkey, int32 index);
+
+    HDFLIBAPI intn VSsetexternalfile
+		(int32 vkey, const char *filename, int32 offset);
+
+    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);
+
+/*
+   ** from vgF.c
+ */
+#ifndef VG_FNAMES
+#   define VG_FNAMES
+#ifdef DF_CAPFNAMES
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#   define  ndfivopn FNAME(DFIVOPN)
+#   define  ndfvclos FNAME(DFVCLOS)
+#   define  nvatchc  FNAME(VATCHC)
+#   define  nvdtchc  FNAME(VDTCHC)
+#   define  nvgnamc  FNAME(VGNAMC)
+#   define  nvgclsc  FNAME(VGCLSC)
+#   define  nvinqc   FNAME(VINQC)
+#   define  nvdeletec FNAME(VDELETEC)
+#   define  nvgidc   FNAME(VGIDC)
+#   define  nvgnxtc  FNAME(VGNXTC)
+#   define  nvsnamc  FNAME(VSNAMC)
+#   define  nvsclsc  FNAME(VSCLSC)
+#   define  nvinsrtc FNAME(VINSRTC)
+#   define  nvisvgc  FNAME(VISVGC)
+#   define  nvisvsc  FNAME(VISVSC)
+#   define  nvsatchc FNAME(VSATCHC)
+#   define  nvsdtchc FNAME(VSDTCHC)
+#   define  nvsqref  FNAME(VSQREF)
+#   define  nvsqtag  FNAME(VSQTAG)
+#   define  nvsgver  FNAME(VSGVER)
+#   define  nvsseekc FNAME(VSSEEKC)
+#   define  nvsgnamc FNAME(VSGNAMC)
+#   define  nvsgclsc FNAME(VSGCLSC)
+#   define  nvsinqc  FNAME(VSINQC)
+#   define  nvsfexc  FNAME(VSFEXC)
+#   define  nvsfndc  FNAME(VSFNDC)
+#   define  nvsgidc  FNAME(VSGIDC)
+#   define  nvsdltc  FNAME(VSDLTC)
+#   define  nvsapp   FNAME(VSAPP)
+#   define  nvssnamc FNAME(VSSNAMC)
+#   define  nvssclsc FNAME(VSSCLSC)
+#   define  nvssfldc FNAME(VSSFLDC)
+#   define  nvssintc FNAME(VSSINTC)
+#   define  nvsfdefc FNAME(VSFDEFC)
+#   define  nvssextfc FNAME(VSSEXTFC)
+#   define  nvfnflds FNAME(VFNFLDS)
+#   define  nvffnamec FNAME(VFFNAMEC)
+#   define  nvfftype FNAME(VFFTYPE)
+#   define  nvffisiz FNAME(VFFISIZ)
+#   define  nvffesiz FNAME(VFFESIZ)
+#   define  nvffordr FNAME(VFFORDR)
+#   define  nvsfrdc  FNAME(VSFRDC)
+#   define  nvsfrd   FNAME(VSFRD)
+#   define  nvsreadc FNAME(VSREADC)
+#   define  nvsfwrt  FNAME(VSFWRT)
+#   define  nvsfwrtc FNAME(VSFWRTC)
+#   define  nvswritc FNAME(VSWRITC)
+#   define  nvsgintc FNAME(VSGINTC)
+#   define  nvseltsc FNAME(VSELTSC)
+#   define  nvsgfldc FNAME(VSGFLDC)
+#   define  nvssizc  FNAME(VSSIZC)
+#   define  nventsc  FNAME(VENTSC)
+#   define  nvlonec  FNAME(VLONEC)
+#   define  nvslonec FNAME(VSLONEC)
+#   define  nvfindc  FNAME(VFINDC)
+#   define  nvfndclsc FNAME(VFNDCLSC)
+#   define  nvhscdc  FNAME(VHSCDC)
+#   define  nvhsdc   FNAME(VHSDC)
+#   define  nvhscdmc FNAME(VHSCDMC)
+#   define  nvhsdmc  FNAME(VHSDMC)
+#   define  nvhmkgpc FNAME(VHMKGPC)
+#   define  nvflocc  FNAME(VFLOCC)
+#   define  nvinqtrc FNAME(VINQTRC)
+#   define  nvntrc   FNAME(VNTRC)
+#   define  nvnrefs  FNAME(VNREFS)
+#   define  nvgttrsc FNAME(VGTTRSC)
+#   define  nvqref   FNAME(VQREF)
+#   define  nvqtag   FNAME(VQTAG)
+#   define  nvgttrc  FNAME(VGTTRC)
+#   define  nvadtrc  FNAME(VADTRC)
+#   define  nvfstart FNAME(VFSTART)
+#   define  nvfend   FNAME(VFEND)
+#   define  nvsqfnelt   FNAME(VSQFNELT)
+#   define  nvsqfintr   FNAME(VSQFINTR)
+#   define  nvsqfldsc   FNAME(VSQFLDSC)
+#   define  nvsqfvsiz   FNAME(VSQFVSIZ)
+#   define  nvsqnamec   FNAME(VSQNAMEC)
+#   define  nvsfccpk    FNAME(VSFCCPK)
+#   define  nvsfncpk    FNAME(VSFNCPK)
+#   define  nvdtrc      FNAME(VDTRC)
+#   define  nvscfcls    FNAME(VSCFCLS)
+#  else                                /* !sl */
+#   define  ndfivopn FNAME(DFIVOPN)
+#   define  ndfvclos FNAME(DFVCLOS)
+#   define  nvatchc  FNAME(VATCHC)
+#   define  nvdtchc  FNAME(VDTCHC)
+#   define  nvgnamc  FNAME(VGNAMC)
+#   define  nvgclsc  FNAME(VGCLSC)
+#   define  nvinqc   FNAME(VINQC)
+#   define  nvdeletec FNAME(VDELETEC)
+#   define  nvgidc   FNAME(VGIDC)
+#   define  nvgnxtc  FNAME(VGNXTC)
+#   define  nvsnamc  FNAME(VSNAMC)
+#   define  nvsclsc  FNAME(VSCLSC)
+#   define  nvinsrtc FNAME(VINSRTC)
+#   define  nvisvgc  FNAME(VISVGC)
+#   define  nvfistart FNAME(VFISTART)
+#   define  nvfiend  FNAME(VFIEND)
+#   define  nvisvsc  FNAME(VISVSC)
+#   define  nvsatchc FNAME(VSATCHC)
+#   define  nvsdtchc FNAME(VSDTCHC)
+#   define  nvsiqref FNAME(VSIQREF)
+#   define  nvsiqtag FNAME(VSIQTAG)
+#   define  nvsigver FNAME(VSIGVER)
+#   define  nvsseekc FNAME(VSSEEKC)
+#   define  nvsgnamc FNAME(VSGNAMC)
+#   define  nvsgclsc FNAME(VSGCLSC)
+#   define  nvsinqc  FNAME(VSINQC)
+#   define  nvsfexc  FNAME(VSFEXC)
+#   define  nvsfndc  FNAME(VSFNDC)
+#   define  nvsgidc  FNAME(VSGIDC)
+#   define  nvsdltc  FNAME(VSDLTC)
+#   define  nvsapp   FNAME(VSAPP)
+#   define  nvssnamc FNAME(VSSNAMC)
+#   define  nvssclsc FNAME(VSSCLSC)
+#   define  nvssfldc FNAME(VSSFLDC)
+#   define  nvssintc FNAME(VSSINTC)
+#   define  nvsfdefc FNAME(VSFDEFC)
+#   define  nvssextfc FNAME(VSSEXTFC)
+#   define  nvfinflds FNAME(VFINFLDS)
+#   define  nvfifnm  FNAME(VFIFNM)
+#   define  nvfiftp  FNAME(VFIFTP)
+#   define  nvfifisz FNAME(VFIFISZ)
+#   define  nvfifesz FNAME(VFIFESZ)
+#   define  nvfifodr FNAME(VFIFODR)
+#   define  nvsfirdc FNAME(VSFIRDC)
+#   define  nvsfird  FNAME(VSFIRD)
+#   define  nvsreadc FNAME(VSREADC)
+#   define  nvsfiwrc FNAME(VSFIWRC)
+#   define  nvsfiwr  FNAME(VSFIWR)
+#   define  nvswritc FNAME(VSWRITC)
+#   define  nvsgintc FNAME(VSGINTC)
+#   define  nvseltsc FNAME(VSELTSC)
+#   define  nvsgfldc FNAME(VSGFLDC)
+#   define  nvssizc  FNAME(VSSIZC)
+#   define  nventsc  FNAME(VENTSC)
+#   define  nvlonec  FNAME(VLONEC)
+#   define  nvslonec FNAME(VSLONEC)
+#   define  nvfindc  FNAME(VFINDC)
+#   define  nvfndclsc FNAME(VFNDCLSC)
+#   define  nvhsdc   FNAME(VHSDC)
+#   define  nvhscdc  FNAME(VHSCDC)
+#   define  nvhscdmc FNAME(VHSCDMC)
+#   define  nvhsdmc  FNAME(VHSDMC)
+#   define  nvhmkgpc FNAME(VHMKGPC)
+#   define  nvflocc  FNAME(VFLOCC)
+#   define  nvfirefs FNAME(VFIREFS)
+#   define  nvfiqref  FNAME(VFIQREF)
+#   define  nvfiqtag  FNAME(VFIQTAG)
+#   define  nvinqtrc FNAME(VINQTRC)
+#   define  nvntrc   FNAME(VNTRC)
+#   define  nvgttrsc FNAME(VGTTRSC)
+#   define  nvgttrc  FNAME(VGTTRC)
+#   define  nvadtrc  FNAME(VADTRC)
+#   define  nvsiqintr FNAME(VSIQINTR)
+#   define  nvsiqnelt FNAME(VSIQNELT)
+#   define  nvsqfldsc   FNAME(VSQFLDSC)
+#   define  nvsiqvsz    FNAME(VSIQVSZ)
+#   define  nvsqnamec   FNAME(VSQNAMEC)
+#   define  nvsfccpk    FNAME(VSFCCPK)
+#   define  nvsfncpk    FNAME(VSFNCPK)
+#   define  nvdtrc      FNAME(VDTRC)
+#   define  nvscfcls    FNAME(VSCFCLS)
+#  endif
+#else                           /* !DF_CAPFNAMES */
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#   define  ndfivopn FNAME(dfivopn)
+#   define  ndfvclos FNAME(dfvclos)
+#   define  nvatchc  FNAME(vatchc)
+#   define  nvdtchc  FNAME(vdtchc)
+#   define  nvgnamc  FNAME(vgnamc)
+#   define  nvgclsc  FNAME(vgclsc)
+#   define  nvinqc   FNAME(vinqc)
+#   define  nvdeletec FNAME(vdeletec)
+#   define  nvgidc   FNAME(vgidc)
+#   define  nvgnxtc  FNAME(vgnxtc)
+#   define  nvsnamc  FNAME(vsnamc)
+#   define  nvsclsc  FNAME(vsclsc)
+#   define  nvinsrtc FNAME(vinsrtc)
+#   define  nvisvgc  FNAME(visvgc)
+#   define  nvisvsc  FNAME(visvsc)
+#   define  nvsatchc FNAME(vsatchc)
+#   define  nvsdtchc FNAME(vsdtchc)
+#   define  nvsqref  FNAME(vsqref)
+#   define  nvsqtag  FNAME(vsqtag)
+#   define  nvsgver  FNAME(vsgver)
+#   define  nvsseekc FNAME(vsseekc)
+#   define  nvsgnamc FNAME(vsgnamc)
+#   define  nvsgclsc FNAME(vsgclsc)
+#   define  nvsinqc  FNAME(vsinqc)
+#   define  nvsfexc  FNAME(vsfexc)
+#   define  nvsfndc  FNAME(vsfndc)
+#   define  nvsgidc  FNAME(vsgidc)
+#   define  nvsdltc  FNAME(vsdltc)
+#   define  nvsapp   FNAME(vsapp)
+#   define  nvssnamc FNAME(vssnamc)
+#   define  nvssclsc FNAME(vssclsc)
+#   define  nvssfldc FNAME(vssfldc)
+#   define  nvssintc FNAME(vssintc)
+#   define  nvsfdefc FNAME(vsfdefc)
+#   define  nvssextfc FNAME(vssextfc)
+#   define  nvfnflds FNAME(vfnflds)
+#   define  nvffnamec FNAME(vffnamec)
+#   define  nvfftype FNAME(vfftype)
+#   define  nvffisiz FNAME(vffisiz)
+#   define  nvffesiz FNAME(vffesiz)
+#   define  nvffordr FNAME(vffordr)
+#   define  nvsfrdc  FNAME(vsfrdc)
+#   define  nvsfrd   FNAME(vsfrd)
+#   define  nvsreadc FNAME(vsreadc)
+#   define  nvsfwrtc FNAME(vsfwrtc)
+#   define  nvsfwrt  FNAME(vsfwrt)
+#   define  nvswritc FNAME(vswritc)
+#   define  nvsgintc FNAME(vsgintc)
+#   define  nvseltsc FNAME(vseltsc)
+#   define  nvsgfldc FNAME(vsgfldc)
+#   define  nvssizc  FNAME(vssizc)
+#   define  nventsc  FNAME(ventsc)
+#   define  nvlonec  FNAME(vlonec)
+#   define  nvslonec FNAME(vslonec)
+#   define  nvfindc  FNAME(vfindc)
+#   define  nvfndclsc FNAME(vfndclsc)
+#   define  nvhscdc  FNAME(vhscdc)
+#   define  nvhsdc   FNAME(vhsdc)
+#   define  nvhscdmc  FNAME(vhscdmc)
+#   define  nvhsdmc  FNAME(vhsdmc)
+#   define  nvhmkgpc FNAME(vhmkgpc)
+#   define  nvflocc  FNAME(vflocc)
+#   define  nvinqtrc FNAME(vinqtrc)
+#   define  nvntrc   FNAME(vntrc)
+#   define  nvnrefs  FNAME(vnrefs)
+#   define  nvgttrsc FNAME(vgttrsc)
+#   define  nvqref   FNAME(vqref)
+#   define  nvqtag   FNAME(vqtag)
+#   define  nvgttrc  FNAME(vgttrc)
+#   define  nvadtrc  FNAME(vadtrc)
+#   define  nvfstart FNAME(vfstart)
+#   define  nvfend   FNAME(vfend)
+#   define  nvsqfnelt   FNAME(vsqfnelt)
+#   define  nvsqfintr   FNAME(vsqfintr)
+#   define  nvsqfldsc   FNAME(vsqfldsc)
+#   define  nvsqfvsiz   FNAME(vsqfvsiz)
+#   define  nvsqnamec   FNAME(vsqnamec)
+#   define  nvsfccpk    FNAME(vsfccpk)
+#   define  nvsfncpk    FNAME(vsfncpk)
+#   define  nvdtrc      FNAME(vdtrc)
+#   define  nvscfcls    FNAME(vscfcls)
+#  else                            /* !sl */
+#   define  ndfivopn FNAME(dfivopn)
+#   define  ndfvclos FNAME(dfvclos)
+#   define  nvatchc  FNAME(vatchc)
+#   define  nvdtchc  FNAME(vdtchc)
+#   define  nvgnamc  FNAME(vgnamc)
+#   define  nvgclsc  FNAME(vgclsc)
+#   define  nvinqc   FNAME(vinqc)
+#   define  nvdeletec FNAME(vdeletec)
+#   define  nvgidc   FNAME(vgidc)
+#   define  nvgnxtc  FNAME(vgnxtc)
+#   define  nvsnamc  FNAME(vsnamc)
+#   define  nvsclsc  FNAME(vsclsc)
+#   define  nvinsrtc FNAME(vinsrtc)
+#   define  nvisvgc  FNAME(visvgc)
+#   define  nvfistart FNAME(vfistart)
+#   define  nvfiend  FNAME(vfiend)
+#   define  nvisvsc  FNAME(visvsc)
+#   define  nvsatchc FNAME(vsatchc)
+#   define  nvsdtchc FNAME(vsdtchc)
+#   define  nvsiqref FNAME(vsiqref)
+#   define  nvsiqtag FNAME(vsiqtag)
+#   define  nvsigver FNAME(vsigver)
+#   define  nvsseekc FNAME(vsseekc)
+#   define  nvsgnamc FNAME(vsgnamc)
+#   define  nvsgclsc FNAME(vsgclsc)
+#   define  nvsinqc  FNAME(vsinqc)
+#   define  nvsfexc  FNAME(vsfexc)
+#   define  nvsfndc  FNAME(vsfndc)
+#   define  nvsgidc  FNAME(vsgidc)
+#   define  nvsdltc  FNAME(vsdltc)
+#   define  nvsapp   FNAME(vsapp)
+#   define  nvssnamc FNAME(vssnamc)
+#   define  nvssclsc FNAME(vssclsc)
+#   define  nvssfldc FNAME(vssfldc)
+#   define  nvssintc FNAME(vssintc)
+#   define  nvsfdefc FNAME(vsfdefc)
+#   define  nvssextfc FNAME(vssextfc)
+#   define  nvfinflds FNAME(vfinflds)
+#   define  nvfifnm  FNAME(vfifnm)
+#   define  nvfiftp  FNAME(vfiftp)
+#   define  nvfifisz FNAME(vfifisz)
+#   define  nvfifesz FNAME(vfifesz)
+#   define  nvfifodr FNAME(vfifodr)
+#   define  nvsfirdc FNAME(vsfirdc)
+#   define  nvsfird  FNAME(vsfird)
+#   define  nvsreadc FNAME(vsreadc)
+#   define  nvsfiwrc FNAME(vsfiwrc)
+#   define  nvsfiwr  FNAME(vsfiwr)
+#   define  nvswritc FNAME(vswritc)
+#   define  nvsgintc FNAME(vsgintc)
+#   define  nvseltsc FNAME(vseltsc)
+#   define  nvsgfldc FNAME(vsgfldc)
+#   define  nvssizc  FNAME(vssizc)
+#   define  nventsc  FNAME(ventsc)
+#   define  nvlonec  FNAME(vlonec)
+#   define  nvslonec FNAME(vslonec)
+#   define  nvfindc  FNAME(vfindc)
+#   define  nvfndclsc FNAME(vfndclsc)
+#   define  nvhsdc   FNAME(vhsdc)
+#   define  nvhscdc  FNAME(vhscdc)
+#   define  nvhscdmc FNAME(vhscdmc)
+#   define  nvhsdmc  FNAME(vhsdmc)
+#   define  nvhmkgpc FNAME(vhmkgpc)
+#   define  nvflocc  FNAME(vflocc)
+#   define  nvfirefs FNAME(vfirefs)
+#   define  nvfiqref  FNAME(vfiqref)
+#   define  nvfiqtag  FNAME(vfiqtag)
+#   define  nvinqtrc FNAME(vinqtrc)
+#   define  nvntrc   FNAME(vntrc)
+#   define  nvgttrsc FNAME(vgttrsc)
+#   define  nvgttrc  FNAME(vgttrc)
+#   define  nvadtrc  FNAME(vadtrc)
+#   define  nvsiqintr FNAME(vsiqintr)
+#   define  nvsiqnelt FNAME(vsiqnelt)
+#   define  nvsqfldsc   FNAME(vsqfldsc)
+#   define  nvsiqvsz   FNAME(vsiqvsz)
+#   define  nvsqnamec   FNAME(vsqnamec)
+#   define  nvsfccpk    FNAME(vsfccpk)
+#   define  nvsfncpk    FNAME(vsfncpk)
+#   define  nvdtrc      FNAME(vdtrc)
+#   define  nvscfcls    FNAME(vscfcls)
+#  endif
+#endif                          /* DF_CAPFNAMES */
+#endif                          /* VG_FNAMES */
+
+    HDFLIBAPI      FRETVAL(intf) ndfivopn
+                (_fcd filename, intf  * acc_mode, intf  * defdds, intf  * namelen);
+
+    HDFLIBAPI      FRETVAL(intf) ndfvclos
+                (intf  * file_id);
+
+    HDFLIBAPI      FRETVAL(intf) nvatchc
+                (intf  * f, intf  * vgid, _fcd accesstype);
+
+    HDFLIBAPI      FRETVAL(intf) nvdtchc
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvgnamc
+                (intf  * vkey, _fcd vgname);
+
+    HDFLIBAPI      FRETVAL(intf) nvgclsc
+                (intf  * vkey, _fcd vgclass);
+
+    HDFLIBAPI      FRETVAL(intf) nvinqc
+                (intf  * vkey, intf  * nentries, _fcd vgname);
+
+    HDFLIBAPI      FRETVAL(intf) nvdeletec
+                (intf  *f, intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvgidc
+                (intf  * f, intf  * vgid);
+
+    HDFLIBAPI      FRETVAL(intf) nvgnxtc
+                (intf  * vkey, intf  * id);
+
+    HDFLIBAPI      FRETVAL(intf) nvsnamc
+                (intf  * vkey, _fcd vgname, intf  * vgnamelen);
+
+    HDFLIBAPI      FRETVAL(intf) nvsclsc
+                (intf  * vkey, _fcd vgclass, intf  * vgclasslen);
+
+    HDFLIBAPI      FRETVAL(intf) nvinsrtc
+                (intf  * vkey, intf  * vobjptr);
+
+    HDFLIBAPI      FRETVAL(intf) nvisvgc
+                (intf  * vkey, intf  * id);
+
+    HDFLIBAPI      FRETVAL(intf) nvfstart
+                (intf  * f);
+
+    HDFLIBAPI      FRETVAL(intf) nvfend
+                (intf  * f);
+
+    HDFLIBAPI      FRETVAL(intf) nvisvsc
+                (intf  * vkey, intf  * id);
+
+    HDFLIBAPI      FRETVAL(intf) nvsatchc
+                (intf  * f, intf  * vsref, _fcd accesstype);
+
+    HDFLIBAPI      FRETVAL(intf) nvsdtchc
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvsqref
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvsqtag
+                (intf  * vkey);
+  
+    HDFLIBAPI      FRETVAL(intf) nvsqnfld
+                (intf * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvsgver
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvsseekc
+                (intf  * vkey, intf  * eltpos);
+
+    HDFLIBAPI      FRETVAL(intf) nvsgnamc
+                (intf  * vkey, _fcd vsname, intf *vsnamelen);
+
+    HDFLIBAPI      FRETVAL(intf) nvsgclsc
+                (intf  * vkey, _fcd vsclass, intf *vsclasslen);
+
+    HDFLIBAPI      FRETVAL(intf) nvsinqc
+                (intf  * vkey, intf  * nelt, intf  * interlace, _fcd fields,
+		intf  * eltsize, _fcd vsname, intf *fieldslen, intf *vsnamelen);
+
+    HDFLIBAPI      FRETVAL(intf) nvsfexc
+                (intf  * vkey, _fcd fields, intf  * fieldslen);
+
+    HDFLIBAPI      FRETVAL(intf) nvsfndc
+                (intf  * f, _fcd name, intf  * namelen);
+
+    HDFLIBAPI      FRETVAL(intf) nvsgidc
+                (intf  * f, intf  * vsref);
+
+    HDFLIBAPI      FRETVAL(intf) nvsdltc
+                (intf  * f, intf  * vsref);
+
+    HDFLIBAPI      FRETVAL(intf) nvsapp
+                (intf  * vkey, intf  *blk);
+
+    HDFLIBAPI      FRETVAL(intf) nvssnamc
+                (intf  * vkey, _fcd vsname, intf  * vsnamelen);
+
+    HDFLIBAPI      FRETVAL(intf) nvssclsc
+                (intf  * vkey, _fcd vsclass, intf  * vsclasslen);
+
+    HDFLIBAPI      FRETVAL(intf) nvssfldc
+                (intf  * vkey, _fcd fields, intf  * fieldslen);
+
+    HDFLIBAPI      FRETVAL(intf) nvssintc
+                (intf  * vkey, intf  * interlace);
+
+    HDFLIBAPI      FRETVAL(intf) nvsfdefc
+                (intf  * vkey, _fcd field, intf  * localtype,
+                 intf  * order, intf  * fieldlen);
+
+    HDFLIBAPI      FRETVAL(intf) nvssextfc
+                (intf  * vkey, _fcd fname, intf  * offset,
+                 intf  * fnamelen);
+
+    HDFLIBAPI      FRETVAL(intf) nvfnflds
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvffnamec
+                (intf  * vkey, intf  *index, _fcd fname, intf *len);
+
+    HDFLIBAPI      FRETVAL(intf) nvfftype
+                (intf  * vkey, intf  *index);
+
+    HDFLIBAPI      FRETVAL(intf) nvffisiz
+                (intf  * vkey, intf  *index);
+
+    HDFLIBAPI      FRETVAL(intf) nvffesiz
+                (intf  * vkey, intf  *index);
+
+    HDFLIBAPI      FRETVAL(intf) nvffordr
+                (intf  * vkey, intf  *index);
+
+    HDFLIBAPI      FRETVAL(intf) nvsfrdc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFLIBAPI      FRETVAL(intf) nvsfrd
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFLIBAPI      FRETVAL(intf) nvsreadc
+                (intf  * vkey, uint8  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFLIBAPI      FRETVAL(intf) nvsfwrtc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFLIBAPI      FRETVAL(intf) nvsfwrt
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFLIBAPI      FRETVAL(intf) nvswritc
+                (intf  * vkey, uint8  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFLIBAPI      FRETVAL(intf) nvsgintc
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvseltsc
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvsgfldc
+                (intf  * vkey, _fcd fields);
+
+    HDFLIBAPI      FRETVAL(intf) nvssizc
+                (intf  * vkey, _fcd fields, intf  * fieldslen);
+
+    HDFLIBAPI      FRETVAL(intf) nventsc
+                (intf  * f, intf  * vgid);
+
+    HDFLIBAPI      FRETVAL(intf) nvlonec
+                (intf  * f, intf  * idarray, intf  * asize);
+
+    HDFLIBAPI      FRETVAL(intf) nvslonec
+                (intf  * f, intf  * idarray, intf  * asize);
+
+    HDFLIBAPI      FRETVAL(intf) nvfindc
+                (intf  * f, _fcd name, intf  * namelen);
+
+    HDFLIBAPI      FRETVAL(intf) nvfndclsc
+                (intf  * f, _fcd vgclass, intf  * classlen);
+
+    HDFLIBAPI      FRETVAL(intf) nvhscdc
+                (intf  * f, _fcd field, _fcd  cbuf, intf  * n, 
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * fieldlen, intf  * vsnamelen,
+                 intf  * vsclasslen);
+
+    HDFLIBAPI      FRETVAL(intf) nvhsdc
+                (intf  * f, _fcd field, uint8  * buf, intf  * n, 
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * fieldlen, intf  * vsnamelen,
+                 intf  * vsclasslen);
+
+    HDFLIBAPI      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);
+
+    HDFLIBAPI      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);
+
+    HDFLIBAPI      FRETVAL(intf) nvhmkgpc
+                (intf  * f, intf  * tagarray, intf  * refarray, intf  * n,
+                 _fcd vgname, _fcd vgclass, intf  * vgnamelen, intf  * vgclasslen);
+
+    HDFLIBAPI      FRETVAL(intf) nvflocc
+                (intf  * vkey, _fcd field, intf  * fieldlen);
+
+    HDFLIBAPI      FRETVAL(intf) nvinqtrc
+                (intf  * vkey, intf  * tag, intf  * ref);
+
+    HDFLIBAPI      FRETVAL(intf) nvntrc
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvnrefs
+                (intf  * vkey, intf  *tag);
+
+    HDFLIBAPI      FRETVAL(intf) nvqref
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvqtag
+                (intf  * vkey);
+
+    HDFLIBAPI      FRETVAL(intf) nvgttrsc
+                (intf  * vkey, intf  * tagarray, intf  * refarray, intf  * n);
+
+    HDFLIBAPI      FRETVAL(intf) nvgttrc
+                (intf  * vkey, intf  * which, intf  * tag, intf  * ref);
+
+    HDFLIBAPI      FRETVAL(intf) nvadtrc
+                (intf  * vkey, intf  * tag, intf  * ref);
+
+    HDFLIBAPI      FRETVAL(intf) nvdtrc
+                (intf  * vkey, intf  * tag, intf  * ref);
+
+    HDFLIBAPI      FRETVAL(intf) nvsqfnelt
+                (intf * vkey, intf * nelt);
+
+    HDFLIBAPI      FRETVAL(intf)nvsqfintr
+                (intf * vkey, intf * interlace);
+
+    HDFLIBAPI      FRETVAL(intf)nvsqfldsc
+                (intf * vkey, _fcd fields, intf *fieldslen);
+
+    HDFLIBAPI      FRETVAL(intf)nvsqfvsiz
+                (intf * vkey, intf * size);
+
+    HDFLIBAPI      FRETVAL(intf)nvsqnamec  
+                (intf * vkey, _fcd name, intf *namelen);
+
+    HDFLIBAPI      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);
+
+    HDFLIBAPI      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);
+
+/* 
+  ** from vattrf.c
+ */
+#ifndef VATTR_FNAMES
+#  define VATTR_FNAMES
+#ifdef DF_CAPFNAMES
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#  define nvsfcfdx   FNAME(VSFCFDX)
+#  define nvsfcsat   FNAME(VSFCSAT)
+#  define nvsfcsca   FNAME(VSFCSCA)
+#  define nvsfnats   FNAME(VSFNATS)
+#  define nvsffnas   FNAME(VSFFNAS)
+#  define nvsfcfda   FNAME(VSFCFDA)
+#  define nvsfcain   FNAME(VSFCAIN)
+#  define nvsfgnat   FNAME(VSFGNAT)
+#  define nvsfgcat   FNAME(VSFGCAT)
+#  define nvsfisat   FNAME(VSFISAT)
+#  define nvfcsatt   FNAME(VFCSATT)
+#  define nvfcscat   FNAME(VFCSCAT)
+#  define nvfnatts   FNAME(VFNATTS)
+#  define nvfcfdat   FNAME(VFCFDAT)
+#  define nvfainfo   FNAME(VFAINFO)
+#  define nvfgnatt   FNAME(VFGNATT)
+#  define nvfgcatt   FNAME(VFGCATT)
+#  define nvfgver    FNAME(VFGVER)
+# else                          /* !sl */
+#  define nvsfcfdx   FNAME(VSFCFDX)
+#  define nvsfcsat   FNAME(VSFCSAT)
+#  define nvsfcsca   FNAME(VSFCSCA)
+#  define nvsfcnats  FNAME(VSFCNATS)
+#  define nvsfcfnas  FNAME(VSFCFNAS)
+#  define nvsfcfda   FNAME(VSFCFDA)
+#  define nvsfcainf  FNAME(VSFCAINF)
+#  define nvsfcgna   FNAME(VSFCGNA)
+#  define nvsfcgca   FNAME(VSFCGCA)
+#  define nvsfcisa   FNAME(VSFCISA)
+#  define nvfcsatt   FNAME(VFCSATT)
+#  define nvfcscat   FNAME(VFCSCAT)
+#  define nvfcnats   FNAME(VFCNATS)
+#  define nvfcfdat   FNAME(VFCFDAT)
+#  define nvfcainf   FNAME(VFCAINF)
+#  define nvfcgnat   FNAME(VFCGNAT)
+#  define nvfcgcat   FNAME(VFCGCAT)
+#  define nvfcgver   FNAME(VFCGVER)
+# endif
+#else       /* !DF_CAPFNAMES  */
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#  define nvsfcfdx   FNAME(vsfcfdx)
+#  define nvsfcsat   FNAME(vsfcsat)
+#  define nvsfcsca   FNAME(vsfcsca)
+#  define nvsfnats   FNAME(vsfnats)
+#  define nvsffnas   FNAME(vsffnas)
+#  define nvsfcfda   FNAME(vsfcfda)
+#  define nvsfcain   FNAME(vsfcain)
+#  define nvsfgnat   FNAME(vsfgnat)
+#  define nvsfgcat   FNAME(vsfgcat)
+#  define nvsfisat   FNAME(vsfisat)
+#  define nvfcsatt   FNAME(vfcsatt)
+#  define nvfcscat   FNAME(vfcscat)
+#  define nvfnatts   FNAME(vfnatts)
+#  define nvfcfdat   FNAME(vfcfdat)
+#  define nvfainfo   FNAME(vfainfo)
+#  define nvfgnatt   FNAME(vfgnatt)
+#  define nvfgcatt   FNAME(vfgcatt)
+#  define nvfgver    FNAME(vfgver)
+# else                           /* !sl */
+#  define nvsfcfdx   FNAME(vsfcfdx)
+#  define nvsfcsat   FNAME(vsfcsat)
+#  define nvsfcsca   FNAME(vsfcsca)
+#  define nvsfcnats  FNAME(vsfcnats)
+#  define nvsfcfnas  FNAME(vsfcfnas)
+#  define nvsfcfda   FNAME(vsfcfda)
+#  define nvsfcainf  FNAME(vsfcainf)
+#  define nvsfcgna   FNAME(vsfcgna)
+#  define nvsfcgca   FNAME(vsfcgca)
+#  define nvsfcisa   FNAME(vsfcisa)
+#  define nvfcsatt   FNAME(vfcsatt)
+#  define nvfcscat   FNAME(vfcscat)
+#  define nvfcnats   FNAME(vfcnats)
+#  define nvfcfdat   FNAME(vfcfdat)
+#  define nvfcainf   FNAME(vfcainf)
+#  define nvfcgnat   FNAME(vfcgnat)
+#  define nvfcgcat   FNAME(vfcgcat)
+#  define nvfcgver   FNAME(vfcgver)
+# endif
+#endif   /* DF_CAPFNAMES */
+#endif   /* VATTR_FNAMES  */
+   HDFLIBAPI   FRETVAL(intf) nvsfcfdx
+            (intf *vsid, _fcd fldnm, intf *findex, intf *fldnmlen);
+   HDFLIBAPI   FRETVAL(intf) nvsfcsat
+            (intf *vsid, intf *findex, _fcd attrnm, intf *dtype,
+             intf *count, intf *values, intf *attrnmlen);
+   HDFLIBAPI   FRETVAL(intf) nvsfcsca
+            (intf *vsid, intf *findex, _fcd attrnm, intf *dtype,
+             intf *count, _fcd values, intf *attrnmlen);
+   HDFLIBAPI   FRETVAL(intf) nvsfnats
+            (intf *vsid);
+   HDFLIBAPI   FRETVAL(intf) nvsffnas
+            (intf *vsid, intf *findex);
+   HDFLIBAPI   FRETVAL(intf) nvsfcfda
+            (intf *vsid, intf *findex, _fcd attrnm, intf *attrnmlen);
+   HDFLIBAPI   FRETVAL(intf) nvsfcain
+            (intf *vsid, intf *findex, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size, intf *attrnamelen);
+   HDFLIBAPI   FRETVAL(intf) nvsfgnat
+            (intf *vsid, intf *findex, intf *aindex, intf *values);
+   HDFLIBAPI   FRETVAL(intf) nvsfgcat
+            (intf *vsid, intf *findex, intf *aindex, _fcd values);
+   HDFLIBAPI   FRETVAL(intf) nvsfisat
+            (intf *vsid);
+   HDFLIBAPI   FRETVAL(intf) nvfcsatt
+            (intf *vgid, _fcd attrnm, intf *dtype,
+             intf *count, intf *values, intf *attrnmlen);
+   HDFLIBAPI   FRETVAL(intf) nvfcscat
+            (intf *vgid, _fcd attrnm, intf *dtype, intf *count,
+             _fcd values, intf *attrnmlen);
+   HDFLIBAPI   FRETVAL(intf) nvfnatts
+            (intf *vgid);
+   HDFLIBAPI   FRETVAL(intf) nvfcfdat
+            (intf *vgid, _fcd attrnm, intf *attrnmlen);
+   HDFLIBAPI   FRETVAL(intf) nvfainfo
+            (intf *vgid, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size);
+   HDFLIBAPI   FRETVAL(intf) nvfgnatt
+            (intf *vgid, intf *aindex, intf *values);
+   HDFLIBAPI   FRETVAL(intf) nvfgcatt
+            (intf *vgid, intf *aindex, _fcd values);
+   HDFLIBAPI   FRETVAL(intf) nvfgver
+            (intf *vgid);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* _H_PROTO */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/hqueue.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/hqueue.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/hqueue.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,261 @@
+/* 
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. 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,v 1.2 1996/10/02 18:45:13 georgev Exp $ */
+
+#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_ */

Added: packages/libhdf4/branches/upstream/current/hdf/src/htags.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/htags.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/htags.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -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: htags.h,v 1.7 1999/02/06 03:21:47 koziol Exp $ */
+
+/*+ 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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/linklist.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/linklist.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/linklist.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,559 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.4 $";
+#endif
+
+/* $Id: linklist.c,v 1.4 1999/06/16 21:11:06 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_linklist_c
+#endif
+
+/*
+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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HULcreate_list);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask,ID_HULcreate_list);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HULdestroy_list);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask,ID_HULdestroy_list);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HULadd_node);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask,ID_HULadd_node);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HULsearch_node);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask,ID_HULsearch_node);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HULfirst_node);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask,ID_HULfirst_node);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HULnext_node);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask,ID_HULnext_node);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_HULremove_node);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask,ID_HULremove_node);
+#endif /* HAVE_PABLO */
+
+  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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/linklist.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/linklist.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/linklist.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,210 @@
+/****************************************************************************
+ * 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: linklist.h,v 1.2 1996/05/16 18:42:05 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/makepc.386
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/makepc.386	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/makepc.386	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,398 @@
+# ****************************************************************************
+# * 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: makepc.386,v 1.6 1994/08/26 20:06:22 koziol Exp $
+#
+# ##################################################################
+#
+#           MAKEFILE for creating the HDF library, libdf.a,
+#
+# This makefile creates the following FORTRAN and C interfaces 
+# for HDF in a library called "df.lib":
+#
+#              DFR8   (8-bit raster image sets)
+#              DF24   (24-bit raster image sets)
+#              DFP    (palettes)
+#              DFSD   (scientific data sets)
+#              DFAN   (annotations)
+#              V      (vsets)
+#
+# See the file INSTALL for further information on how to invoke
+# this makefile.
+#
+# This release of HDF marks the first use of a new set of lower
+# level routines.  The makefile also creates these interfaces,
+# which are available in C only.  These routines are categorized
+# as follows:
+#
+#              H      (new lower level i/o)
+#              DF     (emulation of old lower level i/o routines)
+#              HD     (lower level utilities for developers)
+#              HE     (lower level error-handling)
+#              HD     (lower level utilities, for developers)
+#              DFK    (conversion routines)
+#
+# ##################################################################
+#
+#
+# PORTING INSTRUCTIONS
+# You must modify the lines marked "# ==>".
+#
+
+# ==> specify your machine
+#MACHINE=PC
+
+INCDIR=..\include
+LIBDIR=..\lib
+BINDIR=..\bin
+JPEGDIR=..\jpeg
+
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+IFLAGS=   /i=$(INCDIR) /i=. /i=$(JPEGDIR)
+
+# ==> specify your FORTRAN compiler
+#FC=fl
+#FFLAGS= /Gt64 /AH $(IFLAGS) /W2 /Od /Tf
+#FFLAGS= /AH $(IFLAGS) /W2 /Od /Tf
+#FFLAGS= /Gt64 /AH $(IFLAGS) /W2 /Ox /Tf
+
+# ==> specify your C compiler
+CC=wcc386
+CFLAGS=  /ms /w4 /Od /d2 /s $(IFLAGS) /zc /ze
+#CFLAGS= /ms /w4 /Oneatx /s $(IFLAGS) /zc /ze
+
+# ==> specify your Macro-Assembler compiler
+MM = ml
+MFLAGS = /c /nologo /W3
+
+# ==> where is your HDF library (df.lib) located?
+LIBS= $(LIBDIR)\df.lib
+
+# ==> specify your archiver
+AR=wlib
+ARFLAGS=/q /b
+ARFLAGS2=
+
+# ==> specify your archive randomizer
+#RANLIB=ranlib
+
+RM=del
+RMFLAGS=
+LINTFLAGS=
+
+HDRS=hfile.h hdf.h hdfi.h herr.h hproto.h dfan.h dfrig.h dfgr.h dfsd.h &
+     dfgroup.h vg.h df.h dfi.h dfstubs.h dfutil.h hconv.h tbbt.h hcompi.h &
+     mstdio.h clre.h cnbit.h hbitio.h
+
+CSRCS=hfile.c herr.c hblocks.c hextelt.c hkit.c dfan.c dfr8.c dfcomp.c &
+      dfrle.c dfimcomp.c dfjpeg.c dfunjpeg.c dfp.c dfgr.c df24.c dfsd.c &
+      dfgroup.c dfconv.c dfufp2i.c vg.c vrw.c vio.c vparse.c vconv.c vsfld.c &
+      vgp.c vhi.c dfutil.c dfstubs.c dfknat.c dfkswap.c dfkcray.c dfkvms.c &
+      dfkconv.c dfkfuji.c tbbt.c hdfalloc.c maldebug.c hcomp.c mstdio.c &
+      crle.c cnbit.c hbitio.c
+
+COBJS=hfile.obj herr.obj hblocks.obj hextelt.obj hkit.obj dfan.obj dfr8.obj &
+        dfcomp.obj dfrle.obj dfimcomp.obj dfjpeg.obj dfunjpeg.obj dfp.obj &
+        dfgr.obj df24.obj dfsd.obj dfgroup.obj dfconv.obj dfufp2i.obj vg.obj &
+        vrw.obj vio.obj vparse.obj vconv.obj vsfld.obj vgp.obj vhi.obj &
+        dfutil.obj dfstubs.obj dfknat.obj dfkswap.obj dfkcray.obj dfkvms.obj &
+        dfkconv.obj dfkfuji.obj tbbt.obj hdfalloc.obj maldebug.obj hcomp.obj &
+        mstdio.obj crle.obj cnbit.obj hbitio.obj
+
+FSRCS=hfilef.c herrf.c dfanf.c dfr8f.c dfpf.c df24f.c dfsdf.c vgf.c dff.c &
+      dfutilf.c hfileff.f dfanff.f df24ff.f dfpff.f dfr8ff.f dfsdff.f vgff.f &
+      dfff.f dfufp2if.f
+
+FOBJS=hfilef.obj herrf.obj dfanf.obj dfr8f.obj dfpf.obj df24f.obj dfsdf.obj &
+      vgf.obj dff.obj dfutilf.obj hfileff.obj dfanff.obj df24ff.obj dfpff.obj &
+      dfr8ff.obj dfsdff.obj vgff.obj dfff.obj dfufp2if.obj
+
+JCSRCS= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c &
+        jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c &
+        jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c &
+        jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c &
+        jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c &
+        jwrppm.c jwrrle.c jwrtarga.c jmemsys.c
+
+JINCS= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c
+
+# objectfiles common to both JPEG compression and decompression
+#COMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj
+COMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj
+# compression objectfiles
+CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj &
+        jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj
+
+CFILEOBJECTS=jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj
+
+# decompression objectfiles
+DLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj &
+        jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj &
+        jquant2.obj jrevdct.obj
+
+DFILEOBJECTS=jrdjfif.obj jwrgif.obj jwrppm.obj jwrrle.obj jwrtarga.obj
+
+# These objectfiles are included in libjpeg.lib
+JOBJS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+
+#.f.obj:
+#    $(FC) /c $(FFLAGS) $<
+#    $(AR) $(ARFLAGS) df.lib $(ARFLAGS2) $*;
+
+.c.obj:
+    $(CC) $[@ $(CFLAGS)
+
+.asm.obj:
+    $(MM) $(MFLAGS) /Fo $^@ $[@ >$^&.err
+
+all: df.lib install note
+    %null
+
+allnostub: libnostub install note
+    %null
+
+df.lib: $(COBJS) $(FOBJS) $(JOBJS)
+    del df.lib
+    $(AR) $(ARFLAGS) df.lib @hdfw386.lbc
+
+libnostub: $(COBJS) $(JOBJS)
+    del df.lib
+    $(AR) $(ARFLAGS) df.lib @hdfnofw3.lbc
+
+note:
+	@echo "^G"
+	@echo "***********************************************************"
+    @echo " df.lib successfully created."
+	@echo ""
+	@echo "If you have any old vset files (v 1.0) you must use vcompat"
+	@echo "to make them compatible with Vset 2.0 applications"
+	@echo ""
+	@echo "***********************************************************"
+	@echo ""
+
+
+hdf.h : hdfi.h
+    %null
+
+hcompi.h : mstdio.h crle.h cnbit.h
+    %null
+
+hfile.obj: hfile.c hfile.h hdf.h herr.h hdfi.h
+
+herr.obj: herr.c hdf.h herr.h hdfi.h
+
+hblocks.obj: hblocks.c hfile.h hdf.h herr.h hdfi.h
+
+hextelt.obj: hextelt.c hfile.h hdf.h herr.h hdfi.h
+
+hkit.obj: hkit.c hfile.h hdf.h herr.h hdfi.h
+
+hdfalloc.obj: hdfalloc.c hdf.h herr.h hdfi.h
+
+dfan.obj: dfan.c hdf.h herr.h dfan.h hdfi.h
+
+dfanf.obj: dfanf.c hdf.h herr.h dfan.h hdfi.h
+
+dfr8.obj: dfr8.c hdf.h herr.h dfrig.h hdfi.h
+
+dfr8f.obj: dfr8f.c hdf.h herr.h dfrig.h hdfi.h
+
+dfcomp.obj: dfcomp.c hdf.h herr.h dfrig.h hdfi.h
+
+dfimcomp.obj: dfimcomp.c hdf.h herr.h dfrig.h hdfi.h
+
+dfrle.obj: dfrle.c hdf.h herr.h dfrig.h hdfi.h
+
+dfjpeg.obj: dfjpeg.c hdf.h herr.h dfrig.h hdfi.h
+
+dfunjpeg.obj: dfunjpeg.c hdf.h herr.h dfrig.h hdfi.h
+
+dfp.obj: dfp.c hdf.h herr.h hdfi.h
+
+dfpf.obj: dfpf.c hdf.h herr.h hdfi.h
+
+dfgr.obj: dfgr.c hdf.h herr.h dfgr.h hdfi.h
+
+df24.obj: df24.c hdf.h herr.h dfgr.h hdfi.h
+
+df24f.obj: df24f.c hdf.h herr.h dfgr.h hdfi.h
+
+dfsd.obj: dfsd.c hdf.h herr.h dfsd.h hdfi.h
+
+dfsdf.obj: dfsdf.c hdf.h herr.h dfsd.h hdfi.h
+
+dfgroup.obj: dfgroup.c hdf.h herr.h hfile.h hdfi.h
+
+dfconv.obj: dfconv.c hdf.h herr.h hdfi.h hconv.h
+
+dfknat.obj: dfknat.c hdf.h herr.h hdfi.h hconv.h
+
+dfkswap.obj: dfkswap.c hdf.h herr.h hdfi.h hconv.h
+
+dfkcray.obj: dfkcray.c hdf.h herr.h hdfi.h hconv.h
+
+dfkvms.obj: dfkvms.c hdf.h herr.h hdfi.h hconv.h
+
+dfkconv.obj: dfkconv.c hdf.h herr.h hdfi.h hconv.h
+
+dfkfuji.obj: dfkfuji.c hdf.h herr.h hdfi.h hconv.h
+
+vg.obj: vg.c vg.h hdf.h hdfi.h
+
+vgf.obj: vgf.c vg.h hdf.h hdfi.h
+
+vrw.obj: vrw.c vg.h hdf.h hdfi.h
+
+vio.obj: vio.c vg.h hdf.h hdfi.h
+
+vparse.obj: vparse.c vg.h hdf.h hdfi.h
+
+vconv.obj: vconv.c vg.h hdf.h hdfi.h
+
+vsfld.obj: vsfld.c vg.h hdf.h hdfi.h
+
+vgp.obj: vgp.c vg.h hdf.h hdfi.h
+
+vhi.obj: vhi.c vg.h hdf.h hdfi.h
+
+tbbt.obj: tbbt.c tbbt.h hdfi.h
+
+hbitio.obj: hbitio.c hbitio.h hdfi.h
+
+maldebug.obj : maldebug.c maldebug.h hdfi.h
+
+hcomp.obj : hcomp.c hdfi.h hcompi.h
+
+mstdio.obj : mstdio.c hdfi.h hcompi.h mstdio.h
+
+crle.obj : crle.c hdfi.h hcompi.h crle.h
+
+cnbit.obj : cnbit.c hdfi.h hcompi.h cnbit.h
+
+dfstubs.obj: dfstubs.c hdf.h herr.h dfstubs.h df.h dfi.h hdfi.h
+
+dff.obj: dff.c hdf.h herr.h dfstubs.h df.h dfi.h hdfi.h
+
+hfileff.obj : hfileff.f
+
+dfanff.obj : dfanff.f
+
+df24ff.obj : df24ff.f
+
+dfpff.obj : dfpff.f
+
+dfr8ff.obj : dfr8ff.f
+
+dfsdff.obj : dfsdff.f
+
+vgff.obj : vgff.f
+
+dfff.obj : dfff.f
+
+dfufp2if.obj : dfufp2if.f
+
+# JPEG source files
+jbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h
+
+jcarith.obj : jcarith.c jinclude.h jconfig.h jpegdata.h
+
+jccolor.obj : jccolor.c jinclude.h jconfig.h jpegdata.h
+
+jcdeflts.obj : jcdeflts.c jinclude.h jconfig.h jpegdata.h
+
+jcexpand.obj : jcexpand.c jinclude.h jconfig.h jpegdata.h
+
+jchuff.obj : jchuff.c jinclude.h jconfig.h jpegdata.h
+
+#jcmain.obj : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
+
+jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpegdata.h
+
+jcmcu.obj : jcmcu.c jinclude.h jconfig.h jpegdata.h
+
+jcpipe.obj : jcpipe.c jinclude.h jconfig.h jpegdata.h
+
+jcsample.obj : jcsample.c jinclude.h jconfig.h jpegdata.h
+
+jdarith.obj : jdarith.c jinclude.h jconfig.h jpegdata.h
+
+jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpegdata.h
+
+jddeflts.obj : jddeflts.c jinclude.h jconfig.h jpegdata.h
+
+jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpegdata.h
+
+#jdmain.obj : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
+
+jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpegdata.h
+
+jdmcu.obj : jdmcu.c jinclude.h jconfig.h jpegdata.h
+
+jdpipe.obj : jdpipe.c jinclude.h jconfig.h jpegdata.h
+
+jdsample.obj : jdsample.c jinclude.h jconfig.h jpegdata.h
+
+jerror.obj : jerror.c jinclude.h jconfig.h jpegdata.h
+
+jquant1.obj : jquant1.c jinclude.h jconfig.h jpegdata.h
+
+jquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h
+
+jfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h
+
+jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h
+
+jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h
+
+jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h
+
+jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h
+
+jrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h
+
+jrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h
+
+jrdrle.obj : jrdrle.c jinclude.h jconfig.h jpegdata.h
+
+jrdtarga.obj : jrdtarga.c jinclude.h jconfig.h jpegdata.h
+
+jwrjfif.obj : jwrjfif.c jinclude.h jconfig.h jpegdata.h
+
+jwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h
+
+jwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h
+
+jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h
+
+jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h
+
+jmemsys.obj : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h
+
+#jmemdosa.obj : jmemdosa.asm
+
+install:
+	-mkdir $(INCDIR)
+    -copy *.h $(INCDIR)
+	-mkdir $(LIBDIR)
+    -copy df.lib $(LIBDIR)
+
+clean:
+    -$(RM) $(RMFLAGS) *.obj
+
+cleanup:
+	-$(RM) $(RMFLAGS) df.lib $(UTILS)
+
+lint: $(SRCS) $(R8SRCS)
+	$(LINT) $(LINTFLAGS) $(SRCS)
+
+TAGS: $(SRCS) $(HDRS)
+	etags $(SRCS) $(HDRS)
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/makepc.msc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/makepc.msc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/makepc.msc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,475 @@
+# ****************************************************************************
+# * 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: makepc.msc,v 1.12 1995/04/21 16:00:58 acheng Exp $
+#
+# ##################################################################
+#
+#           MAKEFILE for creating the HDF library, libdf.a,
+#
+# This makefile creates the following FORTRAN and C interfaces 
+# for HDF in a library called "df.lib": 
+#
+#              DFR8   (8-bit raster image sets)
+#              DF24   (24-bit raster image sets)
+#              DFP    (palettes)
+#              DFSD   (scientific data sets)
+#              DFAN   (annotations)
+#              V      (vsets)
+#
+# See the file INSTALL for further information on how to invoke
+# this makefile.
+#
+# This release of HDF marks the first use of a new set of lower
+# level routines.  The makefile also creates these interfaces,
+# which are available in C only.  These routines are categorized 
+# as follows:
+#
+#              H      (new lower level i/o)
+#              DF     (emulation of old lower level i/o routines)
+#              HD     (lower level utilities for developers)
+#              HE     (lower level error-handling)
+#              HD     (lower level utilities, for developers)
+#              DFK    (conversion routines)
+#
+# ##################################################################
+#
+#
+# PORTING INSTRUCTIONS
+# You must modify the lines marked "# ==>".
+#
+
+.SUFFIXES : .f .asm
+
+# ==> specify your machine
+MACHINE=PC
+
+INCDIR=..\include
+LIBDIR=..\lib
+BINDIR=..\bin
+
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+IFLAGS=   /I$(INCDIR) /I.
+
+# ==> specify your FORTRAN compiler
+FC=fl
+#FFLAGS= /Gt64 /AH $(IFLAGS) /W2 /Od /Tf
+FFLAGS= /AH $(IFLAGS) /W2 /Od /Tf
+#FFLAGS= /Gt64 /AH $(IFLAGS) /W2 /Ox /Tf
+
+# ==> specify your C compiler
+CC=cl
+#CFLAGS=  /D$(MACHINE) /Gt64 /AH /W4 /Ozaxb2 $(IFLAGS) /Zl
+#CFLAGS=  /D$(MACHINE) /Gt64 /AH /W4 /Od $(IFLAGS) /Zi /Zl /DMALDEBUG
+CFLAGS=  /D$(MACHINE) /Gt32 /AH /W4 /Od $(IFLAGS) /Zi /Zl /Gs /FPi87
+#CFLAGS=  /D$(MACHINE) /Gt64 /AH /W4 /Od $(IFLAGS) /C /P
+#CFLAGS=  /D$(MACHINE) /Gt64 /AH /W4 /Od $(IFLAGS) /Zg
+
+# ==> where is your HDF library (df.lib) located?
+LIBS= $(LIBDIR)\df.lib
+
+# ==> specify your archiver
+AR=lib
+ARFLAGS=/PAGE:32
+ARFLAGS2=/NOLOGO +
+
+RM=del
+RMFLAGS=
+
+HDRS=hfile.h hdf.h hdfi.h herr.h hproto.h dfan.h dfrig.h dfgr.h dfsd.h \
+     dfgroup.h vg.h df.h dfi.h dfstubs.h dfutil.h hconv.h tbbt.h hcompi.h \
+     mstdio.h crle.h cnbit.h
+
+CSRCS=hfile.c herr.c hblocks.c hextelt.c hkit.c dfan.c dfr8.c dfcomp.c \
+      dfrle.c dfimcomp.c dfjpeg.c dfunjpeg.c dfp.c dfgr.c df24.c dfsd.c \
+      dfgroup.c dfconv.c dfufp2i.c vg.c vrw.c vio.c vparse.c vconv.c vsfld.c \
+      vgp.c vhi.c dfutil.c dfstubs.c dfknat.c dfkswap.c dfkcray.c dfkvms.c \
+      dfkconv.c dfkfuji.c tbbt.c hdfalloc.c maldebug.c hbitio.c hcomp.c \
+      mstdio.c crle.c cnbit.c
+
+COBJS=hfile.obj herr.obj hblocks.obj hextelt.obj hkit.obj dfan.obj dfr8.obj \
+        dfcomp.obj dfrle.obj dfimcomp.obj dfjpeg.obj dfunjpeg.obj dfp.obj \
+        dfgr.obj df24.obj dfsd.obj dfgroup.obj dfconv.obj dfufp2i.obj vg.obj \
+        vrw.obj vio.obj vparse.obj vconv.obj vsfld.obj vgp.obj vhi.obj \
+        dfutil.obj dfstubs.obj dfknat.obj dfkswap.obj dfkcray.obj dfkvms.obj \
+        dfkconv.obj dfkfuji.obj tbbt.obj hdfalloc.obj maldebug.obj hbitio.obj \
+        hcomp.obj mstdio.obj crle.obj cnbit.obj
+
+FSRCS=hfilef.c herrf.c dfanf.c dfr8f.c dfpf.c df24f.c dfsdf.c vgf.c dff.c \
+      dfutilf.c hfileff.f dfanff.f df24ff.f dfpff.f dfr8ff.f dfsdff.f vgff.f \
+      dfff.f dfufp2if.f
+
+FOBJS=hfilef.obj herrf.obj dfanf.obj dfr8f.obj dfpf.obj df24f.obj dfsdf.obj \
+      vgf.obj dff.obj dfutilf.obj hfileff.obj dfanff.obj df24ff.obj dfpff.obj \
+      dfr8ff.obj dfsdff.obj vgff.obj dfff.obj dfufp2if.obj
+
+JCSRCS= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \
+        jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \
+        jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \
+        jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \
+        jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \
+        jwrppm.c jwrrle.c jwrtarga.c jmemsys.c
+
+JINCS= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c
+
+# objectfiles common to both JPEG compression and decompression
+COMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj
+# compression objectfiles
+CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \
+        jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj
+
+CFILEOBJECTS=jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj
+
+# decompression objectfiles
+DLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj \
+        jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj \
+        jquant2.obj jrevdct.obj
+
+DFILEOBJECTS=jrdjfif.obj jwrgif.obj jwrppm.obj jwrrle.obj jwrtarga.obj
+
+# These objectfiles are included in libjpeg.lib
+JOBJS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+
+#.c.obj:
+#    $(CC) /c $(CFLAGS) $<
+#    $(AR) $(ARFLAGS) df.lib $(ARFLAGS2) $*;
+
+#.f.obj:
+#    $(FC) /c $(FFLAGS) $<
+#    $(AR) $(ARFLAGS) df.lib $(ARFLAGS2) $*;
+
+all: df.lib install note
+
+allnostub: libnostub install note
+
+df.lib: $(COBJS) $(FOBJS) $(JOBJS)
+    del df.lib
+    $(AR) $(ARFLAGS) df.lib @hdf.bld;
+
+libnostub: $(COBJS) $(JOBJS)
+    del df.lib
+    $(AR) $(ARFLAGS) df.lib @hdfnof.bld;
+
+note:
+	@echo "^G"
+	@echo "***********************************************************"
+    @echo " df.lib successfully created."
+	@echo ""
+	@echo "If you have any old vset files (v 1.0) you must use vcompat"
+	@echo "to make them compatible with Vset 2.0 applications"
+	@echo ""
+	@echo "***********************************************************"
+	@echo ""
+
+hdf.h : hdfi.h herr.h
+
+hcompi.h : mstdio.h crle.h cnbit.h
+
+hfile.obj: hfile.c hfile.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+herr.obj: herr.c hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+hblocks.obj: hblocks.c hfile.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+hextelt.obj: hextelt.c hfile.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+hbitio.obj: hbitio.c hdf.h hfile.h
+    $(CC) /c $(CFLAGS) %s
+
+hkit.obj: hkit.c hfile.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+hdfalloc.obj: hdfalloc.c hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+dfan.obj: dfan.c hdf.h dfan.h
+    $(CC) /c $(CFLAGS) %s
+
+dfanf.obj: dfanf.c hdf.h dfan.h
+    $(CC) /c $(CFLAGS) %s
+
+dfr8.obj: dfr8.c hdf.h dfrig.h
+    $(CC) /c $(CFLAGS) %s
+
+dfr8f.obj: dfr8f.c hdf.h dfrig.h
+    $(CC) /c $(CFLAGS) %s
+
+dfcomp.obj: dfcomp.c hdf.h dfrig.h
+    $(CC) /c $(CFLAGS) %s
+
+dfimcomp.obj: dfimcomp.c hdf.h dfrig.h
+    $(CC) /c $(CFLAGS) %s
+
+dfrle.obj: dfrle.c hdf.h dfrig.h
+    $(CC) /c $(CFLAGS) %s
+
+dfjpeg.obj: dfjpeg.c hdf.h dfrig.h
+    $(CC) /c $(CFLAGS) %s
+
+dfunjpeg.obj: dfunjpeg.c hdf.h dfrig.h
+    $(CC) /c $(CFLAGS) %s
+
+dfp.obj: dfp.c hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+dfpf.obj: dfpf.c hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+dfgr.obj: dfgr.c hdf.h dfgr.h
+    $(CC) /c $(CFLAGS) %s
+
+df24.obj: df24.c hdf.h dfgr.h
+    $(CC) /c $(CFLAGS) %s
+
+df24f.obj: df24f.c hdf.h dfgr.h
+    $(CC) /c $(CFLAGS) %s
+
+dfsd.obj: dfsd.c hdf.h dfsd.h
+    $(CC) /c $(CFLAGS) %s
+
+dfsdf.obj: dfsdf.c hdf.h dfsd.h
+    $(CC) /c $(CFLAGS) %s
+
+dfgroup.obj: dfgroup.c hdf.h hfile.h
+    $(CC) /c $(CFLAGS) %s
+
+dfconv.obj: dfconv.c hdf.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfknat.obj: dfknat.c hdf.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkswap.obj: dfkswap.c hdf.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkcray.obj: dfkcray.c hdf.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkvms.obj: dfkvms.c hdf.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkconv.obj: dfkconv.c hdf.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkfuji.obj: dfkfuji.c hdf.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+vg.obj: vg.c vg.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+vgf.obj: vgf.c vg.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+vrw.obj: vrw.c vg.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+vio.obj: vio.c vg.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+vparse.obj: vparse.c vg.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+vconv.obj: vconv.c vg.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+vsfld.obj: vsfld.c vg.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+vgp.obj: vgp.c vg.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+vhi.obj: vhi.c vg.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+tbbt.obj: tbbt.c tbbt.h hdf.h
+    $(CC) /c $(CFLAGS) %s
+
+maldebug.obj : maldebug.c maldebug.h
+    $(CC) /c $(CFLAGS) %s
+
+hcomp.obj : hcomp.c hdf.h hcompi.h
+    $(CC) /c $(CFLAGS) %s
+
+mstdio.obj : mstdio.c hdf.h hcompi.h mstdio.h
+    $(CC) /c $(CFLAGS) %s
+
+crle.obj : crle.c hdf.h hcompi.h crle.h
+    $(CC) /c $(CFLAGS) %s
+
+cnbit.obj: cnbit.c hdf.h hcompi.h cnbit.h
+    $(CC) /c $(CFLAGS) %s
+
+dfstubs.obj: dfstubs.c hdf.h dfstubs.h df.h dfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dff.obj: dff.c hdf.h dfstubs.h df.h dfi.h
+    $(CC) /c $(CFLAGS) %s
+
+hfileff.obj : hfileff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfanff.obj : dfanff.f
+    $(FC) /c $(FFLAGS) %s
+
+df24ff.obj : df24ff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfpff.obj : dfpff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfr8ff.obj : dfr8ff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfsdff.obj : dfsdff.f
+    $(FC) /c $(FFLAGS) %s
+
+vgff.obj : vgff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfff.obj : dfff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfufp2if.obj : dfufp2if.f
+    $(FC) /c $(FFLAGS) %s
+
+# JPEG source files
+jbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcarith.obj : jcarith.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jccolor.obj : jccolor.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcdeflts.obj : jcdeflts.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcexpand.obj : jcexpand.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jchuff.obj : jchuff.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+#jcmain.obj : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
+#    $(CC) /c $(CFLAGS) %s
+
+jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcmcu.obj : jcmcu.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcpipe.obj : jcpipe.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcsample.obj : jcsample.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdarith.obj : jdarith.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jddeflts.obj : jddeflts.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+#jdmain.obj : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
+#    $(CC) /c $(CFLAGS) %s
+
+jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdmcu.obj : jdmcu.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdpipe.obj : jdpipe.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdsample.obj : jdsample.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jerror.obj : jerror.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jquant1.obj : jquant1.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdrle.obj : jrdrle.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdtarga.obj : jrdtarga.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrjfif.obj : jwrjfif.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jmemsys.obj : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h
+    $(CC) /c $(CFLAGS) %s
+
+jmemdosa.obj : jmemdosa.asm
+	masm /mx %s
+
+install:
+	-mkdir $(INCDIR)
+    -copy *.h $(INCDIR)
+	-mkdir $(LIBDIR)
+    -copy df.lib $(LIBDIR)
+
+clean:
+    -$(RM) $(RMFLAGS) *.obj
+
+cleanup:
+	-$(RM) $(RMFLAGS) libdf.a $(UTILS)

Added: packages/libhdf4/branches/upstream/current/hdf/src/makepc.wcc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/makepc.wcc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/makepc.wcc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,374 @@
+# ****************************************************************************
+# * 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: makepc.wcc,v 1.3 1994/01/13 21:15:53 georgev Exp $
+#
+# ##################################################################
+#
+#           MAKEFILE for creating the HDF library, libdf.a,
+#
+# This makefile creates the following FORTRAN and C interfaces 
+# for HDF in a library called "df.lib": 
+#
+#              DFR8   (8-bit raster image sets)
+#              DF24   (24-bit raster image sets)
+#              DFP    (palettes)
+#              DFSD   (scientific data sets)
+#              DFAN   (annotations)
+#              V      (vsets)
+#
+# See the file INSTALL for further information on how to invoke
+# this makefile.
+#
+# This release of HDF marks the first use of a new set of lower
+# level routines.  The makefile also creates these interfaces,
+# which are available in C only.  These routines are categorized
+# as follows:
+#
+#              H      (new lower level i/o)
+#              DF     (emulation of old lower level i/o routines)
+#              HD     (lower level utilities for developers)
+#              HE     (lower level error-handling)
+#              HD     (lower level utilities, for developers)
+#              DFK    (conversion routines)
+#
+# ##################################################################
+#
+#
+# PORTING INSTRUCTIONS
+# You must modify the lines marked "# ==>".
+#
+
+# ==> specify your machine
+MACHINE=PC
+
+INCDIR=..\include
+LIBDIR=..\lib
+BINDIR=..\bin
+
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+IFLAGS=   /i=$(INCDIR) /i=.
+
+# ==> specify your FORTRAN compiler
+#FC=fl
+#FFLAGS= /Gt64 /AH $(IFLAGS) /W2 /Od /Tf
+#FFLAGS= /AH $(IFLAGS) /W2 /Od /Tf
+#FFLAGS= /Gt64 /AH $(IFLAGS) /W2 /Ox /Tf
+
+# ==> specify your C compiler
+CC=wccp
+CFLAGS=  /D$(MACHINE) /mh /w4 /2 /Oals /s $(IFLAGS) /zc /ze /zdp /zp
+
+# ==> specify your Macro-Assembler compiler
+MM = ml
+MFLAGS = /c /nologo /W3
+
+# ==> where is your HDF library (df.lib) located?
+LIBS= $(LIBDIR)\df.lib
+
+# ==> specify your archiver
+AR=wlib
+ARFLAGS=/q /b
+ARFLAGS2=
+
+# ==> specify your archive randomizer
+#RANLIB=ranlib
+
+RM=del
+RMFLAGS=
+LINTFLAGS=
+
+HDRS=hfile.h hdf.h hdfi.h herr.h hproto.h dfan.h dfrig.h dfgr.h dfsd.h &
+     dfgroup.h vg.h df.h dfi.h dfstubs.h dfutil.h hconv.h tbbt.h
+
+CSRCS=hfile.c herr.c hblocks.c hextelt.c hkit.c dfan.c dfr8.c dfcomp.c &
+      dfrle.c dfimcomp.c dfjpeg.c dfunjpeg.c dfp.c dfgr.c df24.c dfsd.c &
+      dfgroup.c dfconv.c dfufp2i.c vg.c vrw.c vio.c vparse.c vconv.c vsfld.c &
+      vgp.c vhi.c dfutil.c dfstubs.c dfknat.c dfkswap.c dfkcray.c dfkvms.c &
+      dfkconv.c dfkfuji.c tbbt.c hdfalloc.c maldebug.c
+
+COBJS=hfile.obj herr.obj hblocks.obj hextelt.obj hkit.obj dfan.obj dfr8.obj &
+        dfcomp.obj dfrle.obj dfimcomp.obj dfjpeg.obj dfunjpeg.obj dfp.obj &
+        dfgr.obj df24.obj dfsd.obj dfgroup.obj dfconv.obj dfufp2i.obj vg.obj &
+        vrw.obj vio.obj vparse.obj vconv.obj vsfld.obj vgp.obj vhi.obj &
+        dfutil.obj dfstubs.obj dfknat.obj dfkswap.obj dfkcray.obj dfkvms.obj &
+        dfkconv.obj dfkfuji.obj tbbt.obj hdfalloc.obj maldebug.obj
+
+FSRCS=hfilef.c herrf.c dfanf.c dfr8f.c dfpf.c df24f.c dfsdf.c vgf.c dff.c &
+      dfutilf.c hfileff.f dfanff.f df24ff.f dfpff.f dfr8ff.f dfsdff.f vgff.f &
+      dfff.f dfufp2if.f
+
+FOBJS=hfilef.obj herrf.obj dfanf.obj dfr8f.obj dfpf.obj df24f.obj dfsdf.obj &
+      vgf.obj dff.obj dfutilf.obj hfileff.obj dfanff.obj df24ff.obj dfpff.obj &
+      dfr8ff.obj dfsdff.obj vgff.obj dfff.obj dfufp2if.obj
+
+JCSRCS= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c &
+        jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c &
+        jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c &
+        jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c &
+        jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c &
+        jwrppm.c jwrrle.c jwrtarga.c jmemsys.c
+
+JINCS= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c
+
+# objectfiles common to both JPEG compression and decompression
+COMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj
+# compression objectfiles
+CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj &
+        jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj
+
+CFILEOBJECTS=jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj
+
+# decompression objectfiles
+DLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj &
+        jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj &
+        jquant2.obj jrevdct.obj
+
+DFILEOBJECTS=jrdjfif.obj jwrgif.obj jwrppm.obj jwrrle.obj jwrtarga.obj
+
+# These objectfiles are included in libjpeg.lib
+JOBJS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+
+#.f.obj:
+#    $(FC) /c $(FFLAGS) $<
+#    $(AR) $(ARFLAGS) df.lib $(ARFLAGS2) $*;
+
+.c.obj:
+    $(CC) $[@ $(CFLAGS)
+
+.asm.obj:
+    $(MM) $(MFLAGS) /Fo $^@ $[@ >$^&.err
+
+all: df.lib install note
+
+allnostub: libnostub install note
+
+df.lib: $(COBJS) $(FOBJS) $(JOBJS)
+    del df.lib
+    $(AR) $(ARFLAGS) df.lib @hdfwcc.lbc
+
+libnostub: $(COBJS) $(JOBJS)
+    del df.lib
+    $(AR) $(ARFLAGS) df.lib @hdfnofwc.lbc
+
+note:
+	@echo "^G"
+	@echo "***********************************************************"
+    @echo " df.lib successfully created."
+	@echo ""
+	@echo "If you have any old vset files (v 1.0) you must use vcompat"
+	@echo "to make them compatible with Vset 2.0 applications"
+	@echo ""
+	@echo "***********************************************************"
+	@echo ""
+
+
+hfile.obj: hfile.c hfile.h hdf.h herr.h hdfi.h
+
+herr.obj: herr.c hdf.h herr.h hdfi.h
+
+hblocks.obj: hblocks.c hfile.h hdf.h herr.h hdfi.h
+
+hextelt.obj: hextelt.c hfile.h hdf.h herr.h hdfi.h
+
+hkit.obj: hkit.c hfile.h hdf.h herr.h hdfi.h
+
+hdfalloc.obj: hdfalloc.c hdf.h herr.h hdfi.h
+
+dfan.obj: dfan.c hdf.h herr.h dfan.h hdfi.h
+
+dfanf.obj: dfanf.c hdf.h herr.h dfan.h hdfi.h
+
+dfr8.obj: dfr8.c hdf.h herr.h dfrig.h hdfi.h
+
+dfr8f.obj: dfr8f.c hdf.h herr.h dfrig.h hdfi.h
+
+dfcomp.obj: dfcomp.c hdf.h herr.h dfrig.h hdfi.h
+
+dfimcomp.obj: dfimcomp.c hdf.h herr.h dfrig.h hdfi.h
+
+dfrle.obj: dfrle.c hdf.h herr.h dfrig.h hdfi.h
+
+dfjpeg.obj: dfjpeg.c hdf.h herr.h dfrig.h hdfi.h
+
+dfunjpeg.obj: dfunjpeg.c hdf.h herr.h dfrig.h hdfi.h
+
+dfp.obj: dfp.c hdf.h herr.h hdfi.h
+
+dfpf.obj: dfpf.c hdf.h herr.h hdfi.h
+
+dfgr.obj: dfgr.c hdf.h herr.h dfgr.h hdfi.h
+
+df24.obj: df24.c hdf.h herr.h dfgr.h hdfi.h
+
+df24f.obj: df24f.c hdf.h herr.h dfgr.h hdfi.h
+
+dfsd.obj: dfsd.c hdf.h herr.h dfsd.h hdfi.h
+
+dfsdf.obj: dfsdf.c hdf.h herr.h dfsd.h hdfi.h
+
+dfgroup.obj: dfgroup.c hdf.h herr.h hfile.h hdfi.h
+
+dfconv.obj: dfconv.c hdf.h herr.h hdfi.h hconv.h
+
+dfknat.obj: dfknat.c hdf.h herr.h hdfi.h hconv.h
+
+dfkswap.obj: dfkswap.c hdf.h herr.h hdfi.h hconv.h
+
+dfkcray.obj: dfkcray.c hdf.h herr.h hdfi.h hconv.h
+
+dfkvms.obj: dfkvms.c hdf.h herr.h hdfi.h hconv.h
+
+dfkconv.obj: dfkconv.c hdf.h herr.h hdfi.h hconv.h
+
+dfkfuji.obj: dfkfuji.c hdf.h herr.h hdfi.h hconv.h
+
+vg.obj: vg.c vg.h hdf.h hdfi.h
+
+vgf.obj: vgf.c vg.h hdf.h hdfi.h
+
+vrw.obj: vrw.c vg.h hdf.h hdfi.h
+
+vio.obj: vio.c vg.h hdf.h hdfi.h
+
+vparse.obj: vparse.c vg.h hdf.h hdfi.h
+
+vconv.obj: vconv.c vg.h hdf.h hdfi.h
+
+vsfld.obj: vsfld.c vg.h hdf.h hdfi.h
+
+vgp.obj: vgp.c vg.h hdf.h hdfi.h
+
+vhi.obj: vhi.c vg.h hdf.h hdfi.h
+
+tbbt.obj: tbbt.c tbbt.h hdfi.h
+
+maldebug.obj : maldebug.c maldebug.h hdfi.h
+
+dfstubs.obj: dfstubs.c hdf.h herr.h dfstubs.h df.h dfi.h hdfi.h
+
+dff.obj: dff.c hdf.h herr.h dfstubs.h df.h dfi.h hdfi.h
+
+hfileff.obj : hfileff.f
+
+dfanff.obj : dfanff.f
+
+df24ff.obj : df24ff.f
+
+dfpff.obj : dfpff.f
+
+dfr8ff.obj : dfr8ff.f
+
+dfsdff.obj : dfsdff.f
+
+vgff.obj : vgff.f
+
+dfff.obj : dfff.f
+
+dfufp2if.obj : dfufp2if.f
+
+# JPEG source files
+jbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h
+
+jcarith.obj : jcarith.c jinclude.h jconfig.h jpegdata.h
+
+jccolor.obj : jccolor.c jinclude.h jconfig.h jpegdata.h
+
+jcdeflts.obj : jcdeflts.c jinclude.h jconfig.h jpegdata.h
+
+jcexpand.obj : jcexpand.c jinclude.h jconfig.h jpegdata.h
+
+jchuff.obj : jchuff.c jinclude.h jconfig.h jpegdata.h
+
+#jcmain.obj : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
+
+jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpegdata.h
+
+jcmcu.obj : jcmcu.c jinclude.h jconfig.h jpegdata.h
+
+jcpipe.obj : jcpipe.c jinclude.h jconfig.h jpegdata.h
+
+jcsample.obj : jcsample.c jinclude.h jconfig.h jpegdata.h
+
+jdarith.obj : jdarith.c jinclude.h jconfig.h jpegdata.h
+
+jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpegdata.h
+
+jddeflts.obj : jddeflts.c jinclude.h jconfig.h jpegdata.h
+
+jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpegdata.h
+
+#jdmain.obj : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
+
+jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpegdata.h
+
+jdmcu.obj : jdmcu.c jinclude.h jconfig.h jpegdata.h
+
+jdpipe.obj : jdpipe.c jinclude.h jconfig.h jpegdata.h
+
+jdsample.obj : jdsample.c jinclude.h jconfig.h jpegdata.h
+
+jerror.obj : jerror.c jinclude.h jconfig.h jpegdata.h
+
+jquant1.obj : jquant1.c jinclude.h jconfig.h jpegdata.h
+
+jquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h
+
+jfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h
+
+jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h
+
+jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h
+
+jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h
+
+jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h
+
+jrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h
+
+jrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h
+
+jrdrle.obj : jrdrle.c jinclude.h jconfig.h jpegdata.h
+
+jrdtarga.obj : jrdtarga.c jinclude.h jconfig.h jpegdata.h
+
+jwrjfif.obj : jwrjfif.c jinclude.h jconfig.h jpegdata.h
+
+jwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h
+
+jwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h
+
+jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h
+
+jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h
+
+jmemsys.obj : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h
+
+jmemdosa.obj : jmemdosa.asm
+
+install:
+	-mkdir $(INCDIR)
+    -copy *.h $(INCDIR)
+	-mkdir $(LIBDIR)
+    -copy df.lib $(LIBDIR)
+
+clean:
+    -$(RM) $(RMFLAGS) *.obj
+
+cleanup:
+	-$(RM) $(RMFLAGS) df.lib $(UTILS)
+
+lint: $(SRCS) $(R8SRCS)
+	$(LINT) $(LINTFLAGS) $(SRCS)
+
+TAGS: $(SRCS) $(HDRS)
+	etags $(SRCS) $(HDRS)
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/makewin.msc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/makewin.msc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/makewin.msc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,469 @@
+# ****************************************************************************
+# * 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: makewin.msc,v 1.3 1994/01/13 21:15:54 georgev Exp $
+#
+# ##################################################################
+#
+#           MAKEFILE for creating the HDF library, libdf.a,
+#
+# This makefile creates the following FORTRAN and C interfaces 
+# for HDF in a library called "df.lib": 
+#
+#              DFR8   (8-bit raster image sets)
+#              DF24   (24-bit raster image sets)
+#              DFP    (palettes)
+#              DFSD   (scientific data sets)
+#              DFAN   (annotations)
+#              V      (vsets)
+#
+# See the file INSTALL for further information on how to invoke
+# this makefile.
+#
+# This release of HDF marks the first use of a new set of lower
+# level routines.  The makefile also creates these interfaces,
+# which are available in C only.  These routines are categorized 
+# as follows:
+#
+#              H      (new lower level i/o)
+#              DF     (emulation of old lower level i/o routines)
+#              HD     (lower level utilities for developers)
+#              HE     (lower level error-handling)
+#              HD     (lower level utilities, for developers)
+#              DFK    (conversion routines)
+#
+# ##################################################################
+#
+#
+# PORTING INSTRUCTIONS
+# You must modify the lines marked "# ==>".
+#
+
+.SUFFIXES : .f
+
+# ==> specify your machine
+#MACHINE=WIN3
+MACHINE=PC
+
+INCDIR=..\include
+LIBDIR=..\lib
+BINDIR=..\bin
+
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+IFLAGS=   /I$(INCDIR) /I.
+
+# ==> specify your FORTRAN compiler
+FC=fl
+#FFLAGS= /Gt64 /AH $(IFLAGS) /W2 /Od /Tf
+FFLAGS= /AH $(IFLAGS) /W2 /Od /Tf
+#FFLAGS= /Gt64 /AH $(IFLAGS) /W2 /Ox /Tf
+
+# ==> specify your C compiler
+CC=cl
+#CFLAGS=  /D$(MACHINE) /Gt64 /AH /W4 /Ozaxb2 $(IFLAGS) /Zl
+#CFLAGS=  /D$(MACHINE) /Gt64 /AH /W4 /Od $(IFLAGS) /Zi /Zl /DMALDEBUG
+CFLAGS=  /D$(MACHINE) /Gt32 /AH /W4 /Od $(IFLAGS) /Zi /Zl /Mq /DTEST_WIN
+#CFLAGS=  /D$(MACHINE) /Gt64 /AH /W4 /Od $(IFLAGS) /C /P
+#CFLAGS=  /D$(MACHINE) /Gt64 /AH /W4 /Od $(IFLAGS) /Zg
+
+# ==> where is your HDF library (df.lib) located?
+LIBS= $(LIBDIR)\df.lib
+
+# ==> specify your archiver
+AR=lib
+ARFLAGS=/PAGE:64
+ARFLAGS2=/NOLOGO +
+
+# ==> specify your archive randomizer
+#RANLIB=ranlib
+
+RM=del
+RMFLAGS=
+LINTFLAGS=
+
+HDRS=hfile.h hdf.h hdfi.h herr.h hproto.h dfan.h dfrig.h dfgr.h dfsd.h \
+     dfgroup.h vg.h df.h dfi.h dfstubs.h dfutil.h hconv.h tbbt.h
+
+CSRCS=hfile.c herr.c hblocks.c hextelt.c hkit.c dfan.c dfr8.c dfcomp.c \
+      dfrle.c dfimcomp.c dfjpeg.c dfunjpeg.c dfp.c dfgr.c df24.c dfsd.c \
+      dfgroup.c dfconv.c dfufp2i.c vg.c vrw.c vio.c vparse.c vconv.c vsfld.c \
+      vgp.c vhi.c dfutil.c dfstubs.c dfknat.c dfkswap.c dfkcray.c dfkvms.c \
+      dfkconv.c dfkfuji.c tbbt.c hdfalloc.c
+
+COBJS=hfile.obj herr.obj hblocks.obj hextelt.obj hkit.obj dfan.obj dfr8.obj \
+        dfcomp.obj dfrle.obj dfimcomp.obj dfjpeg.obj dfunjpeg.obj dfp.obj \
+        dfgr.obj df24.obj dfsd.obj dfgroup.obj dfconv.obj dfufp2i.obj vg.obj \
+        vrw.obj vio.obj vparse.obj vconv.obj vsfld.obj vgp.obj vhi.obj \
+        dfutil.obj dfstubs.obj dfknat.obj dfkswap.obj dfkcray.obj dfkvms.obj \
+        dfkconv.obj dfkfuji.obj tbbt.obj hdfalloc.obj
+
+FSRCS=hfilef.c herrf.c dfanf.c dfr8f.c dfpf.c df24f.c dfsdf.c vgf.c dff.c \
+      dfutilf.c hfileff.f dfanff.f df24ff.f dfpff.f dfr8ff.f dfsdff.f vgff.f \
+      dfff.f dfufp2if.f
+
+FOBJS=hfilef.obj herrf.obj dfanf.obj dfr8f.obj dfpf.obj df24f.obj dfsdf.obj \
+      vgf.obj dff.obj dfutilf.obj hfileff.obj dfanff.obj df24ff.obj dfpff.obj \
+      dfr8ff.obj dfsdff.obj vgff.obj dfff.obj dfufp2if.obj
+
+JCSRCS= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \
+        jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \
+        jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \
+        jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \
+        jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \
+        jwrppm.c jwrrle.c jwrtarga.c jmemsys.c
+
+JINCS= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c
+
+# objectfiles common to both JPEG compression and decompression
+COMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj
+# compression objectfiles
+CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \
+        jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj
+        
+CFILEOBJECTS=jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj
+
+# decompression objectfiles
+DLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj \
+        jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj \
+        jquant2.obj jrevdct.obj
+
+DFILEOBJECTS=jrdjfif.obj jwrgif.obj jwrppm.obj jwrrle.obj jwrtarga.obj
+
+# These objectfiles are included in libjpeg.lib
+JOBJS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+
+#add all utilities here
+#UTILS=vshow.obj
+
+#.c.obj:
+#    $(CC) /c $(CFLAGS) $<
+#    $(AR) $(ARFLAGS) df.lib $(ARFLAGS2) $*;
+
+#.f.obj:
+#    $(FC) /c $(FFLAGS) $<
+#    $(AR) $(ARFLAGS) df.lib $(ARFLAGS2) $*;
+
+all: df.lib install note
+
+allnostub: libnostub install note
+
+df.lib: $(COBJS) $(FOBJS) $(JOBJS)
+    del df.lib
+    $(AR) $(ARFLAGS) df.lib @hdf.bld;
+
+libnostub: $(COBJS) $(JOBJS)
+    del df.lib
+    $(AR) $(ARFLAGS) df.lib @hdfnof.bld;
+
+note:
+	@echo "^G"
+	@echo "***********************************************************"
+    @echo " df.lib successfully created."
+	@echo ""
+	@echo "If you have any old vset files (v 1.0) you must use vcompat"
+	@echo "to make them compatible with Vset 2.0 applications"
+	@echo ""
+	@echo "***********************************************************"
+	@echo ""
+
+
+hfile.obj: hfile.c hfile.h hdf.h herr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+herr.obj: herr.c hdf.h herr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+hblocks.obj: hblocks.c hfile.h hdf.h herr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+hextelt.obj: hextelt.c hfile.h hdf.h herr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+hkit.obj: hkit.c hfile.h hdf.h herr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+hdfalloc.obj: hdfalloc.c hdf.h herr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfan.obj: dfan.c hdf.h herr.h dfan.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfanf.obj: dfanf.c hdf.h herr.h dfan.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfr8.obj: dfr8.c hdf.h herr.h dfrig.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfr8f.obj: dfr8f.c hdf.h herr.h dfrig.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfcomp.obj: dfcomp.c hdf.h herr.h dfrig.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfimcomp.obj: dfimcomp.c hdf.h herr.h dfrig.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfrle.obj: dfrle.c hdf.h herr.h dfrig.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfjpeg.obj: dfjpeg.c hdf.h herr.h dfrig.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfunjpeg.obj: dfunjpeg.c hdf.h herr.h dfrig.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfp.obj: dfp.c hdf.h herr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfpf.obj: dfpf.c hdf.h herr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfgr.obj: dfgr.c hdf.h herr.h dfgr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+df24.obj: df24.c hdf.h herr.h dfgr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+df24f.obj: df24f.c hdf.h herr.h dfgr.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfsd.obj: dfsd.c hdf.h herr.h dfsd.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfsdf.obj: dfsdf.c hdf.h herr.h dfsd.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfgroup.obj: dfgroup.c hdf.h herr.h hfile.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfconv.obj: dfconv.c hdf.h herr.h hdfi.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfknat.obj: dfknat.c hdf.h herr.h hdfi.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkswap.obj: dfkswap.c hdf.h herr.h hdfi.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkcray.obj: dfkcray.c hdf.h herr.h hdfi.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkvms.obj: dfkvms.c hdf.h herr.h hdfi.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkconv.obj: dfkconv.c hdf.h herr.h hdfi.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+dfkfuji.obj: dfkfuji.c hdf.h herr.h hdfi.h hconv.h
+    $(CC) /c $(CFLAGS) %s
+
+vg.obj: vg.c vg.h hdf.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+vgf.obj: vgf.c vg.h hdf.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+vrw.obj: vrw.c vg.h hdf.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+vio.obj: vio.c vg.h hdf.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+vparse.obj: vparse.c vg.h hdf.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+vconv.obj: vconv.c vg.h hdf.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+vsfld.obj: vsfld.c vg.h hdf.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+vgp.obj: vgp.c vg.h hdf.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+vhi.obj: vhi.c vg.h hdf.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+tbbt.obj: tbbt.c tbbt.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dfstubs.obj: dfstubs.c hdf.h herr.h dfstubs.h df.h dfi.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+dff.obj: dff.c hdf.h herr.h dfstubs.h df.h dfi.h hdfi.h
+    $(CC) /c $(CFLAGS) %s
+
+hfileff.obj : hfileff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfanff.obj : dfanff.f
+    $(FC) /c $(FFLAGS) %s
+
+df24ff.obj : df24ff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfpff.obj : dfpff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfr8ff.obj : dfr8ff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfsdff.obj : dfsdff.f
+    $(FC) /c $(FFLAGS) %s
+
+vgff.obj : vgff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfff.obj : dfff.f
+    $(FC) /c $(FFLAGS) %s
+
+dfufp2if.obj : dfufp2if.f
+    $(FC) /c $(FFLAGS) %s
+
+# JPEG source files
+jbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcarith.obj : jcarith.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jccolor.obj : jccolor.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcdeflts.obj : jcdeflts.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcexpand.obj : jcexpand.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jchuff.obj : jchuff.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+#jcmain.obj : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
+#    $(CC) /c $(CFLAGS) %s
+
+jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcmcu.obj : jcmcu.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcpipe.obj : jcpipe.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jcsample.obj : jcsample.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdarith.obj : jdarith.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jddeflts.obj : jddeflts.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+#jdmain.obj : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
+#    $(CC) /c $(CFLAGS) %s
+
+jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdmcu.obj : jdmcu.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdpipe.obj : jdpipe.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jdsample.obj : jdsample.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jerror.obj : jerror.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jquant1.obj : jquant1.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdrle.obj : jrdrle.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jrdtarga.obj : jrdtarga.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrjfif.obj : jwrjfif.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h
+    $(CC) /c $(CFLAGS) %s
+
+jmemsys.obj : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h
+    $(CC) /c $(CFLAGS) %s
+
+
+jmemdosa.obj : jmemdosa.asm
+	masm /mx $*;
+
+
+install:
+	-mkdir $(INCDIR)
+    -copy *.h $(INCDIR)
+	-mkdir $(LIBDIR)
+    -copy df.lib $(LIBDIR)
+
+clean:
+    -$(RM) $(RMFLAGS) *.obj
+
+cleanup:
+	-$(RM) $(RMFLAGS) libdf.a $(UTILS)
+
+lint: $(SRCS) $(R8SRCS)
+	$(LINT) $(LINTFLAGS) $(SRCS)
+
+TAGS: $(SRCS) $(HDRS)
+	etags $(SRCS) $(HDRS)
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/maldebug.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/maldebug.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/maldebug.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,672 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.8 $";
+#endif
+
+/* $Id: maldebug.c,v 1.8 1996/03/28 21:57:38 koziol Exp $ */
+
+/*----------------------------------------------------------------------
+ *
+ *  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;
+
+#ifdef QAK
+/* 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] = ~q[i];
+#endif
+#endif
+
+#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
+#ifdef QAK
+    exit(1);
+#endif
+}   /* end mem_tag_err() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/maldebug.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/maldebug.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/maldebug.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/* $Id: maldebug.h,v 1.7 1995/04/18 15:33:50 koziol Exp $ */
+
+/*----------------------------------------------------------------------
+ *
+ *  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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/mcache.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mcache.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mcache.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1344 @@
+/*-
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. 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: 1.3 $";
+#endif
+
+/* $Id: mcache.c,v 1.3 1996/10/28 15:21:39 koziol Exp $ */
+
+/*
+ *  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);
+                      ret_value = RET_ERROR;
+                      goto done;
+                  }
+            }
+          else
+            {
+                HEreport("mcache_get: reading fcn not set,chunk=%d\n",(intn)pgno-1);
+                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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/mcache.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mcache.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mcache.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,220 @@
+/*-
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. 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,v 1.2 1996/10/02 18:45:15 georgev Exp $ */
+
+/*
+ *  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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/mfan.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mfan.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mfan.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2381 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.52 $";
+#endif
+
+/* $Id: mfan.c,v 1.52 1999/06/16 21:11:08 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_mfan_c
+#endif
+
+/*-----------------------------------------------------------------------------
+ * 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
+ *
+ *  ANinit      - Intialize the annotation interface
+ *  ANdestroy   - 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_C  /* define main annoation source file */
+#define MFAN_C
+
+#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 */
+
+/*--------------------------------------------------------------------------
+ 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 ANdestroy() */
+    if (HPregister_term_func(&ANdestroy) != 0)
+        HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return(ret_value);
+} /* end ANIstart() */
+
+/* ------------------------------- ANinit -------------------------------- 
+ NAME
+	ANinit -- 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
+ANinit(void)
+{
+    CONSTR(FUNC, "ANinit");
+    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;
+} /* ANinit() */
+
+/* ------------------------------- ANdestroy -------------------------------- 
+ NAME
+	ANdestroy -- 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
+ANdestroy(void)
+{
+#ifdef LATER
+    CONSTR(FUNC, "ANdestroy");
+#endif /* LATER */
+    int32    ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Destroy the atom groups for annotations */
+    HAdestroy_group(ANIDGROUP);
+
+    return ret_value;
+} /* ANdestroy () */
+
+/*--------------------------------------------------------------------------
+ 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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANstart);
+#endif /* HAVE_PABLO */
+
+    /* 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 ANinit, should just register termination function once 
+       no matter how many times it is called. */
+    ANinit();
+
+    ret_value = file_id;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+      } /* end if */
+
+    /* Normal function cleanup */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANstart);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANfileinfo);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANfileinfo);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANend);
+#endif /* HAVE_PABLO */
+  
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANend);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANcreate);
+#endif /* HAVE_PABLO */
+
+    ret_value = (ANIcreate(an_id, elem_tag, elem_ref, type));
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANcreate);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANcreatef);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANcreatef);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANselect);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANselect);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANnumann);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANnumann);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANannlist);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANannlist);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANannlen);
+#endif /* HAVE_PABLO */
+
+    ret_value =  ANIannlen(ann_id);
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANannlen);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANwriteann);
+#endif /* HAVE_PABLO */
+
+    ret_value = ANIwriteann(ann_id, ann, annlen);
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANwriteann);
+#endif /* HAVE_PABLO */
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANreadann);
+#endif /* HAVE_PABLO */
+
+    ret_value = ANIreadann(ann_id, ann, maxlen);
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANreadann);
+#endif /* HAVE_PABLO */
+
+    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;
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_ANendaccess);
+#endif /* HAVE_PABLO */
+
+    /* shut compiler up */
+    ann_id=ann_id;
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_ANendaccess);
+#endif /* HAVE_PABLO */
+
+
+    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_C */

Added: packages/libhdf4/branches/upstream/current/hdf/src/mfan.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mfan.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mfan.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,372 @@
+/****************************************************************************
+ * 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: mfan.h,v 1.15 1997/10/21 17:45:06 georgev Exp $ */
+
+/*------------------------------------------------------------------------------
+ * 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 "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
+
+#ifdef MFAN_C
+/* 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 /* !MFAN_C */
+/* WE are NOT in main ANNOTATION source file
+ * Nothing EXPORTED except Public fcns */
+
+
+/******************************************************************************
+ NAME
+    ANdestroy -- Un-Initialize Annotation Interface
+
+ DESCRIPTION
+    Unallocates global annotaton node list and file list.
+
+ RETURNS
+    SUCCEED or FAIL
+*******************************************************************************/
+extern intn ANdestroy(void);
+
+/******************************************************************************
+ 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.
+*******************************************************************************/
+extern 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
+
+*******************************************************************************/
+extern 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.
+*******************************************************************************/
+extern 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.
+*******************************************************************************/
+extern 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
+*******************************************************************************/
+extern 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 
+*******************************************************************************/
+extern 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
+
+*******************************************************************************/
+extern 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
+
+*******************************************************************************/
+extern 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
+
+*******************************************************************************/
+extern 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
+
+*******************************************************************************/
+extern 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
+
+*******************************************************************************/
+extern 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)
+*******************************************************************************/
+extern 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.
+
+*******************************************************************************/
+extern 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. 
+*******************************************************************************/
+extern 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. 
+*******************************************************************************/
+extern 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.
+*******************************************************************************/
+extern 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.
+*******************************************************************************/
+extern ann_type ANtag2atype(uint16 atag /* IN: annotation tag */);
+
+
+#endif /* !MFAN_C */
+
+#endif /* _MFAN_H */

Added: packages/libhdf4/branches/upstream/current/hdf/src/mfanf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mfanf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mfanf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,501 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.19 $";
+#endif
+
+/* $Id: mfanf.c,v 1.19 1996/12/17 20:11:08 georgev Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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"
+
+/*-----------------------------------------------------------------------------
+  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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/mfgr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mfgr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mfgr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,6402 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 1.77 $";
+#endif
+
+/* $Id: mfgr.c,v 1.77 2000/11/16 15:41:04 koziol Exp $ */
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_mfgr_c
+#endif
+
+/*
+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 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,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,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"
+
+/* 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);
+
+/*--------------------------------------------------------------------------
+ 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() */
+
+        
+/* -------------------------- 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 */
+    } *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);
+
+#ifdef QAK
+printf("%s: nri=%ld, nci=%ld, nri8=%ld, nci8=%ld, nii8=%ld, nvg=%ld\n",FUNC,(long)nri,(long)nci,(long)nri8,(long)nci8,(long)nii8,(long)nvg);
+#endif /* QAK */
+    /* 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 */
+                
+#ifdef QAK
+printf("%s: nobjs=%d\n",FUNC,(int)nobjs);
+#endif /* QAK */
+                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 */
+#ifdef QAK
+printf("%s: DFTAG_VG, ref=%u\n",FUNC,(unsigned)grp_ref);
+#endif /* QAK */
+                                if((img_key=Vattach(file_id,grp_ref,"r"))!=FAIL)
+                                  {
+#ifdef QAK
+printf("%s: img_key=%d\n",FUNC,(int)img_key);
+#endif /* QAK */
+                                    if(Vgetclass(img_key,textbuf)!=FAIL)
+                                      {
+#ifdef QAK
+printf("%s: class=%s\n",FUNC,textbuf);
+#endif /* QAK */
+                                        if(!HDstrcmp(textbuf,RI_NAME))
+                                          { /* found an image, whew! */
+#ifdef QAK
+printf("%s: Vntagrefs=%d\n",FUNC,(int)Vntagrefs(img_key));
+#endif /* QAK */
+                                            for(j=0; j<Vntagrefs(img_key); j++)
+                                              {
+                                                  if(Vgettagref(img_key,j,&img_tag,&img_ref)==FAIL)
+                                                      continue;
+#ifdef QAK
+printf("%s: img_tag=%u, img_ref=%u\n",FUNC,(unsigned)img_tag,(unsigned)img_ref);
+#endif /* QAK */
+                                                  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:
+#ifdef QAK
+printf("%s: tag=%u, ref=%u\n",FUNC,(unsigned)grp_tag,(unsigned)grp_ref);
+#endif /* QAK */
+                                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 */
+#ifdef QAK
+printf("before duplicate elimination, curr_image=%d\n",curr_image);
+for (i = 0; i < curr_image; i++)
+  {
+    printf("%d: tag=%u, ref=%u, offset=%ld\n",(int)i,(unsigned)img_info[i].img_tag,(unsigned)img_info[i].img_ref,(long)img_info[i].offset);
+  } /* end for */
+#endif /* QAK */
+    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(img_info[j].img_tag!=DFTAG_NULL)
+                        if ((img_info[i].offset!= INVALID_OFFSET && img_info[i].offset!=0)
+                            && img_info[i].offset == img_info[j].offset)
+                          {
+                              /* 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].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].img_tag=DFTAG_NULL;
+                                          else
+                                            {
+                                              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 for */
+      } /* end for */
+#ifdef QAK
+printf("after duplicate elimination\n");
+for (i = 0; i < curr_image; i++)
+  {
+    printf("%d: tag=%u, ref=%u, offset=%ld\n",(int)i,(unsigned)img_info[i].img_tag,(unsigned)img_info[i].img_ref,(long)img_info[i].offset);
+  } /* end for */
+#endif /* QAK */
+
+    /* 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 */
+
+#ifdef QAK
+printf("%s: reading GR vgroup, img_ref=%d\n",FUNC,(int)img_info[i].img_ref);
+#endif /* QAK */
+                          if((img_key=Vattach(file_id,(int32)img_info[i].grp_ref,"r"))!=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 */
+                                if(Vgetname(img_key,textbuf)==FAIL)
+                                    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);
+
+                                /* 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;
+                                              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 */
+
+#ifdef QAK
+printf("%s: reading RIG, img_ref=%d\n",FUNC,(int)img_info[i].img_ref);
+#endif /* QAK */
+                          /* 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);
+
+                          /* 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 */
+
+#ifdef QAK
+printf("%s: reading RI, img_ref=%d\n",FUNC,(int)img_info[i].img_ref);
+#endif /* QAK */
+                          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);
+
+                          /* 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 */
+
+#ifdef QAK
+printf("%s: inil=%d, outil=%d\n",FUNC,(int)inil,(int)outil);
+printf("%s: dim[XDIM]=%d, dim[YDIM]=%d\n",FUNC,(int)dims[XDIM],(int)dims[YDIM]);
+printf("%s: ncomp=%d, nt=%d\n",FUNC,(int)ncomp,(int)nt);
+printf("%s: pixel_size=%d, comp_size=%d\n",FUNC,(int)pixel_size,(int)comp_size);
+#endif /* QAK */
+    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 */
+
+#ifdef QAK
+for(i=0; i<ncomp; i++)
+  {
+      printf("%s: in_pixel_add[%d]=%d, in_line_add[%d]=%d\n",FUNC,(int)i,(int)in_pixel_add[i],(int)i,(int)in_line_add[i]);
+      printf("%s: out_pixel_add[%d]=%d, out_line_add[%d]=%d\n",FUNC,(int)i,(int)out_pixel_add[i],(int)i,(int)out_line_add[i]);
+  } /* end for */
+#endif /* QAK */
+        /* 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(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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRstart);
+#endif /* HAVE_PABLO */
+    /* 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);
+
+#ifdef QAK
+/* Dump the tree */
+printf("%s: id=%ld\n",FUNC,(long)GRSLOT2ID(hdf_file_id,next_gr));
+tbbtdump(gr_ptr->gattree,0);
+#endif /* QAK */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRstart);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRfileinfo);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRfileinfo);
+#endif /* HAVE_PABLO */
+  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;
+      }
+
+#ifdef QAK
+printf("%s: writing RIG\n",FUNC);
+#endif /* QAK */
+
+    /* 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);
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    /* 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);
+
+#ifdef QAK
+printf("%s: check 2.0, GroupID=%ld\n",FUNC,(long)GroupID);
+#endif /* QAK */
+    /* 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;
+    }
+
+#ifdef QAK
+printf("%s: check 3.0, img_ptr->name=%s\n",FUNC,img_ptr->name);
+#endif /* QAK */
+    /* 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);
+
+#ifdef QAK
+printf("%s: attr_ptr->ref=%u\n",FUNC,attr_ptr->ref);
+#endif /* QAK */
+    /* 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 */
+
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRend);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef QAK
+printf("%s: gr_modified=%d, gr_count=%ld\n",FUNC,gr_ptr->gr_modified,(long)gr_ptr->gr_count);
+#endif /* QAK */
+        if(gr_ptr->gr_modified==TRUE && gr_ptr->gr_count>0)
+          {
+              void *      *t2;
+              ri_info_t *img_ptr;   /* ptr to the image */
+
+#ifdef QAK
+printf("%s: gr_modified=%d, gr_count=%ld\n",FUNC,gr_ptr->gr_modified,(long)gr_ptr->gr_count);
+#endif /* QAK */
+              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)
+                {
+#ifdef QAK
+printf("%s: data_modified=%d, meta_modified=%d, attr_modified=%d\n",FUNC,img_ptr->data_modified,img_ptr->meta_modified,img_ptr->attr_modified);
+printf("%s: ri_ref=%u\n",FUNC,img_ptr->ri_ref);
+#endif /* QAK */
+                    /* 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 */
+
+#ifdef QAK
+printf("%s: ri_ref=%u, atptr->ref=%u\n",FUNC,img_ptr->ri_ref,attr_ptr->ref);
+#endif /* QAK */
+                                /* 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 */
+
+#ifdef QAK
+printf("%s: gr_ptr=%p, gr_ptr->gattr_modified=%d, gr_ptr->gattr_count=%ld\n",FUNC,gr_ptr,gr_ptr->gattr_modified,gr_ptr->gattr_count);
+#endif /* QAK */
+        /* 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 */
+
+#ifdef QAK
+printf("%s: attr_ptr=%p\n",FUNC,attr_ptr);
+#endif /* QAK */
+              /* cycle through all of the global attributes in memory */
+              while (t2!=NULL)
+                {
+#ifdef QAK
+printf("%s: attr_ptr->data_modified=%d\n",FUNC,attr_ptr->data_modified);
+#endif /* QAK */
+                    /* 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;
+
+#ifdef QAK
+printf("%s: attr_ptr->new_at=%d\n",FUNC,attr_ptr->new_at);
+#endif /* QAK */
+                        /* check if the attribute was a new attribute */
+                        if(attr_ptr->new_at==TRUE)
+                          {
+#ifdef QAK
+printf("%s: GroupID=%ld\n",FUNC,(long)GroupID);
+#endif /* QAK */
+                            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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRend);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRselect);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRselect);
+#endif /* HAVE_PABLO */
+  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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRcreate);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRcreate);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+	TRACE_ON(PABLO_mask,ID_GRnametoindex);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRnametoindex);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRgetiminfo);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, FAIL);
+
+#ifdef QAK
+printf("%s: ri_ptr->img_tag=%u\n",FUNC,(unsigned)ri_ptr->img_tag);
+printf("%s: ri_ptr->img_dim.comp_tag=%u\n",FUNC,(unsigned)ri_ptr->img_dim.comp_tag);
+printf("%s: ri_ptr->use_buf_drvr=%u\n",FUNC,ri_ptr->use_buf_drvr);
+printf("%s: ri_ptr->use_cr_drvr=%u\n",FUNC,ri_ptr->use_cr_drvr);
+#endif /* QAK */
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRgetiminfo);
+#endif /* HAVE_PABLO */
+  return ret_value;
+} /* end GRgetiminfo() */
+
+/*--------------------------------------------------------------------------
+ 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 */
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRwriteimage);
+#endif /* HAVE_PABLO */
+    /* clear error stack and check validity of args */
+    HEclear();
+
+#ifdef QAK
+printf("%s: check 1\n",FUNC);
+#endif /* QAK */
+    /* 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);
+
+#ifdef QAK
+printf("%s: check 2, stride[XDIM,YDIM]=%ld, %ld\n",FUNC,stride[XDIM],stride[YDIM]);
+#endif /* QAK */
+#ifdef QAK
+printf("%s: riid=%ld\n",FUNC,(long)riid);
+printf("%s: start={%ld,%ld}\n",FUNC,(long)start[XDIM],(long)start[YDIM]);
+printf("%s: stride={%ld,%ld}\n",FUNC,(long)stride[XDIM],(long)stride[YDIM]);
+printf("%s: count={%ld,%ld}\n",FUNC,(long)count[XDIM],(long)count[YDIM]);
+printf("%s: data=%p\n",FUNC,data);
+#endif /* QAK */
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    gr_ptr=ri_ptr->gr_ptr;
+    hdf_file_id=gr_ptr->hdf_file_id;
+
+#ifdef QAK
+printf("%s: stride[XDIM,YDIM]=%ld, %ld\n",FUNC,stride[XDIM],stride[YDIM]);
+printf("%s: start[XDIM,YDIM]=%ld, %ld\n",FUNC,start[XDIM],start[YDIM]);
+printf("%s: count[XDIM,YDIM]=%ld, %ld\n",FUNC,count[XDIM],count[YDIM]);
+#endif /* QAK */
+    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;
+
+#ifdef QAK
+printf("%s: check 3\n",FUNC);
+#endif /* QAK */
+    /* 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);
+#ifdef QAK
+printf("%s: file_nt_subclass=%x, platnumsubclass=%x\n",FUNC,(unsigned)ri_ptr->img_dim.file_nt_subclass,(unsigned)platnumsubclass);
+printf("%s: pixel_mem_size=%u, pixel_disk_size=%u\n",FUNC,(unsigned)pixel_mem_size,(unsigned)pixel_disk_size);
+#endif /* QAK */
+    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 */
+
+#ifdef QAK
+printf("%s: check 4\n",FUNC);
+printf("%s: solid_block=%d\n",FUNC,(int)solid_block);
+printf("%s: whole_image=%d\n",FUNC,(int)whole_image);
+printf("%s: pixel_mem_size=%d\n",FUNC,(int)pixel_mem_size);
+printf("%s: pixel_disk_size=%d\n",FUNC,(int)pixel_disk_size);
+printf("%s: convert=%d\n",FUNC,(int)convert);
+printf("%s: new_image=%d\n",FUNC,(int)new_image);
+fprintf(stderr,"%s: img_tag=%d, img_ref=%d\n",FUNC,(int)ri_ptr->img_tag,(int)ri_ptr->img_ref);
+#endif /* QAK */
+    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 */
+
+#ifdef QAK
+printf("%s: check 6, ri_ptr->fill_img=%d, tag=%u, ref=%u\n",FUNC,(int)ri_ptr->fill_img,(unsigned)ri_ptr->img_tag,(unsigned)ri_ptr->img_ref);
+#endif /* QAK */
+          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 */
+
+#ifdef QAK
+printf("%s: check 6.5, creating new image and need to fill it, ri_ptr->fill_value=%p, convert=%d\n",FUNC,ri_ptr->fill_value,(int)convert);
+#endif /* QAK */
+                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);
+#ifdef QAK
+printf("%s: check 6.6, found a fill value, nt=%d, ncomps=%d\n",FUNC,(int)ri_ptr->img_dim.nt,(int)ri_ptr->img_dim.ncomps);
+#endif /* QAK */
+                          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));
+
+#ifdef QAK
+printf("%s: check 6.75, xdim=%ld, ydim=%ld, fill_lo_size=%ld, fill_hi_size=%ld\n",FUNC,(long)ri_ptr->img_dim.xdim,(long)ri_ptr->img_dim.ydim,(long)fill_lo_size,(long)fill_hi_size);
+#endif /* QAK */
+
+                /* 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 */
+
+#ifdef QAK
+printf("%s: check 7, fill_image=%d\n",FUNC,fill_image);
+#endif /* QAK */
+          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 */
+#ifdef QAK
+printf("%s: check 8\n",FUNC);
+#endif /* QAK */
+                      /* 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 */
+
+#ifdef QAK
+printf("%s: check 9\n",FUNC);
+#endif /* QAK */
+                      /* 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);
+
+#ifdef QAK
+printf("%s: check 10, fill_lo_size=%ld, fill_hi_size=%ld, pix_len=%ld\n",FUNC,(long)fill_lo_size,(long)fill_hi_size,(long)pix_len);
+printf("%s: *tmp_data=%u\n",FUNC,(unsigned)*(uint8 *)tmp_data);
+#endif /* QAK */
+                      /* 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 */
+                        
+#ifdef QAK
+printf("%s: check 11\n",FUNC);
+#endif /* QAK */
+                      /* 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);
+
+#ifdef QAK
+printf("%s: check 12\n",FUNC);
+#endif /* QAK */
+                      /* 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 */
+#ifdef QAK
+printf("%s: check 12.4\n",FUNC);
+#endif /* QAK */
+                  } /* end if */
+                else
+                  {   /* don't worry about fill values */
+#ifdef QAK
+printf("%s: check 12.5\n",FUNC);
+#endif /* QAK */
+                      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 */
+
+#ifdef QAK
+printf("%s: check 13\n",FUNC);
+#endif /* QAK */
+                /* 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;
+#ifdef QAK
+printf("%s: check 14\n",FUNC);
+#endif /* QAK */
+
+                      /* write fills and sub-sampled data */
+
+                      /* write out lines "below" the block */
+                      if(start[YDIM]>0)
+                        { /* fill in the lines leading up the block */
+#ifdef QAK
+printf("%s: check 14.1 start[YDIM]=%d, writing %ld bytes\n",FUNC,(int)start[YDIM],(long)fill_line_size);
+#endif /* QAK */
+                          for(i=0; i<start[YDIM]; i++)
+                            {
+#ifdef QAK
+printf("%s: check 14.15 i=%d\n",FUNC,i);
+#endif /* QAK */
+                              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)
+                        {
+#ifdef QAK
+printf("%s: check 14.2 writing prelude of %d bytes\n",FUNC,(int)fill_lo_size);
+#endif /* QAK */
+                          if(Hwrite(ri_ptr->img_aid,fill_lo_size,fill_line)==FAIL)
+                              HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                        } /* end if */
+
+#ifdef QAK
+printf("%s: check 14.5, fill_lo_size=%ld, fill_hi_size=%ld\n",FUNC,(long)fill_lo_size,(long)fill_hi_size);
+printf("%s: check 14.55, pixel_disk_size=%ld\n",FUNC,(long)pixel_disk_size);
+printf("%s: check 14.6, fill_xdim=%ld, fill_ydim=%ld, fill_stride_size=%ld, fill_line_size=%ld\n",FUNC,(long)fill_xdim,(long)fill_ydim,(long)fill_stride_size,(long)fill_line_size);
+printf("%s: check 14.61, count[YDIM]=%ld, count[XDIM]=%ld\n",FUNC,(long)count[YDIM],(long)count[XDIM]);
+#endif /* QAK */
+                      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))
+                                  {
+#ifdef QAK
+printf("%s: check 14.63, writing fill_stride_size=%ld bytes\n",FUNC,(long)fill_stride_size);
+#endif /* QAK */
+                                    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++)
+                                  {
+#ifdef QAK
+printf("%s: check 14.65, k=%d\n",FUNC,(int)k);
+#endif /* QAK */
+                                    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))
+                              {
+#ifdef QAK
+printf("%s: check 14.7, i=%d\n",FUNC,(int)i);
+#endif /* QAK */
+                                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)
+                        {
+#ifdef QAK
+printf("%s: check 14.75, fill_hi_size=%d\n",FUNC,(int)fill_hi_size);
+#endif /* QAK */
+                          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];
+
+#ifdef QAK
+printf("%s: check 15, stride_add=%ld, img_offset=%ld\n",FUNC,(long)stride_add,(long)img_offset);
+#endif /* QAK */
+                      for(i=0; i<count[YDIM]; i++)
+                        {
+                            int32 local_offset;
+
+                            local_offset=img_offset;
+#ifdef QAK
+printf("%s: check 15.5, local_offset=%ld\n",FUNC,(long)local_offset);
+#endif /* QAK */
+                            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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRwriteimage);
+#endif /* HAVE_PABLO */
+  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 */
+    intn  ret_value = SUCCEED;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRreadimage);
+#endif /* HAVE_PABLO */
+    /* 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);
+
+#ifdef QAK
+fprintf(stderr,"%s: riid=%ld\n",FUNC,(long)riid);
+fprintf(stderr,"%s: start={%ld,%ld}\n",FUNC,(long)start[XDIM],(long)start[YDIM]);
+fprintf(stderr,"%s: stride={%ld,%ld}\n",FUNC,(long)stride[XDIM],(long)stride[YDIM]);
+fprintf(stderr,"%s: count={%ld,%ld}\n",FUNC,(long)count[XDIM],(long)count[YDIM]);
+fprintf(stderr,"%s: data=%p\n",FUNC,data);
+#endif /* QAK */
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    gr_ptr=ri_ptr->gr_ptr;
+    hdf_file_id=gr_ptr->hdf_file_id;
+
+    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);
+#ifdef QAK
+printf("%s: file_nt_subclass=%x, platnumsubclass=%x\n",FUNC,(unsigned)ri_ptr->img_dim.file_nt_subclass,(unsigned)platnumsubclass);
+printf("%s: pixel_disk_size=%u\n",FUNC,(unsigned)pixel_disk_size);
+#endif /* QAK */
+    convert = (pixel_disk_size != pixel_mem_size) || (ri_ptr->img_dim.file_nt_subclass != platnumsubclass);  /* is conversion necessary? */
+
+#ifdef QAK
+fprintf(stderr,"%s: solid_block=%d\n",FUNC,(int)solid_block);
+fprintf(stderr,"%s: whole_image=%d\n",FUNC,(int)whole_image);
+fprintf(stderr,"%s: pixel_disk_size=%d\n",FUNC,(int)pixel_disk_size);
+fprintf(stderr,"%s: ri_ptr->img_tag=%d, ri_ptr->img_ref=%d\n",FUNC,(int)ri_ptr->img_tag,(int)ri_ptr->img_ref);
+fprintf(stderr,"%s: convert=%d\n",FUNC,(int)convert);
+#endif /* QAK */
+
+    /* 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(ri_ptr->gr_ptr->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;
+
+#ifdef QAK
+fprintf(stderr,"%s: faking an image for the user\n",FUNC);
+#endif /* QAK */
+          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 */
+#ifdef QAK
+printf("%s: going after a fill value\n",FUNC);
+#endif /* QAK */
+                if(GRgetattr(riid,at_index,fill_pixel)==FAIL)
+                    HGOTO_ERROR(DFE_BADATTR,FAIL);
+#ifdef QAK
+printf("%s: got the fill value\n",FUNC);
+#endif /* QAK */
+            } /* 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 */
+#ifdef QAK
+fprintf(stderr,"%s: image exists\n",FUNC);
+#endif /* QAK */
+          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;
+
+#ifdef QAK
+printf("%s: check 1 whole_image=%d, solid_block=%d\n",FUNC,(int)whole_image,(int)solid_block);
+#endif /* QAK */
+          if(GRIgetaid(ri_ptr, DFACC_READ)==FAIL)
+              HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+#ifdef QAK
+printf("%s: check 1.1\n",FUNC);
+#endif /* QAK */
+          if(whole_image==TRUE)
+            { /* read the whole image in */
+#ifdef QAK
+fprintf(stderr,"%s: check 1.3, tag=%u, ref=%u\n",FUNC,(unsigned)ri_ptr->img_tag,(unsigned)ri_ptr->img_ref);
+#endif /* QAK */
+#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 */
+            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 */
+
+#ifdef QAK
+fprintf(stderr,"%s: check 1.5\n",FUNC);
+#endif /* QAK */
+                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 */
+
+#ifdef QAK
+printf("%s: check 2\n",FUNC);
+#endif /* QAK */
+                      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 */
+
+#ifdef QAK
+printf("%s: check 3\n",FUNC);
+#endif /* QAK */
+                      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 */
+                  
+#ifdef QAK
+printf("%s: convert=%d\n",FUNC,(int)convert);
+#endif /* QAK */
+          if(convert)
+            { /* convert the pixel data into the HDF disk format */
+#ifdef QAK
+printf("%s: check 4\n",FUNC);
+#endif /* QAK */
+              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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRreadimage);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRendaccess);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+
+#ifdef QAK
+printf("%s: ri_ptr->ri_ref=%u, ri_ptr->rig_ref=%u\n",FUNC,(unsigned)ri_ptr->ri_ref,(unsigned)ri_ptr->rig_ref);
+printf("%s: ri_ptr->img_tag=%u, ri_ptr->img_ref=%u\n",FUNC,(unsigned)ri_ptr->img_tag,(unsigned)ri_ptr->img_ref);
+printf("%s: ri_ptr->meta_mod=%u, ri_ptr->data_mod=%u\n",FUNC,(unsigned)ri_ptr->meta_modified,(unsigned)ri_ptr->data_modified);
+#endif /* QAK */
+
+    /* 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_NOVS, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRendaccess);
+#endif /* HAVE_PABLO */
+  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? */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRidtoref);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRidtoref);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRreftoindex);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRreftoindex);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRreqlutil);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRreqlutil);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+     TRACE_ON(PABLO_mask,ID_GRreqimageil);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRreqimageil);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRgetlutid);
+#endif /* HAVE_PABLO */
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRgetlutid);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRluttoref);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+       TRACE_OFF(PABLO_mask, ID_GRluttoref);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRgetlutinfo);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRgetlutinfo);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRwritelut);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 && 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRwritelut);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRreadlut);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRreadlut);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRsetexternalfile);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+   TRACE_OFF(PABLO_mask, ID_GRsetexternalfile);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRsetaccesstype);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRsetaccesstype);
+#endif /* HAVE_PABLO */
+  return ret_value;
+} /* end GRsetaccesstype() */
+
+/*--------------------------------------------------------------------------
+ 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
+        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)
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRsetcompress(int32 riid,int32 comp_type,comp_info *cinfo)
+{
+    CONSTR(FUNC, "GRsetcompress");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = SUCCEED;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRsetcompress);
+#endif /* HAVE_PABLO */
+    /* 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);
+    
+    /* Check the validity of the compression type */
+    if ((comp_type < 0 || 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_NOVS, 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);
+
+    /* 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 */
+
+    /* Store compression parameters */
+    HDmemcpy(&(ri_ptr->cinfo),cinfo,sizeof(comp_info));
+
+    /* Mark the image as needing to be a buffered special element */
+    ri_ptr->use_buf_drvr=1;
+
+#ifdef QAK
+printf("%s: check 1.0, acc_perm=%d\n",FUNC,ri_ptr->acc_perm);
+#endif /* QAK */
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRsetcompress);
+#endif /* HAVE_PABLO */
+  return ret_value;
+} /* end GRsetcompress() */
+
+/*--------------------------------------------------------------------------
+ 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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRsetattr);
+#endif /* HAVE_PABLO */
+    /* clear error stack and check validity of args */
+    HEclear();
+
+#ifdef QAK
+printf("%s: entering\n",FUNC);
+printf("%s: id=%ld, name=%p, data=%p, count=%ld\n",FUNC,(long)id,name,data,(long)count);
+#endif /* QAK */
+    /* 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)
+      {
+#ifdef QAK
+printf("%s: got a GRID\n",FUNC);
+#endif /* QAK */
+          /* locate GR's object in hash table */
+          if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_NOVS, FAIL);
+
+          hdf_file_id=gr_ptr->hdf_file_id;
+          search_tree=gr_ptr->gattree;
+          update_flag=&(gr_ptr->gattr_modified);
+#ifdef QAK
+printf("%s: gr_ptr->gattr_count=%ld\n",FUNC,(long)gr_ptr->gattr_count);
+#endif /* QAK */
+          update_count=&(gr_ptr->gattr_count);
+      } /* end if */
+    else if (HAatom_group(id)==RIIDGROUP)
+      {
+          /* Need this flag for later */
+          is_riid=TRUE;
+
+#ifdef QAK
+printf("%s: got a RIID, riid=%lx\n",FUNC,(long unsigned)id);
+#endif /* QAK */
+          /* locate RI's object in hash table */
+          if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_NOVS, FAIL);
+          gr_ptr=ri_ptr->gr_ptr;
+#ifdef QAK
+printf("%s: got a RIID, ri_ptr=%p, gr_ptr=%p\n",FUNC,ri_ptr,gr_ptr);
+#endif /* QAK */
+
+          hdf_file_id=gr_ptr->hdf_file_id;
+#ifdef QAK
+printf("%s: hdf_file_id=%lx\n",FUNC,(long unsigned)hdf_file_id);
+#endif /* QAK */
+          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);
+
+#ifdef QAK
+printf("%s: check 1, search_tree=%p\n",FUNC,search_tree);
+#endif /* QAK */
+    /* Search for an attribute with the same name */
+    if((t = (void **)tbbtfirst((TBBT_NODE *)*search_tree))!=NULL)
+      {
+#ifdef QAK
+printf("%s: t=%p\n",FUNC,t);
+#endif /* QAK */
+          do {
+              at_ptr=(at_info_t *)*t;
+#ifdef QAK
+printf("%s: at_ptr=%p\n",FUNC,at_ptr);
+if(at_ptr!=NULL)
+{
+    printf("%s: at_ptr->name=%p, at_ptr->index=%ld, name=%p\n",FUNC,at_ptr->name,(long)at_ptr->index,name);
+    if(at_ptr->name!=NULL && name!=NULL)
+        printf("%s: at_ptr->name=%s, name=%s\n",FUNC,at_ptr->name,name);
+}
+#endif /* QAK */
+              if(at_ptr!=NULL && HDstrcmp(at_ptr->name,name)==0)  /* ie. the name matches */
+                {
+                    found=TRUE;
+                    break;
+                } /* end if */
+#ifdef QAK
+printf("%s: check 1.9: found=%d\n",FUNC,found);
+#endif /* QAK */
+          } while((t= (void **)tbbtnext((TBBT_NODE *)t))!=NULL);
+      } /* end if */
+
+#ifdef QAK
+printf("%s: check 2: found=%d\n",FUNC,found);
+#endif /* QAK */
+    if(found==TRUE) /* attribute already exists, just update it */
+      {
+          int32 new_at_size;          /* size in bytes of the new attribute data */
+
+#ifdef QAK
+printf("%s: found existing attribute\n",FUNC);
+#endif /* QAK */
+          /* 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 */
+      {
+#ifdef QAK
+printf("%s: check 2.5: creating new attribute\n",FUNC);
+#endif /* QAK */
+        if((at_ptr=(at_info_t *)HDmalloc(sizeof(at_info_t)))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+        /* Fill in fields for the new attribute */
+#ifdef QAK
+printf("%s:1: gr_ptr->gattr_count=%ld\n",FUNC,(long)gr_ptr->gattr_count);
+#endif /* QAK */
+        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 */
+#ifdef QAK
+printf("%s: hdf_file_id=%lx\n",FUNC,(long unsigned)hdf_file_id);
+#endif /* QAK */
+              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 */
+#ifdef QAK
+printf("%s:2: gr_ptr->gattr_count=%ld\n",FUNC,(long)gr_ptr->gattr_count);
+#endif /* QAK */
+      } /* 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 */
+
+#ifdef QAK
+printf("%s: check 3\n",FUNC);
+#endif /* QAK */
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRsetattr);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRattrinfo);
+#endif /* HAVE_PABLO */
+    /* 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)
+      {
+#ifdef QAK
+printf("%s: found a GRID\n",FUNC);
+#endif /* QAK */
+          /* locate GR's object in hash table */
+          if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_NOVS, 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)
+      {
+#ifdef QAK
+printf("%s: found a RIID\n",FUNC);
+#endif /* QAK */
+          /* locate RI's object in hash table */
+          if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRattrinfo);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRgetattr);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRgetattr);
+#endif /* HAVE_PABLO */
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRfindattr);
+#endif /* HAVE_PABLO */
+    /* 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_NOVS, 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_GRfindattr);
+#endif /* HAVE_PABLO */
+  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);
+
+#ifdef QAK
+printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+    /* 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;
+
+#ifdef QAK
+printf("%s: check 2.0\n",FUNC);
+#endif /* QAK */
+    /* Test if the tag/ref pair has been assigned yet */
+    if(ri_ptr->img_tag==DFTAG_NULL || ri_ptr->img_ref==DFREF_WILDCARD)
+      {
+#ifdef QAK
+printf("%s: check 2.1\n",FUNC);
+#endif /* QAK */
+
+        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))
+      {
+#ifdef QAK
+printf("%s: check 2.5\n",FUNC);
+#endif /* QAK */
+        /* Close the old AID (which only had read permission) */
+        Hendaccess(ri_ptr->img_aid);
+        ri_ptr->img_aid=0;
+      } /* end if */
+
+#ifdef QAK
+printf("%s: check 3.0\n",FUNC);
+#endif /* QAK */
+    /* Check if we are the first to open the AID */
+    if(ri_ptr->img_aid==0)
+      {
+#ifdef QAK
+printf("%s: check 4.0\n",FUNC);
+#endif /* QAK */
+        /* Go get the AID */
+        if(ri_ptr->comp_img)
+          { /* Need to create the compressed data element */
+#ifdef QAK
+printf("%s: check 5.0\n",FUNC);
+#endif /* QAK */
+            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 */
+
+#ifdef QAK
+printf("%s: check 6.0\n",FUNC);
+#endif /* QAK */
+
+                pixel_size=(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize(ri_ptr->img_dim.nt));
+                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 */
+#ifdef QAK
+printf("%s: check 7.0\n",FUNC);
+#endif /* QAK */
+                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 */
+#ifdef QAK
+printf("%s: check 8.0\n",FUNC);
+#endif /* QAK */
+        if(ri_ptr->use_buf_drvr)
+          { /* Convert to buffered special element if needed */
+#ifdef QAK
+printf("%s: check 9.0\n",FUNC);
+#endif /* QAK */
+            if(HBconvert(ri_ptr->img_aid)==FAIL)
+                HGOTO_ERROR(DFE_CANTINIT,FAIL);
+          } /* end if */
+        ri_ptr->acc_perm=acc_perm;
+      } /* end if */
+#ifdef QAK
+printf("%s: check 10.0\n",FUNC);
+#endif /* QAK */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        ri_ptr->img_aid=0;
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end GRIupdatemeta() */
+
+/*--------------------------------------------------------------------------
+ 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 */
+    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 HAVE_PABLO
+	TRACE_ON(PABLO_mask,ID_GRsetchunk);
+#endif /* HAVE_PABLO */
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"GRsetchunk: called  \n");
+#endif
+    /* 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_NOVS, 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):
+          cdef  = (HDF_CHUNK_DEF *)&chunk_def;
+          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 */
+          break;
+      case (HDF_CHUNK | HDF_NBIT): /* don't support NBIT for GRs */
+          ret_value = FAIL;
+          goto done;
+      default:
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 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)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 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;
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"GRsetchunk: ri_ptr->img_dim.xdim=%d\n",ri_ptr->img_dim.xdim);
+    fprintf(stderr,"GRsetchunk: ri_ptr->img_dim.ydim=%d\n",ri_ptr->img_dim.ydim);
+    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,"GRsetchunk: 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,"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);
+#ifdef QAK
+                printf("%s: check 6.6, found a fill value, nt=%d, ncomps=%d\n",FUNC,(int)ri_ptr->img_dim.nt,(int)ri_ptr->img_dim.ncomps);
+#endif /* QAK */
+                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,"GRsetchunk: 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 specail 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);
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_GRsetchunk);
+#endif /* HAVE_PABLO */
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRgetchunkinfo);
+#endif /* HAVE_PABLO */
+
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_GRgetchunkinfo);
+#endif /* HAVE_PABLO */
+    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 GRwritedata() when this information is known. This
+     routine has less overhead and is much faster than using GRwritedata().
+
+     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;
+    intn       switch_interlace = FALSE;/* whether the memory interlace needs to be switched around */
+    intn       ret_value = SUCCEED;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRwritechunk);
+#endif /* HAVE_PABLO */
+
+    /* 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_NOVS, 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)
+            {  /* 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);
+#ifdef QAK
+printf("%s: file_nt_subclass=%x, platnumsubclass=%x\n",FUNC,(unsigned)ri_ptr->img_dim.file_nt_subclass,(unsigned)platnumsubclass);
+printf("%s: pixel_mem_size=%u, pixel_disk_size=%u\n",FUNC,(unsigned)pixel_mem_size,(unsigned)pixel_disk_size);
+#endif /* QAK */
+                     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);
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_GRwritechunk);
+#endif /* HAVE_PABLO */
+    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;
+    intn       switch_interlace = FALSE;/* whether the memory interlace needs to be switched around */
+    intn       ret_value = SUCCEED;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRreadchunk);
+#endif /* HAVE_PABLO */
+
+    /* 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_NOVS, 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)
+            {  /* 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);
+#ifdef QAK
+printf("%s: file_nt_subclass=%x, platnumsubclass=%x\n",FUNC,(unsigned)ri_ptr->img_dim.file_nt_subclass,(unsigned)platnumsubclass);
+printf("%s: pixel_mem_size=%u, pixel_disk_size=%u\n",FUNC,(unsigned)pixel_mem_size,(unsigned)pixel_disk_size);
+#endif /* QAK */
+                       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);
+
+#ifdef HAVE_PABLO
+	TRACE_OFF(PABLO_mask,ID_GRreadchunk);
+#endif /* HAVE_PABLO */
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_GRsetchunkcache);
+#endif /* HAVE_PABLO */
+
+    /* 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_NOVS, 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_GRsetchunkcache);
+#endif /* HAVE_PABLO */
+    return ret_value;
+} /* GRsetchunkcache() */
+
+/*
+
+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)
+
+*/

Added: packages/libhdf4/branches/upstream/current/hdf/src/mfgr.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mfgr.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mfgr.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,143 @@
+/****************************************************************************
+ * 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: mfgr.h,v 1.21 1999/02/06 03:21:48 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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
+
+/* 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 */
+    int32 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 */
+} 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/mfgrf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mfgrf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mfgrf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1214 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.15 $";
+#endif
+
+/* $Id: mfgrf.c,v 1.15 2000/08/29 13:55:36 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 [Later]
+ *  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"
+
+/* 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    = 6
+ *          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     */
+    int32 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:    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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/mfgrff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mfgrff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mfgrff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,369 @@
+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: mfgrff.f,v 1.8 2000/02/15 19:50:10 epourmal Exp $
+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    = 6
+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
+
+           

Added: packages/libhdf4/branches/upstream/current/hdf/src/mstdio.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mstdio.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mstdio.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,348 @@
+
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.17 $";
+#endif
+
+/* $Id: mstdio.c,v 1.17 1999/01/13 19:18:27 koziol Exp $ */
+
+/*
+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() */

Added: packages/libhdf4/branches/upstream/current/hdf/src/mstdio.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/mstdio.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/mstdio.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,89 @@
+
+/****************************************************************************
+ * 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: mstdio.h,v 1.12 1997/10/24 21:01:07 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+ * 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/patchlevel.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/patchlevel.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/patchlevel.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2 @@
+
+#define PATCHLEVEL  0

Added: packages/libhdf4/branches/upstream/current/hdf/src/src.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/src.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/src.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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,v 1.33 1999/02/06 03:21:48 koziol Exp $
+#
+# ##################################################################
+#
+#           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
+
+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 
+
+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
+
+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)
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/sys_dir_mac.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/sys_dir_mac.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/sys_dir_mac.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,48 @@
+/****************************************************************************************
+ *
+ *	File:		sys_dirent.h
+ *	Created:	7/3/93		By:	George T. Talbot
+ *	Purpose:	Implements UNIX-like directory reading for the Macintosh.
+ *				Filesystem-independent directory information.
+ *
+ *	Modifications:
+ *
+ *	Notes:
+ *			1) These routines will NOT work under A/UX.
+ *			2) WD = working directory
+ *			3) CD = change directory
+ *			4) FS = file system
+ *			5) Mac filesystems allow spaces as part of pathnames!
+ *			6) All routines which return a path use the default Macintosh path separator,
+ *			   a colon (":").
+ *
+ ****************************************************************************************/
+
+/* $Id: sys_dir_mac.h,v 1.3 1998/02/02 21:44:51 smitchel Exp $ */
+
+#ifndef	__sys_dirent_h
+#define	__sys_dirent_h
+
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+
+#include <Files.h>
+
+struct	dirent {
+	/* PRIVATE FIELDS.  Use fields after PUBLIC	*/
+	struct dirent	**next;
+	FSSpec			fsp;
+	
+	/*	PUBLIC.	*/
+	long			d_off;					/* index (to seekdir()) of this entry */	
+	long			d_fileno;				/* File number (dirID) of this entry	*/
+#define	d_parent	fsp.parID				/* File number (dirID) of parent	*/
+#define	d_reclen	sizeof(struct dirent)	/* Size of this record	*/
+#define	d_namelen	strlen(fsp.name)		/*	Length of the name	*/
+#define	d_name		fsp.name				/*	Name	*/
+#define	d_volume	fsp.vRefNum
+};
+
+#define	DIRSIZ(dp) sizeof(struct dirent)
+
+#endif /* defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)  */
+#endif	/* !__sys_dirent_h */

Added: packages/libhdf4/branches/upstream/current/hdf/src/tbbt.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/tbbt.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/tbbt.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1042 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.44 $";
+#endif
+
+/* $Id: tbbt.c,v 1.44 2000/08/29 13:55:36 koziol Exp $ */
+
+/* "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;
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C) /* Macro substitution limit on Mac */
+    kid->flags = SetFlags(kid, (1 + 2 - (side)),
+                        deep[2] - 1 - Max(deep[0], 0), HasChild(kid, side));
+#else  /* !macintosh */
+    kid->flags = (TBBT_FLAG)SetFlags(kid, Other(side),
+                        deep[2] - 1 - Max(deep[0], 0), HasChild(kid, side));
+#endif /* !macintosh */
+
+    /* 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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/tbbt.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/tbbt.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/tbbt.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,327 @@
+/****************************************************************************
+ * 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: tbbt.h,v 1.25 1998/02/02 21:44:53 smitchel Exp $ */
+
+/* "tbbt.h" -- Data types/routines for threaded, balanced, binary trees. */
+/* Extended from Knuth 6.2.3, Algorithm A */
+
+#ifndef TBBT_H
+#define TBBT_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 */
+#if defined macintosh || defined MAC || defined SYMANTEC_C     /* Macro substitution limit */
+# define  Cnt(node,s)   ( 1==(s) ? LeftCnt(node) : RightCnt(node) )
+#else                           /* !macintosh */
+# define  Cnt(node,s)   ( LEFT==(s) ? LeftCnt(node) : RightCnt(node) )
+#endif                          /* !macintosh */
+# 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 */
+
+    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.
+ */
+
+    TBBT_NODE  *tbbtdfind
+                (TBBT_TREE * tree, VOIDP key, TBBT_NODE ** pp);
+    TBBT_NODE  *tbbtfind
+                (TBBT_NODE * root, VOIDP key, intn (*cmp) (VOIDP, VOIDP, intn),
+                 intn arg, TBBT_NODE ** pp);
+    TBBT_NODE  *tbbtdless
+                (TBBT_TREE * tree, VOIDP key, TBBT_NODE ** pp);
+    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.
+ */
+
+    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)'.
+ */
+
+    TBBT_NODE  *tbbtdins
+                (TBBT_TREE * tree, VOIDP item, VOIDP key);
+    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().
+ */
+
+    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 );
+ */
+
+    TBBT_NODE  *tbbtfirst
+                (TBBT_NODE * root);
+    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 *)
+ */
+
+    TBBT_NODE  *tbbtnext
+                (TBBT_NODE * node);
+    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.
+ */
+
+    TBBT_TREE  *tbbtdfree
+                (TBBT_TREE * tree, VOID(*fd) (VOIDP), VOID(*fk) (VOIDP));
+    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.
+ */
+
+    VOID        tbbtprint
+                (TBBT_NODE * node);
+/* Prints out the data in a node */
+
+    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
+ */
+
+    long        tbbtcount
+                (TBBT_TREE * tree);
+
+/* Terminate the buffers used in the tbbt*() interface */
+    intn tbbt_shutdown(void);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* TBBT_H */

Added: packages/libhdf4/branches/upstream/current/hdf/src/trace.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/trace.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/trace.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,10 @@
+#ifdef HAVE_PABLO 
+#include "ProcIDs.h"
+#else
+#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 )
+#endif /* HAVE_PABLO */

Added: packages/libhdf4/branches/upstream/current/hdf/src/vattr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vattr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vattr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1342 @@
+/*******************************************************************
+ * 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.                                               *
+ *                                                                 *
+ *******************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.16 $";
+#endif
+
+/* $Id: vattr.c,v 1.16 1999/06/16 21:11:12 dwells Exp $ */
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_vattr_c
+#endif
+
+/**************************************************************
+*
+* 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 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, void * values)
+*        get values of an attribute
+*   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;
+
+#ifdef PABLO
+     TRACE_ON(PABLO_mask,ID_VSfindex);
+#endif
+     
+     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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_VSfindex);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSsetattr);
+#endif /* HAVE_PABLO */
+
+     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);
+     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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSsetattr);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}  /* VSsetattr */
+/* ------------------------------------------------ 
+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;
+    
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSnattrs);
+#endif /* HAVE_PABLO */
+
+     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 */
+#ifdef HAVE_PABLO
+       TRACE_OFF(PABLO_mask, ID_VSnattrs);
+#endif /* HAVE_PABLO */
+
+  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;
+ 
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSfnattrs);
+#endif /* HAVE_PABLO */
+
+     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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VSfnattrs);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+     TRACE_ON(PABLO_mask,ID_VSfindattr);
+#endif /* HAVE_PABLO */
+
+     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;
+     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 */
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VSfindattr);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+     TRACE_ON(PABLO_mask,ID_VSattrinfo);
+#endif /* HAVE_PABLO */
+
+     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 */
+#ifdef HAVE_PABLO
+            TRACE_OFF(PABLO_mask, ID_VSattrinfo);
+#endif /* HAVE_PABLO */
+
+  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];
+
+#ifdef HAVE_PABLO
+     TRACE_ON(PABLO_mask,ID_VSgetattr);
+#endif /* HAVE_PABLO */
+
+     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 */
+#ifdef HAVE_PABLO
+             TRACE_OFF(PABLO_mask, ID_VSgetattr);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSisattr);
+#endif /* HAVE_PABLO */
+
+     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 */
+#ifdef HAVE_PABLO
+            TRACE_OFF(PABLO_mask, ID_VSisattr);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vsetattr);
+#endif /* HAVE_PABLO */
+
+    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) || (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;
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_Vsetattr);
+#endif /* HAVE_PABLO */
+  
+  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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vgetversion);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+            TRACE_OFF(PABLO_mask, ID_Vgetversion);
+#endif /* HAVE_PABLO */
+  
+  return ret_value;
+}  /* Vgetversion */
+
+/* ---------------- Vnattr ------------------------ 
+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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vnattrs);
+#endif  /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+            TRACE_OFF(PABLO_mask, ID_Vnattrs);
+#endif /* HAVE_PABLO */
+  
+  return ret_value;
+}  /* Vnattrs */
+
+/* -----------------  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vfindattr);
+#endif /* HAVE_PABLO */
+
+    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 == 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 */
+
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_Vfindattr);
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vattrinfo);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+            TRACE_OFF(PABLO_mask, ID_Vattrinfo);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}  /* Vattrinfo */
+
+/* ----------  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;
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vgetattr);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+            TRACE_OFF(PABLO_mask, ID_Vgetattr);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}  /* Vgetattr */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/vattr.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vattr.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vattr.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,33 @@
+/*****************************************************************
+ * 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.                                             *
+ *                                                               *
+ *****************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.3 $ "
+#endif
+
+/***********************************************************
+ * vattr.h - vdata/vgroup attribute interface
+ *
+ ***********************************************************  */
+
+/* $Id: vattr.h,v 1.3 1997/11/05 19:39:05 koziol Exp $ */
+
+#ifndef _VATTR_H
+#define _VATTR_H
+
+#include "hdf.h"
+#include "vg.h"
+
+
+#endif
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/vattrf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vattrf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vattrf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,362 @@
+/****************************************************************
+ * 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.                                            *
+ *                                                              *
+ ****************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.12 $";
+#endif
+
+/* $Id: vattrf.c,v 1.12 1998/02/07 22:28:41 koziol Exp $ */
+/*
+   *
+   * vattrf.c
+   * Part of the HDF Vset attribute interface.
+   *
+   * C routines (short names) to be called from fortran
+   *
+   *
+   ******************************************************/
+
+#define VSET_INTERFACE
+#include "hdf.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);
+}
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/vattrff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vattrff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vattrff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,141 @@
+C***********************************************************
+C * NCSA HDF
+C   *
+C * Software Development Group
+C   *
+C * National Center for Supercomputing Applications
+C   *
+C * University of Illinois at Urbana-Champaign
+C   *
+C * 605 E. Springfield, Champaign IL 61820
+C   *
+C *
+C   *
+C * For conditions of distribution and use, see the accompanying
+C   *
+C * hdf/COPYING file.
+C   *
+C *
+C   *
+C***************************************************
+C
+C $Id: vattrff.f,v 1.6 1997/09/11 00:16:43 acheng Exp $
+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 --------------------------------------------
+
+ 
+
+     

Added: packages/libhdf4/branches/upstream/current/hdf/src/vconv.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vconv.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vconv.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,491 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.30 $";
+#endif
+
+/* $Id: vconv.c,v 1.30 1998/02/07 22:28:42 koziol Exp $ */
+
+/* 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);
+      }
+
+    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[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 */
+
+/* ------------------------------------------------------------------ */

Added: packages/libhdf4/branches/upstream/current/hdf/src/vg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1280 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.55 $";
+#endif
+/* vg.c,v 1.15.4.1 1993/10/26 19:25:07 georgev Exp */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_vg_c
+#endif
+
+/*
+FILE  
+     vg.c
+     HDF vdata routines and some vgroup routines
+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
+     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
+     Vsetzap        -- maintaind for back compatibility
+PRIVATE FUNCTIONS
+     matchnocase    -- compares to strings, ignoring case
+
+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"
+
+/* 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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VSelts);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_VSelts);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VSgetinterlace);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_VSgetinterlace);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSsetinterlace);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_VSsetinterlace);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSgetfields);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSgetfields);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSfexist);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSfexist);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSsizeof);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSsizeof);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSsetname);
+#endif /* HAVE_PABLO */
+
+    /* 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);
+
+    /* get current length of vdata name */
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSsetname);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSsetclass);
+#endif /* HAVE_PABLO */
+
+    /* 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);
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSsetclass);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSgetname);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSgetname);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSgetclass);
+#endif /* HAVE_PABLO */
+
+    /* 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);
+
+    /* copy class name over */
+    HDstrcpy(vsclass, vs->vsclass);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSgetclass);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSinquire);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSinquire);
+#endif /* HAVE_PABLO */
+
+    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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSlone);
+#endif /* HAVE_PABLO */
+
+    /* -- 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSlone);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vlone);
+#endif /* HAVE_PABLO */
+
+    /* -- 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF( PABLO_mask, ID_Vlone );
+#endif /* HAVE_PABLO */
+
+  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;
+#ifdef LATER
+    CONSTR(FUNC, "Vfind");
+#endif
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vfind);
+#endif /* HAVE_PABLO */
+
+    /* 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 (!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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF( PABLO_mask, ID_Vfind );
+#endif /* HAVE_PABLO */
+
+  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;
+#ifdef LATER
+    CONSTR(FUNC, "VSfind");
+#endif
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSfind);
+#endif /* HAVE_PABLO */
+
+    /* 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 (!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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSfind);
+#endif /* HAVE_PABLO */
+
+  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;
+#ifdef LATER
+    CONSTR(FUNC, "Vfindclass");
+#endif
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vfindclass);
+#endif /* HAVE_PABLO */
+
+    /* 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 class to 'vgclass' */
+        if (!HDstrcmp(vgclass, v->vg->vgclass)) 
+            HGOTO_DONE((int32)(v->vg->oref));  /* found the vgroup */
+      }
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF( PABLO_mask, ID_Vfindclass);
+#endif /* HAVE_PABLO */
+
+  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;
+#ifdef LATER
+    CONSTR(FUNC, "VSfind");
+#endif
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSfindclass);
+#endif /* HAVE_PABLO */
+
+    /* 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 (!HDstrcmp(vsclass, v->vs->vsclass)) 
+            HGOTO_DONE((int32)(v->vs->oref));  /* found the vdata */
+      }
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSfindclass);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}   /* VSfindclass */
+
+/* ------------------------------- Vsetzap -------------------------------- */
+/*
+ * Vsetzap: Useless now. Maintained for back compatibility.
+ */
+VOID 
+Vsetzap(void)
+{
+}

Added: packages/libhdf4/branches/upstream/current/hdf/src/vg.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vg.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vg.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,72 @@
+/****************************************************************************
+ * 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: vg.h,v 1.53 1998/03/30 18:29:40 smitchel Exp $ */
+
+/*****************************************************************************
+*
+* 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/src/vgf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vgf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vgf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1455 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.42 $";
+#endif
+
+/* $Id: vgf.c,v 1.42 2000/02/29 21:35:30 koziol Exp $ */
+
+/*-----------------------------------------------------------------------------
+  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"
+
+/*
+   **  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);
+} 

Added: packages/libhdf4/branches/upstream/current/hdf/src/vgff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vgff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vgff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,771 @@
+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: vgff.f,v 1.24 2000/02/25 19:13:01 epourmal Exp $ 
+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

Added: packages/libhdf4/branches/upstream/current/hdf/src/vgint.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vgint.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vgint.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,296 @@
+/****************************************************************************
+ * 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: vgint.h,v 1.1 1998/02/07 21:58:30 koziol Exp $ */
+
+/*****************************************************************************
+*
+* 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 "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[VGNAMELENMAX + 1];     /* S name of this vgroup */
+      char        vgclass[VGNAMELENMAX + 1];    /* 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 attributes */
+      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);
+
+    extern vsinstance_t *VSIget_vsinstance_node(void);
+
+    extern void VSIrelease_vsinstance_node(vsinstance_t *vs);
+
+    VGROUP *VIget_vgroup_node(void);
+
+    void VIrelease_vgroup_node(VGROUP *v);
+
+    extern vginstance_t *VIget_vginstance_node(void);
+
+    extern void VIrelease_vginstance_node(vginstance_t *vg);
+
+    extern intn VPparse_shutdown(void);
+
+    extern vfile_t *Get_vfile(HFILEID f);
+
+    extern vsinstance_t *vsinst
+                (HFILEID f, uint16 vsid);
+
+    extern vginstance_t *vginst
+            (HFILEID f, uint16 vgid);
+
+    extern DYN_VWRITELIST *vswritelist
+                (int32 vskey);
+
+    extern intn vpackvg
+                (VGROUP * vg, uint8 buf[], int32 * size);
+
+    extern int32 vinsertpair
+                (VGROUP * vg, uint16 tag, uint16 ref);
+
+    extern intn vpackvs
+                (VDATA * vs, uint8 buf[], int32 * size);
+
+    extern VGROUP *VPgetinfo
+                (HFILEID f,uint16 ref);
+
+    extern VDATA *VSPgetinfo
+                (HFILEID f,uint16 ref);
+
+    extern int16 map_from_old_types
+                (intn type);
+
+    extern void trimendblanks
+                (char *ss);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* _VGINT_H */

Added: packages/libhdf4/branches/upstream/current/hdf/src/vgp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vgp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vgp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,3236 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.96 $";
+#endif
+
+/* $Id: vgp.c,v 1.96 1999/06/16 21:11:16 dwells Exp $ */
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_vgp_c
+#endif
+
+/*****************************************************************************
+
+ 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.
+ Vgetname     -- Returns the vgroup's name.
+ Vgetclass    -- Returns the vgroup's class name .
+ 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"
+
+/* 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 an 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);
+
+    /* 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);
+
+    /* 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->alist != NULL)
+                    HDfree((VOIDP) vg->alist);
+
+                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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vinitialize);
+#endif /* HAVE_PABLO */
+  
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vinitialize);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vfinish);
+#endif /* HAVE_PABLO */
+
+  /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vfinish);
+#endif /* HAVE_PABLO */
+
+  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[MAXVGNAMELEN]
+   *            char     vgclass[MAXVGNAMELEN]
+   *            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 pack 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;
+    int16 slen;
+    uint8 *bb = NULL;
+    int32 ret_value = SUCCEED;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_vpackvg);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+    slen = HDstrlen(vg->vgname);
+    UINT16ENCODE(bb, slen);
+
+    HDstrcpy((char *) bb, vg->vgname);
+    bb += slen;
+
+    /* save the vgclasslen and vgclass- omit the null */
+    slen = HDstrlen(vg->vgclass);
+    UINT16ENCODE(bb, slen);
+
+    HDstrcpy((char *) bb, vg->vgclass);
+    bb += slen;
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask,ID_vpackvg);
+#endif /* HAVE_PABLO */
+ 
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_vunpackvg);
+#endif /* HAVE_PABLO */
+
+    /* 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);
+
+          HIstrncpy(vg->vgname, (char *) bb, (int32) uint16var + 1);
+          bb += (size_t)uint16var;
+
+          /* retrieve vgclass (and its len)  */
+          UINT16DECODE(bb, uint16var);
+
+          HIstrncpy(vg->vgclass, (char *) bb, (int32) 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask,ID_vunpackvg);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vattach);
+#endif /* HAVE_PABLO */
+
+    /* 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));
+
+          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;
+          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;
+
+              /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vattach);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vdetach);
+#endif /* HAVE_PABLO */
+
+    /* 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;
+
+          need = sizeof(VGROUP)+ (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;
+      }
+
+    v->nattach--;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vdetach);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vinsert);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vinsert);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vinqtagref);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vinqtagref);
+#endif /* HAVE_PABLO */
+
+  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. */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vdeletetagref);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask,ID_Vdeletetagref);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vntagrefs);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vntagrefs);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vgettagrefs);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vgettagrefs);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vgettagref);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vgettagref);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vaddtagref);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vaddtagref);
+#endif /* HAVE_PABLO */
+
+  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.
+    truncates to max length of VGNAMELENMAX
+
+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 vgrou */) 
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "Vsetname");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_Vsetname);
+#endif /* HAVE_PABLO */
+
+    /* 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, upto VGNAMELENMAX in length */
+    HIstrncpy(vg->vgname, vgname, VGNAMELENMAX);
+
+    vg->marked = TRUE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vsetname);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}   /* Vsetname */
+
+/*******************************************************************************
+NAME
+   Vsetclass
+
+DESCRIPTION
+    assigns a class name to the VGROUP vg.
+   truncates to max length of VGNAMELENMAX
+   
+RETURNS
+    RETURN VALUES: SUCCEED for success, FAIL for failure (big suprise, eh?)
+   
+*******************************************************************************/
+int32
+Vsetclass(int32 vkey,          /* IN: vgroup key */
+          const char *vgclass  /* IN: class to set for vgroup */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "Vsetclass");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vsetclass);
+#endif /* HAVE_PABLO */
+    /* 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 class over, upto VGNAMELENMAX in length */
+    HIstrncpy(vg->vgclass, vgclass, VGNAMELENMAX);
+
+    vg->marked = TRUE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vsetclass);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vgetid);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vgetid);
+#endif /* HAVE_PABLO */
+
+  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
+   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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vgetname);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+    HDstrcpy(vgname, vg->vgname);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vgetname);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vgetclass);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+    HDstrcpy(vgclass, vg->vgclass);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vgetclass);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_Vinquire);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask,ID_Vinquire);
+#endif /* HAVE_PABLO */
+
+  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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/vhi.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vhi.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vhi.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,232 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.26 $";
+#endif
+
+/* $Id: vhi.c,v 1.26 1999/06/16 21:11:18 dwells Exp $ */
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_vhi_c
+#endif
+
+/*
+   * 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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VHstoredata);
+#endif /* HAVE_PABLO */
+    ret_value = ((int32)VHstoredatam(f, field, buf, n, datatype, vsname, vsclass, order));
+
+#ifdef HAVE_PABLO
+        TRACE_OFF( PABLO_mask, ID_VHstoredata );
+#endif /* HAVE_PABLO */
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VHstoredatam);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VHstoredatam );
+#endif /* HAVE_PABLO */
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VHmakegroup);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VHmakegroup );
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}   /* VHmakegroup */
+
+/* ------------------------------------------------------------------ */

Added: packages/libhdf4/branches/upstream/current/hdf/src/vio.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vio.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vio.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1643 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.76 $";
+#endif
+
+/* $Id: vio.c,v 1.76 1999/06/16 21:11:18 dwells Exp $ */
+
+/*****************************************************************************
+ 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;
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_vio_c
+#endif
+
+/* 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;
+
+#ifdef HAVE_PABLO
+         TRACE_ON(PABLO_mask, ID_vpackvs);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_vpackvs);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+      TRACE_ON(PABLO_mask, ID_vunpackvs);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+	#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_vunpackvs);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+        TRACE_ON(PABLO_mask, ID_VSattach);
+#endif /* HAVE_PABLO */
+    /* 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 */
+              if (w->nattach && w->vs->access == 'r')
+                  w->nattach++;
+              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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VSattach);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+        TRACE_ON(PABLO_mask, ID_VSdetach);
+#endif /* HAVE_PABLO */
+
+    /* 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);
+
+              /* 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);
+
+          /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VSdetach);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+        TRACE_ON(PABLO_mask, ID_VSappendable);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSappendable);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+        TRACE_ON(PABLO_mask, ID_VSgetid);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VSgetid);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+        TRACE_ON(PABLO_mask, ID_VSdelete);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VSdelete);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}	/* VSdelete */

Added: packages/libhdf4/branches/upstream/current/hdf/src/vparse.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vparse.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vparse.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,212 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.37 $";
+#endif
+/* $Id: vparse.c,v 1.37 1998/02/07 22:28:59 koziol Exp $ */
+
+/*****************************************************************************
+
+ 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 )
+
+#if defined(macintosh) || defined(MAC) || defined(SYMANTEC_C) || defined(DMEM)   /* Dynamic memory */
+PRIVATE char **symptr = NULL;   /* array of ptrs to tokens  ? */
+PRIVATE char **sym = NULL;      /* array of tokens ? */
+#else  /* !macintosh */
+PRIVATE char *symptr[VSFIELDMAX];       /* array of ptrs to tokens  ? */
+PRIVATE char sym[VSFIELDMAX][FIELDNAMELENMAX + 1];  /* array of tokens ? */
+#endif /* !macintosh */
+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 defined(macintosh) || defined(MAC) || defined(SYMANTEC_C) || defined(DMEM)   /* Dynamic memory */
+    intn i;
+
+    /* Lets allocate space for ptrs to tokens and tokens */
+    if (symptr == NULL)
+      {
+          symptr = (char **) HDmalloc(VSFIELDMAX * sizeof(char *));
+          if (symptr == NULL)
+              HRETURN_ERROR(DFE_NOSPACE, FAIL);
+      }
+
+    if (sym == NULL)
+      {
+          sym = (char **) HDmalloc(VSFIELDMAX * sizeof(char *));
+          if (sym == NULL)
+              HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+          for (i = 0; i < VSFIELDMAX; i++)
+            {
+                sym[i] = (char *) HDmalloc(sizeof(char) * (FIELDNAMELENMAX + 1));
+                if (sym[i] == NULL)
+                    HRETURN_ERROR(DFE_NOSPACE, FAIL);
+            }
+      }
+
+#endif /* macintosh */
+
+    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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/vrw.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vrw.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vrw.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,828 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.52 $";
+#endif
+
+/* $Id: vrw.c,v 1.52 1999/06/16 21:11:19 dwells Exp $ */
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_vrw_c
+#endif
+
+/***********************************************************************
+*
+* 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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VSseek);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF( PABLO_mask, ID_VSseek );
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VSread);
+#endif /* HAVE_PABLO */
+
+    /* 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF( PABLO_mask,ID_VSread);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VSwrite);
+#endif /* HAVE_PABLO */
+
+    /* 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 incresing 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF( PABLO_mask, ID_VSwrite );
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}	/* VSwrite */
+

Added: packages/libhdf4/branches/upstream/current/hdf/src/vsfld.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/vsfld.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/vsfld.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,989 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.66 $";
+#endif
+
+/* $Id: vsfld.c,v 1.66 1999/06/16 21:11:21 dwells Exp $ */
+
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_vsfld_c
+#endif
+
+/*****************************************************************************
+* 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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VSsetfields);
+#endif /* HAVE_PABLO */
+
+    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') && (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 */
+
+    /*
+     *   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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VSsetfields);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VSfdefine);
+#endif /* HAVE_PABLO */
+
+    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 QAK
+/* 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 /* QAK */
+
+    /* --- 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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VSfdefine);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VFnfields);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+        TRACE_OFF(PABLO_mask, ID_VFnfields);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VFfieldname);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask, ID_VFfieldname);;
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VFfieldtype);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+      TRACE_OFF(PABLO_mask, ID_VFfieldtype);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VFfieldisize);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+     TRACE_OFF(PABLO_mask, ID_VFfieldisize);
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VFfieldesize);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+  TRACE_OFF(PABLO_mask, ID_VFfieldesize);
+
+#endif /* HAVE_PABLO */
+
+  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");
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_VFfieldorder);
+#endif /* HAVE_PABLO */
+
+    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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VFfieldorder);
+#endif /* HAVE_PABLO */
+
+  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 */
+
+/*----------------------------------------------------------------- 
+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;
+
+#ifdef HAVE_PABLO
+  TRACE_ON(PABLO_mask,ID_VSfpack);
+#endif /* HAVE_PABLO */
+
+    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);
+
+#ifdef HAVE_PABLO
+    TRACE_OFF(PABLO_mask, ID_VSfpack);
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}       /* VSfpack */
+/*--------------------------------------------------------- */

Added: packages/libhdf4/branches/upstream/current/hdf/src/win32hdf.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/src/win32hdf.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/src/win32hdf.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,791 @@
+# 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 "win32hdf.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
+# PROP Target_Last_Scanned "Win32 Debug"
+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 : .\win32hdf.lib .\win32hdf.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /W3 /GX /O2 /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
+ /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"win32hdf.bsc" 
+
+.\win32hdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	.\dfkswap.obj \
+	.\vconv.obj \
+	.\dfrle.obj \
+	.\hbitio.obj \
+	.\dfjpeg.obj \
+	.\tbbt.obj \
+	.\dff.obj \
+	.\hextelt.obj \
+	.\dfsd.obj \
+	.\dfimcomp.obj \
+	.\dfkconv.obj \
+	.\crle.obj \
+	.\dfkfuji.obj \
+	.\herrf.obj \
+	.\vsfld.obj \
+	.\dfconv.obj \
+	.\dfufp2i.obj \
+	.\dfstubs.obj \
+	.\dfkvms.obj \
+	.\mstdio.obj \
+	.\dfgroup.obj \
+	.\dfp.obj \
+	.\dfutil.obj \
+	.\dfcomp.obj \
+	.\vio.obj \
+	.\mfgr.obj \
+	.\herr.obj \
+	.\dfgr.obj \
+	.\hkit.obj \
+	.\df24.obj \
+	.\dfkcray.obj \
+	.\cnone.obj \
+	.\vhi.obj \
+	.\hblocks.obj \
+	.\hdfalloc.obj \
+	.\vrw.obj \
+	.\mfan.obj \
+	.\hvblocks.obj \
+	.\vg.obj \
+	.\cnbit.obj \
+	.\dfan.obj \
+	.\cskphuff.obj \
+	.\vgp.obj \
+	.\hcomp.obj \
+	.\dfknat.obj \
+	.\vparse.obj \
+	.\dfunjpeg.obj \
+	.\hfile.obj \
+	.\cgzip.obj \
+	.\dfr8.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"win32hdf.lib" 
+
+.\win32hdf.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 : .\win32hdf.lib .\win32hdf.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /Z7 /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /W3 /GX /Z7 /Od /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D\
+ "_WINDOWS" /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"win32hdf.bsc" 
+
+.\win32hdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	.\dfkswap.obj \
+	.\vconv.obj \
+	.\dfrle.obj \
+	.\hbitio.obj \
+	.\dfjpeg.obj \
+	.\tbbt.obj \
+	.\dff.obj \
+	.\hextelt.obj \
+	.\dfsd.obj \
+	.\dfimcomp.obj \
+	.\dfkconv.obj \
+	.\crle.obj \
+	.\dfkfuji.obj \
+	.\herrf.obj \
+	.\vsfld.obj \
+	.\dfconv.obj \
+	.\dfufp2i.obj \
+	.\dfstubs.obj \
+	.\dfkvms.obj \
+	.\mstdio.obj \
+	.\dfgroup.obj \
+	.\dfp.obj \
+	.\dfutil.obj \
+	.\dfcomp.obj \
+	.\vio.obj \
+	.\mfgr.obj \
+	.\herr.obj \
+	.\dfgr.obj \
+	.\hkit.obj \
+	.\df24.obj \
+	.\dfkcray.obj \
+	.\cnone.obj \
+	.\vhi.obj \
+	.\hblocks.obj \
+	.\hdfalloc.obj \
+	.\vrw.obj \
+	.\mfan.obj \
+	.\hvblocks.obj \
+	.\vg.obj \
+	.\cnbit.obj \
+	.\dfan.obj \
+	.\cskphuff.obj \
+	.\vgp.obj \
+	.\hcomp.obj \
+	.\dfknat.obj \
+	.\vparse.obj \
+	.\dfunjpeg.obj \
+	.\hfile.obj \
+	.\cgzip.obj \
+	.\dfr8.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"win32hdf.lib" 
+
+.\win32hdf.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=.\dfkswap.c
+
+.\dfkswap.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vconv.c
+
+.\vconv.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfivms.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfrle.c
+
+.\dfrle.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hbitio.c
+
+.\hbitio.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfrig.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hbitio.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfjpeg.c
+
+.\dfjpeg.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\tbbt.c
+
+.\tbbt.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dff.c
+
+.\dff.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hextelt.c
+
+.\hextelt.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfsd.c
+
+.\dfsd.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfimcomp.c
+
+.\dfimcomp.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdf.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\tbbt.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfkconv.c
+
+.\dfkconv.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfsd.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\crle.c
+
+.\crle.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\patchlevel.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfkfuji.c
+
+.\dfkfuji.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\crle.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\herrf.c
+
+.\herrf.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vsfld.c
+
+.\vsfld.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfconv.c
+
+.\dfconv.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfufp2i.c
+
+.\dfufp2i.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfstubs.c
+
+.\dfstubs.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfkvms.c
+
+.\dfkvms.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfufp2i.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfstubs.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mstdio.c
+
+.\mstdio.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfgroup.c
+
+.\dfgroup.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfp.c
+
+.\dfp.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfutil.c
+
+.\dfutil.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mstdio.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfcomp.c
+
+.\dfcomp.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vio.c
+
+.\vio.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mfgr.c
+
+.\mfgr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfconvrt.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\herr.c
+
+.\herr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mfgr.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfgr.c
+
+.\dfgr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hkit.c
+
+.\hkit.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\df24.c
+
+.\df24.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\herr.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfkcray.c
+
+.\dfkcray.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfgr.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cnone.c
+
+.\cnone.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hkit.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vhi.c
+
+.\vhi.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hblocks.c
+
+.\hblocks.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cnone.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdfalloc.c
+
+.\hdfalloc.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vrw.c
+
+.\vrw.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mfan.c
+
+.\mfan.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hvblocks.c
+
+.\hvblocks.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vg.c
+
+.\vg.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cnbit.c
+
+.\cnbit.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mfan.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdfi.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfan.c
+
+.\dfan.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cskphuff.c
+
+.\cskphuff.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vgp.c
+
+.\vgp.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hconv.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vg.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cnbit.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfan.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cskphuff.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\df.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hcomp.c
+
+.\hcomp.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfknat.c
+
+.\dfknat.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hproto.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vparse.c
+
+.\vparse.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfunjpeg.c
+
+.\dfunjpeg.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hcomp.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfi.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hfile.c
+
+.\hfile.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vproto.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cgzip.c
+
+.\cgzip.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hfile.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dfr8.c
+
+.\dfr8.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cgzip.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hcompi.h
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/test/8bit.dat
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/test/8bit.dat
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/test/MAKE.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/MAKE.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/MAKE.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,132 @@
+$! ****************************************************************************
+$! * 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: MAKE.COM,v 1.9 1996/01/18 05:09:44 sxu Exp $
+$!
+$!
+$! File to build the test files in the HDF test suite
+$!
+$!
+$! The following constants should probably be defined
+$!   only once in the main HDF MAKE.COM...
+$!
+$ hdflib= "[-.src]df/lib,[-.jpeg]libjpeg/lib,[-.zlib]libz/lib"
+$ hdfinc= "([-.src],[-.jpeg],[-.zlib])"
+$! define/nolog hdf$include ([-.src],[-.jpeg],[-.zlib])
+$! define/nolog sys$clib sys$library:deccrtl
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC/opt/nodebug/define=VMS/include='hdfinc"
+$ define/nolog sys$clib sys$library:deccrtl
+$ else
+$ ccopt = "/opt/nodebug/define=VMS/include='hdfinc"
+$ define/nolog sys$clib sys$library:vaxcrtl
+$ endif
+$! ccopt= "/debug/noopt/include=([-.src],[-.jpeg],[-.zlib])/define=VMS"
+$! foropt= "/debug/noopt"
+$ foropt= "/opt/nodebug"
+$!
+$ type sys$input
+  **    Making testhdf **
+$ cc 'ccopt   testhdf
+$ type sys$input
+  **    Making H level test programs **
+$!
+$ cc 'ccopt   file
+$ cc 'ccopt   file1
+$ cc 'ccopt   blocks
+$ cc 'ccopt   extelt
+$ cc 'ccopt   vers
+$ cc 'ccopt   buffer
+$ type sys$input
+  **  Making C interface test programs **
+$!
+$ cc 'ccopt   rig
+$ cc 'ccopt   sdmms
+$ cc 'ccopt   sdnmms
+$ cc 'ccopt   an
+$ cc 'ccopt   anfile
+$ cc 'ccopt   slab
+$ cc 'ccopt   sdstr
+$ cc 'ccopt   litend
+$ cc 'ccopt   tvset
+$ cc 'ccopt   conv
+$ cc 'ccopt   tree
+$ cc 'ccopt   bitio
+$ cc 'ccopt   comp
+$ cc 'ccopt   man
+$ cc 'ccopt   mgr.c
+$ cc 'ccopt   nbit
+$ cc 'ccopt   tbv
+$ cc 'ccopt   gentest
+$ cc 'ccopt   tvsfpack
+$ cc 'ccopt   tvattr
+$ cc 'ccopt   chunks
+$ cc 'ccopt   macros
+$ link/nodebug testhdf,rig,sdmms,sdnmms,an,anfile,sdstr, buffer, -
+  slab,litend, file,file1,blocks,extelt,vers,tvset,conv,tree, -
+  bitio,comp,man,mgr.obj,nbit,tbv,tvsfpack,tvattr,chunks, macros, -
+  'hdflib, sys$clib/lib
+$!  'hdflib, sys$library:deccrtl/lib
+$! link gentest, 'hdflib, sys$library:deccrtl/lib
+$ link gentest, 'hdflib, sys$clib/lib
+$ type sys$input 
+  **  Making Fortran interface test programs **
+$!
+$! cc /debug/noopt/include=([-.src],[-.jpeg],[-.zlib])/define=VMS fortest.c
+$ cc 'ccopt   fortest.c
+$! cc/debug/noopt/include=([-.src],[-.jpeg],[-.zlib])/define=VMS forsupf.c
+$ cc 'ccopt   forsupf.c
+$ fortran 'foropt fortestF.f
+$ fortran 'foropt tr8F.f
+$ fortran 'foropt t24F.f
+$ fortran 'foropt tpF.f
+$ fortran 'foropt tsdmmsF.f
+$ fortran 'foropt tsdnmmsF.f
+$ fortran 'foropt tsdntF.f
+$ fortran 'foropt tsdnntF.f
+$ fortran 'foropt tanF.f
+$ fortran 'foropt tanfileF.f
+$ fortran 'foropt tstubsF.f
+$ fortran 'foropt tsdstrF.f
+$ fortran 'foropt slabwf.f
+$ fortran egfhi.f
+$ fortran 'foropt forsupff.f
+$ fortran 'foropt manf.f
+$ fortran 'foropt mgrf.f
+$ fortran 'foropt tvsetf.f
+$ fortran 'foropt tvattrf.f
+$!
+$ link fortest,forsupf, 'hdflib, sys$clib/lib
+$! link tr8f, forsupff,forsupf, 'hdflib, sys$clib/lib
+$! link t24f,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link tpf, forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link tsdmmsf,forsupff,forsupf, 'hdflib, sys$clib/lib
+$! link tsdnmmsf,forsupff,forsupf, 'hdflib, sys$clib/lib
+$! link tsdntf,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link tsdnntf,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link tanf,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link tanfilef,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link tstubsf,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link tsdstrf,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link slabwf,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link manf,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link mgrf,forsupff, forsupf, 'hdflib, sys$clib/lib
+$ link egfhi,forsupff, forsupf, 'hdflib, sys$clib/lib
+$! link tvsetf,forsupff,forsupf, 'hdflib, sys$clib/lib
+$! link tvattrf,forsupff,forsupf, 'hdflib, sys$clib/lib
+$ link fortestF, forsupff,forsupf,tr8f,t24f,tpf,tsdmmsf, -
+  tsdnmmsf,tsdntf,tsdnntf,tanf,tanfilef,tstubsf,tsdstrf, -
+  slabwf,manf,mgrf,tvsetf,tvattrf, -
+  'hdflib, sys$clib/lib
+$! delete *.obj;*
+$ exit

Added: packages/libhdf4/branches/upstream/current/hdf/test/MAKENOF.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/MAKENOF.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/MAKENOF.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,57 @@
+! ****************************************************************************
+! * 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: MAKENOF.COM,v 1.3 1993/12/01 03:44:57 sxu Exp $
+!$!
+!$!
+!$! File to build the test files in the HDF test suite
+!$!
+!$!
+!$! The following constants should probably be defined
+!$!   only once in the main HDF MAKE.COM...
+!$!
+$ define/nolog hdf$lib [-.lib]df
+$ define/nolog hdf$include [-.include]
+$ define/nolog sys$clib sys$library:vaxcrtl
+!$!
+$ type sys$input
+  **    Making testhdf **
+$ cc/define=VMS/include=hdf$include   testhdf
+$ type sys$input
+  **    Making H level test programs **
+$!
+$ cc/define=VMS/include=hdf$include   file
+$ cc/define=VMS/include=hdf$include   file1
+$ cc/define=VMS/include=hdf$include   blocks
+$ cc/define=VMS/include=hdf$include   extelt
+$ cc/define=VMS/include=hdf$include   vers
+$ type sys$input
+  **  Making C interface test programs **
+$!
+$ cc/define=VMS/include=hdf$include   rig
+$ cc/define=VMS/include=hdf$include   sdmms
+$ cc/define=VMS/include=hdf$include   sdnmms
+$ cc/define=VMS/include=hdf$include   an
+$ cc/define=VMS/include=hdf$include   anfile
+$ cc/define=VMS/include=hdf$include   slab
+$ cc/define=VMS/include=hdf$include   sdstr
+$ cc/define=VMS/include=hdf$include   litend
+$ cc/define=VMS/include=hdf$include   tvset
+$ cc/define=VMS/include=hdf$include   conv
+$ cc/define=VMS/include=hdf$include   tree
+
+$ link testhdf,rig,sdmms,sdnmms,an,anfile,sdstr,slab,litend, -
+  file, file1,blocks,extelt,vers,tvset,conv, tree,  -
+  hdf$lib/lib,sys$clib/lib
+$ type sys$input 
+  **  Making Fortran interface test programs **
+$!

Added: packages/libhdf4/branches/upstream/current/hdf/test/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,432 @@
+# ****************************************************************************
+# * 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: Makefile.in,v 1.38 1999/01/13 19:19:37 koziol Exp $
+#
+# ##################################################################
+#
+#                          ABOUT THIS MAKEFILE
+#
+# This makefile creates HDF test programs.  There are three categories
+# of test programs:
+#
+#              application layer C test programs
+#              application layer FORTRAN test programs
+#              lower level C test programs
+#
+# The application layer C test programs are:
+#
+#          trig    (8-bit, 24-bit raster image sets and palette interface)
+#          tsdnt  (scientific data sets, data only)
+#          tsdnnt (same as tdfsd_nt with native number types)
+#          tsdmms (scientific data sets, data, max/min and scales)
+#          tsdnmms(same as tdfsd_mms with native number types)
+#          tsdstr (data and dimension strings: label, unit, format and coordsys)
+#          tan     (annotations for HDF objects)
+#          tanfile (annotations for HDF files)
+#          tstubs  (emulation of old lower level i/o routines)
+#
+# The application layer FORTRAN test programs are:
+#
+#          tr8F     (8-bit raster image sets)
+#          t24F     (24-bit raster image sets)
+#          tpF      (Palettes)
+#          tsdntF   (scientific data sets, data only)
+#          tsdnntF  (same as tdfsd_nntF except all data types are native
+#                           machine number types)
+#          tsdmmsF  (scientific data sets, data, max/min and scales)
+#          tsdnmmsF (same as tdfsd_mmsF with native number types)
+#          tsdstrF  (data and dimenstrings: label, unit, format and coordsys)
+#          tanF     (annotations for HDF objects)
+#          tanfileF (annotations for HDF files)
+#          tstubsF  (emulation of old lower level i/o routines)
+#
+# Vset test programs:
+#
+#          tvset.c  (the basic vgroup and vdata creation routines)
+#          tvsfpack.c (pack/unpack field values into/from a vdata buf)
+#          egfhi.f  (Fortran version of egchi.c)
+#          tvsetf.f (Fortran version of tvset.c)
+#          tvattrf.f (Fortran version of tvattr.c)
+# The lower level C test programs are:
+#
+#              vers.c     (get version string from an HDF file)
+#              thfile     (basic i/o)
+#              terr       (error handling)
+#              thblocks   (linked blocks)
+#              thextelt   (i/o involving external files)
+#              tvers      (storing and retrieving version strings)
+#              thlinkage  (linkage of functions)
+#
+# Hyperslab C test programs
+#              slabw      (write data as 5 slabs )
+#              slab1w     (write data as first 3 of 5 slabs )
+#              slab2w     (write data as last 2 of 5 slabs )
+#              slab3w     (write data as 24 slabs i.e. each element )
+#              slab4w     (write data as 1 slab )
+#              slabwf     (write data as 5 slabs )
+#
+# Hyperslab Fortran test programs
+#              slabw      (write data as 5 slabs )
+#              slab1wf    (write data as first 3 of 5 slabs )
+#              slab2wf    (write data as last 2 of 5 slabs )
+#              slab3wf    (write data as 24 slabs i.e. each element )
+#              slab4wf    (write data as 1 slab )
+#
+# ##################################################################
+#
+#                      HOW TO USE THIS MAKEFILE
+#
+# You need libdf.a to compile any of these test programs.  You will
+# also need selected header files as described below.
+#
+# To compile the application layer C test programs, enter "make ctests".
+# If there are test programs that you do not want to compile, do this
+# by removing them from the lines "COBJS=" and "CSRCS=" below.
+# You need access to the header files indicated in the "CHDRS=" line
+# below to compile these programs.
+#
+# To compile the application layer FORTRAN test programs, enter
+# "make ftests".  You need access to the header files indicated in
+# the "FHDRS=" line below to compile these programs.
+# If there are test programs that you do not want to compile, do this
+# by removing them from the lines "FOBJS=" and "FSRCS=" below.
+#
+# To compile the lower level C test programs, enter "make htests".
+# You need access to the header files indicated in the "HHDRS=" line
+# below to compile these programs.  If there are test programs that
+# you do not want to compile, do this by removing them from the lines
+# "HOBJS=" and "HSRCS=" below.
+#
+# To remove all object files created by this makefile, enter "make clean"
+#
+# ##################################################################
+#
+#                       PORTING INSTRUCTIONS
+#
+# You must modify the lines containing the symbol "==>" to make
+# this makefile compatible with your platform.
+#
+# ##################################################################
+
+### Start of system configuration section. ####
+# Set shell so we know what it is
+SHELL = /bin/sh
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+INSTALL = $${srcroot}/install.sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+#Compilier defaults overriden by top level make
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install scripts.
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+
+# ############# End of system configuration section. ###############
+
+HDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        MACHINE="$(MACHINE)" 
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ==> where is your HDF library (libdf.a) located?
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+HDFINC= $(srcdir)/../src
+HDFLIB=$(srcdir)/../src
+HDFSRC=$(srcdir)/../src
+HDFBIN=$(srcdir)/../bin
+
+# ==> where is your JPEG library (libjpeg.a) located?
+JPEGLIB=$(srcdir)/../jpeg
+JPEGINC=$(srcdir)/../jpeg
+
+# ==> where is your PABLO include files
+PABLO_HINC= $(srcdir)/../pablo
+
+# ==> specify where to find the FMPOOL include and source files 
+FMPOOL_INC=$(srcdir)/../fmpool
+FMPOOL_SRC=$(srcdir)/../fmpool
+
+# ==> where is your zlib library (libzlib.a) located?
+ZLIBLIB=$(srcdir)/../zlib
+ZLIBINC=$(srcdir)/../zlib
+
+ALL_CFLAGS = $(CFLAGS) $(FMPOOL_FLAGS) -I$(HDFINC) -I$(JPEGINC) -I$(ZLIBINC)
+
+MANIFEST = $(DISTFILES)
+
+DISTFILES = Makefile.in bitio.dat litend.dat nbit.dat tmgr.dat win32tst.mak \
+	$(CSRCS) $(FSRCS) $(CHDRS) gentest.c
+
+CHDRS= tproto.h tutils.h
+
+CSRCS= 	rig.c sdstr.c blocks.c an.c anfile.c extelt.c file.c file1.c vers.c \
+	sdmms.c sdnmms.c slab.c litend.c tvset.c comp.c bitio.c tree.c macros.c \
+	conv.c nbit.c man.c mgr.c testhdf.c tbv.c tvsfpack.c chunks.c tvattr.c \
+    buffer.c
+
+COBJS= rig.o sdstr.o blocks.o an.o anfile.o extelt.o file.o file1.o vers.o \
+	sdmms.o sdnmms.o slab.o litend.o tvset.o comp.o bitio.o tree.o macros.o \
+	conv.o nbit.o man.o mgr.o testhdf.o tbv.o tvsfpack.o chunks.o tvattr.o \
+    buffer.o
+
+FSRCS= fortest.c fortestF.f forsupff.f forsupf.c \
+	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 \
+        tvsetf.f, tvattrf.f
+
+FOBJS = fortestF.o forsupff.o forsupf.o \
+	manf.o mgrf.o slabwf.o t24f.o tanf.o tanfilef.o tpf.o tr8f.o \
+	tsdmmsf.o tsdnmmsf.o tsdnntf.o tsdntf.o tsdstrf.o tstubsf.o  \
+        tvsetf.o tvattrf.o
+
+#CFORSUPSRCS = forsupf.c
+
+FTESTS = fortest fortestF
+
+#CFORSUPOBJS = forsupf.o
+
+TESTF = fortest.o
+
+# directory used by extelt test.
+TESTDIR = testdir
+
+all::		FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) nofortran ;; \
+	*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) rall ; \
+	esac
+
+rall::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) testhdf $(FTESTS) gentest; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" testhdf $(FTESTS) gentest; \
+	fi
+
+nofortran::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) testhdf gentest; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" testhdf gentest; \
+	fi
+
+rebuild:
+	@$(MAKE) all $(HDF_FLAGS) FRC=force_rebuild
+
+rebuildnofortran:
+	@$(MAKE) nofortran $(MFLAGS) $(HDF_FLAGS) FRC=force_rebuild
+
+# Leave this target blank with no actions, the rebuild macros above depend on it
+force_rebuild:
+
+debug: ptesthdf
+
+$(HDFLIB)/libdf.a:
+#	cd $(HDFLIB); echo Making \`$(TARG)\' in `pwd`; \        
+#	$(MAKE) $(MFLAGS) $(HDF_FLAGS) $(TARG); 
+
+$(JPEGLIB)/libjpeg.a:
+#	cd $(JPEGLIB); echo Making \`$(TARG)\' in `pwd`; \        
+#	$(MAKE) $(MFLAGS) $(HDF_FLAGS) $(TARG); 
+
+$(ZLIBLIB)/libz.a:
+#	cd $(JPEGLIB); echo Making \`$(TARG)\' in `pwd`; \        
+#	$(MAKE) $(MFLAGS) $(HDF_FLAGS) $(TARG); 
+
+#.c.o: 
+#	 $(CC) $(CFLAGS) -c -I$(HDFINC) $*.c 
+#
+.c.o: 
+	$(CC) $(ALL_CFLAGS) -c $*.c 
+
+.f.o:
+	$(FC) $(FFLAGS) -c $*.f 
+
+$(COBJS) $(TESTF) $(FTESTS): $(FRC)
+
+$(FOBJS): fortest.inc
+
+#$(FTESTS): $(FOBJS) $(CFORSUPOBJS) $(FFORSUPOBJS) $(HDFLIB)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a
+#	$(FC) $(FFLAGS) $@.o -o $@ $(CFORSUPOBJS) $(FFORSUPOBJS) $(HDFLIB)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a
+
+#$(FTESTS): $(FRC)
+
+test-hdf::		FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) test-hdfnofortran ;; \
+	*) \
+	    $(MAKE) $(MFLAGS) $(HDF_FLAGS) atest-hdf ; \
+	esac
+
+atest-hdf: testhdf $(FTESTS)
+	-$(RM) $(RMFLAGS) *.hdf 
+	./testhdf
+	-$(RM) $(RMFLAGS) *.hdf 
+	./fortest
+
+test-hdfnofortran: testhdf
+	-$(RM) $(RMFLAGS) *.hdf 
+	./testhdf
+
+test-hdffortran: $(FTESTS) fortest.sav
+	-$(RM) $(RMFLAGS) *.hdf 
+	./fortest > fortest.out
+	@cmp fortest.out fortest.sav && echo "*** Fortran tests passed ***";
+
+qtesthdf: $(COBJS) $(HDFLIB)/libdf.a
+	quantify $(CC) $(ALL_CFLAGS) -o qtesthdf $(COBJS) $(HDFSRC)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a -lm
+
+ptesthdf: $(COBJS) $(HDFLIB)/libdf.a
+	purify $(CC) $(ALL_CFLAGS) -o ptesthdf $(COBJS) $(HDFSRC)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a -lm
+
+testhdf.tc: $(COBJS) $(HDFLIB)/libdf.a
+	proof $(CC) $(ALL_CFLAGS) -o testhdf.tc $(COBJS) $(HDFLIB)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a -lm
+
+testhdf: $(COBJS) $(HDFLIB)/libdf.a
+	$(CC) $(ALL_CFLAGS) -o testhdf $(COBJS) $(HDFLIB)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a -lm
+	test -d $(TESTDIR) || mkdir $(TESTDIR)
+
+fortestF: $(FOBJS) $(HDFLIB)/libdf.a
+	$(FC) $(FFLAGS) -o $@ $(FOBJS) $(HDFLIB)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a -lm
+
+fortest: $(HDFLIB)/libdf.a fortest.c $(CHDRS)
+	$(CC) $(ALL_CFLAGS) -o fortest fortest.c $(HDFLIB)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a -lm
+
+gentest: gentest.c $(HDFLIB)/libdf.a
+	$(CC) $(ALL_CFLAGS) gentest.c -o gentest $(HDFLIB)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a -lm
+
+ftests: $(FTESTS)
+
+clean: 
+	-$(RM) $(RMFLAGS) $(COBJS) testhdf $(FOBJS) $(FTESTS) \
+	core *.hdf ptesthdf qtesthdf gentest *.o fortest.arg $(TESTDIR)/*
+
+distclean: 
+	-$(RM) $(RMFLAGS) $(COBJS) testhdf $(FOBJS) $(FTESTS) \
+	core *.hdf ptesthdf qtesthdf gentest *.o fortest.arg $(TESTDIR)/* \
+	config.status Makefile
+
+depend: 
+	makedepend -I$(HDFINC) *.c
+
+saber:	$(CSRCS)
+	 #load $(ALL_CFLAGS) $(CSRCS) 
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = hdf/test
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+help:
+	@echo ""
+	@echo "Make supports the following targets in the 'tests' directory"
+	@echo "make help    - prints this usage section"
+	@echo "make all     - (DEFAULT) makes tests"
+	@echo "make nofortran - makes HDF tests excluding fortran tests"
+	@echo "make testhdf   - makes HDF C test program "
+	@echo "make fortest   - makes HDF Fortran test program "
+	@echo "make test-hdf          - run HDF tests " 
+	@echo "make test-hdfnofortran - run HDF tests except the fortran test " 
+	@echo "make test-hdffortran   - run HDF fortran tests only " 
+	@echo "make clean     - cleans up tests (both C and Fortran)"
+	@echo "make distclean - cleans up HDF tests including"
+	@echo "                 configuration(Makefiles,config.status,..)"
+	@echo ""
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.

Added: packages/libhdf4/branches/upstream/current/hdf/test/README
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -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.
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/SETUPTEST.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/SETUPTEST.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/SETUPTEST.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,21 @@
+! ****************************************************************************
+! * 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: SETUPTEST.COM,v 1.3 1996/03/25 17:54:24 sxu Exp $
+!$ ! This file is only for VAX/VMS systems.
+!$ !
+!$ ! set up testhdf
+!$ ! change below to the hdf bin directory
+!$ ! 
+$ define/nolog hdf$test    mrlxp4$dka200:[folk.dev.hdf.test]
+$ !
+$ testhdf     :== $ hdf$test:testhdf

Added: packages/libhdf4/branches/upstream/current/hdf/test/an.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/an.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/an.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,239 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.17 $";
+#endif
+
+/* $Id: an.c,v 1.17 1996/11/11 20:39:45 koziol Exp $ */
+
+/***********************************************************
+*
+* 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            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);
+      }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/anfile.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/anfile.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/anfile.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.12 $";
+#endif
+
+/* $Id: anfile.c,v 1.12 1997/10/02 18:53:05 georgev Exp $ */
+
+#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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/bitio.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/bitio.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/bitio.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,435 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*
+   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,v 1.21 1999/02/19 23:28:57 koziol Exp $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.21 $";
+#endif
+
+#include "tproto.h"
+#include <time.h>
+
+#define TESTFILE_NAME "tbitio.hdf"
+#define DATAFILE_NAME "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(fid, FAIL, "Hopen");
+
+    bitid1 = Hstartbitwrite(fid, BITIO_TAG_1, BITIO_REF_1, 16);
+    CHECK(bitid1, FAIL, "Hstartbitwrite");
+
+    ret = Hbitappendable(bitid1);
+    RESULT("Hbitappendable");
+
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          ret = Hbitwrite(bitid1, (intn)outbuf[i], (uint32) outbuf2[i]);
+          VERIFY((uint8) ret, outbuf[i], "Hbitwrite");
+      }     /* end for */
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    bitid1 = Hstartbitread(fid, BITIO_TAG_1, BITIO_REF_1);
+    CHECK(bitid1, FAIL, "Hstartbitread");
+
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          ret = Hbitread(bitid1, (intn)outbuf[i], &inbuf2[i]);
+          VERIFY((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;
+
+    SEED((uintn) time(NULL));
+
+    MESSAGE(6, printf("Testing bitio read routines\n");
+        );
+
+    fid = Hopen(DATAFILE_NAME, DFACC_READ, 0);
+    CHECK(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_NAME, DFACC_READ, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    bitid1 = Hstartbitread(fid, DATA_TAG_1, DATA_REF_1);
+    CHECK(bitid1, FAIL, "Hstartbitread");
+
+    for (i = 0; i < DATASIZE; i++)
+      {
+          ret = Hbitread(bitid1, 8, &inbuf2[i]);
+          VERIFY(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(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(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(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(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(fid, FAIL, "Hopen");
+
+    MESSAGE(8, printf("Seek & read from start of dataset\n");
+        );
+    bitid1 = Hstartbitread(fid, BITIO_TAG_1, BITIO_REF_1);
+    CHECK(bitid1, FAIL, "Hstartbitread");
+
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          ret = Hbitseek(bitid1, (int32)(totbits[i] / 8), (intn) (totbits[i] % 8));
+          CHECK(ret, FAIL, "Hbitseek");
+          ret = Hbitread(bitid1, (intn)outbuf[i], &inbuf2[i]);
+          VERIFY((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(bitid1, FAIL, "Hstartbitread");
+
+    for (i = BUFSIZE - 1; i >= 0; i--)
+      {
+          ret = Hbitseek(bitid1, (int32)(totbits[i] / 8), (intn) (totbits[i] % 8));
+          CHECK(ret, FAIL, "Hbitseek");
+          ret = Hbitread(bitid1, (intn)outbuf[i], &inbuf2[i]);
+          VERIFY((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(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(ret, FAIL, "Hbitseek");
+          ret = Hbitwrite(bitid1, (intn)outbuf[i], (uint32) outbuf2[i]);
+          VERIFY((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(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((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(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((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(bitid1, FAIL, "Hstartbitread");
+
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          ret = Hbitseek(bitid1, (int32)(totbits[i] / 8), (intn) (totbits[i] % 8));
+          CHECK(ret, FAIL, "Hbitseek");
+          ret = Hbitread(bitid1, (intn)outbuf[i], &inbuf2[i]);
+          VERIFY((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(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((uint8) ret, 8, "Hbitwrite");
+    ret = Hbitwrite(bitid1, 8, (uint32) outbuf[1]);
+    VERIFY((uint8) ret, 8, "Hbitwrite");
+    ret = Hbitwrite(bitid1, 8, (uint32) outbuf[2]);
+    VERIFY((uint8) ret, 8, "Hbitwrite");
+    ret = Hbitwrite(bitid1, 8, (uint32) outbuf[3]);
+    VERIFY((uint8) ret, 8, "Hbitwrite");
+    ret = Hbitwrite(bitid1, 3, (uint32) outbuf[4]);
+    VERIFY((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(bitid1, FAIL, "Hstartbitread");
+
+    ret = Hbitread(bitid1, 8, &inbuf2[0]);
+    VERIFY((uint8) ret, 8, "Hbitread");
+    ret = Hbitread(bitid1, 8, &inbuf2[1]);
+    VERIFY((uint8) ret, 8, "Hbitread");
+    ret = Hbitread(bitid1, 8, &inbuf2[2]);
+    VERIFY((uint8) ret, 8, "Hbitread");
+    ret = Hbitread(bitid1, 8, &inbuf2[3]);
+    VERIFY((uint8) ret, 8, "Hbitread");
+    ret = Hbitread(bitid1, 3, &inbuf2[4]);
+    VERIFY((uint8) ret, 3, "Hbitread");
+
+    VERIFY(outbuf[0],inbuf2[0],"I/O Transfer");
+    VERIFY(outbuf[1],inbuf2[1],"I/O Transfer");
+    VERIFY(outbuf[2],inbuf2[2],"I/O Transfer");
+    VERIFY(outbuf[3],inbuf2[3],"I/O Transfer");
+    VERIFY((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();
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/bitio.dat
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/test/bitio.dat
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/test/blocks.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/blocks.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/blocks.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,311 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.16 $";
+#endif
+
+/* $Id: blocks.c,v 1.16 1997/10/25 00:56:10 koziol Exp $ */
+
+#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(fid, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid);
+    CHECK(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(ret, FAIL, "Hputelement");
+
+    aid1 = HLcreate(fid, 1000, 1, 10, 10);
+    CHECK(aid1, FAIL, "HLcreate");
+
+    ret = Hseek(aid1, (int32)HDstrlen("element 1000 1 "), DF_START);
+    CHECK(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Create a new element as a Linked Block\n");
+        );
+    aid1 = HLcreate(fid, 1000, 4, 512, 2);
+    CHECK(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(ret, FAIL, "Hendaccess");
+
+    ret = (int32)Hnewref(fid);
+    CHECK(ret, FAIL, "Hnewref");
+
+    aid1 = HLcreate(fid, 1000, 2, 128, 16);
+    CHECK(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(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(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing and re-opening file %s\n", TESTFILE_NAME);
+        );
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid);
+    CHECK(ret, FAIL, "Hnewref");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+
+    aid1 = Hstartread(fid, 1000, 1);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK(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(ret, FAIL, "Hnewref");
+
+    ret = Hnextread(aid1, 1000, DFREF_WILDCARD, DF_CURRENT);
+    CHECK(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK(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(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK(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(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK(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(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(ret, FAIL, "Hendaccess");
+
+    ret = Hendaccess(aid2);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Open a second id for file %s\n", TESTFILE_NAME);
+        );
+    fid1 = Hopen(TESTFILE_NAME, DFACC_READ, 0);
+    CHECK(fid1, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid1);
+    CHECK(ret, FAIL, "Hnewref");
+
+    MESSAGE(5, printf("Closing the files\n");
+        );
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    ret = Hclose(fid1);
+    CHECK(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Testing HLconvert function\n");
+        );
+    fid = Hopen(TESTFILE_NAME, DFACC_WRITE, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    ref = Hnewref(fid);
+    CHECK(ret, FAIL, "Hnewref");
+
+    aid = Hstartwrite(fid, HLCONVERT_TAG, ref, 5);
+    CHECK(aid, FAIL, "Hstartwrite");
+
+    ret = Hwrite(aid, 4, outbuf);
+    CHECK(ret, FAIL, "Hwrite");
+
+    ret = HLconvert(aid, 256, 10);
+    CHECK(ret, FAIL, "HLconvert");
+
+    ret = Hwrite(aid, 508, &outbuf[4]);
+    CHECK(ret, FAIL, "Hwrite");
+
+    ret = Hendaccess(aid);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    aid = Hstartread(fid, HLCONVERT_TAG, ref);
+    CHECK(aid, FAIL, "Hstartread");
+
+    ret = Hread(aid, 512, inbuf);
+    CHECK(ret, FAIL, "Hread");
+
+    ret = Hendaccess(aid);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    ret = Hclose(fid);
+    CHECK(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 */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/buffer.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/buffer.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/buffer.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,436 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*
+    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
+ */
+
+/* $Id: buffer.c,v 1.6 2000/08/29 13:55:43 koziol Exp $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.6 $";
+#endif
+
+#include <time.h>
+#include "tproto.h"
+#include "hfile.h"
+
+/* Substitute bogus value if CLOCKS_PER_SEC is unavailable */
+#ifndef CLOCKS_PER_SEC
+#define CLOCKS_PER_SEC -1
+#endif
+
+#define TESTFILE_NAME "tbuffer.hdf"
+#define EXTFILE_NAME "tbuffer.dat"
+
+/* Size of data elements to create */
+#define ELEMSIZE 16384
+
+/* 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
+
+/* 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
+clock_t read_time[NUM_TESTS][2];    /* 0 is unbuffered, 1 is buffered */
+clock_t write_time[NUM_TESTS][2];   /* 0 is unbuffered, 1 is buffered */
+
+/* I/O buffers */
+uint8 out_buf[ELEMSIZE];    /* Buffer for writing data */
+uint8 in_buf[ELEMSIZE];     /* Buffer for reading data */
+
+/* local function prototypes */
+static void init_buffer(void);
+
+/* 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 clock_t
+read_test(int32 aid)
+{
+    clock_t start_time, end_time, acc_time;     /* timing counts */
+    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 */
+                start_time=clock();
+                ret=Hread(aid,ELEMSIZE,in_buf);
+                VERIFY(ret, ELEMSIZE, "Hread");
+                end_time=clock();
+                break;
+
+            case 1:     /* Read entire buffer one byte at a time forwards */
+                start_time=clock();
+                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 */
+                end_time=clock();
+                break;
+
+            case 2:     /* Read entire buffer one byte at a time every one byte forwards */
+                start_time=clock();
+                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 */
+                end_time=clock();
+                break;
+
+            case 3:     /* Read entire buffer one byte at a time backwards */
+                start_time=clock();
+                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 */
+                end_time=clock();
+                break;
+
+            case 4:     /* Read entire buffer one byte at a time every one byte backwards */
+                start_time=clock();
+                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 */
+                end_time=clock();
+                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-start_time);
+    } /* end for */
+
+    return(acc_time);
+}   /* end read_test() */
+
+static clock_t
+write_test(int32 aid,intn num_timings)
+{
+    clock_t start_time, end_time, acc_time;     /* timing counts */
+    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 */
+                start_time=clock();
+                ret=Hwrite(aid,ELEMSIZE,out_buf);
+                VERIFY(ret, ELEMSIZE, "Hwrite");
+                end_time=clock();
+                break;
+
+            case 1:     /* Write entire buffer one byte at a time forwards */
+                start_time=clock();
+                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 */
+                end_time=clock();
+                break;
+
+            case 2:     /* Write entire buffer one byte at a time every one byte forwards */
+                start_time=clock();
+                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 */
+                end_time=clock();
+                break;
+
+            case 3:     /* Write entire buffer one byte at a time backwards */
+                start_time=clock();
+                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 */
+                end_time=clock();
+                break;
+
+            case 4:     /* Write entire buffer one byte at a time every one byte backwards */
+                start_time=clock();
+                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 */
+                end_time=clock();
+                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-start_time);
+    } /* end for */
+
+    return(acc_time);
+}   /* end read_test() */
+
+void
+test_buffer(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 */
+    int32       aid;            /* AID of element to test */
+    intn        test_num;
+    int32       ret;
+
+    MESSAGE(6, printf("Starting buffered element test\n");
+        )
+
+    /* fill the buffer with interesting data to compress */
+    init_buffer();
+
+    /* open the HDF file */
+    fid = Hopen(TESTFILE_NAME, 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 */
+                aid=HXcreate(fid,BUFF_TAG,ref_num,EXTFILE_NAME,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(6, {
+            printf("Unbuffered read time=%f seconds\n",((float)read_time[test_num][0]/CLOCKS_PER_SEC));
+            printf("Unbuffered write time=%f seconds\n",((float)write_time[test_num][0]/CLOCKS_PER_SEC));
+            printf("Buffered read time=%f seconds\n",((float)read_time[test_num][1]/CLOCKS_PER_SEC));
+            printf("Buffered write time=%f seconds\n",((float)write_time[test_num][1]/CLOCKS_PER_SEC));
+        }
+            )
+
+      }     /* end for */
+
+    /* close the HDF file */
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    /* Clean up files created */
+    remove(EXTFILE_NAME);
+
+    MESSAGE(6, printf("Finished buffered element test\n");
+        )
+}   /* end test_buffer() */

Added: packages/libhdf4/branches/upstream/current/hdf/test/chunks.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/chunks.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/chunks.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2519 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.18 $";
+#endif
+
+/* $Id: chunks.c,v 1.18 1997/11/05 19:39:19 koziol Exp $ */
+
+/*
+ * 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};
+#ifdef QAK
+static    uint8      cptr0[4] = {0,1,4,5};
+#endif /* QAK */
+
+/* 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(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(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+
+    ret = Hclose(fid);
+    CHECK(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start write access   tag,  ref */
+    aid1 = Hstartwrite(fid, 1020, 2, 16);
+    CHECK(aid1, FAIL, "Hstartwrite");
+
+    /* Try writing to last chunk in the element */
+    dims[0] = 1;
+    dims[1] = 1;
+    ret = HMCwriteChunk(aid1, dims, cptr3);
+    CHECK(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(ret, FAIL, "HMCwriteChunk");
+
+    MESSAGE(5, printf("Wrote to 3 chunk (3of4 chunks) in file\n"););
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 2);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(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(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(aid1, FAIL, "HMCcreate");
+
+    /* Try writing to 2 chunk in the element */
+    dims[0] = 1;
+    dims[1] = 0;
+    ret = HMCwriteChunk(aid1, dims, cptr2);
+    CHECK(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(ret, FAIL, "HMCwriteChunk");
+
+    MESSAGE(5, printf("Wrote to 2nd chunk (2of4 chunks) in file\n"); );
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 3);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK(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(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(aid1, FAIL, "HMCcreate");
+
+    /* write 16 bytes out */
+    ret = Hwrite(aid1, 16, outbuf);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 5);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK(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(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(aid1, FAIL, "HMCcreate");
+
+    /* write only 112 bytes out */
+    ret = Hwrite(aid1, 112, outbuf);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 6);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(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(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(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(ret, 12, "HMCsetMaxcache");
+    
+    /* write 112 bytes out */
+    ret = Hwrite(aid1, 112, outbuf);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 7);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK(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(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(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(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(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk4);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 0;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk2);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk5);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 0;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk3);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk6);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    /* end access */
+    ret = Hendaccess(aid2);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n"););
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 12);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* start read access   tag,  ref */
+    aid2 = Hstartread(fid, 1020, 18);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(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(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(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(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(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(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(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(ret, FAIL, "Hendaccess");
+
+    /* end access and close file */
+    ret = Hendaccess(aid2);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(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  */
+#if  !(defined(UNICOS) || defined(_UNICOS) || defined(_CRAYMPP))
+
+    /* 
+       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(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(aid1, FAIL, "HMCcreate");
+
+    /* write 48 bytes out */
+    ret = Hwrite(aid1, 48, u16_data);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 14);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 48, inbuf_u16);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(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(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(aid1, FAIL, "HMCcreate");
+
+    if (aid1 == FAIL)
+      {
+        HEprint(stderr,0);
+        errors++;
+        goto done;
+      }
+
+    /* write 96 bytes out */
+    ret = Hwrite(aid1, 96, f32_data);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 15);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 96, inbuf_f32);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+#endif /*  !(defined(UNICOS) || defined(_UNICOS) || defined(_CRAYMPP)) */
+
+    /* 
+       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(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(aid1, FAIL, "HMCcreate");
+
+    /* write 5000 bytes out */
+    ret = Hwrite(aid1, 5000, outbuf);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK(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(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(ret, 0, "Hseek");
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 1000, inbuf);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(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(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(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 10);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(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(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(ret, 0, "Hseek");
+      }
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK(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(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(aid1, FAIL, "HMCcreate");
+
+    /* write 16 bytes out */
+    ret = Hwrite(aid1, 16, outbuf);
+    VERIFY(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 20);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK(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(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(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(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(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk4);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 0;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk2);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk5);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 0;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk3);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk6);
+    CHECK(ret, FAIL, "HMCwriteChunk");
+
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    /* end access */
+    ret = Hendaccess(aid2);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n"););
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 21);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* start read access   tag,  ref */
+    aid2 = Hstartread(fid, 1020, 22);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK(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(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(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(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(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(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(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(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(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(ret, FAIL, "Hendaccess");
+
+    /* end access and close file */
+    ret = Hendaccess(aid2);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK(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() */

Added: packages/libhdf4/branches/upstream/current/hdf/test/comp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/comp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/comp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,485 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*
+   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,v 1.23 1999/01/13 19:19:38 koziol Exp $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.23 $";
+#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(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(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(ret, FAIL, "Hclose");
+
+    /* free the input and output buffers */
+    free_buffers();
+
+    MESSAGE(6, printf("Finished compression test\n");
+        )
+}   /* end test_comp() */

Added: packages/libhdf4/branches/upstream/current/hdf/test/conv.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/conv.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/conv.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,924 @@
+/****************************************************************************
+ * 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: conv.c,v 1.23 1996/11/11 20:39:51 koziol Exp $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.23 $";
+#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.
+ */
+
+#ifdef UNICOS
+#include <stdlib.h>
+#endif
+#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
+
+#ifdef UNICOS
+#define TEST_SIZE 1000001
+#else
+#if defined macintosh
+#define TEST_SIZE 8001  /* so that 8*8000<=64K */
+#else
+#define TEST_SIZE 100001
+#endif
+#endif
+
+#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(src_int8,NULL,"HDmalloc");
+        	return;
+          } /* end if */
+        dst_int8=(int8 *)HDmalloc(TEST_SIZE*sizeof(int8));
+        if(dst_int8==NULL) {
+        	CHECK(dst_int8,NULL,"HDmalloc");
+        	return;
+          } /* end if */
+        dst2_int8=(int8 *)HDmalloc(TEST_SIZE*sizeof(int8));
+        if(dst2_int8==NULL) {
+            CHECK(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(src_uint8,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_uint8=(uint8 *)HDmalloc(TEST_SIZE*sizeof(uint8));
+        if(dst_uint8==NULL) {
+            CHECK(dst_uint8,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_uint8=(uint8 *)HDmalloc(TEST_SIZE*sizeof(uint8));
+        if(dst2_uint8==NULL) {
+            CHECK(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(src_int16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_int16=(int16 *)HDmalloc(TEST_SIZE*sizeof(int16));
+        if(dst_int16==NULL) {
+            CHECK(dst_int16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_int16=(int16 *)HDmalloc(TEST_SIZE*sizeof(int16));
+        if(dst2_int16==NULL) {
+            CHECK(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(src_uint16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_uint16=(uint16 *)HDmalloc(TEST_SIZE*sizeof(uint16));
+        if(dst_uint16==NULL) {
+            CHECK(dst_uint16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_uint16=(uint16 *)HDmalloc(TEST_SIZE*sizeof(uint16));
+        if(dst2_uint16==NULL) {
+            CHECK(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(src_int32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_int32=(int32 *)HDmalloc(TEST_SIZE*sizeof(int32));
+        if(dst_int32==NULL) {
+            CHECK(dst_int32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_int32=(int32 *)HDmalloc(TEST_SIZE*sizeof(int32));
+        if(dst2_int32==NULL) {
+            CHECK(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(src_uint32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_uint32=(uint32 *)HDmalloc(TEST_SIZE*sizeof(uint32));
+        if(dst_uint32==NULL) {
+            CHECK(dst_uint32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_uint32=(uint32 *)HDmalloc(TEST_SIZE*sizeof(uint32));
+        if(dst2_uint32==NULL) {
+            CHECK(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(src_float32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_float32=(float32 *)HDmalloc(TEST_SIZE*sizeof(float32));
+        if(dst_float32==NULL) {
+            CHECK(dst_float32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_float32=(float32 *)HDmalloc(TEST_SIZE*sizeof(float32));
+        if(dst2_float32==NULL) {
+            CHECK(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]););
+
+/* This amazing hack is because of the way the Cray converts numbers. */
+/*  The converted number are going to have to be checked by hand... */
+#if defined UNICOS | defined VP | (defined __alpha & !defined (__unix))
+#ifdef OLD_WAY
+        if(Verbocity>9) {
+            intn i;
+            uint8 *u8_s=(uint8 *)src_float32,
+	        *u8_d=(uint8 *)dst_float32,
+	        *u8_d2=(uint8 *)dst2_float32;
+
+            printf("src_float32:  ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_s[i]);
+            printf("\ndst_float32:  ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_d[i]);
+            printf("\ndst2_float32: ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_d2[i]);
+            printf("\n");
+        }
+#else /* OLD_WAY */
+	for(i=0; i<TEST_SIZE; i++) {
+	    if(abs(dst2_float32[i]-src_float32[i])> abs(src_float32[i]*EPS32)) {
+              printf("Error converting %s float32 values!\n",test_name[t]);
+printf("src[%d]=%lf, dst[%d]=%lf, dst2[%d]=%lf\n",i,src_float32[i],i,dst_float32[i],i,dst2_float32[i]);
+{
+            intn j;
+            uint8 *u8_s=(uint8 *)&src_float32[i],
+	        *u8_d=(uint8 *)&dst_float32[i],
+	        *u8_d2=(uint8 *)&dst2_float32[i];
+
+            printf("src_float32:  ");
+            for(j=0; j<sizeof(float32); j++)
+              printf("%.2x ",u8_s[j]);
+            printf("\ndst_float32:  ");
+            for(j=0; j<sizeof(float32); j++)
+              printf("%.2x ",u8_d[j]);
+            printf("\ndst2_float32: ");
+            for(j=0; j<sizeof(float32); j++)
+              printf("%.2x ",u8_d2[j]);
+            printf("\n");
+}
+              HEprint(stdout,0);
+              num_errs++;
+            } /* end if */
+	  } /* end for */
+#endif /* OLD_WAY */
+#else
+        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 */
+#endif
+
+        /* 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););
+
+/* This amazing hack is because of the way the Cray converts numbers. */
+/*  The converted number are going to have to be checked by hand... */
+#if defined UNICOS | defined VP | defined CONVEXNATIVE
+#ifdef OLD_WAY
+        if(Verbocity>9) {
+            intn i;
+            uint8 *u8_s=(uint8 *)src_float32,
+	        *u8_d=(uint8 *)dst_float32,
+	        *u8_d2=(uint8 *)dst2_float32;
+
+            printf("src_float32:  ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_s[i]);
+            printf("\ndst_float32:  ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_d[i]);
+            printf("\ndst2_float32: ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_d2[i]);
+            printf("\n");
+        }
+#else /* OLD_WAY */
+	for(i=0; i<(TEST_SIZE/2); i++) {
+            if(abs(dst2_float32[i]-src_float32[i])>abs(src_float32[i]*EPS32)) {
+              printf("Error converting %s float32 values!\n",test_name[t]);
+printf("src[%d]=%lf, dst[%d]=%lf, dst2[%d]=%lf\n",i,src_float32[i],i,dst_float32[i],i,dst2_float32[i]);
+{
+            intn j;
+            uint8 *u8_s=(uint8 *)&src_float32[i],
+	        *u8_d=(uint8 *)&dst_float32[i],
+	        *u8_d2=(uint8 *)&dst2_float32[i];
+
+            printf("src_float32:  ");
+            for(j=0; j<sizeof(float32); j++)
+              printf("%.2x ",u8_s[j]);
+            printf("\ndst_float32:  ");
+            for(j=0; j<sizeof(float32); j++)
+              printf("%.2x ",u8_d[j]);
+            printf("\ndst2_float32: ");
+            for(j=0; j<sizeof(float32); j++)
+              printf("%.2x ",u8_d2[j]);
+            printf("\n");
+}
+              HEprint(stdout,0);
+              num_errs++;
+            } /* end if */
+	  } /* end for */
+#endif /* OLD_WAY */
+#else
+        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 */
+#endif
+
+        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(src_float64,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_float64=(float64 *)HDmalloc(TEST_SIZE*sizeof(float64));
+        if(dst_float64==NULL) {
+            CHECK(dst_float64,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_float64=(float64 *)HDmalloc(TEST_SIZE*sizeof(float64));
+        if(dst2_float64==NULL) {
+            CHECK(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]););
+/* This amazing hack is because of the way the VMS converts numbers. */
+/*  The converted number are going to have to be checked by hand... */
+#if defined VP | defined VMS | defined CONVEXNATIVE
+#ifdef OLD_WAY
+        if(Verbocity>9) {
+            intn i;
+            uint8 *u8_s=(uint8 *)src_float64,
+	        *u8_d=(uint8 *)dst_float64,
+	        *u8_d2=(uint8 *)dst2_float64;
+
+            printf("src_float64:  ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_s[i]);
+            printf("\ndst_float64:  ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_d[i]);
+            printf("\ndst2_float64: ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_d2[i]);
+            printf("\n");
+        }
+#else /* OLD_WAY */
+	for(i=0; i<TEST_SIZE; i++) {
+	    if(abs(dst2_float64[i]-src_float64[i]) >
+		abs(src_float64[i]*EPS64)) {
+             printf("Error converting %s float64 values!\n",test_name[t]);
+printf("src[%d]=%lf, dst[%d]=%lf, dst2[%d]=%lf\n",i,src_float64[i],i,dst_float64[i],i,dst2_float64[i]);
+{
+            intn j;
+            uint8 *u8_s=(uint8 *)&src_float64[i],
+	        *u8_d=(uint8 *)&dst_float64[i],
+	        *u8_d2=(uint8 *)&dst2_float64[i];
+
+            printf("src_float64:  ");
+            for(j=0; j<sizeof(float64); j++)
+              printf("%.2x ",u8_s[j]);
+            printf("\ndst_float64:  ");
+            for(j=0; j<sizeof(float64); j++)
+              printf("%.2x ",u8_d[j]);
+            printf("\ndst2_float64: ");
+            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(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 */
+#endif /* VMS */
+
+        /* 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););
+/* This amazing hack is because of the way the VMS converts numbers. */
+/*  The converted number are going to have to be checked by hand... */
+#if defined VP | defined VMS | defined CONVEXNATIVE
+#ifdef OLD_WAY
+        if(Verbocity>9) {
+            intn i;
+            uint8 *u8_s=(uint8 *)src_float64,
+	        *u8_d=(uint8 *)dst_float64,
+	        *u8_d2=(uint8 *)dst2_float64;
+
+            printf("src_float64:  ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_s[i]);
+            printf("\ndst_float64:  ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_d[i]);
+            printf("\ndst2_float64: ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_d2[i]);
+            printf("\n");
+        }
+#else /* OLD_WAY */
+	for(i=0; i<(TEST_SIZE/2); i++) {
+            if(abs(dst2_float64[i]-src_float64[i]) >
+		 abs(src_float64[i]*EPS64)) {
+              printf("Error converting %s float64 values!\n",test_name[t]);
+printf("src[%d]=%lf, dst[%d]=%lf, dst2[%d]=%lf\n",i,src_float64[i],i,dst_float64[i],i,dst2_float64[i]);
+{
+            intn j;
+            uint8 *u8_s=(uint8 *)&src_float64[i],
+	        *u8_d=(uint8 *)&dst_float64[i],
+	        *u8_d2=(uint8 *)&dst2_float64[i];
+
+            printf("src_float64:  ");
+            for(j=0; j<sizeof(float64); j++)
+              printf("%.2x ",u8_s[j]);
+            printf("\ndst_float64:  ");
+            for(j=0; j<sizeof(float64); j++)
+              printf("%.2x ",u8_d[j]);
+            printf("\ndst2_float64: ");
+            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(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 */
+#endif
+
+        HDfree((VOIDP)src_float64);
+        HDfree((VOIDP)dst_float64);
+        HDfree((VOIDP)dst2_float64);
+      } /* end for */
+
+}   /* end test_conv() */

Added: packages/libhdf4/branches/upstream/current/hdf/test/egchi.res
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/egchi.res	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/egchi.res	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/hdf/test/egfhi.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/egfhi.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/egfhi.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+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: egfhi.f,v 1.8 1993/10/25 23:41:49 georgev Exp $
+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

Added: packages/libhdf4/branches/upstream/current/hdf/test/egfhi.res
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/egfhi.res	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/egfhi.res	2007-05-14 09:41:34 UTC (rev 808)
@@ -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  
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/extelt.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/extelt.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/extelt.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,494 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.24 $";
+#endif
+
+/* $Id: extelt.c,v 1.24 1998/12/08 21:37:50 koziol Exp $ */
+
+/*
+ * 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(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(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(aid1, FAIL, "HXcreate");
+
+    ret = Hseek(aid1, (int32)HDstrlen("element 1000 1") + 1, DF_START);
+    CHECK(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(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(aid1, FAIL, "HXcreate");
+
+    MESSAGE(5, printf("Writing 2000 bytes to file #2\n");
+        );
+    ret = Hwrite(aid1, 2000, outbuf);
+    CHECK(ret, FAIL, "Hwrite");
+
+    ret = Hendaccess(aid1);
+    CHECK(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(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(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(aid2, FAIL, "HXcreate");
+
+    ret = Hendaccess(aid2);
+    CHECK(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(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(ret, FAIL, "Hendaccess");
+
+    /* Close the file */
+    ret = Hclose(fid);
+    CHECK(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(ret, FAIL, "Hopen");
+
+    /* Verify element in file #1 */
+    aid1 = Hstartread(fid, 1000, 1);
+    CHECK(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(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(ret, FAIL, "Hendaccess");
+
+    /* Verify element in file #2 */
+    aid1 = Hstartread(fid, 1000, 4);
+    CHECK(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(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(ret, FAIL, "Hendaccess");
+
+    /* Verify overlapping element in file #3 */
+    aid1 = Hstartread(fid, 1001, 2);
+    CHECK(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(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(ret, FAIL, "Hendaccess");
+
+    /* Verify the whole element in file #3 */
+    aid1 = Hstartread(fid, 1000, 2);
+    CHECK(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(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(ret, FAIL, "Hendaccess");
+
+    /* Verify element in file #4 */
+    aid1 = Hstartread(fid, 1020, 2);
+    CHECK(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(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(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(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(ret, FAIL, "Hendaccess");
+
+    /* Second file open rest for reading */
+    fid1 = Hopen(TESTFILE_NAME, DFACC_READ, 0);
+    CHECK(fid1, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid1);
+    CHECK(ret, FAIL, "Hnewref");
+
+    /* Close first open of file */
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    /* Close second open of file */
+    ret = Hclose(fid1);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    ret = HXsetcreatedir("testdir");
+    CHECK(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(aid1, FAIL, "HXcreate");
+
+    MESSAGE(5, printf("Writing 2000 bytes to file t5.hdf\n");
+        );
+    ret = Hwrite(aid1, 2000, outbuf);
+    CHECK(ret, FAIL, "Hwrite");
+
+    MESSAGE(5, printf("Ending access to element and closing header file %s\n", 
+                      TESTFILE_NAME1);
+        );
+    ret = Hendaccess(aid1);
+    CHECK(ret, FAIL, "Hendaccess");
+
+    ret = Hclose(fid);
+    CHECK(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(fid, FAIL, "Hopen");
+
+    ret = Hgetelement(fid, (uint16) 1000, (uint16) 5, inbuf);
+    VERIFY(ret, FAIL, "Hgetelement");
+
+    ret = HXsetdir("nosuchdir|testdir");
+    CHECK(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(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(ret, FAIL, "Hclose");
+
+    /* unset the external paths directory variables */
+    ret = HXsetcreatedir(NULL);
+    CHECK(ret, FAIL, "HXsetcreatedir");
+    ret = HXsetdir(NULL);
+    CHECK(ret, FAIL, "HXsetdir");
+
+    num_errs += errors;     /* increment global error count */
+}
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/file.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/file.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/file.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,241 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.15 $";
+#endif
+
+/* $Id: file.c,v 1.15 1997/10/25 00:56:14 koziol Exp $ */
+
+/*
+   * 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(fid, FAIL, "Hopen");
+
+    ret_bool = (intn) Hishdf(TESTFILE_NAME);
+    CHECK(ret_bool, FALSE, "Hishdf");
+
+    ret = (int32)Hnewref(fid);
+    CHECK(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(ret, FAIL, "Hputelement");
+
+    ret = Hputelement(fid, (uint16) 100, (uint16) 4, outbuf, 2000);
+    CHECK(ret, FAIL, "Hputelement");
+
+    ret = (int32)Hnewref(fid);
+    CHECK(ret, FAIL, "Hnewref");
+
+    ret = Hputelement(fid, (uint16) 103, (uint16) 2,
+                  (const uint8 *) "element 103 2", (int32)HDstrlen("element 103 2") + 1);
+    CHECK(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(ret, FAIL, "Hputlement");
+
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Closing and re-opening file %s\n", TESTFILE_NAME);
+        );
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid);
+    CHECK(ret, FAIL, "Hnewref");
+
+    aid1 = Hstartread(fid, 100, 1);
+    CHECK(aid1, FAIL, "Hstartread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK(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(ret, FAIL, "Hnewref");
+
+    MESSAGE(5, printf("Testing a number of searching schemes\n");
+        );
+    ret = Hnextread(aid1, 100, DFREF_WILDCARD, DF_CURRENT);
+    CHECK(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK(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(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK(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(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK(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(ret, FAIL, "Hendaccess");
+
+    ret = Hendaccess(aid2);
+    CHECK(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(ret, FAIL, "Hnewref");
+
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    ret = Hclose(fid1);
+    CHECK(ret, FAIL, "Hclose");
+
+    ret_bool = (intn) Hishdf(TESTFILE_NAME);
+    CHECK(ret_bool, FALSE, "Hishdf");
+
+    ret_bool = (intn) Hishdf(__FILE__);
+    CHECK(ret_bool, TRUE, "Hishdf");
+
+    ret_bool = (intn) Hishdf("qqqqqqqq.qqq");   /* I sure hope it isn't there */
+    CHECK(ret, TRUE, "Hishdf");
+
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/file1.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/file1.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/file1.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,246 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.17 $";
+#endif
+
+/* $Id: file1.c,v 1.17 1998/02/02 21:46:22 smitchel Exp $ */
+
+/*
+   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"
+/* Change the define below for Maximum 'refs' tested on 
+   the Macintosh if the 'hfile1' tests starts to croak */
+#if defined macintosh || defined MAC || defined SYMANTEC_C
+#define     MAX_REF_TESTED 5000
+#else
+#define     MAX_REF_TESTED MAX_REF
+#endif
+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(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(ref, 0, "Htagnewref");
+                aid=Hstartwrite(fid,TAG1,ref,sizeof(int32));
+                CHECK(aid, FAIL, "Hstartwrite");
+                data=(int32)ref;
+                ret=Hwrite(aid,sizeof(int32),&data);
+                CHECK(ret, FAIL, "Hwrite");
+                ret=Hendaccess(aid);
+                CHECK(ret, FAIL, "Hendaccess");
+
+                /* lets be a little smatter here */
+                if (ret == FAIL)
+                    break;
+
+                /* Write out data to tag2 */
+                ref=Htagnewref(fid,TAG2);
+                CHECK(ref, 0, "Htagnewref");
+                aid=Hstartwrite(fid,TAG2,ref,sizeof(int32));
+                CHECK(aid, FAIL, "Hstartwrite");
+                data=ref<<16;
+                ret=Hwrite(aid,sizeof(int32),&data);
+                CHECK(ret, FAIL, "Hwrite");
+                ret=Hendaccess(aid);
+                CHECK(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(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(aid1, FAIL, "Hstartread");
+              ret=Hread(aid1,sizeof(int32),&data);
+              CHECK(ret, FAIL, "Hread");
+              ret=Hinquire(aid1,NULL,NULL,&ref,NULL,NULL,NULL,NULL,NULL);
+              CHECK(ret, FAIL, "Hinquire");
+              VERIFY((uint16)data,ref,"Hread");
+
+              /* Read in data from tag2 */
+              aid2=Hstartread(fid,TAG2,DFREF_WILDCARD);
+              CHECK(aid2, FAIL, "Hstartread");
+              ret=Hread(aid2,sizeof(int32),&data);
+              CHECK(ret, FAIL, "Hread");
+              ret=Hinquire(aid2,NULL,NULL,&ref,NULL,NULL,NULL,NULL,NULL);
+              CHECK(ret, FAIL, "Hinquire");
+              VERIFY((uint32)data,(((uint32)ref)<<16),"Hread");
+
+              while(Hnextread(aid1,TAG1,DFTAG_WILDCARD,DF_CURRENT)!=FAIL)
+                {
+                    ret=Hread(aid1,sizeof(int32),&data);
+                    CHECK(ret, FAIL, "Hread");
+                    ret=Hinquire(aid1,NULL,NULL,&ref,NULL,NULL,NULL,NULL,NULL);
+                    CHECK(ret, FAIL, "Hinquire");
+                    VERIFY((uint16)data,ref,"Hread");
+
+                  if(Hnextread(aid2,TAG2,DFTAG_WILDCARD,DF_CURRENT)!=FAIL)
+                    {
+                        ret=Hread(aid2,sizeof(int32),&data);
+                        CHECK(ret, FAIL, "Hread");
+                        ret=Hinquire(aid2,NULL,NULL,&ref,NULL,NULL,NULL,NULL,NULL);
+                        CHECK(ret, FAIL, "Hinquire");
+                        VERIFY((uint32)data,(((uint32)ref)<<16),"Hread");
+                    } /* end while */
+                } /* end while */
+              ret=Hendaccess(aid1);
+              CHECK(ret, FAIL, "Hendaccess");
+
+              ret=Hendaccess(aid2);
+              CHECK(ret, FAIL, "Hendaccess");
+
+              Hclose(fid);
+          } /* end if */
+      } /* end if */
+} /* end test_ref_limits() */
+
+void
+test_hfile1(void)
+{
+    test_file_limits();
+    test_ref_limits();
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/forsupf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/forsupf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/forsupf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,69 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 1.3 $";
+#endif
+
+/* $Id: forsupf.c,v 1.3 1996/06/22 23:07:24 acheng Exp $ */
+
+#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;
+#ifdef vms
+    return(4);
+#else
+    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);
+#endif
+}   /* end getverb() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    hisystem
+ * Purpose: Invoke the system call to execute cmd
+ * Inputs:  cmd -- the command to execute
+ * Returns: verbosity level on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: HDgetenv
+ *---------------------------------------------------------------------------*/
+
+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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/forsupff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/forsupff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/forsupff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,313 @@
+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: forsupff.f,v 1.11 1997/10/24 17:27:55 acheng Exp $
+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
+C For VMS uncomment next line and comment out the line after next
+C     include '[-.src]hdf.inc'
+      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
+C For VMS uncomment next line and comment out the line after next
+C     include '[-.src]hdf.inc'
+      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
+C For VMS uncomment next line and comment out the line after next
+C     include '[-.src]hdf.inc'
+      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     Print the Test banner
+C
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      subroutine hsystem(cmd)
+      implicit none
+
+      character*(*) cmd
+      integer retcode, hisystem
+
+      retcode = hisystem(cmd, len(cmd))
+      return
+      end

Added: packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/forsupffp.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/forsupffp.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/forsupffp.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,357 @@
+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: forsupffp.f,v 1.2 1998/06/12 21:54:12 epourmal Exp $
+C
+C------------------------------------------------------------------------------
+C File:     forsupffp.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
+C For VMS uncomment next line and comment out the line after next
+C     include '[-.src]hdf.inc'
+      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: VERIFY
+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 VERIFY(errval, routine, num_failed)
+      implicit none
+C For VMS uncomment next line and comment out the line after next
+C     include '[-.src]hdf.inc'
+      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: 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
+C For VMS uncomment next line and comment out the line after next
+C     include '[-.src]hdf.inc'
+      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
+C For VMS uncomment next line and comment out the line after next
+C     include '[-.src]hdf.inc'
+      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     Print the Test banner
+C
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      subroutine hsystem(cmd)
+      implicit none
+
+      character*(*) cmd
+      integer retcode
+C		integer hisystem
+      INTERFACE 
+	   INTEGER FUNCTION hisystem(cmd, cmdlen)
+	     !MS$ATTRIBUTES C, reference,alias:'_HISYSTEM' :: hisystem
+	     !DEC$ ATTRIBUTES reference :: cmd
+	     character*(*) cmd
+	     integer cmdlen
+	   END FUNCTION hisystem
+	END INTERFACE
+
+      retcode = hisystem(cmd, len(cmd))
+      return
+      end

Added: packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortest.arg
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortest.arg	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortest.arg	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,5 @@
+Cleanup del *.hdf
+Test manf
+Test mgrf
+Test vsetf
+Test vattrf

Added: packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortestFp.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortestFp.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortestFp.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,268 @@
+C $Id: fortestFp.f,v 1.1 1997/05/22 23:25:22 sxu Exp $
+C Interface to invoke tests for HDF Fortran interfaces.
+
+	Program main
+	implicit none
+	include 'fortest.inc'
+
+	integer nerror, retcode
+	character cmd*15, test*30
+
+	print *, '==========================================='
+	print *, 'HDF Library Fortran Interface Tests Started'
+	print *, '==========================================='
+
+C Default to cleanup *.hdf files and set verbosity to default value
+	CleanUp = .TRUE.
+	CleanUpCMD = 'rm -f *.hdf'
+	Verbosity = VERBO_DEF
+	nerror = 0
+
+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)
+
+	stop
+	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, 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
+
+C For VMS, un-comment the next line 
+C        read(5,11,END=100,err=100) inline
+	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
+
+C For VMS use the next three lines 
+C100	continue
+C        close(5)
+C        retcode =1
+C For VMS comment out next line
+C End of file or read error on cmdfile.  Close it either way.
+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
+C	if (param .EQ. 'slab') then
+C	    call slabwf(retcode)
+C	    return
+C	endif
+
+C	if (param .EQ. 'r24') then
+C	    call t24f(retcode)
+C	    return
+C	endif
+
+C	if (param .EQ. 'an') then
+C	    call tanf(retcode)
+C	    return
+C	endif
+
+C	if (param .EQ. 'anfile') then
+C	    call tanfilef(retcode)
+C	    return
+C	endif
+
+ 	if (param .EQ. 'manf') then
+ 	    call manf(retcode)
+ 	    return
+	endif
+
+	if (param .EQ. 'mgrf') then
+	    call mgrf(retcode)
+	    return
+	endif
+
+C	if (param .EQ. 'p') then
+C	    call tpf(retcode)
+C	    return
+C	endif
+C
+C	if (param .EQ. 'r8') then
+C	    call tr8f(retcode)
+C	    return
+C	endif
+C
+C	if (param .EQ. 'sdmms') then
+C	    call tsdmmsf(retcode)
+C	    return
+C	endif
+
+C	if (param .EQ. 'sdnmms') then
+C	    call tsdnmmsf(retcode)
+C	    return
+C	endif
+ 
+C	if (param .EQ. 'sdnnt') then
+C	    call tsdnntf(retcode)
+C	    return
+C	endif
+
+C	if (param .EQ. 'sdnt') then
+C	    call tsdntf(retcode)
+C	    return
+C	endif
+
+C	if (param .EQ. 'sdstr') then
+C	    call tsdstrf(retcode)
+C	    return
+C	endif
+ 
+	if (param .EQ. 'vsetf') then
+	    call tvsetf(retcode)
+	    return
+	endif
+
+	if (param .EQ. 'vattrf') then
+	    call tvattrf(retcode)
+	    return
+	endif
+
+c	if (param .EQ. 'stubs') then
+C	    call tstubsf(retcode)
+C	    return
+C	endif
+
+C
+	print *, 'Unknown Command: ', cmd, param
+	retcode = -1
+	return
+	end
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortestp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortestp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/fortestp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,237 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.1 $";
+#endif
+
+/* $Id: fortestp.c,v 1.1 1997/05/22 23:25:23 sxu Exp $ */
+
+#define TESTMASTER
+
+#include <stdio.h>
+#include "hdf.h"
+#include "tutils.h"
+#include "fortest.h"
+#ifdef VMS
+#include <processes.h>
+#include <string.h>
+#endif
+#define NUMOFTESTS 20
+#define VERSION "4.0beta"
+#define BUILDDATE "Wed Nov 22 1995"
+
+struct TestStruct
+  {
+      int         NumErrors;
+      char        Description[64];
+      int         SkipFlag;
+      char        Name[16];
+      char        Call[20];
+  }
+Test[NUMOFTESTS];
+
+int
+InitTest(const char *TheName, const char *TheCall, const char *TheDescr)
+{
+    static int  Index = 0;
+    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;
+    char	*cmdfilename="fortest.arg";
+    int sysret=0;
+
+/*
+    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("vattrf", "tvattrf", "");
+/*
+#ifndef DEC_ALPHA
+    num_tests=InitTest("stubs", "tstubsf", "");
+#else
+    printf("   Skipping stubs\n");
+#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);
+
+#ifdef VMS
+    {
+        char *comprocfile="fortest.com";
+
+        if ((cmdfile = fopen(comprocfile, "w")) == NULL){
+           printf("***Can't write to cmdfile(%s)***\n", comprocfile);
+           return(-1);
+        }
+        fprintf(cmdfile, "%s %s\n",
+            "DEFINE/USER_MODE SYS$INPUT", cmdfilename);
+        fprintf(cmdfile, "%s\n", "run []fortestF.exe");
+        fclose(cmdfile);
+        return(system("@fortest.com"));
+    }
+#else
+    return(system("./fortestF"));
+#endif
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/manpf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/manpf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fort_ps/manpf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,584 @@
+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: manpf.f,v 1.2 1999/04/02 18:34:33 ptlu Exp $
+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, affcreate
+      integer afwriteann, afendaccess, hopen, hclose
+c	integer afcreate
+
+C      integer dssdims, dsadata, dslref, dsgdims
+C      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 )
+
+c      integer refnum
+      integer ret
+c      integer rank, 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
+c      character pal(768)
+      character*64 TESTFILE
+
+      character*1 CR
+c      character image(ROWS, COLS), newimage(ROWS, COLS)
+c      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 ***
+ 
+C      rank = 2
+C      dimsizes(1)=ROWS 
+C      dimsizes(2)=COLS
+
+C      call gen2Dfloat(ROWS, COLS, data)
+C      call genimage(ROWS, COLS, data, image)
+
+C      ret = dssdims(rank,dimsizes)
+C      call VERIFY(ret,'dssdims',number_failed)
+
+C  *** start annotation on file ***
+      fhandle = hopen(TESTFILE,DFACC_CREATE, 0)
+      ret = fhandle
+      call VERIFY(ret,'fhanlde',number_failed)
+      ahandle = afstart(fhandle)
+      ret = ahandle
+      call VERIFY(ret,'afstart',number_failed)
+
+C  *** write file 2 labels/ 2 descriptions ***
+      anhandle = affcreate(ahandle, AN_FILE_LABEL)
+      ret = anhandle
+      call VERIFY(ret, 'affcreate', number_failed)
+      ret = afwriteann(anhandle,lab2,len(lab2))
+      call VERIFY(ret, 'afwriteann', number_failed)
+      ret = afendaccess(anhandle)
+      call VERIFY(ret, 'afendaccess', number_failed)
+
+      anhandle = affcreate(ahandle, AN_FILE_LABEL)
+      ret = anhandle
+      call VERIFY(ret, 'affcreate', number_failed)
+      ret = afwriteann(anhandle,lab1,len(lab1))
+      call VERIFY(ret, 'afwriteann', number_failed)
+      ret = afendaccess(anhandle)
+      call VERIFY(ret, 'afendaccess', number_failed)
+
+      anhandle = affcreate(ahandle, AN_FILE_DESC)
+      ret = anhandle
+      call VERIFY(ret, 'affcreate', number_failed)
+      ret = afwriteann(anhandle,desc2,len(desc2))
+      call VERIFY(ret, 'afwriteann', number_failed)
+      ret = afendaccess(anhandle)
+      call VERIFY(ret, 'afendaccess', number_failed)
+
+      anhandle = affcreate(ahandle, AN_FILE_DESC)
+      ret = anhandle
+      call VERIFY(ret, 'affcreate', number_failed)
+      ret = afwriteann(anhandle,desc1,len(desc1))
+      call VERIFY(ret, 'afwriteann', number_failed)
+      ret = afendaccess(anhandle)
+      call VERIFY(ret, 'afendaccess', number_failed)
+
+C  ***  Write data labels and descriptions ***
+
+C      call MESSAGE(VERBO_HI,
+C     +    '***  Writing labels & descriptions with SDS and RIS ***')
+
+C      do 100 j=1,REPS
+C  ***  write out scientific data set 
+C         ret = dsadata(TESTFILE, rank,dimsizes, data)
+C         call VERIFY(ret, 'dsadata', number_failed)
+
+C ****    write out annotations for 2 out of every 3 
+C         if (mod(j,3) .ne. 0) then 
+C            refnum = dslref()
+
+C ********** Write out 2 labels for each SDS *****************
+C            anhandle = afcreate(ahandle,DFTAG_SDG,refnum,AN_DATA_LABEL)
+C            ret = anhandle
+C            call VERIFY(ret, 'afcreate', number_failed)
+C            ret = afwriteann(anhandle,labsds2,len(labsds2))
+C            call VERIFY(ret, 'afwriteann', number_failed)
+C            ret = afendaccess(anhandle)
+C            call VERIFY(ret, 'afendaccess', number_failed)
+
+C            anhandle = afcreate(ahandle,DFTAG_SDG,refnum,AN_DATA_LABEL)
+C            ret = anhandle
+C            call VERIFY(ret, 'afcreate', number_failed)
+C            ret = afwriteann(anhandle,labsds,len(labsds))
+C            call VERIFY(ret, 'afwriteann', number_failed)
+C            ret = afendaccess(anhandle)
+C            call VERIFY(ret, 'afendaccess', number_failed)
+
+C *********** Write out 2 descritptions for each SDS ***********
+C            anhandle = afcreate(ahandle,DFTAG_SDG,refnum,AN_DATA_DESC)
+C            ret = anhandle
+C            call VERIFY(ret, 'afcreate', number_failed)
+C            ret = afwriteann(anhandle,descsds2,len(descsds2))
+C            call VERIFY(ret, 'afwriteann', number_failed)
+C            ret = afendaccess(anhandle)
+C            call VERIFY(ret, 'afendaccess', number_failed)
+
+C            anhandle = afcreate(ahandle,DFTAG_SDG,refnum,AN_DATA_DESC)
+C            ret = anhandle
+C            call VERIFY(ret, 'afcreate', number_failed)
+C            ret = afwriteann(anhandle,descsds,len(descsds))
+C            call VERIFY(ret, 'afwriteann', number_failed)
+C            ret = afendaccess(anhandle)
+C            call VERIFY(ret, 'afendaccess', number_failed)
+
+C         endif
+
+C         ret = d8aimg(TESTFILE, image, COLS, ROWS, 0)
+C         call VERIFY(ret, 'd8aimg', number_failed)
+C         refnum = DFR8lastref()
+
+C ********** Write out 2 labels for each Image *****************
+C          anhandle = afcreate(ahandle, DFTAG_RIG, refnum, AN_DATA_LABEL)
+C          ret = anhandle
+C          call VERIFY(ret, 'afcreate', number_failed)
+C          ret = afwriteann(anhandle,labris2,len(labris2))
+C          call VERIFY(ret, 'afwriteann', number_failed)
+C          ret = afendaccess(anhandle)
+C          call VERIFY(ret, 'afendaccess', number_failed)
+
+C          anhandle = afcreate(ahandle, DFTAG_RIG, refnum, AN_DATA_LABEL)
+C          ret = anhandle
+c          call VERIFY(ret, 'afcreate', number_failed)
+c          ret = afwriteann(anhandle,labris,len(labris))
+c          call VERIFY(ret, 'afwriteann', number_failed)
+c          ret = afendaccess(anhandle)
+c          call VERIFY(ret, 'afendaccess', number_failed)
+
+C *********** Write out 2 descritptions for each Image ***********
+c          anhandle = afcreate(ahandle, DFTAG_RIG, refnum, AN_DATA_DESC)
+c          ret = anhandle
+c          call VERIFY(ret, 'afcreate', number_failed)
+c          ret = afwriteann(anhandle,descris2,len(descris2))
+c          call VERIFY(ret, 'afwriteann', number_failed)
+c          ret = afendaccess(anhandle)
+c          call VERIFY(ret, 'afendaccess', number_failed)
+
+c          anhandle = afcreate(ahandle, DFTAG_RIG, refnum, AN_DATA_DESC)
+c          ret = anhandle
+c          call VERIFY(ret, 'afcreate', number_failed)
+c          ret = afwriteann(anhandle,descris,len(descris))
+c          call VERIFY(ret, 'afwriteann', number_failed)
+c          ret = afendaccess(anhandle)
+c          call VERIFY(ret, 'afendaccess', number_failed)
+
+c  100 continue
+
+C ******* End writing annotatons **********
+      ret = afend(ahandle)
+      call VERIFY(ret, 'afend', number_failed)
+      ret = hclose(fhandle)
+      call VERIFY(ret, 'hclose', number_failed)
+
+
+C********  Read data labels and descriptions *********
+c      call MESSAGE(VERBO_HI,
+c     +    '*** Reading labels and descriptions for SDS and RIS ***')
+
+c      do 200 j=1,REPS
+c          ret = dsgdims(TESTFILE, rank,dimsizes,3)
+c          call VERIFY(ret, 'dsgdims', number_failed)
+c          refnum = dslref()
+
+C ******  read in annotations for 2 out of every 3 
+c          if (mod(j,3) .ne. 0) then
+c              call man_check_lab_desc(TESTFILE, DFTAG_SDG, refnum, 
+c     *                            labsds, descsds, numberfailed)
+c
+c              call man_check_lab_desc(TESTFILE, DFTAG_SDG, refnum, 
+c     *                            labsds2, descsds2, numberfailed)
+c          endif
+
+C ****    read annotations for images
+c          ret = d8gimg(TESTFILE, newimage, COLS, ROWS, pal)
+c          call VERIFY(ret, 'd8gimg', number_failed)
+c          refnum = DFR8lastref()
+c          call man_check_lab_desc(TESTFILE, DFTAG_RIG, refnum, 
+c     *                        labris, descris, numberfailed)
+c
+c          call man_check_lab_desc(TESTFILE, DFTAG_RIG, refnum, 
+c     *                        labris2, descris2, numberfailed)
+      
+c  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 )
+
+      integer  inlablen, indesclen, ret
+
+      integer affileinfo, afnumann, afannlist, afannlen
+      integer afreadann, afstart, afend, afendaccess, hopen, hclose
+      integer hishdf, hestring
+      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
+      DFACC_READ = 1
+      AN_DATA_LABEL = 0
+      AN_DATA_DESC  = 1
+      AN_FILE_LABEL = 2
+      AN_FILE_DESC  = 3
+
+C ***** Test if the file fname is an HDF file
+C
+C
+      ret = hishdf(fname)
+      if (ret .ne. 1) then
+          num_failed = num_failed + 1
+          write(*,*) "HISHDF function failed"
+      endif
+      ret = hestring(0, error_message)
+       if (ret .ne. 0) then
+          num_failed = num_failed + 1
+          write(*,*) "HESTRING function failed"
+      endif
+
+C
+C     Call hishdf with  file not being an hdf file. Call should return
+C     0 
+C
+      ret = hishdf("manf.f")
+      if (ret .ne. 0) then
+          num_failed = num_failed + 1
+          write(*,*) "HISHDF function failed"
+      endif
+C
+C *****  end of hishdf test
+C
+C *****start annotation access on file *****
+      fileh = hopen(fname, DFACC_READ,0)
+      ret = fileh
+      call VERIFY(ret, 'hopen', num_failed)
+      anh = afstart(fileh)
+      ret = anh
+      call VERIFY(ret, 'afstart', num_failed)
+
+      ret = affileinfo(anh,nflabs,nfdescs,nolabs,nodescs)
+      call VERIFY(ret, 'affileinfo', num_failed)
+
+      numdlabels = afnumann(anh, AN_DATA_LABEL, tag, ref)
+      call VERIFY(numdlabels, 'afnumann', num_failed)
+
+      numddescs = afnumann(anh, AN_DATA_DESC, tag, ref)
+      call VERIFY(numddescs, 'afnumann', num_failed)
+
+      ret = afannlist(anh, AN_DATA_LABEL, tag, ref, dlabels)
+      call VERIFY(ret, 'afannlist', num_failed)
+
+      ret = afannlist(anh, AN_DATA_DESC, tag, ref, ddescs)
+      call VERIFY(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 VERIFY(annlen, 'afannlen', num_failed)
+
+         ret = afreadann(dlabels(j), inlabel, MAXLENLAB)
+         call VERIFY(ret, 'afreadann', num_failed)
+         ret = afendaccess(dlabels(j))
+         call VERIFY(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 VERIFY(annlen, 'afannlen', num_failed)
+
+         ret = afreadann(ddescs(j), indesc, MAXLEN_DESC)
+         call VERIFY(ret, 'afreadann', num_failed)
+         ret = afendaccess(ddescs(j))
+         call VERIFY(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 VERIFY(ret, 'afend', num_failed)
+      ret = hclose(fileh)
+      call VERIFY(ret, 'hclose', num_failed)
+
+
+      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 VERIFY(ret, 'hopen', num_failed)
+      anh = afstart(fileh)
+      ret = anh
+      call VERIFY(ret, 'afstart', num_failed)
+
+      ret = affileinfo(anh,nflabs,nfdescs,nolabs,nodescs)
+      call VERIFY(ret, 'affileinfo', num_failed)
+
+C ***** Read file label **********
+      annh = afselect(anh, index, AN_FILE_LABEL)
+      call VERIFY(ret, 'afselect', num_failed)
+
+      fannlen = afannlen(annh)
+      call VERIFY(fannlen, 'afannlen', num_failed)
+
+      ret = afreadann(annh, flabel, fannlen)
+      call VERIFY(ret, 'afreadann', num_failed)
+      ret = afendaccess(annh)
+      call VERIFY(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 VERIFY(ret, 'afselect', num_failed)
+
+      fannlen = afannlen(annh)
+      call VERIFY(fannlen, 'afannlen', num_failed)
+
+      ret = afreadann(annh, fdesc, fannlen)
+      call VERIFY(ret, 'afreadann', num_failed)
+      ret = afendaccess(annh)
+      call VERIFY(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 VERIFY(ret, 'afend', num_failed)
+      ret = hclose(fileh)
+      call VERIFY(ret, 'hclose', num_failed)
+
+      return
+      end
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/fortest.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fortest.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fortest.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,245 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.36 $";
+#endif
+
+/* $Id: fortest.c,v 1.36 1998/03/04 21:36:03 acheng Exp $ */
+
+#define TESTMASTER
+
+#include "hdf.h"
+#include "tutils.h"
+#include "fortest.h"
+#ifdef VMS
+#include <processes.h>
+#include <string.h>
+#endif
+#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("vattrf", "tvattrf", "");
+#ifdef DEC_ALPHA
+    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);
+
+#ifdef VMS
+    {
+        char *comprocfile="fortest.com";
+
+        if ((cmdfile = fopen(comprocfile, "w")) == NULL){
+           printf("***Can't write to cmdfile(%s)***\n", comprocfile);
+           return(-1);
+        }
+        fprintf(cmdfile, "%s %s\n",
+            "DEFINE/USER_MODE SYS$INPUT", cmdfilename);
+        fprintf(cmdfile, "%s\n", "run []fortestF.exe");
+        fclose(cmdfile);
+        return(system("@fortest.com"));
+    }
+#else
+    return(system("./fortestF"));
+#endif
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/fortest.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fortest.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fortest.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,36 @@
+/****************************************************************************
+ * 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: fortest.h,v 1.3 1997/05/22 23:36:55 sxu Exp $ */
+
+#ifndef __FORTEST_H
+#define __FORTEST_H
+#include "hdf.h"
+
+/* Verbosity Environment Variable */
+#define FOR_VERB    "HDF_FOR_VERBOSITY"
+
+#ifdef DF_CAPFNAMES
+#  define ngetverb      FNAME(GETVERB)
+#  define nhisystem       FNAME(HISYSTEM)
+#else  /* !DF_CAPFNAMES */
+#  define ngetverb      FNAME(getverb)
+#  define nhisystem       FNAME(hisystem)
+#endif /* DF_CAPFNAMES */
+
+/* FORTRAN support C-stubs for FORTRAN interface tests */
+
+extern FRETVAL(intf) ngetverb(void);
+extern FRETVAL(intf) nhisystem(_fcd cmd, intf *cmdlen);
+
+#endif /* __FORTEST_H */
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/fortest.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fortest.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fortest.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,51 @@
+C $Id: fortest.inc,v 1.5 1997/02/17 22:28:18 acheng Exp $
+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     9		High:	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')

Added: packages/libhdf4/branches/upstream/current/hdf/test/fortest.sav
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fortest.sav	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fortest.sav	2007-05-14 09:41:34 UTC (rev 808)
@@ -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...
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/fortestF.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/fortestF.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/fortestF.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,284 @@
+C $Id: fortestF.f,v 1.19 1999/05/04 17:36:31 koziol Exp $
+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,'r',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
+
+C For VMS, un-comment the next line 
+C        read(5,11,END=100,err=100) inline
+	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
+
+C For VMS use the next three lines 
+C100	continue
+C        close(5)
+C        retcode =1
+C For VMS comment out next line
+C End of file or read error on cmdfile.  Close it either way.
+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. '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
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/gentest.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/gentest.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/gentest.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,206 @@
+/****************************************************************************
+ * 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: gentest.c,v 1.10 1997/11/05 19:39:22 koziol Exp $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.10 $";
+#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  "bitio.dat"
+#define BITIO_TAG1  1000
+#define BITIO_REF1  1000
+#define BITIO_SIZE1 4096
+
+#define NBIT_NAME   "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() */

Added: packages/libhdf4/branches/upstream/current/hdf/test/gr_r24.dat
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/test/gr_r24.dat
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/test/greyjpeg.dat
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/test/greyjpeg.dat
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/test/jpeg.dat
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/test/jpeg.dat
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/test/litend.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/litend.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/litend.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,724 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.17 $";
+#endif
+
+/* $Id: litend.c,v 1.17 1996/11/11 20:39:55 koziol Exp $ */
+
+#include "tproto.h"
+
+/* Internal Variables */
+#define CDIM_X  7
+#define CDIM_Y  9
+
+#define FILENAME    "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;
+
+    MESSAGE(5,printf("Testing Little-Endian Read Routines\n"););
+
+    MESSAGE(10,printf("Testing Little-Endian INT8 Reading Routines\n"););
+
+    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() */

Added: packages/libhdf4/branches/upstream/current/hdf/test/litend.dat
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/test/litend.dat
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/test/macros.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/macros.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/macros.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,175 @@
+#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() */
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/makepc.386
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/makepc.386	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/makepc.386	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,194 @@
+#
+# $Id: makepc.386,v 1.2 1993/11/03 21:57:10 koziol Exp $
+#
+# ##################################################################
+#
+#                   NCSA HDF Version 3.3 release 1
+#                          September 1993
+#
+#                  MAKEFILE for testing HDF Version 3.3
+#
+# This makefile creates HDF test programs.  There are three categories
+# of test programs:
+#
+#              application layer C test programs
+#              application layer FORTRAN test programs
+#              lower level C test programs
+#
+# The application layer C test programs are:
+#
+#              trig    (8-bit, 24-bit raster image sets and palette interface)
+#              tsdnt  (scientific data sets, data only)
+#              tsdnnt (same as tdfsd_nt with native number types)
+#              tsdmms (scientific data sets, data, max/min and scales)
+#              tsdnmms(same as tdfsd_mms with native number types)
+#              tsdstr (data and dimension strings: label, unit, format and coordsys)
+#              tan     (annotations for HDF objects)
+#              tanfile (annotations for HDF files)
+#              tstubs  (emulation of old lower level i/o routines)
+#              tlitend (Tests Little-endian support)
+#
+# The application layer FORTRAN test programs are:
+#
+#              tr8F     (8-bit raster image sets)
+#              t24F     (24-bit raster image sets)
+#              tpF      (Palettes)
+#              tsdntF   (scientific data sets, data only)
+#              tsdnntF  (same as tdfsd_nntF except all data types are native
+#                           machine number types)
+#              tsdmmsF  (scientific data sets, data, max/min and scales)
+#	       tsdnmmsF (same as tdfsd_mmsF with native number types)
+#              tsdstrF  (data and dimenstrings: label, unit, format and coordsys)
+#              tanF     (annotations for HDF objects)
+#              tanfileF (annotations for HDF files)
+#              tstubsF  (emulation of old lower level i/o routines)
+#
+# Vset test programs:
+#
+#	       egchi.c  (high level VSET write routines)
+#	       tv1.c    (the basic vgroup and vdata creation routines)
+#	       tv2.c    (creates vsets in 2 files simultaneously)
+#	       tvers.c  (get version string from an HDF file)
+# 	       egfhi.f  (Fortran version of egchi.c)
+#
+# The lower level C test programs are:
+#
+#              thfile     (basic i/o)
+#              terr       (error handling)
+#              thblocks   (linked blocks)
+#              thextelt   (i/o involving external files)
+#              tvers      (storing and retrieving version strings)
+#              thlinkage  (linkage of functions)
+#
+# Hyperslab Fortran test programs
+#              slabw      (write data as 5 slabs )
+#              slab1wf    (write data as first 3 of 5 slabs )
+#              slab2wf    (write data as last 2 of 5 slabs )
+#              slab3wf    (write data as 24 slabs i.e. each element )
+#              slab4wf    (write data as 1 slab )
+#
+# ##################################################################
+#
+#                      HOW TO USE THIS MAKEFILE
+#
+# You need df.lib to compile any of these test programs.  You will
+# also need selected header files as described below.
+#
+# To compile the application layer C test programs, enter "nmake ctests".
+# If there are test programs that you do not want to compile, do this 
+# by removing them from the lines "COBJS=" and "CSRCS=" below.
+# You need access to the header files indicated in the "CHDRS=" line
+# below to compile these programs. 
+#
+# To compile the application layer FORTRAN test programs, enter
+# "nmake ftests".  You need access to the header files indicated in
+# the "FHDRS=" line below to compile these programs. 
+# If there are test programs that you do not want to compile, do this 
+# by removing them from the lines "FOBJS=" and "FSRCS=" below.
+#
+# To compile the lower level C test programs, enter "make htests".
+# You need access to the header files indicated in the "HHDRS=" line
+# below to compile these programs.  If there are test programs that
+# you do not want to compile, do this by removing them from the lines
+# "HOBJS=" and "HSRCS=" below.
+#
+# To remove all object files created by this makefile, enter "make clean"
+#
+# ##################################################################
+#
+#                       PORTING INSTRUCTIONS
+#
+# You must modify the lines containing the symbol "==>" to make
+# this makefile compatible with your platform.
+#
+# ##################################################################
+
+.SUFFIXES : .f
+
+# ==> specify your machine
+#MACHINE=WIN3
+MACHINE=PC
+
+INCDIR=..\include
+LIBDIR=..\lib
+BINDIR=..\bin
+
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+IFLAGS=   /I$(INCDIR) /I.
+
+# ==> specify your FORTRAN compiler
+FC=fl
+FFLAGS= /c /Gt64 /AH /4I4 $(IFLAGS) /W2 /Od /Tf
+
+# ==> specify your C compiler
+CC=wcc386
+CFLAGS=  /ms /w4 /Od /d2 /s $(IFLAGS) /zc /ze
+#CFLAGS=  /ms /w4 /Oneatx /s $(IFLAGS) /zc /ze
+
+# ==> specify your Macro-Assembler compiler
+MM = ml
+MFLAGS = /c /nologo /W3
+
+# ==> where is your HDF library (libdf.a) located?
+LIBS= $(LIBDIR)\df.lib
+
+#BDIR=../backup
+
+# ==> specify your archiver
+AR=wlib
+ARFLAGS=/q /b
+ARFLAGS2=
+
+# ==> specify your linker
+LN=wlinkp
+LNFLAGS=
+
+# ==> specify your archive randomizer
+#RANLIB=ranlib
+
+RM=del
+RMFLAGS=
+LINTFLAGS=
+SHAR=zip
+ARCHIVE=hdf.zip
+
+SRCS=   testhdf.c rig.c sdstr.c blocks.c an.c anfile.c &
+        extelt.c file.c file1.c vers.c sdmms.c &
+        sdnmms.c slab.c litend.c tvset.c comp.c conv.c bitio.c &
+        tree.c
+
+CTESTS= testhdf.obj rig.obj sdstr.obj blocks.obj an.obj anfile.obj &
+        extelt.obj file.obj file1.obj vers.obj sdmms.obj &
+        sdnmms.obj slab.obj litend.obj tvset.obj comp.obj conv.obj bitio.obj &
+        tree.obj
+
+FTESTS= tr8f.exe t24f.exe tpf.exe tanf.exe tanfilef.exe tsdstrf.exe tsdntf.exe tsdnntf.exe &
+        tsdmmsf.exe tsdnmmsf.exe tstubsf.exe &
+        slabwf.exe slab1wf.exe slab2wf.exe slab3wf.exe slab4wf.exe
+TESTF = fortest.obj
+FOBJS = tr8f.obj t24f.obj tpf.obj tanf.obj tanfilef.obj tsdstrf.obj tsdntf.obj &
+        tsdnntf.obj tsdmmsf.obj tsdnmmsf.obj tstubsf.obj fortest.obj &
+        slabwf.obj slab1wf.obj slab2wf.obj slab3wf.obj slab4wf.obj
+
+#.f.obj:
+#    $(FC) $(FFLAGS) $<
+#
+.c.obj:
+    $(CC) $[@ $(CFLAGS)
+
+all: testhdf.exe fortest.exe
+    %null
+
+nofortran: testhdf.exe
+    %null
+
+testhdf.exe: $(CTESTS) $(LIBDIR)\df.lib testhdf.obj
+#    $(CC) $(CFLAGS) testhdf.c
+    $(LN) $(LNFLAGS) @testhdf.386
+
+fortest.exe: $(FTESTS) $(LIBDIR)\df.lib fortest.obj
+#    $(FC) $(FFLAGS) fortest.f
+    $(LN) $(LNFLAGS) fortest $(FTESTS),,,$(LIBDIR)\df.lib;
+
+clean:
+    -$(RM) $(RMFLAGS) *.hdf *.obj *.exe

Added: packages/libhdf4/branches/upstream/current/hdf/test/makepc.msc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/makepc.msc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/makepc.msc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,195 @@
+# ****************************************************************************
+# * 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: makepc.msc,v 1.6 1994/04/21 13:09:16 koziol Exp $
+#
+# ##################################################################
+#
+#
+# This makefile creates HDF test programs.  There are three categories
+# of test programs: 
+#
+#              application layer C test programs 
+#              application layer FORTRAN test programs 
+#              lower level C test programs 
+#
+# The application layer C test programs are:
+#
+#              trig    (8-bit, 24-bit raster image sets and palette interface)
+#              tsdnt  (scientific data sets, data only)
+#              tsdnnt (same as tdfsd_nt with native number types)
+#              tsdmms (scientific data sets, data, max/min and scales)
+#              tsdnmms(same as tdfsd_mms with native number types)
+#              tsdstr (data and dimension strings: label, unit, format and coordsys)
+#              tan     (annotations for HDF objects)
+#              tanfile (annotations for HDF files)
+#              tstubs  (emulation of old lower level i/o routines)
+#              tlitend (Tests Little-endian support)
+#
+# The application layer FORTRAN test programs are:
+#
+#              tr8F     (8-bit raster image sets)
+#              t24F     (24-bit raster image sets)
+#              tpF      (Palettes)
+#              tsdntF   (scientific data sets, data only)
+#              tsdnntF  (same as tdfsd_nntF except all data types are native
+#                           machine number types)
+#              tsdmmsF  (scientific data sets, data, max/min and scales)
+#	       tsdnmmsF (same as tdfsd_mmsF with native number types)
+#              tsdstrF  (data and dimenstrings: label, unit, format and coordsys)
+#              tanF     (annotations for HDF objects)
+#              tanfileF (annotations for HDF files)
+#              tstubsF  (emulation of old lower level i/o routines)
+#
+# Vset test programs:
+#
+#	       egchi.c  (high level VSET write routines)
+#	       tv1.c    (the basic vgroup and vdata creation routines)
+#	       tv2.c    (creates vsets in 2 files simultaneously)
+#	       tvers.c  (get version string from an HDF file)
+# 	       egfhi.f  (Fortran version of egchi.c)
+#
+# The lower level C test programs are:
+#
+#              thfile     (basic i/o)
+#              terr       (error handling)
+#              thblocks   (linked blocks)
+#              thextelt   (i/o involving external files)
+#              tvers      (storing and retrieving version strings)
+#              thlinkage  (linkage of functions)
+#
+# Hyperslab Fortran test programs
+#              slabw      (write data as 5 slabs )
+#              slab1wf    (write data as first 3 of 5 slabs )
+#              slab2wf    (write data as last 2 of 5 slabs )
+#              slab3wf    (write data as 24 slabs i.e. each element )
+#              slab4wf    (write data as 1 slab )
+#
+# ##################################################################
+#
+#                      HOW TO USE THIS MAKEFILE
+#
+# You need df.lib to compile any of these test programs.  You will
+# also need selected header files as described below.
+#
+# To compile the application layer C test programs, enter "nmake ctests".
+# If there are test programs that you do not want to compile, do this 
+# by removing them from the lines "COBJS=" and "CSRCS=" below.
+# You need access to the header files indicated in the "CHDRS=" line
+# below to compile these programs. 
+#
+# To compile the application layer FORTRAN test programs, enter
+# "nmake ftests".  You need access to the header files indicated in
+# the "FHDRS=" line below to compile these programs. 
+# If there are test programs that you do not want to compile, do this 
+# by removing them from the lines "FOBJS=" and "FSRCS=" below.
+#
+# To compile the lower level C test programs, enter "make htests". 
+# You need access to the header files indicated in the "HHDRS=" line
+# below to compile these programs.  If there are test programs that
+# you do not want to compile, do this by removing them from the lines
+# "HOBJS=" and "HSRCS=" below.
+#
+# To remove all object files created by this makefile, enter "make clean"
+#
+# ##################################################################
+#
+#                       PORTING INSTRUCTIONS
+#
+# You must modify the lines containing the symbol "==>" to make
+# this makefile compatible with your platform.
+#
+# ##################################################################
+
+.SUFFIXES : .f
+
+# ==> specify your machine
+#MACHINE=WIN3
+MACHINE=PC
+
+INCDIR=..\include
+LIBDIR=..\lib
+BINDIR=..\bin
+
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+IFLAGS=   /I$(INCDIR) /I.
+
+# ==> specify your FORTRAN compiler
+FC=fl
+FFLAGS= /c /Gt64 /AH /4I4 $(IFLAGS) /W2 /Od /Tf
+
+# ==> specify your C compiler
+CC=cl
+#CFLAGS=  /c /D$(MACHINE) /NTt$* /ND$* /Gt64 /AH /W4 /Od $(IFLAGS) /Zi /Zp1
+#CFLAGS=  /c /D$(MACHINE) /NTt$* /ND$* /Gt64 /AH /W4 /Ozaxb2 $(IFLAGS) /Zp1
+CFLAGS=  /c /D$(MACHINE) /Gt32 /AH /W4 /Od $(IFLAGS) /Zi /Gs /FPi87
+
+# ==> where is your HDF library (libdf.a) located?
+LIBS= $(LIBDIR)\df.lib
+
+#BDIR=../backup
+
+# ==> specify your archiver
+AR=lib
+ARFLAGS=
+ARFLAGS2=/NOLOGO /PAGE:32 -+
+
+# ==> specify your linker
+LN=link
+LNFLAGS=/COD /ST:8192 /MAP /SEG:512
+
+# ==> specify your archive randomizer
+#RANLIB=ranlib
+
+RM=del
+RMFLAGS=
+LINTFLAGS=
+SHAR=zip
+ARCHIVE=hdf.zip
+
+SRCS=   testhdf.c rig.c sdstr.c blocks.c an.c anfile.c \
+        extelt.c file.c file1.c vers.c sdmms.c \
+        sdnmms.c slab.c litend.c comp.c tvset.c conv.c nbit.c bitio.c tree.c
+
+CTESTS= testhdf.obj rig.obj sdstr.obj blocks.obj an.obj anfile.obj \
+        extelt.obj file.obj file1.obj vers.obj sdmms.obj sdnmms.obj slab.obj \
+        litend.obj comp.obj tvset.obj conv.obj nbit.obj bitio.obj tree.obj
+
+FTESTS= tr8f.exe t24f.exe tpf.exe tanf.exe tanfilef.exe tsdstrf.exe tsdntf.exe tsdnntf.exe \
+        tsdmmsf.exe tsdnmmsf.exe tstubsf.exe \
+        slabwf.exe slab1wf.exe slab2wf.exe slab3wf.exe slab4wf.exe
+TESTF = fortest.obj
+FOBJS = tr8f.obj t24f.obj tpf.obj tanf.obj tanfilef.obj tsdstrf.obj tsdntf.obj \
+        tsdnntf.obj tsdmmsf.obj tsdnmmsf.obj tstubsf.obj fortest.obj \
+        slabwf.obj slab1wf.obj slab2wf.obj slab3wf.obj slab4wf.obj
+
+.f.obj:
+    $(FC) $(FFLAGS) $<
+
+.c.obj:
+    $(CC) $(CFLAGS) $<
+
+all: testhdf fortest
+
+nofortran: testhdf
+
+testhdf: $(CTESTS) $(LIBDIR)\df.lib testhdf.obj
+#    $(CC) $(CFLAGS) testhdf.c
+    $(LN) $(LNFLAGS) @testhdf.pc
+
+fortest: $(FTESTS) $(LIBDIR)\df.lib fortest.obj
+#    $(FC) $(FFLAGS) fortest.f
+    $(LN) $(LNFLAGS) fortest $(FTESTS),,,$(LIBDIR)\df.lib;
+
+clean:
+    -$(RM) $(RMFLAGS) *.hdf *.obj *.exe
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/makewin.msc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/makewin.msc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/makewin.msc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,298 @@
+# ****************************************************************************
+# * 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: makewin.msc,v 1.2 1993/11/03 21:57:15 koziol Exp $
+#
+# ##################################################################
+#
+# This makefile creates HDF test programs.  There are three categories
+# of test programs: 
+#
+#              application layer C test programs 
+#              application layer FORTRAN test programs 
+#              lower level C test programs 
+#
+# The application layer C test programs are:
+#
+#              trig    (8-bit, 24-bit raster image sets and palette interface)
+#              tsdnt  (scientific data sets, data only)
+#              tsdnnt (same as tdfsd_nt with native number types)
+#              tsdmms (scientific data sets, data, max/min and scales)
+#              tsdnmms(same as tdfsd_mms with native number types)
+#              tsdstr (data and dimension strings: label, unit, format and coordsys)
+#              tan     (annotations for HDF objects)
+#              tanfile (annotations for HDF files)
+#              tstubs  (emulation of old lower level i/o routines)
+#              tlitend (Tests Little-endian support)
+#
+# The application layer FORTRAN test programs are:
+#
+#              tr8F     (8-bit raster image sets)
+#              t24F     (24-bit raster image sets)
+#              tpF      (Palettes)
+#              tsdntF   (scientific data sets, data only)
+#              tsdnntF  (same as tdfsd_nntF except all data types are native
+#                           machine number types)
+#              tsdmmsF  (scientific data sets, data, max/min and scales)
+#	       tsdnmmsF (same as tdfsd_mmsF with native number types)
+#              tsdstrF  (data and dimenstrings: label, unit, format and coordsys)
+#              tanF     (annotations for HDF objects)
+#              tanfileF (annotations for HDF files)
+#              tstubsF  (emulation of old lower level i/o routines)
+#
+# Vset test programs:
+#
+#	       egchi.c  (high level VSET write routines)
+#	       tv1.c    (the basic vgroup and vdata creation routines)
+#	       tv2.c    (creates vsets in 2 files simultaneously)
+#	       tvers.c  (get version string from an HDF file)
+# 	       egfhi.f  (Fortran version of egchi.c)
+#
+# The lower level C test programs are:
+#
+#              thfile     (basic i/o)
+#              terr       (error handling)
+#              thblocks   (linked blocks)
+#              thextelt   (i/o involving external files)
+#              tvers      (storing and retrieving version strings)
+#              thlinkage  (linkage of functions)
+#
+# Hyperslab Fortran test programs
+#              slabw      (write data as 5 slabs )
+#              slab1wf    (write data as first 3 of 5 slabs )
+#              slab2wf    (write data as last 2 of 5 slabs )
+#              slab3wf    (write data as 24 slabs i.e. each element )
+#              slab4wf    (write data as 1 slab )
+#
+# ##################################################################
+#
+#                      HOW TO USE THIS MAKEFILE
+#
+# You need df.lib to compile any of these test programs.  You will
+# also need selected header files as described below.
+#
+# To compile the application layer C test programs, enter "nmake ctests".
+# If there are test programs that you do not want to compile, do this 
+# by removing them from the lines "COBJS=" and "CSRCS=" below.
+# You need access to the header files indicated in the "CHDRS=" line
+# below to compile these programs. 
+#
+# To compile the application layer FORTRAN test programs, enter 
+# "nmake ftests".  You need access to the header files indicated in
+# the "FHDRS=" line below to compile these programs. 
+# If there are test programs that you do not want to compile, do this 
+# by removing them from the lines "FOBJS=" and "FSRCS=" below.
+#
+# To compile the lower level C test programs, enter "make htests". 
+# You need access to the header files indicated in the "HHDRS=" line
+# below to compile these programs.  If there are test programs that 
+# you do not want to compile, do this by removing them from the lines
+# "HOBJS=" and "HSRCS=" below.
+#
+# To remove all object files created by this makefile, enter "make clean"
+#
+# ##################################################################
+#
+#                       PORTING INSTRUCTIONS
+#
+# You must modify the lines containing the symbol "==>" to make
+# this makefile compatible with your platform.
+#
+# ##################################################################
+
+
+.SUFFIXES : .f
+
+# ==> specify your machine
+#MACHINE=WIN3
+MACHINE=PC
+
+INCDIR=../include
+LIBDIR=../lib
+BINDIR=../bin
+
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+IFLAGS=   /I../include /I.
+
+# ==> specify your FORTRAN compiler
+FC=fl
+#FFLAGS= /c /Gt512 /AH /4I4 $(IFLAGS) /W2 /Od /Tf
+FFLAGS= /c /AH $(IFLAGS) /W2 /Od /Tf
+
+# ==> specify your C compiler
+CC=cl
+#CFLAGS=  /c /D$(MACHINE) /ND$* /Gt64 /AH /W4 /Od $(IFLAGS) /Zi /DMALDEBUG
+#CFLAGS=  /c /D$(MACHINE) /AH /W4 /Od $(IFLAGS) /Zi /Mq /DTEST_PC
+#CFLAGS=  /D$(MACHINE) /AH /W4 /Od $(IFLAGS) /Zi /Mq /DTEST_PC
+CFLAGS=  /D$(MACHINE) /Gt32 /AH /W4 /Od $(IFLAGS) /Zi /Mq /DTEST_PC
+#CFLAGS=  /c /D$(MACHINE) /ND$* /Gt64 /AH /W4 /Ox $(IFLAGS)
+
+# ==> where is your HDF library (libdf.a) located?
+LIBS= ..\lib\df.lib
+
+#BDIR=../backup
+
+# ==> specify your archiver
+AR=lib
+ARFLAGS=
+ARFLAGS2=/NOLOGO /PAGE:32 -+
+
+# ==> specify your linker
+LN=link
+LNFLAGS=/COD /ST:6118 /SEG:512
+
+# ==> specify your archive randomizer
+#RANLIB=ranlib
+
+RM=del
+RMFLAGS=
+LINTFLAGS=
+SHAR=zip
+ARCHIVE=hdf.zip
+
+CTESTS= trig.exe tsdstr.exe tsdmms.exe tsdnmms.exe tsdnnt.exe tsdnt.exe tan.exe \
+        tanfile.exe tstubs.exe tv1.exe tv2.exe tvers.exe egchi.exe \
+        slabw.exe slab1w.exe slab2w.exe slab3w.exe slab4w.exe tlitend.exe
+
+CHDRS = df.h dfi.h dfsd.h vg.h df.h dfi.h dfstubs.h \
+        vproto.h
+
+CTSRCS= trig.c tsdstr.c tsdmms.c tsdnmms.c tsdnnt.c \
+        tsdnt.c tan.c tanfile.c tstubs.c \
+        tv1.c tv2.c tvers.c egchi.c \
+        slabw.c slab1w.c slab2w.c slab3w.c slab4w.c tlitend.c
+
+CTOBJS= trig.obj tsdstr.obj tsdmms.obj tsdnt.obj tan.obj tanfile.obj \
+        tstubs.obj tsdnmms.obj tsdnnt.obj tv1.obj tv2.obj \
+        tvers.obj egchi.obj \
+        slabw.obj slab1w.obj slab2w.obj slab3w.obj slab4w.obj tlitend.obj
+
+HTESTS= thfile.exe thfile1.exe terr.exe thblocks.exe thextelt.exe tlinkage.exe
+HHDRS = hfile.h hdf.h hdfi.h herr.h hproto.h
+HTSRCS= thfile.c thfile1.c terr.c thblocks.c thextelt.c tlinkage.c
+HTOBJS= thfile.obj thfile1.obj terr.obj thblocks.obj thextelt.obj tlinkage.obj
+
+FTESTS= tr8f.exe t24f.exe tpf.exe tanf.exe tanfilef.exe tsdstrf.exe tsdntf.exe tsdnntf.exe \
+        tsdmmsf.exe tsdnmmsf.exe tstubsf.exe egfhi.exe \
+        slabwf.exe slab1wf.exe slab2wf.exe slab3wf.exe slab4wf.exe
+FSRCS = tr8f.f t24f.f tpf.f tanf.f tanfilef.f tsdstrf.f tsdntf.f \
+        tsdnntf.f tsdmmsf.f  tsdnmmsf.f tstubsf.f egfhi.f \
+        slabwf.f slab1wf.f slab2wf.f slab3wf.f slab4wf.f
+FOBJS = tr8f.obj t24f.obj tpf.obj tanf.obj tanfilef.obj tsdstrf.obj tsdntf.obj \
+        tsdnntf.obj tsdmmsf.obj tsdnmmsf.obj tstubsf.obj egfhi.obj \
+        slabwf.obj slab1wf.obj slab2wf.obj slab3wf.obj slab4wf.obj
+
+.c.exe:
+    $(CC) $(CFLAGS) $< $(LIBS)
+#    $(LN) $(LNFLAGS) $*,$*,$*,$(LIBS);
+
+.f.exe:
+    $(FC) $(FFLAGS) $<
+    $(LN) $(LNFLAGS) /NOD /NOE $*,$*,$*,$(LIBS) llibc7.lib oldnames.lib llibfor7.lib;
+
+all: ctests ftests htests
+
+nofortran: ctests htests
+
+ctests: $(CTESTS)
+
+ftests: $(FTESTS)
+
+htests: $(HTESTS)
+	
+trig.exe:  trig.c
+
+tsdstr.exe:    tsdstr.c
+
+tsdnt.exe:    tsdnt.c
+
+tsdmms.exe:    tsdmms.c
+
+tsdnnt.exe:    tsdnnt.c
+
+tsdnmms.exe:    tsdnmms.c
+
+tan.exe:  tan.c
+
+tanfile.exe:     tanfile.c
+
+tstubs.exe:     tstubs.c
+
+tlitend.exe:     tlitend.c
+
+tv1.exe:        tv1.c
+
+tv2.exe:        tv2.c
+
+tvers.exe:      tvers.c
+
+egchi.exe :      egchi.c
+
+tr8f.exe :          tr8f.f
+
+t24f.exe :       t24f.f
+
+tanf.exe :       tanf.f
+
+tanfilef.exe :   tanfilef.f
+
+tpf.exe :   tpf.f
+
+tstubsf.exe :   tstubsf.f
+
+tsdstrf.exe :   tsdstrf.f
+
+tsdntf.exe :   tsdntf.f
+
+tsdnntf.exe :   tsdnntf.f
+
+tsdmmsf.exe :   tsdmmsf.f
+
+tsdnmmsf.exe :   tsdnmmsf.f
+
+egfhi.exe :     egfhi.f
+
+thfile.exe :     thfile.c
+
+thfile1.exe :     thfile1.c
+
+terr.exe :     terr.c
+
+thblocks.exe :     thblocks.c
+
+thextelt.exe :     thextelt.c
+
+tlinkage.exe :     tlinkage.c
+
+slabw.exe : slabw.c
+
+slab1w.exe : slab1w.c
+
+slab2w.exe : slab2w.c
+
+slab3w.exe : slab3w.c
+
+slab4w.exe : slab4w.c
+
+slabwf.exe : slabwf.f
+
+slab1wf.exe : slab1wf.f
+
+slab2wf.exe : slab2wf.f
+
+slab3wf.exe : slab3wf.f
+
+slab4wf.exe : slab4wf.f
+
+clean:
+	-$(RM) $(RMFLAGS) *.hdf $(CTESTS) $(HTESTS) $(FTESTS)
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/makewin.new
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/makewin.new	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/makewin.new	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,99 @@
+# ****************************************************************************
+# * 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: makewin.new,v 1.2 1993/11/03 21:57:17 koziol Exp $
+#
+
+.SUFFIXES : .f
+
+# ==> specify your machine
+#MACHINE=WIN3
+MACHINE=PC
+
+INCDIR=..\include
+LIBDIR=..\lib
+BINDIR=..\bin
+
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+IFLAGS=   /I$(INCDIR) /I.
+
+# ==> specify your FORTRAN compiler
+FC=fl
+FFLAGS= /c /Gt64 /AH /4I4 $(IFLAGS) /W2 /Od /Tf
+
+# ==> specify your C compiler
+CC=cl
+#CFLAGS=  /c /D$(MACHINE) /NTt$* /ND$* /Gt64 /AH /W4 /Od $(IFLAGS) /Zi /Zp1
+#CFLAGS=  /c /D$(MACHINE) /NTt$* /ND$* /Gt64 /AH /W4 /Ozaxb2 $(IFLAGS) /Zp1
+CFLAGS=  /c /D$(MACHINE) /Gt32 /AH /W4 /Od $(IFLAGS) /Zi /Mq /DTEST_PC /DTEST_WIN
+#CFLAGS=  /c /D$(MACHINE) /Gt32 /AH /W4 /Od $(IFLAGS) /Zi
+
+# ==> where is your HDF library (libdf.a) located?
+LIBS= $(LIBDIR)\df.lib
+
+#BDIR=../backup
+
+# ==> specify your archiver
+AR=lib
+ARFLAGS=
+ARFLAGS2=/NOLOGO /PAGE:32 -+
+
+# ==> specify your linker
+LN=link
+LNFLAGS=/INFO /COD /ST:8192 /MAP:FULL /SEG:256
+
+# ==> specify your archive randomizer
+#RANLIB=ranlib
+
+RM=del
+RMFLAGS=
+LINTFLAGS=
+SHAR=zip
+ARCHIVE=hdf.zip
+
+SRCS=   testhdf.c rig.c sdstr.c blocks.c an.c anfile.c \
+        extelt.c file.c file1.c vers.c sdmms.c \
+        sdnmms.c slab.c litend.c
+
+CTESTS= testhdf.obj rig.obj sdstr.obj blocks.obj an.obj anfile.obj \
+        extelt.obj file.obj file1.obj vers.obj sdmms.obj \
+        sdnmms.obj slab.obj litend.obj
+
+FTESTS= tr8f.exe t24f.exe tpf.exe tanf.exe tanfilef.exe tsdstrf.exe tsdntf.exe tsdnntf.exe \
+        tsdmmsf.exe tsdnmmsf.exe tstubsf.exe \
+        slabwf.exe slab1wf.exe slab2wf.exe slab3wf.exe slab4wf.exe
+TESTF = fortest.obj
+FOBJS = tr8f.obj t24f.obj tpf.obj tanf.obj tanfilef.obj tsdstrf.obj tsdntf.obj \
+        tsdnntf.obj tsdmmsf.obj tsdnmmsf.obj tstubsf.obj fortest.obj \
+        slabwf.obj slab1wf.obj slab2wf.obj slab3wf.obj slab4wf.obj
+
+.f.obj:
+    $(FC) $(FFLAGS) $<
+
+.c.obj:
+    $(CC) $(CFLAGS) $<
+
+all: testhdf fortest
+
+nofortran: testhdf
+
+testhdf: $(CTESTS) $(LIBDIR)\df.lib testhdf.obj
+#    $(CC) $(CFLAGS) testhdf.c
+    $(LN) $(LNFLAGS) @testhdf.lnk
+
+fortest: $(FTESTS) $(LIBDIR)\df.lib fortest.obj
+#    $(FC) $(FFLAGS) fortest.f
+    $(LN) $(LNFLAGS) fortest $(FTESTS),,,$(LIBDIR)\df.lib;
+
+clean:
+    -$(RM) $(RMFLAGS) *.hdf *.obj *.exe
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/man.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/man.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/man.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,960 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.25 $";
+#endif
+
+/* $Id: man.c,v 1.25 1998/01/27 17:50:58 bmribler Exp $ */
+
+/***********************************************************
+*
+* 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() */

Added: packages/libhdf4/branches/upstream/current/hdf/test/manf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/manf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/manf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,592 @@
+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: manf.f,v 1.22 2000/02/29 20:38:04 epourmal Exp $
+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 )
+
+      integer  inlablen, indesclen, ret
+
+      integer affileinfo, afnumann, afannlist, afannlen
+      integer afreadann, afstart, afend, afendaccess, hopen, hclose
+      integer hishdff, hestringf
+      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(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)
+
+
+      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
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/mgr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/mgr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/mgr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4962 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 1.30 $";
+#endif
+
+/* $Id: mgr.c,v 1.30 2000/11/16 15:41:36 koziol Exp $ */
+
+/***********************************************************
+*
+* Test program:  mgr
+*
+* Test the multi-file raster image interface
+*
+*************************************************************/
+
+#define TESTFILE "tmgr.hdf"
+#define TESTFILE2 "tmgrchk.hdf"
+#define DATAFILE "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 "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 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,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 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,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 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}},
+{{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}},
+{{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}}
+};
+
+#ifdef QAK
+static void dump_image(void *data, int32 xdim, int32 ydim, int32 ncomp, int32 nt);
+#endif /* QAK */
+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_b2a2aa(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_b2b2(int flag);
+static void test_mgr_image_b2b3(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);
+static void test_mgr_attr(int flag);
+
+#define ABS(x)  ((int)(x)<0 ? (-x) : x)
+
+static intn
+fuzzy_memcmp(const void *s1, const void *s2, int32 len, intn fuzz_factor);
+
+#ifdef DEC_ALPHA
+#define JPEG_FUZZ 13
+#else
+#define JPEG_FUZZ 1
+#endif
+
+static 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() */
+
+
+#ifdef QAK
+static void dump_image(void *data, int32 xdim, int32 ydim, int32 ncomp, int32 nt)
+{
+    int32 nt_size=DFKNTsize(nt);
+    int32 i,j,k;
+
+    for(i=0; i<ydim; i++)
+      {
+#ifdef QAK
+          printf("%ld:",(long)i);
+#endif /* QAK */
+          for(j=0; j<xdim; j++)
+            {
+                if(ncomp>1)
+                    printf("{");
+                for(k=0; k<ncomp; k++)
+                  {
+                    switch(nt)
+                      {
+                          case DFNT_CHAR8:
+                          case DFNT_UCHAR8:
+#ifdef QAK
+                            {
+                                char *ptr=(char *)data;
+                                printf("%c",*ptr);
+                            }
+                            break;
+#endif /* QAK */
+
+                          case DFNT_UINT8:
+                            {
+                                unsigned char *ptr=(unsigned char *)data;
+                                printf("%u",(unsigned)*ptr);
+                            }
+                            break;
+
+                          case DFNT_INT8:
+                            {
+                                char *ptr=(char *)data;
+                                printf("%d",(int)*ptr);
+                            }
+                            break;
+
+                          case DFNT_UINT16:
+                            {
+                                uint16 *ptr=(uint16 *)data;
+                                printf("%u",(unsigned)*ptr);
+                            }
+                            break;
+
+                          case DFNT_INT16:
+                            {
+                                int16 *ptr=(int16 *)data;
+                                printf("%d",(int)*ptr);
+                            }
+                            break;
+
+                          case DFNT_UINT32:
+                            {
+                                uint32 *ptr=(uint32 *)data;
+                                printf("%lu",(unsigned long)*ptr);
+                            }
+                            break;
+
+                          case DFNT_INT32:
+                            {
+                                int32 *ptr=(int32 *)data;
+                                printf("%ld",(long)*ptr);
+                            }
+                            break;
+
+                          case DFNT_FLOAT32:
+                            {
+                                float32 *ptr=(float32 *)data;
+                                printf("%f",(double)*ptr);
+                            }
+                            break;
+
+                          case DFNT_FLOAT64:
+                            {
+                                float64 *ptr=(float64 *)data;
+                                printf("%f",(double)*ptr);
+                            }
+                            break;
+
+                          default:
+                            printf("unknown NT: %ld\n",(long)nt);
+                            break;
+
+                      } /* end switch */
+                    if(k<(ncomp-1))
+                        printf(", ");
+                    data=(void *)((char *)data+nt_size);
+                  } /* end for */
+                if(ncomp>1)
+                    printf("}, ");
+                else
+                    printf(", ");
+
+            } /* end for */
+          printf("\n");
+      } /* end for */
+}   /* dump_image() */
+#endif /* QAK */
+
+/* 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
+    IX. Compressed image Functions
+        
+*/
+
+/****************************************************************
+**
+**  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 */
+
+    /* 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"););
+
+    /* Ok, now create a new file */
+    fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK(fid,FAIL,"Hopen");
+
+    /* Try initializing the GR interface */
+    grid=GRstart(fid);
+    CHECK(grid,FAIL,"GRstart");
+
+    ret=(intn)GRfileinfo(grid,&n_datasets,&n_attrs);
+    CHECK(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(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK(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(fid,FAIL,"Hopen");
+
+    /* Try initializing the GR interface */
+    grid=GRstart(fid);
+    CHECK(grid,FAIL,"GRstart");
+
+    ret=(intn)GRfileinfo(grid,&n_datasets,&n_attrs);
+    CHECK(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(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK(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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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(ret,FAIL,"GRsetchunk");
+
+              /* Set Chunk cache to hold 3 chunks */
+              ret = GRsetchunkcache(riid, 3, 0);
+              CHECK(ret,FAIL,"GRsetchunkcache");
+          }
+
+        /* 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 */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(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(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(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");
+} /* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(riid,FAIL,"GRcreate");
+
+        /* Set the fill-value */
+        ret=GRsetattr(riid,FILL_ATTR,DFNT_FLOAT64,sizeof(fill_pixel)/sizeof(float64),fill_pixel);
+        CHECK(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(ret,FAIL,"GRsetchunk");
+          }
+
+        /* 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 */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(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(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(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");
+} /* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(ref,(uint16)FAIL,"GRidtoref");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRwriteimage(riid,start,stride,dims,image);
+        CHECK(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(riid,FAIL,"GRselect");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK(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(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(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");
+} /* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(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(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(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(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(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");
+
+} /* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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(ret,FAIL,"GRsetchunk");
+
+              /* Set Chunk cache to hold 3 chunks */
+              ret = GRsetchunkcache(riid, 3, 0);
+              CHECK(ret,FAIL,"GRsetchunkcache");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(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(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(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(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(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");
+
+} /* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(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(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(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(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(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");
+
+}
+
+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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(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(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(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(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(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");
+
+} /* end test_mgr_image_b2a1cc() */
+
+static void test_mgr_image_b2a2aa(int flag)
+{
+#ifdef QAK
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+
+/* B2a2aa - Read/Write images - with real Data - New Image - with User-Defined Fill Value - Whole Image */
+/* The following test is unnecessary, fill-values only are important when writing out partial images */
+    MESSAGE(8, printf("Check out I/O on new image with real data, with User-Defined fill-value, Whole Image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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,k;     /* 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(riid,FAIL,"GRcreate");
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(ref,(uint16)FAIL,"GRidtoref");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRwriteimage(riid,start,stride,dims,image);
+        CHECK(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(riid,FAIL,"GRselect");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK(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 */
+
+        /* 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");
+#endif /* QAK */
+
+} /* end test_mgr_image_b2a2aa() */
+
+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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(riid,FAIL,"GRcreate");
+
+        /* Set the fill-value */
+        ret=GRsetattr(riid,FILL_ATTR,TEST_NT,TEST_NCOMP,fill_pixel);
+        CHECK(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(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(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(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(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(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(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");
+
+/* The following test is unnecessary, fill-values only make a difference when writing out data -QAK */
+#ifdef QAK
+    MESSAGE(8, printf("Check out I/O on new image with real data, with User-Defined fill-value, Reading Sub-setted Image\n"););
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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]={-3.4,4.5,-0.03,100.4};   /* pixel with fill values */
+        TEST_VARTYPE pixel[TEST_NCOMP]={-20.00,4.8,0.3,1.0};   /* pixel with fill values */
+        TEST_VARTYPE pixel2[TEST_NCOMP]={1.23,1.0,-6500.0,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 */
+        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],pixel,sizeof(pixel));
+                    else
+                        HDmemcpy(&image0[i][j][0],pixel2,sizeof(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 B2a2bb2",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK(riid,FAIL,"GRcreate");
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(ref,(uint16)FAIL,"GRidtoref");
+
+        /* Set the fill-value */
+        ret=GRsetattr(riid,FILL_ATTR,TEST_NT,TEST_NCOMP,fill_pixel);
+        CHECK(ret,FAIL,"GRsetattr");
+
+        /* Create whole image */
+        start[XDIM]=start[YDIM]=0;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRwriteimage(riid,start,stride,dims,image0);
+        CHECK(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,sub_image,count[XDIM]*count[YDIM]*sizeof(pixel)))
+          {
+              MESSAGE(3, printf("%d:Error reading data for new image with default fill-value, sub-setted image\n",__LINE__););
+              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");
+#endif /* QAK */
+
+} /* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(riid,FAIL,"GRcreate");
+
+        /* Set the fill-value */
+        ret=GRsetattr(riid,FILL_ATTR,TEST_NT,TEST_NCOMP,fill_pixel);
+        CHECK(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(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(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(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(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(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(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");
+
+/* The following test is unnecessary, fill-values only make a difference when writing out data -QAK */
+#ifdef QAK
+    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 */
+    fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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,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((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 B2a2cc2",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK(riid,FAIL,"GRcreate");
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(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(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(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(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,sub_image,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 */
+
+        /* 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");
+#endif /* QAK */
+
+} /* 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 */
+
+/* B2b1 - Read/Write images - with real Data - Existing Image - Whole Image */
+    MESSAGE(8, printf("Check out I/O from Existing Image - Whole Image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(DATAFILE,DFACC_READ,0);
+    CHECK(fid,FAIL,"Hopen");
+
+    /* Try initializing the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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(riid,FAIL,"GRselect");
+
+              /* Get the Image information */
+              *name='\0';
+              ret=GRgetiminfo(riid,name,&ncomp,&nt,&il,dimsizes,&n_attr);
+              CHECK(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(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(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(ret,FAIL,"GRendaccess");
+          } /* end for */
+      } /* end block */
+
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK(ret,FAIL,"Hclose");
+
+} /* end test_mgr_image_b2b1() */
+
+static void test_mgr_image_b2b2(int flag)
+{
+/* B2b2 - Read/Write images - with real Data - Existing Image - Sub-setted Image */
+    /* This test is unnecessary, I think this case has been adequately covered above -QAK */
+} /* end test_mgr_image_b2b2() */
+
+static void test_mgr_image_b2b3(int flag)
+{
+/* B2b3 - Read/Write images - with real Data - Existing Image - Sub-sampled Image */
+    /* This test is unnecessary, I think this case has been adequately covered above -QAK */
+} /* end test_mgr_image_b2b3() */
+
+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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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(ret,FAIL,"GRsetchunk");
+
+        /* Set Chunk cache to hold 2 chunks */
+        ret = GRsetchunkcache(riid, 2, 0);
+        CHECK(ret,FAIL,"GRsetchunkcache");
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK(ref,(uint16)FAIL,"GRidtoref");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRwriteimage(riid,start,stride,dims,image);
+        CHECK(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+
+        /* Shut down the GR interface */
+        ret=GRend(grid);
+        CHECK(ret,FAIL,"GRend");
+
+        /* Initialize the GR interface again */
+        grid=GRstart(fid);
+        CHECK(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(riid,FAIL,"GRcreate");
+
+#endif
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK(riid,FAIL,"GRselect");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK(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(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(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");
+
+
+#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
+** 
+**      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_b2a2aa(flag);
+    test_mgr_image_b2a2bb(flag);
+    test_mgr_image_b2a2cc(flag);
+    test_mgr_image_b2b1(flag);
+    test_mgr_image_b2b2(flag);
+    test_mgr_image_b2b3(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(fid,FAIL,"Hopen");
+
+    /* initialize the gr interface */
+    grid=GRstart(fid);
+    CHECK(grid,FAIL,"GRstart");
+
+    {
+        intn i,j;     /* local counting variables */
+        
+        ret=(intn)GRfileinfo(grid,&n_datasets,&n_attrs);
+        CHECK(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(riid,FAIL,"GRselect");
+
+              /* Get the Image information */
+              *name='\0';
+              ret=GRgetiminfo(riid,name,&ncomp,&nt,&il,dimsizes,&n_attr);
+              CHECK(ret,FAIL,"GRgetiminfo");
+
+              image=HDmalloc((size_t)(dimsizes[XDIM]*dimsizes[YDIM]*ncomp*DFKNTsize(nt|DFNT_NATIVE)));
+              CHECK(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(img_data,NULL,"HDmalloc");
+
+                    pixel_buf=HDmalloc((size_t)(dimsizes[0]*dimsizes[1]*ncomp*DFKNTsize(nt|DFNT_NATIVE)));
+                    CHECK(pixel_buf,NULL,"HDmalloc");
+
+                    HDmemset(img_data,0,(size_t)(dimsizes[0]*dimsizes[1]*ncomp*DFKNTsize(nt|DFNT_NATIVE)));
+
+                    ret=GRreqimageil(riid,j);
+                    CHECK(ret,FAIL,"GRreqimageil");
+
+                    start[0]=start[1]=0;
+                    stride[0]=stride[1]=1;
+                    ret=GRreadimage(riid,start,stride,dimsizes,img_data);
+                    CHECK(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(ret,FAIL,"GRendaccess");
+          } /* end for */
+      } /* end block */
+    
+    /* shut down the gr interface */
+    ret=GRend(grid);
+    CHECK(ret,FAIL,"GRend");
+
+    /* close the file */
+    ret=Hclose(fid);
+    CHECK(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(fid,FAIL,"Hopen");
+
+    /* initialize the gr interface */
+    grid=GRstart(fid);
+    CHECK(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(riid,FAIL,"GRselect");
+
+        /* Get the Image information */
+        *name='\0';
+        ret=GRgetiminfo(riid,name,&ncomp,&nt,&il,dimsizes,&n_attr);
+        CHECK(ret,FAIL,"GRgetiminfo");
+
+        lutid=GRgetlutid(riid,0);
+        CHECK(lutid,FAIL,"GRgetlutid");
+        
+        /* Get the Palette information */
+        ret=GRgetlutinfo(lutid,&pal_ncomp,&pal_nt,&pal_il,&pal_entries);
+        CHECK(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(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(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(tmp_data,NULL,"HDmalloc");
+
+              pixel_buf=HDmalloc((size_t)(pal_entries*pal_ncomp*DFKNTsize(pal_nt|DFNT_NATIVE)));
+              CHECK(pixel_buf,NULL,"HDmalloc");
+
+              HDmemset(tmp_data,0,(size_t)(pal_entries*pal_ncomp*DFKNTsize(pal_nt|DFNT_NATIVE)));
+
+              ret=GRreqlutil(lutid,j);
+              CHECK(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(pal_ref,0,"GRluttoref");
+
+	/* Now, this bogus lutid should cause GRluttoref to return a 0 - BMR */
+        pal_ref=GRluttoref(0);
+        VERIFY(pal_ref,0,"GRluttoref");
+        
+        /* End access to the image */
+        ret=GRendaccess(riid);
+        CHECK(ret,FAIL,"GRendaccess");
+      } /* end block */
+    
+    /* shut down the gr interface */
+    ret=GRend(grid);
+    CHECK(ret,FAIL,"GRend");
+
+    /* close the file */
+    ret=Hclose(fid);
+    CHECK(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(file_id,FAIL,"Hopen");
+
+	/* Initiate the GR interface. */
+	gr_id = GRstart(file_id);
+    CHECK(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(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(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(status,FAIL,"GRgetlutid");
+
+    status = GRendaccess(ri_id);
+    CHECK(status,FAIL,"GRendaccess");
+ 
+    status = GRend(gr_id);
+    CHECK(status,FAIL,"GRend");
+ 
+	status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose");
+
+	file_id = Hopen(GR_LUTBFILE, DFACC_READ, 0);
+    CHECK(file_id,FAIL,"Hopen");
+
+    gr_id = GRstart(file_id);
+    CHECK(gr_id,FAIL,"GRstart");
+ 
+    ri_idx = GRnametoindex(gr_id, "Image_1");
+    CHECK(ri_idx,FAIL,"GRnametoindex");
+ 
+    ri_id = GRselect (gr_id, ri_idx);
+    CHECK(ri_id,FAIL,"GRselect");
+ 
+    pal_id = GRgetlutid(ri_id, ri_idx);
+    CHECK(pal_id,FAIL,"GRgetlutid");
+
+	/* Read the palette data. */
+	status = GRreadlut(pal_id, (VOIDP)r_palette_data);
+    CHECK(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(status,FAIL,"GRendaccess");
+
+	/* Terminate access to the GR interface. */
+	status = GRend(gr_id);
+    CHECK(status,FAIL,"GRend");
+
+	/* Close the file. */
+	status = Hclose(file_id);
+    CHECK(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(): 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(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() */
+
+#define OLDRLEFILE  "8bit.dat"
+#define OLDGREYJPEGFILE  "greyjpeg.dat"
+#define OLDJPEGFILE  "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 */
+
+/* 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_RDWR,0);
+    CHECK(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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 RLE 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");
+} /* 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 */
+
+/* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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,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(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");
+} /* 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 */
+
+/* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(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,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(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");
+} /* 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 GZIPFILE    "gr_gzip.hdf"
+#define JPEGFILE    "gr_jpeg.hdf"
+
+/* Sub-tests for test_mgr_compress() */
+static void test_mgr_compress_a(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+
+/* A - Create/Write/Read gzip compressed image */
+    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 */
+        int32 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");
+} /* end test_mgr_compress_a() */
+
+static void test_mgr_compress_b(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+
+/* B - Create/Write/Read JPEG compressed image */
+    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 */
+        int32 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");
+} /* end test_mgr_compress_b() */
+
+static void test_mgr_compress_c(int flag)
+{
+    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 nc, dt, im, dims[2], na;
+ 
+    /* ---- End of variable declaration --- */
+ 
+    /* 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 and, close the HDF file.         */
+    /* ------------------------------------------ */
+    status = GRendaccess (ri_id);
+    CHECK(status,FAIL,"GRendaccess");
+
+    status = GRend (gr_id);
+    CHECK(status,FAIL,"GRend");
+ 
+    /* Read back data and print */
+    /* ------------------------ */
+    gr_id = GRstart (file_id);
+    CHECK(gr_id,FAIL,"GRstart");
+ 
+    ri_id = GRselect (gr_id, 0);
+    CHECK(ri_id,FAIL,"GRselect");
+ 
+    status = GRgetiminfo (ri_id, gname, &nc, &dt, &im, dims, &na);
+    CHECK(status,FAIL,"GRreadimage");
+    VERIFY(nc,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");
+ 
+    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");
+ 
+  /* Compare data read in */
+    /* Verify correct image contents */
+    if(fuzzy_memcmp(image_buf,read_buf,128*128*3,JPEG_FUZZ)!=0) {
+        MESSAGE(3, printf("Error reading data for 24-big JPEG compressed image\n"););
+        num_errs++;
+    } /* end if */
+
+   
+    /* Close all interfaces */
+    /* -------------------- */
+    status = GRendaccess (ri_id);
+    CHECK(status,FAIL,"GRendaccess");
+
+    status = GRend (gr_id);
+    CHECK(status,FAIL,"GRend");
+
+    status = Hclose (file_id);
+    CHECK(status,FAIL,"Hclose");
+ 
+} /* end test_mgr_compress_c() */
+
+/****************************************************************
+**
+**  test_mgr_compress(): Multi-file Raster Compression tests
+** 
+**  VIII. 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
+** 
+****************************************************************/
+static void
+test_mgr_compress(int flag)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster Compression Testing\n"););
+
+    test_mgr_compress_a(flag);
+    test_mgr_compress_b(flag);
+    test_mgr_compress_c(flag);
+
+}   /* end test_mgr_compress() */
+
+#define GR_R24FILE    "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 */
+
+/* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(riid,FAIL,"GRselect");
+
+        /* Check the image information */
+        ret=GRgetiminfo(riid,NULL,&ncomp,&nt,NULL,dimsizes,NULL);
+        CHECK(ret,FAIL,"GRgetiminfo");
+        VERIFY(ncomp,3,"GRgetiminfo");
+        VERIFY(nt,DFNT_UCHAR8,"GRgetiminfo");
+        VERIFY(dimsizes[0],dims[0],"GRgetiminfo");
+        VERIFY(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(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(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");
+} /* end test_mgr_r24_a() */
+
+/****************************************************************
+**
+**  test_mgr_r24(): Multi-file Raster/DF24 Compatibility Tests
+** 
+**  VIII. 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(ret,FAIL,"DFR8setpalette");
+    ret = DFR8putimage(GR_R8FILE, (VOIDP) picture, GR_R8XDIM, GR_R8YDIM, COMP_RLE);
+    CHECK(ret,FAIL,"DFR8putimage");
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(GR_R8FILE,DFACC_READ,0);
+    CHECK(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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 */
+
+        /* 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(riid,FAIL,"GRselect");
+
+        /* Check the image information */
+        ret=GRgetiminfo(riid,NULL,&ncomp,&nt,NULL,dimsizes,NULL);
+        CHECK(ret,FAIL,"GRgetiminfo");
+        VERIFY(ncomp,1,"GRgetiminfo");
+        VERIFY(nt,DFNT_UCHAR8,"GRgetiminfo");
+        VERIFY(dimsizes[0],dims[0],"GRgetiminfo");
+        VERIFY(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(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(pal_id,FAIL,"GRgetlutid");
+
+        ncomp=nt=0;
+        ret = GRgetlutinfo(pal_id, &ncomp, &nt, &interlace, &num_entries);
+        CHECK(ret,FAIL,"GRgetlutinfo");
+        VERIFY(ncomp,3,"GRgetlutinfo");
+        VERIFY(nt,DFNT_UINT8,"GRgetlutinfo");
+        VERIFY(interlace,0,"GRgetlutinfo");
+        VERIFY(num_entries,256,"GRgetlutinfo");
+
+        /* 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");
+} /* end test_mgr_r8_a() */
+
+/****************************************************************
+**
+**  test_mgr_r8(): Multi-file Raster/DF8 Compatibility Tests
+** 
+**  VIII. 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 */
+
+/* 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(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK(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(riid,FAIL,"GRselect");
+
+        /* Check the image information */
+        ret=GRgetiminfo(riid,NULL,&ncomp,&nt,NULL,dimsizes,NULL);
+        CHECK(ret,FAIL,"GRgetiminfo");
+        VERIFY(ncomp,3,"GRgetiminfo");
+        VERIFY(nt,DFNT_UCHAR8,"GRgetiminfo");
+        VERIFY(dimsizes[0],dims[0],"GRgetiminfo");
+        VERIFY(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(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(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");
+} /* end test_mgr_pal_a() */
+
+/****************************************************************
+**
+**  test_mgr_pal(): Multi-file Raster/DFP Compatibility Tests
+** 
+**  VIII. 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  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];
+   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 (FILE_NAME, DFACC_WRITE, 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 (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(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(status, FAIL, "GRsetchunk");
+
+   /*
+   * Write first data chunk ( 0, 0 ). 
+   */
+   origin[0] = origin[1] = 0;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk00);
+   CHECK(status, FAIL, "GRwritechunk");
+
+   /*
+   * Write second data chunk ( 0, 1 ). 
+   */
+   origin[0] = 0; origin[1] = 1;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk01);
+   CHECK(status, FAIL, "GRwritechunk");
+
+   /*
+   * Write third data chunk ( 1, 4 ). 
+   */
+   origin[0] = 1; origin[1] = 4;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk14);
+   CHECK(status, FAIL, "GRwritechunk");
+   /*
+   * Read third chunk back.
+   */
+   origin[0] = 1; origin[1] = 4;
+   status = GRreadchunk(ri_id[i], origin, (VOIDP)chunk_buf);
+   CHECK(status, FAIL, "GRreadchunk");
+
+   /*
+   * Terminate access to the GR interface and close the HDF file.
+   */
+   status = GRendaccess (ri_id[i]);
+   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 (FILE_NAME, DFACC_WRITE, 0); 
+    CHECK(file_id, FAIL, "Hopen");
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+   CHECK(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(index, FAIL, "GRnametoindex");
+   
+   /* 
+   * Select the image.
+   */
+   ri_id[i] = GRselect(gr_id, index);
+   CHECK(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(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(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(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");
+}
+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];
+   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(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 (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(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(status, FAIL, "GRsetchunk");
+
+   /*
+   * Write first data chunk ( 0, 0 ). 
+   */
+   origin[0] = origin[1] = 0;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk00);
+   CHECK(status, FAIL, "GRwritechunk");
+
+   /*
+   * Write second data chunk ( 0, 1 ). 
+   */
+   origin[0] = 0; origin[1] = 1;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk01);
+   CHECK(status, FAIL, "GRwritechunk");
+
+   /*
+   * Write third data chunk ( 1, 4 ). 
+   */
+   origin[0] = 1; origin[1] = 4;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk14);
+   CHECK(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(status, FAIL, "GRendaccess");
+/* } */ /* end for*/
+   status = GRend (gr_id);
+   CHECK(status, FAIL, "GRend");
+   status = Hclose (file_id);
+   CHECK(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(file_id, FAIL, "Hopen");
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+   CHECK(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(index, FAIL, "GRnametoindex");
+   
+   /* 
+   * Select the image.
+   */
+   ri_id[i] = GRselect(gr_id, index);
+   CHECK(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(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(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(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");
+}
+/****************************************************************
+**
+**  test_mgr_chunkwr(): GR chunking test 
+** 
+**  X. 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 it's 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
+        VIII. Access to old-style images - test_mgr_old
+        VIII. Compressed images         - test_mgr_compress
+        X.  Chunking write/read test 
+            with enabled compression    - test_mgr_chunkwr
+    */
+
+    /* 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(0);
+    test_mgr_old(0);
+    test_mgr_compress(0);
+    test_mgr_r24(0);
+    test_mgr_r8(0);
+    test_mgr_chunkwr();
+#ifdef LATER
+    test_mgr_pal(0);    /* read in old-style DFP palette tests */
+#endif /* LATER */
+}   /* test_mgr() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/mgrf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/mgrf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/mgrf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1518 @@
+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: mgrf.f,v 1.27 2000/10/02 19:46:30 epourmal Exp $
+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                        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
+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)
+      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,
+     .          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 = 6)
+      parameter (DEFLATE_LEVEL = 1,
+     .           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 - 1
+      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     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 
+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
+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_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 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/, 
+     .      chunk21 /
+     .                210, 211, 212, 220, 221, 222,
+     .                230, 231, 232, 240, 241, 242,
+     .                250, 251, 252, 260, 261, 262
+     .              /,
+     .      chunk52 /
+     .                1010, 1011, 1012, 1020, 1021, 1022,
+     .                1030, 1031, 1032, 1040, 1041, 1042,
+     .                1050, 1051, 1052, 1060, 1061, 1062
+     .              /,
+     .      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 
+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

Added: packages/libhdf4/branches/upstream/current/hdf/test/mgrf_sunOS.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/mgrf_sunOS.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/mgrf_sunOS.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1463 @@
+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: mgrf_sunOS.f,v 1.1 1999/05/05 14:45:32 epourmal Exp $
+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
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/nbit.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/nbit.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/nbit.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1128 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/*
+   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,v 1.17 1996/11/11 20:39:59 koziol Exp $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.17 $";
+#endif
+
+#include "tproto.h"
+#define TESTFILE_NAME "tnbit.hdf"
+#define DATAFILE_NAME "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(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(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(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("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(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(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(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("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(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(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_UINT16, NBIT_SIZE3, DFACC_WRITE, 0, 0);
+    CHECK(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(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(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("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(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(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_INT16, NBIT_SIZE4, DFACC_WRITE, 0, 0);
+    CHECK(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(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(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("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(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(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_UINT32, NBIT_SIZE5, DFACC_WRITE, 0, 0);
+    CHECK(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(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(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("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(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(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_INT32, NBIT_SIZE6, DFACC_WRITE, 0, 0);
+    CHECK(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(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(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("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(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(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(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("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(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(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(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("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(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(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_UINT16, NBIT_SIZE9, DFACC_WRITE, 0, 0);
+    CHECK(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(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(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("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(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(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_INT16, NBIT_SIZE10, DFACC_WRITE, 0, 0);
+    CHECK(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(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(ret, FAIL, "DFKconvert");
+
+    for (i = 0; i < NBIT_SIZE10; i++)
+      {
+          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("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(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(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_UINT32, NBIT_SIZE11, DFACC_WRITE, 0, 0);
+    CHECK(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(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(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("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(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(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_INT32, NBIT_SIZE12, DFACC_WRITE, 0, 0);
+    CHECK(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(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(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("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(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(ret, FAIL, "Hclose");
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/nbit.dat
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/test/nbit.dat
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/test/rig.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/rig.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/rig.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1919 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.37 $";
+#endif
+
+/* $Id: rig.c,v 1.37 1998/12/08 21:37:51 koziol Exp $ */
+
+#include "tproto.h"
+
+#define XSIZE 13
+#define YSIZE 15
+#define TESTFILE "tdf24.hdf"
+
+#define JPEGX   46
+#define JPEGY   23
+#define JPEGFILE "tjpeg.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} 
+};
+
+static 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 
+};
+
+#define ABS(x)  ((int)(x)<0 ? (-x) : x)
+
+static intn
+fuzzy_memcmp(const void *s1, const void *s2, int32 len, intn fuzz_factor);
+static VOID
+check_im_pal(int32 oldx, int32 oldy, int32 newx, int32 newy,
+             uint8 *oldim, uint8 *newim, uint8 *oldpal, uint8 *newpal);
+
+static 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() */
+
+#ifdef DEC_ALPHA
+#define JPEG_FUZZ 13
+#else
+#define JPEG_FUZZ 1
+#endif
+
+/* ------------------------------- test_r24 ------------------------------- */
+
+void
+test_r24(void)
+{
+    comp_info   cinfo;          /* compression information for the JPEG */
+    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++;
+      }
+
+    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");
+    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");
+#ifdef QAK
+{
+    intn i,j,k;
+    intn out_cnt=0;
+
+    printf("retrieved quality 80\n");
+    for(i=0; i<JPEGY; i++) {
+        for(j=0; j<JPEGX; j++) {
+            for(k=0; k<3; k++) 
+                out_cnt+=printf("%d, ",(intn)*(jpeg_24bit_temp+(i*JPEGX*3)+(j*3)+k));
+            if(out_cnt>80) {
+                printf("\n");
+                out_cnt=0;
+              } /* end if */
+          } /* end for */
+        out_cnt=0;
+        printf("\n\n");
+      } /* end for */
+    printf("\n");
+} /* end block */
+#endif /* QAK */
+
+    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++;
+      }
+
+    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");
+#ifdef QAK
+{
+    intn i,j,k;
+    intn out_cnt=0;
+
+    printf("retrieved quality 30\n");
+    for(i=0; i<JPEGY; i++) {
+        for(j=0; j<JPEGX; j++) {
+            for(k=0; k<3; k++) 
+                out_cnt+=printf("%d, ",(intn)*(jpeg_24bit_temp+(i*JPEGX*3)+(j*3)+k));
+            if(out_cnt>80) {
+                printf("\n");
+                out_cnt=0;
+              } /* end if */
+          } /* end for */
+        out_cnt=0;
+        printf("\n\n");
+      } /* end for */
+    printf("\n");
+} /* end block */
+#endif /* QAK */
+
+    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++;
+      }
+
+    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");
+#ifdef QAK
+{
+    intn i,j,k;
+    intn out_cnt=0;
+
+    printf("retrieved quality 75\n");
+    for(i=0; i<JPEGY; i++) {
+        for(j=0; j<JPEGX; j++) {
+            for(k=0; k<3; k++) 
+                out_cnt+=printf("%d, ",(intn)*(jpeg_24bit_temp+(i*JPEGX*3)+(j*3)+k));
+            if(out_cnt>80) {
+                printf("\n");
+                out_cnt=0;
+              } /* end if */
+          } /* end for */
+        out_cnt=0;
+        printf("\n\n");
+      } /* end for */
+    printf("\n");
+} /* end block */
+#endif /* QAK */
+
+    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));
+#ifdef QAK
+          print_image24("JPEG(75) Correct image", (uint8 *) jpeg_24bit_j75, JPEGX, JPEGY);
+          print_image24("JPEG(75) New image", (uint8 *) jpeg_24bit_temp, JPEGX, JPEGY);
+#endif
+          num_errs++;
+      }
+
+    HDfree(jpeg_24bit_temp);
+}
+
+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
+
+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, im1, XD1, YD1, 0);
+    RESULT("DFR8putimage");
+    num_images++;
+    ref1 = DFR8lastref();
+
+    MESSAGE(5, printf("Putting image RLE compression\n");
+        );
+    ret = DFR8addimage(TESTFILE, 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, im3, XD3, YD3, DFTAG_IMCOMP);
+    RESULT("DFR8addimage");
+    num_images++;
+    ref3 = DFR8lastref();
+#endif /* DONT_TEST_IMCOMP */     /* QAK */
+
+    ret = DFR8nimages(TESTFILE);
+    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, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+    ret = DFR8getimage(TESTFILE, (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, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+
+#ifdef DONT_TEST_IMCOMP /* QAK */
+    MESSAGE(5, printf("Verifying IMCOMP compressed image\n");
+        );
+
+    ret = DFR8getdims(TESTFILE, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+    ret = DFR8getimage(TESTFILE, (uint8 *) ii3, (int32) XD3, (int32) YD3, ipal);
+    RESULT("DFR8getimage");
+#endif /* DONT_TEST_IMCOMP */     /* QAK */
+
+    MESSAGE(5, printf("Rechecking RLE image\n");
+        );
+
+    ret = DFR8readref(TESTFILE, ref2);
+    RESULT("DFR8readref");
+    ret = DFR8getimage(TESTFILE, (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, ref1);
+    RESULT("DFR8writeref");
+    ret = DFR8setpalette(pal2);
+    RESULT("DFR8setpalette");
+    ret = DFR8addimage(TESTFILE, im1, XD1, YD1, DFTAG_RLE);
+    RESULT("DFR8addimage");
+
+    MESSAGE(5, printf("Verifying palette change\n");
+        );
+
+    ret = DFR8readref(TESTFILE, ref1);
+    RESULT("DFR8readref");
+    ret = DFR8getdims(TESTFILE, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+    ret = DFR8getimage(TESTFILE, (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");
+#ifdef QAK
+{
+    intn i,j;
+
+    printf("retrieved quality 80\n");
+    for(i=0; i<JPEGY; i++) {
+        for(j=0; j<JPEGX; j++) 
+            printf("%d, ",(intn)*(jpeg_8bit_temp+(i*JPEGX)+j));
+        printf("\n\n");
+      } /* end for */
+    printf("\n");
+} /* end block */
+#endif /* QAK */
+
+    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");
+#ifdef QAK
+{
+    intn i,j;
+
+    printf("retrieved quality 30\n");
+    for(i=0; i<JPEGY; i++) {
+        for(j=0; j<JPEGX; j++) 
+            printf("%d, ",(intn)*(jpeg_8bit_temp+(i*JPEGX)+j));
+        printf("\n\n");
+      } /* end for */
+    printf("\n");
+} /* end block */
+#endif /* QAK */
+
+    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");
+#ifdef QAK
+{
+    intn i,j;
+
+    printf("retrieved quality 75\n");
+    for(i=0; i<JPEGY; i++) {
+        for(j=0; j<JPEGX; j++) 
+            printf("%d, ",(intn)*(jpeg_8bit_temp+(i*JPEGX)+j));
+        printf("\n\n");
+      } /* end for */
+    printf("\n");
+} /* end block */
+#endif /* QAK */
+
+    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);
+}
+
+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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/sdmms.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/sdmms.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/sdmms.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,459 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.13 $";
+#endif
+
+/* $Id: sdmms.c,v 1.13 1996/03/28 21:58:12 koziol Exp $ */
+
+#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)
+{
+    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++)
+            {
+                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 * 400000000) + 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 * 400000000) + 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(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");) ;
+
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/sdnmms.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/sdnmms.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/sdnmms.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,472 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.12 $";
+#endif
+
+/* $Id: sdnmms.c,v 1.12 1996/11/11 20:40:02 koziol Exp $ */
+
+#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");) ;
+
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/sdstr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/sdstr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/sdstr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,143 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.12 $";
+#endif
+
+/* $Id: sdstr.c,v 1.12 1996/05/16 18:42:58 koziol Exp $ */
+
+/***************************************************************
+**
+** 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++;
+      }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/slab.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/slab.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/slab.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2873 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "$Id: slab.c,v 1.18 1997/10/25 00:56:23 koziol Exp $";
+#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();
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/slabwf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/slabwf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/slabwf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,532 @@
+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: slabwf.f,v 1.21 1997/11/16 03:44:13 acheng Exp $
+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
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/t24f.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/t24f.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/t24f.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,248 @@
+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: t24f.f,v 1.10 1997/10/24 17:28:00 acheng Exp $
+C
+      subroutine t24f (number_failed)
+      implicit none
+      include 'fortest.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 d2setil, d2reqil, d2pimg, d2aimg
+      integer d2gdims, d2gimg, d2first
+
+      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(k,j,i) .ne. buf2(k,j,i)) 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
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/tanf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tanf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tanf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,228 @@
+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: tanf.f,v 1.19 1997/10/24 17:28:01 acheng Exp $
+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
+
+      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+1)
+      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
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/tanfilef.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tanfilef.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tanfilef.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,209 @@
+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: tanfilef.f,v 1.17 1997/10/24 17:28:02 acheng Exp $
+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

Added: packages/libhdf4/branches/upstream/current/hdf/test/tbv.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tbv.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tbv.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,230 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.3 $";
+#endif
+
+/* $Id: tbv.c,v 1.3 1996/11/11 20:40:05 koziol Exp $ */
+
+/*
+   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(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY(size,BV_DEFAULT_BITS,"bv_size");
+    flags=bv_flags(b);
+    CHECK(flags,(uint32)FAIL,"bv_flags");
+    MESSAGE(8, printf("Bit-vector flags=%lx\n",(unsigned long)flags););
+    ret=bv_delete(b);
+    CHECK(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(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY(size,80000,"bv_size");
+    flags=bv_flags(b);
+    CHECK(flags,(uint32)FAIL,"bv_flags");
+    MESSAGE(8, printf("Bit-vector flags=%lx\n",(unsigned long)flags););
+    ret=bv_delete(b);
+    CHECK(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(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY(size,BV_DEFAULT_BITS,"bv_size");
+    flags=bv_flags(b);
+    CHECK(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(ret,FAIL,"bv_set");
+    ret=bv_set(b,3,BV_TRUE);
+    CHECK(ret,FAIL,"bv_set");
+    ret=bv_set(b,150,BV_TRUE);
+    VERIFY(ret,FAIL,"bv_set");
+    /* Check getting bits */
+    ret=bv_get(b,2);
+    VERIFY(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,3);
+    VERIFY(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,0);
+    VERIFY(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,13);
+    VERIFY(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,-1);
+    VERIFY(ret,FAIL,"bv_get");
+    ret=bv_delete(b);
+    CHECK(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(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY(size,1000,"bv_size");
+    flags=bv_flags(b);
+    CHECK(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(ret,FAIL,"bv_set");
+    ret=bv_set(b,3,BV_TRUE);
+    CHECK(ret,FAIL,"bv_set");
+    ret=bv_set(b,1050,BV_TRUE);
+    CHECK(ret,FAIL,"bv_set");
+    /* Check getting bits */
+    ret=bv_get(b,2);
+    VERIFY(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,3);
+    VERIFY(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,0);
+    VERIFY(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,13);
+    VERIFY(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,1040);
+    VERIFY(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,1050);
+    VERIFY(ret,BV_TRUE,"bv_get");
+    ret=bv_delete(b);
+    CHECK(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(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY(size,BV_DEFAULT_BITS,"bv_size");
+    flags=bv_flags(b);
+    CHECK(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(ret,FAIL,"bv_set");
+    ret=bv_set(b,3,BV_TRUE);
+    CHECK(ret,FAIL,"bv_set");
+    ret=bv_set(b,150,BV_TRUE);
+    CHECK(ret,FAIL,"bv_set");
+
+    /* Check getting bits */
+    ret=bv_get(b,2);
+    VERIFY(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,3);
+    VERIFY(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,0);
+    VERIFY(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,13);
+    VERIFY(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,140);
+    VERIFY(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,150);
+    VERIFY(ret,BV_TRUE,"bv_get");
+
+    size=bv_find(b,-1,BV_FALSE);
+    CHECK(size,FAIL,"bv_find");
+    MESSAGE(8, printf("First 0 found at: %lu\n",(unsigned long)size););
+    ret=bv_set(b,size,BV_TRUE);
+    CHECK(ret,FAIL,"bv_set");
+
+    size=bv_find(b,-1,BV_FALSE);
+    CHECK(size,FAIL,"bv_find");
+    MESSAGE(8, printf("Second 0 found at: %lu\n",(unsigned long)size););
+    ret=bv_set(b,size,BV_TRUE);
+    CHECK(ret,FAIL,"bv_set");
+
+    size=bv_find(b,-1,BV_FALSE);
+    CHECK(size,FAIL,"bv_find");
+    MESSAGE(8, printf("Third 0 found at: %lu\n",(unsigned long)size););
+    ret=bv_set(b,size,BV_TRUE);
+    CHECK(ret,FAIL,"bv_set");
+
+    size=bv_find(b,-1,BV_FALSE);
+    CHECK(size,FAIL,"bv_find");
+    MESSAGE(8, printf("Fourth 0 found at: %lu\n",(unsigned long)size););
+    ret=bv_set(b,size,BV_TRUE);
+    CHECK(ret,FAIL,"bv_set");
+
+    ret=bv_delete(b);
+    CHECK(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() */
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/testhdf.386
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/testhdf.386	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/testhdf.386	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,10 @@
+DEBUG ALL
+#OPTION DOSSEG
+OPTION MAP=testhdf
+OPTION VERBOSE
+LIBPATH ..\lib
+
+NAME testhdf
+FILE testhdf, rig, sdstr, blocks, an, anfile, extelt, file, file1, vers
+FILE sdmms, sdnmms, slab, litend, tvset, comp, conv, bitio, tree
+LIBRARY df

Added: packages/libhdf4/branches/upstream/current/hdf/test/testhdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/testhdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/testhdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,339 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.46 $";
+#endif
+
+/* $Id: testhdf.c,v 1.46 1999/01/13 19:19:39 koziol Exp $ */
+
+/*
+   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.
+
+ */
+
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#define MAXNUMOFTESTS 30
+#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];
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+#if !(defined MAC || defined __MWERKS__ || defined SYMANTEC_C)
+    /* Un-buffer the stdout and stderr */
+    setbuf(stderr, NULL);
+    setbuf(stdout, NULL);
+#endif
+    /* 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("buffer", test_buffer, "Buffered 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("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("vattr", test_vset_attr, "VSET AttributeTest");
+    InitTest("vsfpack", test_vspack, "Vdata fields pack Test");
+    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.%ur%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);
+                    );
+
+#ifdef QAK
+                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");
+                    );
+#endif
+
+            }   /* 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");
+              );
+#ifdef VMS   
+       system("delete *.tmp;*");
+#else        /* VMS */
+#if !(defined DOS386 | defined WIN386)
+          system("rm -f *.hdf *.tmp");
+#else   /* OLD_WAY */
+          remove("*.hdf");
+          remove("*.tmp");
+#endif  /* OLD_WAY */
+#endif  /* VMS */
+      }     /* end if */
+    exit(0);
+    return (0);
+}   /* end main() */

Added: packages/libhdf4/branches/upstream/current/hdf/test/testhdf.def
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/testhdf.def	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/testhdf.def	2007-05-14 09:41:34 UTC (rev 808)
@@ -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.
+;

Added: packages/libhdf4/branches/upstream/current/hdf/test/testhdf.lnk
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/testhdf.lnk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/testhdf.lnk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,5 @@
+testhdf rig sdstr blocks an anfile extelt file file1 vers sdmms sdnmms slab litend
+testhdf /noi
+testhdf
+..\lib\df.lib /NOD:LLIBCE LLIBCEWQ LIBW
+testhdf

Added: packages/libhdf4/branches/upstream/current/hdf/test/testhdf.pc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/testhdf.pc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/testhdf.pc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4 @@
+testhdf rig sdstr blocks an anfile extelt file file1 vers sdmms sdnmms slab litend comp tvset conv nbit bitio tree
+testhdf /noi
+testhdf
+..\lib\df.lib,;
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/hdf/test/testhdf.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/testhdf.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/testhdf.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,658 @@
+(This file must be converted with BinHex 4.0)
+
+:$h4PFh4SC'BZF(*[DQ9MG!"069"b3eG*43!!!!"kT3!!!!#[Qf0[Ef`!!!!#!!!
+!+!!!GCd!!(A&!!!%i!!!!$!"!!!!!!!!!!!!!!!!"3%!rrm!!!!!!!!!!2rr!3%
+"!3%!!!!!(J%"!!!!!!!!!!#CQ3!!2rmrrcrr!!%!#3C0EfjKBfm!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!"!!S!!S"`J+!!#J!#J(#!S!!!!!!!!!!!!!!!!!
+!!!!!!3!!!3!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!J%!!!-
+!!`!"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!#!!-!#J!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%
+!!3!!%%eKBb"28b"38%-J3bp$+bXZY3!!!!!!!!!!!!!!!!!!3!!!!!!%!!!!!!3
+!!!3!!!!!"!"9!C!!!3N#H`!!!!!!!!!!!!!!!3"B!43#-3+$!-)!!+A-!!#rCh4
+PFh4SC'Bk4 at 4TG'pb!(4PFh4SC'Bk4QpZG!"dCA0dD'4Q1PGTEP*$)%0[EA"TE'9
+b!(4PFh4SC'BkH$Jf)%0[C'9(C at i!G'9cG'KNCMTi1$BJ6'PZDf9b!(4PFh4SC'B
+kH$Jf)&"bEfTPBh3!G'9cG'KNCMT3FQpUC at 0d)%9iG(*KF`"dCA0dD'4Q1N0eFh4
+[E5",C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A3!!!(DF(*PCJ!0-#!!!!!
+X!!!!!!!!!!!c6J!!!!a`FQ9Q!!eV(J!!!#d!!!!!!!!!!$0D!!!!BR"bC at B!$@*
+(!!!!,J!!!!!!!!!!-l`!!!!iF(*PCJ!0'I8!!!![!!!!!!!!!!!cp!!!!!e`FQ9
+Q!!dBR!!!!$!!!!!!!!!!!$3"!!!!&("bC at B!$CJ8!!!!-3!!!!!!!!!!0"8!!!!
++F(*PCJ!05bF!!!!b!!!!!!!!!!!d(`!!!-4`FQ9Q!!fq``!!!$-!!!!!!!!!!'Z
+(!!!"&R"bC at B!$HMX!!!!0!!!!!!!!!!!E*d!!!#kF(*PCJ!0`fm!!!!e!!!!!!!
+!!!"Y9`!!!#j`FQ9Q!!fZS`!!!$B!!!!!!!!!!'kh!!!#$("bC at B!$6Nk!!!!0`!
+!8#-!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/test/tmgr.dat
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/test/tmgr.dat
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/test/tpf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tpf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tpf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,233 @@
+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: tpf.f,v 1.16 1997/10/24 17:28:03 acheng Exp $
+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
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/tproto.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tproto.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tproto.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,51 @@
+/****************************************************************************
+ * 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: tproto.h,v 1.27 1999/01/13 19:19:40 koziol Exp $ */
+
+#ifndef _TPROTO_H
+#define _TPROTO_H
+
+#include "hdf.h"
+#include "tutils.h"
+
+void        test_an(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_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_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_bitvect(void);
+void        test_chunks(void);
+void        test_buffer(void);
+
+#endif /* _TPROTO_H */

Added: packages/libhdf4/branches/upstream/current/hdf/test/tr8f.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tr8f.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tr8f.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,285 @@
+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: tr8f.f,v 1.12 1997/10/24 17:28:04 acheng Exp $
+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
+
+ 
+      
+      
+
+
+
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/tree.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tree.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tree.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,150 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.12 $";
+#endif
+
+/* $Id: tree.c,v 1.12 1997/11/13 15:12:44 koziol Exp $ */
+
+/*
+   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() */

Added: packages/libhdf4/branches/upstream/current/hdf/test/tsdmmsf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tsdmmsf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tsdmmsf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,341 @@
+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: tsdmmsf.f,v 1.17 1999/03/27 20:00:33 epourmal Exp $
+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
+C
+C  **** VMS users ****
+C
+C  VMS has a special way of handling the passsing of character
+C   strings between C and FORTRAN.  For these tests to work 
+C   correctly, you must change the definition of i8 and ti8
+C   to be 'byte' not 'character'  You will also need to remove
+C   a couple of calls to char().  If you search on the string 
+C   VMS you should be able to find all of the necessary changes.
+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
+
+C Change these to be of type 'byte' for VMS      
+C      byte i8(10,10), ti8(10,10)
+C      byte i8scale(10), ti8scale(10), i8max, i8min
+C      byte ti8max, ti8min   
+      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
+C Use the following lines for VMS
+C      i8min = -128
+C      i8max = 127
+      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
+C  Use the following line for VMS
+C            i8(i,j) =  (i * 10) + 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
+C  Use the following line for VMS
+C          i8scale(i) = (i * 10) + 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

Added: packages/libhdf4/branches/upstream/current/hdf/test/tsdnmmsf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tsdnmmsf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tsdnmmsf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,302 @@
+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: tsdnmmsf.f,v 1.18 1999/03/27 20:00:34 epourmal Exp $
+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
+C  **** VMS users ****
+C
+C  VMS has a special way of handling the passsing of character
+C   strings between C and FORTRAN.  For these tests to work 
+C   correctly, you must change the definition of i8 and ti8
+C   to be 'byte' not 'character'  You will also need to remove
+C   a couple of calls to char().  If you search on the string 
+C   VMS you should be able to find all of the necessary changes.
+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
+
+C  Change these to be of type 'byte' for VMS      
+C      byte i8(10,10), ti8(10,10)
+C      byte i8scale(10), ti8scale(10), i8max, i8min
+C      byte ti8max, ti8min
+      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
+C Use the following lines for VMS
+C      i8min = -128
+C      i8max = 127
+      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
+C  Use the following line for VMS
+C            i8(i,j) =  (i * 10) + 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
+C  Use the following line for VMS
+C          i8scale(i) = (i * 10) + 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

Added: packages/libhdf4/branches/upstream/current/hdf/test/tsdnntf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tsdnntf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tsdnntf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,276 @@
+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: tsdnntf.f,v 1.14 1997/10/24 17:28:05 acheng Exp $
+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
+
+C  **** VMS users ****
+C
+C  VMS has a special way of handling the passsing of character
+C   strings between C and FORTRAN.  For these tests to work 
+C   correctly, you must change the definition of i8 and ti8
+C   to be 'byte' not 'character'  You will also need to remove
+C   a couple of calls to char().  If you search on the string 
+C   VMS you should be able to find all of the necessary changes.
+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)
+      
+C  Change these to be of type 'byte' for VMS
+C      byte      i8(10,10), ti8(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
+C  Use the following line for VMS
+C            i8(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
+C     Use the following line for VMS
+C     ti8(i,j) = 0
+             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

Added: packages/libhdf4/branches/upstream/current/hdf/test/tsdntf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tsdntf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tsdntf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,263 @@
+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: tsdntf.f,v 1.14 1997/10/24 17:28:06 acheng Exp $
+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
+C  **** VMS users ****
+C
+C  VMS has a special way of handling the passsing of character
+C   strings between C and FORTRAN.  For these tests to work 
+C   correctly, you must change the definition of i8 and ti8
+C   to be 'byte' not 'character'  You will also need to remove
+C   a couple of calls to char().  If you search on the string 
+C   VMS you should be able to find all of the necessary changes.
+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)
+
+C  Change these to be of type 'byte' for VMS
+C      byte      i8(10,10), ti8(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
+C  Use the following line for VMS
+C            i8(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
+C Use the following line for VMS
+C           ti8(i,j) = 0
+  	    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  

Added: packages/libhdf4/branches/upstream/current/hdf/test/tsdstrf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tsdstrf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tsdstrf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,131 @@
+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: tsdstrf.f,v 1.10 1997/01/17 19:08:14 sxu Exp $
+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

Added: packages/libhdf4/branches/upstream/current/hdf/test/tstubsf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tstubsf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tstubsf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,423 @@
+C****************************************************************************
+C* $Id: tstubsf.f,v 1.18 1997/01/17 19:08:16 sxu Exp $			    *
+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
+      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

Added: packages/libhdf4/branches/upstream/current/hdf/test/tutils.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tutils.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tutils.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * 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: tutils.h,v 1.16 1997/05/22 23:36:57 sxu Exp $ */
+
+#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 */
+#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++;} \
+} while(0)
+
+/* 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++;} \
+} 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"
+
+/* System command to use for Cleanup */
+#ifdef VMS
+#define CLEAN_CMD	"delete *.hdf;*"
+#else
+#   ifdef WIN32
+#   define CLEAN_CMD  "del *.hdf"   
+#   else
+/* default is Unix */
+#   define CLEAN_CMD	"rm -f *.hdf"
+#   endif  /* WIN32  */
+#endif /*VMS */
+#endif /* _TUTILS_H */

Added: packages/libhdf4/branches/upstream/current/hdf/test/tv1.res
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tv1.res	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tv1.res	2007-05-14 09:41:34 UTC (rev 808)
@@ -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  
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/tv2.res
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tv2.res	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tv2.res	2007-05-14 09:41:34 UTC (rev 808)
@@ -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})

Added: packages/libhdf4/branches/upstream/current/hdf/test/tvattr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tvattr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tvattr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,741 @@
+/*******************************************************************
+ * 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.                                               *
+ *                                                                 *
+ *******************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.11 $";
+#endif
+
+/* $Id: tvattr.c,v 1.11 1998/02/02 18:44:52 pharten Exp $ */
+
+/**************************************************************
+*
+* 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.
+*
+* wrtie_vset_stuff() creates 1 empty vgroup and 1 vgroup having 1 
+*  vdata. wirte_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.  
+*
+**************************************************************/
+#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
+
+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 write_vset_stuff(void);
+static intn write_vattrs(void);
+static intn read_vattrs(void);
+
+/* create vdatas and vgroups */
+
+static intn write_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;
+} /* write_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;
+  }
+   /* 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;
+}
+
+/* main test driver */
+void
+test_vset_attr(void)   
+{
+   write_vset_stuff();
+   write_vattrs();
+   read_vattrs(); 
+} /* test_vset_attr */

Added: packages/libhdf4/branches/upstream/current/hdf/test/tvattr.dat
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/test/tvattr.dat
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/test/tvattrf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tvattrf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tvattrf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,328 @@
+C***********************************************************
+C * NCSA HDF
+C   *
+C * Software Development Group
+C   *
+C * National Center for Supercomputing Applications
+C   *
+C * University of Illinois at Urbana-Champaign
+C   *
+C * 605 E. Springfield, Champaign IL 61820
+C   *
+C *
+C   *
+C * For conditions of distribution and use, see the accompanying
+C   *
+C * hdf/COPYING file.
+C   *
+C *
+C   *
+C***************************************************
+C
+C $Id: tvattrf.f,v 1.15 1998/03/05 00:24:46 pharten Exp $
+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: tvattr.dat
+C Output file: tvattrf.hdf
+
+      implicit none
+      include 'fortest.inc'
+
+      integer number_failed
+
+      character*20 myname, ifn, ofn
+      parameter (myname = 'vattrf',
+     +           ifn = '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
+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, DFNT_CHAR
+      integer DFNT_INT32, DFNT_FLOAT32 
+      integer VSET_VERSION, VSET_NEW_VERSION
+      integer HDF_VDATA
+
+      parameter (DFACC_CREATE = 4,
+     +           DFACC_RDWR = 3,
+     +           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 
+      fid1 = hopen(ifn, DFACC_RDWR, 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
+
+
+
+
+
+
+
+
+
+       
+
+     
+        
+     

Added: packages/libhdf4/branches/upstream/current/hdf/test/tvset.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tvset.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tvset.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1868 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.35 $";
+#endif
+
+/* $Id: tvset.c,v 1.35 1998/12/08 21:37:53 koziol Exp $ */
+
+/*
+ *
+ * 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 FNAME1   "tvset1.hdf"
+#define FNAME2   "tvset2.hdf"
+#define EXTFNM	 "tvsetext.hdf"
+#define EMPTYNM  "tvsempty.hdf"
+
+#define FIELD1       "FIELD_name_HERE"
+#define FIELD1_UPPER "FIELD_NAME_HERE"
+#define FIELD2       "DIFFERENT_FIELD_NAME"
+
+#define ST "STATION_NAME"
+#define VL "VALUES"
+#define FL "FLOATS"
+#define MX "STATION_NAME,VALUES,FLOATS"
+#define EMPTY_VDATA "Empty"
+
+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);
+
+/* 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");
+
+    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");
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"Vdetach: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        name[512], class[512], fields[512];
+    char       *p;
+    int32       fid;
+    int32       vg1;
+    int32       vs1;
+    int32       status, num, i, count, intr, sz;
+    float32     fl_expected;
+    int32       in_expected;
+    char8       c_expected;
+
+    fid = Hopen(FNAME0, DFACC_RDONLY, 0);
+    if (fid == FAIL)
+      {
+          num_errs++;
+          return FAIL;
+      }
+
+    status = Vstart(fid);
+if(status==FAIL)
+    HEprint(stderr,0);
+    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 = Vgetname(vg1, name);
+    CHECK(status,FAIL,"Vgetname:vg1");
+
+    status = Vgetclass(vg1, class);
+    CHECK(status,FAIL,"Vgetclass:vg1");
+
+    if (HDstrcmp(name, "Second Vgroup"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vgroup name : %s\n", name);
+      }
+
+    if (HDstrcmp(class, "Test object"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vgroup class : %s\n", class);
+      }
+
+    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, name);
+    CHECK(status,FAIL,"VSgetname:vs1");
+
+    status = VSgetclass(vs1, class);
+    CHECK(status,FAIL,"VSgetclass:vs1");
+
+    if (HDstrcmp(name, "Float Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name (VSgetname) : %s\n", name);
+      }
+
+    if (HDstrcmp(class, "Test object"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata class : %s\n", class);
+      }
+
+    status = VSinquire(vs1, &count, &intr, fields, &sz, name);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSinquire failed on float Vdata\n");
+      }
+
+    if (HDstrcmp(name, "Float Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Float Vdata name (VSinquire) : %s\n", name);
+      }
+
+    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, name);
+    CHECK(status,FAIL,"VSgetname:vs1");
+
+    status = VSgetclass(vs1, class);
+    CHECK(status,FAIL,"VSgetclass:vs1");
+
+    if (HDstrcmp(name, "Integer Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name (VSgetname) : %s\n", name);
+      }
+
+    if (HDstrcmp(class, "Test object"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata class : %s\n", class);
+      }
+
+    status = VSinquire(vs1, &count, &intr, fields, &sz, name);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSinquire failed on float Vdata\n");
+      }
+
+    if (HDstrcmp(name, "Integer Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Integer Vdata name (VSinquire) : %s\n", name);
+      }
+
+    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, name);
+    CHECK(status,FAIL,"VSgetname:vs1");
+
+    status = VSgetclass(vs1, class);
+    CHECK(status,FAIL,"VSgetclass:vs1");
+
+    if (HDstrcmp(name, "Mixed Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name (VSgetname) : %s\n", name);
+      }
+
+    if (HDstrcmp(class, "No class specified"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata class : %s\n", class);
+      }
+
+    status = VSinquire(vs1, &count, &intr, fields, &sz, name);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSinquire failed on float Vdata\n");
+      }
+
+    if (HDstrcmp(name, "Mixed Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Mixed Vdata name (VSinquire) : %s\n", name);
+      }
+
+    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, name);
+    CHECK(status,FAIL,"VSgetname:vs1");
+
+    status = VSgetclass(vs1, class);
+    CHECK(status,FAIL,"VSgetclass:vs1");
+
+    if (HDstrcmp(name, "Multi-Order Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name (VSgetname) : %s\n", name);
+      }
+
+    if (HDstrcmp(class, "No class specified"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata class : %s\n", class);
+      }
+
+    status = VSinquire(vs1, &count, &intr, fields, &sz, name);
+    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.*/
+static void
+test_vsdelete(void)
+{
+#define FIELD_NAME     "Field Entries"
+#define NUMBER_OF_ROWS 10
+#define ORDER           3
+    int32  file_id;
+    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. */
+    file_id = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK(file_id,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK(status,FAIL,"Vstart:file_id");
+
+    /* Create a new vdata. */
+    vdata_id = VSattach(file_id, -1, "w");
+    CHECK(vdata_id,FAIL,"VSattach:vdata_id");
+          
+    /* Define the field data name, type and order. */
+    status = VSfdefine(vdata_id, FIELD_NAME, DFNT_INT16, ORDER);
+    CHECK(status,FAIL,"VSfdefine:vdata_id");
+
+    /* Specify the field(s) that will be written to. */
+    status = VSsetfields(vdata_id, FIELD_NAME);
+    CHECK(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(num_of_elements,FAIL,"VSwrite:");
+
+    /* Set the name and class. */
+    status = VSsetname(vdata_id, "Vdata should have been deleted");
+    CHECK(status,FAIL,"VSsetname:vdata_id");
+
+    status = VSsetclass(vdata_id, "Vdata should have been deleted");
+    CHECK(status,FAIL,"VSsetclass:vdata_id");
+
+    /* get ref of Vdata */
+    v_ref = VSQueryref(vdata_id);
+    CHECK(v_ref,FAIL,"VSQueryref:vdata_id");
+
+    /* Terminate access to the vdata. */
+    status = VSdetach(vdata_id);
+    CHECK(status,FAIL,"VSdetach:vdata_id");
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(file_id);
+    CHECK(status,FAIL,"Vend:file_id");
+
+    status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose:file_id");
+
+    /* Now open the file again and delete the vdata */
+    /* Open the HDF file. */
+    file_id = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK(file_id,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK(status,FAIL,"Vstart:file_id");
+
+    /* attach to Vdata */
+    vdata_id = VSattach(file_id, v_ref, "w");
+    CHECK(vdata_id,FAIL,"VSattach:vdata_id");
+
+    /* delete this Vdata */
+    status = VSdelete (file_id, v_ref);
+    CHECK(status,FAIL,"VSdelete:vdata_id");
+
+    /* Terminate access to the vdata. */
+    status = VSdetach(vdata_id);
+    CHECK(status,FAIL,"VSdetach:vdata_id");
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(file_id);
+    CHECK(status,FAIL,"Vend:file_id");
+
+    status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose:file_id");
+
+    /* Now open file again and try to attach to vdata with 'v_ref'.
+       The VSattach should fail. */
+    /* Open the HDF file. */
+    file_id = Hopen(FNAME0, DFACC_RDONLY, 0);
+    CHECK(file_id,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent the vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK(status,FAIL,"Vstart:file_id");
+
+    /* Try to attach to Vdata. This should fail now */
+    vdata_id = VSattach(file_id, 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(file_id);
+    CHECK(status,FAIL,"Vend:file_id");
+
+    status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose:file_id");
+
+} /* test_vsdelete */
+
+/* Testing Vdelete for vgroups. */ 
+static void
+test_vdelete(void)
+{
+    int32 file_id;
+    int32 vgroup_id;
+    int32 status;
+    int32 vg_ref;
+
+    /* Open the HDF file. */
+    file_id = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK(file_id,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK(status,FAIL,"Vstart:file_id");
+
+    /* Create a new vgroup. */
+    vgroup_id = Vattach(file_id, -1, "w");
+    CHECK(vgroup_id,FAIL,"Vattach:vgroup_id");
+          
+    /* Set the name and class. */
+    status = Vsetname(vgroup_id, "Vgroup should have been deleted");
+    CHECK(status,FAIL,"Vsetname:vgroup_id");
+
+    status = Vsetclass(vgroup_id, "Vgroup should have been deleted");
+    CHECK(status,FAIL,"Vsetclass:vgroup_id");
+
+    /* get ref of vgroup */
+    vg_ref = VQueryref(vgroup_id);
+    CHECK(vg_ref,FAIL,"VQueryref:vgroup_id");
+
+    /* Terminate access to the vgroup. */
+    status = Vdetach(vgroup_id);
+    CHECK(status,FAIL,"Vdetach:vgroup_id");
+    
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(file_id);
+    CHECK(status,FAIL,"Vend:file_id");
+
+    status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose:file_id");
+
+    /* Now open the file again and delete the vgroup */
+    /* Open the HDF file. */
+    file_id = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK(file_id,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK(status,FAIL,"Vstart:file_id");
+
+    /* attach to vgroup */
+    vgroup_id = Vattach(file_id, vg_ref, "w");
+    CHECK(vgroup_id,FAIL,"Vattach:vgroup_id");
+
+    /* delete this vgroup */
+    status = Vdelete (file_id, vg_ref);
+    CHECK(status,FAIL,"Vdelete:vgroup_id");
+
+    /* Terminate access to the vgroup. */
+    status = Vdetach(vgroup_id);
+    CHECK(status,FAIL,"VSdetach:vgroup_id");
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(file_id);
+    CHECK(status,FAIL,"Vend:file_id");
+
+    status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose:file_id");
+
+    /* Now open file again and try to attach to vgroup with 'vg_ref'.
+       The Vattach should fail. */
+    /* Open the HDF file. */
+    file_id = Hopen(FNAME0, DFACC_RDONLY, 0);
+    CHECK(file_id,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent the vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK(status,FAIL,"Vstart:file_id");
+
+    /* Try to attach to vgroup. This should fail now */
+    vgroup_id = Vattach(file_id, 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(file_id);
+    CHECK(status,FAIL,"Vend:file_id");
+
+    status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose:file_id");
+
+} /* test_vdelete */
+
+/* Testing Vdeletetagref() for vgroups. */ 
+static void
+test_vdeletetagref(void)
+{
+    int32 file_id;
+    int32 vgroup_id;
+    int32 status;
+    int32 vg_ref;
+
+    /* Open the HDF file. */
+    file_id = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK(file_id,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK(status,FAIL,"Vstart:file_id");
+
+    /* Create a new vgroup. */
+    vgroup_id = Vattach(file_id, -1, "w");
+    CHECK(vgroup_id,FAIL,"Vattach:vgroup_id");
+          
+    /* Set the name and class. */
+    status = Vsetname(vgroup_id, "Vgroup to delete elements from");
+    CHECK(status,FAIL,"Vsetname:vgroup_id");
+
+    status = Vsetclass(vgroup_id, "Vgroup to delete elements from");
+    CHECK(status,FAIL,"Vsetclass:vgroup_id");
+
+    /* add a few tag/ref pairs to Vgroup */
+    status = Vaddtagref(vgroup_id, 1000, 12345);
+    CHECK(status,FAIL,"Vaddtagref");
+    status = Vaddtagref(vgroup_id, 1000, 12346);
+    CHECK(status,FAIL,"Vaddtagref");
+
+#ifndef NO_DUPLICATES
+    /* duplicate tag/ref pairs allowed. 
+       So add a duplicate */
+    status = Vaddtagref(vgroup_id, 1000, 12346);
+    CHECK(status,FAIL,"Vaddtagref");
+
+#endif /* NO_DUPLICATES */
+
+    status = Vaddtagref(vgroup_id, 2000, 12345);
+    CHECK(status,FAIL,"Vaddtagref");
+    status = Vaddtagref(vgroup_id, 2000, 12346);
+    CHECK(status,FAIL,"Vaddtagref");
+
+    status = Vaddtagref(vgroup_id, 3000, 12345);
+    CHECK(status,FAIL,"Vaddtagref");
+    status = Vaddtagref(vgroup_id, 3000, 12346);
+    CHECK(status,FAIL,"Vaddtagref");
+
+    /* get ref of vgroup */
+    vg_ref = VQueryref(vgroup_id);
+    CHECK(vg_ref,FAIL,"VQueryref:vgroup_id");
+
+    /* delete one item in vgroup during this round */
+    status = Vdeletetagref(vgroup_id, 1000, 12346);
+    CHECK(status,FAIL,"Vdeletetagref:vgroup_id");
+
+    /* Terminate access to the vgroup. */
+    status = Vdetach(vgroup_id);
+    CHECK(status,FAIL,"Vdetach:vgroup_id");
+    
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(file_id);
+    CHECK(status,FAIL,"Vend:file_id");
+
+    status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose:file_id");
+
+    /* Now open the file again and delete two elements in the vgroup
+       during this round. */
+
+    /* Open the HDF file. */
+    file_id = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK(file_id,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK(status,FAIL,"Vstart:file_id");
+
+    /* attach to vgroup */
+    vgroup_id = Vattach(file_id, vg_ref, "w");
+    CHECK(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(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(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(status,FAIL,"Vdeletetagref:vgroup_id");
+
+    /* Terminate access to the vgroup. */
+    status = Vdetach(vgroup_id);
+    CHECK(status,FAIL,"VSdetach:vgroup_id");
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(file_id);
+    CHECK(status,FAIL,"Vend:file_id");
+
+    status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose:file_id");
+
+    /* 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. */
+    file_id = Hopen(FNAME0, DFACC_RDONLY, 0);
+    CHECK(file_id,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent the vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK(status,FAIL,"Vstart:file_id");
+
+    /* attach to vgroup, read only */
+    vgroup_id = Vattach(file_id, vg_ref, "r");
+    CHECK(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(file_id);
+    CHECK(status,FAIL,"Vend:file_id");
+
+    status = Hclose(file_id);
+    CHECK(status,FAIL,"Hclose:file_id");
+
+} /* 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 */
+#ifndef macintosh
+    char  name[VSNAMELENMAX], fields[FIELDNAMELENMAX*VSFIELDMAX];
+#else
+	// fields is too big - Mac has a 32K local data limit.
+    char  name[VSNAMELENMAX], *fields;
+    
+    fields = malloc(FIELDNAMELENMAX*VSFIELDMAX*sizeof(char));
+    if (fields == NULL)		return;
+#endif
+
+    /* Open the HDF file. */
+    fid = Hopen(EMPTYNM, DFACC_RDWR, 0);
+    CHECK(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK(status,FAIL,"Vstart");
+
+    /* Create a new vdata. */
+    vs1 = VSattach(fid, -1, "w");
+    CHECK(vs1,FAIL,"VSattach");
+
+    status=VSsetname(vs1, EMPTY_VDATA);
+    CHECK(status,FAIL,"VSsetname");
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK(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(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK(status,FAIL,"Vstart");
+
+    /* Find the empty vdata. */
+    ref=VSfind(fid,EMPTY_VDATA);
+    CHECK(ref,FAIL,"VSfind");
+
+    vs1 = VSattach(fid, ref, "r");
+    CHECK(vs1,FAIL,"VSattach");
+
+    status=VSgetname(vs1, name);
+    CHECK(status,FAIL,"VSgetname");
+
+    if (HDstrcmp(name, EMPTY_VDATA))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name : %s\n", name);
+      }
+
+    status=VFnfields(vs1);
+    VERIFY(status,0,"VFnfields");
+
+    status=VSgetfields(vs1,fields);
+    CHECK(status,FAIL,"VSgetfields");
+
+    if (HDstrcmp(fields, ""))
+      {
+          num_errs++;
+          printf(">>> Got bogus field names : %s\n", fields);
+      }
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK(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(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK(status,FAIL,"Vstart");
+
+    /* Find the empty vdata. */
+    ref=VSfind(fid,EMPTY_VDATA);
+    CHECK(ref,FAIL,"VSfind");
+
+    vs1 = VSattach(fid, ref, "w");
+    CHECK(vs1,FAIL,"VSattach");
+
+    /* Write out simple vdata fields */
+    status=VSfdefine(vs1, FIELD1, DFNT_FLOAT32, 1);
+    CHECK(status,FAIL,"VSfdefine");
+
+    status = VSfdefine(vs1, FIELD2, DFNT_INT32, 2);
+    CHECK(status,FAIL,"VSfdefine");
+
+    status = VSsetfields(vs1, FIELD1","FIELD2);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", name);
+      }
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK(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(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK(status,FAIL,"Vstart");
+
+    /* Find the empty vdata. */
+    ref=VSfind(fid,EMPTY_VDATA);
+    CHECK(ref,FAIL,"VSfind");
+
+    vs1 = VSattach(fid, ref, "r");
+    CHECK(vs1,FAIL,"VSattach");
+
+    status=VFnfields(vs1);
+    VERIFY(status,2,"VFnfields");
+
+    status=VSgetfields(vs1,fields);
+    CHECK(status,FAIL,"VSgetfields");
+
+    if (HDstrcmp(fields, FIELD1","FIELD2))
+      {
+          num_errs++;
+          printf(">>> Got bogus field names : %s\n", fields);
+      }
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK(status,FAIL,"Hclose");
+
+#ifdef macintosh
+	free(fields);
+#endif
+
+} /* test_emptyvdata() */
+
+/* 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_vsets */
+

Added: packages/libhdf4/branches/upstream/current/hdf/test/tvsetf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tvsetf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tvsetf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,547 @@
+C**********************************************************************
+C* NCSA HDF
+C*
+C* Software Development Group
+C*
+C* National Center for Supercomputing Applications
+C*
+C* University of Illinois at Urbana-Champaign
+C*
+C* 605 E. Springfield, Champaign IL 61820
+C*
+C*
+C*
+C* For conditions of distribution and use, see the accompanying
+C*
+C* hdf/COPYING file.
+C*
+C*
+C*
+C*********************************************************************
+C $Id: tvsetf.f,v 1.22 1999/01/22 22:45:09 epourmal Exp $
+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

Added: packages/libhdf4/branches/upstream/current/hdf/test/tvsfpack.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/tvsfpack.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/tvsfpack.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,322 @@
+#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 *) malloc(((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 */ 

Added: packages/libhdf4/branches/upstream/current/hdf/test/vers.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/vers.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/vers.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,44 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.8 $";
+#endif
+
+/* $Id: vers.c,v 1.8 1994/06/29 13:10:53 koziol Exp $ */
+
+/*
+   ***********************************************************************
+   ** 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);
+        );
+
+}

Added: packages/libhdf4/branches/upstream/current/hdf/test/win32tst.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/test/win32tst.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/test/win32tst.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,382 @@
+# 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 "win32tst.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 : $(OUTDIR)/testhdf.exe $(OUTDIR)/testhdf.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"testhdf.bsc" 
+
+$(OUTDIR)/testhdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/tvset.obj \
+	$(INTDIR)/man.obj \
+	$(INTDIR)/vers.obj \
+	$(INTDIR)/blocks.obj \
+	$(INTDIR)/tree.obj \
+	$(INTDIR)/testhdf.obj \
+	$(INTDIR)/rig.obj \
+	$(INTDIR)/sdmms.obj \
+	$(INTDIR)/an.obj \
+	$(INTDIR)/bitio.obj \
+	$(INTDIR)/vblocks.obj \
+	$(INTDIR)/sdstr.obj \
+	$(INTDIR)/conv.obj \
+	$(INTDIR)/litend.obj \
+	$(INTDIR)/file1.obj \
+	$(INTDIR)/sdnmms.obj \
+	$(INTDIR)/extelt.obj \
+	$(INTDIR)/nbit.obj \
+	$(INTDIR)/comp.obj \
+	$(INTDIR)/anfile.obj \
+	$(INTDIR)/file.obj \
+	$(INTDIR)/mgr.obj \
+	$(INTDIR)/slab.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"testhdf.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"testhdf.exe" 
+
+$(OUTDIR)/testhdf.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)/testhdf.exe $(OUTDIR)/testhdf.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /W3 /GX /Z7 /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /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)/"testhdf.bsc" 
+
+$(OUTDIR)/testhdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/tvset.obj \
+	$(INTDIR)/man.obj \
+	$(INTDIR)/vers.obj \
+	$(INTDIR)/blocks.obj \
+	$(INTDIR)/tree.obj \
+	$(INTDIR)/testhdf.obj \
+	$(INTDIR)/rig.obj \
+	$(INTDIR)/sdmms.obj \
+	$(INTDIR)/an.obj \
+	$(INTDIR)/bitio.obj \
+	$(INTDIR)/vblocks.obj \
+	$(INTDIR)/sdstr.obj \
+	$(INTDIR)/conv.obj \
+	$(INTDIR)/litend.obj \
+	$(INTDIR)/file1.obj \
+	$(INTDIR)/sdnmms.obj \
+	$(INTDIR)/extelt.obj \
+	$(INTDIR)/nbit.obj \
+	$(INTDIR)/comp.obj \
+	$(INTDIR)/anfile.obj \
+	$(INTDIR)/file.obj \
+	$(INTDIR)/mgr.obj \
+	$(INTDIR)/slab.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"testhdf.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"testhdf.exe" 
+
+$(OUTDIR)/testhdf.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=.\tvset.c
+
+$(INTDIR)/tvset.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\man.c
+
+$(INTDIR)/man.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vers.c
+
+$(INTDIR)/vers.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\blocks.c
+
+$(INTDIR)/blocks.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\tree.c
+
+$(INTDIR)/tree.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\testhdf.c
+
+$(INTDIR)/testhdf.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\rig.c
+
+$(INTDIR)/rig.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\sdmms.c
+
+$(INTDIR)/sdmms.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\tutils.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\an.c
+
+$(INTDIR)/an.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\bitio.c
+
+$(INTDIR)/bitio.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vblocks.c
+
+$(INTDIR)/vblocks.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\sdstr.c
+
+$(INTDIR)/sdstr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\conv.c
+
+$(INTDIR)/conv.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\litend.c
+
+$(INTDIR)/litend.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\file1.c
+
+$(INTDIR)/file1.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\sdnmms.c
+
+$(INTDIR)/sdnmms.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\extelt.c
+
+$(INTDIR)/extelt.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\nbit.c
+
+$(INTDIR)/nbit.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\comp.c
+
+$(INTDIR)/comp.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\anfile.c
+
+$(INTDIR)/anfile.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\file.c
+
+$(INTDIR)/file.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mgr.c
+
+$(INTDIR)/mgr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\tproto.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\slab.c
+
+$(INTDIR)/slab.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/HELINK.OPT
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/HELINK.OPT	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/HELINK.OPT	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2 @@
+sys$common:[syslib]tpushr/share
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/MAKEUTIL.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MAKEUTIL.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MAKEUTIL.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,64 @@
+$! ****************************************************************************
+$! * 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: MAKEUTIL.COM,v 1.16 1999/04/27 20:15:11 epourmal Exp $
+$!
+$! Make HDF utilities
+$ !
+$ ! This assumes that you have run top level MAKE.COM which came
+$ !   with the HDF distribution.  Otherwise, you will need to 
+$ !   manually define hdf$lib and sys$clib
+$ !
+$ type sys$input
+	Making utilities
+$ hdflib="[-.src]df/lib,[-.jpeg]libjpeg/lib,[-.zlib]libz/lib"
+$ hdfinc="([-.src],[-.jpeg],[-.zlib])"
+$ utils="hdfls,r8tohdf,hdfcomp,hdftor8,hdftopal,hdf8to24,"+-
+"jpeg2hdf,fp2hdf,fptest,he_main,he_cntrl,he_disp,he_file,"  +-
+"paltohdf,hdf24to8,hdfpack,ristosds,vshow,vmake,hdf2jpeg"
+$! "jpeg2hdf,fp2hdf,he_main,he_cntrl,he_disp,he_file"
+$! define/nolog hdf$lib MRLXP1$DKA200:[folk.dev.hdf.src]df.olb
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then
+$    define/nolog  sys$clib sys$library:deccrtl
+$    ccopt = "/DECC/STANDARD=VAXC/define=VMS/include='hdfinc"
+$ else
+$    define/nolog  sys$clib sys$library:vaxcrtl
+$    ccopt = "/define=VMS/include='hdfinc"
+$ endif
+$ cc 'ccopt  'utils
+$! link/exe=hdfed he_main,he_cntrl,he_disp,he_file,'hdflib, -
+ !  sys$clib/lib, helink.opt/option
+$ link/exe=hdfed he_main,he_cntrl,he_disp,he_file,helink.opt/option, 'hdflib, -
+   sys$clib/lib
+$ link hdfls,     'hdflib, sys$clib/lib
+$! link hdfrseq,   'hdflib, sys$clib/lib
+$ link r8tohdf,   'hdflib, sys$clib/lib
+$ link hdfcomp,   'hdflib, sys$clib/lib
+$ link hdftor8,   'hdflib, sys$clib/lib
+$ link hdftopal,  'hdflib, sys$clib/lib
+$ link paltohdf,  'hdflib, sys$clib/lib
+$ link hdf24to8,  'hdflib, sys$clib/lib
+$ link hdfpack,   'hdflib, sys$clib/lib
+$ link ristosds,  'hdflib, sys$clib/lib
+$ link vshow,     'hdflib, sys$clib/lib
+$ link vmake,     'hdflib, sys$clib/lib
+$ link hdf2jpeg,  'hdflib, sys$clib/lib
+$ link jpeg2hdf,  'hdflib, sys$clib/lib
+$ link hdf24to8,  'hdflib, sys$clib/lib
+$ link fp2hdf,    'hdflib, sys$clib/lib
+$ link fptest,    'hdflib, sys$clib/lib
+$ type sys$input
+	Made all utils
+****	Please edit setuputils.com and run the script to set up executables
+$ delete *.obj;*
+$

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/PalToHDF.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/PalToHDF.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/PalToHDF.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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!!!!(!!!!#!!!!!%!!!!%!!!!#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!!!(-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!!!,@`!!!"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!!!
+:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/R8ToHDF.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/R8ToHDF.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/R8ToHDF.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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!!!&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!!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!(`
+`!!!BF("bC at B!'E*X!!!!rJ!!!!!!!!!!-Z-!!!*NF(*PCJ!C(rS!!!$r!!!!!!!
+!!!#8S!!!),T`FQ9Q!"QBQ3!!!3!!!!!!!!!!!!X5!!!!"("bC at B!'CmY!!!"!3!
+!!!!!!!!!#aB!!!!BF(*PCJ!CMci!!!%#!!!!!!!!!!!,,J!!!!T`FQ9Q!"Pd#J!
+!!3-!!!!!!!!!!!Xi!!!!$R"bC at B!'Ar'!!!""!!!!!!!!!!!%+i!!!$'F(*PCJ!
+CpZ)!!!%&!!!!!!!!!!!4G!!!!$K`FQ9Q!"QKd`!!!3B!!!!!!!!!!!Y'!!!!$("
+bC at B!'@-P!!!""`!!!!!!!!!!08F!!!(DF(*PCJ!CC!-!!!%)!!!!!!!!!!!,8J!
+!!!a`FQ9Q!"NKM3!!!3N!!!!!!!!!!$Mb!!!!BR"bC at B!'Fp0!!!"#J!!!!!!!!!
+!0b%!!!!iF(*PCJ!C&&i!!!%,!!!!!!!!!!!,AJ!!!!e`FQ9Q!"NfA!!!!3`!!!!
+!!!!!!!`Y!!!!&("bC at B!'Gr&!!!"$3!!!!!!!!!!$%%!!!!+F(*PCJ!Ch#m!!!%
+1!!!!!!!!!!!j9!!!!-4`FQ9Q!"Q6IJ!!!3m!!!!!!!!!!$SB!!!"&R"bC at B!'69
+'!!!"%!!!!!!!!!!!1bi!!!#kF(*PCJ!CLTi!!!%4!!!!!!!!!!!lk!!!!#j`FQ9
+Q!"QL%3!!!4)!!!!!!!!!!%)+!!!#$("bC at B!'IB2!!!"%`!!Pf!!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/RISToHDF.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/RISToHDF.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/RISToHDF.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,964 @@
+(This file must be converted with BinHex 4.0)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!!!!!!!""`!!!!%T`FQ9
+Q!!%9C`!!!&X!!!!!!!!!!$Gb!!!"J'ecF'N!!!!"!!!!!!!!!!!!!!!!#e!!!!!
+DF(*PCJ!CLAB!!!%8!!!!!!!!!!"e3!!!'("`FQ9Q!"QFK`!!!48!!!!!!!!!!$6
+p!!!#C("bC at B!'@L!!!!"&J!!!!!!!!!!ME!!!##kF(*PCJ!CZfN!!!%A!!!!!!!
+!!!!-+3!!!!4`FQ9Q!"R4m3!!!4J!!!!!!!!!!!`Y!!!!'("bC at B!'LUZ!!!"'3!
+!!!!!!!!!$%8!!!!+F(*PCJ!D#&3!!!%D!!!!!!!!!!!3[!!!!!j`FQ9Q!"R1V3!
+!!4X!!!!!!!!!!"$+!!!!aR"bC at B!'Gr*!!!"(!!!!!!!!!!!12)!!!!iF(*PCJ!
+D#(%!!!%G!!!!!!!!!!!4N!!!!!!-F(*PCJ!D)Id!!!%H!!!!!!!!!!!j+J!!!GT
+`FQ9Q!"PdB`!!!4m!!!!!!!!!!"'F!!!!$("bC at B!'K5h!!!")!!!!!!!!!!!1`3
+!!!"LF(*PCJ!Cji3!!!%K!!!!!!!!!!!lCJ!!!$K`FQ9Q!"PNE!!!!5)!!!!!!!!
+!!"'S!!!!$A"bC at B!'C!!bJ!!!5-!!!!!!!!!!$ZH!!!!&("bC at B!'@)%!!!"*!!
+!!!!!!!!!0f%!!!!+F(*PCJ!CXDi!!!%P!!!!!!!!!!!lXJ!!!-4`FQ9Q!"RXq!!
+!!5B!!!!!!!!!!%)+!!!"&R"bC at B!'90)!!!"*`!!!!!!!!!!3b!!!!#kF(*PCJ!
+C9Q`!!!%S!!!!!!!!!!"$fJ!!!#j`FQ9Q!"Q)MJ!!!5N!!!!!!!!!!%3)!!!#$("
+bC at B!'HG,!!!"+J!!pN8!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/fp2hdf.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/fp2hdf.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/fp2hdf.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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!!!!!!!!"*%!!!!S!!!!!!!!"+i!!!!T!!!!!!!!"-i!!!!
+U!!!!!!!!"1i!!!!V!!!!!!!!"3B!!!!X!!!!!!!!"53!!!!Y!!!!!!!!"8%!!!!
+Z!!!!!!!!"9m!!!![!!!!!!!!"AJ!!!!`!!!!!!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C`FQ9Q!""r'J!!!)B!!!!!!!!!!%2N!!!!ZR"bC at B!%,m4!!!
+!K`!!!!!!!!!!%BS!!!!ZF(*PCJ!3+Ki!!!#)!!!!!!!!!!"%RJ!!!Ja`FQ9Q!""
+VcJ!!!)N!!,Lm!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdf24to8.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdf24to8.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdf24to8.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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!!!$6J!!!"e8CA0d!!!$DJ!
+!!"j%FQ&R!!!$K`!!!"p8FQ&M!!!$Q3!!!#!-4(*K!!!$ZJ!!!#%!!!'!!!!$f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!!!!!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!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfcomp.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfcomp.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfcomp.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+!!!!1D at aX3`!!!DJ!!!!28fK[G`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*PCJ!5hY8!!!#X!!!!!!!
+!!!!*dJ!!!!a`FQ9Q!"-Yd!!!!+d!!!!!!!!!!$Cl!!!!BR"bC at B!%c6D!!!!VJ!
+!!!!!!!!!0Yd!!!!iF(*PCJ!6NX!!!!#[!!!!!!!!!!!*hJ!!!!e`FQ9Q!"-kP!!
+!!,!!!!!!!!!!!!`c!!!!&("bC at B!%eL*!!!!X3!!!!!!!!!!#HX!!!!+F(*PCJ!
+5mI3!!!#b!!!!!!!!!!!l9J!!!-4`FQ9Q!"-A0J!!!,-!!!!!!!!!!%2N!!!"&R"
+bC at B!%cT,!!!!Y!!!!!!!!!!!42S!!!#kF(*PCJ!6 at iJ!!!#e!!!!!!!!!!!h&3!
+!!#j`FQ9Q!"1I#!!!!,B!!!!!!!!!!%Hq!!!#$("bC at B!%caU!!!!Y`!!ST8!!!:
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfed.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfed.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfed.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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`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`!!!!!!!!!!#CB!!!!BF(*PCJ!DJH-!!!"i!!!!!!!
+!!!!*VJ!!!!T`FQ9Q!"S'q`!!!(N!!!!!!!!!!!Qi!!!!$R"bC at B!'HXf!!!!HJ!
+!!!!!!!!!09J!!!$'F(*PCJ!D[bS!!!"l!!!!!!!!!!!,b`!!!$K`FQ9Q!"SCY`!
+!!(`!!!!!!!!!!!T3!!!!$("bC at B!'I-a!!!!I3!!!!!!!!!!3JS!!!(DF(*PCJ!
+DfN-!!!"q!!!!!!!!!!!+A!!!!!a`FQ9Q!"RfA!!!!(m!!!!!!!!!!"%8!!!!BR"
+bC at B!'Uf6!!!!J!!!!!!!!!!!$!-!!!!iF(*PCJ!D)A)!!!#"!!!!!!!!!!!+D!!
+!!!e`FQ9Q!"U+8`!!!))!!!!!!!!!!!`l!!!!&("bC at B!'I"'!!!!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!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfls.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfls.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfls.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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`!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!!!!!!!!!%(!!!!!5R"bC at B!!49
+R!!!!@`!!!!!!!!!!0h)!!!'!EA0`D3!!!!%!!!!!!!!!!!!!!!!+YJ!!!"T`FQ9
+Q!!@H#`!!!&`!!!!!!!!!!&,!!!!BF("bC at B!"4"N!!!!A3!!!!!!!!!!)aJ!!!*
+NF(*PCJ!&1G8!!!"H!!!!!!!!!!"V-!!!),T`FQ9Q!!@B9!!!!&m!!!!!!!!!!!V
+3!!!!"("bC at B!"C3N!!!!B!!!!!!!!!!!#Y3!!!!BF(*PCJ!&M83!!!"K!!!!!!!
+!!!!+l!!!!!T`FQ9Q!!9-H3!!!')!!!!!!!!!!!Vf!!!!$R"bC at B!"@&(!!!!B`!
+!!!!!!!!!#`3!!!$'F(*PCJ!&2SJ!!!"N!!!!!!!!!!!,bJ!!!$K`FQ9Q!!8-k`!
+!!'8!!!!!!!!!!!`#!!!!$("bC at B!"1AB!!!!CJ!!!!!!!!!!*A`!!!(DF(*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!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfpack.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfpack.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdfpack.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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!!!*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!!!!*!!!!!!!!!3f!!!!*3!!!!!!!!46!!!
+!*J!!!!!!!!4e!!!!*`!!!!!!!!54!!!!+!!!!!!!!!5Z!!!!+3!!!!!!!!61!!!
+!+J!!!!!!!!6Z!!!!+`!!!!!!!!8'!!!!,!!!!!!!!!8N!!!!,3!!!!!!!!9"!!!
+!,J!!!!!!!!9I!!!!,`!!!!!!!!9i!!!!-!!!!!!!!!@E!!!!-3!!!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!!!!#R"bC at B!%p0F!!!
+![J!!!!!!!!!!#cJ!!!!1F(*PCJ!8%[B!!!#r!!!!!!!!!!!l(J!!!-C`FQ9Q!"1
+Lj3!!!-!!!!!!!!!!!"&S!!!!1("bC at B!&$mr!!!!`3!!!!!!!!!!#dB!!!!-F(*
+PCJ!8!E%!!!$#!!!!!!!!!!"([J!!!GT`FQ9Q!"1J'J!!!--!!!!!!!!!!!Y5!!!
+!$("bC at B!%iMX!!!!a!!!!!!!!!!!1q3!!!"LF(*PCJ!6bIF!!!$&!!!!!!!!!!!
+m4J!!!$K`FQ9Q!"3M``!!!-B!!!!!!!!!!!YH!!!!$A"bC at B!&&88!!!!a`!!!!!
+!!!!!$$-!!!!8F(*PCJ!86Ed!!!$)!!!!!!!!!!!,D`!!!!T`FQ9Q!"4ZA!!!!-N
+!!!!!!!!!!%D)!!!!a("bC at B!%qMe!!!!bJ!!!!!!!!!!5CJ!!!%@F(*PCJ!6cCd
+!!!$,!!!!!!!!!!"2f!!!!,T`FQ9Q!"1Zh3!!!-`!!!!!!!!!!%G-!!!!,R"bC at B
+!%l(@!!!!c3!!!!!!!!!!N!$U!!!#$("bC at B!%pVa!!!!cJ!!Rjd!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdftoR8.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdftoR8.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdftoR8.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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!!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U@!!!!'("bC at B!&cbk!!!!k`!!!!!!!!!!#Ui!!!!+F(*PCJ!
+AIe%!!!$X!!!!!!!!!!!+Z!!!!!j`FQ9Q!"GZ&!!!!1d!!!!!!!!!!"#Z!!!!aR"
+bC at B!&VEd!!!!lJ!!!!!!!!!!#XB!!!!iF(*PCJ!A)qd!!!$[!!!!!!!!!!!+rJ!
+!!!a`FQ9Q!"F0U!!!!2!!!!!!!!!!!%)+!!!"fR"bC at B!&[eI!!!!m3!!!!!!!!!
+!#`S!!!!-F(*PCJ!@m6B!!!$b!!!!!!!!!!!fi`!!!'*`FQ9Q!"D`M`!!!2-!!!!
+!!!!!!!X@!!!!1("bC at B!&ZYc!!!!p!!!!!!!!!!!#di!!!!0F(*PCJ!ABA-!!!$
+e!!!!!!!!!!!,@`!!!"4`FQ9Q!"GLI`!!!2B!!!!!!!!!!!`Y!!!!#R"bC at B!&`5
+S!!!!p`!!!!!!!!!!1eB!!!$%F(*PCJ!A'58!!!$i!!!!!!!!!!"$j!!!!4C`FQ9
+Q!"G)DJ!!!2N!!!!!!!!!!%6k!!!!ZR"bC at B!&UMa!!!!qJ!!!!!!!!!!%A3!!!!
+ZF(*PCJ!@ca%!!!$l!!!!!!!!!!"([J!!!Ja`FQ9Q!"E053!!!2`!!$+i!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdftopal.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdftopal.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/hdftopal.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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!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"YFh"T!!!!!3!!!!!!!!!
+!!!!!!!Ti!!!!'R"bC at B!&`2B!!!!c`!!!!!!!!!!AX!!!"K`F(*PCJ!@S33!!!$
+3!!!!!!!!!!!imJ!!!Q4`FQ9Q!"Fd[!!!!0%!!!!!!!!!!*!!kJ!!),T`FQ9Q!"C
+C63!!!0)!!!!!!!!!!!U5!!!!"("bC at B!&akH!!!!d`!!!!!!!!!!#TB!!!!BF(*
+PCJ!@@qF!!!$8!!!!!!!!!!!+VJ!!!!T`FQ9Q!"EEA!!!!08!!!!!!!!!!!Ui!!!
+!$R"bC at B!&XP"!!!!eJ!!!!!!!!!!%+i!!!$'F(*PCJ!@d*F!!!$A!!!!!!!!!!!
++aJ!!!$K`FQ9Q!"C6H`!!!0J!!!!!!!!!!!Vq!!!!$("bC at B!&UX9!!!!f3!!!!!
+!!!!!3JS!!!(DF(*PCJ!@a%!!!!$D!!!!!!!!!!!,#J!!!!a`FQ9Q!"FiI`!!!0X
+!!!!!!!!!!$EM!!!!BR"bC at B!&a-k!!!!h!!!!!!!!!!!#aB!!!!iF(*PCJ!A'J-
+!!!$G!!!!!!!!!!!,6J!!!!e`FQ9Q!"DELJ!!!0i!!!!!!!!!!!YE!!!!&("bC at B
+!&S11!!!!h`!!!!!!!!!!$$-!!!!+F(*PCJ!@[l`!!!$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!!!:

Added: packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/vshow.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/vshow.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/MacProjects/vshow.project.hqx	2007-05-14 09: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8X!!!"K`F(*PCJ!DUN!!!!#,!!!!!!!!!!!imJ!!!Q4`FQ9Q!"T8RJ!!!)`
+!!!!!!!!!!'X`!!!JZR"bC at B!'PZM!!!!M3!!!!!!!!!!#C)!!!!%F(*PCJ!D at L3
+!!!#1!!!!!!!!!!!*PJ!!!"K`FQ9Q!"XI"3!!!)m!!!!!!!!!!!QZ!!!!#R"bC at B
+!'U5P!!!!N!!!!!!!!!!!!!Qi!!!!$R"bC at B!'QiZ!!!!N3!!!!!!!!!!#V-!!!$
+'F(*PCJ!DU8B!!!#5!!!!!!!!!!!,H3!!!$K`FQ9Q!"TX)`!!!*-!!!!!!!!!!!T
+3!!!!$("bC at B!'TA2!!!!P!!!!!!!!!!!3JS!!!(DF(*PCJ!DHdd!!!#9!!!!!!!
+!!!!+A!!!!!a`FQ9Q!"X%@!!!!*B!!!!!!!!!!!Za!!!!BR"bC at B!'Nfk!!!!P`!
+!!!!!!!!!$"-!!!!iF(*PCJ!Dr--!!!#B!!!!!!!!!!!+D!!!!!e`FQ9Q!"TUD`!
+!!*N!!!!!!!!!!"%8!!!!&("bC at B!'TcD!!!!QJ!!!!!!!!!!#FB!!!!+F(*PCJ!
+DYYd!!!#E!!!!!!!!!!!er3!!!-4`FQ9Q!"U#E!!!!*`!!!!!!!!!!$Y@!!!"&R"
+bC at B!'Tbl!!!!R3!!!!!!!!!!3q3!!!#kF(*PCJ!DX`F!!!#H!!!!!!!!!!!4+!!
+!!#j`FQ9Q!"U(F`!!!*m!!!!!!!!!!%5H!!!#$("bC at B!'R)i!!!!S!!!3Bd!!!:
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,292 @@
+# ****************************************************************************
+# * 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: Makefile.in,v 1.24 2000/06/26 19:51:31 rushabh Exp $
+#
+# ##################################################################
+#
+
+### Start of system configuration section. ####
+# Set shell so we know what it is
+SHELL = /bin/sh
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+#Compilier defaults overriden by top level make
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# The echo command.
+ECHO = echo
+
+# Directory in which to install scripts.
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install include files.
+includedir = $(prefix)/include
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+
+# ############# End of system configuration section. ###############
+HDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        MACHINE="$(MACHINE)" 
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ==> where is your HDF library (libdf.a) located?
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+HDFINC=$(srcdir)/../src
+HDFLIB=$(srcdir)/../src
+HDFSRC=$(srcdir)/../src
+HDFBIN=$(srcdir)/../bin
+
+# ==> where is your JPEG library (libjpeg.a) located?
+JPEGLIB=$(srcdir)/../jpeg
+JPEGINC=$(srcdir)/../jpeg
+
+# ==> where is your PABLO include files
+PABLO_HINC= $(srcdir)/../pablo
+
+# ==> specify where to find the FMPOOL include and source files 
+FMPOOL_INC=$(srcdir)/../fmpool
+FMPOOL_SRC=$(srcdir)/../fmpool
+
+# ==> where is your zlib library (libz.a) located?
+ZLIBLIB=$(srcdir)/../zlib
+ZLIBINC=$(srcdir)/../zlib
+
+#Where are the utility includes
+UTILINC=$(srcdir)
+
+ALL_CFLAGS = $(CFLAGS) $(FMPOOL_FLAGS) -I$(HDFINC) -I$(JPEGINC) -I$(ZLIBINC) -I$(UTILINC)
+
+OTHERDIRS = fixatr testfiles
+
+MANIFEST = $(DISTFILES)
+DISTFILES = Makefile.in README.TST $(UTILSRCS) $(UTILHDRS) $(FIXATRS) $(TESTFILES)
+
+# Utilities
+UTILSRCS = hdf24to8.c hdfcomp.c hdfls.c hdfpack.c hdftopal.c hdftor8.c paltohdf.c \
+        r8tohdf.c ristosds.c vmake.c vshow.c hdf8to24.c hdf2jpeg.c jpeg2hdf.c fp2hdf.c \
+	hdfunpac.c he_main.c he_cntrl.c he_disp.c he_file.c fptest.c gif2hdf.c \
+	writehdf.c gif2mem.c gifread.c decompress.c hdf2gif.c hdfgifwr.c
+
+UTILHDRS = he.h he_proto.h gif.h
+
+FIXATRS = fixatr/README fixatr/command.for fixatr/common.for fixatr/fixatr.cld \
+	fixatr/fixatr.hlp fixatr/makefix.com fixatr/parse.mar fixatr/rformat.for
+
+
+TESTFILES = testfiles/README testfiles/head.r24.Z testfiles/jpeg_img.jpg \
+	testfiles/ntcheck.hdf testfiles/palette.raw testfiles/storm110.hdf \
+	testfiles/storm110.raw testfiles/storm120.hdf testfiles/storm120.raw \
+	testfiles/storm130.hdf testfiles/storm130.raw testfiles/storm140.raw \
+	testfiles/test.cdf testfiles/test.hdf
+
+UTILS = hdf24to8 hdfcomp hdfls hdfpack hdftopal hdftor8 paltohdf \
+        r8tohdf ristosds  vmake vshow hdf8to24 hdf2jpeg jpeg2hdf fp2hdf \
+	hdfunpac gif2hdf hdf2gif
+
+GHOBJ = gif2hdf.o writehdf.o gif2mem.o gifread.o decompress.o
+
+HGOBJ = hdf2gif.o hdfgifwr.o
+
+HEOBJ = he_main.o he_cntrl.o he_disp.o he_file.o
+
+PROGS = $(UTILS) hdfed
+
+#all: hdfed utils fp2hdf fptest
+all::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) hdfed utils fp2hdf fptest ; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" hdfed utils fp2hdf fptest ; \
+	fi
+
+#nofortran: hdfed utils fp2hdf fptest
+nofortran::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) hdfed utils fp2hdf fptest ; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(HDF_FLAGS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" hdfed utils fp2hdf fptest ; \
+	fi
+
+rebuild:
+	@$(MAKE) all $(HDF_FLAGS) FRC=force_rebuild
+
+rebuildnofortran:
+	@$(MAKE) nofortran $(MFLAGS) $(HDF_FLAGS) FRC=force_rebuild
+
+# Leave this target blank with no actions, the rebuild macros above depend on it
+force_rebuild:
+
+install: install-prog
+
+install-prog: all
+	for p in $(PROGS); do \
+	    $(INSTALL_PROGRAM) \
+		`pwd`/$$p $(bindir)/`$(ECHO) $$p`; \
+	done
+
+test-utils:
+	./testutil.sh $(target_canonical)
+
+#.c.o: 
+#	 $(CC) $(CFLAGS) -c -I$(HDFINC) $*.c 
+#
+#.c.o: 
+#	 $(CC) $(CFLAGS) -c -I$(HDFINC) -I$(UTILINC) -I$(JPEGINC) -I$(ZLIBINC) $*.c 
+
+.c.o: he.h he_proto.h $(HDFLIB)/libdf.a $(FRC)
+	$(CC) $(ALL_CFLAGS) -c $<
+
+.c: $(HDFLIB)/libdf.a
+	$(CC) $(ALL_CFLAGS) $< -o $@ $(HDFLIB)/libdf.a $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a $(LIBSX)
+
+.f: $(HDFLIB)/libdf.a 
+	$(FC) $(FFLAGS) $< $(HDFLIB)/libdf.a -o $@ $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a
+
+hdfed: he.h he_proto.h $(HEOBJ) $(HDFLIB)/libdf.a $(FRC)
+	$(CC) $(ALL_CFLAGS) $(HEOBJ) $(HDFLIB)/libdf.a -o hdfed $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a
+
+gif2hdf: gif.h $(GHOBJ) $(HDFLIB)/libdf.a $(FRC)
+	$(CC) $(ALL_CFLAGS) $(GHOBJ) $(HDFLIB)/libdf.a -o gif2hdf $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a
+
+hdf2gif: gif.h $(HGOBJ) $(HDFLIB)/libdf.a $(FRC)
+	$(CC) $(ALL_CFLAGS) $(HGOBJ) $(HDFLIB)/libdf.a -o hdf2gif $(JPEGLIB)/libjpeg.a $(ZLIBLIB)/libz.a
+
+utils: $(UTILS) $(HDFLIB)/libdf.a $(FRC)
+
+$(HEOBJ): $(FRC)
+
+$(HDFLIB)/libdf.a:
+
+$(JPEGLIB)/libjpeg.a:
+
+$(ZLIBLIB)/libz.a:
+
+clean:
+	-$(RM) $(RMFLAGS) *.o $(UTILS) hdfed fptest
+	-$(RM) $(RMFLAGS) o* ctx* cb* fptestf 
+
+distclean:
+	-$(RM) $(RMFLAGS) *.o $(UTILS) hdfed fptest config.status Makefile
+	-$(RM) $(RMFLAGS) o* ctx* cb* fptestf
+depend: 
+	 makedepend -I$(HDFINC) -I$(UTILINC) *.c
+
+saber:	$(SRCS)
+	 #load $(ALL_CFLAGS) -D$(MACHINE) $(SRCS) 
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = hdf/util
+dist: $(DISTFILES)
+	for subdir in $(OTHERDIRS); do \
+	  mkdir $(distdir)/$$subdir || exit 1; \
+	done
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+help:
+	@echo ""
+	@echo "Make supports the following targets in the 'utilities' directory"
+	@echo "make help    - prints this usage section"
+	@echo "make all     - (DEFAULT) makes utilities"
+	@echo "make hdfed   - makes hdfed utilitiy"
+	@echo "make test-utils  - tests utilities"
+	@echo "make install     - install HDF utilites, "
+	@echo "make clean     - cleans up tests (both C and Fortran)"
+	@echo "make distclean - cleans up HDF tests including"
+	@echo "                 configuration(Makefiles,config.status,..)"
+	@echo ""
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.

Added: packages/libhdf4/branches/upstream/current/hdf/util/README
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -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.
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/README.TST
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/README.TST	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/README.TST	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+                   
+
+
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/SETUPUTILS.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/SETUPUTILS.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/SETUPUTILS.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,39 @@
+$! ****************************************************************************
+$! * 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: SETUPUTILS.COM,v 1.14 1998/06/25 16:38:02 epourmal Exp $
+$! This file is only for VAX/VMS systems.
+$!
+$! set up utilities
+$! change below to the hdf bin directory
+$! 
+$! define/nolog hdf$bin    [-.util]
+$!
+$ hdfls     :== $ hdf$bin:hdfls
+$! hdfrseq   :== $ hdf$bin:hdfrseq
+$ r8tohdf   :== $ hdf$bin:r8tohdf
+$ hdfcomp   :== $ hdf$bin:hdfcomp
+$ hdftor8   :== $ hdf$bin:hdftor8
+$ hdftopal  :== $ hdf$bin:hdftopal
+$ paltohdf  :== $ hdf$bin:paltohdf
+$ hdf24to8  :== $ hdf$bin:hdf24to8
+$ hdf8to24  :== $ hdf$bin:hdf8to24
+$ hdfpack   :== $ hdf$bin:hdfpack
+$ hdfunpac  :== $ hdf$bin:hdfunpac
+$ ristosds  :== $ hdf$bin:ristosds
+$ vshow     :== $ hdf$bin:vshow
+$ vmake     :== $ hdf$bin:vmake
+$ hdfed     :== $ hdf$bin:hdfed
+$ hdf2jpeg  :== $ hdf$bin:hdf2jpeg
+$ jpeg2hdf  :== $ hdf$bin:jpeg2hdf
+$ fp2hdf    :== $ hdf$bin:fp2hdf
+$ exit

Added: packages/libhdf4/branches/upstream/current/hdf/util/decompress.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/decompress.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/decompress.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,301 @@
+#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;	
+}
+
+


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/decompress.c
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/util/fixatr/README
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fixatr/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fixatr/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,32 @@
+VMS has several different file organizations, two of which are 
+important to us: the 512-byte Fixed-length record format, and 
+the Stream-LF format.  HDF is written in C, and VMS C works (only) 
+with the Stream-LF format.  FTP and other transfer programs, on 
+the other hand, work better with the Fixed-512 format.  Therefore
+HDF includes the FIXATR utility written at NCSA for converting 
+between the formats.
+
+The files in util/fixatr may be transferred to a VMS system, and compiled
+by running the COM file.  Then the command FIXATR may be invoked to convert
+files, as in the examples below:
+
+	To convert from Fixed-512 to Stream-LF:
+		FIXATR myfile.dat /rfm=stream:lf
+
+	To convert from Stream-LF to Fixed-512:
+		FIXATR myfile.dat /rfm=fixed:512
+
+Note that the conversion is done in-place (a new version is not created).
+
+Thus, if you FTP a file from the Cray to VMS, you should issue the first
+command above, then use HDF calls on it.  On the other hand, if you create a
+file on VMS using HDF, you should use the second command to convert it to a
+form where you can use FTP or other file transfer programs on it.
+
+Actually, the current version of the source code will read Fixed-512 files
+also correctly.  However, it creates Stream-LF files, and it is generally
+recommended that you convert files to Stream-LF before using HDF on them.
+
+Note about setting up fixatr:  You need to edit the file FIXATR.CLD to
+change the reference to "disk:directories" to what is on your system,
+run makefix.com, then type "set command fixatr."

Added: packages/libhdf4/branches/upstream/current/hdf/util/fixatr/command.for
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fixatr/command.for	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fixatr/command.for	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,258 @@
+	subroutine command_parse
+c
+	implicit	integer*4(a-z)
+	integer*4	len1,index,len2
+	include		'common.for/list'
+c
+c	call cli routines to get command line
+c
+	call cli$get_value('filespec',filename)
+c
+	istat = str$trim (filename, filename, len)
+c
+c	model file is currently not implemented.
+c
+	if (cli$present('model')) then
+		mdl_flag = 1
+	type *,'%FIXATR-I-NOTIMP, currently not implemented.'
+		call exit
+	endif
+c
+	if (cli$present('rfm')) then
+		call cli$get_value ('rfm',rfm_val)
+	else 
+		rfm = 'VARIABLE'
+		goto 100
+	endif
+c
+c	parse rfm qualifier
+c
+		index = str$position (rfm_val, ':')
+c
+c	value for rfm present?
+c
+		if (index .ne. 0) then
+		     rfm = rfm_val(1:index-1)
+		     size = rfm_val(index+1:)
+		else
+		     rfm = rfm_val
+		     size = ' '
+		endif
+c
+		istat = str$trim (rfm,rfm,len2)
+		if (.not. istat) call lib$stop (%val(istat))
+c
+		istat = str$trim (size,size,len1)
+		if (.not. istat) call lib$stop (%val(istat))
+
+c
+	if((size(1:2).eq.'CR').or.(size(1:2).eq.'LF')) goto 50  ! cjfm
+	if (size(1:2) .ne.' ') then                             ! cjfm
+		  if (len1 .eq.1) then
+		    isize = ichar ( size ) - 48
+		  else
+		    istat=lib$cvt_dtb(%val(len1),%ref(size(1:len1)),isize)
+        	  endif
+  	else if (size .eq. ' ') then
+  		  isize = 0
+        else
+  		  type *,'%FIXATR-E-SYNERR, command syntax error.'
+  	          call exit
+  	endif
+c
+c	assign value for variable recl.
+c
+50		i = lib$matchc (%descr(rfm(1:len2)),'VARIABLE')
+		if (i .eq. 1) then
+			rfm = 'VARIABLE'
+			if (isize .ne. 0) then
+			     	mrs = isize
+			     	rs  = 0
+			endif		
+		goto 100
+		endif
+c
+c 	assign value for fixed recl.
+c
+		i =lib$matchc (%descr(rfm(1:len2)),'FIXED')
+		if (i .eq. 1) then
+		    rfm = 'FIXED'
+		    if (isize .ne. 0) then
+			mrs = isize
+			rs  = isize
+		    else 
+			type *,'%FIXATR-E-SYNERR, command syntax error.'
+			call exit
+		     endif
+		goto 100
+		endif
+c
+c	assign value for stream rec type.
+c
+		i = lib$matchc (%descr(rfm(1:len2)),'STREAM')
+		if (i .eq. 1) then
+			if (size .eq. 'CR') then
+		     	    rfm = 'STREAMCR'
+	          	else if (size .eq. 'LF') then
+	     		          rfm = 'STREAMLF'
+		     	     else if (size .eq. ' ') then
+				      rfm = 'STREAM'
+				  else
+			type *,'%FIXATR-E-SYNERR, command syntax error.'
+				      call exit
+			endif
+		goto 100
+		endif
+c
+c	assign value for VFC records.
+c
+	      	i = lib$matchc (%descr(rfm (1:len2)), 'VFC') 
+	   	if (i .eq. 1) then
+		       rfm = 'VFC'
+		       if (isize .ne. 0) then
+		           vfcsize = isize
+			   goto 100
+		       else
+		type *,'%FIXATR-E-SYNERR, command syntax error.'
+	     		   call exit
+		        endif
+	       	else
+		type *,'%FIXATR-E-SYNERR, command syntax error.'
+			call exit
+		endif
+c
+100	if (cli$present('rat')) then
+		call cli$get_value('rat',rat)
+		istat = str$trim (rat,rat,len1)
+		i = lib$matchc (%descr(rat(1:len1)),'FORTRANCC')
+		if (i .eq. 1) then
+		    rat = 'FORTRANCC'
+		else
+		    i = lib$matchc (%descr(rat(1:len1)),'IMPLIEDCC')
+		    if (i .eq. 1) then
+			rat = 'IMPLIEDCC'
+		    else
+		        i = lib$matchc (%descr(rat(1:len1)),'PRINTCC')
+			if (i .eq. 1) then
+			    rat = 'PRINTCC'
+			else
+			    i = lib$matchc (%descr(rat(1:len1)),'NOSPAN')
+			    if (i .eq. 1) then
+				rat = 'NOSPAN'
+			    else
+				i = lib$matchc (rat(1:len1),'NONE')
+				if (i .eq. 1) then
+				    rat = 'NONE'
+				else
+		type *,'%FIXATR-E-SYNERR, command syntax error.'
+				call exit
+				endif
+			    endif
+			endif
+		     endif
+		endif
+	else
+		rat = 'IMPLIEDCC'		! default
+	endif
+c
+c	parse org qualifier
+c
+	if (cli$present('org')) then
+		call cli$get_value('org',org_val)
+		istat = str$trim (org_val,org_val,len1)
+		index = str$position (org_val, ':')
+	else
+		org = 'SEQUENTIAL'
+		goto 200
+	endif	
+c
+c	value for org present?
+c
+	if (index .ne. 0) then
+	     org = org_val(1:index-1)
+	     size = org_val(index+1:)
+	else
+	     org = org_val
+	     size = ' '
+	endif
+c
+	istat = str$trim (org,org,len2)
+	if (.not. istat) call lib$stop (%val(istat))
+c
+	istat = str$trim (size,size,len1)
+	if (.not. istat) call lib$stop (%val(istat))
+
+	i = lib$matchc (%descr(org(1:len2)),'SEQUENTIAL')
+	if (i .eq. 1) then
+	    org = 'SEQUENTIAL'
+		goto 200
+	endif
+
+     	i = lib$matchc (%descr(org(1:len2)),'INDEXED')
+        if (i .eq. 1) then
+	    org = 'INDEXED'
+	    if (size .eq. ' ') then
+		type *, '%FIXATR-E-SYNERR, command syntax error'
+                call exit
+	    endif
+            if (len1 .eq.1) then
+	         isize = ichar ( size ) -48
+		 bktsize = isize
+     	    else
+	     istat = lib$cvt_dtb (%val(len1),%ref(size(1:len1)),isize)
+		 bktsize = isize
+	    endif
+		goto 200
+	endif
+
+        i = lib$matchc (%descr(org(1:len2)),'RELATIVE')
+        if  (i .eq. 1) then
+             org = 'RELATIVE'
+	    if (size .eq. ' ') then
+		type *, '%FIXATR-E-SYNERR, command syntax error'
+                call exit
+	    endif
+            if (len1 .eq.1) then
+	         isize = ichar ( size ) -48
+		 bktsize = isize
+     	    else
+	     istat = lib$cvt_dtb (%val(len1),%ref(size(1:len1)),isize)
+		 bktsize = isize
+	    endif
+	    goto 200
+	endif
+
+	i = lib$matchc (%descr(org(1:len2)),'DIRECT')
+	if (i .eq. 1) then
+            org = 'DIRECT'
+		goto 200
+        else
+	     type *, '%FIXATR-E-SYNERR, command syntax error'
+             call exit
+        endif
+c
+	
+200	if (cli$present('efblk')) then
+		call cli$get_value('efblk',efblk)
+		istat = str$trim (efblk,efblk,len1)
+		istat = lib$cvt_dtb (%val(len1),%ref(efblk(1:len1)),eof_blk)
+	endif
+c
+	if (cli$present('ffbyte')) then
+		call cli$get_value('ffbyte',ffbyte)
+		istat = str$trim (ffbyte,ffbyte,len1)
+		istat = lib$cvt_dtb (%val(len1),%ref(ffbyte(1:len1)),ff_byte)
+	endif
+d	type *, 'bktsize = ',bktsize
+d	type *, 'vfcsize = ',vfcsize
+d	type *, 'rfm = ', rfm
+d	type *, 'mrs = ', mrs
+d	type *, 'rs  = ', rs
+d	type *, 'rat = ', rat
+d	type *, 'org = ', org
+d	type *, 'efblk = ', eof_blk
+d	type *, 'ffbyte= ', ff_byte
+
+	return
+	end
+		

Added: packages/libhdf4/branches/upstream/current/hdf/util/fixatr/common.for
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fixatr/common.for	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fixatr/common.for	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,10 @@
+	character	org*12,org_val*12,rfm_val*20,rfm*13,size*5
+	character	rat*9,efblk*10,ffbyte*3,filename*80,model*20
+	integer*2	mrs,rs,ff_byte,isize
+	integer*4	eof_blk
+	byte		vfcsize,mdl_flag,bktsize
+	common/clibuf/eof_blk,mrs,rs,ff_byte,isize,bktsize,
+	1	      vfcsize,
+	1	      mdl_flag,rfm_val,
+	1	      rfm,filename,model,size,ffbyte,org,efblk,rat,
+	1	      org_val

Added: packages/libhdf4/branches/upstream/current/hdf/util/fixatr/fixatr.cld
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fixatr/fixatr.cld	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fixatr/fixatr.cld	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,9 @@
+define verb fixatr
+        image           MRLXP1$DKA200:[FOLK.DEV.HDF.UTIL.FIXATR]rformat
+	parameter	p1,label=filespec,prompt="File",value(required)
+	qualifier	rfm, label=rfm, value(default=variable)
+	qualifier	rat, label=rat, value(default=impliedcc)
+	qualifier	org, label=org, value(default=sequential)
+	qualifier	efblk, label=efblk, value
+	qualifier	ffbyte, label=ffbyte, value
+	qualifier	model, label=model, value

Added: packages/libhdf4/branches/upstream/current/hdf/util/fixatr/fixatr.hlp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fixatr/fixatr.hlp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fixatr/fixatr.hlp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,67 @@
+1 FIXATR
+ Fixes the file and the record attributes of a given file without making
+ a copy. This command is used to fix some files transferred from CFS or
+ CTSS, so that they can be understood by VMS. 
+
+ For detailed information on VMS file and record attributes,
+ please read INTRODUCTION TO VAX-11 RMS and VAX-11 RMS USER'S GUIDE
+ (Volume 4 of the VAX/VMS documentation set).
+
+ Format:
+
+      FIXATR filespec/qualifiers
+
+2 Parameters
+  filespec
+
+   Specifies the name of the file to which the record attributes are to
+   be fixed. The filespec follows the VMS file specification standard.
+
+2 Qualifiers
+/RFM
+
+      /RFM = record_format[:value]
+      /RFM = VARIABLE (D)
+
+ The valid record formats are VARIABLE, FIXED and STREAM. Value assigned
+ to this qualifier is the record length for FIXED RFM (required), or the
+ maxinum record length for the VARIABLE RFM (optional). If the RFM is
+ STREAM, the value can be LF, CR or none specified (corresponds to STREAMLF,
+ STREAMCR or STREAM respectively). The default is VARIABLE with no value
+ assigned.
+
+/RAT
+
+      /RAT = carriage_control
+      /RAT = IMPLIEDCC (D)
+
+ The valid carriage control values are IMPLIEDCC (FORTRAN LIST
+ equivalent ), PRINTCC (printer carriage control), FORTRAN (fortran 
+ carriage  control), NOSPAN (record can not span block) ,and 
+ NONE. The default is IMPLIEDCC.
+
+
+/ORG
+
+      /ORG = file_organization[:value]
+      /ORG = SEQUENTIAL (D)
+
+ The valid RMS file organizations are SEQUENTIAL, INDEXED, RELATIVE
+ and DIRECT. The value to be assigned to the ORG qualifier is the bucket
+ size. A value specification is mendatory for INDEXED and RELATIVE files,
+ and should be left unspecified for SEQUENTIAL and DIRECT files. The default
+ is SEQUENTIAL.
+
+2 VMS_FILES
+
+  The following is a table of DIFFERENT files created by VMS utilities
+  and their default attributes:
+     
+
+  FILE TYPE    FILE ORG.(ORG)   RECORD FORMAT(RFM)   RECORD ATTRIBUTE(RAT)
+   ---------------------------------------------------------------------
+  EDT files    SEQUENTIAL       VARIABLE          IMPLIEDCC (fortran LIST)
+  OBJ files    SEQUENTIAL       FIXED (512 bytes) NONE
+  EXE files    SEQUENTIAL       FIXED (512 bytes) NONE
+  LIS files    SEQUENTIAL       VARIABLE          IMPLIEDCC (fortran LIST)
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/fixatr/makefix.com
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fixatr/makefix.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fixatr/makefix.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,20 @@
+$ v = 'f$verify(0)'
+$ if p1 .eqs. "DEBUG" then goto debug
+$ x = f$verify(1)
+$ fort rformat
+$ fort command
+$ macro parse
+$ link rformat,command,parse
+$ x = 'f$verify(0)'
+$ goto 10
+$ debug:
+$ x = f$verify(1)
+$ fort/lis/deb/noopt rformat
+$ fort/lis/deb/noopt command
+$ macro/lis/deb parse
+$ link/deb rformat,command,parse
+$ x = 'f$verify(0)'
+$ 10:
+$ v = f$verify(v)
+$ ! put the help in the library
+$ library/create/help fixatr.hlb fixatr.hlp

Added: packages/libhdf4/branches/upstream/current/hdf/util/fixatr/parse.mar
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fixatr/parse.mar	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fixatr/parse.mar	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,83 @@
+	.title	parse
+;
+;	Procedure to get FID, DID and result filename of a given file.
+;	Follows the VMS procedure calling standard, CALL_G.
+;	
+;	Calling procedure:
+;
+;		retstat=parse(filename,FID,DID,result_str,device_name)
+;		
+;		arguments : filename passed by desc
+;			    FID an array of 3 two-byte words
+;			    DID an array of 3 two-byte words
+;			    result_str fully specified actual file name
+;;			    device_name of file
+;
+;	Helen Chen (DECsws)	11/28/83
+;
+	.library	/sys$library:lib.mlb/
+	$namdef			;name block definitions
+
+
+	.psect	data,noexe,wrt
+fab_blk:
+	$fab	fop=nam,-	;use name block option
+		nam=nam_blk	;name block address
+nam_blk:
+	$nam	rsa=res_str,-		;result buffer address
+		rss=nam$c_maxrss,-	;result buffer size
+		esa=exp_str,-		;expanded buffer address
+		ess=nam$c_maxrss	;expanded buffer size
+exp_str:				;expanded string buffer
+	.blkb	nam$c_maxrss		
+res_str:				;result string buffer
+	.blkb	nam$c_maxrss
+
+filename=4
+fid=8
+did=12
+result_str=16
+;device_name=20
+	.psect	code,exe,nowrt
+	.entry	parse,^m<r3,r4,r5,r6,r7>		
+	movl	filename(ap),r3		;r3 points to filename desc
+;	movaw	fid_blk,r4		;r5 points to DID
+;	movaw	did_blk,r5
+	$fab_store	fab=fab_blk,-	;Store input
+			fna=@4(r3),-	;file name
+			fns=(r3)	;size
+
+;
+;	Perform initial parse to set up RMS context for
+;	subsequent search.
+;
+
+	$parse	fab=r0			;parse the file spec
+	blbc	r0,exit			;quit on error
+;
+;	Search for a file.
+;
+	$search	fab=fab_blk		;find a file
+	blbc	r0,exit		;any found?
+;
+;	Return the FID and DID values from the search operation
+;
+	movaw	nam_blk,r6		;r6 points to nam_blk
+	movl	fid(ap),r4		;r4 points to FID 
+	movl	did(ap),r5    		;r5 points to DID
+	movw	nam$w_fid(r6),(r4)	;move fid (6 bytes)
+	movw	nam$w_fid+2(r6),2(r4)	;
+	movw	nam$w_fid+4(r6),4(r4)	;
+	movw	nam$w_did(r6),(r5)	;move did (6 bytes)
+	movw	nam$w_did+2(r6),2(r5)	;
+	movw	nam$w_did+4(r6),4(r5)	;
+	moval	nam_blk,r6		;get address of nam block to r6
+	movl	result_str(ap),r7	;r7 points to result_str
+	movc5	nam$b_rsl(r6),-		;ret result filename to 
+		res_str,#32,(r7), at 4(r7)	;fortran program
+;	movl	device_name(ap),r7	;r7 points to device_name
+;	movc5	nam$b_dev(r6),-		;return device name to fortran program
+;		@nam$l_dev(r6),#32,(r7), at 4(r7)
+	movl	#1,r0			;normal completion
+exit:	ret
+	.end

Added: packages/libhdf4/branches/upstream/current/hdf/util/fixatr/rformat.for
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fixatr/rformat.for	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fixatr/rformat.for	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,196 @@
+	program recformat
+c
+c	This program will prompt the user for proper record attributes 
+c	to be applied to the file header of interest.
+c
+	implicit	integer*4 (a-z)
+c
+	include		'($iodef)'
+c
+c	include storage for parsed command line.
+c
+	include		'common.for/list'
+c
+c	$fibdef
+c
+	parameter	(fib$m_writethru=	'80000'x)
+c
+c	$fatdef.
+c
+	parameter 	(fat$c_fixed	=	'1'x)
+	parameter 	(fat$c_variable	=	'2'x)
+	parameter 	(fat$c_vfc	=	'3'x)
+	parameter 	(fat$c_stream	=	'4'x)
+	parameter 	(fat$c_streamlf =	'5'x)
+	parameter 	(fat$c_streamcr	=	'6'x)
+	parameter	(fat$m_fortrancc=	'1'x)
+	parameter	(fat$m_printcc	=	'4'x)
+	parameter	(fat$m_impliedcc=	'2'x)
+	parameter	(fat$m_nospan	=	'8'x)
+	parameter	(fat$c_direct	=	'3'x)
+	parameter	(fat$c_indexed	=	'2'x)
+	parameter	(fat$c_relative	=	'1'x)
+	parameter	(fat$c_sequential=	'0'x)
+	parameter	(fat$v_rtype	=	'0'x)
+	parameter	(fat$v_fileorg	=	'4'x)
+	parameter	(fat$b_vfcsize	=	'f'x)
+	parameter	(fat$w_maxrec	=	'10'x)
+	parameter	(fat$w_rsize	=	'2'x)
+	parameter	(fat$l_efblk	=	'8'x)
+	parameter	(fat$w_ffbyte	=	'c'x)
+	parameter	(fat$w_vfcsize	=	'f'x)
+	parameter	(fat$w_bktsize	=	'e'x)
+c
+c	$atrdef
+c
+	parameter	(atr$c_recattr	=	'4'x)
+	parameter	(atr$s_recattr	=	'20'x)
+c
+	character*255	res_str
+	integer*2	fid_blk(3), did_blk(3),iosb(4)
+	character*64	device_name
+	integer*4	device_len
+c
+c	p1 for qio.
+c
+	integer*4	fib_desc(2)
+	integer*2	fib_desc_w(4)
+	equivalence	(fib_desc,fib_desc_w)
+	integer*2	fib(11)
+	integer*4	fib_l
+	equivalence	(fib_l,fib)
+c	
+c	p5 for qio.
+c
+	integer*4	attr_desc(3)
+	integer*2	attr_desc_w(6)
+	equivalence	(attr_desc,attr_desc_w)
+	integer*4	attr(8)
+	integer*2	attr_w(16)
+	byte		attr_b(32)
+	equivalence	(attr,attr_b)
+	equivalence	(attr_w,attr_b)
+c
+c	Build p1.
+c
+	data	fib_desc_w(1)/22/
+	fib_desc(2)=%loc(fib)
+c
+c	Build p5.
+c
+	data	attr_desc_w(1)/atr$s_recattr/
+	data	attr_desc_w(2)/atr$c_recattr/
+	attr_desc(2)=%loc(attr)
+	attr_desc(3)=0
+c
+c	call command_parse to get command line
+c
+	call command_parse	
+c
+c	call macro routine parse to obtain DID and FID
+c
+	istat = parse (filename,%ref(fid_blk),%ref(did_blk),res_str)
+	if (.not.istat) call lib$stop(%val(istat))
+d	type *,' fid= ',fid_blk(1),fid_blk(2),fid_blk(3)
+d	type *,' did= ',did_blk(1),did_blk(2),did_blk(3)
+	device_len = index(res_str,':')
+	device_name = res_str(1:device_len)
+d	type *,' Device= ',device_name(1:device_len)
+c
+c	build dib. fid and did.
+c
+	fib(1) = 0
+	fib(2) = 0
+	fib(3) = fid_blk(1)
+	fib(4) = fid_blk(2)
+	fib(5) = fid_blk(3)
+c	fib(6) = did_blk(1)
+c	fib(7) = did_blk(2)
+c	fib(8) = did_blk(3)
+	fib(9) = 0
+	fib(10) = 0
+	fib(11) = 0
+	fib_l = fib$m_writethru
+c	
+c	assign channel
+c
+c	istat = sys$assign('sys$disk:',chan,,)
+	istat = sys$assign(device_name(1:device_len),chan,,)
+	if (.not. istat) call lib$stop (%val(istat))
+c
+c
+c	Build record attribute block using the io$_access func and
+c	then change the attributes based on the input from user.
+c
+	istat = sys$qiow(,%val(chan),%val(io$_access),iosb,,,fib_desc
+	1		,,,,attr_desc,)
+	if (.not. istat) call lib$stop (%val(istat))
+	if (.not. iosb(1)) call lib$signal (%val(iosb(1)))
+c
+	if (rfm .eq. 'VARIABLE') then 
+		attr_b(1)=fat$c_variable
+		if (rs .ne. 0 .or. mrs .ne. 0) then
+		     	attr_w(2) = rs
+		     	attr_w(9) = mrs
+		endif
+	else if	(rfm .eq. 'FIXED') then 
+		   attr_b(1)=fat$c_fixed
+		   if (rs .ne. 0 .and. mrs .ne. 0) then
+		   	attr_w(2) = rs
+		   	attr_w(9) = mrs
+		   endif	
+	     else if (rfm .eq. 'STREAM') then
+			attr_b(1)=fat$c_stream
+		  else if (rfm .eq. 'VFC') then
+			    attr_b(1)=fat$c_vfc
+			    attr_b(16) = vfcsize
+		       else if (rfm .eq. 'STREAMLF') then
+			       attr_b(1)=fat$c_streamlf
+			    else if (rfm .eq. 'STREAMCR') then
+				     attr_b(1)=fat$c_streamcr
+				 else
+				     attr(1)=0
+	end if
+c
+	if (rat .eq. 'NONE') then
+		attr_b(2)= 0
+	else if (rat .eq. 'PRINTCC') then
+	            attr_b(2) = fat$m_printcc
+	     else if (rat .eq. 'FORTRANCC') then
+		        attr_b(2) = fat$m_fortrancc
+		  else if (rat .eq. 'IMPLIEDCC') then
+				attr_b(2) = fat$m_impliedcc
+		       else if (rat .eq. 'NOSPAN') then
+				     attr_b(2) = fat$m_nospan
+			    else
+   				     attr_b(2) = 0
+	endif	
+c
+	if (org .eq. 'SEQUENTIAL') then
+	    attr_b(1) = attr_b(1) + fat$c_sequential*2**fat$v_fileorg
+	else if (org .eq. 'INDEXED') then
+		 attr_b(1) = attr_b(1) + fat$c_indexed*2**fat$v_fileorg
+		 attr_b(15) = bktsize
+	     else if (org .eq. 'RELATIVE') then
+		      attr_b(1)=attr_b(1)+fat$c_relative*2**fat$v_fileorg
+		      attr_b(15) = bktsize
+		  else
+		      attr_b(1)=attr_b(1)+fat$c_direct*2**fat$v_fileorg
+	endif
+c
+	if (eof_blk .ne. 0) attr(3) = eof_blk
+c
+	if (ff_byte .ne. 0) attr_w(7) = ff_byte
+c
+c	Now perform the QIOW with IO$_MODIFY as function code.
+c
+	istat = sys$qiow(,%val(chan),%val(io$_modify),iosb,,,fib_desc
+	1		,,,,attr_desc,)
+	if (.not. istat) call lib$stop (%val(istat))
+	if (.not. iosb(1)) call lib$signal (%val(iosb(1)))
+c
+	istat = sys$dassgn(%val(chan))
+	if (.not. istat) call lib$stop (%val(istat))
+	call exit
+999	type *,' iostat = ', iso
+	end

Added: packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2260 @@
+/*
+ * 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>
+
+/*
+ * 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";
+
+    /*
+     * set 'stdout' and 'stderr' to line-buffering mode
+     */
+    (void) setvbuf(stderr, (char *) NULL, _IOLBF, 0);
+    (void) setvbuf(stdout, (char *) NULL, _IOLBF, 0);
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    /*
+     * 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))
+              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;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.input1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.input1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.input1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.input1-32
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.input1-32	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.input1-32	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "fp2hdf.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)/fp2hdf.exe $(OUTDIR)/fp2hdf.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"fp2hdf.bsc" 
+
+$(OUTDIR)/fp2hdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/fp2hdf.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"fp2hdf.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"fp2hdf.exe" 
+
+$(OUTDIR)/fp2hdf.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)/fp2hdf.exe $(OUTDIR)/fp2hdf.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"fp2hdf.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)/"fp2hdf.bsc" 
+
+$(OUTDIR)/fp2hdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/fp2hdf.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"fp2hdf.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"fp2hdf.exe" 
+
+$(OUTDIR)/fp2hdf.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=.\fp2hdf.c
+
+$(INTDIR)/fp2hdf.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out1-32
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out1-32	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out1-32	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out2
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out2	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out2	2007-05-14 09:41:34 UTC (rev 808)
@@ -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: 

Added: packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out2-32
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out2-32	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.out2-32	2007-05-14 09:41:34 UTC (rev 808)
@@ -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: 

Added: packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.test.result
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.test.result	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fp2hdf.test.result	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/hdf/util/fptest.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fptest.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fptest.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,249 @@
+
+#include <stdio.h>
+#include "hdf.h"
+
+/*
+ * Name:
+ *      fptest
+ *
+ * Description:
+ *      This program creates six floating point files that can be
+ *      used to test the fp2hdf program.  [Note: the 32-bit floating
+ *      point files are omitted for Cray (UNICOS) systems]
+ *
+ *      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
+     */
+
+    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
+     */
+
+#ifndef UNICOS
+    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);
+#endif
+
+    /*
+     * 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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/fptestf.f
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/fptestf.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/fptestf.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,345 @@
+       program fptest
+
+c
+c  This program creates six floating point files that can be 
+c  used to test the fp2hdf program.  [Note: the 32-bit floating
+c  point files are omitted for Cray (UNICOS) systems]
+c 
+c  May 23, 1990
+c  Glen A. Mortensen, gam at inel.gov
+c
+c  The file names that are created are named:
+c      ftxtr2, type 'TEXT', size 3x4
+c      ftxtr3, type 'TEXT', size 3x4x5
+c      fb32r2, type 'FP32', size 3x4
+c      fb32r3, type 'FP32', size 3x4x5
+c      fb64r2, type 'FP64', size 3x4
+c      fb64r3, type 'FP64', size 3x4x5
+c
+c   row    values start at 11 and increment by 1 => 11, 12, 13
+c   column values start at 21 and increment by 2 => 21, 23, 25, 27
+c   plane  values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+c
+c   data element value = row value + column value [+ plane value, if rank=3]
+c
+
+       integer    nrow    , ncol    , npln    , ione
+       parameter (nrow = 3, ncol = 4)
+       integer    i       , j       , k       , nrec
+       integer    funit
+
+       real       b32r2(3,4)    , b32r3(3,4,5)
+       real       row4(3)       , col4(4)       , pln4(5)
+       real       rowo4         , colo4         , plno4
+       real       rowi4         , coli4         , plni4
+       parameter (rowo4 = 11.0e0, colo4 = 21.0e0, plno4 = 51.0e0)
+       parameter (rowi4 =  1.0e0, coli4 =  2.0e0, plni4 =  5.0e0)
+       real       ezero
+       parameter (ezero  =  0.0e0)
+
+C#ifndef UNICOS
+C       double precision     b64r2(3,4)    , b64r3(3,4,5)
+C       double precision    row8(3)       , col8(4)       , pln8(5)
+C       double precision    rowo8         , colo8         , plno8
+C       double precision    rowi8         , coli8         , plni8
+C       parameter       (rowo8 = 11.0d0, colo8 = 21.0d0, plno8 = 51.0d0)
+C       parameter       (rowi8 =  1.0d0, coli8 =  2.0d0, plni8 =  5.0d0)
+C       double precision    dzero
+C       parameter       (dzero =  0.0d0)
+C#else
+       real       b64r2(3,4)    , b64r3(3,4,5)
+       real       row8(3)       , col8(4)       , pln8(5)
+       real       rowo8         , colo8         , plno8
+       real       rowi8         , coli8         , plni8
+       parameter (rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0)
+       parameter (rowi8 =  1.0e0, coli8 =  2.0e0, plni8 =  5.0e0)
+       real       dzero
+       parameter (dzero  =  0.0e0)
+C#endif
+
+       integer   text,  fp32,  fp64
+       data      text   / 'TEXT' /
+       data      fp32   / 'FP32' /
+       data      fp64   / 'FP64' /
+       data      funit  /    21  /
+
+c
+c  setting of these two parameters using assignments gets around the
+c  bug in the Absoft MacFortran/MPW compiler.  This bug is fixed
+c  in the new version, MacFortran II, gam 7/5/90.
+c
+       ione = 1
+       npln = 5
+
+c
+c
+c  initialize the row, column, and plane vectors
+c
+c  row values start at 11 and increment by 1 => 11, 12, 13
+c  column values start at 21 and increment by 2 => 21, 23, 25, 27
+c  plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+c
+       row4(1) = rowo4
+       col4(1) = colo4
+       pln4(1) = plno4
+       row8(1) = rowo8
+       col8(1) = colo8
+       pln8(1) = plno8
+
+       do 10 i = 2, nrow
+         row4(i) = row4(i-1) + rowi4
+         row8(i) = row8(i-1) + rowi8
+   10  continue
+       do 20 j = 2, ncol
+         col4(j) = col4(j-1) + coli4
+         col8(j) = col8(j-1) + coli8
+   20  continue
+       do 30 k = 2, npln
+         pln4(k) = pln4(k-1) + plni4
+         pln8(k) = pln8(k-1) + plni8
+   30  continue
+
+c
+c  build array elements - rank 2
+c
+c  element value = sum of row value and col values
+c
+
+       do 110 i = 1, nrow
+         do 100 j = 1, ncol
+           b32r2(i,j) = row4(i) + col4(j)
+           b64r2(i,j) = row8(i) + col8(j)
+  100    continue
+  110  continue
+
+c
+c  build array elements - rank 3
+c
+c  element value = sum of row value, col, and plane values
+c
+
+       do 220 i = 1, nrow
+         do 210 j = 1, ncol
+           do 200 k = 1, npln
+             b32r3(i,j,k) = row4(i) + col4(j) + pln4(k)
+             b64r3(i,j,k) = row8(i) + col8(j) + pln8(k)
+  200      continue
+  210    continue
+  220  continue
+
+c 
+c  text file - rank 2 & 3
+c
+
+       open  (funit,file='ftxtr2')
+       write (funit,800) text
+       write (funit,801) ione, nrow , ncol
+       write (funit,802) ezero, ezero
+       write (funit,802) (row4(i), i=1, nrow)
+       write (funit,802) (col4(j), j=1, ncol )
+       do 310 i = 1, nrow
+         write (funit,802) (b32r2(i,j), j=1, ncol)
+  310  continue
+       close (funit)
+
+       open  (funit,file='ftxtr3')
+       write (funit,800) text
+       write (funit,801) npln, nrow, ncol
+       write (funit,802) ezero, ezero
+       write (funit,802) (pln4(k), k=1, npln)
+       write (funit,802) (row4(i), i=1, nrow)
+       write (funit,802) (col4(j), j=1, ncol)
+       do 330 k = 1, npln
+         do 320 i = 1, nrow
+           write (funit,802) (b32r3(i,j,k), j=1, ncol)
+  320    continue
+  330  continue
+       close (funit)
+
+c
+c  binary 32-bit file - rank 2 & 3
+c
+
+#ifndef UNICOS
+#ifdef	DECSTATION
+       open  (funit,file='fb32r2',form='unformatted',recl=1,
+     .        access='direct')
+#else
+       open  (funit,file='fb32r2',form='unformatted',recl=4,
+     .        access='direct')
+#endif
+       write (funit,rec=1) fp32
+       write (funit,rec=2) ione
+       write (funit,rec=3) nrow
+       write (funit,rec=4) ncol
+       write (funit,rec=5) ezero
+       write (funit,rec=6) ezero
+       nrec = 6
+       do 410 i = 1, nrow
+         nrec = nrec + 1
+         write (funit,rec=nrec) row4(i)
+  410  continue
+       do 420 j = 1, ncol
+         nrec = nrec + 1
+         write (funit,rec=nrec) col4(j)
+  420  continue
+       do 440 i = 1, nrow
+         do 430 j = 1, ncol
+           nrec = nrec + 1
+           write (funit,rec=nrec) b32r2(i,j)
+  430    continue
+  440  continue
+       close (funit)
+
+#ifdef	DECSTATION
+       open  (funit,file='fb32r3',form='unformatted',recl=1,
+     .        access='direct')
+#else
+       open  (funit,file='fb32r3',form='unformatted',recl=4,
+     .        access='direct')
+#endif
+       write (funit,rec=1) fp32
+       write (funit,rec=2) npln
+       write (funit,rec=3) nrow
+       write (funit,rec=4) ncol
+       write (funit,rec=5) ezero
+       write (funit,rec=6) ezero
+       nrec = 6
+       do 450 k = 1, npln
+         nrec = nrec + 1
+         write (funit,rec=nrec) pln4(k)
+  450  continue
+       do 460 i = 1, nrow
+         nrec = nrec + 1
+         write (funit,rec=nrec) row4(i)
+  460  continue
+       do 470 j = 1, ncol
+         nrec = nrec + 1
+         write (funit,rec=nrec) col4(j)
+  470  continue
+       do 500 k = 1, npln
+         do 490 i = 1, nrow
+           do 480 j = 1, ncol
+             nrec = nrec + 1
+             write (funit,rec=nrec) b32r3(i,j,k)
+  480      continue
+  490    continue
+  500  continue
+       close (funit)
+#endif
+
+c
+c  binary 64-bit file - rank 2 & 3
+c
+
+#ifdef UNICOS
+       open  (funit,file='fb64r2',form='unformatted',recl=8,
+     .        access='direct')
+#else
+#ifdef DECSTATION
+       open  (funit,file='fb64r2',form='unformatted',recl=1,
+     .        access='direct')
+#else
+       open  (funit,file='fb64r2',form='unformatted',recl=4,
+     .        access='direct')
+#endif
+#endif
+       write (funit,rec=1) fp64
+       write (funit,rec=2) ione
+       write (funit,rec=3) nrow
+       write (funit,rec=4) ncol
+#ifdef UNICOS
+       nrec = 5
+#else
+       close (funit)
+#ifdef	DECSTATION
+       open  (funit,file='fb64r2',form='unformatted',recl=2,
+     .        access='direct')
+#else
+       open  (funit,file='fb64r2',form='unformatted',recl=8,
+     .        access='direct')
+#endif
+       nrec = 3
+#endif
+       write (funit,rec=nrec) dzero
+       nrec = nrec + 1
+       write (funit,rec=nrec) dzero
+       do 510 i = 1, nrow
+         nrec = nrec + 1
+         write (funit,rec=nrec) row8(i)
+  510  continue
+       do 520 j = 1, ncol
+         nrec = nrec + 1
+         write (funit,rec=nrec) col8(j)
+  520  continue
+       do 540 i = 1, nrow
+         do 530 j = 1, ncol
+           nrec = nrec + 1
+           write (funit,rec=nrec) b64r2(i,j)
+  530    continue
+  540  continue
+       close (funit)
+
+#ifdef UNICOS
+       open  (funit,file='fb64r3',form='unformatted',recl=8,
+     .        access='direct')
+#else
+#ifdef DECSTATION
+       open  (funit,file='fb64r3',form='unformatted',recl=1,
+     .        access='direct')
+#else
+       open  (funit,file='fb64r3',form='unformatted',recl=4,
+     .        access='direct')
+#endif
+#endif
+       write (funit,rec=1) fp64
+       write (funit,rec=2) npln
+       write (funit,rec=3) nrow
+       write (funit,rec=4) ncol
+#ifdef UNICOS
+       nrec = 5
+#else
+       close (funit)
+#ifdef DECSTATION
+       open  (funit,file='fb64r3',form='unformatted',recl=2,
+     .        access='direct')
+#else
+       open  (funit,file='fb64r3',form='unformatted',recl=8,
+     .        access='direct')
+#endif
+       nrec = 3
+#endif
+       write (funit,rec=nrec) dzero
+       nrec = nrec + 1
+       write (funit,rec=nrec) dzero
+       do 550 k = 1, npln
+         nrec = nrec + 1
+         write (funit,rec=nrec) pln8(k)
+  550  continue
+       do 560 i = 1, nrow
+         nrec = nrec + 1
+         write (funit,rec=nrec) row8(i)
+  560  continue
+       do 570 j = 1, ncol
+         nrec = nrec + 1
+         write (funit,rec=nrec) col8(j)
+  570  continue
+       do 600 k = 1,npln
+         do 590 i = 1, nrow
+           do 580 j = 1, ncol
+             nrec = nrec + 1
+             write (funit,rec=nrec) b64r3(i,j,k)
+  580      continue
+  590    continue
+  600  continue
+       close (funit)
+
+c
+c  formats for the text files
+c
+
+  800  format (a4)
+  801  format (3i10)
+  802  format (1p5e14.6)
+
+       end      

Added: packages/libhdf4/branches/upstream/current/hdf/util/getopt.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/getopt.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/getopt.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -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 */

Added: packages/libhdf4/branches/upstream/current/hdf/util/getopt1.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/getopt1.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/getopt1.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -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 */

Added: packages/libhdf4/branches/upstream/current/hdf/util/gif.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/gif.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/gif.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -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 */
+


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/gif.h
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/util/gif2hdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/gif2hdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/gif2hdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,106 @@
+#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);
+}


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/gif2hdf.c
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/util/gif2mem.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/gif2mem.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/gif2mem.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,344 @@
+/*
+** 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 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);
+        }
+	}
+	
+	
+}


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/gif2mem.c
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/util/gifread.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/gifread.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/gifread.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,413 @@
+/****************************************************************************\
+**  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 */
+}
+
+
+
+
+


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/gifread.c
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdf24to8.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdf24to8.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdf24to8.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,359 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.14 $";
+#endif
+
+/* $Id: hdf24to8.c,v 1.14 1996/11/11 20:40:14 koziol Exp $ */
+
+/**************************************************************************
+* 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
+
+#if defined __MWERKS__
+#include <console.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 defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdf24to8.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdf24to8.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdf24to8.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,161 @@
+# 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 "hdf24to8.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 : $(OUTDIR)/hdf24to8.exe $(OUTDIR)/hdf24to8.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /W3 /GX /YX /O2 /I "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c
+CPP_PROJ=/nologo /W3 /GX /YX /O2 /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "NDEBUG" /D "_CONSOLE" /FR$(INTDIR)/ /Fp$(OUTDIR)/"hdf24to8.pch" /Fo$(INTDIR)/\
+ /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	$(INTDIR)/hdf24to8.sbr
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"hdf24to8.bsc" 
+
+$(OUTDIR)/hdf24to8.bsc : $(OUTDIR)  $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdf24to8.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 advai32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386
+LINK32_FLAGS=advai32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\
+ comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdf24to8.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdf24to8.exe" 
+
+$(OUTDIR)/hdf24to8.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)/hdf24to8.exe $(OUTDIR)/hdf24to8.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c
+# SUBTRACT CPP /YX
+CPP_PROJ=/nologo /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /FR$(INTDIR)/ /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdf24to8.pdb"\
+ /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	$(INTDIR)/hdf24to8.sbr
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"hdf24to8.bsc" 
+
+$(OUTDIR)/hdf24to8.bsc : $(OUTDIR)  $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdf24to8.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 advapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386
+LINK32_FLAGS=advapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\
+ comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdf24to8.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdf24to8.exe" 
+
+$(OUTDIR)/hdf24to8.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=.\hdf24to8.c
+
+$(INTDIR)/hdf24to8.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdf2gif.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdf2gif.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdf2gif.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,340 @@
+#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 appears not to be 8-bit. Trying next image...\n");
+			continue;
+		}
+
+		
+		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);
+}


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/hdf2gif.c
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdf2jpeg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdf2jpeg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdf2jpeg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,384 @@
+
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.15 $";
+#endif
+
+/* $Id: hdf2jpeg.c,v 1.15 1996/11/11 20:40:15 koziol Exp $ */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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 defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+    /*
+     * 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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdf2jpeg.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdf2jpeg.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdf2jpeg.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "hdf2jpeg.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)/hdf2jpeg.exe $(OUTDIR)/hdf2jpeg.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"hdf2jpeg.bsc" 
+
+$(OUTDIR)/hdf2jpeg.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdf2jpeg.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdf2jpeg.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdf2jpeg.exe" 
+
+$(OUTDIR)/hdf2jpeg.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)/hdf2jpeg.exe $(OUTDIR)/hdf2jpeg.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdf2jpeg.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)/"hdf2jpeg.bsc" 
+
+$(OUTDIR)/hdf2jpeg.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdf2jpeg.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdf2jpeg.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdf2jpeg.exe" 
+
+$(OUTDIR)/hdf2jpeg.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=.\hdf2jpeg.c
+
+$(INTDIR)/hdf2jpeg.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdf8to24.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdf8to24.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdf8to24.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,362 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.18 $";
+#endif
+
+/* $Id: hdf8to24.c,v 1.18 1998/12/08 21:37:55 koziol Exp $ */
+
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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 defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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 */

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdf8to24.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdf8to24.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdf8to24.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,152 @@
+# 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 "hdf8to24.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)/hdf8to24.exe $(OUTDIR)/hdf8to24.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"hdf8to24.bsc" 
+
+$(OUTDIR)/hdf8to24.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdf8to24.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdf8to24.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdf8to24.exe" 
+
+$(OUTDIR)/hdf8to24.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)/hdf8to24.exe $(OUTDIR)/hdf8to24.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdf8to24.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)/"hdf8to24.bsc" 
+
+$(OUTDIR)/hdf8to24.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdf8to24.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdf8to24.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdf8to24.exe" 
+
+$(OUTDIR)/hdf8to24.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=\hdf4.0\DEV\hdf\util\hdf8to24.c
+
+$(INTDIR)/hdf8to24.obj :  $(SOURCE)  $(INTDIR)
+   $(CPP) $(CPP_PROJ)  $(SOURCE) 
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,252 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 1.14 $";
+#endif
+
+/* $Id: hdfcomp.c,v 1.14 1996/11/11 20:40:17 koziol Exp $ */
+
+/*
+*  hdfcomp.c
+*  Re-compress Raster-8 HDF file
+*/
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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 defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "hdfcomp.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)/hdfcomp.exe $(OUTDIR)/hdfcomp.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"hdfcomp.bsc" 
+
+$(OUTDIR)/hdfcomp.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdfcomp.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdfcomp.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdfcomp.exe" 
+
+$(OUTDIR)/hdfcomp.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)/hdfcomp.exe $(OUTDIR)/hdfcomp.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdfcomp.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)/"hdfcomp.bsc" 
+
+$(OUTDIR)/hdfcomp.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdfcomp.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdfcomp.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdfcomp.exe" 
+
+$(OUTDIR)/hdfcomp.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=.\hdfcomp.c
+
+$(INTDIR)/hdfcomp.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.out1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.out1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfcomp.out1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfed.input1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfed.input1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfed.input1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfed.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfed.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfed.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,181 @@
+# 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 "hdfed.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)/hdfed.exe $(OUTDIR)/hdfed.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"hdfed.bsc" 
+
+$(OUTDIR)/hdfed.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/he_file.obj \
+	$(INTDIR)/he_main.obj \
+	$(INTDIR)/he_disp.obj \
+	$(INTDIR)/he_cntrl.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdfed.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdfed.exe" 
+
+$(OUTDIR)/hdfed.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)/hdfed.exe $(OUTDIR)/hdfed.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdfed.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)/"hdfed.bsc" 
+
+$(OUTDIR)/hdfed.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/he_file.obj \
+	$(INTDIR)/he_main.obj \
+	$(INTDIR)/he_disp.obj \
+	$(INTDIR)/he_cntrl.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdfed.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdfed.exe" 
+
+$(OUTDIR)/hdfed.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=.\he_file.c
+
+$(INTDIR)/he_file.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\he_main.c
+
+$(INTDIR)/he_main.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\he_disp.c
+
+$(INTDIR)/he_disp.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\he_cntrl.c
+
+$(INTDIR)/he_cntrl.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfed.out1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfed.out1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfed.out1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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 

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfgifwr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfgifwr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfgifwr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,519 @@
+/*
+ * 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;
+  }
+}	
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfls.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfls.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfls.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,630 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.61 $";
+#endif
+
+/* $Id: hdfls.c,v 1.61 1998/12/23 21:30:04 epourmal Exp $ */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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;
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfls.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfls.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfls.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "hdfls.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)/hdfls.exe $(OUTDIR)/hdfls.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"hdfls.bsc" 
+
+$(OUTDIR)/hdfls.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdfls.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdfls.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdfls.exe" 
+
+$(OUTDIR)/hdfls.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)/hdfls.exe $(OUTDIR)/hdfls.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdfls.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)/"hdfls.bsc" 
+
+$(OUTDIR)/hdfls.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdfls.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdfls.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdfls.exe" 
+
+$(OUTDIR)/hdfls.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=.\hdfls.c
+
+$(INTDIR)/hdfls.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,663 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.26 $";
+#endif
+
+/* $Id: hdfpack.c,v 1.26 1997/10/25 00:56:30 koziol Exp $ */
+
+/*
+   ** 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.
+ */
+
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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");
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+/*
+   **   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 = -1;
+    oldlen = -1;
+    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 = Hstartwrite(outfile, BASETAG(dd->tag), dd->ref, dd->length);
+    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 (len == 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));
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "hdfpack.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)/hdfpack.exe $(OUTDIR)/hdfpack.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"hdfpack.bsc" 
+
+$(OUTDIR)/hdfpack.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdfpack.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdfpack.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdfpack.exe" 
+
+$(OUTDIR)/hdfpack.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)/hdfpack.exe $(OUTDIR)/hdfpack.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdfpack.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)/"hdfpack.bsc" 
+
+$(OUTDIR)/hdfpack.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdfpack.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdfpack.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdfpack.exe" 
+
+$(OUTDIR)/hdfpack.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=.\hdfpack.c
+
+$(INTDIR)/hdfpack.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.out1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.out1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfpack.out1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfrseq.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfrseq.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfrseq.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,713 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.14 $";
+#endif
+
+/* $Id: hdfrseq.c,v 1.14 1996/04/09 20:09:38 georgev Exp $ */
+
+/*    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
+   *
+ */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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;
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+/*
+   *  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 */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdftopal.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdftopal.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdftopal.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,105 @@
+
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.11 $";
+#endif
+
+/* $Id: hdftopal.c,v 1.11 1996/04/09 20:09:38 georgev Exp $ */
+
+/*
+   *  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
+   *
+ */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+
+#include "hdf.h"
+
+int         main(int argc, char *argv[]);
+int         rawpalconv(char *hdffile, char *rawpalfile);
+
+int
+main(int argc, char *argv[])
+{
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdftopal.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdftopal.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdftopal.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "hdftopal.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)/hdftopal.exe $(OUTDIR)/hdftopal.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"hdftopal.bsc" 
+
+$(OUTDIR)/hdftopal.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdftopal.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdftopal.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdftopal.exe" 
+
+$(OUTDIR)/hdftopal.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)/hdftopal.exe $(OUTDIR)/hdftopal.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdftopal.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)/"hdftopal.bsc" 
+
+$(OUTDIR)/hdftopal.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdftopal.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdftopal.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdftopal.exe" 
+
+$(OUTDIR)/hdftopal.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=.\hdftopal.c
+
+$(INTDIR)/hdftopal.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,404 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.22 $";
+#endif
+
+/* $Id: hdftor8.c,v 1.22 1998/12/08 21:37:57 koziol Exp $ */
+
+/*
+ * hdftor8.c
+ * Extract images from HDF file to raster files
+ */
+
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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 defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "hdftor8.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)/hdftor8.exe $(OUTDIR)/hdftor8.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"hdftor8.bsc" 
+
+$(OUTDIR)/hdftor8.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdftor8.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdftor8.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdftor8.exe" 
+
+$(OUTDIR)/hdftor8.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)/hdftor8.exe $(OUTDIR)/hdftor8.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdftor8.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)/"hdftor8.bsc" 
+
+$(OUTDIR)/hdftor8.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdftor8.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdftor8.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdftor8.exe" 
+
+$(OUTDIR)/hdftor8.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=.\hdftor8.c
+
+$(INTDIR)/hdftor8.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.out1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.out1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdftor8.out1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfunpac.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfunpac.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfunpac.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,225 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.12 $";
+#endif
+
+/* $Id: hdfunpac.c,v 1.12 1996/11/11 20:40:20 koziol Exp $ */
+
+/*
+   ** 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".
+ */
+
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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;
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    /* 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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/hdfunpac.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/hdfunpac.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/hdfunpac.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,161 @@
+# 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 "hdfunpac.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 : $(OUTDIR)/hdfunpac.exe $(OUTDIR)/hdfunpac.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c
+# SUBTRACT CPP /YX
+CPP_PROJ=/nologo /W3 /GX /O2 /I "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D\
+ "_CONSOLE" /FR$(INTDIR)/ /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	$(INTDIR)/hdfunpac.sbr
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"hdfunpac.bsc" 
+
+$(OUTDIR)/hdfunpac.bsc : $(OUTDIR)  $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdfunpac.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdfunpac.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdfunpac.exe" 
+
+$(OUTDIR)/hdfunpac.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)/hdfunpac.exe $(OUTDIR)/hdfunpac.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c
+# SUBTRACT CPP /YX
+CPP_PROJ=/nologo /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /FR$(INTDIR)/ /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdfunpac.pdb"\
+ /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	$(INTDIR)/hdfunpac.sbr
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"hdfunpac.bsc" 
+
+$(OUTDIR)/hdfunpac.bsc : $(OUTDIR)  $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdfunpac.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdfunpac.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdfunpac.exe" 
+
+$(OUTDIR)/hdfunpac.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=.\hdfunpac.c
+
+$(INTDIR)/hdfunpac.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/he.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/he.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/he.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,197 @@
+/****************************************************************************
+ * 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: he.h,v 1.19 1996/11/11 20:40:20 koziol Exp $ */
+
+/* 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 VMS
+#include <unixlib.h>
+#include <descrip.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 */

Added: packages/libhdf4/branches/upstream/current/hdf/util/he_cntrl.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/he_cntrl.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/he_cntrl.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1739 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.33 $";
+#endif
+
+/* $Id: he_cntrl.c,v 1.33 2000/08/29 13:55:56 koziol Exp $ */
+
+/* ------ 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 dump(length, offset, format, raw);
+}
+
+#define MAX_LINE 60
+
+/*
+ * Run 'od' on a segment of the current data element
+ */
+int
+dump(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 */

Added: packages/libhdf4/branches/upstream/current/hdf/util/he_disp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/he_disp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/he_disp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,409 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.19 $";
+#endif
+
+/* $Id: he_disp.c,v 1.19 1996/11/11 20:40:22 koziol Exp $ */
+
+/* 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/util/he_file.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/he_file.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/he_file.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,656 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.31 $";
+#endif
+
+/* $Id: he_file.c,v 1.31 1998/02/02 21:46:09 smitchel Exp $ */
+
+/* --- he-file.c  --- file and annotation manipulation routines */
+#include "he.h"
+#ifdef VMS
+#   include <descrip.h>
+#   include <processes.h>
+#   include <unixlib.h>
+/*
+#   include <tpudef.h>
+*/
+#   include <tpu$routines>
+#endif
+
+/* 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)
+{
+
+#if !defined MAC && !defined WIN386 && !defined(macintosh)
+
+    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);
+      }
+
+#ifndef VMS
+    /* 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";
+      }
+#ifdef CRAYMPP
+    {	char	cmd[256];
+	if (HDstrlen(editor) > 100) {
+	    fprintf(stderr, "Environment variable EDITOR too big\n");
+	}
+	else {
+	    sprintf(cmd, "%s %s", editor, file);
+	    system(cmd);
+	}
+    }
+#else
+    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);
+#endif
+#else  /* VMS  */
+    if (vfork() == 0)
+        /* this is the child */
+      {
+          intn        ret_status;
+ 
+          $DESCRIPTOR(input_file, file);
+          $DESCRIPTOR(output_file, file);
+          ret_status = TPU$EDIT(&input_file, &output_file);
+          fprintf(stderr, "TPU$EDIT return status: %d. \n", ret_status);
+          exit(0);
+      }
+
+    /* the parent waits for the child to die */
+    wait(0);
+#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;
+
+#else
+    /* shut compiler up */
+    ann = ann;
+    editor = editor;
+
+    return 1;
+
+#endif /* not def MAC & WIN386 & macintosh */
+
+}
+
+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 */

Added: packages/libhdf4/branches/upstream/current/hdf/util/he_main.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/he_main.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/he_main.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1317 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.39 $";
+#endif
+
+/* $Id: he_main.c,v 1.39 1997/12/04 01:50:05 sxu Exp $ */
+
+/******************************************************************************
+ * 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 */
+
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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;
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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 function is not called.
+
+   int od(char *format, char *file)
+   {
+   fork a child and let the child run od. Use vfork for VMS.
+
+   if (fork() == 0)
+
+   {
+   this is the child
+
+   if (execl("/bin/od", "od", format, file, 0) == -1)
+   fprintf(stderr, "Error while executing od.\n");
+
+   return control to the parent
+   exit(0);
+   }
+
+   the parent waits for the child to die
+
+   wait(0);
+
+   this is a bug because it always returns OK, will expand this as
+   soon as the status return mechanism from wait is understood
+   return HE_OK;
+
+   }
+ */
+
+/* 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)
+{
+#ifndef VMS
+    return unlink(file);
+#else
+    return remove((const char *) file);
+#endif
+}
+
+/* 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 */

Added: packages/libhdf4/branches/upstream/current/hdf/util/he_proto.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/he_proto.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/he_proto.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,308 @@
+/****************************************************************************
+ * 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: he_proto.h,v 1.14 1997/11/05 19:39:39 koziol Exp $ */
+
+/* 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         dump
+            (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);

Added: packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,619 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char *RcsId[] = "@(#)$Revision: 1.13 $";
+#endif
+
+/* $Id: jpeg2hdf.c,v 1.13 1996/11/11 20:40:25 koziol Exp $ */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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)
+            {
+#ifdef QAK
+                case M_SOF0:
+                case M_SOF1:
+                case M_SOF2:
+                case M_SOF3:
+                case M_SOF5:
+                case M_SOF6:
+                case M_SOF7:
+                case M_JPG:
+                case M_SOF9:
+                case M_SOF10:
+                case M_SOF11:
+                case M_SOF13:
+                case M_SOF14:
+                case M_SOF15:
+                case M_SOI:
+#endif
+                case M_EOI:
+#ifdef OLD_WAY
+                case M_SOS:
+#endif
+                    return ((JPEG_MARKER) c);
+
+                case M_SOF0:
+                case M_SOF1:
+                case M_SOF9:
+                    get_sof(f);
+                    return ((JPEG_MARKER) c);
+
+#ifdef QAK
+                case M_DHT:
+                    get_dht(cinfo);
+                    break;
+
+                case M_DAC:
+                    get_dac(cinfo);
+                    break;
+
+                case M_DQT:
+                    get_dqt(cinfo);
+                    break;
+
+                case M_DRI:
+                    get_dri(cinfo);
+                    break;
+
+                case M_APP0:
+                    get_app0(cinfo);
+                    break;
+#endif
+
+                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 defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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 */

Added: packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "jpeg2hdf.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)/jpeg2hdf.exe $(OUTDIR)/jpeg2hdf.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"jpeg2hdf.bsc" 
+
+$(OUTDIR)/jpeg2hdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/jpeg2hdf.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"jpeg2hdf.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"jpeg2hdf.exe" 
+
+$(OUTDIR)/jpeg2hdf.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)/jpeg2hdf.exe $(OUTDIR)/jpeg2hdf.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"jpeg2hdf.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)/"jpeg2hdf.bsc" 
+
+$(OUTDIR)/jpeg2hdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/jpeg2hdf.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"jpeg2hdf.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"jpeg2hdf.exe" 
+
+$(OUTDIR)/jpeg2hdf.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=.\jpeg2hdf.c
+
+$(INTDIR)/jpeg2hdf.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.out1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.out1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/jpeg2hdf.out1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/makepc.386
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/makepc.386	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/makepc.386	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,119 @@
+# ****************************************************************************
+# * 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: makepc.386,v 1.1 1994/10/06 20:06:14 koziol Exp $
+#
+#
+UTILS = hdf24to8.exe hdfcomp.exe hdfls.exe hdfpack.exe hdftopal.exe &
+    hdftor8.exe paltohdf.exe r8tohdf.exe ristosds.exe vcompat.exe vmake.exe &
+    vshow.exe hdf8to24.exe hdf2jpeg.exe jpeg2hdf.exe
+
+HEOBJ = he_main.obj he_cntrl.obj he_disp.obj he_file.obj
+HELNK = he_main, he_cntrl, he_disp, he_file
+
+#
+# These values will typically be over ridden by values specified in
+#   top level HDF
+#
+
+# ==> Uncomment the line with your system type on it.
+#MACHINE = SUN
+#MACHINE = UNICOS
+#MACHINE = IRIS4
+#MACHINE = APOLLO
+#MACHINE = IBM6000
+#MACHINE = CONVEX
+#MACHINE = VMS
+#MACHINE = MIPSEL
+#MACHINE = MAC
+MACHINE = PC386
+#MACHINE = HP9000
+
+RM=del
+RMFLAGS=
+
+HDFLIB = ..\lib
+HDFINC = ..\include
+HDFBIN = ..\bin
+
+IFLAGS=   /i=$(HDFINC) /I.
+LIBS= $(HDFLIB)\df.lib
+
+CC=wcc386
+CFLAGS=  /d$(MACHINE) /ms /w4 /Oneatx /s $(IFLAGS) /zc /ze
+
+LN=wlink
+#LNFLAGS=/COD /ST:6118
+
+.c.obj:
+    $(CC) $[@ $(CFLAGS)
+
+all: hdfed.exe utils
+    mkdir $(HDFBIN)
+    cp *.exe $(HDFBIN)
+
+nofortran: all
+
+hdfed.exe: he.h he_proto.h $(HEOBJ)
+    $(LN) $(LNFLAGS) NAME hdfed FILE $(HELNK) LIBRARY $(LIBS)
+
+hdf24to8.exe : hdf24to8.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+hdfcomp.exe : hdfcomp.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+hdfls.exe : hdfls.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+hdfpack.exe : hdfpack.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+hdftopal.exe : hdftopal.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+hdftor8.exe : hdftor8.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+paltohdf.exe : paltohdf.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+r8tohdf.exe : r8tohdf.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+hdf8to24.exe : hdf8to24.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+hdf2jpeg.exe : hdf2jpeg.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+jpeg2hdf.exe : jpeg2hdf.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+ristosds.exe : ristosds.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+vcompat.exe : vcompat.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+vmake.exe : vmake.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+vshow.exe : vshow.obj
+    $(LN) $(LNFLAGS) NAME $^@ FILE $[@ LIBRARY $(LIBS)
+
+utils: $(UTILS)
+    %null
+
+clean:
+    -$(RM) $(RMFLAGS) *.obj $(UTILS) hdfed.exe
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/makepc.msc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/makepc.msc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/makepc.msc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,119 @@
+# ****************************************************************************
+# * 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: makepc.msc,v 1.6 1994/04/19 15:52:36 koziol Exp $
+#
+UTILS = hdf24to8.exe hdfcomp.exe hdfls.exe hdfpack.exe hdftopal.exe \
+    hdftor8.exe paltohdf.exe r8tohdf.exe ristosds.exe vcompat.exe vmake.exe \
+    vshow.exe hdf8to24.exe hdf2jpeg.exe jpeg2hdf.exe
+
+HEOBJ = he_main.obj he_cntrl.obj he_disp.obj he_file.obj
+
+#
+# These values will typically be over ridden by values specified in
+#   top level HDF 
+#
+
+# ==> Uncomment the line with your system type on it.
+#MACHINE = SUN
+#MACHINE = UNICOS
+#MACHINE = IRIS4
+#MACHINE = APOLLO
+#MACHINE = IBM6000
+#MACHINE = CONVEX
+#MACHINE = VMS
+#MACHINE = MIPSEL
+#MACHINE = MAC
+MACHINE = PC
+#MACHINE = HP9000
+
+RM=del
+RMFLAGS=
+
+HDFLIB = ..\lib
+HDFINC = ..\include
+HDFBIN = ..\bin
+
+IFLAGS=   /I..\include /I.
+LIBS= ..\lib\df.lib
+
+CC=cl
+#CFLAGS=  /c /D$(MACHINE) /Gt512 /AH /W4 /Od $(IFLAGS) /Zi
+#CFLAGS=  /c /D$(MACHINE) /AH /W4 /Od $(IFLAGS) /Zi
+CFLAGS=  /c /D$(MACHINE) /Gt32 /AH /W4 /Od $(IFLAGS) /Zi /Gs /FPi87
+#CFLAGS=  /c /D$(MACHINE) /Gt512 /AH /W4 /Ox $(IFLAGS)
+
+LN=link
+LNFLAGS=/COD /ST:6118 /SEG:256
+
+# ==> For IRIS4, specify CFLAGS as follows:
+#CFLAGS=  -g -D$(MACHINE) -ansi
+
+.c.obj:
+    $(CC) $(CFLAGS) $<
+
+all: hdfed.exe utils
+    mkdir $(HDFBIN)
+    cp *.exe $(HDFBIN)
+
+nofortran: all
+
+hdfed.exe: he.h he_proto.h $(HEOBJ)
+    $(LN) $(LNFLAGS) $(HEOBJ),$*,nul,$(LIBS);
+
+hdf24to8.exe : hdf24to8.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+hdfcomp.exe : hdfcomp.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+hdfpack.exe : hdfpack.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+hdftopal.exe : hdftopal.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+hdftor8.exe : hdftor8.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+paltohdf.exe : paltohdf.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+r8tohdf.exe : r8tohdf.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+hdf8to24.exe : hdf8to24.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+hdf2jpeg.exe : hdf2jpeg.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+jpeg2hdf.exe : jpeg2hdf.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+ristosds.exe : ristosds.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+vcompat.exe : vcompat.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+vmake.exe : vmake.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+vshow.exe : vshow.obj
+    $(LN) $(LNFLAGS) $*,$*,nul,$(LIBS);
+
+utils: $(UTILS)
+
+clean:
+    -$(RM) $(RMFLAGS) *.obj $(UTILS) hdfed.exe
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/paltohdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/paltohdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/paltohdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,104 @@
+
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#) $Revision: 1.11 $"
+#endif
+
+/* $Id: paltohdf.c,v 1.11 1996/04/09 20:09:44 georgev Exp $ */
+
+/*
+   *  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
+ */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#include "hdf.h"
+
+int main(int argc, char *argv[]);
+int         palconv(char *palfile, char *outfile);
+
+int
+main(int argc, char *argv[])
+{
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/paltohdf.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/paltohdf.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/paltohdf.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "paltohdf.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)/paltohdf.exe $(OUTDIR)/paltohdf.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"paltohdf.bsc" 
+
+$(OUTDIR)/paltohdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/paltohdf.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"paltohdf.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"paltohdf.exe" 
+
+$(OUTDIR)/paltohdf.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)/paltohdf.exe $(OUTDIR)/paltohdf.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"paltohdf.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)/"paltohdf.bsc" 
+
+$(OUTDIR)/paltohdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/paltohdf.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"paltohdf.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"paltohdf.exe" 
+
+$(OUTDIR)/paltohdf.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=.\paltohdf.c
+
+$(INTDIR)/paltohdf.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/r8tohdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/r8tohdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/r8tohdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,206 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.16 $";
+#endif
+
+/* $Id: r8tohdf.c,v 1.16 1996/11/11 20:40:26 koziol Exp $ */
+
+/*
+   *  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 */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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 defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/r8tohdf.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/r8tohdf.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/r8tohdf.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "r8tohdf.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)/r8tohdf.exe $(OUTDIR)/r8tohdf.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"r8tohdf.bsc" 
+
+$(OUTDIR)/r8tohdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/r8tohdf.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"r8tohdf.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"r8tohdf.exe" 
+
+$(OUTDIR)/r8tohdf.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)/r8tohdf.exe $(OUTDIR)/r8tohdf.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"r8tohdf.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)/"r8tohdf.bsc" 
+
+$(OUTDIR)/r8tohdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/r8tohdf.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"r8tohdf.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"r8tohdf.exe" 
+
+$(OUTDIR)/r8tohdf.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=.\r8tohdf.c
+
+$(INTDIR)/r8tohdf.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/ristosds.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/ristosds.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/ristosds.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,206 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.17 $";
+#endif
+
+/* $Id: ristosds.c,v 1.17 1996/11/11 20:40:26 koziol Exp $ */
+
+/* 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                 */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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 defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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)));
+    indata0 = indata = (uint8 *) HDmalloc((size_t)(w * h) * sizeof(char));
+    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);
+    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);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/util/ristosds.input1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/ristosds.input1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/ristosds.input1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/hdf/util/ristosds.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/ristosds.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/ristosds.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "ristosds.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)/ristosds.exe $(OUTDIR)/ristosds.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"ristosds.bsc" 
+
+$(OUTDIR)/ristosds.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/ristosds.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"ristosds.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"ristosds.exe" 
+
+$(OUTDIR)/ristosds.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)/ristosds.exe $(OUTDIR)/ristosds.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"ristosds.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)/"ristosds.bsc" 
+
+$(OUTDIR)/ristosds.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/ristosds.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"ristosds.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"ristosds.exe" 
+
+$(OUTDIR)/ristosds.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=.\ristosds.c
+
+$(INTDIR)/ristosds.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/ristosds.out1
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/ristosds.out1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/ristosds.out1	2007-05-14 09:41:34 UTC (rev 808)
@@ -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 

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/README
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/testfiles/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/testfiles/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/SunWheel.gif
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/SunWheel.gif
___________________________________________________________________
Name: svn:executable
   + 
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/bttrfly.gif
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/bttrfly.gif
___________________________________________________________________
Name: svn:executable
   + 
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/head.r24.Z
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/head.r24.Z
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/head.r8.Z
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/testfiles/head.r8.Z	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/testfiles/head.r8.Z	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,134 @@
+
+H° Áƒ*\È°¡Ã‡#JœH±¢Å‹3jÜȱ£Ç CŠI²¤É“(Sª\ɲ¥Ë—0cÊœI³¦Í›8sêÜɳ§ÏŸ@ƒ
+J´¨Ñ£H“*]Ê´©Ó§P£JJµªÒX³æ˜±UÀ«`j‹u+®Y³†]»³¬Ö[Õpõ²µ.¸i¿²Ý3/ÞtÉÜ<C0Ö³wëªåËø¤ßˆ!K\¸°`¸wé’ÕÛ¸³G·usPÎJøò`ȆͪފճkŒnÑžE‹V²àÓ·gV=[1ç×ÀÆF}÷°êÀ˜¹â
+¹0\ºfk·N!hͲ•‹>üvóå©)÷^\½<Ùºš¹Îí<qÕ²¿ÃíZž:W¼†‹K6®<ûõ﵇žh•ýVccA§bšÖ`sžæbÎզ؁&§œs^D¶ {¨… nìU†s&r…![´•F~–]F?8˜ÛŒ’Ù tšmWÖŠU¹usŠÉ#Žjü'b{J¶W…ɝ¤TñEÆàw%9˜–¨Õ˜›–jˆ¨£ò1§ }S2Uå„K’&f‚…çIæ §›sâišmbö˜”i^Åœ•Ñí‰åmZÖ˜ä¢7Ž¸žž$ò9dbͨP¾ÈdžÄ)šå—#‚‰§¨^ÚÙèe~WYbÓ]
+Ô“òEê&Ž£Î©£¸ÖªëŒqê"›»uxŸ«?mèá`©²W'¤ÌBš«–ˆêY'´
+®·jŽËS||vG"ˆx¢Æ¨©¶Æyë®Ô. Ÿ™š8›¶7U)ž¤ÑBV#dÔ’‹o­Œæi®­ûRëè„ln/MsIÚ¦¡Ì.Ûoº
+ã
+-Ä_’+ëd¿Âup_¸qXÚ˜³2ìo˜·>ûð¨¢Nlª¸¢æŠùYº1J÷ÑÕf¼âË2¿s§F%)ót®XúŠr
+7óJÆîG¡¡¼nº/ʈ.J4˜D‡<*¹gJ/ŠKÓ<¨Ñ.úlª§W;»h%n>ò³Ð<Ç
+5¸×BGXØ%-ë„6>ڤз²ý¬›oŸ+±®ŸBª0Ð¥‡&Þ5°bŠj*ÉpcívÛ%o®†Û‚K·œQˆ1wÍA¹{Fí–þŠ¾6¿C[MFè'O,X©Ln·ø~ªsô!Á߆¸l憃)x’@
+úÏг}{Ö¢&~™ºs#»wðñ
+lÙ6rùz³¶—Ïoó%[íyá#7ëè’"¾Ì½Ezûži>;úÎGÏ(Û@»áª&:ÓL«MF[]æ7‘
+åG{Œ;Õõt5¸èqî\ü3™›€–2ó
+NâÛؤÄÀ‡àÌ~~£Õ¢¸v>æApÐ\	—Áéá)€ç* æì´®’IB%Îï—š÷°ŒeÏZÞç~@ ö‰oÃaónHEÃ鉅dq,“ƒ *„ryÔ˜Ò…¯«½Ð…4D×CÞ°d0ô¥³¶®8¦)Œ¢dÉJYŽ*gçÂ5fp‰Ul£È<ÂÉñdáŠ$ô¸=…zÜ88½å±± „CéIPÂp‘rDœÅºö>1‘!Y–Èw4™³ð	R¡Cý7=ÿÕP†‚{žíFײ;JP7h‰%›X­Ü”
+kÌ%!—L‰=}LÔeqµ¼9^NjÕq,	2WÚÑ^¼•Û„ÉÉE®ñvŠ„"6ŸÌ&Ê3‘øóN¿"t?…í‘r?™>¥gµèM1p6lž(ýçË%BÏm
+shÅêIæxš´VƒèºŽ6ªT8t!DÙI~˜ç<KfOÁ °‘ºsÙúišŽPŒ½[ÖÜJ2²p£Ü QÉR•ÆðØdhAÏØñåtSc 8º3‡åi'Ífó6QƒbUž«O׉Á‡Bq`â'NÅ4?>õŠ¡âf4ÕC¬rµ\u¡A÷º×•fs›häŸ
++
+»^õÍŽëáÞ[;¥Ó×ɵ
+j'±ºR£þì« Œ§A3ÏM|u’%ÚÊ~ØC—‘!xj“—²7@%2T›=m¨Vå	ÙÌŠò®µ¦gAéÙ„²/Ÿyò’S‹)³ƒÑ
+ª¼ÒßšÙÍŽ”\n%jÙ“öt”˜
+Ü]C:À©Ñ\[¢×` ·°#Šoµ¹â­1˜˜]£Úõ“”õ*^çëWôµ7}»mb|Ù×/ÅÅÔo¦Ã›éD–Ü|^hyµn6·K_Ü^W
+¸¥¬(9;ÊÍð¶Û”âÉv6Ú;¡SŒa‹QÏÇ3‹mb½xEé_3á_×®¾T(o£ÛÕ­2ø¾±Må>y¨¨Îlqb%Ö<ËÕåÎvºPü*{
+éK×óÀóuò<=ËoÅkí¸Às/;.
+Àê2ælÚ º)»DæŸ;çEf0#Í”}ïn!lÝ
+3ÈvÍïnï
+Oªý—|ŒÛ˜+É…^P!ôaQÖ*ÐŒÁŒèíÁUVC•aìâ(_w”†VAÙKù²û…c´@k›;a/ÐðòÛp
+Ø>‚¶É%ã´£9}×÷Æ–·—…0÷,g6»ø²oÖµ"ÓL†øþò6¯&1§U\ ™sFÂà “Ôhéaõv˜=q­i=ì<¿–¾™­µ•Å}ß<ƒÒÍx5­k=C«0ٯ餭ïKܬ63P\lÐJ7Ñx}3šu‰à^ëÎŽïg%e¼zögn†8§þâÍI´ØzâÝ´À{b=ûFIâÝmB!˜~0ú̯7‘ÕMeZsÚ¡x0Åç<g‡¿w×â%£7áæ7Wbâ•p3V÷gÍN{˜ã3Ô©]%â{×±Ófú!
+JÌá/÷ìÄíêr"3£½Ž²¶9»g¾²tßnî:•Á~â*ÓW
+ƈmœØ¶Þ­M𸧹”9Ù£qii	w7zºc^tö>Zë>/{”¹-l[§y†iºÏé
+FÇÆæ³–6‘¶ÍH`wòÛ¥Tm/HFKykžÐÇnî\Sœ·áV¹Í‹niaÏøí—x¯+/p%?XÓ6à{°×Å4̧—ÝŸKøˆÛ<î³qæ&Ê	÷ÚܶNq§½4°3ZÒ<ïGÀï!Jãu®7³œú+íFÿ°ç¡ «÷Ü£ëX…ƒ¶/îÄ7œÆ3w{Òu[ÓgŒ¶h<·^=lÌp¿v~É£~^ù)SFë±Zβ)I´dÚ¶T6v™‡xcwibGiŽ{*—€Õvb•Çh>—$WpD8_•| ·3‰ålÀ%FiUAWp™·s½·o0Wp[gxöo—æzÔåSêõfëÅp¡€ZwgqO@%×–V·!răþ±BÕcds’A[÷rÇi=7t&ƒ'hi—p(Ö`®çhVØuë–ur¦d½d¡¥ƒ¸â]¨$ †Q|';Bå{—Ekmèp÷0t÷@u÷ 
+éÖvrx}ÑW}–†}m§uèrR8gš–cîF®†²w!³Bå":7¨H½—u?‡bù{K¨„87]²×`xb3&Šq¶u?cÔ[uÇg¡£ˆv-’±ŠrãczîVfÔw‚\Çk»¥èg…ׇ3Hs3y(t¶sbg_—&TôgLЖ‚|œÒŽýuŽˆ—Š+Çkçhãø|;÷Yéø<·€vu˜„lY…3;]òŠx¢ƒq/âS†º³6!•y³×vRHtø'¦H±weVH3¦0øˆ<‡0—xmxI;:ôtÑ8‘åQ:¹~Ä´(\…TwÅrAŽ·¨g÷`yö^p v¹jZ—{êEŠê¶o æf4aÅÖS±ã…úWWMIá…?åÃKl@Ó€‰‡u¸Ö}“v€¹xxÙTyx{‹g—à[.} ¦DEQ‘ S´25	h,õ6½µn‘ÈkëæuÙpa‡}Ñwsžˆg,g…éæv¾7lŒtfˆdQ[†V8Y¸Qh7Z¸`)t—HtÜg¸”6׉qçzïu„:WŽÇm¡Ð‚W$Uƒ\‚‘A b»2GüÒ^\Ň;'—Úf„´¹”)g†çzØèk³7qæ×\ ÷IäFÁgzŸR|ÔñÌòMÊ'*¯¦–{sl(tõɏùt
+É”oÙ^…Ÿ¼˜j']ºiJ¼THè/Çz§…š òaSí”$ê6sè†x;'~X7iù5‚®v™“)€üÈxl8›¿¸U/4Enô/˜5íQ¥VXŠ(˜¥rà×K	s-i‰û(‚â9nàök¹¶—’Ék«·u¼Hg•WUƒG–¦Ã%¨¹0í	Iƒ„¢)6‚’‡ŽÙ¶™¡äpý q&OüXi8’ú4.¹‚Ææ`s5í8GÎxëY/Zã)”;Ïå?÷‰—8xŒgsý ~Ii#h›…‚û˜›æè‹N¦…VÇ•1%˜Ö#:§ùA*Ñ¢~†ÆHV¦ŸiÇ{lGdÞ盲g›Edžs	’x9•Rçpvkõ‡A uKsoˆ¨ž®á3_èw,š6ž6Œ³¸	ý ›'6¨ x„䖏r†v/—uöI—k	ƒm„ªÍ••ÊM®È~¦á%Á1b3˜]‰~µ&™
+ˆ¬•0¨çö‹ X›†‹˜eii7—'I›y{OØI+4=x9á–¯Á«Îr¬YP.¶}k—yýPl–g­Û‘hc7‹Y'—/w[ŸX®µ˜.E=Ö$;pµq³Â¯ô×dFz””EÒÀv'›})gPÖ\/DUxd§„m8¦êu›VGY†2Ãt‘4#"0šJ€È¯hƒ‡Ø’>qd0‰&7t!XÊˆêu+w¹]v—÷9›Ò¥„(8…	:£þ¥5y‡©Ì9AaÊŒ£:°'›_7~§BGt*9Š¾(
+_g‰ü7_FnKx¡Q¹†Ùµ/vmÌxV¯8§t°%Û«¢ÕŠb_ZÊpTÖs—Ȇ.És›VK˜–C×€‡×™x8qœ¶¦¿YŽ£¸ºÒ°nœÅTrãŠùtD"Ëc·!uÎi+ŸÄ¡ûÆ{‘˜„íZª‘ù‰ÒybD˜‹Žˆ’†·¹z• Htn6¼ÛXœ¡GôÀ±½‰q¦V.vâ“jÈJ¬RÈ{¯;ŸÉª ¸‡]«uv™‹»¡£³Õépz›h.%§Ó–t×c*Gk©qR«¾ú?ÚÕ™_véZµ9½Xœ»5¯šÈ¼‡×¾ï«‡Ù•ˆƒ:¨û»¿+›C2:½2o/º«t4˜Î˜;?‡vVùÁn6ªú™¦Ï§müf yºÊzß©¼ò;ÁJ‰lùÁÅÊ–áƒ	˜<†6>ŸgX ÛIz4âÂjpÄXU¬·ÂŠÃÞ§®0éÅÓ{¿…{¼‘©‡7›¸À[¬2œ_—·_Ç3…64P%’+.*°ŒZèJmUöu¨Ã‘x®Ç*~K“¸z[±$wzØ‘›y¸kl¾
+Hµ‡lÄ3¼°=ž
+35Þ5f|¶gk«ˆJaZ«œûÁ„Wllù’Á¿j8ªJŒ}%zÃY±ü¬›ÌÁƒëfÒÐÁáÂF<¨Piž
+3² Û ž1|Ñ¢ƒ´AO¨É3¬ŸnBµ-[¬–ŠÇÁëVµI‚!éÈQ™çŠ¬ynÌLs©·gffv·“§!¥®QXîé¿jVlÅüuF»RWÌ2ü¾ŒvRˆ¬Ï
+‚^×ΩÐÒ9Ã'æ·?3¨÷
+™v¯Wº»µ°,ŠDaÖ7…¨Â
+ºcÔš¸Å_›pÁÅ•x¾µœÄßü¾¼‡¼–'…jrzɷź	Të}¢úÁ÷ªòÜyE&7ˆ®ÞqÏ¡ÒÄH÷œuˆ¾‚\mfVĬ†Ž¸z
+ÍÍîŠz8¨%Ú€ÖÀ‚»3íÆÆ<”kCîtEÒˆ«ÞҝáÑ sfãÊDhwÁ ,ysv¾üu «ÄDè”@ŠÍió»v
+ýY ;¨Ù|ÄâG¬nLµèwñi+e8®>Å|¡V·J°Ð“¡¬„Œ½É(ÇÑÛs›	¿šIÐ\¢
+
+ƒ™“ØÓ÷ amÚašnÜš˜e)®ÌÌ´OVõ]S³–~+È\\•E|”\ÈhÚ,½›iÓ„­Úw=Éĺwiªz‘¸Ó06uºÁŽ}Ä1ˆƒ™ê•¥v©›½ÌNú%\KÑŽÍ	ÐqLÌ2ÈÓm(/XË“üÐÕ
+Ä.Ýv¶8› ¼gnÂiÓÓs½À
+ˆÅYb‡Â~ºÊc)®bVŒÜàÕùuŽiÄ€hRÝ6ÆX­cüך	ÎYÌlקÄ:¼²Öo„Sej¨¼
+ÞÁÉI‡xÂZs|¿½ÞÕŠWÉiF\ƦíÜš¬FÕ*ŒÑ:›]ç’²¬ÃÆÅK‰•P…‚à\ÁŽX¢&§®5;¾PÜX&žÁj2x.u$TŸ;ä]vÐãË[VÑäY}¼„ÕÔÉ‚6Ôæw.q–Û\{yû&Ãýܲþ¼ŒN·$ÒÌLÒ_â²6m¨ÉøÇ/GgèãƯÕ3¼…Úô)ØÔ­qÉsQv;Ÿ^8—gÛJkýf&gèÅŒWâWmmÍjÙ£%e^@«$´’ÇÁÎìŒÚ'&-U«
+w—º€‡t»¹=zy¨¿@wPø²‘e.ÌÓÏ †e¾*mª9á{±$–*¼µÓ\\ãŠ}ƒT	ÓN™À¶u°Igõi±kЪ«™Ál+ép«y 04X¨ÌÅU;iìçè!ëR¬ÇÍ‚6•ÀÎÃKÑÇ}¾tç‡ÇY+¨Ñ¡é•¢È–Q=i¾8¨oÄIyöâ‡6X5çYìÕÉi[6Ü3^ð-ì»W¼Àïlr¹ÙI®6‰þü¸xÒ¡»ˆ‹WéGŒ¢t~zÝÔ¡mx'_÷—2LŸD1ò'NRH¡WÌ×Õ+
+ÄŽjšÍ£#ÍŠAm€}Åœ”Ñ£ÅêžlßïÞqPÆfêÆæålú’Exüòbþ•QÄ‚rù€QŸ|s7u)gfpâi:½JÜÀí?Zœ¦$.ÒÀÄ9«68_­¤ÉìŠS#U¿ã‰³6!˜v|…¢7b'Ó[‡ãYŒ8tÈúˆuۏ¨ì&ª/˜¥vœ„µ(‡1wæÕRÌ¥3&q­S•ä:Ç{‹YH¦'o™eÄêõg*ä_<ˈ]«ãþ,Þcr7Ò¹:¬ÚÆ&ƒ}Ž`l='Šb6=ÎŽ…EPI½˜%;pZ¾¿pTœeg]HОvnvØ›ÆãÅ’CøBÄ ê0è‡Ñ§üTñhO^Ifµdœð=ÆMŽe#)›'$±%Þ`1@™ºk.JŒíì´yҤŽ	¬;0+@lw‚<™=Ê¥¤:=ÜÎjR[,£ê}®ÑN¨Ì¾²:nB ,®,ÖsÜJ-™Ìc¡ôœ†Wµ\N¢5(GݘŠE“ÛàÀá˜"4$ í&È6TDÝ;!:¹§€ˆã'£”¶jFó¸v•]`¦¢Rsâäù59ö˜†ÒY{U5ë,¼“•åˆ]­"S°ÎËÁ¸=e¨¼‰$ùUhíHó6„
+$bb¤êŝLÕ\ÔÉ3J°ig
+:
+Uf¸Ò] 2§pä ƒ. •1b\Èr>Ú¾E’ ƒO
+¡À! áSZ“¥å¤ó³»<Ñè2Ìo‘¨qçåêξh4é"#	€M0à
+ëzYBŽõ"kÝ`b+!Þ@Ð2…	BÀˆÈœ’¡£'ØF£	Z‰v¨;.TÛŒ«ZmyÔh‰jó¿êË‘JÝH—L;~Tª3j¡ÇÛ…oîÛ‰k)ÒØœ:à
+ÊœGžÕ
+¶ñÁ2߁«Æ¿"Ó[lÈ)Û5‹$yD=<üú
+J6ô¨V¹Žl¸/À‘IͳˆH¨¸PQ+8}JàÜŽ¥§jÎE±êyâí¹åÄÖó
+Ô„'\§!EªÂuLÃS…[†8ÈÏ6­žßÁ&Ç‹mL¢ffØ—]ÙJ„„é«Ðu¾Œ”W+2EÖ!›­±ônžù}Ÿñí.Þ“GëCN¥°˜¬¿°pw’aÐy!oæ.¨—¥u£RŽë‰&BÔ–’ó¶zª£lÇn׉ŸµMNE¾¬¹›-Ñ<æߣ“4¦Kò¢¢61ÀÄÂBa¶Ž1Ds+¾9Ü-K¯2‘G'bУ`ñ¤&&«T¡~ÞAÜ$©¶DóU¬bÎgã*B°µh	$xç!}T¬¨Mxs²á§h…ã4žŸ b|D)$á‡ÚÌ¥4Z30Žx‰Ïh*ÐÈ°óPwk²U>Ÿ’CðŸóy3Rõè8‘×[B4Χi
+.¢à‹1ƒ;ÇîÃá‘ñµŒÜâ¾9$ÀF85SÛÏÙ ­ HHÜ[ɹì"³
+?¬ãÄ;§ãtDÏ3!dqL;ñî+*Í´sõ²}[%Ò–0Q	Le¢,5N]y–{àÊ*ËQÑ°F½7IÕò0JTN,Ë°™,g+˜#²Ùdíl:ñBÖ6x—™k3÷GáüA¨ÕTŸƒAf-à,,f·ºtÄAô$•±W%é[¡M¼\a
+ÍŽå2 ðÛ4L£¦4ƒî/åAg®Û|™†¡ „
+¯'¨%Ï9b”¯	5O%jtG„x…Ž:‚™<3R bš:½§‘@Yã6$/ì<;NJʪËò¿t´è=‰˜¯E&½´M
+üpBmƒ3˜‚A$¢q‚¶J&¦>Feþ4ô—è±G,fмÚJÚ
+ž‡€Ü†­¢a¢I¿B‚’F)ñ8'œ›+Uqîø›ŸhœÍ2oÇ#jĪ€Io¹oqb¤pžª¡kTA;dFÎÈñžË 4@l„f'NÕÉóUÕVZ
+5xŸÓóLÅâ…t
+,ñ8Ñ×Âç‘?²ßì›ØŸHÔÑk˜èŠ‰CTGŽj[žH‘…y0Ⱦ¹ìÄ9ìX’
+ŽÀ
+y3kãôSƒk:.¬iwÅÀ±Z‡Aãm¥9—ÇþÜÊš\ÈxmÈ u6˜1X†e¦M|¤kH˜ÏˆSØ…“$Š–*NÑA¹Œ‚¡URÈ*.ã«š8 byÔ6¬ô ­GÑ|+¡Ò¨Q¨8&æD±Z‡ÅfQ¬$f_ˆLH•N¤9¦&[BùU´0 $¾ô™‡±(
+ç?¶2+½šªu'‘N"ßN‡t†e–þ&²Y/ô.b~ªkS¬¬²Y‡J³é\å‚ãE© -Êá_Ü Ãß-B•
+ã(­sà\äüÙc/
+4@üÌã4äb“U‚Úæ}®˜ùš~ns§©*–Å›da1íß̉ûÀ1WØr<óί¥«¯2BÇÏt‹zÂ*
+¸6Éd£˜²öÍQÑË B›h`OT/¬&¿­C`e™›y8çß(˜Î¢CÆbÄÀ®<—ƲB‹…Å»ØÆ«Ù7o…)ÏÁ;¦c¯èˆÒ‚¹ÍPBÏLJbý•PDÓèŽ	Œ#Xcþ]±Ê³6{Λ39ž/Å0ÊQ‘ŒX‰\5)A…©ÿAO™X\ŸRˆt	ã ¹BÝlŒ_‚Ôœž¦V‘x§½¡HëpL°S2°R÷a}§ì’¬­¤F[è²øv(±ßéI#Ã~Æ{¨:»å(©Ì•Ù=³¤;&=cyQj¤Ki4Ç6p’­óBš‡dG&¿b'šGä8óR*XEjÁkU^SwÞ%»ÐѬ³cj 9ñ.¤Èÿ \X‰2e`q_
+;®å2	›àIk~cw’ŒžY·ØLJy:lA®Á'u!#&{¸[ˈ[ê;ðuCh4¼«RAò5¸• TÇ€1®¹“nÓÛ 9{òx0(wT^³0ZHÔ,]³–ø=Ùã	û>¶HlºEoèG+¡®{’–O(#Î×ܹÚ?r
+Ž–5ÊH>™tN-¼Lo‰XI©g§ºÕÜ€‘¯™>‡Ð•q`¦Êa‰$ eÒ kÔi€–E›vô²õûT¹•ÎPžô@ãQ‹¬ˆ²h`³ÂQ6óçOo‘ÔI ÃKà–Ž6`xLG,¤ñêߌpÈ)¥MU¥ðO ÊÉGLó"µA{¼ðD­ËÈG7ÄœyCQ¤š¯îÂ,VË7iB˜4’pÇlYáXJš¹PÝgÄÜ…¬£;ã=%1!"“FIÙ¦Ž4ð,ö&pîÏËÈrÞãw›y„ôäO,*|jhºªx{â‹ÊRcJ4…Gs(˜%æ`Á1•Š¬£aR4¨Ð>’ÑJ>éM2Œ˜y.°“ÌSÒø9f1€{š$faZÔ	¹%8ܱ'ԐŒ[±!L`§ÝeúY>#8´Zsf®nOƒÊ«˜¢¿é-jï2b¹PíX
+{ú;úOƒ	ÊÚqĐoÇéh	‚š’ÀE#9Š B½Mµ!IŒ^Ù9E3ØBœ¹(Ü%VñŒéä"Õ’ÓK¹üŒÙ@D&…ö°†‹Ä÷óŠQœ]RtãE¹(–¡~ö]â,lÜyUøB9ôÈ>–é±*¤W"ï‰×ÐG	dÍ¥+W½ë¹a¿bIe»%N€Ré8V– Õuh=›*H![…&°î=.ÏâÄ«€HEÓÁNEñU/øc{x“y𺩛~£]È*Ý4••îA@Pö"iM¢¿Å§,F;êQ ià`™‹­–Ð1§¶¸P–™!ß"{˜L£Ö+ÛÉ<–ÍM¼-†#pÔ ÛŒEMªVâ{Ö\áep¡!Fìg™Ã‘±¸®\ìZZB‹ÊR3+î%‰¤Æ£ž¶[¹BÚ±¦"&·
+­x¦]F^œê{ ’^Î(D÷\ŠëÅÓ×`•SZÑpßµÙ7q©-Î$a-?í:.êOÐÖœh8Ñ\Õ0Œï¦þ@T”=€lû^B³T»†„
+æ`C0ËÅ…3Ck’„“e§…Èo+¶ù
+
+í;5"]͘„BËÅ÷ᆿ¶ý•å#;Ê‹f›¯k•Ô¬äÁ%(rØæá(NP„\èÄ4’…È.„
+Û@¬4
+º:7°ÃEZ¥Udü߁|ÜŠ`E.«PUîAlµ\UÍ+´“˜cä-nóÔà”.óLA&kÂ8“ÄEÐΞ’&‘ܹo‰‰ñɁåù_¬I㺘r+gÖ9¬÷D’Ú2	UXÞŸ!²dÉ€å\la8†¤
+¥xþSá£h\ÙQ{iAÐÚ0A
+üØÈ–…#ñV†~8ä–éašŸPÌNŒ°* ¼æqUe†Y¢és~N.Ül~)êÓÞ’¯TÁÂŽDZéDš|¦B„癹ˆlç.›ä´J«6I}j¥±l‘Àé&6ácó•+1®C#OõJN-Rí&(Ä”½$ˆð© µµóúF‘ghd–P©»Ë«ªWLa›•gRÏµ„‹^m
+=(áÙ§
+ETS
+d¹’úÞ0‡w¦Žà.gE%þ]N+ÌaÕ©Vx‚ ¶¢ÏAòŠ‹²#ÞŠäÖi´~æã©G÷R6=˜à6x+ِ6f„ÀŸ+GjfI 	'§ó{Ö^:´ôÚ~#8ÞJ¥,ŽS7I>…(Úö9¥x€W+µz÷2Äœ¹áÌþU¤Øë‹zv4C¬!s‚ ‚Êß¡ÊÀRu–DT=&‰#!PÈó<>ŠŠàҁÂ>ÛH%KÕ£â‘Y=¦kSÖ>DTŸÔÙrF–W¤¿ö÷töƒŸ³‰éãôŽòAR(aŽÎOÑ_ÚòœÎá”ÁT´v>JU#)§‹bž×ü+lñy;3H%p"F­IrY°2N%
+[µ%áf¬BNA®÷”d•4+5Dñ0;m*Ý7™1‰Ô"mÆãZ´eúB$EܵOjčÖEñ$'E‰í˜ePêµ&õ6,,ÄžÀ@ŒswÈܘi.®Ë\BäQAa	
+)…Ñ1ɶêâøݾHëØ©\H eãî•š´dÇŠr¨®ø+yCÄë&˜ÁgƒŽ˜VL; JÜ‚:k	V>ñû“á¨@x‚¸÷·jÔSýnÖÁÞbãˆÅ§æyCðXjÄ©(Úì#ä„€ƒ	kc¹\µF¦ WwBy©¤*9Ä83cÕÄüWïk‘DÈ~¯å’?—Ú¢ÆÄöγŠbŽYk|XP[91V“‘îIÆÀyŠÂzŽn	´j‹´g—ø’OÙPTÅÜcº&癚…½©Ø„p&LÈßôTPÝɐ§¸$ìÑGOhBs€X@îTZ6­TPúWHT3—OñòæU?ž@W×5$R*C1é,ØWtÞrB	QN(')5õ¬H¹7=,Ž[åZ*ˆÜʐ–\b Å¬ÉR±Œ™<Ü!÷GYag³ßÉH»ª~¤ÎÒĪf-V8[ÒoÀ'ÜUºÆSuBQú0Ã'ÂüÀ3¤¯FÊè»h–xú_ºC¢ …˜Û€²]+2¹RÅßÕ	™HSÞ…FÑ4=ͤòhe§w-—ÎÍà}G£Ô¥®é%uÆYê„Uýl½L.HBg\éù‡Œœ+îòa¢’e°,XÈk|ȼWÇp:f/ÿgüñå(X€QƒEpƼ4J€¸xSἉ8A&A _\_e!“úK<	ݱٗ§r=*¹å)%š¿²>j˦ƒrª¬îð®ÐC ie
+%`õ6N¼*ý²ö×IaÐcjòøŸóšKéȐ͈L*åËçõžrÁ5^§aa@*9—•mQëP’sòjš¬‰(ت›ɯb•&ÏP…)+ŒMçt,´£X¡Èµw؝Š¦n¯ÙR´›GEߎD¦Å2°}]‹-I“ óIøÒÕª[gNg)Â8ga%±ÅÑ¡9ÝU–“kà	ÆÒk–¬Ð¢Í2ËOqY.ˆž76Ô²\W7,•h¹7­Ž·–8HîüÑEöãÆ…Kdz}.£dÚ#çëÜ%jN5éNI¨Z'æß)4ÒÈML-‰˜M«ÝÍ“&½ªÔF©±cœÊÎÛ¾†â`ÒR 
+8«À½ÉéǍ3ÿâp¶­#}ƒ#ž³Koiß^—‡|”æ‹f}Kk6“䐷lHEE´íÕê…äàK×Ûå\`BNՍb- ÎðÉëƶúJ䐼Cèy£`¤4Û¸!”{œ($6’ó.×”FÛE-—ù@‹ÀàÜÅS¤xÏMû¢yrŒrcSƒUœ!z3¹gØVŽUtعhÎêÞ	$$d¸è“þâP¸f—œÓÓ€c-U˜³ÙXp<µ{›”œÏNU9-U"4¬l“V‘á\Kàà?ŒM!¨€añH!œ¨¿¼˜¬™q¾2—Üc÷1&Õnæ<Óæ^>°`g)2tØ‹èT-ÙÏ‚7v*ZÖ?#Mt¢Å}¢w¼‡Û¸%yL±ŠßÍ)ù“U'°F²Œ‰[.´ŸñW›Ì!u|SÛ|.µ³Jë„Y5«ùñä€{ÐÇóC‚a¢ë$!¡ŸUØùšÛ7GÛñ6‘kfŸÂ°ÝI¥§T'"9¦ÝÿqÒ¥ë(e¨ ³l‡Å´vÀÆãQcþEıXŽè¢•»ŠàBÕÂQýèI·›,}0k·S Ž<ÉË“u6‰JokICç««µC½ð5Gk]cbHâ(ƒ0§¹UZ÷J
+PŸc—.篓ð5ìúsÒÒ#H9SŒ3j%k+ˆÜ[Ðe"TÇ|ÝŠIt³Í]ø¡sÉHâk®A«kž¸Ž£]Æ0e’Imô»UH¬<g•ÒM6ëK>+^ýê;3"i®Ø'c4˜ØMÖ›th˜A6—M‚xš6«¼rtb훩:O*cXžYÝa +Ô³˜ëš`lì^a¢»2,_Œ•ÉŒ÷ÛV!.QKЭaCÉ׸!~ÎސérA6ç†DÓ›Ì;7oÉ1´È~/i4SÂl4ŽX%j7ö² º;©ÆuL€Ë-éƒ4Š‚ƒ ÖÒZ0[92N|”d0QuJ¢VzG#cMâܐP£UúšWg1õ2!髁ÊÃgHPŸ=P,5²:Ù$.U™ÇÆZ'æ’ÀN¼1± 14Oã‹U6 ”„©»ãÑôèá¢qƒó"ššçA#
+=„Ž V®âÜE®IíÔŒ…n'k&ïŠUc+‹Ã«EÇ@ð-:yŒRNñ·:®ux®0·õ]çÑ´´ž†vºO!secÚ¤¶X›&˜!£ ãÚ0O`AÍfyÚ1k³
+²Y·{¸[¡4P“K‹¥åy
+â¾eÏ‚-ÁÛ&·½µQSÅÈA??¿ÇFîú˧¨"±1*ü ÚÓ»nñt«ÁK0ï[󠚇³PM.á<Oi/¹…”Þ¢¯{˜¬fæ½[¬ŒB¡Ç×¼¢-"œ
+´~b¶qqd_Õœ`•¾}0’YÅC^ðÜm¯SŽ¶¢™ƒ¶È“â2ŠN4âNR/{áA©
+¹ñFc¶Î¡ÔŠ)P­ZÇm§èQ ñgÕ“OËsžß¦Wu"¨ÃÉô£Z“¼äVšÄŽA ÃPÑ+Ö_­oæË5N«ë™Îˆ§“€ôŠ‹úieí˜}‰uY,Rb¦óP7´ªi's6J=fÚE*ß¾(ˆáºš
+­ØÙân
+ðCíY4åPáV6\OÔªt:!ÅÝÁ¯
+€f=b6ÿ8ê>AphÑšElñ„3É¡Œ€ËRó*³ÜV$U•ˆF´TÑ.…BV¹v»d́~zöå¹ð˜7éqYÿüÏþÝ&‹ï °¤á$¶§8ìÜ„õ´8Y ÑmK•Ù}¹Mó‘·½¥ÏÜcv”%Ü?G„ÌìŽò’PÛñUZ†7k.•¸?Þ!Œ’w…'Ì€+0¦ÒÑ"c£0q¢ÞîcóyÛ!çÌó´Ü£n’HÑ.€” x0c²¦•fuåIJr>1˜\w™u'|q4EbPµ¨ªí’s‚äÍêb†*å¨pÕ¯ÁežÊJ§Ðë§iN®hÓA˜Þc"f˜×С¶è¥HÜ&á@äÍÕöŽû¢ƒ ™¼‚a"MkyÔW–G…3Oå&2Ç&+)j
+Õá~Ï> & j-²…ª$µzËKA‹µ‘Ñ€SJq˜9™[P¯|m<ñæÙ§†šü9šÌ…DœB«'³ÔÚíV¸ï…î½tšÏ*Hm¹´!(à0v¬ý‚H¢V”o#j0Ü€-@àÒ:
+@‡ú,§ì÷fDUG>Õ—S©ãtæo!½Ô6î‘šoꆽù{ÄÖ-z$*(§G&VÛŽ!uX[
+ѯç³3
+©³¡gê
+gh5:bÝÔ[ÂtõrVF­Âe•±ò%Ø‘Ú=r®Ýœ#h‘²Ë~£óº<pw©ÑôœŽE°Ìüxþ!Õ7¸I‚ãÇœÞâtà–ËsÁÎ9ud³Âƒ˜\@IóÉÓÈÃ$T‡lÐ-9@®ÓYÃ$xº¦Bï y!"w4²Kæƒl(ξÝe„tth^çêÞ7ðTã…©#¦,Y}¦ŒY)‡Ùè
+ñ˜?ÖGEf`<?ÖúÂ\Ú+a!Œvp†!8uE.%ºŠ²Kë€KªBh9k§ÍÊ#¾¸¾ÞÓ¾ysl:,à`8k“u™ahØÑüDÛl §Ü–LÚ¥ŽÐö‰¾X”‰´4t]1·	i:ùh‰º¸1–ÑwU´RÅ´R«j¼”ÇÅ°ÍÍCsoë:F	JÞpî4‰r¶Œœœ¥—â>ÿ›ùó脝s/ØåRª	@LÀIÅí:Öc"¶GìÀ½1Iw=OŽíÚ–ªÔIYIšn—‡ªÒªqâþ•&r€”˜ÓûéI‰«G-H$ñR­úp
+À؁srXy¨d£óØZn¼Dp1V‡ìZ
+ÒR7]G¼Š[§uøÍSÌ€FÊÕÇÕb±»ÓäMU-Œy²ðD"Š‘6cèT~dã‚M$ÆÑbÒlyX±aõ;K” ِf§„epmø\–ÖѲ¬$h‡6£KLF«¨gNˆ
+UÙ´¹çßc3ûà€ƒÊ‡÷±,Üdu{ÚYù–%´T°Ž%s~ñGŸ[Oço88rFK³Æ:äË¢]ÍG=ÉÈrD½€f\W>ü;Íxs¦RÊVÆÔ/ˆ_3t~-Bé"N|x'Ǥ»ÅiFÌV´§¹{_”ÔLðS·NæX‘óDK]N?ÓÓ=VÊÎP7Q ‹&È~EMü„Ù¨ÁÈ4$)/æ¥6#VKëÝ@‚ÃèàdÊׇ£®DCg´ÆÓ:2Ptq„¹Ìþ“üp= ‘õƒ4=Ë›"TÙ”^þƵXÝUÈóÀœ^ØY¤O©á[*Tæ,M
+TÁsä{¢€1Œ†Š#}E¤]S~‰
+ÁLE%%ÙQXL£ãœ}B‡Á„
+âiP ³s	qyfDÙjŽ_¨WÆ5+¿‘® J:G/gº˜I=ÏmVy…„ìCteªM
+u+ ƒ•ð¤¼G
+%W©Ù6gGtÉPPŠðqÏð8žS
+eþœCÓ́Ö-ÃÁ&Ôñ_a˜J·aaLÙˆÛ1Ô@*‡»u;ôYh08-3óE9Å<H[à߃">Ø	ÊÛru0CÊZòÙ|XÄTÓh¤gæÓÊ–FÉQSÇCÆFQûôÎÑpç‚P#Ÿ™lç,ð|.èQ‘“1JÈ	¨Ç´(ä{fF•Q^Í_U÷,6E×ÀÄU
+ê âÿM~ª½ðm%CĆi™A^øÊlp L+“C\|:Ü­Rjð•„uDôíkò”ûHJ.ÈÅG¼)E¶Ðs7°Ñ?S ÛqAU:
+H%   ðÆ*µ
+ö<þ›µ4,Ý<ÒƒÔ’P³™÷ÖPa5˜¨@]!YÚcÉøBt±€ ©Ð4ØZ3 ±áf4J¢€FVÙSqÚS7ý(\éÇó?4cDW²ô­0'¼áÿ
+ZKËê¥Ä4BÞÈEhý]Ö=‡y­.ÒЉÁü±G„À0š¦ãpl-–çÄß1WÝ®²OÒòpÁ•^CÉò@¨q‰dQTGeõÏŒ1ÆÌ6xÆtN†D÷6‚MÁŸ_SÛ<%„dCD]E}€%˜UƒCt‘¶Y?6‘ƒþ…K;;òmmNúŽ¥cmìÇL!Ñ(¹KEzRwÈKñÇ–HˆÂê´é8Oʁ`sÍPÛR8ÕgTDWø"q-hPµ¡	BHÈЗx&(ÑIŤ™C™QcB­Ä<(3Õð7ü[¹ËÕ¸,h@ÑiV½aòÖVB’:R„Š“ü)6SȦÇGn{á?¸A”éÃMÌ$-ìãÀ%?f,'’ANÅEgL}¦šúå+%—24üU1N³6‘p†¢¤Qýx³A´>—Á½´0YRÚ
+ZÙ]†›õisB<RϨ-@.áYkIi6µX"¥Ö±e-­…@µÔ.Íl2ÙnPÐi”R±QÖÈ'ô¤™yá°u˜e®Tøâ)<#b"™¨|ñI¥Ñ»@¨+„Šésݤiˆ˲À$_^
+˜âr`8؉Õü©i/”¤bì9gZq¹
+ZÊG‹r*¬fNÚâÞT‹ˇ¬^‰ÑRiÓPc%ÕDŽ’b“–ÐLÛWAºµ\ԝ1µ|Uµ9涽-| 7W­¥]õ"ä2fØTžš©6mJ
+GºôYÔF»K֔Ŭ;sF?´²I¨Œe8õÅŒ?W7¦	zj½…Ôâ~¡= Y¥ûœ}>¢™sâ	Š<Ù
+UF9hD“´y`
+§‰´çIé˸òiPSµøYy®Ì÷qUL[VE‚eŸ­>ÖVgƒ¨B¯H¬@ÕZüG§DÜ^§̐†áóÙUfK›±i4XÙVQÊ4jI¾€1¶vw‡,´FLÉàË<]ÿŒè™ñ‰p—n5Ô]H/²;çÐUN'³¢ùYÎ]ce'øWEòç,Jb£à€Ø‹…
+’”C`Ði å	ƒ½‡Zm+aj$~<Íï·%@✠ÑTcXZpÃ5L	Ézo|ˆI#d€™X|’îDTü`%VI@À7(HíCqd‰j@ƒ¨@$̈6žÕ	¥Ø-ø|‰…O‡r*t!à4ÿ¸…§Å!äVʍ+ËåxËÜÚ4hWwÁ¬gUÓƒȇ™EåÑ}ƒd™6ä#F˜3–`Ø#P;ŽpvAÐîD!áõ}ÙYõÖ@`94kÆR3€R™4-jQºÂ0ºôˆ€0%ÌIƒ 9 at 0*P4ÅÌtƒgDï²Ñ.¸^`ƒüØ%Qª}Nÿò@Š‘ˆ‚dúéÍ0‘‡Ý{£Âû‘£«Äìi!3ÙEuÕ&à.—_ØjÅçp'ùOï[Að]ô§E‘¬Xn£,Á.•wžÐ¸°#†;ò•aR×$-\cŒ£~p4ó£ý¨žXS …gÄXF†Ö|¶Óœ9VEƒ¨<ÒCA "\ Ýë B‚SåæÄP⁐qypX¾Peu¥×ÂH“Ïm IڐÀÏ¢úèfÆËA8yMðØEDS„±!	Pà1zD\Í¢i”ýK‘'W“E¼)'zäÑ‘­1SiAÛw|
+ÞÎW'1ļ‡¥i-”Û)
+ôÌù£ˆàOÇÒhH§ÅÐÉý“6¤PV°UVÖî£c]K®Òãüt`Ú,ÂzS”í
+Ê› w$'â²Ð¹9zq˜S}h˜@„щ(ÐaP€p¶$öXdT“íd;éB X(¤qÂ}av¤8Öñ"|L_V%Ž·Â¥òmáqƒÝºfäSïKõ(m a@ƒ,!‘ÁoƒWáP!Lî#=cѝŠÁÁöb² ‡½Xº0Ýe•Òö84%>“cÄ8HÎGHƒÇ•BP%±Bd•5H²Áù)–ÏP’4ɵWO¹MŽ$H·6U•}V@÷
+«ÓÓ,”éwÐ}—D‘5|cR)´w½JÏø…W–•æÓ—ü%ZÔáý4(ÄWÀUÁJÁø’±Õ0ÅŒkÔZÕ	ôÐA0JöAÀ6B^AœXUX»£` ªEäèAg%ˆCewZë…E@B)‰SV“õ›+ƒyi?‡¾€ìE)Ì)F¢P‰x÷Š¨?ð(½Çæ°¢yó†Lb‘ÖåfYˆp?ƒú¢¼IxÛR!HÙè–ßåi ^2’uÂ65ÃÜxýÅÁ@ø@@&%ö„RU•k¥")u(’÷e˜8JS+Û\ÉiÞ›ê' xRáѲ-–Q™^"í Ÿõ.i˜Òš@p˜ðåB ÖA^ªÒ"Â	WÈBp@ÎŽ5YAFm,b´"µ `Ž·’cá†[™ÅVò¶p˜aŠ"éíô ¯à ÿÝE^	Dm–£Qmd|}%þßOõbþ£žO©?ðm“ËÏ Fê–MfC`U¡WBGËõ\(ÌŒ÷öeblSs£ÃP<1W9Zú’xWŒ‚”¥_ˆ¸Ça
+
+rQµ8#ˆùT6¬eñÑhš.“´€PÅ’xÒ0dUjâõØÐ’X%=‰E¹`õÛhkŠæE°[Ê”ŠƒFïM˜ÁƒŸy†¸>Õ•ÿW_â$ÆB2šes at fÌŒ¡UAEM¬˜àCFaªC#÷«Lh·ÌqkW@ñ¡kø`Ix;•vNÞ’óCh<æd\Eù/Ì 2.4›Á€YÝ(Aí¦-5(»æ—£L
+/ŽùL— ºI
+5|ùTö™%¡ÙdR+C·g†
+ß_j‚!	æwù_5BÁ›‘D|eEX4q±Äf™]E–—Ægk.³(	Bîç¨Ùi®;E©L¬¡LQ‡ãàUæAöoµ†Ì0pF›¸&¨”I–ÁÂ(TŸÙ…•¿w¹BU(¢Wj‚~N:y=Vœ6¤4&1qUá	HP5ùkVMÁýÃ?¤,§þÈtV“É+´PBu¦e´X†ÉE M~š-¿ùuæšB¤»•U’9'	BÑ/ÁÌùvB›$Bµg¢/zgBàXŠçÞi”^t¦tØ,ž"‹U¹¬M&ã)yNž”gåiy^ž˜gæIŒVšgçéy~ž gè)zŽž¤géizžž¨gê©z®ž9qÅz¾ž°gì){Ξ´gíi{Þž¸gî©{îžC
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/jet2.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/jet2.hdf
___________________________________________________________________
Name: svn:executable
   + 
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/jpeg_img.jpg
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/jpeg_img.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/ntcheck.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/ntcheck.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/palette.raw
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/palette.raw
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/skull.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/skull.hdf
___________________________________________________________________
Name: svn:executable
   + 
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm110.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm110.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm110.raw
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm110.raw	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm110.raw	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+RRQQPOOONNNNNNNNNNNNOOPQRSSTUVWXYZZZZYXXWVUTTTTTTTTUUUUVVQPPPOONNNMMNNNNNNNNNNOPQRRSTUVWXYZZZZYXWWVUTTTTTTTTUUUUVVOOOONNNMMMMMMMMMMMMNNOPPQRSTUVWXYZZZZYXWVVUTTTTTTTTUUUUVVNNOONNMMMLLLLLMMMMMMNNOPQRSSTVWXYYZZYYXWVVUTTTTTTTTUUUUVVMNOONNMMLLLLLLLLLLMMMNOPPQRSTUVXXYYYYYXWVUUTTTTTTTTUUUUVWNOOOONNMMLLLLLLLLLLMMNNOPQRSTUVWXYYYYXXWVUUTTTTTTTTUUUUVWQQPPOONNMMLLLLLLLLLLMMNOPQQRSUVWXXYYXXWWVUTTTTTTTTTUUUVVWSSRQPOONNMMMLLLLLLLLMMNNOPQRSTUVWXXXXXWVUUTTTTTTTTTUUUVVWWVTSQPPONNNMMMLLLLLLLMMNOPPQRTUVWXXXXWWVUUTTSSSTTTTUUUVVW[YVTRQPPOONNMMMLLLLLLMMNNOPQRSTVWWXXWWVUUTTSSSSSTTTUUUVVW[ZVSRQQPPPONNMMMLLLLLLMMNNOPQRTUVWWWWVVUTTSSSSSSTTTUUUVVW]XT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Z[\]SW[YTUY_fo{‰”š˜’•”ŽŽ““‘ˆ‚zn\I at DINQRSTTTUUUVVWWXYZZ[\\]INSXaktzˆŽ‘Ž‘™™Œ„ˆ‹Š‰‰ˆ„ypbOCEJNQSTUUUUVVVWXXYZZ[[\]^\Z`lx~€ƒ†ˆˆˆŒ‘”’Š€„yvx{{xtncRFGLPRTUUVVVWWWXYYZZ[[\\]^yqt}‚}‚…‡‹Œ‰‰‡zxvmfdgloomi`RHINQSUVVWWWXXXYYZZ[[\\]^_„…‰†~z}„†‡…†‹ŽŠ~rolaYWZ_bdec\PHLPRUVWWWXXXYYZZ[[\\\]]^_ŠŒ…xw{„††„„††}mfaYQNPTW[]\ULINRSUVWXXYYZZ[[[\\\]]]^^_”š›’tw{~‚„‚„…ƒzj`[TMIILOSUTOIKRTTWWXYYZZZ[[\\]]^^^^^^_’›œxquz|}€€|j[UOKGGHKMNLIIOTTUWWXXYZ[\]^__`````__^[‘š–ƒrquy|}}~}~|{p\QJGEDDEFFEGLSUTUVWXZ\^_abbcccbba`___a’Šxpruxz{|}}||{yyveTIC@???@BFLQSRSUVY\^`bcdeeeddcb`_]ZWPŽ‰|qpsuwxy{{{zz{vuxq`RGB?>@BEJMOPQTWZ]`bcddddddcba_][Y[`iˆropsuwxxyyyywxwrswpcVMGEEFILNQTX[^`bbbbbccbba`^][YWVX[_€uonprtvwxxwwxvvwtoquskbZUSSUWZ]_aaa`________^\[YWTQNKIF<ypnnprstuvvvwwutuurnoqsrokiggghgfdb_^\\[ZZZYYXVTROKGEHQ[cypnnqqstttuuuuutrstqmmnrsssrqpnmkhea_\[YWVUSRPNKIECCGOXclvnlnoqsstssttsstrqrsqnmmpqrssrqomjgda^\ZWURPMKHFDDEJQYbo{ummmooqrrrssssrrrqppssqnmmnopponljhfdb_\YVSPMKJIJLPTYaly„umlnppqqqqqqrrrrqqqooqrrpnmmmmmllkigfca_\YVTRQPQSUW[`iu‚Œslllnopqqpqqpppqqpqqonoprqonlkjjihgfecb`^\[YXXYZZ[\_ep|†Œtkllnnoooppopooppoppponnoprrqpnljhgedca`__^^^^^]\]^bitŒ’qkllnnoooooooooonnoopqpnnmmnoonnlkigfdcbbaa`_^^_abadjt€‹’pikkmmonooooonnnnnnnmmoqqpnmllllkkjihgfdcbaaabdedbbekv‚Œ‘pjlkmmmnnnnoonnnnnmmnnmmnooonmkjihgfeddcccccdeeddddflv‚Œ”oijkmlnnnnnnnnnnnnnmmmnnmmmmnnmlkjihfeedddeeffghgfdflv‚Œ‘nikjllmmmmnmmmlmmnnmmmmmmmllkkkkjjihggffeeefghhhgfeglw…–qjjkmlmmmmmmnmmmmmnnmmmmmmmmllkjiihggfeeeefgghhhhgfgmwƒŽ•pikkllmmmmmmmmmmmmmmmmmmmmllllkjjihhgffffffgghiihgfgmwƒŽ”
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm120.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm120.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm120.raw
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm120.raw	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm120.raw	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+RRRRQQQPPPOOOOOOPQRSUVXY[]^___^\YVRNKHFFGIKMNPRSUVWWXXXYYRRRRQQQPPPOOOOOOPQRSUVXY[]^___^\YVRNKHFFGIKMNPRSUVWWXXXYYRRRRQQQPPPOOOOOOPQRSTVXY[]^___^\YVRNKHFFGIKMNPRSUVWWXXXYYRRRQQQQPPPOOOOOOPQRSTVXY[]^___^\YVRNJHFFGIKMNPRSUVWWXXXYYRRRQQQPPPPOOOOOOPQRSTVXY[\^___]\YVRNJHFFGIKLNPRSUVWXXXYYYRRRQQQPPPPOOOOOOPQRSTVXY[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aaa`_^]\ZXY\^`bba^ZUOKIHHIKMOQRTVWXXXXXXXfr~wojgffgjloqrrqomifca`^[\^abcb_[VQLIHHJKMOQSTVWXYYXXXWzˆˆ€wsrsuwy{}~}{xtojfdc`^^accca]XRMJIIJLMOQSUVXYYYYXXXk|‹Ž‡}xwxz}€‚ƒƒ‚‚‚€~{wqkfddb`acddb^YTOKIIJLNOQSUWXYZZZYYY„Ž‘Œƒ|{}‚…‡†…†ˆ‡„~|yslfddcaceec`[UPLJJKLNPRTVXYZ[[[ZZY{ˆ‘“†ƒ†ŠŒ‹ˆ‰Œˆ…‚€~{yslfeecceedb]WRNKKKMOQSUWYZ\]]]\\\~…”‰……ˆ‹ŽŠŠ‰†……„|yvpieedcefec_YTOLKLNOQSVXZ\]^__^^^ƒ‰”‘Šˆ‰‹ŽŒ’”Œ‰‘’ˆ€ytqkededeffda[VQNMMNPRTWY[]_`aaaa`ƒŠ‘“ŒŒ”—Ž‹“¡Ÿ˜‚xqmjeceeefgeb]XSPNNOQSVXZ]_`bccddd†‹’‘’•˜”‹•¤­¬¤—Š~skgfcaceefgfd`ZURPOQRUWY\^`bdeffgg‡‹‘‘‘’Ž“™™“¤²´«~sjc`a`_beeghheb]XTRQRTVX[]`bdeghhiiˆŒ‘‘‘‘‘—š•Ž›¯·²¤‘pf_ZY[\]adegiigd_[WTSSUWZ\_aceghijkkŠ‘‘’Ž’˜˜‘¤µ·¬›†sdZURRUX[`efhjjifb]YVUUWY[^`befhjkllmŒ‘‘“™–Ž”©¶²¦”k\SNLNRVY`eghkkjhe`\YXWXZ\_adfhiklmmn‹ŒŽŽ”—”Œ–ª³­ ŽzhYPKIKPUZaghjlmljgd`\ZZZ\^`beghjkmmno‹‹ŒŒŽŽ”•‘‹•¨®¨›ŠxfYOJILQV\dijlnnnmjgc`]\\]_acegiklmnopŠŠŠ‹Œ‹““Š’£©¢–†vgZQLLNSY`hklnpppolifc`_^_`bdfhiklmnoq‰Š‰Š‹‹‹Š‘‘ˆœ£ž’„uh\TPPSX^flnnqrrrqolifcaaabcefhjklmnpr‡ˆ‡‡ˆŠ‰‰‹Œ†ˆ”œ™ƒvj`ZWWZ_elppqtuutsqolifdcbcdeghiklmoru††……†‡ˆˆ‰ŒŽŒ…ƒ‹””„xnfa_`chmqstuvwvvusqnkhfdddefghijlmptx††„„…‡‡‡‡‰Œ‹…ƒŠŽ‹„|smihilpsvwxxyyxxvurpmjhfeeeffgijkou{}„„ƒƒ„…†††‡‰Š…~}†‡„ytqqrtwz|||||{zywusqnkigfeeefggimt|ƒ‡ƒƒ‚ƒ„…………†ˆ†€zz~‚€}zyyz|~€€€~}{zxvsqnligfeeeeegkou|ƒˆ‚€‚‚‚ƒƒ‚„……{wwz|}~}}~‚ƒ‚‚€~}{yxuspnkigeedccehkowƒ‹€€€€€€‚ƒ}xttvxz{}~€‚‚‚€}|zywtromjhgecbbdefjt„‘˜š€~~~~~zusrstvxz|}~~}|{zxwurpnligecbbcbagu‡–Ÿ¡ ~}~~~}}||}}|xurqrstvwyzz{{zyxwvtspnljhedcca^^fxŠ˜¢¦¦£~}}}}~~~}}}|{{{{zxusrqrstuvwwwwvvusrpnljhfedb_\]gw‡•Ÿ¥§¦¤~}|}}}|}||||{zzzzywutrrrrsstttttsrqpnlkihfda^[]fs‚š¢¦§¦¥}|||||{{zzz{{zyyyyxwvtsrrqqqrrrqqponmljigda]\^ep|ˆ”ž¥¨§¦¥}{{{{{zzyyyyyyyyyyyxwvtsrqppppppoonmljhfc`]]_emw€‹– ¦¨¨¦¤|{{{{{zzyxxyxxxyyyyyyxvusrponmmllkjigec`_^^afmtz‚™£¨©¨§§|zz{zzzzyxxyyxxyyyyyyyxxwvusqpnmlkjihfeedegimrw|ƒŽ›¤©ª¨¦¦|{z{zzzzxxxyxxxyyyyyyxxxwvvuuttsrqqponmllllnpty}„›¤©ª¨¦¥
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm130.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm130.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm130.raw
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm130.raw	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm130.raw	2007-05-14 09:41:34 UTC (rev 808)
@@ -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_][WQKFDDGJNRUXZ[]]^____SSTTUUUUUUVVVWXXYZ[\\]^^_``aabbaa`][WQKFDDGJNRUXZ[\]^^___SSSTUUUUUVVVWWXXYZ[\]]^^_`aabbbaa`^[WQKFCDFJNRUXZ[\]^^^^_SRRSTUUVVVVWWXYYZ[\\]^^__`aabbbba`^[WRKFCDFJNRUXZ[\]^^^^^TRRSSTUUVVVWXXYZZ[\]^^__``abbbbba`^[WRKECCFJNRUXZ[\]^^^__TSRSTTUUVVVWXXYZ[\]]^__``aabbbbba`^\XSLEBCFJNRVXZ[\]^^___TSRRSTUVVWWWXYZ[\\]^__```abbcccbba_\YSLEBCFJOSVXZ\]]^__``UTSSTUVVWXXXXXY[\]]^__``aabcccccba_]YTMEABFJOSVYZ\]^__`aaUTSRRTVXXXYYYYZ[\^^__``aabccdddccb`^ZUMEABFKOSWY[\^_``abbXWVTRRTVXZZ[\\\\]^__```abbcddddddca^[VNFABFKPTWY[]^_aabccXXXXWUUUVXZ\]^^^^_`aaaaabccdeeeedcb_\WOF at AFKPTWZ\^_`bcdddha[XXXXYYYY[]^_```abbbbbbcddefffedb`]XPG at AFKPTXZ\^`acdeff€zpd\YYZ[\]^_`abbabbccbbccdeffgffeca^YRG@@FKQUX[]_`bcefgg”ˆ|nd^\\]_`acdeedcccddccddefgggfedb^ZSH@@FLQUX[]_abdeghhŸ˜Žtjda`aabcefggfeddedddeefghhgfeb_[TI@@FLQUX[]_acdfghh£ œ•Œvnjhhgggghhihhgfeeeeeffghhhgfc`\UKA?FLQUX[]_acdfghi¡›—”Ž†~wspooonnnmlkjihgfffffgghiihfda]WLA?ELQUX[]_abdefgh˜’‘‘ˆƒ~zxvvuuutsrpnljihgfffghiiiigeb^XNB?ELQUX[]_`bcdeggŽŽŽ‹‡„€~|{zzzyyxwurnkihgffghijjihfc_YOC>ELQUX[]^`abcdeeˆ‹Ž‹ˆ…ƒ€}|{{zzywsokihggghijjjigd`ZQD>ELPUXZ\]_``abcdŠŒŽ’““’‘ŽŒ‰‡„}|{zywtokiggghijkkjgda[SE>ELPTWZ[]^__`aabŒ‘”•–––•”“’Ž‹‡ƒ|zzywsnjhggghjkkjheb]TG?DLPTWY[\]^__``a‘”•–––––—˜™˜—”‹†€{xxxvrliggghjkkkifc^VI?DLPTWY[]^__``aa“••••–˜›ž›˜•’ˆyuuvtojggghiklljgd_WJ at DLPTWZ\^_`abbbb‘”••–—šŸŸœ™”‘‘‘Ž‰wsstqkhgghikllkhe`YMADLQUX[^`bcdeeff’““”—›žž™”‘”––”Œ†}sprrmhffgiklmljfb[OBCLQVZ]`cefghhii‘‘‘•šžœ—’‘–¢¤¢œ”†unnpnigfgikmmmkhc]QDCLRW[_cehikllll‘”˜š›™•‘”œ¦¯³³­¤™„}vmknnjgfgikmnnlie_TFCLRX]behklnopqq‘•—˜–”‘’– ¬¸¿À»²¦˜‹xslhkmkgfgilnoomkgaWIDLSY_dhkmoqrrss‘•––”’’— ­»ÅÉź­Ÿ‘…yqniehlkhghjlnppolid[LEKT[afjmpqsuvvv’•”“‘’–žª¹ÆÍÊÀ²¡’…zpigfceklighjmoqqpnkf^PFKT\bhlprtuwy{}‘’‘‘‘•›¦´ÃÌÍƸ¦“ƒvmfa`badjlihiknprrrpmhaUHKT]djnrtvxyz{~Ž‘‘‘’˜ ¬»ÇÍʾ®š†uha]Z[^_cjmjijloqsttrokdZLLT]ekptwyz{{{{Ž‘‘”›¤°¾ÈËÄ·¤{j^XUTW\^cknljkmprtuutqmh^PMT]flrvy{}~~~}Ž‘•œ¦²¿Çƾ°ˆtdXSQQU[^elomkmortvwwvspkbVOT]fmsx{~€‚Ž‘•¦²½ÃÁ¹ª˜…rbWRPQV\`goqnmoqsvxxxwurmf[RU]fnuy}€‚ƒ„„…Ž”œ¥°º¾¼´¦•ƒrcYTRTY^dkrrpoqsuwyzzywtpjaWV]fou{~ƒ…†‡ˆŽ“š¢¬µ¹·¯£”„tg^XWY^chputrqsuwyz{{zyvrme\Y^fov{‚„†ˆŠŽŽŽ—ž§¯³±« “…xlc_]_chntwvttuwy{||}|zxupi`\`gov{‚…‡‹“ŽŒŽ“š¡©¬«§ž“‡{qjfefjntxzxvvxy{|}}~}{yvqle`bhov{ƒ†‰‘–ŒŽŽ‹‹•›¢¦¦¢›’ˆvpmlmpty{{yxxz{|}~~~~|zwtnhdeiov{ƒ‡‹”œŠ‹‹‹‰ˆŠ•›Ÿ ž™’Š‚{vtsuwz}~}{z{|}~~~}{xtpkghkpv{€…‰‘š¨ˆ‰‰‰ˆ††Š”˜š™–‘‹…€|zz{}€€~}|}}~~~}{xuqmjjlqv|†ŠŽ–¥¶‡‡‡‡†…ƒ…‰‘””“Œ‡„€€‚‚‚€~~~}{xuqnllnrw~ƒ‡Ž—£²¾††……„ƒƒ‡‹ŽŽ‹‰†„„ƒ„„„„ƒ€€€€€~}|zwurommotz…Ž™¤®·¿……„ƒ‚‚€~…ˆŠ‹‹‹Šˆˆ‡‡‡††…„‚€€€~~}{ywtqnmnrw|ƒœ¥«°µº„„‚‚€~}}€ƒ†ˆ‰‰‰ˆˆˆˆˆˆ‡†„ƒ‚€€~~}|zxurpooqsw¤¨«¯³µ„ƒ‚€~~}||~‚…‡ˆ‰‰‰‰‰‰ˆ‡†„ƒ‚€€~}}{zxvsqpooqv€›¡¤¦ª¯±²„ƒ‚€~}}|||~„†ˆ‰ŠŠŠ‰ˆ‡…„‚€€~~}|{zxvtrqpoqu}Š–¡£¦ª®°°
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm140.raw
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm140.raw	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/testfiles/storm140.raw	2007-05-14 09:41:34 UTC (rev 808)
@@ -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[[[[[[[\\\\\]^`cghb]]_acddddddb_^]]\\\\\\\\[[[[[[[ZZZZZZ[[[[[[[\\\\\\]^`chhb]]`bcddddddc`_^]]]]]]]]\\\\[[[[[[[[[[[[[[[[\\\\\]]]^`chga\^`bddeddddda`_^^^^^^^]]]\\\\\\\[[[[\\\\\\\\\\]]]]]^`dhf_\^aceeeeeddeca_______^^^]]]]\\\\\\\\\\\\\\\\\]]]]]]^`dhe^]`bdeffeeeeeda`________^^^]]]]]]\\\\\\]]]\\\]]]]]]^_aehc]^adfgggfffffeba````````__^^^^^]]]]]]]]]]]]]]]]]]]]^_afhb]_cfghhhggffgfca`````a````__^^^^^^]]]]]]]]]]]]]]]]]^_bff`^aegiiiihggfgfdba``aaaaaaa``__^^^^^^^^^^^^]]]]]]]]]^_cfe__dgijjjihhggffdba`aaabbbaaaa``____^^^^^^^^^]]]]^]]]^`cfc_afikkkkjihhhhhfdbaabbbbbbbbaaa``_______^^^^]]]]^^]]^`ceb`dhklllkkjiiioomheccccccccbbbbaaa``_______^^^]]^^^^^_`bdaafjlmmmllkkjj{{xqjfeeeeeddccbbbbaa``````___^^^]^^^^^_`bcbdilnnnnmmlllkˆ‰‡€vmhggfffeddcccbbbaa`````__^^^^^^^^___accfknoooonnnmmm–˜—‘†xojiihhgfedcccccbaa`````__^^^^^^__^^`cdhmoppppppoooo¢¥¥¡—ˆzqmlkjihgeddddccbaa`````_^^^^^___]]adfjnpqqqqqqqqqq®¯°­¥—ˆ{ronmkjihfdddddcbaaaa``__^^^___^\\aehloqrrssssssssµ¶µ³­£•‡|tponlkihfeeeedcbaaa``__^^^___^[\bfinprssttuuuvvv¹·´±®¨ž’‡}vrqpnljhgffeedcbaa```_____`_]Z]chkoqrttuvwwxxyyµ±­¬«¨£š‘ˆxsrrqnkhgfffedbaa```_____`_[Z^eilprstuvwxyz{{{¯©¦§¨¨¤Ÿ™’Š‚zussrokhffffecba````___``^ZY_fjmprtuvwxz{||}}«¦¤¦©©§¢ž™”…~yvutplhffffdca````__```]YZahknqstuwxy{|}~¥¢£¦©«ª§¢š–ˆ|zxuqlgeeeecba````````\Y[ciloqstuvxyz|}~€€žŸ¢¦©¬­¬¨¢™–‘Š„|zvpjfddedba``````a_[X\djmoqrstuwxyz|}~~›Ÿ¤¨«®°°¯ª£œ˜–’Œ†‚~zuohdcddba`````aa_[X]fkmoqrsttvwxz{}}~› ¥§©ª¬¬­¬¨¢›•“‘Œ‡ƒysleccccba````aa^ZY^glmopqrstuvwy{|~šŸ¢¢¢¢¢£¤¦¦¥ ˜’Ž‹‡ƒ}wpicbbbba```aaa^ZY`hlmnppqrrtuvwxz|}™œœ›››œžŸ¡£¤£Ÿ—‹Š‰…zslebabba```aaa^YZahlmnoopqrstuvwxyy—™˜˜™›ž ¢¤¥¥¥¤Ÿ–Œˆ‡†ƒ~vohb`aba```aba^YZailmnnnopqstuvvwxx••–™œ ¤§ª¬­­«¨¥Ÿ”‰„„ƒyqjc_`aaa`abba]Y[bilmmmnoqrsuvwwxyy”–šž£¨­±µ¸¹¸´¯©£›„€€{sle__`a``abca^Z[billmmnpqstvwxyyzz–š ¥ª°¶¼ÁÄĽ¶®¦ž”‡~}}{unf`^_`aabccb^Z\billmnoprtuwxyzz{{šŸ¥«²¹ÀÆÊÌÊÆÀ¹±§ž•Š~yzzvoha^^`aabcdb^[\bilmmnpqsuwxz{{{||ž¤ª±¹ÁÈÌÎÌÈ»´¬¤›“Šwwyvpic^^`abcdec_[\bilmnpqsuvxz{}}}}}¡§®¶¿ÆÌÍËŽµ¬¦¡œ•Ž‡~utvvpjd_^`abcded`\]bimnoqrtvxz|}~€¢©±ºÃÈËȸ­¢™’ŽŽ‹‡‚|sqtuqke`_`bcdegea]]bhmoprtvxz|~€‚£«´½ÄÇÆÀ¶ªœ„}z|~|xqnrtqkfa``bdefhgc_^bhmprtvx{}€‚ƒƒ„„„¤«µ½Âÿ¶ª›Œ~rjgkrvvtnlpsqlgcaacefhihea_bgmqsvx{}€‚„…†‡ˆˆˆ£«µ¼¿½·¬Ÿpd[Y^gnppljosqmhdbacegijjgbabgmqtwz}€ƒ…ˆ‰‹Œ¢ª³¹»¸°¥–†vgZRPU`hkljiosrmieccefhjlliebcglruy|€ƒ†‰ŒŽ‘’““ ¨±µ·³«Ÿ‘qbVOMR\dhihiosrnifddegjlmnkgddglrvz~‚†Š’“•–˜š¤­²³¯§œŽ~oaVPOT\cfhhjqtrnjhfegikmopnjgfgkqv{€„‰Œ“•—˜š ™ ©®¯¬¥šqdZUTX^cfhhlrusokigghjmoqrplighkpv|†‹“–˜™›ž¢¦•›¤©¬©¤š‚uja\[]behijouvsoljiijloqstsoliikpv|‚ˆ‘•˜š›ž¢¨±–ž¤¨§£œ’‡{qidcdfhijmrwwspmkjjlnpsuvurnkjkou|‚‰Ž”—™›ž¢ª·Ç‹—ž£¤¢•Œ‚yqmjjkllnqvywtpnlllnpruwxwuqmklot{‚‰”—š¡¬¼ÊÒ‡Š–  —ˆ€ytrppopquyzwtqnmmnoqtvxzywsollot{‚‰•™›Ÿ­¿ËÐÑ…†Š”™œ›—’Œ…zwutstwz|{wtqonnoqsvxz{{yuqnmotz‚‰”—­¿ÊÍÍÌ…†ˆ‹Ž’•–•‘‡‚~{yxxy{}}zwsqpopqrtwy{||{wrnmot{‚‰”›¨»ÆÊÉÈÇ
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/test.cdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/test.cdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/test.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/test.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/tvattr.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testfiles/tvattr.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/hdf/util/testutil.sh
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/testutil.sh	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/testutil.sh	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,424 @@
+#!/bin/sh 
+# HDF Utilities Test script
+# Usage: testutil.sh [machine-type]
+
+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 -r gif_hdf_temp
+/bin/mkdir gif_hdf_temp
+./hdf2gif testfiles/skull.hdf  gif_hdf_temp/skull.gif
+./gif2hdf testfiles/SunWheel.gif  gif_hdf_temp/SunWheel.hdf
+./gif2hdf 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 " testfiles/SunWheel.gif and 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 " testfiles/skull.hdf and gif_hdf_temp/skull.gif"
+  echo " ********************* END NOTE **************************"
+  echo ""
+  errors=0
+
+# hdf24to8
+if [ -f hdf24to8 -a -f hdftor8 ]; then
+echo "** Testing hdf24to8  ***"
+/bin/rm -f head.r24 head.r8 head8.hdf img001-263.328 pal001
+cp testfiles/head.r24.Z testfiles/head.r8.Z .
+uncompress head.r24.Z head.r8.Z
+./hdf24to8 head.r24 head8.hdf
+./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 testfiles/head.r24.Z testfiles/head.r8.Z . "
+  echo " uncompress head.r24.Z head.r8.Z "
+  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 testfiles/storm110.hdf testfiles/ntcheck.hdf .
+$HDFEDCMD < hdfed.input1 > hdfed.tmp 2>&1
+diff hdfed.tmp 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 testfiles/storm110.hdf testfiles/ntcheck.hdf . "
+   echo "$HDFEDCMD < hdfed.input1 >& hdfed.tmp "
+   echo "diff hdfed.tmp 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 testfiles/storm110.hdf testfiles/storm120.hdf testfiles/storm130.hdf .
+./ristosds storm*.hdf -o storm.hdf > /dev/null 2>&1
+$HDFEDCMD < ristosds.input1 > hdfed.tmp1 2>&1
+diff  hdfed.tmp1 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 testfiles/storm110.hdf testfiles/storm120.hdf testfiles/storm130.hdf . "
+  echo "./ristosds storm*.hdf -o storm.hdf "
+  echo "$HDFEDCMD < ristosds.input1 >& hdfed.tmp1 "
+  echo " diff  hdfed.tmp1 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 testfiles/test.hdf .
+./hdfpack test.hdf test.pck
+./hdfpack -b test.hdf test.blk
+(./hdfls test.hdf | $SED ) > hdfls.tmp1 2>&1
+(./hdfls test.pck | $SED ) >> hdfls.tmp1 2>&1
+diff  hdfls.tmp1 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 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 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 testfiles/palette.raw .
+./paltohdf palette.raw palette.hdf
+./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 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 testfiles/storm*.raw testfiles/palette.raw .
+./r8tohdf 57 57 storm.hdf storm*.raw
+./r8tohdf 57 57 storm.hdf -p palette.raw -i storm110.raw
+./hdftor8 storm.hdf
+(./hdfls -l storm.hdf | $SED) > hdfls.tmp2 2>&1
+diff  hdfls.tmp2 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 testfiles/storm*.raw 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 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 testfiles/storm*.hdf .
+./hdfcomp allstorms.hdf storm*.hdf
+./hdfcomp allcomp.hdf -c storm*.hdf
+(./hdfls -l allstorms.hdf | $SED) > hdfls.tmp3 2>&1
+(./hdfls -l allcomp.hdf | $SED) >> hdfls.tmp3 2>&1
+diff  hdfls.tmp3 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 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 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 testfiles/jpeg_img.jpg .
+./jpeg2hdf jpeg_img.jpg jpeg.hdf
+./hdf2jpeg jpeg.hdf jpeg2.jpg
+(./hdfls -l jpeg.hdf | $SED) > hdfls.tmp4 2>&1
+diff  hdfls.tmp4 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 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 jpeg2hdf.out1 "
+    echo "cmp jpeg_img.jpg jpeg2.jpg "
+  echo " ******* END NOTE *************"
+  echo ""
+   errors=0
+fi
+
+# 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 fp2hdf.out1 || errors=1
+    $HDFEDCMD < fp2hdf.input1 > hdfed.tmp6 2>&1
+    diff  hdfed.tmp6 fp2hdf.out2 || errors=1
+else
+    diff  hdfls.tmp5 fp2hdf.out1-32 || errors=1
+    $HDFEDCMD < fp2hdf.input1-32 > hdfed.tmp6 2>&1
+    diff  hdfed.tmp6 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 fp2hdf.out1 "
+  echo " $HDFEDCMD < fp2hdf.input1 >& hdfed.tmp6 "
+  echo " diff hdfed.tmp6 fp2hdf.out2 "
+  else
+  echo " diff hdfls.tmp5 fp2hdf.out1-32 "
+  echo " $HDFEDCMD < fp2hdf.input1-32 >& hdfed.tmp6 "
+  echo " diff hdfed.tmp6 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 0


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/testutil.sh
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/util/vcompat.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/vcompat.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/vcompat.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,51 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.14 $";
+#endif
+
+/* $Id: vcompat.c,v 1.14 1998/12/08 21:37:57 koziol Exp $ */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#include <stdio.h>
+#include "hdf.h"
+
+int
+main(int argc, char *argv[])
+{
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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 */
+
+/* ------------------------------------------------------------------ */

Added: packages/libhdf4/branches/upstream/current/hdf/util/vcompat.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/vcompat.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/vcompat.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "vcompat.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)/vcompat.exe $(OUTDIR)/vcompat.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"vcompat.bsc" 
+
+$(OUTDIR)/vcompat.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/vcompat.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"vcompat.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"vcompat.exe" 
+
+$(OUTDIR)/vcompat.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)/vcompat.exe $(OUTDIR)/vcompat.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"vcompat.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)/"vcompat.bsc" 
+
+$(OUTDIR)/vcompat.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/vcompat.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"vcompat.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"vcompat.exe" 
+
+$(OUTDIR)/vcompat.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=.\vcompat.c
+
+$(INTDIR)/vcompat.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/vmake.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/vmake.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/vmake.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,619 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char *RcsId[] = "@(#)$Revision: 1.34 $";
+#endif
+
+/* $Id: vmake.c,v 1.34 1998/12/08 21:37:58 koziol Exp $ */
+
+/*****************************************************************************
+*
+* 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
+*
+*
+******************************************************************************/
+
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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 defined __MWERKS__
+    ac = ccommand(&av);
+#endif
+
+    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);
+}
+
+/* ------------------------------------------------------------------ */

Added: packages/libhdf4/branches/upstream/current/hdf/util/vmake.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/vmake.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/vmake.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "vmake.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)/vmake.exe $(OUTDIR)/vmake.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"vmake.bsc" 
+
+$(OUTDIR)/vmake.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/vmake.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"vmake.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"vmake.exe" 
+
+$(OUTDIR)/vmake.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)/vmake.exe $(OUTDIR)/vmake.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"vmake.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)/"vmake.bsc" 
+
+$(OUTDIR)/vmake.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/vmake.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"vmake.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"vmake.exe" 
+
+$(OUTDIR)/vmake.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=.\vmake.c
+
+$(INTDIR)/vmake.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/vshow.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/vshow.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/vshow.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,810 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char *RcsId[] = "@(#)$Revision: 1.59 $";
+#endif
+
+/* $Id: vshow.c,v 1.59 1999/04/23 22:19:11 smitchel Exp $ */
+
+/*****************************************************************************
+*
+* 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.
+*
+*
+******************************************************************************/
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#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 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 */
+
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+    char        *fields = NULL;
+#else
+    char        fields[VSFIELDMAX*FIELDNAMELENMAX];
+#endif
+    char        vgname[VGNAMELENMAX];
+    char        vsname[VSNAMELENMAX];
+    char        vgclass[VGNAMELENMAX], vsclass[VSNAMELENMAX];
+    char *name;
+    int32       fulldump = 0, full;
+
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+	fields = HDmalloc(VSFIELDMAX*FIELDNAMELENMAX);
+	if (fields == NULL)
+	{
+          printf("Error: Out of memory. Cannot allocate %d bytes space. Quit.\n", VSFIELDMAX*FIELDNAMELENMAX);
+          exit(0);
+      }
+#endif
+
+
+#if defined __MWERKS__
+    ac = ccommand(&av);
+#endif
+
+    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);
+            }
+          Vinquire(vg, &n, vgname);
+          vgotag = VQuerytag(vg);
+          vgoref = VQueryref(vg);
+          Vgetclass(vg, vgclass);
+          if (HDstrlen(vgname) == 0)
+              HDstrcat(vgname, "NoName");
+          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;
+                        }
+
+                      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);
+
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+	if (fields)
+		HDfree(fields);
+#endif
+
+    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
+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)
+{
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+    char        *fields = NULL; 
+#else
+    char        fields[VSFIELDMAX*FIELDNAMELENMAX]; 
+#endif
+    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 */
+
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+	fields = HDmalloc(VSFIELDMAX*FIELDNAMELENMAX);
+	if (fields == NULL)
+	{
+          printf("Error: Out of memory. Cannot allocate %d bytes space. Quit.\n", VSFIELDMAX*FIELDNAMELENMAX);
+          return(0);
+      }
+#endif
+
+    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");
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+	    if (fields)			HDfree(fields);
+#endif
+          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:
+                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");
+
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+	if (fields)
+		HDfree(fields);
+#endif
+
+    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;
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+   long bufsize = BUFFER;
+   uint8 *attrbuf = HDmalloc(bufsize);
+   if (attrbuf == NULL)
+   {
+	printf(">>>dumpattr: Out of memory. Cannot allocate %d byte attribute buffer.\n", bufsize);
+	return FAIL;
+   }
+#else
+   uint8 attrbuf[BUFFER];
+#endif
+
+   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:
+                 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:
+             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:
+#if defined(MAC) || defined(macintosh) || defined(SYMANTEC_C)
+   if (attrbuf)			HDfree(attrbuf);
+#endif
+
+   return ret_val;
+}                   
+/* ------------------------------------- */

Added: packages/libhdf4/branches/upstream/current/hdf/util/vshow.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/vshow.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/vshow.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# 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 "vshow.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)/vshow.exe $(OUTDIR)/vshow.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 "..\src" /I "..\jpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\src" /I "..\jpeg" /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)/"vshow.bsc" 
+
+$(OUTDIR)/vshow.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/vshow.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"vshow.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"vshow.exe" 
+
+$(OUTDIR)/vshow.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)/vshow.exe $(OUTDIR)/vshow.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 "..\src" /I "..\jpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\src" /I "..\jpeg" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"vshow.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)/"vshow.bsc" 
+
+$(OUTDIR)/vshow.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/vshow.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 ..\src\win32hdf.lib ..\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 ..\src\win32hdf.lib ..\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"vshow.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"vshow.exe" 
+
+$(OUTDIR)/vshow.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=.\vshow.c
+
+$(INTDIR)/vshow.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/hdf/util/writehdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/util/writehdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/util/writehdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,202 @@
+#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);
+}


Property changes on: packages/libhdf4/branches/upstream/current/hdf/util/writehdf.c
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/ChangeLog
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/ChangeLog	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/ChangeLog	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,471 @@
+
+		ChangeLog file for zlib
+
+Changes in 1.1.3 (9 July 1998)
+- fix "an inflate input buffer bug that shows up on rare but persistent
+  occasions" (Mark)
+- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
+- fix gzseek(..., SEEK_SET) in write mode
+- fix crc check after a gzeek (Frank Faubert)
+- fix miniunzip when the last entry in a zip file is itself a zip file
+  (J Lillge)
+- add contrib/asm586 and contrib/asm686 (Brian Raiter)
+  See http://www.muppetlabs.com/~breadbox/software/assembly.html
+- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
+- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
+- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
+- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
+- added a FAQ file
+
+- Support gzdopen on Mac with Metrowerks (Jason Linhart)
+- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
+- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
+- avoid some warnings with Borland C (Tom Tanner)
+- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
+- emulate utime() for WIN32 in contrib/untgz  (Gilles Vollant)
+- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
+- use libdir and includedir in Makefile.in (Tim Mooney)
+- support shared libraries on OSF1 V4 (Tim Mooney)
+- remove so_locations in "make clean"  (Tim Mooney)
+- fix maketree.c compilation error (Glenn, Mark)
+- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
+- new Makefile.riscos (Rich Walker)
+- initialize static descriptors in trees.c for embedded targets (Nick Smith)
+- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
+- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
+- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
+- fix maketree.c to allow clean compilation of inffixed.h (Mark)
+- fix parameter check in deflateCopy (Gunther Nikl)
+- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
+- Many portability patches by Christian Spieler:
+  . zutil.c, zutil.h: added "const" for zmem*
+  . Make_vms.com: fixed some typos
+  . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
+  . msdos/Makefile.msc: remove "default rtl link library" info from obj files
+  . msdos/Makefile.*: use model-dependent name for the built zlib library
+  . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
+     new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
+- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
+- replace __far with _far for better portability (Christian Spieler, Tom Lane)
+- fix test for errno.h in configure (Tim Newsham)
+
+Changes in 1.1.2 (19 March 98)
+- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
+  See http://www.winimage.com/zLibDll/unzip.html
+- preinitialize the inflate tables for fixed codes, to make the code
+  completely thread safe (Mark)
+- some simplifications and slight speed-up to the inflate code (Mark)
+- fix gzeof on non-compressed files (Allan Schrum)
+- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
+- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
+- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
+- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
+- do not wrap extern "C" around system includes (Tom Lane)
+- mention zlib binding for TCL in README (Andreas Kupries)
+- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
+- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
+- allow "configure --prefix $HOME" (Tim Mooney)
+- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
+- move Makefile.sas to amiga/Makefile.sas
+
+Changes in 1.1.1 (27 Feb 98)
+- fix macros _tr_tally_* in deflate.h for debug mode  (Glenn Randers-Pehrson)
+- remove block truncation heuristic which had very marginal effect for zlib
+  (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
+  compression ratio on some files. This also allows inlining _tr_tally for
+  matches in deflate_slow.
+- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
+
+Changes in 1.1.0 (24 Feb 98)
+- do not return STREAM_END prematurely in inflate (John Bowler)
+- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
+- compile with -DFASTEST to get compression code optimized for speed only
+- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
+- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
+  on Sun but significant on HP)
+
+- add a pointer to experimental unzip library in README (Gilles Vollant)
+- initialize variable gcc in configure (Chris Herborth)
+
+Changes in 1.0.9 (17 Feb 1998)
+- added gzputs and gzgets functions
+- do not clear eof flag in gzseek (Mark Diekhans)
+- fix gzseek for files in transparent mode (Mark Diekhans)
+- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
+- replace EXPORT with ZEXPORT to avoid conflict with other programs
+- added compress2 in zconf.h, zlib.def, zlib.dnt
+- new asm code from Gilles Vollant in contrib/asm386
+- simplify the inflate code (Mark):
+ . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
+ . ZALLOC the length list in inflate_trees_fixed() instead of using stack
+ . ZALLOC the value area for huft_build() instead of using stack
+ . Simplify Z_FINISH check in inflate()
+
+- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
+- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
+- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
+  the declaration of FAR (Gilles VOllant)
+- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
+- read_buf buf parameter of type Bytef* instead of charf*
+- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
+- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
+- fix check for presence of directories in "make install" (Ian Willis)
+
+Changes in 1.0.8 (27 Jan 1998)
+- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
+- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
+- added compress2() to allow setting the compression level
+- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
+- use constant arrays for the static trees in trees.c instead of computing
+  them at run time (thanks to Ken Raeburn for this suggestion). To create
+  trees.h, compile with GEN_TREES_H and run "make test".
+- check return code of example in "make test" and display result
+- pass minigzip command line options to file_compress
+- simplifying code of inflateSync to avoid gcc 2.8 bug
+
+- support CC="gcc -Wall" in configure -s (QingLong)
+- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
+- fix test for shared library support to avoid compiler warnings
+- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
+- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
+- do not use fdopen for Metrowerks on Mac (Brad Pettit))
+- add checks for gzputc and gzputc in example.c
+- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
+- use const for the CRC table (Ken Raeburn)
+- fixed "make uninstall" for shared libraries
+- use Tracev instead of Trace in infblock.c
+- in example.c use correct compressed length for test_sync
+- suppress +vnocompatwarnings in configure for HPUX (not always supported)
+
+Changes in 1.0.7 (20 Jan 1998)
+- fix gzseek which was broken in write mode
+- return error for gzseek to negative absolute position
+- fix configure for Linux (Chun-Chung Chen)
+- increase stack space for MSC (Tim Wegner)
+- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
+- define EXPORTVA for gzprintf (Gilles Vollant)
+- added man page zlib.3 (Rick Rodgers)
+- for contrib/untgz, fix makedir() and improve Makefile
+
+- check gzseek in write mode in example.c
+- allocate extra buffer for seeks only if gzseek is actually called
+- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
+- add inflateSyncPoint in zconf.h
+- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
+
+Changes in 1.0.6 (19 Jan 1998)
+- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
+  gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
+- Fix a deflate bug occuring only with compression level 0 (thanks to
+  Andy Buckler for finding this one).
+- In minigzip, pass transparently also the first byte for .Z files.
+- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
+- check Z_FINISH in inflate (thanks to Marc Schluper)
+- Implement deflateCopy (thanks to Adam Costello)
+- make static libraries by default in configure, add --shared option.
+- move MSDOS or Windows specific files to directory msdos
+- suppress the notion of partial flush to simplify the interface
+  (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
+- suppress history buffer provided by application to simplify the interface
+  (this feature was not implemented anyway in 1.0.4)
+- next_in and avail_in must be initialized before calling inflateInit or
+  inflateInit2
+- add EXPORT in all exported functions (for Windows DLL)
+- added Makefile.nt (thanks to Stephen Williams)
+- added the unsupported "contrib" directory:
+   contrib/asm386/ by Gilles Vollant <info at winimage.com>
+	386 asm code replacing longest_match().
+   contrib/iostream/ by Kevin Ruland <kevin at rodin.wustl.edu>
+        A C++ I/O streams interface to the zlib gz* functions
+   contrib/iostream2/  by Tyge Løvset <Tyge.Lovset at cmr.no>
+	Another C++ I/O streams interface
+   contrib/untgz/  by "Pedro A. Aranda Guti\irrez" <paag at tid.es>
+	A very simple tar.gz file extractor using zlib
+   contrib/visual-basic.txt by Carlos Rios <c_rios at sonda.cl>
+        How to use compress(), uncompress() and the gz* functions from VB.
+- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
+  level) in minigzip (thanks to Tom Lane)
+
+- use const for rommable constants in deflate
+- added test for gzseek and gztell in example.c
+- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
+- add undocumented function zError to convert error code to string
+  (for Tim Smithers)
+- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
+- Use default memcpy for Symantec MSDOS compiler.
+- Add EXPORT keyword for check_func (needed for Windows DLL)
+- add current directory to LD_LIBRARY_PATH for "make test"
+- create also a link for libz.so.1
+- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
+- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
+- added -soname for Linux in configure (Chun-Chung Chen,
+- assign numbers to the exported functions in zlib.def (for Windows DLL)
+- add advice in zlib.h for best usage of deflateSetDictionary
+- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
+- allow compilation with ANSI keywords only enabled for TurboC in large model
+- avoid "versionString"[0] (Borland bug)
+- add NEED_DUMMY_RETURN for Borland
+- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
+- allow compilation with CC
+- defined STDC for OS/2 (David Charlap)	
+- limit external names to 8 chars for MVS (Thomas Lund)
+- in minigzip.c, use static buffers only for 16-bit systems
+- fix suffix check for "minigzip -d foo.gz"
+- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
+- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
+- added makelcc.bat for lcc-win32 (Tom St Denis)
+- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
+- Avoid expanded $Id: ChangeLog,v 1.5 1998/12/18 21:38:28 koziol Exp $. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
+- check for unistd.h in configure (for off_t)
+- remove useless check parameter in inflate_blocks_free
+- avoid useless assignment of s->check to itself in inflate_blocks_new
+- do not flush twice in gzclose (thanks to Ken Raeburn)
+- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
+- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
+- work around buggy fclose on pipes for HP/UX
+- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
+- fix configure if CC is already equal to gcc
+
+Changes in 1.0.5 (3 Jan 98)
+- Fix inflate to terminate gracefully when fed corrupted or invalid data
+- Use const for rommable constants in inflate
+- Eliminate memory leaks on error conditions in inflate
+- Removed some vestigial code in inflate
+- Update web address in README
+  
+Changes in 1.0.4 (24 Jul 96)
+- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
+  bit, so the decompressor could decompress all the correct data but went
+  on to attempt decompressing extra garbage data. This affected minigzip too.
+- zlibVersion and gzerror return const char* (needed for DLL)
+- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
+- use z_error only for DEBUG (avoid problem with DLLs)
+
+Changes in 1.0.3 (2 Jul 96)
+- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
+  small and medium models; this makes the library incompatible with previous
+  versions for these models. (No effect in large model or on other systems.)
+- return OK instead of BUF_ERROR if previous deflate call returned with
+  avail_out as zero but there is nothing to do
+- added memcmp for non STDC compilers
+- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
+- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
+- better check for 16-bit mode MSC (avoids problem with Symantec)
+
+Changes in 1.0.2 (23 May 96)
+- added Windows DLL support
+- added a function zlibVersion (for the DLL support)
+- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
+- Bytef is define's instead of typedef'd only for Borland C
+- avoid reading uninitialized memory in example.c
+- mention in README that the zlib format is now RFC1950
+- updated Makefile.dj2
+- added algorithm.doc
+
+Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
+- fix array overlay in deflate.c which sometimes caused bad compressed data
+- fix inflate bug with empty stored block
+- fix MSDOS medium model which was broken in 0.99
+- fix deflateParams() which could generated bad compressed data.
+- Bytef is define'd instead of typedef'ed (work around Borland bug)
+- added an INDEX file
+- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
+  Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
+- speed up adler32 for modern machines without auto-increment
+- added -ansi for IRIX in configure
+- static_init_done in trees.c is an int
+- define unlink as delete for VMS
+- fix configure for QNX
+- add configure branch for SCO and HPUX
+- avoid many warnings (unused variables, dead assignments, etc...)
+- no fdopen for BeOS
+- fix the Watcom fix for 32 bit mode (define FAR as empty)
+- removed redefinition of Byte for MKWERKS
+- work around an MWKERKS bug (incorrect merge of all .h files)
+
+Changes in 0.99 (27 Jan 96)
+- allow preset dictionary shared between compressor and decompressor
+- allow compression level 0 (no compression)
+- add deflateParams in zlib.h: allow dynamic change of compression level
+  and compression strategy.
+- test large buffers and deflateParams in example.c
+- add optional "configure" to build zlib as a shared library
+- suppress Makefile.qnx, use configure instead
+- fixed deflate for 64-bit systems (detected on Cray)
+- fixed inflate_blocks for 64-bit systems (detected on Alpha)
+- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
+- always return Z_BUF_ERROR when deflate() has nothing to do
+- deflateInit and inflateInit are now macros to allow version checking
+- prefix all global functions and types with z_ with -DZ_PREFIX
+- make falloc completely reentrant (inftrees.c)
+- fixed very unlikely race condition in ct_static_init
+- free in reverse order of allocation to help memory manager
+- use zlib-1.0/* instead of zlib/* inside the tar.gz
+- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
+  -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
+- allow gzread on concatenated .gz files
+- deflateEnd now returns Z_DATA_ERROR if it was premature
+- deflate is finally (?) fully deterministic (no matches beyond end of input)
+- Document Z_SYNC_FLUSH
+- add uninstall in Makefile
+- Check for __cpluplus in zlib.h
+- Better test in ct_align for partial flush
+- avoid harmless warnings for Borland C++
+- initialize hash_head in deflate.c
+- avoid warning on fdopen (gzio.c) for HP cc -Aa
+- include stdlib.h for STDC compilers
+- include errno.h for Cray
+- ignore error if ranlib doesn't exist
+- call ranlib twice for NeXTSTEP
+- use exec_prefix instead of prefix for libz.a
+- renamed ct_* as _tr_* to avoid conflict with applications
+- clear z->msg in inflateInit2 before any error return
+- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
+- fixed typo in zconf.h (_GNUC__ => __GNUC__)
+- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
+- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
+- in fcalloc, normalize pointer if size > 65520 bytes
+- don't use special fcalloc for 32 bit Borland C++
+- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
+- use Z_BINARY instead of BINARY
+- document that gzclose after gzdopen will close the file
+- allow "a" as mode in gzopen.
+- fix error checking in gzread
+- allow skipping .gz extra-field on pipes
+- added reference to Perl interface in README
+- put the crc table in FAR data (I dislike more and more the medium model :)
+- added get_crc_table
+- added a dimension to all arrays (Borland C can't count).
+- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
+- guard against multiple inclusion of *.h (for precompiled header on Mac)
+- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
+- don't use unsized arrays to avoid silly warnings by Visual C++:
+     warning C4746: 'inflate_mask' : unsized array treated as  '__far'
+     (what's wrong with far data in far model?).
+- define enum out of inflate_blocks_state to allow compilation with C++
+
+Changes in 0.95 (16 Aug 95)
+- fix MSDOS small and medium model (now easier to adapt to any compiler)
+- inlined send_bits
+- fix the final (:-) bug for deflate with flush (output was correct but
+  not completely flushed in rare occasions).
+- default window size is same for compression and decompression
+  (it's now sufficient to set MAX_WBITS in zconf.h).
+- voidp -> voidpf and voidnp -> voidp (for consistency with other
+  typedefs and because voidnp was not near in large model).
+
+Changes in 0.94 (13 Aug 95)
+- support MSDOS medium model
+- fix deflate with flush (could sometimes generate bad output)
+- fix deflateReset (zlib header was incorrectly suppressed)
+- added support for VMS
+- allow a compression level in gzopen()
+- gzflush now calls fflush
+- For deflate with flush, flush even if no more input is provided.
+- rename libgz.a as libz.a
+- avoid complex expression in infcodes.c triggering Turbo C bug
+- work around a problem with gcc on Alpha (in INSERT_STRING)
+- don't use inline functions (problem with some gcc versions)
+- allow renaming of Byte, uInt, etc... with #define.
+- avoid warning about (unused) pointer before start of array in deflate.c
+- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
+- avoid reserved word 'new' in trees.c
+
+Changes in 0.93 (25 June 95)
+- temporarily disable inline functions
+- make deflate deterministic
+- give enough lookahead for PARTIAL_FLUSH
+- Set binary mode for stdin/stdout in minigzip.c for OS/2
+- don't even use signed char in inflate (not portable enough)
+- fix inflate memory leak for segmented architectures
+
+Changes in 0.92 (3 May 95)
+- don't assume that char is signed (problem on SGI)
+- Clear bit buffer when starting a stored block
+- no memcpy on Pyramid
+- suppressed inftest.c
+- optimized fill_window, put longest_match inline for gcc
+- optimized inflate on stored blocks.
+- untabify all sources to simplify patches
+
+Changes in 0.91 (2 May 95)
+- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
+- Document the memory requirements in zconf.h
+- added "make install"
+- fix sync search logic in inflateSync
+- deflate(Z_FULL_FLUSH) now works even if output buffer too short
+- after inflateSync, don't scare people with just "lo world"
+- added support for DJGPP
+
+Changes in 0.9 (1 May 95)
+- don't assume that zalloc clears the allocated memory (the TurboC bug
+  was Mark's bug after all :)
+- let again gzread copy uncompressed data unchanged (was working in 0.71)
+- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
+- added a test of inflateSync in example.c
+- moved MAX_WBITS to zconf.h because users might want to change that.
+- document explicitly that zalloc(64K) on MSDOS must return a normalized
+  pointer (zero offset)
+- added Makefiles for Microsoft C, Turbo C, Borland C++
+- faster crc32()
+
+Changes in 0.8 (29 April 95)
+- added fast inflate (inffast.c)
+- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
+  is incompatible with previous versions of zlib which returned Z_OK.
+- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
+  (actually that was not a compiler bug, see 0.81 above)
+- gzread no longer reads one extra byte in certain cases
+- In gzio destroy(), don't reference a freed structure
+- avoid many warnings for MSDOS
+- avoid the ERROR symbol which is used by MS Windows
+
+Changes in 0.71 (14 April 95)
+- Fixed more MSDOS compilation problems :( There is still a bug with
+  TurboC large model.
+
+Changes in 0.7 (14 April 95)
+- Added full inflate support.
+- Simplified the crc32() interface. The pre- and post-conditioning
+  (one's complement) is now done inside crc32(). WARNING: this is
+  incompatible with previous versions; see zlib.h for the new usage.
+
+Changes in 0.61 (12 April 95)
+- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
+
+Changes in 0.6 (11 April 95)
+- added minigzip.c
+- added gzdopen to reopen a file descriptor as gzFile
+- added transparent reading of non-gziped files in gzread.
+- fixed bug in gzread (don't read crc as data)
+- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
+- don't allocate big arrays in the stack (for MSDOS)
+- fix some MSDOS compilation problems
+
+Changes in 0.5:
+- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
+  not yet Z_FULL_FLUSH.
+- support decompression but only in a single step (forced Z_FINISH)
+- added opaque object for zalloc and zfree.
+- added deflateReset and inflateReset
+- added a variable zlib_version for consistency checking.
+- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
+  Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
+
+Changes in 0.4:
+- avoid "zip" everywhere, use zlib instead of ziplib.
+- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
+  if compression method == 8.
+- added adler32 and crc32
+- renamed deflateOptions as deflateInit2, call one or the other but not both
+- added the method parameter for deflateInit2.
+- added inflateInit2
+- simplied considerably deflateInit and inflateInit by not supporting
+  user-provided history buffer. This is supported only in deflateInit2
+  and inflateInit2.
+
+Changes in 0.3:
+- prefix all macro names with Z_
+- use Z_FINISH instead of deflateEnd to finish compression.
+- added Z_HUFFMAN_ONLY
+- added gzerror()

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/FAQ
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/FAQ	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/FAQ	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,72 @@
+
+		Frequently Asked Questions about zlib
+
+
+If your question is not there, please check the zlib home page 
+http://www.cdrom.com/pub/infozip/zlib/ which may have more recent information.
+
+
+1) I need a Windows DLL
+2) I need a Visual Basic interface to zlib
+3) compress() returns Z_BUF_ERROR
+4) deflate or inflate returns Z_BUF_ERROR
+5) Where is the zlib documentation (man pages, etc...)?
+6) Why don't you use GNU autoconf, libtool, etc...?
+7) There is a bug in zlib.
+8) I get "undefined reference to gzputc"
+
+
+
+1) I need a Windows DLL
+
+  The zlib sources can be compiled without change to produce a DLL.
+  If you want a precompiled DLL, see http://www.winimage.com/zLibDll
+
+
+2) I need a Visual Basic interface to zlib
+
+  See http://www.tcfb.com/dowseware/cmp-z-it.zip
+      http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm
+  and contrib/visual-basic.txt
+
+3) compress() returns Z_BUF_ERROR
+
+  Make sure that before the call of compress, the length of the
+  compressed buffer is equal to the total size of the compressed buffer
+  and not zero.  For Visual Basic, check that this parameter is passed
+  by reference ("as any"), not by value ("as long").
+
+
+4) deflate or inflate returns Z_BUF_ERROR
+
+  Make sure that before the call avail_in and avail_out are not zero.
+
+
+5) Where is the zlib documentation (man pages, etc...)?
+
+  It's in zlib.h for the moment. Volunteers to transform this
+  to man pages, please contact jloup at gzip.org. Examples of zlib usage
+  are in the files example.c and minigzip.c.
+
+
+6) Why don't you use GNU autoconf, libtool, etc...?
+
+  Because we would like to keep zlib as a very small and simple package.
+  zlib is rather portable and doesn't need much configuration.
+
+
+7) There is a bug in zlib.
+
+  Most of the time, such problems are due to an incorrect usage
+  of zlib. Please try to reproduce the problem with a small
+  program and send us the corresponding source at zlib at quest.jpl.nasa.gov
+  Do not send multi-megabyte data files without prior agreement.
+
+
+8) I get "undefined reference to gzputc"
+
+  If "make test" produces something like
+     example.o(.text+0x174): 
+  check that you don't have old files libz.* in /usr/lib, /usr/local/lib
+  or /usr/X11R6/lib. Remove old versions then do "make install".
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/INDEX
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/INDEX	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/INDEX	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,86 @@
+ChangeLog		history of changes
+INDEX			this file
+FAQ			Frequently Asked Questions about zlib
+Make_vms.com		script for Vax/VMS
+Makefile		makefile for Unix (generated by configure)
+Makefile.in		makefile for Unix (template for configure)
+Makefile.riscos 	makefile for RISCOS
+README			guess what
+algorithm.txt		description of the (de)compression algorithm
+configure		configure script for Unix
+descrip.mms		makefile for Vax/VMS
+zlib.3			mini man page for zlib (volunteers to write full
+			man pages from zlib.h welcome. write to jloup at gzip.org)
+
+amiga/Makefile.sas	makefile for Amiga SAS/C
+amiga/Makefile.pup      makefile for Amiga powerUP SAS/C PPC
+
+msdos/Makefile.w32      makefile for Microsoft Visual C++ 32-bit
+msdos/Makefile.b32	makefile for Borland C++   32-bit
+msdos/Makefile.bor	makefile for Borland C/C++ 16-bit
+msdos/Makefile.dj2	makefile for DJGPP 2.x
+msdos/Makefile.emx	makefile for EMX 0.9c (32-bit DOS/OS2)
+msdos/Makefile.msc	makefile for Microsoft C 16-bit
+msdos/Makefile.tc	makefile for Turbo C
+msdos/Makefile.wat	makefile for Watcom C
+msdos/zlib.def        	definition file for Windows DLL
+msdos/zlib.rc         	definition file for Windows DLL
+
+nt/Makefile.nt		makefile for Windows NT
+nt/zlib.dnt		definition file for Windows NT DLL
+nt/Makefile.emx		makefile for EMX 0.9c/RSXNT 1.41 (Win32 Intel)
+nt/Makefile.gcc		makefile for Windows NT using GCC (mingw32)
+
+
+		zlib public header files (must be kept):
+zconf.h
+zlib.h
+
+		private source files used to build the zlib library:
+adler32.c
+compress.c
+crc32.c
+deflate.c
+deflate.h
+gzio.c
+infblock.c
+infblock.h
+infcodes.c
+infcodes.h
+inffast.c
+inffast.h
+inflate.c
+inftrees.c
+inftrees.h
+infutil.c
+infutil.h
+maketree.c
+trees.c
+uncompr.c
+zutil.c
+zutil.h
+
+		source files for sample programs:
+example.c
+minigzip.c
+
+		unsupported contribution by third parties
+
+contrib/asm386/ by Gilles Vollant <info at winimage.com>
+	386 asm code replacing longest_match().
+
+contrib/minizip/ by Gilles Vollant <info at winimage.com>
+	Mini zip and unzip based on zlib
+        See http://www.winimage.com/zLibDll/unzip.html
+
+contrib/iostream/ by Kevin Ruland <kevin at rodin.wustl.edu>
+        A C++ I/O streams interface to the zlib gz* functions
+
+contrib/iostream2/  by Tyge Løvset <Tyge.Lovset at cmr.no>
+	Another C++ I/O streams interface
+
+contrib/untgz/  by "Pedro A. Aranda Guti\irrez" <paag at tid.es>
+	A very simple tar.gz extractor using zlib
+
+contrib/visual-basic.txt by Carlos Rios <c_rios at sonda.cl>
+        How to use compress(), uncompress() and the gz* functions from VB.

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/Make_vms.com
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/Make_vms.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/Make_vms.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,115 @@
+$! make libz under VMS
+$! written by Martin P.J. Zinser <m.zinser at gsi.de>
+$!
+$! Look for the compiler used
+$!
+$ ccopt = "/noopt"
+$ if f$getsyi("HW_MODEL").ge.1024
+$ then
+$  ccopt = "/prefix=all"+ccopt
+$  comp  = "__decc__=1"
+$  if f$trnlnm("SYS").eqs."" then define sys sys$library:
+$ else
+$  if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
+$   then
+$    comp  = "__vaxc__=1"
+$    if f$trnlnm("SYS").eqs."" then define sys sys$library:
+$   else
+$    if f$trnlnm("SYS").eqs."" then define sys decc$library_include:
+$    ccopt = "/decc/prefix=all"+ccopt
+$    comp  = "__decc__=1"
+$  endif
+$ endif
+$!
+$! Build the thing plain or with mms
+$!
+$ write sys$output "Compiling Zlib sources ..."
+$ if f$search("SYS$SYSTEM:MMS.EXE").eqs.""
+$  then
+$   dele example.obj;*,minigzip.obj;*
+$   CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
+                adler32.c zlib.h zconf.h
+$   CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
+                compress.c zlib.h zconf.h
+$   CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
+                crc32.c zlib.h zconf.h
+$   CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
+                deflate.c deflate.h zutil.h zlib.h zconf.h
+$   CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" -
+                gzio.c zutil.h zlib.h zconf.h
+$   CALL MAKE infblock.OBJ "CC ''CCOPT' infblock" -
+                infblock.c zutil.h zlib.h zconf.h infblock.h
+$   CALL MAKE infcodes.OBJ "CC ''CCOPT' infcodes" -
+                infcodes.c zutil.h zlib.h zconf.h inftrees.h
+$   CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
+                inffast.c zutil.h zlib.h zconf.h inffast.h
+$   CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
+                inflate.c zutil.h zlib.h zconf.h infblock.h
+$   CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
+                inftrees.c zutil.h zlib.h zconf.h inftrees.h
+$   CALL MAKE infutil.OBJ "CC ''CCOPT' infutil" -
+                infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
+$   CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
+                trees.c deflate.h zutil.h zlib.h zconf.h
+$   CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
+                uncompr.c zlib.h zconf.h
+$   CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
+                zutil.c zutil.h zlib.h zconf.h
+$   write sys$output "Building Zlib ..."
+$   CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
+$   write sys$output "Building example..."
+$   CALL MAKE example.OBJ "CC ''CCOPT' example" -
+                example.c zlib.h zconf.h
+$   call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
+$!   write sys$output "Building minigzip..."
+$!   CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
+ !               minigzip.c zlib.h zconf.h
+$!   call make minigzip.exe - 
+ !               "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" - 
+ !               minigzip.obj libz.olb
+$  else
+$   mms/macro=('comp')
+$  endif
+$ write sys$output "Zlib build completed"
+$ exit
+$!
+$!
+$MAKE: SUBROUTINE   !SUBROUTINE TO CHECK DEPENDENCIES
+$ V = 'F$Verify(0)
+$! P1 = What we are trying to make
+$! P2 = Command to make it
+$! P3 - P8  What it depends on
+$
+$ If F$Search(P1) .Eqs. "" Then Goto Makeit
+$ Time = F$CvTime(F$File(P1,"RDT"))
+$arg=3
+$Loop:
+$       Argument = P'arg
+$       If Argument .Eqs. "" Then Goto Exit
+$       El=0
+$Loop2:
+$       File = F$Element(El," ",Argument)
+$       If File .Eqs. " " Then Goto Endl
+$       AFile = ""
+$Loop3:
+$       OFile = AFile
+$       AFile = F$Search(File)
+$       If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
+$       If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
+$       Goto Loop3
+$NextEL:
+$       El = El + 1
+$       Goto Loop2
+$EndL:
+$ arg=arg+1
+$ If arg .Le. 8 Then Goto Loop
+$ Goto Exit
+$
+$Makeit:
+$ VV=F$VERIFY(0)
+$ write sys$output P2
+$ 'P2
+$ VV='F$Verify(VV)
+$Exit:
+$ If V Then Set Verify
+$ENDSUBROUTINE

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,211 @@
+# Makefile for zlib
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h 
+
+# To compile and test, type:
+#   ./configure; make test
+# The call of configure is optional if you don't have special requirements
+# If you wish to build zlib as a shared library, use: ./configure -s
+
+# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
+#    make install
+# To install in $HOME instead of /usr/local, use:
+#    make install prefix=$HOME
+
+CC=cc
+
+CFLAGS=-O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-g -DDEBUG
+#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+#           -Wstrict-prototypes -Wmissing-prototypes
+
+LDFLAGS=-L. -lz
+LDSHARED=$(CC)
+CPP=$(CC) -E
+
+VER=1.1.3
+LIBS=libz.a
+SHAREDLIB=libz.so
+
+AR=ar
+ARFLAGS = rc
+RANLIB=ranlib
+TAR=tar
+SHELL=/bin/sh
+
+TOP_SRCDIR = ../..
+#prefix = /usr/local
+prefix = $(TOP_SRCDIR)/NewHDF
+exec_prefix = ${prefix}
+libdir = ${exec_prefix}/lib
+includedir = ${prefix}/include
+
+# installation program
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# ==> specify directories where to find inludes and library
+#     HDF library, and HDF utilities
+HDFINC= $(srcdir)/../src
+HDFLIB= $(srcdir)/../src
+HDFBIN= $(srcdir)/../bin
+
+#### makefile fragment from 'config/' goes here ##############
+## ------------------------ end of makefile fragments--------------------
+HDF_FLAGS       = \
+        CC="$(CC)" \
+        CFLAGS="$(CFLAGS)" \
+        FC="$(FC)" \
+        FFLAGS="$(FFLAGS)" \
+        RANLIB="$(RANLIB)" \
+        AR="$(AR)" \
+        ARFLAGS="$(ARFLAGS)" \
+        RM="$(RM)" \
+        RMFLAGS="$(RMFLAGS)" \
+        MACHINE="$(MACHINE)" 
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+OBJA =
+# to use the asm code: make OBJA=match.o
+
+TEST_OBJS = example.o minigzip.o
+
+DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \
+  algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
+  nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \
+  contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \
+  contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \
+  contrib/asm[56]86/*.S contrib/iostream/*.cpp \
+  contrib/iostream/*.h  contrib/iostream2/*.h contrib/iostream2/*.cpp \
+  contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \
+  contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \
+  contrib/delphi*/*.???
+
+all: example minigzip
+
+test: all
+	@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
+	echo hello world | ./minigzip | ./minigzip -d || \
+	  echo '		*** minigzip test FAILED ***' ; \
+	if ./example; then \
+	  echo '		*** zlib test OK ***'; \
+	else \
+	  echo '		*** zlib test FAILED ***'; \
+	fi
+
+libz.a: $(OBJS) $(OBJA)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
+	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
+
+match.o: match.S
+	$(CPP) match.S > _match.s
+	$(CC) -c _match.s
+	mv _match.o match.o
+	rm -f _match.s
+
+$(SHAREDLIB).$(VER): $(OBJS)
+	$(LDSHARED) -o $@ $(OBJS)
+	rm -f $(SHAREDLIB) $(SHAREDLIB).1
+	ln -s $@ $(SHAREDLIB)
+	ln -s $@ $(SHAREDLIB).1
+
+example: example.o $(LIBS)
+	$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
+
+minigzip: minigzip.o $(LIBS)
+	$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
+
+install-lib install: $(LIBS)
+	- at if [ ! -d $(includedir)  ]; then mkdir $(includedir); fi
+	- at if [ ! -d $(libdir) ]; then mkdir $(libdir); fi
+	cp zlib.h zconf.h $(includedir)
+	chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
+	cp $(LIBS) $(libdir)
+	cd $(libdir); chmod 644 $(LIBS)
+	-@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+	cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \
+	  rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
+	  ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \
+	  ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \
+	  (ldconfig || true)  >/dev/null 2>&1; \
+	fi
+# The ranlib in install is needed on NeXTSTEP which checks file times
+# ldconfig is for Linux
+
+uninstall:
+	cd $(includedir); \
+	v=$(VER); \
+	if test -f zlib.h; then \
+	  v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \
+          rm -f zlib.h zconf.h; \
+	fi; \
+	cd $(libdir); rm -f libz.a; \
+	if test -f $(SHAREDLIB).$$v; then \
+	  rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \
+	fi
+
+clean:
+	rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
+	   _match.s maketree
+
+distclean:	clean
+	rm -f config.status Makefile
+
+zip:
+	mv Makefile Makefile~; cp -p Makefile.in Makefile
+	rm -f test.c ztest*.c contrib/minizip/test.zip
+	v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
+	zip -ul9 zlib$$v $(DISTFILES)
+	mv Makefile~ Makefile
+
+dist:
+	mv Makefile Makefile~; cp -p Makefile.in Makefile
+	rm -f test.c ztest*.c contrib/minizip/test.zip
+	d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
+	rm -f $$d.tar.gz; \
+	if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
+	files=""; \
+	for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
+	cd ..; \
+	GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
+	if test ! -d $$d; then rm -f $$d; fi
+	mv Makefile~ Makefile
+
+tags:	
+	etags *.[ch]
+
+depend:
+	makedepend -- $(CFLAGS) -- *.[ch]
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+adler32.o: zlib.h zconf.h
+compress.o: zlib.h zconf.h
+crc32.o: zlib.h zconf.h
+deflate.o: deflate.h zutil.h zlib.h zconf.h
+example.o: zlib.h zconf.h
+gzio.o: zutil.h zlib.h zconf.h
+infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
+infcodes.o: zutil.h zlib.h zconf.h
+infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
+inffast.o: zutil.h zlib.h zconf.h inftrees.h
+inffast.o: infblock.h infcodes.h infutil.h inffast.h
+inflate.o: zutil.h zlib.h zconf.h infblock.h
+inftrees.o: zutil.h zlib.h zconf.h inftrees.h
+infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
+minigzip.o:  zlib.h zconf.h 
+trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
+uncompr.o: zlib.h zconf.h
+zutil.o: zutil.h zlib.h zconf.h  

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/Makefile.riscos
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/Makefile.riscos	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/Makefile.riscos	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+# Project:   zlib_1_03
+# Patched for zlib 1.1.2 rw at shadow.org.uk 19980430
+# test works out-of-the-box, installs `somewhere' on demand
+
+# Toolflags:
+CCflags = -c -depend !Depend -IC: -g -throwback  -DRISCOS  -fah 
+C++flags = -c -depend !Depend -IC: -throwback
+Linkflags = -aif -c++ -o $@ 
+ObjAsmflags = -throwback -NoCache -depend !Depend
+CMHGflags = 
+LibFileflags = -c -l -o $@ 
+Squeezeflags = -o $@
+
+# change the line below to where _you_ want the library installed.
+libdest = lib:zlib
+
+# Final targets:
+ at .lib:   @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \
+        @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \
+        @.o.uncompr @.o.zutil 
+        LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \
+        @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \
+        @.o.trees @.o.uncompr @.o.zutil 
+test:   @.minigzip @.example @.lib
+	@copy @.lib @.libc  A~C~DF~L~N~P~Q~RS~TV
+	@echo running tests: hang on.
+	@/@.minigzip -f -9 libc
+	@/@.minigzip -d libc-gz
+	@/@.minigzip -f -1 libc
+	@/@.minigzip -d libc-gz
+	@/@.minigzip -h -9 libc
+	@/@.minigzip -d libc-gz
+	@/@.minigzip -h -1 libc
+	@/@.minigzip -d libc-gz
+	@/@.minigzip -9 libc
+	@/@.minigzip -d libc-gz
+	@/@.minigzip -1 libc
+	@/@.minigzip -d libc-gz
+	@diff @.lib @.libc
+	@echo that should have reported '@.lib and @.libc identical' if you have diff.
+	@/@.example @.fred @.fred
+	@echo that will have given lots of hello!'s.
+
+ at .minigzip:   @.o.minigzip @.lib C:o.Stubs 
+        Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs 
+ at .example:   @.o.example @.lib C:o.Stubs 
+        Link $(Linkflags) @.o.example @.lib C:o.Stubs
+
+install: @.lib
+	cdir $(libdest)
+	cdir $(libdest).h
+	@copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV
+	@copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV
+	@copy @.lib $(libdest).lib  A~C~DF~L~N~P~Q~RS~TV
+	@echo okay, installed zlib in $(libdest)
+
+clean:; remove @.minigzip
+	remove @.example
+	remove @.libc
+	-wipe @.o.* F~r~cV
+	remove @.fred
+
+# User-editable dependencies:
+.c.o:
+        cc $(ccflags) -o $@ $<
+
+# Static dependencies:
+
+# Dynamic dependencies:
+o.example:	c.example
+o.example:	h.zlib
+o.example:	h.zconf
+o.minigzip:	c.minigzip
+o.minigzip:	h.zlib
+o.minigzip:	h.zconf
+o.adler32:	c.adler32
+o.adler32:	h.zlib
+o.adler32:	h.zconf
+o.compress:	c.compress
+o.compress:	h.zlib
+o.compress:	h.zconf
+o.crc32:	c.crc32
+o.crc32:	h.zlib
+o.crc32:	h.zconf
+o.deflate:	c.deflate
+o.deflate:	h.deflate
+o.deflate:	h.zutil
+o.deflate:	h.zlib
+o.deflate:	h.zconf
+o.gzio:	c.gzio
+o.gzio:	h.zutil
+o.gzio:	h.zlib
+o.gzio:	h.zconf
+o.infblock:	c.infblock
+o.infblock:	h.zutil
+o.infblock:	h.zlib
+o.infblock:	h.zconf
+o.infblock:	h.infblock
+o.infblock:	h.inftrees
+o.infblock:	h.infcodes
+o.infblock:	h.infutil
+o.infcodes:	c.infcodes
+o.infcodes:	h.zutil
+o.infcodes:	h.zlib
+o.infcodes:	h.zconf
+o.infcodes:	h.inftrees
+o.infcodes:	h.infblock
+o.infcodes:	h.infcodes
+o.infcodes:	h.infutil
+o.infcodes:	h.inffast
+o.inffast:	c.inffast
+o.inffast:	h.zutil
+o.inffast:	h.zlib
+o.inffast:	h.zconf
+o.inffast:	h.inftrees
+o.inffast:	h.infblock
+o.inffast:	h.infcodes
+o.inffast:	h.infutil
+o.inffast:	h.inffast
+o.inflate:	c.inflate
+o.inflate:	h.zutil
+o.inflate:	h.zlib
+o.inflate:	h.zconf
+o.inflate:	h.infblock
+o.inftrees:	c.inftrees
+o.inftrees:	h.zutil
+o.inftrees:	h.zlib
+o.inftrees:	h.zconf
+o.inftrees:	h.inftrees
+o.inftrees:	h.inffixed
+o.infutil:	c.infutil
+o.infutil:	h.zutil
+o.infutil:	h.zlib
+o.infutil:	h.zconf
+o.infutil:	h.infblock
+o.infutil:	h.inftrees
+o.infutil:	h.infcodes
+o.infutil:	h.infutil
+o.trees:	c.trees
+o.trees:	h.deflate
+o.trees:	h.zutil
+o.trees:	h.zlib
+o.trees:	h.zconf
+o.trees:	h.trees
+o.uncompr:	c.uncompr
+o.uncompr:	h.zlib
+o.uncompr:	h.zconf
+o.zutil:	c.zutil
+o.zutil:	h.zutil
+o.zutil:	h.zlib
+o.zutil:	h.zconf

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/README
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,148 @@
+zlib 1.1.3 is a general purpose data compression library.  All the code
+is thread safe.  The data format used by the zlib library
+is described by RFCs (Request for Comments) 1950 to 1952 in the files 
+ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
+format) and rfc1952.txt (gzip format). These documents are also available in
+other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
+
+All functions of the compression library are documented in the file zlib.h
+(volunteer to write man pages welcome, contact jloup at gzip.org). A usage
+example of the library is given in the file example.c which also tests that
+the library is working correctly. Another example is given in the file
+minigzip.c. The compression library itself is composed of all source files
+except example.c and minigzip.c.
+
+To compile all files and run the test program, follow the instructions
+given at the top of Makefile. In short "make test; make install"
+should work for most machines. For Unix: "configure; make test; make install"
+For MSDOS, use one of the special makefiles such as Makefile.msc.
+For VMS, use Make_vms.com or descrip.mms.
+
+Questions about zlib should be sent to <zlib at quest.jpl.nasa.gov>, or to
+Gilles Vollant <info at winimage.com> for the Windows DLL version.
+The zlib home page is http://www.cdrom.com/pub/infozip/zlib/
+The official zlib ftp site is ftp://ftp.cdrom.com/pub/infozip/zlib/
+Before reporting a problem, please check those sites to verify that
+you have the latest version of zlib; otherwise get the latest version and
+check whether the problem still exists or not.
+
+Mark Nelson <markn at tiny.com> wrote an article about zlib for the Jan. 1997
+issue of  Dr. Dobb's Journal; a copy of the article is available in
+http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm
+
+The changes made in version 1.1.3 are documented in the file ChangeLog.
+The main changes since 1.1.2 are:
+
+- fix "an inflate input buffer bug that shows up on rare but persistent
+  occasions" (Mark)
+- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
+- fix gzseek(..., SEEK_SET) in write mode
+- fix crc check after a gzeek (Frank Faubert)
+- fix miniunzip when the last entry in a zip file is itself a zip file
+  (J Lillge)
+- add contrib/asm586 and contrib/asm686 (Brian Raiter)
+  See http://www.muppetlabs.com/~breadbox/software/assembly.html
+- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
+- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
+- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
+- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
+- added a FAQ file
+
+plus many changes for portability.
+
+Unsupported third party contributions are provided in directory "contrib".
+
+A Java implementation of zlib is available in the Java Development Kit 1.1
+http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
+See the zlib home page http://www.cdrom.com/pub/infozip/zlib/ for details.
+
+A Perl interface to zlib written by Paul Marquess <pmarquess at bfsec.bt.co.uk>
+is in the CPAN (Comprehensive Perl Archive Network) sites, such as:
+ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib*
+
+A Python interface to zlib written by A.M. Kuchling <amk at magnet.com>
+is available in Python 1.5 and later versions, see
+http://www.python.org/doc/lib/module-zlib.html
+
+A zlib binding for TCL written by Andreas Kupries <a.kupries at westend.com>
+is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html
+
+An experimental package to read and write files in .zip format,
+written on top of zlib by Gilles Vollant <info at winimage.com>, is
+available at http://www.winimage.com/zLibDll/unzip.html
+and also in the contrib/minizip directory of zlib.
+
+
+Notes for some targets:
+
+- To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc
+  and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL
+  The zlib DLL support was initially done by Alessandro Iacopetti and is
+  now maintained by Gilles Vollant <info at winimage.com>. Check the zlib DLL
+  home page at http://www.winimage.com/zLibDll
+
+  From Visual Basic, you can call the DLL functions which do not take
+  a structure as argument: compress, uncompress and all gz* functions.
+  See contrib/visual-basic.txt for more information, or get
+  http://www.tcfb.com/dowseware/cmp-z-it.zip
+
+- For 64-bit Irix, deflate.c must be compiled without any optimization.
+  With -O, one libpng test fails. The test works in 32 bit mode (with
+  the -n32 compiler flag). The compiler bug has been reported to SGI.
+
+- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1   
+  it works when compiled with cc.
+
+- on Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1
+  is necessary to get gzprintf working correctly. This is done by configure.
+
+- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works
+  with other compilers. Use "make test" to check your compiler.
+
+- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
+
+- For Turbo C the small model is supported only with reduced performance to
+  avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
+
+- For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html
+  Per Harald Myrvang <perm at stud.cs.uit.no>
+
+
+Acknowledgments:
+
+  The deflate format used by zlib was defined by Phil Katz. The deflate
+  and zlib specifications were written by L. Peter Deutsch. Thanks to all the
+  people who reported problems and suggested various improvements in zlib;
+  they are too numerous to cite here.
+
+Copyright notice:
+
+ (C) 1995-1998 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup at gzip.org          madler at alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not*
+receiving lengthy legal documents to sign. The sources are provided
+for free but without warranty of any kind.  The library has been
+entirely written by Jean-loup Gailly and Mark Adler; it does not
+include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include
+in the file ChangeLog history information documenting your changes.

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/adler32.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/adler32.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/adler32.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,48 @@
+/* adler32.c -- compute the Adler-32 checksum of a data stream
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* @(#) $Id: adler32.c,v 1.5 1998/12/18 21:38:36 koziol Exp $ */
+
+#include "zlib.h"
+
+#define BASE 65521L /* largest prime smaller than 65536 */
+#define NMAX 5552
+/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
+
+#define DO1(buf,i)  {s1 += buf[i]; s2 += s1;}
+#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
+#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
+#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
+#define DO16(buf)   DO8(buf,0); DO8(buf,8);
+
+/* ========================================================================= */
+uLong ZEXPORT adler32(adler, buf, len)
+    uLong adler;
+    const Bytef *buf;
+    uInt len;
+{
+    unsigned long s1 = adler & 0xffff;
+    unsigned long s2 = (adler >> 16) & 0xffff;
+    int k;
+
+    if (buf == Z_NULL) return 1L;
+
+    while (len > 0) {
+        k = len < NMAX ? len : NMAX;
+        len -= k;
+        while (k >= 16) {
+            DO16(buf);
+	    buf += 16;
+            k -= 16;
+        }
+        if (k != 0) do {
+            s1 += *buf++;
+	    s2 += s1;
+        } while (--k);
+        s1 %= BASE;
+        s2 %= BASE;
+    }
+    return (s2 << 16) | s1;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/algorithm.txt
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/algorithm.txt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/algorithm.txt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,213 @@
+1. Compression algorithm (deflate)
+
+The deflation algorithm used by gzip (also zip and zlib) is a variation of
+LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in
+the input data.  The second occurrence of a string is replaced by a
+pointer to the previous string, in the form of a pair (distance,
+length).  Distances are limited to 32K bytes, and lengths are limited
+to 258 bytes. When a string does not occur anywhere in the previous
+32K bytes, it is emitted as a sequence of literal bytes.  (In this
+description, `string' must be taken as an arbitrary sequence of bytes,
+and is not restricted to printable characters.)
+
+Literals or match lengths are compressed with one Huffman tree, and
+match distances are compressed with another tree. The trees are stored
+in a compact form at the start of each block. The blocks can have any
+size (except that the compressed data for one block must fit in
+available memory). A block is terminated when deflate() determines that
+it would be useful to start another block with fresh trees. (This is
+somewhat similar to the behavior of LZW-based _compress_.)
+
+Duplicated strings are found using a hash table. All input strings of
+length 3 are inserted in the hash table. A hash index is computed for
+the next 3 bytes. If the hash chain for this index is not empty, all
+strings in the chain are compared with the current input string, and
+the longest match is selected.
+
+The hash chains are searched starting with the most recent strings, to
+favor small distances and thus take advantage of the Huffman encoding.
+The hash chains are singly linked. There are no deletions from the
+hash chains, the algorithm simply discards matches that are too old.
+
+To avoid a worst-case situation, very long hash chains are arbitrarily
+truncated at a certain length, determined by a runtime option (level
+parameter of deflateInit). So deflate() does not always find the longest
+possible match but generally finds a match which is long enough.
+
+deflate() also defers the selection of matches with a lazy evaluation
+mechanism. After a match of length N has been found, deflate() searches for
+a longer match at the next input byte. If a longer match is found, the
+previous match is truncated to a length of one (thus producing a single
+literal byte) and the process of lazy evaluation begins again. Otherwise,
+the original match is kept, and the next match search is attempted only N
+steps later.
+
+The lazy match evaluation is also subject to a runtime parameter. If
+the current match is long enough, deflate() reduces the search for a longer
+match, thus speeding up the whole process. If compression ratio is more
+important than speed, deflate() attempts a complete second search even if
+the first match is already long enough.
+
+The lazy match evaluation is not performed for the fastest compression
+modes (level parameter 1 to 3). For these fast modes, new strings
+are inserted in the hash table only when no match was found, or
+when the match is not too long. This degrades the compression ratio
+but saves time since there are both fewer insertions and fewer searches.
+
+
+2. Decompression algorithm (inflate)
+
+2.1 Introduction
+
+The real question is, given a Huffman tree, how to decode fast.  The most
+important realization is that shorter codes are much more common than
+longer codes, so pay attention to decoding the short codes fast, and let
+the long codes take longer to decode.
+
+inflate() sets up a first level table that covers some number of bits of
+input less than the length of longest code.  It gets that many bits from the
+stream, and looks it up in the table.  The table will tell if the next
+code is that many bits or less and how many, and if it is, it will tell
+the value, else it will point to the next level table for which inflate()
+grabs more bits and tries to decode a longer code.
+
+How many bits to make the first lookup is a tradeoff between the time it
+takes to decode and the time it takes to build the table.  If building the
+table took no time (and if you had infinite memory), then there would only
+be a first level table to cover all the way to the longest code.  However,
+building the table ends up taking a lot longer for more bits since short
+codes are replicated many times in such a table.  What inflate() does is
+simply to make the number of bits in the first table a variable, and set it
+for the maximum speed.
+
+inflate() sends new trees relatively often, so it is possibly set for a
+smaller first level table than an application that has only one tree for
+all the data.  For inflate, which has 286 possible codes for the
+literal/length tree, the size of the first table is nine bits.  Also the
+distance trees have 30 possible values, and the size of the first table is
+six bits.  Note that for each of those cases, the table ended up one bit
+longer than the ``average'' code length, i.e. the code length of an
+approximately flat code which would be a little more than eight bits for
+286 symbols and a little less than five bits for 30 symbols.  It would be
+interesting to see if optimizing the first level table for other
+applications gave values within a bit or two of the flat code size.
+
+
+2.2 More details on the inflate table lookup
+
+Ok, you want to know what this cleverly obfuscated inflate tree actually  
+looks like.  You are correct that it's not a Huffman tree.  It is simply a  
+lookup table for the first, let's say, nine bits of a Huffman symbol.  The  
+symbol could be as short as one bit or as long as 15 bits.  If a particular  
+symbol is shorter than nine bits, then that symbol's translation is duplicated
+in all those entries that start with that symbol's bits.  For example, if the  
+symbol is four bits, then it's duplicated 32 times in a nine-bit table.  If a  
+symbol is nine bits long, it appears in the table once.
+
+If the symbol is longer than nine bits, then that entry in the table points  
+to another similar table for the remaining bits.  Again, there are duplicated  
+entries as needed.  The idea is that most of the time the symbol will be short
+and there will only be one table look up.  (That's whole idea behind data  
+compression in the first place.)  For the less frequent long symbols, there  
+will be two lookups.  If you had a compression method with really long  
+symbols, you could have as many levels of lookups as is efficient.  For  
+inflate, two is enough.
+
+So a table entry either points to another table (in which case nine bits in  
+the above example are gobbled), or it contains the translation for the symbol  
+and the number of bits to gobble.  Then you start again with the next  
+ungobbled bit.
+
+You may wonder: why not just have one lookup table for how ever many bits the  
+longest symbol is?  The reason is that if you do that, you end up spending  
+more time filling in duplicate symbol entries than you do actually decoding.   
+At least for deflate's output that generates new trees every several 10's of  
+kbytes.  You can imagine that filling in a 2^15 entry table for a 15-bit code  
+would take too long if you're only decoding several thousand symbols.  At the  
+other extreme, you could make a new table for every bit in the code.  In fact,
+that's essentially a Huffman tree.  But then you spend two much time  
+traversing the tree while decoding, even for short symbols.
+
+So the number of bits for the first lookup table is a trade of the time to  
+fill out the table vs. the time spent looking at the second level and above of
+the table.
+
+Here is an example, scaled down:
+
+The code being decoded, with 10 symbols, from 1 to 6 bits long:
+
+A: 0
+B: 10
+C: 1100
+D: 11010
+E: 11011
+F: 11100
+G: 11101
+H: 11110
+I: 111110
+J: 111111
+
+Let's make the first table three bits long (eight entries):
+
+000: A,1
+001: A,1
+010: A,1
+011: A,1
+100: B,2
+101: B,2
+110: -> table X (gobble 3 bits)
+111: -> table Y (gobble 3 bits)
+
+Each entry is what the bits decode to and how many bits that is, i.e. how  
+many bits to gobble.  Or the entry points to another table, with the number of
+bits to gobble implicit in the size of the table.
+
+Table X is two bits long since the longest code starting with 110 is five bits
+long:
+
+00: C,1
+01: C,1
+10: D,2
+11: E,2
+
+Table Y is three bits long since the longest code starting with 111 is six  
+bits long:
+
+000: F,2
+001: F,2
+010: G,2
+011: G,2
+100: H,2
+101: H,2
+110: I,3
+111: J,3
+
+So what we have here are three tables with a total of 20 entries that had to  
+be constructed.  That's compared to 64 entries for a single table.  Or  
+compared to 16 entries for a Huffman tree (six two entry tables and one four  
+entry table).  Assuming that the code ideally represents the probability of  
+the symbols, it takes on the average 1.25 lookups per symbol.  That's compared
+to one lookup for the single table, or 1.66 lookups per symbol for the  
+Huffman tree.
+
+There, I think that gives you a picture of what's going on.  For inflate, the  
+meaning of a particular symbol is often more than just a letter.  It can be a  
+byte (a "literal"), or it can be either a length or a distance which  
+indicates a base value and a number of bits to fetch after the code that is  
+added to the base value.  Or it might be the special end-of-block code.  The  
+data structures created in inftrees.c try to encode all that information  
+compactly in the tables.
+
+
+Jean-loup Gailly        Mark Adler
+jloup at gzip.org          madler at alumni.caltech.edu
+
+
+References:
+
+[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data
+Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3,
+pp. 337-343.
+
+``DEFLATE Compressed Data Format Specification'' available in
+ftp://ds.internic.net/rfc/rfc1951.txt

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/amiga/Makefile.pup
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/amiga/Makefile.pup	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/amiga/Makefile.pup	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,66 @@
+# Amiga powerUP (TM) Makefile
+# makefile for libpng and SAS C V6.58/7.00 PPC compiler
+# Copyright (C) 1998 by Andreas R. Kleinert
+
+CC       = scppc
+CFLAGS   = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \
+           OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8
+LIBNAME  = libzip.a
+AR       = ppc-amigaos-ar
+AR_FLAGS = cr
+RANLIB   = ppc-amigaos-ranlib
+LDFLAGS  = -r -o
+LDLIBS   = LIB:scppc.a
+LN       = ppc-amigaos-ld
+RM       = delete quiet
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example minigzip
+
+test: all
+        example
+        echo hello world | minigzip | minigzip -d
+
+$(LIBNAME): $(OBJS)
+            $(AR) $(AR_FLAGS) $@ $(OBJS)
+            $(RANLIB) $@
+
+example: example.o $(LIBNAME)
+        $(LN) $(LDFLAGS) example LIB:c_ppc.o example.o $(LIBNAME) $(LDLIBS) LIB:end.o
+
+minigzip: minigzip.o $(LIBNAME)
+        $(LN) $(LDFLAGS) minigzip LIB:c_ppc.o minigzip.o $(LIBNAME) $(LDLIBS) LIB:end.o
+
+clean:
+        $(RM) *.o example minigzip $(LIBNAME) foo.gz
+
+zip:
+        zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \
+          descrip.mms *.[ch]
+
+tgz:
+        cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
+          zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch]
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+adler32.o: zutil.h zlib.h zconf.h
+compress.o: zlib.h zconf.h
+crc32.o: zutil.h zlib.h zconf.h
+deflate.o: deflate.h zutil.h zlib.h zconf.h
+example.o: zlib.h zconf.h
+gzio.o: zutil.h zlib.h zconf.h
+infblock.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
+infcodes.o: zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
+inffast.o: zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
+inflate.o: zutil.h zlib.h zconf.h infblock.h
+inftrees.o: zutil.h zlib.h zconf.h inftrees.h
+infutil.o: zutil.h zlib.h zconf.h inftrees.h infutil.h
+minigzip.o: zlib.h zconf.h
+trees.o: deflate.h zutil.h zlib.h zconf.h
+uncompr.o: zlib.h zconf.h
+zutil.o: zutil.h zlib.h zconf.h

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/amiga/Makefile.sas
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/amiga/Makefile.sas	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/amiga/Makefile.sas	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,64 @@
+# SMakefile for zlib
+# Modified from the standard UNIX Makefile Copyright Jean-loup Gailly
+# Osma Ahvenlampi <Osma.Ahvenlampi at hut.fi>
+# Amiga, SAS/C 6.56 & Smake
+
+CC=sc
+CFLAGS=OPT
+#CFLAGS=OPT CPU=68030
+#CFLAGS=DEBUG=LINE
+LDFLAGS=LIB z.lib
+
+SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
+       NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX 
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: SCOPTIONS example minigzip
+
+test: all
+	`cd`/example
+	echo hello world | minigzip | minigzip -d 
+
+install: z.lib
+	copy zlib.h zconf.h INCLUDE: clone
+	copy z.lib LIB: clone
+
+z.lib: $(OBJS)
+	oml z.lib r $(OBJS)
+
+example: example.o z.lib
+	$(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS)
+
+minigzip: minigzip.o z.lib
+	$(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS)
+
+clean:
+	-delete force quiet *.o example minigzip z.lib foo.gz *.lnk SCOPTIONS
+
+SCOPTIONS: Smakefile
+        copy to $@ <from <
+$(SCOPTIONS)
+<
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+adler32.o: zutil.h zlib.h zconf.h
+compress.o: zlib.h zconf.h
+crc32.o: zutil.h zlib.h zconf.h
+deflate.o: deflate.h zutil.h zlib.h zconf.h
+example.o: zlib.h zconf.h
+gzio.o: zutil.h zlib.h zconf.h
+infblock.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
+infcodes.o: zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
+inffast.o: zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
+inflate.o: zutil.h zlib.h zconf.h infblock.h
+inftrees.o: zutil.h zlib.h zconf.h inftrees.h
+infutil.o: zutil.h zlib.h zconf.h inftrees.h infutil.h
+minigzip.o: zlib.h zconf.h
+trees.o: deflate.h zutil.h zlib.h zconf.h
+uncompr.o: zlib.h zconf.h
+zutil.o: zutil.h zlib.h zconf.h

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/compress.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/compress.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/compress.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,68 @@
+/* compress.c -- compress a memory buffer
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* @(#) $Id: compress.c,v 1.5 1998/12/18 21:38:38 koziol Exp $ */
+
+#include "zlib.h"
+
+/* ===========================================================================
+     Compresses the source buffer into the destination buffer. The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer. Upon entry, destLen is the total size of the
+   destination buffer, which must be at least 0.1% larger than sourceLen plus
+   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
+    Bytef *dest;
+    uLongf *destLen;
+    const Bytef *source;
+    uLong sourceLen;
+    int level;
+{
+    z_stream stream;
+    int err;
+
+    stream.next_in = (Bytef*)source;
+    stream.avail_in = (uInt)sourceLen;
+#ifdef MAXSEG_64K
+    /* Check for source > 64K on 16-bit machine: */
+    if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+#endif
+    stream.next_out = dest;
+    stream.avail_out = (uInt)*destLen;
+    if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+    stream.zalloc = (alloc_func)0;
+    stream.zfree = (free_func)0;
+    stream.opaque = (voidpf)0;
+
+    err = deflateInit(&stream, level);
+    if (err != Z_OK) return err;
+
+    err = deflate(&stream, Z_FINISH);
+    if (err != Z_STREAM_END) {
+        deflateEnd(&stream);
+        return err == Z_OK ? Z_BUF_ERROR : err;
+    }
+    *destLen = stream.total_out;
+
+    err = deflateEnd(&stream);
+    return err;
+}
+
+/* ===========================================================================
+ */
+int ZEXPORT compress (dest, destLen, source, sourceLen)
+    Bytef *dest;
+    uLongf *destLen;
+    const Bytef *source;
+    uLong sourceLen;
+{
+    return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/configure.gnu
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/configure.gnu	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/configure.gnu	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,212 @@
+#!/bin/sh
+# configure script for zlib. This script is needed only if
+# you wish to build a shared library and your system supports them,
+# of if you need special compiler, flags or install directory.
+# Otherwise, you can just use directly "make test; make install"
+#
+# To create a shared library, use "configure --shared"; by default a static
+# library is created. If the primitive shared library support provided here
+# does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz
+#
+# To impose specific compiler or flags or install directory, use for example:
+#    prefix=$HOME CC=cc CFLAGS="-O4" ./configure
+# or for csh/tcsh users:
+#    (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
+# LDSHARED is the command to be used to create a shared library
+
+# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
+# If you have problems, try without defining CC and CFLAGS before reporting
+# an error.
+
+LIBS=libz.a
+SHAREDLIB=libz.so
+VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
+AR=${AR-"ar rc"}
+RANLIB=${RANLIB-"ranlib"}
+prefix=${prefix-/usr/local}
+exec_prefix=${exec_prefix-'${prefix}'}
+libdir=${libdir-'${exec_prefix}/lib'}
+includedir=${includedir-'${prefix}/include'}
+shared_ext='.so'
+shared=0
+gcc=0
+old_cc="$CC"
+old_cflags="$CFLAGS"
+
+while test $# -ge 1
+do
+case "$1" in
+    -h* | --h*)
+      echo 'usage:'
+      echo '  configure [--shared] [--prefix=PREFIX]  [--exec_prefix=EXPREFIX]'
+      echo '     [--libdir=LIBDIR] [--includedir=INCLUDEDIR]'
+        exit 0;;
+    -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
+    -e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
+    -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
+    -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
+    -p* | --p*) prefix="$2"; shift; shift;;
+    -e* | --e*) exec_prefix="$2"; shift; shift;;
+    -l* | --l*) libdir="$2"; shift; shift;;
+    -i* | --i*) includedir="$2"; shift; shift;;
+    -s* | --s*) shared=1; shift;;
+    esac
+done
+
+test=ztest$$
+cat > $test.c <<EOF
+extern int getchar();
+int hello() {return getchar();}
+EOF
+
+test -z "$CC" && echo Checking for gcc...
+cc=${CC-gcc}
+cflags=${CFLAGS-"-O3"}
+# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
+case "$cc" in
+  *gcc*) gcc=1;;
+esac
+
+if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
+  CC="$cc"
+  SFLAGS=${CFLAGS-"-fPIC -O3"}
+  CFLAGS="$cflags"
+  case `(uname -s || echo unknown) 2>/dev/null` in
+  Linux | linux) LDSHARED=${LDSHARED-"gcc -shared -Wl,-soname,libz.so.1"};;
+  *)             LDSHARED=${LDSHARED-"gcc -shared"};;
+  esac
+else
+  # find system name and corresponding cc options
+  CC=${CC-cc}
+  case `(uname -sr || echo unknown) 2>/dev/null` in
+  HP-UX*)    SFLAGS=${CFLAGS-"-O +z"}
+	     CFLAGS=${CFLAGS-"-O"}
+#	     LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
+	     LDSHARED=${LDSHARED-"ld -b"}
+	     shared_ext='.sl'
+	     SHAREDLIB='libz.sl';;
+  IRIX*)     SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
+	     CFLAGS=${CFLAGS-"-ansi -O2"}
+	     LDSHARED=${LDSHARED-"cc -shared"};;
+  OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
+	     CFLAGS=${CFLAGS-"-O -std1"}
+	     LDSHARED=${LDSHARED-"cc -shared  -Wl,-soname,$SHAREDLIB -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};;
+  OSF1*)     SFLAGS=${CFLAGS-"-O -std1"}
+	     CFLAGS=${CFLAGS-"-O -std1"}
+	     LDSHARED=${LDSHARED-"cc -shared"};;
+  QNX*)      SFLAGS=${CFLAGS-"-4 -O"}
+             CFLAGS=${CFLAGS-"-4 -O"}
+	     LDSHARED=${LDSHARED-"cc"}
+             RANLIB=${RANLIB-"true"}
+             AR="cc -A";;
+  SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
+	     CFLAGS=${CFLAGS-"-O3"}
+	     LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};;
+  SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."}
+             CFLAGS=${CFLAGS-"-fast -xcg89"}
+	     LDSHARED=${LDSHARED-"cc -G"};;
+  SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
+	     CFLAGS=${CFLAGS-"-O2"}
+	     LDSHARED=${LDSHARED-"ld"};;
+  UNIX_System_V\ 4.2.0) 
+	     SFLAGS=${CFLAGS-"-KPIC -O"}
+	     CFLAGS=${CFLAGS-"-O"}
+	     LDSHARED=${LDSHARED-"cc -G"};;
+  UNIX_SV\ 4.2MP)
+	     SFLAGS=${CFLAGS-"-Kconform_pic -O"}
+	     CFLAGS=${CFLAGS-"-O"}
+	     LDSHARED=${LDSHARED-"cc -G"};;
+  # send working options for other systems to support at gzip.org
+  *)         SFLAGS=${CFLAGS-"-O"}
+	     CFLAGS=${CFLAGS-"-O"}
+	     LDSHARED=${LDSHARED-"cc -shared"};;
+  esac
+fi
+
+if test $shared -eq 1; then
+  echo Checking for shared library support...
+  # we must test in two steps (cc then ld), required at least on SunOS 4.x
+  if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
+     test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
+    CFLAGS="$SFLAGS"
+    LIBS="$SHAREDLIB.$VER"
+    echo Building shared library $SHAREDLIB.$VER with $CC.
+  elif test -z "$old_cc" -a -z "$old_cflags"; then
+    echo No shared library suppport.
+    shared=0;
+  else
+    echo 'No shared library suppport; try without defining CC and CFLAGS'
+    shared=0;
+  fi
+fi
+if test $shared -eq 0; then
+  LDSHARED="$CC"
+  echo Building static library $LIBS version $VER with $CC.
+fi
+
+cat > $test.c <<EOF
+#include <unistd.h>
+int main() { return 0; }
+EOF
+if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+  CFLAGS="$CFLAGS -DHAVE_UNISTD_H"
+  echo "Checking for unistd.h... Yes."
+else
+  echo "Checking for unistd.h... No."
+fi
+
+cat > $test.c <<EOF
+#include <errno.h>
+int main() { return 0; }
+EOF
+if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+  echo "Checking for errno.h...	 Yes."
+else
+  echo "Checking for errno.h...	 No."
+  CFLAGS="$CFLAGS -DNO_ERRNO_H"
+fi
+
+cat > $test.c <<EOF
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+caddr_t hello() {
+  return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0); 
+}
+EOF
+if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+  CFLAGS="$CFLAGS -DUSE_MMAP"
+  echo Checking for mmap support... Yes.
+else
+  echo Checking for mmap support... No.
+fi
+
+CPP=${CPP-"$CC -E"}
+case $CFLAGS in
+  *ASMV*)
+    if test "`nm $test.o | grep _hello`" = ""; then
+      CPP="$CPP -DNO_UNDERLINE"
+      echo Checking for underline in external names... No.
+    else
+      echo Checking for underline in external names... Yes.
+    fi;;
+esac
+
+rm -f $test.[co] $test$shared_ext
+
+# udpate Makefile
+sed < Makefile.in "
+/^CC *=/s%=.*%=$CC%
+/^CFLAGS *=/s%=.*%=$CFLAGS%
+/^CPP *=/s%=.*%=$CPP%
+/^LDSHARED *=/s%=.*%=$LDSHARED%
+/^LIBS *=/s%=.*%=$LIBS%
+/^SHAREDLIB *=/s%=.*%=$SHAREDLIB%
+/^AR *=/s%=.*%=$AR%
+/^RANLIB *=/s%=.*%=$RANLIB%
+/^VER *=/s%=.*%=$VER%
+/^prefix *=/s%=.*%=$prefix%
+/^exec_prefix *=/s%=.*%=$exec_prefix%
+/^libdir *=/s%=.*%=$libdir%
+/^includedir *=/s%=.*%=$includedir%
+" > Makefile


Property changes on: packages/libhdf4/branches/upstream/current/hdf/zlib/configure.gnu
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/README.contrib
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/README.contrib	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/README.contrib	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,34 @@
+All files under this contrib directory are UNSUPPORTED. There were
+provided by users of zlib and were not tested by the authors of zlib.
+Use at your own risk. Please contact the authors of the contributions
+for help about these, not the zlib authors. Thanks.
+
+
+asm386/     by Gilles Vollant <info at winimage.com>
+	386 asm code replacing longest_match(), for Visual C++ 4.2 and ML 6.11c
+
+asm586/ and asm686/    by Brian Raiter <breadbox at muppetlabs.com> 
+        asm code for Pentium and Pentium Pro
+        See http://www.muppetlabs.com/~breadbox/software/assembly.html
+
+delphi/      by Bob Dellaca <bobdl at xtra.co.nz>
+	Support for Delphi
+
+delphi2/     by Davide Moretti <dave at rimini.com>
+        Another support for C++Builder and Delphi
+
+minizip/    by Gilles Vollant <info at winimage.com>
+	Mini zip and unzip based on zlib
+        See http://www.winimage.com/zLibDll/unzip.html
+
+iostream/   by Kevin Ruland <kevin at rodin.wustl.edu>
+        A C++ I/O streams interface to the zlib gz* functions
+
+iostream2/  by Tyge Løvset <Tyge.Lovset at cmr.no>
+	Another C++ I/O streams interface
+
+untgz/      by "Pedro A. Aranda Guti\irrez" <paag at tid.es>
+	A very simple tar.gz file extractor using zlib
+
+visual-basic.txt by Carlos Rios <c_rios at sonda.cl>
+        How to use compress(), uncompress() and the gz* functions from VB.

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/gvmat32.asm
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/gvmat32.asm	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/gvmat32.asm	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,559 @@
+;
+; gvmat32.asm -- Asm portion of the optimized longest_match for 32 bits x86
+; Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.
+; File written by Gilles Vollant, by modifiying the longest_match
+;  from Jean-loup Gailly in deflate.c
+; It need wmask == 0x7fff
+;     (assembly code is faster with a fixed wmask)
+;
+; For Visual C++ 4.2 and ML 6.11c (version in directory \MASM611C of Win95 DDK)
+;   I compile with : "ml /coff /Zi /c gvmat32.asm"
+;
+
+;uInt longest_match_7fff(s, cur_match)
+;    deflate_state *s;
+;    IPos cur_match;                             /* current match */
+
+        NbStack         equ     76
+        cur_match       equ     dword ptr[esp+NbStack-0]
+        str_s           equ     dword ptr[esp+NbStack-4]
+; 5 dword on top (ret,ebp,esi,edi,ebx)
+        adrret          equ     dword ptr[esp+NbStack-8]
+        pushebp         equ     dword ptr[esp+NbStack-12]
+        pushedi         equ     dword ptr[esp+NbStack-16]
+        pushesi         equ     dword ptr[esp+NbStack-20]
+        pushebx         equ     dword ptr[esp+NbStack-24]
+
+        chain_length    equ     dword ptr [esp+NbStack-28]
+        limit           equ     dword ptr [esp+NbStack-32]
+        best_len        equ     dword ptr [esp+NbStack-36]
+        window          equ     dword ptr [esp+NbStack-40]
+        prev            equ     dword ptr [esp+NbStack-44]
+        scan_start      equ      word ptr [esp+NbStack-48]
+        wmask           equ     dword ptr [esp+NbStack-52]
+        match_start_ptr equ     dword ptr [esp+NbStack-56]
+        nice_match      equ     dword ptr [esp+NbStack-60]
+        scan            equ     dword ptr [esp+NbStack-64]
+
+        windowlen       equ     dword ptr [esp+NbStack-68]
+        match_start     equ     dword ptr [esp+NbStack-72]
+        strend          equ     dword ptr [esp+NbStack-76]
+        NbStackAdd      equ     (NbStack-24)
+
+    .386p
+
+    name    gvmatch
+    .MODEL  FLAT
+
+
+
+;  all the +4 offsets are due to the addition of pending_buf_size (in zlib
+;  in the deflate_state structure since the asm code was first written
+;  (if you compile with zlib 1.0.4 or older, remove the +4).
+;  Note : these value are good with a 8 bytes boundary pack structure
+    dep_chain_length    equ     70h+4
+    dep_window          equ     2ch+4
+    dep_strstart        equ     60h+4
+    dep_prev_length     equ     6ch+4
+    dep_nice_match      equ     84h+4
+    dep_w_size          equ     20h+4
+    dep_prev            equ     34h+4
+    dep_w_mask          equ     28h+4
+    dep_good_match      equ     80h+4
+    dep_match_start     equ     64h+4
+    dep_lookahead       equ     68h+4
+
+
+_TEXT                   segment
+
+IFDEF NOUNDERLINE
+                        public  longest_match_7fff
+;                        public  match_init
+ELSE
+                        public  _longest_match_7fff
+;                        public  _match_init
+ENDIF
+
+    MAX_MATCH           equ     258
+    MIN_MATCH           equ     3
+    MIN_LOOKAHEAD       equ     (MAX_MATCH+MIN_MATCH+1)
+
+
+
+IFDEF NOUNDERLINE
+;match_init      proc near
+;                ret
+;match_init      endp
+ELSE
+;_match_init     proc near
+;                ret
+;_match_init     endp
+ENDIF
+
+
+IFDEF NOUNDERLINE
+longest_match_7fff   proc near
+ELSE
+_longest_match_7fff  proc near
+ENDIF
+
+        mov     edx,[esp+4]
+
+
+
+        push    ebp
+        push    edi
+        push    esi
+        push    ebx
+
+        sub     esp,NbStackAdd
+
+; initialize or check the variables used in match.asm.
+        mov     ebp,edx
+
+; chain_length = s->max_chain_length
+; if (prev_length>=good_match) chain_length >>= 2
+        mov     edx,[ebp+dep_chain_length]
+        mov     ebx,[ebp+dep_prev_length]
+        cmp     [ebp+dep_good_match],ebx
+        ja      noshr
+        shr     edx,2
+noshr:
+; we increment chain_length because in the asm, the --chain_lenght is in the beginning of the loop
+        inc     edx
+        mov     edi,[ebp+dep_nice_match]
+        mov     chain_length,edx
+        mov     eax,[ebp+dep_lookahead]
+        cmp     eax,edi
+; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+        jae     nolookaheadnicematch
+        mov     edi,eax
+nolookaheadnicematch:
+; best_len = s->prev_length
+        mov     best_len,ebx
+
+; window = s->window
+        mov     esi,[ebp+dep_window]
+        mov     ecx,[ebp+dep_strstart]
+        mov     window,esi
+
+        mov     nice_match,edi
+; scan = window + strstart
+        add     esi,ecx
+        mov     scan,esi
+; dx = *window
+        mov     dx,word ptr [esi]
+; bx = *(window+best_len-1)
+        mov     bx,word ptr [esi+ebx-1]
+        add     esi,MAX_MATCH-1
+; scan_start = *scan
+        mov     scan_start,dx
+; strend = scan + MAX_MATCH-1
+        mov     strend,esi
+; bx = scan_end = *(window+best_len-1)
+
+;    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+;        s->strstart - (IPos)MAX_DIST(s) : NIL;
+
+        mov     esi,[ebp+dep_w_size]
+        sub     esi,MIN_LOOKAHEAD
+; here esi = MAX_DIST(s)
+        sub     ecx,esi
+        ja      nodist
+        xor     ecx,ecx
+nodist:
+        mov     limit,ecx
+
+; prev = s->prev
+        mov     edx,[ebp+dep_prev]
+        mov     prev,edx
+
+;
+        mov     edx,dword ptr [ebp+dep_match_start]
+        mov     bp,scan_start
+        mov     eax,cur_match
+        mov     match_start,edx
+
+        mov     edx,window
+        mov     edi,edx
+        add     edi,best_len
+        mov     esi,prev
+        dec     edi
+; windowlen = window + best_len -1
+        mov     windowlen,edi
+
+        jmp     beginloop2
+        align   4
+
+; here, in the loop
+;       eax = ax = cur_match
+;       ecx = limit
+;        bx = scan_end
+;        bp = scan_start
+;       edi = windowlen (window + best_len -1)
+;       esi = prev
+
+
+;// here; chain_length <=16
+normalbeg0add16:
+        add     chain_length,16
+        jz      exitloop
+normalbeg0:
+        cmp     word ptr[edi+eax],bx
+        je      normalbeg2noroll
+rcontlabnoroll:
+; cur_match = prev[cur_match & wmask]
+        and     eax,7fffh
+        mov     ax,word ptr[esi+eax*2]
+; if cur_match > limit, go to exitloop
+        cmp     ecx,eax
+        jnb     exitloop
+; if --chain_length != 0, go to exitloop
+        dec     chain_length
+        jnz     normalbeg0
+        jmp     exitloop
+
+normalbeg2noroll:
+; if (scan_start==*(cur_match+window)) goto normalbeg2
+        cmp     bp,word ptr[edx+eax]
+        jne     rcontlabnoroll
+        jmp     normalbeg2
+
+contloop3:
+        mov     edi,windowlen
+
+; cur_match = prev[cur_match & wmask]
+        and     eax,7fffh
+        mov     ax,word ptr[esi+eax*2]
+; if cur_match > limit, go to exitloop
+        cmp     ecx,eax
+jnbexitloopshort1:
+        jnb     exitloop
+; if --chain_length != 0, go to exitloop
+
+
+; begin the main loop
+beginloop2:
+        sub     chain_length,16+1
+; if chain_length <=16, don't use the unrolled loop
+        jna     normalbeg0add16
+
+do16:
+        cmp     word ptr[edi+eax],bx
+        je      normalbeg2dc0
+
+maccn   MACRO   lab
+        and     eax,7fffh
+        mov     ax,word ptr[esi+eax*2]
+        cmp     ecx,eax
+        jnb     exitloop
+        cmp     word ptr[edi+eax],bx
+        je      lab
+        ENDM
+
+rcontloop0:
+        maccn   normalbeg2dc1
+
+rcontloop1:
+        maccn   normalbeg2dc2
+
+rcontloop2:
+        maccn   normalbeg2dc3
+
+rcontloop3:
+        maccn   normalbeg2dc4
+
+rcontloop4:
+        maccn   normalbeg2dc5
+
+rcontloop5:
+        maccn   normalbeg2dc6
+
+rcontloop6:
+        maccn   normalbeg2dc7
+
+rcontloop7:
+        maccn   normalbeg2dc8
+
+rcontloop8:
+        maccn   normalbeg2dc9
+
+rcontloop9:
+        maccn   normalbeg2dc10
+
+rcontloop10:
+        maccn   short normalbeg2dc11
+
+rcontloop11:
+        maccn   short normalbeg2dc12
+
+rcontloop12:
+        maccn   short normalbeg2dc13
+
+rcontloop13:
+        maccn   short normalbeg2dc14
+
+rcontloop14:
+        maccn   short normalbeg2dc15
+
+rcontloop15:
+        and     eax,7fffh
+        mov     ax,word ptr[esi+eax*2]
+        cmp     ecx,eax
+        jnb     exitloop
+
+        sub     chain_length,16
+        ja      do16
+        jmp     normalbeg0add16
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+normbeg MACRO   rcontlab,valsub
+; if we are here, we know that *(match+best_len-1) == scan_end
+        cmp     bp,word ptr[edx+eax]
+; if (match != scan_start) goto rcontlab
+        jne     rcontlab
+; calculate the good chain_length, and we'll compare scan and match string
+        add     chain_length,16-valsub
+        jmp     iseq
+        ENDM
+
+
+normalbeg2dc11:
+        normbeg rcontloop11,11
+
+normalbeg2dc12:
+        normbeg short rcontloop12,12
+
+normalbeg2dc13:
+        normbeg short rcontloop13,13
+
+normalbeg2dc14:
+        normbeg short rcontloop14,14
+
+normalbeg2dc15:
+        normbeg short rcontloop15,15
+
+normalbeg2dc10:
+        normbeg rcontloop10,10
+
+normalbeg2dc9:
+        normbeg rcontloop9,9
+
+normalbeg2dc8:
+        normbeg rcontloop8,8
+
+normalbeg2dc7:
+        normbeg rcontloop7,7
+
+normalbeg2dc6:
+        normbeg rcontloop6,6
+
+normalbeg2dc5:
+        normbeg rcontloop5,5
+
+normalbeg2dc4:
+        normbeg rcontloop4,4
+
+normalbeg2dc3:
+        normbeg rcontloop3,3
+
+normalbeg2dc2:
+        normbeg rcontloop2,2
+
+normalbeg2dc1:
+        normbeg rcontloop1,1
+
+normalbeg2dc0:
+        normbeg rcontloop0,0
+
+
+; we go in normalbeg2 because *(ushf*)(match+best_len-1) == scan_end
+
+normalbeg2:
+        mov     edi,window
+
+        cmp     bp,word ptr[edi+eax]
+        jne     contloop3                   ; if *(ushf*)match != scan_start, continue
+
+iseq:
+; if we are here, we know that *(match+best_len-1) == scan_end
+; and (match == scan_start)
+
+        mov     edi,edx
+        mov     esi,scan                    ; esi = scan
+        add     edi,eax                     ; edi = window + cur_match = match
+
+        mov     edx,[esi+3]                 ; compare manually dword at match+3
+        xor     edx,[edi+3]                 ; and scan +3
+
+        jz      begincompare                ; if equal, go to long compare
+
+; we will determine the unmatch byte and calculate len (in esi)
+        or      dl,dl
+        je      eq1rr
+        mov     esi,3
+        jmp     trfinval
+eq1rr:
+        or      dx,dx
+        je      eq1
+
+        mov     esi,4
+        jmp     trfinval
+eq1:
+        and     edx,0ffffffh
+        jz      eq11
+        mov     esi,5
+        jmp     trfinval
+eq11:
+        mov     esi,6
+        jmp     trfinval
+
+begincompare:
+        ; here we now scan and match begin same
+        add     edi,6
+        add     esi,6
+        mov     ecx,(MAX_MATCH-(2+4))/4     ; scan for at most MAX_MATCH bytes
+        repe    cmpsd                       ; loop until mismatch
+
+        je      trfin                       ; go to trfin if not unmatch
+; we determine the unmatch byte
+        sub     esi,4
+        mov     edx,[edi-4]
+        xor     edx,[esi]
+
+        or      dl,dl
+        jnz     trfin
+        inc     esi
+
+        or      dx,dx
+        jnz     trfin
+        inc     esi
+
+        and     edx,0ffffffh
+        jnz     trfin
+        inc     esi
+
+trfin:
+        sub     esi,scan          ; esi = len
+trfinval:
+; here we have finised compare, and esi contain len of equal string
+        cmp     esi,best_len        ; if len > best_len, go newbestlen
+        ja      short newbestlen
+; now we restore edx, ecx and esi, for the big loop
+        mov     esi,prev
+        mov     ecx,limit
+        mov     edx,window
+        jmp     contloop3
+
+newbestlen:
+        mov     best_len,esi        ; len become best_len
+
+        mov     match_start,eax     ; save new position as match_start
+        cmp     esi,nice_match      ; if best_len >= nice_match, exit
+        jae     exitloop
+        mov     ecx,scan
+        mov     edx,window          ; restore edx=window
+        add     ecx,esi
+        add     esi,edx
+
+        dec     esi
+        mov     windowlen,esi       ; windowlen = window + best_len-1
+        mov     bx,[ecx-1]          ; bx = *(scan+best_len-1) = scan_end
+
+; now we restore ecx and esi, for the big loop :
+        mov     esi,prev
+        mov     ecx,limit
+        jmp     contloop3
+
+exitloop:
+; exit : s->match_start=match_start
+        mov     ebx,match_start
+        mov     ebp,str_s
+        mov     ecx,best_len
+        mov     dword ptr [ebp+dep_match_start],ebx        
+        mov     eax,dword ptr [ebp+dep_lookahead]
+        cmp     ecx,eax
+        ja      minexlo
+        mov     eax,ecx
+minexlo:
+; return min(best_len,s->lookahead)
+        
+; restore stack and register ebx,esi,edi,ebp
+        add     esp,NbStackAdd
+
+        pop     ebx
+        pop     esi
+        pop     edi
+        pop     ebp
+        ret
+InfoAuthor:
+; please don't remove this string !
+; Your are free use gvmat32 in any fre or commercial apps if you don't remove the string in the binary!
+        db     0dh,0ah,"GVMat32 optimised assembly code written 1996-98 by Gilles Vollant",0dh,0ah
+
+
+
+IFDEF NOUNDERLINE
+longest_match_7fff   endp
+ELSE
+_longest_match_7fff  endp
+ENDIF
+
+
+IFDEF NOUNDERLINE
+cpudetect32     proc near
+ELSE
+_cpudetect32    proc near
+ENDIF
+
+
+	pushfd                  ; push original EFLAGS
+	pop     eax             ; get original EFLAGS
+	mov     ecx, eax        ; save original EFLAGS
+	xor     eax, 40000h     ; flip AC bit in EFLAGS
+	push    eax             ; save new EFLAGS value on stack
+	popfd                   ; replace current EFLAGS value
+	pushfd                  ; get new EFLAGS
+	pop     eax             ; store new EFLAGS in EAX
+	xor     eax, ecx        ; can’t toggle AC bit, processor=80386
+	jz      end_cpu_is_386  ; jump if 80386 processor
+	push    ecx
+	popfd                   ; restore AC bit in EFLAGS first
+
+	pushfd
+	pushfd
+	pop     ecx
+			
+	mov     eax, ecx        ; get original EFLAGS
+	xor     eax, 200000h    ; flip ID bit in EFLAGS
+	push    eax             ; save new EFLAGS value on stack
+	popfd                   ; replace current EFLAGS value
+	pushfd                  ; get new EFLAGS
+	pop		eax	            ; store new EFLAGS in EAX
+	popfd                   ; restore original EFLAGS
+	xor		eax, ecx        ; can’t toggle ID bit,
+	je		is_old_486		; processor=old
+
+	mov     eax,1
+	db      0fh,0a2h        ;CPUID   
+
+exitcpudetect:
+	ret
+
+end_cpu_is_386:
+	mov     eax,0300h
+	jmp     exitcpudetect
+
+is_old_486:
+	mov     eax,0400h
+	jmp     exitcpudetect
+
+IFDEF NOUNDERLINE
+cpudetect32     endp
+ELSE
+_cpudetect32    endp
+ENDIF
+
+_TEXT   ends
+end

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/gvmat32c.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/gvmat32c.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/gvmat32c.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,200 @@
+/* gvmat32.c -- C portion of the optimized longest_match for 32 bits x86
+ * Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.
+ * File written by Gilles Vollant, by modifiying the longest_match
+ *  from Jean-loup Gailly in deflate.c
+ *  it prepare all parameters and call the assembly longest_match_gvasm
+ *  longest_match execute standard C code is wmask != 0x7fff
+ *     (assembly code is faster with a fixed wmask)
+ *
+ */
+
+#include "deflate.h"
+
+#undef FAR
+#include <windows.h>
+
+#ifdef ASMV
+#define NIL 0
+
+#define UNALIGNED_OK
+
+
+/* if your C compiler don't add underline before function name,
+		define ADD_UNDERLINE_ASMFUNC */
+#ifdef ADD_UNDERLINE_ASMFUNC
+#define longest_match_7fff _longest_match_7fff
+#endif
+
+
+
+void match_init()
+{
+}
+
+unsigned long cpudetect32();
+
+uInt longest_match_c(
+    deflate_state *s,
+    IPos cur_match);                             /* current match */
+
+
+uInt longest_match_7fff(
+    deflate_state *s,
+    IPos cur_match);                             /* current match */
+
+uInt longest_match(
+    deflate_state *s,
+    IPos cur_match)                             /* current match */
+{
+	static uInt iIsPPro=2;
+
+    if ((s->w_mask == 0x7fff) && (iIsPPro==0))
+        return longest_match_7fff(s,cur_match);
+
+	if (iIsPPro==2)
+		iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0;
+
+	return longest_match_c(s,cur_match);
+}
+
+
+
+uInt longest_match_c(s, cur_match)
+    deflate_state *s;
+    IPos cur_match;                             /* current match */
+{
+    unsigned chain_length = s->max_chain_length;/* max hash chain length */
+    register Bytef *scan = s->window + s->strstart; /* current string */
+    register Bytef *match;                       /* matched string */
+    register int len;                           /* length of current match */
+    int best_len = s->prev_length;              /* best match length so far */
+    int nice_match = s->nice_match;             /* stop if match long enough */
+    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+        s->strstart - (IPos)MAX_DIST(s) : NIL;
+    /* Stop when cur_match becomes <= limit. To simplify the code,
+     * we prevent matches with the string of window index 0.
+     */
+    Posf *prev = s->prev;
+    uInt wmask = s->w_mask;
+
+#ifdef UNALIGNED_OK
+    /* Compare two bytes at a time. Note: this is not always beneficial.
+     * Try with and without -DUNALIGNED_OK to check.
+     */
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
+    register ush scan_start = *(ushf*)scan;
+    register ush scan_end   = *(ushf*)(scan+best_len-1);
+#else
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+    register Byte scan_end1  = scan[best_len-1];
+    register Byte scan_end   = scan[best_len];
+#endif
+
+    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+     * It is easy to get rid of this optimization if necessary.
+     */
+    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+
+    /* Do not waste too much time if we already have a good match: */
+    if (s->prev_length >= s->good_match) {
+        chain_length >>= 2;
+    }
+    /* Do not look for matches beyond the end of the input. This is necessary
+     * to make deflate deterministic.
+     */
+    if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+
+    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+
+    do {
+        Assert(cur_match < s->strstart, "no future");
+        match = s->window + cur_match;
+
+        /* Skip to next match if the match length cannot increase
+         * or if the match length is less than 2:
+         */
+#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
+        /* This code assumes sizeof(unsigned short) == 2. Do not use
+         * UNALIGNED_OK if your compiler uses a different size.
+         */
+        if (*(ushf*)(match+best_len-1) != scan_end ||
+            *(ushf*)match != scan_start) continue;
+
+        /* It is not necessary to compare scan[2] and match[2] since they are
+         * always equal when the other bytes match, given that the hash keys
+         * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
+         * strstart+3, +5, ... up to strstart+257. We check for insufficient
+         * lookahead only every 4th comparison; the 128th check will be made
+         * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+         * necessary to put more guard bytes at the end of the window, or
+         * to check more often for insufficient lookahead.
+         */
+        Assert(scan[2] == match[2], "scan[2]?");
+        scan++, match++;
+        do {
+        } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 scan < strend);
+        /* The funny "do {}" generates better code on most compilers */
+
+        /* Here, scan <= window+strstart+257 */
+        Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+        if (*scan == *match) scan++;
+
+        len = (MAX_MATCH - 1) - (int)(strend-scan);
+        scan = strend - (MAX_MATCH-1);
+
+#else /* UNALIGNED_OK */
+
+        if (match[best_len]   != scan_end  ||
+            match[best_len-1] != scan_end1 ||
+            *match            != *scan     ||
+            *++match          != scan[1])      continue;
+
+        /* The check at best_len-1 can be removed because it will be made
+         * again later. (This heuristic is not always a win.)
+         * It is not necessary to compare scan[2] and match[2] since they
+         * are always equal when the other bytes match, given that
+         * the hash keys are equal and that HASH_BITS >= 8.
+         */
+        scan += 2, match++;
+        Assert(*scan == *match, "match[2]?");
+
+        /* We check for insufficient lookahead only every 8th comparison;
+         * the 256th check will be made at strstart+258.
+         */
+        do {
+        } while (*++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 scan < strend);
+
+        Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+
+        len = MAX_MATCH - (int)(strend - scan);
+        scan = strend - MAX_MATCH;
+
+#endif /* UNALIGNED_OK */
+
+        if (len > best_len) {
+            s->match_start = cur_match;
+            best_len = len;
+            if (len >= nice_match) break;
+#ifdef UNALIGNED_OK
+            scan_end = *(ushf*)(scan+best_len-1);
+#else
+            scan_end1  = scan[best_len-1];
+            scan_end   = scan[best_len];
+#endif
+        }
+    } while ((cur_match = prev[cur_match & wmask]) > limit
+             && --chain_length != 0);
+
+    if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
+    return s->lookahead;
+}
+
+#endif /* ASMV */

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/mkgvmt32.bat
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/mkgvmt32.bat	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/mkgvmt32.bat	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+c:\masm611\bin\ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.def
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.def	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.def	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,74 @@
+LIBRARY		"zlib"
+
+DESCRIPTION	'"""zlib data compression library"""'
+
+
+VERSION		1.11
+
+
+HEAPSIZE	1048576,8192
+
+EXPORTS
+    adler32                        @1
+    compress                       @2
+    crc32                          @3
+    deflate                        @4
+    deflateCopy                    @5
+    deflateEnd                     @6
+    deflateInit2_                  @7
+    deflateInit_                   @8
+    deflateParams                  @9
+    deflateReset                   @10
+    deflateSetDictionary           @11
+    gzclose                        @12
+    gzdopen                        @13
+    gzerror                        @14
+    gzflush                        @15
+    gzopen                         @16
+    gzread                         @17
+    gzwrite                        @18
+    inflate                        @19
+    inflateEnd                     @20
+    inflateInit2_                  @21
+    inflateInit_                   @22
+    inflateReset                   @23
+    inflateSetDictionary           @24
+    inflateSync                    @25
+    uncompress                     @26
+    zlibVersion                    @27
+    gzprintf                       @28
+    gzputc                         @29
+    gzgetc                         @30
+    gzseek                         @31
+    gzrewind                       @32
+    gztell                         @33
+    gzeof                          @34
+    gzsetparams                    @35
+    zError                         @36
+    inflateSyncPoint               @37
+    get_crc_table                  @38
+    compress2                      @39
+    gzputs                         @40
+    gzgets                         @41
+
+	unzOpen                       @61
+	unzClose                      @62
+	unzGetGlobalInfo              @63
+	unzGetCurrentFileInfo         @64
+	unzGoToFirstFile              @65
+	unzGoToNextFile               @66
+	unzOpenCurrentFile            @67
+	unzReadCurrentFile            @68
+	unztell                       @70
+	unzeof                        @71
+	unzCloseCurrentFile           @72
+	unzGetGlobalComment           @73
+	unzStringFileNameCompare      @74
+	unzLocateFile                 @75
+	unzGetLocalExtrafield         @76
+
+	zipOpen                       @80
+	zipOpenNewFileInZip           @81
+	zipWriteInFileInZip           @82
+	zipCloseFileInZip             @83
+	zipClose                      @84

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.dsp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.dsp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.dsp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,651 @@
+# Microsoft Developer Studio Project File - Name="zlibvc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+# TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602
+
+CFG=zlibvc - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "zlibvc.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "zlibvc.mak" CFG="zlibvc - Win32 Release"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "zlibvc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "zlibvc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "zlibvc - Win32 ReleaseAxp" (based on\
+ "Win32 (ALPHA) Dynamic-Link Library")
+!MESSAGE "zlibvc - Win32 ReleaseWithoutAsm" (based on\
+ "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "zlibvc - Win32 ReleaseWithoutCrtdll" (based on\
+ "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\Release"
+# PROP BASE Intermediate_Dir ".\Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release"
+# PROP Intermediate_Dir ".\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c
+# SUBTRACT CPP /YX
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# 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:windows /dll /machine:I386
+# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\Debug"
+# PROP BASE Intermediate_Dir ".\Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug"
+# PROP Intermediate_Dir ".\Debug"
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /FD /c
+# SUBTRACT CPP /YX
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# 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:windows /dll /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 /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug\zlib.dll"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "zlibvc__"
+# PROP BASE Intermediate_Dir "zlibvc__"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "zlibvc__"
+# PROP Intermediate_Dir "zlibvc__"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+CPP=cl.exe
+# ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
+# ADD CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c
+# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:".\Release\zlib.dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:"zlibvc__\zlib.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "zlibvc_0"
+# PROP BASE Intermediate_Dir "zlibvc_0"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "zlibvc_0"
+# PROP Intermediate_Dir "zlibvc_0"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c
+# SUBTRACT CPP /YX
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_0\zlib.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "zlibvc_1"
+# PROP BASE Intermediate_Dir "zlibvc_1"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "zlibvc_1"
+# PROP Intermediate_Dir "zlibvc_1"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c
+# SUBTRACT CPP /YX
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_1\zlib.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF 
+
+# Begin Target
+
+# Name "zlibvc - Win32 Release"
+# Name "zlibvc - Win32 Debug"
+# Name "zlibvc - Win32 ReleaseAxp"
+# Name "zlibvc - Win32 ReleaseWithoutAsm"
+# Name "zlibvc - Win32 ReleaseWithoutCrtdll"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\adler32.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_ADLER=\
+	".\zconf.h"\
+	".\zlib.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\compress.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_COMPR=\
+	".\zconf.h"\
+	".\zlib.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\crc32.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_CRC32=\
+	".\zconf.h"\
+	".\zlib.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\deflate.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_DEFLA=\
+	".\deflate.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\gvmat32c.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\gzio.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_GZIO_=\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\infblock.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFBL=\
+	".\infblock.h"\
+	".\infcodes.h"\
+	".\inftrees.h"\
+	".\infutil.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\infcodes.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFCO=\
+	".\infblock.h"\
+	".\infcodes.h"\
+	".\inffast.h"\
+	".\inftrees.h"\
+	".\infutil.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\inffast.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFFA=\
+	".\infblock.h"\
+	".\infcodes.h"\
+	".\inffast.h"\
+	".\inftrees.h"\
+	".\infutil.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\inflate.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFLA=\
+	".\infblock.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\inftrees.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFTR=\
+	".\inftrees.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\infutil.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFUT=\
+	".\infblock.h"\
+	".\infcodes.h"\
+	".\inftrees.h"\
+	".\infutil.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\trees.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_TREES=\
+	".\deflate.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\uncompr.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_UNCOM=\
+	".\zconf.h"\
+	".\zlib.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\unzip.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\zip.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\zlib.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\zlibvc.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\zutil.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_ZUTIL=\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\deflate.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\infblock.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\infcodes.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\inffast.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\inftrees.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\infutil.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\zconf.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\zlib.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\zutil.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.dsw
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.dsw	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm386/zlibvc.dsw	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "zlibstat"=.\zlibstat.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "zlibvc"=.\zlibvc.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586/README.586
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586/README.586	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586/README.586	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+This is a patched version of zlib modified to use
+Pentium-optimized assembly code in the deflation algorithm. The files
+changed/added by this patch are:
+
+README.586
+match.S
+
+The effectiveness of these modifications is a bit marginal, as the the
+program's bottleneck seems to be mostly L1-cache contention, for which
+there is no real way to work around without rewriting the basic
+algorithm. The speedup on average is around 5-10% (which is generally
+less than the amount of variance between subsequent executions).
+However, when used at level 9 compression, the cache contention can
+drop enough for the assembly version to achieve 10-20% speedup (and
+sometimes more, depending on the amount of overall redundancy in the
+files). Even here, though, cache contention can still be the limiting
+factor, depending on the nature of the program using the zlib library.
+This may also mean that better improvements will be seen on a Pentium
+with MMX, which suffers much less from L1-cache contention, but I have
+not yet verified this.
+
+Note that this code has been tailored for the Pentium in particular,
+and will not perform well on the Pentium Pro (due to the use of a
+partial register in the inner loop).
+
+If you are using an assembler other than GNU as, you will have to
+translate match.S to use your assembler's syntax. (Have fun.)
+
+Brian Raiter
+breadbox at muppetlabs.com
+April, 1998
+
+
+Added for zlib 1.1.3:
+
+The patches come from
+http://www.muppetlabs.com/~breadbox/software/assembly.html
+
+To compile zlib with this asm file, copy match.S to the zlib directory
+then do:
+
+CFLAGS="-O3 -DASMV" ./configure
+make OBJA=match.o

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586/match.S
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586/match.S	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm586/match.S	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,354 @@
+/* match.s -- Pentium-optimized version of longest_match()
+ * Written for zlib 1.1.2
+ * Copyright (C) 1998 Brian Raiter <breadbox at muppetlabs.com>
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License.
+ */
+
+#ifndef NO_UNDERLINE
+#define	match_init	_match_init
+#define	longest_match	_longest_match
+#endif
+
+#define	MAX_MATCH	(258)
+#define	MIN_MATCH	(3)
+#define	MIN_LOOKAHEAD	(MAX_MATCH + MIN_MATCH + 1)
+#define	MAX_MATCH_8	((MAX_MATCH + 7) & ~7)
+
+/* stack frame offsets */
+
+#define	wmask			0	/* local copy of s->wmask	*/
+#define	window			4	/* local copy of s->window	*/
+#define	windowbestlen		8	/* s->window + bestlen		*/
+#define	chainlenscanend		12	/* high word: current chain len	*/
+					/* low word: last bytes sought	*/
+#define	scanstart		16	/* first two bytes of string	*/
+#define	scanalign		20	/* dword-misalignment of string	*/
+#define	nicematch		24	/* a good enough match size	*/
+#define	bestlen			28	/* size of best match so far	*/
+#define	scan			32	/* ptr to string wanting match	*/
+
+#define	LocalVarsSize		(36)
+/*	saved ebx		36 */
+/*	saved edi		40 */
+/*	saved esi		44 */
+/*	saved ebp		48 */
+/*	return address		52 */
+#define	deflatestate		56	/* the function arguments	*/
+#define	curmatch		60
+
+/* Offsets for fields in the deflate_state structure. These numbers
+ * are calculated from the definition of deflate_state, with the
+ * assumption that the compiler will dword-align the fields. (Thus,
+ * changing the definition of deflate_state could easily cause this
+ * program to crash horribly, without so much as a warning at
+ * compile time. Sigh.)
+ */
+#define	dsWSize			36
+#define	dsWMask			44
+#define	dsWindow		48
+#define	dsPrev			56
+#define	dsMatchLen		88
+#define	dsPrevMatch		92
+#define	dsStrStart		100
+#define	dsMatchStart		104
+#define	dsLookahead		108
+#define	dsPrevLen		112
+#define	dsMaxChainLen		116
+#define	dsGoodMatch		132
+#define	dsNiceMatch		136
+
+
+.file "match.S"
+
+.globl	match_init, longest_match
+
+.text
+
+/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
+
+longest_match:
+
+/* Save registers that the compiler may be using, and adjust %esp to	*/
+/* make room for our stack frame.					*/
+
+		pushl	%ebp
+		pushl	%edi
+		pushl	%esi
+		pushl	%ebx
+		subl	$LocalVarsSize, %esp
+
+/* Retrieve the function arguments. %ecx will hold cur_match		*/
+/* throughout the entire function. %edx will hold the pointer to the	*/
+/* deflate_state structure during the function's setup (before		*/
+/* entering the main loop).						*/
+
+		movl	deflatestate(%esp), %edx
+		movl	curmatch(%esp), %ecx
+
+/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;	*/
+
+		movl	dsNiceMatch(%edx), %eax
+		movl	dsLookahead(%edx), %ebx
+		cmpl	%eax, %ebx
+		jl	LookaheadLess
+		movl	%eax, %ebx
+LookaheadLess:	movl	%ebx, nicematch(%esp)
+
+/* register Bytef *scan = s->window + s->strstart;			*/
+
+		movl	dsWindow(%edx), %esi
+		movl	%esi, window(%esp)
+		movl	dsStrStart(%edx), %ebp
+		lea	(%esi,%ebp), %edi
+		movl	%edi, scan(%esp)
+
+/* Determine how many bytes the scan ptr is off from being		*/
+/* dword-aligned.							*/
+
+		movl	%edi, %eax
+		negl	%eax
+		andl	$3, %eax
+		movl	%eax, scanalign(%esp)
+
+/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ?			*/
+/*     s->strstart - (IPos)MAX_DIST(s) : NIL;				*/
+
+		movl	dsWSize(%edx), %eax
+		subl	$MIN_LOOKAHEAD, %eax
+		subl	%eax, %ebp
+		jg	LimitPositive
+		xorl	%ebp, %ebp
+LimitPositive:
+
+/* unsigned chain_length = s->max_chain_length;				*/
+/* if (s->prev_length >= s->good_match) {				*/
+/*     chain_length >>= 2;						*/
+/* }									*/
+
+		movl	dsPrevLen(%edx), %eax
+		movl	dsGoodMatch(%edx), %ebx
+		cmpl	%ebx, %eax
+		movl	dsMaxChainLen(%edx), %ebx
+		jl	LastMatchGood
+		shrl	$2, %ebx
+LastMatchGood:
+
+/* chainlen is decremented once beforehand so that the function can	*/
+/* use the sign flag instead of the zero flag for the exit test.	*/
+/* It is then shifted into the high word, to make room for the scanend	*/
+/* scanend value, which it will always accompany.			*/
+
+		decl	%ebx
+		shll	$16, %ebx
+
+/* int best_len = s->prev_length;					*/
+
+		movl	dsPrevLen(%edx), %eax
+		movl	%eax, bestlen(%esp)
+
+/* Store the sum of s->window + best_len in %esi locally, and in %esi.	*/
+
+		addl	%eax, %esi
+		movl	%esi, windowbestlen(%esp)
+
+/* register ush scan_start = *(ushf*)scan;				*/
+/* register ush scan_end   = *(ushf*)(scan+best_len-1);			*/
+
+		movw	(%edi), %bx
+		movw	%bx, scanstart(%esp)
+		movw	-1(%edi,%eax), %bx
+		movl	%ebx, chainlenscanend(%esp)
+
+/* Posf *prev = s->prev;						*/
+/* uInt wmask = s->w_mask;						*/
+
+		movl	dsPrev(%edx), %edi
+		movl	dsWMask(%edx), %edx
+		mov	%edx, wmask(%esp)
+
+/* Jump into the main loop.						*/
+
+		jmp	LoopEntry
+
+.balign 16
+
+/* do {
+ *     match = s->window + cur_match;
+ *     if (*(ushf*)(match+best_len-1) != scan_end ||
+ *         *(ushf*)match != scan_start) continue;
+ *     [...]
+ * } while ((cur_match = prev[cur_match & wmask]) > limit
+ *          && --chain_length != 0);
+ *
+ * Here is the inner loop of the function. The function will spend the
+ * majority of its time in this loop, and majority of that time will
+ * be spent in the first ten instructions.
+ *
+ * Within this loop:
+ * %ebx = chainlenscanend - i.e., ((chainlen << 16) | scanend)
+ * %ecx = curmatch
+ * %edx = curmatch & wmask
+ * %esi = windowbestlen - i.e., (window + bestlen)
+ * %edi = prev
+ * %ebp = limit
+ *
+ * Two optimization notes on the choice of instructions:
+ *
+ * The first instruction uses a 16-bit address, which costs an extra,
+ * unpairable cycle. This is cheaper than doing a 32-bit access and
+ * zeroing the high word, due to the 3-cycle misalignment penalty which
+ * would occur half the time. This also turns out to be cheaper than
+ * doing two separate 8-bit accesses, as the memory is so rarely in the
+ * L1 cache.
+ *
+ * The window buffer, however, apparently spends a lot of time in the
+ * cache, and so it is faster to retrieve the word at the end of the
+ * match string with two 8-bit loads. The instructions that test the
+ * word at the beginning of the match string, however, are executed
+ * much less frequently, and there it was cheaper to use 16-bit
+ * instructions, which avoided the necessity of saving off and
+ * subsequently reloading one of the other registers.
+ */
+LookupLoop:
+							/* 1 U & V  */
+		movw	(%edi,%edx,2), %cx		/* 2 U pipe */
+		movl	wmask(%esp), %edx		/* 2 V pipe */
+		cmpl	%ebp, %ecx			/* 3 U pipe */
+		jbe	LeaveNow			/* 3 V pipe */
+		subl	$0x00010000, %ebx		/* 4 U pipe */
+		js	LeaveNow			/* 4 V pipe */
+LoopEntry:	movb	-1(%esi,%ecx), %al		/* 5 U pipe */
+		andl	%ecx, %edx			/* 5 V pipe */
+		cmpb	%bl, %al			/* 6 U pipe */
+		jnz	LookupLoop			/* 6 V pipe */
+		movb	(%esi,%ecx), %ah
+		cmpb	%bh, %ah
+		jnz	LookupLoop
+		movl	window(%esp), %eax
+		movw	(%eax,%ecx), %ax
+		cmpw	scanstart(%esp), %ax
+		jnz	LookupLoop
+
+/* Store the current value of chainlen.					*/
+
+		movl	%ebx, chainlenscanend(%esp)
+
+/* Point %edi to the string under scrutiny, and %esi to the string we	*/
+/* are hoping to match it up with. In actuality, %esi and %edi are	*/
+/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is	*/
+/* initialized to -(MAX_MATCH_8 - scanalign).				*/
+
+		movl	window(%esp), %esi
+		movl	scan(%esp), %edi
+		addl	%ecx, %esi
+		movl	scanalign(%esp), %eax
+		movl	$(-MAX_MATCH_8), %edx
+		lea	MAX_MATCH_8(%edi,%eax), %edi
+		lea	MAX_MATCH_8(%esi,%eax), %esi
+
+/* Test the strings for equality, 8 bytes at a time. At the end,
+ * adjust %edx so that it is offset to the exact byte that mismatched.
+ *
+ * We already know at this point that the first three bytes of the
+ * strings match each other, and they can be safely passed over before
+ * starting the compare loop. So what this code does is skip over 0-3
+ * bytes, as much as necessary in order to dword-align the %edi
+ * pointer. (%esi will still be misaligned three times out of four.)
+ *
+ * It should be confessed that this loop usually does not represent
+ * much of the total running time. Replacing it with a more
+ * straightforward "rep cmpsb" would not drastically degrade
+ * performance.
+ */
+LoopCmps:
+		movl	(%esi,%edx), %eax
+		movl	(%edi,%edx), %ebx
+		xorl	%ebx, %eax
+		jnz	LeaveLoopCmps
+		movl	4(%esi,%edx), %eax
+		movl	4(%edi,%edx), %ebx
+		xorl	%ebx, %eax
+		jnz	LeaveLoopCmps4
+		addl	$8, %edx
+		jnz	LoopCmps
+		jmp	LenMaximum
+LeaveLoopCmps4:	addl	$4, %edx
+LeaveLoopCmps:	testl	$0x0000FFFF, %eax
+		jnz	LenLower
+		addl	$2, %edx
+		shrl	$16, %eax
+LenLower:	subb	$1, %al
+		adcl	$0, %edx
+
+/* Calculate the length of the match. If it is longer than MAX_MATCH,	*/
+/* then automatically accept it as the best possible match and leave.	*/
+
+		lea	(%edi,%edx), %eax
+		movl	scan(%esp), %edi
+		subl	%edi, %eax
+		cmpl	$MAX_MATCH, %eax
+		jge	LenMaximum
+
+/* If the length of the match is not longer than the best match we	*/
+/* have so far, then forget it and return to the lookup loop.		*/
+
+		movl	deflatestate(%esp), %edx
+		movl	bestlen(%esp), %ebx
+		cmpl	%ebx, %eax
+		jg	LongerMatch
+		movl	chainlenscanend(%esp), %ebx
+		movl	windowbestlen(%esp), %esi
+		movl	dsPrev(%edx), %edi
+		movl	wmask(%esp), %edx
+		andl	%ecx, %edx
+		jmp	LookupLoop
+
+/*         s->match_start = cur_match;					*/
+/*         best_len = len;						*/
+/*         if (len >= nice_match) break;				*/
+/*         scan_end = *(ushf*)(scan+best_len-1);			*/
+
+LongerMatch:	movl	nicematch(%esp), %ebx
+		movl	%eax, bestlen(%esp)
+		movl	%ecx, dsMatchStart(%edx)
+		cmpl	%ebx, %eax
+		jge	LeaveNow
+		movl	window(%esp), %esi
+		addl	%eax, %esi
+		movl	%esi, windowbestlen(%esp)
+		movl	chainlenscanend(%esp), %ebx
+		movw	-1(%edi,%eax), %bx
+		movl	dsPrev(%edx), %edi
+		movl	%ebx, chainlenscanend(%esp)
+		movl	wmask(%esp), %edx
+		andl	%ecx, %edx
+		jmp	LookupLoop
+
+/* Accept the current string, with the maximum possible length.		*/
+
+LenMaximum:	movl	deflatestate(%esp), %edx
+		movl	$MAX_MATCH, bestlen(%esp)
+		movl	%ecx, dsMatchStart(%edx)
+
+/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len;		*/
+/* return s->lookahead;							*/
+
+LeaveNow:
+		movl	deflatestate(%esp), %edx
+		movl	bestlen(%esp), %ebx
+		movl	dsLookahead(%edx), %eax
+		cmpl	%eax, %ebx
+		jg	LookaheadRet
+		movl	%ebx, %eax
+LookaheadRet:
+
+/* Restore the stack and return from whence we came.			*/
+
+		addl	$LocalVarsSize, %esp
+		popl	%ebx
+		popl	%esi
+		popl	%edi
+		popl	%ebp
+match_init:	ret

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686/README.686
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686/README.686	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686/README.686	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,34 @@
+This is a patched version of zlib, modified to use
+Pentium-Pro-optimized assembly code in the deflation algorithm. The
+files changed/added by this patch are:
+
+README.686
+match.S
+
+The speedup that this patch provides varies, depending on whether the
+compiler used to build the original version of zlib falls afoul of the
+PPro's speed traps. My own tests show a speedup of around 10-20% at
+the default compression level, and 20-30% using -9, against a version
+compiled using gcc 2.7.2.3. Your mileage may vary.
+
+Note that this code has been tailored for the PPro/PII in particular,
+and will not perform particuarly well on a Pentium.
+
+If you are using an assembler other than GNU as, you will have to
+translate match.S to use your assembler's syntax. (Have fun.)
+
+Brian Raiter
+breadbox at muppetlabs.com
+April, 1998
+
+
+Added for zlib 1.1.3:
+
+The patches come from
+http://www.muppetlabs.com/~breadbox/software/assembly.html
+
+To compile zlib with this asm file, copy match.S to the zlib directory
+then do:
+
+CFLAGS="-O3 -DASMV" ./configure
+make OBJA=match.o

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686/match.S
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686/match.S	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/asm686/match.S	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,327 @@
+/* match.s -- Pentium-Pro-optimized version of longest_match()
+ * Written for zlib 1.1.2
+ * Copyright (C) 1998 Brian Raiter <breadbox at muppetlabs.com>
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License.
+ */
+
+#ifndef NO_UNDERLINE
+#define	match_init	_match_init
+#define	longest_match	_longest_match
+#endif
+
+#define	MAX_MATCH	(258)
+#define	MIN_MATCH	(3)
+#define	MIN_LOOKAHEAD	(MAX_MATCH + MIN_MATCH + 1)
+#define	MAX_MATCH_8	((MAX_MATCH + 7) & ~7)
+
+/* stack frame offsets */
+
+#define	chainlenwmask		0	/* high word: current chain len	*/
+					/* low word: s->wmask		*/
+#define	window			4	/* local copy of s->window	*/
+#define	windowbestlen		8	/* s->window + bestlen		*/
+#define	scanstart		16	/* first two bytes of string	*/
+#define	scanend			12	/* last two bytes of string	*/
+#define	scanalign		20	/* dword-misalignment of string	*/
+#define	nicematch		24	/* a good enough match size	*/
+#define	bestlen			28	/* size of best match so far	*/
+#define	scan			32	/* ptr to string wanting match	*/
+
+#define	LocalVarsSize		(36)
+/*	saved ebx		36 */
+/*	saved edi		40 */
+/*	saved esi		44 */
+/*	saved ebp		48 */
+/*	return address		52 */
+#define	deflatestate		56	/* the function arguments	*/
+#define	curmatch		60
+
+/* Offsets for fields in the deflate_state structure. These numbers
+ * are calculated from the definition of deflate_state, with the
+ * assumption that the compiler will dword-align the fields. (Thus,
+ * changing the definition of deflate_state could easily cause this
+ * program to crash horribly, without so much as a warning at
+ * compile time. Sigh.)
+ */
+#define	dsWSize			36
+#define	dsWMask			44
+#define	dsWindow		48
+#define	dsPrev			56
+#define	dsMatchLen		88
+#define	dsPrevMatch		92
+#define	dsStrStart		100
+#define	dsMatchStart		104
+#define	dsLookahead		108
+#define	dsPrevLen		112
+#define	dsMaxChainLen		116
+#define	dsGoodMatch		132
+#define	dsNiceMatch		136
+
+
+.file "match.S"
+
+.globl	match_init, longest_match
+
+.text
+
+/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
+
+longest_match:
+
+/* Save registers that the compiler may be using, and adjust %esp to	*/
+/* make room for our stack frame.					*/
+
+		pushl	%ebp
+		pushl	%edi
+		pushl	%esi
+		pushl	%ebx
+		subl	$LocalVarsSize, %esp
+
+/* Retrieve the function arguments. %ecx will hold cur_match		*/
+/* throughout the entire function. %edx will hold the pointer to the	*/
+/* deflate_state structure during the function's setup (before		*/
+/* entering the main loop).						*/
+
+		movl	deflatestate(%esp), %edx
+		movl	curmatch(%esp), %ecx
+
+/* uInt wmask = s->w_mask;						*/
+/* unsigned chain_length = s->max_chain_length;				*/
+/* if (s->prev_length >= s->good_match) {				*/
+/*     chain_length >>= 2;						*/
+/* }									*/
+
+		movl	dsPrevLen(%edx), %eax
+		movl	dsGoodMatch(%edx), %ebx
+		cmpl	%ebx, %eax
+		movl	dsWMask(%edx), %eax
+		movl	dsMaxChainLen(%edx), %ebx
+		jl	LastMatchGood
+		shrl	$2, %ebx
+LastMatchGood:
+
+/* chainlen is decremented once beforehand so that the function can	*/
+/* use the sign flag instead of the zero flag for the exit test.	*/
+/* It is then shifted into the high word, to make room for the wmask	*/
+/* value, which it will always accompany.				*/
+
+		decl	%ebx
+		shll	$16, %ebx
+		orl	%eax, %ebx
+		movl	%ebx, chainlenwmask(%esp)
+
+/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;	*/
+
+		movl	dsNiceMatch(%edx), %eax
+		movl	dsLookahead(%edx), %ebx
+		cmpl	%eax, %ebx
+		jl	LookaheadLess
+		movl	%eax, %ebx
+LookaheadLess:	movl	%ebx, nicematch(%esp)
+
+/* register Bytef *scan = s->window + s->strstart;			*/
+
+		movl	dsWindow(%edx), %esi
+		movl	%esi, window(%esp)
+		movl	dsStrStart(%edx), %ebp
+		lea	(%esi,%ebp), %edi
+		movl	%edi, scan(%esp)
+
+/* Determine how many bytes the scan ptr is off from being		*/
+/* dword-aligned.							*/
+
+		movl	%edi, %eax
+		negl	%eax
+		andl	$3, %eax
+		movl	%eax, scanalign(%esp)
+
+/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ?			*/
+/*     s->strstart - (IPos)MAX_DIST(s) : NIL;				*/
+
+		movl	dsWSize(%edx), %eax
+		subl	$MIN_LOOKAHEAD, %eax
+		subl	%eax, %ebp
+		jg	LimitPositive
+		xorl	%ebp, %ebp
+LimitPositive:
+
+/* int best_len = s->prev_length;					*/
+
+		movl	dsPrevLen(%edx), %eax
+		movl	%eax, bestlen(%esp)
+
+/* Store the sum of s->window + best_len in %esi locally, and in %esi.	*/
+
+		addl	%eax, %esi
+		movl	%esi, windowbestlen(%esp)
+
+/* register ush scan_start = *(ushf*)scan;				*/
+/* register ush scan_end   = *(ushf*)(scan+best_len-1);			*/
+/* Posf *prev = s->prev;						*/
+
+		movzwl	(%edi), %ebx
+		movl	%ebx, scanstart(%esp)
+		movzwl	-1(%edi,%eax), %ebx
+		movl	%ebx, scanend(%esp)
+		movl	dsPrev(%edx), %edi
+
+/* Jump into the main loop.						*/
+
+		movl	chainlenwmask(%esp), %edx
+		jmp	LoopEntry
+
+.balign 16
+
+/* do {
+ *     match = s->window + cur_match;
+ *     if (*(ushf*)(match+best_len-1) != scan_end ||
+ *         *(ushf*)match != scan_start) continue;
+ *     [...]
+ * } while ((cur_match = prev[cur_match & wmask]) > limit
+ *          && --chain_length != 0);
+ *
+ * Here is the inner loop of the function. The function will spend the
+ * majority of its time in this loop, and majority of that time will
+ * be spent in the first ten instructions.
+ *
+ * Within this loop:
+ * %ebx = scanend
+ * %ecx = curmatch
+ * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
+ * %esi = windowbestlen - i.e., (window + bestlen)
+ * %edi = prev
+ * %ebp = limit
+ */
+LookupLoop:
+		andl	%edx, %ecx
+		movzwl	(%edi,%ecx,2), %ecx
+		cmpl	%ebp, %ecx
+		jbe	LeaveNow
+		subl	$0x00010000, %edx
+		js	LeaveNow
+LoopEntry:	movzwl	-1(%esi,%ecx), %eax
+		cmpl	%ebx, %eax
+		jnz	LookupLoop
+		movl	window(%esp), %eax
+		movzwl	(%eax,%ecx), %eax
+		cmpl	scanstart(%esp), %eax
+		jnz	LookupLoop
+
+/* Store the current value of chainlen.					*/
+
+		movl	%edx, chainlenwmask(%esp)
+
+/* Point %edi to the string under scrutiny, and %esi to the string we	*/
+/* are hoping to match it up with. In actuality, %esi and %edi are	*/
+/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is	*/
+/* initialized to -(MAX_MATCH_8 - scanalign).				*/
+
+		movl	window(%esp), %esi
+		movl	scan(%esp), %edi
+		addl	%ecx, %esi
+		movl	scanalign(%esp), %eax
+		movl	$(-MAX_MATCH_8), %edx
+		lea	MAX_MATCH_8(%edi,%eax), %edi
+		lea	MAX_MATCH_8(%esi,%eax), %esi
+
+/* Test the strings for equality, 8 bytes at a time. At the end,
+ * adjust %edx so that it is offset to the exact byte that mismatched.
+ *
+ * We already know at this point that the first three bytes of the
+ * strings match each other, and they can be safely passed over before
+ * starting the compare loop. So what this code does is skip over 0-3
+ * bytes, as much as necessary in order to dword-align the %edi
+ * pointer. (%esi will still be misaligned three times out of four.)
+ *
+ * It should be confessed that this loop usually does not represent
+ * much of the total running time. Replacing it with a more
+ * straightforward "rep cmpsb" would not drastically degrade
+ * performance.
+ */
+LoopCmps:
+		movl	(%esi,%edx), %eax
+		xorl	(%edi,%edx), %eax
+		jnz	LeaveLoopCmps
+		movl	4(%esi,%edx), %eax
+		xorl	4(%edi,%edx), %eax
+		jnz	LeaveLoopCmps4
+		addl	$8, %edx
+		jnz	LoopCmps
+		jmp	LenMaximum
+LeaveLoopCmps4:	addl	$4, %edx
+LeaveLoopCmps:	testl	$0x0000FFFF, %eax
+		jnz	LenLower
+		addl	$2, %edx
+		shrl	$16, %eax
+LenLower:	subb	$1, %al
+		adcl	$0, %edx
+
+/* Calculate the length of the match. If it is longer than MAX_MATCH,	*/
+/* then automatically accept it as the best possible match and leave.	*/
+
+		lea	(%edi,%edx), %eax
+		movl	scan(%esp), %edi
+		subl	%edi, %eax
+		cmpl	$MAX_MATCH, %eax
+		jge	LenMaximum
+
+/* If the length of the match is not longer than the best match we	*/
+/* have so far, then forget it and return to the lookup loop.		*/
+
+		movl	deflatestate(%esp), %edx
+		movl	bestlen(%esp), %ebx
+		cmpl	%ebx, %eax
+		jg	LongerMatch
+		movl	windowbestlen(%esp), %esi
+		movl	dsPrev(%edx), %edi
+		movl	scanend(%esp), %ebx
+		movl	chainlenwmask(%esp), %edx
+		jmp	LookupLoop
+
+/*         s->match_start = cur_match;					*/
+/*         best_len = len;						*/
+/*         if (len >= nice_match) break;				*/
+/*         scan_end = *(ushf*)(scan+best_len-1);			*/
+
+LongerMatch:	movl	nicematch(%esp), %ebx
+		movl	%eax, bestlen(%esp)
+		movl	%ecx, dsMatchStart(%edx)
+		cmpl	%ebx, %eax
+		jge	LeaveNow
+		movl	window(%esp), %esi
+		addl	%eax, %esi
+		movl	%esi, windowbestlen(%esp)
+		movzwl	-1(%edi,%eax), %ebx
+		movl	dsPrev(%edx), %edi
+		movl	%ebx, scanend(%esp)
+		movl	chainlenwmask(%esp), %edx
+		jmp	LookupLoop
+
+/* Accept the current string, with the maximum possible length.		*/
+
+LenMaximum:	movl	deflatestate(%esp), %edx
+		movl	$MAX_MATCH, bestlen(%esp)
+		movl	%ecx, dsMatchStart(%edx)
+
+/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len;		*/
+/* return s->lookahead;							*/
+
+LeaveNow:
+		movl	deflatestate(%esp), %edx
+		movl	bestlen(%esp), %ebx
+		movl	dsLookahead(%edx), %eax
+		cmpl	%eax, %ebx
+		jg	LookaheadRet
+		movl	%ebx, %eax
+LookaheadRet:
+
+/* Restore the stack and return from whence we came.			*/
+
+		addl	$LocalVarsSize, %esp
+		popl	%ebx
+		popl	%esi
+		popl	%edi
+		popl	%ebp
+match_init:	ret

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi/zlib.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi/zlib.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi/zlib.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,36 @@
+# Makefile for zlib32bd.lib
+# ------------- Borland C++ 4.5 -------------
+
+# The (32-bit) zlib32bd.lib made with this makefile is intended for use 
+# in making the (32-bit) DLL, png32bd.dll. It uses the "stdcall" calling 
+# convention.
+
+CFLAGS= -ps -O2 -C -K -N- -k- -d -3 -r- -w-par -w-aus -WDE
+CC=f:\bc45\bin\bcc32
+LIBFLAGS= /C
+LIB=f:\bc45\bin\tlib
+ZLIB=zlib32bd.lib
+
+.autodepend
+.c.obj:
+        $(CC) -c $(CFLAGS) $<
+
+OBJ1=adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj 
+OBJ2=infcodes.obj inflate.obj inftrees.obj infutil.obj inffast.obj 
+OBJ3=trees.obj uncompr.obj zutil.obj
+pOBJ1=+adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infblock.obj 
+pOBJ2=+infcodes.obj+inflate.obj+inftrees.obj+infutil.obj+inffast.obj 
+pOBJ3=+trees.obj+uncompr.obj+zutil.obj
+
+all: $(ZLIB)
+
+$(ZLIB): $(OBJ1) $(OBJ2) $(OBJ3)
+        @if exist $@ del $@
+        $(LIB) @&&|
+$@ $(LIBFLAGS) &
+$(pOBJ1) &
+$(pOBJ2) &
+$(pOBJ3)
+|
+
+# End of makefile for zlib32bd.lib

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi/zlibdef.pas
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi/zlibdef.pas	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi/zlibdef.pas	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,169 @@
+unit zlibdef;
+
+interface
+
+uses
+  Windows;
+
+const
+  ZLIB_VERSION = '1.1.3';
+
+type
+  voidpf = Pointer;
+  int    = Integer;
+  uInt   = Cardinal;
+  pBytef = PChar;
+  uLong  = Cardinal;
+
+  alloc_func = function(opaque: voidpf; items, size: uInt): voidpf;
+                    stdcall;
+  free_func  = procedure(opaque, address: voidpf);
+                    stdcall;
+
+  internal_state = Pointer;
+
+  z_streamp = ^z_stream;
+  z_stream = packed record
+    next_in: pBytef;          // next input byte
+    avail_in: uInt;           // number of bytes available at next_in
+    total_in: uLong;          // total nb of input bytes read so far
+
+    next_out: pBytef;         // next output byte should be put there
+    avail_out: uInt;          // remaining free space at next_out
+    total_out: uLong;         // total nb of bytes output so far
+
+    msg: PChar;               // last error message, NULL if no error
+    state: internal_state;    // not visible by applications
+
+    zalloc: alloc_func;       // used to allocate the internal state
+    zfree: free_func;         // used to free the internal state
+    opaque: voidpf;           // private data object passed to zalloc and zfree
+
+    data_type: int;           // best guess about the data type: ascii or binary
+    adler: uLong;             // adler32 value of the uncompressed data
+    reserved: uLong;          // reserved for future use
+    end;
+
+const
+  Z_NO_FLUSH      = 0;
+  Z_SYNC_FLUSH    = 2;
+  Z_FULL_FLUSH    = 3;
+  Z_FINISH        = 4;
+
+  Z_OK            = 0;
+  Z_STREAM_END    = 1;
+
+  Z_NO_COMPRESSION         =  0;
+  Z_BEST_SPEED             =  1;
+  Z_BEST_COMPRESSION       =  9;
+  Z_DEFAULT_COMPRESSION    = -1;
+
+  Z_FILTERED            = 1;
+  Z_HUFFMAN_ONLY        = 2;
+  Z_DEFAULT_STRATEGY    = 0;
+
+  Z_BINARY   = 0;
+  Z_ASCII    = 1;
+  Z_UNKNOWN  = 2;
+
+  Z_DEFLATED    = 8;
+
+  MAX_MEM_LEVEL = 9;
+
+function adler32(adler: uLong; const buf: pBytef; len: uInt): uLong;
+             stdcall;
+function crc32(crc: uLong; const buf: pBytef; len: uInt): uLong;
+             stdcall;
+function deflate(strm: z_streamp; flush: int): int;
+             stdcall;
+function deflateCopy(dest, source: z_streamp): int;
+             stdcall;
+function deflateEnd(strm: z_streamp): int;
+             stdcall;
+function deflateInit2_(strm: z_streamp; level, method,
+                       windowBits, memLevel, strategy: int;
+                       const version: PChar; stream_size: int): int;
+             stdcall;
+function deflateInit_(strm: z_streamp; level: int;
+                      const version: PChar; stream_size: int): int;
+             stdcall;
+function deflateParams(strm: z_streamp; level, strategy: int): int;
+             stdcall;
+function deflateReset(strm: z_streamp): int;
+             stdcall;
+function deflateSetDictionary(strm: z_streamp;
+                              const dictionary: pBytef;
+                              dictLength: uInt): int;
+             stdcall;
+function inflate(strm: z_streamp; flush: int): int;
+             stdcall;
+function inflateEnd(strm: z_streamp): int;
+             stdcall;
+function inflateInit2_(strm: z_streamp; windowBits: int;
+                       const version: PChar; stream_size: int): int;
+             stdcall;
+function inflateInit_(strm: z_streamp; const version: PChar;
+                      stream_size: int): int;
+             stdcall;
+function inflateReset(strm: z_streamp): int;
+             stdcall;
+function inflateSetDictionary(strm: z_streamp;
+                              const dictionary: pBytef;
+                              dictLength: uInt): int;
+             stdcall;
+function inflateSync(strm: z_streamp): int;
+             stdcall;
+
+function deflateInit(strm: z_streamp; level: int): int;
+function deflateInit2(strm: z_streamp; level, method, windowBits,
+                      memLevel, strategy: int): int;
+function inflateInit(strm: z_streamp): int;
+function inflateInit2(strm: z_streamp; windowBits: int): int;
+
+implementation
+
+function deflateInit(strm: z_streamp; level: int): int;
+begin
+  Result := deflateInit_(strm, level, ZLIB_VERSION, sizeof(z_stream));
+end;
+
+function deflateInit2(strm: z_streamp; level, method, windowBits,
+                      memLevel, strategy: int): int;
+begin
+  Result := deflateInit2_(strm, level, method, windowBits, memLevel,
+                          strategy, ZLIB_VERSION, sizeof(z_stream));
+end;
+
+function inflateInit(strm: z_streamp): int;
+begin
+  Result := inflateInit_(strm, ZLIB_VERSION, sizeof(z_stream));
+end;
+
+function inflateInit2(strm: z_streamp; windowBits: int): int;
+begin
+  Result := inflateInit2_(strm, windowBits, ZLIB_VERSION,
+                          sizeof(z_stream));
+end;
+
+const
+  zlibDLL = 'png32bd.dll';
+
+function adler32; external zlibDLL;
+function crc32; external zlibDLL;
+function deflate; external zlibDLL;
+function deflateCopy; external zlibDLL;
+function deflateEnd; external zlibDLL;
+function deflateInit2_; external zlibDLL;
+function deflateInit_; external zlibDLL;
+function deflateParams; external zlibDLL;
+function deflateReset; external zlibDLL;
+function deflateSetDictionary; external zlibDLL;
+function inflate; external zlibDLL;
+function inflateEnd; external zlibDLL;
+function inflateInit2_; external zlibDLL;
+function inflateInit_; external zlibDLL;
+function inflateReset; external zlibDLL;
+function inflateSetDictionary; external zlibDLL;
+function inflateSync; external zlibDLL;
+
+end.

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/d_zlib.bpr
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/d_zlib.bpr	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/d_zlib.bpr	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,224 @@
+# ---------------------------------------------------------------------------
+!if !$d(BCB)
+BCB = $(MAKEDIR)\..
+!endif
+
+# ---------------------------------------------------------------------------
+# IDE SECTION
+# ---------------------------------------------------------------------------
+# The following section of the project makefile is managed by the BCB IDE.
+# It is recommended to use the IDE to change any of the values in this
+# section.
+# ---------------------------------------------------------------------------
+
+VERSION = BCB.03
+# ---------------------------------------------------------------------------
+PROJECT = d_zlib.lib
+OBJFILES = d_zlib.obj adler32.obj deflate.obj infblock.obj infcodes.obj inffast.obj \
+  inflate.obj inftrees.obj infutil.obj trees.obj
+RESFILES =
+RESDEPEN = $(RESFILES)
+LIBFILES =
+LIBRARIES = VCL35.lib
+SPARELIBS = VCL35.lib
+DEFFILE =
+PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi ibsmp35.bpi bcbsmp35.bpi \
+  dclocx35.bpi QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi DSS35.bpi \
+  NMFAST35.bpi INETDB35.bpi INET35.bpi VCLMID35.bpi
+# ---------------------------------------------------------------------------
+PATHCPP = .;
+PATHASM = .;
+PATHPAS = .;
+PATHRC = .;
+DEBUGLIBPATH = $(BCB)\lib\debug
+RELEASELIBPATH = $(BCB)\lib\release
+# ---------------------------------------------------------------------------
+CFLAG1 = -O2 -Ve -d -k- -vi
+CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl -H=$(BCB)\lib\vcl35.csm
+CFLAG3 = -ff -pr -5
+PFLAGS = -U;$(DEBUGLIBPATH) -I$(BCB)\include;$(BCB)\include\vcl -H -W -$I- -v -JPHN -M
+RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl 
+AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zn
+LFLAGS =
+IFLAGS = -g -Gn
+# ---------------------------------------------------------------------------
+ALLOBJ = c0w32.obj $(OBJFILES)
+ALLRES = $(RESFILES)
+ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib
+# ---------------------------------------------------------------------------
+!!ifdef IDEOPTIONS
+
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1040
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=2
+Item0=$(BCB)\include
+Item1=$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[Debugging]
+DebugSourceDirs=
+
+[Parameters]
+RunParams=
+HostApplication=
+
+!endif
+
+ ---------------------------------------------------------------------------
+# MAKE SECTION
+# ---------------------------------------------------------------------------
+# This section of the project file is not used by the BCB IDE.  It is for
+# the benefit of building from the command-line using the MAKE utility.
+# ---------------------------------------------------------------------------
+
+.autodepend
+# ---------------------------------------------------------------------------
+!if !$d(BCC32)
+BCC32 = bcc32
+!endif
+
+!if !$d(DCC32)
+DCC32 = dcc32
+!endif
+
+!if !$d(TASM32)
+TASM32 = tasm32
+!endif
+
+!if !$d(LINKER)
+LINKER = TLib
+!endif
+
+!if !$d(BRCC32)
+BRCC32 = brcc32
+!endif
+# ---------------------------------------------------------------------------
+!if $d(PATHCPP)
+.PATH.CPP = $(PATHCPP)
+.PATH.C   = $(PATHCPP)
+!endif
+
+!if $d(PATHPAS)
+.PATH.PAS = $(PATHPAS)
+!endif
+
+!if $d(PATHASM)
+.PATH.ASM = $(PATHASM)
+!endif
+
+!if $d(PATHRC)
+.PATH.RC  = $(PATHRC)
+!endif
+# ---------------------------------------------------------------------------
+!ifdef IDEOPTIONS
+
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1040
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=2
+Item0=$(BCB)\include;$(BCB)\include\vcl
+Item1=$(BCB)\include
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[Debugging]
+DebugSourceDirs=
+
+[Parameters]
+RunParams=
+HostApplication=
+
+!endif
+
+$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)
+    $(BCB)\BIN\$(LINKER) @&&!
+    $(LFLAGS) $(IFLAGS) +
+    $(ALLOBJ), +
+    $(PROJECT),, +
+    $(ALLLIB), +
+    $(DEFFILE), +
+    $(ALLRES)
+!
+# ---------------------------------------------------------------------------
+.pas.hpp:
+    $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
+
+.pas.obj:
+    $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
+
+.cpp.obj:
+    $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
+
+.c.obj:
+    $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
+
+.asm.obj:
+    $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@
+
+.rc.res:
+    $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
+# ---------------------------------------------------------------------------

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/d_zlib.cpp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/d_zlib.cpp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/d_zlib.cpp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,17 @@
+#include <condefs.h>
+#pragma hdrstop
+//---------------------------------------------------------------------------
+USEUNIT("adler32.c");
+USEUNIT("deflate.c");
+USEUNIT("infblock.c");
+USEUNIT("infcodes.c");
+USEUNIT("inffast.c");
+USEUNIT("inflate.c");
+USEUNIT("inftrees.c");
+USEUNIT("infutil.c");
+USEUNIT("trees.c");
+//---------------------------------------------------------------------------
+#define Library
+
+// To add a file to the library use the Project menu 'Add to Project'.
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/readme.txt
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/readme.txt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/readme.txt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,17 @@
+These are files used to compile zlib under Borland C++ Builder 3.
+
+zlib.bpg is the main project group that can be loaded in the BCB IDE and
+loads all other *.bpr projects
+
+zlib.bpr is a project used to create a static zlib.lib library with C calling
+convention for functions.
+
+zlib32.bpr creates a zlib32.dll dynamic link library with Windows standard
+calling convention.
+
+d_zlib.bpr creates a set of .obj files with register calling convention.
+These files are used by zlib.pas to create a Delphi unit containing zlib.
+The d_zlib.lib file generated isn't useful and can be deleted.
+
+zlib.cpp, zlib32.cpp and d_zlib.cpp are used by the above projects.
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.bpg
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.bpg	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.bpg	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,26 @@
+#------------------------------------------------------------------------------
+VERSION = BWS.01
+#------------------------------------------------------------------------------
+!ifndef ROOT
+ROOT = $(MAKEDIR)\..
+!endif
+#------------------------------------------------------------------------------
+MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
+DCC = $(ROOT)\bin\dcc32.exe $**
+BRCC = $(ROOT)\bin\brcc32.exe $**
+#------------------------------------------------------------------------------
+PROJECTS = zlib zlib32 d_zlib
+#------------------------------------------------------------------------------
+default: $(PROJECTS)
+#------------------------------------------------------------------------------
+
+zlib: zlib.bpr
+  $(MAKE)
+
+zlib32: zlib32.bpr
+  $(MAKE)
+
+d_zlib: d_zlib.bpr
+  $(MAKE)
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.bpr
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.bpr	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.bpr	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,225 @@
+# ---------------------------------------------------------------------------
+!if !$d(BCB)
+BCB = $(MAKEDIR)\..
+!endif
+
+# ---------------------------------------------------------------------------
+# IDE SECTION
+# ---------------------------------------------------------------------------
+# The following section of the project makefile is managed by the BCB IDE.
+# It is recommended to use the IDE to change any of the values in this
+# section.
+# ---------------------------------------------------------------------------
+
+VERSION = BCB.03
+# ---------------------------------------------------------------------------
+PROJECT = zlib.lib
+OBJFILES = zlib.obj adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj \
+  infcodes.obj inffast.obj inflate.obj inftrees.obj infutil.obj trees.obj \
+  uncompr.obj zutil.obj
+RESFILES =
+RESDEPEN = $(RESFILES)
+LIBFILES =
+LIBRARIES = VCL35.lib
+SPARELIBS = VCL35.lib
+DEFFILE =
+PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi ibsmp35.bpi bcbsmp35.bpi \
+  dclocx35.bpi QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi DSS35.bpi \
+  NMFAST35.bpi INETDB35.bpi INET35.bpi VCLMID35.bpi
+# ---------------------------------------------------------------------------
+PATHCPP = .;
+PATHASM = .;
+PATHPAS = .;
+PATHRC = .;
+DEBUGLIBPATH = $(BCB)\lib\debug
+RELEASELIBPATH = $(BCB)\lib\release
+# ---------------------------------------------------------------------------
+CFLAG1 = -O2 -Ve -d -k- -vi
+CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl -H=$(BCB)\lib\vcl35.csm
+CFLAG3 = -ff -5
+PFLAGS = -U;$(DEBUGLIBPATH) -I$(BCB)\include;$(BCB)\include\vcl -H -W -$I- -v -JPHN -M
+RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl 
+AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zn
+LFLAGS =
+IFLAGS = -g -Gn
+# ---------------------------------------------------------------------------
+ALLOBJ = c0w32.obj $(OBJFILES)
+ALLRES = $(RESFILES)
+ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib
+# ---------------------------------------------------------------------------
+!!ifdef IDEOPTIONS
+
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1040
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=2
+Item0=$(BCB)\include
+Item1=$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[Debugging]
+DebugSourceDirs=
+
+[Parameters]
+RunParams=
+HostApplication=
+
+!endif
+
+ ---------------------------------------------------------------------------
+# MAKE SECTION
+# ---------------------------------------------------------------------------
+# This section of the project file is not used by the BCB IDE.  It is for
+# the benefit of building from the command-line using the MAKE utility.
+# ---------------------------------------------------------------------------
+
+.autodepend
+# ---------------------------------------------------------------------------
+!if !$d(BCC32)
+BCC32 = bcc32
+!endif
+
+!if !$d(DCC32)
+DCC32 = dcc32
+!endif
+
+!if !$d(TASM32)
+TASM32 = tasm32
+!endif
+
+!if !$d(LINKER)
+LINKER = TLib
+!endif
+
+!if !$d(BRCC32)
+BRCC32 = brcc32
+!endif
+# ---------------------------------------------------------------------------
+!if $d(PATHCPP)
+.PATH.CPP = $(PATHCPP)
+.PATH.C   = $(PATHCPP)
+!endif
+
+!if $d(PATHPAS)
+.PATH.PAS = $(PATHPAS)
+!endif
+
+!if $d(PATHASM)
+.PATH.ASM = $(PATHASM)
+!endif
+
+!if $d(PATHRC)
+.PATH.RC  = $(PATHRC)
+!endif
+# ---------------------------------------------------------------------------
+!ifdef IDEOPTIONS
+
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1040
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=2
+Item0=$(BCB)\include;$(BCB)\include\vcl
+Item1=$(BCB)\include
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[Debugging]
+DebugSourceDirs=
+
+[Parameters]
+RunParams=
+HostApplication=
+
+!endif
+
+$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)
+    $(BCB)\BIN\$(LINKER) @&&!
+    $(LFLAGS) $(IFLAGS) +
+    $(ALLOBJ), +
+    $(PROJECT),, +
+    $(ALLLIB), +
+    $(DEFFILE), +
+    $(ALLRES)
+!
+# ---------------------------------------------------------------------------
+.pas.hpp:
+    $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
+
+.pas.obj:
+    $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
+
+.cpp.obj:
+    $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
+
+.c.obj:
+    $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
+
+.asm.obj:
+    $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@
+
+.rc.res:
+    $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
+# ---------------------------------------------------------------------------

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.cpp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.cpp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.cpp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,22 @@
+#include <condefs.h>
+#pragma hdrstop
+//---------------------------------------------------------------------------
+USEUNIT("adler32.c");
+USEUNIT("compress.c");
+USEUNIT("crc32.c");
+USEUNIT("deflate.c");
+USEUNIT("gzio.c");
+USEUNIT("infblock.c");
+USEUNIT("infcodes.c");
+USEUNIT("inffast.c");
+USEUNIT("inflate.c");
+USEUNIT("inftrees.c");
+USEUNIT("infutil.c");
+USEUNIT("trees.c");
+USEUNIT("uncompr.c");
+USEUNIT("zutil.c");
+//---------------------------------------------------------------------------
+#define Library
+
+// To add a file to the library use the Project menu 'Add to Project'.
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.pas
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.pas	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib.pas	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,534 @@
+{*******************************************************}
+{                                                       }
+{       Delphi Supplemental Components                  }
+{       ZLIB Data Compression Interface Unit            }
+{                                                       }
+{       Copyright (c) 1997 Borland International        }
+{                                                       }
+{*******************************************************}
+
+{ Modified for zlib 1.1.3 by Davide Moretti <dave at rimini.com }
+
+unit zlib;
+
+interface
+
+uses Sysutils, Classes;
+
+type
+  TAlloc = function (AppData: Pointer; Items, Size: Integer): Pointer;
+  TFree = procedure (AppData, Block: Pointer);
+
+  // Internal structure.  Ignore.
+  TZStreamRec = packed record
+    next_in: PChar;       // next input byte
+    avail_in: Integer;    // number of bytes available at next_in
+    total_in: Integer;    // total nb of input bytes read so far
+
+    next_out: PChar;      // next output byte should be put here
+    avail_out: Integer;   // remaining free space at next_out
+    total_out: Integer;   // total nb of bytes output so far
+
+    msg: PChar;           // last error message, NULL if no error
+    internal: Pointer;    // not visible by applications
+
+    zalloc: TAlloc;       // used to allocate the internal state
+    zfree: TFree;         // used to free the internal state
+    AppData: Pointer;     // private data object passed to zalloc and zfree
+
+    data_type: Integer;   //  best guess about the data type: ascii or binary
+    adler: Integer;       // adler32 value of the uncompressed data
+    reserved: Integer;    // reserved for future use
+  end;
+
+  // Abstract ancestor class
+  TCustomZlibStream = class(TStream)
+  private
+    FStrm: TStream;
+    FStrmPos: Integer;
+    FOnProgress: TNotifyEvent;
+    FZRec: TZStreamRec;
+    FBuffer: array [Word] of Char;
+  protected
+    procedure Progress(Sender: TObject); dynamic;
+    property OnProgress: TNotifyEvent read FOnProgress write FOnProgress;
+    constructor Create(Strm: TStream);
+  end;
+
+{ TCompressionStream compresses data on the fly as data is written to it, and
+  stores the compressed data to another stream.
+
+  TCompressionStream is write-only and strictly sequential. Reading from the
+  stream will raise an exception. Using Seek to move the stream pointer
+  will raise an exception.
+
+  Output data is cached internally, written to the output stream only when
+  the internal output buffer is full.  All pending output data is flushed
+  when the stream is destroyed.
+
+  The Position property returns the number of uncompressed bytes of
+  data that have been written to the stream so far.
+
+  CompressionRate returns the on-the-fly percentage by which the original
+  data has been compressed:  (1 - (CompressedBytes / UncompressedBytes)) * 100
+  If raw data size = 100 and compressed data size = 25, the CompressionRate
+  is 75%
+
+  The OnProgress event is called each time the output buffer is filled and
+  written to the output stream.  This is useful for updating a progress
+  indicator when you are writing a large chunk of data to the compression
+  stream in a single call.}
+
+
+  TCompressionLevel = (clNone, clFastest, clDefault, clMax);
+
+  TCompressionStream = class(TCustomZlibStream)
+  private
+    function GetCompressionRate: Single;
+  public
+    constructor Create(CompressionLevel: TCompressionLevel; Dest: TStream);
+    destructor Destroy; override;
+    function Read(var Buffer; Count: Longint): Longint; override;
+    function Write(const Buffer; Count: Longint): Longint; override;
+    function Seek(Offset: Longint; Origin: Word): Longint; override;
+    property CompressionRate: Single read GetCompressionRate;
+    property OnProgress;
+  end;
+
+{ TDecompressionStream decompresses data on the fly as data is read from it.
+
+  Compressed data comes from a separate source stream.  TDecompressionStream
+  is read-only and unidirectional; you can seek forward in the stream, but not
+  backwards.  The special case of setting the stream position to zero is
+  allowed.  Seeking forward decompresses data until the requested position in
+  the uncompressed data has been reached.  Seeking backwards, seeking relative
+  to the end of the stream, requesting the size of the stream, and writing to
+  the stream will raise an exception.
+
+  The Position property returns the number of bytes of uncompressed data that
+  have been read from the stream so far.
+
+  The OnProgress event is called each time the internal input buffer of
+  compressed data is exhausted and the next block is read from the input stream.
+  This is useful for updating a progress indicator when you are reading a
+  large chunk of data from the decompression stream in a single call.}
+
+  TDecompressionStream = class(TCustomZlibStream)
+  public
+    constructor Create(Source: TStream);
+    destructor Destroy; override;
+    function Read(var Buffer; Count: Longint): Longint; override;
+    function Write(const Buffer; Count: Longint): Longint; override;
+    function Seek(Offset: Longint; Origin: Word): Longint; override;
+    property OnProgress;
+  end;
+
+
+
+{ CompressBuf compresses data, buffer to buffer, in one call.
+   In: InBuf = ptr to compressed data
+       InBytes = number of bytes in InBuf
+  Out: OutBuf = ptr to newly allocated buffer containing decompressed data
+       OutBytes = number of bytes in OutBuf   }
+procedure CompressBuf(const InBuf: Pointer; InBytes: Integer;
+                      out OutBuf: Pointer; out OutBytes: Integer);
+
+
+{ DecompressBuf decompresses data, buffer to buffer, in one call.
+   In: InBuf = ptr to compressed data
+       InBytes = number of bytes in InBuf
+       OutEstimate = zero, or est. size of the decompressed data
+  Out: OutBuf = ptr to newly allocated buffer containing decompressed data
+       OutBytes = number of bytes in OutBuf   }
+procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer;
+ OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer);
+
+const
+  zlib_version = '1.1.3';
+
+type
+  EZlibError = class(Exception);
+  ECompressionError = class(EZlibError);
+  EDecompressionError = class(EZlibError);
+
+function adler32(adler: Integer; buf: PChar; len: Integer): Integer;
+
+implementation
+
+const
+  Z_NO_FLUSH      = 0;
+  Z_PARTIAL_FLUSH = 1;
+  Z_SYNC_FLUSH    = 2;
+  Z_FULL_FLUSH    = 3;
+  Z_FINISH        = 4;
+
+  Z_OK            = 0;
+  Z_STREAM_END    = 1;
+  Z_NEED_DICT     = 2;
+  Z_ERRNO         = (-1);
+  Z_STREAM_ERROR  = (-2);
+  Z_DATA_ERROR    = (-3);
+  Z_MEM_ERROR     = (-4);
+  Z_BUF_ERROR     = (-5);
+  Z_VERSION_ERROR = (-6);
+
+  Z_NO_COMPRESSION       =   0;
+  Z_BEST_SPEED           =   1;
+  Z_BEST_COMPRESSION     =   9;
+  Z_DEFAULT_COMPRESSION  = (-1);
+
+  Z_FILTERED            = 1;
+  Z_HUFFMAN_ONLY        = 2;
+  Z_DEFAULT_STRATEGY    = 0;
+
+  Z_BINARY   = 0;
+  Z_ASCII    = 1;
+  Z_UNKNOWN  = 2;
+
+  Z_DEFLATED = 8;
+
+  _z_errmsg: array[0..9] of PChar = (
+    'need dictionary',      // Z_NEED_DICT      (2)
+    'stream end',           // Z_STREAM_END     (1)
+    '',                     // Z_OK             (0)
+    'file error',           // Z_ERRNO          (-1)
+    'stream error',         // Z_STREAM_ERROR   (-2)
+    'data error',           // Z_DATA_ERROR     (-3)
+    'insufficient memory',  // Z_MEM_ERROR      (-4)
+    'buffer error',         // Z_BUF_ERROR      (-5)
+    'incompatible version', // Z_VERSION_ERROR  (-6)
+    ''
+  );
+
+{$L deflate.obj}
+{$L inflate.obj}
+{$L inftrees.obj}
+{$L trees.obj}
+{$L adler32.obj}
+{$L infblock.obj}
+{$L infcodes.obj}
+{$L infutil.obj}
+{$L inffast.obj}
+
+procedure _tr_init; external;
+procedure _tr_tally; external;
+procedure _tr_flush_block; external;
+procedure _tr_align; external;
+procedure _tr_stored_block; external;
+function adler32; external;
+procedure inflate_blocks_new; external;
+procedure inflate_blocks; external;
+procedure inflate_blocks_reset; external;
+procedure inflate_blocks_free; external;
+procedure inflate_set_dictionary; external;
+procedure inflate_trees_bits; external;
+procedure inflate_trees_dynamic; external;
+procedure inflate_trees_fixed; external;
+procedure inflate_codes_new; external;
+procedure inflate_codes; external;
+procedure inflate_codes_free; external;
+procedure _inflate_mask; external;
+procedure inflate_flush; external;
+procedure inflate_fast; external;
+
+procedure _memset(P: Pointer; B: Byte; count: Integer);cdecl;
+begin
+  FillChar(P^, count, B);
+end;
+
+procedure _memcpy(dest, source: Pointer; count: Integer);cdecl;
+begin
+  Move(source^, dest^, count);
+end;
+
+
+
+// deflate compresses data
+function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar;
+  recsize: Integer): Integer; external;
+function deflate(var strm: TZStreamRec; flush: Integer): Integer; external;
+function deflateEnd(var strm: TZStreamRec): Integer; external;
+
+// inflate decompresses data
+function inflateInit_(var strm: TZStreamRec; version: PChar;
+  recsize: Integer): Integer; external;
+function inflate(var strm: TZStreamRec; flush: Integer): Integer; external;
+function inflateEnd(var strm: TZStreamRec): Integer; external;
+function inflateReset(var strm: TZStreamRec): Integer; external;
+
+
+function zcalloc(AppData: Pointer; Items, Size: Integer): Pointer;
+begin
+  GetMem(Result, Items*Size);
+end;
+
+procedure zcfree(AppData, Block: Pointer);
+begin
+  FreeMem(Block);
+end;
+
+function zlibCheck(code: Integer): Integer;
+begin
+  Result := code;
+  if code < 0 then
+    raise EZlibError.Create('error');    //!!
+end;
+
+function CCheck(code: Integer): Integer;
+begin
+  Result := code;
+  if code < 0 then
+    raise ECompressionError.Create('error'); //!!
+end;
+
+function DCheck(code: Integer): Integer;
+begin
+  Result := code;
+  if code < 0 then
+    raise EDecompressionError.Create('error');  //!!
+end;
+
+procedure CompressBuf(const InBuf: Pointer; InBytes: Integer;
+                      out OutBuf: Pointer; out OutBytes: Integer);
+var
+  strm: TZStreamRec;
+  P: Pointer;
+begin
+  FillChar(strm, sizeof(strm), 0);
+  OutBytes := ((InBytes + (InBytes div 10) + 12) + 255) and not 255;
+  GetMem(OutBuf, OutBytes);
+  try
+    strm.next_in := InBuf;
+    strm.avail_in := InBytes;
+    strm.next_out := OutBuf;
+    strm.avail_out := OutBytes;
+    CCheck(deflateInit_(strm, Z_BEST_COMPRESSION, zlib_version, sizeof(strm)));
+    try
+      while CCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do
+      begin
+        P := OutBuf;
+        Inc(OutBytes, 256);
+        ReallocMem(OutBuf, OutBytes);
+        strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P)));
+        strm.avail_out := 256;
+      end;
+    finally
+      CCheck(deflateEnd(strm));
+    end;
+    ReallocMem(OutBuf, strm.total_out);
+    OutBytes := strm.total_out;
+  except
+    FreeMem(OutBuf);
+    raise
+  end;
+end;
+
+
+procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer;
+  OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer);
+var
+  strm: TZStreamRec;
+  P: Pointer;
+  BufInc: Integer;
+begin
+  FillChar(strm, sizeof(strm), 0);
+  BufInc := (InBytes + 255) and not 255;
+  if OutEstimate = 0 then
+    OutBytes := BufInc
+  else
+    OutBytes := OutEstimate;
+  GetMem(OutBuf, OutBytes);
+  try
+    strm.next_in := InBuf;
+    strm.avail_in := InBytes;
+    strm.next_out := OutBuf;
+    strm.avail_out := OutBytes;
+    DCheck(inflateInit_(strm, zlib_version, sizeof(strm)));
+    try
+      while DCheck(inflate(strm, Z_FINISH)) <> Z_STREAM_END do
+      begin
+        P := OutBuf;
+        Inc(OutBytes, BufInc);
+        ReallocMem(OutBuf, OutBytes);
+        strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P)));
+        strm.avail_out := BufInc;
+      end;
+    finally
+      DCheck(inflateEnd(strm));
+    end;
+    ReallocMem(OutBuf, strm.total_out);
+    OutBytes := strm.total_out;
+  except
+    FreeMem(OutBuf);
+    raise
+  end;
+end;
+
+
+// TCustomZlibStream
+
+constructor TCustomZLibStream.Create(Strm: TStream);
+begin
+  inherited Create;
+  FStrm := Strm;
+  FStrmPos := Strm.Position;
+end;
+
+procedure TCustomZLibStream.Progress(Sender: TObject);
+begin
+  if Assigned(FOnProgress) then FOnProgress(Sender);
+end;
+
+
+// TCompressionStream
+
+constructor TCompressionStream.Create(CompressionLevel: TCompressionLevel;
+  Dest: TStream);
+const
+  Levels: array [TCompressionLevel] of ShortInt =
+    (Z_NO_COMPRESSION, Z_BEST_SPEED, Z_DEFAULT_COMPRESSION, Z_BEST_COMPRESSION);
+begin
+  inherited Create(Dest);
+  FZRec.next_out := FBuffer;
+  FZRec.avail_out := sizeof(FBuffer);
+  CCheck(deflateInit_(FZRec, Levels[CompressionLevel], zlib_version, sizeof(FZRec)));
+end;
+
+destructor TCompressionStream.Destroy;
+begin
+  FZRec.next_in := nil;
+  FZRec.avail_in := 0;
+  try
+    if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos;
+    while (CCheck(deflate(FZRec, Z_FINISH)) <> Z_STREAM_END)
+      and (FZRec.avail_out = 0) do
+    begin
+      FStrm.WriteBuffer(FBuffer, sizeof(FBuffer));
+      FZRec.next_out := FBuffer;
+      FZRec.avail_out := sizeof(FBuffer);
+    end;
+    if FZRec.avail_out < sizeof(FBuffer) then
+      FStrm.WriteBuffer(FBuffer, sizeof(FBuffer) - FZRec.avail_out);
+  finally
+    deflateEnd(FZRec);
+  end;
+  inherited Destroy;
+end;
+
+function TCompressionStream.Read(var Buffer; Count: Longint): Longint;
+begin
+  raise ECompressionError.Create('Invalid stream operation');
+end;
+
+function TCompressionStream.Write(const Buffer; Count: Longint): Longint;
+begin
+  FZRec.next_in := @Buffer;
+  FZRec.avail_in := Count;
+  if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos;
+  while (FZRec.avail_in > 0) do
+  begin
+    CCheck(deflate(FZRec, 0));
+    if FZRec.avail_out = 0 then
+    begin
+      FStrm.WriteBuffer(FBuffer, sizeof(FBuffer));
+      FZRec.next_out := FBuffer;
+      FZRec.avail_out := sizeof(FBuffer);
+      FStrmPos := FStrm.Position;
+      Progress(Self);
+    end;
+  end;
+  Result := Count;
+end;
+
+function TCompressionStream.Seek(Offset: Longint; Origin: Word): Longint;
+begin
+  if (Offset = 0) and (Origin = soFromCurrent) then
+    Result := FZRec.total_in
+  else
+    raise ECompressionError.Create('Invalid stream operation');
+end;
+
+function TCompressionStream.GetCompressionRate: Single;
+begin
+  if FZRec.total_in = 0 then
+    Result := 0
+  else
+    Result := (1.0 - (FZRec.total_out / FZRec.total_in)) * 100.0;
+end;
+
+
+// TDecompressionStream
+
+constructor TDecompressionStream.Create(Source: TStream);
+begin
+  inherited Create(Source);
+  FZRec.next_in := FBuffer;
+  FZRec.avail_in := 0;
+  DCheck(inflateInit_(FZRec, zlib_version, sizeof(FZRec)));
+end;
+
+destructor TDecompressionStream.Destroy;
+begin
+  inflateEnd(FZRec);
+  inherited Destroy;
+end;
+
+function TDecompressionStream.Read(var Buffer; Count: Longint): Longint;
+begin
+  FZRec.next_out := @Buffer;
+  FZRec.avail_out := Count;
+  if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos;
+  while (FZRec.avail_out > 0) do
+  begin
+    if FZRec.avail_in = 0 then
+    begin
+      FZRec.avail_in := FStrm.Read(FBuffer, sizeof(FBuffer));
+      if FZRec.avail_in = 0 then
+        begin
+          Result := Count - FZRec.avail_out;
+          Exit;
+        end;
+      FZRec.next_in := FBuffer;
+      FStrmPos := FStrm.Position;
+      Progress(Self);
+    end;
+    DCheck(inflate(FZRec, 0));
+  end;
+  Result := Count;
+end;
+
+function TDecompressionStream.Write(const Buffer; Count: Longint): Longint;
+begin
+  raise EDecompressionError.Create('Invalid stream operation');
+end;
+
+function TDecompressionStream.Seek(Offset: Longint; Origin: Word): Longint;
+var
+  I: Integer;
+  Buf: array [0..4095] of Char;
+begin
+  if (Offset = 0) and (Origin = soFromBeginning) then
+  begin
+    DCheck(inflateReset(FZRec));
+    FZRec.next_in := FBuffer;
+    FZRec.avail_in := 0;
+    FStrm.Position := 0;
+    FStrmPos := 0;
+  end
+  else if ( (Offset >= 0) and (Origin = soFromCurrent)) or
+          ( ((Offset - FZRec.total_out) > 0) and (Origin = soFromBeginning)) then
+  begin
+    if Origin = soFromBeginning then Dec(Offset, FZRec.total_out);
+    if Offset > 0 then
+    begin
+      for I := 1 to Offset div sizeof(Buf) do
+        ReadBuffer(Buf, sizeof(Buf));
+      ReadBuffer(Buf, Offset mod sizeof(Buf));
+    end;
+  end
+  else
+    raise EDecompressionError.Create('Invalid stream operation');
+  Result := FZRec.total_out;
+end;
+
+end.

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib32.bpr
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib32.bpr	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib32.bpr	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,174 @@
+# ---------------------------------------------------------------------------
+!if !$d(BCB)
+BCB = $(MAKEDIR)\..
+!endif
+
+# ---------------------------------------------------------------------------
+# IDE SECTION
+# ---------------------------------------------------------------------------
+# The following section of the project makefile is managed by the BCB IDE.
+# It is recommended to use the IDE to change any of the values in this
+# section.
+# ---------------------------------------------------------------------------
+
+VERSION = BCB.03
+# ---------------------------------------------------------------------------
+PROJECT = zlib32.dll
+OBJFILES = zlib32.obj adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj \
+  infcodes.obj inffast.obj inflate.obj inftrees.obj infutil.obj trees.obj \
+  uncompr.obj zutil.obj
+RESFILES =
+RESDEPEN = $(RESFILES)
+LIBFILES =
+LIBRARIES = 
+SPARELIBS = 
+DEFFILE =
+PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi ibsmp35.bpi bcbsmp35.bpi \
+  dclocx35.bpi QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi DSS35.bpi \
+  NMFAST35.bpi INETDB35.bpi INET35.bpi VCLMID35.bpi
+# ---------------------------------------------------------------------------
+PATHCPP = .;
+PATHASM = .;
+PATHPAS = .;
+PATHRC = .;
+DEBUGLIBPATH = $(BCB)\lib\debug
+RELEASELIBPATH = $(BCB)\lib\release
+# ---------------------------------------------------------------------------
+CFLAG1 = -WD -O2 -Ve -d -k- -vi -c -tWD
+CFLAG2 = -D_NO_VCL;ZLIB_DLL -I$(BCB)\include
+CFLAG3 = -ff -5
+PFLAGS = -D_NO_VCL;ZLIB_DLL -U$(BCB)\lib;$(RELEASELIBPATH) -I$(BCB)\include -$I- -v \
+  -JPHN -M
+RFLAGS = -D_NO_VCL;ZLIB_DLL -i$(BCB)\include
+AFLAGS = /i$(BCB)\include /d_NO_VCL /dZLIB_DLL /mx /w2 /zn
+LFLAGS = -L$(BCB)\lib;$(RELEASELIBPATH) -aa -Tpd -x -Gi
+IFLAGS = -Gn -g
+# ---------------------------------------------------------------------------
+ALLOBJ = c0d32.obj $(OBJFILES)
+ALLRES = $(RESFILES)
+ALLLIB = $(LIBFILES)  import32.lib cw32mt.lib
+# ---------------------------------------------------------------------------
+!ifdef IDEOPTIONS
+
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=1
+Locale=1040
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=DLL (GUI)
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=1
+Item0=$(BCB)\include
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=$(BCB)\lib
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_NO_VCL;ZLIB_DLL
+
+[Debugging]
+DebugSourceDirs=
+
+[Parameters]
+RunParams=
+HostApplication=
+
+!endif
+
+# ---------------------------------------------------------------------------
+# MAKE SECTION
+# ---------------------------------------------------------------------------
+# This section of the project file is not used by the BCB IDE.  It is for
+# the benefit of building from the command-line using the MAKE utility.
+# ---------------------------------------------------------------------------
+
+.autodepend
+# ---------------------------------------------------------------------------
+!if !$d(BCC32)
+BCC32 = bcc32
+!endif
+
+!if !$d(DCC32)
+DCC32 = dcc32
+!endif
+
+!if !$d(TASM32)
+TASM32 = tasm32
+!endif
+
+!if !$d(LINKER)
+LINKER = ilink32
+!endif
+
+!if !$d(BRCC32)
+BRCC32 = brcc32
+!endif
+# ---------------------------------------------------------------------------
+!if $d(PATHCPP)
+.PATH.CPP = $(PATHCPP)
+.PATH.C   = $(PATHCPP)
+!endif
+
+!if $d(PATHPAS)
+.PATH.PAS = $(PATHPAS)
+!endif
+
+!if $d(PATHASM)
+.PATH.ASM = $(PATHASM)
+!endif
+
+!if $d(PATHRC)
+.PATH.RC  = $(PATHRC)
+!endif
+# ---------------------------------------------------------------------------
+$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)
+    $(BCB)\BIN\$(LINKER) @&&!
+    $(LFLAGS) $(IFLAGS) +
+    $(ALLOBJ), +
+    $(PROJECT),, +
+    $(ALLLIB), +
+    $(DEFFILE), +
+    $(ALLRES)
+!
+# ---------------------------------------------------------------------------
+.pas.hpp:
+    $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
+
+.pas.obj:
+    $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
+
+.cpp.obj:
+    $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
+
+.c.obj:
+    $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
+
+.asm.obj:
+    $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@
+
+.rc.res:
+    $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
+# ---------------------------------------------------------------------------

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib32.cpp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib32.cpp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/delphi2/zlib32.cpp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,42 @@
+
+#include <windows.h>
+#pragma hdrstop
+#include <condefs.h>
+
+
+//---------------------------------------------------------------------------
+//   Important note about DLL memory management in a VCL DLL:
+//
+//
+//
+// If your DLL uses VCL and exports any functions that pass VCL String objects
+// (or structs/classes containing nested Strings) as parameter or function
+// results, you will need to build both your DLL project and any EXE projects
+// that use your DLL with the dynamic RTL (the RTL DLL).  This will change your
+// DLL and its calling EXE's to use BORLNDMM.DLL as their memory manager. In
+// these cases, the file BORLNDMM.DLL should be deployed along with your DLL
+// and the RTL DLL (CP3240MT.DLL). To avoid the requiring BORLNDMM.DLL in
+// these situations, pass string information using "char *" or ShortString
+// parameters and then link with the static RTL.
+//
+//---------------------------------------------------------------------------
+USEUNIT("adler32.c");
+USEUNIT("compress.c");
+USEUNIT("crc32.c");
+USEUNIT("deflate.c");
+USEUNIT("gzio.c");
+USEUNIT("infblock.c");
+USEUNIT("infcodes.c");
+USEUNIT("inffast.c");
+USEUNIT("inflate.c");
+USEUNIT("inftrees.c");
+USEUNIT("infutil.c");
+USEUNIT("trees.c");
+USEUNIT("uncompr.c");
+USEUNIT("zutil.c");
+//---------------------------------------------------------------------------
+#pragma argsused
+int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
+{
+        return 1;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/test.cpp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/test.cpp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/test.cpp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,24 @@
+
+#include "zfstream.h"
+
+int main() {
+
+  // Construct a stream object with this filebuffer.  Anything sent
+  // to this stream will go to standard out.
+  gzofstream os( 1, ios::out );
+
+  // This text is getting compressed and sent to stdout.
+  // To prove this, run 'test | zcat'.
+  os << "Hello, Mommy" << endl;
+
+  os << setcompressionlevel( Z_NO_COMPRESSION );
+  os << "hello, hello, hi, ho!" << endl;
+
+  setcompressionlevel( os, Z_DEFAULT_COMPRESSION )
+    << "I'm compressing again" << endl;
+
+  os.close();
+
+  return 0;
+
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/zfstream.cpp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/zfstream.cpp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/zfstream.cpp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,329 @@
+
+#include <memory.h>
+#include "zfstream.h"
+
+gzfilebuf::gzfilebuf() :
+  file(NULL),
+  mode(0),
+  own_file_descriptor(0)
+{ }
+
+gzfilebuf::~gzfilebuf() {
+
+  sync();
+  if ( own_file_descriptor )
+    close();
+
+}
+
+gzfilebuf *gzfilebuf::open( const char *name,
+			    int io_mode ) {
+
+  if ( is_open() )
+    return NULL;
+
+  char char_mode[10];
+  char *p;
+  memset(char_mode,'\0',10);
+  p = char_mode;
+
+  if ( io_mode & ios::in ) {
+    mode = ios::in;
+    *p++ = 'r';
+  } else if ( io_mode & ios::app ) {
+    mode = ios::app;
+    *p++ = 'a';
+  } else {
+    mode = ios::out;
+    *p++ = 'w';
+  }
+
+  if ( io_mode & ios::binary ) {
+    mode |= ios::binary;
+    *p++ = 'b';
+  }
+
+  // Hard code the compression level
+  if ( io_mode & (ios::out|ios::app )) {
+    *p++ = '9';
+  }
+
+  if ( (file = gzopen(name, char_mode)) == NULL )
+    return NULL;
+
+  own_file_descriptor = 1;
+
+  return this;
+
+}
+
+gzfilebuf *gzfilebuf::attach( int file_descriptor,
+			      int io_mode ) {
+
+  if ( is_open() )
+    return NULL;
+
+  char char_mode[10];
+  char *p;
+  memset(char_mode,'\0',10);
+  p = char_mode;
+
+  if ( io_mode & ios::in ) {
+    mode = ios::in;
+    *p++ = 'r';
+  } else if ( io_mode & ios::app ) {
+    mode = ios::app;
+    *p++ = 'a';
+  } else {
+    mode = ios::out;
+    *p++ = 'w';
+  }
+
+  if ( io_mode & ios::binary ) {
+    mode |= ios::binary;
+    *p++ = 'b';
+  }
+
+  // Hard code the compression level
+  if ( io_mode & (ios::out|ios::app )) {
+    *p++ = '9';
+  }
+
+  if ( (file = gzdopen(file_descriptor, char_mode)) == NULL )
+    return NULL;
+
+  own_file_descriptor = 0;
+
+  return this;
+
+}
+
+gzfilebuf *gzfilebuf::close() {
+
+  if ( is_open() ) {
+
+    sync();
+    gzclose( file );
+    file = NULL;
+
+  }
+
+  return this;
+
+}
+
+int gzfilebuf::setcompressionlevel( short comp_level ) {
+
+  return gzsetparams(file, comp_level, -2);
+
+}
+
+int gzfilebuf::setcompressionstrategy( short comp_strategy ) {
+
+  return gzsetparams(file, -2, comp_strategy);
+
+}
+
+
+streampos gzfilebuf::seekoff( streamoff off, ios::seek_dir dir, int which ) {
+
+  return streampos(EOF);
+
+}
+
+int gzfilebuf::underflow() {
+
+  // If the file hasn't been opened for reading, error.
+  if ( !is_open() || !(mode & ios::in) )
+    return EOF;
+
+  // if a buffer doesn't exists, allocate one.
+  if ( !base() ) {
+
+    if ( (allocate()) == EOF )
+      return EOF;
+    setp(0,0);
+
+  } else {
+
+    if ( in_avail() )
+      return (unsigned char) *gptr();
+
+    if ( out_waiting() ) {
+      if ( flushbuf() == EOF )
+	return EOF;
+    }
+
+  }
+
+  // Attempt to fill the buffer.
+
+  int result = fillbuf();
+  if ( result == EOF ) {
+    // disable get area
+    setg(0,0,0);
+    return EOF;
+  }
+
+  return (unsigned char) *gptr();
+
+}
+
+int gzfilebuf::overflow( int c ) {
+
+  if ( !is_open() || !(mode & ios::out) )
+    return EOF;
+
+  if ( !base() ) {
+    if ( allocate() == EOF )
+      return EOF;
+    setg(0,0,0);
+  } else {
+    if (in_avail()) {
+	return EOF;
+    }
+    if (out_waiting()) {
+      if (flushbuf() == EOF)
+	return EOF;
+    }
+  }
+
+  int bl = blen();
+  setp( base(), base() + bl);
+
+  if ( c != EOF ) {
+
+    *pptr() = c;
+    pbump(1);
+
+  }
+
+  return 0;
+
+}
+
+int gzfilebuf::sync() {
+
+  if ( !is_open() )
+    return EOF;
+
+  if ( out_waiting() )
+    return flushbuf();
+
+  return 0;
+
+}
+
+int gzfilebuf::flushbuf() {
+
+  int n;
+  char *q;
+
+  q = pbase();
+  n = pptr() - q;
+
+  if ( gzwrite( file, q, n) < n )
+    return EOF;
+
+  setp(0,0);
+
+  return 0;
+
+}
+
+int gzfilebuf::fillbuf() {
+
+  int required;
+  char *p;
+
+  p = base();
+
+  required = blen();
+
+  int t = gzread( file, p, required );
+
+  if ( t <= 0) return EOF;
+
+  setg( base(), base(), base()+t);
+
+  return t;
+
+}
+
+gzfilestream_common::gzfilestream_common() :
+  ios( gzfilestream_common::rdbuf() )
+{ }
+
+gzfilestream_common::~gzfilestream_common()
+{ }
+
+void gzfilestream_common::attach( int fd, int io_mode ) {
+
+  if ( !buffer.attach( fd, io_mode) )
+    clear( ios::failbit | ios::badbit );
+  else
+    clear();
+
+}
+
+void gzfilestream_common::open( const char *name, int io_mode ) {
+
+  if ( !buffer.open( name, io_mode ) )
+    clear( ios::failbit | ios::badbit );
+  else
+    clear();
+
+}
+
+void gzfilestream_common::close() {
+
+  if ( !buffer.close() )
+    clear( ios::failbit | ios::badbit );
+
+}
+
+gzfilebuf *gzfilestream_common::rdbuf() {
+
+  return &buffer;
+
+}
+     
+gzifstream::gzifstream() :
+  ios( gzfilestream_common::rdbuf() )
+{
+  clear( ios::badbit );
+}
+
+gzifstream::gzifstream( const char *name, int io_mode ) :
+  ios( gzfilestream_common::rdbuf() )
+{
+  gzfilestream_common::open( name, io_mode );
+}
+
+gzifstream::gzifstream( int fd, int io_mode ) :
+  ios( gzfilestream_common::rdbuf() )
+{
+  gzfilestream_common::attach( fd, io_mode );
+}
+
+gzifstream::~gzifstream() { }
+
+gzofstream::gzofstream() :
+  ios( gzfilestream_common::rdbuf() )
+{
+  clear( ios::badbit );
+}
+
+gzofstream::gzofstream( const char *name, int io_mode ) :
+  ios( gzfilestream_common::rdbuf() )
+{
+  gzfilestream_common::open( name, io_mode );
+}
+
+gzofstream::gzofstream( int fd, int io_mode ) :
+  ios( gzfilestream_common::rdbuf() )
+{
+  gzfilestream_common::attach( fd, io_mode );
+}
+
+gzofstream::~gzofstream() { }

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/zfstream.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/zfstream.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream/zfstream.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,142 @@
+
+#ifndef _zfstream_h
+#define _zfstream_h
+
+#include <fstream.h>
+#include "zlib.h"
+
+class gzfilebuf : public streambuf {
+
+public:
+
+  gzfilebuf( );
+  virtual ~gzfilebuf();
+
+  gzfilebuf *open( const char *name, int io_mode );
+  gzfilebuf *attach( int file_descriptor, int io_mode );
+  gzfilebuf *close();
+
+  int setcompressionlevel( short comp_level );
+  int setcompressionstrategy( short comp_strategy );
+
+  inline int is_open() const { return (file !=NULL); }
+
+  virtual streampos seekoff( streamoff, ios::seek_dir, int );
+
+  virtual int sync();
+
+protected:
+
+  virtual int underflow();
+  virtual int overflow( int = EOF );
+
+private:
+
+  gzFile file;
+  short mode;
+  short own_file_descriptor;
+
+  int flushbuf();
+  int fillbuf();
+
+};
+
+class gzfilestream_common : virtual public ios {
+
+  friend class gzifstream;
+  friend class gzofstream;
+  friend gzofstream &setcompressionlevel( gzofstream &, int );
+  friend gzofstream &setcompressionstrategy( gzofstream &, int );
+
+public:
+  virtual ~gzfilestream_common();
+
+  void attach( int fd, int io_mode );
+  void open( const char *name, int io_mode );
+  void close();
+
+protected:
+  gzfilestream_common();
+
+private:
+  gzfilebuf *rdbuf();
+
+  gzfilebuf buffer;
+
+};
+
+class gzifstream : public gzfilestream_common, public istream {
+
+public:
+
+  gzifstream();
+  gzifstream( const char *name, int io_mode = ios::in );
+  gzifstream( int fd, int io_mode = ios::in );
+
+  virtual ~gzifstream();
+
+};
+
+class gzofstream : public gzfilestream_common, public ostream {
+
+public:
+
+  gzofstream();
+  gzofstream( const char *name, int io_mode = ios::out );
+  gzofstream( int fd, int io_mode = ios::out );
+
+  virtual ~gzofstream();
+
+};
+
+template<class T> class gzomanip {
+  friend gzofstream &operator<<(gzofstream &, const gzomanip<T> &);
+public:
+  gzomanip(gzofstream &(*f)(gzofstream &, T), T v) : func(f), val(v) { }
+private:
+  gzofstream &(*func)(gzofstream &, T);
+  T val;
+};
+
+template<class T> gzofstream &operator<<(gzofstream &s,
+					 const gzomanip<T> &m) {
+  return (*m.func)(s, m.val);
+  
+}
+
+inline gzofstream &setcompressionlevel( gzofstream &s, int l ) {
+  (s.rdbuf())->setcompressionlevel(l);
+  return s;
+}
+
+inline gzofstream &setcompressionstrategy( gzofstream &s, int l ) {
+  (s.rdbuf())->setcompressionstrategy(l);
+  return s;
+}
+
+inline gzomanip<int> setcompressionlevel(int l)
+{
+  return gzomanip<int>(&setcompressionlevel,l);
+}
+
+inline gzomanip<int> setcompressionstrategy(int l)
+{
+  return gzomanip<int>(&setcompressionstrategy,l);
+}
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2/zstream.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2/zstream.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2/zstream.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,307 @@
+/*
+ *
+ * Copyright (c) 1997
+ * Christian Michelsen Research AS
+ * Advanced Computing
+ * Fantoftvegen 38, 5036 BERGEN, Norway
+ * http://www.cmr.no
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation.  Christian Michelsen Research AS makes no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef ZSTREAM__H
+#define ZSTREAM__H
+
+/*
+ * zstream.h - C++ interface to the 'zlib' general purpose compression library
+ * $Id: zstream.h,v 1.1 1998/12/18 21:39:28 koziol Exp $
+ */
+
+#include <strstream.h>
+#include <string.h>
+#include <stdio.h>
+#include "zlib.h"
+
+#if defined(_WIN32)
+#   include <fcntl.h>
+#   include <io.h>
+#   define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
+#else
+#   define SET_BINARY_MODE(file)
+#endif
+
+class zstringlen {
+public:
+    zstringlen(class izstream&);
+    zstringlen(class ozstream&, const char*);
+    size_t value() const { return val.word; }
+private:
+    struct Val { unsigned char byte; size_t word; } val;
+};
+
+//  ----------------------------- izstream -----------------------------
+
+class izstream
+{
+    public:
+        izstream() : m_fp(0) {}
+        izstream(FILE* fp) : m_fp(0) { open(fp); }
+        izstream(const char* name) : m_fp(0) { open(name); }
+        ~izstream() { close(); }
+
+        /* Opens a gzip (.gz) file for reading.
+         * open() can be used to read a file which is not in gzip format;
+         * in this case read() will directly read from the file without
+         * decompression. errno can be checked to distinguish two error
+         * cases (if errno is zero, the zlib error is Z_MEM_ERROR).
+         */
+        void open(const char* name) {
+            if (m_fp) close();
+            m_fp = ::gzopen(name, "rb");
+        }
+
+        void open(FILE* fp) {
+            SET_BINARY_MODE(fp);
+            if (m_fp) close();
+            m_fp = ::gzdopen(fileno(fp), "rb");
+        }
+
+        /* Flushes all pending input if necessary, closes the compressed file
+         * and deallocates all the (de)compression state. The return value is
+         * the zlib error number (see function error() below).
+         */
+        int close() {
+            int r = ::gzclose(m_fp);
+            m_fp = 0; return r;
+        }
+
+        /* Binary read the given number of bytes from the compressed file.
+         */
+        int read(void* buf, size_t len) {
+            return ::gzread(m_fp, buf, len);
+        }
+
+        /* Returns the error message for the last error which occurred on the
+         * given compressed file. errnum is set to zlib error number. If an
+         * error occurred in the file system and not in the compression library,
+         * errnum is set to Z_ERRNO and the application may consult errno
+         * to get the exact error code.
+         */
+        const char* error(int* errnum) {
+            return ::gzerror(m_fp, errnum);
+        }
+
+        gzFile fp() { return m_fp; }
+
+    private:
+        gzFile m_fp;
+};
+
+/*
+ * Binary read the given (array of) object(s) from the compressed file.
+ * If the input file was not in gzip format, read() copies the objects number
+ * of bytes into the buffer.
+ * returns the number of uncompressed bytes actually read
+ * (0 for end of file, -1 for error).
+ */
+template <class T, class Items>
+inline int read(izstream& zs, T* x, Items items) {
+    return ::gzread(zs.fp(), x, items*sizeof(T));
+}
+
+/*
+ * Binary input with the '>' operator.
+ */
+template <class T>
+inline izstream& operator>(izstream& zs, T& x) {
+    ::gzread(zs.fp(), &x, sizeof(T));
+    return zs;
+}
+
+
+inline zstringlen::zstringlen(izstream& zs) {
+    zs > val.byte;
+    if (val.byte == 255) zs > val.word;
+    else val.word = val.byte;
+}
+
+/*
+ * Read length of string + the string with the '>' operator.
+ */
+inline izstream& operator>(izstream& zs, char* x) {
+    zstringlen len(zs);
+    ::gzread(zs.fp(), x, len.value());
+    x[len.value()] = '\0';
+    return zs;
+}
+
+inline char* read_string(izstream& zs) {
+    zstringlen len(zs);
+    char* x = new char[len.value()+1];
+    ::gzread(zs.fp(), x, len.value());
+    x[len.value()] = '\0';
+    return x;
+}
+
+// ----------------------------- ozstream -----------------------------
+
+class ozstream
+{
+    public:
+        ozstream() : m_fp(0), m_os(0) {
+        }
+        ozstream(FILE* fp, int level = Z_DEFAULT_COMPRESSION)
+            : m_fp(0), m_os(0) {
+            open(fp, level);
+        }
+        ozstream(const char* name, int level = Z_DEFAULT_COMPRESSION)
+            : m_fp(0), m_os(0) {
+            open(name, level);
+        }
+        ~ozstream() {
+            close();
+        }
+
+        /* Opens a gzip (.gz) file for writing.
+         * The compression level parameter should be in 0..9
+         * errno can be checked to distinguish two error cases
+         * (if errno is zero, the zlib error is Z_MEM_ERROR).
+         */
+        void open(const char* name, int level = Z_DEFAULT_COMPRESSION) {
+            char mode[4] = "wb\0";
+            if (level != Z_DEFAULT_COMPRESSION) mode[2] = '0'+level;
+            if (m_fp) close();
+            m_fp = ::gzopen(name, mode);
+        }
+
+        /* open from a FILE pointer.
+         */
+        void open(FILE* fp, int level = Z_DEFAULT_COMPRESSION) {
+            SET_BINARY_MODE(fp);
+            char mode[4] = "wb\0";
+            if (level != Z_DEFAULT_COMPRESSION) mode[2] = '0'+level;
+            if (m_fp) close();
+            m_fp = ::gzdopen(fileno(fp), mode);
+        }
+
+        /* Flushes all pending output if necessary, closes the compressed file
+         * and deallocates all the (de)compression state. The return value is
+         * the zlib error number (see function error() below).
+         */
+        int close() {
+            if (m_os) {
+                ::gzwrite(m_fp, m_os->str(), m_os->pcount());
+                delete[] m_os->str(); delete m_os; m_os = 0;
+            }
+            int r = ::gzclose(m_fp); m_fp = 0; return r;
+        }
+
+        /* Binary write the given number of bytes into the compressed file.
+         */
+        int write(const void* buf, size_t len) {
+            return ::gzwrite(m_fp, (voidp) buf, len);
+        }
+
+        /* Flushes all pending output into the compressed file. The parameter
+         * _flush is as in the deflate() function. The return value is the zlib
+         * error number (see function gzerror below). flush() returns Z_OK if
+         * the flush_ parameter is Z_FINISH and all output could be flushed.
+         * flush() should be called only when strictly necessary because it can
+         * degrade compression.
+         */
+        int flush(int _flush) {
+            os_flush();
+            return ::gzflush(m_fp, _flush);
+        }
+
+        /* Returns the error message for the last error which occurred on the
+         * given compressed file. errnum is set to zlib error number. If an
+         * error occurred in the file system and not in the compression library,
+         * errnum is set to Z_ERRNO and the application may consult errno
+         * to get the exact error code.
+         */
+        const char* error(int* errnum) {
+            return ::gzerror(m_fp, errnum);
+        }
+
+        gzFile fp() { return m_fp; }
+
+        ostream& os() {
+            if (m_os == 0) m_os = new ostrstream;
+            return *m_os;
+        }
+
+        void os_flush() {
+            if (m_os && m_os->pcount()>0) {
+                ostrstream* oss = new ostrstream;
+                oss->fill(m_os->fill());
+                oss->flags(m_os->flags());
+                oss->precision(m_os->precision());
+                oss->width(m_os->width());
+                ::gzwrite(m_fp, m_os->str(), m_os->pcount());
+                delete[] m_os->str(); delete m_os; m_os = oss;
+            }
+        }
+
+    private:
+        gzFile m_fp;
+        ostrstream* m_os;
+};
+
+/*
+ * Binary write the given (array of) object(s) into the compressed file.
+ * returns the number of uncompressed bytes actually written
+ * (0 in case of error).
+ */
+template <class T, class Items>
+inline int write(ozstream& zs, const T* x, Items items) {
+    return ::gzwrite(zs.fp(), (voidp) x, items*sizeof(T));
+}
+
+/*
+ * Binary output with the '<' operator.
+ */
+template <class T>
+inline ozstream& operator<(ozstream& zs, const T& x) {
+    ::gzwrite(zs.fp(), (voidp) &x, sizeof(T));
+    return zs;
+}
+
+inline zstringlen::zstringlen(ozstream& zs, const char* x) {
+    val.byte = 255;  val.word = ::strlen(x);
+    if (val.word < 255) zs < (val.byte = val.word);
+    else zs < val;
+}
+
+/*
+ * Write length of string + the string with the '<' operator.
+ */
+inline ozstream& operator<(ozstream& zs, const char* x) {
+    zstringlen len(zs, x);
+    ::gzwrite(zs.fp(), (voidp) x, len.value());
+    return zs;
+}
+
+#ifdef _MSC_VER
+inline ozstream& operator<(ozstream& zs, char* const& x) {
+    return zs < (const char*) x;
+}
+#endif
+
+/*
+ * Ascii write with the << operator;
+ */
+template <class T>
+inline ostream& operator<<(ozstream& zs, const T& x) {
+    zs.os_flush();
+    return zs.os() << x;
+}
+
+#endif

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2/zstream_test.cpp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2/zstream_test.cpp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/iostream2/zstream_test.cpp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,25 @@
+#include "zstream.h"
+#include <math.h>
+#include <stdlib.h>
+#include <iomanip.h>
+
+void main() {
+	char h[256] = "Hello";
+	char* g = "Goodbye";
+	ozstream out("temp.gz");
+    out < "This works well" < h < g;
+    out.close();
+
+    izstream in("temp.gz"); // read it back
+    char *x = read_string(in), *y = new char[256], z[256];
+    in > y > z;
+    in.close();
+    cout << x << endl << y << endl << z << endl;
+
+    out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results
+    out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl;
+    out << z << endl << y << endl << x << endl;
+    out << 1.1234567890123456789 << endl;
+
+    delete[] x; delete[] y;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/ChangeLogUnzip
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/ChangeLogUnzip	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/ChangeLogUnzip	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+Change in 0.15: (19 Mar 98)
+- fix memory leak in minizip.c
+
+Change in 0.14: (10 Mar 98)
+- fix bugs in minizip.c sample for zipping big file
+- fix problem in month in date handling
+- fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for 
+    comment handling
+
+Change in 0.13: (6 Mar 98)
+- fix bugs in zip.c
+- add real minizip sample
+
+Change in 0.12: (4 Mar 98)
+- add zip.c and zip.h for creates .zip file
+- fix change_file_date in miniunz.c for Unix (Jean-loup Gailly)
+- fix miniunz.c for file without specific record for directory
+
+Change in 0.11: (3 Mar 98)
+- fix bug in unzGetCurrentFileInfo for get extra field and comment
+- enhance miniunz sample, remove the bad unztst.c sample
+
+Change in 0.10: (2 Mar 98)
+- fix bug in unzReadCurrentFile
+- rename unzip* to unz* function and structure
+- remove Windows-like hungary notation variable name
+- modify some structure in unzip.h
+- add somes comment in source
+- remove unzipGetcCurrentFile function
+- replace ZUNZEXPORT by ZEXPORT
+- add unzGetLocalExtrafield for get the local extrafield info
+- add a new sample, miniunz.c
+
+Change in 0.4: (25 Feb 98)
+- suppress the type unzipFileInZip. 
+  Only on file in the zipfile can be open at the same time
+- fix somes typo in code
+- added tm_unz structure in unzip_file_info (date/time in readable format)

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/Makefile
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/Makefile	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/Makefile	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,25 @@
+CC=cc
+CFLAGS=-O -I../..
+
+UNZ_OBJS = miniunz.o unzip.o ../../libz.a
+ZIP_OBJS = minizip.o zip.o   ../../libz.a
+
+.c.o:
+	$(CC) -c $(CFLAGS) $*.c
+
+all: miniunz minizip
+
+miniunz:  $(UNZ_OBJS)
+	$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
+
+minizip:  $(ZIP_OBJS)
+	$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
+
+test:	miniunz minizip
+	./minizip test readme.txt
+	./miniunz -l test.zip
+	mv readme.txt readme.old
+	./miniunz test.zip
+
+clean:
+	/bin/rm -f *.o *~ minizip miniunz

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/miniunz.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/miniunz.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/miniunz.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,508 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#ifdef unix
+# include <unistd.h>
+# include <utime.h>
+#else
+# include <direct.h>
+# include <io.h>
+#endif
+
+#include "unzip.h"
+
+#define CASESENSITIVITY (0)
+#define WRITEBUFFERSIZE (8192)
+
+/*
+  mini unzip, demo of unzip package
+
+  usage :
+  Usage : miniunz [-exvlo] file.zip [file_to_extract]
+
+  list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT
+    if it exists
+*/
+
+
+/* change_file_date : change the date/time of a file
+    filename : the filename of the file where date/time must be modified
+    dosdate : the new date at the MSDos format (4 bytes)
+    tmu_date : the SAME new date at the tm_unz format */
+void change_file_date(filename,dosdate,tmu_date)
+	const char *filename;
+	uLong dosdate;
+	tm_unz tmu_date;
+{
+#ifdef WIN32
+  HANDLE hFile;
+  FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
+
+  hFile = CreateFile(filename,GENERIC_READ | GENERIC_WRITE,
+                      0,NULL,OPEN_EXISTING,0,NULL);
+  GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite);
+  DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal);
+  LocalFileTimeToFileTime(&ftLocal,&ftm);
+  SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
+  CloseHandle(hFile);
+#else
+#ifdef unix
+  struct utimbuf ut;
+  struct tm newdate;
+  newdate.tm_sec = tmu_date.tm_sec;
+  newdate.tm_min=tmu_date.tm_min;
+  newdate.tm_hour=tmu_date.tm_hour;
+  newdate.tm_mday=tmu_date.tm_mday;
+  newdate.tm_mon=tmu_date.tm_mon;
+  if (tmu_date.tm_year > 1900)
+      newdate.tm_year=tmu_date.tm_year - 1900;
+  else
+      newdate.tm_year=tmu_date.tm_year ;
+  newdate.tm_isdst=-1;
+
+  ut.actime=ut.modtime=mktime(&newdate);
+  utime(filename,&ut);
+#endif
+#endif
+}
+
+
+/* mymkdir and change_file_date are not 100 % portable
+   As I don't know well Unix, I wait feedback for the unix portion */
+
+int mymkdir(dirname)
+	const char* dirname;
+{
+    int ret=0;
+#ifdef WIN32
+	ret = mkdir(dirname);
+#else
+#ifdef unix
+	ret = mkdir (dirname,0775);
+#endif
+#endif
+	return ret;
+}
+
+int makedir (newdir)
+    char *newdir;
+{
+  char *buffer ;
+  char *p;
+  int  len = strlen(newdir);  
+
+  if (len <= 0) 
+    return 0;
+
+  buffer = (char*)malloc(len+1);
+  strcpy(buffer,newdir);
+  
+  if (buffer[len-1] == '/') {
+    buffer[len-1] = '\0';
+  }
+  if (mymkdir(buffer) == 0)
+    {
+      free(buffer);
+      return 1;
+    }
+
+  p = buffer+1;
+  while (1)
+    {
+      char hold;
+
+      while(*p && *p != '\\' && *p != '/')
+        p++;
+      hold = *p;
+      *p = 0;
+      if ((mymkdir(buffer) == -1) && (errno == ENOENT))
+        {
+          printf("couldn't create directory %s\n",buffer);
+          free(buffer);
+          return 0;
+        }
+      if (hold == 0)
+        break;
+      *p++ = hold;
+    }
+  free(buffer);
+  return 1;
+}
+
+void do_banner()
+{
+	printf("MiniUnz 0.15, demo of zLib + Unz package written by Gilles Vollant\n");
+	printf("more info at http://wwww.winimage/zLibDll/unzip.htm\n\n");
+}
+
+void do_help()
+{	
+	printf("Usage : miniunz [-exvlo] file.zip [file_to_extract]\n\n") ;
+}
+
+
+int do_list(uf)
+	unzFile uf;
+{
+	uLong i;
+	unz_global_info gi;
+	int err;
+
+	err = unzGetGlobalInfo (uf,&gi);
+	if (err!=UNZ_OK)
+		printf("error %d with zipfile in unzGetGlobalInfo \n",err);
+    printf(" Length  Method   Size  Ratio   Date    Time   CRC-32     Name\n");
+    printf(" ------  ------   ----  -----   ----    ----   ------     ----\n");
+	for (i=0;i<gi.number_entry;i++)
+	{
+		char filename_inzip[256];
+		unz_file_info file_info;
+		uLong ratio=0;
+		const char *string_method;
+		err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
+		if (err!=UNZ_OK)
+		{
+			printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
+			break;
+		}
+		if (file_info.uncompressed_size>0)
+			ratio = (file_info.compressed_size*100)/file_info.uncompressed_size;
+
+		if (file_info.compression_method==0)
+			string_method="Stored";
+		else
+		if (file_info.compression_method==Z_DEFLATED)
+		{
+			uInt iLevel=(uInt)((file_info.flag & 0x6)/2);
+			if (iLevel==0)
+			  string_method="Defl:N";
+			else if (iLevel==1)
+			  string_method="Defl:X";
+			else if ((iLevel==2) || (iLevel==3))
+			  string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
+		}
+		else
+			string_method="Unkn. ";
+
+		printf("%7lu  %6s %7lu %3lu%%  %2.2lu-%2.2lu-%2.2lu  %2.2lu:%2.2lu  %8.8lx   %s\n",
+			    file_info.uncompressed_size,string_method,file_info.compressed_size,
+				ratio,
+				(uLong)file_info.tmu_date.tm_mon + 1,
+                (uLong)file_info.tmu_date.tm_mday,
+				(uLong)file_info.tmu_date.tm_year % 100,
+				(uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min,
+				(uLong)file_info.crc,filename_inzip);
+		if ((i+1)<gi.number_entry)
+		{
+			err = unzGoToNextFile(uf);
+			if (err!=UNZ_OK)
+			{
+				printf("error %d with zipfile in unzGoToNextFile\n",err);
+				break;
+			}
+		}
+	}
+
+	return 0;
+}
+
+
+int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite)
+	unzFile uf;
+	const int* popt_extract_without_path;
+    int* popt_overwrite;
+{
+	char filename_inzip[256];
+	char* filename_withoutpath;
+	char* p;
+    int err=UNZ_OK;
+    FILE *fout=NULL;
+    void* buf;
+    uInt size_buf;
+	
+	unz_file_info file_info;
+	uLong ratio=0;
+	err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
+
+	if (err!=UNZ_OK)
+	{
+		printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
+		return err;
+	}
+
+    size_buf = WRITEBUFFERSIZE;
+    buf = (void*)malloc(size_buf);
+    if (buf==NULL)
+    {
+        printf("Error allocating memory\n");
+        return UNZ_INTERNALERROR;
+    }
+
+	p = filename_withoutpath = filename_inzip;
+	while ((*p) != '\0')
+	{
+		if (((*p)=='/') || ((*p)=='\\'))
+			filename_withoutpath = p+1;
+		p++;
+	}
+
+	if ((*filename_withoutpath)=='\0')
+	{
+		if ((*popt_extract_without_path)==0)
+		{
+			printf("creating directory: %s\n",filename_inzip);
+			mymkdir(filename_inzip);
+		}
+	}
+	else
+	{
+		const char* write_filename;
+		int skip=0;
+
+		if ((*popt_extract_without_path)==0)
+			write_filename = filename_inzip;
+		else
+			write_filename = filename_withoutpath;
+
+		err = unzOpenCurrentFile(uf);
+		if (err!=UNZ_OK)
+		{
+			printf("error %d with zipfile in unzOpenCurrentFile\n",err);
+		}
+
+		if (((*popt_overwrite)==0) && (err==UNZ_OK))
+		{
+			char rep;
+			FILE* ftestexist;
+			ftestexist = fopen(write_filename,"rb");
+			if (ftestexist!=NULL)
+			{
+				fclose(ftestexist);
+				do
+				{
+					char answer[128];
+					printf("The file %s exist. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
+					scanf("%1s",answer);
+					rep = answer[0] ;
+					if ((rep>='a') && (rep<='z'))
+						rep -= 0x20;
+				}
+				while ((rep!='Y') && (rep!='N') && (rep!='A'));
+			}
+
+			if (rep == 'N')
+				skip = 1;
+
+			if (rep == 'A')
+				*popt_overwrite=1;
+		}
+
+		if ((skip==0) && (err==UNZ_OK))
+		{
+			fout=fopen(write_filename,"wb");
+
+            /* some zipfile don't contain directory alone before file */
+            if ((fout==NULL) && ((*popt_extract_without_path)==0) && 
+                                (filename_withoutpath!=(char*)filename_inzip))
+            {
+                char c=*(filename_withoutpath-1);
+                *(filename_withoutpath-1)='\0';
+                makedir(write_filename);
+                *(filename_withoutpath-1)=c;
+                fout=fopen(write_filename,"wb");
+            }
+
+			if (fout==NULL)
+			{
+				printf("error opening %s\n",write_filename);
+			}
+		}
+
+		if (fout!=NULL)
+		{
+			printf(" extracting: %s\n",write_filename);
+
+			do
+			{
+				err = unzReadCurrentFile(uf,buf,size_buf);
+				if (err<0)	
+				{
+					printf("error %d with zipfile in unzReadCurrentFile\n",err);
+					break;
+				}
+				if (err>0)
+					if (fwrite(buf,err,1,fout)!=1)
+					{
+						printf("error in writing extracted file\n");
+                        err=UNZ_ERRNO;
+						break;
+					}
+			}
+			while (err>0);
+			fclose(fout);
+			if (err==0) 
+				change_file_date(write_filename,file_info.dosDate,
+					             file_info.tmu_date);
+		}
+
+        if (err==UNZ_OK)
+        {
+		    err = unzCloseCurrentFile (uf);
+		    if (err!=UNZ_OK)
+		    {
+			    printf("error %d with zipfile in unzCloseCurrentFile\n",err);
+		    }
+        }
+        else
+            unzCloseCurrentFile(uf); /* don't lose the error */       
+	}
+
+    free(buf);    
+    return err;
+}
+
+
+int do_extract(uf,opt_extract_without_path,opt_overwrite)
+	unzFile uf;
+	int opt_extract_without_path;
+    int opt_overwrite;
+{
+	uLong i;
+	unz_global_info gi;
+	int err;
+	FILE* fout=NULL;	
+
+	err = unzGetGlobalInfo (uf,&gi);
+	if (err!=UNZ_OK)
+		printf("error %d with zipfile in unzGetGlobalInfo \n",err);
+
+	for (i=0;i<gi.number_entry;i++)
+	{
+        if (do_extract_currentfile(uf,&opt_extract_without_path,
+                                      &opt_overwrite) != UNZ_OK)
+            break;
+
+		if ((i+1)<gi.number_entry)
+		{
+			err = unzGoToNextFile(uf);
+			if (err!=UNZ_OK)
+			{
+				printf("error %d with zipfile in unzGoToNextFile\n",err);
+				break;
+			}
+		}
+	}
+
+	return 0;
+}
+
+int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite)
+	unzFile uf;
+	const char* filename;
+	int opt_extract_without_path;
+    int opt_overwrite;
+{
+    int err = UNZ_OK;
+    if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
+    {
+        printf("file %s not found in the zipfile\n",filename);
+        return 2;
+    }
+
+    if (do_extract_currentfile(uf,&opt_extract_without_path,
+                                      &opt_overwrite) == UNZ_OK)
+        return 0;
+    else
+        return 1;
+}
+
+
+int main(argc,argv)
+	int argc;
+	char *argv[];
+{
+	const char *zipfilename=NULL;
+    const char *filename_to_extract=NULL;
+	int i;
+	int opt_do_list=0;
+	int opt_do_extract=1;
+	int opt_do_extract_withoutpath=0;
+	int opt_overwrite=0;
+	char filename_try[512];
+	unzFile uf=NULL;
+
+	do_banner();
+	if (argc==1)
+	{
+		do_help();
+		exit(0);
+	}
+	else
+	{
+		for (i=1;i<argc;i++)
+		{
+			if ((*argv[i])=='-')
+			{
+				const char *p=argv[i]+1;
+				
+				while ((*p)!='\0')
+				{			
+					char c=*(p++);;
+					if ((c=='l') || (c=='L'))
+						opt_do_list = 1;
+					if ((c=='v') || (c=='V'))
+						opt_do_list = 1;
+					if ((c=='x') || (c=='X'))
+						opt_do_extract = 1;
+					if ((c=='e') || (c=='E'))
+						opt_do_extract = opt_do_extract_withoutpath = 1;
+					if ((c=='o') || (c=='O'))
+						opt_overwrite=1;
+				}
+			}
+			else
+            {
+				if (zipfilename == NULL)
+					zipfilename = argv[i];
+                else if (filename_to_extract==NULL)
+                        filename_to_extract = argv[i] ;
+            }
+		}
+	}
+
+	if (zipfilename!=NULL)
+	{
+		strcpy(filename_try,zipfilename);
+		uf = unzOpen(zipfilename);
+		if (uf==NULL)
+		{
+			strcat(filename_try,".zip");
+			uf = unzOpen(filename_try);
+		}
+	}
+
+	if (uf==NULL)
+	{
+		printf("Cannot open %s or %s.zip\n",zipfilename,zipfilename);
+		exit (1);
+	}
+    printf("%s opened\n",filename_try);
+
+	if (opt_do_list==1)
+		return do_list(uf);
+	else if (opt_do_extract==1)
+    {
+        if (filename_to_extract == NULL)
+		    return do_extract(uf,opt_do_extract_withoutpath,opt_overwrite);
+        else
+            return do_extract_onefile(uf,filename_to_extract,
+                                      opt_do_extract_withoutpath,opt_overwrite);
+    }
+	unzCloseCurrentFile(uf);
+
+	return 0;  /* to avoid warning */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/minizip.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/minizip.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/minizip.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,302 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#ifdef unix
+# include <unistd.h>
+# include <utime.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+#else
+# include <direct.h>
+# include <io.h>
+#endif
+
+#include "zip.h"
+
+
+#define WRITEBUFFERSIZE (16384)
+#define MAXFILENAME (256)
+
+#ifdef WIN32
+uLong filetime(f, tmzip, dt)
+    char *f;                /* name of file to get info on */
+    tm_zip *tmzip;             /* return value: access, modific. and creation times */
+    uLong *dt;             /* dostime */
+{
+  int ret = 0;
+  {
+      FILETIME ftLocal;
+      HANDLE hFind;
+      WIN32_FIND_DATA  ff32;
+
+      hFind = FindFirstFile(f,&ff32);
+      if (hFind != INVALID_HANDLE_VALUE)
+      {
+        FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal);
+        FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0);
+        FindClose(hFind);
+        ret = 1;
+      }
+  }
+  return ret;
+}
+#else
+#ifdef unix
+uLong filetime(f, tmzip, dt)
+    char *f;                /* name of file to get info on */
+    tm_zip *tmzip;             /* return value: access, modific. and creation times */
+    uLong *dt;             /* dostime */
+{
+  int ret=0;
+  struct stat s;        /* results of stat() */
+  struct tm* filedate;
+  time_t tm_t=0;
+  
+  if (strcmp(f,"-")!=0)
+  {
+    char name[MAXFILENAME];
+    int len = strlen(f);
+    strcpy(name, f);
+    if (name[len - 1] == '/')
+      name[len - 1] = '\0';
+    /* not all systems allow stat'ing a file with / appended */
+    if (stat(name,&s)==0)
+    {
+      tm_t = s.st_mtime;
+      ret = 1;
+    }
+  }
+  filedate = localtime(&tm_t);
+
+  tmzip->tm_sec  = filedate->tm_sec;
+  tmzip->tm_min  = filedate->tm_min;
+  tmzip->tm_hour = filedate->tm_hour;
+  tmzip->tm_mday = filedate->tm_mday;
+  tmzip->tm_mon  = filedate->tm_mon ;
+  tmzip->tm_year = filedate->tm_year;
+
+  return ret;
+}
+#else
+uLong filetime(f, tmzip, dt)
+    char *f;                /* name of file to get info on */
+    tm_zip *tmzip;             /* return value: access, modific. and creation times */
+    uLong *dt;             /* dostime */
+{
+    return 0;
+}
+#endif
+#endif
+
+
+
+
+int check_exist_file(filename)
+    const char* filename;
+{
+	FILE* ftestexist;
+    int ret = 1;
+	ftestexist = fopen(filename,"rb");
+	if (ftestexist==NULL)
+        ret = 0;
+    else
+        fclose(ftestexist);
+    return ret;
+}
+
+void do_banner()
+{
+	printf("MiniZip 0.15, demo of zLib + Zip package written by Gilles Vollant\n");
+	printf("more info at http://wwww.winimage/zLibDll/unzip.htm\n\n");
+}
+
+void do_help()
+{	
+	printf("Usage : minizip [-o] file.zip [files_to_add]\n\n") ;
+}
+
+int main(argc,argv)
+	int argc;
+	char *argv[];
+{
+	int i;
+	int opt_overwrite=0;
+    int opt_compress_level=Z_DEFAULT_COMPRESSION;
+    int zipfilenamearg = 0;
+	char filename_try[MAXFILENAME];
+    int zipok;
+    int err=0;
+    int size_buf=0;
+    void* buf=NULL,
+
+
+	do_banner();
+	if (argc==1)
+	{
+		do_help();
+		exit(0);
+        return 0;
+	}
+	else
+	{
+		for (i=1;i<argc;i++)
+		{
+			if ((*argv[i])=='-')
+			{
+				const char *p=argv[i]+1;
+				
+				while ((*p)!='\0')
+				{			
+					char c=*(p++);;
+					if ((c=='o') || (c=='O'))
+						opt_overwrite = 1;
+                    if ((c>='0') && (c<='9'))
+                        opt_compress_level = c-'0';
+				}
+			}
+			else
+				if (zipfilenamearg == 0)
+                    zipfilenamearg = i ;
+		}
+	}
+
+    size_buf = WRITEBUFFERSIZE;
+    buf = (void*)malloc(size_buf);
+    if (buf==NULL)
+    {
+        printf("Error allocating memory\n");
+        return ZIP_INTERNALERROR;
+    }
+
+	if (zipfilenamearg==0)
+        zipok=0;
+    else
+	{
+        int i,len;
+        int dot_found=0;
+
+        zipok = 1 ;
+		strcpy(filename_try,argv[zipfilenamearg]);
+        len=strlen(filename_try);
+        for (i=0;i<len;i++)
+            if (filename_try[i]=='.')
+                dot_found=1;
+
+        if (dot_found==0)
+            strcat(filename_try,".zip");
+
+        if (opt_overwrite==0)
+            if (check_exist_file(filename_try)!=0)
+			{
+                char rep;
+				do
+				{
+					char answer[128];
+					printf("The file %s exist. Overwrite ? [y]es, [n]o : ",filename_try);
+					scanf("%1s",answer);
+					rep = answer[0] ;
+					if ((rep>='a') && (rep<='z'))
+						rep -= 0x20;
+				}
+				while ((rep!='Y') && (rep!='N'));
+                if (rep=='N')
+                    zipok = 0;
+			}
+    }
+
+    if (zipok==1)
+    {
+        zipFile zf;
+        int errclose;
+        zf = zipOpen(filename_try,0);
+        if (zf == NULL)
+        {
+            printf("error opening %s\n",filename_try);
+            err= ZIP_ERRNO;
+        }
+        else 
+            printf("creating %s\n",filename_try);
+
+        for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++)
+        {
+            if (((*(argv[i]))!='-') && ((*(argv[i]))!='/'))
+            {
+                FILE * fin;
+                int size_read;
+                const char* filenameinzip = argv[i];
+                zip_fileinfo zi;
+
+                zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour = 
+                zi.tmz_date.tm_mday = zi.tmz_date.tm_min = zi.tmz_date.tm_year = 0;
+                zi.dosDate = 0;
+                zi.internal_fa = 0;
+                zi.external_fa = 0;
+                filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
+
+
+                err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
+                                 NULL,0,NULL,0,NULL /* comment*/,
+                                 (opt_compress_level != 0) ? Z_DEFLATED : 0,
+                                 opt_compress_level);
+
+                if (err != ZIP_OK)
+                    printf("error in opening %s in zipfile\n",filenameinzip);
+                else
+                {
+                    fin = fopen(filenameinzip,"rb");
+                    if (fin==NULL)
+                    {
+                        err=ZIP_ERRNO;
+                        printf("error in opening %s for reading\n",filenameinzip);
+                    }
+                }
+
+                if (err == ZIP_OK)
+                    do
+                    {
+                        err = ZIP_OK;
+                        size_read = fread(buf,1,size_buf,fin);
+                        if (size_read < size_buf)
+                            if (feof(fin)==0)
+                        {
+                            printf("error in reading %s\n",filenameinzip);
+                            err = ZIP_ERRNO;
+                        }
+
+                        if (size_read>0)
+                        {
+                            err = zipWriteInFileInZip (zf,buf,size_read);
+                            if (err<0)
+                            {
+                                printf("error in writing %s in the zipfile\n",
+                                                 filenameinzip);
+                            }
+                                
+                        }
+                    } while ((err == ZIP_OK) && (size_read>0));
+
+                fclose(fin);
+                if (err<0)
+                    err=ZIP_ERRNO;
+                else
+                {                    
+                    err = zipCloseFileInZip(zf);
+                    if (err!=ZIP_OK)
+                        printf("error in closing %s in the zipfile\n",
+                                    filenameinzip);
+                }
+            }
+        }
+        errclose = zipClose(zf,NULL);
+        if (errclose != ZIP_OK)
+            printf("error in closing %s\n",filename_try);
+   }
+
+    free(buf);
+    exit(0);
+	return 0;  /* to avoid warning */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/readme.txt
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/readme.txt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/readme.txt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,37 @@
+
+UnZip 0.15 additionnal library
+
+
+  This unzip package allow extract file from .ZIP file, compatible with 
+PKZip 2.04g, WinZip, InfoZip tools and compatible.
+
+  Multi volume ZipFile (span) are not supported, and old compression used by old 
+PKZip 1.x are not supported.
+
+See probdesc.zip from PKWare for specification of .ZIP format.
+
+What is Unzip
+  The Zlib library support the deflate compression and the creation of gzip (.gz) 
+file. Zlib is free and small.
+  The .Zip format, which can contain several compressed files (.gz can containt
+only one file) is a very popular format. This is why I've written a package for reading file compressed in Zipfile.
+
+Using Unzip package
+
+You need source of Zlib (get zlib111.zip and read zlib.h).
+Get unzlb015.zip and read unzip.h (whith documentation of unzip functions)
+
+The Unzip package is only two file : unzip.h and unzip.c. But it use the Zlib 
+  files.
+unztst.c is a simple sample program, which list file in a zipfile and display
+  README.TXT or FILE_ID.DIZ (if these files are found).
+miniunz.c is a mini unzip program.
+
+I'm also currenlyt writing a zipping portion (zip.h, zip.c and test with minizip.c)
+
+Please email me for feedback.
+I hope my source is compatible with Unix system, but I need your help for be sure
+
+Latest revision : Mar 04th, 1998
+
+Check http://www.winimage.com/zLibDll/unzip.html for up to date info.

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1294 @@
+/* unzip.c -- IO on .zip files using zlib 
+   Version 0.15 beta, Mar 19th, 1998,
+
+   Read unzip.h for more info
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "zlib.h"
+#include "unzip.h"
+
+#ifdef STDC
+#  include <stddef.h>
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+    extern int errno;
+#else
+#   include <errno.h>
+#endif
+
+
+#ifndef local
+#  define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+
+
+#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \
+                      !defined(CASESENSITIVITYDEFAULT_NO)
+#define CASESENSITIVITYDEFAULT_NO
+#endif
+
+
+#ifndef UNZ_BUFSIZE
+#define UNZ_BUFSIZE (16384)
+#endif
+
+#ifndef UNZ_MAXFILENAMEINZIP
+#define UNZ_MAXFILENAMEINZIP (256)
+#endif
+
+#ifndef ALLOC
+# define ALLOC(size) (malloc(size))
+#endif
+#ifndef TRYFREE
+# define TRYFREE(p) {if (p) free(p);}
+#endif
+
+#define SIZECENTRALDIRITEM (0x2e)
+#define SIZEZIPLOCALHEADER (0x1e)
+
+
+/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
+
+#ifndef SEEK_CUR
+#define SEEK_CUR    1
+#endif
+
+#ifndef SEEK_END
+#define SEEK_END    2
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET    0
+#endif
+
+const char unz_copyright[] =
+   " unzip 0.15 Copyright 1998 Gilles Vollant ";
+
+/* unz_file_info_interntal contain internal info about a file in zipfile*/
+typedef struct unz_file_info_internal_s
+{
+    uLong offset_curfile;/* relative offset of local header 4 bytes */
+} unz_file_info_internal;
+
+
+/* file_in_zip_read_info_s contain internal information about a file in zipfile,
+    when reading and decompress it */
+typedef struct
+{
+	char  *read_buffer;         /* internal buffer for compressed data */
+	z_stream stream;            /* zLib stream structure for inflate */
+
+	uLong pos_in_zipfile;       /* position in byte on the zipfile, for fseek*/
+	uLong stream_initialised;   /* flag set if stream structure is initialised*/
+
+	uLong offset_local_extrafield;/* offset of the local extra field */
+	uInt  size_local_extrafield;/* size of the local extra field */
+	uLong pos_local_extrafield;   /* position in the local extra field in read*/
+
+	uLong crc32;                /* crc32 of all data uncompressed */
+	uLong crc32_wait;           /* crc32 we must obtain after decompress all */
+	uLong rest_read_compressed; /* number of byte to be decompressed */
+	uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/
+	FILE* file;                 /* io structore of the zipfile */
+	uLong compression_method;   /* compression method (0==store) */
+	uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+} file_in_zip_read_info_s;
+
+
+/* unz_s contain internal information about the zipfile
+*/
+typedef struct
+{
+	FILE* file;                 /* io structore of the zipfile */
+	unz_global_info gi;       /* public global information */
+	uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+	uLong num_file;             /* number of the current file in the zipfile*/
+	uLong pos_in_central_dir;   /* pos of the current file in the central dir*/
+	uLong current_file_ok;      /* flag about the usability of the current file*/
+	uLong central_pos;          /* position of the beginning of the central dir*/
+
+	uLong size_central_dir;     /* size of the central directory  */
+	uLong offset_central_dir;   /* offset of start of central directory with
+								   respect to the starting disk number */
+
+	unz_file_info cur_file_info; /* public info about the current file in zip*/
+	unz_file_info_internal cur_file_info_internal; /* private info about it*/
+    file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current
+	                                    file if we are decompressing it */
+} unz_s;
+
+
+/* ===========================================================================
+     Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+   for end of file.
+   IN assertion: the stream s has been sucessfully opened for reading.
+*/
+
+
+local int unzlocal_getByte(fin,pi)
+	FILE *fin;
+	int *pi;
+{
+    unsigned char c;
+	int err = fread(&c, 1, 1, fin);
+    if (err==1)
+    {
+        *pi = (int)c;
+        return UNZ_OK;
+    }
+    else
+    {
+        if (ferror(fin)) 
+            return UNZ_ERRNO;
+        else
+            return UNZ_EOF;
+    }
+}
+
+
+/* ===========================================================================
+   Reads a long in LSB order from the given gz_stream. Sets 
+*/
+local int unzlocal_getShort (fin,pX)
+	FILE* fin;
+    uLong *pX;
+{
+    uLong x ;
+    int i;
+    int err;
+
+    err = unzlocal_getByte(fin,&i);
+    x = (uLong)i;
+    
+    if (err==UNZ_OK)
+        err = unzlocal_getByte(fin,&i);
+    x += ((uLong)i)<<8;
+   
+    if (err==UNZ_OK)
+        *pX = x;
+    else
+        *pX = 0;
+    return err;
+}
+
+local int unzlocal_getLong (fin,pX)
+	FILE* fin;
+    uLong *pX;
+{
+    uLong x ;
+    int i;
+    int err;
+
+    err = unzlocal_getByte(fin,&i);
+    x = (uLong)i;
+    
+    if (err==UNZ_OK)
+        err = unzlocal_getByte(fin,&i);
+    x += ((uLong)i)<<8;
+
+    if (err==UNZ_OK)
+        err = unzlocal_getByte(fin,&i);
+    x += ((uLong)i)<<16;
+
+    if (err==UNZ_OK)
+        err = unzlocal_getByte(fin,&i);
+    x += ((uLong)i)<<24;
+   
+    if (err==UNZ_OK)
+        *pX = x;
+    else
+        *pX = 0;
+    return err;
+}
+
+
+/* My own strcmpi / strcasecmp */
+local int strcmpcasenosensitive_internal (fileName1,fileName2)
+	const char* fileName1;
+	const char* fileName2;
+{
+	for (;;)
+	{
+		char c1=*(fileName1++);
+		char c2=*(fileName2++);
+		if ((c1>='a') && (c1<='z'))
+			c1 -= 0x20;
+		if ((c2>='a') && (c2<='z'))
+			c2 -= 0x20;
+		if (c1=='\0')
+			return ((c2=='\0') ? 0 : -1);
+		if (c2=='\0')
+			return 1;
+		if (c1<c2)
+			return -1;
+		if (c1>c2)
+			return 1;
+	}
+}
+
+
+#ifdef  CASESENSITIVITYDEFAULT_NO
+#define CASESENSITIVITYDEFAULTVALUE 2
+#else
+#define CASESENSITIVITYDEFAULTVALUE 1
+#endif
+
+#ifndef STRCMPCASENOSENTIVEFUNCTION
+#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
+#endif
+
+/* 
+   Compare two filename (fileName1,fileName2).
+   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+                                                                or strcasecmp)
+   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
+        (like 1 on Unix, 2 on Windows)
+
+*/
+extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
+	const char* fileName1;
+	const char* fileName2;
+	int iCaseSensitivity;
+{
+	if (iCaseSensitivity==0)
+		iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
+
+	if (iCaseSensitivity==1)
+		return strcmp(fileName1,fileName2);
+
+	return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
+} 
+
+#define BUFREADCOMMENT (0x400)
+
+/*
+  Locate the Central directory of a zipfile (at the end, just before
+    the global comment)
+*/
+local uLong unzlocal_SearchCentralDir(fin)
+	FILE *fin;
+{
+	unsigned char* buf;
+	uLong uSizeFile;
+	uLong uBackRead;
+	uLong uMaxBack=0xffff; /* maximum size of global comment */
+	uLong uPosFound=0;
+	
+	if (fseek(fin,0,SEEK_END) != 0)
+		return 0;
+
+
+	uSizeFile = ftell( fin );
+	
+	if (uMaxBack>uSizeFile)
+		uMaxBack = uSizeFile;
+
+	buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
+	if (buf==NULL)
+		return 0;
+
+	uBackRead = 4;
+	while (uBackRead<uMaxBack)
+	{
+		uLong uReadSize,uReadPos ;
+		int i;
+		if (uBackRead+BUFREADCOMMENT>uMaxBack) 
+			uBackRead = uMaxBack;
+		else
+			uBackRead+=BUFREADCOMMENT;
+		uReadPos = uSizeFile-uBackRead ;
+		
+		uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? 
+                     (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
+		if (fseek(fin,uReadPos,SEEK_SET)!=0)
+			break;
+
+		if (fread(buf,(uInt)uReadSize,1,fin)!=1)
+			break;
+
+                for (i=(int)uReadSize-3; (i--)>0;)
+			if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && 
+				((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
+			{
+				uPosFound = uReadPos+i;
+				break;
+			}
+
+		if (uPosFound!=0)
+			break;
+	}
+	TRYFREE(buf);
+	return uPosFound;
+}
+
+/*
+  Open a Zip file. path contain the full pathname (by example,
+     on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer
+	 "zlib/zlib109.zip".
+	 If the zipfile cannot be opened (file don't exist or in not valid), the
+	   return value is NULL.
+     Else, the return value is a unzFile Handle, usable with other function
+	   of this unzip package.
+*/
+extern unzFile ZEXPORT unzOpen (path)
+	const char *path;
+{
+	unz_s us;
+	unz_s *s;
+	uLong central_pos,uL;
+	FILE * fin ;
+
+	uLong number_disk;          /* number of the current dist, used for 
+								   spaning ZIP, unsupported, always 0*/
+	uLong number_disk_with_CD;  /* number the the disk with central dir, used
+								   for spaning ZIP, unsupported, always 0*/
+	uLong number_entry_CD;      /* total number of entries in
+	                               the central dir 
+	                               (same than number_entry on nospan) */
+
+	int err=UNZ_OK;
+
+    if (unz_copyright[0]!=' ')
+        return NULL;
+
+    fin=fopen(path,"rb");
+	if (fin==NULL)
+		return NULL;
+
+	central_pos = unzlocal_SearchCentralDir(fin);
+	if (central_pos==0)
+		err=UNZ_ERRNO;
+
+	if (fseek(fin,central_pos,SEEK_SET)!=0)
+		err=UNZ_ERRNO;
+
+	/* the signature, already checked */
+	if (unzlocal_getLong(fin,&uL)!=UNZ_OK)
+		err=UNZ_ERRNO;
+
+	/* number of this disk */
+	if (unzlocal_getShort(fin,&number_disk)!=UNZ_OK)
+		err=UNZ_ERRNO;
+
+	/* number of the disk with the start of the central directory */
+	if (unzlocal_getShort(fin,&number_disk_with_CD)!=UNZ_OK)
+		err=UNZ_ERRNO;
+
+	/* total number of entries in the central dir on this disk */
+	if (unzlocal_getShort(fin,&us.gi.number_entry)!=UNZ_OK)
+		err=UNZ_ERRNO;
+
+	/* total number of entries in the central dir */
+	if (unzlocal_getShort(fin,&number_entry_CD)!=UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if ((number_entry_CD!=us.gi.number_entry) ||
+		(number_disk_with_CD!=0) ||
+		(number_disk!=0))
+		err=UNZ_BADZIPFILE;
+
+	/* size of the central directory */
+	if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK)
+		err=UNZ_ERRNO;
+
+	/* offset of start of central directory with respect to the 
+	      starting disk number */
+	if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK)
+		err=UNZ_ERRNO;
+
+	/* zipfile comment length */
+	if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if ((central_pos<us.offset_central_dir+us.size_central_dir) && 
+		(err==UNZ_OK))
+		err=UNZ_BADZIPFILE;
+
+	if (err!=UNZ_OK)
+	{
+		fclose(fin);
+		return NULL;
+	}
+
+	us.file=fin;
+	us.byte_before_the_zipfile = central_pos -
+		                    (us.offset_central_dir+us.size_central_dir);
+	us.central_pos = central_pos;
+    us.pfile_in_zip_read = NULL;
+	
+
+	s=(unz_s*)ALLOC(sizeof(unz_s));
+	*s=us;
+	unzGoToFirstFile((unzFile)s);	
+	return (unzFile)s;	
+}
+
+
+/*
+  Close a ZipFile opened with unzipOpen.
+  If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
+    these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+  return UNZ_OK if there is no problem. */
+extern int ZEXPORT unzClose (file)
+	unzFile file;
+{
+	unz_s* s;
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+
+    if (s->pfile_in_zip_read!=NULL)
+        unzCloseCurrentFile(file);
+
+	fclose(s->file);
+	TRYFREE(s);
+	return UNZ_OK;
+}
+
+
+/*
+  Write info about the ZipFile in the *pglobal_info structure.
+  No preparation of the structure is needed
+  return UNZ_OK if there is no problem. */
+extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
+	unzFile file;
+	unz_global_info *pglobal_info;
+{
+	unz_s* s;
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+	*pglobal_info=s->gi;
+	return UNZ_OK;
+}
+
+
+/*
+   Translate date/time from Dos format to tm_unz (readable more easilty)
+*/
+local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
+    uLong ulDosDate;
+    tm_unz* ptm;
+{
+    uLong uDate;
+    uDate = (uLong)(ulDosDate>>16);
+    ptm->tm_mday = (uInt)(uDate&0x1f) ;
+    ptm->tm_mon =  (uInt)((((uDate)&0x1E0)/0x20)-1) ;
+    ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;
+
+    ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);
+    ptm->tm_min =  (uInt) ((ulDosDate&0x7E0)/0x20) ;
+    ptm->tm_sec =  (uInt) (2*(ulDosDate&0x1f)) ;
+}
+
+/*
+  Get Info about the current file in the zipfile, with internal only info
+*/
+local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
+                                                  unz_file_info *pfile_info,
+                                                  unz_file_info_internal 
+                                                  *pfile_info_internal,
+                                                  char *szFileName,
+												  uLong fileNameBufferSize,
+                                                  void *extraField,
+												  uLong extraFieldBufferSize,
+                                                  char *szComment,
+												  uLong commentBufferSize));
+
+local int unzlocal_GetCurrentFileInfoInternal (file,
+                                              pfile_info,
+                                              pfile_info_internal,
+                                              szFileName, fileNameBufferSize,
+                                              extraField, extraFieldBufferSize,
+                                              szComment,  commentBufferSize)
+	unzFile file;
+	unz_file_info *pfile_info;
+	unz_file_info_internal *pfile_info_internal;
+	char *szFileName;
+	uLong fileNameBufferSize;
+	void *extraField;
+	uLong extraFieldBufferSize;
+	char *szComment;
+	uLong commentBufferSize;
+{
+	unz_s* s;
+	unz_file_info file_info;
+	unz_file_info_internal file_info_internal;
+	int err=UNZ_OK;
+	uLong uMagic;
+	long lSeek=0;
+
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+	if (fseek(s->file,s->pos_in_central_dir+s->byte_before_the_zipfile,SEEK_SET)!=0)
+		err=UNZ_ERRNO;
+
+
+	/* we check the magic */
+	if (err==UNZ_OK)
+		if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
+			err=UNZ_ERRNO;
+		else if (uMagic!=0x02014b50)
+			err=UNZ_BADZIPFILE;
+
+	if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getShort(s->file,&file_info.version_needed) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getShort(s->file,&file_info.flag) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getShort(s->file,&file_info.compression_method) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getLong(s->file,&file_info.dosDate) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+    unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date);
+
+	if (unzlocal_getLong(s->file,&file_info.crc) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getLong(s->file,&file_info.compressed_size) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getLong(s->file,&file_info.uncompressed_size) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getShort(s->file,&file_info.size_filename) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getShort(s->file,&file_info.size_file_extra) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getShort(s->file,&file_info.size_file_comment) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getShort(s->file,&file_info.disk_num_start) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getShort(s->file,&file_info.internal_fa) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getLong(s->file,&file_info.external_fa) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	lSeek+=file_info.size_filename;
+	if ((err==UNZ_OK) && (szFileName!=NULL))
+	{
+		uLong uSizeRead ;
+		if (file_info.size_filename<fileNameBufferSize)
+		{
+			*(szFileName+file_info.size_filename)='\0';
+			uSizeRead = file_info.size_filename;
+		}
+		else
+			uSizeRead = fileNameBufferSize;
+
+		if ((file_info.size_filename>0) && (fileNameBufferSize>0))
+			if (fread(szFileName,(uInt)uSizeRead,1,s->file)!=1)
+				err=UNZ_ERRNO;
+		lSeek -= uSizeRead;
+	}
+
+	
+	if ((err==UNZ_OK) && (extraField!=NULL))
+	{
+		uLong uSizeRead ;
+		if (file_info.size_file_extra<extraFieldBufferSize)
+			uSizeRead = file_info.size_file_extra;
+		else
+			uSizeRead = extraFieldBufferSize;
+
+		if (lSeek!=0)
+			if (fseek(s->file,lSeek,SEEK_CUR)==0)
+				lSeek=0;
+			else
+				err=UNZ_ERRNO;
+		if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
+			if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1)
+				err=UNZ_ERRNO;
+		lSeek += file_info.size_file_extra - uSizeRead;
+	}
+	else
+		lSeek+=file_info.size_file_extra; 
+
+	
+	if ((err==UNZ_OK) && (szComment!=NULL))
+	{
+		uLong uSizeRead ;
+		if (file_info.size_file_comment<commentBufferSize)
+		{
+			*(szComment+file_info.size_file_comment)='\0';
+			uSizeRead = file_info.size_file_comment;
+		}
+		else
+			uSizeRead = commentBufferSize;
+
+		if (lSeek!=0)
+			if (fseek(s->file,lSeek,SEEK_CUR)==0)
+				lSeek=0;
+			else
+				err=UNZ_ERRNO;
+		if ((file_info.size_file_comment>0) && (commentBufferSize>0))
+			if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1)
+				err=UNZ_ERRNO;
+		lSeek+=file_info.size_file_comment - uSizeRead;
+	}
+	else
+		lSeek+=file_info.size_file_comment;
+
+	if ((err==UNZ_OK) && (pfile_info!=NULL))
+		*pfile_info=file_info;
+
+	if ((err==UNZ_OK) && (pfile_info_internal!=NULL))
+		*pfile_info_internal=file_info_internal;
+
+	return err;
+}
+
+
+
+/*
+  Write info about the ZipFile in the *pglobal_info structure.
+  No preparation of the structure is needed
+  return UNZ_OK if there is no problem.
+*/
+extern int ZEXPORT unzGetCurrentFileInfo (file,
+                                                  pfile_info,
+                                                  szFileName, fileNameBufferSize,
+                                                  extraField, extraFieldBufferSize,
+                                                  szComment,  commentBufferSize)
+	unzFile file;
+	unz_file_info *pfile_info;
+	char *szFileName;
+	uLong fileNameBufferSize;
+	void *extraField;
+	uLong extraFieldBufferSize;
+	char *szComment;
+	uLong commentBufferSize;
+{
+	return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
+												szFileName,fileNameBufferSize,
+												extraField,extraFieldBufferSize,
+												szComment,commentBufferSize);
+}
+
+/*
+  Set the current file of the zipfile to the first file.
+  return UNZ_OK if there is no problem
+*/
+extern int ZEXPORT unzGoToFirstFile (file)
+	unzFile file;
+{
+	int err=UNZ_OK;
+	unz_s* s;
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+	s->pos_in_central_dir=s->offset_central_dir;
+	s->num_file=0;
+	err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+											 &s->cur_file_info_internal,
+											 NULL,0,NULL,0,NULL,0);
+	s->current_file_ok = (err == UNZ_OK);
+	return err;
+}
+
+
+/*
+  Set the current file of the zipfile to the next file.
+  return UNZ_OK if there is no problem
+  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+*/
+extern int ZEXPORT unzGoToNextFile (file)
+	unzFile file;
+{
+	unz_s* s;	
+	int err;
+
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+	if (!s->current_file_ok)
+		return UNZ_END_OF_LIST_OF_FILE;
+	if (s->num_file+1==s->gi.number_entry)
+		return UNZ_END_OF_LIST_OF_FILE;
+
+	s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
+			s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
+	s->num_file++;
+	err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+											   &s->cur_file_info_internal,
+											   NULL,0,NULL,0,NULL,0);
+	s->current_file_ok = (err == UNZ_OK);
+	return err;
+}
+
+
+/*
+  Try locate the file szFileName in the zipfile.
+  For the iCaseSensitivity signification, see unzipStringFileNameCompare
+
+  return value :
+  UNZ_OK if the file is found. It becomes the current file.
+  UNZ_END_OF_LIST_OF_FILE if the file is not found
+*/
+extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
+	unzFile file;
+	const char *szFileName;
+	int iCaseSensitivity;
+{
+	unz_s* s;	
+	int err;
+
+	
+	uLong num_fileSaved;
+	uLong pos_in_central_dirSaved;
+
+
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+
+    if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
+        return UNZ_PARAMERROR;
+
+	s=(unz_s*)file;
+	if (!s->current_file_ok)
+		return UNZ_END_OF_LIST_OF_FILE;
+
+	num_fileSaved = s->num_file;
+	pos_in_central_dirSaved = s->pos_in_central_dir;
+
+	err = unzGoToFirstFile(file);
+
+	while (err == UNZ_OK)
+	{
+		char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
+		unzGetCurrentFileInfo(file,NULL,
+								szCurrentFileName,sizeof(szCurrentFileName)-1,
+								NULL,0,NULL,0);
+		if (unzStringFileNameCompare(szCurrentFileName,
+										szFileName,iCaseSensitivity)==0)
+			return UNZ_OK;
+		err = unzGoToNextFile(file);
+	}
+
+	s->num_file = num_fileSaved ;
+	s->pos_in_central_dir = pos_in_central_dirSaved ;
+	return err;
+}
+
+
+/*
+  Read the local header of the current zipfile
+  Check the coherency of the local header and info in the end of central
+        directory about this file
+  store in *piSizeVar the size of extra info in local header
+        (filename and size of extra field data)
+*/
+local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
+													poffset_local_extrafield,
+													psize_local_extrafield)
+	unz_s* s;
+	uInt* piSizeVar;
+	uLong *poffset_local_extrafield;
+	uInt  *psize_local_extrafield;
+{
+	uLong uMagic,uData,uFlags;
+	uLong size_filename;
+	uLong size_extra_field;
+	int err=UNZ_OK;
+
+	*piSizeVar = 0;
+	*poffset_local_extrafield = 0;
+	*psize_local_extrafield = 0;
+
+	if (fseek(s->file,s->cur_file_info_internal.offset_curfile +
+								s->byte_before_the_zipfile,SEEK_SET)!=0)
+		return UNZ_ERRNO;
+
+
+	if (err==UNZ_OK)
+		if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
+			err=UNZ_ERRNO;
+		else if (uMagic!=0x04034b50)
+			err=UNZ_BADZIPFILE;
+
+	if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
+		err=UNZ_ERRNO;
+/*
+	else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
+		err=UNZ_BADZIPFILE;
+*/
+	if (unzlocal_getShort(s->file,&uFlags) != UNZ_OK)
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
+		err=UNZ_ERRNO;
+	else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
+		err=UNZ_BADZIPFILE;
+
+    if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
+                         (s->cur_file_info.compression_method!=Z_DEFLATED))
+        err=UNZ_BADZIPFILE;
+
+	if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */
+		err=UNZ_ERRNO;
+
+	if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */
+		err=UNZ_ERRNO;
+	else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) &&
+		                      ((uFlags & 8)==0))
+		err=UNZ_BADZIPFILE;
+
+	if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */
+		err=UNZ_ERRNO;
+	else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) &&
+							  ((uFlags & 8)==0))
+		err=UNZ_BADZIPFILE;
+
+	if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */
+		err=UNZ_ERRNO;
+	else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && 
+							  ((uFlags & 8)==0))
+		err=UNZ_BADZIPFILE;
+
+
+	if (unzlocal_getShort(s->file,&size_filename) != UNZ_OK)
+		err=UNZ_ERRNO;
+	else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
+		err=UNZ_BADZIPFILE;
+
+	*piSizeVar += (uInt)size_filename;
+
+	if (unzlocal_getShort(s->file,&size_extra_field) != UNZ_OK)
+		err=UNZ_ERRNO;
+	*poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
+									SIZEZIPLOCALHEADER + size_filename;
+	*psize_local_extrafield = (uInt)size_extra_field;
+
+	*piSizeVar += (uInt)size_extra_field;
+
+	return err;
+}
+												
+/*
+  Open for reading data the current file in the zipfile.
+  If there is no error and the file is opened, the return value is UNZ_OK.
+*/
+extern int ZEXPORT unzOpenCurrentFile (file)
+	unzFile file;
+{
+	int err=UNZ_OK;
+	int Store;
+	uInt iSizeVar;
+	unz_s* s;
+	file_in_zip_read_info_s* pfile_in_zip_read_info;
+	uLong offset_local_extrafield;  /* offset of the local extra field */
+	uInt  size_local_extrafield;    /* size of the local extra field */
+
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+	if (!s->current_file_ok)
+		return UNZ_PARAMERROR;
+
+    if (s->pfile_in_zip_read != NULL)
+        unzCloseCurrentFile(file);
+
+	if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
+				&offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
+		return UNZ_BADZIPFILE;
+
+	pfile_in_zip_read_info = (file_in_zip_read_info_s*)
+									    ALLOC(sizeof(file_in_zip_read_info_s));
+	if (pfile_in_zip_read_info==NULL)
+		return UNZ_INTERNALERROR;
+
+	pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
+	pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
+	pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
+	pfile_in_zip_read_info->pos_local_extrafield=0;
+
+	if (pfile_in_zip_read_info->read_buffer==NULL)
+	{
+		TRYFREE(pfile_in_zip_read_info);
+		return UNZ_INTERNALERROR;
+	}
+
+	pfile_in_zip_read_info->stream_initialised=0;
+	
+	if ((s->cur_file_info.compression_method!=0) &&
+        (s->cur_file_info.compression_method!=Z_DEFLATED))
+		err=UNZ_BADZIPFILE;
+	Store = s->cur_file_info.compression_method==0;
+
+	pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
+	pfile_in_zip_read_info->crc32=0;
+	pfile_in_zip_read_info->compression_method =
+            s->cur_file_info.compression_method;
+	pfile_in_zip_read_info->file=s->file;
+	pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
+
+    pfile_in_zip_read_info->stream.total_out = 0;
+
+	if (!Store)
+	{
+	  pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
+	  pfile_in_zip_read_info->stream.zfree = (free_func)0;
+	  pfile_in_zip_read_info->stream.opaque = (voidpf)0; 
+      
+	  err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
+	  if (err == Z_OK)
+	    pfile_in_zip_read_info->stream_initialised=1;
+        /* windowBits is passed < 0 to tell that there is no zlib header.
+         * Note that in this case inflate *requires* an extra "dummy" byte
+         * after the compressed stream in order to complete decompression and
+         * return Z_STREAM_END. 
+         * In unzip, i don't wait absolutely Z_STREAM_END because I known the 
+         * size of both compressed and uncompressed data
+         */
+	}
+	pfile_in_zip_read_info->rest_read_compressed = 
+            s->cur_file_info.compressed_size ;
+	pfile_in_zip_read_info->rest_read_uncompressed = 
+            s->cur_file_info.uncompressed_size ;
+
+	
+	pfile_in_zip_read_info->pos_in_zipfile = 
+            s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + 
+			  iSizeVar;
+	
+	pfile_in_zip_read_info->stream.avail_in = (uInt)0;
+
+
+	s->pfile_in_zip_read = pfile_in_zip_read_info;
+    return UNZ_OK;
+}
+
+
+/*
+  Read bytes from the current file.
+  buf contain buffer where data must be copied
+  len the size of buf.
+
+  return the number of byte copied if somes bytes are copied
+  return 0 if the end of file was reached
+  return <0 with error code if there is an error
+    (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+*/
+extern int ZEXPORT unzReadCurrentFile  (file, buf, len)
+	unzFile file;
+	voidp buf;
+	unsigned len;
+{
+	int err=UNZ_OK;
+	uInt iRead = 0;
+	unz_s* s;
+	file_in_zip_read_info_s* pfile_in_zip_read_info;
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+	if (pfile_in_zip_read_info==NULL)
+		return UNZ_PARAMERROR;
+
+
+	if ((pfile_in_zip_read_info->read_buffer == NULL))
+		return UNZ_END_OF_LIST_OF_FILE;
+	if (len==0)
+		return 0;
+
+	pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
+
+	pfile_in_zip_read_info->stream.avail_out = (uInt)len;
+	
+	if (len>pfile_in_zip_read_info->rest_read_uncompressed)
+		pfile_in_zip_read_info->stream.avail_out = 
+		  (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
+
+	while (pfile_in_zip_read_info->stream.avail_out>0)
+	{
+		if ((pfile_in_zip_read_info->stream.avail_in==0) &&
+            (pfile_in_zip_read_info->rest_read_compressed>0))
+		{
+			uInt uReadThis = UNZ_BUFSIZE;
+			if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
+				uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
+			if (uReadThis == 0)
+				return UNZ_EOF;
+			if (fseek(pfile_in_zip_read_info->file,
+                      pfile_in_zip_read_info->pos_in_zipfile + 
+                         pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0)
+				return UNZ_ERRNO;
+			if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1,
+                         pfile_in_zip_read_info->file)!=1)
+				return UNZ_ERRNO;
+			pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
+
+			pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
+			
+			pfile_in_zip_read_info->stream.next_in = 
+                (Bytef*)pfile_in_zip_read_info->read_buffer;
+			pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
+		}
+
+		if (pfile_in_zip_read_info->compression_method==0)
+		{
+			uInt uDoCopy,i ;
+			if (pfile_in_zip_read_info->stream.avail_out < 
+                            pfile_in_zip_read_info->stream.avail_in)
+				uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
+			else
+				uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
+				
+			for (i=0;i<uDoCopy;i++)
+				*(pfile_in_zip_read_info->stream.next_out+i) =
+                        *(pfile_in_zip_read_info->stream.next_in+i);
+					
+			pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
+								pfile_in_zip_read_info->stream.next_out,
+								uDoCopy);
+			pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
+			pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
+			pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
+			pfile_in_zip_read_info->stream.next_out += uDoCopy;
+			pfile_in_zip_read_info->stream.next_in += uDoCopy;
+            pfile_in_zip_read_info->stream.total_out += uDoCopy;
+			iRead += uDoCopy;
+		}
+		else
+		{
+			uLong uTotalOutBefore,uTotalOutAfter;
+			const Bytef *bufBefore;
+			uLong uOutThis;
+			int flush=Z_SYNC_FLUSH;
+
+			uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
+			bufBefore = pfile_in_zip_read_info->stream.next_out;
+
+			/*
+			if ((pfile_in_zip_read_info->rest_read_uncompressed ==
+			         pfile_in_zip_read_info->stream.avail_out) &&
+				(pfile_in_zip_read_info->rest_read_compressed == 0))
+				flush = Z_FINISH;
+			*/
+			err=inflate(&pfile_in_zip_read_info->stream,flush);
+
+			uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
+			uOutThis = uTotalOutAfter-uTotalOutBefore;
+			
+			pfile_in_zip_read_info->crc32 = 
+                crc32(pfile_in_zip_read_info->crc32,bufBefore,
+                        (uInt)(uOutThis));
+
+			pfile_in_zip_read_info->rest_read_uncompressed -=
+                uOutThis;
+
+			iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
+            
+			if (err==Z_STREAM_END)
+				return (iRead==0) ? UNZ_EOF : iRead;
+			if (err!=Z_OK) 
+				break;
+		}
+	}
+
+	if (err==Z_OK)
+		return iRead;
+	return err;
+}
+
+
+/*
+  Give the current position in uncompressed data
+*/
+extern z_off_t ZEXPORT unztell (file)
+	unzFile file;
+{
+	unz_s* s;
+	file_in_zip_read_info_s* pfile_in_zip_read_info;
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+	if (pfile_in_zip_read_info==NULL)
+		return UNZ_PARAMERROR;
+
+	return (z_off_t)pfile_in_zip_read_info->stream.total_out;
+}
+
+
+/*
+  return 1 if the end of file was reached, 0 elsewhere 
+*/
+extern int ZEXPORT unzeof (file)
+	unzFile file;
+{
+	unz_s* s;
+	file_in_zip_read_info_s* pfile_in_zip_read_info;
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+	if (pfile_in_zip_read_info==NULL)
+		return UNZ_PARAMERROR;
+	
+	if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
+		return 1;
+	else
+		return 0;
+}
+
+
+
+/*
+  Read extra field from the current file (opened by unzOpenCurrentFile)
+  This is the local-header version of the extra field (sometimes, there is
+    more info in the local-header version than in the central-header)
+
+  if buf==NULL, it return the size of the local extra field that can be read
+
+  if buf!=NULL, len is the size of the buffer, the extra header is copied in
+	buf.
+  the return value is the number of bytes copied in buf, or (if <0) 
+	the error code
+*/
+extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
+	unzFile file;
+	voidp buf;
+	unsigned len;
+{
+	unz_s* s;
+	file_in_zip_read_info_s* pfile_in_zip_read_info;
+	uInt read_now;
+	uLong size_to_read;
+
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+	if (pfile_in_zip_read_info==NULL)
+		return UNZ_PARAMERROR;
+
+	size_to_read = (pfile_in_zip_read_info->size_local_extrafield - 
+				pfile_in_zip_read_info->pos_local_extrafield);
+
+	if (buf==NULL)
+		return (int)size_to_read;
+	
+	if (len>size_to_read)
+		read_now = (uInt)size_to_read;
+	else
+		read_now = (uInt)len ;
+
+	if (read_now==0)
+		return 0;
+	
+	if (fseek(pfile_in_zip_read_info->file,
+              pfile_in_zip_read_info->offset_local_extrafield + 
+			  pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0)
+		return UNZ_ERRNO;
+
+	if (fread(buf,(uInt)size_to_read,1,pfile_in_zip_read_info->file)!=1)
+		return UNZ_ERRNO;
+
+	return (int)read_now;
+}
+
+/*
+  Close the file in zip opened with unzipOpenCurrentFile
+  Return UNZ_CRCERROR if all the file was read but the CRC is not good
+*/
+extern int ZEXPORT unzCloseCurrentFile (file)
+	unzFile file;
+{
+	int err=UNZ_OK;
+
+	unz_s* s;
+	file_in_zip_read_info_s* pfile_in_zip_read_info;
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+    pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+	if (pfile_in_zip_read_info==NULL)
+		return UNZ_PARAMERROR;
+
+
+	if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
+	{
+		if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
+			err=UNZ_CRCERROR;
+	}
+
+
+	TRYFREE(pfile_in_zip_read_info->read_buffer);
+	pfile_in_zip_read_info->read_buffer = NULL;
+	if (pfile_in_zip_read_info->stream_initialised)
+		inflateEnd(&pfile_in_zip_read_info->stream);
+
+	pfile_in_zip_read_info->stream_initialised = 0;
+	TRYFREE(pfile_in_zip_read_info);
+
+    s->pfile_in_zip_read=NULL;
+
+	return err;
+}
+
+
+/*
+  Get the global comment string of the ZipFile, in the szComment buffer.
+  uSizeBuf is the size of the szComment buffer.
+  return the number of byte copied or an error code <0
+*/
+extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
+	unzFile file;
+	char *szComment;
+	uLong uSizeBuf;
+{
+	int err=UNZ_OK;
+	unz_s* s;
+	uLong uReadThis ;
+	if (file==NULL)
+		return UNZ_PARAMERROR;
+	s=(unz_s*)file;
+
+	uReadThis = uSizeBuf;
+	if (uReadThis>s->gi.size_comment)
+		uReadThis = s->gi.size_comment;
+
+	if (fseek(s->file,s->central_pos+22,SEEK_SET)!=0)
+		return UNZ_ERRNO;
+
+	if (uReadThis>0)
+    {
+      *szComment='\0';
+	  if (fread(szComment,(uInt)uReadThis,1,s->file)!=1)
+		return UNZ_ERRNO;
+    }
+
+	if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
+		*(szComment+s->gi.size_comment)='\0';
+	return (int)uReadThis;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.def
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.def	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.def	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,15 @@
+	unzOpen                       @61
+	unzClose                      @62
+	unzGetGlobalInfo              @63
+	unzGetCurrentFileInfo         @64
+	unzGoToFirstFile              @65
+	unzGoToNextFile               @66
+	unzOpenCurrentFile            @67
+	unzReadCurrentFile            @68
+	unztell                       @70
+	unzeof                        @71
+	unzCloseCurrentFile           @72
+	unzGetGlobalComment           @73
+	unzStringFileNameCompare      @74
+	unzLocateFile                 @75
+	unzGetLocalExtrafield         @76

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/unzip.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,275 @@
+/* unzip.h -- IO for uncompress .zip files using zlib 
+   Version 0.15 beta, Mar 19th, 1998,
+
+   Copyright (C) 1998 Gilles Vollant
+
+   This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
+     WinZip, InfoZip tools and compatible.
+   Encryption and multi volume ZipFile (span) are not supported.
+   Old compressions used by old PKZip 1.x are not supported
+
+   THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
+   CAN CHANGE IN FUTURE VERSION !!
+   I WAIT FEEDBACK at mail info at winimage.com
+   Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
+
+   Condition of use and distribution are the same than zlib :
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+
+*/
+/* for more info about .ZIP format, see 
+      ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
+   PkWare has also a specification at :
+      ftp://ftp.pkware.com/probdesc.zip */
+
+#ifndef _unz_H
+#define _unz_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
+/* like the STRICT of WIN32, we define a pointer that cannot be converted
+    from (void*) without cast */
+typedef struct TagunzFile__ { int unused; } unzFile__; 
+typedef unzFile__ *unzFile;
+#else
+typedef voidp unzFile;
+#endif
+
+
+#define UNZ_OK                                  (0)
+#define UNZ_END_OF_LIST_OF_FILE (-100)
+#define UNZ_ERRNO               (Z_ERRNO)
+#define UNZ_EOF                 (0)
+#define UNZ_PARAMERROR                  (-102)
+#define UNZ_BADZIPFILE                  (-103)
+#define UNZ_INTERNALERROR               (-104)
+#define UNZ_CRCERROR                    (-105)
+
+/* tm_unz contain date/time info */
+typedef struct tm_unz_s 
+{
+	uInt tm_sec;            /* seconds after the minute - [0,59] */
+	uInt tm_min;            /* minutes after the hour - [0,59] */
+	uInt tm_hour;           /* hours since midnight - [0,23] */
+	uInt tm_mday;           /* day of the month - [1,31] */
+	uInt tm_mon;            /* months since January - [0,11] */
+	uInt tm_year;           /* years - [1980..2044] */
+} tm_unz;
+
+/* unz_global_info structure contain global data about the ZIPfile
+   These data comes from the end of central dir */
+typedef struct unz_global_info_s
+{
+	uLong number_entry;         /* total number of entries in
+				       the central dir on this disk */
+	uLong size_comment;         /* size of the global comment of the zipfile */
+} unz_global_info;
+
+
+/* unz_file_info contain information about a file in the zipfile */
+typedef struct unz_file_info_s
+{
+    uLong version;              /* version made by                 2 bytes */
+    uLong version_needed;       /* version needed to extract       2 bytes */
+    uLong flag;                 /* general purpose bit flag        2 bytes */
+    uLong compression_method;   /* compression method              2 bytes */
+    uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */
+    uLong crc;                  /* crc-32                          4 bytes */
+    uLong compressed_size;      /* compressed size                 4 bytes */ 
+    uLong uncompressed_size;    /* uncompressed size               4 bytes */ 
+    uLong size_filename;        /* filename length                 2 bytes */
+    uLong size_file_extra;      /* extra field length              2 bytes */
+    uLong size_file_comment;    /* file comment length             2 bytes */
+
+    uLong disk_num_start;       /* disk number start               2 bytes */
+    uLong internal_fa;          /* internal file attributes        2 bytes */
+    uLong external_fa;          /* external file attributes        4 bytes */
+
+    tm_unz tmu_date;
+} unz_file_info;
+
+extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
+												 const char* fileName2,
+												 int iCaseSensitivity));
+/*
+   Compare two filename (fileName1,fileName2).
+   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+								or strcasecmp)
+   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
+	(like 1 on Unix, 2 on Windows)
+*/
+
+
+extern unzFile ZEXPORT unzOpen OF((const char *path));
+/*
+  Open a Zip file. path contain the full pathname (by example,
+     on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
+	 "zlib/zlib111.zip".
+	 If the zipfile cannot be opened (file don't exist or in not valid), the
+	   return value is NULL.
+     Else, the return value is a unzFile Handle, usable with other function
+	   of this unzip package.
+*/
+
+extern int ZEXPORT unzClose OF((unzFile file));
+/*
+  Close a ZipFile opened with unzipOpen.
+  If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
+    these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+  return UNZ_OK if there is no problem. */
+
+extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
+					unz_global_info *pglobal_info));
+/*
+  Write info about the ZipFile in the *pglobal_info structure.
+  No preparation of the structure is needed
+  return UNZ_OK if there is no problem. */
+
+
+extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
+										   char *szComment,
+					   uLong uSizeBuf));
+/*
+  Get the global comment string of the ZipFile, in the szComment buffer.
+  uSizeBuf is the size of the szComment buffer.
+  return the number of byte copied or an error code <0
+*/
+
+
+/***************************************************************************/
+/* Unzip package allow you browse the directory of the zipfile */
+
+extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
+/*
+  Set the current file of the zipfile to the first file.
+  return UNZ_OK if there is no problem
+*/
+
+extern int ZEXPORT unzGoToNextFile OF((unzFile file));
+/*
+  Set the current file of the zipfile to the next file.
+  return UNZ_OK if there is no problem
+  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+*/
+
+extern int ZEXPORT unzLocateFile OF((unzFile file, 
+				     const char *szFileName,
+				     int iCaseSensitivity));
+/*
+  Try locate the file szFileName in the zipfile.
+  For the iCaseSensitivity signification, see unzStringFileNameCompare
+
+  return value :
+  UNZ_OK if the file is found. It becomes the current file.
+  UNZ_END_OF_LIST_OF_FILE if the file is not found
+*/
+
+
+extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
+					     unz_file_info *pfile_info,
+					     char *szFileName,
+					     uLong fileNameBufferSize,
+					     void *extraField,
+					     uLong extraFieldBufferSize,
+					     char *szComment,
+					     uLong commentBufferSize));
+/*
+  Get Info about the current file
+  if pfile_info!=NULL, the *pfile_info structure will contain somes info about
+	    the current file
+  if szFileName!=NULL, the filemane string will be copied in szFileName
+			(fileNameBufferSize is the size of the buffer)
+  if extraField!=NULL, the extra field information will be copied in extraField
+			(extraFieldBufferSize is the size of the buffer).
+			This is the Central-header version of the extra field
+  if szComment!=NULL, the comment string of the file will be copied in szComment
+			(commentBufferSize is the size of the buffer)
+*/
+
+/***************************************************************************/
+/* for reading the content of the current zipfile, you can open it, read data
+   from it, and close it (you can close it before reading all the file)
+   */
+
+extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
+/*
+  Open for reading data the current file in the zipfile.
+  If there is no error, the return value is UNZ_OK.
+*/
+
+extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
+/*
+  Close the file in zip opened with unzOpenCurrentFile
+  Return UNZ_CRCERROR if all the file was read but the CRC is not good
+*/
+
+												
+extern int ZEXPORT unzReadCurrentFile OF((unzFile file, 
+					  voidp buf,
+					  unsigned len));
+/*
+  Read bytes from the current file (opened by unzOpenCurrentFile)
+  buf contain buffer where data must be copied
+  len the size of buf.
+
+  return the number of byte copied if somes bytes are copied
+  return 0 if the end of file was reached
+  return <0 with error code if there is an error
+    (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+*/
+
+extern z_off_t ZEXPORT unztell OF((unzFile file));
+/*
+  Give the current position in uncompressed data
+*/
+
+extern int ZEXPORT unzeof OF((unzFile file));
+/*
+  return 1 if the end of file was reached, 0 elsewhere 
+*/
+
+extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
+											 voidp buf,
+											 unsigned len));
+/*
+  Read extra field from the current file (opened by unzOpenCurrentFile)
+  This is the local-header version of the extra field (sometimes, there is
+    more info in the local-header version than in the central-header)
+
+  if buf==NULL, it return the size of the local extra field
+
+  if buf!=NULL, len is the size of the buffer, the extra header is copied in
+	buf.
+  the return value is the number of bytes copied in buf, or (if <0) 
+	the error code
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _unz_H */

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,718 @@
+/* zip.c -- IO on .zip files using zlib 
+   Version 0.15 beta, Mar 19th, 1998,
+
+   Read zip.h for more info
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "zlib.h"
+#include "zip.h"
+
+#ifdef STDC
+#  include <stddef.h>
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+    extern int errno;
+#else
+#   include <errno.h>
+#endif
+
+
+#ifndef local
+#  define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+#ifndef VERSIONMADEBY
+# define VERSIONMADEBY   (0x0) /* platform depedent */
+#endif
+
+#ifndef Z_BUFSIZE
+#define Z_BUFSIZE (16384)
+#endif
+
+#ifndef Z_MAXFILENAMEINZIP
+#define Z_MAXFILENAMEINZIP (256)
+#endif
+
+#ifndef ALLOC
+# define ALLOC(size) (malloc(size))
+#endif
+#ifndef TRYFREE
+# define TRYFREE(p) {if (p) free(p);}
+#endif
+
+/*
+#define SIZECENTRALDIRITEM (0x2e)
+#define SIZEZIPLOCALHEADER (0x1e)
+*/
+
+/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
+
+#ifndef SEEK_CUR
+#define SEEK_CUR    1
+#endif
+
+#ifndef SEEK_END
+#define SEEK_END    2
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET    0
+#endif
+
+const char zip_copyright[] =
+   " zip 0.15 Copyright 1998 Gilles Vollant ";
+
+
+#define SIZEDATA_INDATABLOCK (4096-(4*4))
+
+#define LOCALHEADERMAGIC    (0x04034b50)
+#define CENTRALHEADERMAGIC  (0x02014b50)
+#define ENDHEADERMAGIC      (0x06054b50)
+
+#define FLAG_LOCALHEADER_OFFSET (0x06)
+#define CRC_LOCALHEADER_OFFSET  (0x0e)
+
+#define SIZECENTRALHEADER (0x2e) /* 46 */
+
+typedef struct linkedlist_datablock_internal_s
+{
+  struct linkedlist_datablock_internal_s* next_datablock;
+  uLong  avail_in_this_block;
+  uLong  filled_in_this_block;
+  uLong  unused; /* for future use and alignement */
+  unsigned char data[SIZEDATA_INDATABLOCK];
+} linkedlist_datablock_internal;
+
+typedef struct linkedlist_data_s
+{
+    linkedlist_datablock_internal* first_block;
+    linkedlist_datablock_internal* last_block;
+} linkedlist_data;
+
+
+typedef struct
+{
+	z_stream stream;            /* zLib stream structure for inflate */
+    int  stream_initialised;    /* 1 is stream is initialised */
+    uInt pos_in_buffered_data;  /* last written byte in buffered_data */
+
+    uLong pos_local_header;     /* offset of the local header of the file 
+                                     currenty writing */
+    char* central_header;       /* central header data for the current file */
+    uLong size_centralheader;   /* size of the central header for cur file */
+    uLong flag;                 /* flag of the file currently writing */
+
+    int  method;                /* compression method of file currenty wr.*/
+    Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
+    uLong dosDate;
+    uLong crc32;
+} curfile_info;
+
+typedef struct
+{
+    FILE * filezip;
+    linkedlist_data central_dir;/* datablock with central dir in construction*/
+    int  in_opened_file_inzip;  /* 1 if a file in the zip is currently writ.*/
+    curfile_info ci;            /* info on the file curretly writing */
+
+    uLong begin_pos;            /* position of the beginning of the zipfile */
+    uLong number_entry;
+} zip_internal;
+
+local linkedlist_datablock_internal* allocate_new_datablock()
+{
+    linkedlist_datablock_internal* ldi;
+    ldi = (linkedlist_datablock_internal*)
+                 ALLOC(sizeof(linkedlist_datablock_internal));
+    if (ldi!=NULL)
+    {
+        ldi->next_datablock = NULL ;
+        ldi->filled_in_this_block = 0 ;
+        ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ;
+    }
+    return ldi;
+}
+
+local void free_datablock(ldi)
+    linkedlist_datablock_internal* ldi;
+{
+    while (ldi!=NULL)
+    {
+        linkedlist_datablock_internal* ldinext = ldi->next_datablock;
+        TRYFREE(ldi);
+        ldi = ldinext;
+    }
+}
+
+local void init_linkedlist(ll)
+    linkedlist_data* ll;
+{
+    ll->first_block = ll->last_block = NULL;
+}
+
+local void free_linkedlist(ll)
+    linkedlist_data* ll;
+{
+    free_datablock(ll->first_block);
+    ll->first_block = ll->last_block = NULL;
+}
+
+
+local int add_data_in_datablock(ll,buf,len)
+    linkedlist_data* ll;    
+    const void* buf;
+    uLong len;
+{
+    linkedlist_datablock_internal* ldi;
+    const unsigned char* from_copy;
+
+    if (ll==NULL)
+        return ZIP_INTERNALERROR;
+
+    if (ll->last_block == NULL)
+    {
+        ll->first_block = ll->last_block = allocate_new_datablock();
+        if (ll->first_block == NULL)
+            return ZIP_INTERNALERROR;
+    }
+
+    ldi = ll->last_block;
+    from_copy = (unsigned char*)buf;
+
+    while (len>0)
+    {
+        uInt copy_this;
+        uInt i;
+        unsigned char* to_copy;
+
+        if (ldi->avail_in_this_block==0)
+        {
+            ldi->next_datablock = allocate_new_datablock();
+            if (ldi->next_datablock == NULL)
+                return ZIP_INTERNALERROR;
+            ldi = ldi->next_datablock ;
+            ll->last_block = ldi;
+        }
+
+        if (ldi->avail_in_this_block < len)
+            copy_this = (uInt)ldi->avail_in_this_block;
+        else
+            copy_this = (uInt)len;
+
+        to_copy = &(ldi->data[ldi->filled_in_this_block]);
+
+        for (i=0;i<copy_this;i++)
+            *(to_copy+i)=*(from_copy+i);
+
+        ldi->filled_in_this_block += copy_this;
+        ldi->avail_in_this_block -= copy_this;
+        from_copy += copy_this ;
+        len -= copy_this;
+    }
+    return ZIP_OK;
+}
+
+
+local int write_datablock(fout,ll)
+    FILE * fout;
+    linkedlist_data* ll;    
+{
+    linkedlist_datablock_internal* ldi;
+    ldi = ll->first_block;
+    while (ldi!=NULL)
+    {
+        if (ldi->filled_in_this_block > 0)
+            if (fwrite(ldi->data,(uInt)ldi->filled_in_this_block,1,fout)!=1)
+                return ZIP_ERRNO;
+        ldi = ldi->next_datablock;
+    }
+    return ZIP_OK;
+}
+
+/****************************************************************************/
+
+/* ===========================================================================
+   Outputs a long in LSB order to the given file
+   nbByte == 1, 2 or 4 (byte, short or long)
+*/
+
+local int ziplocal_putValue OF((FILE *file, uLong x, int nbByte));
+local int ziplocal_putValue (file, x, nbByte)
+    FILE *file;
+    uLong x;
+    int nbByte;
+{
+    unsigned char buf[4];
+    int n;
+    for (n = 0; n < nbByte; n++) {
+        buf[n] = (unsigned char)(x & 0xff);
+        x >>= 8;
+    }
+    if (fwrite(buf,nbByte,1,file)!=1)
+        return ZIP_ERRNO;
+    else
+        return ZIP_OK;
+}
+
+local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte));
+local void ziplocal_putValue_inmemory (dest, x, nbByte)
+    void* dest;
+    uLong x;
+    int nbByte;
+{
+    unsigned char* buf=(unsigned char*)dest;
+    int n;
+    for (n = 0; n < nbByte; n++) {
+        buf[n] = (unsigned char)(x & 0xff);
+        x >>= 8;
+    }
+}
+/****************************************************************************/
+
+
+local uLong ziplocal_TmzDateToDosDate(ptm,dosDate)
+    tm_zip* ptm;
+    uLong dosDate;
+{
+    uLong year = (uLong)ptm->tm_year;
+    if (year>1980)
+        year-=1980;
+    else if (year>80)
+        year-=80;
+    return
+      (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
+        ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
+}
+
+
+/****************************************************************************/
+
+extern zipFile ZEXPORT zipOpen (pathname, append)
+    const char *pathname;
+    int append;
+{
+    zip_internal ziinit;
+    zip_internal* zi;
+
+    ziinit.filezip = fopen(pathname,(append == 0) ? "wb" : "ab");
+    if (ziinit.filezip == NULL)
+        return NULL;
+    ziinit.begin_pos = ftell(ziinit.filezip);
+    ziinit.in_opened_file_inzip = 0;
+    ziinit.ci.stream_initialised = 0;
+    ziinit.number_entry = 0;
+    init_linkedlist(&(ziinit.central_dir));
+
+
+    zi = (zip_internal*)ALLOC(sizeof(zip_internal));
+    if (zi==NULL)
+    {
+        fclose(ziinit.filezip);
+        return NULL;
+    }
+
+    *zi = ziinit;
+    return (zipFile)zi;
+}
+
+extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, 
+                                        extrafield_local, size_extrafield_local,
+                                        extrafield_global, size_extrafield_global,
+                                        comment, method, level)
+    zipFile file;
+    const char* filename;
+    const zip_fileinfo* zipfi;
+    const void* extrafield_local;
+    uInt size_extrafield_local;
+    const void* extrafield_global;
+    uInt size_extrafield_global;
+    const char* comment;
+    int method;
+    int level;
+{
+    zip_internal* zi;
+    uInt size_filename;
+    uInt size_comment;
+    uInt i;
+    int err = ZIP_OK;
+
+    if (file == NULL)
+        return ZIP_PARAMERROR;
+    if ((method!=0) && (method!=Z_DEFLATED))
+        return ZIP_PARAMERROR;
+
+    zi = (zip_internal*)file;
+
+    if (zi->in_opened_file_inzip == 1)
+    {
+        err = zipCloseFileInZip (file);
+        if (err != ZIP_OK)
+            return err;
+    }
+
+
+    if (filename==NULL)
+        filename="-";
+
+    if (comment==NULL)
+        size_comment = 0;
+    else
+        size_comment = strlen(comment);
+
+    size_filename = strlen(filename);
+
+    if (zipfi == NULL)
+        zi->ci.dosDate = 0;
+    else
+    {
+        if (zipfi->dosDate != 0)
+            zi->ci.dosDate = zipfi->dosDate;
+        else zi->ci.dosDate = ziplocal_TmzDateToDosDate(&zipfi->tmz_date,zipfi->dosDate);
+    }
+
+    zi->ci.flag = 0;
+    if ((level==8) || (level==9))
+      zi->ci.flag |= 2;
+    if ((level==2))
+      zi->ci.flag |= 4;
+    if ((level==1))
+      zi->ci.flag |= 6;
+
+    zi->ci.crc32 = 0;
+    zi->ci.method = method;
+    zi->ci.stream_initialised = 0;
+    zi->ci.pos_in_buffered_data = 0;
+    zi->ci.pos_local_header = ftell(zi->filezip);
+    zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + 
+                                      size_extrafield_global + size_comment;
+    zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader);
+
+    ziplocal_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4);
+    /* version info */
+    ziplocal_putValue_inmemory(zi->ci.central_header+4,(uLong)VERSIONMADEBY,2);
+    ziplocal_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2);
+    ziplocal_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2);
+    ziplocal_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2);
+    ziplocal_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4);
+    ziplocal_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/
+    ziplocal_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/
+    ziplocal_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/
+    ziplocal_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2);
+    ziplocal_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2);
+    ziplocal_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2);
+    ziplocal_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/
+
+    if (zipfi==NULL)
+        ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2); 
+    else
+        ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2); 
+
+    if (zipfi==NULL)
+        ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4); 
+    else
+        ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4);
+
+    ziplocal_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header,4);
+
+    for (i=0;i<size_filename;i++)
+        *(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
+
+    for (i=0;i<size_extrafield_global;i++)
+        *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+i) =
+              *(((const char*)extrafield_global)+i);
+
+    for (i=0;i<size_comment;i++)
+        *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+
+              size_extrafield_global+i) = *(filename+i);
+    if (zi->ci.central_header == NULL)
+        return ZIP_INTERNALERROR;
+
+    /* write the local header */
+    err = ziplocal_putValue(zi->filezip,(uLong)LOCALHEADERMAGIC,4);
+
+    if (err==ZIP_OK)
+        err = ziplocal_putValue(zi->filezip,(uLong)20,2);/* version needed to extract */
+    if (err==ZIP_OK)
+        err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.flag,2);
+
+    if (err==ZIP_OK)
+        err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.method,2);
+
+    if (err==ZIP_OK)
+        err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.dosDate,4);
+
+    if (err==ZIP_OK)
+        err = ziplocal_putValue(zi->filezip,(uLong)0,4); /* crc 32, unknown */
+    if (err==ZIP_OK)
+        err = ziplocal_putValue(zi->filezip,(uLong)0,4); /* compressed size, unknown */
+    if (err==ZIP_OK)
+        err = ziplocal_putValue(zi->filezip,(uLong)0,4); /* uncompressed size, unknown */
+
+    if (err==ZIP_OK)
+        err = ziplocal_putValue(zi->filezip,(uLong)size_filename,2);
+
+    if (err==ZIP_OK)
+        err = ziplocal_putValue(zi->filezip,(uLong)size_extrafield_local,2);
+
+    if ((err==ZIP_OK) && (size_filename>0))
+        if (fwrite(filename,(uInt)size_filename,1,zi->filezip)!=1)
+                err = ZIP_ERRNO;
+
+    if ((err==ZIP_OK) && (size_extrafield_local>0))
+        if (fwrite(extrafield_local,(uInt)size_extrafield_local,1,zi->filezip)
+                                                                           !=1)
+                err = ZIP_ERRNO;
+
+    zi->ci.stream.avail_in = (uInt)0;
+    zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
+    zi->ci.stream.next_out = zi->ci.buffered_data;
+    zi->ci.stream.total_in = 0;
+    zi->ci.stream.total_out = 0;
+
+    if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED))
+    {
+        zi->ci.stream.zalloc = (alloc_func)0;
+        zi->ci.stream.zfree = (free_func)0;
+        zi->ci.stream.opaque = (voidpf)0;
+
+        err = deflateInit2(&zi->ci.stream, level,
+               Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, 0);
+
+        if (err==Z_OK)
+            zi->ci.stream_initialised = 1;
+    }
+
+
+    if (err==Z_OK)
+        zi->in_opened_file_inzip = 1;
+    return err;
+}
+
+extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
+    zipFile file;
+    const voidp buf;
+    unsigned len;
+{
+    zip_internal* zi;
+    int err=ZIP_OK;
+
+    if (file == NULL)
+        return ZIP_PARAMERROR;
+    zi = (zip_internal*)file;
+
+    if (zi->in_opened_file_inzip == 0)
+        return ZIP_PARAMERROR;
+
+    zi->ci.stream.next_in = buf;
+    zi->ci.stream.avail_in = len;
+    zi->ci.crc32 = crc32(zi->ci.crc32,buf,len);
+
+    while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
+    {
+        if (zi->ci.stream.avail_out == 0)
+        {
+            if (fwrite(zi->ci.buffered_data,(uInt)zi->ci.pos_in_buffered_data,1,zi->filezip)
+                                                                           !=1)
+                err = ZIP_ERRNO;
+            zi->ci.pos_in_buffered_data = 0;
+            zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
+            zi->ci.stream.next_out = zi->ci.buffered_data;
+        }
+
+        if (zi->ci.method == Z_DEFLATED)
+        {
+            uLong uTotalOutBefore = zi->ci.stream.total_out;
+            err=deflate(&zi->ci.stream,  Z_NO_FLUSH);
+            zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
+
+        }
+        else
+        {
+            uInt copy_this,i;
+            if (zi->ci.stream.avail_in < zi->ci.stream.avail_out)
+                copy_this = zi->ci.stream.avail_in;
+            else
+                copy_this = zi->ci.stream.avail_out;
+            for (i=0;i<copy_this;i++)
+                *(((char*)zi->ci.stream.next_out)+i) =
+                    *(((const char*)zi->ci.stream.next_in)+i);
+            {
+                zi->ci.stream.avail_in -= copy_this;
+                zi->ci.stream.avail_out-= copy_this;
+                zi->ci.stream.next_in+= copy_this;
+                zi->ci.stream.next_out+= copy_this;
+                zi->ci.stream.total_in+= copy_this;
+                zi->ci.stream.total_out+= copy_this;
+                zi->ci.pos_in_buffered_data += copy_this;
+            }
+        }
+    }
+
+    return 0;
+}
+
+extern int ZEXPORT zipCloseFileInZip (file)
+    zipFile file;
+{
+    zip_internal* zi;
+    int err=ZIP_OK;
+
+    if (file == NULL)
+        return ZIP_PARAMERROR;
+    zi = (zip_internal*)file;
+
+    if (zi->in_opened_file_inzip == 0)    
+        return ZIP_PARAMERROR;
+    zi->ci.stream.avail_in = 0;
+    
+    if (zi->ci.method == Z_DEFLATED)
+        while (err==ZIP_OK)
+    {
+        uLong uTotalOutBefore;
+        if (zi->ci.stream.avail_out == 0)
+        {
+            if (fwrite(zi->ci.buffered_data,(uInt)zi->ci.pos_in_buffered_data,1,zi->filezip)
+                                                                           !=1)
+                err = ZIP_ERRNO;
+            zi->ci.pos_in_buffered_data = 0;
+            zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
+            zi->ci.stream.next_out = zi->ci.buffered_data;
+        }
+        uTotalOutBefore = zi->ci.stream.total_out;
+        err=deflate(&zi->ci.stream,  Z_FINISH);
+        zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
+    }
+
+    if (err==Z_STREAM_END)
+        err=ZIP_OK; /* this is normal */
+
+    if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
+        if (fwrite(zi->ci.buffered_data,(uInt)zi->ci.pos_in_buffered_data,1,zi->filezip)
+                                                                       !=1)
+            err = ZIP_ERRNO;
+
+    if ((zi->ci.method == Z_DEFLATED) && (err==ZIP_OK))
+    {
+        err=deflateEnd(&zi->ci.stream);
+        zi->ci.stream_initialised = 0;
+    }
+
+    ziplocal_putValue_inmemory(zi->ci.central_header+16,(uLong)zi->ci.crc32,4); /*crc*/
+    ziplocal_putValue_inmemory(zi->ci.central_header+20,
+                                (uLong)zi->ci.stream.total_out,4); /*compr size*/
+    ziplocal_putValue_inmemory(zi->ci.central_header+24,
+                                (uLong)zi->ci.stream.total_in,4); /*uncompr size*/
+
+    if (err==ZIP_OK)
+        err = add_data_in_datablock(&zi->central_dir,zi->ci.central_header,
+                                       (uLong)zi->ci.size_centralheader);
+    free(zi->ci.central_header);
+
+    if (err==ZIP_OK)
+    {
+        long cur_pos_inzip = ftell(zi->filezip);
+	    if (fseek(zi->filezip,
+                  zi->ci.pos_local_header + 14,SEEK_SET)!=0)
+		    err = ZIP_ERRNO;
+
+        if (err==ZIP_OK)
+            err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.crc32,4); /* crc 32, unknown */
+
+        if (err==ZIP_OK) /* compressed size, unknown */
+            err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.stream.total_out,4); 
+
+        if (err==ZIP_OK) /* uncompressed size, unknown */
+            err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.stream.total_in,4);
+
+	    if (fseek(zi->filezip,
+                  cur_pos_inzip,SEEK_SET)!=0)
+		    err = ZIP_ERRNO;
+    }
+
+    zi->number_entry ++;
+    zi->in_opened_file_inzip = 0;
+
+    return err;
+}
+
+extern int ZEXPORT zipClose (file, global_comment)
+    zipFile file;
+    const char* global_comment;
+{
+    zip_internal* zi;
+    int err = 0;
+    uLong size_centraldir = 0;
+    uLong centraldir_pos_inzip ;
+    uInt size_global_comment;
+    if (file == NULL)
+        return ZIP_PARAMERROR;
+    zi = (zip_internal*)file;
+
+    if (zi->in_opened_file_inzip == 1)
+    {
+        err = zipCloseFileInZip (file);
+    }
+
+    if (global_comment==NULL)
+        size_global_comment = 0;
+    else
+        size_global_comment = strlen(global_comment);
+
+
+    centraldir_pos_inzip = ftell(zi->filezip);
+    if (err==ZIP_OK)
+    {
+        linkedlist_datablock_internal* ldi = zi->central_dir.first_block ;
+        while (ldi!=NULL)
+        {
+            if ((err==ZIP_OK) && (ldi->filled_in_this_block>0))
+                if (fwrite(ldi->data,(uInt)ldi->filled_in_this_block,
+                                        1,zi->filezip) !=1 )
+                    err = ZIP_ERRNO;
+
+            size_centraldir += ldi->filled_in_this_block;
+            ldi = ldi->next_datablock;
+        }
+    }
+    free_datablock(zi->central_dir.first_block);
+
+    if (err==ZIP_OK) /* Magic End */
+        err = ziplocal_putValue(zi->filezip,(uLong)ENDHEADERMAGIC,4);
+
+    if (err==ZIP_OK) /* number of this disk */
+        err = ziplocal_putValue(zi->filezip,(uLong)0,2);
+
+    if (err==ZIP_OK) /* number of the disk with the start of the central directory */
+        err = ziplocal_putValue(zi->filezip,(uLong)0,2);
+
+    if (err==ZIP_OK) /* total number of entries in the central dir on this disk */
+        err = ziplocal_putValue(zi->filezip,(uLong)zi->number_entry,2);
+
+    if (err==ZIP_OK) /* total number of entries in the central dir */
+        err = ziplocal_putValue(zi->filezip,(uLong)zi->number_entry,2);
+
+    if (err==ZIP_OK) /* size of the central directory */
+        err = ziplocal_putValue(zi->filezip,(uLong)size_centraldir,4);
+
+    if (err==ZIP_OK) /* offset of start of central directory with respect to the 
+	                        starting disk number */
+        err = ziplocal_putValue(zi->filezip,(uLong)centraldir_pos_inzip ,4);
+
+    if (err==ZIP_OK) /* zipfile comment length */
+        err = ziplocal_putValue(zi->filezip,(uLong)size_global_comment,2);
+
+    if ((err==ZIP_OK) && (size_global_comment>0))
+        if (fwrite(global_comment,(uInt)size_global_comment,1,zi->filezip) !=1 )
+                err = ZIP_ERRNO;
+    fclose(zi->filezip);
+    TRYFREE(zi);
+
+    return err;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.def
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.def	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.def	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,5 @@
+	zipOpen                       @80
+	zipOpenNewFileInZip           @81
+	zipWriteInFileInZip           @82
+	zipCloseFileInZip             @83
+	zipClose                      @84

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zip.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,150 @@
+/* zip.h -- IO for compress .zip files using zlib 
+   Version 0.15 alpha, Mar 19th, 1998,
+
+   Copyright (C) 1998 Gilles Vollant
+
+   This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
+     WinZip, InfoZip tools and compatible.
+   Encryption and multi volume ZipFile (span) are not supported.
+   Old compressions used by old PKZip 1.x are not supported
+
+  For uncompress .zip file, look at unzip.h
+
+   THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
+   CAN CHANGE IN FUTURE VERSION !!
+   I WAIT FEEDBACK at mail info at winimage.com
+   Visit also http://www.winimage.com/zLibDll/zip.htm for evolution
+
+   Condition of use and distribution are the same than zlib :
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+
+*/
+
+/* for more info about .ZIP format, see 
+      ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
+   PkWare has also a specification at :
+      ftp://ftp.pkware.com/probdesc.zip
+*/
+
+#ifndef _zip_H
+#define _zip_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
+/* like the STRICT of WIN32, we define a pointer that cannot be converted
+    from (void*) without cast */
+typedef struct TagzipFile__ { int unused; } zipFile__; 
+typedef zipFile__ *zipFile;
+#else
+typedef voidp zipFile;
+#endif
+
+#define ZIP_OK                                  (0)
+#define ZIP_ERRNO               (Z_ERRNO)
+#define ZIP_PARAMERROR                  (-102)
+#define ZIP_INTERNALERROR               (-104)
+
+/* tm_zip contain date/time info */
+typedef struct tm_zip_s 
+{
+	uInt tm_sec;            /* seconds after the minute - [0,59] */
+	uInt tm_min;            /* minutes after the hour - [0,59] */
+	uInt tm_hour;           /* hours since midnight - [0,23] */
+	uInt tm_mday;           /* day of the month - [1,31] */
+	uInt tm_mon;            /* months since January - [0,11] */
+	uInt tm_year;           /* years - [1980..2044] */
+} tm_zip;
+
+typedef struct
+{
+	tm_zip      tmz_date;       /* date in understandable format           */
+    uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */
+/*    uLong       flag;        */   /* general purpose bit flag        2 bytes */
+
+    uLong       internal_fa;    /* internal file attributes        2 bytes */
+    uLong       external_fa;    /* external file attributes        4 bytes */
+} zip_fileinfo;
+
+extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
+/*
+  Create a zipfile.
+	 pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or on
+	   an Unix computer "zlib/zlib111.zip".
+	 if the file pathname exist and append=1, the zip will be created at the end
+	   of the file. (useful if the file contain a self extractor code)
+	 If the zipfile cannot be opened, the return value is NULL.
+     Else, the return value is a zipFile Handle, usable with other function
+	   of this zip package.
+
+
+*/
+
+extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
+					   const char* filename,
+					   const zip_fileinfo* zipfi,
+					   const void* extrafield_local,
+					   uInt size_extrafield_local,
+					   const void* extrafield_global,
+					   uInt size_extrafield_global,
+					   const char* comment,
+					   int method,
+					   int level));
+/*
+  Open a file in the ZIP for writing.
+  filename : the filename in zip (if NULL, '-' without quote will be used
+  *zipfi contain supplemental information
+  if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
+    contains the extrafield data the the local header
+  if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
+    contains the extrafield data the the local header
+  if comment != NULL, comment contain the comment string
+  method contain the compression method (0 for store, Z_DEFLATED for deflate)
+  level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
+*/
+
+extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
+					   const voidp buf,
+					   unsigned len));
+/*
+  Write data in the zipfile
+*/
+
+extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
+/*
+  Close the current file in the zipfile
+*/
+
+extern int ZEXPORT zipClose OF((zipFile file,
+				const char* global_comment));
+/*
+  Close the zipfile
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _zip_H */

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.def
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.def	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.def	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,74 @@
+LIBRARY		"zlib"
+
+DESCRIPTION	'"""zlib data compression library"""'
+
+
+VERSION		1.11
+
+
+HEAPSIZE	1048576,8192
+
+EXPORTS
+    adler32                        @1
+    compress                       @2
+    crc32                          @3
+    deflate                        @4
+    deflateCopy                    @5
+    deflateEnd                     @6
+    deflateInit2_                  @7
+    deflateInit_                   @8
+    deflateParams                  @9
+    deflateReset                   @10
+    deflateSetDictionary           @11
+    gzclose                        @12
+    gzdopen                        @13
+    gzerror                        @14
+    gzflush                        @15
+    gzopen                         @16
+    gzread                         @17
+    gzwrite                        @18
+    inflate                        @19
+    inflateEnd                     @20
+    inflateInit2_                  @21
+    inflateInit_                   @22
+    inflateReset                   @23
+    inflateSetDictionary           @24
+    inflateSync                    @25
+    uncompress                     @26
+    zlibVersion                    @27
+    gzprintf                       @28
+    gzputc                         @29
+    gzgetc                         @30
+    gzseek                         @31
+    gzrewind                       @32
+    gztell                         @33
+    gzeof                          @34
+    gzsetparams                    @35
+    zError                         @36
+    inflateSyncPoint               @37
+    get_crc_table                  @38
+    compress2                      @39
+    gzputs                         @40
+    gzgets                         @41
+
+	unzOpen                       @61
+	unzClose                      @62
+	unzGetGlobalInfo              @63
+	unzGetCurrentFileInfo         @64
+	unzGoToFirstFile              @65
+	unzGoToNextFile               @66
+	unzOpenCurrentFile            @67
+	unzReadCurrentFile            @68
+	unztell                       @70
+	unzeof                        @71
+	unzCloseCurrentFile           @72
+	unzGetGlobalComment           @73
+	unzStringFileNameCompare      @74
+	unzLocateFile                 @75
+	unzGetLocalExtrafield         @76
+
+	zipOpen                       @80
+	zipOpenNewFileInZip           @81
+	zipWriteInFileInZip           @82
+	zipCloseFileInZip             @83
+	zipClose                      @84

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.dsp
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.dsp	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.dsp	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,651 @@
+# Microsoft Developer Studio Project File - Name="zlibvc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+# TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602
+
+CFG=zlibvc - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "zlibvc.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "zlibvc.mak" CFG="zlibvc - Win32 Release"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "zlibvc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "zlibvc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "zlibvc - Win32 ReleaseAxp" (based on\
+ "Win32 (ALPHA) Dynamic-Link Library")
+!MESSAGE "zlibvc - Win32 ReleaseWithoutAsm" (based on\
+ "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "zlibvc - Win32 ReleaseWithoutCrtdll" (based on\
+ "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\Release"
+# PROP BASE Intermediate_Dir ".\Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release"
+# PROP Intermediate_Dir ".\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c
+# SUBTRACT CPP /YX
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# 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:windows /dll /machine:I386
+# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\Debug"
+# PROP BASE Intermediate_Dir ".\Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug"
+# PROP Intermediate_Dir ".\Debug"
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /FD /c
+# SUBTRACT CPP /YX
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# 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:windows /dll /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 /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug\zlib.dll"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "zlibvc__"
+# PROP BASE Intermediate_Dir "zlibvc__"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "zlibvc__"
+# PROP Intermediate_Dir "zlibvc__"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+CPP=cl.exe
+# ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
+# ADD CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c
+# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:".\Release\zlib.dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:"zlibvc__\zlib.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "zlibvc_0"
+# PROP BASE Intermediate_Dir "zlibvc_0"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "zlibvc_0"
+# PROP Intermediate_Dir "zlibvc_0"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c
+# SUBTRACT CPP /YX
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_0\zlib.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "zlibvc_1"
+# PROP BASE Intermediate_Dir "zlibvc_1"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "zlibvc_1"
+# PROP Intermediate_Dir "zlibvc_1"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c
+# SUBTRACT CPP /YX
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_1\zlib.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF 
+
+# Begin Target
+
+# Name "zlibvc - Win32 Release"
+# Name "zlibvc - Win32 Debug"
+# Name "zlibvc - Win32 ReleaseAxp"
+# Name "zlibvc - Win32 ReleaseWithoutAsm"
+# Name "zlibvc - Win32 ReleaseWithoutCrtdll"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\adler32.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_ADLER=\
+	".\zconf.h"\
+	".\zlib.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\compress.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_COMPR=\
+	".\zconf.h"\
+	".\zlib.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\crc32.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_CRC32=\
+	".\zconf.h"\
+	".\zlib.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\deflate.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_DEFLA=\
+	".\deflate.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\gvmat32c.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\gzio.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_GZIO_=\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\infblock.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFBL=\
+	".\infblock.h"\
+	".\infcodes.h"\
+	".\inftrees.h"\
+	".\infutil.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\infcodes.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFCO=\
+	".\infblock.h"\
+	".\infcodes.h"\
+	".\inffast.h"\
+	".\inftrees.h"\
+	".\infutil.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\inffast.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFFA=\
+	".\infblock.h"\
+	".\infcodes.h"\
+	".\inffast.h"\
+	".\inftrees.h"\
+	".\infutil.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\inflate.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFLA=\
+	".\infblock.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\inftrees.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFTR=\
+	".\inftrees.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\infutil.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_INFUT=\
+	".\infblock.h"\
+	".\infcodes.h"\
+	".\inftrees.h"\
+	".\infutil.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\trees.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_TREES=\
+	".\deflate.h"\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\uncompr.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_UNCOM=\
+	".\zconf.h"\
+	".\zlib.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\unzip.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\zip.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\zlib.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\zlibvc.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\zutil.c
+
+!IF  "$(CFG)" == "zlibvc - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
+
+DEP_CPP_ZUTIL=\
+	".\zconf.h"\
+	".\zlib.h"\
+	".\zutil.h"\
+	
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
+
+!ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
+
+!ENDIF 
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\deflate.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\infblock.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\infcodes.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\inffast.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\inftrees.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\infutil.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\zconf.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\zlib.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\zutil.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.dsw
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.dsw	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/minizip/zlibvc.dsw	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "zlibstat"=.\zlibstat.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "zlibvc"=.\zlibvc.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/Makefile
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/Makefile	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/Makefile	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,14 @@
+CC=cc
+CFLAGS=-g
+
+untgz: untgz.o  ../../libz.a
+	$(CC) $(CFLAGS) -o untgz  untgz.o -L../.. -lz
+
+untgz.o: untgz.c ../../zlib.h
+	$(CC) $(CFLAGS) -c -I../.. untgz.c
+
+../../libz.a:
+	cd ../..; make
+
+clean:
+	rm -f untgz untgz.o *~

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/makefile.w32
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/makefile.w32	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/makefile.w32	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,63 @@
+# Makefile for zlib.  Modified for mingw32
+# For conditions of distribution and use, see copyright notice in zlib.h 
+
+# To compile, 
+# 
+#   make -fmakefile.w32
+# 
+
+CC=gcc
+
+# Generate dependencies (see end of the file)
+
+CPPFLAGS=-MMD 
+
+#CFLAGS=-MMD -O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-MMD -g -DDEBUG
+CFLAGS=-O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+             -Wstrict-prototypes -Wmissing-prototypes
+
+# If cp.exe is not found, replace with copy /Y .
+CP=cp -f
+
+# The default value of RM is "rm -f."  
+# If "rm.exe" is not found, uncomment:
+# RM=del
+
+LD=gcc
+LDLIBS=-L. -lz
+LDFLAGS=-s
+
+
+INCL=zlib.h zconf.h
+LIBS=libz.a
+
+AR=ar rcs
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o \
+       inffast.o
+
+TEST_OBJS = minigzip.o untgz.o
+
+all: minigzip.exe untgz.exe
+
+rebuild:	clean	all
+
+libz.a: $(OBJS)
+	$(AR) $@ $(OBJS)
+
+%.exe : %.o $(LIBS)
+	$(LD) $(LDFLAGS) -o $@ $< $(LDLIBS)
+
+.PHONY : clean
+
+clean:
+	$(RM) *.d *.o *.exe libz.a foo.gz
+
+DEPS := $(wildcard *.d)
+ifneq ($(DEPS),)
+include $(DEPS)
+endif
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/untgz.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/untgz.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/untgz/untgz.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,522 @@
+/*
+ * untgz.c -- Display contents and/or extract file from
+ * a gzip'd TAR file
+ * written by "Pedro A. Aranda Guti\irrez" <paag at tid.es>
+ * adaptation to Unix by Jean-loup Gailly <jloup at gzip.org>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+#ifdef unix
+# include <unistd.h>
+#else
+# include <direct.h>
+# include <io.h>
+#endif
+
+#include "zlib.h"
+
+#ifdef WIN32
+#  ifndef F_OK
+#    define F_OK (0)
+#  endif
+#  ifdef _MSC_VER
+#    define mkdir(dirname,mode) _mkdir(dirname)
+#    define strdup(str)         _strdup(str)
+#    define unlink(fn)          _unlink(fn)
+#    define access(path,mode)   _access(path,mode)
+#  else
+#    define mkdir(dirname,mode) _mkdir(dirname)
+#  endif
+#else
+#  include <utime.h>
+#endif
+
+
+/* Values used in typeflag field.  */
+
+#define REGTYPE	 '0'		/* regular file */
+#define AREGTYPE '\0'		/* regular file */
+#define LNKTYPE  '1'		/* link */
+#define SYMTYPE  '2'		/* reserved */
+#define CHRTYPE  '3'		/* character special */
+#define BLKTYPE  '4'		/* block special */
+#define DIRTYPE  '5'		/* directory */
+#define FIFOTYPE '6'		/* FIFO special */
+#define CONTTYPE '7'		/* reserved */
+
+#define BLOCKSIZE 512
+
+struct tar_header
+{				/* byte offset */
+  char name[100];		/*   0 */
+  char mode[8];			/* 100 */
+  char uid[8];			/* 108 */
+  char gid[8];			/* 116 */
+  char size[12];		/* 124 */
+  char mtime[12];		/* 136 */
+  char chksum[8];		/* 148 */
+  char typeflag;		/* 156 */
+  char linkname[100];		/* 157 */
+  char magic[6];		/* 257 */
+  char version[2];		/* 263 */
+  char uname[32];		/* 265 */
+  char gname[32];		/* 297 */
+  char devmajor[8];		/* 329 */
+  char devminor[8];		/* 337 */
+  char prefix[155];		/* 345 */
+				/* 500 */
+};
+
+union tar_buffer {
+  char               buffer[BLOCKSIZE];
+  struct tar_header  header;
+};
+
+enum { TGZ_EXTRACT = 0, TGZ_LIST };
+
+static char *TGZfname	OF((const char *));
+void TGZnotfound	OF((const char *));
+
+int getoct		OF((char *, int));
+char *strtime		OF((time_t *));
+int ExprMatch		OF((char *,char *));
+
+int makedir		OF((char *));
+int matchname		OF((int,int,char **,char *));
+
+void error		OF((const char *));
+int  tar		OF((gzFile, int, int, int, char **));
+
+void help		OF((int));
+int main		OF((int, char **));
+
+char *prog;
+
+/* This will give a benign warning */
+
+static char *TGZprefix[] = { "\0", ".tgz", ".tar.gz", ".tar", NULL };
+
+/* Return the real name of the TGZ archive */
+/* or NULL if it does not exist. */
+
+static char *TGZfname OF((const char *fname))
+{
+  static char buffer[1024];
+  int origlen,i;
+  
+  strcpy(buffer,fname);
+  origlen = strlen(buffer);
+
+  for (i=0; TGZprefix[i]; i++)
+    {
+       strcpy(buffer+origlen,TGZprefix[i]);
+       if (access(buffer,F_OK) == 0)
+         return buffer;
+    }
+  return NULL;
+}
+
+/* error message for the filename */
+
+void TGZnotfound OF((const char *fname))
+{
+  int i;
+
+  fprintf(stderr,"%s : couldn't find ",prog);
+  for (i=0;TGZprefix[i];i++)
+    fprintf(stderr,(TGZprefix[i+1]) ? "%s%s, " : "or %s%s\n",
+            fname,
+            TGZprefix[i]);
+  exit(1);
+}
+
+
+/* help functions */
+
+int getoct(char *p,int width)
+{
+  int result = 0;
+  char c;
+  
+  while (width --)
+    {
+      c = *p++;
+      if (c == ' ')
+	continue;
+      if (c == 0)
+	break;
+      result = result * 8 + (c - '0');
+    }
+  return result;
+}
+
+char *strtime (time_t *t)
+{
+  struct tm   *local;
+  static char result[32];
+
+  local = localtime(t);
+  sprintf(result,"%2d/%02d/%4d %02d:%02d:%02d",
+	  local->tm_mday, local->tm_mon+1, local->tm_year+1900,
+	  local->tm_hour, local->tm_min,   local->tm_sec);
+  return result;
+}
+
+
+/* regular expression matching */
+
+#define ISSPECIAL(c) (((c) == '*') || ((c) == '/'))
+
+int ExprMatch(char *string,char *expr)
+{
+  while (1)
+    {
+      if (ISSPECIAL(*expr))
+	{
+	  if (*expr == '/')
+	    {
+	      if (*string != '\\' && *string != '/')
+		return 0;
+	      string ++; expr++;
+	    }
+	  else if (*expr == '*')
+	    {
+	      if (*expr ++ == 0)
+		return 1;
+	      while (*++string != *expr)
+		if (*string == 0)
+		  return 0;
+	    }
+	}
+      else
+	{
+	  if (*string != *expr)
+	    return 0;
+	  if (*expr++ == 0)
+	    return 1;
+	  string++;
+	}
+    }
+}
+
+/* recursive make directory */
+/* abort if you get an ENOENT errno somewhere in the middle */
+/* e.g. ignore error "mkdir on existing directory" */
+/* */
+/* return 1 if OK */
+/*        0 on error */
+
+int makedir (char *newdir)
+{
+  char *buffer = strdup(newdir);
+  char *p;
+  int  len = strlen(buffer);
+  
+  if (len <= 0) {
+    free(buffer);
+    return 0;
+  }
+  if (buffer[len-1] == '/') {
+    buffer[len-1] = '\0';
+  }
+  if (mkdir(buffer, 0775) == 0)
+    {
+      free(buffer);
+      return 1;
+    }
+
+  p = buffer+1;
+  while (1)
+    {
+      char hold;
+      
+      while(*p && *p != '\\' && *p != '/')
+	p++;
+      hold = *p;
+      *p = 0;
+      if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT))
+	{
+	  fprintf(stderr,"%s: couldn't create directory %s\n",prog,buffer);
+	  free(buffer);
+	  return 0;
+	}
+      if (hold == 0)
+	break;
+      *p++ = hold;
+    }
+  free(buffer);
+  return 1;
+}
+
+int matchname (int arg,int argc,char **argv,char *fname)
+{
+  if (arg == argc)		/* no arguments given (untgz tgzarchive) */
+    return 1;
+
+  while (arg < argc)
+    if (ExprMatch(fname,argv[arg++]))
+      return 1;
+
+  return 0; /* ignore this for the moment being */
+}
+
+
+/* Tar file list or extract */
+
+int tar (gzFile in,int action,int arg,int argc,char **argv)
+{
+  union  tar_buffer buffer;
+  int    len;
+  int    err;
+  int    getheader = 1;
+  int    remaining = 0;
+  FILE   *outfile = NULL;
+  char   fname[BLOCKSIZE];
+  time_t tartime;
+  
+  if (action == TGZ_LIST)
+    printf("     day      time     size                       file\n"
+	   " ---------- -------- --------- -------------------------------------\n");
+  while (1)
+    {
+      len = gzread(in, &buffer, BLOCKSIZE);
+      if (len < 0)
+	error (gzerror(in, &err));
+      /*
+       * Always expect complete blocks to process
+       * the tar information.
+       */
+      if (len != BLOCKSIZE)
+	error("gzread: incomplete block read");
+      
+      /*
+       * If we have to get a tar header
+       */
+      if (getheader == 1)
+	{
+	  /*
+	   * if we met the end of the tar
+	   * or the end-of-tar block,
+	   * we are done
+	   */
+	  if ((len == 0)  || (buffer.header.name[0]== 0)) break;
+
+	  tartime = (time_t)getoct(buffer.header.mtime,12);
+	  strcpy(fname,buffer.header.name);
+	  
+	  switch (buffer.header.typeflag)
+	    {
+	    case DIRTYPE:
+	      if (action == TGZ_LIST)
+		printf(" %s     <dir> %s\n",strtime(&tartime),fname);
+	      if (action == TGZ_EXTRACT)
+		makedir(fname);
+	      break;
+	    case REGTYPE:
+	    case AREGTYPE:
+	      remaining = getoct(buffer.header.size,12);
+	      if (action == TGZ_LIST)
+		printf(" %s %9d %s\n",strtime(&tartime),remaining,fname);
+	      if (action == TGZ_EXTRACT)
+		{
+		  if ((remaining) && (matchname(arg,argc,argv,fname)))
+		    {
+		      outfile = fopen(fname,"wb");
+		      if (outfile == NULL) {
+			/* try creating directory */
+			char *p = strrchr(fname, '/');
+			if (p != NULL) {
+			  *p = '\0';
+			  makedir(fname);
+			  *p = '/';
+			  outfile = fopen(fname,"wb");
+			}
+		      }
+		      fprintf(stderr,
+			      "%s %s\n",
+			      (outfile) ? "Extracting" : "Couldn't create",
+			      fname);
+		    }
+		  else
+		    outfile = NULL;
+		}
+	      /*
+	       * could have no contents
+	       */
+	      getheader = (remaining) ? 0 : 1;
+	      break;
+	    default:
+	      if (action == TGZ_LIST)
+		printf(" %s     <---> %s\n",strtime(&tartime),fname);
+	      break;
+	    }
+	}
+      else
+	{
+	  unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;
+
+	  if ((action == TGZ_EXTRACT) && (outfile != NULL))
+	    {
+	      if (fwrite(&buffer,sizeof(char),bytes,outfile) != bytes)
+		{
+		  fprintf(stderr,"%s : error writing %s skipping...\n",prog,fname);
+		  fclose(outfile);
+		  unlink(fname);
+		}
+	    }
+	  remaining -= bytes;
+	  if (remaining == 0)
+	    {
+	      getheader = 1;
+	      if ((action == TGZ_EXTRACT) && (outfile != NULL))
+		{
+#ifdef WIN32
+		  HANDLE hFile;
+		  FILETIME ftm,ftLocal;
+		  SYSTEMTIME st;
+		  struct tm localt;
+ 
+		  fclose(outfile);
+
+		  localt = *localtime(&tartime);
+
+		  hFile = CreateFile(fname, GENERIC_READ | GENERIC_WRITE,
+				     0, NULL, OPEN_EXISTING, 0, NULL);
+		  
+		  st.wYear = (WORD)localt.tm_year+1900;
+		  st.wMonth = (WORD)localt.tm_mon;
+		  st.wDayOfWeek = (WORD)localt.tm_wday;
+		  st.wDay = (WORD)localt.tm_mday;
+		  st.wHour = (WORD)localt.tm_hour;
+		  st.wMinute = (WORD)localt.tm_min;
+		  st.wSecond = (WORD)localt.tm_sec;
+		  st.wMilliseconds = 0;
+		  SystemTimeToFileTime(&st,&ftLocal);
+		  LocalFileTimeToFileTime(&ftLocal,&ftm);
+		  SetFileTime(hFile,&ftm,NULL,&ftm);
+		  CloseHandle(hFile);
+
+		  outfile = NULL;
+#else
+		  struct utimbuf settime;
+
+		  settime.actime = settime.modtime = tartime;
+
+		  fclose(outfile);
+		  outfile = NULL;
+		  utime(fname,&settime);
+#endif
+		}
+	    }
+	}
+    }
+  
+  if (gzclose(in) != Z_OK)
+    error("failed gzclose");
+
+  return 0;
+}
+
+
+/* =========================================================== */
+
+void help(int exitval)
+{
+  fprintf(stderr,
+	  "untgz v 0.1\n"
+	  " an sample application of zlib 1.0.4\n\n"
+          "Usage : untgz TGZfile            to extract all files\n"
+          "        untgz TGZfile fname ...  to extract selected files\n"
+          "        untgz -l TGZfile         to list archive contents\n"
+          "        untgz -h                 to display this help\n\n");
+  exit(exitval);
+}
+
+void error(const char *msg)
+{
+    fprintf(stderr, "%s: %s\n", prog, msg);
+    exit(1);
+}
+
+
+/* ====================================================================== */
+
+int _CRT_glob = 0;	/* disable globbing of the arguments */
+
+int main(int argc,char **argv)
+{
+    int 	action = TGZ_EXTRACT;
+    int 	arg = 1;
+    char	*TGZfile;
+    gzFile	*f;
+    
+
+    prog = strrchr(argv[0],'\\');
+    if (prog == NULL)
+      {
+	prog = strrchr(argv[0],'/');
+	if (prog == NULL)
+	  {
+	    prog = strrchr(argv[0],':');
+	    if (prog == NULL)
+	      prog = argv[0];
+	    else
+	      prog++;
+	  }
+	else
+	  prog++;
+      }
+    else
+      prog++;
+    
+    if (argc == 1)
+      help(0);
+
+    if (strcmp(argv[arg],"-l") == 0)
+      {
+	action = TGZ_LIST;
+	if (argc == ++arg)
+	  help(0);
+      }
+    else if (strcmp(argv[arg],"-h") == 0)
+      {
+	help(0);
+      }
+
+    if ((TGZfile = TGZfname(argv[arg])) == NULL)
+      TGZnotfound(argv[arg]);            
+
+    ++arg;
+    if ((action == TGZ_LIST) && (arg != argc))
+      help(1);
+
+/*
+ *  Process the TGZ file
+ */
+    switch(action)
+      {
+      case TGZ_LIST:
+      case TGZ_EXTRACT:
+	f = gzopen(TGZfile,"rb");
+	if (f == NULL)
+	  {
+	    fprintf(stderr,"%s: Couldn't gzopen %s\n",
+		    prog,
+		    TGZfile);
+	    return 1;
+	  }
+	exit(tar(f, action, arg, argc, argv));
+      break;
+	
+      default:
+	error("Unknown option!");
+	exit(1);
+      }
+
+    return 0;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/visual-basic.txt
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/visual-basic.txt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/contrib/visual-basic.txt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,69 @@
+See below some functions declarations for Visual Basic.
+
+Frequently Asked Question:
+
+Q: Each time I use the compress function I get the -5 error (not enough
+   room in the output buffer).
+
+A: Make sure that the length of the compressed buffer is passed by
+   reference ("as any"), not by value ("as long"). Also check that
+   before the call of compress this length is equal to the total size of
+   the compressed buffer and not zero.
+
+
+From: "Jon Caruana" <jon-net at usa.net>
+Subject: Re: How to port zlib declares to vb?
+Date: Mon, 28 Oct 1996 18:33:03 -0600
+
+Got the answer! (I haven't had time to check this but it's what I got, and
+looks correct):
+
+He has the following routines working:
+        compress
+        uncompress
+        gzopen
+        gzwrite
+        gzread
+        gzclose
+
+Declares follow: (Quoted from Carlos Rios <c_rios at sonda.cl>, in Vb4 form)
+
+#If Win16 Then   'Use Win16 calls.
+Declare Function compress Lib "ZLIB.DLL" (ByVal compr As
+        String, comprLen As Any, ByVal buf As String, ByVal buflen
+        As Long) As Integer
+Declare Function uncompress Lib "ZLIB.DLL" (ByVal uncompr
+        As String, uncomprLen As Any, ByVal compr As String, ByVal
+        lcompr As Long) As Integer
+Declare Function gzopen Lib "ZLIB.DLL" (ByVal filePath As
+        String, ByVal mode As String) As Long
+Declare Function gzread Lib "ZLIB.DLL" (ByVal file As
+        Long, ByVal uncompr As String, ByVal uncomprLen As Integer)
+        As Integer
+Declare Function gzwrite Lib "ZLIB.DLL" (ByVal file As
+        Long, ByVal uncompr As String, ByVal uncomprLen As Integer)
+        As Integer
+Declare Function gzclose Lib "ZLIB.DLL" (ByVal file As
+        Long) As Integer
+#Else
+Declare Function compress Lib "ZLIB32.DLL"
+        (ByVal compr As String, comprLen As Any, ByVal buf As
+        String, ByVal buflen As Long) As Integer
+Declare Function uncompress Lib "ZLIB32.DLL"
+        (ByVal uncompr As String, uncomprLen As Any, ByVal compr As
+        String, ByVal lcompr As Long) As Long
+Declare Function gzopen Lib "ZLIB32.DLL"
+        (ByVal file As String, ByVal mode As String) As Long
+Declare Function gzread Lib "ZLIB32.DLL"
+        (ByVal file As Long, ByVal uncompr As String, ByVal
+        uncomprLen As Long) As Long
+Declare Function gzwrite Lib "ZLIB32.DLL"
+        (ByVal file As Long, ByVal uncompr As String, ByVal
+        uncomprLen As Long) As Long
+Declare Function gzclose Lib "ZLIB32.DLL"
+        (ByVal file As Long) As Long
+#End If
+
+-Jon Caruana
+jon-net at usa.net
+Microsoft Sitebuilder Network Level 1 Member - HTML Writer's Guild Member

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/crc32.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/crc32.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/crc32.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,162 @@
+/* crc32.c -- compute the CRC-32 of a data stream
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* @(#) $Id: crc32.c,v 1.6 1998/12/18 21:38:39 koziol Exp $ */
+
+#include "zlib.h"
+
+#define local static
+
+#ifdef DYNAMIC_CRC_TABLE
+
+local int crc_table_empty = 1;
+local uLongf crc_table[256];
+local void make_crc_table OF((void));
+
+/*
+  Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
+  x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
+
+  Polynomials over GF(2) are represented in binary, one bit per coefficient,
+  with the lowest powers in the most significant bit.  Then adding polynomials
+  is just exclusive-or, and multiplying a polynomial by x is a right shift by
+  one.  If we call the above polynomial p, and represent a byte as the
+  polynomial q, also with the lowest power in the most significant bit (so the
+  byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
+  where a mod b means the remainder after dividing a by b.
+
+  This calculation is done using the shift-register method of multiplying and
+  taking the remainder.  The register is initialized to zero, and for each
+  incoming bit, x^32 is added mod p to the register if the bit is a one (where
+  x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
+  x (which is shifting right by one and adding x^32 mod p if the bit shifted
+  out is a one).  We start with the highest power (least significant bit) of
+  q and repeat for all eight bits of q.
+
+  The table is simply the CRC of all possible eight bit values.  This is all
+  the information needed to generate CRC's on data a byte at a time for all
+  combinations of CRC register values and incoming bytes.
+*/
+local void make_crc_table()
+{
+  uLong c;
+  int n, k;
+  uLong poly;            /* polynomial exclusive-or pattern */
+  /* terms of polynomial defining this crc (except x^32): */
+  static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
+
+  /* make exclusive-or pattern from polynomial (0xedb88320L) */
+  poly = 0L;
+  for (n = 0; n < sizeof(p)/sizeof(Byte); n++)
+    poly |= 1L << (31 - p[n]);
+ 
+  for (n = 0; n < 256; n++)
+  {
+    c = (uLong)n;
+    for (k = 0; k < 8; k++)
+      c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+    crc_table[n] = c;
+  }
+  crc_table_empty = 0;
+}
+#else
+/* ========================================================================
+ * Table of CRC-32's of all single-byte values (made by make_crc_table)
+ */
+local const uLongf crc_table[256] = {
+  0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
+  0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
+  0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
+  0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
+  0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
+  0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
+  0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
+  0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
+  0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
+  0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
+  0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
+  0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
+  0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
+  0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
+  0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
+  0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
+  0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
+  0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
+  0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
+  0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
+  0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
+  0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
+  0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
+  0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
+  0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
+  0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
+  0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
+  0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
+  0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
+  0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
+  0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
+  0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
+  0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
+  0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
+  0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
+  0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
+  0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
+  0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
+  0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
+  0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
+  0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
+  0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
+  0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
+  0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
+  0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
+  0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
+  0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
+  0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
+  0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
+  0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
+  0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
+  0x2d02ef8dL
+};
+#endif
+
+/* =========================================================================
+ * This function can be used by asm versions of crc32()
+ */
+const uLongf * ZEXPORT get_crc_table()
+{
+#ifdef DYNAMIC_CRC_TABLE
+  if (crc_table_empty) make_crc_table();
+#endif
+  return (const uLongf *)crc_table;
+}
+
+/* ========================================================================= */
+#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
+#define DO2(buf)  DO1(buf); DO1(buf);
+#define DO4(buf)  DO2(buf); DO2(buf);
+#define DO8(buf)  DO4(buf); DO4(buf);
+
+/* ========================================================================= */
+uLong ZEXPORT crc32(crc, buf, len)
+    uLong crc;
+    const Bytef *buf;
+    uInt len;
+{
+    if (buf == Z_NULL) return 0L;
+#ifdef DYNAMIC_CRC_TABLE
+    if (crc_table_empty)
+      make_crc_table();
+#endif
+    crc = crc ^ 0xffffffffL;
+    while (len >= 8)
+    {
+      DO8(buf);
+      len -= 8;
+    }
+    if (len) do {
+      DO1(buf);
+    } while (--len);
+    return crc ^ 0xffffffffL;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/deflate.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/deflate.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/deflate.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1350 @@
+/* deflate.c -- compress data using the deflation algorithm
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/*
+ *  ALGORITHM
+ *
+ *      The "deflation" process depends on being able to identify portions
+ *      of the input text which are identical to earlier input (within a
+ *      sliding window trailing behind the input currently being processed).
+ *
+ *      The most straightforward technique turns out to be the fastest for
+ *      most input files: try all possible matches and select the longest.
+ *      The key feature of this algorithm is that insertions into the string
+ *      dictionary are very simple and thus fast, and deletions are avoided
+ *      completely. Insertions are performed at each input character, whereas
+ *      string matches are performed only when the previous match ends. So it
+ *      is preferable to spend more time in matches to allow very fast string
+ *      insertions and avoid deletions. The matching algorithm for small
+ *      strings is inspired from that of Rabin & Karp. A brute force approach
+ *      is used to find longer strings when a small match has been found.
+ *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
+ *      (by Leonid Broukhis).
+ *         A previous version of this file used a more sophisticated algorithm
+ *      (by Fiala and Greene) which is guaranteed to run in linear amortized
+ *      time, but has a larger average cost, uses more memory and is patented.
+ *      However the F&G algorithm may be faster for some highly redundant
+ *      files if the parameter max_chain_length (described below) is too large.
+ *
+ *  ACKNOWLEDGEMENTS
+ *
+ *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
+ *      I found it in 'freeze' written by Leonid Broukhis.
+ *      Thanks to many people for bug reports and testing.
+ *
+ *  REFERENCES
+ *
+ *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
+ *      Available in ftp://ds.internic.net/rfc/rfc1951.txt
+ *
+ *      A description of the Rabin and Karp algorithm is given in the book
+ *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
+ *
+ *      Fiala,E.R., and Greene,D.H.
+ *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
+ *
+ */
+
+/* @(#) $Id: deflate.c,v 1.6 1998/12/18 21:38:39 koziol Exp $ */
+
+#include "deflate.h"
+
+const char deflate_copyright[] =
+   " deflate 1.1.3 Copyright 1995-1998 Jean-loup Gailly ";
+/*
+  If you use the zlib library in a product, an acknowledgment is welcome
+  in the documentation of your product. If for some reason you cannot
+  include such an acknowledgment, I would appreciate that you keep this
+  copyright string in the executable of your product.
+ */
+
+/* ===========================================================================
+ *  Function prototypes.
+ */
+typedef enum {
+    need_more,      /* block not completed, need more input or more output */
+    block_done,     /* block flush performed */
+    finish_started, /* finish started, need only more output at next deflate */
+    finish_done     /* finish done, accept no more input or output */
+} block_state;
+
+typedef block_state (*compress_func) OF((deflate_state *s, int flush));
+/* Compression function. Returns the block state after the call. */
+
+local void fill_window    OF((deflate_state *s));
+local block_state deflate_stored OF((deflate_state *s, int flush));
+local block_state deflate_fast   OF((deflate_state *s, int flush));
+local block_state deflate_slow   OF((deflate_state *s, int flush));
+local void lm_init        OF((deflate_state *s));
+local void putShortMSB    OF((deflate_state *s, uInt b));
+local void flush_pending  OF((z_streamp strm));
+local int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size));
+#ifdef ASMV
+      void match_init OF((void)); /* asm code initialization */
+      uInt longest_match  OF((deflate_state *s, IPos cur_match));
+#else
+local uInt longest_match  OF((deflate_state *s, IPos cur_match));
+#endif
+
+#ifdef DEBUG
+local  void check_match OF((deflate_state *s, IPos start, IPos match,
+                            int length));
+#endif
+
+/* ===========================================================================
+ * Local data
+ */
+
+#define NIL 0
+/* Tail of hash chains */
+
+#ifndef TOO_FAR
+#  define TOO_FAR 4096
+#endif
+/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+/* Values for max_lazy_match, good_match and max_chain_length, depending on
+ * the desired pack level (0..9). The values given below have been tuned to
+ * exclude worst case performance for pathological files. Better values may be
+ * found for specific files.
+ */
+typedef struct config_s {
+   ush good_length; /* reduce lazy search above this match length */
+   ush max_lazy;    /* do not perform lazy search above this match length */
+   ush nice_length; /* quit search above this match length */
+   ush max_chain;
+   compress_func func;
+} config;
+
+local const config configuration_table[10] = {
+/*      good lazy nice chain */
+/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
+/* 1 */ {4,    4,  8,    4, deflate_fast}, /* maximum speed, no lazy matches */
+/* 2 */ {4,    5, 16,    8, deflate_fast},
+/* 3 */ {4,    6, 32,   32, deflate_fast},
+
+/* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */
+/* 5 */ {8,   16, 32,   32, deflate_slow},
+/* 6 */ {8,   16, 128, 128, deflate_slow},
+/* 7 */ {8,   32, 128, 256, deflate_slow},
+/* 8 */ {32, 128, 258, 1024, deflate_slow},
+/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */
+
+/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
+ * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
+ * meaning.
+ */
+
+#define EQUAL 0
+/* result of memcmp for equal strings */
+
+struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
+
+/* ===========================================================================
+ * Update a hash value with the given input byte
+ * IN  assertion: all calls to to UPDATE_HASH are made with consecutive
+ *    input characters, so that a running hash key can be computed from the
+ *    previous key instead of complete recalculation each time.
+ */
+#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
+
+
+/* ===========================================================================
+ * Insert string str in the dictionary and set match_head to the previous head
+ * of the hash chain (the most recent string with same hash key). Return
+ * the previous length of the hash chain.
+ * If this file is compiled with -DFASTEST, the compression level is forced
+ * to 1, and no hash chains are maintained.
+ * IN  assertion: all calls to to INSERT_STRING are made with consecutive
+ *    input characters and the first MIN_MATCH bytes of str are valid
+ *    (except for the last MIN_MATCH-1 bytes of the input file).
+ */
+#ifdef FASTEST
+#define INSERT_STRING(s, str, match_head) \
+   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+    match_head = s->head[s->ins_h], \
+    s->head[s->ins_h] = (Pos)(str))
+#else
+#define INSERT_STRING(s, str, match_head) \
+   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+    s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \
+    s->head[s->ins_h] = (Pos)(str))
+#endif
+
+/* ===========================================================================
+ * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
+ * prev[] will be initialized on the fly.
+ */
+#define CLEAR_HASH(s) \
+    s->head[s->hash_size-1] = NIL; \
+    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+
+/* ========================================================================= */
+int ZEXPORT deflateInit_(strm, level, version, stream_size)
+    z_streamp strm;
+    int level;
+    const char *version;
+    int stream_size;
+{
+    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
+			 Z_DEFAULT_STRATEGY, version, stream_size);
+    /* To do: ignore strm->next_in if we use it as window */
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
+		  version, stream_size)
+    z_streamp strm;
+    int  level;
+    int  method;
+    int  windowBits;
+    int  memLevel;
+    int  strategy;
+    const char *version;
+    int stream_size;
+{
+    deflate_state *s;
+    int noheader = 0;
+    static const char* my_version = ZLIB_VERSION;
+
+    ushf *overlay;
+    /* We overlay pending_buf and d_buf+l_buf. This works since the average
+     * output size for (length,distance) codes is <= 24 bits.
+     */
+
+    if (version == Z_NULL || version[0] != my_version[0] ||
+        stream_size != sizeof(z_stream)) {
+	return Z_VERSION_ERROR;
+    }
+    if (strm == Z_NULL) return Z_STREAM_ERROR;
+
+    strm->msg = Z_NULL;
+    if (strm->zalloc == Z_NULL) {
+	strm->zalloc = zcalloc;
+	strm->opaque = (voidpf)0;
+    }
+    if (strm->zfree == Z_NULL) strm->zfree = zcfree;
+
+    if (level == Z_DEFAULT_COMPRESSION) level = 6;
+#ifdef FASTEST
+    level = 1;
+#endif
+
+    if (windowBits < 0) { /* undocumented feature: suppress zlib header */
+        noheader = 1;
+        windowBits = -windowBits;
+    }
+    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
+        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
+	strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
+        return Z_STREAM_ERROR;
+    }
+    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
+    if (s == Z_NULL) return Z_MEM_ERROR;
+    strm->state = (struct internal_state FAR *)s;
+    s->strm = strm;
+
+    s->noheader = noheader;
+    s->w_bits = windowBits;
+    s->w_size = 1 << s->w_bits;
+    s->w_mask = s->w_size - 1;
+
+    s->hash_bits = memLevel + 7;
+    s->hash_size = 1 << s->hash_bits;
+    s->hash_mask = s->hash_size - 1;
+    s->hash_shift =  ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
+
+    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
+    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
+    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));
+
+    s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
+
+    overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
+    s->pending_buf = (uchf *) overlay;
+    s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
+
+    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
+        s->pending_buf == Z_NULL) {
+        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
+        deflateEnd (strm);
+        return Z_MEM_ERROR;
+    }
+    s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
+    s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
+
+    s->level = level;
+    s->strategy = strategy;
+    s->method = (Byte)method;
+
+    return deflateReset(strm);
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
+    z_streamp strm;
+    const Bytef *dictionary;
+    uInt  dictLength;
+{
+    deflate_state *s;
+    uInt length = dictLength;
+    uInt n;
+    IPos hash_head = 0;
+
+    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
+        strm->state->status != INIT_STATE) return Z_STREAM_ERROR;
+
+    s = strm->state;
+    strm->adler = adler32(strm->adler, dictionary, dictLength);
+
+    if (length < MIN_MATCH) return Z_OK;
+    if (length > MAX_DIST(s)) {
+	length = MAX_DIST(s);
+#ifndef USE_DICT_HEAD
+	dictionary += dictLength - length; /* use the tail of the dictionary */
+#endif
+    }
+    zmemcpy(s->window, dictionary, length);
+    s->strstart = length;
+    s->block_start = (long)length;
+
+    /* Insert all strings in the hash table (except for the last two bytes).
+     * s->lookahead stays null, so s->ins_h will be recomputed at the next
+     * call of fill_window.
+     */
+    s->ins_h = s->window[0];
+    UPDATE_HASH(s, s->ins_h, s->window[1]);
+    for (n = 0; n <= length - MIN_MATCH; n++) {
+	INSERT_STRING(s, n, hash_head);
+    }
+    if (hash_head) hash_head = 0;  /* to make compiler happy */
+    return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateReset (strm)
+    z_streamp strm;
+{
+    deflate_state *s;
+    
+    if (strm == Z_NULL || strm->state == Z_NULL ||
+        strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR;
+
+    strm->total_in = strm->total_out = 0;
+    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
+    strm->data_type = Z_UNKNOWN;
+
+    s = (deflate_state *)strm->state;
+    s->pending = 0;
+    s->pending_out = s->pending_buf;
+
+    if (s->noheader < 0) {
+        s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */
+    }
+    s->status = s->noheader ? BUSY_STATE : INIT_STATE;
+    strm->adler = 1;
+    s->last_flush = Z_NO_FLUSH;
+
+    _tr_init(s);
+    lm_init(s);
+
+    return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateParams(strm, level, strategy)
+    z_streamp strm;
+    int level;
+    int strategy;
+{
+    deflate_state *s;
+    compress_func func;
+    int err = Z_OK;
+
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    s = strm->state;
+
+    if (level == Z_DEFAULT_COMPRESSION) {
+	level = 6;
+    }
+    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
+	return Z_STREAM_ERROR;
+    }
+    func = configuration_table[s->level].func;
+
+    if (func != configuration_table[level].func && strm->total_in != 0) {
+	/* Flush the last buffer: */
+	err = deflate(strm, Z_PARTIAL_FLUSH);
+    }
+    if (s->level != level) {
+	s->level = level;
+	s->max_lazy_match   = configuration_table[level].max_lazy;
+	s->good_match       = configuration_table[level].good_length;
+	s->nice_match       = configuration_table[level].nice_length;
+	s->max_chain_length = configuration_table[level].max_chain;
+    }
+    s->strategy = strategy;
+    return err;
+}
+
+/* =========================================================================
+ * Put a short in the pending buffer. The 16-bit value is put in MSB order.
+ * IN assertion: the stream state is correct and there is enough room in
+ * pending_buf.
+ */
+local void putShortMSB (s, b)
+    deflate_state *s;
+    uInt b;
+{
+    put_byte(s, (Byte)(b >> 8));
+    put_byte(s, (Byte)(b & 0xff));
+}   
+
+/* =========================================================================
+ * Flush as much pending output as possible. All deflate() output goes
+ * through this function so some applications may wish to modify it
+ * to avoid allocating a large strm->next_out buffer and copying into it.
+ * (See also read_buf()).
+ */
+local void flush_pending(strm)
+    z_streamp strm;
+{
+    unsigned len = strm->state->pending;
+
+    if (len > strm->avail_out) len = strm->avail_out;
+    if (len == 0) return;
+
+    zmemcpy(strm->next_out, strm->state->pending_out, len);
+    strm->next_out  += len;
+    strm->state->pending_out  += len;
+    strm->total_out += len;
+    strm->avail_out  -= len;
+    strm->state->pending -= len;
+    if (strm->state->pending == 0) {
+        strm->state->pending_out = strm->state->pending_buf;
+    }
+}
+
+/* ========================================================================= */
+int ZEXPORT deflate (strm, flush)
+    z_streamp strm;
+    int flush;
+{
+    int old_flush; /* value of flush param for previous deflate call */
+    deflate_state *s;
+
+    if (strm == Z_NULL || strm->state == Z_NULL ||
+	flush > Z_FINISH || flush < 0) {
+        return Z_STREAM_ERROR;
+    }
+    s = strm->state;
+
+    if (strm->next_out == Z_NULL ||
+        (strm->next_in == Z_NULL && strm->avail_in != 0) ||
+	(s->status == FINISH_STATE && flush != Z_FINISH)) {
+        ERR_RETURN(strm, Z_STREAM_ERROR);
+    }
+    if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
+
+    s->strm = strm; /* just in case */
+    old_flush = s->last_flush;
+    s->last_flush = flush;
+
+    /* Write the zlib header */
+    if (s->status == INIT_STATE) {
+
+        uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
+        uInt level_flags = (s->level-1) >> 1;
+
+        if (level_flags > 3) level_flags = 3;
+        header |= (level_flags << 6);
+	if (s->strstart != 0) header |= PRESET_DICT;
+        header += 31 - (header % 31);
+
+        s->status = BUSY_STATE;
+        putShortMSB(s, header);
+
+	/* Save the adler32 of the preset dictionary: */
+	if (s->strstart != 0) {
+	    putShortMSB(s, (uInt)(strm->adler >> 16));
+	    putShortMSB(s, (uInt)(strm->adler & 0xffff));
+	}
+	strm->adler = 1L;
+    }
+
+    /* Flush as much pending output as possible */
+    if (s->pending != 0) {
+        flush_pending(strm);
+        if (strm->avail_out == 0) {
+	    /* Since avail_out is 0, deflate will be called again with
+	     * more output space, but possibly with both pending and
+	     * avail_in equal to zero. There won't be anything to do,
+	     * but this is not an error situation so make sure we
+	     * return OK instead of BUF_ERROR at next call of deflate:
+             */
+	    s->last_flush = -1;
+	    return Z_OK;
+	}
+
+    /* Make sure there is something to do and avoid duplicate consecutive
+     * flushes. For repeated and useless calls with Z_FINISH, we keep
+     * returning Z_STREAM_END instead of Z_BUFF_ERROR.
+     */
+    } else if (strm->avail_in == 0 && flush <= old_flush &&
+	       flush != Z_FINISH) {
+        ERR_RETURN(strm, Z_BUF_ERROR);
+    }
+
+    /* User must not provide more input after the first FINISH: */
+    if (s->status == FINISH_STATE && strm->avail_in != 0) {
+        ERR_RETURN(strm, Z_BUF_ERROR);
+    }
+
+    /* Start a new block or continue the current one.
+     */
+    if (strm->avail_in != 0 || s->lookahead != 0 ||
+        (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
+        block_state bstate;
+
+	bstate = (*(configuration_table[s->level].func))(s, flush);
+
+        if (bstate == finish_started || bstate == finish_done) {
+            s->status = FINISH_STATE;
+        }
+        if (bstate == need_more || bstate == finish_started) {
+	    if (strm->avail_out == 0) {
+	        s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
+	    }
+	    return Z_OK;
+	    /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
+	     * of deflate should use the same flush parameter to make sure
+	     * that the flush is complete. So we don't have to output an
+	     * empty block here, this will be done at next call. This also
+	     * ensures that for a very small output buffer, we emit at most
+	     * one empty block.
+	     */
+	}
+        if (bstate == block_done) {
+            if (flush == Z_PARTIAL_FLUSH) {
+                _tr_align(s);
+            } else { /* FULL_FLUSH or SYNC_FLUSH */
+                _tr_stored_block(s, (char*)0, 0L, 0);
+                /* For a full flush, this empty block will be recognized
+                 * as a special marker by inflate_sync().
+                 */
+                if (flush == Z_FULL_FLUSH) {
+                    CLEAR_HASH(s);             /* forget history */
+                }
+            }
+            flush_pending(strm);
+	    if (strm->avail_out == 0) {
+	      s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
+	      return Z_OK;
+	    }
+        }
+    }
+    Assert(strm->avail_out > 0, "bug2");
+
+    if (flush != Z_FINISH) return Z_OK;
+    if (s->noheader) return Z_STREAM_END;
+
+    /* Write the zlib trailer (adler32) */
+    putShortMSB(s, (uInt)(strm->adler >> 16));
+    putShortMSB(s, (uInt)(strm->adler & 0xffff));
+    flush_pending(strm);
+    /* If avail_out is zero, the application will call deflate again
+     * to flush the rest.
+     */
+    s->noheader = -1; /* write the trailer only once! */
+    return s->pending != 0 ? Z_OK : Z_STREAM_END;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateEnd (strm)
+    z_streamp strm;
+{
+    int status;
+
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+
+    status = strm->state->status;
+    if (status != INIT_STATE && status != BUSY_STATE &&
+	status != FINISH_STATE) {
+      return Z_STREAM_ERROR;
+    }
+
+    /* Deallocate in reverse order of allocations: */
+    TRY_FREE(strm, strm->state->pending_buf);
+    TRY_FREE(strm, strm->state->head);
+    TRY_FREE(strm, strm->state->prev);
+    TRY_FREE(strm, strm->state->window);
+
+    ZFREE(strm, strm->state);
+    strm->state = Z_NULL;
+
+    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
+}
+
+/* =========================================================================
+ * Copy the source state to the destination state.
+ * To simplify the source, this is not supported for 16-bit MSDOS (which
+ * doesn't have enough memory anyway to duplicate compression states).
+ */
+int ZEXPORT deflateCopy (dest, source)
+    z_streamp dest;
+    z_streamp source;
+{
+#ifdef MAXSEG_64K
+    return Z_STREAM_ERROR;
+#else
+    deflate_state *ds;
+    deflate_state *ss;
+    ushf *overlay;
+
+
+    if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
+        return Z_STREAM_ERROR;
+    }
+
+    ss = source->state;
+
+    *dest = *source;
+
+    ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
+    if (ds == Z_NULL) return Z_MEM_ERROR;
+    dest->state = (struct internal_state FAR *) ds;
+    *ds = *ss;
+    ds->strm = dest;
+
+    ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
+    ds->prev   = (Posf *)  ZALLOC(dest, ds->w_size, sizeof(Pos));
+    ds->head   = (Posf *)  ZALLOC(dest, ds->hash_size, sizeof(Pos));
+    overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
+    ds->pending_buf = (uchf *) overlay;
+
+    if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
+        ds->pending_buf == Z_NULL) {
+        deflateEnd (dest);
+        return Z_MEM_ERROR;
+    }
+    /* following zmemcpy do not work for 16-bit MSDOS */
+    zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
+    zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
+    zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
+    zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+
+    ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
+    ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
+    ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
+
+    ds->l_desc.dyn_tree = ds->dyn_ltree;
+    ds->d_desc.dyn_tree = ds->dyn_dtree;
+    ds->bl_desc.dyn_tree = ds->bl_tree;
+
+    return Z_OK;
+#endif
+}
+
+/* ===========================================================================
+ * Read a new buffer from the current input stream, update the adler32
+ * and total number of bytes read.  All deflate() input goes through
+ * this function so some applications may wish to modify it to avoid
+ * allocating a large strm->next_in buffer and copying from it.
+ * (See also flush_pending()).
+ */
+local int read_buf(strm, buf, size)
+    z_streamp strm;
+    Bytef *buf;
+    unsigned size;
+{
+    unsigned len = strm->avail_in;
+
+    if (len > size) len = size;
+    if (len == 0) return 0;
+
+    strm->avail_in  -= len;
+
+    if (!strm->state->noheader) {
+        strm->adler = adler32(strm->adler, strm->next_in, len);
+    }
+    zmemcpy(buf, strm->next_in, len);
+    strm->next_in  += len;
+    strm->total_in += len;
+
+    return (int)len;
+}
+
+/* ===========================================================================
+ * Initialize the "longest match" routines for a new zlib stream
+ */
+local void lm_init (s)
+    deflate_state *s;
+{
+    s->window_size = (ulg)2L*s->w_size;
+
+    CLEAR_HASH(s);
+
+    /* Set the default configuration parameters:
+     */
+    s->max_lazy_match   = configuration_table[s->level].max_lazy;
+    s->good_match       = configuration_table[s->level].good_length;
+    s->nice_match       = configuration_table[s->level].nice_length;
+    s->max_chain_length = configuration_table[s->level].max_chain;
+
+    s->strstart = 0;
+    s->block_start = 0L;
+    s->lookahead = 0;
+    s->match_length = s->prev_length = MIN_MATCH-1;
+    s->match_available = 0;
+    s->ins_h = 0;
+#ifdef ASMV
+    match_init(); /* initialize the asm code */
+#endif
+}
+
+/* ===========================================================================
+ * Set match_start to the longest match starting at the given string and
+ * return its length. Matches shorter or equal to prev_length are discarded,
+ * in which case the result is equal to prev_length and match_start is
+ * garbage.
+ * IN assertions: cur_match is the head of the hash chain for the current
+ *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
+ * OUT assertion: the match length is not greater than s->lookahead.
+ */
+#ifndef ASMV
+/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
+ * match.S. The code will be functionally equivalent.
+ */
+#ifndef FASTEST
+local uInt longest_match(s, cur_match)
+    deflate_state *s;
+    IPos cur_match;                             /* current match */
+{
+    unsigned chain_length = s->max_chain_length;/* max hash chain length */
+    register Bytef *scan = s->window + s->strstart; /* current string */
+    register Bytef *match;                       /* matched string */
+    register int len;                           /* length of current match */
+    int best_len = s->prev_length;              /* best match length so far */
+    int nice_match = s->nice_match;             /* stop if match long enough */
+    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+        s->strstart - (IPos)MAX_DIST(s) : NIL;
+    /* Stop when cur_match becomes <= limit. To simplify the code,
+     * we prevent matches with the string of window index 0.
+     */
+    Posf *prev = s->prev;
+    uInt wmask = s->w_mask;
+
+#ifdef UNALIGNED_OK
+    /* Compare two bytes at a time. Note: this is not always beneficial.
+     * Try with and without -DUNALIGNED_OK to check.
+     */
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
+    register ush scan_start = *(ushf*)scan;
+    register ush scan_end   = *(ushf*)(scan+best_len-1);
+#else
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+    register Byte scan_end1  = scan[best_len-1];
+    register Byte scan_end   = scan[best_len];
+#endif
+
+    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+     * It is easy to get rid of this optimization if necessary.
+     */
+    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+
+    /* Do not waste too much time if we already have a good match: */
+    if (s->prev_length >= s->good_match) {
+        chain_length >>= 2;
+    }
+    /* Do not look for matches beyond the end of the input. This is necessary
+     * to make deflate deterministic.
+     */
+    if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+
+    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+
+    do {
+        Assert(cur_match < s->strstart, "no future");
+        match = s->window + cur_match;
+
+        /* Skip to next match if the match length cannot increase
+         * or if the match length is less than 2:
+         */
+#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
+        /* This code assumes sizeof(unsigned short) == 2. Do not use
+         * UNALIGNED_OK if your compiler uses a different size.
+         */
+        if (*(ushf*)(match+best_len-1) != scan_end ||
+            *(ushf*)match != scan_start) continue;
+
+        /* It is not necessary to compare scan[2] and match[2] since they are
+         * always equal when the other bytes match, given that the hash keys
+         * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
+         * strstart+3, +5, ... up to strstart+257. We check for insufficient
+         * lookahead only every 4th comparison; the 128th check will be made
+         * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+         * necessary to put more guard bytes at the end of the window, or
+         * to check more often for insufficient lookahead.
+         */
+        Assert(scan[2] == match[2], "scan[2]?");
+        scan++, match++;
+        do {
+        } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 scan < strend);
+        /* The funny "do {}" generates better code on most compilers */
+
+        /* Here, scan <= window+strstart+257 */
+        Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+        if (*scan == *match) scan++;
+
+        len = (MAX_MATCH - 1) - (int)(strend-scan);
+        scan = strend - (MAX_MATCH-1);
+
+#else /* UNALIGNED_OK */
+
+        if (match[best_len]   != scan_end  ||
+            match[best_len-1] != scan_end1 ||
+            *match            != *scan     ||
+            *++match          != scan[1])      continue;
+
+        /* The check at best_len-1 can be removed because it will be made
+         * again later. (This heuristic is not always a win.)
+         * It is not necessary to compare scan[2] and match[2] since they
+         * are always equal when the other bytes match, given that
+         * the hash keys are equal and that HASH_BITS >= 8.
+         */
+        scan += 2, match++;
+        Assert(*scan == *match, "match[2]?");
+
+        /* We check for insufficient lookahead only every 8th comparison;
+         * the 256th check will be made at strstart+258.
+         */
+        do {
+        } while (*++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 scan < strend);
+
+        Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+
+        len = MAX_MATCH - (int)(strend - scan);
+        scan = strend - MAX_MATCH;
+
+#endif /* UNALIGNED_OK */
+
+        if (len > best_len) {
+            s->match_start = cur_match;
+            best_len = len;
+            if (len >= nice_match) break;
+#ifdef UNALIGNED_OK
+            scan_end = *(ushf*)(scan+best_len-1);
+#else
+            scan_end1  = scan[best_len-1];
+            scan_end   = scan[best_len];
+#endif
+        }
+    } while ((cur_match = prev[cur_match & wmask]) > limit
+             && --chain_length != 0);
+
+    if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
+    return s->lookahead;
+}
+
+#else /* FASTEST */
+/* ---------------------------------------------------------------------------
+ * Optimized version for level == 1 only
+ */
+local uInt longest_match(s, cur_match)
+    deflate_state *s;
+    IPos cur_match;                             /* current match */
+{
+    register Bytef *scan = s->window + s->strstart; /* current string */
+    register Bytef *match;                       /* matched string */
+    register int len;                           /* length of current match */
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+
+    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+     * It is easy to get rid of this optimization if necessary.
+     */
+    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+
+    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+
+    Assert(cur_match < s->strstart, "no future");
+
+    match = s->window + cur_match;
+
+    /* Return failure if the match length is less than 2:
+     */
+    if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
+
+    /* The check at best_len-1 can be removed because it will be made
+     * again later. (This heuristic is not always a win.)
+     * It is not necessary to compare scan[2] and match[2] since they
+     * are always equal when the other bytes match, given that
+     * the hash keys are equal and that HASH_BITS >= 8.
+     */
+    scan += 2, match += 2;
+    Assert(*scan == *match, "match[2]?");
+
+    /* We check for insufficient lookahead only every 8th comparison;
+     * the 256th check will be made at strstart+258.
+     */
+    do {
+    } while (*++scan == *++match && *++scan == *++match &&
+	     *++scan == *++match && *++scan == *++match &&
+	     *++scan == *++match && *++scan == *++match &&
+	     *++scan == *++match && *++scan == *++match &&
+	     scan < strend);
+
+    Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+
+    len = MAX_MATCH - (int)(strend - scan);
+
+    if (len < MIN_MATCH) return MIN_MATCH - 1;
+
+    s->match_start = cur_match;
+    return len <= s->lookahead ? len : s->lookahead;
+}
+#endif /* FASTEST */
+#endif /* ASMV */
+
+#ifdef DEBUG
+/* ===========================================================================
+ * Check that the match at match_start is indeed a match.
+ */
+local void check_match(s, start, match, length)
+    deflate_state *s;
+    IPos start, match;
+    int length;
+{
+    /* check that the match is indeed a match */
+    if (zmemcmp(s->window + match,
+                s->window + start, length) != EQUAL) {
+        fprintf(stderr, " start %u, match %u, length %d\n",
+		start, match, length);
+        do {
+	    fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
+	} while (--length != 0);
+        z_error("invalid match");
+    }
+    if (z_verbose > 1) {
+        fprintf(stderr,"\\[%d,%d]", start-match, length);
+        do { putc(s->window[start++], stderr); } while (--length != 0);
+    }
+}
+#else
+#  define check_match(s, start, match, length)
+#endif
+
+/* ===========================================================================
+ * Fill the window when the lookahead becomes insufficient.
+ * Updates strstart and lookahead.
+ *
+ * IN assertion: lookahead < MIN_LOOKAHEAD
+ * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
+ *    At least one byte has been read, or avail_in == 0; reads are
+ *    performed for at least two bytes (required for the zip translate_eol
+ *    option -- not supported here).
+ */
+local void fill_window(s)
+    deflate_state *s;
+{
+    register unsigned n, m;
+    register Posf *p;
+    unsigned more;    /* Amount of free space at the end of the window. */
+    uInt wsize = s->w_size;
+
+    do {
+        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+
+        /* Deal with !@#$% 64K limit: */
+        if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
+            more = wsize;
+
+        } else if (more == (unsigned)(-1)) {
+            /* Very unlikely, but possible on 16 bit machine if strstart == 0
+             * and lookahead == 1 (input done one byte at time)
+             */
+            more--;
+
+        /* If the window is almost full and there is insufficient lookahead,
+         * move the upper half to the lower one to make room in the upper half.
+         */
+        } else if (s->strstart >= wsize+MAX_DIST(s)) {
+
+            zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
+            s->match_start -= wsize;
+            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
+            s->block_start -= (long) wsize;
+
+            /* Slide the hash table (could be avoided with 32 bit values
+               at the expense of memory usage). We slide even when level == 0
+               to keep the hash table consistent if we switch back to level > 0
+               later. (Using level 0 permanently is not an optimal usage of
+               zlib, so we don't care about this pathological case.)
+             */
+	    n = s->hash_size;
+	    p = &s->head[n];
+	    do {
+		m = *--p;
+		*p = (Pos)(m >= wsize ? m-wsize : NIL);
+	    } while (--n);
+
+	    n = wsize;
+#ifndef FASTEST
+	    p = &s->prev[n];
+	    do {
+		m = *--p;
+		*p = (Pos)(m >= wsize ? m-wsize : NIL);
+		/* If n is not on any hash chain, prev[n] is garbage but
+		 * its value will never be used.
+		 */
+	    } while (--n);
+#endif
+            more += wsize;
+        }
+        if (s->strm->avail_in == 0) return;
+
+        /* If there was no sliding:
+         *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+         *    more == window_size - lookahead - strstart
+         * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+         * => more >= window_size - 2*WSIZE + 2
+         * In the BIG_MEM or MMAP case (not yet supported),
+         *   window_size == input_size + MIN_LOOKAHEAD  &&
+         *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+         * Otherwise, window_size == 2*WSIZE so more >= 2.
+         * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+         */
+        Assert(more >= 2, "more < 2");
+
+        n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+        s->lookahead += n;
+
+        /* Initialize the hash value now that we have some input: */
+        if (s->lookahead >= MIN_MATCH) {
+            s->ins_h = s->window[s->strstart];
+            UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+            Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+        }
+        /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+         * but this is not important since only literal bytes will be emitted.
+         */
+
+    } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
+}
+
+/* ===========================================================================
+ * Flush the current block, with given end-of-file flag.
+ * IN assertion: strstart is set to the end of the current match.
+ */
+#define FLUSH_BLOCK_ONLY(s, eof) { \
+   _tr_flush_block(s, (s->block_start >= 0L ? \
+                   (charf *)&s->window[(unsigned)s->block_start] : \
+                   (charf *)Z_NULL), \
+		(ulg)((long)s->strstart - s->block_start), \
+		(eof)); \
+   s->block_start = s->strstart; \
+   flush_pending(s->strm); \
+   Tracev((stderr,"[FLUSH]")); \
+}
+
+/* Same but force premature exit if necessary. */
+#define FLUSH_BLOCK(s, eof) { \
+   FLUSH_BLOCK_ONLY(s, eof); \
+   if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
+}
+
+/* ===========================================================================
+ * Copy without compression as much as possible from the input stream, return
+ * the current block state.
+ * This function does not insert new strings in the dictionary since
+ * uncompressible data is probably not useful. This function is used
+ * only for the level=0 compression option.
+ * NOTE: this function should be optimized to avoid extra copying from
+ * window to pending_buf.
+ */
+local block_state deflate_stored(s, flush)
+    deflate_state *s;
+    int flush;
+{
+    /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
+     * to pending_buf_size, and each stored block has a 5 byte header:
+     */
+    ulg max_block_size = 0xffff;
+    ulg max_start;
+
+    if (max_block_size > s->pending_buf_size - 5) {
+        max_block_size = s->pending_buf_size - 5;
+    }
+
+    /* Copy as much as possible from input to output: */
+    for (;;) {
+        /* Fill the window as much as possible: */
+        if (s->lookahead <= 1) {
+
+            Assert(s->strstart < s->w_size+MAX_DIST(s) ||
+		   s->block_start >= (long)s->w_size, "slide too late");
+
+            fill_window(s);
+            if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
+
+            if (s->lookahead == 0) break; /* flush the current block */
+        }
+	Assert(s->block_start >= 0L, "block gone");
+
+	s->strstart += s->lookahead;
+	s->lookahead = 0;
+
+	/* Emit a stored block if pending_buf will be full: */
+ 	max_start = s->block_start + max_block_size;
+        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
+	    /* strstart == 0 is possible when wraparound on 16-bit machine */
+	    s->lookahead = (uInt)(s->strstart - max_start);
+	    s->strstart = (uInt)max_start;
+            FLUSH_BLOCK(s, 0);
+	}
+	/* Flush if we may have to slide, otherwise block_start may become
+         * negative and the data will be gone:
+         */
+        if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
+            FLUSH_BLOCK(s, 0);
+	}
+    }
+    FLUSH_BLOCK(s, flush == Z_FINISH);
+    return flush == Z_FINISH ? finish_done : block_done;
+}
+
+/* ===========================================================================
+ * Compress as much as possible from the input stream, return the current
+ * block state.
+ * This function does not perform lazy evaluation of matches and inserts
+ * new strings in the dictionary only for unmatched strings or for short
+ * matches. It is used only for the fast compression options.
+ */
+local block_state deflate_fast(s, flush)
+    deflate_state *s;
+    int flush;
+{
+    IPos hash_head = NIL; /* head of the hash chain */
+    int bflush;           /* set if current block must be flushed */
+
+    for (;;) {
+        /* Make sure that we always have enough lookahead, except
+         * at the end of the input file. We need MAX_MATCH bytes
+         * for the next match, plus MIN_MATCH bytes to insert the
+         * string following the next match.
+         */
+        if (s->lookahead < MIN_LOOKAHEAD) {
+            fill_window(s);
+            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+	        return need_more;
+	    }
+            if (s->lookahead == 0) break; /* flush the current block */
+        }
+
+        /* Insert the string window[strstart .. strstart+2] in the
+         * dictionary, and set hash_head to the head of the hash chain:
+         */
+        if (s->lookahead >= MIN_MATCH) {
+            INSERT_STRING(s, s->strstart, hash_head);
+        }
+
+        /* Find the longest match, discarding those <= prev_length.
+         * At this point we have always match_length < MIN_MATCH
+         */
+        if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
+            /* To simplify the code, we prevent matches with the string
+             * of window index 0 (in particular we have to avoid a match
+             * of the string with itself at the start of the input file).
+             */
+            if (s->strategy != Z_HUFFMAN_ONLY) {
+                s->match_length = longest_match (s, hash_head);
+            }
+            /* longest_match() sets match_start */
+        }
+        if (s->match_length >= MIN_MATCH) {
+            check_match(s, s->strstart, s->match_start, s->match_length);
+
+            _tr_tally_dist(s, s->strstart - s->match_start,
+                           s->match_length - MIN_MATCH, bflush);
+
+            s->lookahead -= s->match_length;
+
+            /* Insert new strings in the hash table only if the match length
+             * is not too large. This saves time but degrades compression.
+             */
+#ifndef FASTEST
+            if (s->match_length <= s->max_insert_length &&
+                s->lookahead >= MIN_MATCH) {
+                s->match_length--; /* string at strstart already in hash table */
+                do {
+                    s->strstart++;
+                    INSERT_STRING(s, s->strstart, hash_head);
+                    /* strstart never exceeds WSIZE-MAX_MATCH, so there are
+                     * always MIN_MATCH bytes ahead.
+                     */
+                } while (--s->match_length != 0);
+                s->strstart++; 
+            } else
+#endif
+	    {
+                s->strstart += s->match_length;
+                s->match_length = 0;
+                s->ins_h = s->window[s->strstart];
+                UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+                Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+                /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
+                 * matter since it will be recomputed at next deflate call.
+                 */
+            }
+        } else {
+            /* No match, output a literal byte */
+            Tracevv((stderr,"%c", s->window[s->strstart]));
+            _tr_tally_lit (s, s->window[s->strstart], bflush);
+            s->lookahead--;
+            s->strstart++; 
+        }
+        if (bflush) FLUSH_BLOCK(s, 0);
+    }
+    FLUSH_BLOCK(s, flush == Z_FINISH);
+    return flush == Z_FINISH ? finish_done : block_done;
+}
+
+/* ===========================================================================
+ * Same as above, but achieves better compression. We use a lazy
+ * evaluation for matches: a match is finally adopted only if there is
+ * no better match at the next window position.
+ */
+local block_state deflate_slow(s, flush)
+    deflate_state *s;
+    int flush;
+{
+    IPos hash_head = NIL;    /* head of hash chain */
+    int bflush;              /* set if current block must be flushed */
+
+    /* Process the input block. */
+    for (;;) {
+        /* Make sure that we always have enough lookahead, except
+         * at the end of the input file. We need MAX_MATCH bytes
+         * for the next match, plus MIN_MATCH bytes to insert the
+         * string following the next match.
+         */
+        if (s->lookahead < MIN_LOOKAHEAD) {
+            fill_window(s);
+            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+	        return need_more;
+	    }
+            if (s->lookahead == 0) break; /* flush the current block */
+        }
+
+        /* Insert the string window[strstart .. strstart+2] in the
+         * dictionary, and set hash_head to the head of the hash chain:
+         */
+        if (s->lookahead >= MIN_MATCH) {
+            INSERT_STRING(s, s->strstart, hash_head);
+        }
+
+        /* Find the longest match, discarding those <= prev_length.
+         */
+        s->prev_length = s->match_length, s->prev_match = s->match_start;
+        s->match_length = MIN_MATCH-1;
+
+        if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
+            s->strstart - hash_head <= MAX_DIST(s)) {
+            /* To simplify the code, we prevent matches with the string
+             * of window index 0 (in particular we have to avoid a match
+             * of the string with itself at the start of the input file).
+             */
+            if (s->strategy != Z_HUFFMAN_ONLY) {
+                s->match_length = longest_match (s, hash_head);
+            }
+            /* longest_match() sets match_start */
+
+            if (s->match_length <= 5 && (s->strategy == Z_FILTERED ||
+                 (s->match_length == MIN_MATCH &&
+                  s->strstart - s->match_start > TOO_FAR))) {
+
+                /* If prev_match is also MIN_MATCH, match_start is garbage
+                 * but we will ignore the current match anyway.
+                 */
+                s->match_length = MIN_MATCH-1;
+            }
+        }
+        /* If there was a match at the previous step and the current
+         * match is not better, output the previous match:
+         */
+        if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
+            uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
+            /* Do not insert strings in hash table beyond this. */
+
+            check_match(s, s->strstart-1, s->prev_match, s->prev_length);
+
+            _tr_tally_dist(s, s->strstart -1 - s->prev_match,
+			   s->prev_length - MIN_MATCH, bflush);
+
+            /* Insert in hash table all strings up to the end of the match.
+             * strstart-1 and strstart are already inserted. If there is not
+             * enough lookahead, the last two strings are not inserted in
+             * the hash table.
+             */
+            s->lookahead -= s->prev_length-1;
+            s->prev_length -= 2;
+            do {
+                if (++s->strstart <= max_insert) {
+                    INSERT_STRING(s, s->strstart, hash_head);
+                }
+            } while (--s->prev_length != 0);
+            s->match_available = 0;
+            s->match_length = MIN_MATCH-1;
+            s->strstart++;
+
+            if (bflush) FLUSH_BLOCK(s, 0);
+
+        } else if (s->match_available) {
+            /* If there was no match at the previous position, output a
+             * single literal. If there was a match but the current match
+             * is longer, truncate the previous match to a single literal.
+             */
+            Tracevv((stderr,"%c", s->window[s->strstart-1]));
+	    _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+	    if (bflush) {
+                FLUSH_BLOCK_ONLY(s, 0);
+            }
+            s->strstart++;
+            s->lookahead--;
+            if (s->strm->avail_out == 0) return need_more;
+        } else {
+            /* There is no previous match to compare with, wait for
+             * the next step to decide.
+             */
+            s->match_available = 1;
+            s->strstart++;
+            s->lookahead--;
+        }
+    }
+    Assert (flush != Z_NO_FLUSH, "no flush?");
+    if (s->match_available) {
+        Tracevv((stderr,"%c", s->window[s->strstart-1]));
+        _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+        s->match_available = 0;
+    }
+    FLUSH_BLOCK(s, flush == Z_FINISH);
+    return flush == Z_FINISH ? finish_done : block_done;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/deflate.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/deflate.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/deflate.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,318 @@
+/* deflate.h -- internal compression state
+ * Copyright (C) 1995-1998 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: deflate.h,v 1.5 1998/12/18 21:38:40 koziol Exp $ */
+
+#ifndef _DEFLATE_H
+#define _DEFLATE_H
+
+#include "zutil.h"
+
+/* ===========================================================================
+ * Internal compression state.
+ */
+
+#define LENGTH_CODES 29
+/* number of length codes, not counting the special END_BLOCK code */
+
+#define LITERALS  256
+/* number of literal bytes 0..255 */
+
+#define L_CODES (LITERALS+1+LENGTH_CODES)
+/* number of Literal or Length codes, including the END_BLOCK code */
+
+#define D_CODES   30
+/* number of distance codes */
+
+#define BL_CODES  19
+/* number of codes used to transfer the bit lengths */
+
+#define HEAP_SIZE (2*L_CODES+1)
+/* maximum heap size */
+
+#define MAX_BITS 15
+/* All codes must not exceed MAX_BITS bits */
+
+#define INIT_STATE    42
+#define BUSY_STATE   113
+#define FINISH_STATE 666
+/* Stream status */
+
+
+/* Data structure describing a single value and its code string. */
+typedef struct ct_data_s {
+    union {
+        ush  freq;       /* frequency count */
+        ush  code;       /* bit string */
+    } fc;
+    union {
+        ush  dad;        /* father node in Huffman tree */
+        ush  len;        /* length of bit string */
+    } dl;
+} FAR ct_data;
+
+#define Freq fc.freq
+#define Code fc.code
+#define Dad  dl.dad
+#define Len  dl.len
+
+typedef struct static_tree_desc_s  static_tree_desc;
+
+typedef struct tree_desc_s {
+    ct_data *dyn_tree;           /* the dynamic tree */
+    int     max_code;            /* largest code with non zero frequency */
+    static_tree_desc *stat_desc; /* the corresponding static tree */
+} FAR tree_desc;
+
+typedef ush Pos;
+typedef Pos FAR Posf;
+typedef unsigned IPos;
+
+/* A Pos is an index in the character window. We use short instead of int to
+ * save space in the various tables. IPos is used only for parameter passing.
+ */
+
+typedef struct internal_state {
+    z_streamp strm;      /* pointer back to this zlib stream */
+    int   status;        /* as the name implies */
+    Bytef *pending_buf;  /* output still pending */
+    ulg   pending_buf_size; /* size of pending_buf */
+    Bytef *pending_out;  /* next pending byte to output to the stream */
+    int   pending;       /* nb of bytes in the pending buffer */
+    int   noheader;      /* suppress zlib header and adler32 */
+    Byte  data_type;     /* UNKNOWN, BINARY or ASCII */
+    Byte  method;        /* STORED (for zip only) or DEFLATED */
+    int   last_flush;    /* value of flush param for previous deflate call */
+
+                /* used by deflate.c: */
+
+    uInt  w_size;        /* LZ77 window size (32K by default) */
+    uInt  w_bits;        /* log2(w_size)  (8..16) */
+    uInt  w_mask;        /* w_size - 1 */
+
+    Bytef *window;
+    /* Sliding window. Input bytes are read into the second half of the window,
+     * and move to the first half later to keep a dictionary of at least wSize
+     * bytes. With this organization, matches are limited to a distance of
+     * wSize-MAX_MATCH bytes, but this ensures that IO is always
+     * performed with a length multiple of the block size. Also, it limits
+     * the window size to 64K, which is quite useful on MSDOS.
+     * To do: use the user input buffer as sliding window.
+     */
+
+    ulg window_size;
+    /* Actual size of window: 2*wSize, except when the user input buffer
+     * is directly used as sliding window.
+     */
+
+    Posf *prev;
+    /* Link to older string with same hash index. To limit the size of this
+     * array to 64K, this link is maintained only for the last 32K strings.
+     * An index in this array is thus a window index modulo 32K.
+     */
+
+    Posf *head; /* Heads of the hash chains or NIL. */
+
+    uInt  ins_h;          /* hash index of string to be inserted */
+    uInt  hash_size;      /* number of elements in hash table */
+    uInt  hash_bits;      /* log2(hash_size) */
+    uInt  hash_mask;      /* hash_size-1 */
+
+    uInt  hash_shift;
+    /* Number of bits by which ins_h must be shifted at each input
+     * step. It must be such that after MIN_MATCH steps, the oldest
+     * byte no longer takes part in the hash key, that is:
+     *   hash_shift * MIN_MATCH >= hash_bits
+     */
+
+    long block_start;
+    /* Window position at the beginning of the current output block. Gets
+     * negative when the window is moved backwards.
+     */
+
+    uInt match_length;           /* length of best match */
+    IPos prev_match;             /* previous match */
+    int match_available;         /* set if previous match exists */
+    uInt strstart;               /* start of string to insert */
+    uInt match_start;            /* start of matching string */
+    uInt lookahead;              /* number of valid bytes ahead in window */
+
+    uInt prev_length;
+    /* Length of the best match at previous step. Matches not greater than this
+     * are discarded. This is used in the lazy match evaluation.
+     */
+
+    uInt max_chain_length;
+    /* To speed up deflation, hash chains are never searched beyond this
+     * length.  A higher limit improves compression ratio but degrades the
+     * speed.
+     */
+
+    uInt max_lazy_match;
+    /* Attempt to find a better match only when the current match is strictly
+     * smaller than this value. This mechanism is used only for compression
+     * levels >= 4.
+     */
+#   define max_insert_length  max_lazy_match
+    /* Insert new strings in the hash table only if the match length is not
+     * greater than this length. This saves time but degrades compression.
+     * max_insert_length is used only for compression levels <= 3.
+     */
+
+    int level;    /* compression level (1..9) */
+    int strategy; /* favor or force Huffman coding*/
+
+    uInt good_match;
+    /* Use a faster search when the previous match is longer than this */
+
+    int nice_match; /* Stop searching when current match exceeds this */
+
+                /* used by trees.c: */
+    /* Didn't use ct_data typedef below to supress compiler warning */
+    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
+    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
+    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
+
+    struct tree_desc_s l_desc;               /* desc. for literal tree */
+    struct tree_desc_s d_desc;               /* desc. for distance tree */
+    struct tree_desc_s bl_desc;              /* desc. for bit length tree */
+
+    ush bl_count[MAX_BITS+1];
+    /* number of codes at each bit length for an optimal tree */
+
+    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
+    int heap_len;               /* number of elements in the heap */
+    int heap_max;               /* element of largest frequency */
+    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+     * The same heap array is used to build all trees.
+     */
+
+    uch depth[2*L_CODES+1];
+    /* Depth of each subtree used as tie breaker for trees of equal frequency
+     */
+
+    uchf *l_buf;          /* buffer for literals or lengths */
+
+    uInt  lit_bufsize;
+    /* Size of match buffer for literals/lengths.  There are 4 reasons for
+     * limiting lit_bufsize to 64K:
+     *   - frequencies can be kept in 16 bit counters
+     *   - if compression is not successful for the first block, all input
+     *     data is still in the window so we can still emit a stored block even
+     *     when input comes from standard input.  (This can also be done for
+     *     all blocks if lit_bufsize is not greater than 32K.)
+     *   - if compression is not successful for a file smaller than 64K, we can
+     *     even emit a stored file instead of a stored block (saving 5 bytes).
+     *     This is applicable only for zip (not gzip or zlib).
+     *   - creating new Huffman trees less frequently may not provide fast
+     *     adaptation to changes in the input data statistics. (Take for
+     *     example a binary file with poorly compressible code followed by
+     *     a highly compressible string table.) Smaller buffer sizes give
+     *     fast adaptation but have of course the overhead of transmitting
+     *     trees more frequently.
+     *   - I can't count above 4
+     */
+
+    uInt last_lit;      /* running index in l_buf */
+
+    ushf *d_buf;
+    /* Buffer for distances. To simplify the code, d_buf and l_buf have
+     * the same number of elements. To use different lengths, an extra flag
+     * array would be necessary.
+     */
+
+    ulg opt_len;        /* bit length of current block with optimal trees */
+    ulg static_len;     /* bit length of current block with static trees */
+    uInt matches;       /* number of string matches in current block */
+    int last_eob_len;   /* bit length of EOB code for last block */
+
+#ifdef DEBUG
+    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
+#endif
+
+    ush bi_buf;
+    /* Output buffer. bits are inserted starting at the bottom (least
+     * significant bits).
+     */
+    int bi_valid;
+    /* Number of valid bits in bi_buf.  All bits above the last valid bit
+     * are always zero.
+     */
+
+} FAR deflate_state;
+
+/* Output a byte on the stream.
+ * IN assertion: there is enough room in pending_buf.
+ */
+#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
+
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
+/* In order to simplify the code, particularly on 16 bit machines, match
+ * distances are limited to MAX_DIST instead of WSIZE.
+ */
+
+        /* in trees.c */
+void _tr_init         OF((deflate_state *s));
+int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
+void _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
+			  int eof));
+void _tr_align        OF((deflate_state *s));
+void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
+                          int eof));
+
+#define d_code(dist) \
+   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * used.
+ */
+
+#ifndef DEBUG
+/* Inline versions of _tr_tally for speed: */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+  extern uch _length_code[];
+  extern uch _dist_code[];
+#else
+  extern const uch _length_code[];
+  extern const uch _dist_code[];
+#endif
+
+# define _tr_tally_lit(s, c, flush) \
+  { uch cc = (c); \
+    s->d_buf[s->last_lit] = 0; \
+    s->l_buf[s->last_lit++] = cc; \
+    s->dyn_ltree[cc].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+   }
+# define _tr_tally_dist(s, distance, length, flush) \
+  { uch len = (length); \
+    ush dist = (distance); \
+    s->d_buf[s->last_lit] = dist; \
+    s->l_buf[s->last_lit++] = len; \
+    dist--; \
+    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+    s->dyn_dtree[d_code(dist)].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+  }
+#else
+# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
+# define _tr_tally_dist(s, distance, length, flush) \
+              flush = _tr_tally(s, distance, length) 
+#endif
+
+#endif

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/descrip.mms
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/descrip.mms	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/descrip.mms	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,48 @@
+# descrip.mms: MMS description file for building zlib on VMS
+# written by Martin P.J. Zinser <m.zinser at gsi.de>
+
+cc_defs = 
+c_deb = 
+
+.ifdef __DECC__
+pref = /prefix=all
+.endif
+
+OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\
+       deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\
+       inftrees.obj, infcodes.obj, infutil.obj, inffast.obj
+
+CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF)
+
+all : example.exe minigzip.exe
+        @ write sys$output " Example applications available"
+libz.olb : libz.olb($(OBJS))
+	@ write sys$output " libz available"
+
+example.exe : example.obj libz.olb
+              link example,libz.olb/lib
+
+minigzip.exe : minigzip.obj libz.olb
+              link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
+
+clean : 
+	delete *.obj;*,libz.olb;*
+
+
+# Other dependencies.
+adler32.obj : zutil.h zlib.h zconf.h
+compress.obj : zlib.h zconf.h
+crc32.obj : zutil.h zlib.h zconf.h
+deflate.obj : deflate.h zutil.h zlib.h zconf.h
+example.obj : zlib.h zconf.h
+gzio.obj : zutil.h zlib.h zconf.h
+infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
+infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
+inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
+inflate.obj : zutil.h zlib.h zconf.h infblock.h
+inftrees.obj : zutil.h zlib.h zconf.h inftrees.h
+infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h
+minigzip.obj : zlib.h zconf.h
+trees.obj : deflate.h zutil.h zlib.h zconf.h
+uncompr.obj : zlib.h zconf.h
+zutil.obj : zutil.h zlib.h zconf.h

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/example.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/example.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/example.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,556 @@
+/* example.c -- usage example of the zlib compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* @(#) $Id: example.c,v 1.5 1998/12/18 21:38:41 koziol Exp $ */
+
+#include <stdio.h>
+#include "zlib.h"
+
+#ifdef STDC
+#  include <string.h>
+#  include <stdlib.h>
+#else
+   extern void exit  OF((int));
+#endif
+
+#if defined(VMS) || defined(RISCOS)
+#  define TESTFILE "foo-gz"
+#else
+#  define TESTFILE "foo.gz"
+#endif
+
+#define CHECK_ERR(err, msg) { \
+    if (err != Z_OK) { \
+        fprintf(stderr, "%s error: %d\n", msg, err); \
+        exit(1); \
+    } \
+}
+
+const char hello[] = "hello, hello!";
+/* "hello world" would be more standard, but the repeated "hello"
+ * stresses the compression code better, sorry...
+ */
+
+const char dictionary[] = "hello";
+uLong dictId; /* Adler32 value of the dictionary */
+
+void test_compress      OF((Byte *compr, uLong comprLen,
+		            Byte *uncompr, uLong uncomprLen));
+void test_gzio          OF((const char *out, const char *in, 
+		            Byte *uncompr, int uncomprLen));
+void test_deflate       OF((Byte *compr, uLong comprLen));
+void test_inflate       OF((Byte *compr, uLong comprLen,
+		            Byte *uncompr, uLong uncomprLen));
+void test_large_deflate OF((Byte *compr, uLong comprLen,
+		            Byte *uncompr, uLong uncomprLen));
+void test_large_inflate OF((Byte *compr, uLong comprLen,
+		            Byte *uncompr, uLong uncomprLen));
+void test_flush         OF((Byte *compr, uLong *comprLen));
+void test_sync          OF((Byte *compr, uLong comprLen,
+		            Byte *uncompr, uLong uncomprLen));
+void test_dict_deflate  OF((Byte *compr, uLong comprLen));
+void test_dict_inflate  OF((Byte *compr, uLong comprLen,
+		            Byte *uncompr, uLong uncomprLen));
+int  main               OF((int argc, char *argv[]));
+
+/* ===========================================================================
+ * Test compress() and uncompress()
+ */
+void test_compress(compr, comprLen, uncompr, uncomprLen)
+    Byte *compr, *uncompr;
+    uLong comprLen, uncomprLen;
+{
+    int err;
+    uLong len = strlen(hello)+1;
+
+    err = compress(compr, &comprLen, (const Bytef*)hello, len);
+    CHECK_ERR(err, "compress");
+
+    strcpy((char*)uncompr, "garbage");
+
+    err = uncompress(uncompr, &uncomprLen, compr, comprLen);
+    CHECK_ERR(err, "uncompress");
+
+    if (strcmp((char*)uncompr, hello)) {
+        fprintf(stderr, "bad uncompress\n");
+	exit(1);
+    } else {
+        printf("uncompress(): %s\n", (char *)uncompr);
+    }
+}
+
+/* ===========================================================================
+ * Test read/write of .gz files
+ */
+void test_gzio(out, in, uncompr, uncomprLen)
+    const char *out; /* compressed output file */
+    const char *in;  /* compressed input file */
+    Byte *uncompr;
+    int  uncomprLen;
+{
+    int err;
+    int len = strlen(hello)+1;
+    gzFile file;
+    z_off_t pos;
+
+    file = gzopen(out, "wb");
+    if (file == NULL) {
+        fprintf(stderr, "gzopen error\n");
+        exit(1);
+    }
+    gzputc(file, 'h');
+    if (gzputs(file, "ello") != 4) {
+        fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));
+	exit(1);
+    }
+    if (gzprintf(file, ", %s!", "hello") != 8) {
+        fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err));
+	exit(1);
+    }
+    gzseek(file, 1L, SEEK_CUR); /* add one zero byte */
+    gzclose(file);
+
+    file = gzopen(in, "rb");
+    if (file == NULL) {
+        fprintf(stderr, "gzopen error\n");
+    }
+    strcpy((char*)uncompr, "garbage");
+
+    uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen);
+    if (uncomprLen != len) {
+        fprintf(stderr, "gzread err: %s\n", gzerror(file, &err));
+	exit(1);
+    }
+    if (strcmp((char*)uncompr, hello)) {
+        fprintf(stderr, "bad gzread: %s\n", (char*)uncompr);
+	exit(1);
+    } else {
+        printf("gzread(): %s\n", (char *)uncompr);
+    }
+
+    pos = gzseek(file, -8L, SEEK_CUR);
+    if (pos != 6 || gztell(file) != pos) {
+	fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n",
+		(long)pos, (long)gztell(file));
+	exit(1);
+    }
+
+    if (gzgetc(file) != ' ') {
+	fprintf(stderr, "gzgetc error\n");
+	exit(1);
+    }
+
+    gzgets(file, (char*)uncompr, uncomprLen);
+    uncomprLen = strlen((char*)uncompr);
+    if (uncomprLen != 6) { /* "hello!" */
+        fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err));
+	exit(1);
+    }
+    if (strcmp((char*)uncompr, hello+7)) {
+        fprintf(stderr, "bad gzgets after gzseek\n");
+	exit(1);
+    } else {
+        printf("gzgets() after gzseek: %s\n", (char *)uncompr);
+    }
+
+    gzclose(file);
+}
+
+/* ===========================================================================
+ * Test deflate() with small buffers
+ */
+void test_deflate(compr, comprLen)
+    Byte *compr;
+    uLong comprLen;
+{
+    z_stream c_stream; /* compression stream */
+    int err;
+    int len = strlen(hello)+1;
+
+    c_stream.zalloc = (alloc_func)0;
+    c_stream.zfree = (free_func)0;
+    c_stream.opaque = (voidpf)0;
+
+    err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
+    CHECK_ERR(err, "deflateInit");
+
+    c_stream.next_in  = (Bytef*)hello;
+    c_stream.next_out = compr;
+
+    while (c_stream.total_in != (uLong)len && c_stream.total_out < comprLen) {
+        c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */
+        err = deflate(&c_stream, Z_NO_FLUSH);
+        CHECK_ERR(err, "deflate");
+    }
+    /* Finish the stream, still forcing small buffers: */
+    for (;;) {
+        c_stream.avail_out = 1;
+        err = deflate(&c_stream, Z_FINISH);
+        if (err == Z_STREAM_END) break;
+        CHECK_ERR(err, "deflate");
+    }
+
+    err = deflateEnd(&c_stream);
+    CHECK_ERR(err, "deflateEnd");
+}
+
+/* ===========================================================================
+ * Test inflate() with small buffers
+ */
+void test_inflate(compr, comprLen, uncompr, uncomprLen)
+    Byte *compr, *uncompr;
+    uLong comprLen, uncomprLen;
+{
+    int err;
+    z_stream d_stream; /* decompression stream */
+
+    strcpy((char*)uncompr, "garbage");
+
+    d_stream.zalloc = (alloc_func)0;
+    d_stream.zfree = (free_func)0;
+    d_stream.opaque = (voidpf)0;
+
+    d_stream.next_in  = compr;
+    d_stream.avail_in = 0;
+    d_stream.next_out = uncompr;
+
+    err = inflateInit(&d_stream);
+    CHECK_ERR(err, "inflateInit");
+
+    while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) {
+        d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */
+        err = inflate(&d_stream, Z_NO_FLUSH);
+        if (err == Z_STREAM_END) break;
+        CHECK_ERR(err, "inflate");
+    }
+
+    err = inflateEnd(&d_stream);
+    CHECK_ERR(err, "inflateEnd");
+
+    if (strcmp((char*)uncompr, hello)) {
+        fprintf(stderr, "bad inflate\n");
+	exit(1);
+    } else {
+        printf("inflate(): %s\n", (char *)uncompr);
+    }
+}
+
+/* ===========================================================================
+ * Test deflate() with large buffers and dynamic change of compression level
+ */
+void test_large_deflate(compr, comprLen, uncompr, uncomprLen)
+    Byte *compr, *uncompr;
+    uLong comprLen, uncomprLen;
+{
+    z_stream c_stream; /* compression stream */
+    int err;
+
+    c_stream.zalloc = (alloc_func)0;
+    c_stream.zfree = (free_func)0;
+    c_stream.opaque = (voidpf)0;
+
+    err = deflateInit(&c_stream, Z_BEST_SPEED);
+    CHECK_ERR(err, "deflateInit");
+
+    c_stream.next_out = compr;
+    c_stream.avail_out = (uInt)comprLen;
+
+    /* At this point, uncompr is still mostly zeroes, so it should compress
+     * very well:
+     */
+    c_stream.next_in = uncompr;
+    c_stream.avail_in = (uInt)uncomprLen;
+    err = deflate(&c_stream, Z_NO_FLUSH);
+    CHECK_ERR(err, "deflate");
+    if (c_stream.avail_in != 0) {
+        fprintf(stderr, "deflate not greedy\n");
+	exit(1);
+    }
+
+    /* Feed in already compressed data and switch to no compression: */
+    deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
+    c_stream.next_in = compr;
+    c_stream.avail_in = (uInt)comprLen/2;
+    err = deflate(&c_stream, Z_NO_FLUSH);
+    CHECK_ERR(err, "deflate");
+
+    /* Switch back to compressing mode: */
+    deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
+    c_stream.next_in = uncompr;
+    c_stream.avail_in = (uInt)uncomprLen;
+    err = deflate(&c_stream, Z_NO_FLUSH);
+    CHECK_ERR(err, "deflate");
+
+    err = deflate(&c_stream, Z_FINISH);
+    if (err != Z_STREAM_END) {
+        fprintf(stderr, "deflate should report Z_STREAM_END\n");
+	exit(1);
+    }
+    err = deflateEnd(&c_stream);
+    CHECK_ERR(err, "deflateEnd");
+}
+
+/* ===========================================================================
+ * Test inflate() with large buffers
+ */
+void test_large_inflate(compr, comprLen, uncompr, uncomprLen)
+    Byte *compr, *uncompr;
+    uLong comprLen, uncomprLen;
+{
+    int err;
+    z_stream d_stream; /* decompression stream */
+
+    strcpy((char*)uncompr, "garbage");
+
+    d_stream.zalloc = (alloc_func)0;
+    d_stream.zfree = (free_func)0;
+    d_stream.opaque = (voidpf)0;
+
+    d_stream.next_in  = compr;
+    d_stream.avail_in = (uInt)comprLen;
+
+    err = inflateInit(&d_stream);
+    CHECK_ERR(err, "inflateInit");
+
+    for (;;) {
+        d_stream.next_out = uncompr;            /* discard the output */
+	d_stream.avail_out = (uInt)uncomprLen;
+        err = inflate(&d_stream, Z_NO_FLUSH);
+        if (err == Z_STREAM_END) break;
+        CHECK_ERR(err, "large inflate");
+    }
+
+    err = inflateEnd(&d_stream);
+    CHECK_ERR(err, "inflateEnd");
+
+    if (d_stream.total_out != 2*uncomprLen + comprLen/2) {
+        fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out);
+	exit(1);
+    } else {
+        printf("large_inflate(): OK\n");
+    }
+}
+
+/* ===========================================================================
+ * Test deflate() with full flush
+ */
+void test_flush(compr, comprLen)
+    Byte *compr;
+    uLong *comprLen;
+{
+    z_stream c_stream; /* compression stream */
+    int err;
+    int len = strlen(hello)+1;
+
+    c_stream.zalloc = (alloc_func)0;
+    c_stream.zfree = (free_func)0;
+    c_stream.opaque = (voidpf)0;
+
+    err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
+    CHECK_ERR(err, "deflateInit");
+
+    c_stream.next_in  = (Bytef*)hello;
+    c_stream.next_out = compr;
+    c_stream.avail_in = 3;
+    c_stream.avail_out = (uInt)*comprLen;
+    err = deflate(&c_stream, Z_FULL_FLUSH);
+    CHECK_ERR(err, "deflate");
+
+    compr[3]++; /* force an error in first compressed block */
+    c_stream.avail_in = len - 3;
+
+    err = deflate(&c_stream, Z_FINISH);
+    if (err != Z_STREAM_END) {
+        CHECK_ERR(err, "deflate");
+    }
+    err = deflateEnd(&c_stream);
+    CHECK_ERR(err, "deflateEnd");
+
+    *comprLen = c_stream.total_out;
+}
+
+/* ===========================================================================
+ * Test inflateSync()
+ */
+void test_sync(compr, comprLen, uncompr, uncomprLen)
+    Byte *compr, *uncompr;
+    uLong comprLen, uncomprLen;
+{
+    int err;
+    z_stream d_stream; /* decompression stream */
+
+    strcpy((char*)uncompr, "garbage");
+
+    d_stream.zalloc = (alloc_func)0;
+    d_stream.zfree = (free_func)0;
+    d_stream.opaque = (voidpf)0;
+
+    d_stream.next_in  = compr;
+    d_stream.avail_in = 2; /* just read the zlib header */
+
+    err = inflateInit(&d_stream);
+    CHECK_ERR(err, "inflateInit");
+
+    d_stream.next_out = uncompr;
+    d_stream.avail_out = (uInt)uncomprLen;
+
+    inflate(&d_stream, Z_NO_FLUSH);
+    CHECK_ERR(err, "inflate");
+
+    d_stream.avail_in = (uInt)comprLen-2;   /* read all compressed data */
+    err = inflateSync(&d_stream);           /* but skip the damaged part */
+    CHECK_ERR(err, "inflateSync");
+
+    err = inflate(&d_stream, Z_FINISH);
+    if (err != Z_DATA_ERROR) {
+        fprintf(stderr, "inflate should report DATA_ERROR\n");
+        /* Because of incorrect adler32 */
+	exit(1);
+    }
+    err = inflateEnd(&d_stream);
+    CHECK_ERR(err, "inflateEnd");
+
+    printf("after inflateSync(): hel%s\n", (char *)uncompr);
+}
+
+/* ===========================================================================
+ * Test deflate() with preset dictionary
+ */
+void test_dict_deflate(compr, comprLen)
+    Byte *compr;
+    uLong comprLen;
+{
+    z_stream c_stream; /* compression stream */
+    int err;
+
+    c_stream.zalloc = (alloc_func)0;
+    c_stream.zfree = (free_func)0;
+    c_stream.opaque = (voidpf)0;
+
+    err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
+    CHECK_ERR(err, "deflateInit");
+
+    err = deflateSetDictionary(&c_stream,
+			       (const Bytef*)dictionary, sizeof(dictionary));
+    CHECK_ERR(err, "deflateSetDictionary");
+
+    dictId = c_stream.adler;
+    c_stream.next_out = compr;
+    c_stream.avail_out = (uInt)comprLen;
+
+    c_stream.next_in = (Bytef*)hello;
+    c_stream.avail_in = (uInt)strlen(hello)+1;
+
+    err = deflate(&c_stream, Z_FINISH);
+    if (err != Z_STREAM_END) {
+        fprintf(stderr, "deflate should report Z_STREAM_END\n");
+	exit(1);
+    }
+    err = deflateEnd(&c_stream);
+    CHECK_ERR(err, "deflateEnd");
+}
+
+/* ===========================================================================
+ * Test inflate() with a preset dictionary
+ */
+void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
+    Byte *compr, *uncompr;
+    uLong comprLen, uncomprLen;
+{
+    int err;
+    z_stream d_stream; /* decompression stream */
+
+    strcpy((char*)uncompr, "garbage");
+
+    d_stream.zalloc = (alloc_func)0;
+    d_stream.zfree = (free_func)0;
+    d_stream.opaque = (voidpf)0;
+
+    d_stream.next_in  = compr;
+    d_stream.avail_in = (uInt)comprLen;
+
+    err = inflateInit(&d_stream);
+    CHECK_ERR(err, "inflateInit");
+
+    d_stream.next_out = uncompr;
+    d_stream.avail_out = (uInt)uncomprLen;
+
+    for (;;) {
+        err = inflate(&d_stream, Z_NO_FLUSH);
+        if (err == Z_STREAM_END) break;
+	if (err == Z_NEED_DICT) {
+	    if (d_stream.adler != dictId) {
+		fprintf(stderr, "unexpected dictionary");
+		exit(1);
+	    }
+	    err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
+				       sizeof(dictionary));
+	}
+        CHECK_ERR(err, "inflate with dict");
+    }
+
+    err = inflateEnd(&d_stream);
+    CHECK_ERR(err, "inflateEnd");
+
+    if (strcmp((char*)uncompr, hello)) {
+        fprintf(stderr, "bad inflate with dict\n");
+	exit(1);
+    } else {
+        printf("inflate with dictionary: %s\n", (char *)uncompr);
+    }
+}
+
+/* ===========================================================================
+ * Usage:  example [output.gz  [input.gz]]
+ */
+
+int main(argc, argv)
+    int argc;
+    char *argv[];
+{
+    Byte *compr, *uncompr;
+    uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
+    uLong uncomprLen = comprLen;
+    static const char* myVersion = ZLIB_VERSION;
+
+    if (zlibVersion()[0] != myVersion[0]) {
+        fprintf(stderr, "incompatible zlib version\n");
+        exit(1);
+
+    } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
+        fprintf(stderr, "warning: different zlib version\n");
+    }
+
+    compr    = (Byte*)calloc((uInt)comprLen, 1);
+    uncompr  = (Byte*)calloc((uInt)uncomprLen, 1);
+    /* compr and uncompr are cleared to avoid reading uninitialized
+     * data and to ensure that uncompr compresses well.
+     */
+    if (compr == Z_NULL || uncompr == Z_NULL) {
+        printf("out of memory\n");
+	exit(1);
+    }
+    test_compress(compr, comprLen, uncompr, uncomprLen);
+
+    test_gzio((argc > 1 ? argv[1] : TESTFILE),
+              (argc > 2 ? argv[2] : TESTFILE),
+	      uncompr, (int)uncomprLen);
+
+    test_deflate(compr, comprLen);
+    test_inflate(compr, comprLen, uncompr, uncomprLen);
+
+    test_large_deflate(compr, comprLen, uncompr, uncomprLen);
+    test_large_inflate(compr, comprLen, uncompr, uncomprLen);
+
+    test_flush(compr, &comprLen);
+    test_sync(compr, comprLen, uncompr, uncomprLen);
+    comprLen = uncomprLen;
+
+    test_dict_deflate(compr, comprLen);
+    test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
+
+    exit(0);
+    return 0; /* to avoid warning */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/gzio.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/gzio.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/gzio.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,875 @@
+/* gzio.c -- IO on .gz files
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * Compile this file with -DNO_DEFLATE to avoid the compression code.
+ */
+
+/* @(#) $Id: gzio.c,v 1.7 1998/12/18 21:38:41 koziol Exp $ */
+
+#include <stdio.h>
+
+#include "zutil.h"
+
+struct internal_state {int dummy;}; /* for buggy compilers */
+
+#ifndef Z_BUFSIZE
+#  ifdef MAXSEG_64K
+#    define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
+#  else
+#    define Z_BUFSIZE 16384
+#  endif
+#endif
+#ifndef Z_PRINTF_BUFSIZE
+#  define Z_PRINTF_BUFSIZE 4096
+#endif
+
+#define ALLOC(size) malloc(size)
+#define TRYFREE(p) {if (p) free(p);}
+
+static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
+
+/* gzip flag byte */
+#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
+#define HEAD_CRC     0x02 /* bit 1 set: header CRC present */
+#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
+#define COMMENT      0x10 /* bit 4 set: file comment present */
+#define RESERVED     0xE0 /* bits 5..7: reserved */
+
+typedef struct gz_stream {
+    z_stream stream;
+    int      z_err;   /* error code for last stream operation */
+    int      z_eof;   /* set if end of input file */
+    FILE     *file;   /* .gz file */
+    Byte     *inbuf;  /* input buffer */
+    Byte     *outbuf; /* output buffer */
+    uLong    crc;     /* crc32 of uncompressed data */
+    char     *msg;    /* error message */
+    char     *path;   /* path name for debugging only */
+    int      transparent; /* 1 if input file is not a .gz file */
+    char     mode;    /* 'w' or 'r' */
+    long     startpos; /* start of compressed data in file (header skipped) */
+} gz_stream;
+
+
+local gzFile gz_open      OF((const char *path, const char *mode, int  fd));
+local int do_flush        OF((gzFile file, int flush));
+local int    get_byte     OF((gz_stream *s));
+local void   check_header OF((gz_stream *s));
+local int    destroy      OF((gz_stream *s));
+local void   putLong      OF((FILE *file, uLong x));
+local uLong  getLong      OF((gz_stream *s));
+
+/* ===========================================================================
+     Opens a gzip (.gz) file for reading or writing. The mode parameter
+   is as in fopen ("rb" or "wb"). The file is given either by file descriptor
+   or path name (if fd == -1).
+     gz_open return NULL if the file could not be opened or if there was
+   insufficient memory to allocate the (de)compression state; errno
+   can be checked to distinguish the two cases (if errno is zero, the
+   zlib error is Z_MEM_ERROR).
+*/
+local gzFile gz_open (path, mode, fd)
+    const char *path;
+    const char *mode;
+    int  fd;
+{
+    int err;
+    int level = Z_DEFAULT_COMPRESSION; /* compression level */
+    int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
+    char *p = (char*)mode;
+    gz_stream *s;
+    char fmode[80]; /* copy of mode, without the compression level */
+    char *m = fmode;
+
+    if (!path || !mode) return Z_NULL;
+
+    s = (gz_stream *)ALLOC(sizeof(gz_stream));
+    if (!s) return Z_NULL;
+
+    s->stream.zalloc = (alloc_func)0;
+    s->stream.zfree = (free_func)0;
+    s->stream.opaque = (voidpf)0;
+    s->stream.next_in = s->inbuf = Z_NULL;
+    s->stream.next_out = s->outbuf = Z_NULL;
+    s->stream.avail_in = s->stream.avail_out = 0;
+    s->file = NULL;
+    s->z_err = Z_OK;
+    s->z_eof = 0;
+    s->crc = crc32(0L, Z_NULL, 0);
+    s->msg = NULL;
+    s->transparent = 0;
+
+    s->path = (char*)ALLOC(strlen(path)+1);
+    if (s->path == NULL) {
+        return destroy(s), (gzFile)Z_NULL;
+    }
+    strcpy(s->path, path); /* do this early for debugging */
+
+    s->mode = '\0';
+    do {
+        if (*p == 'r') s->mode = 'r';
+        if (*p == 'w' || *p == 'a') s->mode = 'w';
+        if (*p >= '0' && *p <= '9') {
+	    level = *p - '0';
+	} else if (*p == 'f') {
+	  strategy = Z_FILTERED;
+	} else if (*p == 'h') {
+	  strategy = Z_HUFFMAN_ONLY;
+	} else {
+	    *m++ = *p; /* copy the mode */
+	}
+    } while (*p++ && m != fmode + sizeof(fmode));
+    if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
+    
+    if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+        err = Z_STREAM_ERROR;
+#else
+        err = deflateInit2(&(s->stream), level,
+                           Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
+        /* windowBits is passed < 0 to suppress zlib header */
+
+        s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+#endif
+        if (err != Z_OK || s->outbuf == Z_NULL) {
+            return destroy(s), (gzFile)Z_NULL;
+        }
+    } else {
+        s->stream.next_in  = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
+
+        err = inflateInit2(&(s->stream), -MAX_WBITS);
+        /* windowBits is passed < 0 to tell that there is no zlib header.
+         * Note that in this case inflate *requires* an extra "dummy" byte
+         * after the compressed stream in order to complete decompression and
+         * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
+         * present after the compressed stream.
+         */
+        if (err != Z_OK || s->inbuf == Z_NULL) {
+            return destroy(s), (gzFile)Z_NULL;
+        }
+    }
+    s->stream.avail_out = Z_BUFSIZE;
+
+    errno = 0;
+    s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
+
+    if (s->file == NULL) {
+        return destroy(s), (gzFile)Z_NULL;
+    }
+    if (s->mode == 'w') {
+        /* Write a very simple .gz header:
+         */
+        fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
+             Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
+	s->startpos = 10L;
+	/* We use 10L instead of ftell(s->file) to because ftell causes an
+         * fflush on some systems. This version of the library doesn't use
+         * startpos anyway in write mode, so this initialization is not
+         * necessary.
+         */
+    } else {
+	check_header(s); /* skip the .gz header */
+	s->startpos = (ftell(s->file) - s->stream.avail_in);
+    }
+    
+    return (gzFile)s;
+}
+
+/* ===========================================================================
+     Opens a gzip (.gz) file for reading or writing.
+*/
+gzFile ZEXPORT gzopen (path, mode)
+    const char *path;
+    const char *mode;
+{
+    return gz_open (path, mode, -1);
+}
+
+/* ===========================================================================
+     Associate a gzFile with the file descriptor fd. fd is not dup'ed here
+   to mimic the behavio(u)r of fdopen.
+*/
+gzFile ZEXPORT gzdopen (fd, mode)
+    int fd;
+    const char *mode;
+{
+    char name[20];
+
+    if (fd < 0) return (gzFile)Z_NULL;
+    sprintf(name, "<fd:%d>", fd); /* for debugging */
+
+    return gz_open (name, mode, fd);
+}
+
+/* ===========================================================================
+ * Update the compression level and strategy
+ */
+int ZEXPORT gzsetparams (file, level, strategy)
+    gzFile file;
+    int level;
+    int strategy;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+    /* Make room to allow flushing */
+    if (s->stream.avail_out == 0) {
+
+	s->stream.next_out = s->outbuf;
+	if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+	    s->z_err = Z_ERRNO;
+	}
+	s->stream.avail_out = Z_BUFSIZE;
+    }
+
+    return deflateParams (&(s->stream), level, strategy);
+}
+
+/* ===========================================================================
+     Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+   for end of file.
+   IN assertion: the stream s has been sucessfully opened for reading.
+*/
+local int get_byte(s)
+    gz_stream *s;
+{
+    if (s->z_eof) return EOF;
+    if (s->stream.avail_in == 0) {
+	errno = 0;
+	s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+	if (s->stream.avail_in == 0) {
+	    s->z_eof = 1;
+	    if (ferror(s->file)) s->z_err = Z_ERRNO;
+	    return EOF;
+	}
+	s->stream.next_in = s->inbuf;
+    }
+    s->stream.avail_in--;
+    return *(s->stream.next_in)++;
+}
+
+/* ===========================================================================
+      Check the gzip header of a gz_stream opened for reading. Set the stream
+    mode to transparent if the gzip magic header is not present; set s->err
+    to Z_DATA_ERROR if the magic header is present but the rest of the header
+    is incorrect.
+    IN assertion: the stream s has already been created sucessfully;
+       s->stream.avail_in is zero for the first time, but may be non-zero
+       for concatenated .gz files.
+*/
+local void check_header(s)
+    gz_stream *s;
+{
+    int method; /* method byte */
+    int flags;  /* flags byte */
+    uInt len;
+    int c;
+
+    /* Check the gzip magic header */
+    for (len = 0; len < 2; len++) {
+	c = get_byte(s);
+	if (c != gz_magic[len]) {
+	    if (len != 0) s->stream.avail_in++, s->stream.next_in--;
+	    if (c != EOF) {
+		s->stream.avail_in++, s->stream.next_in--;
+		s->transparent = 1;
+	    }
+	    s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END;
+	    return;
+	}
+    }
+    method = get_byte(s);
+    flags = get_byte(s);
+    if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
+	s->z_err = Z_DATA_ERROR;
+	return;
+    }
+
+    /* Discard time, xflags and OS code: */
+    for (len = 0; len < 6; len++) (void)get_byte(s);
+
+    if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
+	len  =  (uInt)get_byte(s);
+	len += ((uInt)get_byte(s))<<8;
+	/* len is garbage if EOF but the loop below will quit anyway */
+	while (len-- != 0 && get_byte(s) != EOF) ;
+    }
+    if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
+	while ((c = get_byte(s)) != 0 && c != EOF) ;
+    }
+    if ((flags & COMMENT) != 0) {   /* skip the .gz file comment */
+	while ((c = get_byte(s)) != 0 && c != EOF) ;
+    }
+    if ((flags & HEAD_CRC) != 0) {  /* skip the header crc */
+	for (len = 0; len < 2; len++) (void)get_byte(s);
+    }
+    s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
+}
+
+ /* ===========================================================================
+ * Cleanup then free the given gz_stream. Return a zlib error code.
+   Try freeing in the reverse order of allocations.
+ */
+local int destroy (s)
+    gz_stream *s;
+{
+    int err = Z_OK;
+
+    if (!s) return Z_STREAM_ERROR;
+
+    TRYFREE(s->msg);
+
+    if (s->stream.state != NULL) {
+	if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+	    err = Z_STREAM_ERROR;
+#else
+	    err = deflateEnd(&(s->stream));
+#endif
+	} else if (s->mode == 'r') {
+	    err = inflateEnd(&(s->stream));
+	}
+    }
+    if (s->file != NULL && fclose(s->file)) {
+#ifdef ESPIPE
+	if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
+#endif
+	    err = Z_ERRNO;
+    }
+    if (s->z_err < 0) err = s->z_err;
+
+    TRYFREE(s->inbuf);
+    TRYFREE(s->outbuf);
+    TRYFREE(s->path);
+    TRYFREE(s);
+    return err;
+}
+
+/* ===========================================================================
+     Reads the given number of uncompressed bytes from the compressed file.
+   gzread returns the number of bytes actually read (0 for end of file).
+*/
+int ZEXPORT gzread (file, buf, len)
+    gzFile file;
+    voidp buf;
+    unsigned len;
+{
+    gz_stream *s = (gz_stream*)file;
+    Bytef *start = (Bytef*)buf; /* starting point for crc computation */
+    Byte  *next_out; /* == stream.next_out but not forced far (for MSDOS) */
+
+    if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
+
+    if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
+    if (s->z_err == Z_STREAM_END) return 0;  /* EOF */
+
+    next_out = (Byte*)buf;
+    s->stream.next_out = (Bytef*)buf;
+    s->stream.avail_out = len;
+
+    while (s->stream.avail_out != 0) {
+
+	if (s->transparent) {
+	    /* Copy first the lookahead bytes: */
+	    uInt n = s->stream.avail_in;
+	    if (n > s->stream.avail_out) n = s->stream.avail_out;
+	    if (n > 0) {
+		zmemcpy(s->stream.next_out, s->stream.next_in, n);
+		next_out += n;
+		s->stream.next_out = next_out;
+		s->stream.next_in   += n;
+		s->stream.avail_out -= n;
+		s->stream.avail_in  -= n;
+	    }
+	    if (s->stream.avail_out > 0) {
+		s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out,
+					     s->file);
+	    }
+	    len -= s->stream.avail_out;
+	    s->stream.total_in  += (uLong)len;
+	    s->stream.total_out += (uLong)len;
+            if (len == 0) s->z_eof = 1;
+	    return (int)len;
+	}
+        if (s->stream.avail_in == 0 && !s->z_eof) {
+
+            errno = 0;
+            s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+            if (s->stream.avail_in == 0) {
+                s->z_eof = 1;
+		if (ferror(s->file)) {
+		    s->z_err = Z_ERRNO;
+		    break;
+		}
+            }
+            s->stream.next_in = s->inbuf;
+        }
+        s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
+
+	if (s->z_err == Z_STREAM_END) {
+	    /* Check CRC and original size */
+	    s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+	    start = s->stream.next_out;
+
+	    if (getLong(s) != s->crc) {
+		s->z_err = Z_DATA_ERROR;
+	    } else {
+	        (void)getLong(s);
+                /* The uncompressed length returned by above getlong() may
+                 * be different from s->stream.total_out) in case of
+		 * concatenated .gz files. Check for such files:
+		 */
+		check_header(s);
+		if (s->z_err == Z_OK) {
+		    uLong total_in = s->stream.total_in;
+		    uLong total_out = s->stream.total_out;
+
+		    inflateReset(&(s->stream));
+		    s->stream.total_in = total_in;
+		    s->stream.total_out = total_out;
+		    s->crc = crc32(0L, Z_NULL, 0);
+		}
+	    }
+	}
+	if (s->z_err != Z_OK || s->z_eof) break;
+    }
+    s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+
+    return (int)(len - s->stream.avail_out);
+}
+
+
+/* ===========================================================================
+      Reads one byte from the compressed file. gzgetc returns this byte
+   or -1 in case of end of file or error.
+*/
+int ZEXPORT gzgetc(file)
+    gzFile file;
+{
+    unsigned char c;
+
+    return gzread(file, &c, 1) == 1 ? c : -1;
+}
+
+
+/* ===========================================================================
+      Reads bytes from the compressed file until len-1 characters are
+   read, or a newline character is read and transferred to buf, or an
+   end-of-file condition is encountered.  The string is then terminated
+   with a null character.
+      gzgets returns buf, or Z_NULL in case of error.
+
+      The current implementation is not optimized at all.
+*/
+char * ZEXPORT gzgets(file, buf, len)
+    gzFile file;
+    char *buf;
+    int len;
+{
+    char *b = buf;
+    if (buf == Z_NULL || len <= 0) return Z_NULL;
+
+    while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
+    *buf = '\0';
+    return b == buf && len > 0 ? Z_NULL : b;
+}
+
+
+#ifndef NO_DEFLATE
+/* ===========================================================================
+     Writes the given number of uncompressed bytes into the compressed file.
+   gzwrite returns the number of bytes actually written (0 in case of error).
+*/
+int ZEXPORT gzwrite (file, buf, len)
+    gzFile file;
+    const voidp buf;
+    unsigned len;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+    s->stream.next_in = (Bytef*)buf;
+    s->stream.avail_in = len;
+
+    while (s->stream.avail_in != 0) {
+
+        if (s->stream.avail_out == 0) {
+
+            s->stream.next_out = s->outbuf;
+            if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+                s->z_err = Z_ERRNO;
+                break;
+            }
+            s->stream.avail_out = Z_BUFSIZE;
+        }
+        s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
+        if (s->z_err != Z_OK) break;
+    }
+    s->crc = crc32(s->crc, (const Bytef *)buf, len);
+
+    return (int)(len - s->stream.avail_in);
+}
+
+/* ===========================================================================
+     Converts, formats, and writes the args to the compressed file under
+   control of the format string, as in fprintf. gzprintf returns the number of
+   uncompressed bytes actually written (0 in case of error).
+*/
+#ifdef STDC
+#include <stdarg.h>
+
+int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
+{
+    char buf[Z_PRINTF_BUFSIZE];
+    va_list va;
+    int len;
+
+    va_start(va, format);
+#ifdef HAS_vsnprintf
+    (void)vsnprintf(buf, sizeof(buf), format, va);
+#else
+    (void)vsprintf(buf, format, va);
+#endif
+    va_end(va);
+    len = strlen(buf); /* some *sprintf don't return the nb of bytes written */
+    if (len <= 0) return 0;
+
+    return gzwrite(file, buf, (unsigned)len);
+}
+#else /* not ANSI C */
+
+int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+	               a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
+    gzFile file;
+    const char *format;
+    int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+	a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
+{
+    char buf[Z_PRINTF_BUFSIZE];
+    int len;
+
+#ifdef HAS_snprintf
+    snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
+	     a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+#else
+    sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
+	    a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+#endif
+    len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */
+    if (len <= 0) return 0;
+
+    return gzwrite(file, buf, len);
+}
+#endif
+
+/* ===========================================================================
+      Writes c, converted to an unsigned char, into the compressed file.
+   gzputc returns the value that was written, or -1 in case of error.
+*/
+int ZEXPORT gzputc(file, c)
+    gzFile file;
+    int c;
+{
+    unsigned char cc = (unsigned char) c; /* required for big endian systems */
+
+    return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
+}
+
+
+/* ===========================================================================
+      Writes the given null-terminated string to the compressed file, excluding
+   the terminating null character.
+      gzputs returns the number of characters written, or -1 in case of error.
+*/
+int ZEXPORT gzputs(file, s)
+    gzFile file;
+    const char *s;
+{
+    return gzwrite(file, (char*)s, (unsigned)strlen(s));
+}
+
+
+/* ===========================================================================
+     Flushes all pending output into the compressed file. The parameter
+   flush is as in the deflate() function.
+*/
+local int do_flush (file, flush)
+    gzFile file;
+    int flush;
+{
+    uInt len;
+    int done = 0;
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+    s->stream.avail_in = 0; /* should be zero already anyway */
+
+    for (;;) {
+        len = Z_BUFSIZE - s->stream.avail_out;
+
+        if (len != 0) {
+            if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
+                s->z_err = Z_ERRNO;
+                return Z_ERRNO;
+            }
+            s->stream.next_out = s->outbuf;
+            s->stream.avail_out = Z_BUFSIZE;
+        }
+        if (done) break;
+        s->z_err = deflate(&(s->stream), flush);
+
+	/* Ignore the second of two consecutive flushes: */
+	if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
+
+        /* deflate has finished flushing only when it hasn't used up
+         * all the available space in the output buffer: 
+         */
+        done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
+ 
+        if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
+    }
+    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+}
+
+int ZEXPORT gzflush (file, flush)
+     gzFile file;
+     int flush;
+{
+    gz_stream *s = (gz_stream*)file;
+    int err = do_flush (file, flush);
+
+    if (err) return err;
+    fflush(s->file);
+    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+}
+#endif /* NO_DEFLATE */
+
+/* ===========================================================================
+      Sets the starting position for the next gzread or gzwrite on the given
+   compressed file. The offset represents a number of bytes in the
+      gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error.
+      SEEK_END is not implemented, returns error.
+      In this version of the library, gzseek can be extremely slow.
+*/
+z_off_t ZEXPORT gzseek (file, offset, whence)
+    gzFile file;
+    z_off_t offset;
+    int whence;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || whence == SEEK_END ||
+	s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
+	return -1L;
+    }
+    
+    if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+	return -1L;
+#else
+	if (whence == SEEK_SET) {
+	    offset -= s->stream.total_in;
+	}
+	if (offset < 0) return -1L;
+
+	/* At this point, offset is the number of zero bytes to write. */
+	if (s->inbuf == Z_NULL) {
+	    s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
+	    zmemzero(s->inbuf, Z_BUFSIZE);
+	}
+	while (offset > 0)  {
+	    uInt size = Z_BUFSIZE;
+	    if (offset < Z_BUFSIZE) size = (uInt)offset;
+
+	    size = gzwrite(file, s->inbuf, size);
+	    if (size == 0) return -1L;
+
+	    offset -= size;
+	}
+	return (z_off_t)s->stream.total_in;
+#endif
+    }
+    /* Rest of function is for reading only */
+
+    /* compute absolute position */
+    if (whence == SEEK_CUR) {
+	offset += s->stream.total_out;
+    }
+    if (offset < 0) return -1L;
+
+    if (s->transparent) {
+	/* map to fseek */
+	s->stream.avail_in = 0;
+	s->stream.next_in = s->inbuf;
+        if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
+
+	s->stream.total_in = s->stream.total_out = (uLong)offset;
+	return offset;
+    }
+
+    /* For a negative seek, rewind and use positive seek */
+    if ((uLong)offset >= s->stream.total_out) {
+	offset -= s->stream.total_out;
+    } else if (gzrewind(file) < 0) {
+	return -1L;
+    }
+    /* offset is now the number of bytes to skip. */
+
+    if (offset != 0 && s->outbuf == Z_NULL) {
+	s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+    }
+    while (offset > 0)  {
+	int size = Z_BUFSIZE;
+	if (offset < Z_BUFSIZE) size = (int)offset;
+
+	size = gzread(file, s->outbuf, (uInt)size);
+	if (size <= 0) return -1L;
+	offset -= size;
+    }
+    return (z_off_t)s->stream.total_out;
+}
+
+/* ===========================================================================
+     Rewinds input file. 
+*/
+int ZEXPORT gzrewind (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+    
+    if (s == NULL || s->mode != 'r') return -1;
+
+    s->z_err = Z_OK;
+    s->z_eof = 0;
+    s->stream.avail_in = 0;
+    s->stream.next_in = s->inbuf;
+    s->crc = crc32(0L, Z_NULL, 0);
+	
+    if (s->startpos == 0) { /* not a compressed file */
+	rewind(s->file);
+	return 0;
+    }
+
+    (void) inflateReset(&s->stream);
+    return fseek(s->file, s->startpos, SEEK_SET);
+}
+
+/* ===========================================================================
+     Returns the starting position for the next gzread or gzwrite on the
+   given compressed file. This position represents a number of bytes in the
+   uncompressed data stream.
+*/
+z_off_t ZEXPORT gztell (file)
+    gzFile file;
+{
+    return gzseek(file, 0L, SEEK_CUR);
+}
+
+/* ===========================================================================
+     Returns 1 when EOF has previously been detected reading the given
+   input stream, otherwise zero.
+*/
+int ZEXPORT gzeof (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+    
+    return (s == NULL || s->mode != 'r') ? 0 : s->z_eof;
+}
+
+/* ===========================================================================
+   Outputs a long in LSB order to the given file
+*/
+local void putLong (file, x)
+    FILE *file;
+    uLong x;
+{
+    int n;
+    for (n = 0; n < 4; n++) {
+        fputc((int)(x & 0xff), file);
+        x >>= 8;
+    }
+}
+
+/* ===========================================================================
+   Reads a long in LSB order from the given gz_stream. Sets z_err in case
+   of error.
+*/
+local uLong getLong (s)
+    gz_stream *s;
+{
+    uLong x = (uLong)get_byte(s);
+    int c;
+
+    x += ((uLong)get_byte(s))<<8;
+    x += ((uLong)get_byte(s))<<16;
+    c = get_byte(s);
+    if (c == EOF) s->z_err = Z_DATA_ERROR;
+    x += ((uLong)c)<<24;
+    return x;
+}
+
+/* ===========================================================================
+     Flushes all pending output if necessary, closes the compressed file
+   and deallocates all the (de)compression state.
+*/
+int ZEXPORT gzclose (file)
+    gzFile file;
+{
+    int err;
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL) return Z_STREAM_ERROR;
+
+    if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+	return Z_STREAM_ERROR;
+#else
+        err = do_flush (file, Z_FINISH);
+        if (err != Z_OK) return destroy((gz_stream*)file);
+
+        putLong (s->file, s->crc);
+        putLong (s->file, s->stream.total_in);
+#endif
+    }
+    return destroy((gz_stream*)file);
+}
+
+/* ===========================================================================
+     Returns the error message for the last error which occured on the
+   given compressed file. errnum is set to zlib error number. If an
+   error occured in the file system and not in the compression library,
+   errnum is set to Z_ERRNO and the application may consult errno
+   to get the exact error code.
+*/
+const char*  ZEXPORT gzerror (file, errnum)
+    gzFile file;
+    int *errnum;
+{
+    char *m;
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL) {
+        *errnum = Z_STREAM_ERROR;
+        return (const char*)ERR_MSG(Z_STREAM_ERROR);
+    }
+    *errnum = s->z_err;
+    if (*errnum == Z_OK) return (const char*)"";
+
+    m =  (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
+
+    if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
+
+    TRYFREE(s->msg);
+    s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
+    strcpy(s->msg, s->path);
+    strcat(s->msg, ": ");
+    strcat(s->msg, m);
+    return (const char*)s->msg;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/infblock.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/infblock.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/infblock.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,398 @@
+/* infblock.c -- interpret and process block types to last block
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+#include "zutil.h"
+#include "infblock.h"
+#include "inftrees.h"
+#include "infcodes.h"
+#include "infutil.h"
+
+struct inflate_codes_state {int dummy;}; /* for buggy compilers */
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+/* Table for deflate from PKZIP's appnote.txt. */
+local const uInt border[] = { /* Order of the bit length code lengths */
+        16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+
+/*
+   Notes beyond the 1.93a appnote.txt:
+
+   1. Distance pointers never point before the beginning of the output
+      stream.
+   2. Distance pointers can point back across blocks, up to 32k away.
+   3. There is an implied maximum of 7 bits for the bit length table and
+      15 bits for the actual data.
+   4. If only one code exists, then it is encoded using one bit.  (Zero
+      would be more efficient, but perhaps a little confusing.)  If two
+      codes exist, they are coded using one bit each (0 and 1).
+   5. There is no way of sending zero distance codes--a dummy must be
+      sent if there are none.  (History: a pre 2.0 version of PKZIP would
+      store blocks with no distance codes, but this was discovered to be
+      too harsh a criterion.)  Valid only for 1.93a.  2.04c does allow
+      zero distance codes, which is sent as one code of zero bits in
+      length.
+   6. There are up to 286 literal/length codes.  Code 256 represents the
+      end-of-block.  Note however that the static length tree defines
+      288 codes just to fill out the Huffman codes.  Codes 286 and 287
+      cannot be used though, since there is no length base or extra bits
+      defined for them.  Similarily, there are up to 30 distance codes.
+      However, static trees define 32 codes (all 5 bits) to fill out the
+      Huffman codes, but the last two had better not show up in the data.
+   7. Unzip can check dynamic Huffman blocks for complete code sets.
+      The exception is that a single code would not be complete (see #4).
+   8. The five bits following the block type is really the number of
+      literal codes sent minus 257.
+   9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
+      (1+6+6).  Therefore, to output three times the length, you output
+      three codes (1+1+1), whereas to output four times the same length,
+      you only need two codes (1+3).  Hmm.
+  10. In the tree reconstruction algorithm, Code = Code + Increment
+      only if BitLength(i) is not zero.  (Pretty obvious.)
+  11. Correction: 4 Bits: # of Bit Length codes - 4     (4 - 19)
+  12. Note: length code 284 can represent 227-258, but length code 285
+      really is 258.  The last length deserves its own, short code
+      since it gets used a lot in very redundant files.  The length
+      258 is special since 258 - 3 (the min match length) is 255.
+  13. The literal/length and distance code bit lengths are read as a
+      single stream of lengths.  It is possible (and advantageous) for
+      a repeat code (16, 17, or 18) to go across the boundary between
+      the two sets of lengths.
+ */
+
+
+void inflate_blocks_reset(s, z, c)
+inflate_blocks_statef *s;
+z_streamp z;
+uLongf *c;
+{
+  if (c != Z_NULL)
+    *c = s->check;
+  if (s->mode == BTREE || s->mode == DTREE)
+    ZFREE(z, s->sub.trees.blens);
+  if (s->mode == CODES)
+    inflate_codes_free(s->sub.decode.codes, z);
+  s->mode = TYPE;
+  s->bitk = 0;
+  s->bitb = 0;
+  s->read = s->write = s->window;
+  if (s->checkfn != Z_NULL)
+    z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
+  Tracev((stderr, "inflate:   blocks reset\n"));
+}
+
+
+inflate_blocks_statef *inflate_blocks_new(z, c, w)
+z_streamp z;
+check_func c;
+uInt w;
+{
+  inflate_blocks_statef *s;
+
+  if ((s = (inflate_blocks_statef *)ZALLOC
+       (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
+    return s;
+  if ((s->hufts =
+       (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL)
+  {
+    ZFREE(z, s);
+    return Z_NULL;
+  }
+  if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
+  {
+    ZFREE(z, s->hufts);
+    ZFREE(z, s);
+    return Z_NULL;
+  }
+  s->end = s->window + w;
+  s->checkfn = c;
+  s->mode = TYPE;
+  Tracev((stderr, "inflate:   blocks allocated\n"));
+  inflate_blocks_reset(s, z, Z_NULL);
+  return s;
+}
+
+
+int inflate_blocks(s, z, r)
+inflate_blocks_statef *s;
+z_streamp z;
+int r;
+{
+  uInt t;               /* temporary storage */
+  uLong b;              /* bit buffer */
+  uInt k;               /* bits in bit buffer */
+  Bytef *p;             /* input data pointer */
+  uInt n;               /* bytes available there */
+  Bytef *q;             /* output window write pointer */
+  uInt m;               /* bytes to end of window or read pointer */
+
+  /* copy input/output information to locals (UPDATE macro restores) */
+  LOAD
+
+  /* process input based on current state */
+  while (1) switch (s->mode)
+  {
+    case TYPE:
+      NEEDBITS(3)
+      t = (uInt)b & 7;
+      s->last = t & 1;
+      switch (t >> 1)
+      {
+        case 0:                         /* stored */
+          Tracev((stderr, "inflate:     stored block%s\n",
+                 s->last ? " (last)" : ""));
+          DUMPBITS(3)
+          t = k & 7;                    /* go to byte boundary */
+          DUMPBITS(t)
+          s->mode = LENS;               /* get length of stored block */
+          break;
+        case 1:                         /* fixed */
+          Tracev((stderr, "inflate:     fixed codes block%s\n",
+                 s->last ? " (last)" : ""));
+          {
+            uInt bl, bd;
+            inflate_huft *tl, *td;
+
+            inflate_trees_fixed(&bl, &bd, &tl, &td, z);
+            s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);
+            if (s->sub.decode.codes == Z_NULL)
+            {
+              r = Z_MEM_ERROR;
+              LEAVE
+            }
+          }
+          DUMPBITS(3)
+          s->mode = CODES;
+          break;
+        case 2:                         /* dynamic */
+          Tracev((stderr, "inflate:     dynamic codes block%s\n",
+                 s->last ? " (last)" : ""));
+          DUMPBITS(3)
+          s->mode = TABLE;
+          break;
+        case 3:                         /* illegal */
+          DUMPBITS(3)
+          s->mode = BAD;
+          z->msg = (char*)"invalid block type";
+          r = Z_DATA_ERROR;
+          LEAVE
+      }
+      break;
+    case LENS:
+      NEEDBITS(32)
+      if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
+      {
+        s->mode = BAD;
+        z->msg = (char*)"invalid stored block lengths";
+        r = Z_DATA_ERROR;
+        LEAVE
+      }
+      s->sub.left = (uInt)b & 0xffff;
+      b = k = 0;                      /* dump bits */
+      Tracev((stderr, "inflate:       stored length %u\n", s->sub.left));
+      s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
+      break;
+    case STORED:
+      if (n == 0)
+        LEAVE
+      NEEDOUT
+      t = s->sub.left;
+      if (t > n) t = n;
+      if (t > m) t = m;
+      zmemcpy(q, p, t);
+      p += t;  n -= t;
+      q += t;  m -= t;
+      if ((s->sub.left -= t) != 0)
+        break;
+      Tracev((stderr, "inflate:       stored end, %lu total out\n",
+              z->total_out + (q >= s->read ? q - s->read :
+              (s->end - s->read) + (q - s->window))));
+      s->mode = s->last ? DRY : TYPE;
+      break;
+    case TABLE:
+      NEEDBITS(14)
+      s->sub.trees.table = t = (uInt)b & 0x3fff;
+#ifndef PKZIP_BUG_WORKAROUND
+      if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
+      {
+        s->mode = BAD;
+        z->msg = (char*)"too many length or distance symbols";
+        r = Z_DATA_ERROR;
+        LEAVE
+      }
+#endif
+      t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
+      if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)
+      {
+        r = Z_MEM_ERROR;
+        LEAVE
+      }
+      DUMPBITS(14)
+      s->sub.trees.index = 0;
+      Tracev((stderr, "inflate:       table sizes ok\n"));
+      s->mode = BTREE;
+    case BTREE:
+      while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
+      {
+        NEEDBITS(3)
+        s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;
+        DUMPBITS(3)
+      }
+      while (s->sub.trees.index < 19)
+        s->sub.trees.blens[border[s->sub.trees.index++]] = 0;
+      s->sub.trees.bb = 7;
+      t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,
+                             &s->sub.trees.tb, s->hufts, z);
+      if (t != Z_OK)
+      {
+        ZFREE(z, s->sub.trees.blens);
+        r = t;
+        if (r == Z_DATA_ERROR)
+          s->mode = BAD;
+        LEAVE
+      }
+      s->sub.trees.index = 0;
+      Tracev((stderr, "inflate:       bits tree ok\n"));
+      s->mode = DTREE;
+    case DTREE:
+      while (t = s->sub.trees.table,
+             s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
+      {
+        inflate_huft *h;
+        uInt i, j, c;
+
+        t = s->sub.trees.bb;
+        NEEDBITS(t)
+        h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);
+        t = h->bits;
+        c = h->base;
+        if (c < 16)
+        {
+          DUMPBITS(t)
+          s->sub.trees.blens[s->sub.trees.index++] = c;
+        }
+        else /* c == 16..18 */
+        {
+          i = c == 18 ? 7 : c - 14;
+          j = c == 18 ? 11 : 3;
+          NEEDBITS(t + i)
+          DUMPBITS(t)
+          j += (uInt)b & inflate_mask[i];
+          DUMPBITS(i)
+          i = s->sub.trees.index;
+          t = s->sub.trees.table;
+          if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
+              (c == 16 && i < 1))
+          {
+            ZFREE(z, s->sub.trees.blens);
+            s->mode = BAD;
+            z->msg = (char*)"invalid bit length repeat";
+            r = Z_DATA_ERROR;
+            LEAVE
+          }
+          c = c == 16 ? s->sub.trees.blens[i - 1] : 0;
+          do {
+            s->sub.trees.blens[i++] = c;
+          } while (--j);
+          s->sub.trees.index = i;
+        }
+      }
+      s->sub.trees.tb = Z_NULL;
+      {
+        uInt bl, bd;
+        inflate_huft *tl, *td;
+        inflate_codes_statef *c;
+
+        bl = 9;         /* must be <= 9 for lookahead assumptions */
+        bd = 6;         /* must be <= 9 for lookahead assumptions */
+        t = s->sub.trees.table;
+        t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
+                                  s->sub.trees.blens, &bl, &bd, &tl, &td,
+                                  s->hufts, z);
+        ZFREE(z, s->sub.trees.blens);
+        if (t != Z_OK)
+        {
+          if (t == (uInt)Z_DATA_ERROR)
+            s->mode = BAD;
+          r = t;
+          LEAVE
+        }
+        Tracev((stderr, "inflate:       trees ok\n"));
+        if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
+        {
+          r = Z_MEM_ERROR;
+          LEAVE
+        }
+        s->sub.decode.codes = c;
+      }
+      s->mode = CODES;
+    case CODES:
+      UPDATE
+      if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
+        return inflate_flush(s, z, r);
+      r = Z_OK;
+      inflate_codes_free(s->sub.decode.codes, z);
+      LOAD
+      Tracev((stderr, "inflate:       codes end, %lu total out\n",
+              z->total_out + (q >= s->read ? q - s->read :
+              (s->end - s->read) + (q - s->window))));
+      if (!s->last)
+      {
+        s->mode = TYPE;
+        break;
+      }
+      s->mode = DRY;
+    case DRY:
+      FLUSH
+      if (s->read != s->write)
+        LEAVE
+      s->mode = DONE;
+    case DONE:
+      r = Z_STREAM_END;
+      LEAVE
+    case BAD:
+      r = Z_DATA_ERROR;
+      LEAVE
+    default:
+      r = Z_STREAM_ERROR;
+      LEAVE
+  }
+}
+
+
+int inflate_blocks_free(s, z)
+inflate_blocks_statef *s;
+z_streamp z;
+{
+  inflate_blocks_reset(s, z, Z_NULL);
+  ZFREE(z, s->window);
+  ZFREE(z, s->hufts);
+  ZFREE(z, s);
+  Tracev((stderr, "inflate:   blocks freed\n"));
+  return Z_OK;
+}
+
+
+void inflate_set_dictionary(s, d, n)
+inflate_blocks_statef *s;
+const Bytef *d;
+uInt  n;
+{
+  zmemcpy(s->window, d, n);
+  s->read = s->write = s->window + n;
+}
+
+
+/* Returns true if inflate is currently at the end of a block generated
+ * by Z_SYNC_FLUSH or Z_FULL_FLUSH. 
+ * IN assertion: s != Z_NULL
+ */
+int inflate_blocks_sync_point(s)
+inflate_blocks_statef *s;
+{
+  return s->mode == LENS;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/infblock.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/infblock.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/infblock.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,39 @@
+/* infblock.h -- header to use infblock.c
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+struct inflate_blocks_state;
+typedef struct inflate_blocks_state FAR inflate_blocks_statef;
+
+extern inflate_blocks_statef * inflate_blocks_new OF((
+    z_streamp z,
+    check_func c,               /* check function */
+    uInt w));                   /* window size */
+
+extern int inflate_blocks OF((
+    inflate_blocks_statef *,
+    z_streamp ,
+    int));                      /* initial return code */
+
+extern void inflate_blocks_reset OF((
+    inflate_blocks_statef *,
+    z_streamp ,
+    uLongf *));                  /* check value on output */
+
+extern int inflate_blocks_free OF((
+    inflate_blocks_statef *,
+    z_streamp));
+
+extern void inflate_set_dictionary OF((
+    inflate_blocks_statef *s,
+    const Bytef *d,  /* dictionary */
+    uInt  n));       /* dictionary length */
+
+extern int inflate_blocks_sync_point OF((
+    inflate_blocks_statef *s));

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/infcodes.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/infcodes.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/infcodes.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,257 @@
+/* infcodes.c -- process literals and length/distance pairs
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "infblock.h"
+#include "infcodes.h"
+#include "infutil.h"
+#include "inffast.h"
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+typedef enum {        /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
+      START,    /* x: set up for LEN */
+      LEN,      /* i: get length/literal/eob next */
+      LENEXT,   /* i: getting length extra (have base) */
+      DIST,     /* i: get distance next */
+      DISTEXT,  /* i: getting distance extra */
+      COPY,     /* o: copying bytes in window, waiting for space */
+      LIT,      /* o: got literal, waiting for output space */
+      WASH,     /* o: got eob, possibly still output waiting */
+      END,      /* x: got eob and all data flushed */
+      BADCODE}  /* x: got error */
+inflate_codes_mode;
+
+/* inflate codes private state */
+struct inflate_codes_state {
+
+  /* mode */
+  inflate_codes_mode mode;      /* current inflate_codes mode */
+
+  /* mode dependent information */
+  uInt len;
+  union {
+    struct {
+      inflate_huft *tree;       /* pointer into tree */
+      uInt need;                /* bits needed */
+    } code;             /* if LEN or DIST, where in tree */
+    uInt lit;           /* if LIT, literal */
+    struct {
+      uInt get;                 /* bits to get for extra */
+      uInt dist;                /* distance back to copy from */
+    } copy;             /* if EXT or COPY, where and how much */
+  } sub;                /* submode */
+
+  /* mode independent information */
+  Byte lbits;           /* ltree bits decoded per branch */
+  Byte dbits;           /* dtree bits decoder per branch */
+  inflate_huft *ltree;          /* literal/length/eob tree */
+  inflate_huft *dtree;          /* distance tree */
+
+};
+
+
+inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
+uInt bl, bd;
+inflate_huft *tl;
+inflate_huft *td; /* need separate declaration for Borland C++ */
+z_streamp z;
+{
+  inflate_codes_statef *c;
+
+  if ((c = (inflate_codes_statef *)
+       ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)
+  {
+    c->mode = START;
+    c->lbits = (Byte)bl;
+    c->dbits = (Byte)bd;
+    c->ltree = tl;
+    c->dtree = td;
+    Tracev((stderr, "inflate:       codes new\n"));
+  }
+  return c;
+}
+
+
+int inflate_codes(s, z, r)
+inflate_blocks_statef *s;
+z_streamp z;
+int r;
+{
+  uInt j;               /* temporary storage */
+  inflate_huft *t;      /* temporary pointer */
+  uInt e;               /* extra bits or operation */
+  uLong b;              /* bit buffer */
+  uInt k;               /* bits in bit buffer */
+  Bytef *p;             /* input data pointer */
+  uInt n;               /* bytes available there */
+  Bytef *q;             /* output window write pointer */
+  uInt m;               /* bytes to end of window or read pointer */
+  Bytef *f;             /* pointer to copy strings from */
+  inflate_codes_statef *c = s->sub.decode.codes;  /* codes state */
+
+  /* copy input/output information to locals (UPDATE macro restores) */
+  LOAD
+
+  /* process input and output based on current state */
+  while (1) switch (c->mode)
+  {             /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
+    case START:         /* x: set up for LEN */
+#ifndef SLOW
+      if (m >= 258 && n >= 10)
+      {
+        UPDATE
+        r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);
+        LOAD
+        if (r != Z_OK)
+        {
+          c->mode = r == Z_STREAM_END ? WASH : BADCODE;
+          break;
+        }
+      }
+#endif /* !SLOW */
+      c->sub.code.need = c->lbits;
+      c->sub.code.tree = c->ltree;
+      c->mode = LEN;
+    case LEN:           /* i: get length/literal/eob next */
+      j = c->sub.code.need;
+      NEEDBITS(j)
+      t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
+      DUMPBITS(t->bits)
+      e = (uInt)(t->exop);
+      if (e == 0)               /* literal */
+      {
+        c->sub.lit = t->base;
+        Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+                 "inflate:         literal '%c'\n" :
+                 "inflate:         literal 0x%02x\n", t->base));
+        c->mode = LIT;
+        break;
+      }
+      if (e & 16)               /* length */
+      {
+        c->sub.copy.get = e & 15;
+        c->len = t->base;
+        c->mode = LENEXT;
+        break;
+      }
+      if ((e & 64) == 0)        /* next table */
+      {
+        c->sub.code.need = e;
+        c->sub.code.tree = t + t->base;
+        break;
+      }
+      if (e & 32)               /* end of block */
+      {
+        Tracevv((stderr, "inflate:         end of block\n"));
+        c->mode = WASH;
+        break;
+      }
+      c->mode = BADCODE;        /* invalid code */
+      z->msg = (char*)"invalid literal/length code";
+      r = Z_DATA_ERROR;
+      LEAVE
+    case LENEXT:        /* i: getting length extra (have base) */
+      j = c->sub.copy.get;
+      NEEDBITS(j)
+      c->len += (uInt)b & inflate_mask[j];
+      DUMPBITS(j)
+      c->sub.code.need = c->dbits;
+      c->sub.code.tree = c->dtree;
+      Tracevv((stderr, "inflate:         length %u\n", c->len));
+      c->mode = DIST;
+    case DIST:          /* i: get distance next */
+      j = c->sub.code.need;
+      NEEDBITS(j)
+      t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
+      DUMPBITS(t->bits)
+      e = (uInt)(t->exop);
+      if (e & 16)               /* distance */
+      {
+        c->sub.copy.get = e & 15;
+        c->sub.copy.dist = t->base;
+        c->mode = DISTEXT;
+        break;
+      }
+      if ((e & 64) == 0)        /* next table */
+      {
+        c->sub.code.need = e;
+        c->sub.code.tree = t + t->base;
+        break;
+      }
+      c->mode = BADCODE;        /* invalid code */
+      z->msg = (char*)"invalid distance code";
+      r = Z_DATA_ERROR;
+      LEAVE
+    case DISTEXT:       /* i: getting distance extra */
+      j = c->sub.copy.get;
+      NEEDBITS(j)
+      c->sub.copy.dist += (uInt)b & inflate_mask[j];
+      DUMPBITS(j)
+      Tracevv((stderr, "inflate:         distance %u\n", c->sub.copy.dist));
+      c->mode = COPY;
+    case COPY:          /* o: copying bytes in window, waiting for space */
+#ifndef __TURBOC__ /* Turbo C bug for following expression */
+      f = (uInt)(q - s->window) < c->sub.copy.dist ?
+          s->end - (c->sub.copy.dist - (q - s->window)) :
+          q - c->sub.copy.dist;
+#else
+      f = q - c->sub.copy.dist;
+      if ((uInt)(q - s->window) < c->sub.copy.dist)
+        f = s->end - (c->sub.copy.dist - (uInt)(q - s->window));
+#endif
+      while (c->len)
+      {
+        NEEDOUT
+        OUTBYTE(*f++)
+        if (f == s->end)
+          f = s->window;
+        c->len--;
+      }
+      c->mode = START;
+      break;
+    case LIT:           /* o: got literal, waiting for output space */
+      NEEDOUT
+      OUTBYTE(c->sub.lit)
+      c->mode = START;
+      break;
+    case WASH:          /* o: got eob, possibly more output */
+      if (k > 7)        /* return unused byte, if any */
+      {
+        Assert(k < 16, "inflate_codes grabbed too many bytes")
+        k -= 8;
+        n++;
+        p--;            /* can always return one */
+      }
+      FLUSH
+      if (s->read != s->write)
+        LEAVE
+      c->mode = END;
+    case END:
+      r = Z_STREAM_END;
+      LEAVE
+    case BADCODE:       /* x: got error */
+      r = Z_DATA_ERROR;
+      LEAVE
+    default:
+      r = Z_STREAM_ERROR;
+      LEAVE
+  }
+#ifdef NEED_DUMMY_RETURN
+  return Z_STREAM_ERROR;  /* Some dumb compilers complain without this */
+#endif
+}
+
+
+void inflate_codes_free(c, z)
+inflate_codes_statef *c;
+z_streamp z;
+{
+  ZFREE(z, c);
+  Tracev((stderr, "inflate:       codes free\n"));
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/infcodes.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/infcodes.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/infcodes.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,27 @@
+/* infcodes.h -- header to use infcodes.c
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+struct inflate_codes_state;
+typedef struct inflate_codes_state FAR inflate_codes_statef;
+
+extern inflate_codes_statef *inflate_codes_new OF((
+    uInt, uInt,
+    inflate_huft *, inflate_huft *,
+    z_streamp ));
+
+extern int inflate_codes OF((
+    inflate_blocks_statef *,
+    z_streamp ,
+    int));
+
+extern void inflate_codes_free OF((
+    inflate_codes_statef *,
+    z_streamp ));
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/inffast.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/inffast.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/inffast.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,170 @@
+/* inffast.c -- process literals and length/distance pairs fast
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "infblock.h"
+#include "infcodes.h"
+#include "infutil.h"
+#include "inffast.h"
+
+struct inflate_codes_state {int dummy;}; /* for buggy compilers */
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+/* macros for bit input with no checking and for returning unused bytes */
+#define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}
+#define UNGRAB {c=z->avail_in-n;c=(k>>3)<c?k>>3:c;n+=c;p-=c;k-=c<<3;}
+
+/* Called with number of bytes left to write in window at least 258
+   (the maximum string length) and number of input bytes available
+   at least ten.  The ten bytes are six bytes for the longest length/
+   distance pair plus four bytes for overloading the bit buffer. */
+
+int inflate_fast(bl, bd, tl, td, s, z)
+uInt bl, bd;
+inflate_huft *tl;
+inflate_huft *td; /* need separate declaration for Borland C++ */
+inflate_blocks_statef *s;
+z_streamp z;
+{
+  inflate_huft *t;      /* temporary pointer */
+  uInt e;               /* extra bits or operation */
+  uLong b;              /* bit buffer */
+  uInt k;               /* bits in bit buffer */
+  Bytef *p;             /* input data pointer */
+  uInt n;               /* bytes available there */
+  Bytef *q;             /* output window write pointer */
+  uInt m;               /* bytes to end of window or read pointer */
+  uInt ml;              /* mask for literal/length tree */
+  uInt md;              /* mask for distance tree */
+  uInt c;               /* bytes to copy */
+  uInt d;               /* distance back to copy from */
+  Bytef *r;             /* copy source pointer */
+
+  /* load input, output, bit values */
+  LOAD
+
+  /* initialize masks */
+  ml = inflate_mask[bl];
+  md = inflate_mask[bd];
+
+  /* do until not enough input or output space for fast loop */
+  do {                          /* assume called with m >= 258 && n >= 10 */
+    /* get literal/length code */
+    GRABBITS(20)                /* max bits for literal/length code */
+    if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
+    {
+      DUMPBITS(t->bits)
+      Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+                "inflate:         * literal '%c'\n" :
+                "inflate:         * literal 0x%02x\n", t->base));
+      *q++ = (Byte)t->base;
+      m--;
+      continue;
+    }
+    do {
+      DUMPBITS(t->bits)
+      if (e & 16)
+      {
+        /* get extra bits for length */
+        e &= 15;
+        c = t->base + ((uInt)b & inflate_mask[e]);
+        DUMPBITS(e)
+        Tracevv((stderr, "inflate:         * length %u\n", c));
+
+        /* decode distance base of block to copy */
+        GRABBITS(15);           /* max bits for distance code */
+        e = (t = td + ((uInt)b & md))->exop;
+        do {
+          DUMPBITS(t->bits)
+          if (e & 16)
+          {
+            /* get extra bits to add to distance base */
+            e &= 15;
+            GRABBITS(e)         /* get extra bits (up to 13) */
+            d = t->base + ((uInt)b & inflate_mask[e]);
+            DUMPBITS(e)
+            Tracevv((stderr, "inflate:         * distance %u\n", d));
+
+            /* do the copy */
+            m -= c;
+            if ((uInt)(q - s->window) >= d)     /* offset before dest */
+            {                                   /*  just copy */
+              r = q - d;
+              *q++ = *r++;  c--;        /* minimum count is three, */
+              *q++ = *r++;  c--;        /*  so unroll loop a little */
+            }
+            else                        /* else offset after destination */
+            {
+              e = d - (uInt)(q - s->window); /* bytes from offset to end */
+              r = s->end - e;           /* pointer to offset */
+              if (c > e)                /* if source crosses, */
+              {
+                c -= e;                 /* copy to end of window */
+                do {
+                  *q++ = *r++;
+                } while (--e);
+                r = s->window;          /* copy rest from start of window */
+              }
+            }
+            do {                        /* copy all or what's left */
+              *q++ = *r++;
+            } while (--c);
+            break;
+          }
+          else if ((e & 64) == 0)
+          {
+            t += t->base;
+            e = (t += ((uInt)b & inflate_mask[e]))->exop;
+          }
+          else
+          {
+            z->msg = (char*)"invalid distance code";
+            UNGRAB
+            UPDATE
+            return Z_DATA_ERROR;
+          }
+        } while (1);
+        break;
+      }
+      if ((e & 64) == 0)
+      {
+        t += t->base;
+        if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0)
+        {
+          DUMPBITS(t->bits)
+          Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+                    "inflate:         * literal '%c'\n" :
+                    "inflate:         * literal 0x%02x\n", t->base));
+          *q++ = (Byte)t->base;
+          m--;
+          break;
+        }
+      }
+      else if (e & 32)
+      {
+        Tracevv((stderr, "inflate:         * end of block\n"));
+        UNGRAB
+        UPDATE
+        return Z_STREAM_END;
+      }
+      else
+      {
+        z->msg = (char*)"invalid literal/length code";
+        UNGRAB
+        UPDATE
+        return Z_DATA_ERROR;
+      }
+    } while (1);
+  } while (m >= 258 && n >= 10);
+
+  /* not enough input or output--restore pointers and return */
+  UNGRAB
+  UPDATE
+  return Z_OK;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/inffast.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/inffast.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/inffast.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,17 @@
+/* inffast.h -- header to use inffast.c
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+extern int inflate_fast OF((
+    uInt,
+    uInt,
+    inflate_huft *,
+    inflate_huft *,
+    inflate_blocks_statef *,
+    z_streamp ));

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/inffixed.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/inffixed.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/inffixed.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,151 @@
+/* inffixed.h -- table for decoding fixed codes
+ * Generated automatically by the maketree.c program
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+local uInt fixed_bl = 9;
+local uInt fixed_bd = 5;
+local inflate_huft fixed_tl[] = {
+    {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
+    {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},
+    {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},
+    {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224},
+    {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144},
+    {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208},
+    {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176},
+    {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240},
+    {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
+    {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200},
+    {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168},
+    {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232},
+    {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152},
+    {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216},
+    {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184},
+    {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248},
+    {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
+    {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196},
+    {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164},
+    {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228},
+    {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148},
+    {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212},
+    {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180},
+    {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244},
+    {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
+    {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204},
+    {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172},
+    {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236},
+    {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156},
+    {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220},
+    {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188},
+    {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252},
+    {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
+    {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194},
+    {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162},
+    {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226},
+    {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146},
+    {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210},
+    {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178},
+    {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242},
+    {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
+    {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202},
+    {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170},
+    {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234},
+    {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154},
+    {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218},
+    {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186},
+    {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250},
+    {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
+    {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198},
+    {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166},
+    {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230},
+    {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150},
+    {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214},
+    {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182},
+    {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246},
+    {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
+    {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206},
+    {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174},
+    {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238},
+    {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158},
+    {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222},
+    {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190},
+    {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254},
+    {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
+    {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193},
+    {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161},
+    {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225},
+    {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145},
+    {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209},
+    {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177},
+    {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241},
+    {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
+    {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201},
+    {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169},
+    {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233},
+    {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153},
+    {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217},
+    {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185},
+    {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249},
+    {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
+    {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197},
+    {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165},
+    {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229},
+    {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149},
+    {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213},
+    {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181},
+    {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245},
+    {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
+    {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205},
+    {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173},
+    {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237},
+    {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157},
+    {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221},
+    {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189},
+    {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253},
+    {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
+    {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195},
+    {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163},
+    {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227},
+    {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147},
+    {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211},
+    {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179},
+    {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243},
+    {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
+    {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203},
+    {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171},
+    {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235},
+    {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155},
+    {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219},
+    {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187},
+    {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251},
+    {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
+    {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199},
+    {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167},
+    {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231},
+    {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151},
+    {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215},
+    {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183},
+    {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247},
+    {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
+    {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207},
+    {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175},
+    {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239},
+    {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159},
+    {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223},
+    {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},
+    {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}
+  };
+local inflate_huft fixed_td[] = {
+    {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},
+    {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},
+    {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},
+    {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577},
+    {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145},
+    {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577},
+    {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289},
+    {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}
+  };

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/inflate.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/inflate.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/inflate.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,366 @@
+/* inflate.c -- zlib interface to inflate modules
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+#include "zutil.h"
+#include "infblock.h"
+
+struct inflate_blocks_state {int dummy;}; /* for buggy compilers */
+
+typedef enum {
+      METHOD,   /* waiting for method byte */
+      FLAG,     /* waiting for flag byte */
+      DICT4,    /* four dictionary check bytes to go */
+      DICT3,    /* three dictionary check bytes to go */
+      DICT2,    /* two dictionary check bytes to go */
+      DICT1,    /* one dictionary check byte to go */
+      DICT0,    /* waiting for inflateSetDictionary */
+      BLOCKS,   /* decompressing blocks */
+      CHECK4,   /* four check bytes to go */
+      CHECK3,   /* three check bytes to go */
+      CHECK2,   /* two check bytes to go */
+      CHECK1,   /* one check byte to go */
+      DONE,     /* finished check, done */
+      BAD}      /* got an error--stay here */
+inflate_mode;
+
+/* inflate private state */
+struct internal_state {
+
+  /* mode */
+  inflate_mode  mode;   /* current inflate mode */
+
+  /* mode dependent information */
+  union {
+    uInt method;        /* if FLAGS, method byte */
+    struct {
+      uLong was;                /* computed check value */
+      uLong need;               /* stream check value */
+    } check;            /* if CHECK, check values to compare */
+    uInt marker;        /* if BAD, inflateSync's marker bytes count */
+  } sub;        /* submode */
+
+  /* mode independent information */
+  int  nowrap;          /* flag for no wrapper */
+  uInt wbits;           /* log2(window size)  (8..15, defaults to 15) */
+  inflate_blocks_statef 
+    *blocks;            /* current inflate_blocks state */
+
+};
+
+
+int ZEXPORT inflateReset(z)
+z_streamp z;
+{
+  if (z == Z_NULL || z->state == Z_NULL)
+    return Z_STREAM_ERROR;
+  z->total_in = z->total_out = 0;
+  z->msg = Z_NULL;
+  z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
+  inflate_blocks_reset(z->state->blocks, z, Z_NULL);
+  Tracev((stderr, "inflate: reset\n"));
+  return Z_OK;
+}
+
+
+int ZEXPORT inflateEnd(z)
+z_streamp z;
+{
+  if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
+    return Z_STREAM_ERROR;
+  if (z->state->blocks != Z_NULL)
+    inflate_blocks_free(z->state->blocks, z);
+  ZFREE(z, z->state);
+  z->state = Z_NULL;
+  Tracev((stderr, "inflate: end\n"));
+  return Z_OK;
+}
+
+
+int ZEXPORT inflateInit2_(z, w, version, stream_size)
+z_streamp z;
+int w;
+const char *version;
+int stream_size;
+{
+  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+      stream_size != sizeof(z_stream))
+      return Z_VERSION_ERROR;
+
+  /* initialize state */
+  if (z == Z_NULL)
+    return Z_STREAM_ERROR;
+  z->msg = Z_NULL;
+  if (z->zalloc == Z_NULL)
+  {
+    z->zalloc = zcalloc;
+    z->opaque = (voidpf)0;
+  }
+  if (z->zfree == Z_NULL) z->zfree = zcfree;
+  if ((z->state = (struct internal_state FAR *)
+       ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)
+    return Z_MEM_ERROR;
+  z->state->blocks = Z_NULL;
+
+  /* handle undocumented nowrap option (no zlib header or check) */
+  z->state->nowrap = 0;
+  if (w < 0)
+  {
+    w = - w;
+    z->state->nowrap = 1;
+  }
+
+  /* set window size */
+  if (w < 8 || w > 15)
+  {
+    inflateEnd(z);
+    return Z_STREAM_ERROR;
+  }
+  z->state->wbits = (uInt)w;
+
+  /* create inflate_blocks state */
+  if ((z->state->blocks =
+      inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w))
+      == Z_NULL)
+  {
+    inflateEnd(z);
+    return Z_MEM_ERROR;
+  }
+  Tracev((stderr, "inflate: allocated\n"));
+
+  /* reset state */
+  inflateReset(z);
+  return Z_OK;
+}
+
+
+int ZEXPORT inflateInit_(z, version, stream_size)
+z_streamp z;
+const char *version;
+int stream_size;
+{
+  return inflateInit2_(z, DEF_WBITS, version, stream_size);
+}
+
+
+#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
+#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
+
+int ZEXPORT inflate(z, f)
+z_streamp z;
+int f;
+{
+  int r;
+  uInt b;
+
+  if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL)
+    return Z_STREAM_ERROR;
+  f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
+  r = Z_BUF_ERROR;
+  while (1) switch (z->state->mode)
+  {
+    case METHOD:
+      NEEDBYTE
+      if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)
+      {
+        z->state->mode = BAD;
+        z->msg = (char*)"unknown compression method";
+        z->state->sub.marker = 5;       /* can't try inflateSync */
+        break;
+      }
+      if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
+      {
+        z->state->mode = BAD;
+        z->msg = (char*)"invalid window size";
+        z->state->sub.marker = 5;       /* can't try inflateSync */
+        break;
+      }
+      z->state->mode = FLAG;
+    case FLAG:
+      NEEDBYTE
+      b = NEXTBYTE;
+      if (((z->state->sub.method << 8) + b) % 31)
+      {
+        z->state->mode = BAD;
+        z->msg = (char*)"incorrect header check";
+        z->state->sub.marker = 5;       /* can't try inflateSync */
+        break;
+      }
+      Tracev((stderr, "inflate: zlib header ok\n"));
+      if (!(b & PRESET_DICT))
+      {
+        z->state->mode = BLOCKS;
+        break;
+      }
+      z->state->mode = DICT4;
+    case DICT4:
+      NEEDBYTE
+      z->state->sub.check.need = (uLong)NEXTBYTE << 24;
+      z->state->mode = DICT3;
+    case DICT3:
+      NEEDBYTE
+      z->state->sub.check.need += (uLong)NEXTBYTE << 16;
+      z->state->mode = DICT2;
+    case DICT2:
+      NEEDBYTE
+      z->state->sub.check.need += (uLong)NEXTBYTE << 8;
+      z->state->mode = DICT1;
+    case DICT1:
+      NEEDBYTE
+      z->state->sub.check.need += (uLong)NEXTBYTE;
+      z->adler = z->state->sub.check.need;
+      z->state->mode = DICT0;
+      return Z_NEED_DICT;
+    case DICT0:
+      z->state->mode = BAD;
+      z->msg = (char*)"need dictionary";
+      z->state->sub.marker = 0;       /* can try inflateSync */
+      return Z_STREAM_ERROR;
+    case BLOCKS:
+      r = inflate_blocks(z->state->blocks, z, r);
+      if (r == Z_DATA_ERROR)
+      {
+        z->state->mode = BAD;
+        z->state->sub.marker = 0;       /* can try inflateSync */
+        break;
+      }
+      if (r == Z_OK)
+        r = f;
+      if (r != Z_STREAM_END)
+        return r;
+      r = f;
+      inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);
+      if (z->state->nowrap)
+      {
+        z->state->mode = DONE;
+        break;
+      }
+      z->state->mode = CHECK4;
+    case CHECK4:
+      NEEDBYTE
+      z->state->sub.check.need = (uLong)NEXTBYTE << 24;
+      z->state->mode = CHECK3;
+    case CHECK3:
+      NEEDBYTE
+      z->state->sub.check.need += (uLong)NEXTBYTE << 16;
+      z->state->mode = CHECK2;
+    case CHECK2:
+      NEEDBYTE
+      z->state->sub.check.need += (uLong)NEXTBYTE << 8;
+      z->state->mode = CHECK1;
+    case CHECK1:
+      NEEDBYTE
+      z->state->sub.check.need += (uLong)NEXTBYTE;
+
+      if (z->state->sub.check.was != z->state->sub.check.need)
+      {
+        z->state->mode = BAD;
+        z->msg = (char*)"incorrect data check";
+        z->state->sub.marker = 5;       /* can't try inflateSync */
+        break;
+      }
+      Tracev((stderr, "inflate: zlib check ok\n"));
+      z->state->mode = DONE;
+    case DONE:
+      return Z_STREAM_END;
+    case BAD:
+      return Z_DATA_ERROR;
+    default:
+      return Z_STREAM_ERROR;
+  }
+#ifdef NEED_DUMMY_RETURN
+  return Z_STREAM_ERROR;  /* Some dumb compilers complain without this */
+#endif
+}
+
+
+int ZEXPORT inflateSetDictionary(z, dictionary, dictLength)
+z_streamp z;
+const Bytef *dictionary;
+uInt  dictLength;
+{
+  uInt length = dictLength;
+
+  if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0)
+    return Z_STREAM_ERROR;
+
+  if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR;
+  z->adler = 1L;
+
+  if (length >= ((uInt)1<<z->state->wbits))
+  {
+    length = (1<<z->state->wbits)-1;
+    dictionary += dictLength - length;
+  }
+  inflate_set_dictionary(z->state->blocks, dictionary, length);
+  z->state->mode = BLOCKS;
+  return Z_OK;
+}
+
+
+int ZEXPORT inflateSync(z)
+z_streamp z;
+{
+  uInt n;       /* number of bytes to look at */
+  Bytef *p;     /* pointer to bytes */
+  uInt m;       /* number of marker bytes found in a row */
+  uLong r, w;   /* temporaries to save total_in and total_out */
+
+  /* set up */
+  if (z == Z_NULL || z->state == Z_NULL)
+    return Z_STREAM_ERROR;
+  if (z->state->mode != BAD)
+  {
+    z->state->mode = BAD;
+    z->state->sub.marker = 0;
+  }
+  if ((n = z->avail_in) == 0)
+    return Z_BUF_ERROR;
+  p = z->next_in;
+  m = z->state->sub.marker;
+
+  /* search */
+  while (n && m < 4)
+  {
+    static const Byte mark[4] = {0, 0, 0xff, 0xff};
+    if (*p == mark[m])
+      m++;
+    else if (*p)
+      m = 0;
+    else
+      m = 4 - m;
+    p++, n--;
+  }
+
+  /* restore */
+  z->total_in += p - z->next_in;
+  z->next_in = p;
+  z->avail_in = n;
+  z->state->sub.marker = m;
+
+  /* return no joy or set up to restart on a new block */
+  if (m != 4)
+    return Z_DATA_ERROR;
+  r = z->total_in;  w = z->total_out;
+  inflateReset(z);
+  z->total_in = r;  z->total_out = w;
+  z->state->mode = BLOCKS;
+  return Z_OK;
+}
+
+
+/* Returns true if inflate is currently at the end of a block generated
+ * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
+ * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH
+ * but removes the length bytes of the resulting empty stored block. When
+ * decompressing, PPP checks that at the end of input packet, inflate is
+ * waiting for these length bytes.
+ */
+int ZEXPORT inflateSyncPoint(z)
+z_streamp z;
+{
+  if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
+    return Z_STREAM_ERROR;
+  return inflate_blocks_sync_point(z->state->blocks);
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/inftrees.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/inftrees.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/inftrees.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,455 @@
+/* inftrees.c -- generate Huffman trees for efficient decoding
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+
+#if !defined(BUILDFIXED) && !defined(STDC)
+#  define BUILDFIXED   /* non ANSI compilers may not accept inffixed.h */
+#endif
+
+const char inflate_copyright[] =
+   " inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
+/*
+  If you use the zlib library in a product, an acknowledgment is welcome
+  in the documentation of your product. If for some reason you cannot
+  include such an acknowledgment, I would appreciate that you keep this
+  copyright string in the executable of your product.
+ */
+struct internal_state  {int dummy;}; /* for buggy compilers */
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+
+local int huft_build OF((
+    uIntf *,            /* code lengths in bits */
+    uInt,               /* number of codes */
+    uInt,               /* number of "simple" codes */
+    const uIntf *,      /* list of base values for non-simple codes */
+    const uIntf *,      /* list of extra bits for non-simple codes */
+    inflate_huft * FAR*,/* result: starting table */
+    uIntf *,            /* maximum lookup bits (returns actual) */
+    inflate_huft *,     /* space for trees */
+    uInt *,             /* hufts used in space */
+    uIntf * ));         /* space for values */
+
+/* Tables for deflate from PKZIP's appnote.txt. */
+local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
+        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
+        /* see note #13 above about 258 */
+local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */
+        0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
+        3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */
+local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */
+        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
+        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+        8193, 12289, 16385, 24577};
+local const uInt cpdext[30] = { /* Extra bits for distance codes */
+        0, 0, 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};
+
+/*
+   Huffman code decoding is performed using a multi-level table lookup.
+   The fastest way to decode is to simply build a lookup table whose
+   size is determined by the longest code.  However, the time it takes
+   to build this table can also be a factor if the data being decoded
+   is not very long.  The most common codes are necessarily the
+   shortest codes, so those codes dominate the decoding time, and hence
+   the speed.  The idea is you can have a shorter table that decodes the
+   shorter, more probable codes, and then point to subsidiary tables for
+   the longer codes.  The time it costs to decode the longer codes is
+   then traded against the time it takes to make longer tables.
+
+   This results of this trade are in the variables lbits and dbits
+   below.  lbits is the number of bits the first level table for literal/
+   length codes can decode in one step, and dbits is the same thing for
+   the distance codes.  Subsequent tables are also less than or equal to
+   those sizes.  These values may be adjusted either when all of the
+   codes are shorter than that, in which case the longest code length in
+   bits is used, or when the shortest code is *longer* than the requested
+   table size, in which case the length of the shortest code in bits is
+   used.
+
+   There are two different values for the two tables, since they code a
+   different number of possibilities each.  The literal/length table
+   codes 286 possible values, or in a flat code, a little over eight
+   bits.  The distance table codes 30 possible values, or a little less
+   than five bits, flat.  The optimum values for speed end up being
+   about one bit more than those, so lbits is 8+1 and dbits is 5+1.
+   The optimum values may differ though from machine to machine, and
+   possibly even between compilers.  Your mileage may vary.
+ */
+
+
+/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
+#define BMAX 15         /* maximum bit length of any code */
+
+local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
+uIntf *b;               /* code lengths in bits (all assumed <= BMAX) */
+uInt n;                 /* number of codes (assumed <= 288) */
+uInt s;                 /* number of simple-valued codes (0..s-1) */
+const uIntf *d;         /* list of base values for non-simple codes */
+const uIntf *e;         /* list of extra bits for non-simple codes */
+inflate_huft * FAR *t;  /* result: starting table */
+uIntf *m;               /* maximum lookup bits, returns actual */
+inflate_huft *hp;       /* space for trees */
+uInt *hn;               /* hufts used in space */
+uIntf *v;               /* working area: values in order of bit length */
+/* Given a list of code lengths and a maximum table size, make a set of
+   tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR
+   if the given code set is incomplete (the tables are still built in this
+   case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of
+   lengths), or Z_MEM_ERROR if not enough memory. */
+{
+
+  uInt a;                       /* counter for codes of length k */
+  uInt c[BMAX+1];               /* bit length count table */
+  uInt f;                       /* i repeats in table every f entries */
+  int g;                        /* maximum code length */
+  int h;                        /* table level */
+  register uInt i;              /* counter, current code */
+  register uInt j;              /* counter */
+  register int k;               /* number of bits in current code */
+  int l;                        /* bits per table (returned in m) */
+  uInt mask;                    /* (1 << w) - 1, to avoid cc -O bug on HP */
+  register uIntf *p;            /* pointer into c[], b[], or v[] */
+  inflate_huft *q;              /* points to current table */
+  struct inflate_huft_s r;      /* table entry for structure assignment */
+  inflate_huft *u[BMAX];        /* table stack */
+  register int w;               /* bits before this table == (l * h) */
+  uInt x[BMAX+1];               /* bit offsets, then code stack */
+  uIntf *xp;                    /* pointer into x */
+  int y;                        /* number of dummy codes added */
+  uInt z;                       /* number of entries in current table */
+
+
+  /* Generate counts for each bit length */
+  p = c;
+#define C0 *p++ = 0;
+#define C2 C0 C0 C0 C0
+#define C4 C2 C2 C2 C2
+  C4                            /* clear c[]--assume BMAX+1 is 16 */
+  p = b;  i = n;
+  do {
+    c[*p++]++;                  /* assume all entries <= BMAX */
+  } while (--i);
+  if (c[0] == n)                /* null input--all zero length codes */
+  {
+    *t = (inflate_huft *)Z_NULL;
+    *m = 0;
+    return Z_OK;
+  }
+
+
+  /* Find minimum and maximum length, bound *m by those */
+  l = *m;
+  for (j = 1; j <= BMAX; j++)
+    if (c[j])
+      break;
+  k = j;                        /* minimum code length */
+  if ((uInt)l < j)
+    l = j;
+  for (i = BMAX; i; i--)
+    if (c[i])
+      break;
+  g = i;                        /* maximum code length */
+  if ((uInt)l > i)
+    l = i;
+  *m = l;
+
+
+  /* Adjust last length count to fill out codes, if needed */
+  for (y = 1 << j; j < i; j++, y <<= 1)
+    if ((y -= c[j]) < 0)
+      return Z_DATA_ERROR;
+  if ((y -= c[i]) < 0)
+    return Z_DATA_ERROR;
+  c[i] += y;
+
+
+  /* Generate starting offsets into the value table for each length */
+  x[1] = j = 0;
+  p = c + 1;  xp = x + 2;
+  while (--i) {                 /* note that i == g from above */
+    *xp++ = (j += *p++);
+  }
+
+
+  /* Make a table of values in order of bit lengths */
+  p = b;  i = 0;
+  do {
+    if ((j = *p++) != 0)
+      v[x[j]++] = i;
+  } while (++i < n);
+  n = x[g];                     /* set n to length of v */
+
+
+  /* Generate the Huffman codes and for each, make the table entries */
+  x[0] = i = 0;                 /* first Huffman code is zero */
+  p = v;                        /* grab values in bit order */
+  h = -1;                       /* no tables yet--level -1 */
+  w = -l;                       /* bits decoded == (l * h) */
+  u[0] = (inflate_huft *)Z_NULL;        /* just to keep compilers happy */
+  q = (inflate_huft *)Z_NULL;   /* ditto */
+  z = 0;                        /* ditto */
+
+  /* go through the bit lengths (k already is bits in shortest code) */
+  for (; k <= g; k++)
+  {
+    a = c[k];
+    while (a--)
+    {
+      /* here i is the Huffman code of length k bits for value *p */
+      /* make tables up to required level */
+      while (k > w + l)
+      {
+        h++;
+        w += l;                 /* previous table always l bits */
+
+        /* compute minimum size table less than or equal to l bits */
+        z = g - w;
+        z = z > (uInt)l ? l : z;        /* table size upper limit */
+        if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */
+        {                       /* too few codes for k-w bit table */
+          f -= a + 1;           /* deduct codes from patterns left */
+          xp = c + k;
+          if (j < z)
+            while (++j < z)     /* try smaller tables up to z bits */
+            {
+              if ((f <<= 1) <= *++xp)
+                break;          /* enough codes to use up j bits */
+              f -= *xp;         /* else deduct codes from patterns */
+            }
+        }
+        z = 1 << j;             /* table entries for j-bit table */
+
+        /* allocate new table */
+        if (*hn + z > MANY)     /* (note: doesn't matter for fixed) */
+          return Z_MEM_ERROR;   /* not enough memory */
+        u[h] = q = hp + *hn;
+        *hn += z;
+
+        /* connect to last table, if there is one */
+        if (h)
+        {
+          x[h] = i;             /* save pattern for backing up */
+          r.bits = (Byte)l;     /* bits to dump before this table */
+          r.exop = (Byte)j;     /* bits in this table */
+          j = i >> (w - l);
+          r.base = (uInt)(q - u[h-1] - j);   /* offset to this table */
+          u[h-1][j] = r;        /* connect to last table */
+        }
+        else
+          *t = q;               /* first table is returned result */
+      }
+
+      /* set up table entry in r */
+      r.bits = (Byte)(k - w);
+      if (p >= v + n)
+        r.exop = 128 + 64;      /* out of values--invalid code */
+      else if (*p < s)
+      {
+        r.exop = (Byte)(*p < 256 ? 0 : 32 + 64);     /* 256 is end-of-block */
+        r.base = *p++;          /* simple code is just the value */
+      }
+      else
+      {
+        r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */
+        r.base = d[*p++ - s];
+      }
+
+      /* fill code-like entries with r */
+      f = 1 << (k - w);
+      for (j = i >> w; j < z; j += f)
+        q[j] = r;
+
+      /* backwards increment the k-bit code i */
+      for (j = 1 << (k - 1); i & j; j >>= 1)
+        i ^= j;
+      i ^= j;
+
+      /* backup over finished tables */
+      mask = (1 << w) - 1;      /* needed on HP, cc -O bug */
+      while ((i & mask) != x[h])
+      {
+        h--;                    /* don't need to update q */
+        w -= l;
+        mask = (1 << w) - 1;
+      }
+    }
+  }
+
+
+  /* Return Z_BUF_ERROR if we were given an incomplete table */
+  return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
+}
+
+
+int inflate_trees_bits(c, bb, tb, hp, z)
+uIntf *c;               /* 19 code lengths */
+uIntf *bb;              /* bits tree desired/actual depth */
+inflate_huft * FAR *tb; /* bits tree result */
+inflate_huft *hp;       /* space for trees */
+z_streamp z;            /* for messages */
+{
+  int r;
+  uInt hn = 0;          /* hufts used in space */
+  uIntf *v;             /* work area for huft_build */
+
+  if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL)
+    return Z_MEM_ERROR;
+  r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,
+                 tb, bb, hp, &hn, v);
+  if (r == Z_DATA_ERROR)
+    z->msg = (char*)"oversubscribed dynamic bit lengths tree";
+  else if (r == Z_BUF_ERROR || *bb == 0)
+  {
+    z->msg = (char*)"incomplete dynamic bit lengths tree";
+    r = Z_DATA_ERROR;
+  }
+  ZFREE(z, v);
+  return r;
+}
+
+
+int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
+uInt nl;                /* number of literal/length codes */
+uInt nd;                /* number of distance codes */
+uIntf *c;               /* that many (total) code lengths */
+uIntf *bl;              /* literal desired/actual bit depth */
+uIntf *bd;              /* distance desired/actual bit depth */
+inflate_huft * FAR *tl; /* literal/length tree result */
+inflate_huft * FAR *td; /* distance tree result */
+inflate_huft *hp;       /* space for trees */
+z_streamp z;            /* for messages */
+{
+  int r;
+  uInt hn = 0;          /* hufts used in space */
+  uIntf *v;             /* work area for huft_build */
+
+  /* allocate work area */
+  if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
+    return Z_MEM_ERROR;
+
+  /* build literal/length tree */
+  r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v);
+  if (r != Z_OK || *bl == 0)
+  {
+    if (r == Z_DATA_ERROR)
+      z->msg = (char*)"oversubscribed literal/length tree";
+    else if (r != Z_MEM_ERROR)
+    {
+      z->msg = (char*)"incomplete literal/length tree";
+      r = Z_DATA_ERROR;
+    }
+    ZFREE(z, v);
+    return r;
+  }
+
+  /* build distance tree */
+  r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v);
+  if (r != Z_OK || (*bd == 0 && nl > 257))
+  {
+    if (r == Z_DATA_ERROR)
+      z->msg = (char*)"oversubscribed distance tree";
+    else if (r == Z_BUF_ERROR) {
+#ifdef PKZIP_BUG_WORKAROUND
+      r = Z_OK;
+    }
+#else
+      z->msg = (char*)"incomplete distance tree";
+      r = Z_DATA_ERROR;
+    }
+    else if (r != Z_MEM_ERROR)
+    {
+      z->msg = (char*)"empty distance tree with lengths";
+      r = Z_DATA_ERROR;
+    }
+    ZFREE(z, v);
+    return r;
+#endif
+  }
+
+  /* done */
+  ZFREE(z, v);
+  return Z_OK;
+}
+
+
+/* build fixed tables only once--keep them here */
+#ifdef BUILDFIXED
+local int fixed_built = 0;
+#define FIXEDH 544      /* number of hufts used by fixed tables */
+local inflate_huft fixed_mem[FIXEDH];
+local uInt fixed_bl;
+local uInt fixed_bd;
+local inflate_huft *fixed_tl;
+local inflate_huft *fixed_td;
+#else
+#include "inffixed.h"
+#endif
+
+
+int inflate_trees_fixed(bl, bd, tl, td, z)
+uIntf *bl;               /* literal desired/actual bit depth */
+uIntf *bd;               /* distance desired/actual bit depth */
+inflate_huft * FAR *tl;  /* literal/length tree result */
+inflate_huft * FAR *td;  /* distance tree result */
+z_streamp z;             /* for memory allocation */
+{
+#ifdef BUILDFIXED
+  /* build fixed tables if not already */
+  if (!fixed_built)
+  {
+    int k;              /* temporary variable */
+    uInt f = 0;         /* number of hufts used in fixed_mem */
+    uIntf *c;           /* length list for huft_build */
+    uIntf *v;           /* work area for huft_build */
+
+    /* allocate memory */
+    if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
+      return Z_MEM_ERROR;
+    if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
+    {
+      ZFREE(z, c);
+      return Z_MEM_ERROR;
+    }
+
+    /* literal table */
+    for (k = 0; k < 144; k++)
+      c[k] = 8;
+    for (; k < 256; k++)
+      c[k] = 9;
+    for (; k < 280; k++)
+      c[k] = 7;
+    for (; k < 288; k++)
+      c[k] = 8;
+    fixed_bl = 9;
+    huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl,
+               fixed_mem, &f, v);
+
+    /* distance table */
+    for (k = 0; k < 30; k++)
+      c[k] = 5;
+    fixed_bd = 5;
+    huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd,
+               fixed_mem, &f, v);
+
+    /* done */
+    ZFREE(z, v);
+    ZFREE(z, c);
+    fixed_built = 1;
+  }
+#endif
+  *bl = fixed_bl;
+  *bd = fixed_bd;
+  *tl = fixed_tl;
+  *td = fixed_td;
+  return Z_OK;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/inftrees.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/inftrees.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/inftrees.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,58 @@
+/* inftrees.h -- header to use inftrees.c
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* Huffman code lookup table entry--this entry is four bytes for machines
+   that have 16-bit pointers (e.g. PC's in the small or medium model). */
+
+typedef struct inflate_huft_s FAR inflate_huft;
+
+struct inflate_huft_s {
+  union {
+    struct {
+      Byte Exop;        /* number of extra bits or operation */
+      Byte Bits;        /* number of bits in this code or subcode */
+    } what;
+    uInt pad;           /* pad structure to a power of 2 (4 bytes for */
+  } word;               /*  16-bit, 8 bytes for 32-bit int's) */
+  uInt base;            /* literal, length base, distance base,
+                           or table offset */
+};
+
+/* Maximum size of dynamic tree.  The maximum found in a long but non-
+   exhaustive search was 1004 huft structures (850 for length/literals
+   and 154 for distances, the latter actually the result of an
+   exhaustive search).  The actual maximum is not known, but the
+   value below is more than safe. */
+#define MANY 1440
+
+extern int inflate_trees_bits OF((
+    uIntf *,                    /* 19 code lengths */
+    uIntf *,                    /* bits tree desired/actual depth */
+    inflate_huft * FAR *,       /* bits tree result */
+    inflate_huft *,             /* space for trees */
+    z_streamp));                /* for messages */
+
+extern int inflate_trees_dynamic OF((
+    uInt,                       /* number of literal/length codes */
+    uInt,                       /* number of distance codes */
+    uIntf *,                    /* that many (total) code lengths */
+    uIntf *,                    /* literal desired/actual bit depth */
+    uIntf *,                    /* distance desired/actual bit depth */
+    inflate_huft * FAR *,       /* literal/length tree result */
+    inflate_huft * FAR *,       /* distance tree result */
+    inflate_huft *,             /* space for trees */
+    z_streamp));                /* for messages */
+
+extern int inflate_trees_fixed OF((
+    uIntf *,                    /* literal desired/actual bit depth */
+    uIntf *,                    /* distance desired/actual bit depth */
+    inflate_huft * FAR *,       /* literal/length tree result */
+    inflate_huft * FAR *,       /* distance tree result */
+    z_streamp));                /* for memory allocation */

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/infutil.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/infutil.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/infutil.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,87 @@
+/* inflate_util.c -- data and routines common to blocks and codes
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+#include "zutil.h"
+#include "infblock.h"
+#include "inftrees.h"
+#include "infcodes.h"
+#include "infutil.h"
+
+struct inflate_codes_state {int dummy;}; /* for buggy compilers */
+
+/* And'ing with mask[n] masks the lower n bits */
+uInt inflate_mask[17] = {
+    0x0000,
+    0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
+    0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
+};
+
+
+/* copy as much as possible from the sliding window to the output area */
+int inflate_flush(s, z, r)
+inflate_blocks_statef *s;
+z_streamp z;
+int r;
+{
+  uInt n;
+  Bytef *p;
+  Bytef *q;
+
+  /* local copies of source and destination pointers */
+  p = z->next_out;
+  q = s->read;
+
+  /* compute number of bytes to copy as far as end of window */
+  n = (uInt)((q <= s->write ? s->write : s->end) - q);
+  if (n > z->avail_out) n = z->avail_out;
+  if (n && r == Z_BUF_ERROR) r = Z_OK;
+
+  /* update counters */
+  z->avail_out -= n;
+  z->total_out += n;
+
+  /* update check information */
+  if (s->checkfn != Z_NULL)
+    z->adler = s->check = (*s->checkfn)(s->check, q, n);
+
+  /* copy as far as end of window */
+  zmemcpy(p, q, n);
+  p += n;
+  q += n;
+
+  /* see if more to copy at beginning of window */
+  if (q == s->end)
+  {
+    /* wrap pointers */
+    q = s->window;
+    if (s->write == s->end)
+      s->write = s->window;
+
+    /* compute bytes to copy */
+    n = (uInt)(s->write - q);
+    if (n > z->avail_out) n = z->avail_out;
+    if (n && r == Z_BUF_ERROR) r = Z_OK;
+
+    /* update counters */
+    z->avail_out -= n;
+    z->total_out += n;
+
+    /* update check information */
+    if (s->checkfn != Z_NULL)
+      z->adler = s->check = (*s->checkfn)(s->check, q, n);
+
+    /* copy */
+    zmemcpy(p, q, n);
+    p += n;
+    q += n;
+  }
+
+  /* update pointers */
+  z->next_out = p;
+  s->read = q;
+
+  /* done */
+  return r;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/infutil.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/infutil.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/infutil.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,98 @@
+/* infutil.h -- types and macros common to blocks and codes
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+#ifndef _INFUTIL_H
+#define _INFUTIL_H
+
+typedef enum {
+      TYPE,     /* get type bits (3, including end bit) */
+      LENS,     /* get lengths for stored */
+      STORED,   /* processing stored block */
+      TABLE,    /* get table lengths */
+      BTREE,    /* get bit lengths tree for a dynamic block */
+      DTREE,    /* get length, distance trees for a dynamic block */
+      CODES,    /* processing fixed or dynamic block */
+      DRY,      /* output remaining window bytes */
+      DONE,     /* finished last block, done */
+      BAD}      /* got a data error--stuck here */
+inflate_block_mode;
+
+/* inflate blocks semi-private state */
+struct inflate_blocks_state {
+
+  /* mode */
+  inflate_block_mode  mode;     /* current inflate_block mode */
+
+  /* mode dependent information */
+  union {
+    uInt left;          /* if STORED, bytes left to copy */
+    struct {
+      uInt table;               /* table lengths (14 bits) */
+      uInt index;               /* index into blens (or border) */
+      uIntf *blens;             /* bit lengths of codes */
+      uInt bb;                  /* bit length tree depth */
+      inflate_huft *tb;         /* bit length decoding tree */
+    } trees;            /* if DTREE, decoding info for trees */
+    struct {
+      inflate_codes_statef 
+         *codes;
+    } decode;           /* if CODES, current state */
+  } sub;                /* submode */
+  uInt last;            /* true if this block is the last block */
+
+  /* mode independent information */
+  uInt bitk;            /* bits in bit buffer */
+  uLong bitb;           /* bit buffer */
+  inflate_huft *hufts;  /* single malloc for tree space */
+  Bytef *window;        /* sliding window */
+  Bytef *end;           /* one byte after sliding window */
+  Bytef *read;          /* window read pointer */
+  Bytef *write;         /* window write pointer */
+  check_func checkfn;   /* check function */
+  uLong check;          /* check on output */
+
+};
+
+
+/* defines for inflate input/output */
+/*   update pointers and return */
+#define UPDBITS {s->bitb=b;s->bitk=k;}
+#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
+#define UPDOUT {s->write=q;}
+#define UPDATE {UPDBITS UPDIN UPDOUT}
+#define LEAVE {UPDATE return inflate_flush(s,z,r);}
+/*   get bytes and bits */
+#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
+#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
+#define NEXTBYTE (n--,*p++)
+#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
+#define DUMPBITS(j) {b>>=(j);k-=(j);}
+/*   output bytes */
+#define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
+#define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
+#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
+#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
+#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
+#define OUTBYTE(a) {*q++=(Byte)(a);m--;}
+/*   load local pointers */
+#define LOAD {LOADIN LOADOUT}
+
+/* masks for lower bits (size given to avoid silly warnings with Visual C++) */
+extern uInt inflate_mask[17];
+
+/* copy as much as possible from the sliding window to the output area */
+extern int inflate_flush OF((
+    inflate_blocks_statef *,
+    z_streamp ,
+    int));
+
+struct internal_state      {int dummy;}; /* for buggy compilers */
+
+#endif

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/maketree.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/maketree.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/maketree.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,85 @@
+/* maketree.c -- make inffixed.h table for decoding fixed codes
+ * Copyright (C) 1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* This program is included in the distribution for completeness.
+   You do not need to compile or run this program since inffixed.h
+   is already included in the distribution.  To use this program
+   you need to compile zlib with BUILDFIXED defined and then compile
+   and link this program with the zlib library.  Then the output of
+   this program can be piped to inffixed.h. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "zutil.h"
+#include "inftrees.h"
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+/* generate initialization table for an inflate_huft structure array */
+void maketree(uInt b, inflate_huft *t)
+{
+  int i, e;
+
+  i = 0;
+  while (1)
+  {
+    e = t[i].exop;
+    if (e && (e & (16+64)) == 0)        /* table pointer */
+    {
+      fprintf(stderr, "maketree: cannot initialize sub-tables!\n");
+      exit(1);
+    }
+    if (i % 4 == 0)
+      printf("\n   ");
+    printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base);
+    if (++i == (1<<b))
+      break;
+    putchar(',');
+  }
+  puts("");
+}
+
+/* create the fixed tables in C initialization syntax */
+void main(void)
+{
+  int r;
+  uInt bl, bd;
+  inflate_huft *tl, *td;
+  z_stream z;
+
+  z.zalloc = zcalloc;
+  z.opaque = (voidpf)0;
+  z.zfree = zcfree;
+  r = inflate_trees_fixed(&bl, &bd, &tl, &td, &z);
+  if (r)
+  {
+    fprintf(stderr, "inflate_trees_fixed error %d\n", r);
+    return;
+  }
+  puts("/* inffixed.h -- table for decoding fixed codes");
+  puts(" * Generated automatically by the maketree.c program");
+  puts(" */");
+  puts("");
+  puts("/* WARNING: this file should *not* be used by applications. It is");
+  puts("   part of the implementation of the compression library and is");
+  puts("   subject to change. Applications should only use zlib.h.");
+  puts(" */");
+  puts("");
+  printf("local uInt fixed_bl = %d;\n", bl);
+  printf("local uInt fixed_bd = %d;\n", bd);
+  printf("local inflate_huft fixed_tl[] = {");
+  maketree(bl, tl);
+  puts("  };");
+  printf("local inflate_huft fixed_td[] = {");
+  maketree(bd, td);
+  puts("  };");
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/minigzip.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/minigzip.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/minigzip.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,320 @@
+/* minigzip.c -- simulate gzip using the zlib compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/*
+ * minigzip is a minimal implementation of the gzip utility. This is
+ * only an example of using zlib and isn't meant to replace the
+ * full-featured gzip. No attempt is made to deal with file systems
+ * limiting names to 14 or 8+3 characters, etc... Error checking is
+ * very limited. So use minigzip only for testing; use gzip for the
+ * real thing. On MSDOS, use only on file names without extension
+ * or in pipe mode.
+ */
+
+/* @(#) $Id: minigzip.c,v 1.6 1998/12/18 21:38:47 koziol Exp $ */
+
+#include <stdio.h>
+#include "zlib.h"
+
+#ifdef STDC
+#  include <string.h>
+#  include <stdlib.h>
+#else
+   extern void exit  OF((int));
+#endif
+
+#ifdef USE_MMAP
+#  include <sys/types.h>
+#  include <sys/mman.h>
+#  include <sys/stat.h>
+#endif
+
+#if defined(MSDOS) || defined(OS2) || defined(WIN32)
+#  include <fcntl.h>
+#  include <io.h>
+#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
+#else
+#  define SET_BINARY_MODE(file)
+#endif
+
+#ifdef VMS
+#  define unlink delete
+#  define GZ_SUFFIX "-gz"
+#endif
+#ifdef RISCOS
+#  define unlink remove
+#  define GZ_SUFFIX "-gz"
+#  define fileno(file) file->__file
+#endif
+#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+#  include <unix.h> /* for fileno */
+#endif
+
+#ifndef WIN32 /* unlink already in stdio.h for WIN32 */
+  extern int unlink OF((const char *));
+#endif
+
+#ifndef GZ_SUFFIX
+#  define GZ_SUFFIX ".gz"
+#endif
+#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1)
+
+#define BUFLEN      16384
+#define MAX_NAME_LEN 1024
+
+#ifdef MAXSEG_64K
+#  define local static
+   /* Needed for systems with limitation on stack size. */
+#else
+#  define local
+#endif
+
+char *prog;
+
+void error            OF((const char *msg));
+void gz_compress      OF((FILE   *in, gzFile out));
+#ifdef USE_MMAP
+int  gz_compress_mmap OF((FILE   *in, gzFile out));
+#endif
+void gz_uncompress    OF((gzFile in, FILE   *out));
+void file_compress    OF((char  *file, char *mode));
+void file_uncompress  OF((char  *file));
+int  main             OF((int argc, char *argv[]));
+
+/* ===========================================================================
+ * Display error message and exit
+ */
+void error(msg)
+    const char *msg;
+{
+    fprintf(stderr, "%s: %s\n", prog, msg);
+    exit(1);
+}
+
+/* ===========================================================================
+ * Compress input to output then close both files.
+ */
+
+void gz_compress(in, out)
+    FILE   *in;
+    gzFile out;
+{
+    local char buf[BUFLEN];
+    int len;
+    int err;
+
+#ifdef USE_MMAP
+    /* Try first compressing with mmap. If mmap fails (minigzip used in a
+     * pipe), use the normal fread loop.
+     */
+    if (gz_compress_mmap(in, out) == Z_OK) return;
+#endif
+    for (;;) {
+        len = fread(buf, 1, sizeof(buf), in);
+        if (ferror(in)) {
+            perror("fread");
+            exit(1);
+        }
+        if (len == 0) break;
+
+        if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err));
+    }
+    fclose(in);
+    if (gzclose(out) != Z_OK) error("failed gzclose");
+}
+
+#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech at eso.org> */
+
+/* Try compressing the input file at once using mmap. Return Z_OK if
+ * if success, Z_ERRNO otherwise.
+ */
+int gz_compress_mmap(in, out)
+    FILE   *in;
+    gzFile out;
+{
+    int len;
+    int err;
+    int ifd = fileno(in);
+    caddr_t buf;    /* mmap'ed buffer for the entire input file */
+    off_t buf_len;  /* length of the input file */
+    struct stat sb;
+
+    /* Determine the size of the file, needed for mmap: */
+    if (fstat(ifd, &sb) < 0) return Z_ERRNO;
+    buf_len = sb.st_size;
+    if (buf_len <= 0) return Z_ERRNO;
+
+    /* Now do the actual mmap: */
+    buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); 
+    if (buf == (caddr_t)(-1)) return Z_ERRNO;
+
+    /* Compress the whole file at once: */
+    len = gzwrite(out, (char *)buf, (unsigned)buf_len);
+
+    if (len != (int)buf_len) error(gzerror(out, &err));
+
+    munmap(buf, buf_len);
+    fclose(in);
+    if (gzclose(out) != Z_OK) error("failed gzclose");
+    return Z_OK;
+}
+#endif /* USE_MMAP */
+
+/* ===========================================================================
+ * Uncompress input to output then close both files.
+ */
+void gz_uncompress(in, out)
+    gzFile in;
+    FILE   *out;
+{
+    local char buf[BUFLEN];
+    int len;
+    int err;
+
+    for (;;) {
+        len = gzread(in, buf, sizeof(buf));
+        if (len < 0) error (gzerror(in, &err));
+        if (len == 0) break;
+
+        if ((int)fwrite(buf, 1, (unsigned)len, out) != len) {
+	    error("failed fwrite");
+	}
+    }
+    if (fclose(out)) error("failed fclose");
+
+    if (gzclose(in) != Z_OK) error("failed gzclose");
+}
+
+
+/* ===========================================================================
+ * Compress the given file: create a corresponding .gz file and remove the
+ * original.
+ */
+void file_compress(file, mode)
+    char  *file;
+    char  *mode;
+{
+    local char outfile[MAX_NAME_LEN];
+    FILE  *in;
+    gzFile out;
+
+    strcpy(outfile, file);
+    strcat(outfile, GZ_SUFFIX);
+
+    in = fopen(file, "rb");
+    if (in == NULL) {
+        perror(file);
+        exit(1);
+    }
+    out = gzopen(outfile, mode);
+    if (out == NULL) {
+        fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile);
+        exit(1);
+    }
+    gz_compress(in, out);
+
+    unlink(file);
+}
+
+
+/* ===========================================================================
+ * Uncompress the given file and remove the original.
+ */
+void file_uncompress(file)
+    char  *file;
+{
+    local char buf[MAX_NAME_LEN];
+    char *infile, *outfile;
+    FILE  *out;
+    gzFile in;
+    int len = strlen(file);
+
+    strcpy(buf, file);
+
+    if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
+        infile = file;
+        outfile = buf;
+        outfile[len-3] = '\0';
+    } else {
+        outfile = file;
+        infile = buf;
+        strcat(infile, GZ_SUFFIX);
+    }
+    in = gzopen(infile, "rb");
+    if (in == NULL) {
+        fprintf(stderr, "%s: can't gzopen %s\n", prog, infile);
+        exit(1);
+    }
+    out = fopen(outfile, "wb");
+    if (out == NULL) {
+        perror(file);
+        exit(1);
+    }
+
+    gz_uncompress(in, out);
+
+    unlink(infile);
+}
+
+
+/* ===========================================================================
+ * Usage:  minigzip [-d] [-f] [-h] [-1 to -9] [files...]
+ *   -d : decompress
+ *   -f : compress with Z_FILTERED
+ *   -h : compress with Z_HUFFMAN_ONLY
+ *   -1 to -9 : compression level
+ */
+
+int main(argc, argv)
+    int argc;
+    char *argv[];
+{
+    int uncompr = 0;
+    gzFile file;
+    char outmode[20];
+
+    strcpy(outmode, "wb6 ");
+
+    prog = argv[0];
+    argc--, argv++;
+
+    while (argc > 0) {
+      if (strcmp(*argv, "-d") == 0)
+	uncompr = 1;
+      else if (strcmp(*argv, "-f") == 0)
+	outmode[3] = 'f';
+      else if (strcmp(*argv, "-h") == 0)
+	outmode[3] = 'h';
+      else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' &&
+	       (*argv)[2] == 0)
+	outmode[2] = (*argv)[1];
+      else
+	break;
+      argc--, argv++;
+    }
+    if (argc == 0) {
+        SET_BINARY_MODE(stdin);
+        SET_BINARY_MODE(stdout);
+        if (uncompr) {
+            file = gzdopen(fileno(stdin), "rb");
+            if (file == NULL) error("can't gzdopen stdin");
+            gz_uncompress(file, stdout);
+        } else {
+            file = gzdopen(fileno(stdout), outmode);
+            if (file == NULL) error("can't gzdopen stdout");
+            gz_compress(stdin, file);
+        }
+    } else {
+        do {
+            if (uncompr) {
+                file_uncompress(*argv);
+            } else {
+                file_compress(*argv, outmode);
+            }
+        } while (argv++, --argc);
+    }
+    exit(0);
+    return 0; /* to avoid warning */
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.b32
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.b32	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.b32	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,104 @@
+# Makefile for zlib
+# Borland C++   
+
+# This version of the zlib makefile was adapted by Chris Young for use
+# with Borland C 4.5x with the Dos Power Pack for a 32-bit protected mode
+# flat memory model.  It was created for use with POV-Ray ray tracer and
+# you may choose to edit the CFLAGS to suit your needs but the
+# switches -WX and -DMSDOS are required.
+# -- Chris Young 76702.1655 at compuserve.com
+
+# To use, do "make -fmakefile.b32"
+
+# See zconf.h for details about the memory requirements.
+
+# ------------- Borland C++ -------------
+MODEL=-WX 
+CFLAGS= $(MODEL) -P-C -K -N- -k- -d -3 -r- -v- -f -DMSDOS
+CC=bcc32
+LD=bcc32
+LIB=tlib
+LDFLAGS= $(MODEL)
+O=.obj
+
+# variables
+OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
+  trees$(O)
+OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\
+  trees$(O)
+OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
+  infutil$(O) inffast$(O)
+OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\
+  infutil$(O)+inffast$(O)
+
+all: test
+
+adler32.obj: adler32.c zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+compress.obj: compress.c zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+crc32.obj: crc32.c zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+gzio.obj: gzio.c zutil.h zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h\
+   infcodes.h infutil.h
+	$(CC) -c $(CFLAGS) $*.c
+
+infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h\
+   infcodes.h inffast.h
+	$(CC) -c $(CFLAGS) $*.c
+
+inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h
+	$(CC) -c $(CFLAGS) $*.c
+
+inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
+	$(CC) -c $(CFLAGS) $*.c
+
+infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
+	$(CC) -c $(CFLAGS) $*.c
+
+inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
+	$(CC) -c $(CFLAGS) $*.c
+
+trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+uncompr.obj: uncompr.c zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+zutil.obj: zutil.c zutil.h zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+example.obj: example.c zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+minigzip.obj: minigzip.c zlib.h zconf.h
+	$(CC) -c $(CFLAGS) $*.c
+
+# we must cut the command line to fit in the MS/DOS 128 byte limit:
+zlib.lib: $(OBJ1) $(OBJ2)
+	del zlib.lib
+	$(LIB) zlib +$(OBJP1)
+	$(LIB) zlib +$(OBJP2)
+
+example.exe: example.obj zlib.lib
+	$(LD) $(LDFLAGS) example.obj zlib.lib
+
+minigzip.exe: minigzip.obj zlib.lib
+	$(LD) $(LDFLAGS) minigzip.obj zlib.lib
+
+test: example.exe minigzip.exe
+	example
+	echo hello world | minigzip | minigzip -d 
+
+#clean:
+#	del *.obj
+#	del *.exe

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.bor
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.bor	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.bor	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,125 @@
+# Makefile for zlib
+# Borland C++   ************ UNTESTED ***********
+
+# To use, do "make -fmakefile.bor"
+# To compile in small model, set below: MODEL=s
+
+# WARNING: the small model is supported but only for small values of
+# MAX_WBITS and MAX_MEM_LEVEL. For example:
+#    -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3
+# If you wish to reduce the memory requirements (default 256K for big
+# objects plus a few K), you can add to the LOC macro below:
+#   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
+# See zconf.h for details about the memory requirements.
+
+# ------------- Turbo C++, Borland C++ -------------
+
+#    Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
+#    should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
+#    to the declaration of LOC here:
+LOC = $(LOCAL_ZLIB)
+
+# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
+CPU_TYP = 0
+
+# Memory model: one of s, m, c, l (small, medium, compact, large)
+MODEL=l
+
+CC=bcc
+#   replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version
+LD=$(CC)
+AR=tlib
+
+# compiler flags
+CFLAGS=-O2 -Z -m$(MODEL) $(LOC)
+#   replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0
+
+LDFLAGS=-m$(MODEL)
+
+O=.obj
+
+# variables
+OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
+  trees$(O)
+OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\
+  trees$(O)
+OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
+  infutil$(O) inffast$(O)
+OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\
+  infutil$(O)+inffast$(O)
+
+ZLIB_H = zlib.h zconf.h
+ZUTIL_H = zutil.h $(ZLIB_H)
+
+ZLIB_LIB = zlib_$(MODEL).lib
+
+all: test
+
+# individual dependencies and action rules:
+adler32.obj: adler32.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+compress.obj: compress.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+crc32.obj: crc32.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+deflate.obj: deflate.c deflate.h $(ZUTIL_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+gzio.obj: gzio.c $(ZUTIL_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h
+	$(CC) -c $(CFLAGS) $*.c
+
+infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h
+	$(CC) -c $(CFLAGS) $*.c
+
+inflate.obj: inflate.c $(ZUTIL_H) infblock.h
+	$(CC) -c $(CFLAGS) $*.c
+
+inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h
+	$(CC) -c $(CFLAGS) $*.c
+
+infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h
+	$(CC) -c $(CFLAGS) $*.c
+
+inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h
+	$(CC) -c $(CFLAGS) $*.c
+
+trees.obj: trees.c deflate.h $(ZUTIL_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+uncompr.obj: uncompr.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+zutil.obj: zutil.c $(ZUTIL_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+example.obj: example.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+minigzip.obj: minigzip.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+# we must cut the command line to fit in the MS/DOS 128 byte limit:
+$(ZLIB_LIB): $(OBJ1) $(OBJ2)
+	del $(ZLIB_LIB)
+	$(AR) $(ZLIB_LIB) +$(OBJP1)
+	$(AR) $(ZLIB_LIB) +$(OBJP2)
+
+example.exe: example.obj $(ZLIB_LIB)
+	$(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
+
+minigzip.exe: minigzip.obj $(ZLIB_LIB)
+	$(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
+
+test: example.exe minigzip.exe
+	example
+	echo hello world | minigzip | minigzip -d 
+
+#clean:
+#	del *.obj
+#	del *.exe

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.dj2
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.dj2	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.dj2	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,100 @@
+# Makefile for zlib.  Modified for djgpp v2.0 by F. J. Donahoe, 3/15/96.
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h 
+
+# To compile, or to compile and test, type:
+# 
+#   make -fmakefile.dj2;  make test -fmakefile.dj2
+# 
+# To install libz.a, zconf.h and zlib.h in the djgpp directories, type:
+# 
+#    make install -fmakefile.dj2
+# 
+# after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as
+# in the sample below if the pattern of the DJGPP distribution is to
+# be followed.  Remember that, while <sp>'es around <=> are ignored in
+# makefiles, they are *not* in batch files or in djgpp.env.
+# - - - - -
+# [make]
+# INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include
+# LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib
+# BUTT=-m486
+# - - - - -
+# Alternately, these variables may be defined below, overriding the values
+# in djgpp.env, as
+# INCLUDE_PATH=c:\usr\include
+# LIBRARY_PATH=c:\usr\lib
+
+CC=gcc
+
+#CFLAGS=-MMD -O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-MMD -g -DDEBUG
+CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+             -Wstrict-prototypes -Wmissing-prototypes
+
+# If cp.exe is available, replace "copy /Y" with "cp -fp" .
+CP=copy /Y
+# If gnu install.exe is available, replace $(CP) with ginstall.
+INSTALL=$(CP)
+# The default value of RM is "rm -f."  If "rm.exe" is found, comment out:
+RM=del
+LDLIBS=-L. -lz
+LD=$(CC) -s -o
+LDSHARED=$(CC)
+
+INCL=zlib.h zconf.h
+LIBS=libz.a
+
+AR=ar rcs
+
+prefix=/usr/local
+exec_prefix = $(prefix)
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example.exe minigzip.exe
+
+test: all
+	./example
+	echo hello world | .\minigzip | .\minigzip -d 
+
+%.o : %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+libz.a: $(OBJS)
+	$(AR) $@ $(OBJS)
+
+%.exe : %.o $(LIBS)
+	$(LD) $@ $< $(LDLIBS)
+
+# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env .
+
+.PHONY : uninstall clean
+
+install: $(INCL) $(LIBS)
+	- at if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH)
+	- at if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH)
+	$(INSTALL) zlib.h $(INCLUDE_PATH)
+	$(INSTALL) zconf.h $(INCLUDE_PATH)
+	$(INSTALL) libz.a $(LIBRARY_PATH)
+
+uninstall:
+	$(RM) $(INCLUDE_PATH)\zlib.h
+	$(RM) $(INCLUDE_PATH)\zconf.h
+	$(RM) $(LIBRARY_PATH)\libz.a
+
+clean:
+	$(RM) *.d
+	$(RM) *.o
+	$(RM) *.exe
+	$(RM) libz.a
+	$(RM) foo.gz
+
+DEPS := $(wildcard *.d)
+ifneq ($(DEPS),)
+include $(DEPS)
+endif

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.emx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.emx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.emx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,69 @@
+# Makefile for zlib.  Modified for emx 0.9c by Chr. Spieler, 6/17/98.
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h 
+
+# To compile, or to compile and test, type:
+# 
+#   make -fmakefile.emx;  make test -fmakefile.emx
+# 
+
+CC=gcc
+
+#CFLAGS=-MMD -O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-MMD -g -DDEBUG
+CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+             -Wstrict-prototypes -Wmissing-prototypes
+
+# If cp.exe is available, replace "copy /Y" with "cp -fp" .
+CP=copy /Y
+# If gnu install.exe is available, replace $(CP) with ginstall.
+INSTALL=$(CP)
+# The default value of RM is "rm -f."  If "rm.exe" is found, comment out:
+RM=del
+LDLIBS=-L. -lzlib
+LD=$(CC) -s -o
+LDSHARED=$(CC)
+
+INCL=zlib.h zconf.h
+LIBS=zlib.a
+
+AR=ar rcs
+
+prefix=/usr/local
+exec_prefix = $(prefix)
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example.exe minigzip.exe
+
+test: all
+	./example
+	echo hello world | .\minigzip | .\minigzip -d 
+
+%.o : %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+zlib.a: $(OBJS)
+	$(AR) $@ $(OBJS)
+
+%.exe : %.o $(LIBS)
+	$(LD) $@ $< $(LDLIBS)
+
+
+.PHONY : clean
+
+clean:
+	$(RM) *.d
+	$(RM) *.o
+	$(RM) *.exe
+	$(RM) zlib.a
+	$(RM) foo.gz
+
+DEPS := $(wildcard *.d)
+ifneq ($(DEPS),)
+include $(DEPS)
+endif

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.msc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.msc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.msc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,121 @@
+# Makefile for zlib
+# Microsoft C 5.1 or later
+
+# To use, do "make makefile.msc"
+# To compile in small model, set below: MODEL=S
+
+# If you wish to reduce the memory requirements (default 256K for big
+# objects plus a few K), you can add to the LOC macro below:
+#   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
+# See zconf.h for details about the memory requirements.
+
+# ------------- Microsoft C 5.1 and later -------------
+
+#    Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
+#    should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
+#    to the declaration of LOC here:
+LOC = $(LOCAL_ZLIB)
+
+# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
+CPU_TYP = 0
+
+# Memory model: one of S, M, C, L (small, medium, compact, large)
+MODEL=L
+
+CC=cl
+CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC)
+#-Ox generates bad code with MSC 5.1
+LIB_CFLAGS=-Zl $(CFLAGS)
+
+LD=link
+LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode
+# "/farcall/packcode" are only useful for `large code' memory models
+# but should be a "no-op" for small code models.
+
+O=.obj
+
+# variables
+OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
+  trees$(O)
+OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\
+  trees$(O)
+OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
+  infutil$(O) inffast$(O)
+OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\
+  infutil$(O)+inffast$(O)
+
+ZLIB_H = zlib.h zconf.h
+ZUTIL_H = zutil.h $(ZLIB_H)
+
+ZLIB_LIB = zlib_$(MODEL).lib
+
+all:  $(ZLIB_LIB) example.exe minigzip.exe
+
+# individual dependencies and action rules:
+adler32.obj: adler32.c $(ZLIB_H)
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+compress.obj: compress.c $(ZLIB_H)
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+crc32.obj: crc32.c $(ZLIB_H)
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+deflate.obj: deflate.c deflate.h $(ZUTIL_H)
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+gzio.obj: gzio.c $(ZUTIL_H)
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+inflate.obj: inflate.c $(ZUTIL_H) infblock.h
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+trees.obj: trees.c deflate.h $(ZUTIL_H)
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+uncompr.obj: uncompr.c $(ZLIB_H)
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+zutil.obj: zutil.c $(ZUTIL_H)
+	$(CC) -c $(LIB_CFLAGS) $*.c
+
+example.obj: example.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+minigzip.obj: minigzip.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+# we must cut the command line to fit in the MS/DOS 128 byte limit:
+$(ZLIB_LIB): $(OBJ1) $(OBJ2)
+	if exist $(ZLIB_LIB) del $(ZLIB_LIB)
+	lib $(ZLIB_LIB) $(OBJ1);
+	lib $(ZLIB_LIB) $(OBJ2);
+
+example.exe: example.obj $(ZLIB_LIB)
+	$(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB);
+
+minigzip.exe: minigzip.obj $(ZLIB_LIB)
+	$(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB);
+
+test: example.exe minigzip.exe
+	example
+	echo hello world | minigzip | minigzip -d 
+
+#clean:
+#	del *.obj
+#	del *.exe

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.tc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.tc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.tc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,108 @@
+# Makefile for zlib
+# TurboC 2.0
+
+# To use, do "make -fmakefile.tc"
+# To compile in small model, set below: MODEL=-ms
+
+# WARNING: the small model is supported but only for small values of
+# MAX_WBITS and MAX_MEM_LEVEL. For example:
+#    -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
+# If you wish to reduce the memory requirements (default 256K for big
+# objects plus a few K), you can add to CFLAGS below:
+#   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
+# See zconf.h for details about the memory requirements.
+
+# ------------- Turbo C 2.0 -------------
+MODEL=l
+# CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
+CFLAGS=-O2 -G -Z -m$(MODEL)
+CC=tcc -I\tc\include
+LD=tcc -L\tc\lib
+AR=tlib
+LDFLAGS=-m$(MODEL) -f-
+O=.obj
+
+# variables
+OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
+  trees$(O)
+OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\
+  trees$(O)
+OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
+  infutil$(O) inffast$(O)
+OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\
+  infutil$(O)+inffast$(O)
+
+ZLIB_H = zlib.h zconf.h
+ZUTIL_H = zutil.h $(ZLIB_H)
+
+ZLIB_LIB = zlib_$(MODEL).lib
+
+all: test
+
+adler32.obj: adler32.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+compress.obj: compress.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+crc32.obj: crc32.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+deflate.obj: deflate.c deflate.h $(ZUTIL_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+gzio.obj: gzio.c $(ZUTIL_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h
+	$(CC) -c $(CFLAGS) $*.c
+
+infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h
+	$(CC) -c $(CFLAGS) $*.c
+
+inflate.obj: inflate.c $(ZUTIL_H) infblock.h
+	$(CC) -c $(CFLAGS) $*.c
+
+inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h
+	$(CC) -c $(CFLAGS) $*.c
+
+infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h
+	$(CC) -c $(CFLAGS) $*.c
+
+inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h
+	$(CC) -c $(CFLAGS) $*.c
+
+trees.obj: trees.c deflate.h $(ZUTIL_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+uncompr.obj: uncompr.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+zutil.obj: zutil.c $(ZUTIL_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+example.obj: example.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+minigzip.obj: minigzip.c $(ZLIB_H)
+	$(CC) -c $(CFLAGS) $*.c
+
+# we must cut the command line to fit in the MS/DOS 128 byte limit:
+$(ZLIB_LIB): $(OBJ1) $(OBJ2)
+	del $(ZLIB_LIB)
+	$(AR) $(ZLIB_LIB) +$(OBJP1)
+	$(AR) $(ZLIB_LIB) +$(OBJP2)
+
+example.exe: example.obj $(ZLIB_LIB)
+	$(LD) $(LDFLAGS) -eexample.exe example.obj $(ZLIB_LIB)
+
+minigzip.exe: minigzip.obj $(ZLIB_LIB)
+	$(LD) $(LDFLAGS) -eminigzip.exe minigzip.obj $(ZLIB_LIB)
+
+test: example.exe minigzip.exe
+	example
+	echo hello world | minigzip | minigzip -d 
+
+#clean:
+#	del *.obj
+#	del *.exe

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.w32
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.w32	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.w32	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,97 @@
+# Makefile for zlib
+# Microsoft 32-bit Visual C++ 4.0 or later (may work on earlier versions)
+
+# To use, do "nmake /f makefile.w32"
+
+# If you wish to reduce the memory requirements (default 256K for big
+# objects plus a few K), you can add to CFLAGS below: 
+#   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
+# See zconf.h for details about the memory requirements.
+
+# ------------- Microsoft Visual C++ 4.0 and later -------------
+MODEL=
+CFLAGS=-Ox -GA3s -nologo -W3
+CC=cl
+LD=link
+LDFLAGS=
+O=.obj
+
+# variables
+OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
+  trees$(O)
+OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\
+  trees$(O)
+OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
+  infutil$(O) inffast$(O)
+OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\
+  infutil$(O)+inffast$(O)
+
+all:  zlib.lib example.exe minigzip.exe
+
+adler32.obj: adler32.c zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+compress.obj: compress.c zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+crc32.obj: crc32.c zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+gzio.obj: gzio.c zutil.h zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h\
+   infcodes.h infutil.h
+  $(CC) -c $(CFLAGS) $*.c
+
+infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h\
+   infcodes.h inffast.h
+  $(CC) -c $(CFLAGS) $*.c
+
+inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h
+  $(CC) -c $(CFLAGS) $*.c
+
+inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
+  $(CC) -c $(CFLAGS) $*.c
+
+infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
+  $(CC) -c $(CFLAGS) $*.c
+
+inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
+  $(CC) -c $(CFLAGS) $*.c
+
+trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+uncompr.obj: uncompr.c zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+zutil.obj: zutil.c zutil.h zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+example.obj: example.c zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+minigzip.obj: minigzip.c zlib.h zconf.h
+  $(CC) -c $(CFLAGS) $*.c
+
+zlib.lib: $(OBJ1) $(OBJ2)
+  if exist zlib.lib del zlib.lib
+  lib /OUT:zlib.lib $(OBJ1) $(OBJ2)
+
+example.exe: example.obj zlib.lib
+  $(LD) $(LDFLAGS) example.obj zlib.lib /OUT:example.exe /SUBSYSTEM:CONSOLE
+
+minigzip.exe: minigzip.obj zlib.lib
+  $(LD) $(LDFLAGS) minigzip.obj zlib.lib /OUT:minigzip.exe /SUBSYSTEM:CONSOLE
+
+test: example.exe minigzip.exe
+  example
+  echo hello world | minigzip | minigzip -d 
+
+#clean:
+#  del *.obj
+#  del *.exe

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.wat
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.wat	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/Makefile.wat	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,103 @@
+# Makefile for zlib
+# Watcom 10a
+
+# This version of the zlib makefile was adapted by Chris Young for use
+# with Watcom 10a 32-bit protected mode flat memory model.  It was created 
+# for use with POV-Ray ray tracer and you may choose to edit the CFLAGS to 
+# suit your needs but the -DMSDOS is required.
+# -- Chris Young 76702.1655 at compuserve.com
+
+# To use, do "wmake -f makefile.wat"
+
+# See zconf.h for details about the memory requirements.
+
+# ------------- Watcom 10a -------------
+MODEL=-mf 
+CFLAGS= $(MODEL) -fpi87 -fp5 -zp4 -5r -w5 -oneatx -DMSDOS
+CC=wcc386
+LD=wcl386
+LIB=wlib -b -c 
+LDFLAGS= 
+O=.obj
+
+# variables
+OBJ1=adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) 
+OBJ2=trees$(O) zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) 
+OBJ3=infutil$(O) inffast$(O)
+OBJP1=adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)
+OBJP2=trees$(O)+zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)
+OBJP3=infutil$(O)+inffast$(O)
+
+all: test
+
+adler32.obj: adler32.c zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+compress.obj: compress.c zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+crc32.obj: crc32.c zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+gzio.obj: gzio.c zutil.h zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h &
+  infcodes.h infutil.h
+	$(CC) $(CFLAGS) $*.c
+
+infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h &
+  infcodes.h inffast.h
+	$(CC) $(CFLAGS) $*.c
+
+inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h
+	$(CC) $(CFLAGS) $*.c
+
+inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
+	$(CC) $(CFLAGS) $*.c
+
+infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
+	$(CC) $(CFLAGS) $*.c
+
+inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
+	$(CC) $(CFLAGS) $*.c
+
+trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+uncompr.obj: uncompr.c zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+zutil.obj: zutil.c zutil.h zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+example.obj: example.c zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+minigzip.obj: minigzip.c zlib.h zconf.h
+	$(CC) $(CFLAGS) $*.c
+
+# we must cut the command line to fit in the MS/DOS 128 byte limit:
+zlib.lib: $(OBJ1) $(OBJ2) $(OBJ3) 
+	del zlib.lib
+	$(LIB) zlib.lib +$(OBJP1)
+	$(LIB) zlib.lib +$(OBJP2)
+	$(LIB) zlib.lib +$(OBJP3)
+
+example.exe: example.obj zlib.lib
+	$(LD) $(LDFLAGS) example.obj zlib.lib
+
+minigzip.exe: minigzip.obj zlib.lib
+	$(LD) $(LDFLAGS) minigzip.obj zlib.lib
+
+test: minigzip.exe example.exe
+	example
+	echo hello world | minigzip | minigzip -d >test
+	type test
+
+#clean:
+#	del *.obj
+#	del *.exe

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/zlib.def
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/zlib.def	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/zlib.def	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,60 @@
+LIBRARY		"zlib"
+
+DESCRIPTION	'"""zlib data compression library"""'
+
+EXETYPE		NT
+
+SUBSYSTEM	WINDOWS
+
+STUB		'WINSTUB.EXE'
+
+VERSION		1.13
+
+CODE		 EXECUTE READ
+
+DATA		 READ WRITE
+
+HEAPSIZE	1048576,4096
+
+EXPORTS
+    adler32                        @1
+    compress                       @2
+    crc32                          @3
+    deflate                        @4
+    deflateCopy                    @5
+    deflateEnd                     @6
+    deflateInit2_                  @7
+    deflateInit_                   @8
+    deflateParams                  @9
+    deflateReset                   @10
+    deflateSetDictionary           @11
+    gzclose                        @12
+    gzdopen                        @13
+    gzerror                        @14
+    gzflush                        @15
+    gzopen                         @16
+    gzread                         @17
+    gzwrite                        @18
+    inflate                        @19
+    inflateEnd                     @20
+    inflateInit2_                  @21
+    inflateInit_                   @22
+    inflateReset                   @23
+    inflateSetDictionary           @24
+    inflateSync                    @25
+    uncompress                     @26
+    zlibVersion                    @27
+    gzprintf                       @28
+    gzputc                         @29
+    gzgetc                         @30
+    gzseek                         @31
+    gzrewind                       @32
+    gztell                         @33
+    gzeof                          @34
+    gzsetparams                    @35
+    zError                         @36
+    inflateSyncPoint               @37
+    get_crc_table                  @38
+    compress2                      @39
+    gzputs                         @40
+    gzgets                         @41

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/zlib.rc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/zlib.rc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/msdos/zlib.rc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,32 @@
+#include <windows.h>
+
+#define IDR_VERSION1  1
+IDR_VERSION1	VERSIONINFO	MOVEABLE IMPURE LOADONCALL DISCARDABLE
+  FILEVERSION	 1,1,3,0
+  PRODUCTVERSION 1,1,3,0
+  FILEFLAGSMASK	VS_FFI_FILEFLAGSMASK
+  FILEFLAGS	0
+  FILEOS	VOS_DOS_WINDOWS32
+  FILETYPE	VFT_DLL
+  FILESUBTYPE	0	// not used
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904E4"
+    //language ID = U.S. English, char set = Windows, Multilingual
+
+    BEGIN
+      VALUE "FileDescription", "zlib data compression library\0"
+      VALUE "FileVersion",	"1.1.3\0"
+      VALUE "InternalName",	"zlib\0"
+      VALUE "OriginalFilename",	"zlib.dll\0"
+      VALUE "ProductName",	"ZLib.DLL\0"
+      VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
+      VALUE "LegalCopyright", "(C) 1995-1998 Jean-loup Gailly & Mark Adler\0"
+    END
+  END
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 1252
+  END
+END

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.emx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.emx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.emx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,138 @@
+# Makefile for zlib.  Modified for emx/rsxnt by Chr. Spieler, 6/16/98.
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h 
+
+# To compile, or to compile and test, type:
+# 
+#   make -fmakefile.emx;  make test -fmakefile.emx
+# 
+
+CC=gcc -Zwin32
+
+#CFLAGS=-MMD -O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-MMD -g -DDEBUG
+CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+             -Wstrict-prototypes -Wmissing-prototypes
+
+# If cp.exe is available, replace "copy /Y" with "cp -fp" .
+CP=copy /Y
+# If gnu install.exe is available, replace $(CP) with ginstall.
+INSTALL=$(CP)
+# The default value of RM is "rm -f."  If "rm.exe" is found, comment out:
+RM=del
+LDLIBS=-L. -lzlib
+LD=$(CC) -s -o
+LDSHARED=$(CC)
+
+INCL=zlib.h zconf.h
+LIBS=zlib.a
+
+AR=ar rcs
+
+prefix=/usr/local
+exec_prefix = $(prefix)
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example.exe minigzip.exe
+
+test: all
+	./example
+	echo hello world | .\minigzip | .\minigzip -d 
+
+%.o : %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+zlib.a: $(OBJS)
+	$(AR) $@ $(OBJS)
+
+%.exe : %.o $(LIBS)
+	$(LD) $@ $< $(LDLIBS)
+
+
+.PHONY : clean
+
+clean:
+	$(RM) *.d
+	$(RM) *.o
+	$(RM) *.exe
+	$(RM) zlib.a
+	$(RM) foo.gz
+
+DEPS := $(wildcard *.d)
+ifneq ($(DEPS),)
+include $(DEPS)
+endif
+# Makefile for zlib.  Modified for emx 0.9c by Chr. Spieler, 6/17/98.
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h 
+
+# To compile, or to compile and test, type:
+# 
+#   make -fmakefile.emx;  make test -fmakefile.emx
+# 
+
+CC=gcc
+
+#CFLAGS=-MMD -O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-MMD -g -DDEBUG
+CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+             -Wstrict-prototypes -Wmissing-prototypes
+
+# If cp.exe is available, replace "copy /Y" with "cp -fp" .
+CP=copy /Y
+# If gnu install.exe is available, replace $(CP) with ginstall.
+INSTALL=$(CP)
+# The default value of RM is "rm -f."  If "rm.exe" is found, comment out:
+RM=del
+LDLIBS=-L. -lzlib
+LD=$(CC) -s -o
+LDSHARED=$(CC)
+
+INCL=zlib.h zconf.h
+LIBS=zlib.a
+
+AR=ar rcs
+
+prefix=/usr/local
+exec_prefix = $(prefix)
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example.exe minigzip.exe
+
+test: all
+	./example
+	echo hello world | .\minigzip | .\minigzip -d 
+
+%.o : %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+zlib.a: $(OBJS)
+	$(AR) $@ $(OBJS)
+
+%.exe : %.o $(LIBS)
+	$(LD) $@ $< $(LDLIBS)
+
+
+.PHONY : clean
+
+clean:
+	$(RM) *.d
+	$(RM) *.o
+	$(RM) *.exe
+	$(RM) zlib.a
+	$(RM) foo.gz
+
+DEPS := $(wildcard *.d)
+ifneq ($(DEPS),)
+include $(DEPS)
+endif

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.gcc
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.gcc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.gcc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,87 @@
+# Makefile for zlib.  Modified for mingw32 by C. Spieler, 6/16/98.
+# (This Makefile is directly derived from Makefile.dj2)
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h 
+
+# To compile, or to compile and test, type:
+# 
+#   make -fmakefile.gcc;  make test -fmakefile.gcc
+# 
+# To install libz.a, zconf.h and zlib.h in the mingw32 directories, type:
+# 
+#    make install -fmakefile.gcc
+# 
+
+CC=gcc
+
+#CFLAGS=-MMD -O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-MMD -g -DDEBUG
+CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+             -Wstrict-prototypes -Wmissing-prototypes
+
+# If cp.exe is available, replace "copy /Y" with "cp -fp" .
+CP=copy /Y
+# If gnu install.exe is available, replace $(CP) with ginstall.
+INSTALL=$(CP)
+# The default value of RM is "rm -f."  If "rm.exe" is found, comment out:
+RM=del
+LDLIBS=-L. -lz
+LD=$(CC) -s -o
+LDSHARED=$(CC)
+
+INCL=zlib.h zconf.h
+LIBS=libz.a
+
+AR=ar rcs
+
+prefix=/usr/local
+exec_prefix = $(prefix)
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example.exe minigzip.exe
+
+test: all
+	./example
+	echo hello world | .\minigzip | .\minigzip -d 
+
+%.o : %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+libz.a: $(OBJS)
+	$(AR) $@ $(OBJS)
+
+%.exe : %.o $(LIBS)
+	$(LD) $@ $< $(LDLIBS)
+
+# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env .
+
+.PHONY : uninstall clean
+
+install: $(INCL) $(LIBS)
+	- at if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH)
+	- at if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH)
+	$(INSTALL) zlib.h $(INCLUDE_PATH)
+	$(INSTALL) zconf.h $(INCLUDE_PATH)
+	$(INSTALL) libz.a $(LIBRARY_PATH)
+
+uninstall:
+	$(RM) $(INCLUDE_PATH)\zlib.h
+	$(RM) $(INCLUDE_PATH)\zconf.h
+	$(RM) $(LIBRARY_PATH)\libz.a
+
+clean:
+	$(RM) *.d
+	$(RM) *.o
+	$(RM) *.exe
+	$(RM) libz.a
+	$(RM) foo.gz
+
+DEPS := $(wildcard *.d)
+ifneq ($(DEPS),)
+include $(DEPS)
+endif

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.nt
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.nt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/nt/Makefile.nt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,88 @@
+# Makefile for zlib
+
+!include <ntwin32.mak>
+
+CC=cl
+LD=link
+CFLAGS=-O -nologo
+LDFLAGS=
+O=.obj
+
+# variables
+OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
+  trees$(O)
+OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
+  infutil$(O) inffast$(O)
+
+all:  zlib.dll example.exe minigzip.exe
+
+adler32.obj: adler32.c zutil.h zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+compress.obj: compress.c zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+crc32.obj: crc32.c zutil.h zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+gzio.obj: gzio.c zutil.h zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h\
+   infcodes.h infutil.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h\
+   infcodes.h inffast.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+uncompr.obj: uncompr.c zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+zutil.obj: zutil.c zutil.h zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+example.obj: example.c zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+minigzip.obj: minigzip.c zlib.h zconf.h
+	$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+zlib.dll: $(OBJ1) $(OBJ2) zlib.dnt
+	link $(dlllflags) -out:$@ -def:zlib.dnt $(OBJ1) $(OBJ2) $(guilibsdll)
+
+zlib.lib: zlib.dll
+
+example.exe: example.obj zlib.lib
+	$(LD) $(LDFLAGS) example.obj zlib.lib
+
+minigzip.exe: minigzip.obj zlib.lib
+	$(LD) $(LDFLAGS) minigzip.obj zlib.lib
+
+test: example.exe minigzip.exe
+	example
+	echo hello world | minigzip | minigzip -d 
+
+clean:
+	del *.obj
+	del *.exe
+	del *.dll
+	del *.lib

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/nt/zlib.dnt
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/nt/zlib.dnt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/nt/zlib.dnt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,47 @@
+LIBRARY		zlib.dll
+EXETYPE WINDOWS
+CODE		 PRELOAD MOVEABLE DISCARDABLE
+DATA		 PRELOAD MOVEABLE MULTIPLE
+
+EXPORTS
+    adler32                        @1
+    compress                       @2
+    crc32                          @3
+    deflate                        @4
+    deflateCopy                    @5
+    deflateEnd                     @6
+    deflateInit2_                  @7
+    deflateInit_                   @8
+    deflateParams                  @9
+    deflateReset                   @10
+    deflateSetDictionary           @11
+    gzclose                        @12
+    gzdopen                        @13
+    gzerror                        @14
+    gzflush                        @15
+    gzopen                         @16
+    gzread                         @17
+    gzwrite                        @18
+    inflate                        @19
+    inflateEnd                     @20
+    inflateInit2_                  @21
+    inflateInit_                   @22
+    inflateReset                   @23
+    inflateSetDictionary           @24
+    inflateSync                    @25
+    uncompress                     @26
+    zlibVersion                    @27
+    gzprintf                       @28
+    gzputc                         @29
+    gzgetc                         @30
+    gzseek                         @31
+    gzrewind                       @32
+    gztell                         @33
+    gzeof                          @34
+    gzsetparams                    @35
+    zError                         @36
+    inflateSyncPoint               @37
+    get_crc_table                  @38
+    compress2                      @39
+    gzputs                         @40
+    gzgets                         @41

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/os2/Makefile.os2
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/os2/Makefile.os2	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/os2/Makefile.os2	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,136 @@
+# Makefile for zlib under OS/2 using GCC (PGCC)
+# For conditions of distribution and use, see copyright notice in zlib.h 
+
+# To compile and test, type:
+#   cp Makefile.os2 ..
+#   cd ..
+#   make -f Makefile.os2 test
+
+# This makefile will build a static library z.lib, a shared library
+# z.dll and a import library zdll.lib. You can use either z.lib or
+# zdll.lib by specifying either -lz or -lzdll on gcc's command line
+
+CC=gcc -Zomf -s
+
+CFLAGS=-O6 -Wall
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-g -DDEBUG
+#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+#           -Wstrict-prototypes -Wmissing-prototypes
+
+#################### BUG WARNING: #####################
+## infcodes.c hits a bug in pgcc-1.0, so you have to use either
+## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem)
+## This bug is reportedly fixed in pgcc >1.0, but this was not tested
+CFLAGS+=-fno-force-mem
+
+LDFLAGS=-s -L. -lzdll -Zcrtdll
+LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll
+
+VER=1.1.0
+ZLIB=z.lib
+SHAREDLIB=z.dll
+SHAREDLIBIMP=zdll.lib
+LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP)
+
+AR=emxomfar cr
+IMPLIB=emximp
+RANLIB=echo
+TAR=tar
+SHELL=bash
+
+prefix=/usr/local
+exec_prefix = $(prefix)
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \
+  algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
+  nt/Makefile.nt nt/zlib.dnt  contrib/README.contrib contrib/*.txt \
+  contrib/asm386/*.asm contrib/asm386/*.c \
+  contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \
+  contrib/iostream/*.h  contrib/iostream2/*.h contrib/iostream2/*.cpp \
+  contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32
+
+all: example.exe minigzip.exe
+
+test: all
+	@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
+	echo hello world | ./minigzip | ./minigzip -d || \
+	  echo '		*** minigzip test FAILED ***' ; \
+	if ./example; then \
+	  echo '		*** zlib test OK ***'; \
+	else \
+	  echo '		*** zlib test FAILED ***'; \
+	fi
+
+$(ZLIB): $(OBJS)
+	$(AR) $@ $(OBJS)
+	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
+
+$(SHAREDLIB): $(OBJS) os2/z.def
+	$(LDSHARED) -o $@ $^
+
+$(SHAREDLIBIMP): os2/z.def
+	$(IMPLIB) -o $@ $^
+
+example.exe: example.o $(LIBS)
+	$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
+
+minigzip.exe: minigzip.o $(LIBS)
+	$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
+
+clean:
+	rm -f *.o *~ example minigzip libz.a libz.so* foo.gz
+
+distclean:	clean
+
+zip:
+	mv Makefile Makefile~; cp -p Makefile.in Makefile
+	rm -f test.c ztest*.c
+	v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
+	zip -ul9 zlib$$v $(DISTFILES)
+	mv Makefile~ Makefile
+
+dist:
+	mv Makefile Makefile~; cp -p Makefile.in Makefile
+	rm -f test.c ztest*.c
+	d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
+	rm -f $$d.tar.gz; \
+	if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
+	files=""; \
+	for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
+	cd ..; \
+	GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
+	if test ! -d $$d; then rm -f $$d; fi
+	mv Makefile~ Makefile
+
+tags:	
+	etags *.[ch]
+
+depend:
+	makedepend -- $(CFLAGS) -- *.[ch]
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+adler32.o: zlib.h zconf.h
+compress.o: zlib.h zconf.h
+crc32.o: zlib.h zconf.h
+deflate.o: deflate.h zutil.h zlib.h zconf.h
+example.o: zlib.h zconf.h
+gzio.o: zutil.h zlib.h zconf.h
+infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
+infcodes.o: zutil.h zlib.h zconf.h
+infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
+inffast.o: zutil.h zlib.h zconf.h inftrees.h
+inffast.o: infblock.h infcodes.h infutil.h inffast.h
+inflate.o: zutil.h zlib.h zconf.h infblock.h
+inftrees.o: zutil.h zlib.h zconf.h inftrees.h
+infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
+minigzip.o:  zlib.h zconf.h 
+trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
+uncompr.o: zlib.h zconf.h
+zutil.o: zutil.h zlib.h zconf.h  

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/os2/zlib.def
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/os2/zlib.def	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/os2/zlib.def	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,51 @@
+;
+; Slightly modified version of ../nt/zlib.dnt :-)
+;
+
+LIBRARY		Z
+DESCRIPTION	"Zlib compression library for OS/2"
+CODE		PRELOAD MOVEABLE DISCARDABLE
+DATA		PRELOAD MOVEABLE MULTIPLE
+
+EXPORTS
+    adler32
+    compress
+    crc32
+    deflate
+    deflateCopy
+    deflateEnd
+    deflateInit2_
+    deflateInit_
+    deflateParams
+    deflateReset
+    deflateSetDictionary
+    gzclose
+    gzdopen
+    gzerror
+    gzflush
+    gzopen
+    gzread
+    gzwrite
+    inflate
+    inflateEnd
+    inflateInit2_
+    inflateInit_
+    inflateReset
+    inflateSetDictionary
+    inflateSync
+    uncompress
+    zlibVersion
+    gzprintf
+    gzputc
+    gzgetc
+    gzseek
+    gzrewind
+    gztell
+    gzeof
+    gzsetparams
+    zError
+    inflateSyncPoint
+    get_crc_table
+    compress2
+    gzputs
+    gzgets

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/trees.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/trees.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/trees.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1214 @@
+/* trees.c -- output deflated data using Huffman coding
+ * Copyright (C) 1995-1998 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/*
+ *  ALGORITHM
+ *
+ *      The "deflation" process uses several Huffman trees. The more
+ *      common source values are represented by shorter bit sequences.
+ *
+ *      Each code tree is stored in a compressed form which is itself
+ * a Huffman encoding of the lengths of all the code strings (in
+ * ascending order by source values).  The actual code strings are
+ * reconstructed from the lengths in the inflate process, as described
+ * in the deflate specification.
+ *
+ *  REFERENCES
+ *
+ *      Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
+ *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
+ *
+ *      Storer, James A.
+ *          Data Compression:  Methods and Theory, pp. 49-50.
+ *          Computer Science Press, 1988.  ISBN 0-7167-8156-5.
+ *
+ *      Sedgewick, R.
+ *          Algorithms, p290.
+ *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
+ */
+
+/* @(#) $Id: trees.c,v 1.5 1998/12/18 21:38:47 koziol Exp $ */
+
+/* #define GEN_TREES_H */
+
+#include "deflate.h"
+
+#ifdef DEBUG
+#  include <ctype.h>
+#endif
+
+/* ===========================================================================
+ * Constants
+ */
+
+#define MAX_BL_BITS 7
+/* Bit length codes must not exceed MAX_BL_BITS bits */
+
+#define END_BLOCK 256
+/* end of block literal code */
+
+#define REP_3_6      16
+/* repeat previous bit length 3-6 times (2 bits of repeat count) */
+
+#define REPZ_3_10    17
+/* repeat a zero length 3-10 times  (3 bits of repeat count) */
+
+#define REPZ_11_138  18
+/* repeat a zero length 11-138 times  (7 bits of repeat count) */
+
+local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
+   = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
+
+local const int extra_dbits[D_CODES] /* extra bits for each distance code */
+   = {0,0,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};
+
+local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
+   = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
+
+local const uch bl_order[BL_CODES]
+   = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
+/* The lengths of the bit length codes are sent in order of decreasing
+ * probability, to avoid transmitting the lengths for unused bit length codes.
+ */
+
+#define Buf_size (8 * 2*sizeof(char))
+/* Number of bits used within bi_buf. (bi_buf might be implemented on
+ * more than 16 bits on some systems.)
+ */
+
+/* ===========================================================================
+ * Local data. These are initialized only once.
+ */
+
+#define DIST_CODE_LEN  512 /* see definition of array dist_code below */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+/* non ANSI compilers may not accept trees.h */
+
+local ct_data static_ltree[L_CODES+2];
+/* The static literal tree. Since the bit lengths are imposed, there is no
+ * need for the L_CODES extra codes used during heap construction. However
+ * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
+ * below).
+ */
+
+local ct_data static_dtree[D_CODES];
+/* The static distance tree. (Actually a trivial tree since all codes use
+ * 5 bits.)
+ */
+
+uch _dist_code[DIST_CODE_LEN];
+/* Distance codes. The first 256 values correspond to the distances
+ * 3 .. 258, the last 256 values correspond to the top 8 bits of
+ * the 15 bit distances.
+ */
+
+uch _length_code[MAX_MATCH-MIN_MATCH+1];
+/* length code for each normalized match length (0 == MIN_MATCH) */
+
+local int base_length[LENGTH_CODES];
+/* First normalized length for each code (0 = MIN_MATCH) */
+
+local int base_dist[D_CODES];
+/* First normalized distance for each code (0 = distance of 1) */
+
+#else
+#  include "trees.h"
+#endif /* GEN_TREES_H */
+
+struct static_tree_desc_s {
+    const ct_data *static_tree;  /* static tree or NULL */
+    const intf *extra_bits;      /* extra bits for each code or NULL */
+    int     extra_base;          /* base index for extra_bits */
+    int     elems;               /* max number of elements in the tree */
+    int     max_length;          /* max bit length for the codes */
+};
+
+local static_tree_desc  static_l_desc =
+{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
+
+local static_tree_desc  static_d_desc =
+{static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS};
+
+local static_tree_desc  static_bl_desc =
+{(const ct_data *)0, extra_blbits, 0,   BL_CODES, MAX_BL_BITS};
+
+/* ===========================================================================
+ * Local (static) routines in this file.
+ */
+
+local void tr_static_init OF((void));
+local void init_block     OF((deflate_state *s));
+local void pqdownheap     OF((deflate_state *s, ct_data *tree, int k));
+local void gen_bitlen     OF((deflate_state *s, tree_desc *desc));
+local void gen_codes      OF((ct_data *tree, int max_code, ushf *bl_count));
+local void build_tree     OF((deflate_state *s, tree_desc *desc));
+local void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));
+local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
+local int  build_bl_tree  OF((deflate_state *s));
+local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
+                              int blcodes));
+local void compress_block OF((deflate_state *s, ct_data *ltree,
+                              ct_data *dtree));
+local void set_data_type  OF((deflate_state *s));
+local unsigned bi_reverse OF((unsigned value, int length));
+local void bi_windup      OF((deflate_state *s));
+local void bi_flush       OF((deflate_state *s));
+local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
+                              int header));
+
+#ifdef GEN_TREES_H
+local void gen_trees_header OF((void));
+#endif
+
+#ifndef DEBUG
+#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
+   /* Send a code of the given tree. c and tree must not have side effects */
+
+#else /* DEBUG */
+#  define send_code(s, c, tree) \
+     { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
+       send_bits(s, tree[c].Code, tree[c].Len); }
+#endif
+
+/* ===========================================================================
+ * Output a short LSB first on the stream.
+ * IN assertion: there is enough room in pendingBuf.
+ */
+#define put_short(s, w) { \
+    put_byte(s, (uch)((w) & 0xff)); \
+    put_byte(s, (uch)((ush)(w) >> 8)); \
+}
+
+/* ===========================================================================
+ * Send a value on a given number of bits.
+ * IN assertion: length <= 16 and value fits in length bits.
+ */
+#ifdef DEBUG
+local void send_bits      OF((deflate_state *s, int value, int length));
+
+local void send_bits(s, value, length)
+    deflate_state *s;
+    int value;  /* value to send */
+    int length; /* number of bits */
+{
+    Tracevv((stderr," l %2d v %4x ", length, value));
+    Assert(length > 0 && length <= 15, "invalid length");
+    s->bits_sent += (ulg)length;
+
+    /* If not enough room in bi_buf, use (valid) bits from bi_buf and
+     * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+     * unused bits in value.
+     */
+    if (s->bi_valid > (int)Buf_size - length) {
+        s->bi_buf |= (value << s->bi_valid);
+        put_short(s, s->bi_buf);
+        s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
+        s->bi_valid += length - Buf_size;
+    } else {
+        s->bi_buf |= value << s->bi_valid;
+        s->bi_valid += length;
+    }
+}
+#else /* !DEBUG */
+
+#define send_bits(s, value, length) \
+{ int len = length;\
+  if (s->bi_valid > (int)Buf_size - len) {\
+    int val = value;\
+    s->bi_buf |= (val << s->bi_valid);\
+    put_short(s, s->bi_buf);\
+    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
+    s->bi_valid += len - Buf_size;\
+  } else {\
+    s->bi_buf |= (value) << s->bi_valid;\
+    s->bi_valid += len;\
+  }\
+}
+#endif /* DEBUG */
+
+
+#define MAX(a,b) (a >= b ? a : b)
+/* the arguments must not have side effects */
+
+/* ===========================================================================
+ * Initialize the various 'constant' tables.
+ */
+local void tr_static_init()
+{
+#if defined(GEN_TREES_H) || !defined(STDC)
+    static int static_init_done = 0;
+    int n;        /* iterates over tree elements */
+    int bits;     /* bit counter */
+    int length;   /* length value */
+    int code;     /* code value */
+    int dist;     /* distance index */
+    ush bl_count[MAX_BITS+1];
+    /* number of codes at each bit length for an optimal tree */
+
+    if (static_init_done) return;
+
+    /* For some embedded targets, global variables are not initialized: */
+    static_l_desc.static_tree = static_ltree;
+    static_l_desc.extra_bits = extra_lbits;
+    static_d_desc.static_tree = static_dtree;
+    static_d_desc.extra_bits = extra_dbits;
+    static_bl_desc.extra_bits = extra_blbits;
+
+    /* Initialize the mapping length (0..255) -> length code (0..28) */
+    length = 0;
+    for (code = 0; code < LENGTH_CODES-1; code++) {
+        base_length[code] = length;
+        for (n = 0; n < (1<<extra_lbits[code]); n++) {
+            _length_code[length++] = (uch)code;
+        }
+    }
+    Assert (length == 256, "tr_static_init: length != 256");
+    /* Note that the length 255 (match length 258) can be represented
+     * in two different ways: code 284 + 5 bits or code 285, so we
+     * overwrite length_code[255] to use the best encoding:
+     */
+    _length_code[length-1] = (uch)code;
+
+    /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
+    dist = 0;
+    for (code = 0 ; code < 16; code++) {
+        base_dist[code] = dist;
+        for (n = 0; n < (1<<extra_dbits[code]); n++) {
+            _dist_code[dist++] = (uch)code;
+        }
+    }
+    Assert (dist == 256, "tr_static_init: dist != 256");
+    dist >>= 7; /* from now on, all distances are divided by 128 */
+    for ( ; code < D_CODES; code++) {
+        base_dist[code] = dist << 7;
+        for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
+            _dist_code[256 + dist++] = (uch)code;
+        }
+    }
+    Assert (dist == 256, "tr_static_init: 256+dist != 512");
+
+    /* Construct the codes of the static literal tree */
+    for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
+    n = 0;
+    while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
+    while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
+    while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
+    while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
+    /* Codes 286 and 287 do not exist, but we must include them in the
+     * tree construction to get a canonical Huffman tree (longest code
+     * all ones)
+     */
+    gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
+
+    /* The static distance tree is trivial: */
+    for (n = 0; n < D_CODES; n++) {
+        static_dtree[n].Len = 5;
+        static_dtree[n].Code = bi_reverse((unsigned)n, 5);
+    }
+    static_init_done = 1;
+
+#  ifdef GEN_TREES_H
+    gen_trees_header();
+#  endif
+#endif /* defined(GEN_TREES_H) || !defined(STDC) */
+}
+
+/* ===========================================================================
+ * Genererate the file trees.h describing the static trees.
+ */
+#ifdef GEN_TREES_H
+#  ifndef DEBUG
+#    include <stdio.h>
+#  endif
+
+#  define SEPARATOR(i, last, width) \
+      ((i) == (last)? "\n};\n\n" :    \
+       ((i) % (width) == (width)-1 ? ",\n" : ", "))
+
+void gen_trees_header()
+{
+    FILE *header = fopen("trees.h", "w");
+    int i;
+
+    Assert (header != NULL, "Can't open trees.h");
+    fprintf(header,
+	    "/* header created automatically with -DGEN_TREES_H */\n\n");
+
+    fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
+    for (i = 0; i < L_CODES+2; i++) {
+	fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
+		static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
+    }
+
+    fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
+    for (i = 0; i < D_CODES; i++) {
+	fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
+		static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
+    }
+
+    fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
+    for (i = 0; i < DIST_CODE_LEN; i++) {
+	fprintf(header, "%2u%s", _dist_code[i],
+		SEPARATOR(i, DIST_CODE_LEN-1, 20));
+    }
+
+    fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+    for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
+	fprintf(header, "%2u%s", _length_code[i],
+		SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
+    }
+
+    fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
+    for (i = 0; i < LENGTH_CODES; i++) {
+	fprintf(header, "%1u%s", base_length[i],
+		SEPARATOR(i, LENGTH_CODES-1, 20));
+    }
+
+    fprintf(header, "local const int base_dist[D_CODES] = {\n");
+    for (i = 0; i < D_CODES; i++) {
+	fprintf(header, "%5u%s", base_dist[i],
+		SEPARATOR(i, D_CODES-1, 10));
+    }
+
+    fclose(header);
+}
+#endif /* GEN_TREES_H */
+
+/* ===========================================================================
+ * Initialize the tree data structures for a new zlib stream.
+ */
+void _tr_init(s)
+    deflate_state *s;
+{
+    tr_static_init();
+
+    s->l_desc.dyn_tree = s->dyn_ltree;
+    s->l_desc.stat_desc = &static_l_desc;
+
+    s->d_desc.dyn_tree = s->dyn_dtree;
+    s->d_desc.stat_desc = &static_d_desc;
+
+    s->bl_desc.dyn_tree = s->bl_tree;
+    s->bl_desc.stat_desc = &static_bl_desc;
+
+    s->bi_buf = 0;
+    s->bi_valid = 0;
+    s->last_eob_len = 8; /* enough lookahead for inflate */
+#ifdef DEBUG
+    s->compressed_len = 0L;
+    s->bits_sent = 0L;
+#endif
+
+    /* Initialize the first block of the first file: */
+    init_block(s);
+}
+
+/* ===========================================================================
+ * Initialize a new block.
+ */
+local void init_block(s)
+    deflate_state *s;
+{
+    int n; /* iterates over tree elements */
+
+    /* Initialize the trees. */
+    for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
+    for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
+    for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
+
+    s->dyn_ltree[END_BLOCK].Freq = 1;
+    s->opt_len = s->static_len = 0L;
+    s->last_lit = s->matches = 0;
+}
+
+#define SMALLEST 1
+/* Index within the heap array of least frequent node in the Huffman tree */
+
+
+/* ===========================================================================
+ * Remove the smallest element from the heap and recreate the heap with
+ * one less element. Updates heap and heap_len.
+ */
+#define pqremove(s, tree, top) \
+{\
+    top = s->heap[SMALLEST]; \
+    s->heap[SMALLEST] = s->heap[s->heap_len--]; \
+    pqdownheap(s, tree, SMALLEST); \
+}
+
+/* ===========================================================================
+ * Compares to subtrees, using the tree depth as tie breaker when
+ * the subtrees have equal frequency. This minimizes the worst case length.
+ */
+#define smaller(tree, n, m, depth) \
+   (tree[n].Freq < tree[m].Freq || \
+   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
+
+/* ===========================================================================
+ * Restore the heap property by moving down the tree starting at node k,
+ * exchanging a node with the smallest of its two sons if necessary, stopping
+ * when the heap property is re-established (each father smaller than its
+ * two sons).
+ */
+local void pqdownheap(s, tree, k)
+    deflate_state *s;
+    ct_data *tree;  /* the tree to restore */
+    int k;               /* node to move down */
+{
+    int v = s->heap[k];
+    int j = k << 1;  /* left son of k */
+    while (j <= s->heap_len) {
+        /* Set j to the smallest of the two sons: */
+        if (j < s->heap_len &&
+            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
+            j++;
+        }
+        /* Exit if v is smaller than both sons */
+        if (smaller(tree, v, s->heap[j], s->depth)) break;
+
+        /* Exchange v with the smallest son */
+        s->heap[k] = s->heap[j];  k = j;
+
+        /* And continue down the tree, setting j to the left son of k */
+        j <<= 1;
+    }
+    s->heap[k] = v;
+}
+
+/* ===========================================================================
+ * Compute the optimal bit lengths for a tree and update the total bit length
+ * for the current block.
+ * IN assertion: the fields freq and dad are set, heap[heap_max] and
+ *    above are the tree nodes sorted by increasing frequency.
+ * OUT assertions: the field len is set to the optimal bit length, the
+ *     array bl_count contains the frequencies for each bit length.
+ *     The length opt_len is updated; static_len is also updated if stree is
+ *     not null.
+ */
+local void gen_bitlen(s, desc)
+    deflate_state *s;
+    tree_desc *desc;    /* the tree descriptor */
+{
+    ct_data *tree        = desc->dyn_tree;
+    int max_code         = desc->max_code;
+    const ct_data *stree = desc->stat_desc->static_tree;
+    const intf *extra    = desc->stat_desc->extra_bits;
+    int base             = desc->stat_desc->extra_base;
+    int max_length       = desc->stat_desc->max_length;
+    int h;              /* heap index */
+    int n, m;           /* iterate over the tree elements */
+    int bits;           /* bit length */
+    int xbits;          /* extra bits */
+    ush f;              /* frequency */
+    int overflow = 0;   /* number of elements with bit length too large */
+
+    for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
+
+    /* In a first pass, compute the optimal bit lengths (which may
+     * overflow in the case of the bit length tree).
+     */
+    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
+
+    for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+        n = s->heap[h];
+        bits = tree[tree[n].Dad].Len + 1;
+        if (bits > max_length) bits = max_length, overflow++;
+        tree[n].Len = (ush)bits;
+        /* We overwrite tree[n].Dad which is no longer needed */
+
+        if (n > max_code) continue; /* not a leaf node */
+
+        s->bl_count[bits]++;
+        xbits = 0;
+        if (n >= base) xbits = extra[n-base];
+        f = tree[n].Freq;
+        s->opt_len += (ulg)f * (bits + xbits);
+        if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
+    }
+    if (overflow == 0) return;
+
+    Trace((stderr,"\nbit length overflow\n"));
+    /* This happens for example on obj2 and pic of the Calgary corpus */
+
+    /* Find the first bit length which could increase: */
+    do {
+        bits = max_length-1;
+        while (s->bl_count[bits] == 0) bits--;
+        s->bl_count[bits]--;      /* move one leaf down the tree */
+        s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+        s->bl_count[max_length]--;
+        /* The brother of the overflow item also moves one step up,
+         * but this does not affect bl_count[max_length]
+         */
+        overflow -= 2;
+    } while (overflow > 0);
+
+    /* Now recompute all bit lengths, scanning in increasing frequency.
+     * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
+     * lengths instead of fixing only the wrong ones. This idea is taken
+     * from 'ar' written by Haruhiko Okumura.)
+     */
+    for (bits = max_length; bits != 0; bits--) {
+        n = s->bl_count[bits];
+        while (n != 0) {
+            m = s->heap[--h];
+            if (m > max_code) continue;
+            if (tree[m].Len != (unsigned) bits) {
+                Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
+                s->opt_len += ((long)bits - (long)tree[m].Len)
+                              *(long)tree[m].Freq;
+                tree[m].Len = (ush)bits;
+            }
+            n--;
+        }
+    }
+}
+
+/* ===========================================================================
+ * Generate the codes for a given tree and bit counts (which need not be
+ * optimal).
+ * IN assertion: the array bl_count contains the bit length statistics for
+ * the given tree and the field len is set for all tree elements.
+ * OUT assertion: the field code is set for all tree elements of non
+ *     zero code length.
+ */
+local void gen_codes (tree, max_code, bl_count)
+    ct_data *tree;             /* the tree to decorate */
+    int max_code;              /* largest code with non zero frequency */
+    ushf *bl_count;            /* number of codes at each bit length */
+{
+    ush next_code[MAX_BITS+1]; /* next code value for each bit length */
+    ush code = 0;              /* running code value */
+    int bits;                  /* bit index */
+    int n;                     /* code index */
+
+    /* The distribution counts are first used to generate the code values
+     * without bit reversal.
+     */
+    for (bits = 1; bits <= MAX_BITS; bits++) {
+        next_code[bits] = code = (code + bl_count[bits-1]) << 1;
+    }
+    /* Check that the bit counts in bl_count are consistent. The last code
+     * must be all ones.
+     */
+    Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
+            "inconsistent bit counts");
+    Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
+
+    for (n = 0;  n <= max_code; n++) {
+        int len = tree[n].Len;
+        if (len == 0) continue;
+        /* Now reverse the bits */
+        tree[n].Code = bi_reverse(next_code[len]++, len);
+
+        Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
+             n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
+    }
+}
+
+/* ===========================================================================
+ * Construct one Huffman tree and assigns the code bit strings and lengths.
+ * Update the total bit length for the current block.
+ * IN assertion: the field freq is set for all tree elements.
+ * OUT assertions: the fields len and code are set to the optimal bit length
+ *     and corresponding code. The length opt_len is updated; static_len is
+ *     also updated if stree is not null. The field max_code is set.
+ */
+local void build_tree(s, desc)
+    deflate_state *s;
+    tree_desc *desc; /* the tree descriptor */
+{
+    ct_data *tree         = desc->dyn_tree;
+    const ct_data *stree  = desc->stat_desc->static_tree;
+    int elems             = desc->stat_desc->elems;
+    int n, m;          /* iterate over heap elements */
+    int max_code = -1; /* largest code with non zero frequency */
+    int node;          /* new node being created */
+
+    /* Construct the initial heap, with least frequent element in
+     * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+     * heap[0] is not used.
+     */
+    s->heap_len = 0, s->heap_max = HEAP_SIZE;
+
+    for (n = 0; n < elems; n++) {
+        if (tree[n].Freq != 0) {
+            s->heap[++(s->heap_len)] = max_code = n;
+            s->depth[n] = 0;
+        } else {
+            tree[n].Len = 0;
+        }
+    }
+
+    /* The pkzip format requires that at least one distance code exists,
+     * and that at least one bit should be sent even if there is only one
+     * possible code. So to avoid special checks later on we force at least
+     * two codes of non zero frequency.
+     */
+    while (s->heap_len < 2) {
+        node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
+        tree[node].Freq = 1;
+        s->depth[node] = 0;
+        s->opt_len--; if (stree) s->static_len -= stree[node].Len;
+        /* node is 0 or 1 so it does not have extra bits */
+    }
+    desc->max_code = max_code;
+
+    /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+     * establish sub-heaps of increasing lengths:
+     */
+    for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
+
+    /* Construct the Huffman tree by repeatedly combining the least two
+     * frequent nodes.
+     */
+    node = elems;              /* next internal node of the tree */
+    do {
+        pqremove(s, tree, n);  /* n = node of least frequency */
+        m = s->heap[SMALLEST]; /* m = node of next least frequency */
+
+        s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
+        s->heap[--(s->heap_max)] = m;
+
+        /* Create a new node father of n and m */
+        tree[node].Freq = tree[n].Freq + tree[m].Freq;
+        s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1);
+        tree[n].Dad = tree[m].Dad = (ush)node;
+#ifdef DUMP_BL_TREE
+        if (tree == s->bl_tree) {
+            fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
+                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
+        }
+#endif
+        /* and insert the new node in the heap */
+        s->heap[SMALLEST] = node++;
+        pqdownheap(s, tree, SMALLEST);
+
+    } while (s->heap_len >= 2);
+
+    s->heap[--(s->heap_max)] = s->heap[SMALLEST];
+
+    /* At this point, the fields freq and dad are set. We can now
+     * generate the bit lengths.
+     */
+    gen_bitlen(s, (tree_desc *)desc);
+
+    /* The field len is now set, we can generate the bit codes */
+    gen_codes ((ct_data *)tree, max_code, s->bl_count);
+}
+
+/* ===========================================================================
+ * Scan a literal or distance tree to determine the frequencies of the codes
+ * in the bit length tree.
+ */
+local void scan_tree (s, tree, max_code)
+    deflate_state *s;
+    ct_data *tree;   /* the tree to be scanned */
+    int max_code;    /* and its largest code of non zero frequency */
+{
+    int n;                     /* iterates over all tree elements */
+    int prevlen = -1;          /* last emitted length */
+    int curlen;                /* length of current code */
+    int nextlen = tree[0].Len; /* length of next code */
+    int count = 0;             /* repeat count of the current code */
+    int max_count = 7;         /* max repeat count */
+    int min_count = 4;         /* min repeat count */
+
+    if (nextlen == 0) max_count = 138, min_count = 3;
+    tree[max_code+1].Len = (ush)0xffff; /* guard */
+
+    for (n = 0; n <= max_code; n++) {
+        curlen = nextlen; nextlen = tree[n+1].Len;
+        if (++count < max_count && curlen == nextlen) {
+            continue;
+        } else if (count < min_count) {
+            s->bl_tree[curlen].Freq += count;
+        } else if (curlen != 0) {
+            if (curlen != prevlen) s->bl_tree[curlen].Freq++;
+            s->bl_tree[REP_3_6].Freq++;
+        } else if (count <= 10) {
+            s->bl_tree[REPZ_3_10].Freq++;
+        } else {
+            s->bl_tree[REPZ_11_138].Freq++;
+        }
+        count = 0; prevlen = curlen;
+        if (nextlen == 0) {
+            max_count = 138, min_count = 3;
+        } else if (curlen == nextlen) {
+            max_count = 6, min_count = 3;
+        } else {
+            max_count = 7, min_count = 4;
+        }
+    }
+}
+
+/* ===========================================================================
+ * Send a literal or distance tree in compressed form, using the codes in
+ * bl_tree.
+ */
+local void send_tree (s, tree, max_code)
+    deflate_state *s;
+    ct_data *tree; /* the tree to be scanned */
+    int max_code;       /* and its largest code of non zero frequency */
+{
+    int n;                     /* iterates over all tree elements */
+    int prevlen = -1;          /* last emitted length */
+    int curlen;                /* length of current code */
+    int nextlen = tree[0].Len; /* length of next code */
+    int count = 0;             /* repeat count of the current code */
+    int max_count = 7;         /* max repeat count */
+    int min_count = 4;         /* min repeat count */
+
+    /* tree[max_code+1].Len = -1; */  /* guard already set */
+    if (nextlen == 0) max_count = 138, min_count = 3;
+
+    for (n = 0; n <= max_code; n++) {
+        curlen = nextlen; nextlen = tree[n+1].Len;
+        if (++count < max_count && curlen == nextlen) {
+            continue;
+        } else if (count < min_count) {
+            do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
+
+        } else if (curlen != 0) {
+            if (curlen != prevlen) {
+                send_code(s, curlen, s->bl_tree); count--;
+            }
+            Assert(count >= 3 && count <= 6, " 3_6?");
+            send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
+
+        } else if (count <= 10) {
+            send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
+
+        } else {
+            send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
+        }
+        count = 0; prevlen = curlen;
+        if (nextlen == 0) {
+            max_count = 138, min_count = 3;
+        } else if (curlen == nextlen) {
+            max_count = 6, min_count = 3;
+        } else {
+            max_count = 7, min_count = 4;
+        }
+    }
+}
+
+/* ===========================================================================
+ * Construct the Huffman tree for the bit lengths and return the index in
+ * bl_order of the last bit length code to send.
+ */
+local int build_bl_tree(s)
+    deflate_state *s;
+{
+    int max_blindex;  /* index of last bit length code of non zero freq */
+
+    /* Determine the bit length frequencies for literal and distance trees */
+    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
+    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
+
+    /* Build the bit length tree: */
+    build_tree(s, (tree_desc *)(&(s->bl_desc)));
+    /* opt_len now includes the length of the tree representations, except
+     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+     */
+
+    /* Determine the number of bit length codes to send. The pkzip format
+     * requires that at least 4 bit length codes be sent. (appnote.txt says
+     * 3 but the actual value used is 4.)
+     */
+    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
+        if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
+    }
+    /* Update opt_len to include the bit length tree and counts */
+    s->opt_len += 3*(max_blindex+1) + 5+5+4;
+    Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
+            s->opt_len, s->static_len));
+
+    return max_blindex;
+}
+
+/* ===========================================================================
+ * Send the header for a block using dynamic Huffman trees: the counts, the
+ * lengths of the bit length codes, the literal tree and the distance tree.
+ * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
+ */
+local void send_all_trees(s, lcodes, dcodes, blcodes)
+    deflate_state *s;
+    int lcodes, dcodes, blcodes; /* number of codes for each tree */
+{
+    int rank;                    /* index in bl_order */
+
+    Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
+    Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
+            "too many codes");
+    Tracev((stderr, "\nbl counts: "));
+    send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
+    send_bits(s, dcodes-1,   5);
+    send_bits(s, blcodes-4,  4); /* not -3 as stated in appnote.txt */
+    for (rank = 0; rank < blcodes; rank++) {
+        Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
+        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
+    }
+    Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
+
+    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
+    Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
+
+    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
+    Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
+}
+
+/* ===========================================================================
+ * Send a stored block
+ */
+void _tr_stored_block(s, buf, stored_len, eof)
+    deflate_state *s;
+    charf *buf;       /* input block */
+    ulg stored_len;   /* length of input block */
+    int eof;          /* true if this is the last block for a file */
+{
+    send_bits(s, (STORED_BLOCK<<1)+eof, 3);  /* send block type */
+#ifdef DEBUG
+    s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
+    s->compressed_len += (stored_len + 4) << 3;
+#endif
+    copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
+}
+
+/* ===========================================================================
+ * Send one empty static block to give enough lookahead for inflate.
+ * This takes 10 bits, of which 7 may remain in the bit buffer.
+ * The current inflate code requires 9 bits of lookahead. If the
+ * last two codes for the previous block (real code plus EOB) were coded
+ * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
+ * the last real code. In this case we send two empty static blocks instead
+ * of one. (There are no problems if the previous block is stored or fixed.)
+ * To simplify the code, we assume the worst case of last real code encoded
+ * on one bit only.
+ */
+void _tr_align(s)
+    deflate_state *s;
+{
+    send_bits(s, STATIC_TREES<<1, 3);
+    send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+    s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
+#endif
+    bi_flush(s);
+    /* Of the 10 bits for the empty block, we have already sent
+     * (10 - bi_valid) bits. The lookahead for the last real code (before
+     * the EOB of the previous block) was thus at least one plus the length
+     * of the EOB plus what we have just sent of the empty static block.
+     */
+    if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
+        send_bits(s, STATIC_TREES<<1, 3);
+        send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+        s->compressed_len += 10L;
+#endif
+        bi_flush(s);
+    }
+    s->last_eob_len = 7;
+}
+
+/* ===========================================================================
+ * Determine the best encoding for the current block: dynamic trees, static
+ * trees or store, and output the encoded block to the zip file.
+ */
+void _tr_flush_block(s, buf, stored_len, eof)
+    deflate_state *s;
+    charf *buf;       /* input block, or NULL if too old */
+    ulg stored_len;   /* length of input block */
+    int eof;          /* true if this is the last block for a file */
+{
+    ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+    int max_blindex = 0;  /* index of last bit length code of non zero freq */
+
+    /* Build the Huffman trees unless a stored block is forced */
+    if (s->level > 0) {
+
+	 /* Check if the file is ascii or binary */
+	if (s->data_type == Z_UNKNOWN) set_data_type(s);
+
+	/* Construct the literal and distance trees */
+	build_tree(s, (tree_desc *)(&(s->l_desc)));
+	Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
+		s->static_len));
+
+	build_tree(s, (tree_desc *)(&(s->d_desc)));
+	Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
+		s->static_len));
+	/* At this point, opt_len and static_len are the total bit lengths of
+	 * the compressed block data, excluding the tree representations.
+	 */
+
+	/* Build the bit length tree for the above two trees, and get the index
+	 * in bl_order of the last bit length code to send.
+	 */
+	max_blindex = build_bl_tree(s);
+
+	/* Determine the best encoding. Compute first the block length in bytes*/
+	opt_lenb = (s->opt_len+3+7)>>3;
+	static_lenb = (s->static_len+3+7)>>3;
+
+	Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
+		opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
+		s->last_lit));
+
+	if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
+
+    } else {
+        Assert(buf != (char*)0, "lost buf");
+	opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
+    }
+
+#ifdef FORCE_STORED
+    if (buf != (char*)0) { /* force stored block */
+#else
+    if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+                       /* 4: two words for the lengths */
+#endif
+        /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
+         * Otherwise we can't have processed more than WSIZE input bytes since
+         * the last block flush, because compression would have been
+         * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
+         * transform a block into a stored block.
+         */
+        _tr_stored_block(s, buf, stored_len, eof);
+
+#ifdef FORCE_STATIC
+    } else if (static_lenb >= 0) { /* force static trees */
+#else
+    } else if (static_lenb == opt_lenb) {
+#endif
+        send_bits(s, (STATIC_TREES<<1)+eof, 3);
+        compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
+#ifdef DEBUG
+        s->compressed_len += 3 + s->static_len;
+#endif
+    } else {
+        send_bits(s, (DYN_TREES<<1)+eof, 3);
+        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
+                       max_blindex+1);
+        compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
+#ifdef DEBUG
+        s->compressed_len += 3 + s->opt_len;
+#endif
+    }
+    Assert (s->compressed_len == s->bits_sent, "bad compressed size");
+    /* The above check is made mod 2^32, for files larger than 512 MB
+     * and uLong implemented on 32 bits.
+     */
+    init_block(s);
+
+    if (eof) {
+        bi_windup(s);
+#ifdef DEBUG
+        s->compressed_len += 7;  /* align on byte boundary */
+#endif
+    }
+    Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
+           s->compressed_len-7*eof));
+}
+
+/* ===========================================================================
+ * Save the match info and tally the frequency counts. Return true if
+ * the current block must be flushed.
+ */
+int _tr_tally (s, dist, lc)
+    deflate_state *s;
+    unsigned dist;  /* distance of matched string */
+    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */
+{
+    s->d_buf[s->last_lit] = (ush)dist;
+    s->l_buf[s->last_lit++] = (uch)lc;
+    if (dist == 0) {
+        /* lc is the unmatched char */
+        s->dyn_ltree[lc].Freq++;
+    } else {
+        s->matches++;
+        /* Here, lc is the match length - MIN_MATCH */
+        dist--;             /* dist = match distance - 1 */
+        Assert((ush)dist < (ush)MAX_DIST(s) &&
+               (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
+               (ush)d_code(dist) < (ush)D_CODES,  "_tr_tally: bad match");
+
+        s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+        s->dyn_dtree[d_code(dist)].Freq++;
+    }
+
+#ifdef TRUNCATE_BLOCK
+    /* Try to guess if it is profitable to stop the current block here */
+    if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
+        /* Compute an upper bound for the compressed length */
+        ulg out_length = (ulg)s->last_lit*8L;
+        ulg in_length = (ulg)((long)s->strstart - s->block_start);
+        int dcode;
+        for (dcode = 0; dcode < D_CODES; dcode++) {
+            out_length += (ulg)s->dyn_dtree[dcode].Freq *
+                (5L+extra_dbits[dcode]);
+        }
+        out_length >>= 3;
+        Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
+               s->last_lit, in_length, out_length,
+               100L - out_length*100L/in_length));
+        if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
+    }
+#endif
+    return (s->last_lit == s->lit_bufsize-1);
+    /* We avoid equality with lit_bufsize because of wraparound at 64K
+     * on 16 bit machines and because stored blocks are restricted to
+     * 64K-1 bytes.
+     */
+}
+
+/* ===========================================================================
+ * Send the block data compressed using the given Huffman trees
+ */
+local void compress_block(s, ltree, dtree)
+    deflate_state *s;
+    ct_data *ltree; /* literal tree */
+    ct_data *dtree; /* distance tree */
+{
+    unsigned dist;      /* distance of matched string */
+    int lc;             /* match length or unmatched char (if dist == 0) */
+    unsigned lx = 0;    /* running index in l_buf */
+    unsigned code;      /* the code to send */
+    int extra;          /* number of extra bits to send */
+
+    if (s->last_lit != 0) do {
+        dist = s->d_buf[lx];
+        lc = s->l_buf[lx++];
+        if (dist == 0) {
+            send_code(s, lc, ltree); /* send a literal byte */
+            Tracecv(isgraph(lc), (stderr," '%c' ", lc));
+        } else {
+            /* Here, lc is the match length - MIN_MATCH */
+            code = _length_code[lc];
+            send_code(s, code+LITERALS+1, ltree); /* send the length code */
+            extra = extra_lbits[code];
+            if (extra != 0) {
+                lc -= base_length[code];
+                send_bits(s, lc, extra);       /* send the extra length bits */
+            }
+            dist--; /* dist is now the match distance - 1 */
+            code = d_code(dist);
+            Assert (code < D_CODES, "bad d_code");
+
+            send_code(s, code, dtree);       /* send the distance code */
+            extra = extra_dbits[code];
+            if (extra != 0) {
+                dist -= base_dist[code];
+                send_bits(s, dist, extra);   /* send the extra distance bits */
+            }
+        } /* literal or match pair ? */
+
+        /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
+        Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
+
+    } while (lx < s->last_lit);
+
+    send_code(s, END_BLOCK, ltree);
+    s->last_eob_len = ltree[END_BLOCK].Len;
+}
+
+/* ===========================================================================
+ * Set the data type to ASCII or BINARY, using a crude approximation:
+ * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
+ * IN assertion: the fields freq of dyn_ltree are set and the total of all
+ * frequencies does not exceed 64K (to fit in an int on 16 bit machines).
+ */
+local void set_data_type(s)
+    deflate_state *s;
+{
+    int n = 0;
+    unsigned ascii_freq = 0;
+    unsigned bin_freq = 0;
+    while (n < 7)        bin_freq += s->dyn_ltree[n++].Freq;
+    while (n < 128)    ascii_freq += s->dyn_ltree[n++].Freq;
+    while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
+    s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII);
+}
+
+/* ===========================================================================
+ * Reverse the first len bits of a code, using straightforward code (a faster
+ * method would use a table)
+ * IN assertion: 1 <= len <= 15
+ */
+local unsigned bi_reverse(code, len)
+    unsigned code; /* the value to invert */
+    int len;       /* its bit length */
+{
+    register unsigned res = 0;
+    do {
+        res |= code & 1;
+        code >>= 1, res <<= 1;
+    } while (--len > 0);
+    return res >> 1;
+}
+
+/* ===========================================================================
+ * Flush the bit buffer, keeping at most 7 bits in it.
+ */
+local void bi_flush(s)
+    deflate_state *s;
+{
+    if (s->bi_valid == 16) {
+        put_short(s, s->bi_buf);
+        s->bi_buf = 0;
+        s->bi_valid = 0;
+    } else if (s->bi_valid >= 8) {
+        put_byte(s, (Byte)s->bi_buf);
+        s->bi_buf >>= 8;
+        s->bi_valid -= 8;
+    }
+}
+
+/* ===========================================================================
+ * Flush the bit buffer and align the output on a byte boundary
+ */
+local void bi_windup(s)
+    deflate_state *s;
+{
+    if (s->bi_valid > 8) {
+        put_short(s, s->bi_buf);
+    } else if (s->bi_valid > 0) {
+        put_byte(s, (Byte)s->bi_buf);
+    }
+    s->bi_buf = 0;
+    s->bi_valid = 0;
+#ifdef DEBUG
+    s->bits_sent = (s->bits_sent+7) & ~7;
+#endif
+}
+
+/* ===========================================================================
+ * Copy a stored block, storing first the length and its
+ * one's complement if requested.
+ */
+local void copy_block(s, buf, len, header)
+    deflate_state *s;
+    charf    *buf;    /* the input data */
+    unsigned len;     /* its length */
+    int      header;  /* true if block header must be written */
+{
+    bi_windup(s);        /* align on byte boundary */
+    s->last_eob_len = 8; /* enough lookahead for inflate */
+
+    if (header) {
+        put_short(s, (ush)len);   
+        put_short(s, (ush)~len);
+#ifdef DEBUG
+        s->bits_sent += 2*16;
+#endif
+    }
+#ifdef DEBUG
+    s->bits_sent += (ulg)len<<3;
+#endif
+    while (len--) {
+        put_byte(s, *buf++);
+    }
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/trees.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/trees.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/trees.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,128 @@
+/* header created automatically with -DGEN_TREES_H */
+
+local const ct_data static_ltree[L_CODES+2] = {
+{{ 12},{  8}}, {{140},{  8}}, {{ 76},{  8}}, {{204},{  8}}, {{ 44},{  8}},
+{{172},{  8}}, {{108},{  8}}, {{236},{  8}}, {{ 28},{  8}}, {{156},{  8}},
+{{ 92},{  8}}, {{220},{  8}}, {{ 60},{  8}}, {{188},{  8}}, {{124},{  8}},
+{{252},{  8}}, {{  2},{  8}}, {{130},{  8}}, {{ 66},{  8}}, {{194},{  8}},
+{{ 34},{  8}}, {{162},{  8}}, {{ 98},{  8}}, {{226},{  8}}, {{ 18},{  8}},
+{{146},{  8}}, {{ 82},{  8}}, {{210},{  8}}, {{ 50},{  8}}, {{178},{  8}},
+{{114},{  8}}, {{242},{  8}}, {{ 10},{  8}}, {{138},{  8}}, {{ 74},{  8}},
+{{202},{  8}}, {{ 42},{  8}}, {{170},{  8}}, {{106},{  8}}, {{234},{  8}},
+{{ 26},{  8}}, {{154},{  8}}, {{ 90},{  8}}, {{218},{  8}}, {{ 58},{  8}},
+{{186},{  8}}, {{122},{  8}}, {{250},{  8}}, {{  6},{  8}}, {{134},{  8}},
+{{ 70},{  8}}, {{198},{  8}}, {{ 38},{  8}}, {{166},{  8}}, {{102},{  8}},
+{{230},{  8}}, {{ 22},{  8}}, {{150},{  8}}, {{ 86},{  8}}, {{214},{  8}},
+{{ 54},{  8}}, {{182},{  8}}, {{118},{  8}}, {{246},{  8}}, {{ 14},{  8}},
+{{142},{  8}}, {{ 78},{  8}}, {{206},{  8}}, {{ 46},{  8}}, {{174},{  8}},
+{{110},{  8}}, {{238},{  8}}, {{ 30},{  8}}, {{158},{  8}}, {{ 94},{  8}},
+{{222},{  8}}, {{ 62},{  8}}, {{190},{  8}}, {{126},{  8}}, {{254},{  8}},
+{{  1},{  8}}, {{129},{  8}}, {{ 65},{  8}}, {{193},{  8}}, {{ 33},{  8}},
+{{161},{  8}}, {{ 97},{  8}}, {{225},{  8}}, {{ 17},{  8}}, {{145},{  8}},
+{{ 81},{  8}}, {{209},{  8}}, {{ 49},{  8}}, {{177},{  8}}, {{113},{  8}},
+{{241},{  8}}, {{  9},{  8}}, {{137},{  8}}, {{ 73},{  8}}, {{201},{  8}},
+{{ 41},{  8}}, {{169},{  8}}, {{105},{  8}}, {{233},{  8}}, {{ 25},{  8}},
+{{153},{  8}}, {{ 89},{  8}}, {{217},{  8}}, {{ 57},{  8}}, {{185},{  8}},
+{{121},{  8}}, {{249},{  8}}, {{  5},{  8}}, {{133},{  8}}, {{ 69},{  8}},
+{{197},{  8}}, {{ 37},{  8}}, {{165},{  8}}, {{101},{  8}}, {{229},{  8}},
+{{ 21},{  8}}, {{149},{  8}}, {{ 85},{  8}}, {{213},{  8}}, {{ 53},{  8}},
+{{181},{  8}}, {{117},{  8}}, {{245},{  8}}, {{ 13},{  8}}, {{141},{  8}},
+{{ 77},{  8}}, {{205},{  8}}, {{ 45},{  8}}, {{173},{  8}}, {{109},{  8}},
+{{237},{  8}}, {{ 29},{  8}}, {{157},{  8}}, {{ 93},{  8}}, {{221},{  8}},
+{{ 61},{  8}}, {{189},{  8}}, {{125},{  8}}, {{253},{  8}}, {{ 19},{  9}},
+{{275},{  9}}, {{147},{  9}}, {{403},{  9}}, {{ 83},{  9}}, {{339},{  9}},
+{{211},{  9}}, {{467},{  9}}, {{ 51},{  9}}, {{307},{  9}}, {{179},{  9}},
+{{435},{  9}}, {{115},{  9}}, {{371},{  9}}, {{243},{  9}}, {{499},{  9}},
+{{ 11},{  9}}, {{267},{  9}}, {{139},{  9}}, {{395},{  9}}, {{ 75},{  9}},
+{{331},{  9}}, {{203},{  9}}, {{459},{  9}}, {{ 43},{  9}}, {{299},{  9}},
+{{171},{  9}}, {{427},{  9}}, {{107},{  9}}, {{363},{  9}}, {{235},{  9}},
+{{491},{  9}}, {{ 27},{  9}}, {{283},{  9}}, {{155},{  9}}, {{411},{  9}},
+{{ 91},{  9}}, {{347},{  9}}, {{219},{  9}}, {{475},{  9}}, {{ 59},{  9}},
+{{315},{  9}}, {{187},{  9}}, {{443},{  9}}, {{123},{  9}}, {{379},{  9}},
+{{251},{  9}}, {{507},{  9}}, {{  7},{  9}}, {{263},{  9}}, {{135},{  9}},
+{{391},{  9}}, {{ 71},{  9}}, {{327},{  9}}, {{199},{  9}}, {{455},{  9}},
+{{ 39},{  9}}, {{295},{  9}}, {{167},{  9}}, {{423},{  9}}, {{103},{  9}},
+{{359},{  9}}, {{231},{  9}}, {{487},{  9}}, {{ 23},{  9}}, {{279},{  9}},
+{{151},{  9}}, {{407},{  9}}, {{ 87},{  9}}, {{343},{  9}}, {{215},{  9}},
+{{471},{  9}}, {{ 55},{  9}}, {{311},{  9}}, {{183},{  9}}, {{439},{  9}},
+{{119},{  9}}, {{375},{  9}}, {{247},{  9}}, {{503},{  9}}, {{ 15},{  9}},
+{{271},{  9}}, {{143},{  9}}, {{399},{  9}}, {{ 79},{  9}}, {{335},{  9}},
+{{207},{  9}}, {{463},{  9}}, {{ 47},{  9}}, {{303},{  9}}, {{175},{  9}},
+{{431},{  9}}, {{111},{  9}}, {{367},{  9}}, {{239},{  9}}, {{495},{  9}},
+{{ 31},{  9}}, {{287},{  9}}, {{159},{  9}}, {{415},{  9}}, {{ 95},{  9}},
+{{351},{  9}}, {{223},{  9}}, {{479},{  9}}, {{ 63},{  9}}, {{319},{  9}},
+{{191},{  9}}, {{447},{  9}}, {{127},{  9}}, {{383},{  9}}, {{255},{  9}},
+{{511},{  9}}, {{  0},{  7}}, {{ 64},{  7}}, {{ 32},{  7}}, {{ 96},{  7}},
+{{ 16},{  7}}, {{ 80},{  7}}, {{ 48},{  7}}, {{112},{  7}}, {{  8},{  7}},
+{{ 72},{  7}}, {{ 40},{  7}}, {{104},{  7}}, {{ 24},{  7}}, {{ 88},{  7}},
+{{ 56},{  7}}, {{120},{  7}}, {{  4},{  7}}, {{ 68},{  7}}, {{ 36},{  7}},
+{{100},{  7}}, {{ 20},{  7}}, {{ 84},{  7}}, {{ 52},{  7}}, {{116},{  7}},
+{{  3},{  8}}, {{131},{  8}}, {{ 67},{  8}}, {{195},{  8}}, {{ 35},{  8}},
+{{163},{  8}}, {{ 99},{  8}}, {{227},{  8}}
+};
+
+local const ct_data static_dtree[D_CODES] = {
+{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
+{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
+{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
+{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
+{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
+{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
+};
+
+const uch _dist_code[DIST_CODE_LEN] = {
+ 0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,
+ 8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,
+10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,  0, 16, 17,
+18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
+};
+
+const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
+ 0,  1,  2,  3,  4,  5,  6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 12, 12,
+13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
+17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
+19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
+22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
+};
+
+local const int base_length[LENGTH_CODES] = {
+0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
+64, 80, 96, 112, 128, 160, 192, 224, 0
+};
+
+local const int base_dist[D_CODES] = {
+    0,     1,     2,     3,     4,     6,     8,    12,    16,    24,
+   32,    48,    64,    96,   128,   192,   256,   384,   512,   768,
+ 1024,  1536,  2048,  3072,  4096,  6144,  8192, 12288, 16384, 24576
+};
+

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/uncompr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/uncompr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/uncompr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,58 @@
+/* uncompr.c -- decompress a memory buffer
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* @(#) $Id: uncompr.c,v 1.5 1998/12/18 21:38:48 koziol Exp $ */
+
+#include "zlib.h"
+
+/* ===========================================================================
+     Decompresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be large enough to hold the
+   entire uncompressed data. (The size of the uncompressed data must have
+   been saved previously by the compressor and transmitted to the decompressor
+   by some mechanism outside the scope of this compression library.)
+   Upon exit, destLen is the actual size of the compressed buffer.
+     This function can be used to decompress a whole file at once if the
+   input file is mmap'ed.
+
+     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer, or Z_DATA_ERROR if the input data was corrupted.
+*/
+int ZEXPORT uncompress (dest, destLen, source, sourceLen)
+    Bytef *dest;
+    uLongf *destLen;
+    const Bytef *source;
+    uLong sourceLen;
+{
+    z_stream stream;
+    int err;
+
+    stream.next_in = (Bytef*)source;
+    stream.avail_in = (uInt)sourceLen;
+    /* Check for source > 64K on 16-bit machine: */
+    if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+
+    stream.next_out = dest;
+    stream.avail_out = (uInt)*destLen;
+    if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+    stream.zalloc = (alloc_func)0;
+    stream.zfree = (free_func)0;
+
+    err = inflateInit(&stream);
+    if (err != Z_OK) return err;
+
+    err = inflate(&stream, Z_FINISH);
+    if (err != Z_STREAM_END) {
+        inflateEnd(&stream);
+        return err == Z_OK ? Z_BUF_ERROR : err;
+    }
+    *destLen = stream.total_out;
+
+    err = inflateEnd(&stream);
+    return err;
+}

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/zconf.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/zconf.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/zconf.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,279 @@
+/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* @(#) $Id: zconf.h,v 1.6 1998/12/18 21:38:48 koziol Exp $ */
+
+#ifndef _ZCONF_H
+#define _ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ */
+#ifdef Z_PREFIX
+#  define deflateInit_	z_deflateInit_
+#  define deflate	z_deflate
+#  define deflateEnd	z_deflateEnd
+#  define inflateInit_ 	z_inflateInit_
+#  define inflate	z_inflate
+#  define inflateEnd	z_inflateEnd
+#  define deflateInit2_	z_deflateInit2_
+#  define deflateSetDictionary z_deflateSetDictionary
+#  define deflateCopy	z_deflateCopy
+#  define deflateReset	z_deflateReset
+#  define deflateParams	z_deflateParams
+#  define inflateInit2_	z_inflateInit2_
+#  define inflateSetDictionary z_inflateSetDictionary
+#  define inflateSync	z_inflateSync
+#  define inflateSyncPoint z_inflateSyncPoint
+#  define inflateReset	z_inflateReset
+#  define compress	z_compress
+#  define compress2	z_compress2
+#  define uncompress	z_uncompress
+#  define adler32	z_adler32
+#  define crc32		z_crc32
+#  define get_crc_table z_get_crc_table
+
+#  define Byte		z_Byte
+#  define uInt		z_uInt
+#  define uLong		z_uLong
+#  define Bytef	        z_Bytef
+#  define charf		z_charf
+#  define intf		z_intf
+#  define uIntf		z_uIntf
+#  define uLongf	z_uLongf
+#  define voidpf	z_voidpf
+#  define voidp		z_voidp
+#endif
+
+#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
+#  define WIN32
+#endif
+#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
+#  ifndef __32BIT__
+#    define __32BIT__
+#  endif
+#endif
+#if defined(__MSDOS__) && !defined(MSDOS)
+#  define MSDOS
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#if defined(MSDOS) && !defined(__32BIT__)
+#  define MAXSEG_64K
+#endif
+#ifdef MSDOS
+#  define UNALIGNED_OK
+#endif
+
+#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32))  && !defined(STDC)
+#  define STDC
+#endif
+#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
+#  ifndef STDC
+#    define STDC
+#  endif
+#endif
+
+#ifndef STDC
+#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+#    define const
+#  endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
+#  define NO_DUMMY_DECL
+#endif
+
+/* Old Borland C incorrectly complains about missing returns: */
+#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
+#  define NEED_DUMMY_RETURN
+#endif
+
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+#  ifdef MAXSEG_64K
+#    define MAX_MEM_LEVEL 8
+#  else
+#    define MAX_MEM_LEVEL 9
+#  endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+#  define MAX_WBITS   15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+            (1 << (windowBits+2)) +  (1 << (memLevel+9))
+ that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+   The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+                        /* Type declarations */
+
+#ifndef OF /* function prototypes */
+#  ifdef STDC
+#    define OF(args)  args
+#  else
+#    define OF(args)  ()
+#  endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
+   /* MSC small or medium model */
+#  define SMALL_MEDIUM
+#  ifdef _MSC_VER
+#    define FAR _far
+#  else
+#    define FAR far
+#  endif
+#endif
+#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
+#  ifndef __32BIT__
+#    define SMALL_MEDIUM
+#    define FAR _far
+#  endif
+#endif
+
+/* Compile with -DZLIB_DLL for Windows DLL support */
+#if defined(ZLIB_DLL)
+#  if defined(_WINDOWS) || defined(WINDOWS)
+#    ifdef FAR
+#      undef FAR
+#    endif
+#    include <windows.h>
+#    define ZEXPORT  WINAPI
+#    ifdef WIN32
+#      define ZEXPORTVA  WINAPIV
+#    else
+#      define ZEXPORTVA  FAR _cdecl _export
+#    endif
+#  endif
+#  if defined (__BORLANDC__)
+#    if (__BORLANDC__ >= 0x0500) && defined (WIN32)
+#      include <windows.h>
+#      define ZEXPORT __declspec(dllexport) WINAPI
+#      define ZEXPORTRVA __declspec(dllexport) WINAPIV
+#    else
+#      if defined (_Windows) && defined (__DLL__)
+#        define ZEXPORT _export
+#        define ZEXPORTVA _export
+#      endif
+#    endif
+#  endif
+#endif
+
+#if defined (__BEOS__)
+#  if defined (ZLIB_DLL)
+#    define ZEXTERN extern __declspec(dllexport)
+#  else
+#    define ZEXTERN extern __declspec(dllimport)
+#  endif
+#endif
+
+#ifndef ZEXPORT
+#  define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+#  define ZEXPORTVA
+#endif
+#ifndef ZEXTERN
+#  define ZEXTERN extern
+#endif
+
+#ifndef FAR
+#   define FAR
+#endif
+
+#if !defined(MACOS) && !defined(TARGET_OS_MAC)
+typedef unsigned char  Byte;  /* 8 bits */
+#endif
+typedef unsigned int   uInt;  /* 16 bits or more */
+typedef unsigned long  uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+#  define Bytef Byte FAR
+#else
+   typedef Byte  FAR Bytef;
+#endif
+typedef char  FAR charf;
+typedef int   FAR intf;
+typedef uInt  FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+   typedef void FAR *voidpf;
+   typedef void     *voidp;
+#else
+   typedef Byte FAR *voidpf;
+   typedef Byte     *voidp;
+#endif
+
+#ifdef HAVE_UNISTD_H
+#  include <sys/types.h> /* for off_t */
+#  include <unistd.h>    /* for SEEK_* and off_t */
+#  define z_off_t  off_t
+#endif
+#ifndef SEEK_SET
+#  define SEEK_SET        0       /* Seek from beginning of file.  */
+#  define SEEK_CUR        1       /* Seek from current position.  */
+#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
+#endif
+#ifndef z_off_t
+#  define  z_off_t long
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+#   pragma map(deflateInit_,"DEIN")
+#   pragma map(deflateInit2_,"DEIN2")
+#   pragma map(deflateEnd,"DEEND")
+#   pragma map(inflateInit_,"ININ")
+#   pragma map(inflateInit2_,"ININ2")
+#   pragma map(inflateEnd,"INEND")
+#   pragma map(inflateSync,"INSY")
+#   pragma map(inflateSetDictionary,"INSEDI")
+#   pragma map(inflate_blocks,"INBL")
+#   pragma map(inflate_blocks_new,"INBLNE")
+#   pragma map(inflate_blocks_free,"INBLFR")
+#   pragma map(inflate_blocks_reset,"INBLRE")
+#   pragma map(inflate_codes_free,"INCOFR")
+#   pragma map(inflate_codes,"INCO")
+#   pragma map(inflate_fast,"INFA")
+#   pragma map(inflate_flush,"INFLU")
+#   pragma map(inflate_mask,"INMA")
+#   pragma map(inflate_set_dictionary,"INSEDI2")
+#   pragma map(inflate_copyright,"INCOPY")
+#   pragma map(inflate_trees_bits,"INTRBI")
+#   pragma map(inflate_trees_dynamic,"INTRDY")
+#   pragma map(inflate_trees_fixed,"INTRFI")
+#   pragma map(inflate_trees_free,"INTRFR")
+#endif
+
+#endif /* _ZCONF_H */

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.3
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.3	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.3	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,107 @@
+.TH ZLIB 3 "9 July 1998"
+.SH NAME
+zlib \- compression/decompression library
+.SH SYNOPSIS
+[see
+.I zlib.h
+for full description]
+.SH DESCRIPTION
+The
+.I zlib
+library is a general purpose data compression library.
+The code is thread safe.
+It provides in-memory compression and decompression functions,
+including integrity checks of the uncompressed data.
+This version of the library supports only one compression method (deflation)
+but other algorithms will be added later and will have the same stream interface.
+.LP
+Compression can be done in a single step if the buffers are large enough
+(for example if an input file is mmap'ed),
+or can be done by repeated calls of the compression function.
+In the latter case,
+the application must provide more input and/or consume the output
+(providing more output space) before each call.
+.LP
+The library also supports reading and writing files in
+.I gzip
+(.gz) format
+with an interface similar to that of stdio.
+.LP
+The library does not install any signal handler. The decoder checks
+the consistency of the compressed data, so the library should never
+crash even in case of corrupted input.
+.LP
+All functions of the compression library are documented in the file
+.IR zlib.h.
+The distribution source includes examples of use of the library
+the files
+.I example.c
+and
+.IR minigzip.c .
+.LP
+A Java implementation of
+.IR zlib
+is available in the Java Development Kit 1.1
+.IP
+http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
+.LP
+A Perl interface to
+.IR zlib ,
+written by Paul Marquess (pmarquess at bfsec.bt.co.uk)
+is available at CPAN (Comprehensive Perl Archive Network) sites,
+such as:
+.IP
+ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib*
+.LP
+A Python interface to
+.IR zlib
+written by A.M. Kuchling <amk at magnet.com>
+is available from the Python Software Association sites, such as:
+.IP
+ftp://ftp.python.org/pub/python/contrib/Encoding/zlib*.tar.gz
+.SH "SEE ALSO"
+Questions about zlib should be sent to:
+.IP
+zlib at quest.jpl.nasa.gov
+or, if this fails, to the author addresses given below.
+The zlib home page is:
+.IP
+http://www.cdrom.com/pub/infozip/zlib/
+.LP
+The data format used by the zlib library is described by RFC
+(Request for Comments) 1950 to 1952 in the files: 
+.IP
+ftp://ds.internic.net/rfc/rfc1950.txt (zlib format)
+.br
+rfc1951.txt (deflate format)
+.br
+rfc1952.txt (gzip format)
+.LP
+These documents are also available in other formats from:
+.IP
+ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
+.SH AUTHORS
+Version 1.1.3
+Copyright (C) 1995-1998 Jean-loup Gailly (jloup at gzip.org)
+and Mark Adler (madler at alumni.caltech.edu).
+.LP
+This software is provided "as-is,"
+without any express or implied warranty.
+In no event will the authors be held liable for any damages
+arising from the use of this software.
+See the distribution directory with respect to requirements
+governing redistribution.
+The deflate format used by
+.I zlib
+was defined by Phil Katz.
+The deflate and
+.I zlib
+specifications were written by L. Peter Deutsch.
+Thanks to all the people who reported problems and suggested various
+improvements in
+.IR zlib ;
+who are too numerous to cite here.
+.LP
+UNIX manual page by R. P. C. Rodgers,
+U.S. National Library of Medicine (rodgers at nlm.nih.gov).
+.\" end of man page

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,893 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+  version 1.1.3, July 9th, 1998
+
+  Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup at gzip.org          madler at alumni.caltech.edu
+
+
+  The data format used by the zlib library is described by RFCs (Request for
+  Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
+  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef _ZLIB_H
+#define _ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.1.3"
+
+/* 
+     The 'zlib' compression library provides in-memory compression and
+  decompression functions, including integrity checks of the uncompressed
+  data.  This version of the library supports only one compression method
+  (deflation) but other algorithms will be added later and will have the same
+  stream interface.
+
+     Compression can be done in a single step if the buffers are large
+  enough (for example if an input file is mmap'ed), or can be done by
+  repeated calls of the compression function.  In the latter case, the
+  application must provide more input and/or consume the output
+  (providing more output space) before each call.
+
+     The library also supports reading and writing files in gzip (.gz) format
+  with an interface similar to that of stdio.
+
+     The library does not install any signal handler. The decoder checks
+  the consistency of the compressed data, so the library should never
+  crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+    Bytef    *next_in;  /* next input byte */
+    uInt     avail_in;  /* number of bytes available at next_in */
+    uLong    total_in;  /* total nb of input bytes read so far */
+
+    Bytef    *next_out; /* next output byte should be put there */
+    uInt     avail_out; /* remaining free space at next_out */
+    uLong    total_out; /* total nb of bytes output so far */
+
+    char     *msg;      /* last error message, NULL if no error */
+    struct internal_state FAR *state; /* not visible by applications */
+
+    alloc_func zalloc;  /* used to allocate the internal state */
+    free_func  zfree;   /* used to free the internal state */
+    voidpf     opaque;  /* private data object passed to zalloc and zfree */
+
+    int     data_type;  /* best guess about the data type: ascii or binary */
+    uLong   adler;      /* adler32 value of the uncompressed data */
+    uLong   reserved;   /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+   The application must update next_in and avail_in when avail_in has
+   dropped to zero. It must update next_out and avail_out when avail_out
+   has dropped to zero. The application must initialize zalloc, zfree and
+   opaque before calling the init function. All other fields are set by the
+   compression library and must not be updated by the application.
+
+   The opaque value provided by the application will be passed as the first
+   parameter for calls of zalloc and zfree. This can be useful for custom
+   memory management. The compression library attaches no meaning to the
+   opaque value.
+
+   zalloc must return Z_NULL if there is not enough memory for the object.
+   If zlib is used in a multi-threaded application, zalloc and zfree must be
+   thread safe.
+
+   On 16-bit systems, the functions zalloc and zfree must be able to allocate
+   exactly 65536 bytes, but will not be required to allocate more than this
+   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+   pointers returned by zalloc for objects of exactly 65536 bytes *must*
+   have their offset normalized to zero. The default allocation function
+   provided by this library ensures this (see zutil.c). To reduce memory
+   requirements and avoid any allocation of 64K objects, at the expense of
+   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+   The fields total_in and total_out can be used for statistics or
+   progress reports. After compression, total_in holds the total size of
+   the uncompressed data and may be saved for use in the decompressor
+   (particularly if the decompressor wants to decompress everything in
+   a single step).
+*/
+
+                        /* constants */
+
+#define Z_NO_FLUSH      0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH    2
+#define Z_FULL_FLUSH    3
+#define Z_FINISH        4
+/* Allowed flush values; see deflate() below for details */
+
+#define Z_OK            0
+#define Z_STREAM_END    1
+#define Z_NEED_DICT     2
+#define Z_ERRNO        (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR   (-3)
+#define Z_MEM_ERROR    (-4)
+#define Z_BUF_ERROR    (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION         0
+#define Z_BEST_SPEED             1
+#define Z_BEST_COMPRESSION       9
+#define Z_DEFAULT_COMPRESSION  (-1)
+/* compression levels */
+
+#define Z_FILTERED            1
+#define Z_HUFFMAN_ONLY        2
+#define Z_DEFAULT_STRATEGY    0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY   0
+#define Z_ASCII    1
+#define Z_UNKNOWN  2
+/* Possible values of the data_type field */
+
+#define Z_DEFLATED   8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+                        /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+   If the first character differs, the library code actually used is
+   not compatible with the zlib.h header file used by the application.
+   This check is automatically made by deflateInit and inflateInit.
+ */
+
+/* 
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+     Initializes the internal stream state for compression. The fields
+   zalloc, zfree and opaque must be initialized before by the caller.
+   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+   use default allocation functions.
+
+     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+   1 gives best speed, 9 gives best compression, 0 gives no compression at
+   all (the input data is simply copied a block at a time).
+   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+   compression (currently equivalent to level 6).
+
+     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+   with the version assumed by the caller (ZLIB_VERSION).
+   msg is set to null if there is no error message.  deflateInit does not
+   perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+    deflate compresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may introduce some
+  output latency (reading input without producing any output) except when
+  forced to flush.
+
+    The detailed semantics are as follows. deflate performs one or both of the
+  following actions:
+
+  - Compress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in and avail_in are updated and
+    processing will resume at this point for the next call of deflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly. This action is forced if the parameter flush is non zero.
+    Forcing flush frequently degrades the compression ratio, so this parameter
+    should be set only when necessary (in interactive applications).
+    Some output may be provided even if flush is not set.
+
+  Before the call of deflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating avail_in or avail_out accordingly; avail_out
+  should never be zero before the call. The application can consume the
+  compressed output when it wants, for example when the output buffer is full
+  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+  and with zero avail_out, it must be called again after making room in the
+  output buffer because there might be more output pending.
+
+    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+  flushed to the output buffer and the output is aligned on a byte boundary, so
+  that the decompressor can get all input data available so far. (In particular
+  avail_in is zero after the call if enough output space has been provided
+  before the call.)  Flushing may degrade compression for some compression
+  algorithms and so it should be used only when necessary.
+
+    If flush is set to Z_FULL_FLUSH, all output is flushed as with
+  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+  restart from this point if previous compressed data has been damaged or if
+  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+  the compression.
+
+    If deflate returns with avail_out == 0, this function must be called again
+  with the same value of the flush parameter and more output space (updated
+  avail_out), until the flush is complete (deflate returns with non-zero
+  avail_out).
+
+    If the parameter flush is set to Z_FINISH, pending input is processed,
+  pending output is flushed and deflate returns with Z_STREAM_END if there
+  was enough output space; if deflate returns with Z_OK, this function must be
+  called again with Z_FINISH and more output space (updated avail_out) but no
+  more input data, until it returns with Z_STREAM_END or an error. After
+  deflate has returned Z_STREAM_END, the only possible operations on the
+  stream are deflateReset or deflateEnd.
+  
+    Z_FINISH can be used immediately after deflateInit if all the compression
+  is to be done in a single step. In this case, avail_out must be at least
+  0.1% larger than avail_in plus 12 bytes.  If deflate does not return
+  Z_STREAM_END, then it must be called again as described above.
+
+    deflate() sets strm->adler to the adler32 checksum of all input read
+  so far (that is, total_in bytes).
+
+    deflate() may update data_type if it can make a good guess about
+  the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
+  binary. This field is only for information purposes and does not affect
+  the compression algorithm in any manner.
+
+    deflate() returns Z_OK if some progress has been made (more input
+  processed or more output produced), Z_STREAM_END if all input has been
+  consumed and all output has been produced (only when flush is set to
+  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+  (for example avail_in or avail_out was zero).
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+   prematurely (some input or output was discarded). In the error case,
+   msg may be set but then points to a static string (which must not be
+   deallocated).
+*/
+
+
+/* 
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+     Initializes the internal stream state for decompression. The fields
+   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+   value depends on the compression method), inflateInit determines the
+   compression method from the zlib header and allocates all data structures
+   accordingly; otherwise the allocation will be deferred to the first call of
+   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+   use default allocation functions.
+
+     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+   version assumed by the caller.  msg is set to null if there is no error
+   message. inflateInit does not perform any decompression apart from reading
+   the zlib header if present: this will be done by inflate().  (So next_in and
+   avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+    inflate decompresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may some
+  introduce some output latency (reading input without producing any output)
+  except when forced to flush.
+
+  The detailed semantics are as follows. inflate performs one or both of the
+  following actions:
+
+  - Decompress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in is updated and processing
+    will resume at this point for the next call of inflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly.  inflate() provides as much output as possible, until there
+    is no more input data or no more space in the output buffer (see below
+    about the flush parameter).
+
+  Before the call of inflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating the next_* and avail_* values accordingly.
+  The application can consume the uncompressed output when it wants, for
+  example when the output buffer is full (avail_out == 0), or after each
+  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+  must be called again after making room in the output buffer because there
+  might be more output pending.
+
+    If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
+  output as possible to the output buffer. The flushing behavior of inflate is
+  not specified for values of the flush parameter other than Z_SYNC_FLUSH
+  and Z_FINISH, but the current implementation actually flushes as much output
+  as possible anyway.
+
+    inflate() should normally be called until it returns Z_STREAM_END or an
+  error. However if all decompression is to be performed in a single step
+  (a single call of inflate), the parameter flush should be set to
+  Z_FINISH. In this case all pending input is processed and all pending
+  output is flushed; avail_out must be large enough to hold all the
+  uncompressed data. (The size of the uncompressed data may have been saved
+  by the compressor for this purpose.) The next operation on this stream must
+  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+  is never required, but can be used to inform inflate that a faster routine
+  may be used for the single inflate() call.
+
+     If a preset dictionary is needed at this point (see inflateSetDictionary
+  below), inflate sets strm-adler to the adler32 checksum of the
+  dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise 
+  it sets strm->adler to the adler32 checksum of all output produced
+  so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
+  an error code as described below. At the end of the stream, inflate()
+  checks that its computed adler32 checksum is equal to that saved by the
+  compressor and returns Z_STREAM_END only if the checksum is correct.
+
+    inflate() returns Z_OK if some progress has been made (more input processed
+  or more output produced), Z_STREAM_END if the end of the compressed data has
+  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+  corrupted (input stream not conforming to the zlib format or incorrect
+  adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
+  (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
+  enough memory, Z_BUF_ERROR if no progress is possible or if there was not
+  enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
+  case, the application may then call inflateSync to look for a good
+  compression block.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+   was inconsistent. In the error case, msg may be set but then points to a
+   static string (which must not be deallocated).
+*/
+
+                        /* Advanced functions */
+
+/*
+    The following functions are needed only in some special applications.
+*/
+
+/*   
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+                                     int  level,
+                                     int  method,
+                                     int  windowBits,
+                                     int  memLevel,
+                                     int  strategy));
+
+     This is another version of deflateInit with more compression options. The
+   fields next_in, zalloc, zfree and opaque must be initialized before by
+   the caller.
+
+     The method parameter is the compression method. It must be Z_DEFLATED in
+   this version of the library.
+
+     The windowBits parameter is the base two logarithm of the window size
+   (the size of the history buffer).  It should be in the range 8..15 for this
+   version of the library. Larger values of this parameter result in better
+   compression at the expense of memory usage. The default value is 15 if
+   deflateInit is used instead.
+
+     The memLevel parameter specifies how much memory should be allocated
+   for the internal compression state. memLevel=1 uses minimum memory but
+   is slow and reduces compression ratio; memLevel=9 uses maximum memory
+   for optimal speed. The default value is 8. See zconf.h for total memory
+   usage as a function of windowBits and memLevel.
+
+     The strategy parameter is used to tune the compression algorithm. Use the
+   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+   filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
+   string match).  Filtered data consists mostly of small values with a
+   somewhat random distribution. In this case, the compression algorithm is
+   tuned to compress them better. The effect of Z_FILTERED is to force more
+   Huffman coding and less string matching; it is somewhat intermediate
+   between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
+   the compression ratio but not the correctness of the compressed output even
+   if it is not set appropriately.
+
+      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+   method). msg is set to null if there is no error message.  deflateInit2 does
+   not perform any compression: this will be done by deflate().
+*/
+                            
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the compression dictionary from the given byte sequence
+   without producing any compressed output. This function must be called
+   immediately after deflateInit, deflateInit2 or deflateReset, before any
+   call of deflate. The compressor and decompressor must use exactly the same
+   dictionary (see inflateSetDictionary).
+
+     The dictionary should consist of strings (byte sequences) that are likely
+   to be encountered later in the data to be compressed, with the most commonly
+   used strings preferably put towards the end of the dictionary. Using a
+   dictionary is most useful when the data to be compressed is short and can be
+   predicted with good accuracy; the data can then be compressed better than
+   with the default empty dictionary.
+
+     Depending on the size of the compression data structures selected by
+   deflateInit or deflateInit2, a part of the dictionary may in effect be
+   discarded, for example if the dictionary is larger than the window size in
+   deflate or deflate2. Thus the strings most likely to be useful should be
+   put at the end of the dictionary, not at the front.
+
+     Upon return of this function, strm->adler is set to the Adler32 value
+   of the dictionary; the decompressor may later use this value to determine
+   which dictionary has been used by the compressor. (The Adler32 value
+   applies to the whole dictionary even if only a subset of the dictionary is
+   actually used by the compressor.)
+
+     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent (for example if deflate has already been called for this stream
+   or if the compression method is bsort). deflateSetDictionary does not
+   perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when several compression strategies will be
+   tried, for example when there are several ways of pre-processing the input
+   data with a filter. The streams that will be discarded should then be freed
+   by calling deflateEnd.  Note that deflateCopy duplicates the internal
+   compression state which can be quite large, so this strategy is slow and
+   can consume lots of memory.
+
+     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being NULL). msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to deflateEnd followed by deflateInit,
+   but does not free and reallocate all the internal compression state.
+   The stream will keep the same compression level and any other attributes
+   that may have been set by deflateInit2.
+
+      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+				      int level,
+				      int strategy));
+/*
+     Dynamically update the compression level and compression strategy.  The
+   interpretation of level and strategy is as in deflateInit2.  This can be
+   used to switch between compression and straight copy of the input data, or
+   to switch to a different kind of input data requiring a different
+   strategy. If the compression level is changed, the input available so far
+   is compressed with the old level (and may be flushed); the new level will
+   take effect only at the next call of deflate().
+
+     Before the call of deflateParams, the stream state must be set as for
+   a call of deflate(), since the currently available input may have to
+   be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+   if strm->avail_out was zero.
+*/
+
+/*   
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+                                     int  windowBits));
+
+     This is another version of inflateInit with an extra parameter. The
+   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+   before by the caller.
+
+     The windowBits parameter is the base two logarithm of the maximum window
+   size (the size of the history buffer).  It should be in the range 8..15 for
+   this version of the library. The default value is 15 if inflateInit is used
+   instead. If a compressed stream with a larger window size is given as
+   input, inflate() will return with the error code Z_DATA_ERROR instead of
+   trying to allocate a larger window.
+
+      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
+   memLevel). msg is set to null if there is no error message.  inflateInit2
+   does not perform any decompression apart from reading the zlib header if
+   present: this will be done by inflate(). (So next_in and avail_in may be
+   modified, but next_out and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the decompression dictionary from the given uncompressed byte
+   sequence. This function must be called immediately after a call of inflate
+   if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
+   can be determined from the Adler32 value returned by this call of
+   inflate. The compressor and decompressor must use exactly the same
+   dictionary (see deflateSetDictionary).
+
+     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+   expected one (incorrect Adler32 value). inflateSetDictionary does not
+   perform any decompression: this will be done by subsequent calls of
+   inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/* 
+    Skips invalid compressed data until a full flush point (see above the
+  description of deflate with Z_FULL_FLUSH) can be found, or until all
+  available input is skipped. No output is provided.
+
+    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+  case, the application may save the current current value of total_in which
+  indicates where valid compressed data was found. In the error case, the
+  application may repeatedly call inflateSync, providing more input each time,
+  until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to inflateEnd followed by inflateInit,
+   but does not free and reallocate all the internal decompression state.
+   The stream will keep attributes that may have been set by inflateInit2.
+
+      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+
+                        /* utility functions */
+
+/*
+     The following utility functions are implemented on top of the
+   basic stream-oriented functions. To simplify the interface, some
+   default options are assumed (compression level and memory usage,
+   standard memory allocation functions). The source code of these
+   utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
+                                 const Bytef *source, uLong sourceLen));
+/*
+     Compresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be at least 0.1% larger than
+   sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
+   compressed buffer.
+     This function can be used to compress a whole file at once if the
+   input file is mmap'ed.
+     compress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
+                                  const Bytef *source, uLong sourceLen,
+                                  int level));
+/*
+     Compresses the source buffer into the destination buffer. The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer. Upon entry, destLen is the total size of the
+   destination buffer, which must be at least 0.1% larger than sourceLen plus
+   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
+                                   const Bytef *source, uLong sourceLen));
+/*
+     Decompresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be large enough to hold the
+   entire uncompressed data. (The size of the uncompressed data must have
+   been saved previously by the compressor and transmitted to the decompressor
+   by some mechanism outside the scope of this compression library.)
+   Upon exit, destLen is the actual size of the compressed buffer.
+     This function can be used to decompress a whole file at once if the
+   input file is mmap'ed.
+
+     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer, or Z_DATA_ERROR if the input data was corrupted.
+*/
+
+
+typedef voidp gzFile;
+
+ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
+/*
+     Opens a gzip (.gz) file for reading or writing. The mode parameter
+   is as in fopen ("rb" or "wb") but can also include a compression level
+   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+   Huffman only compression as in "wb1h". (See the description
+   of deflateInit2 for more information about the strategy parameter.)
+
+     gzopen can be used to read a file which is not in gzip format; in this
+   case gzread will directly read from the file without decompression.
+
+     gzopen returns NULL if the file could not be opened or if there was
+   insufficient memory to allocate the (de)compression state; errno
+   can be checked to distinguish the two cases (if errno is zero, the
+   zlib error is Z_MEM_ERROR).  */
+
+ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
+/*
+     gzdopen() associates a gzFile with the file descriptor fd.  File
+   descriptors are obtained from calls like open, dup, creat, pipe or
+   fileno (in the file has been previously opened with fopen).
+   The mode parameter is as in gzopen.
+     The next call of gzclose on the returned gzFile will also close the
+   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+     gzdopen returns NULL if there was insufficient memory to allocate
+   the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+     Dynamically update the compression level or strategy. See the description
+   of deflateInit2 for the meaning of these parameters.
+     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+   opened for writing.
+*/
+
+ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
+/*
+     Reads the given number of uncompressed bytes from the compressed file.
+   If the input file was not in gzip format, gzread copies the given number
+   of bytes into the buffer.
+     gzread returns the number of uncompressed bytes actually read (0 for
+   end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT    gzwrite OF((gzFile file, 
+				   const voidp buf, unsigned len));
+/*
+     Writes the given number of uncompressed bytes into the compressed file.
+   gzwrite returns the number of uncompressed bytes actually written
+   (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
+/*
+     Converts, formats, and writes the args to the compressed file under
+   control of the format string, as in fprintf. gzprintf returns the number of
+   uncompressed bytes actually written (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+      Writes the given null-terminated string to the compressed file, excluding
+   the terminating null character.
+      gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+      Reads bytes from the compressed file until len-1 characters are read, or
+   a newline character is read and transferred to buf, or an end-of-file
+   condition is encountered.  The string is then terminated with a null
+   character.
+      gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
+/*
+      Writes c, converted to an unsigned char, into the compressed file.
+   gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
+/*
+      Reads one byte from the compressed file. gzgetc returns this byte
+   or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
+/*
+     Flushes all pending output into the compressed file. The parameter
+   flush is as in the deflate() function. The return value is the zlib
+   error number (see function gzerror below). gzflush returns Z_OK if
+   the flush parameter is Z_FINISH and all output could be flushed.
+     gzflush should be called only when strictly necessary because it can
+   degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
+				      z_off_t offset, int whence));
+/* 
+      Sets the starting position for the next gzread or gzwrite on the
+   given compressed file. The offset represents a number of bytes in the
+   uncompressed data stream. The whence parameter is defined as in lseek(2);
+   the value SEEK_END is not supported.
+     If the file is opened for reading, this function is emulated but can be
+   extremely slow. If the file is opened for writing, only forward seeks are
+   supported; gzseek then compresses a sequence of zeroes up to the new
+   starting position.
+
+      gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error, in
+   particular if the file is opened for writing and the new starting position
+   would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
+/*
+     Rewinds the given file. This function is supported only for reading.
+
+   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
+/*
+     Returns the starting position for the next gzread or gzwrite on the
+   given compressed file. This position represents a number of bytes in the
+   uncompressed data stream.
+
+   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+     Returns 1 when EOF has previously been detected reading the given
+   input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
+/*
+     Flushes all pending output if necessary, closes the compressed file
+   and deallocates all the (de)compression state. The return value is the zlib
+   error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+     Returns the error message for the last error which occurred on the
+   given compressed file. errnum is set to zlib error number. If an
+   error occurred in the file system and not in the compression library,
+   errnum is set to Z_ERRNO and the application may consult errno
+   to get the exact error code.
+*/
+
+                        /* checksum functions */
+
+/*
+     These functions are not related to compression but are exported
+   anyway because they might be useful in applications using the
+   compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+
+/*
+     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+   return the updated checksum. If buf is NULL, this function returns
+   the required initial value for the checksum.
+   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+   much faster. Usage example:
+
+     uLong adler = adler32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       adler = adler32(adler, buffer, length);
+     }
+     if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
+/*
+     Update a running crc with the bytes buf[0..len-1] and return the updated
+   crc. If buf is NULL, this function returns the required initial value
+   for the crc. Pre- and post-conditioning (one's complement) is performed
+   within this function so it shouldn't be done by the application.
+   Usage example:
+
+     uLong crc = crc32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       crc = crc32(crc, buffer, length);
+     }
+     if (crc != original_crc) error();
+*/
+
+
+                        /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
+                                      int windowBits, int memLevel,
+                                      int strategy, const char *version,
+                                      int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
+                                      const char *version, int stream_size));
+#define deflateInit(strm, level) \
+        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+
+
+#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
+    struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char   * ZEXPORT zError           OF((int err));
+ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZLIB_H */

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/zlib.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2075 @@
+(This file must be converted with BinHex 4.0)
+
+:$(TXD@)ZF(*[DQ9MG!"069"b3eG*43!!!!'%E3!!!!$1d at 0[Ef`!!!!#!!!!+!!
+"GSm!!ADh!!!0YJ!!!)F"!!!!!!!!!!!!!!!!"3%!rrm!!!!!!!!!!2rr!3%"!3%
+!!!!!(J%"!!!!!!!!!!#CQ3!!2rmrrcrr!!%!#3C0EfjKBfm!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!"!!S!!S"`J+!!#J!#J(#!S!!!!!!!!!!!!!!!!!!!!!
+!!3!!!3"G!+)#$!)D!!-!!l#T!!$lf!!!!#)!!!$*!!!!bJ!!!-X!!!$-!!!!a3!
+!!-J!!!$0!!!!cJ!!!-m!!!$%!!!!a`!!!0!!!!$4!!!!dJ!!!0-!!!$8!!!!e3!
+!!0B!!!$A!!!!f!!!!0N!!!$D!!!!aJ!!!,)!!!#c!!!!Y!!!!,8!!!#Z!!!!X3!
+!!,B!!!#h!!!!Z!!!!+d!!!#`!!!!Z3!!!,S!!!#l!!!![!!!!,d!!!#q!!!![`!
+!!-!!!!$"!!!!`J!!!--!!!#[!!!!Q`!!!*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!!!!d3!!!!!!!!!!,Hm!!!"LF(*PCJ!8,P3!!!$5!!!!!!!!!!!
+Z83!!!$K`FQ9Q!"05 at 3!!!0-!!!!!!!!!!"G'!!!!$A"bC at B!&$4i!!!!e!!!!!!
+!!!!!,SN!!!!8F(*PCJ!6NUd!!!$9!!!!!!!!!!!96!!!!!T`FQ9Q!"0EB3!!!0B
+!!!!!!!!!!$*,!!!!a("bC at B!%p3(!!!!e`!!!!!!!!!!-`m!!!%@F(*PCJ!6Q8B
+!!!$B!!!!!!!!!!!fL3!!!,T`FQ9Q!"3Y*3!!!0N!!!!!!!!!!#kG!!!!,R"bC at B
+!%h3X!!!!fJ!!!!!!!!!!CAd!!!)-F(*PCJ!6PBJ!!!$E!!#jm`!!:

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/zutil.c
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/zutil.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/zutil.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,225 @@
+/* zutil.c -- target dependent utility functions for the compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h 
+ */
+
+/* @(#) $Id: zutil.c,v 1.5 1998/12/18 21:38:51 koziol Exp $ */
+
+#include "zutil.h"
+
+struct internal_state      {int dummy;}; /* for buggy compilers */
+
+#ifndef STDC
+extern void exit OF((int));
+#endif
+
+const char *z_errmsg[10] = {
+"need dictionary",     /* Z_NEED_DICT       2  */
+"stream end",          /* Z_STREAM_END      1  */
+"",                    /* Z_OK              0  */
+"file error",          /* Z_ERRNO         (-1) */
+"stream error",        /* Z_STREAM_ERROR  (-2) */
+"data error",          /* Z_DATA_ERROR    (-3) */
+"insufficient memory", /* Z_MEM_ERROR     (-4) */
+"buffer error",        /* Z_BUF_ERROR     (-5) */
+"incompatible version",/* Z_VERSION_ERROR (-6) */
+""};
+
+
+const char * ZEXPORT zlibVersion()
+{
+    return ZLIB_VERSION;
+}
+
+#ifdef DEBUG
+
+#  ifndef verbose
+#    define verbose 0
+#  endif
+int z_verbose = verbose;
+
+void z_error (m)
+    char *m;
+{
+    fprintf(stderr, "%s\n", m);
+    exit(1);
+}
+#endif
+
+/* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+const char * ZEXPORT zError(err)
+    int err;
+{
+    return ERR_MSG(err);
+}
+
+
+#ifndef HAVE_MEMCPY
+
+void zmemcpy(dest, source, len)
+    Bytef* dest;
+    const Bytef* source;
+    uInt  len;
+{
+    if (len == 0) return;
+    do {
+        *dest++ = *source++; /* ??? to be unrolled */
+    } while (--len != 0);
+}
+
+int zmemcmp(s1, s2, len)
+    const Bytef* s1;
+    const Bytef* s2;
+    uInt  len;
+{
+    uInt j;
+
+    for (j = 0; j < len; j++) {
+        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+    }
+    return 0;
+}
+
+void zmemzero(dest, len)
+    Bytef* dest;
+    uInt  len;
+{
+    if (len == 0) return;
+    do {
+        *dest++ = 0;  /* ??? to be unrolled */
+    } while (--len != 0);
+}
+#endif
+
+#ifdef __TURBOC__
+#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
+/* Small and medium model in Turbo C are for now limited to near allocation
+ * with reduced MAX_WBITS and MAX_MEM_LEVEL
+ */
+#  define MY_ZCALLOC
+
+/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
+ * must fix the pointer. Warning: the pointer must be put back to its
+ * original form in order to free it, use zcfree().
+ */
+
+#define MAX_PTR 10
+/* 10*64K = 640K */
+
+local int next_ptr = 0;
+
+typedef struct ptr_table_s {
+    voidpf org_ptr;
+    voidpf new_ptr;
+} ptr_table;
+
+local ptr_table table[MAX_PTR];
+/* This table is used to remember the original form of pointers
+ * to large buffers (64K). Such pointers are normalized with a zero offset.
+ * Since MSDOS is not a preemptive multitasking OS, this table is not
+ * protected from concurrent access. This hack doesn't work anyway on
+ * a protected system like OS/2. Use Microsoft C instead.
+ */
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    voidpf buf = opaque; /* just to make some compilers happy */
+    ulg bsize = (ulg)items*size;
+
+    /* If we allocate less than 65520 bytes, we assume that farmalloc
+     * will return a usable pointer which doesn't have to be normalized.
+     */
+    if (bsize < 65520L) {
+        buf = farmalloc(bsize);
+        if (*(ush*)&buf != 0) return buf;
+    } else {
+        buf = farmalloc(bsize + 16L);
+    }
+    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
+    table[next_ptr].org_ptr = buf;
+
+    /* Normalize the pointer to seg:0 */
+    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
+    *(ush*)&buf = 0;
+    table[next_ptr++].new_ptr = buf;
+    return buf;
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    int n;
+    if (*(ush*)&ptr != 0) { /* object < 64K */
+        farfree(ptr);
+        return;
+    }
+    /* Find the original pointer */
+    for (n = 0; n < next_ptr; n++) {
+        if (ptr != table[n].new_ptr) continue;
+
+        farfree(table[n].org_ptr);
+        while (++n < next_ptr) {
+            table[n-1] = table[n];
+        }
+        next_ptr--;
+        return;
+    }
+    ptr = opaque; /* just to make some compilers happy */
+    Assert(0, "zcfree: ptr not found");
+}
+#endif
+#endif /* __TURBOC__ */
+
+
+#if defined(M_I86) && !defined(__32BIT__)
+/* Microsoft C in 16-bit mode */
+
+#  define MY_ZCALLOC
+
+#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
+#  define _halloc  halloc
+#  define _hfree   hfree
+#endif
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    if (opaque) opaque = 0; /* to make compiler happy */
+    return _halloc((long)items, size);
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    if (opaque) opaque = 0; /* to make compiler happy */
+    _hfree(ptr);
+}
+
+#endif /* MSC */
+
+
+#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+
+#ifndef STDC
+extern voidp  calloc OF((uInt items, uInt size));
+extern void   free   OF((voidpf ptr));
+#endif
+
+voidpf zcalloc (opaque, items, size)
+    voidpf opaque;
+    unsigned items;
+    unsigned size;
+{
+    if (opaque) items += size - size; /* make compiler happy */
+    return (voidpf)calloc(items, size);
+}
+
+void  zcfree (opaque, ptr)
+    voidpf opaque;
+    voidpf ptr;
+{
+    free(ptr);
+    if (opaque) return; /* make compiler happy */
+}
+
+#endif /* MY_ZCALLOC */

Added: packages/libhdf4/branches/upstream/current/hdf/zlib/zutil.h
===================================================================
--- packages/libhdf4/branches/upstream/current/hdf/zlib/zutil.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/hdf/zlib/zutil.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,220 @@
+/* zutil.h -- internal interface and configuration of the compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: zutil.h,v 1.5 1998/12/18 21:38:52 koziol Exp $ */
+
+#ifndef _Z_UTIL_H
+#define _Z_UTIL_H
+
+#include "zlib.h"
+
+#ifdef STDC
+#  include <stddef.h>
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+    extern int errno;
+#else
+#   include <errno.h>
+#endif
+
+#ifndef local
+#  define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+typedef unsigned char  uch;
+typedef uch FAR uchf;
+typedef unsigned short ush;
+typedef ush FAR ushf;
+typedef unsigned long  ulg;
+
+extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
+/* (size given to avoid silly warnings with Visual C++) */
+
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+
+#define ERR_RETURN(strm,err) \
+  return (strm->msg = (char*)ERR_MSG(err), (err))
+/* To be used only when the state is known to be valid */
+
+        /* common constants */
+
+#ifndef DEF_WBITS
+#  define DEF_WBITS MAX_WBITS
+#endif
+/* default windowBits for decompression. MAX_WBITS is for compression only */
+
+#if MAX_MEM_LEVEL >= 8
+#  define DEF_MEM_LEVEL 8
+#else
+#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
+#endif
+/* default memLevel */
+
+#define STORED_BLOCK 0
+#define STATIC_TREES 1
+#define DYN_TREES    2
+/* The three kinds of block type */
+
+#define MIN_MATCH  3
+#define MAX_MATCH  258
+/* The minimum and maximum match lengths */
+
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+
+        /* target dependencies */
+
+#ifdef MSDOS
+#  define OS_CODE  0x00
+#  if defined(__TURBOC__) || defined(__BORLANDC__)
+#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+       /* Allow compilation with ANSI keywords only enabled */
+       void _Cdecl farfree( void *block );
+       void *_Cdecl farmalloc( unsigned long nbytes );
+#    else
+#     include <alloc.h>
+#    endif
+#  else /* MSC or DJGPP */
+#    include <malloc.h>
+#  endif
+#endif
+
+#ifdef OS2
+#  define OS_CODE  0x06
+#endif
+
+#ifdef WIN32 /* Window 95 & Windows NT */
+#  define OS_CODE  0x0b
+#endif
+
+#if defined(VAXC) || defined(VMS)
+#  define OS_CODE  0x02
+#  define F_OPEN(name, mode) \
+     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+#endif
+
+#ifdef AMIGA
+#  define OS_CODE  0x01
+#endif
+
+#if defined(ATARI) || defined(atarist)
+#  define OS_CODE  0x05
+#endif
+
+#if defined(MACOS) || defined(TARGET_OS_MAC)
+#  define OS_CODE  0x07
+#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+#    include <unix.h> /* for fdopen */
+#  else
+#    ifndef fdopen
+#      define fdopen(fd,mode) NULL /* No fdopen() */
+#    endif
+#  endif
+#endif
+
+#ifdef __50SERIES /* Prime/PRIMOS */
+#  define OS_CODE  0x0F
+#endif
+
+#ifdef TOPS20
+#  define OS_CODE  0x0a
+#endif
+
+#if defined(_BEOS_) || defined(RISCOS)
+#  define fdopen(fd,mode) NULL /* No fdopen() */
+#endif
+
+#if (defined(_MSC_VER) && (_MSC_VER > 600))
+#  define fdopen(fd,type)  _fdopen(fd,type)
+#endif
+
+
+        /* Common defaults */
+
+#ifndef OS_CODE
+#  define OS_CODE  0x03  /* assume Unix */
+#endif
+
+#ifndef F_OPEN
+#  define F_OPEN(name, mode) fopen((name), (mode))
+#endif
+
+         /* functions */
+
+#ifdef HAVE_STRERROR
+   extern char *strerror OF((int));
+#  define zstrerror(errnum) strerror(errnum)
+#else
+#  define zstrerror(errnum) ""
+#endif
+
+#if defined(pyr)
+#  define NO_MEMCPY
+#endif
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
+ /* Use our own functions for small and medium model with MSC <= 5.0.
+  * You may have to use the same strategy for Borland C (untested).
+  * The __SC__ check is for Symantec.
+  */
+#  define NO_MEMCPY
+#endif
+#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
+#  define HAVE_MEMCPY
+#endif
+#ifdef HAVE_MEMCPY
+#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
+#    define zmemcpy _fmemcpy
+#    define zmemcmp _fmemcmp
+#    define zmemzero(dest, len) _fmemset(dest, 0, len)
+#  else
+#    define zmemcpy memcpy
+#    define zmemcmp memcmp
+#    define zmemzero(dest, len) memset(dest, 0, len)
+#  endif
+#else
+   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
+   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
+   extern void zmemzero OF((Bytef* dest, uInt len));
+#endif
+
+/* Diagnostic functions */
+#ifdef DEBUG
+#  include <stdio.h>
+   extern int z_verbose;
+   extern void z_error    OF((char *m));
+#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
+#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
+#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+#else
+#  define Assert(cond,msg)
+#  define Trace(x)
+#  define Tracev(x)
+#  define Tracevv(x)
+#  define Tracec(c,x)
+#  define Tracecv(c,x)
+#endif
+
+
+typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
+				       uInt len));
+voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+void   zcfree  OF((voidpf opaque, voidpf ptr));
+
+#define ZALLOC(strm, items, size) \
+           (*((strm)->zalloc))((strm)->opaque, (items), (size))
+#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
+#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+
+#endif /* _Z_UTIL_H */

Added: packages/libhdf4/branches/upstream/current/install-sh
===================================================================
--- packages/libhdf4/branches/upstream/current/install-sh	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/install-sh	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,243 @@
+#!/bin/sh
+# $Id: install-sh,v 1.2 1996/12/11 21:50:49 acheng Exp $
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# 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.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+tranformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+# HDF specific change to set umask so that files are created others
+# accessible.
+umask 022
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "install:	no input file specified"
+	exit 1
+else
+	true
+fi
+
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+	
+	if [ -d $dst ]; then
+		instcmd=:
+	else
+		instcmd=mkdir
+	fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f $src -o -d $src ]
+	then
+		true
+	else
+		echo "install:  $src does not exist"
+		exit 1
+	fi
+	
+	if [ x"$dst" = x ]
+	then
+		echo "install:	no destination specified"
+		exit 1
+	else
+		true
+	fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+	if [ -d $dst ]
+	then
+		dst="$dst"/`basename $src`
+	else
+		true
+	fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='	
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp="${pathcomp}${1}"
+	shift
+
+	if [ ! -d "${pathcomp}" ] ;
+        then
+		$mkdirprog "${pathcomp}"
+	else
+		true
+	fi
+
+	pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd $dst &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+	if [ x"$transformarg" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		dstfile=`basename $dst $transformbasename | 
+			sed $transformarg`$transformbasename
+	fi
+
+# don't allow the sed command to completely eliminate the filename
+
+	if [ x"$dstfile" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		true
+	fi
+
+# Make a temp file name in the proper directory.
+
+	dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+	$doit $instcmd $src $dsttmp &&
+
+	trap "rm -f ${dsttmp}" 0 &&
+
+# 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 $instcmd $src $dsttmp" command.
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+	$doit $rmcmd -f $dstdir/$dstfile &&
+	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0


Property changes on: packages/libhdf4/branches/upstream/current/install-sh
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/man/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/man/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/man/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,177 @@
+# ****************************************************************************
+# * 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: Makefile.in,v 1.11 1998/03/06 14:08:54 bljones Exp $
+#
+# ##################################################################
+#
+
+### Start of system configuration section. ####
+# Set shell so we know what it is
+SHELL = /bin/sh
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = r
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+#Compilier defaults overriden by top level make
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# The echo command.
+ECHO = echo
+
+# Directory in which to install scripts.
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install include files.
+includedir = $(prefix)/include
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+
+# ############# End of system configuration section. ###############
+
+# ==> where is your HDF library (libdf.a) located?
+# ==> where are your hdf.h, hdfi.h and vg.h files located?
+HDFINC=$(srcdir)/../src
+HDFLIB=$(srcdir)/../src
+HDFSRC=$(srcdir)/../src
+HDFBIN=$(srcdir)/../bin
+
+# ==> where is your JPEG library (libjpeg.a) located?
+JPEGLIB=$(srcdir)/../jpeg
+JPEGINC=$(srcdir)/../jpeg
+
+DISTFILES = $(MAN_NROFF_1) 
+
+# Man pages
+MAN_NROFF_1 = hdf.1 hdfunpac.1
+MAN_NROFF_3 =
+
+all: docs
+
+nofortran: all
+
+rebuild:
+	true
+
+rebuildnofortran:
+	true
+
+# Leave this target blank with no actions, the rebuild macros above depend on it
+force_rebuild:
+
+install: install-man1 
+
+install-man1: 
+	for p in $(MAN_NROFF_1); do \
+	    $(INSTALL_DATA) \
+		`pwd`/$$p $(man1dir)/`$(ECHO) $$p`; \
+	done
+
+install-man3: 
+	for p in $(MAN_NROFF_3); do \
+	    $(INSTALL_DATA) \
+		`pwd`/$$p $(man3dir)/`$(ECHO) $$p`; \
+	done
+
+docs:
+	true
+
+clean:
+	true
+
+distclean:
+	-$(RM) $(RMFLAGS) config.status Makefile
+
+depend: 
+	 true
+
+saber:	
+	true
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = man
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+help:
+	@echo ""
+	@echo "Make supports the following targets in the 'utilities' directory"
+	@echo "make help    - prints this usage section"
+	@echo "make all     - (DEFAULT) makes man pages"
+	@echo "make install - install HDF man pages "
+	@echo "make clean     - cleans up "
+	@echo "make distclean - cleans up including"
+	@echo "                 configuration(Makefiles,config.status,..)"
+	@echo ""
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.

Added: packages/libhdf4/branches/upstream/current/man/gr_chunk.3
===================================================================
--- packages/libhdf4/branches/upstream/current/man/gr_chunk.3	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/man/gr_chunk.3	2007-05-14 09:41:34 UTC (rev 808)
@@ -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.
+
+

Added: packages/libhdf4/branches/upstream/current/man/hdf.1
===================================================================
--- packages/libhdf4/branches/upstream/current/man/hdf.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/man/hdf.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,201 @@
+.\" $Id: hdf.1,v 1.2 1996/12/19 22:06:10 georgev Exp $
+.TH HDF 1 "July 1996" "NCSA HDF 4.1"
+.SH NAME
+hdf \- Hierarchical Data Format library
+.SH SYNOPSIS
+.ft B
+-lmfhdf -ldf -ljpeg -lz
+.sp 0
+{HDFLIBDIR}/libmfhdf.a {HDFLIBDIR}/libdf.a {HDFLIBDIR}/libjpeg.a {HDFLIBDIR}/libz.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.  Machines currently 
+supported include the Cray, HP, Vax, Sun, IBM RS/6000, Silicon Graphics,
+Macintosh, and IBM PC computers.  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 to 
+prepare raw image of data files or for use with other NCSA software.  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 arbitray grouping of other HDF objects.
+
+.SS "HDF Raster Images"
+HDF supports the storing of both 8-bit and 24-bit raster images.  As well as
+storing information about the dimensions and palette of a raster image, HDF
+supports raster image compression.  In previous versions of HDF, Run-length
+encoding and Imcomp compression were both supported.  With HDF> 3.3 JPEG
+compression is also available. 
+
+.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 have more than one file open at a time.
+  o A more general framework for meta-data within the SDS data-model
+    (allowing 'name = value' styel 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 > 3.3 and netCDF"
+HDF > 3.3 merges in the netCDF library produced by Unidata.  The full
+netCDF library is supported as is a new "multi-file" SDS interface.  Both of
+these interfaces can read old netCDF files and HDF files transparently.
+
+
+.SS "EXAMPLES"
+All HDF routines require the header "hdf.h" to be included in the C
+source file. If using the SDS routines the header "mfhdf.h" should be 
+included instead in in the C source file. Fortran programs should 
+use "dffunc.inc" and "hdf.inc".
+
+To compile a program that makes HDF calls on most Unix platforms.
+.nf
+
+   HDFLIBDIR = /usr/local/lib/hdf
+   HDFINC    = /usr/local/include/hdf
+
+   (FORTRAN):
+.na 
+   f77 myprog.f \-I{HDFINC} \-o myprog {HDFLIBDIR}/libmfhdf.a \\
+   {HDFLIBDIR}/libdf.a  {HDFLIBDIR}/libjpeg.a {HDFLIBDIR}/libz.a
+
+   (C):
+.na 
+   cc myprog.c \-I{HDFINC} \-o myprog {HDFLIBDIR}/libmfhdf.a \\
+   {HDFLIBDIR}/libdf.a  {HDFLIBDIR}/libjpeg.a {HDFLIBDIR}/libz.a  
+
+.fi
+
+.SH DOCUMENTATION
+
+The HDF WWW page is located at http://hdf.ncsa.uiuc.edu/
+
+For the vast majority of users, the "Users Guide" documents and the "Reference"
+manuals should be sufficient. 
+
+You may download the documentation via ftp on NCSA's anonymous 
+ftp server. (ftp.ncsa.uiuc.edu:/HDF). On anonymous ftp there the documentation 
+is available in Postscript, PDF and MIF.
+
+
+.SH VENDOR
+NCSA Software Development Division
+.sp 0
+Hierarchical Data Format Group
+.sp 0
+152 Computing Applications Bldg.
+.sp 0
+605 E. Springfield Ave.
+.sp 0
+Champaign, IL 61820
+
+.SH VERSION
+4.1
+.SH LICENSE & SOURCE AVAILABILITY
+UNIVERSITY OF ILLINOIS (UI), NATIONAL CENTER FOR SUPERCOMPUTING
+APPLICATIONS (NCSA), Software Distribution Policy for Public Domain
+Software
+
+NCSA HDF Version 4.1 source code and documentation are in the public
+domain, available without fee for education, research, non-commercial and
+commercial purposes.  Users may distribute the binary or source code to
+third parties provided that this statement appears on all copies and that
+no charge is made for such copies.  
+
+UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY
+PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.  THE
+UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE USER OF THIS
+SOFTWARE.  The software may have been developed under agreements between
+the UI and the Federal Government which entitle the Government to certain
+rights.
+
+We ask, but do not require that the following message be include in all
+derived works:
+
+  Portions developed at the National Center for Supercomputing 
+  Applications at the University of Illinois at Urbana-Champaign.
+
+By copying this program, you, the user, agree to abide by the conditions
+and understandings with respect to any software which is marked with a
+public domain notice.
+
+Acknowledgements:
+----------------
+
+Portions of this software were developed by the Unidata Program at the 
+University Corporation for Atmospheric Research, specifically the 
+NETCDF distribution used.
+
+This product also includes software developed by the Independent JPEG
+Group, specifically the IJPEG library libjpeg.a.
+
+This product also includes software developed by Jean-loup Gailly 
+and Mark Adler , specifically the ZLIB library libz.a.
+
+This product includes software developed by the University of
+California, Berkeley and its contributors.
+
+.SH CONTACT & HELP
+NCSA Software Deveopment Division
+.sp 0
+Hierarchical Data Format Group
+.sp 0
+email: hdfhelp at ncsa.uiuc.edu
+
+.SH FILES
+.PD 0
+.TP 30
+.B /usr/local/lib/hdf/{libmfhdf.a,libdf.a,libjpeg.a,libz.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 and others
+.PD
+
+.SH SEE ALSO
+.BR hdfls (1),
+.BR hdfpack (1),
+.BR hdfunpac (1),
+.BR hdp (1)

Added: packages/libhdf4/branches/upstream/current/man/hdfunpac.1
===================================================================
--- packages/libhdf4/branches/upstream/current/man/hdfunpac.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/man/hdfunpac.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,27 @@
+.\" $Id: hdfunpac.1,v 1.1 1995/07/25 01:53:22 sxu Exp $
+.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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/CHANGES
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/CHANGES	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/CHANGES	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,364 @@
+$Id: CHANGES,v 1.2 1994/11/11 20:36:19 dianam Exp $
+
+The default fill values for double and floating-point data were changed.
+The previous strategy of using numbers that mapped to IEEE NaN under XDR
+caused portability problems.  Now FILL_FLOAT and FILL_DOUBLE are large
+constants within the floating-point range.  As before, we continue to
+recommend that users define their own variable-specific fill values rather
+than use the default ones provided.
+
+The way in which the default fill values are defined in the FORTRAN
+interface was changed, so that now the FORTRAN default fill values will
+always be the same as the C default values.  This eliminates the need for
+the platform-specific foo0.inc files where these constants were previously
+defined.
+
+Support for generalized hyperslabs was added.  This adds the new functions
+ncvarputg and ncvargetg to the C interface, and new subroutines NCVPTG,
+NCVPGC, NCVGTG, and NCVGGC to the Fortran interface.
+
+The FILL parameters defined in the netcdf.inc include file for integer types
+for the FORTRAN interface were "fixed" to be the same as the FILL parameters
+in the C interface.  In previous releases these had differed from the C
+interface values, which meant C and FORTRAN programs would not agree on
+default fill values.  This fix is unfortunate but necessary to bring the two
+interfaces back into line.
+
+The installation procedure on UNIX platforms was changed to use the GNU
+configure approach to constructing makefiles based on inquiries run from a
+configure shell script.
+
+Names acceptable to ncgen for
+	netcdf name { ... }
+may now start with a non-alphabetic character and include any characters
+except blanks or "{" characters.
+
+Some new informational files were added at the top-level:  FAQ for answers
+to frequently asked questions, ORIGIN to describe where the distribution
+came from, COPYRIGHT separates out the Copyright notice from the README
+file.
+
+Changed recommended netCDF file extension from ".cdf" to ".nc", and added
+"-b" option of ncgen to produce ".nc" files.
+
+Added several options to ncdump to control annotations in output.
+
+An experimental draft prototype C++ interface has been added.  See the c++
+subdirectory for the implementation, an example of the use, and soime
+preliminary minimal documentation.
+
+Many "const" declarations were added to the interfaces and documentation, to
+specify where functions do not change values through passed in pointers.
+
+Added three new C convenience functions to the interface to handle record
+I/O.  ncrecget, ncrecput, and ncrecinq permit accessing a whole record's
+worth of data with a single call.
+
+Made clearer in the User's Guide that a NULL pointer can be provided for any
+return parameter from an inquire function, to indicate that you don't want
+that value returned.  Also indicated that inquire functions never incur any
+I/O.
+
+
+------ Mon Dec 23 MST 1991  Changes in netCDF (2.01 to 2.02)
+
+A "memory leak" is fixed that would cause any program that opened and closed
+many netCDF files to grow.
+
+All inquire functions (ncinquire, ncdiminq, ncvarinq, ncattinq) now permit a
+NULL pointer to be given for any of their return parameters, to indicate
+when no return value for that parameter is desired.
+
+The default library type that is built by the distributed Makefile is now
+"nonsharable" rather than "sharable".
+
+The format that ncdump uses to output byte data is changed from octal to
+decimal.
+
+------ Mon Nov 25 1991	Changes in netCDF (2.0 to 2.01)
+
+Correct usage of the XDR_LD macro is added to all appropriate
+program-building rules in all appropriate sub-Makefiles.  This is needed for
+proper program-creation under the IRIX operating-system.
+
+Corrects the major.minor revision ID for SunOS sharable libraries to 2.01.
+
+Adds support for the creation of the netCDF Fortran interface under the IRIX
+operating-system.
+
+------ Wed Oct  9 1991	Changes in netCDF (1.11 to 2.0)
+
+The netCDF C interfaces were changed to use long values rather than ints for
+netCDF dimensions on all machines.  This changed the following interfaces that
+formerly use "int" or "int*" for dimensions and dimension pointers:
+
+  int ncdimdef(int cdfid, const char* name, int length);
+  int ncdiminq(int cdfid, int dimid, char* name, int* length);
+  int ncvarput1(int cdfid, int varid, int *coords, void* value);
+  int ncvarget1(int cdfid, int varid, int *coords, void* value);
+  int ncvarput(int cdfid, int varid, int *start, int *count, void* value);
+  int ncvarget(int cdfid, int varid, int *start, int *count, void* value);
+
+to use "long" or "long*" instead:
+
+  int ncdimdef(int cdfid, const char* name, long length);
+  int ncdiminq(int cdfid, int dimid, char* name, long* length);
+  int ncvarput1(int cdfid, int varid, long *coords, void* value);
+  int ncvarget1(int cdfid, int varid, long *coords, void* value);
+  int ncvarput(int cdfid, int varid, long *start, long *count, void* value);
+  int ncvarget(int cdfid, int varid, long *start, long *count, void* value);
+
+No change to data representation or file formats was required, since the XDR
+form of integers is 32 bits.  The main advantage of this change is that on
+platforms such as MSDOS machines on which integers are only 16 bits, it is
+now possible to access data from variables that have a dimension greater
+than 32767.  This is of some practical importance, since CD-ROM disks are
+being written with large datasets in netCDF form, and it is desirable to be
+able to access this data from inexpensive 16-bit machines.
+
+Since ints and longs are the same on most current platforms (Suns,
+DECstations, VAXen, IBM RS6000s, SGIs, HPs, CRAYs, ...), this change does
+not break old code.  Applications compiled with the old interface on such
+machines will work the same way as they did before without recompiling.
+Standard C compilers that support prototypes permit using int values for
+dimension size and automatically convert them to longs before the call.  C
+code that uses pointers to ints instead of pointers to longs (where required
+by the new interfaces) will elicit warning messages from lint and from
+standard C compilers, so all such problems may be caught at compile time.
+
+Programs compiled under the old interface on machines with 16-bit ints
+(primarily MSDOS machines based on the 80286 or earlier chips) must be
+recompiled.  Such programs are also the main beneficiaries of the change.
+
+Modifications necessitated by this interface change are included in this
+version, including changes to the man-page reference documentation, the
+User's Guide, the nctest test program, the ncdump and ncgen utilities, and
+the Fortran jackets.
+
+A bug on VMS was fixed by forcing stream mode access on netCDF files.
+
+ncdump was fixed to work on platforms that have 16-bit integers, even for
+variables that have a dimension to large to fit in a 16-bit integer.
+
+The "-c" option of ncgen was fixed to work even when a large number of
+values need to be initialized, instead of overflowing the array reserved for
+C statements.
+
+Changes were incorporated in the Makefiles to permit building netCDF on SGI
+platforms.
+
+A bug setting fill values for short integers, in which only every other
+value was filled, was fixed.
+
+
+------ Wed May 15 1991	Changes in netCDF (1.10 to 1.11)
+
+Fix for opening two or more netCDF files for writing when more than one file
+was in redefine mode.  The fix permits multiple netCDF files in redefine
+mode simultaneously.
+
+Improvements to INSTALL documentation.
+
+Some files in the source distribution were renamed, to conform to the strict
+conventions of MSDOS and OS/2.
+
+ANSI C function prototypes for netCDF functions were added to netcdf.h, for
+use in checking calls to the library when you have an ANSI C compiler.
+
+The Makefiles for netCDF were revised to make installation easier.  The
+Makefiles now also make shared libraries for SunOS and AIX platforms.
+
+The generation of Fortran jackets for various platforms from a single m4
+source is now possible with versions of m4 that don't have the defn()
+built-in macro, e.g. Ultrix.  FORTRAN jackets in Microsoft C for Micrsoft
+FORTRAN on MSDOS and OS/2 are now supported.
+
+The netCDF User's Guide was revised to include write-ups for the new
+functions ncsetfill() and NCSFIL(), to contain an updated Foreward, a
+description of the use of the reserved attribute "_FillValue", and an
+appendix containing a description of the suggested units syntax standard.  A
+copy of our units file was included in the netcdf/doc directory.  A more
+recent version of texinfo.tex is distributed with the User's Guide.
+
+*****
+A change was made to putget.c to eliminate unnecessary seeks.  This results
+in a considerable performance enhancement for sequential writes.
+
+***** A new function ncsetfill(int fillmode) (NCSFIL(INTEGER FILLMODE) for
+FORTRAN) has been added, to support optimization of writes without
+prefilling.  
+
+Example:
+	ncsetmode(NC_NOFILL) ; 
+	ncvarput
+	ncvarput
+
+This is a performance enhancement which can be used to eliminate the dual
+"writes" that result from the netcdf putting its default fill value in only
+to be immediately overwritten by the data.
+
+Caveats:
+
+    It is incumbent upon the applications program to be certain that all the
+data positions have valid data "put" to them.
+    If the netcdf file has an unlimited dimension and the last record was
+"put" while NC_NOFILL was set, then the file will be 4 bytes longer than if
+NC_NOFILL wasn't set.
+
+*****
+IF an attribute named "_FillValue" exists for a given netcdf variable AND
+the attribute is of same type of the variable AND the "count" (array length)
+of the attribute is 1, THEN the value of that attribute will be henceforth
+used as the "fill value" for that variable.
+
+Example:
+	long lfill = -1 ;
+	long_id = ncvardef(cdfid, "avar", NC_LONG, ndims, dims) ;
+ 	ncattput(id, Long_id, "_FillValue", NC_LONG, 1, &lfill) ;
+
+The purpose of this is to save the applications programmer the work of
+"prefilling" and also to eliminate the dual "writes" that result from netcdf
+putting its default fill value in, only to be immediately overwritten by the
+programmers preferred value.
+
+Caveat:
+	If you change or add this attribute after the variable has been
+	instantiated (first ncendef after ncvardef of the variable), it
+	doesn't go back and change the old stuff. 
+
+*****
+A fix was put in ncdump for printing byte-values '\374' through '\377',
+which printed as multiple bytes on platforms where chars are signed rather
+than unsigned.
+
+Integrated the changes needed to support FORTRAN jackets for the Microsoft
+FORTRAN compiler and C compiler under MSDOS and OS/2 into the new
+netcdf/fortran/msoft directory.
+
+A problem in the library that would only appear when trying to read a very
+large array on machines with 16-bit ints was fixed.  The nctest program was
+changed to test for this case, so it would reveal the problem.
+
+The single big malloc() of enough space to hold all the data for a variable
+with one big ncvarget() call to get it all, was changed to a small malloc()
+and multiple ncvarget() calls for each "row" of data.  This will make ncdump
+smaller at run-time and make it work better on 16-bit machines for large
+arrays.
+
+Reference documentation, in the form of Unix man pages, was added to the
+netcdf/doc directory, to supplement the TeXinfo documentation for the User's
+Guide.  The new files are ncdump.1, ncgen.1, netcdf.3, and netcdf.3f for the
+ncdump and ncgen utilities and for the C and FORTRAN interfaces,
+respectively.
+
+In the netCDF User's Guide, a new chapter on ``netCDF File Structure and
+Performance'' was added, and the interface description for the nctypelen()
+function was moved.  A Makefile for printing the manual from the ug.texinfo
+source and the source for texindex.c were added.
+
+ncgen was modified to accept the hyphen character ("-") as acceptable in
+names for dimensions, variables, and attributes.
+
+The top-level Makefile was changed to build and install the FORTRAN
+interface by default.  The PORTING documentation was modified to describe
+necessary steps to include the FORTRAN interface.  The default OS for the
+FORTRAN interface was changed to "sun".
+
+------ Thu Oct 25 05:26:01 MDT 1990	Changes in netCDF (1.09 to 1.10)
+
+The double-precision `fill value' for MIPSEL (DECstation) architectures was
+fixed.
+
+A list of which platforms have suitable vendor-supplied XDR libraries and
+where they can be found was added to the netCDF/PORTING document.
+
+The Makefile in netcdf/ncgen was fixed to eliminate an extra compilation
+when testing the Fortran generated by "ncgen -f".
+
+Several bugs were fixed in the Fortran jackets, the README documentation was
+improved, and the names of the `vaxultrix' directory and macro files were
+changed to `ultrix' after fixes were incorporated for the DECstation/Ultrix
+platform.  Several of the sets of system-specific NOTES files were
+simplified and corrected.  The Makefile was improved by removing a feature
+not available in make on some systems, and by providing a more informative
+error message when a value for the OS macro is not specified.  Comments were
+removed from two of the calls to test drivers for NCVPT1() and NCVGT1() in
+the Fortran test program, and problems revealed by these tests on the unicos
+platform were fixed.  Blank-filling of character strings returned by NCVGTC()
+and NCAGTC() was fixed for multi-dimensional string arrays.  Null-terminating
+of character attribute values stored with NCAPTC() calls was fixed, so now
+such attributes are only null-terminated if the user has explicitly provided
+the terminating null character.  New versions of the pre-generated source
+for the Fortran test driver and jackets library incorporating these fixes
+were created for aix, sun, ultrix, unicos, and vms.
+
+------ Wed Oct 17 14:37:04 MDT 1990	Changes in netCDF (1.08 to 1.09)
+
+The portable XDR library we distribute has been modified so that it will
+compile and work properly under OS/2 and MSDOS (Microsoft 6.0 compiler) with
+netCDF files larger than 64K.  This means that a vendor XDR, such as Sun
+PCNFS or IBM TCP/IP, is NO LONGER required in order to compile netCDF on
+these platforms.  In order to `seek' past the 64k mark in files, a change
+has been made to the XDR interface:
+
+	xdr_setpos takes a `long' rather than `int' position argument.
+	xdr_getpos returns a `long' rather than `int' position argument.
+
+On machines which have 32 bit ints and 32 bit longs, this change is
+transparent.  The Microsoft compilers should use the /Za option (ANSI)
+so that the proper conditional compilation code is visible.
+
+There is now a single source for the netCDF FORTRAN interface, instead of
+several diverging sources.  A new system for parameterizing the FORTRAN
+interface generates working jacket libraries for various versions of
+FORTRAN-to-C calling conventions, including those found on Sun, VAX/ULTRIX,
+VAX/VMS, CRAY/UNICOS, and IBM RS6000/AIX.  It is much easier to create and
+test a FORTRAN interface for a new platform, since all the differences among
+the various platforms and FORTRAN-to-C calling conventions are isolated in a
+small set of M4 macros.  The FORTRAN jackets will now work for FORTRAN
+compilers that don't support either or both of the nonstandard BYTE
+(integer*1) or the short (INTEGER*2) types.
+
+Declarations for the netCDF functions (as opposed to subroutines) in the
+FORTRAN interface are now included in the `netcdf.inc' file, so users don't
+need to declare them.  This may cause incorrect warnings about unused integer
+variables, which can be ignored.
+
+Ncgen no longer depends on /usr/include/limits.h, since this file is absent
+from some versions of Unix.
+
+------ Thu Aug  2 09:57:08 MDT 1990    Changes in netCDF (1.07 to 1.08)
+
+Fixed bug in ncdump: reading octal constants beginning with leading 0 as
+decimal.
+
+Fixed bug in ncgen found by Saber C: memory leak and problem with
+non null-terminated character array attributes.
+
+Enhanced ncdump to insert line breaks after new-lines in multi-line
+attributes, and tested for this in test0.cdl example.
+
+------ Mon Jul 23 10:01:58 MDT 1990	Changes in netCDF (1.06 to 1.07)
+
+The netCDF User's Guide can now be used as an on-line ``hypertext''
+document if you have a texinfo reader.  Texinfo is available as part of
+the GNU emacs editor (from prep.ai.mit.edu), and a texinfo reader is
+also available as an X Windows client named "xinfo".  The texinfo system
+allows a single source (in this case netcdf/src/doc/ug.texinfo) to be
+used to generate both a hard-copy manual (the netCDF User's Guide) and
+files that provide an on-line hypertext version of the manual.
+
+Numerous bugs in the "-f" option of ncgen have been fixed, and a much
+more stringent test of the execution of the resulting FORTRAN code is
+now part of "make test" in the ncgen directory.  "ncgen -f" now
+generates FORTRAN code works on (at least) Sun f77, VMS FORTRAN, and
+DEC ULTRIX f77.
+
+Numerous bugs in the FORTRAN jackets have been fixed, including:
+
+	NCVGTC() now correctly blank-fills character hyperslab arrays
+	that it returns.
+
+	The ID of the unlimited dimension returned by NCINQ() is no
+	longer off by one.
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/COPYRIGHT
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/COPYRIGHT	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/COPYRIGHT	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,30 @@
+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, the user agrees to credit
+UCAR/Unidata in any publications that result from the use of this
+software or in any product that includes this software. 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 TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.

Added: packages/libhdf4/branches/upstream/current/mfhdf/CUSTOMIZE
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/CUSTOMIZE	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/CUSTOMIZE	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,57 @@
+# This file is for customizing the configuation process performed by
+# `./configuration'.  This file consists of sh(1) variable-definition lines.
+# The value given to those variables by this file will override their default
+# values.
+#
+# You can also customize the configuration process via the environment
+# variables seen by ./configure.  For example:
+#
+#     In csh(1):
+#	  % setenv CC acc
+#	  & setenv CFLAGS -g
+#	  % ./configure
+#
+#     In sh(1):
+#	  $ CC=acc CFLAGS=-g ./configure
+#
+# Variables in this file override the environmental ones.
+#
+#############################################################################
+#
+# Type of C compiler (default is `cc'):
+# Try 'gcc -ansi' if your cc is not ANSI compatible.
+CC='cc'
+#
+# C compiler flags (default is `-O'):
+#CFLAGS='-O'
+#
+# SGI needs not ranlib.  Set RANLIB to true as an no-op.
+RANLIB=true
+#
+# C preprocessor flags 
+CPPFLAGS='DBIG_LONGS'
+#
+# Type of FORTRAN 77 compiler (default is `f77'):
+FC='f77'
+#
+# FORTRAN compiler flags (default is `'):
+#FFLAGS='-g'
+#
+# Location of the HDF home.  Must be an absolute path.
+HDF_HOME=`pwd`/..
+# Location of HDF include files.  Must be an absolute path.
+HDF_INC=-I${HDF_HOME}/hdf/src
+#
+# Location of HDF library file.  Must be an absolute path.
+HDF_LIB=${HDF_HOME}/hdf/src/libdf.a
+#
+# Location of JPEG library file.  Must be an absolute path.
+JPEG_LIB=${HDF_HOME}/hdf/jpeg/libjpeg.a
+#
+# Installation prefix (default is `..'):
+#prefix=/usr/local
+#
+# Whether to use the old floating-point fill values for backward
+# compatibility (see INSTALL).  Uncomment to obtain the pre-2.3 default,
+# floating-point fill values.
+# OLD_FILLVALUES=yes

Added: packages/libhdf4/branches/upstream/current/mfhdf/FAQ
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/FAQ	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/FAQ	2007-05-14 09:41:34 UTC (rev 808)
@@ -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.

Added: packages/libhdf4/branches/upstream/current/mfhdf/INSTALL
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/INSTALL	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/INSTALL	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,253 @@
+			    INSTALLATION
+
+This document describes how to build and install the netCDF package on a
+UNIX system and how to port the installation procedures to a new system.
+
+For instructions on installing on a PCDOS, MSDOS, OS/2, or VMS system, see
+the notes at the end of this file.
+
+On a UNIX system:
+
+1) Create the makefiles via the `configure' script.
+
+    1.1) Decide where you want the software installed.  By default, all
+         software will be installed in peer directories of the directory
+	 containing this file (e.g. in `../bin/', `../lib/', etc.).  If you
+	 want the software installed someplace else then you'll need to
+	 specify this place to the `configure' script by using the
+	 `--prefix=...' option.  For example, if you want the software to
+	 be installed under `/usr/local', then you should invoke the
+	 `configure' script as
+
+		configure --prefix=/usr/local
+
+	 This will install the software in `/usr/local/bin',
+	 `/usr/local/lib', etc.  The default is to install the software
+	 in subdirectories under `..' and is thus equivalent to invoking
+	 the configure script as
+
+		configure --prefix=..
+
+	 NB: You must have write access to the root of the installation tree
+	 (e.g. /usr/local) and its subdirectories in order to install the
+	 software.
+
+    1.2) Decide the values you want for the following symbols:
+
+	Symbol		Definition			Default Value
+	-----		----------			-------------
+	CC		C compiler			cc
+	CPPFLAGS	C preprocessor options		-DNDEBUG
+	CFLAGS		C compiler options		-O
+	FC		FORTRAN compiler		f77
+	FFLAGS		FORTRAN compiler options	-O
+	OLD_FILLVALUES	Use old, default floating-	no
+			point fill values?
+
+	 The default -DNDEBUG value for CPPFLAGS means that the C
+	 preprocessor will cause the use of the C assert() macro in the
+	 source files to be ignored -- resulting in a slight improvement in
+	 speed at the expense of some internal consistency-checking at
+	 runtime.  If you want internal runtime consistency-checking, then
+	 you define CPPFLAGS as something else (such as the empty string).
+
+	 If you do not have a FORTRAN compiler, then you should set the FC
+	 macro to a dummy value (e.g. "/bin/f77" or just "").  The
+	 makefiles check to see that the compiler actually exists.
+
+	 The OLD_FILLVALUES 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 OLD_FILLVALUES
+	 should have the value `yes'.  
+
+	 Implementation detail on fill values is contained in the file
+	 libsrc/netcdf.h.in.
+
+    1.3) If you want changes to the above defaults to be somewhat permanent,
+	 then edit them into the CUSTOMIZE file, which is in the same
+	 directory as this file (the file itself will tell you how to make
+	 the edits).  Otherwise, proceed with the next step.
+
+    1.4) Go to the directory containing this file and invoke the
+	 `configure' script -- specifying any changes to the above
+	 defaults that you have not made permanent in the CUSTOMIZE file (or
+	 that you wish to override).  For example, if you want internal
+	 consistency-checking, want to use gcc(1) as the C compiler, and
+	 want to install the software in subdirectories of /usr/local, then
+	 do the following:
+
+	     If using csh(1) or tcsh(1):
+
+		 % setenv CC gcc
+		 % setenv CPPFLAGS
+		 % ./configure --prefix=/usr/local
+
+	     If using sh(1) or bash(1):
+
+		 $ CC=gcc CPPFLAGS= ./configure --prefix=/usr/local
+
+	 NOTE:  You must run the `configure' script even if you accept all
+	 the defaults.
+
+2) Make "all".  It is to your advantage to log the build process in case
+   something goes wrong and you request assistance.  For example:
+
+       If using csh(1) or tcsh(1):
+
+	   % make all >&! log &
+	   % tail -f log
+
+       If using sh(1) or bash(1):
+
+	   $ make all > log 2>&1 &
+	   $ tail -f log
+
+3) Make "test" if you wish to test the software.  If this is your first
+   time with the package, then testing is a good idea.
+
+   The XDR library will be tested and the netCDF interface will be tested
+   in the "nctest" directory.  The Fortran netCDF interface will also be
+   tested if appropriate.
+
+   You will know the tests are successful if there are no error
+   messages interspersed among the messages that look like
+
+	*** Testing ncfoo ... ok
+
+4) Make "install".  This should install the header-files, the library
+   (possibly with the Fortran interface) the utilities, and the manual
+   pages.  If you have an "info" reader like emacs, xinfo, or info, you can
+   use the doc/ug.texinfo file to generate info files for an on-line
+   hypertext version of the netCDF User's Guide.  See a Texinfo manual for
+   how to do this.
+
+5) Make "clean".
+		
+Notes:
+
+   Shared libraries are no longer supported by the installation mechanism
+   If you have a shared library from a previous release already installed,
+   then you should probably delete it and relink the applications programs
+   that used it against the new library.
+
+   The reason for dropping support for shared libraries is that, basically,
+   it became too great a headache (too many platforms, too many differences
+   in the way they handled shared libraries).  Our philosphy now is to
+   advise users to use system-supplied shared runtime libraries (e.g.
+   libc.a) but to link statically with Unidata-supplied ones.
+
+   Because the FORTRAN interface to the netCDF library doesn't depend upon
+   the existence of a FORTRAN compiler, it will always be built and 
+   incorporated into the netCDF library.  If your platform doesn't have a
+   FORTRAN compiler, however, then the FORTRAN interface will not be tested
+   by `make test'.
+
+   The "XDR_" macros will be set as appropriate for your system.  If your
+   system has an XDR library, then the "xdr" subdirectory will be ignored.
+   The installation process will, however, build the test routine
+   "xdr/xdrtest" against your XDR library and run it.  This will
+   superficially verify your vendor's XDR implementation.  Systems that we
+   know already have a satisfactory XDR library include Sun (in libc),
+   CRAY/UNICOS, SGI/IRIX (in libsun) and IBM RS6000/AIX.  Systems for which
+   you should build an XDR library from the sources we provide include
+   MSDOS, OS/2, VAX/VMS (unless you have a vendor-supplied one, e.g. from
+   TGV), and DECstation/Ultrix (because of a bug in the vendor-supplied
+   library, see note below).  You might also wish to use our XDR library
+   for VAXstation/Ultrix systems.
+
+   Assuming you will use the XDR routines provided, do you want the XDR
+   routines rolled in with the netcdf library, or placed in a separate
+   library?  The Makefiles are set up assuming the first choice was made.
+
+   Note: If you are building the netCDF library on a DECstation under
+   ULTRIX, you should use the provided XDR source instead of the XDR
+   routines in the system library, since the XDR floating point routines in
+   the latter contain a bug (this is checked for by the `configure' script).
+   There are also (much less notable) problems on VAX ULTRIX. In both
+   cases, the problems are isolated to the module xdr_float.c.
+   We suggest replacing the /lib/libc.a module xdr_float.o in Ultrix
+   distributions with the one provided here.
+
+   Since there is no standard for calling C from Fortran, we provide a way
+   of generating a Fortran interface for the most common platforms, and a
+   way of parameterizing less common calling conventions so you can generate
+   a Fortran interface for other platforms.  If you use standard
+   vendor-supplied C and Fortran compilers (or other compilers with the same
+   Fortran-to-C calling conventions) on SunOS, Ultrix, Unicos, AIX, VMS, or
+   Microsoft compilers on PCDOS, MSDOS, or OS/2, the Makefile we provide
+   will generate the Fortran interface.  If there are problems generating
+   the Fortran interface, you will see them right away, since make tries to
+   do this first.  In that case, you might want to check the fortran/NOTES
+   file for OS-specific hints.  At the least, you must correctly define the
+   OS macro in the Makefile to be one of the supported platforms.  If you
+   are not building on one of these platforms, follow the instructions in
+   fortran/README to create new Fortran interface sources.  Change back to
+   the top-level netcdf directory before proceeding.
+
+On a VMS system:
+
+    1) Read the exposition of NC_OLD_FILLVALUES in the file libsrc/netcdf.h
+       and set the macro appropriately.
+
+    2) Use the make.com files in each source directory, and build in the
+       subdirectories in the following order:  [.xdr], [.libsrc], [.nctest],
+       [fortran.vms], [.ncdump], [.ncgen].  Note that, by default, the
+       netCDF library will be installed in [-.lib], the C and FORTRAN
+       include files will be installed in [-.include], and the programs
+       `ncgen' and `ncdump' will *not* be installed but will be found in
+       their respective subdirectories.
+
+On a PCDOS, MSDOS, or OS/2 system:
+
+    1) The netCDF package has been tested on MSDOS Version 5.0 and OS/2
+       Version 1.3.
+
+       MSDOS: in order to build the package using recursive makes (nmake),
+       you will have to boot a configuration that contains no (or as few
+       as possible) TSRs from CONFIG.SYS.  If you do not, the compiler and/or
+       linker WILL run out of heap space at some time during the build.
+       
+    2) Read the exposition of NC_OLD_FILLVALUES in the file libsrc/netcdf.h
+       and set the macro appropriately.
+
+    3) If you are building the system on OS/2, you will have to set the "OS2" 
+       macro to 1 in the top-level msoft.mk file or supply the definition
+       OS2=1 on the make invocation command line.  Using msoft.mk from the 
+       top-level directory will invoke the make utility (nmake) recursively 
+       for all the source subdirectories.  
+
+    4) Successively make the targets "all", "test" and "install".  
+
+    NOTES:
+       o Recursive makes work with DOS 5.0 and OS/2 but may not work with 
+         earlier versions of DOS because of memory limitations (see 1) above); 
+         in this case you will have to use the msoft.mk files in each of the 
+         subdirectories.  
+
+       o You may have to delete or rename the VMS-specific make.com files if 
+         your make utility is named "make".  
+
+       o If you are making the Fortran interface, ignore the Fortran error 
+         messages about VALUE type and length mismatches.  For FORTRAN users, 
+         the C library should be built without FORTRAN compatibility, but the 
+         FORTRAN library should be built with C compatibility.
+
+Questions about building or installing netCDF software should be sent to
+support at unidata.ucar.edu.
+
+Good Luck  :-)
+
+Russ Rew
+Steve Emmerson
+Glenn Davis
+Tom Yoksas

Added: packages/libhdf4/branches/upstream/current/mfhdf/MANIFEST
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/MANIFEST	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/MANIFEST	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,189 @@
+CHANGES
+COPYRIGHT
+CUSTOMIZE
+FAQ
+INSTALL
+MANIFEST
+Makefile.in
+ORIGIN
+README
+VERSION
+configure
+configure.in
+aclocal.m4
+msoft.mk
+port/COPYRIGHT
+port/CUSTOMIZE
+port/HISTORY
+port/Makefile.in
+port/VERSION
+port/aclocal.m4
+port/configure
+port/configure.in
+port/depend
+port/master.mk.in
+port/uddummy.c
+port/udposix.h.in
+doc/README
+doc/Makefile.in
+doc/netcdf.3
+doc/netcdf.3f
+doc/texindex.c
+doc/udunits.dat
+doc/guide.ps
+doc/guide.txn
+doc/texinfo.tex
+fortran/ftest.src
+fortran/Makefile.in
+fortran/README
+fortran/aix.m4
+fortran/common.inc
+fortran/common.m4
+fortran/depend
+fortran/descrip.mms
+fortran/fortc
+fortran/fortc1.sed
+fortran/fortc2.sed
+fortran/hpux.m4
+fortran/irix.m4
+fortran/jackets.src
+fortran/msoft.m4
+fortran/msoft.mk
+fortran/sunos.m4
+fortran/ultrix.m4
+fortran/unicos.m4
+fortran/vms.m4
+fortran/msoft/NOTES
+fortran/msoft/fslen.asm
+fortran/msoft/ftest.for
+fortran/msoft/jackets.c
+fortran/msoft/msoft.int
+fortran/msoft/netcdf.inc
+ncdump/Makefile.in
+ncdump/ncdump.c
+ncdump/ncdump.h
+ncdump/depend
+ncdump/msoft.mk
+ncdump/test0.cdl
+ncdump/vardata.c
+ncdump/vardata.h
+ncdump/dumplib.c
+ncdump/dumplib.h
+ncdump/ncdump.1
+ncgen/Makefile.in
+ncgen/depend
+ncgen/README
+ncgen/close.c
+ncgen/descrip.mms
+ncgen/escapes.c
+ncgen/generate.c
+ncgen/generic.h
+ncgen/genlib.c
+ncgen/genlib.h
+ncgen/getfill.c
+ncgen/init.c
+ncgen/lexyacc.com
+ncgen/load.c
+ncgen/main.c
+ncgen/make.com
+ncgen/msoft.mk
+ncgen/msofttab.c
+ncgen/msofttab.h
+ncgen/msoftyy.c
+ncgen/ncgen.1
+ncgen/ncgen.h
+ncgen/ncgen.l
+ncgen/ncgen.opt
+ncgen/ncgen.y
+ncgen/test.com
+ncgen/test0.cdl
+nctest/Makefile.in
+nctest/README
+nctest/add.c
+nctest/add.h
+nctest/atttests.c
+nctest/cdftests.c
+nctest/depend
+nctest/dimtests.c
+nctest/driver.c
+nctest/emalloc.c
+nctest/emalloc.h
+nctest/error.c
+nctest/error.h
+nctest/misctest.c
+nctest/msoft.mk
+nctest/rec.c
+nctest/slabs.c
+nctest/testcdf.h
+nctest/tests.h
+nctest/val.c
+nctest/val.h
+nctest/vardef.c
+nctest/varget.c
+nctest/vargetg.c
+nctest/varput.c
+nctest/varputg.c
+nctest/vartests.c
+nctest/vputget.c
+nctest/vputgetg.c
+libsrc/Makefile.in
+libsrc/README
+libsrc/depend
+libsrc/array.c
+libsrc/attr.c
+libsrc/cdf.c
+libsrc/dim.c
+libsrc/error.c
+libsrc/file.c
+libsrc/globdef.c
+libsrc/iarray.c
+libsrc/putget.c
+libsrc/putgetg.c
+libsrc/sharray.c
+libsrc/string.c
+libsrc/var.c
+libsrc/xdrposix.c
+libsrc/xdrstdio.c
+libsrc/cdftest.c
+libsrc/alloc.h
+libsrc/testout.sav
+libsrc/descrip.mms
+libsrc/error.h
+libsrc/htons.mar
+libsrc/local_nc.h
+libsrc/make.com
+libsrc/msoft.mk
+libsrc/netcdf.h
+libsrc/ntohs.mar
+libsrc/test_cdf.sav
+xdr/Makefile.in
+xdr/NOTICE.h
+xdr/README
+xdr/depend
+xdr/byteordr.c
+xdr/descrip.mms
+xdr/htonl.mar
+xdr/make.com
+xdr/msoft.mk
+xdr/ntohl.mar
+xdr/test_xdr.sav
+xdr/types.h
+xdr/xdr.c
+xdr/xdr.h
+xdr/xdrarray.c
+xdr/xdrfloat.c
+xdr/xdrstdio.c
+xdr/xdrtest.c
+xdr/xdrtest.opt
+xdr/testout.sav
+c++/Makefile
+c++/README
+c++/doc.txt
+c++/example.c
+c++/example.cc
+c++/example.cdl
+c++/nctst.cc
+c++/ncvalues.cc
+c++/ncvalues.hh
+c++/netcdf.cc
+c++/netcdf.hh

Added: packages/libhdf4/branches/upstream/current/mfhdf/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,732 @@
+# $Id: Makefile.in,v 1.24 2000/08/30 00:11:10 wendling Exp $
+#
+#          Makefile to build netcdf library and utilities
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefix)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Default Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(FMPOOL_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+#PACKAGE		= netcdf
+MANIFEST = $(DISTFILES)
+DISTFILES	= CHANGES COPYRIGHT CUSTOMIZE FAQ INSTALL  \
+		  Makefile.in ORIGIN README THANKS VERSION configure \
+		  configure.in aclocal.m4 msoft.mk
+SUBDIRS		= port doc fortran ncdump ncgen nctest libsrc xdr c++ dumper \
+		  pablo
+SUBDIR_TARGETS	= \
+    port/all	                             port/clean   port/distclean \
+    doc/all                  doc/install     doc/clean     doc/distclean \
+    fortran/all fortran/test fortran/install fortran/clean fortran/distclean \
+    ncdump/all  ncdump/test  ncdump/install  ncdump/clean  ncdump/distclean \
+    ncgen/all   ncgen/test   ncgen/install   ncgen/clean   ncgen/distclean \
+    nctest/all  nctest/test                  nctest/clean  nctest/distclean \
+    libsrc/all  libsrc/test  libsrc/install  libsrc/clean  libsrc/distclean \
+    xdr/all     xdr/test     xdr/install     xdr/clean     xdr/distclean \
+    c++/all                                  c++/clean    c++/distclean \
+    pablo/all                pablo/install   pablo/clean  pablo/distclean \
+    dumper/all  dumper/test  dumper/install  dumper/clean dumper/distclean \
+    ncdump/install-utils  ncgen/install-utils dumper/install-utils \
+    ncdump/install-man    ncgen/install-man   \
+    xdr/install-includes fortran/install-includes libsrc/install-includes
+
+all::		port/all xdr/all libsrc/all fortran/all ncdump/all \
+		ncgen/all nctest/all doc/all dumper/all pablo/all
+libmfhdf::	port/all xdr/all libsrc/all fortran/all 
+libmfhdf-inst::	port/all xdr/all libsrc/all fortran/all pablo/all
+test::		xdr/test libsrc/test nctest/test fortran/test ncdump/test \
+		ncgen/test dumper/test
+install::	xdr/install fortran/install libsrc/install ncdump/install \
+		ncgen/install doc/install dumper/install pablo/install
+install-libs::	xdr/install fortran/install libsrc/install  pablo/install
+install-includes::	xdr/install-includes fortran/install-includes libsrc/install-includes 
+install-utils:: ncdump/install-utils ncgen/install-utils dumper/install-utils
+install-man::   doc/install ncdump/install-man ncgen/install-man
+clean::		port/clean xdr/clean libsrc/clean fortran/clean ncdump/clean \
+		ncgen/clean nctest/clean doc/clean dumper/clean pablo/clean
+	rm -f netcdf*.tar.Z
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	FC="$(FC)" \
+    FFLAGS="$(FFLAGS)" 
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	FC="$(FC)" \
+    FFLAGS="$(FFLAGS)" 
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF)'; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+	for subdir in $(SUBDIRS); do \
+	  echo making $@ in $$subdir; \
+	  mkdir $(distdir)/$$subdir || exit 1; \
+	  (cd $$subdir && $(MAKE) $@) || exit 1; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+
+# The `distclean' target appears after the master makefile to prevent
+# making `distclean' in the subdirectories before making `clean'.
+#
+distclean::	port/distclean  \
+		doc/distclean \
+		fortran/distclean \
+		ncdump/distclean \
+		dumper/distclean \
+		ncgen/distclean \
+		nctest/distclean \
+		libsrc/distclean \
+		xdr/distclean \
+		c++/distclean

Added: packages/libhdf4/branches/upstream/current/mfhdf/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,47 @@
+# $Id: Makefile.in_orig,v 1.1 1996/03/28 20:57:16 georgev Exp $
+#
+#          Makefile to build netcdf library and utilities
+
+
+PACKAGE		= netcdf
+MANIFEST	= CHANGES COPYRIGHT CUSTOMIZE FAQ INSTALL MANIFEST \
+		  Makefile.in ORIGIN README THANKS VERSION configure \
+		  configure.in aclocal.m4 msoft.mk
+SUBDIRS		= port doc fortran ncdump ncgen nctest libsrc xdr c++ dumper
+SUBDIR_TARGETS	= \
+    port/all	                             port/clean   port/distclean \
+    doc/all                  doc/install     doc/clean     doc/distclean \
+    fortran/all fortran/test fortran/install fortran/clean fortran/distclean \
+    ncdump/all  ncdump/test  ncdump/install  ncdump/clean  ncdump/distclean \
+    ncgen/all   ncgen/test   ncgen/install   ncgen/clean   ncgen/distclean \
+    nctest/all  nctest/test                  nctest/clean  nctest/distclean \
+    libsrc/all  libsrc/test  libsrc/install  libsrc/clean  libsrc/distclean \
+    xdr/all     xdr/test     xdr/install     xdr/clean     xdr/distclean \
+    c++/all                                  c++/clean    c++/distclean \
+    dumper/all	             dumper/install  dumper/clean dumper/distclean
+
+all::		port/all xdr/all libsrc/all fortran/all ncdump/all \
+		ncgen/all nctest/all doc/all dumper/all
+test::		xdr/test libsrc/test nctest/test fortran/test ncdump/test \
+		ncgen/test
+install::	xdr/install fortran/install libsrc/install ncdump/install \
+		ncgen/install doc/install dumper/install
+clean::		port/clean xdr/clean libsrc/clean fortran/clean ncdump/clean \
+		ncgen/clean nctest/clean doc/clean dumper/clean
+	rm -f netcdf*.tar.Z
+
+include port/master.mk
+
+# The `distclean' target appears after the master makefile to prevent
+# making `distclean' in the subdirectories before making `clean'.
+#
+distclean::	port/distclean  \
+		doc/distclean \
+		fortran/distclean \
+		ncdump/distclean \
+		dumper/distclean \
+		ncgen/distclean \
+		nctest/distclean \
+		libsrc/distclean \
+		xdr/distclean \
+		c++/distclean

Added: packages/libhdf4/branches/upstream/current/mfhdf/ORIGIN
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ORIGIN	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ORIGIN	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4 @@
+Anonymous FTP:
+
+	host: unidata.ucar.edu [128.117.140.3]
+	file: pub/netcdf/netcdf.tar.Z

Added: packages/libhdf4/branches/upstream/current/mfhdf/README
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,110 @@
+			       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.

Added: packages/libhdf4/branches/upstream/current/mfhdf/README.HDF
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/README.HDF	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/README.HDF	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,11 @@
+This directory contains the HDF/mfhdf part of HDF4.1
+and Unidata netCDF v2.3.2. The hdf-related programs are
+in libsrc/ and fortran/. The library is named as
+libmfhdf.a.
+
+HDF/mfhdf will be installed from the top level.
+See the INSTALL file at the top level for installation of
+HDF for different platforms. 
+
+Make.com files are provided in each subdirectory for VMS 
+platforms. 

Added: packages/libhdf4/branches/upstream/current/mfhdf/THANKS
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/THANKS	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/THANKS	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,74 @@
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/VERSION
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/VERSION	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/VERSION	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+2.3.2

Added: packages/libhdf4/branches/upstream/current/mfhdf/aclocal.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/aclocal.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/aclocal.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,270 @@
+define(diversion_number, divnum)dnl
+divert(-1)
+
+
+# Check for fill value usage.
+#
+define(UL_FILLVALUES, [dnl
+echo checking for fill value usage
+if test "${OLD_FILLVALUES-}" = yes; then
+    OLD_FILLVALUES=1
+    AC_DEFINE(OLD_FILLVALUES)
+else
+    OLD_FILLVALUES=0
+fi
+AC_SUBST(OLD_FILLVALUES)dnl
+UC_CREATE(libsrc/netcdf.h)dnl
+])
+
+
+# Check endianness.
+#
+define(UL_SWAP, [dnl
+echo checking endianess
+SWAP=
+AC_TEST_PROGRAM([main() {
+    long i = 0;
+    char *ip = (char*)&i;
+    *ip       = 'a';
+    exit(i != 'a'); /* false if little endian or sizeof(long) == sizeof(char) */
+}], [SWAP=-DSWAP])dnl
+AC_SUBST(SWAP)dnl
+])
+
+
+# Check type of 32-bit `network long' integer.
+#
+define([UL_NETLONG], [dnl
+AC_REQUIRE([UC_OS])dnl
+if test "$OS" = unicos; then
+NETLONG=
+else
+echo checking type of netlong
+AC_TEST_PROGRAM([main() {exit(sizeof(long) == 4);}],
+[NETLONG='-DNETLONG=int'], [NETLONG=])
+fi
+AC_SUBST(NETLONG)dnl
+])
+
+
+# Check for XDR header-file directory.
+#
+define(UL_CPP_XDR, [dnl
+echo checking for XDR header-file
+AC_REQUIRE([UC_PREFIX])dnl
+AC_PROVIDE([$0])dnl
+UC_TEST_DIR(CPP_XDR, /usr/[[include]]/rpc /usr/local/[[include]]/rpc \
+    $prefix/[[include]] UC_ABSPATH(xdr), xdr.h,
+    XDR [[[include]]]-directory, -I/usr/[[[include]]]/rpc)dnl
+if test -n "${CPP_XDR-}"; then
+  CPP_XDR=-I${CPP_XDR}
+fi
+])
+
+
+# Ensure a valid XDR library.
+#
+define(UL_LIB_XDR, [dnl
+echo checking XDR library
+AC_REQUIRE([UC_OS])dnl
+AC_PROVIDE([$0])dnl
+case "${OS}" in
+  irix*)	LD_XDR=-lsun
+#                UC_ENSURE(HDF_INC, -DIRIS4)
+                UC_ENSURE(HDF_INC, -cckr);;
+  ultrix*)	LD_XDR=
+#                UC_ENSURE(HDF_INC, -DMIPSEL);;
+  unicos*)	LD_XDR=
+		UC_ENSURE(CPPFLAGS, -DBIG_SHORTS -DBIG_LONGS)
+#                UC_ENSURE(HDF_INC, -DUNICOS);;
+  aix*)         
+#               UC_ENSURE(HDF_INC, -DIBM6000)
+                LD_XDR=;;
+  sunos*)       
+#               UC_ENSURE(HDF_INC, -DSUN)
+                LD_XDR=;;
+  hpux*)        
+#               UC_ENSURE(HDF_INC, -DHP9000)
+                if test -z "$GCC"; then
+                        UC_ENSURE(CPPFLAGS, -Aa)
+                fi
+                LD_XDR=;;
+  osf*)         
+#               UC_ENSURE(HDF_INC, -DDEC_ALPHA)
+		UC_ENSURE(CPPFLAGS, -DBIG_LONGS)
+		UC_ENSURE(CPPFLAGS, -std1)
+                LD_XDR=;;
+  convex*)      
+#               UC_ENSURE(HDF_INC, -DCONVEX)
+                LD_XDR=;;
+  *)		LD_XDR=;;
+esac
+UC_ENSURE(DEFS, ${CPP_XDR-})dnl
+UC_ENSURE(DEFS, ${CPPFLAGS-})dnl
+UC_ENSURE(LIBS, ${LD_XDR-})dnl
+AC_TEST_PROGRAM(dnl
+[
+#undef NDEBUG
+
+#ifdef _AIX
+#   ifndef _ALL_SOURCE
+#     define _ALL_SOURCE
+#   endif
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+#include <types.h>
+#include <xdr.h>
+
+#define TESTFILE	"conftest.xdr"
+#define EPSILON		.0005
+#ifndef FLT_MIN
+#   define    FLT_MIN 1e-37           /* Standard C maximum */
+#endif
+#ifndef FLT_EPSILON
+#   define FLT_EPSILON        1e-5            /* Standard C maximum */
+#endif
+
+main(ac,av)
+    int			ac ;
+    char		*av[] ;
+{
+    int			ii, jj	= 0 ;
+    char		*fname	= ac > 1 ? av[1] : TESTFILE;
+    FILE		*F	= fopen(fname,"w");
+    XDR			xdrs[1] ;
+    unsigned int	count ;
+    unsigned int	szof ;
+
+    /*
+     * The last value below should be a subnormal number on a DECstation,
+     * RS6000, and SPARCstation.  Hopefully, it will catch bad xdr(3)
+     * implementations (such as a VAXstation's) which don't correctly handle
+     * such values.  Such a value should be the last one in the list.
+     */
+    static float	floats[]	= { 100.125, 100.25, 100.375, 
+					    100.5, 100.625, FLT_MIN/32 } ;
+    float *fp , got_af[sizeof(floats)/sizeof(floats[0])] ;
+
+/* create */
+
+    if( F == NULL)
+    {
+	    perror("fopen failed") ;
+	    exit(-1) ;
+    }
+    xdrstdio_create(xdrs, F, XDR_ENCODE) ;
+
+/* populate */
+
+    szof = sizeof(float) ;
+    count = sizeof(floats)/sizeof(float) ;
+    assert( xdr_vector(xdrs, (char *)floats, count, szof, xdr_float)) ;
+
+/* flush, rewind  and reopen */
+
+    assert(fflush((FILE *)xdrs->x_private) != EOF) ; /* xdr_destroy(xdrs) */
+
+    assert(fclose(F) != EOF) ;
+    F = fopen(fname,"r") ;
+    if( F == NULL)
+    {
+	    perror("fopen failed") ;
+	    exit(-1) ;
+    }
+    xdrstdio_create(xdrs, F, XDR_DECODE) ;
+
+/* check */
+
+    szof = sizeof(float) ;
+    count = sizeof(floats)/sizeof(float) ;
+    assert( xdr_vector(xdrs, (char *)got_af, count, szof, xdr_float)) ;
+    for(ii = 0, fp = got_af;
+	ii < count - 1;
+	ii++, fp++) 
+    {
+	assert(*fp <= floats[ii]*(1+FLT_EPSILON) && *fp >= floats[ii]*(1-FLT_EPSILON)) ;
+    }
+    assert(*fp == 0 || (*fp <= floats[ii]*(1+FLT_EPSILON) && *fp >= floats[ii]*(1-FLT_EPSILON))) ;
+
+    exit(0) ;
+}
+],dnl
+XDR_LIBOBJS=
+XDR_INSTALL_DEPS=,dnl
+XDR_LIBOBJS="xdr.o xdrfloat.o xdrstdio.o xdrarray.o"
+XDR_INSTALL_DEPS=installed_headers
+LD_XDR=)dnl
+AC_SUBST(XDR_LIBOBJS)dnl
+AC_SUBST(XDR_INSTALL_DEPS)dnl
+AC_SUBST(LD_XDR)dnl
+])
+
+
+# Check for XDR implementation (header file and library).
+#
+define(UL_XDR, [dnl
+AC_REQUIRE([UL_CPP_XDR])dnl
+AC_REQUIRE([UL_LIB_XDR])dnl
+])
+
+
+# Define C macros for function prototyping
+#
+define([UL_PROTOTYPES],
+[AC_COMPILE_CHECK([function prototypes], ,
+extern int foo(int bar);
+, dnl
+, dnl
+[UC_ENSURE(CPPFLAGS, -DNO_HAVE_PROTOTYPES)])])
+
+
+# Check for functioning `const' keyword
+#
+define(UL_CONST,
+[AC_COMPILE_CHECK([working const], , [/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+], dnl
+, dnl
+[UC_ENSURE(CPPFLAGS, -Dconst=)])])
+
+
+# Define macros for variadic function support
+#
+define(UL_VARIADIC_FUNCTIONS,[dnl
+AC_PROVIDE([$0])dnl
+AC_REQUIRE([UC_PROG_CPP])dnl
+AC_COMPILE_CHECK([variadic function support], , [} 
+#include <stdarg.h>
+int foo(int bar, ...) {
+    va_list     alist;
+    va_start(alist, bar);
+    bar = (int)va_arg(alist, int);
+    va_end(alist);
+    return bar;
+], dnl
+, dnl
+[UC_ENSURE(CPPFLAGS, -DNO_STDARG)])])
+
+
+# Check for strerror().
+#
+define(UL_STRERROR, [dnl
+AC_REQUIRE([UC_PROG_FC])dnl
+if test `$WHICH "${FC-}" | wc -w` != 1; then
+AC_FUNC_CHECK(strerror, , [[UC_ENSURE(CPPFLAGS, -DNO_STRERROR)]])dnl
+else
+  echo checking for strerror
+  echo '       CALL STRERROR' > conftest.f
+  if eval "$FC conftest.f > /dev/null 2>&1"; then
+    : true
+  else
+    UC_ENSURE(CPPFLAGS, -DNO_STRERROR)dnl
+  fi
+  rm -rf a.out conftest.f
+fi
+])
+
+
+divert(diversion_number)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/build.bat
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/build.bat	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/build.bat	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+nmake /f msoft.mk xdr libsrc nctest fortran ncgen ncdump

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/Makefile
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/Makefile	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/Makefile	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,100 @@
+# $Id: Makefile,v 1.3 1995/10/02 15:32:52 georgev Exp $
+#
+#	Development Makefile for netcdf c++ interface
+#
+srcdir = .
+TOP_SRCDIR = ../..
+# Version of the library
+PACKAGE	 = HDF
+VERSION  = 4.0
+INCDIR = ../libsrc
+LIBDIR = ../libsrc
+
+CCC = CC
+INCLUDES = -I$(INCDIR)
+
+CCFLAGS=-g
+MANIFEST = $(DISTFILES)
+DISTFILES	= Makefile README example.c example.cc example.cdl \
+		  nctst.cc ncvalues.cc ncvalues.hh netcdf.cc netcdf.hh \
+		  expected nc.txn nc.info
+DEFINES =
+CPPFLAGS = $(INCLUDES) $(DEFINES)
+LIBS = -L$(LIBDIR) -lnetcdf
+PURIFY = purify
+PRINTER = hpnp
+
+# a test program that uses some of the draft C++ interface
+PROG = nctst
+PROG_SRCS = netcdf.cc nctst.cc ncvalues.cc
+PROG_OBJS = netcdf.o nctst.o ncvalues.o
+
+all: $(PROG)
+
+$(PROG) : $(PROG_OBJS)
+	$(LINK.cc) $(PROG_OBJS) $(LIBS) -o $@
+
+test:	expected $(PROG)
+	./$(PROG) > test.out
+	@cmp expected test.out && \
+	    echo "*** $(PROG) test successful ***" ;
+
+nctst.pure:	$(PROG_OBJS)
+	$(PURIFY) $(LINK.cc) $(PROG_OBJS) $(LIBS) -o $@
+	./$@
+
+clean:
+	rm -f $(PROG_OBJS) $(PROG) example.cdf *~
+
+distclean:	clean
+
+netcdf.o: netcdf.hh $(INCDIR)/netcdf.h netcdf.cc
+ncvalues.o: ncvalues.hh ncvalues.cc
+nctst.o: netcdf.hh nctst.cc
+
+nctst_src: nctst.cc netcdf.cc ncvalues.cc
+	#load nctst.cc
+	#load netcdf.cc
+	#load ncvalues.cc
+	#load -L../../lib ../../lib/libnetcdf.a
+	#link
+
+nvtst: nvtst.o ncvalues.o
+	$(LINK.cc) -g -o $@ nvtst.cc ncvalues.o
+
+
+nvtst_src: nvtst.cc ncvalues.cc
+	#load nvtst.cc
+	#load ncvalues.cc
+	#link
+
+print: nctst.cc netcdf.hh netcdf.cc ncvalues.hh ncvalues.cc
+	vgrind -s11 -lC++ -t nctst.cc netcdf.hh netcdf.cc ncvalues.hh \
+				ncvalues.cc | lpr -Phpnp
+
+nc.hc:	nc.ps
+	lpr -P$(PRINTER) nc.ps
+
+nc.dvi:	nc.txn
+	tex nc.txn
+	texindex nc.fn nc.cp
+	tex nc.txn
+
+nc.ps:	nc.dvi
+	dvips -o nc.ps -r0 nc.dvi
+
+nc.info: nc.txn
+	makeinfo nc.txn
+
+MANIFEST.echo:
+	@echo $(MANIFEST) | fmt -1
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/c++
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir);}; \
+	done

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/README
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,30 @@
+This is an early release for a prototype experimental implementation of a
+C++ interface for the netCDF data access library.  It presumes you already
+have netCDF installed.  The files are:
+
+   netcdf.hh	the C++ interface
+   netcdf.cc	the implementation of the interface, on top of the current
+		C library interface
+   nctst.cc	a test program for the interface that creates a netCDF file
+		and then dumps out its contents in ASCII form to stdout.
+		This example may also be helpful in understanding how the
+		interface is intended to be used.
+   example.c	example of C code needed to create a small netCDF file
+   example.cc	analogous example of C++ code needed to do the same thing
+   Makefile	makefile for building nctst
+   ncvalues.hh	interface for auxilliary classes of typed arrays needed by
+		netCDF interface; fairly simple
+   ncvalues.cc	implementation of auxilliary classes of typed arrays needed by
+		netCDF interface
+   nc.txn	preliminary class documentation for the experimental C++
+		interface, in Texinfo form.
+   nc.info	preliminary class documentation for the experimental C++
+		interface, in info form, as generated from the Texinfo
+		source file.  The commented example program nctst.cc may
+		also be useful for understanding the interface
+   README	this file   
+
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/example.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/example.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/example.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,147 @@
+#include "netcdf.h"
+
+int
+main() {			/* create example.cdf */
+
+   int  ncid;			/* netCDF id */
+
+   /* dimension ids */
+   int  lat_dim, lon_dim, frtime_dim, timelen_dim;
+
+   /* variable ids */
+   int  P_id, lat_id, lon_id, frtime_id, reftime_id, scalarv_id;
+
+   /* variable shapes */
+   int dims[3];
+
+   /* containers for scalar attributes */
+   float  float_val;
+   double  double_val;
+
+   /* attribute vectors */
+   float  P_valid_range[2];
+
+   /* enter define mode */
+   ncid = nccreate("example.cdf", NC_CLOBBER);
+
+   /* define dimensions */
+   lat_dim = ncdimdef(ncid, "lat", 4L);
+   lon_dim = ncdimdef(ncid, "lon", 3L);
+   frtime_dim = ncdimdef(ncid, "frtime", NC_UNLIMITED);
+   timelen_dim = ncdimdef(ncid, "timelen", 20L);
+
+   /* define variables and assign attributes */
+
+   dims[0] = frtime_dim;
+   dims[1] = lat_dim;
+   dims[2] = lon_dim;
+   P_id = ncvardef (ncid, "P", NC_FLOAT, 3, dims);
+   ncattput (ncid, P_id, "long_name", NC_CHAR, 24,
+	     (void *)"pressure at maximum wind");
+   ncattput (ncid, P_id, "units", NC_CHAR, 12,
+	     (void *)"hectopascals");
+   P_valid_range[0] = 0;
+   P_valid_range[1] = 1500;
+   ncattput (ncid, P_id, "valid_range", NC_FLOAT, 2,
+	     (void *) P_valid_range);
+   float_val = -9999;
+   ncattput (ncid, P_id, "_FillValue", NC_FLOAT, 1,
+	     (void *) &float_val);
+
+   dims[0] = lat_dim;
+   lat_id = ncvardef (ncid, "lat", NC_FLOAT, 1, dims);
+   ncattput (ncid, lat_id, "long_name", NC_CHAR, 8,
+	     (void *)"latitude");
+   ncattput (ncid, lat_id, "units", NC_CHAR, 13,
+	     (void *)"degrees_north");
+
+   dims[0] = lon_dim;
+   lon_id = ncvardef (ncid, "lon", NC_FLOAT, 1, dims);
+   ncattput (ncid, lon_id, "long_name", NC_CHAR, 9,
+	     (void *)"longitude");
+   ncattput (ncid, lon_id, "units", NC_CHAR, 12,
+	     (void *)"degrees_east");
+
+   dims[0] = frtime_dim;
+   frtime_id = ncvardef (ncid, "frtime", NC_LONG, 1, dims);
+   ncattput (ncid, frtime_id, "long_name", NC_CHAR, 13,
+	     (void *)"forecast time");
+   ncattput (ncid, frtime_id, "units", NC_CHAR, 5,
+	     (void *)"hours");
+
+   dims[0] = timelen_dim;
+   reftime_id = ncvardef (ncid, "reftime", NC_CHAR, 1, dims);
+   ncattput (ncid, reftime_id, "long_name", NC_CHAR, 14,
+	     (void *)"reference time");
+   ncattput (ncid, reftime_id, "units", NC_CHAR, 9,
+	     (void *)"text_time");
+
+   scalarv_id = ncvardef (ncid, "scalarv", NC_LONG, 0, 0);
+   double_val = 1;
+   ncattput (ncid, scalarv_id, "scalar_att", NC_DOUBLE, 1,
+	     (void *) &double_val);
+
+   /* Global attributes */
+   ncattput (ncid, NC_GLOBAL, "history", NC_CHAR, 41,
+	     (void *)"created by Unidata LDM from NPS broadcast");
+   ncattput (ncid, NC_GLOBAL, "title", NC_CHAR, 48,
+	     (void *)"NMC Global Product Set: Pressure at Maximum Wind");
+
+   /* leave define mode */
+   ncendef (ncid);
+  
+   {			/* store lat */
+    static long lat_start[] = {0};
+    static long lat_edges[] = {4};
+    static float lat[] = {-90, -87.5, -85, -82.5};
+    ncvarput(ncid, lat_id, lat_start, lat_edges, (void *)lat);
+   }
+
+   {			/* store lon */
+    static long lon_start[] = {0};
+    static long lon_edges[] = {3};
+    static float lon[] = {-180, -175, -170};
+    ncvarput(ncid, lon_id, lon_start, lon_edges, (void *)lon);
+   }
+
+   {			/* store frtime */
+    static long frtime_start[] = {0};
+    static long frtime_edges[] = {1};
+    static long frtime[] = {12};
+    ncvarput(ncid, frtime_id, frtime_start, frtime_edges,
+	     (void *)frtime);
+   }
+
+   {			/* store frtime */
+    static long frtime_start[] = {1};
+    static long frtime_edges[] = {1};
+    static long frtime[] = {18};
+    ncvarput(ncid, frtime_id, frtime_start, frtime_edges,
+	     (void *)frtime);
+   }
+
+   {			/* store reftime */
+    static long reftime_start[] = {0};
+    static long reftime_edges[] = {20};
+    static char reftime[] = {"1992 03 04 12:00"};
+    ncvarput(ncid, reftime_id, reftime_start, reftime_edges,
+	     (void *)reftime);
+   }
+
+   {			/* store P */
+    static long P_start[] = {0, 0, 0};
+    static long P_edges[] = {2, 4, 3};
+    static float P[] = {
+	950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961
+	962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973
+      };
+    ncvarput(ncid, P_id, P_start, P_edges, (void *)P);
+   }
+
+   {			/* store scalarv */
+    static long scalarv = {-2147483647};
+    ncvarput1(ncid, scalarv_id, (long *)0, (void *)&scalarv);
+   }
+   ncclose (ncid);
+   return 0;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/example.cc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/example.cc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/example.cc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,80 @@
+#include <string.h>
+#include "netcdf.hh"
+
+#define NUM(array) (sizeof(array)/sizeof(array[0]))
+
+int
+main( void )
+{
+    const char* path = "example.nc";
+    NcNewFile nc (path, NcFile::Clobber); // Create and leave in define mode
+
+    // Check if the file was opened
+    if (! nc.is_valid()) {
+	cerr << "can't create netCDF file " << path << "\n";
+	return;
+    }
+
+    // Create dimensions
+    NcDim* latd = nc.add_dim("lat", 4);
+    NcDim* lond = nc.add_dim("lon", 3);
+    NcDim* frtimed = nc.add_dim("frtime");
+    NcDim* timelend = nc.add_dim("timelen",20); 
+
+    // Create variables and their attributes
+    NcVar* P = nc.add_var("P", ncFloat, frtimed, latd, lond);
+    P->add_att("long_name", "pressure at maximum wind");
+    P->add_att("units", "hectopascals");
+    static float range[] = {0., 1500.};
+    P->add_att("valid_range", NUM(range), range);
+    P->add_att("_FillValue", -9999.0f);
+
+    NcVar* lat = nc.add_var("lat", ncFloat, latd);
+    lat->add_att("long_name", "latitude");
+    lat->add_att("units", "degrees_north");
+
+    NcVar* lon = nc.add_var("lon", ncFloat, lond);
+    lon->add_att("long_name", "longitude");
+    lon->add_att("units", "degrees_east");
+
+    NcVar* frtime = nc.add_var("frtime", ncLong, frtimed);
+    frtime->add_att("long_name", "forecast time");
+    frtime->add_att("units", "hours");
+
+    NcVar* reftime = nc.add_var("reftime",ncChar,timelend);
+    reftime->add_att("long_name", "reference time");
+    reftime->add_att("units", "text_time");
+
+    NcVar* scalar = nc.add_var("scalarv",ncLong);
+    scalar->add_att("scalar_att", 1.0);
+
+    // Global attributes
+    nc.add_att("history", "created by Unidata LDM from NPS broadcast");
+    nc.add_att("title", "NMC Global Product Set: Pressure at Maximum Wind");
+
+    // Start writing data, implictly leaves define mode
+
+    float *lats = new float[latd->size()];
+    for(int i = 0; i < latd->size(); i++)
+      lats[i] = -90. + 2.5*i;
+    lat->put(lats, latd->size());
+
+    float *lons = new float[lond->size()];
+    for(i = 0; i < lond->size(); i++)
+      lons[i] = -180. + 5.*i;
+    lon->put(lons, lond->size());
+
+    static long frtimes[] = {12, 18};
+    frtime->put(frtimes, NUM(frtimes));
+
+    static char* s = "1992 03 04 12:00" ;
+    reftime->put(s, strlen(s));
+
+    static float P_data[] = {
+	950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961,
+	962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973
+      };
+    P->put(P_data, P->edges());
+    
+    // close of nc takes place in destructor
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/example.cdl
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/example.cdl	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/example.cdl	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,54 @@
+netcdf example {
+dimensions:
+	lat = 4 ;
+	lon = 3 ;
+	frtime = UNLIMITED ; // (2 currently)
+	timelen = 20 ;
+
+variables:
+	float P(frtime, lat, lon) ;
+		P:long_name = "pressure at maximum wind" ;
+		P:units = "hectopascals" ;
+		P:valid_range = 0.f, 1500.f ;
+		P:_FillValue = -9999.f ;
+	float lat(lat) ;
+		lat:long_name = "latitude" ;
+		lat:units = "degrees_north" ;
+	float lon(lon) ;
+		lon:long_name = "longitude" ;
+		lon:units = "degrees_east" ;
+	long frtime(frtime) ;
+		frtime:long_name = "forecast time" ;
+		frtime:units = "hours" ;
+	char reftime(timelen) ;
+		reftime:long_name = "reference time" ;
+		reftime:units = "text_time" ;
+	long scalarv ;
+		scalarv:scalar_att = 1. ;
+
+// global attributes:
+		:history = "created by Unidata LDM from NPS broadcast" ;
+		:title = "NMC Global Product Set: Pressure at Maximum Wind" ;
+
+data:
+
+ P =
+  950, 951, 952,
+  953, 954, 955,
+  956, 957, 958,
+  959, 960, 961,
+  962, 963, 964,
+  965, 966, 967,
+  968, 969, 970,
+  971, 972, 973 ;
+
+ lat = -90, -87.5, -85, -82.5 ;
+
+ lon = -180, -175, -170 ;
+
+ frtime = 12, 18 ;
+
+ reftime = "1992 03 04 12:00" ;
+
+ scalarv = -2147483647 ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/expected
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/expected	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/expected	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,37 @@
+netcdf example {
+dimensions:
+	lat = 4 ;
+	lon = 3 ;
+	frtime = UNLIMITED ;	 // 2 currently
+	timelen = 20 ;
+variables:
+	float P(frtime, lat, lon) ;
+		P:long_name = "pressure at maximum wind" ;
+		P:units = "hectopascals" ;
+		P:valid_range = 0, 1500 ;
+		P:_FillValue = -9999 ;
+	float lat(lat) ;
+		lat:long_name = "latitude" ;
+		lat:units = "degrees_north" ;
+	float lon(lon) ;
+		lon:long_name = "longitude" ;
+		lon:units = "degrees_east" ;
+	long frtime(frtime) ;
+		frtime:long_name = "forecast time" ;
+		frtime:units = "hours" ;
+	char reftime(timelen) ;
+		reftime:long_name = "reference time" ;
+		reftime:units = "text_time" ;
+	long scalarv ;
+		scalarv:scalar_att = 1 ;
+// global attributes
+		:history = "created by Unidata LDM from NPS broadcast" ;
+		:title = "NMC Global Product Set: Pressure at Maximum Wind" ;
+data:
+ P = 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973 ;
+ lat = -90, -87.5, -85, -82.5 ;
+ lon = -180, -175, -170 ;
+ frtime = 12, 18 ;
+ reftime = "1992-3-21 12:00" ;
+ scalarv = -2147483647 ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/nc.info
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/nc.info	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/nc.info	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,915 @@
+This is Info file nc.info, produced by Makeinfo-1.47 from the input
+file nc.txn.
+
+   This file documents the prototype experimental Unidata C++ netCDF
+interface.
+
+   Copyright (C) 1993 University Corporation for Atmospheric Research.
+Permission is granted to make and distribute verbatim copies of this
+file provided the copyright notice and this permission notice are
+preserved on all copies.
+
+
+File: nc.info,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
+
+NetCDF C++ Interface
+********************
+
+   This manual is preliminary documentation for the prototype,
+experimental C++ interface for netCDF (version 0).
+
+* Menu:
+
+* Introduction::
+* File Classes::
+* NetCDF Components::
+* Auxiliary Classes::
+* Function Index::
+
+ -- The Detailed Node Listing --
+
+Introduction
+
+* Class Hierarchy::
+* Auxiliary Types and Constants::
+
+File Classes
+
+* Class NcFile::
+* Class NcNewFile::
+* Class NcOldFile::
+
+Dimensions, Variables, and Attributes
+
+* Class NcDim::
+* Class NcTypedComponent::
+* Class NcVar::
+* Class NcAtt::
+
+Auxiliary Classes
+
+* Class NcValues::
+* Class NcError::
+
+
+File: nc.info,  Node: Introduction,  Next: File Classes,  Prev: Top,  Up: Top
+
+Introduction
+************
+
+   This is an early release for a prototype implementation of a C++
+interface for the netCDF data access library.
+
+   The main requirements for the design of the C++ interface are:
+
+   * to provide the functionality of the C interface;
+
+   * to keep the C++ interface state consistent with the C interface
+     state;
+
+   * to provide type safety by eliminating all use of `void*' pointers;
+     and
+
+   * to provide an interface that is simpler to use than the C
+     interface.
+
+   Some of the features of the C++ interface are:
+
+   * No IDs needed for netCDF's variables, dimensions, or attributes.
+
+   * No explicit open or close calls needed for netCDF files; a
+     constructor opens and a destructor closes a file.
+
+   * No need to specify types for creating attributes; they will have
+     the type of the value provided.
+
+   * No use of `void*': values are type-checked.
+
+   * Less indirection is needed for dimensions & dimension sizes than
+     with the C interface.  Dimensions can be given as arguments in
+     variable definitions.
+
+   * Code for data types is isolated, which should make the addition of
+     new types easier.
+
+   * No explicit `ncredef' or `ncendef' calls are needed for switching
+     between define and data modes.  Whenever a mode switch is
+     required, it happens implicitly.  Note: this may change; there
+     appear to be advantages to not allowing `ncredef' functionality in
+     the C++ interface, but supporting copy semantics and a `schema'
+     object instead.
+
+   The header file `netcdf.hh' must be included in source code files
+using this interface.
+
+   This early release provides the functionality of netCDF version 2.02,
+but does not yet include member functions corresponding to the netCDF
+2.3 generalized hyperslab access interfaces (`ncvarputg', `ncvargetg')
+or the record I/O interfaces (`ncrecinq', `ncrecput', `ncrecget') in
+netCDF version 2.3.
+
+   This manual assumes familiarity with Chapters 1 through 4 of the
+netCDF User's Guide, where the concepts of netCDF dimensions,
+variables, and attributes are discussed.
+
+* Menu:
+
+* Class Hierarchy::
+* Auxiliary Types and Constants::
+
+
+File: nc.info,  Node: Class Hierarchy,  Next: Auxiliary Types and Constants,  Up: Introduction
+
+Class Hierarchy
+===============
+
+     `NcFile'                   abstract base class for files
+             `NcNewFile'        new netCDF files
+             `NcOldFile'        existing netCDF files
+     
+     `NcDim'                    dimension
+     
+     `NcTypedComponent'         abstract base class
+             `NcVar'            variable
+             `NcAtt'            attribute
+     
+     `NcValues'                 abstract base class for arrays
+             `NcValues_ncbyte'  array of bytes
+             `NcValues_char'    array of characters
+             `NcValues_short'   array of shorts
+             `NcValues_int'     array of ints
+             `NcValues_long'    array of longs
+             `NcValues_float'   array of floats
+             `NcValues_double'  array of doubles
+     
+     `NcError'                    for error handling
+
+
+File: nc.info,  Node: Auxiliary Types and Constants,  Prev: Class Hierarchy,  Up: Introduction
+
+Auxiliary Types and Constants
+=============================
+
+   The netCDF classes use several auxiliary types for arguments and
+return types from member functions: `NcToken', `NcType', `ncbyte', and
+`NcBool'.
+
+`NcToken'
+     Used for names for netCDF objects, in particular variable names,
+     dimension names, and attribute names.  Currently this is just a
+     typedef for `const char*'.
+
+`NcType'
+     Used for specifying netCDF value types.  Currently this is an
+     enumerated type with the following legitimate values:  `ncByte',
+     `ncChar', `ncShort', `ncLong', `ncFloat', `ncDouble', and `ncInt'.
+      The latter is a synonym for `ncLong'.
+
+`ncbyte'
+     Used to declare values of type `ncByte', analogously to using the
+     built-in type `float' to declare values of type `ncFloat'. This is
+     currently just a typedef for `unsigned char'.
+
+`NcBool'
+     Used for the return type of some member functions.  If the member
+     function fails, 0 is returned, otherwise some non-zero value. 
+     Currently this is just a typedef for `unsigned int'.
+
+
+File: nc.info,  Node: File Classes,  Next: NetCDF Components,  Prev: Introduction,  Up: Top
+
+File Classes
+************
+
+   There are three netCDF file classes: `NcFile', `NcOldFile', and
+`NcNewFile'.  The latter two are derived from the `NcFile' abstract
+base class, which defines all the member functions except the
+constructors.
+
+* Menu:
+
+* Class NcFile::
+* Class NcNewFile::
+* Class NcOldFile::
+
+
+File: nc.info,  Node: Class NcFile,  Next: Class NcNewFile,  Up: File Classes
+
+Class NcFile
+============
+
+   `NcFile' is the abstract base class for netCDF file objects.  It
+provides all common methods for file operations.  There are no
+constructors for `NcFile'.  `NcOldFile' or `NcNewFile' classes must be
+used to create `NcFile' objects.
+
+   Some member functions return pointers to dimensions (`NcDim') or
+variables (`NcVar').  These objects are owned by the `NcFile' they are
+associated with, and will be deleted automatically by the `NcFile'
+destructor (or by the `close' member function, if this is called
+earlier than the destructor), so users should not delete these.  Member
+functions that return pointers to attributes (`NcAtt') currently pass
+ownership to the calling function; users should delete attributes when
+they are finished with them.  Note: it appears that it will be
+desirable to change the ownership of `NcAtt' objects in the future so
+that they are owned by their variables, at which time their destructor
+will be called when the associated variable destructor is invoked.
+
+   All member functions that return a value of type `NcBool' return
+`TRUE' on success and `FALSE' on failure.  All member functions that
+return a pointer value return the `NULL' pointer on failure.
+
+   This class interface hides the distinction in the C and Fortran
+interfaces between "define mode" (when dimensions, variables, or
+attributes are being defined or renamed), and "data mode" (when data
+values are being accessed), by automatically switching between the modes
+when necessary.  Users should be aware that switching from accessing
+data to adding or renaming dimensions, variables and attributes can be
+expensive, since it may entail a copy of the data.
+
+Public Member Functions
+-----------------------
+
+`~NcFile( void )'
+     Destructor.  The file is closed and all resources associated with
+     it are released, including the associated `NcVar' and `NcDim'
+     objects.  If you wish to close the file earlier, you may
+     explicitly call the `close' member function; a subsequent
+     destructor call will work properly.
+
+`NcBool close( void )'
+     Close netCDF file.
+
+`NcBool is_valid( void ) const'
+     Returns `TRUE' if valid netCDF file, `FALSE' otherwise (e.g. if
+     constructor could not open file).
+
+`int num_dims( void ) const'
+     Returns the number of dimensions in the netCDF file.
+
+`int num_vars( void ) const'
+     Returns the number of variables in the netCDF file.
+
+`int num_atts( void ) const'
+     Returns the number of global attributes in the netCDF file.
+
+`NcDim* get_dim(NcToken name) const'
+     Get a dimension by name.
+
+`NcVar* get_var(NcToken name) const'
+     Get a variable by name.
+
+`NcAtt* get_att(NcToken name) const'
+     Get a global attribute by name.
+
+`NcDim* get_dim(int i) const'
+     Get the ith dimension (beginning with the 0th).
+
+`NcVar* get_var(int i) const'
+     Get the ith variable (beginning with the 0th).
+
+`NcAtt* get_att(int i) const'
+     Get the ith global attribute (beginning with the 0th).
+
+`NcDim* rec_dim( void ) const'
+     Get the unlimited dimension, if any.
+
+`NcDim* add_dim(NcToken dimname)'
+     Add an unlimited dimension named `dimname' to the netCDF file.
+
+`NcDim* add_dim(NcToken dimname, long dimsize)'
+     Add a dimension named `dimname' of size `dimsize'.
+
+`NcVar* add_var(NcToken varname, NcType type, const NcDim* dim0, ... , const NcDim* dim4=0)'
+     Add a variable named `varname' of between 1 and 5 dimensions of the
+     specified type.  Dimension arguments default to 0.  Supply as many
+     dimensions as needed.  If more than 5 dimensions are required, use
+     the n-dimensional version of this member function.
+
+`NcVar* add_var(NcToken varname, NcType type, int ndims, const NcDim* dims)'
+     Add a variable named `varname' of `ndims' dimensions and of the
+     specified type.  Use this method when dealing with variables of
+     more than 5 dimensions.
+
+`NcBool add_att(NcToken name, char val)'
+`NcBool add_att(NcToken name, short val)'
+`NcBool add_att(NcToken name, int val)'
+`NcBool add_att(NcToken name, long val)'
+`NcBool add_att(NcToken name, float val)'
+`NcBool add_att(NcToken name, double val)'
+`NcBool add_att(NcToken name, const char* val)'
+     Add global scalar attributes of the specified name and with the
+     supplied value.
+
+`NcBool add_att(NcToken name, int n, const char* val)'
+`NcBool add_att(NcToken name, int n, const short* val)'
+`NcBool add_att(NcToken name, int n, const int* val)'
+`NcBool add_att(NcToken name, int n, const long* val)'
+`NcBool add_att(NcToken name, int n, const float* val)'
+`NcBool add_att(NcToken name, int n, const double* val)'
+     Add global vector attributes with the specified name and vector
+     value.
+
+`NcBool set_fill( FillMode mode = Fill)'
+     Sets fill-mode to either `NcFile::Fill' or `NcFile::NoFill'.
+     Default is `Fill', in which case unwritten values are prewritten
+     with appropriate type-specific or variable-specific fill values.
+
+`enum NcFile::FillMode get_fill( void ) const'
+     Returns fill mode of the file.
+
+`NcBool sync( void )'
+     Synchronizes file to disk.
+
+`NcBool abort( void )'
+     Either just closes file (if recently it has been in data mode as
+     the result of accessing data), or backs out of the most recent
+     sequence of changes to the file schema (dimensions, variables, and
+     attributes).
+
+
+File: nc.info,  Node: Class NcNewFile,  Next: Class NcOldFile,  Prev: Class NcFile,  Up: File Classes
+
+Class NcNewFile
+===============
+
+   This class is derived from the abstract base class `NcFile', and it
+is used to create new netCDF files.
+
+Public Member Functions
+-----------------------
+
+`NcNewFile( const char * path, CreateMode = NoClobber )'
+     The constructor creates a new netCDF file.  If called with a
+     single path name argument or `NcNewFile::NoClobber' for its second
+     argument, it creates the file only if it does not already exist. 
+     The constructor will not fail in case of a bad path name or if the
+     file already exists, but no netCDF file will be created, and the
+     fact that the creation failed may be checked with the `is_valid()'
+     member function.
+
+     If called with `NcNewFile::Clobber' for its second argument, a new
+     netCDF file will be created even if the file already exists,
+     clobbering the old netCDF file.
+
+`~NcNewFile( void )'
+     The destructor will close the file, if it has not already been
+     closed with an explicit call to the `close()' member function.
+
+
+File: nc.info,  Node: Class NcOldFile,  Prev: Class NcNewFile,  Up: File Classes
+
+Class NcOldFile
+===============
+
+   This class is derived from the abstract base class `NcFile', and it
+is used to open existing netCDF files, either for read-only access (the
+default), or for read-write access.
+
+Public Member Functions
+-----------------------
+
+`NcOldFile( const char * path, OpenMode = ReadOnly )'
+     The constructor opens an existing netCDF file.  The constructor
+     will not fail in case of a bad path name or the proper permissions
+     on the file but no netCDF file will be opened, and the fact that
+     the open failed may be checked with the `is_valid()' member
+     function.
+
+     If called with a single path name argument or `NcOldFile::ReadOnly'
+     for its second argument, the file is opened for read-only access. 
+     If called with `NcOldFile::Write' for its second argument, the file
+     will be opened with read-write access.
+
+`~NcNewFile( void )'
+     The destructor will close the file, if it has not already been
+     closed with an explicit call to the `close()' member function.
+
+
+File: nc.info,  Node: NetCDF Components,  Next: Auxiliary Classes,  Prev: File Classes,  Up: Top
+
+Dimensions, Variables, and Attributes
+*************************************
+
+   The components of a netCDF file are dimensions, variables, and
+attributes.  There is a class for each of these kinds of objects;
+`NcDim', `NcVar', and `NcAtt'.  Variables and attributes share some
+common characteristics that are factored out in the abstract base class
+`NcTypedComponent'.  Users will never declare `NcTypedComponent'
+instances, but must know about the public member functions of this
+class for use with variables and attributes.
+
+* Menu:
+
+* Class NcDim::
+* Class NcTypedComponent::
+* Class NcVar::
+* Class NcAtt::
+
+
+File: nc.info,  Node: Class NcDim,  Next: Class NcTypedComponent,  Up: NetCDF Components
+
+Class NcDim
+===========
+
+   A netCDF dimension has a name and a size.  These are only created and
+destroyed by NcFile member functions, because they cannot exist
+independently of an open netCDF file.  Hence there are no public
+constructors or destructors.
+
+Public Member Functions
+-----------------------
+
+`NcToken name( void ) const'
+     Returns the name of the dimension if it exists, 0 otherwise.
+
+`long size( void ) const'
+     Returns the dimension size.
+
+`NcBool is_valid( void ) const'
+     Returns `TRUE' if file and dimension are both valid, `FALSE'
+     otherwise.
+
+`NcBool is_unlimited( void ) const'
+     Returns `TRUE' if the dimension is the unlimited dimension,
+     `FALSE' if either not a valid netCDF file, or if the dimension is
+     not the unlimited dimension.
+
+`NcBool rename( NcToken newname )'
+     Renames the dimension to `newname'.
+
+`int id( void ) const'
+     Returns the id number of the dimension.  This should almost never
+     be needed in the C++ interface.
+
+
+File: nc.info,  Node: Class NcTypedComponent,  Next: Class NcVar,  Prev: Class NcDim,  Up: NetCDF Components
+
+Class NcTypedComponent
+======================
+
+   `NcTypedComponent' is an abstract base class for `NcVar' and `NcAtt'
+that captures the similarities between netCDF variables and attributes.
+
+Public Member Functions
+-----------------------
+
+`NcToken name( void ) const'
+     Returns the name of the variable or attribute.
+
+`NcType type( void ) const'
+     Returns the type of the variable or attribute.  The type will be
+     one of `ncByte', `ncChar', `ncShort', `ncLong', `ncFloat', or
+     `ncDouble'.
+
+`NcBool is_valid( void ) const'
+     Returns `TRUE' if the component is valid, `FALSE' otherwise.
+
+`long num_vals( void ) const'
+     Returns the number of values for an attribute or variable.  For an
+     attribute, this is just 1 for a scalar attribute, the number of
+     values for a vector-valued attribute, and the number of characters
+     for a string-valued attribute.  For a variable, this is the
+     product of the dimension sizes for all the variable's dimensions.
+
+`NcBool rename( NcToken newname )'
+     Renames the variable or attribute.
+
+`NcValues* values( void )'
+     Returns a pointer to the block of all values for the variable or
+     attribute.  This will be deleted when the variable or attribute is
+     destroyed.  Note that this is not a good way to read selected
+     values of a variable; use the `get' member function instead, to
+     get single values or selected cross-sections of values.
+
+`ncbyte as_ncbyte( int n ) const'
+`char as_char( int n ) const'
+`short as_short( int n ) const'
+`long as_long( int n ) const'
+`float as_float( int n ) const'
+`double as_double( int n ) const'
+`char* as_string( int n ) const'
+     Get the n-th value of the attribute or variable.  These member
+     functions provide conversions from the value type of the variable
+     or attribute to the specified type.  If the value is out-of-range,
+     the default fill-value of the appropriate type should be returned
+     (not yet implemented).
+
+
+File: nc.info,  Node: Class NcVar,  Next: Class NcAtt,  Prev: Class NcTypedComponent,  Up: NetCDF Components
+
+Class NcVar
+===========
+
+   `NcVar' is derived from NcTypedComponent, and represents a netCDF
+variable.  A netCDF variable has a name, a type, a shape, zero or more
+attributes, and a block of values associated with it.  Because variables
+are only associated with open netCDF files, there are no public
+constructors for this class.  Use member functions of `NcFile' to get
+netCDF variables.
+
+Public Member Functions
+-----------------------
+
+`~NcVar( void )'
+     Destructor.
+
+`int num_dims( void ) const'
+     Returns number of dimensions for this variable.
+
+`NcDim* get_dim( int ) const'
+     Returns a pointer to the n-th dimension (starting at 0).  Returns a
+     NULL-pointer if an invalid dimension is requested.
+
+`const long* edges( void ) const'
+     Returns the shape of the variable, in the form of a vector
+     containing the sizes of the dimensions of the variable.
+
+`int num_atts( void ) const'
+     Returns the number of attributes attached to the variable.
+
+`NcAtt* get_att( NcToken ) const'
+     Returns an attribute by name of the variable.  If no such
+     attribute has been attached to the variable, zero is returned. 
+     Currently, attributes returned in this way must be deleted by the
+     caller.
+
+`NcAtt* get_att( int ) const'
+     Returns the n-th (starting at 0) attribute of the variable.  If no
+     such attribute has been attached to the variable, zero is returned.
+     Currently, attributes returned in this way must be deleted by the
+     caller.
+
+`NcBool put( const char* vals, long c0, long c1, long c2, long c3, long c4 )'
+`NcBool put( const short* vals, long c0, long c1, long c2, long c3, long c4 )'
+`NcBool put( const long* vals, long c0, long c1, long c2, long c3, long c4 )'
+`NcBool put( const int* vals, long c0, long c1, long c2, long c3, long c4 )'
+`NcBool put( const float* vals, long c0, long c1, long c2, long c3, long c4 )'
+`NcBool put( const double* vals, long c0, long c1, long c2, long c3, long c4 )'
+     Write scalar or 1 to 5-dimensional arrays by providing enough
+     arguments. Arguments are edge lengths, and their number must not
+     exceed variable's dimensionality.  Start corner is `[0,0,..., 0]'
+     by default, but may be reset using the `set_cur()' member
+     function.  `FALSE' is returned if type of values does not match
+     type for variable.  For more than 5 dimensions, use the overloaded
+     n-dimensional form of the `put' member function.
+
+`NcBool put( const char* vals, const long* counts )'
+`NcBool put( const short* vals, const long* counts )'
+`NcBool put( const long* vals, const long* counts )'
+`NcBool put( const int* vals, const long* counts )'
+`NcBool put( const float* vals, const long* counts )'
+`NcBool put( const double* vals, const long* counts )'
+     Write n-dimensional arrays, starting at `[0, 0, ..., 0]' by
+     default, may be reset with `set_cur()'.  `FALSE' is returned if
+     type of values does not match type for variable.
+
+`NcBool get( char* vals, long c0, long c1, long c2, long c3, long c4 ) const'
+`NcBool get( short* vals, long c0, long c1, long c2, long c3, long c4 ) const'
+`NcBool get( long* vals, long c0, long c1, long c2, long c3, long c4 ) const'
+`NcBool get( int* vals, long c0, long c1, long c2, long c3, long c4 ) const'
+`NcBool get( float* vals, long c0, long c1, long c2, long c3, long c4 ) const'
+`NcBool get( double* vals, long c0, long c1, long c2, long c3, long c4 ) const'
+     Get scalar or 1 to 5 dimensional arrays by providing enough
+     arguments.  Arguments are edge lengths, and their number must not
+     exceed variable's dimensionality.  Start corner is `[0,0,..., 0]'
+     by default, but may be reset using the `set_cur()' member function.
+
+`NcBool get( char* vals, const long* counts ) const'
+`NcBool get( short* vals, const long* counts ) const'
+`NcBool get( long* vals, const long* counts ) const'
+`NcBool get( int* vals, const long* counts ) const'
+`NcBool get( float* vals, const long* counts ) const'
+`NcBool get( double* vals, const long* counts ) const'
+     Get n-dimensional arrays, starting at `[0, 0, ..., 0]' by default,
+     may be reset with `set_cur()' member function.
+
+`NcBool set_cur(long c0=-1, long c1=-1, long c2=-1, long c3=-1, long c4=-1)'
+`NcBool set_cur(long* cur)'
+     Resets the starting corner to the values supplied.  The first form
+     works for a variable of dimensionality from scalar to 5
+     dimensions.  For more than five dimensions, use the second form. 
+     The method returns FALSE if any argument is greater than the size
+     of the corresponding dimension.
+
+`NcBool add_att( NcToken, char )'
+`NcBool add_att( NcToken, short )'
+`NcBool add_att( NcToken, int )'
+`NcBool add_att( NcToken, long )'
+`NcBool add_att( NcToken, float )'
+`NcBool add_att( NcToken, double )'
+`NcBool add_att( NcToken, const char* )'
+`NcBool add_att( NcToken, int, const char* )'
+`NcBool add_att( NcToken, int, const short* )'
+`NcBool add_att( NcToken, int, const int* )'
+`NcBool add_att( NcToken, int, const long* )'
+`NcBool add_att( NcToken, int, const float* )'
+`NcBool add_att( NcToken, int, const double* )'
+     Add scalar or vector attribute of any type to a variable, given the
+     name, number of values, and the vector of values.
+
+`NcBool rename( NcToken newname )'
+     Rename a variable.
+
+`int id( void ) const'
+     Return the variable number.  This is not needed in the C++
+     interface, but might be needed in calling a C-function that
+     requires that a variable be identified by number instead of name.
+
+
+File: nc.info,  Node: Class NcAtt,  Prev: Class NcVar,  Up: NetCDF Components
+
+Class NcAtt
+===========
+
+   `NcAtt' is derived from `NcTypedComponent', and represents a netCDF
+attribute.  A netCDF attribute has a name and a type, and may be either
+a scalar attribute or a vector attribute.  Scalar attributes have one
+value and vector attributes have multiple values.  In addition, each
+attribute is attached to a specific netCDF variable or is global to an
+entire netCDF file.  Because attributes are only associated with open
+netCDF files, there are no public constructors for this class.  Use
+member functions of `NcFile' and `NcVar' to get netCDF attributes. 
+Most of the useful member functions for `NcAtt' are inherited from
+class `NcTypedComponent'.
+
+Public Member Functions
+-----------------------
+
+`~NcAtt( void )'
+     Destructor.
+
+`NcBool remove( void )'
+     Deletes the attribute from the file and detaches it from the
+     variable. Does not call the destructor.  Subsequent calls to
+     `is_valid()' will return `FALSE'.
+
+
+File: nc.info,  Node: Auxiliary Classes,  Next: Function Index,  Prev: NetCDF Components,  Up: Top
+
+Auxiliary Classes
+*****************
+
+   Auxiliary classes include the abstract base class `NcValues', its
+type-specific derived subclasses, and the error-handling class
+`NcError'.
+
+* Menu:
+
+* Class NcValues::
+* Class NcError::
+
+
+File: nc.info,  Node: Class NcValues,  Next: Class NcError,  Up: Auxiliary Classes
+
+Class NcValues
+==============
+
+   Class `NcValues' is an abstract base class for a block of typed
+values.  The derived classes are `NcValues_ncbyte', `NcValues_char',
+`NcValues_short', `NcValues_long', `NcValues_int', `NcValues_float',
+`NcValues_double'. These classes are used as the return type of the
+`NcTypedComponent::values()' member function, for typed-value blocks
+values associated with variables and attributes.
+
+Public Member Functions
+-----------------------
+
+`NcValues( void )'
+     Default constructor.
+
+`NcValues(NcType, long)'
+     Constructor for a value block of the specified type and length.
+
+`~NcValues( void )'
+     Destructor.
+
+`long num( void )'
+     Returns the number of values in the value block.
+
+`ostream& print(ostream&) const'
+     Used to print the comma-delimited sequence of values of the value
+     block.
+
+`void* base( void ) const'
+     Returns a bland pointer to the beginning of the value block.
+
+`int bytes_for_one( void ) const'
+     Returns the number of bytes required for one value.
+
+`ncbyte as_ncbyte( int n ) const'
+`char as_char( int n ) const'
+`short as_short( int n ) const'
+`long as_long( int n ) const'
+`float as_float( int n ) const'
+`double as_double( int n ) const'
+`char* as_string( int n ) const'
+     Provide conversions for the nth value from the value type to a
+     desired basic type.  If the value is out of range, the default
+     "fill-value" for the appropriate type is returned.
+
+
+File: nc.info,  Node: Class NcError,  Prev: Class NcValues,  Up: Auxiliary Classes
+
+Class NcError
+=============
+
+   This class provides control for netCDF error handling.  Declaring an
+`NcError' object temporarily changes the error-handling behavior for
+all netCDF classes until the `NcError' object is destroyed (typically
+by going out of scope), at which time the previous error-handling
+behavior is restored.
+
+Public Member Functions
+-----------------------
+
+`NcError( Behavior b = verbose_fatal )'
+     The constructor saves the previous error state for restoration
+     when the destructor is invoked, and sets a new specified state. 
+     Valid error states are `NcError::silent_nonfatal',
+     `NcError::verbose_nonfatal', `NcError::silent_fatal', or
+     `NcError::verbose_fatal', to control whether error messages are
+     output from the underlying library and whether such messages are
+     fatal or nonfatal.
+
+`~NcError( void )'
+     Destructor, restores previous error state.
+
+`int get_err( void )'
+     Returns most recent error, as enumerated in `netcdf.h'.
+
+
+File: nc.info,  Node: Function Index,  Prev: Auxiliary Classes,  Up: Top
+
+Class and Member Function Index
+*******************************
+
+* Menu:
+
+* NcAtt:                                Class NcVar.
+* NcBool:                               Auxiliary Types and Constants.
+* NcDim:                                NetCDF Components.
+* NcError:                              Class NcValues.
+* NcError:                              Class NcError.
+* NcFile:                               File Classes.
+* NcNewFile:                            Class NcNewFile.
+* NcNewFile:                            Class NcFile.
+* NcOldFile:                            Class NcOldFile.
+* NcOldFile:                            Class NcNewFile.
+* NcToken:                              Auxiliary Types and Constants.
+* NcType:                               Auxiliary Types and Constants.
+* NcTypedComponent:                     Class NcDim.
+* NcValues:                             Class NcValues.
+* NcValues:                             Auxiliary Classes.
+* NcValues:                             Class NcValues.
+* NcValues_char:                        Class NcValues.
+* NcValues_double:                      Class NcValues.
+* NcValues_float:                       Class NcValues.
+* NcValues_int:                         Class NcValues.
+* NcValues_long:                        Class NcValues.
+* NcValues_ncbyte:                      Class NcValues.
+* NcValues_short:                       Class NcValues.
+* NcVar:                                Class NcTypedComponent.
+* abort:                                Class NcFile.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcVar.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcFile.
+* add_att:                              Class NcFile.
+* add_dim:                              Class NcFile.
+* add_dim:                              Class NcFile.
+* add_var:                              Class NcFile.
+* add_var:                              Class NcFile.
+* as_char:                              Class NcTypedComponent.
+* as_char:                              Class NcValues.
+* as_double:                            Class NcValues.
+* as_double:                            Class NcTypedComponent.
+* as_float:                             Class NcTypedComponent.
+* as_float:                             Class NcValues.
+* as_long:                              Class NcTypedComponent.
+* as_long:                              Class NcValues.
+* as_ncbyte:                            Class NcValues.
+* as_ncbyte:                            Class NcTypedComponent.
+* as_short:                             Class NcValues.
+* as_short:                             Class NcTypedComponent.
+* as_string:                            Class NcTypedComponent.
+* as_string:                            Class NcValues.
+* base:                                 Class NcValues.
+* bytes_for_one:                        Class NcValues.
+* close:                                Class NcFile.
+* edges:                                Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get:                                  Class NcVar.
+* get_att:                              Class NcVar.
+* get_att:                              Class NcFile.
+* get_att:                              Class NcFile.
+* get_att:                              Class NcVar.
+* get_dim:                              Class NcFile.
+* get_dim:                              Class NcFile.
+* get_dim:                              Class NcVar.
+* get_err:                              Class NcError.
+* get_fill:                             Class NcFile.
+* get_var:                              Class NcFile.
+* get_var:                              Class NcFile.
+* id:                                   Class NcDim.
+* id:                                   Class NcVar.
+* is_unlimited:                         Class NcDim.
+* is_valid:                             Class NcDim.
+* is_valid:                             Class NcFile.
+* is_valid:                             Class NcTypedComponent.
+* name:                                 Class NcDim.
+* name:                                 Class NcTypedComponent.
+* ncbyte:                               Auxiliary Types and Constants.
+* num:                                  Class NcValues.
+* num_atts:                             Class NcVar.
+* num_atts:                             Class NcFile.
+* num_dims:                             Class NcVar.
+* num_dims:                             Class NcFile.
+* num_vals:                             Class NcTypedComponent.
+* num_vars:                             Class NcFile.
+* print:                                Class NcValues.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* put:                                  Class NcVar.
+* rec_dim:                              Class NcFile.
+* remove:                               Class NcAtt.
+* rename:                               Class NcVar.
+* rename:                               Class NcDim.
+* rename:                               Class NcTypedComponent.
+* set_cur:                              Class NcVar.
+* set_cur:                              Class NcVar.
+* set_fill:                             Class NcFile.
+* size:                                 Class NcDim.
+* sync:                                 Class NcFile.
+* type:                                 Class NcTypedComponent.
+* values:                               Class NcTypedComponent.
+* ~NcAtt:                               Class NcAtt.
+* ~NcError:                             Class NcError.
+* ~NcFile:                              Class NcFile.
+* ~NcNewFile:                           Class NcNewFile.
+* ~NcNewFile:                           Class NcOldFile.
+* ~NcValues:                            Class NcValues.
+* ~NcVar:                               Class NcVar.
+
+
+
+Tag Table:
+Node: Top396
+Node: Introduction1084
+Node: Class Hierarchy3332
+Node: Auxiliary Types and Constants4283
+Node: File Classes5448
+Node: Class NcFile5849
+Node: Class NcNewFile11249
+Node: Class NcOldFile12381
+Node: NetCDF Components13494
+Node: Class NcDim14206
+Node: Class NcTypedComponent15291
+Node: Class NcVar17367
+Node: Class NcAtt22966
+Node: Auxiliary Classes24005
+Node: Class NcValues24335
+Node: Class NcError25867
+Node: Function Index26943
+
+End Tag Table

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/nc.txn
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/nc.txn	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/nc.txn	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,934 @@
+\input ../doc/texinfo   @c -*-texinfo-*-
+
+ at c %**start of header
+ at setfilename nc.info
+ at settitle NetCDF Prototype C++ Interface
+ at setchapternewpage odd
+ at c %**end of header
+
+ at ifinfo
+This file documents the prototype experimental Unidata C++ netCDF
+interface.
+
+Copyright (C) 1993 University Corporation for Atmospheric Research.
+Permission is granted to make and distribute verbatim copies of
+this file provided the copyright notice and this permission notice
+are preserved on all copies.
+ at end ifinfo
+
+ at titlepage
+ at title NetCDF C++ Interface
+ at subtitle Class Documentation
+ at subtitle Prototype Release (Version 0), March 1993
+ at author Russ Rew and Mitch Baltuch
+ at author Unidata Program Center
+ at page
+ at vskip 0pt plus 1filll
+Copyright @copyright{} 1993 University Corporation for Atmospheric Research
+
+Permission is granted to make and distribute verbatim copies of this
+manual provided that the copyright notice and these paragraphs are
+preserved on all copies.  The software and any accompanying written 
+materials are provided ``as is'' without warranty of any kind.  UCAR 
+expressly disclaims all warranties of any kind, either expressed or 
+implied, including but not limited to the implied warranties of 
+merchantability and fitness for a particular purpose.  
+
+The Unidata Program Center is managed by the University 
+Corporation for Atmospheric Research and sponsored by the National 
+Science Foundation.  Any opinions, findings, conclusions, or 
+recommendations expressed in this publication are those of the 
+author(s) and do not necessarily reflect the views of the National 
+Science Foundation.
+
+Mention of any commercial company or product in this document 
+does not constitute an endorsement by the Unidata Program Center.  
+Unidata does not authorize any use of information from this 
+publication for advertising or publicity purposes.
+ at end titlepage
+
+ at node Top, Introduction, (dir), (dir)
+ at ifinfo
+ at top NetCDF C++ Interface
+This manual is preliminary documentation for the prototype, experimental C++
+interface for netCDF (version 0).
+
+ at menu
+* Introduction::                
+* File Classes::                
+* NetCDF Components::           
+* Auxiliary Classes::           
+* Function Index::              
+
+ --- The Detailed Node Listing ---
+
+Introduction
+
+* Class Hierarchy::             
+* Auxiliary Types and Constants::  
+
+File Classes
+
+* Class NcFile::                
+* Class NcNewFile::             
+* Class NcOldFile::             
+
+Dimensions, Variables, and Attributes
+
+* Class NcDim::                 
+* Class NcTypedComponent::      
+* Class NcVar::                 
+* Class NcAtt::                 
+
+Auxiliary Classes
+
+* Class NcValues::              
+* Class NcError::               
+ at end menu
+ at end ifinfo
+
+ at c Combine the variable and function indices.
+ at synindex vr fn
+
+ at iftex
+ at finalout
+ at end iftex
+
+ at node Introduction, File Classes, Top, Top
+ at unnumbered Introduction
+
+This is an early release for a prototype implementation of a C++ interface
+for the netCDF data access library.
+
+The main requirements for the design of the C++ interface are:
+
+ at itemize @bullet
+ at item
+to provide the functionality of the C interface;
+ at item
+to keep the C++ interface state consistent with the C interface state;
+ at item
+to provide type safety by eliminating all use of @code{void*} pointers; and
+ at item
+to provide an interface that is simpler to use than the C interface.
+ at end itemize
+
+Some of the features of the C++ interface are:
+
+ at itemize @bullet
+ at item
+No IDs needed for netCDF's variables, dimensions, or attributes.
+ at item
+No explicit open or close calls needed for netCDF files; a constructor
+opens and a destructor closes a file.
+ at item
+No need to specify types for creating attributes; they will have the
+type of the value provided.
+ at item
+No use of @code{void*}: values are type-checked.
+ at item
+Less indirection is needed for dimensions & dimension sizes than with
+the C interface.  Dimensions can be given as arguments in variable
+definitions.
+ at item
+Code for data types is isolated, which should make the addition of new
+types easier.
+ at item
+No explicit @code{ncredef} or @code{ncendef} calls are needed for
+switching between define and data modes.  Whenever a mode switch is
+required, it happens implicitly.  Note: this may change; there appear to
+be advantages to not allowing @code{ncredef} functionality in the C++
+interface, but supporting copy semantics and a @code{schema} object
+instead.
+ at end itemize
+
+The header file @file{netcdf.hh} must be included in source code files
+using this interface.
+
+This early release provides the functionality of netCDF version 2.02,
+but does not yet include member functions corresponding to the netCDF
+2.3 generalized hyperslab access interfaces (@code{ncvarputg},
+ at code{ncvargetg}) or the record I/O interfaces (@code{ncrecinq},
+ at code{ncrecput}, @code{ncrecget}) in netCDF version 2.3.
+
+This manual assumes familiarity with Chapters 1 through 4 of the netCDF
+User's Guide, where the concepts of netCDF dimensions, variables, and
+attributes are discussed.
+
+ at menu
+* Class Hierarchy::             
+* Auxiliary Types and Constants::  
+ at end menu
+
+ at page
+ at node Class Hierarchy, Auxiliary Types and Constants,  , Introduction
+ at unnumberedsec Class Hierarchy
+
+ at display
+ at group
+ at code{NcFile}                   abstract base class for files
+        @code{NcNewFile}        new netCDF files
+        @code{NcOldFile}        existing netCDF files
+
+ at code{NcDim}                    dimension
+
+ at code{NcTypedComponent}         abstract base class
+        @code{NcVar}            variable
+        @code{NcAtt}            attribute
+
+ at code{NcValues}                 abstract base class for arrays
+        @code{NcValues_ncbyte}  array of bytes
+        @code{NcValues_char}    array of characters
+        @code{NcValues_short}   array of shorts
+        @code{NcValues_int}     array of ints
+        @code{NcValues_long}    array of longs
+        @code{NcValues_float}   array of floats
+        @code{NcValues_double}  array of doubles
+
+ at code{NcError}                    for error handling
+ at end group
+ at end display
+
+ at page
+ at node Auxiliary Types and Constants,  , Class Hierarchy, Introduction
+ at unnumberedsec Auxiliary Types and Constants
+
+The netCDF classes use several auxiliary types for arguments and return
+types from member functions: @code{NcToken}, @code{NcType}, @code{ncbyte},
+and @code{NcBool}.
+
+ at table @code
+ at vindex NcToken
+ at item NcToken
+Used for names for netCDF objects, in particular variable names, dimension
+names, and attribute names.  Currently this is just a typedef for
+ at code{const char*}.
+ at vindex NcType
+ at item NcType
+Used for specifying netCDF value types.  Currently this is an enumerated
+type with the following legitimate values:  @code{ncByte},
+ at code{ncChar}, @code{ncShort}, @code{ncLong}, @code{ncFloat},
+ at code{ncDouble}, and @code{ncInt}.  The latter is a synonym for @code{ncLong}.
+ at vindex ncbyte
+ at item ncbyte
+Used to declare values of type @code{ncByte}, analogously to using
+the built-in type @code{float} to declare values of type @code{ncFloat}.
+This is currently just a typedef for @code{unsigned char}.
+ at vindex NcBool
+ at item NcBool
+Used for the return type of some member functions.  If the member
+function fails, 0 is returned, otherwise some non-zero value.  Currently
+this is just a typedef for @code{unsigned int}.
+ at end table
+
+ at page
+ at node File Classes, NetCDF Components, Introduction, Top
+ at unnumbered     File Classes
+
+There are three netCDF file classes: @code{NcFile}, @code{NcOldFile},
+and @code{NcNewFile}.  The latter two are derived from the
+ at code{NcFile} abstract base class, which defines all the member
+functions except the constructors.
+
+ at menu
+* Class NcFile::                
+* Class NcNewFile::             
+* Class NcOldFile::             
+ at end menu
+
+ at vindex NcFile
+ at node Class NcFile, Class NcNewFile,  , File Classes
+ at unnumberedsec	Class NcFile
+
+ at code{NcFile} is the abstract base class for netCDF file objects.  It
+provides all common methods for file operations.  There are no
+constructors for @code{NcFile}.  @code{NcOldFile} or @code{NcNewFile}
+classes must be used to create @code{NcFile} objects.
+
+Some member functions return pointers to dimensions (@code{NcDim}) or
+variables (@code{NcVar}).  These objects are owned by the @code{NcFile}
+they are associated with, and will be deleted automatically by the
+ at code{NcFile} destructor (or by the @code{close} member function, if
+this is called earlier than the destructor), so users should not delete
+these.  Member functions that return pointers to attributes
+(@code{NcAtt}) currently pass ownership to the calling function; users
+should delete attributes when they are finished with them.  Note: it
+appears that it will be desirable to change the ownership of
+ at code{NcAtt} objects in the future so that they are owned by their
+variables, at which time their destructor will be called when the
+associated variable destructor is invoked.
+
+All member functions that return a value of type @code{NcBool} return
+ at code{TRUE} on success and @code{FALSE} on failure.  All member
+functions that return a pointer value return the @code{NULL} pointer on
+failure.
+
+This class interface hides the distinction in the C and Fortran
+interfaces between @dfn{define mode} (when dimensions, variables, or
+attributes are being defined or renamed), and @dfn{data mode} (when data
+values are being accessed), by automatically switching between the modes
+when necessary.  Users should be aware that switching from accessing
+data to adding or renaming dimensions, variables and attributes can be
+expensive, since it may entail a copy of the data.
+
+ at unnumberedsubsec Public Member Functions
+
+ at table @code
+ at findex ~NcFile
+ at item ~NcFile( void )
+Destructor.  The file is closed and all resources associated with it are
+released, including the associated @code{NcVar} and @code{NcDim}
+objects.  If you wish to close the file earlier, you may explicitly call
+the @code{close} member function; a subsequent destructor call will work
+properly.
+
+ at findex close
+ at item NcBool close( void )
+Close netCDF file.
+
+ at findex is_valid
+ at item NcBool is_valid( void ) const
+Returns @code{TRUE} if valid netCDF file, @code{FALSE} otherwise (e.g.
+if constructor could not open file).
+
+ at findex num_dims
+ at item int num_dims( void ) const
+Returns the number of dimensions in the netCDF file.
+
+ at findex num_vars
+ at item int num_vars( void ) const
+Returns the number of variables in the netCDF file.
+
+ at findex num_atts
+ at item int num_atts( void ) const
+Returns the number of global attributes in the netCDF file.
+
+ at findex get_dim
+ at item NcDim* get_dim(NcToken name) const
+Get a dimension by name.
+
+ at findex get_var
+ at item NcVar* get_var(NcToken name) const
+Get a variable by name.
+
+ at findex get_att
+ at item NcAtt* get_att(NcToken name) const
+Get a global attribute by name.
+
+ at findex get_dim
+ at item NcDim* get_dim(int i) const
+Get the ith dimension (beginning with the 0th).
+
+ at findex get_var
+ at item NcVar* get_var(int i) const
+Get the ith variable (beginning with the 0th).
+
+ at findex get_att
+ at item NcAtt* get_att(int i) const
+Get the ith global attribute (beginning with the 0th).
+
+ at findex rec_dim
+ at item NcDim* rec_dim( void ) const
+Get the unlimited dimension, if any.
+
+ at findex add_dim
+ at item NcDim* add_dim(NcToken dimname)
+Add an unlimited dimension named @code{dimname} to the netCDF file.
+
+ at findex add_dim
+ at item NcDim* add_dim(NcToken dimname, long dimsize)
+Add a dimension named @code{dimname} of size @code{dimsize}.
+
+ at findex add_var
+ at item NcVar* add_var(NcToken varname, NcType type, const NcDim* dim0, @dots{} , const NcDim* dim4=0)
+Add a variable named @code{varname} of between 1 and 5 dimensions of the
+specified type.  Dimension arguments default to 0.  Supply as many
+dimensions as needed.  If more than 5 dimensions are required, use the
+n-dimensional version of this member function. 
+
+ at findex add_var
+ at item NcVar* add_var(NcToken varname, NcType type, int ndims, const NcDim* dims)
+Add a variable named @code{varname} of @code{ndims} dimensions and of
+the specified type.  Use this method when dealing with variables of more
+than 5 dimensions.
+
+ at findex add_att
+ at item NcBool add_att(NcToken name, char val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, short val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, int val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, long val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, float val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, double val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, const char* val)
+Add global scalar attributes of the specified name and with the
+supplied value.
+
+ at findex add_att
+ at item  NcBool add_att(NcToken name, int n, const char* val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, int n, const short* val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, int n, const int* val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, int n, const long* val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, int n, const float* val)
+ at findex add_att
+ at itemx NcBool add_att(NcToken name, int n, const double* val)
+Add global vector attributes with the specified name and vector value.
+
+ at findex set_fill
+ at item NcBool set_fill( FillMode mode = Fill)
+Sets fill-mode to either @code{NcFile::Fill} or @code{NcFile::NoFill}.
+Default is @code{Fill}, in which case unwritten values are prewritten
+with appropriate type-specific or variable-specific fill values.
+
+ at findex get_fill
+ at item enum NcFile::FillMode get_fill( void ) const
+Returns fill mode of the file.
+
+ at findex sync
+ at item NcBool sync( void )
+Synchronizes file to disk.
+
+ at findex abort
+ at item NcBool abort( void )
+Either just closes file (if recently it has been in data mode as the
+result of accessing data), or backs out of the most recent sequence of
+changes to the file schema (dimensions, variables, and attributes).
+ at end table
+
+ at page
+ at vindex NcNewFile
+ at node Class NcNewFile, Class NcOldFile, Class NcFile, File Classes
+ at unnumberedsec	Class NcNewFile
+
+This class is derived from the abstract base class @code{NcFile}, and it
+is used to create new netCDF files.
+
+ at unnumberedsubsec Public Member Functions
+
+ at table @code
+ at findex NcNewFile
+ at item NcNewFile( const char * path, CreateMode = NoClobber )
+The constructor creates a new netCDF file.  If called with a single path
+name argument or @code{NcNewFile::NoClobber} for its second argument, it
+creates the file only if it does not already exist.  The constructor
+will not fail in case of a bad path name or if the file already exists,
+but no netCDF file will be created, and the fact that the creation
+failed may be checked with the @code{is_valid()} member function.
+
+If called with @code{NcNewFile::Clobber} for its second argument, a
+new netCDF file will be created even if the file already exists,
+clobbering the old netCDF file.
+
+ at findex ~NcNewFile
+ at item ~NcNewFile( void )
+The destructor will close the file, if it has not already been closed
+with an explicit call to the @code{close()} member function.
+
+ at end table
+
+ at page
+ at vindex NcOldFile
+ at node Class NcOldFile,  , Class NcNewFile, File Classes
+ at unnumberedsec	Class NcOldFile
+
+This class is derived from the abstract base class @code{NcFile}, and it
+is used to open existing netCDF files, either for read-only access (the
+default), or for read-write access.
+
+ at unnumberedsubsec Public Member Functions
+
+ at table @code
+ at findex NcOldFile
+ at item NcOldFile( const char * path, OpenMode = ReadOnly )
+The constructor opens an existing netCDF file.  The constructor
+will not fail in case of a bad path name or the proper permissions on
+the file but no netCDF file will be opened, and the fact that the open
+failed may be checked with the @code{is_valid()} member function.
+
+If called with a single path name argument or @code{NcOldFile::ReadOnly}
+for its second argument, the file is opened for read-only access.  If
+called with @code{NcOldFile::Write} for its second argument, the file
+will be opened with read-write access.
+
+ at findex ~NcNewFile
+ at item ~NcNewFile( void )
+The destructor will close the file, if it has not already been closed
+with an explicit call to the @code{close()} member function.
+ at end table
+
+ at page
+ at node NetCDF Components, Auxiliary Classes, File Classes, Top
+ at unnumbered     Dimensions, Variables, and Attributes
+
+The components of a netCDF file are dimensions, variables, and
+attributes.  There is a class for each of these kinds of objects;
+ at code{NcDim}, @code{NcVar}, and @code{NcAtt}.  Variables and attributes
+share some common characteristics that are factored out in the
+abstract base class @code{NcTypedComponent}.  Users will never declare
+ at code{NcTypedComponent} instances, but must know about the public member
+functions of this class for use with variables and attributes.
+
+ at menu
+* Class NcDim::                 
+* Class NcTypedComponent::      
+* Class NcVar::                 
+* Class NcAtt::                 
+ at end menu
+
+ at page
+ at vindex NcDim
+ at node Class NcDim, Class NcTypedComponent,  , NetCDF Components
+ at unnumberedsec	Class NcDim
+
+A netCDF dimension has a name and a size.  These are only created and
+destroyed by NcFile member functions, because they cannot exist
+independently of an open netCDF file.  Hence there are no public
+constructors or destructors.
+
+ at unnumberedsubsec Public Member Functions
+
+ at table @code
+ at findex name
+ at item NcToken name( void ) const
+
+Returns the name of the dimension if it exists, 0 otherwise.
+
+ at findex size
+ at item long size( void ) const
+
+Returns the dimension size.
+
+ at findex is_valid
+ at item NcBool is_valid( void ) const
+
+Returns @code{TRUE} if file and dimension are both valid, @code{FALSE}
+otherwise.
+
+ at findex is_unlimited
+ at item NcBool is_unlimited( void ) const
+
+Returns @code{TRUE} if the dimension is the unlimited dimension,
+ at code{FALSE} if either not a valid netCDF file, or if the dimension is
+not the unlimited dimension.
+
+ at findex rename
+ at item NcBool rename( NcToken newname )
+
+Renames the dimension to @code{newname}.
+
+ at findex id
+ at item int id( void ) const
+
+Returns the id number of the dimension.  This should almost never be
+needed in the C++ interface.
+
+ at end table
+
+ at page
+ at vindex NcTypedComponent
+ at node Class NcTypedComponent, Class NcVar, Class NcDim, NetCDF Components
+ at unnumberedsec	Class NcTypedComponent
+
+ at code{NcTypedComponent} is an abstract base class for @code{NcVar} and
+ at code{NcAtt} that captures the similarities between netCDF variables and
+attributes.
+
+ at unnumberedsubsec Public Member Functions
+
+ at table @code
+ at findex name
+ at item NcToken name( void ) const
+
+Returns the name of the variable or attribute.
+
+ at findex type
+ at item NcType type( void ) const
+
+Returns the type of the variable or attribute.  The type will be one of
+ at code{ncByte}, @code{ncChar}, @code{ncShort}, @code{ncLong},
+ at code{ncFloat}, or @code{ncDouble}.
+
+ at findex is_valid
+ at item NcBool is_valid( void ) const
+
+Returns @code{TRUE} if the component is valid, @code{FALSE} otherwise.
+
+ at findex num_vals
+ at item long num_vals( void ) const
+
+Returns the number of values for an attribute or variable.  For an
+attribute, this is just 1 for a scalar attribute, the number of values
+for a vector-valued attribute, and the number of characters for a
+string-valued attribute.  For a variable, this is the product of the
+dimension sizes for all the variable's dimensions.
+
+ at findex rename
+ at item NcBool rename( NcToken newname )
+
+Renames the variable or attribute.
+
+ at findex values
+ at item NcValues* values( void )
+
+Returns a pointer to the block of all values for the variable or
+attribute.  This will be deleted when the variable or attribute is
+destroyed.  Note that this is not a good way to read selected values of
+a variable; use the @code{get} member function instead, to get single
+values or selected cross-sections of values.
+
+ at findex as_ncbyte
+ at item ncbyte as_ncbyte( int n ) const
+ at findex as_char
+ at itemx char as_char( int n ) const
+ at findex as_short
+ at itemx short as_short( int n ) const
+ at findex as_long
+ at itemx long as_long( int n ) const
+ at findex as_float
+ at itemx float as_float( int n ) const
+ at findex as_double
+ at itemx double as_double( int n ) const
+ at findex as_string
+ at itemx char* as_string( int n ) const
+
+Get the n-th value of the attribute or variable.  These member functions
+provide conversions from the value type of the variable or attribute to
+the specified type.  If the value is out-of-range, the default
+fill-value of the appropriate type should be returned (not yet
+implemented).
+ at end table
+
+
+ at page
+ at vindex NcVar
+ at node Class NcVar, Class NcAtt, Class NcTypedComponent, NetCDF Components
+ at unnumberedsec	Class NcVar
+
+ at code{NcVar} is derived from NcTypedComponent, and represents a netCDF
+variable.  A netCDF variable has a name, a type, a shape, zero or more
+attributes, and a block of values associated with it.  Because variables
+are only associated with open netCDF files, there are no public
+constructors for this class.  Use member functions of @code{NcFile} to
+get netCDF variables.
+
+ at unnumberedsubsec Public Member Functions
+
+ at table @code
+ at findex ~NcVar
+ at item ~NcVar( void )
+Destructor.
+
+ at findex num_dims
+ at item int num_dims( void ) const
+Returns number of dimensions for this variable.
+
+ at findex get_dim
+ at item NcDim* get_dim( int ) const
+Returns a pointer to the n-th dimension (starting at 0).  Returns a
+NULL-pointer if an invalid dimension is requested.
+
+ at findex edges
+ at item const long* edges( void ) const
+Returns the shape of the variable, in the form of a vector containing
+the sizes of the dimensions of the variable.
+
+ at findex num_atts
+ at item int num_atts( void ) const
+Returns the number of attributes attached to the variable.
+
+ at findex get_att
+ at item NcAtt* get_att( NcToken ) const
+Returns an attribute by name of the variable.  If no such attribute has
+been attached to the variable, zero is returned.  Currently, attributes
+returned in this way must be deleted by the caller.
+
+ at findex get_att
+ at item NcAtt* get_att( int ) const
+Returns the n-th (starting at 0) attribute of the variable.  If no such
+attribute has been attached to the variable, zero is returned.
+Currently, attributes returned in this way must be deleted by the
+caller.
+
+ at findex put
+ at item NcBool put( const char* vals, long c0, long c1, long c2, long c3, long c4 )
+ at findex put
+ at itemx NcBool put( const short* vals, long c0, long c1, long c2, long c3, long c4 )
+ at findex put
+ at itemx NcBool put( const long* vals, long c0, long c1, long c2, long c3, long c4 )
+ at findex put
+ at itemx NcBool put( const int* vals, long c0, long c1, long c2, long c3, long c4 )
+ at findex put
+ at itemx NcBool put( const float* vals, long c0, long c1, long c2, long c3, long c4 )
+ at findex put
+ at itemx NcBool put( const double* vals, long c0, long c1, long c2, long c3, long c4 )
+Write scalar or 1 to 5-dimensional arrays by providing enough arguments.
+Arguments are edge lengths, and their number must not exceed variable's
+dimensionality.  Start corner is @code{[0,0,..., 0]} by default, but may
+be reset using the @code{set_cur()} member function.  @code{FALSE} is
+returned if type of values does not match type for variable.  For more
+than 5 dimensions, use the overloaded n-dimensional form of the
+ at code{put} member function.
+
+ at findex put
+ at item  NcBool put( const char* vals, const long* counts )
+ at findex put
+ at itemx NcBool put( const short* vals, const long* counts )
+ at findex put
+ at itemx NcBool put( const long* vals, const long* counts )
+ at findex put
+ at itemx NcBool put( const int* vals, const long* counts )
+ at findex put
+ at itemx NcBool put( const float* vals, const long* counts )
+ at findex put
+ at itemx NcBool put( const double* vals, const long* counts )
+Write n-dimensional arrays, starting at @code{[0, 0, ..., 0]} by
+default, may be reset with @code{set_cur()}.  @code{FALSE} is returned
+if type of values does not match type for variable.
+
+ at findex get
+ at item  NcBool get( char* vals, long c0, long c1, long c2, long c3, long c4 ) const
+ at findex get
+ at itemx NcBool get( short* vals, long c0, long c1, long c2, long c3, long c4 ) const
+ at findex get
+ at itemx NcBool get( long* vals, long c0, long c1, long c2, long c3, long c4 ) const
+ at findex get
+ at itemx NcBool get( int* vals, long c0, long c1, long c2, long c3, long c4 ) const
+ at findex get
+ at itemx NcBool get( float* vals, long c0, long c1, long c2, long c3, long c4 ) const
+ at findex get
+ at itemx NcBool get( double* vals, long c0, long c1, long c2, long c3, long c4 ) const
+Get scalar or 1 to 5 dimensional arrays by providing enough
+arguments.  Arguments are edge lengths, and their number must not
+exceed variable's dimensionality.  Start corner is @code{[0,0,..., 0]} by
+default, but may be reset using the @code{set_cur()} member function.
+
+ at findex get
+ at item  NcBool get( char* vals, const long* counts ) const
+ at findex get
+ at itemx NcBool get( short* vals, const long* counts ) const
+ at findex get
+ at itemx NcBool get( long* vals, const long* counts ) const
+ at findex get
+ at itemx NcBool get( int* vals, const long* counts ) const
+ at findex get
+ at itemx NcBool get( float* vals, const long* counts ) const
+ at findex get
+ at itemx NcBool get( double* vals, const long* counts ) const
+Get n-dimensional arrays, starting at @code{[0, 0, ..., 0]} by default,
+may be reset with @code{set_cur()} member function.
+
+ at findex set_cur
+ at item NcBool set_cur(long c0=-1, long c1=-1, long c2=-1, long c3=-1, long c4=-1)
+
+ at findex set_cur
+ at item NcBool set_cur(long* cur)
+Resets the starting corner to the values supplied.  The first form works
+for a variable of dimensionality from scalar to 5 dimensions.  For more
+than five dimensions, use the second form.  The method returns FALSE if
+any argument is greater than the size of the corresponding dimension.
+
+ at findex add_att
+ at item  NcBool add_att( NcToken, char )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, short )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, int )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, long )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, float )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, double )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, const char* )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, int, const char* )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, int, const short* )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, int, const int* )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, int, const long* )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, int, const float* )
+ at findex add_att
+ at itemx NcBool add_att( NcToken, int, const double* )
+Add scalar or vector attribute of any type to a variable, given the
+name, number of values, and the vector of values.
+
+ at findex rename
+ at item NcBool rename( NcToken newname )
+Rename a variable.
+
+ at findex id
+ at item int id( void ) const
+Return the variable number.  This is not needed in the C++ interface,
+but might be needed in calling a C-function that requires that a variable
+be identified by number instead of name.
+ at end table
+
+ at page
+ at vindex NcAtt
+ at node Class NcAtt,  , Class NcVar, NetCDF Components
+ at unnumberedsec	Class NcAtt
+
+ at code{NcAtt} is derived from @code{NcTypedComponent}, and represents a netCDF
+attribute.  A netCDF attribute has a name and a type, and may be either
+a scalar attribute or a vector attribute.  Scalar attributes have one
+value and vector attributes have multiple values.  In addition, each
+attribute is attached to a specific netCDF variable or is global to an
+entire netCDF file.  Because attributes are only associated with open
+netCDF files, there are no public constructors for this class.  Use
+member functions of @code{NcFile} and @code{NcVar} to get netCDF
+attributes.  Most of the useful member functions for @code{NcAtt} are
+inherited from class @code{NcTypedComponent}.
+
+ at unnumberedsubsec Public Member Functions
+
+ at table @code
+ at findex ~NcAtt
+ at item ~NcAtt( void )
+Destructor.
+
+ at findex remove
+ at item NcBool remove( void )
+Deletes the attribute from the file and detaches it from the variable.
+Does not call the destructor.  Subsequent calls to @code{is_valid()} will
+return @code{FALSE}.
+ at end table
+
+ at page
+ at node Auxiliary Classes, Function Index, NetCDF Components, Top
+ at unnumbered  Auxiliary Classes
+
+Auxiliary classes include the abstract base class @code{NcValues}, its
+type-specific derived subclasses, and the error-handling class
+ at code{NcError}.
+
+ at menu
+* Class NcValues::              
+* Class NcError::               
+ at end menu
+
+ at page
+ at vindex NcValues
+ at node Class NcValues, Class NcError,  , Auxiliary Classes
+ at unnumberedsec	Class NcValues
+
+ at vindex NcValues_ncbyte
+ at vindex NcValues_char
+ at vindex NcValues_short
+ at vindex NcValues_long
+ at vindex NcValues_int
+ at vindex NcValues_float
+ at vindex NcValues_double
+Class @code{NcValues} is an abstract base class for a block of typed
+values.  The derived classes are @code{NcValues_ncbyte},
+ at code{NcValues_char}, @code{NcValues_short}, @code{NcValues_long},
+ at code{NcValues_int}, @code{NcValues_float}, @code{NcValues_double}.
+These classes are used as the return type of the
+ at code{NcTypedComponent::values()} member function, for typed-value
+blocks values associated with variables and attributes.
+
+ at unnumberedsubsec Public Member Functions
+
+ at table @code
+ at findex NcValues
+ at item NcValues( void )
+Default constructor.
+
+ at findex NcValues
+ at item NcValues(NcType, long)
+Constructor for a value block of the specified type and length.
+
+ at findex ~NcValues
+ at item ~NcValues( void )
+Destructor.
+
+ at findex num
+ at item long num( void )
+Returns the number of values in the value block.
+
+ at findex print
+ at item ostream& print(ostream&) const
+Used to print the comma-delimited sequence of values of the value block.
+
+ at findex base
+ at item void* base( void ) const
+Returns a bland pointer to the beginning of the value block.
+
+ at findex bytes_for_one
+ at item int bytes_for_one( void ) const
+Returns the number of bytes required for one value.
+
+ at findex as_ncbyte
+ at item ncbyte as_ncbyte( int n ) const
+ at findex as_char
+ at itemx char as_char( int n ) const
+ at findex as_short
+ at itemx short as_short( int n ) const
+ at findex as_long
+ at itemx long as_long( int n ) const
+ at findex as_float
+ at itemx float as_float( int n ) const
+ at findex as_double
+ at itemx double as_double( int n ) const
+ at findex as_string
+ at itemx char* as_string( int n ) const
+Provide conversions for the nth value from the value type to a desired
+basic type.  If the value is out of range, the default "fill-value" for
+the appropriate type is returned.
+ at end table
+
+ at page
+ at vindex NcError
+ at node Class NcError,  , Class NcValues, Auxiliary Classes
+ at unnumberedsec	Class NcError
+
+This class provides control for netCDF error handling.  Declaring an
+ at code{NcError} object temporarily changes the error-handling behavior
+for all netCDF classes until the @code{NcError} object is destroyed
+(typically by going out of scope), at which time the previous
+error-handling behavior is restored.
+
+ at unnumberedsubsec Public Member Functions
+
+ at table @code
+ at findex NcError
+ at item NcError( Behavior b = verbose_fatal )
+The constructor saves the previous error state for restoration when the
+destructor is invoked, and sets a new specified state.  Valid error
+states are @code{NcError::silent_nonfatal},
+ at code{NcError::verbose_nonfatal}, @code{NcError::silent_fatal}, or
+ at code{NcError::verbose_fatal}, to control whether error messages are
+output from the underlying library and whether such messages are fatal
+or nonfatal.
+
+ at findex ~NcError
+ at item ~NcError( void )
+Destructor, restores previous error state.
+
+ at findex get_err
+ at item int get_err( void )
+Returns most recent error, as enumerated in @file{netcdf.h}.
+ at end table
+
+ at page
+ at node Function Index,  , Auxiliary Classes, Top
+ at unnumbered Class and Member Function Index
+
+ at printindex fn
+
+ at contents
+
+ at c That's all
+ at bye

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/nctst.cc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/nctst.cc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/nctst.cc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,228 @@
+#include <iostream.h>
+#include <string.h>
+#include "netcdf.hh"
+
+void gen(const char *path)		// Generate a netCDF file
+{
+    NcNewFile nc (path, NcNewFile::Clobber); // Create, leave in define mode
+
+    // Check if the file was opened successfully
+    if (! nc.is_valid()) {
+	cerr << "can't create netCDF file " << path << "\n";
+	return;
+    }
+
+    // Create dimensions
+    const int NLATS = 4;
+    const int NLONS = 3;
+    const int NFRTIMES = 2;
+    const int TIMELEN = 20;
+    NcDim* latd = nc.add_dim("lat", NLATS);
+    NcDim* lond = nc.add_dim("lon", NLONS);
+    NcDim* frtimed = nc.add_dim("frtime"); // unlimited dimension
+    NcDim* timelend = nc.add_dim("timelen", TIMELEN); 
+
+    // Create variables and their attributes
+    NcVar* P = nc.add_var("P", ncFloat, frtimed, latd, lond);
+    P->add_att("long_name", "pressure at maximum wind");
+    P->add_att("units", "hectopascals");
+    static float range[] = {0., 1500.};
+    P->add_att("valid_range", 2, range);
+    P->add_att("_FillValue", -9999.0f);
+
+    NcVar* lat = nc.add_var("lat", ncFloat, latd);
+    lat->add_att("long_name", "latitude");
+    lat->add_att("units", "degrees_north");
+
+    NcVar* lon = nc.add_var("lon", ncFloat, lond);
+    lon->add_att("long_name", "longitude");
+    lon->add_att("units", "degrees_east");
+
+    NcVar* frtime = nc.add_var("frtime", ncLong, frtimed);
+    frtime->add_att("long_name", "forecast time");
+    frtime->add_att("units", "hours");
+
+    NcVar* reftime = nc.add_var("reftime",ncChar,timelend);
+    reftime->add_att("long_name", "reference time");
+    reftime->add_att("units", "text_time");
+
+    NcVar* scalar = nc.add_var("scalarv", ncLong);
+    scalar->add_att("scalar_att", 1);
+
+    // Global attributes
+    nc.add_att("history", "created by Unidata LDM from NPS broadcast");
+    nc.add_att("title", "NMC Global Product Set: Pressure at Maximum Wind");
+
+    // Start writing data, implictly leaves define mode
+
+    float lats[NLATS] = {-90, -87.5, -85, -82.5};
+    lat->put(lats, NLATS);
+
+    float lons[NLONS] = {-180, -175, -170};
+    lon->put(lons, NLONS);
+
+    static long frtimes[NFRTIMES] = {12, 18};
+    frtime->put(frtimes, NFRTIMES);
+
+    static char* s = "1992-3-21 12:00" ;
+    reftime->put(s, strlen(s));
+
+    static float P_data[] = {
+	950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961,
+	962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973
+      };
+    // We could write all P data at once with P->put(P_data, P->edges()),
+    // but instead we write one record at a time, to show use of setcur().
+    long rec = 0;                                      // start at zero-th
+    const long nrecs = 1;		               // # records to write
+    P->put(&P_data[0], nrecs, NLATS, NLONS);           // write zero-th record
+    P->set_cur(++rec);		                       // set to next record
+    P->put(&P_data[NLATS*NLONS], nrecs, NLATS, NLONS); // write next record
+
+    // close of nc takes place in destructor
+}
+
+
+/*
+ * Convert pathname of netcdf file into name for CDL, by taking last component
+ * of path and stripping off any extension.  The returned string is in static
+ * storage, so copy it if you need to keep it.
+ */
+static char *
+cdl_name(const char *path)
+{
+    static char np[MAX_NC_NAME];
+    char *cp = strrchr(path, '/'); // assumes Unix pathnames
+    if (cp)
+      strncpy(&np[0], ++cp, MAX_NC_NAME);
+    else
+      strncpy(&np[0], path, MAX_NC_NAME);
+
+    if (cp = strrchr(np, '.'))
+      *cp = '\0';
+    return np;
+}
+
+// A derived class, just like NcOldFile except knows how to "dump" its
+// dimensions, variables, global attributes, and data in ASCII form.
+class DumpableNcFile : public NcOldFile
+{
+  public:
+    DumpableNcFile(const char* path) : NcOldFile(path) {} ;
+    void dumpdims( void );
+    void dumpvars( void );
+    void dumpgatts( void );
+    void dumpdata( void );
+};
+
+void DumpableNcFile::dumpdims( void )
+{
+
+    for (int n=0; n < num_dims(); n++) {
+	NcDim* dim = get_dim(n);
+	cout << "\t" << dim->name() << " = " ;
+	if (dim->is_unlimited())
+	  cout << "UNLIMITED" << " ;\t " << "// " << dim->size() <<
+	    " currently\n";
+	else
+	  cout << dim->size() << " ;\n";
+    }
+}
+
+void dumpatts(NcVar& var)
+{
+    NcToken vname = var.name();
+    NcAtt *ap;
+    for(int n = 0; ap = var.get_att(n); n++) {
+	cout << "\t\t" << vname << ":" << ap->name() << " = " ;
+	NcValues *vals = ap->values();
+	cout << *vals << " ;" << endl ;
+	delete ap;
+	delete vals;
+    }
+}
+
+void DumpableNcFile::dumpvars( void )
+{
+    static char *typename[] =
+      {"","byte","char","short","long","float","double"};
+    NcVar *vp;
+
+    for(int n = 0; vp = get_var(n); n++) {
+	cout << "\t" << typename[vp->type()] << " " << vp->name() ;
+
+	if (vp->num_dims() > 0) {
+	    cout << "(";
+	    for (int d = 0; d < vp->num_dims(); d++) {
+		NcDim* dim = vp->get_dim(d);
+		cout << dim->name();
+		if (d < vp->num_dims()-1)
+		  cout << ", ";		  
+	    }
+	    cout << ")";
+	}
+	cout << " ;\n";
+	// now dump each of this variable's attributes
+	dumpatts(*vp);
+    }
+}
+
+void DumpableNcFile::dumpgatts( void )
+{
+    NcAtt *ap;
+    for(int n = 0; ap = get_att(n); n++) {
+	cout << "\t\t" << ":" << ap->name() << " = " ;
+	NcValues *vals = ap->values();
+	cout << *vals << " ;" << endl ;
+	delete vals;
+	delete ap;
+    }
+}
+
+void DumpableNcFile::dumpdata( )
+{
+    NcVar *vp;
+    for (int n = 0; vp = get_var(n); n++) {
+	cout << " " << vp->name() << " = ";
+	NcValues* vals = vp->values();
+	cout << *vals << " ;" << endl ;
+	delete vals;
+    }
+}
+
+void dump(const char *path)
+{
+    DumpableNcFile nc(path); // opens in read-only mode
+
+    cout << "netcdf " << cdl_name(path) << " {" << endl <<
+	    "dimensions:" << endl ;
+
+    nc.dumpdims();
+
+    cout << "variables:" << endl;
+
+    nc.dumpvars();
+
+    if (nc.num_atts() > 0)
+      cout << "// global attributes" << endl ;
+
+    nc.dumpgatts();
+
+    cout << "data:" << endl;
+
+    nc.dumpdata();
+
+    cout << "}" << endl;
+}
+
+
+int
+main( void )	// test new netCDF interface
+{
+    const char* path = "example.nc";
+
+    gen(path);		// create a netCDF file
+    dump(path);		// print what's in it
+
+    return 0;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/ncvalues.cc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/ncvalues.cc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/ncvalues.cc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,229 @@
+/*********************************************************************
+ *   Copyright 1992, University Corporation for Atmospheric Research
+ *   See netcdf/README file for copying and redistribution conditions.
+ *
+ *   Purpose:	implementation of classes of typed arrays for netCDF
+ *
+ *   $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/c++/ncvalues.cc,v 1.2 1993/04/30 20:29:40 koziol Exp $
+ *********************************************************************/
+
+#include <iostream.h>		// for debugging
+#include "ncvalues.hh"
+
+NcValues::NcValues( void ) : the_number(0), the_type(ncNoType)
+{}
+
+NcValues::NcValues(NcType type, long num)
+	: the_number(num), the_type(type)
+{}
+
+NcValues::~NcValues( void )
+{}
+
+long NcValues::num( void )
+{
+    return the_number;
+}    
+
+ostream& operator<< (ostream& os, const NcValues& vals)
+{
+    return vals.print(os);
+}
+
+implement(NcValues,ncbyte)
+implement(NcValues,char)
+implement(NcValues,short)
+implement(NcValues,long)
+implement(NcValues,int)
+implement(NcValues,float)
+implement(NcValues,double)
+
+Ncbytes_for_one_implement(ncbyte)
+Ncbytes_for_one_implement(char)
+Ncbytes_for_one_implement(short)
+Ncbytes_for_one_implement(long)
+Ncbytes_for_one_implement(float)
+Ncbytes_for_one_implement(double)
+
+int NcValues_int::bytes_for_one( void ) const
+{
+    return nctypelen( NC_LONG ); // *** treat "int" as "long" for now
+}
+
+as_ncbyte_implement(short)
+as_ncbyte_implement(int)
+as_ncbyte_implement(long)
+as_ncbyte_implement(float)
+as_ncbyte_implement(double)
+
+inline ncbyte NcValues_char::as_ncbyte( int n ) const
+{
+    return the_values[n] < 0 ? ncBad_byte : (ncbyte) the_values[n];
+}
+
+inline ncbyte NcValues_ncbyte::as_ncbyte( int n ) const
+{
+    return the_values[n];
+}
+
+as_char_implement(short)
+as_char_implement(int)
+as_char_implement(long)
+as_char_implement(float)
+as_char_implement(double)
+
+inline char NcValues_ncbyte::as_char( int n ) const
+{
+    return the_values[n] > CHAR_MAX ? ncBad_char : (char) the_values[n];
+}
+
+inline char NcValues_char::as_char( int n ) const
+{
+    return the_values[n];
+}
+
+as_short_implement(int)
+as_short_implement(long)
+as_short_implement(float)
+as_short_implement(double)
+
+inline short NcValues_ncbyte::as_short( int n ) const
+{
+    return the_values[n];
+}
+
+inline short NcValues_char::as_short( int n ) const
+{
+    return the_values[n];
+}
+
+inline short NcValues_short::as_short( int n ) const
+{
+    return the_values[n];
+}
+
+as_long_implement(float)
+as_long_implement(double)
+
+inline long NcValues_ncbyte::as_long( int n ) const
+{
+    return the_values[n];
+}
+
+inline long NcValues_char::as_long( int n ) const
+{
+    return the_values[n];
+}
+
+inline long NcValues_short::as_long( int n ) const
+{
+    return the_values[n];
+}
+
+inline long NcValues_int::as_long( int n ) const
+{
+    return the_values[n];
+}
+
+inline long NcValues_long::as_long( int n ) const
+{
+    return the_values[n];
+}
+
+as_float_implement(ncbyte)
+as_float_implement(char)
+as_float_implement(short)
+as_float_implement(int)
+as_float_implement(long)
+as_float_implement(float)
+as_float_implement(double)
+
+as_double_implement(ncbyte)
+as_double_implement(char)
+as_double_implement(short)
+as_double_implement(int)
+as_double_implement(long)
+as_double_implement(float)
+as_double_implement(double)
+
+as_string_implement(short)
+as_string_implement(int)
+as_string_implement(long)
+as_string_implement(float)
+as_string_implement(double)
+
+inline char* NcValues_ncbyte::as_string( int n ) const
+{
+    return strdup((char*)the_values + n);
+}
+
+inline char* NcValues_char::as_string( int n ) const
+{
+    return strdup(the_values + n);
+}
+
+ostream& NcValues_short::print(ostream& os) const
+{
+    for(int i = 0; i < the_number - 1; i++)
+      os << the_values[i] << ", ";
+    if (the_number > 0)
+      os << the_values[the_number-1] ;
+    return os;
+}
+
+ostream& NcValues_long::print(ostream& os) const
+{
+    for(int i = 0; i < the_number - 1; i++)
+      os << the_values[i] << ", ";
+    if (the_number > 0)
+      os << the_values[the_number-1] ;
+    return os;
+}
+
+ostream& NcValues_int::print(ostream& os) const
+{
+    for(int i = 0; i < the_number - 1; i++)
+      os << the_values[i] << ", ";
+    if (the_number > 0)
+      os << the_values[the_number-1] ;
+    return os;
+}
+
+ostream& NcValues_ncbyte::print(ostream& os) const
+{
+    for(int i = 0; i < the_number - 1; i++)
+      os << the_values[i] << ", ";
+    if (the_number > 0)
+      os << the_values[the_number-1] ;
+    return os;
+}
+
+ostream& NcValues_char::print(ostream& os) const
+{
+    os << '"' << the_values <<'"';
+    return os;
+}
+
+ostream& NcValues_float::print(ostream& os) const
+{
+    long save=os.flags();
+    os.precision(7);
+    for(int i = 0; i < the_number - 1; i++)
+      os << the_values[i] << ", ";
+    if (the_number > 0)
+      os << the_values[the_number-1] ;
+    os.flags(save);
+    return os;
+}
+
+ostream& NcValues_double::print(ostream& os) const
+{
+    long save=os.flags();
+    os.precision(15);
+    for(int i = 0; i < the_number - 1; i++)
+      os << the_values[i] << ", ";
+    if (the_number > 0)
+      os << the_values[the_number-1];
+    os.flags(save);
+    return os;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/ncvalues.hh
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/ncvalues.hh	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/ncvalues.hh	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,214 @@
+/*********************************************************************
+ *   Copyright 1992, University Corporation for Atmospheric Research
+ *   See netcdf/README file for copying and redistribution conditions.
+ *
+ *   Purpose:	interface for classes of typed arrays for netCDF
+ *
+ *   $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/c++/ncvalues.hh,v 1.2 1993/04/30 20:29:42 koziol Exp $
+ *********************************************************************/
+
+#ifndef Ncvalues_def
+#define Ncvalues_def
+
+#include <generic.h>
+#include <iostream.h>
+#include <strstream.h>
+#include <limits.h>
+#include <string.h>
+#include "netcdf.h"
+
+typedef unsigned char ncbyte;
+
+enum NcType 
+{
+  ncNoType = NC_UNSPECIFIED, 
+  ncByte = NC_BYTE, 
+  ncChar = NC_CHAR, 
+  ncShort = NC_SHORT, 
+  ncLong = NC_LONG, 
+  ncFloat = NC_FLOAT, 
+  ncDouble = NC_DOUBLE, 
+  ncInt				// Note:  needed for int* overloading
+};
+
+static const ncbyte ncBad_byte = FILL_BYTE;
+static const char ncBad_char = FILL_CHAR;
+static const short ncBad_short = FILL_SHORT;
+static const long ncBad_long = FILL_LONG;
+static const float ncBad_float = FILL_FLOAT;
+static const double ncBad_double = FILL_DOUBLE;
+
+#define NcVal(TYPE) name2(NcValues_,TYPE)
+
+#define NcValuesdeclare(TYPE)						      \
+class NcVal(TYPE) : public NcValues					      \
+{									      \
+  public:								      \
+    NcVal(TYPE)( void );						      \
+    NcVal(TYPE)(long num);						      \
+    NcVal(TYPE)(long num, const TYPE* vals);				      \
+    NcVal(TYPE)(const NcVal(TYPE)&);					      \
+    virtual NcVal(TYPE)& operator=(const NcVal(TYPE)&);			      \
+    virtual ~NcVal(TYPE)( void );					      \
+    virtual void* base( void ) const;					      \
+    virtual int bytes_for_one( void ) const;				      \
+    virtual ncbyte as_ncbyte( int n ) const;				      \
+    virtual char as_char( int n ) const;				      \
+    virtual short as_short( int n ) const;				      \
+    virtual long as_long( int n ) const;				      \
+    virtual float as_float( int n ) const;				      \
+    virtual double as_double( int n ) const;				      \
+    virtual char* as_string( int n ) const;				      \
+  private:								      \
+    TYPE* the_values;							      \
+    ostream& print(ostream&) const;					      \
+};
+
+#define NcTypeEnum(TYPE) name2(_nc__,TYPE)
+#define _nc__ncbyte ncByte
+#define _nc__char ncChar
+#define _nc__short ncShort
+#define _nc__long ncLong
+#define _nc__int ncInt
+#define _nc__float ncFloat
+#define _nc__double ncDouble
+#define NcValuesimplement(TYPE)						      \
+NcVal(TYPE)::NcVal(TYPE)( void )					      \
+	: NcValues(NcTypeEnum(TYPE), 0), the_values(0)			      \
+{}									      \
+									      \
+NcVal(TYPE)::NcVal(TYPE)(long num, const TYPE* vals)			      \
+	: NcValues(NcTypeEnum(TYPE), num)				      \
+{									      \
+    the_values = new TYPE[num];						      \
+    for(int i = 0; i < num; i++)					      \
+      the_values[i] = vals[i];						      \
+}									      \
+									      \
+NcVal(TYPE)::NcVal(TYPE)(long num)					      \
+	: NcValues(NcTypeEnum(TYPE), num), the_values(new TYPE[num])	      \
+{}									      \
+									      \
+NcVal(TYPE)::NcVal(TYPE)(const NcVal(TYPE)& v)				      \
+{									      \
+    delete[] the_values;						      \
+    the_values = new TYPE[v.the_number];				      \
+    for(int i = 0; i < v.the_number; i++)				      \
+      the_values[i] = v.the_values[i];					      \
+}									      \
+									      \
+NcVal(TYPE)& NcVal(TYPE)::operator=(const NcVal(TYPE)& v)		      \
+{									      \
+    delete[] the_values;						      \
+    the_values = new TYPE[v.the_number];				      \
+    for(int i = 0; i < v.the_number; i++)				      \
+      the_values[i] = v.the_values[i];					      \
+    return *this;							      \
+}									      \
+									      \
+void* NcVal(TYPE)::base( void ) const					      \
+{									      \
+    return the_values;							      \
+}									      \
+									      \
+NcVal(TYPE)::~NcVal(TYPE)( void )					      \
+{									      \
+    delete[] the_values;						      \
+}
+
+
+#define Ncbytes_for_one_implement(TYPE)					      \
+int NcVal(TYPE)::bytes_for_one( void ) const				      \
+{									      \
+    return nctypelen((nc_type) NcTypeEnum(TYPE));			      \
+}
+
+#define as_ncbyte_implement(TYPE)					      \
+ncbyte NcVal(TYPE)::as_ncbyte( int n ) const				      \
+{									      \
+    if (the_values[n] < 0 || the_values[n] > UCHAR_MAX)			      \
+      return ncBad_byte;						      \
+    return (ncbyte) the_values[n];					      \
+}
+
+#define as_char_implement(TYPE)						      \
+char NcVal(TYPE)::as_char( int n ) const				      \
+{									      \
+    if (the_values[n] < CHAR_MIN || the_values[n] > CHAR_MAX)		      \
+      return ncBad_char;						      \
+    return (char) the_values[n];					      \
+}
+
+#define as_short_implement(TYPE)					      \
+short NcVal(TYPE)::as_short( int n ) const				      \
+{									      \
+    if (the_values[n] < SHRT_MIN || the_values[n] > SHRT_MAX)		      \
+      return ncBad_short;						      \
+    return (short) the_values[n];					      \
+}
+
+#define as_long_implement(TYPE)						      \
+long NcVal(TYPE)::as_long( int n ) const				      \
+{									      \
+    if (the_values[n] < LONG_MIN || the_values[n] > LONG_MAX)		      \
+      return ncBad_long;						      \
+    return (long) the_values[n];					      \
+}
+
+#define as_float_implement(TYPE)					      \
+inline float NcVal(TYPE)::as_float( int n ) const			      \
+{									      \
+    return (float) the_values[n];					      \
+}
+
+#define as_double_implement(TYPE)					      \
+inline double NcVal(TYPE)::as_double( int n ) const			      \
+{									      \
+    return (double) the_values[n];					      \
+}
+
+#define as_string_implement(TYPE)					      \
+char* NcVal(TYPE)::as_string( int n ) const				      \
+{									      \
+    char* s = new char[32];						      \
+    ostrstream(s, sizeof(s)) << the_values[n] << ends ;			      \
+    return s;								      \
+}
+
+class NcValues			// ABC for value blocks
+{
+  public:
+    NcValues( void );
+    NcValues(NcType, long);
+    virtual ~NcValues( void );
+    virtual long num( void );
+    virtual ostream& print(ostream&) const = 0;
+    virtual void* base( void ) const = 0;
+    virtual int bytes_for_one( void ) const = 0;
+
+    // The following member functions provide conversions from the value
+    // type to a desired basic type.  If the value is out of range, the
+    // default "fill-value" for the appropriate type is returned.
+    virtual ncbyte as_ncbyte( int n ) const = 0;   // nth value as a byte
+    virtual char as_char( int n ) const = 0;   // nth value as char
+    virtual short as_short( int n ) const = 0; // nth value as short
+    virtual long as_long( int n ) const = 0;   // nth value as long
+    virtual float as_float( int n ) const = 0; // nth value as floating-point
+    virtual double as_double( int n ) const = 0; // nth value as double
+    virtual char* as_string( int n ) const = 0;  // value as string
+    
+  protected:
+    NcType the_type;
+    long the_number;
+    friend ostream& operator<< (ostream&, const NcValues&);
+};
+
+declare(NcValues,ncbyte)
+declare(NcValues,char)
+declare(NcValues,short)
+declare(NcValues,long)
+declare(NcValues,int)
+declare(NcValues,float)
+declare(NcValues,double)
+
+#endif

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/netcdf.cc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/netcdf.cc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/netcdf.cc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,895 @@
+/*********************************************************************
+ *   Copyright 1992, University Corporation for Atmospheric Research
+ *   See netcdf/README file for copying and redistribution conditions.
+ *
+ *   Purpose:	Implements class interface for netCDF over C interface
+ *
+ *   $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/c++/netcdf.cc,v 1.2 1993/04/30 20:29:45 koziol Exp $
+ *********************************************************************/
+
+#include <string.h>
+#include <stdlib.h>
+#include "netcdf.hh"
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+static const int ncGlobal = NC_GLOBAL; // psuedo-variable for global attributes
+
+static const int ncBad = -1;	// failure return for netCDF C interface 
+
+NcFile::~NcFile( void )
+{
+    (void) close();
+}
+
+NcBool NcFile::is_valid( void ) const
+{
+    return the_id != ncBad;
+}
+
+int NcFile::num_dims( void ) const
+{
+    int num = 0;
+    if (is_valid())
+      ncinquire(the_id, &num, 0, 0, 0);
+    return num;
+}
+
+int NcFile::num_vars( void ) const
+{
+    int num = 0;
+    if (is_valid())
+      ncinquire(the_id, 0, &num, 0, 0);
+    return num;
+}
+
+int NcFile::num_atts( void ) const
+{
+    int num = 0;
+    if (is_valid())
+      ncinquire(the_id, 0, 0, &num, 0);
+    return num;
+}
+
+NcDim* NcFile::get_dim( NcToken name ) const
+{
+    int dimid = ncdimid(the_id, name);
+    return get_dim(dimid);
+}
+
+NcVar* NcFile::get_var( NcToken name ) const
+{
+    int varid = ncvarid(the_id, name);
+    return get_var(varid);
+}
+
+NcAtt * NcFile::get_att( NcToken aname ) const
+{
+    return is_valid() ? globalv->get_att(aname) : 0;
+}
+
+NcDim* NcFile::get_dim( int i ) const
+{
+    if (! is_valid() || i < 0 || i >= num_dims())
+      return 0;
+    return dimensions[i];
+}
+
+NcVar* NcFile::get_var( int i ) const
+{
+    if (! is_valid() || i < 0 || i >= num_vars())
+      return 0;
+    return variables[i];
+}
+
+NcAtt* NcFile::get_att( int n ) const
+{
+    return is_valid() ? globalv->get_att(n) : 0;
+}
+
+NcDim* NcFile::rec_dim( ) const
+{
+    if (! is_valid())
+      return 0;
+    int recdim;
+    ncinquire(the_id, 0, 0, 0, &recdim);
+    if (recdim == -1)
+      return 0;
+    return get_dim(recdim);
+}
+
+NcDim* NcFile::add_dim(NcToken name, long size)
+{
+    if (!is_valid() || !define_mode())
+      return 0;
+    int n = num_dims();
+    NcDim* dimp = new NcDim(this, name, size);
+    dimensions[n] = dimp;	// for garbage collection on close()
+    return dimp;
+}
+
+NcDim* NcFile::add_dim(NcToken name)
+{
+    return add_dim(name, NC_UNLIMITED);
+}
+
+// To create scalar, 1-dimensional, ..., 5-dimensional variables, just supply
+// as many dimension arguments as necessary
+
+NcVar* NcFile::add_var(NcToken name, NcType type, // scalar to 5D var
+			    const NcDim* dim0,
+			    const NcDim* dim1,
+			    const NcDim* dim2,
+			    const NcDim* dim3,
+			    const NcDim* dim4)
+{
+    if (!is_valid() || !define_mode())
+      return 0;
+    int dims[5];
+    int ndims = 0;
+    if (dim0) {
+	ndims++;
+	dims[0] = dim0->id();
+	if (dim1) {
+	    ndims++;
+	    dims[1] = dim1->id();
+	    if (dim2) {
+		ndims++;
+		dims[2] = dim2->id();
+		if (dim3) {
+		    ndims++;
+		    dims[3] = dim3->id();
+		    if (dim4) {
+			ndims++;
+			dims[4] = dim4->id();
+		    }
+		}
+	    }
+	}
+    }
+    int n = num_vars();
+    NcVar* varp =
+      new NcVar(this, ncvardef(the_id, name, (nc_type) type, ndims, dims));
+    variables[n] = varp;
+    return varp;
+}
+
+// For variables with more than 5 dimensions, use n-dimensional interface
+// with vector of dimensions.
+
+NcVar* NcFile::add_var(NcToken name, NcType type, int ndims, const NcDim* dims)
+{
+    if (!is_valid() || !define_mode())
+      return 0;
+    int *dimids = new int[ndims];
+    for (int i=0; i < ndims; i++)
+      dimids[i] = dims[i].id();
+    int n = num_vars();
+    NcVar* varp =
+      new NcVar(this, ncvardef(the_id, name, (nc_type) type, ndims, dimids));
+    variables[n] = varp;
+    return varp;
+}
+
+#define NcFile_add_scalar_att(TYPE)					      \
+NcBool NcFile::add_att(NcToken aname, TYPE val)				      \
+{									      \
+    return globalv->add_att(aname, val);				      \
+}
+
+NcFile_add_scalar_att(char)
+NcFile_add_scalar_att(short)
+NcFile_add_scalar_att(int)
+NcFile_add_scalar_att(long)
+NcFile_add_scalar_att(float)
+NcFile_add_scalar_att(double)
+NcFile_add_scalar_att(const char*)
+
+#define NcFile_add_vector_att(TYPE)					      \
+NcBool NcFile::add_att(NcToken aname, int n, const TYPE* val)		      \
+{									      \
+    return globalv->add_att(aname, n, val);				      \
+}
+
+NcFile_add_vector_att(char)
+NcFile_add_vector_att(short)
+NcFile_add_vector_att(int)
+NcFile_add_vector_att(long)
+NcFile_add_vector_att(float)
+NcFile_add_vector_att(double)
+
+NcBool NcFile::set_fill( FillMode a_mode )
+{
+    return ncsetfill(the_id, a_mode) != ncBad;
+}
+
+enum NcFile::FillMode NcFile::get_fill( void )
+{
+    int mode = ncsetfill(the_id, Fill);
+    if (mode == NC_FILL)
+      return NcFile::Fill;
+    if (mode == NC_NOFILL) {
+	ncsetfill(the_id, NoFill); // reset it
+	return NcFile::NoFill;
+    }
+    return NcFile::Bad;
+}
+
+NcBool NcFile::sync( void )
+{
+    if (ncsync(the_id) == ncBad)
+      return 0;
+    for (int i = 0; i < num_dims(); i++)
+      dimensions[i] = new NcDim(this, i);
+    for (i = 0; i < num_vars(); i++)
+      variables[i] = new NcVar(this, i);
+    return 1;
+}
+
+NcBool NcFile::close( void )
+{
+    if (the_id == ncBad)
+      return 0;
+    for (int i = 0; i < num_dims(); i++)
+      delete dimensions[i];
+    for (i = 0; i < num_vars(); i++)
+      delete variables[i];
+    delete [] dimensions;
+    delete [] variables;
+    delete globalv;
+    int old_id = the_id;
+    the_id = ncBad;
+    return ncclose(old_id) != ncBad;
+}
+
+NcBool NcFile::abort( void )
+{
+    return ncabort(the_id) != ncBad;
+}
+
+NcBool NcFile::define_mode( void )
+{
+    if (! is_valid())
+      return FALSE;
+    if (in_define_mode)
+      return TRUE;
+    if (ncredef(the_id) == ncBad)
+      return FALSE;
+    in_define_mode = 1;
+    return TRUE;
+}
+
+NcBool NcFile::data_mode( void )
+{
+    if (! is_valid())
+      return FALSE;
+    if (! in_define_mode)
+      return TRUE;
+    if (ncendef(the_id) == ncBad)
+      return FALSE;
+    in_define_mode = 0;
+    return TRUE;
+}
+
+int NcFile::id( void ) const
+{
+    return the_id;
+}
+
+
+NcNewFile::NcNewFile( const char * path, CreateMode mode)
+{
+    dimensions = new NcDim*[MAX_NC_DIMS];
+    variables = new NcVar*[MAX_NC_VARS];
+    NcError err(NcError::silent_nonfatal); // because constructor must not fail
+    the_id = nccreate(path, mode);
+    in_define_mode = 1;
+    globalv = new NcVar(this, ncGlobal);
+}
+
+
+NcOldFile::NcOldFile( const char * path, OpenMode mode)
+{
+    dimensions = new NcDim*[MAX_NC_DIMS];
+    variables = new NcVar*[MAX_NC_VARS];
+    NcError err(NcError::silent_nonfatal); // because constructor must not fail
+    the_id = ncopen(path, mode);
+    in_define_mode = 0;
+    for (int i = 0; i < num_dims(); i++)
+      dimensions[i] = new NcDim(this, i);
+    for (i = 0; i < num_vars(); i++)
+      variables[i] = new NcVar(this, i);
+    globalv = new NcVar(this, ncGlobal);
+}
+
+NcToken NcDim::name( void ) const
+{
+    return the_name;
+}
+
+long NcDim::size( void ) const
+{
+    long sz = 0;
+    if (the_file)
+      ncdiminq(the_file->id(), the_id, (char *)0, &sz);
+    return sz;
+}
+
+NcBool NcDim::is_valid( void ) const
+{
+    return the_file->is_valid() && the_id != ncBad;
+}
+
+NcBool NcDim::is_unlimited( void ) const
+{
+    if (!the_file)
+      return FALSE;
+    int recdim;
+    ncinquire(the_file->id(), 0, 0, 0, &recdim);
+    return the_id == recdim;
+}
+
+NcBool NcDim::rename(NcToken newname)
+{
+    NcBool ret = ncdimrename(the_file->id(), the_id, newname) != ncBad;
+    if (ret) {
+	delete [] the_name;
+	the_name = new char[1 + strlen(newname)];
+	strcpy(the_name, newname);
+    }
+    return ret;
+}
+
+int NcDim::id( void ) const
+{
+    return the_id;
+}
+
+NcDim::NcDim(const NcFile* nc, int id)
+	: the_file(nc), the_id(id)
+{
+    char nam[MAX_NC_NAME];
+    if (the_file && ncdiminq(the_file->id(), the_id, nam, 0) != ncBad) {
+	the_name = new char[strlen(nam) + 1]; 
+	strcpy(the_name, nam);
+    } else {
+	the_name = 0;
+    }
+}
+
+NcDim::NcDim(NcFile* nc, NcToken name, long sz)
+	: the_file(nc)
+{
+    the_id = ncdimdef(the_file->id(), name, sz);
+    if (the_id != ncBad) {
+	the_name = new char[strlen(name) + 1];
+	strcpy(the_name, name);
+    } else
+      the_name = 0;
+}
+
+NcDim::~NcDim( void )
+{
+    delete [] the_name;
+}
+
+#define Nc_as(TYPE) name2(as_,TYPE)
+#define NcTypedComponent_as(TYPE)					      \
+TYPE NcTypedComponent::Nc_as(TYPE)( int n ) const			      \
+{									      \
+    return values()->Nc_as(TYPE)(n);					      \
+}
+NcTypedComponent_as(ncbyte)
+NcTypedComponent_as(char)
+NcTypedComponent_as(short)
+NcTypedComponent_as(long)
+NcTypedComponent_as(float)
+NcTypedComponent_as(double)
+
+char* NcTypedComponent::as_string( int n ) const
+{
+    return values()->as_string(n);
+}
+
+NcTypedComponent::NcTypedComponent ( NcFile* nc )
+	: the_file(nc)
+{}
+
+NcValues* NcTypedComponent::get_space( void ) const
+{
+    NcValues* valp;
+    switch (type()) {
+      case ncFloat:
+	valp = new NcValues_float(num_vals());
+	break;
+      case ncDouble:
+	valp = new NcValues_double(num_vals());
+	break;
+      case ncLong:
+	valp = new NcValues_long(num_vals());
+	break;
+      case ncInt:
+	valp = new NcValues_int(num_vals());
+	break;
+      case ncShort:
+	valp = new NcValues_short(num_vals());
+	break;
+      case ncByte:
+      case ncChar:
+	valp = new NcValues_char(num_vals());
+	break;
+      case ncNoType:
+      default:
+	valp = 0;
+    }
+    return valp;
+}
+
+NcVar::~NcVar( void )
+{
+    delete[] the_cur;
+    delete[] the_name;
+}
+
+NcToken NcVar::name( void ) const
+{
+    return the_name;
+}
+
+NcType NcVar::type( void ) const
+{
+    nc_type typ;
+    ncvarinq(the_file->id(), the_id, 0, &typ, 0, 0, 0);
+    return (NcType) typ;
+}
+
+NcBool NcVar::is_valid( void ) const
+{
+    return the_file->is_valid() && the_id != ncBad;
+}
+
+int NcVar::num_dims( void ) const
+{
+    int ndim;
+    ncvarinq(the_file->id(), the_id, 0, 0, &ndim, 0, 0);
+    return ndim;
+}
+
+// The i-th dimension for this variable
+NcDim* NcVar::get_dim( int i ) const
+{
+    int ndim;
+    int dims[MAX_NC_DIMS];
+    if(ncvarinq(the_file->id(), the_id, 0, 0, &ndim, dims, 0) == ncBad ||
+       i < 0 || i >= ndim)
+      return 0;
+    return the_file->get_dim(dims[i]);
+}
+
+const long* NcVar::edges( void ) const	// edge lengths (dimension sizes)
+{
+    long* evec = new long[num_dims()];
+    for(int i=0; i < num_dims(); i++)
+      evec[i] = get_dim(i)->size();
+    return evec;
+}
+
+int NcVar::num_atts( void ) const // handles variable and global atts
+{
+    int natt = 0;
+    if (the_file->is_valid())
+      if (the_id == ncGlobal)
+	natt = the_file->num_atts();
+      else
+	ncvarinq(the_file->id(), the_id, 0, 0, 0, 0, &natt);
+    return natt;
+}
+
+NcAtt * NcVar::get_att( NcToken aname ) const
+{
+    NcAtt* att = new NcAtt(the_file, this, aname);
+    return att;
+}
+
+NcAtt * NcVar::get_att( int n ) const
+{
+    if (n < 0 || n >= num_atts())
+      return 0;
+    NcToken aname = attname(n);
+    NcAtt *ap = get_att(aname);
+    delete [] (char *)aname;
+    return ap;
+}
+
+long NcVar::num_vals( void ) const
+{
+    long prod = 1;
+    NcDim* dim;
+    for (int d = 0; dim = get_dim(d); d++)
+	prod *= dim->size();
+    return  prod;
+}
+
+NcValues* NcVar::values( void ) const
+{
+    int ndims = num_dims();
+    long crnr[MAX_NC_DIMS];
+    long edgs[MAX_NC_DIMS];
+    for (int i = 0; i < ndims; i++) {
+	crnr[i] = 0;
+	edgs[i] = get_dim(i)->size();
+    }
+    NcValues* valp = get_space();
+    if (ncvarget(the_file->id(), the_id, crnr, edgs, valp->base()) == ncBad)
+	return 0;
+    return valp;
+}
+
+#define NcVar_put_array(TYPE)						      \
+NcBool NcVar::put( const TYPE* vals,					      \
+		     long edge0,					      \
+		     long edge1,					      \
+		     long edge2,					      \
+		     long edge3,					      \
+		     long edge4)					      \
+{									      \
+    if (type() != NcTypeEnum(TYPE))					      \
+      return FALSE;							      \
+    if (! the_file->data_mode())					      \
+      return FALSE;							      \
+    long count[5];							      \
+    count[0] = edge0;							      \
+    count[1] = edge1;							      \
+    count[2] = edge2;							      \
+    count[3] = edge3;							      \
+    count[4] = edge4;							      \
+    for (int i = 0; i < 5; i++) {					      \
+	if (count[i]) {							      \
+	    if (num_dims() < i)						      \
+	      return FALSE;						      \
+	} else								      \
+	  break;							      \
+    }									      \
+    static long start[5] = {0, 0, 0, 0, 0};				      \
+    for (int j = 0; j < 5; j++) {					      \
+     start[j] = the_cur[j];						      \
+    }									      \
+    return ncvarput(the_file->id(), the_id, start, count, vals) != ncBad;     \
+}
+
+NcVar_put_array(char)
+NcVar_put_array(short)
+NcVar_put_array(long)
+NcVar_put_array(int)
+NcVar_put_array(float)
+NcVar_put_array(double)
+
+#define NcVar_put_nd_array(TYPE)					      \
+NcBool NcVar::put( const TYPE* vals, const long* count )			      \
+{									      \
+    if (type() != NcTypeEnum(TYPE))					      \
+      return FALSE;							      \
+    if (! the_file->data_mode())					      \
+      return FALSE;							      \
+    long start[MAX_NC_DIMS];						      \
+    for (int i = 0; i < num_dims(); i++)				      \
+      start[i] = the_cur[i];						      \
+    return ncvarput(the_file->id(), the_id, start, count, vals) != ncBad;     \
+}
+
+NcVar_put_nd_array(char)
+NcVar_put_nd_array(short)
+NcVar_put_nd_array(long)
+NcVar_put_nd_array(int)
+NcVar_put_nd_array(float)
+NcVar_put_nd_array(double)
+
+#define NcVar_get_array(TYPE)						      \
+NcBool NcVar::get( TYPE* vals,						      \
+		     long edge0,					      \
+		     long edge1,					      \
+		     long edge2,					      \
+		     long edge3,					      \
+		     long edge4) const					      \
+{									      \
+    if (type() != NcTypeEnum(TYPE))					      \
+      return FALSE;							      \
+    if (! the_file->data_mode())					      \
+      return FALSE;							      \
+    long count[5];							      \
+    count[0] = edge0;							      \
+    count[1] = edge1;							      \
+    count[2] = edge2;							      \
+    count[3] = edge3;							      \
+    count[4] = edge4;							      \
+    for (int i = 0; i < 5; i++) {					      \
+	if (count[i]) {							      \
+	    if (num_dims() < i)						      \
+	      return FALSE;						      \
+	} else								      \
+	  break;							      \
+    }									      \
+    static long start[5] = {0, 0, 0, 0, 0};				      \
+    for (int j = 0; j < 5; j++) {					      \
+     start[j] = the_cur[j];						      \
+    }									      \
+    return ncvarget(the_file->id(), the_id, start, count, vals) != ncBad;     \
+}
+
+NcVar_get_array(char)
+NcVar_get_array(short)
+NcVar_get_array(long)
+NcVar_get_array(int)
+NcVar_get_array(float)
+NcVar_get_array(double)
+
+#define NcVar_get_nd_array(TYPE)					      \
+NcBool NcVar::get( TYPE* vals, const long* count ) const		      	      \
+{									      \
+    if (type() != NcTypeEnum(TYPE))					      \
+      return FALSE;							      \
+    if (! the_file->data_mode())					      \
+      return FALSE;							      \
+    long start[MAX_NC_DIMS];						      \
+    for (int i = 0; i < num_dims(); i++)				      \
+	start[i] = the_cur[i];						      \
+    return ncvarget(the_file->id(), the_id, start, count, vals) != ncBad;     \
+}
+
+NcVar_get_nd_array(char)
+NcVar_get_nd_array(short)
+NcVar_get_nd_array(long)
+NcVar_get_nd_array(int)
+NcVar_get_nd_array(float)
+NcVar_get_nd_array(double)
+
+// If no args, set cursor to all zeros.	 Else set initial elements of cursor
+// to args provided, rest to zeros.
+NcBool NcVar::set_cur(long c0, long c1, long c2, long c3, long c4)
+{
+    long t[5];
+    t[0] = c0;
+    t[1] = c1;
+    t[2] = c2;
+    t[3] = c3;
+    t[4] = c4;
+    for(int j = 0; j < 5; j++) {
+	if (t[j] == -1) {
+	    if (num_dims() < j)
+	      return FALSE;	// too many for variable's dimensionality
+	    for (int i = 0; i < j; i++) {
+		if (t[i] >= get_dim(i)->size())
+		  return FALSE;	// too big for dimension
+		the_cur[i] = t[i];
+	    }
+	    for(i = j; i < num_dims(); i++)
+	      the_cur[i] = 0;
+	    return TRUE;
+	}
+    }
+}
+
+NcBool NcVar::set_cur(long *cur)
+{
+    for(int i = 0; i < num_dims(); i++) {
+	if (cur[i] >= get_dim(i)->size())
+	  return FALSE;
+	the_cur[i] = cur[i];
+    }
+    return TRUE;
+}
+
+#define NcVar_add_scalar_att(TYPE)					      \
+NcBool NcVar::add_att(NcToken aname, TYPE val)				      \
+{									      \
+    if (! the_file->define_mode())					      \
+      return FALSE;							      \
+    if (ncattput(the_file->id(), the_id, aname, (nc_type) NcTypeEnum(TYPE),   \
+		 1, &val) == ncBad)					      \
+      return FALSE;							      \
+    return TRUE;							      \
+}									      \
+
+NcVar_add_scalar_att(char)
+NcVar_add_scalar_att(short)
+NcVar_add_scalar_att(long)
+NcVar_add_scalar_att(double)
+
+NcBool NcVar::add_att(NcToken aname, int val)
+{
+    if (! the_file->define_mode())
+      return FALSE;
+    if (ncattput(the_file->id(), the_id, aname, (nc_type) ncLong,
+		 1, &val) == ncBad)
+      return FALSE;
+    return TRUE;
+}
+
+NcBool NcVar::add_att(NcToken aname, float val)
+{
+    if (! the_file->define_mode())
+      return FALSE;
+    float fval = (float) val;	// workaround for bug, val passed as double??
+    if (ncattput(the_file->id(), the_id, aname, (nc_type) ncFloat,
+		 1, &fval) == ncBad)
+      return FALSE;
+    return TRUE;
+}
+
+NcBool NcVar::add_att(NcToken aname, const char* val)
+{
+    if (! the_file->define_mode())
+      return FALSE;
+    if (ncattput(the_file->id(), the_id, aname, (nc_type) ncChar,
+		 strlen(val) + 1, val) == ncBad)
+      return FALSE;
+    return TRUE;
+}
+
+#define NcVar_add_vector_att(TYPE)					      \
+NcBool NcVar::add_att(NcToken aname, int len, const TYPE* vals)		      \
+{									      \
+    if (! the_file->define_mode())					      \
+      return FALSE;							      \
+    if (ncattput(the_file->id(), the_id, aname, (nc_type) NcTypeEnum(TYPE),   \
+		 len, vals) == ncBad)					      \
+      return FALSE;							      \
+    return TRUE;							      \
+}
+NcVar_add_vector_att(char)
+NcVar_add_vector_att(short)
+NcVar_add_vector_att(long)
+NcVar_add_vector_att(int)
+NcVar_add_vector_att(float)
+NcVar_add_vector_att(double)
+
+NcBool NcVar::rename(NcToken newname)
+{
+    NcBool ret = ncvarrename(the_file->id(), the_id, newname) != ncBad;
+    if (ret) {
+	delete [] the_name;
+	the_name = new char [1 + strlen(newname)];
+	strcpy(the_name, newname);
+    }
+    return ret;
+}
+
+int NcVar::id( void ) const
+{
+    return the_id;
+}
+
+NcVar::NcVar(NcFile* nc, int id)
+   : NcTypedComponent(nc), the_id(id)
+{
+    char nam[MAX_NC_NAME];
+    if (the_file 
+	&& ncvarinq(the_file->id(), the_id, nam, 0, 0, 0, 0) != ncBad) {
+	the_name = new char[1 + strlen(nam)];
+	strcpy(the_name, nam);
+    } else {
+	the_name = 0;
+    }
+    init_cur();
+}
+
+int NcVar::attnum( NcToken attrname ) const
+{
+    for(int num=0; num < num_atts(); num++) {
+	char aname[MAX_NC_NAME];
+	ncattname(the_file->id(), the_id, num, aname);
+	if (strcmp(aname, attrname) == 0)
+	  break;
+    }
+    return num;			// num_atts() if no such attribute
+}
+
+NcToken NcVar::attname( int attnum ) const // caller must delete[]
+{
+    if (attnum < 0 || attnum >= num_atts())
+      return 0;
+    char aname[MAX_NC_NAME];
+    if (ncattname(the_file->id(), the_id, attnum, aname) == ncBad)
+      return 0;
+    char* rname = new char[1 + strlen(aname)];
+    strcpy(rname, aname);
+    return rname;
+}
+
+void NcVar::init_cur( void )
+{
+    the_cur = new long[MAX_NC_DIMS]; // *** don't know num_dims() yet?
+    for(int i = 0; i < MAX_NC_DIMS; i++)
+      the_cur[i] = 0;
+}
+
+NcAtt::NcAtt(NcFile* nc, const NcVar* var, NcToken name)
+   : NcTypedComponent(nc), the_variable(var)
+{
+    the_name = new char[1 + strlen(name)];
+    strcpy(the_name, name);
+}
+
+NcAtt::NcAtt(NcFile* nc, NcToken name)
+   : NcTypedComponent(nc), the_variable(NULL)
+{
+    the_name = new char[1 + strlen(name)];
+    strcpy(the_name, name);
+}
+
+NcAtt::~NcAtt( void )
+{
+    delete [] the_name;
+}
+
+NcToken NcAtt::name( void ) const
+{
+    return the_name;
+}
+
+NcType NcAtt::type( void ) const
+{
+    nc_type typ;
+    ncattinq(the_file->id(), the_variable->id(), the_name, &typ, 0);
+    return (NcType) typ;
+}
+
+long NcAtt::num_vals( void ) const
+{
+    int len;
+    ncattinq(the_file->id(), the_variable->id(), the_name, 0, &len);
+    return len;
+}
+
+NcBool NcAtt::is_valid( void ) const
+{
+    return the_file->is_valid() &&
+      the_variable->is_valid() &&
+	ncattinq(the_file->id(), the_variable->id(), the_name, 0, 0) != ncBad;
+}
+
+NcValues* NcAtt::values( void ) const
+{
+    NcValues* valp = get_space();
+    if (ncattget(the_file->id(),
+		 the_variable->id(),
+		 the_name,
+		 valp->base()) == ncBad) {
+	delete valp;
+	return 0;
+    }
+	
+    return valp;
+}
+
+NcBool NcAtt::rename(NcToken newname)
+{
+    return ncattrename(the_file->id(), the_variable->id(),
+		       the_name, newname) != ncBad;
+}
+
+NcBool NcAtt::remove( void )
+{
+    return ncattdel(the_file->id(), the_variable->id(), the_name) != ncBad;
+}
+
+NcError::NcError( Behavior b )
+{
+    the_old_state = ncopts;	// global variable in C interface
+    the_old_err = ncerr;	// global variable in C interface
+    ncopts = (int) b;
+}
+
+NcError::~NcError( void )
+{
+    ncopts = the_old_state;
+    ncerr = the_old_err;
+}
+
+int NcError::get_err( void )	// returns most recent error
+{
+    return ncerr;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/c++/netcdf.hh
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/c++/netcdf.hh	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/c++/netcdf.hh	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,405 @@
+/*********************************************************************
+ *   Copyright 1992, University Corporation for Atmospheric Research
+ *   See netcdf/README file for copying and redistribution conditions.
+ *
+ *   Purpose:   C++ class interface for netCDF
+ *
+ *   $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/c++/netcdf.hh,v 1.2 1993/04/30 20:29:48 koziol Exp $
+ *********************************************************************/
+
+#ifndef NETCDF_HH
+#define NETCDF_HH
+
+#include "netcdf.h"             // the C interface
+#include "ncvalues.hh"          // arrays that know their element type
+
+typedef const char* NcToken;    // names for netCDF objects
+typedef unsigned int NcBool;    // many members return 0 on failure
+
+class NcDim;                    // dimensions
+class NcVar;                    // variables
+class NcAtt;                    // attributes
+
+
+/*
+ * ***********************************************************************
+ * Abstract base class for netCDF files.  The concrete derived classes are
+ * NcOldFile and NcNewFile.
+ * ***********************************************************************
+ */
+class NcFile
+{
+  public:
+
+    // Pure destructor used to make this an abstract base class.
+    virtual ~NcFile( void )=0;
+
+    NcBool is_valid( void ) const;         // opened OK in ctr, still valid
+
+    int num_dims( void ) const;            // number of dimensions
+    int num_vars( void ) const;            // number of variables
+    int num_atts( void ) const;            // number of (global) attributes
+
+    NcDim* get_dim( NcToken ) const;       // dimension by name
+    NcVar* get_var( NcToken ) const;       // variable by name
+    NcAtt* get_att( NcToken ) const;       // global attribute by name
+
+    NcDim* get_dim( int ) const;           // n-th dimension
+    NcVar* get_var( int ) const;           // n-th variable
+    NcAtt* get_att( int ) const;           // n-th global attribute
+    NcDim* rec_dim( void ) const;          // unlimited dimension, if any
+    
+    // Add new dimensions, variables, global attributes.
+    // These put the file in "define" mode, so could be expensive.
+    NcDim* add_dim( NcToken dimname, long dimsize );
+    NcDim* add_dim( NcToken dimname );     // unlimited
+
+    NcVar* add_var( NcToken varname, NcType type,       // scalar
+                    const NcDim* dim0=0,                // 1-dim
+                    const NcDim* dim1=0,                // 2-dim
+                    const NcDim* dim2=0,                // 3-dim
+                    const NcDim* dim3=0,                // 4-dim
+                    const NcDim* dim4=0 );              // 5-dim
+    NcVar* add_var( NcToken varname, NcType type,       // n-dim
+                          int ndims, const NcDim* dims );
+
+    NcBool add_att( NcToken attname, char );             // scalar attributes
+    NcBool add_att( NcToken attname, short );
+    NcBool add_att( NcToken attname, int );
+    NcBool add_att( NcToken attname, long );
+    NcBool add_att( NcToken attname, float );
+    NcBool add_att( NcToken attname, double );
+    NcBool add_att( NcToken attname, const char*);       // string attribute
+    NcBool add_att( NcToken attname, int, const char* ); // vector attributes
+    NcBool add_att( NcToken attname, int, const short* );
+    NcBool add_att( NcToken attname, int, const int* );
+    NcBool add_att( NcToken attname, int, const long* );
+    NcBool add_att( NcToken attname, int, const float* );
+    NcBool add_att( NcToken attname, int, const double* );
+
+    enum FillMode {
+        Fill = NC_FILL,                    // prefill (default)
+        NoFill = NC_NOFILL,                // don't prefill
+        Bad
+      };
+
+    NcBool set_fill( FillMode = Fill );    // set fill-mode
+    FillMode get_fill( void );             // get fill-mode
+
+    NcBool sync( void );                   // synchronize to disk
+    NcBool close( void );                  // to close earlier than dtr
+    NcBool abort( void );                  // back out of bad defines
+    
+    // Needed by other Nc classes, but users will not need them
+    NcBool define_mode( void ); // leaves in define mode, if possible
+    NcBool data_mode( void );   // leaves in data mode, if possible
+    int id( void ) const;       // id used by C interface
+
+  protected:
+    int the_id;
+    int in_define_mode;
+    NcDim** dimensions;
+    NcVar** variables;
+    NcVar* globalv;             // "variable" for global attributes
+};
+
+
+/*
+ * **********************************************************************
+ * To create new netCDF files, opened in definition mode for adding new
+ * dimensions, variables, and attributes.
+ * **********************************************************************
+ */
+class NcNewFile : public NcFile
+{
+  public:
+
+    enum CreateMode {
+        NoClobber = NC_NOCLOBBER, // create only if doesn't exist (default)
+        Clobber = NC_CLOBBER      // create new file, even if exists
+      };
+
+    NcNewFile( const char * path, CreateMode = NoClobber );
+    virtual ~NcNewFile( void ) {};
+};
+
+
+/*
+ * **********************************************************************
+ * For existing netCDF files, opened in data access mode.
+ * **********************************************************************
+ */
+class NcOldFile : public NcFile
+{
+  public:
+
+    enum OpenMode {
+        ReadOnly = NC_NOWRITE,  // open for read only (default)
+        Write = NC_WRITE        // open for write
+      };
+
+    NcOldFile( const char * path, OpenMode = ReadOnly );
+    virtual ~NcOldFile( void ) {};
+};
+
+
+/*
+ * **********************************************************************
+ * A netCDF dimension, with a name and a size.  These are only created
+ * by NcFile member functions, because they cannot exist independently
+ * of an open netCDF file.
+ * **********************************************************************
+ */
+class NcDim
+{
+  public:
+    NcToken name( void ) const;
+    long size( void ) const;
+    NcBool is_valid( void ) const;
+    NcBool is_unlimited( void ) const;
+    NcBool rename( NcToken newname );
+    int id( void ) const;
+
+  private:
+    const NcFile *the_file;
+    int the_id;
+    char *the_name;
+
+    NcDim(const NcFile*, int num);         // existing dimension
+    NcDim(NcFile*, NcToken name, long sz); // defines a new dim
+    virtual ~NcDim( void );
+    
+    // to construct dimensions, since constructor is private
+  friend NcOldFile::NcOldFile( const char *, NcOldFile::OpenMode );
+  friend NcBool NcFile::sync( void );
+  friend NcDim* NcFile::add_dim( NcToken, long );
+    // to delete dimensions, since destructor is private
+  friend NcBool NcFile::close( void );
+};
+
+
+/*
+ * **********************************************************************
+ * Abstract base class for a netCDF variable or attribute, both of which
+ * have a name, a type, and associated values.  These only exist as
+ * components of an open netCDF file.
+ * **********************************************************************
+ */
+class NcTypedComponent
+{
+  public:
+    virtual NcToken name( void ) const = 0;
+    virtual NcType type( void ) const = 0;
+    virtual NcBool is_valid( void ) const = 0;
+    virtual long num_vals( void ) const = 0; 
+    virtual NcBool rename( NcToken newname ) = 0;
+    virtual NcValues* values( void ) const = 0; // block of all values
+
+    // The following member functions provide conversions from the value
+    // type to a desired basic type.  If the value is out of range,
+    // the default "fill-value" for the appropriate type is returned.
+
+    virtual ncbyte as_ncbyte( int n ) const;    // nth value as an unsgnd char
+    virtual char as_char( int n ) const;        // nth value as char
+    virtual short as_short( int n ) const;      // nth value as short
+    virtual long as_long( int n ) const;        // nth value as long
+    virtual float as_float( int n ) const;      // nth value as floating-point
+    virtual double as_double( int n ) const;    // nth value as double
+    virtual char* as_string( int n ) const;     // nth value as string
+
+  protected:
+    NcFile *the_file;
+    NcTypedComponent( NcFile* );
+    virtual NcValues* get_space( void ) const;  // to hold values
+};
+
+
+/*
+ * **********************************************************************
+ * netCDF variables.  In addition to a name and a type, these also have
+ * a shape, given by a list of dimensions
+ * **********************************************************************
+ */
+class NcVar : public NcTypedComponent
+{
+  public:
+    virtual ~NcVar( void );
+    NcToken name( void ) const;
+    NcType type( void ) const;
+    NcBool is_valid( void ) const;
+    int num_dims( void ) const;         // dimensionality of variable
+    NcDim* get_dim( int ) const;        // n-th dimension
+    const long* edges( void ) const;    // dimension sizes
+    int num_atts( void ) const;         // number of attributes
+    NcAtt* get_att( NcToken ) const;    // attribute by name
+    NcAtt* get_att( int ) const;        // n-th attribute
+    long num_vals( void ) const;        // product of dimension sizes
+    NcValues* values( void ) const;     // all values
+
+    // Put scalar or 1, ..., 5 dimensional arrays by providing enough
+    // arguments.  Arguments are edge lengths, and their number must not
+    // exceed variable\'s dimensionality.  Start corner is [0,0,..., 0] by
+    // default, but may be reset using the set_cur() member.  FALSE is
+    // returned if type of values does not match type for variable.
+    NcBool put( const char* vals,
+                long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
+    NcBool put( const short* vals,
+                long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
+    NcBool put( const long* vals,
+                long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
+    NcBool put( const int* vals,
+                long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
+    NcBool put( const float* vals,
+                long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
+    NcBool put( const double* vals,
+                long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 );
+
+    // Put n-dimensional arrays, starting at [0, 0, ..., 0] by default,
+    // may be reset with set_cur().
+    NcBool put( const char* vals, const long* counts );
+    NcBool put( const short* vals, const long* counts );
+    NcBool put( const long* vals, const long* counts );
+    NcBool put( const int* vals, const long* counts );
+    NcBool put( const float* vals, const long* counts );
+    NcBool put( const double* vals, const long* counts );
+
+    // Get scalar or 1, ..., 5 dimensional arrays by providing enough
+    // arguments.  Arguments are edge lengths, and their number must not
+    // exceed variable\'s dimensionality.  Start corner is [0,0,..., 0] by
+    // default, but may be reset using the set_cur() member.
+    NcBool get( char* vals, long c0=0, long c1=0,
+                long c2=0, long c3=0, long c4=0 ) const;
+    NcBool get( short* vals, long c0=0, long c1=0,
+                long c2=0, long c3=0, long c4=0 ) const;
+    NcBool get( long* vals, long c0=0, long c1=0,
+                long c2=0, long c3=0, long c4=0 ) const;
+    NcBool get( int* vals, long c0=0, long c1=0,
+                long c2=0, long c3=0, long c4=0 ) const;
+    NcBool get( float* vals, long c0=0, long c1=0,
+                long c2=0, long c3=0, long c4=0 ) const;
+    NcBool get( double* vals, long c0=0, long c1=0,
+                long c2=0, long c3=0, long c4=0 ) const; 
+
+    // Get n-dimensional arrays, starting at [0, 0, ..., 0] by default,
+    // may be reset with set_cur().
+    NcBool get( char* vals, const long* counts ) const;
+    NcBool get( short* vals, const long* counts ) const;
+    NcBool get( long* vals, const long* counts ) const;
+    NcBool get( int* vals, const long* counts ) const;
+    NcBool get( float* vals, const long* counts ) const;
+    NcBool get( double* vals, const long* counts ) const;
+
+    NcBool set_cur(long c0=-1, long c1=-1, long c2=-1,
+                         long c3=-1, long c4=-1);
+    NcBool set_cur(long* cur);
+
+    // these put file in define mode, so could be expensive
+    NcBool add_att( NcToken, char );             // add scalar attributes
+    NcBool add_att( NcToken, short );
+    NcBool add_att( NcToken, int );
+    NcBool add_att( NcToken, long );
+    NcBool add_att( NcToken, float );
+    NcBool add_att( NcToken, double );
+    NcBool add_att( NcToken, const char* );      // string attribute
+    NcBool add_att( NcToken, int, const char* ); // vector attributes
+    NcBool add_att( NcToken, int, const short* );
+    NcBool add_att( NcToken, int, const int* );
+    NcBool add_att( NcToken, int, const long* );
+    NcBool add_att( NcToken, int, const float* );
+    NcBool add_att( NcToken, int, const double* );
+
+    NcBool rename( NcToken newname );
+
+    int id( void ) const;               // rarely needed, C interface id
+    
+  private:
+    int the_id;
+    long* the_cur;
+    char* the_name;
+
+    // private constructors because only an NcFile creates these
+    NcVar( void );
+    NcVar(NcFile*, int);
+
+    int attnum( NcToken attname ) const;
+    NcToken attname( int attnum ) const;
+    void init_cur( void );
+
+    // to make variables, since constructor is private
+  friend NcOldFile::NcOldFile( const char *, OpenMode );
+  friend NcNewFile::NcNewFile( const char *, CreateMode );
+  friend NcBool NcFile::sync( void );
+  friend NcVar* NcFile::add_var( NcToken varname, NcType type,
+                                 const NcDim*,
+                                 const NcDim*,
+                                 const NcDim*,
+                                 const NcDim*,
+                                 const NcDim*);
+  friend NcVar* NcFile::add_var( NcToken, NcType, int,
+                                 const NcDim* );
+};
+
+
+/*
+ * **********************************************************************
+ * netCDF attributes.  In addition to a name and a type, these are each
+ * associated with a specific variable, or are global to the file.
+ * **********************************************************************
+ */
+class NcAtt : public NcTypedComponent
+{
+  public:          
+    virtual ~NcAtt( void );
+    NcToken name( void ) const;
+    NcType type( void ) const;
+    NcBool is_valid( void ) const;
+    long num_vals( void ) const; 
+    NcValues* values( void ) const;
+    NcBool rename( NcToken newname );
+    NcBool remove( void );
+
+  private:
+    const NcVar* the_variable;
+    char* the_name;
+    // protected constructors because only NcVars and NcFiles create
+    // attributes
+    NcAtt( NcFile*, const NcVar*, NcToken);
+    NcAtt( NcFile*, NcToken); // global attribute
+    
+    // To make attributes, since constructor is private
+  friend NcOldFile::NcOldFile( const char *, OpenMode );
+  friend NcNewFile::NcNewFile( const char *, CreateMode );
+  friend NcAtt* NcVar::get_att( NcToken ) const;
+};
+
+
+/*
+ * **********************************************************************
+ * To control error handling.  Declaring an NcError object temporarily
+ * changes the error-handling behavior until the object is destroyed, at
+ * which time the previous error-handling behavior is restored.
+ * **********************************************************************
+ */
+class NcError {
+  public:
+    enum Behavior {
+        silent_nonfatal = 0,
+        verbose_nonfatal = NC_VERBOSE,
+        silent_fatal = NC_FATAL,
+        verbose_fatal = NC_FATAL | NC_VERBOSE      
+      };
+
+    // constructor saves previous error state, sets new state
+    NcError( Behavior b = verbose_fatal );
+
+    // destructor restores previous error state
+    virtual ~NcError( void );
+
+    int get_err( void );                 // returns most recent error
+
+  private:
+    int the_old_state;
+    int the_old_err;
+};
+
+#endif                          /* NETCDF_HH */

Added: packages/libhdf4/branches/upstream/current/mfhdf/configure
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/configure	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/configure	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1326 @@
+#!/bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf.
+# Copyright (C) 1991, 1992, 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, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
+#        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
+# Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
+# --with-PACKAGE unless this script has special code to handle it.
+
+
+for arg
+do
+  # Handle --exec-prefix with a space before the argument.
+  if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
+  # Handle --host with a space before the argument.
+  elif test x$next_host = xyes; then next_host=
+  # Handle --prefix with a space before the argument.
+  elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
+  # Handle --srcdir with a space before the argument.
+  elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
+  else
+    case $arg in
+     # For backward compatibility, also recognize exact --exec_prefix.
+     -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
+	exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
+     -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
+	next_exec_prefix=yes ;;
+
+     -gas | --gas | --ga | --g) ;;
+
+     -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
+     -host | --host | --hos | --ho | --h)
+	next_host=yes ;;
+
+     -nfp | --nfp | --nf) ;;
+
+     -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
+        no_create=1 ;;
+
+     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+	prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
+     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+	next_prefix=yes ;;
+
+     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
+	srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
+     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
+	next_srcdir=yes ;;
+
+     -with-* | --with-*)
+       package=`echo $arg|sed 's/-*with-//'`
+       # Delete all the valid chars; see if any are left.
+       if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
+         echo "configure: $package: invalid package name" >&2; exit 1
+       fi
+       eval "with_`echo $package|sed s/-/_/g`=1" ;;
+
+     *) ;;
+    esac
+  fi
+done
+
+trap 'rm -f conftest* core; exit 1' 1 3 15
+
+rm -f conftest*
+compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+unique_file=nctest
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  srcdirdefaulted=yes
+  # Try the directory containing this script, then `..'.
+  prog=$0
+  confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
+  test "X$confdir" = "X$prog" && confdir=.
+  srcdir=$confdir
+  if test ! -r $srcdir/$unique_file; then
+    srcdir=..
+  fi
+fi
+if test ! -r $srcdir/$unique_file; then
+  if test x$srcdirdefaulted = xyes; then
+    echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
+  else
+    echo "configure: Can not find sources in \`${srcdir}'." 1>&2
+  fi
+  exit 1
+fi
+# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
+# But we can't avoid them for `..', to make subdirectories work.
+case $srcdir in
+  .|/*|~*) ;;
+  *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
+esac
+ if [ -r CUSTOMIZE ]; then
+  echo reading configuration customizations
+  . ./CUSTOMIZE
+fi
+ TRANSFORMEES='port/Makefile port/master.mk'
+POST_PROCESSEES='port/Makefile'
+CPPFLAGS=${CPPFLAGS-"-DNDEBUG"}
+
+ CFLAGS=${CFLAGS-"-O"}
+
+ 
+if test -z "$OS"; then
+echo checking for type of operating system
+cat << \CAT_EOF > conftest.c
+#ifdef __osf__
+OS_osf
+#endif
+#ifdef _AIX
+OS_aix
+#endif
+#ifdef __DGUX__
+OS_dgux
+#endif
+#ifdef hpux
+OS_hpux
+#endif
+#ifdef NeXT
+OS_nextos
+#endif
+#ifdef sgi
+OS_irix
+#endif
+#ifdef sun
+OS_sunos
+#endif
+#ifdef __FreeBSD__
+OS_freebsd
+#endif
+#ifdef ultrix
+OS_ultrix
+#endif
+#ifdef _UNICOS
+OS_unicos
+#endif
+#ifdef __convex__
+OS_convex
+#endif
+#ifdef masscomp
+OS_rtu
+#endif
+CAT_EOF
+OS=`cc -E conftest.c | sed -n '/^OS_/ {
+  s///p
+  q
+}'`
+rm conftest.c
+if test -z "$OS"; then
+  echo "OS:operating system:sunos" >> conf.missing
+fi
+fi
+ case "${OS}" in
+  aix*)    for arg in -D_ALL_SOURCE; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+;;
+  hpux*)   for arg in -D_HPUX_SOURCE; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+;;
+esac
+LIBOBJS=${LIBOBJS-""}
+
+ PORT_HEADERS=${PORT_HEADERS-""}
+
+ PORT_MANIFEST=${PORT_MANIFEST-""}
+
+
+PORT_SUBDIRS=${PORT_SUBDIRS-""}
+
+
+
+if test -z "$CC"; then
+  echo checking for cc
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/cc; then
+      CC="cc"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$CC" && CC=""
+if test -z "$CC"; then
+  echo "CC:C compiler:/bin/cc" >> conf.missing
+fi
+# Find out if we are using GNU C, under whatever name.
+cat <<EOF > conftest.c
+#ifdef __GNUC__
+  yes
+#endif
+EOF
+${CC-cc} -E conftest.c > conftest.out 2>&1
+if egrep yes conftest.out >/dev/null 2>&1; then
+  GCC=1 # For later tests.
+  CC="$CC -O"
+fi
+rm -f conftest*
+ if test -z "$AR"; then
+  echo checking for ar
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/ar; then
+      AR="ar"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$AR" && AR=""
+if test -z "$AR"; then
+  echo "AR:library utility:/bin/ar" >> conf.missing
+fi
+ if test -z "$RANLIB"; then
+  echo checking for ranlib
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/ranlib; then
+      RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$RANLIB" && RANLIB="@:"
+  
+
+echo checking for fill value usage
+if test "${OLD_FILLVALUES-}" = yes; then
+    OLD_FILLVALUES=1
+    DEFS="$DEFS -DOLD_FILLVALUES=1"
+else
+    OLD_FILLVALUES=0
+fi
+  for arg in libsrc/netcdf.h; do
+    case "$TRANSFORMEES" in
+      *$arg*) ;;
+      *)      TRANSFORMEES="${TRANSFORMEES-} $arg";;
+    esac
+  done
+
+
+CFLAGS=${CFLAGS-"-O"}
+
+
+CPPFLAGS=${CPPFLAGS-"-DNDEBUG"}
+
+
+  for arg in -DHDF; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+
+HDF_INC=${HDF_INC-"-I/hdf/home/chouck/hdf/33/include"}
+
+
+HDF_LIB=${HDF_LIB-"/hdf/home/chouck/hdf/33/lib/libdf.a"}
+
+JPEG_LIB=${JPEG_LIB-"/hdf/home/chouck/hdf/33/jpeg/libjpeg.a"}
+
+
+FFLAGS=${FFLAGS-""}
+
+
+LEX=${LEX-"lex"}
+
+
+YACC=${YACC-"yacc"}
+
+
+XDRFILE=${XDRFILE-"xdrposix"}
+
+
+echo setting the installation prefix
+prefix=`case "${prefix-..}" in 
+  /*) echo ${prefix-..}; exit;;
+   *) echo '/usr/local';
+#
+# Made the default prefix '/usr/local/' - GV
+#   *) path=\`pwd\`/${prefix-..}
+#        tail=
+#        while test -n "$path"; do
+#          (cd $path && echo \`pwd\`$rest) 2> /dev/null && exit
+#          base=/\`basename "$path"\`
+#          tail=/$base$tail
+#          path=\`echo "$path" | sed "s/\/$base//"\`
+#        done;;
+esac
+`
+test -z "$exec_prefix" && exec_prefix=$prefix/bin
+
+
+
+
+if test -z "$MACHINE"; then
+echo checking for type of machine
+MACHINE=`uname -m | tr A-Z a-z`
+if test -z "$MACHINE"; then
+  echo "MACHINE:machine hardware type:sun4c" >> conf.missing
+fi
+fi
+
+
+  for arg in which; do
+    case "$PORT_MANIFEST" in
+      *$arg*) ;;
+      *)      PORT_MANIFEST="${PORT_MANIFEST-} $arg";;
+    esac
+  done
+if test -z "$WHICH"; then
+  echo checking for which
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/which; then
+      WHICH="which"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$WHICH" && WHICH="`case "port" in 
+  /*) echo port; exit;;
+   *) path=\`pwd\`/port
+        tail=
+        while test -n "$path"; do
+          (cd $path && echo \`pwd\`$rest) 2> /dev/null && exit
+          base=/\`basename "$path"\`
+          tail=/$base$tail
+          path=\`echo "$path" | sed "s/\/$base//"\`
+        done;;
+esac
+`/which"
+
+if test "$OS" = ultrix && test "$MACHINE" = vax \
+    && test `$WHICH "$CC"` = /bin/cc; then
+  echo "changing C compiler to \`vcc' because \`cc' floating-point is broken"
+  CC=vcc
+fi
+
+echo checking how to run the C preprocessor
+if test -z "$CPP"; then
+  CPP='${CC-cc} -E'
+  cat > conftest.c <<EOF
+#include <stdio.h>
+EOF
+err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
+if test -z "$err"; then
+  :
+else
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+CPP=`eval echo $CPP`
+echo "#include <stdlib.h>" > conftest.c
+if test `$CPP conftest.c 2> /dev/null | wc -l` = 0; then
+  if test "$CPP" = cpp; then
+    echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work"
+    echo "CPP:C preprocessor:/lib/cpp" >> conf.missing
+  else
+    echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work; setting to \`cpp'"
+    CPP=cpp
+    if test `${WHICH} ${CPP} 2>&1 | wc -w` != 1; then
+      echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work; setting to \`cpp'"
+      CPP=/usr/ccs/lib/cpp
+      if test `${WHICH} ${CPP} 2>&1 | wc -w` != 1; then
+        echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't exist"
+        echo "CPP:C preprocessor:/lib/cpp" >> conf.missing
+      fi
+    fi
+  fi
+fi
+rm -f conftest.c
+
+ case "$OS" in
+  hpux*) for p in fort77 fortc f77
+do
+if test -z "$FC"; then
+  echo checking for $p
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$p; then
+      FC="$p"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$FC" && FC=""
+
+test -n "$FC" && break
+done
+;;
+  dgux*) for p in ghf77 f77
+do
+if test -z "$FC"; then
+  echo checking for $p
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$p; then
+      FC="$p"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$FC" && FC=""
+
+test -n "$FC" && break
+done
+;;
+  convex*) for p in f77 fc
+do
+if test -z "$FC"; then
+  echo checking for $p
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$p; then
+      FC="$p"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$FC" && FC=""
+
+test -n "$FC" && break
+done
+;;
+  *)     for p in f77 cf77 #fc
+do
+if test -z "$FC"; then
+  echo checking for $p
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$p; then
+      FC="$p"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$FC" && FC=""
+
+test -n "$FC" && break
+done
+;;
+esac
+if test -z "$FC"; then
+    for arg in NONE; do
+    case "$FC" in
+      *$arg*) ;;
+      *)      FC="${FC-} $arg";;
+    esac
+  done
+
+  echo "Was unable to find a Fortran compiler on this machine."
+fi
+
+if test -z "$NEQN"; then
+  echo checking for neqn
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/neqn; then
+      NEQN="neqn"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$NEQN" && NEQN="cat"
+test "$NEQN" = cat && 
+  echo 1>&2 "$0: Can't find program \`neqn'; setting to \`cat'"
+
+if test -z "$TBL"; then
+  echo checking for tbl
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/tbl; then
+      TBL="tbl"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$TBL" && TBL="cat"
+test "$TBL" = cat && 
+  echo 1>&2 "$0: Can't find program \`tbl'; setting to \`cat'"
+
+# Make sure to not get the incompatible SysV /etc/install and
+# /usr/sbin/install, which might be in PATH before a BSD-like install,
+# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
+# or the AFS install, which mishandles nonexistent args.  (Sigh.)
+if test -z "$INSTALL"; then
+  echo checking for install
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    case $dir in
+    /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
+    *)
+      if test -f $dir/install; then
+	if grep dspmsg $dir/install >/dev/null 2>&1; then
+	  : # AIX
+	else
+	  INSTALL="$dir/install -c"
+	  INSTALL_PROGRAM='$(INSTALL)'
+	  INSTALL_DATA='$(INSTALL) -m 644'
+	  break
+	fi
+      fi
+      ;;
+    esac
+  done
+  IFS="$saveifs"
+fi
+INSTALL=${INSTALL-cp}
+INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
+INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
+INSTALL_DATA="`echo "${INSTALL_DATA}" | sed 's/644/664/'`"
+
+if test -z "$AR"; then
+  echo checking for ar
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/ar; then
+      AR="ar"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$AR" && AR=""
+if test -z "$AR"; then
+  echo "AR:library utility:/bin/ar" >> conf.missing
+fi
+
+if test -z "$MAKEINFO"; then
+  echo checking for makeinfo
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/makeinfo; then
+      MAKEINFO="makeinfo"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$MAKEINFO" && MAKEINFO=""
+
+
+echo checking endianess
+SWAP=
+cat > conftest.c <<EOF
+main() {
+    long i = 0;
+    char *ip = (char*)&i;
+    *ip       = 'a';
+    exit(i != 'a'); /* false if little endian or sizeof(long) == sizeof(char) */
+}
+EOF
+eval $compile
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+  SWAP=-DSWAP
+fi
+rm -f conftest*
+if test "$OS" = unicos; then
+NETLONG=
+else
+echo checking type of netlong
+cat > conftest.c <<EOF
+main() {exit(sizeof(long) == 4);}
+EOF
+eval $compile
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+  NETLONG='-DNETLONG=int'
+else
+  NETLONG=
+fi
+rm -f conftest*
+fi
+
+echo checking for XDR header-file
+  if test -z "$CPP_XDR"; then
+    for dir in /usr/include/rpc /usr/local/include/rpc \
+    $prefix/include `case "xdr" in 
+  /*) echo xdr; exit;;
+   *) path=\`pwd\`/xdr
+        tail=
+        while test -n "$path"; do
+          (cd $path && echo \`pwd\`$rest) 2> /dev/null && exit
+          base=/\`basename "$path"\`
+          tail=/$base$tail
+          path=\`echo "$path" | sed "s/\/$base//"\`
+        done;;
+esac
+`; do
+      if test -r $dir/xdr.h; then
+        CPP_XDR=$dir
+        break;
+      fi
+    done
+    if test -z "$CPP_XDR"; then
+      echo "CPP_XDR:XDR include-directory:-I/usr/include/rpc" >> conf.missing
+    fi
+  fi
+if test -n "${CPP_XDR-}"; then
+  CPP_XDR=-I${CPP_XDR}
+fi
+
+echo checking XDR library
+case "${OS}" in
+  irix*)	LD_XDR=
+#                 for arg in -DIRIS4; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+
+#                 for arg in -cckr; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+;;
+  ultrix*)	LD_XDR=
+#                 for arg in -DMIPSEL; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+;;
+  unicos*)	LD_XDR=
+		  for arg in -DBIG_SHORTS -DBIG_LONGS; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+
+#                 for arg in -DUNICOS; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+;;
+  aix*)           
+#                   for arg in -DIBM6000; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+
+                LD_XDR=;;
+  sunos*)         
+#                   for arg in -DSUN; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+
+                LD_XDR=;;
+  freebsd*)         
+#                   for arg in -DUNIX386; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+
+                # QAK: If FreeBSD has float support (xdr_float & xdr_double)
+                # in it's libc.a someday, change the following line to LD_XDR=;;
+                LD_XDR=../xdr/xdrfloat.o;;
+  hpux*)          
+#               for arg in -DHP9000; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+
+                if test -z "$GCC"; then
+                          for arg in -Aa; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+
+                fi
+                LD_XDR=;;
+  osf*)           
+#               for arg in -DDEC_ALPHA; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+
+		  for arg in -DBIG_LONGS; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+
+		  for arg in -std1; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+
+                LD_XDR=;;
+  convex*)        
+#               for arg in -DCONVEX; do
+#   case "$HDF_INC" in
+#     *$arg*) ;;
+#     *)      HDF_INC="${HDF_INC-} $arg";;
+#   esac
+# done
+
+                LD_XDR=;;
+  *)		LD_XDR=;;
+esac
+  for arg in ${CPP_XDR-}; do
+    case "$DEFS" in
+      *$arg*) ;;
+      *)      DEFS="${DEFS-} $arg";;
+    esac
+  done
+  for arg in ${CPPFLAGS-}; do
+    case "$DEFS" in
+      *$arg*) ;;
+      *)      DEFS="${DEFS-} $arg";;
+    esac
+  done
+  for arg in ${LD_XDR-}; do
+    case "$LIBS" in
+      *$arg*) ;;
+      *)      LIBS="${LIBS-} $arg";;
+    esac
+  done
+cat > conftest.c <<EOF
+
+#undef NDEBUG
+
+#ifdef _AIX
+#   ifndef _ALL_SOURCE
+#     define _ALL_SOURCE
+#   endif
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+#include <types.h>
+#include <xdr.h>
+
+#define TESTFILE	"conftest.xdr"
+#define EPSILON		.0005
+#ifndef FLT_MIN
+#   define    FLT_MIN 1e-37           /* Standard C maximum */
+#endif
+#ifndef FLT_EPSILON
+#   define FLT_EPSILON        1e-5            /* Standard C maximum */
+#endif
+
+main(ac,av)
+    int			ac ;
+    char		*av[] ;
+{
+    int			ii, jj	= 0 ;
+    char		*fname	= ac > 1 ? av[1] : TESTFILE;
+    FILE		*F	= fopen(fname,"w");
+    XDR			xdrs[1] ;
+    unsigned int	count ;
+    unsigned int	szof ;
+
+    /*
+     * The last value below should be a subnormal number on a DECstation,
+     * RS6000, and SPARCstation.  Hopefully, it will catch bad xdr(3)
+     * implementations (such as a VAXstation's) which don't correctly handle
+     * such values.  Such a value should be the last one in the list.
+     */
+    static float	floats[]	= { 100.125, 100.25, 100.375, 
+					    100.5, 100.625, FLT_MIN/32 } ;
+    float *fp , got_af[sizeof(floats)/sizeof(floats[0])] ;
+
+/* create */
+
+    if( F == NULL)
+    {
+	    perror("fopen failed") ;
+	    exit(-1) ;
+    }
+    xdrstdio_create(xdrs, F, XDR_ENCODE) ;
+
+/* populate */
+
+    szof = sizeof(float) ;
+    count = sizeof(floats)/sizeof(float) ;
+    assert( xdr_vector(xdrs, (char *)floats, count, szof, xdr_float)) ;
+
+/* flush, rewind  and reopen */
+
+    assert(fflush((FILE *)xdrs->x_private) != EOF) ; /* xdr_destroy(xdrs) */
+
+    assert(fclose(F) != EOF) ;
+    F = fopen(fname,"r") ;
+    if( F == NULL)
+    {
+	    perror("fopen failed") ;
+	    exit(-1) ;
+    }
+    xdrstdio_create(xdrs, F, XDR_DECODE) ;
+
+/* check */
+
+    szof = sizeof(float) ;
+    count = sizeof(floats)/sizeof(float) ;
+    assert( xdr_vector(xdrs, (char *)got_af, count, szof, xdr_float)) ;
+    for(ii = 0, fp = got_af;
+	ii < count - 1;
+	ii++, fp++) 
+    {
+	assert(*fp <= floats[ii]*(1+FLT_EPSILON) && *fp >= floats[ii]*(1-FLT_EPSILON)) ;
+    }
+    assert(*fp == 0 || (*fp <= floats[ii]*(1+FLT_EPSILON) && *fp >= floats[ii]*(1-FLT_EPSILON))) ;
+
+    exit(0) ;
+}
+
+EOF
+eval $compile
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+  XDR_LIBOBJS=
+XDR_INSTALL_DEPS=
+else
+  XDR_LIBOBJS="xdr.o xdrfloat.o xdrstdio.o xdrarray.o"
+XDR_INSTALL_DEPS=installed_headers
+LD_XDR=
+fi
+rm -f conftest*
+
+echo checking for function prototypes
+# If you can get the FreeBSD stuff working, more power to you -QAK
+if test "$OS" = freebsd; then   # for some reason this is not working on FreeBSD
+    :
+else
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { extern int foo(int bar);
+ }
+EOF
+if eval $compile; then
+  :
+else
+    for arg in -DNO_HAVE_PROTOTYPES; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+
+fi
+rm -f conftest*
+fi
+
+echo checking for working const
+# If you can get the FreeBSD stuff working, more power to you -QAK
+if test "$OS" = freebsd; then   # for some reason this is not working on FreeBSD
+    :
+else
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { /* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+ }
+EOF
+if eval $compile; then
+  :
+else
+    for arg in -Dconst=; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+
+fi
+rm -f conftest*
+fi
+
+echo checking for variadic function support
+# If you can get the FreeBSD stuff working, more power to you -QAK
+if test "$OS" = freebsd; then   # for some reason this is not working on FreeBSD
+    :
+else
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { } 
+#include <stdarg.h>
+int foo(int bar, ...) {
+    va_list     alist;
+    va_start(alist, bar);
+    bar = (int)va_arg(alist, int);
+    va_end(alist);
+    return bar;
+ }
+EOF
+if eval $compile; then
+  :
+else
+    for arg in -DNO_STDARG; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+
+fi
+rm -f conftest*
+fi
+
+# If you can get the Convex or Solaris stuff working, more power to you -QAK
+if test "$OS" = solaris || test "$OS" = convex; then   # for some reason this is not working on Convex and Solaris
+    :
+else
+if test `$WHICH "${FC-}" | wc -w` != 1; then
+echo checking for strerror
+cat > conftest.c <<EOF
+#include <stdio.h>
+#include <string.h>
+main() { exit(0); } 
+t() { 
+#ifdef __stub_strerror
+choke me
+#else
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char strerror(); strerror();
+#endif
+ }
+EOF
+if eval $compile; then
+  :
+else
+    for arg in -DNO_STRERROR; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+
+fi
+rm -f conftest*
+#endif
+else
+  echo checking for strerror
+  echo '       CALL STRERROR' > conftest.f
+  if eval "$FC conftest.f > /dev/null 2>&1"; then
+    : true
+  else
+      for arg in -DNO_STRERROR; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
+    esac
+  done
+  fi
+  rm -rf a.out conftest.f
+fi
+fi	# end Convex/Solaris hack
+
+
+FTPDIR=${FTPDIR-/home/ftp}/pub/sdm
+
+echo checking for package version
+if test -z "$VERSION"; then
+  if test -r VERSION; then \
+    VERSION="`cat VERSION`"
+  else
+    VERSION=
+  fi
+fi
+if test -z "$MAJOR_NO"; then
+  if test -n "$VERSION"; then \
+    MAJOR_NO=`echo $VERSION |
+      sed -n '/^\([0-9][0-9]*\)\.[0-9][0-9]*.*/s//\1/p;q'`
+  else
+    MAJOR_NO=
+  fi
+fi
+if test -z "$MINOR_NO"; then
+  if test -n "$VERSION"; then \
+    MINOR_NO=`echo $VERSION |
+      sed -n '/^[0-9][0-9]*\.\([0-9][0-9]*\).*/s//\1/p;q'`
+  else
+    MINOR_NO=
+  fi
+fi
+
+
+if test -s conf.missing; then
+  cat << CAT_EOF
+
+$0: The following variables need values.  They may be set in
+the environment or in the file CUSTOMIZE.  Variables referring to
+executable programs needn't be set if the relevant directory is added to
+PATH.  In any case, ./configure should probably be rerun.  See file INSTALL
+for details.
+
+CAT_EOF
+  awk -F: 'BEGIN {printf "%-13s%-27s%s\n", "VARIABLE", "MEANING", "EXAMPLE";
+	          printf "%-13s%-27s%s\n", "--------", "-------", "-------"}
+	         {printf "%-13s%-27s%s\n", $1, $2, $3}' conf.missing
+  rm conf.missing
+  exit 1
+fi
+rm -f conf.missing
+
+
+if test -n "$prefix"; then
+  test -z "$exec_prefix" && exec_prefix='${prefix}'
+  prsub="s%^prefix\\([ 	]*\\)=\\([ 	]*\\).*$%prefix\\1=\\2$prefix%"
+fi
+if test -n "$exec_prefix"; then
+  prsub="$prsub
+s%^exec_prefix\\([ 	]*\\)=\\([ 	]*\\).*$%\
+exec_prefix\\1=\\2$exec_prefix%"
+fi
+
+trap 'rm -f config.status; exit 1' 1 3 15
+echo creating config.status
+rm -f config.status
+cat > config.status <<EOF
+#!/bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null`:
+#
+# $0 $*
+
+for arg
+do
+  case "\$arg" in
+    -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    exec /bin/sh $0 $* ;;
+    *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
+  esac
+done
+
+trap 'rm -f \
+    Makefile \
+    xdr/Makefile \
+    libsrc/Makefile \
+    fortran/Makefile \
+    ncgen/Makefile \
+    ncdump/Makefile \
+    dumper/Makefile \
+    nctest/Makefile \
+    doc/Makefile \
+     ${TRANSFORMEES-}; exit 1' 1 3 15
+CPPFLAGS='$CPPFLAGS'
+CFLAGS='$CFLAGS'
+OS='$OS'
+LIBOBJS='$LIBOBJS'
+PORT_HEADERS='$PORT_HEADERS'
+PORT_MANIFEST='$PORT_MANIFEST'
+PORT_SUBDIRS='$PORT_SUBDIRS'
+CC='$CC'
+AR='$AR'
+RANLIB='$RANLIB'
+OLD_FILLVALUES='$OLD_FILLVALUES'
+TRANSFORMEES='$TRANSFORMEES'
+HDF_INC='$HDF_INC'
+HDF_LIB='$HDF_LIB'
+JPEG_LIB='$JPEG_LIB'
+FFLAGS='$FFLAGS'
+LEX='$LEX'
+YACC='$YACC'
+XDRFILE='$XDRFILE'
+MACHINE='$MACHINE'
+WHICH='$WHICH'
+CPP='$CPP'
+FC='$FC'
+NEQN='$NEQN'
+TBL='$TBL'
+INSTALL='$INSTALL'
+INSTALL_PROGRAM='$INSTALL_PROGRAM'
+INSTALL_DATA='$INSTALL_DATA'
+MAKEINFO='$MAKEINFO'
+SWAP='$SWAP'
+NETLONG='$NETLONG'
+CPP_XDR='$CPP_XDR'
+DEFS='$DEFS'
+LIBS='$LIBS'
+XDR_LIBOBJS='$XDR_LIBOBJS'
+XDR_INSTALL_DEPS='$XDR_INSTALL_DEPS'
+LD_XDR='$LD_XDR'
+FTPDIR='$FTPDIR'
+VERSION='$VERSION'
+MAJOR_NO='$MAJOR_NO'
+MINOR_NO='$MINOR_NO'
+srcdir='$srcdir'
+DEFS='$DEFS'
+prefix='$prefix'
+exec_prefix='$exec_prefix'
+prsub='$prsub'
+EOF
+cat >> config.status <<\EOF
+
+top_srcdir=$srcdir
+for file in .. \
+    Makefile \
+    xdr/Makefile \
+    libsrc/Makefile \
+    fortran/Makefile \
+    ncgen/Makefile \
+    ncdump/Makefile \
+    dumper/Makefile \
+    nctest/Makefile \
+    doc/Makefile \
+     ${TRANSFORMEES-}; do if [ "x$file" != "x.." ]; then
+  srcdir=$top_srcdir
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
+  if test "$dir" != "$file"; then
+    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
+    test ! -d $dir && mkdir $dir
+  fi
+  echo creating $file
+  rm -f $file
+  case $file in
+    *.c|*.h) echo "/* Generated automatically from `echo $file|sed 's|.*/||'`.in by configure. */" > $file;;
+    *) echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file;;
+  esac
+  sed -e "
+$prsub
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CFLAGS@%$CFLAGS%g
+s%@OS@%$OS%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@PORT_HEADERS@%$PORT_HEADERS%g
+s%@PORT_MANIFEST@%$PORT_MANIFEST%g
+s%@PORT_SUBDIRS@%$PORT_SUBDIRS%g
+s%@CC@%$CC%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@OLD_FILLVALUES@%$OLD_FILLVALUES%g
+s%@TRANSFORMEES@%$TRANSFORMEES%g
+s%@HDF_INC@%$HDF_INC%g
+s%@HDF_LIB@%$HDF_LIB%g
+s%@JPEG_LIB@%$JPEG_LIB%g
+s%@FFLAGS@%$FFLAGS%g
+s%@LEX@%$LEX%g
+s%@YACC@%$YACC%g
+s%@XDRFILE@%$XDRFILE%g
+s%@MACHINE@%$MACHINE%g
+s%@WHICH@%$WHICH%g
+s%@CPP@%$CPP%g
+s%@FC@%$FC%g
+s%@NEQN@%$NEQN%g
+s%@TBL@%$TBL%g
+s%@INSTALL@%$INSTALL%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SWAP@%$SWAP%g
+s%@NETLONG@%$NETLONG%g
+s%@CPP_XDR@%$CPP_XDR%g
+s%@DEFS@%$DEFS%g
+s%@LIBS@%$LIBS%g
+s%@XDR_LIBOBJS@%$XDR_LIBOBJS%g
+s%@XDR_INSTALL_DEPS@%$XDR_INSTALL_DEPS%g
+s%@LD_XDR@%$LD_XDR%g
+s%@FTPDIR@%$FTPDIR%g
+s%@VERSION@%$VERSION%g
+s%@MAJOR_NO@%$MAJOR_NO%g
+s%@MINOR_NO@%$MINOR_NO%g
+s%@srcdir@%$srcdir%g
+s%@DEFS@%$DEFS%
+" $top_srcdir/${file}.in >> $file
+fi; done
+
+EOF
+chmod +x config.status
+test -n "$no_create" || ./config.status
+if test -s conf.missing; then
+  cat << CAT_EOF
+
+$0: The following variables need values.  They may be set in
+the environment or in the file CUSTOMIZE.  Variables referring to
+executable programs needn't be set if the relevant directory is added to
+PATH.  In any case, ./configure should probably be rerun.  See file INSTALL
+for details.
+
+CAT_EOF
+  awk -F: 'BEGIN {printf "%-13s%-27s%s\n", "VARIABLE", "MEANING", "EXAMPLE";
+	          printf "%-13s%-27s%s\n", "--------", "-------", "-------"}
+	         {printf "%-13s%-27s%s\n", $1, $2, $3}' conf.missing
+  rm conf.missing
+  exit 1
+fi
+rm -f conf.missing
+ # Post process any makefiles.
+#
+# Create a script to accomplish the post processing.
+#
+cat << EOF_CONFTEST_SH > conftest.sh
+cat << EOF_CONFTEST_C > conftest.c
+#include <stdio.h>
+main()
+{
+    return readsub((char*)NULL) ? 0 : 1;
+}
+readsub(inpath)
+    char	*inpath;
+{
+    char	buf[2048], path[1024];
+    FILE	*fp	= inpath == NULL
+				? stdin
+				: fopen(inpath, "r");
+    if (fp == NULL) {
+	(void) perror(inpath);
+	return 0;
+    }
+    buf[sizeof(buf)-1]	= 0;
+    while (fgets(buf, sizeof(buf), fp) != NULL) {
+      if (sscanf(buf, "include%*[] \\t[]%s", path) == 1) {
+          if (!readsub(path))
+		return 0;
+	} else {
+	    (void) fputs(buf, stdout);
+	}
+    }
+    return 1;
+}
+EOF_CONFTEST_C
+if $CC -o conftest conftest.c; then
+    conftest=\`pwd\`/conftest
+    set \
+    Makefile \
+    xdr/Makefile \
+    libsrc/Makefile \
+    fortran/Makefile \
+    ncgen/Makefile \
+    ncdump/Makefile \
+    dumper/Makefile \
+    nctest/Makefile \
+    doc/Makefile \
+     ${POST_PROCESSEES-}
+    for file do
+      echo post processing makefile \\\`\$file\\'
+      sd=\`pwd\`/\`echo \$file | sed 's,[^/]*\$,,'\`
+      base=\`basename \$file\`
+      (cd \$sd; \$conftest < \$base > conftest.mk && mv conftest.mk \$base)
+    done
+fi
+rm conftest conftest.c
+EOF_CONFTEST_SH
+#
+# Append the above script to the output-script file, config.status, so that 
+# invoking that file will also do the post processing.  Note that the 
+# output-script file will be invoked by ./configure before the post-
+# processing code is appended.
+#
+cat conftest.sh >> config.status
+#
+# If appropriate, do the postprocessing now because the previous step 
+# couldn't.
+#
+test -n "$no_create" || sh conftest.sh
+rm conftest.sh
+ 

Added: packages/libhdf4/branches/upstream/current/mfhdf/configure.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/configure.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/configure.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,63 @@
+dnl $Id: configure.in,v 1.6 1998/09/02 21:09:59 acheng Exp $
+dnl
+dnl Process this file with GNU autoconf(1) to produce a configure script.
+dnl
+UC_INIT(nctest)
+
+UL_FILLVALUES
+
+UC_DEFAULT(CFLAGS, -O)
+UC_DEFAULT(CPPFLAGS, -DNDEBUG)
+UC_ENSURE(CPPFLAGS, -DHDF)
+UC_DEFAULT(HDF_INC, -I/hdf/home/chouck/hdf/33/include)
+UC_DEFAULT(HDF_LIB, /hdf/home/chouck/hdf/33/lib/libdf.a)
+UC_DEFAULT(JPEG_LIB, /hdf/home/chouck/hdf/33/jpeg/libjpeg.a)
+UC_DEFAULT(FFLAGS,)
+UC_DEFAULT(LEX, lex)
+UC_DEFAULT(YACC, yacc)
+UC_DEFAULT(XDRFILE, xdrposix)
+UC_PREFIX(..)
+
+UC_OS
+UC_MACHINE
+UC_PROG_CC
+UC_PROG_WHICH
+if test "$OS" = ultrix && test "$MACHINE" = vax \
+    && test `$WHICH "$CC"` = /bin/cc; then
+  echo "changing C compiler to \`vcc' because \`cc' floating-point is broken"
+  CC=vcc
+fi
+
+UC_PROG_CPP
+UC_PROG_FC
+UC_PROG_NEQN
+UC_PROG_TBL
+UC_PROG_INSTALL
+UC_PROG_AR
+UC_PROG_MAKEINFO
+
+UL_SWAP
+UL_NETLONG
+UL_XDR
+UL_PROTOTYPES
+UL_CONST
+UL_VARIADIC_FUNCTIONS
+UL_STRERROR
+
+UC_FTPDIR(pub/sdm)
+UC_VERSION
+
+UC_CHECK_MISSING
+
+UC_FINISH( \
+    Makefile \
+    xdr/Makefile \
+    libsrc/Makefile \
+    fortran/Makefile \
+    ncgen/Makefile \
+    ncdump/Makefile \
+    dumper/Makefile \
+    nctest/Makefile \
+    doc/Makefile \
+    pablo/Makefile \
+    )

Added: packages/libhdf4/branches/upstream/current/mfhdf/doc/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/doc/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/doc/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,700 @@
+# Makefile for netCDF User's Guide and man(1)ual pages.
+#
+# $Id: Makefile.in,v 1.10 2000/08/30 00:11:12 wendling Exp $
+#          Makefile to build netcdf library and utilities
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC) 
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+MANUALS		= 
+INFOS		= guide.info
+MANIFEST = $(DISTFILES)
+DISTFILES	= README Makefile.in \
+		  $(MANUALS) texindex.c udunits.dat guide.ps guide.txn \
+		  texinfo.tex 
+prefix		= ../../..
+GARBAGE		= $(INFOS) *.log *~ *.gs *.aux *.cp *.fn *.ky *.pg *.toc \
+		  *.tp *.vr
+PRINTER		= hpnp
+
+all::
+
+install::	installed_manuals
+
+#guide.hc:	guide.ps
+#	lpr -P$(PRINTER) guide.ps
+
+#guide.dvi:	guide.txn texinfo.tex texindex
+#	tex guide.txn
+#	texindex guide.fn guide.cp
+#	tex guide.txn
+
+#guide.ps:	guide.dvi
+#	dvips -o guide.ps -r0 guide.dvi
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF) '; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+	chmod u+rw,g+rw,o=r $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/doc
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:

Added: packages/libhdf4/branches/upstream/current/mfhdf/doc/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/doc/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/doc/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,30 @@
+# Makefile for netCDF User's Guide and man(1)ual pages.
+#
+# $Id: Makefile.in_orig,v 1.1 1996/03/28 20:57:27 georgev Exp $
+
+MANUALS		= netcdf.3 netcdf.3f
+INFOS		= guide.info
+MANIFEST	= README Makefile.in \
+		  $(MANUALS) texindex.c udunits.dat guide.ps guide.txn \
+		  texinfo.tex 
+prefix		= ../../..
+GARBAGE		= $(INFOS) *.log *~ *.gs *.aux *.cp *.fn *.ky *.pg *.toc \
+		  *.tp *.vr
+PRINTER		= hpnp
+
+all::
+
+install::	installed_manuals
+
+guide.hc:	guide.ps
+	lpr -P$(PRINTER) guide.ps
+
+guide.dvi:	guide.txn texinfo.tex texindex
+	tex guide.txn
+	texindex guide.fn guide.cp
+	tex guide.txn
+
+guide.ps:	guide.dvi
+	dvips -o guide.ps -r0 guide.dvi
+
+include ../port/master.mk

Added: packages/libhdf4/branches/upstream/current/mfhdf/doc/README
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/doc/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/doc/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,14 @@
+This directory contains the TeX source for the netCDF User's Guide and
+a PostScript file for direct printing of the netCDF User's Guide on a
+PostScript printer.  It also contains reference documentation in the form
+of troff source for UNIX man pages, using the -man macros.
+
+Makefile	installs man pages, prints User's Guide hard copy
+README		this file
+guide.ps	PostScript file of User's Guide, generated from guide.txn
+guide.txn	source for netCDF User's Guide, uses texinfo macros
+netcdf.3	troff source for C interface reference
+netcdf.3f	troff source for Fortran interface reference
+texindex.c	GNU program for generating TeX index
+texinfo.tex	TeX macros needed by guide.txn
+udunits.dat	example of units file, used by Unidata udunits library

Added: packages/libhdf4/branches/upstream/current/mfhdf/doc/guide.ps
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/doc/guide.ps	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/doc/guide.ps	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,9462 @@
+%!PS (but not EPSF because of memory limits)
+%%Creator: dvips by Radical Eye Software
+%%Title: guide.dvi
+%%Pages: 194 1
+%%BoundingBox: 0 0 612 792
+%%EndComments
+%%BeginDocument: texc.pro
+/TeXDict 200 dict def TeXDict begin /bdf{bind def}def /@rigin{72 Resolution
+div dup neg scale translate}bdf /@letter{Resolution dup -10 mul @rigin}bdf
+/@landscape{[0 1 -1 0 0 0]concat Resolution dup @rigin}bdf /@a4{Resolution dup
+-10.6929133858 mul @rigin}bdf /@legal{Resolution dup -13 mul @rigin}bdf
+/@manualfeed{statusdict /manualfeed true put}bdf /@copies{/#copies exch def}
+bdf /@FontMatrix[1 0 0 -1 0 0]def /@FontBBox[0 0 0 0]def /dmystr(ZZf@@@)def
+/newname{dmystr cvn}bdf /df{/fontname exch def dmystr 2 fontname cvx(@@@@)cvs
+putinterval newname 7 dict def newname load begin /FontType 3 def /FontMatrix
+ at FontMatrix def /FontBBox @FontBBox def /BitMaps 256 array def /BuildChar{
+CharBuilder}def /Encoding IdentityEncoding def end fontname{/foo setfont}2
+array copy cvx def fontname load 0 dmystr 6 string copy cvn cvx put}bdf /dfe{
+newname dup load definefont setfont}bdf /ch-image{ch-data 0 get}bdf /ch-width{
+ch-data 1 get}bdf /ch-height{ch-data 2 get}bdf /ch-xoff{ch-data 3 get}bdf
+/ch-yoff{ch-data 4 get}bdf /ch-dx{ch-data 5 get}bdf /CharBuilder{save 3 1 roll
+exch /BitMaps get exch get /ch-data exch def ch-data null ne{ch-dx 0 ch-xoff
+ch-yoff neg ch-xoff ch-width add ch-height ch-yoff sub setcachedevice ch-width
+ch-height true[1 0 0 -1 -.1 ch-xoff sub ch-height ch-yoff sub .1 add]/id
+ch-image def /rw ch-width 7 add 8 idiv string def /rc 0 def /gp 0 def /cp 0
+def{rc 0 ne{rc 1 sub /rc exch def rw}{G}ifelse}imagemask}if restore}bdf /G{{
+id gp get /gp gp 1 add def dup 18 mod exch 18 idiv pl exch get exec}loop}bdf
+/adv{cp add /cp exch def}bdf /chg{rw cp id gp 4 index getinterval putinterval
+dup gp add /gp exch def adv}bdf /nd{/cp 0 def rw exit}bdf /lsh{rw cp 2 copy
+get dup 0 eq{pop 1}{dup 255 eq{pop 254}{dup dup add 255 and exch 1 and or}
+ifelse}ifelse put 1 adv}bdf /rsh{rw cp 2 copy get dup 0 eq{pop 128}{dup 255 eq
+{pop 127}{dup 2 idiv exch 128 and or}ifelse}ifelse put 1 adv}bdf /clr{rw cp 2
+index string putinterval adv}bdf /set{rw cp fillstr 0 4 index getinterval
+putinterval adv}bdf /fillstr 18 string 0 1 17{2 copy 255 put pop}for def /pl[{
+adv 1 chg}bind{adv 1 chg nd}bind{1 add chg}bind{1 add chg nd}bind{adv lsh}
+bind{adv lsh nd}bind{adv rsh}bind{adv rsh nd}bind{1 add adv}bind{/rc exch def
+nd}bind{1 add set}bind{1 add clr}bind{adv 2 chg}bind{adv 2 chg nd}bind{pop nd}
+bind]def /dc{/ch-code exch def /ch-data exch def newname load /BitMaps get
+ch-code ch-data put}bdf /bop{gsave /SaveImage save def 0 0 moveto}bdf /eop{
+clear SaveImage restore showpage grestore}bdf /@start{/Resolution exch def
+/IdentityEncoding 256 array def 0 1 255{IdentityEncoding exch 1 string dup 0 3
+index put cvn put}for}bdf /p{show}bdf /RuleMatrix[1 0 0 -1 -.1 -.1]def
+/BlackDots 8 string def /v{gsave currentpoint translate false RuleMatrix{
+BlackDots}imagemask grestore}bdf /a{moveto}bdf /delta 0 def /tail{dup /delta
+exch def 0 rmoveto}bdf /b{exch show tail}bdf /c{show delta 4 sub tail}bdf /d{
+show delta 3 sub tail}bdf /e{show delta 2 sub tail}bdf /f{show delta 1 sub
+tail}bdf /g{show delta 0 rmoveto}bdf /h{show delta 1 add tail}bdf /i{show
+delta 2 add tail}bdf /j{show delta 3 add tail}bdf /k{show delta 4 add tail}
+bdf /l{show -4 0 rmoveto}bdf /m{show -3 0 rmoveto}bdf /n{show -2 0 rmoveto}
+bdf /o{show -1 0 rmoveto}bdf /q{show 1 0 rmoveto}bdf /r{show 2 0 rmoveto}bdf
+/s{show 3 0 rmoveto}bdf /t{show 4 0 rmoveto}bdf /w{0 rmoveto}bdf /x{0 exch
+rmoveto}bdf /y{3 2 roll show moveto}bdf /bos{/section save def}bdf /eos{clear
+section restore}bdf end
+%%EndDocument
+TeXDict begin 300 @start bos /fa df[<1203A25A5A123F12F712471207AEEA7FF0A2>12
+23 4 0 20]49 dc[<EA01C0487EA21360A2EA0770A4EA0630EA0E38A5EA1FFCA2EA1C1CA2EA3C
+1EEA380E38FE3F80A2>17 23 1 0 20]65 dc[<EAFFF013FCEA381E130E1307A4130E131EEA3F
+FCA2EA381E130E1307A5130E131EEAFFFC13F8>16 23 1 0 20]66 dc[<EA03C6EA0FFEEA1C3E
+EA181E1238EA700EA21260EAE000A7EA600E1270A2EA380CEA181CEA1C38EA0FF0EA03C0>15 23
+2 0 20]67 dc[<EAFFE013F8EA383C7F130E7FA3EB0380A8EB0700A2130E131E5BEAFFF813E0>
+17 23 1 0 20]68 dc[<B5FCA2EA3807A490C7FCA21370A2EA3FF0A2EA3870A290C7FCA3EB0380
+A4B5FCA2>17 23 1 0 20]69 dc[<B5FCA2EA3807A41300A21370A2EA3FF0A2EA3870A21300A7
+B4FCA2>16 23 2 0 20]70 dc[<EA03C6EA0FFEEA1C3EEA181E1238EA700EA21260EAE000A413
+7FA2130E12601270A2EA381E1218EA1C3EEA0FFEEA03CE>16 23 1 0 20]71 dc[<EAFFF8A2EA
+0700B3EAFFF8A2>13 23 3 0 20]73 dc[<B4FCA21238AF1307A4B5FCA2>16 23 2 0 20]76 dc
+[<38FE0FE0A2003E1380EA3B1BA413BBA2EA39B3A313F3EA38E3A21303A638FE0FE0A2>19 23 0
+0 20]77 dc[<38FE3F80A2383E0E00123BA4138E1239A213CEA31238A213EE136EA4133E12FEA2
+>17 23 1 0 20]78 dc[<EA1FF0EA7FFCEA783CEA701CEAE00EAFEA701CEA783CEA7FFCEA1FF0>
+15 23 2 0 20]79 dc[<EAFFF013FCEA381E130E1307A5130E131EEA3FFC13F0EA3800A812FEA2
+>16 23 1 0 20]80 dc[<EA1FF0EA7FFCEA783CEA701CEAE00EADEAE38EEAE1CEEA71DCEA78FC
+127FEA1FF0EA00781338133C131C131E>15 28 2 5 20]81 dc[<EAFFE013F8EA383C131C7FA4
+5B133CEA3FF85BEA38387FA51480EB1DC0A238FE0F80EB0700>18 23 1 0 20]82 dc[<EA0FCC
+EA1FFCEA307CEA603CEAE01CA313001270127EEA3FE0EA0FF0EA01F8EA001C131E130E126012E0
+A2EAF01CEAF838EAFFF0EAC7E0>15 23 2 0 20]83 dc[<387FFF80B5FCEAE1C3A43801C000AF
+EA0FF8A2>17 23 1 0 20]84 dc[<38FC1F80A238380E00A36C5AA56C5AA4EA0630EA0770A3EA
+0360A213E0A26C5A>17 23 1 0 20]86 dc[<38FE3F80A238380E00EA3C1EEA1C1CEA1E3CEA0E
+38A26C5AA2EA036013E0A26C5AA8EA07F0A2>17 23 1 0 20]89 dc[<EA1FC0EA7FF0EA7078EA
+2018EA001CA2EA07FC121FEA3C1C127012E0A3EA707C383FFF80EA0F8F>17 16 2 0 20]97 dc[
+<12FCA2121CA513F8EA1DFEEA1F07EA1E03001C1380EB01C0A6EB0380001E1300EA1F0EEA1DFC
+EA0CF8>18 23 0 0 20]98 dc[<EA03F8EA0FFCEA1C1CEA3808EA7000126012E0A412601270EA
+380EEA1C1EEA0FFCEA03F0>15 16 2 0 20]99 dc[<137EA2130EA5EA07CEEA0FFEEA1C3EEA30
+1EEA700E12E0A61270EA301EEA383E381FEFC0EA07CF>18 23 1 0 20]100 dc[<EA07E0EA0FF0
+EA1C38EA301CEA700CEAE00EA2EAFFFEA2EAE00012601270EA380EEA1C1EEA0FFCEA03F0>15 16
+2 0 20]101 dc[<137C13FEEA01CEEA03841380A3EA7FFE12FFEA0380ACEA7FFCA2>15 23 1 0
+20]102 dc[<EA07CF381FFF80EA383B38301800EA701CA3EA3018EA3838EA3FF0EA37C00070C7
+FCA2EA3FF86C7E487EEA700F38E00380A438700700EA3C1EEA1FFCEA07F0>17 25 1 9 20]103
+dc[<1203EA0780A2EA0300C7FCA4EA7F80A21203ACEAFFFCA2>14 24 3 0 20]105 dc[<EAFF80
+A21203B3EAFFFEA2>15 23 2 0 20]108 dc[<EAFB8EEAFFDF383CF380A2EA38E3AA38FEFBE013
+79>19 16 0 0 20]109 dc[<EAFC78EAFDFEEA1F86EA1E07121CAA38FF8FE0A2>19 16 0 0 20]
+110 dc[<EA07C0EA1FF0EA3C78EA701CA2EAE00EA6EA701CEA783CEA3C78EA1FF0EA07C0>15 16
+2 0 20]111 dc[<EAFCF8EAFDFEEA1F07EA1E03001C1380EB01C0A6EB0380001E1300EA1F0EEA
+1DFCEA1CF890C7FCA6B47EA2>18 24 0 8 20]112 dc[<EA03CEEA0FFEEA1C3EEA301EEA700E12
+E0A61270EA301EEA1C3EEA0FEEEA07CEEA000EA6EB7FC0A2>18 24 1 8 20]113 dc[<EAFE1FEB
+7F80EA0EE3380F810090C7FCA2120EA8EAFFF0A2>17 16 1 0 20]114 dc[<EA0FD8EA3FF8EA60
+3812C0A2EAF000EA7F80EA3FF0EA07F8EA001CEA600612E012F0EAF81CEAFFF8EACFE0>15 16 2
+0 20]115 dc[<12035AA4EA7FFC12FFEA0700A8130EA3130CEA03FCEA00F0>15 21 1 0 20]
+116 dc[<EAFC3FA2EA1C07AB131F380FFFE0EA03E7>19 16 0 0 20]117 dc[<38FE3F80A2381C
+1C00A46C5AA3EA0630EA0770A36C5AA3>17 16 1 0 20]118 dc[<38FE3F80A2381C1C00A3120E
+5BA212071330A2EA0370A26C5AA35BA3485A12730077C7FC127E123C>17 24 1 8 20]121 dc
+dfe /fb df[<126012F0A21260>4 4 3 0 11]58 dc dfe /fc df[<126012F0A212701210A312
+20A212401280>4 11 3 7 11]44 dc[<EA0780EA1860EA3030A2EA6018A2EAE01CACEA6018A2EA
+7038EA3030EA1860EA0780>14 24 2 0 19]48 dc[<12035AB4FC1207B3A2EAFFF0>12 24 3 0
+19]49 dc[<EA0F80EA1060EA2030EA4038EA803CEAC01C12E01240EA003C1338A21370136013C0
+EA018013001202EA040412081210EA3008EA3FF8127F12FF>14 24 2 0 19]50 dc[<EA0F80EA
+10E0EA2070EA6078EA70381220EA00781370A2136013C0EA0F80EA00E013701338133CA212E0A2
+12C0EA40381370EA30E0EA0F80>14 24 2 0 19]51 dc[<1330A2137013F0A2EA017012031202
+1204120C1208121012301220124012C0B5FCEA0070A6EA07FF>16 24 1 0 19]52 dc[<EA3018
+EA3FF013E013C0EA2000A5EA27C0EA3860EA2030EA00381318131CA2124012E0A2EA8018EA4038
+1330EA30E0EA0F80>14 24 2 0 19]53 dc[<EA01E0EA0610EA0C18EA18381230130012701260
+12E0EAE7C0EAE860EAF030131812E0131CA31260A2EA701812301330EA1860EA07C0>14 24 2 0
+19]54 dc[<1240EA7FFE13FCA2EA4008EA8010A21320EA0040A213801201A213005AA45AA61202
+>15 25 2 0 19]55 dc[<EA0780EA1860EA3030EA20181260A3EA7010EA3C30EA3E60EA0F80EA
+07C0EA19F0EA30F8EA6038EA401CEAC00CA4EA6008EA2010EA1860EA0FC0>14 24 2 0 19]56
+dc[<EA0780EA1860EA30301270EA601812E0A2131CA31260133C1230EA185CEA0F9CEA001C1318
+A21338EA70301360EA6040EA2180EA1F00>14 24 2 0 19]57 dc[<130CA3131EA2133F1327A2
+EB4380A3EB81C0A348C67EA213FF38020070A20006137800041338A2487FA2001C131EB4EBFFC0
+>26 26 1 0 29]65 dc[<B5FC380E01C0EB00E014701478A514F014E0EB03C0380FFF80380E01
+E0EB00701478143CA51438147814F0EB01E0B51280>22 26 2 0 27]66 dc[<EB3F023801C0C6
+3803002E000E131E48130E14065A007813021270A200F01300A600701302A21278003813047E14
+087E000313303801C0C038003F00>23 26 2 0 28]67 dc[<B5FC380E01C0EB00E01430143814
+1CA2140EA2140FA8140EA2141E141C1438A21470EB01C0B51200>24 26 2 0 29]68 dc[<B512
+F0380E00701430141014181408A3EB0400A3130CEA0FFCEA0E0C1304A3EB0004A21408A3141814
+381470B512F0>22 26 2 0 26]69 dc[<B512E0EA0E001460142014301410A3EB0400A3130CEA
+0FFCEA0E0C1304A390C7FCA8EAFFF0>20 26 2 0 25]70 dc[<EB3F023801C0C63803002E000E
+131E48130E14065A007813021270A200F090C7FCA5903801FFC03970000E00A2127812387EA27E
+000313163801C06638003F82>26 26 2 0 30]71 dc[<38FFE7FF380E0070AB380FFFF0380E00
+70AC38FFE7FF>24 26 2 0 29]72 dc[<EAFFE0EA0E00B3A6EAFFE0>11 26 1 0 14]73 dc[<EA
+FFF0000EC7FCB01420A314601440A214C01303B5FC>19 26 2 0 24]76 dc[<B4EB03FC000F14
+C0A2380B8005A33809C009A33808E011A3EB7021A2EB3841A3EB1C81A3EB0F01A31306121C39FF
+861FFC>30 26 2 0 35]77 dc[<38FE01FF380F00381410EA0B80A2EA09C0EA08E0A21370A213
+38131CA2130EA21307EB0390A2EB01D0A2EB00F01470A21430121C38FF8010>24 26 2 0 29]
+78 dc[<137F3801C1C038070070000E7F487F003C131E0038130E0078130F00707F00F01480A8
+0078EB0F00A20038130E003C131E001C131C6C5B6C5B3801C1C0D8007FC7FC>25 26 2 0 30]
+79 dc[<B5FC380E03C0EB00E01470A21478A41470A214E0EB03C0380FFF00000EC7FCABEAFFE0>
+21 26 2 0 26]80 dc[<EAFFFC380E0780EB01C06D7E80A55C495AEB0780D80FFCC7FCEA0E067F
+6D7E80A380A31580EB00F0EC710038FFE03E>25 26 2 0 28]82 dc[<EA0FC2EA1836EA200EEA
+600612C01302A3EAE0001270127EEA3FE0EA1FF8EA07FCEA003E130E130713031280A3EAC00213
+06EAE004EAD818EA87E0>16 26 2 0 21]83 dc[<007FB5FC38701C0700401301A200C0148000
+801300A300001400B13803FFE0>25 26 1 0 28]84 dc[<38FFE1FF380E00381410B200061320
+12076C1340EA01803800C180EB3E00>24 26 2 0 29]85 dc[<39FF801FC0391E000F00001C13
+066C1304A26C5BA36C6C5AA2EBC03000011320A26C6C5AA3EB7080A20139C7FCA3131EA3130CA2
+>26 26 1 0 29]86 dc[<3AFF83FF0FF03A3C007801C0001CEC0080A26CEC0100A2149C6C1402
+A2EB010EA2D803815BEB8207A2D801C25B9038C40388A2D800E41390A29038E801D0017813E0A2
+EB7000A201305B01201340>36 26 1 0 39]87 dc[<387FC0FF380F003C6C1330EB8020000313
+603801C0406D5AEA00E10171C7FC137A133C131C131EA21317EB27801343EB41C0EB81E0EA0100
+147000021378481338000C7F001E133E39FF80FFC0>26 26 1 0 29]88 dc[<39FF801FE0391E
+000700000E1306000F13046C5B13806C6C5A00011330EBE0206C6C5A1370EB78801338011DC7FC
+131F130EAAEBFFE0>27 26 1 0 29]89 dc[<EA07F8EA0C1C1238EA3008EA70005AA61270EA30
+04EA3808EA0C18EA07E0>14 16 1 0 17]99 dc[<137E130EA9EA03CEEA0C3EEA380E12301270
+12E0A612601270EA381EEA1C2E3807CFC0>18 26 1 0 21]100 dc[<EA07C0EA1C30EA30181270
+EA600C12E0EAFFFCEAE000A41260EA3004EA3808EA0C18EA07E0>14 16 1 0 17]101 dc[<EAFC
+F8EA1D0CEA1E0EA2121CAB38FF9FC0>18 16 1 0 21]110 dc[<EA07E0EA1C38EA300CEA700EEA
+6006EAE007A6EA6006EA700EEA381CEA1C38EA07E0>16 16 1 0 19]111 dc[<EAFCF8EA1F0EEA
+1E07381C0380A2EB01C0A6EB03801400EA1E07EA1F0CEA1CF090C7FCA6B47E>18 23 1 7 21]
+112 dc[<EAFCE0EA1D70121E1320EA1C00ABEAFFC0>12 16 1 0 15]114 dc[<EA1F20EA60E0EA
+402012C0A2EAF000127FEA3FC0EA1FE0EA00F0EA8070133012C01320EAF040EA8F80>12 16 1 0
+15]115 dc[<1204A3120CA2121C123CEAFFC0EA1C00A81320A5EA0E40EA0380>11 23 1 0 15]
+116 dc[<EAFC7EEA1C0EAC131EEA0C2E3807CFC0>18 16 1 0 21]117 dc[<38FF1F80383C0600
+EA1C04A2EA1E0CEA0E08A26C5AA21390EA03A0A2EA01C0A36C5AA248C7FCA212E112E212E41278
+>17 23 1 7 20]121 dc dfe /fd df[<120C121C12EC120CAFEAFFC0>10 19 3 0 17]49 dc[<
+121FEA60C01360EAF07013301260EA0070A2136013C012011380EA02005AEA08101210EA2020EA
+7FE012FF>12 19 2 0 17]50 dc dfe /fe df[<903903FC0FE090391FFF3FF890397E03FC783A
+01F807F0FC3803F00F15E0D807E0147802071300A7B71280A23A07E007E000B3A2397FFE7FFFA2
+>38 38 1 0 36]11 dc[<EB03FCEB3FFEEB7E073901F80F803803F01F13E01207A3EC060091C7
+FCA3ECFFC0B6FCA23807E00FB3A2397FFC7FFCA2>30 38 1 0 34]12 dc[<123C127E12FFA412
+7E123C>8 8 4 0 17]46 dc[<131C133C13FC12FFA21200B3AA387FFFFCA2>22 35 4 0 31]49
+dc[<48B4FC000713C0381E07F0383803F8386001FC387C00FE12FE14FF147FA2127C003813FFC7
+FC14FEA2EB01FC14F8EB03F0EB07E01480EB0F00131E5B1370EBE003EA01C03803800738070006
+1206380FFFFE5A5A4813FCB5FCA2>24 35 3 0 31]50 dc[<48B4FC000713E0381E03F0383801
+F8003C13FC387E00FEA3123EEA1C01000013FCA2EB03F8EB07F0EB0FC03801FF00A2380007E0EB
+01F014F8EB00FC14FE14FFA21210127C12FEA214FEA2387C01FC007013F8383E07F0380FFFC000
+011300>24 35 3 0 31]51 dc[<141CA2143EA3147FA24A7EA39038019FC0A29038031FE0140F
+A290380607F0A2010C7F1403011C7FEB1801A201307F1400017FB5FCA2903860007F496D7EA200
+018149131FA248C76C7EA2486C8026FFF801B51280A2>41 37 2 0 46]65 dc[<9138FF800801
+0FEBF01890393FC03C789039FE0006F8D801F81303484813014848130048481478121F48481438
+A2007F151890C8FCA2481500A97E16187F123FA26C6C1430120F6C6C14606C6C14C06C6CEB0180
+D800FEEB070090383FC01E90380FFFF8010013C0>37 37 3 0 44]67 dc[<B612E015FC3903F8
+00FFED1FC0ED07E06F7E6F7E82150082A2167FA31780AA1700A316FEA24B5A5E4B5A4B5AED1FC0
+EDFF80B648C7FC15E0>41 37 2 0 47]68 dc[<B67E15F83903F801FEEC007F6F7E6F7EA282A5
+5EA24B5A4BC7FCEC01FE90B512F815C09038F803F06E7E6E7E157EA2157FA482A31760ED3FC017
+C0ED1FE1B539E00FFF80923801FE00>43 37 2 0 46]82 dc[<01FF1380000713E3380F80F738
+1E001F48130F481307140312F81401A27E91C7FCB4FCEA7FE013FF6C13E014F86C13FE00077F6C
+1480C67E010313C0EB003FEC0FE01407A200C01303A315C07E6C13076C14806CEB0F0038FFC03E
+38E3FFF838803FE0>27 37 3 0 34]83 dc[<B539E00FFFC0A2D803F8C7EA78001630B3A70001
+5D7F00005D137C6D495A6D0107C7FC90380FE03E903803FFF89038007FC0>42 37 2 0 47]85
+dc[<B539C003FFE0A2D807F8C7EA3C00000315187F00015DA26D1470000015606D14E06D5C8001
+3F495AA26D6C48C7FCA26E5A010F130614F001075B14F801035BA2ECFC3801011330ECFE700100
+136014FF6E5AA26E5AA36EC8FCA2140EA2>43 37 1 0 46]86 dc[<EA07FF001F13C0383E03E0
+383F01F0806D7E121EC7FCA3133FEA03FCEA0FC0EA3F00127EA25AA3EB017C127EEA3F06391FFC
+3FE03807F01F>27 24 2 0 30]97 dc[<EAFFC0A2120FACEBC3F8EBCFFE9038F81F809038E00F
+C09038C007E0A2EC03F0A215F8A815F0A2EC07E015C0EBE00F9038383F00380E1FFE380C07F0>
+29 38 2 0 34]98 dc[<EB7FE03803FFF83807C07C381F80FC13005A007E1378140012FEA8127E
+127F6C130CEA1F80EBC0183807E0703803FFE038007F00>22 24 2 0 27]99 dc[<903801FF80
+A2EB001FAC137F3803FFDF3807E0FF381F803F383F001FA2127EA212FEA8127EA27E143F381F80
+7F380FC0FF3903FF9FF83800FE1F>29 38 2 0 34]100 dc[<137F3803FFC03807C1F0380F80F8
+EA1F0048137C127E147E12FEA2B512FEA248C7FCA3127EA214067E6C130C380F80183807E07038
+03FFE038007F80>23 24 2 0 28]101 dc[<EB0FC0EB7FF013F83801F1F8120313E13807E0F014
+00A7B5FCA2EA07E0B3A2EA7FFFA2>21 38 2 0 19]102 dc[<3901FF07C00007EBDFE0380F83F1
+EA1F01393E00F800007E7FA6003E5B6C485A380F83E0EBFFC0001190C7FC0030C8FCA21238123C
+383FFFE06C13FC806C7F481480383C003F48EB0FC000F81307A4007CEB0F806CEB1F00381F807E
+3807FFF8C613C0>27 36 2 12 31]103 dc[<EAFFC0A2120FACEBC1F8EBC7FEEBCC3FEBD01F01
+F0138013E0A213C0AF39FFFCFFF8A2>29 38 3 0 34]104 dc[<120FEA1F80EA3FC0A4EA1F80EA
+0F00C7FCA7EAFFC0A2120FB3A2EAFFF8A2>13 39 2 0 17]105 dc[<EAFFC0A2120FB3B0EAFFFC
+A2>14 38 2 0 17]108 dc[<3AFF81FC01FC903987FF07FF3B0F8C1F8C1F809039980F980F01B0
+01F013C001A013E0A201C013C0AF3BFFFCFFFCFFFCA2>46 24 3 0 51]109 dc[<38FF81F8EB87
+FE380F8C3FEB901F01B0138013A0A213C0AF39FFFCFFF8A2>29 24 3 0 34]110 dc[<EB7F8038
+03FFF03807C0F8381F807E48487EA2007EEB1F80A200FE14C0A8007E1480A26CEB3F00A2381F80
+7E6C6C5A3803FFF038007F80>26 24 2 0 31]111 dc[<38FFC3F8EBCFFE390FF83F809038E00F
+C001C013E0140715F0140315F8A8EC07F0A215E0EC0FC0EBE01F9038F83F00EBDFFEEBC7F001C0
+C7FCA9EAFFFCA2>29 35 2 11 34]112 dc[<38FF87C0EB8FF0380F98F813B113A1A2EBE0F0EB
+C000AFEAFFFEA2>21 24 2 0 25]114 dc[<3807F980EA1FFFEA3C0FEA7003EAF001A300FCC7FC
+B47EEA7FFC7F383FFF80000F13C0120338001FE01303EAC001A212E014C0EAF00338FC078038EF
+FF00EAC3FC>19 24 2 0 24]115 dc[<1360A413E0A21201A212031207121FB512C0A23807E000
+AC1460A6000313C013F03801FF8038007E00>19 35 1 0 24]116 dc[<39FFC1FF80A2380FC01F
+B0143FA20007137FEBE0DF3903FF9FF83800FE1F>29 24 3 0 34]117 dc[<39FFF80FF8A2390F
+C003C09038E001800007EB0300A23803F006A2EBF80E0001130CEBFC1C0000131813FEEB7E30A2
+6D5AA26D5AA36D5AA26DC7FCA2>29 24 1 0 32]118 dc[<3BFFF9FFE0FF80A23B1FC03F001C00
+000F6D13181580D807E05CA201F0EBC070000301371360A23A01F877E0C0146301FC13F1000001
+C15BA2017F01FBC7FC148015FF90383F007EA26D137C011E133CA2010C1318>41 24 1 0 44]
+119 dc[<39FFF80FF8A2390FC003C09038E001800007EB0300A23803F006A2EBF80E0001130CEB
+FC1C0000131813FEEB7E30A26D5AA26D5AA36D5AA26DC7FCA21306A25B1230EA781CEAFC181338
+5BEA78E0EA7FC0001FC8FC>29 35 1 11 32]121 dc dfe /ff df[<127012F8A31270>5 5 4 0
+13]58 dc dfe /fg df[<EAFFC0A4>10 4 1 -8 15]45 dc[<1238127C12FEA3127C1238>7 7 3
+0 13]46 dc[<EA3803EA3FFF5B5B5B13E090C7FC1230A4EA33F0EA37FCEA3C1EEA380F00101380
+120014C0A2127812FCA31480127838601F00EA383EEA1FFCEA07E0>18 29 2 0 23]53 dc[<13
+FCEA03FEEA0783380F0F80EA1E1F123E123C127CEB0F0090C7FC12FCEAFDFCB47EEAFE0F148012
+FC14C0A5127CA21480123C003E1300EA1E1EEA0FFCEA03F0>18 29 2 0 23]54 dc[<EA03F0EA
+0FFCEA1E1EEA380FEB07801278A2127C127E387F0F00EA3FCE13FC6C5AEA0FFE7F5A383C7F8038
+783FC0EA700FEAF0071303A314801278EB0700EA3E0EEA1FFCEA07F0>18 29 2 0 23]56 dc[<
+1238127C12FEA3127C12381200A61238127C12FEA3127C1238>7 20 3 0 13]58 dc[<90381FC0
+409038FFF1C03803F81F3807E00F380FC007381F8003383F0001A25A007E1300A212FE1500A800
+7E14C0A2127F7EEC0180EA1F80390FC003003807E0063803F81C3800FFF8EB1FE0>26 31 3 0
+33]67 dc[<B512F014FC380FC07FEC1F80EC0FC0140715E0140315F0A315F8AA15F0A3EC07E015
+C0140FEC1F80EC7F00B512FC14F0>29 31 2 0 35]68 dc[<B512FCA2380FC07C141C140CA214
+0E1406A213C3A21400A213C713FFA213C713C3A413C0A8EAFFFEA2>23 31 2 0 28]70 dc[<3B
+FFF87FFC3FF0A23B1FC00FC00380000F1600EC07E05ED807E01406EC0FF0A2D803F05CEC19F8A2
+D801F85CEC30FCA2D800FC5CEC607EA2017E5CECC03FA2013F5CEC801FA2011F5CA2EC000F6D91
+C7FCA2010E7F01061306>44 31 1 0 47]87 dc[<EA07F0EA1FFCEA3F1E131FEB0F80A2120C12
+0013FF120FEA1F0F127CA212F8A31317EA7C37383FE3F0EA0F81>20 20 1 0 22]97 dc[<EA03
+F0EA0FFCEA1E7E123E127CA2EAFC181300A7127CEA7E03123EEA1F0EEA0FFCEA03F0>16 20 2 0
+20]99 dc[<EB3FC0A21307AAEA03E7EA0FFFEA1F1FEA3E07127CA212FCA8127CA2EA3C0FEA1E1F
+380FF7F8EA07E7>21 32 2 0 25]100 dc[<EA03F8EA0FFEEA1F0F383E0780123C007C13C0A212
+FCB5FCA200FCC7FCA3127CA26C13C0A2381F03803807FF00EA01FC>18 20 1 0 21]101 dc[<13
+3F3801FF803803E7C0EA07CF138F120FEB8780EB8000A5EAFFF0A2EA0F80B0EA7FF8A2>18 32 1
+0 14]102 dc[<3803F0E0380FFDF0EA1E1EEA3C0F007C1380A5003C1300EA1E1EEA1FFCEA33F0
+0030C7FCA21238EA3FFEEBFF806C13C04813E0387803F0EA700012F0A4387801E0383E07C0381F
+FF803803FC00>20 30 1 10 23]103 dc[<B4FCA2121FAA131FEB3FC01363EB83E0A21303AD38
+FFE7FCA2>22 32 2 0 25]104 dc[<121C123E127FA3123E121CC7FCA6B4FCA2121FB0EAFFE0A2
+>11 33 1 0 12]105 dc[<B4FCA2121FB3AAEAFFE0A2>11 32 1 0 12]108 dc[<39FE0F80F890
+383FC3FC391E63E63E9038C1FC1FEB81F8381F01F0AD3AFFE7FE7FE0A2>35 20 2 0 38]109 dc
+[<EAFE1FEB3FC0EA1E63EB83E0A2EA1F03AD38FFE7FCA2>22 20 2 0 25]110 dc[<EA01F8EA0F
+FF381F0F80383E07C0387C03E0A300FC13F0A7007C13E0A2383E07C0381F0F80380FFF00EA03FC
+>20 20 1 0 23]111 dc[<EAFF3FEBFF80381FC7C0EB03E014F0130114F8A814F0130314E0EBC7
+C0EBFF80EB3E0090C7FCA7EAFFE0A2>21 29 1 9 25]112 dc[<EAFE7813FEEA1EBF121F133FA2
+130C1300ABEAFFF0A2>16 20 1 0 19]114 dc[<EA1FB0EA3FF0EA7070EAE030A3EAF000B4FCEA
+7FC0EA3FE0EA1FF0EA07F8EA0078EAC038A212E0A2EAF070EAFFE0EACF80>13 20 2 0 18]115
+dc[<1203A45AA25AA2123FEAFFF8A2EA1F00AA1318A5EA0F30EA07F0EA03E0>13 29 1 0 18]
+116 dc[<38FF1FE0A2EA1F03AE1307EA0F0F3807FBFCEA03F3>22 20 2 0 25]117 dc[<38FFE7
+F8A2381F00C0A2380F8180A213833807C300A2EA03E6A3EA01FCA36C5AA21370A3>21 20 1 0
+24]118 dc[<39FFCFF1FCA2391F03C060A2EB07E0D80F8713C0A2EB8FF03907CCF180A2EBDCF9
+3903F87B00A2147F3801F03EA33800E01CA2EBC00C>30 20 1 0 33]119 dc[<38FFE7F8A2381F
+00C0A2380F8180A213833807C300A2EA03E6A3EA01FCA36C5AA21370A31360A21278EAFCC0A2EA
+C18012E3007FC7FC123C>21 29 1 9 24]121 dc dfe /fh df[<903803F0F890381C0B8C9038
+381E1EEB703C01E0131CEC18003801C038A548485A007FB512803903807000A448485AA6380E01
+C0A648485A001E7F38FF0FF8>31 32 2 0 26]11 dc[<EB03E0EB1C181338EB703C13E0143838
+01C000A5485A387FFFF038038070A4380700E0A6380E01C0A6381C0380001E13C038FF0FF8>22
+32 2 0 25]12 dc[<EB03F4EB1C1CEB383C137013E01438EA01C0A538038070387FFFF0380380
+70A4380700E0A6380E01C0A6381C0380001E13C038FF9FF8>22 32 2 0 25]13 dc[<1238127C
+A2127E123A1204A31208A21210122012401280>7 14 8 -18 13]39 dc[<130313041308131013
+20136013C0EA018013005A1206A25AA2121C1218A212381230A21270A21260A412E0A61260A57E
+A2121012181208120C12047E7E>16 46 4 12 18]40 dc[<138013C01360132013301318A2130C
+A3130E1306AB130EA3130CA2131C1318A213381330A21360A213C0A2EA018013005A12065A5A5A
+5A1280>15 46 1 12 18]41 dc[<121C123E127EA2123A1202A21204A21208A21210122012C0>
+7 14 3 9 13]44 dc[<EAFFC0A2>10 2 3 -9 15]45 dc[<1230127812F812781270>5 5 4 0
+13]46 dc[<1404140CA21418A21430A21460A214C0A2EB0180A2EB0300A21306A25BA25BA25BA2
+5BA25BA2485AA248C7FCA21206A35AA25AA25AA25AA25AA25A>22 45 2 11 23]47 dc[<130C13
+1C13FCEA0F381200A51370A613E0A6EA01C0A6EA038013C0EAFFFE>15 30 4 0 23]49 dc[<EB
+3F80EBC1E0380100F0000213785AA2000F137C1380A2EB00781206C712F814F0EB01E014C0EB03
+80EB0700130E5B5B13605B485A380300201206000813405A383FFFC0481380B5FC>22 30 2 0
+23]50 dc[<120E121FA2121E120C1200AA1230127812F812781270>8 20 4 0 13]58 dc[<001F
+B512F84814FCC9FCA8B612F06C14E0>30 12 4 -5 35]61 dc[<141014181438A21478A214FCEB
+01BC143C130313021304143EEB081EA21310A21320801340A290B5FCEB800FD801001380140712
+02A25AA2000C14C0123E39FF807FFC>30 32 2 0 34]65 dc[<903801F80890380E0618903838
+013890387000F8484813784848137048481330A248C7FC5A121E003E1420003C1400127CA45AA5
+007814401580A27EEC0100001C13027E0006130C6C13103801C0E0D8003FC7FC>29 33 5 1 33]
+67 dc[<0007B5FC39007C01E090383C00F0157849133CA2151EA3151F5BA64848131E153EA315
+3C157C4848137815F0A2EC01E0EC03C0EC07803907800F00143CB512E0>32 31 2 0 35]68 dc[
+<0007B512F839007C0078013C133815185B1508A414089038F01000A31430EBFFF0EBF0703801
+E020A4EC00081510485AA21520A2156015C0380780011407B61280>29 31 2 0 31]69 dc[<00
+07B512F839007C0078013C133815185B1508A59038F01000A314301470EBFFF03801E0601420A4
+91C7FC485AA6485A7FEAFFFE>29 31 2 0 30]70 dc[<903801FC0490380F030C90383C009C01
+70137C49133C4848133848481318120748C7FC5A121E003E1410003C1400127CA45AA2EC7FFCEC
+03E000781301A2EC03C0A27EA2121C6C13076CEB0B80380380113801E06039003F8000>30 33 5
+1 36]71 dc[<3A07FFC7FFC03A007C00F800013C1378A2495BA649485AA490B5FCEBF001484848
+5AA64848485AA6484848C7FC01C07F39FFF8FFF8>34 31 2 0 34]72 dc[<3807FFE038007C00
+133CA25BA65BA6485AA6485AA6485A7FEAFFFC>19 31 1 0 16]73 dc[<D807FCECFFC0D8007C
+ECF800013CEB0178A2014EEB02F0A21504A21508A20187EB11E0A21521A21541EB8380D8010349
+5AA2EC81031482EB01C214C400024A5A14C8A214D0EB00F0000613E04BC7FC000F01C07F3AFFE0
+C1FFF8>42 31 2 0 42]77 dc[<3A07FC01FFC03A003E003E001518A2014F1310A2EB4780A2EB
+43C0A201835BEB81E0A2EB80F0A21478D801005B147C143CA2141EA200026D5AA31407A2000613
+0392C7FC000F7FEAFFE0>34 31 2 0 34]78 dc[<EB03F8EB1E0EEB38079038E003803901C001
+C0000314E03807800048C712F0A2121E15F8123E123C127CA448EB01F0A4EC03E0127815C01407
+007C1480003CEB0F00141E6C131C000E5B6C13F03803C3C0D800FEC7FC>29 33 5 1 35]79 dc[
+<0007B5FC39007C03C090383C01E0EC00F05B15F8A415F0EBF00115E0EC03C0EC0780EC0F00EB
+FFF8D801E0C7FCA6485AA6485A7FEAFFFC>29 31 2 0 31]80 dc[<EB3F04EB60CC3801803C00
+03131C130048131800061308120EA31400120F7F13E0EA07FE3803FF806C13C038007FE0130713
+01130014F0A2004013E0A4006013C0EB0180EAE00300F81300EAC60CEA81F8>22 33 3 1 25]
+83 dc[<003FB512F0383C078000301430126039400F0010A212C01280A3D8001E1300A65BA65B
+A65B7F387FFFE0>28 31 6 0 33]84 dc[<39FFF003FE391F8000F86CC712601540A26D138000
+07130115001402A26D5A12035CA25C13E000015BA25CA26D5AEA00F191C7FC13F2A213FC137C13
+78A21370A21320>31 32 6 1 34]86 dc[<3A03FFC0FFC03A007F007E00013E1338011E133015
+20011F5B6D5B0281C7FCEB078214C6EB03C414E8EB01F0A2130080A2EB017CEB023C1304EB0C1E
+1308EB101F497E01407FEBC00701807F38010003000780381F800739FFE01FFE>34 31 1 0 34]
+88 dc[<EA07F8EA0C0CEA1E061307121C1200A3137FEA07C7EA1E07EA3C0E127800F01310A313
+1EEB2E2038784F40381F8780>20 20 3 0 23]97 dc[<1207123F120F7EA2120EA65A137CEA1D
+87381E0380381C01C0A2123814E0A5387003C0A2148013071400130EEAE81CEAC438EA83E0>19
+32 5 0 25]98 dc[<EA01FCEA0706EA0E0F121CEA380EEA7800127012F0A45AA4EAF002EA7004
+EA3008EA1830EA0FC0>16 20 4 0 20]99 dc[<1470EB03F013001470A214E0A6EB01C013F9EA
+0305EA0E03121CEA380138780380127012F0A438E00700A5EA700FEA301EEA186F380F8FE0>20
+32 4 0 25]100 dc[<13F8EA070EEA0E07121C383803801278127012F0A2B5FC00F0C7FC5AA46C
+5AEA7002EA3004EA1C18EA07E0>17 20 3 0 20]101 dc[<EB0780EB18C0EB31E01361EBE1C0EB
+C0001201A5485AEA7FF8EA0380A448C7FCA6120EA65A121EEAFFC0>19 32 2 0 14]102 dc[<14
+0EEB3E11EBE1A33801C1C2380381E0EA07801301120FA3380703C01480EB8700EA04FC48C7FCA2
+1218121CEA0FFF14C06C13E0381800F04813305A5AA3006013606C13C0381C0700EA07FC>24 31
+0 10 23]103 dc[<13E0120712011200A2485AA6485AEB8F80EB90E013A0EBC0601380000713E0
+1300A5380E01C0A6381C0380001E13C038FFCFF8>21 32 2 0 25]104 dc[<EA01C0EA03E0A213
+C0EA0180C7FCA6EA0380121F12071203A2EA0700A6120EA65A121EEAFF80>11 31 1 0 12]105
+dc[<13E0120712011200A2EA01C0A6EA0380A6EA0700A6120EA65A121EEAFFC0>11 32 1 0 12]
+108 dc[<390387C07C391F9861863907A072073903C03403EB80380007EB7807EB0070A5000EEB
+E00EA64848485A001EEBE01E3AFFCFFCFFC0>34 20 2 0 38]109 dc[<38038F80381F90E0EA07
+A03803C0601380000713E01300A5380E01C0A6381C0380001E13C038FFCFF8>21 20 2 0 25]
+110 dc[<13FCEA0387380E0180381C00C04813E0A24813F012F0A438E001E0A214C0130300F013
+8038700700EA380E6C5AEA07E0>20 20 3 0 23]111 dc[<EBE3E03807EC383800F01CEBE01E14
+0EEA01C0140FA53803801EA2141C143C14381470380740E0EB21C0EB1F0090C7FCA3120EA4121E
+EAFFC0>24 29 0 9 25]112 dc[<EA038E381FB380EA07C71203EB8300EA078090C7FCA5120EA6
+5A121EEAFFC0>17 20 2 0 18]114 dc[<EA01F2EA060EEA080612181302EA38041300121EEA1F
+E0EA0FF0EA03F8EA003CEA401C130CA212601318EAE010EAD060EA8FC0>15 20 2 0 18]115 dc
+[<1380EA0100A35A5A5A121EEAFFF8EA0E00A45AA65A1320A41340A2EA1880EA0F00>13 28 4 0
+18]116 dc[<381C0380EAFC1FEA3C07EA1C03A238380700A6EA700EA4131EA25BEA305E381F9F
+C0>18 20 5 0 25]117 dc[<38FF83F8381E00E0001C13C014807EEB01001302A2EA0F0412075B
+A25BEA039013A013E05B5B120190C7FC>21 20 4 0 24]118 dc[<39FF9FE1FC393C078070391C
+030060154014801580EA0E079038058100130914C21311380731C41321EB60C81340EB80F0A26C
+485A146000021340>30 20 4 0 33]119 dc[<381FF0FF3803C0780001137014403800E08013E1
+EB73001376133CA2131C132E134E1387EA0107380203801206380C01C0383C03E038FF07FC>24
+20 1 0 24]120 dc[<390FF83F803901E00E00EBC00C1408EA00E05C5CA26D5A13705CA20171C7
+FC1339133A133E133C133813181310A25BA25BEA70C0EAF08000F1C8FC12E2127C>25 29 0 9
+24]121 dc[<3807FFE01301000413C0380C038038080700130E485AC65A5BA25B485A38038080
+EA0700120E381C0100A2485AEA700EEAFFFE>19 20 1 0 20]122 dc dfe /fi df[<127012F8
+B012701200A5127012F8A31270>5 28 9 0 24]33 dc[<EA4010EAE038EAF078EAE038AAEA6030
+>13 14 5 -15 24]34 dc[<EA0306EA078FA6387FFFC0B512E0A26C13C0380F1E00A6387FFFC0
+B512E0A26C13C0381E3C00A6EA0C18>19 28 2 0 24]35 dc[<EA3803387C0780A2EAEE0F1400
+A25B131EA2133EEA7C3CA2EA387CEA0078A213F85B12015BA212035BA21207EB8380EB87C0120F
+EB0EE0A2121F121EA2123E383C07C0A238180380>19 36 2 4 24]37 dc[<EA01C0EA07E0487E
+EA0E70487EA4EB73F0A213E3000F1380EBC70013871307EA1F0E123FEA7B8EEA73DC12E1EAE0F8
+A2EB70701378EA70FC387FFFE0EA3FCF380F03C0>20 28 1 0 24]38 dc[<1238127CA2127E12
+3E120EA3121CA2123812F812F012C0>7 14 8 -14 24]39 dc[<137013F0EA01E0EA03C0EA0780
+EA0F00121E121C5AA25AA45AA81270A47EA27E121E7EEA0780EA03C0EA01F012001370>12 36 7
+4 24]40 dc[<126012F012787E7E7EEA07801203EA01C0A2EA00E0A41370A813E0A4EA01C0A2EA
+03801207EA0F00121E5A5A5A1260>12 36 4 4 24]41 dc[<EA01C0A438C1C180EAF1C7EAF9CF
+387FFF00EA1FFCEA07F0A2EA1FFCEA7FFF38F9CF80EAF1C7EAC1C13801C000A4>17 20 3 -4 24
+]42 dc[<136013F0A7387FFFC0B512E0A26C13C03800F000A71360>19 20 2 -4 24]43 dc[<12
+1C123E127E127F123F121F1207120E121E127C12F81260>8 12 8 6 24]44 dc[<EA7FFFB51280
+A26C1300>17 4 3 -12 24]45 dc[<1230127812FCA212781230>6 6 9 0 24]46 dc[<1303EB
+0780A2130F14005B131EA2133E133C137C1378A213F85B12015B12035BA212075B120F90C7FCA2
+5A121E123E123CA2127C127812F85AA21260>17 36 3 4 24]47 dc[<EA01F0EA07FC487EEA1F
+1FEA1C0738380380007813C0EA7001A238E000E0A9EAF001007013C0A2EA780300381380381C07
+00EA1F1FEA0FFE6C5AEA01F0>19 28 2 0 24]48 dc[<EA01801203A21207120F123F12FF12FB
+12431203B0EA7FFCEAFFFEEA7FFC>15 28 5 0 24]49 dc[<EA03F0EA0FFEEA3FFF387C0F8038
+7003C0EAE00138F000E0A21260C7FCA2EB01C0A21303EB0780EB0F00131E5B5B5B485AEA07C048
+5A381E00E05AEA7FFFB5FC7E>19 28 2 0 24]50 dc[<EA07F8EA1FFE487E38780780EB03C013
+011230120013031480EB0F00EA03FF5B7F38000780EB03C01301EB00E0A312F0A2EB01C0130338
+7C0780383FFF006C5AEA03F8>19 28 2 0 24]51 dc[<131F5B1377A213E7120113C7EA038712
+071307120E121E123C1238127812F0B512F8A338000700A6EB7FF0EBFFF8EB7FF0>21 28 1 0
+24]52 dc[<381FFF805AA20038C7FCA8EA3BF8EA3FFE7F383C0780381803C0EA0001EB00E0A212
+6012F0A238E001C0EA7003387C0F80383FFF00EA1FFCEA03F0>19 28 2 0 24]53 dc[<137E48
+B4FC00071380380F83C0EA1E03121C3838018090C7FC5AA2EAE1F8EAE7FEB5FC38FE078038F803
+C0EAF001EB00E05A7E1270A3383801C0EA3C03381E0780380FFF006C5AEA01F8>19 28 2 0 24]
+54 dc[<12E0B512E0A338E003C0EB078000001300130E131E131C5BA25BA25BA3485AA412035B
+A7>19 29 2 0 24]55 dc[<EA03F8EA0FFE487E383E0F80EA3803387001C0A438380380EA3C07
+381FFF00EA07FC487EEA1F1F383C0780387001C000F013E0EAE000A4387001C0EA7803383E0F80
+381FFF006C5AEA03F8>19 28 2 0 24]56 dc[<EA03F0EA0FFC487EEA3C0F38780780EA700338
+E001C0A314E0A21270EA7803EA3C0FEA1FFFEA0FFEEA03F0C7FCEB01C0A338300380EA7807EB0F
+00133EEA3FFCEA1FF0EA07C0>19 28 2 0 24]57 dc[<1230127812FCA2127812301200A81230
+127812FCA212781230>6 20 9 0 24]58 dc[<1218123C127EA2123C12181200A81218123C127E
+A2123E121E120E121C123C127812F01260>7 26 8 6 24]59 dc[<1303EB0780131FEB3F00137E
+485AEA03F0485AEA1FC048C7FC127E5AA2127E7EEA1FC0EA07E06C7EEA01FCEA007E7FEB1F8013
+07EB0300>17 24 3 -2 24]60 dc[<387FFFC0B512E0A3C8FCA4B512E0A36C13C0>19 12 2 -8
+24]61 dc[<126012F012FC127E7EEA1FC0EA07E06C7EEA01FCEA007E7FEB1F80A2EB3F00137E48
+5AEA03F0485AEA1FC048C7FC127E5A12F01260>17 24 3 -2 24]62 dc[<137CEA01FEEA07FF38
+0F8780381E03C0EA3C1DEA387F3870FFE0EA71E313C112E1EAE380A638E1C1C0127113E33870FF
+8038387F00EA3C1C381E00E0EA0F833807FFC00001138038007E00>19 28 2 0 24]64 dc[<13
+7013F8A213D8A2EA01DCA3138CEA038EA41306EA0707A4380FFF80A3EA0E03A2381C01C0A2387F
+07F038FF8FF8387F07F0>21 28 1 0 24]65 dc[<EAFFFC13FF1480381C03C01301EB00E0A413
+0114C01307381FFF80140014C0EA1C03EB00E014F01470A414F014E01303B512C01480EBFE00>
+20 28 1 0 24]66 dc[<EBF8E0EA03FEEA07FFEA0F07EA1E03EA3C01EA38005AA214005AA81270
+14E0A27E123C381E01C0EA0F073807FF803803FE00EA00F8>19 28 2 0 24]67 dc[<EA7FF8EA
+FFFE6C7E381C0F80EB03C0A2EB01E01300A214F01470A814F014E0A2130114C01303EB0F80387F
+FF00485AEA7FF8>20 28 1 0 24]68 dc[<B512F0A3381C0070A41400A2130EA3EA1FFEA3EA1C
+0EA390C7FCA21438A5B512F8A3>21 28 1 0 24]69 dc[<B512E0A3EA1C00A41400A2131CA3EA
+1FFCA3EA1C1CA390C7FCA7EAFFC0A3>19 28 2 0 24]70 dc[<3801F1C0EA03FDEA0FFFEA1F0F
+EA1C03123813011270A290C7FC5AA5EB0FF0131F130F387001C0A213031238A2EA1C07EA1F0FEA
+0FFFEA03FDEA01F1>20 28 2 0 24]71 dc[<387F07F038FF8FF8387F07F0381C01C0A9EA1FFF
+A3EA1C01AA387F07F038FF8FF8387F07F0>21 28 1 0 24]72 dc[<EA7FFFB512806C1300EA01
+C0B3A4EA7FFFB512806C1300>17 28 3 0 24]73 dc[<EA7FE012FF127F000EC7FCB11470A538
+7FFFF0B5FC7E>20 28 1 0 24]76 dc[<38FC01F8EAFE03A2383B06E0A4138EA2EA398CA213DC
+A3EA38D8A213F81370A21300A638FE03F8A3>21 28 1 0 24]77 dc[<387E07F038FF0FF8387F
+07F0381D81C0A313C1121CA213E1A313611371A213311339A31319A2131D130DA3EA7F07EAFF87
+EA7F03>21 28 1 0 24]78 dc[<EA0FF8EA3FFE487EEA780FEA700700F01380EAE003B0EAF007
+00701300EA780FEA7FFF6C5AEA0FF8>17 28 3 0 24]79 dc[<EAFFFEEBFF8014C0EA1C03EB01
+E013001470A514E01301EB03C0EA1FFF1480EBFE00001CC7FCA8B47EA3>20 28 1 0 24]80 dc[
+<EA0FF8EA3FFE487EEA780FEA700700F01380EAE003AEEAE1E3A2EAF0E73870F700EA787FEA7F
+FF6C5AEA0FFCEA001C131E130E130F7FA2>17 34 3 6 24]81 dc[<EA7FF8EAFFFE6C7E381C0F
+80130314C01301A313031480130F381FFF005BA2EA1C0F7FEB0380A5149CA3387F01F8EAFF8138
+7F00F0>22 28 1 0 24]82 dc[<3803F380EA1FFF5AEA7C0FEA7007EAE003A390C7FC12701278
+123FEA1FF0EA07FEC67EEB0F80EB03C01301EB00E0A2126012E0130100F013C038F80780B5FCEB
+FE00EAE7F8>19 28 2 0 24]83 dc[<387FFFF8B5FCA238E07038A400001300B2EA07FFA3>21
+28 1 0 24]84 dc[<38FF83FEA3381C0070B36C13E0EA0F01380783C03803FF806C1300EA007C>
+23 28 0 0 24]85 dc[<38FF07F8A3381C01C0A4380E0380A4EA0F0700071300A4EA038EA4EA01
+8C13DCA3EA00D813F8A21370>21 28 1 0 24]86 dc[<38FE03F8A338700070A36C13E0A513F8
+A2EA39DCA2001913C0A3138CEA1D8DA4000D13801305EA0F07A2EA0E03>21 28 1 0 24]87 dc[
+<387F8FE0139F138F380E0700120FEA070E138EEA039C13DCEA01F8A26C5AA2137013F07F1201
+13DCEA039E138EEA070F7F000E13801303001E13C0387F07F038FF0FF8387F07F0>21 28 1 0
+24]88 dc[<38FF07F8A3381C01C0EA1E03000E1380EA0F0700071300A2EA038EA2EA01DCA3EA00
+F8A21370A9EA01FC487E6C5A>21 28 1 0 24]89 dc[<383FFFE05AA2387001C01303EB078014
+00C65A131E131C133C5B137013F0485A5B1203485A90C7FC5A001E13E0121C123C5A1270B5FCA3
+>19 28 2 0 24]90 dc[<EAFFF8A3EAE000B3ACEAFFF8A3>13 36 9 4 24]91 dc[<126012F0A2
+7E1278127C123CA2123E121E121F7EA27F12077F1203A27F12017F12007F1378A2137C133C133E
+131EA2131F7F14801307A2EB0300>17 36 3 4 24]92 dc[<EAFFF8A3EA0038B3ACEAFFF8A3>
+13 36 1 4 24]93 dc[<EA0180EA07C0EA1FF0EA7EFCEAF83EEAE00E>15 6 4 -22 24]94 dc[<
+EA7FFFB51280A26C1300>17 4 3 4 24]95 dc[<1206121E123E12381270A212E0A312F812FC12
+7CA21238>7 14 8 -17 24]96 dc[<EA1FE0EA3FF8487EEA781EEA300EC67EA213FF1207121FEA
+7F07127812E0A36C5AEA781F383FFFF0EA1FFBEA07E1>20 20 3 0 24]97 dc[<127E12FE127E
+120EA5133EEBFF80000F13C0EBC1E01380EB0070120E1438A6000F1370A2EB80E013C1EBFFC000
+0E138038063E00>21 28 0 0 24]98 dc[<EA01FEEA07FF001F1380EA3E073838030048C7FCA2
+5AA61270EB01C01238EA3E03381FFF8000071300EA01FC>18 20 3 0 24]99 dc[<EB1F80133F
+131F1303A5EA03E3EA0FFBEA1FFFEA3C1FEA380FEA7007130312E0A6EA7007A2EA380FEA3C1F38
+1FFFF0380FFBF83803E3F0>21 28 2 0 24]100 dc[<EA01F0EA07FCEA1FFEEA3E0F38380780EA
+7003A238E001C0A2B5FCA300E0C7FC1270EB01C01238EA3E03381FFF8000071300EA01FC>18 20
+3 0 24]101 dc[<EB1F80EB7FC0EBFFE013E13801C0C01400A3387FFFC0B5FCA23801C000AEEA
+7FFFA3>19 28 1 0 24]102 dc[<3801E1F03807FFF85A381E1E30381C0E00487EA5EA1C0EEA1E
+1EEA1FFC5BEA39E00038C7FC7EEA1FFEEBFFC04813E0387801F038700070481338A4007813F0EA
+7E03381FFFC06C13803801FC00>21 31 1 11 24]103 dc[<127E12FE127E120EA5133EEBFF80
+000F13C013C1EB80E01300120EAB387FC3FC38FFE7FE387FC3FC>23 28 0 0 24]104 dc[<EA03
+80487EA36C5AC8FCA4EA7FC012FF127F1201AEB5FC14801400>17 29 4 0 24]105 dc[<12FEA3
+120EA5EB3FF0137F133FEB0780EB0F00131E5B5B5BEA0FF87F139C130EEA0E0F7FEB038014C038
+FFC7F8A3>21 28 1 0 24]107 dc[<EA7FE012FF127F1200B3A4387FFFC0B512E06C13C0>19 28
+2 0 24]108 dc[<387CE0E038FFFBF8EA7FFF381F1F1CEA1E1EA2EA1C1CAB387F1F1F39FFBFBF
+80397F1F1F00>25 20 -1 0 24]109 dc[<EA7E3E38FEFF80007F13C0EA0FC1EB80E01300120E
+AB387FC3FC38FFE7FE387FC3FC>23 20 0 0 24]110 dc[<EA01F0EA0FFE487E383E0F80EA3803
+387001C0A238E000E0A5EAF001007013C0EA7803383C0780EA3E0F381FFF006C5AEA01F0>19 20
+2 0 24]111 dc[<EA7E3E38FEFF80007F13C0380FC1E01380EB0070120E1438A6000F1370A2EB
+80E013C1EBFFC0000E1380EB3E0090C7FCA7EA7FC0487E6C5A>21 30 0 10 24]112 dc[<3801
+E380EA07FBEA1FFFEA3E1FEA380FEA7007A2EAE003A6EA7007A2EA380FEA3C1FEA1FFFEA0FFBEA
+03E3EA0003A7EB3FF8A3>21 30 2 10 24]113 dc[<387F87E038FF9FF0387FBFF83803F878EB
+F030EBE0005BA25BA9EA7FFEB5FC6C5A>21 20 1 0 24]114 dc[<EA07F7EA3FFF5AEA780FEAE0
+07A3007CC7FCEA7FE0EA1FFCEA03FEEA001F38600780EAE003A212F038F80F00B5FC13FCEAE7F0
+>17 20 3 0 24]115 dc[<487E1203A4387FFFC0B5FCA238038000A9144014E0A33801C1C013FF
+6C1380EB3E00>19 25 1 0 24]116 dc[<387E07E0EAFE0FEA7E07EA0E00AC1301EA0F033807FF
+FC6C13FE3801FCFC>23 20 0 0 24]117 dc[<387F8FF000FF13F8007F13F0381E03C0000E1380
+A338070700A3EA038EA4EA01DCA3EA00F8A21370>21 20 1 0 24]118 dc[<38FF8FF8A3383800
+E0A3381C01C0A2137113F9A213D9A2380DDD80A3138DEA0F8FA238070700>21 20 1 0 24]119
+dc[<387F8FF0139F138F38070700138EEA039EEA01DC13F81200137013F07FEA01DCEA039E138E
+EA0707000F1380387F8FF000FF13F8007F13F0>21 20 1 0 24]120 dc[<387F8FF000FF13F800
+7F13F0380E01C0EB0380A21207EB0700A2EA03871386138EEA01CEA2EA00CCA213DC1378A31370
+A313F05B1279EA7BC0EA7F806CC7FC121E>21 30 1 10 24]121 dc[<383FFFF05AA2387001E0
+EB03C0EB078038000F00131E5B13F8485AEA03C0485A380F0070121E5A5AB512F0A3>20 20 1 0
+24]122 dc[<EB07E0131F137FEB780013E0AB1201EA7FC0485AA26C7EEA01E01200AB1378EB7F
+E0131F1307>19 36 2 4 24]123 dc[<126012F0B3B01260>4 36 10 4 24]124 dc[<127CB4FC
+13C01203C67EAB7FEB7FC0EB3FE0A2EB7FC0EBF0005BABEA03C012FF90C7FC127C>19 36 2 4
+24]125 dc dfe /fj df[<B512F8A7>21 7 1 -12 27]45 dc[<EB0FF8EB7FFF3901FC1FC03903
+F007E048486C7E000F8048486C7EA2003F80EB8000A2007F80A400FF1580B0007F1500A5003F5C
+EBC001001F5CA26C6C485A00075C6C6C485A3901FC1FC026007FFFC7FCEB0FF8>33 46 3 0 40]
+48 dc[<EB01C01303130F137FEA1FFFB5FC13BFEAE03F1200B3B1007FB512E0A3>27 46 6 0 40
+]49 dc[<EB3FE03801FFFE0007EBFF80D80F8013C0391E003FE00038EB1FF0007CEB0FF8007EEB
+07FCB4FC018013FEA21403A2EA7F00003E1307C7FC15FCA2EC0FF8A215F0EC1FE015C0EC3F80EC
+7F00147E14F8495A495A495A49C7FC011E130E5B133849131E49131C485A48C7123C48B512FC5A
+5A5A4814F8B6FCA3>31 46 4 0 40]50 dc[<EB1FF8EB7FFF48B512C03903E03FE03907800FF0
+D80FC07F381FE00781A4EA0FC0EA0780C7485AA25D4A5A5D4A5A02FEC7FCEB3FF8ECFF80903800
+1FE0EC07F0816E7E816E7EA21680A3121C123E127FEAFF801600A24A5AEA7F00007E495A003C5C
+391FC01FF06CB512C0000391C7FC38003FF8>33 46 3 0 40]51 dc[<157015F0140114031407
+140FA2141F143F147714F714E7EB01C7EB0387EB0707130F130E131C1338137013F013E0EA01C0
+EA0380EA07005A120E5A5A5A5AB712E0A3C7380FF000A9010FB512E0A3>35 46 2 0 40]52 dc[
+<000C1430390FC003F090B512E015C0158015005C14F85C1480000EC8FCA8EB1FF0EB7FFE390F
+E03F809038800FC0390E0007E0000C14F0C713F8EC03FCA315FEA21218123E127F5AA215FCA25A
+0078EB07F815F06CEB0FE06CEB1FC0390FC07F806CB51200000113FC38003FE0>31 46 4 0 40]
+53 dc[<ECFF80010713E0011F7F90387F80F89038FE003CD801F8137C484813FE00071301EA0F
+E0A2EA1FC0003F6D5A157892C7FC485AA338FF83FC90388FFF8090389C0FC09038B003F06E7E01
+E07F01C07F140081A2491480A4127FA4003F15007F121F5D000F495AEA07E06C6C485A3901FC0F
+E06CB55A013F90C7FCEB0FFC>33 46 3 0 40]54 dc[<1238123E003FB612C0A316804815005D
+5D5D0078C7123800705C5D00F0495A48495A4AC7FCA2C7120E5C5CA214785CA213015C1303A213
+07A2495AA3131FA5133FA86D5A6DC8FC>34 48 4 0 40]55 dc[<EB0FF8EB3FFF90B512C03901
+F80FE03903E003F048486C7EEA0F806E7EA2121FA27FA201F05BEBFC01D80FFE5B9038FF83E06C
+EBE7C0ECFF806C49C7FC6C7F6C14C0013F7F48B57ED803E37FD807C17F391F807FFE393F001FFF
+003E1307007E6D1380140048147F153F151FA31600127EA2007F143E6C5CD81FC05B390FF007F0
+0003B55AC61480D91FF8C7FC>33 46 3 0 40]56 dc[<EB0FF8EB7FFF48B57E3903F80FC03907
+E007E048486C7E001F6D7E003F80EA7F8081140000FF80A41680A4007F5BA2123F13C0001F5B00
+0F1306EA07E03801F81C3800FFF8EB1FE090C71300A4000F495AEA1F80D83FC05BA24A5A5D4948
+5A6C48485A001E495A6C6CB4C7FC6CB45A000113F838007FC0>33 46 3 0 40]57 dc[<1578A2
+15FCA34A7EA24A7EA24A7FA34A7FEC0E7F021E7FEC1C3FA202387F151F02787FEC700FA202E07F
+1507010180ECC003A2D903807F8101078191C7FCA249B67EA24981011CC7123F013C810138141F
+A24981160F01F081491407A2484881486C1403B56C48B512FCA3>54 49 3 0 61]65 dc[<B712
+E016FE707EC690C77FEE3FF0707E160F707EA2831603A41607A25FA24C5A4C5A4C5AEEFF80030F
+90C7FC91B55AEEFFC091C7EA1FF0EE07F8EE03FEA2707E18808218C0A718805E18005E4C5A4C5A
+EE7FF8B812E0178004FCC7FC>50 49 2 0 57]66 dc[<913A03FF800180023FEBF00349B5EAFC
+0701079038003F0FD91FF8EB079FD93FC0EB01FFD9FF807F4848C8127F4848153F0007161F4915
+0F485A001F1607A2485A1703127FA24992C7FCA212FFA9127FA27FEF0380123FA26C7E1707000F
+17006C7E6D150E0003161E6C6C151C6C6C6C1478D93FC05CD91FF8EB03E0D907FFEB3F800101D9
+FFFEC7FCD9003F13F802031380>49 49 4 0 58]67 dc[<B712F016FF17C0C6D9800013F0EE0F
+F8EE03FE707E701380EF7FC0173FEF1FE018F0170F18F8A2EF07FCA418FEAB18FCA4EF0FF8A218
+F0171F18E0173FEF7FC01880933801FF004C5AEE0FFCEE7FF0B812C094C7FC16F0>55 49 2 0
+62]68 dc[<B812E0A3C6903880007FEE0FF016031601A21600A21770A31738A21507A21700A35D
+5D5D91B5FCA3EC803F818181A592C8FCACB612E0A3>45 49 2 0 51]70 dc[<B6D8807FB512C0
+A3C60180C7387FC000B391B7FCA30280C7127FB3A3B6D8807FB512C0A3>58 49 2 0 63]72 dc[
+<B61280A3C6EB8000B3B3A7B61280A3>25 49 2 0 30]73 dc[<B612E0A3C60180C8FCB3A9EE01
+C0A416031780A21607A3160F161F163F167FEEFF001507B8FCA3>42 49 2 0 48]76 dc[<B56C
+49B512C08080C66D90390003E0006E6E5AEBEFFC13E780EBE3FF01E17F01E07F6E7E143F816E7E
+6E7E6E7E14036E7E16806E13C0ED7FE0ED3FF0151F16F8ED0FFCED07FEED03FF6F13818117C1EE
+7FE1EE3FF1EE1FF9EE0FFD160717FF828282177F173FA2171F170F486C1507B500E014031701A2
+>58 49 2 0 63]78 dc[<EC0FFF91B512F0903907FC03FE903A1FE0007F80D93F80EB1FC049C7
+6C7ED801FEEC07F848486E7E48486E7EA248486E7E001F178049157F003F17C0A34848ED3FE0A3
+00FF17F0AB007F17E06D157FA3003F17C0A26C6CEDFF80A26C6C4A130000075E6D140300035E6C
+6C4A5A6C6C4A5AD93FC0EB3FC06D6C495A902707FC03FEC7FC0100B512F0020F90C8FC>52 49 4
+0 61]79 dc[<B712E016FEEEFF80C6D9800013E0EE3FF0EE0FF8EE07FCA2EE03FEA217FFA717FE
+A2EE07FC17F8160FEE3FE0EEFFC091B6120016F80280C8FCB3A2B67EA3>48 49 2 0 55]80 dc[
+<EC0FFF91B512F0903907FC03FE903A1FE0007F8049486D7E49C7EA0FE0D801FEEC07F848486E
+7E000782491401000F8248486E1380A24848ED7FC0A3007F17E049153FA200FF17F0AB007F17E0
+A26D157FA2003F17C0A26C6CEDFF80A2000FD901F814003B07F807FC01FE9039FC0E06030003D9
+0C035B2601FE18EB87F8D800FF903801CFF0D93FD8EBFFC0D91FEC5C902707FE03FEC7FC0100B5
+12F0020F6D133091C7FC82047E137093387F81F017FF7013E0A37013C0821880701300705AEE00
+F8>52 63 4 14 61]81 dc[<B77E16F816FEC690398003FF809238007FE0EE1FF0707EA2831607
+83A65F160F5F4C5A4C5A4C5ADB03FFC8FC91B512F816E091388007F8ED01FC6F7E167F83707EA2
+83A583A4F0038017F8161F1900706C5AB6398003FE0E933801FFFC9338001FF0>57 49 2 0 60]
+82 dc[<90391FF8018090B51203000314C73907F007EF390F8000FF48C7127F003E141F150F5A
+150712FCA215037EA26C91C7FC13C0EA7FF0EBFF806C13F8ECFF806C14F06C806C14FE6C80C615
+80133F010114C0D9001F13E01400153FED1FF0150F1507126000E01403A316E07EA26CEC07C07E
+B4EC0F8001C0EB1F00D8FBFC13FE00F1B512F8D8E03F5BD8C0031380>36 49 4 0 45]83 dc[<
+007FB8FCA39039C00FF801D87E00EC003F007C82007882A200708200F01780A3481603A5C792C7
+FCB3AA017FB6FCA3>49 48 3 0 56]84 dc[<B6D88003B51280A3C60180C73807C000715AB3AE
+137F4DC7FC80013F150EA26D6C5C6D6C5C6D6C5C6D6C495A903A00FF801FC0023FB55A020F49C8
+FC020013E0>57 49 2 0 62]85 dc[<B500FC91B5FCA3000390C8EA03C06C17806E14076C1700
+80017F150EA26E141E013F151C6E143C011F153880010F5D8001075DA26E130101035D6E13036D
+5D15806D4AC7FC15C05E027F130EEDE01E023F131CEDF03C021F133815F8020F5BA2EDFCF00207
+5B15FF6E5BA26E5BA26E90C8FCA3157EA2153CA2>56 49 2 0 61]86 dc[<EBFFF0000313FE39
+0F803F809038C00FE0486C6C7EA26E7ED80FC07FEA0780C7FCA414FF131FEBFFE33803FC03EA0F
+F0EA1FC0123FEA7F80A2EAFF00A31407A2387F800D393FC019FE3A1FE070FFF03907FFE07FC6EB
+803F>36 32 2 0 39]97 dc[<EA01F812FFA3120F1207ADEC3FE0ECFFFC9038FBE07F9039FF00
+1F8049EB0FC04914E049EB07F016F8A2ED03FCA316FEA816FCA3ED07F8A216F06DEB0FE06D14C0
+01E7EB3F809039C3C0FE00903880FFF89038003FC0>39 50 2 0 45]98 dc[<EB0FFF017F13C0
+3901FC01F03803F0033907E007F8120FEA1FC0003FEB03F0EC01E04848C7FCA312FFA8127FA36C
+6C131CA2001F14386C7E000714703903F001E03901FC07C039007FFF00EB0FF8>30 32 3 0 36]
+99 dc[<ED0FC0EC07FFA3EC007F153FADEB07F8EB3FFF9038FE07BF3903F801FF3907E0007F12
+0F4848133F123FA2485AA312FFA8127FA36C7EA2121F6C6C137F000714FF2603F00313E03A01FC
+0F3FFE38007FFEEB0FF0>39 50 3 0 45]100 dc[<EB0FFC90387FFF803901FC0FC03903F003E0
+3907E001F0000F14F8391FC000FC003F14FEA24848137E157FA212FFA290B6FCA20180C7FCA412
+7FA36C6C1307121F150E6C7E6C6C131C6C6C13783900FE03E090383FFFC0903807FE00>32 32 2
+0 37]101 dc[<EB01FE90380FFF8090381FC3C090387F07E09038FE0FF0120113FC1203EC07E0
+EC018091C7FCA8B512FCA3D803FCC7FCB3A8387FFFF0A3>28 50 2 0 25]102 dc[<90391FF007
+C09039FFFE3FE03A01F83F79F03907E00FC3000F14E19039C007E0E0001FECF000A2003F80A500
+1F5CA2000F5CEBE00F00075C2603F83FC7FC3806FFFE380E1FF090C9FC121EA2121F7F90B57E6C
+14F015FC6C806C801680000F15C048C7127F007EEC1FE0007C140F00FC1407A4007EEC0FC0003E
+1580003F141FD80FC0EB7E003907F803FC0001B512F0D8001F90C7FC>36 47 2 15 40]103 dc[
+<EA01F812FFA3120F1207ADEC07F8EC3FFEEC783F02C013809039F9801FC0EBFB0001FE14E05B
+A35BB3B500C3B5FCA3>40 50 3 0 45]104 dc[<EA03C0487E487E487EA46C5A6C5A6C5AC8FCA9
+EA01F812FFA3120F1207B3A6B51280A3>17 51 3 0 23]105 dc[<EA01F812FFA3120F1207AD91
+3801FFF8A39138003F00153C5D5DEC03C04A5A4AC7FC141E147814FCEBF9FE13FB90B5FC496C7E
+01FC7FEBF83F496C7E6E7E816E7E14036E7E6E7E1680157F16C0B53881FFFEA3>39 50 2 0 43]
+107 dc[<EA01F812FFA3120F1207B3B3A6B512C0A3>18 50 3 0 23]108 dc[<2703F007F8EB1F
+E000FFD93FFEEBFFF8913A783F01E0FC02C090388300FE280FF1801FC6137F2607F30013CC01F6
+02F8148001FC5CA3495CB3B500C3B5380FFFFCA3>62 32 3 0 67]109 dc[<3903F007F800FFEB
+3FFEEC783F02C013803A0FF1801FC03807F30001F614E013FCA35BB3B500C3B5FCA3>40 32 3 0
+45]110 dc[<EB07FC90387FFFC03901FC07F03903F001F848486C7E4848137E001F147F003F15
+8049133F007F15C0A300FF15E0A8007F15C0A36C6CEB7F80A2001F15006C6C13FE00075C3903F8
+03F83901FE0FF039007FFFC0D907FCC7FC>35 32 2 0 40]111 dc[<3901F83FE000FFEBFFFC90
+38FBE07F9039FF003F80D807FEEB1FC049EB0FE04914F0ED07F8A216FC1503A216FEA816FC1507
+A216F8A2ED0FF06D14E06DEB1FC06DEB3F809039FBC0FE009038F8FFF8EC3FC091C8FCABB512C0
+A3>39 46 2 14 45]112 dc[<903907F801C090383FFE039038FE07073903F8018F3907F000CF
+484813FF001F147F485A153F127FA25B12FFA8127FA27F123FA26C6C137F120F6C6C13FF3903F8
+03BF3901FC0F3F38007FFEEB0FF090C7FCAB913807FFFEA3>39 46 3 14 43]113 dc[<3803F0
+3F00FFEB7FC09038F1C3E01487390FF30FF0EA07F6A29038FC07E0EC03C091C7FCA25BB2B512E0
+A3>28 32 2 0 33]114 dc[<3801FF86000713FEEA1F00003C133E48131E140E12F8A36C90C7FC
+B47E13FC387FFFC014F06C7F6C7F00077F00017FEA003F01001380143F0060131F00E0130FA27E
+15007E6C131E6C131C38FF807838F3FFF038C07F80>25 32 3 0 32]115 dc[<131CA5133CA313
+7CA213FC120112031207381FFFFEB5FCA2D803FCC7FCB0EC0380A71201EC0700EA00FEEB7F0EEB
+3FFCEB07F0>25 46 1 0 31]116 dc[<D801F8EB07E000FFEB03FFA3000FEB003F0007141FB315
+3FA20003147FA26C6CEBDFF03A00FE039FFF90387FFF1FEB0FFC>40 32 3 0 45]117 dc[<B538
+801FFCA33A0FF80003C0000715806D1307000315006D5B0001140E7F6C5CA26D6C5AA2ECC07801
+3F1370ECE0F0011F5B14F1010F5B14F9903807FB80A26DB4C7FCA36D5AA26D5AA21478A2>38 32
+2 0 43]118 dc[<B53A1FFFE07FF8A33C0FF000FE0007807F00071700157F6C6C150EEDFF806D
+151E0001161C913801DFC001FF153C6C0103EBE038DA838F1378017F157091388707F002C714F0
+D93FCF6D5AECCE03D91FEEEBF9C09138FC01FD16FF010F5D4A7E010792C7FC4A7FA20103147E4A
+133E0101143C4A131C>53 32 2 0 58]119 dc[<3A7FFF807FFCA33A03FE000F000001141E6C6C
+5B6E5AEB7FC06D6C5A90381FE1E090380FF3C0ECFF806D90C7FC6D5A13016D7E81815B903803DF
+E09038078FF08190380F07FCEB1E03496C7E496C7E49148049EB7FC00001143F26FFFC01B5FCA3
+>40 32 1 0 43]120 dc[<B538801FFCA33A0FF80003C0000715806D1307000315006D5B000114
+0E7F6C5CA26D6C5AA2ECC078013F1370ECE0F0011F5B14F1010F5B14F9903807FB80A26DB4C7FC
+A36D5AA26D5AA21478A21470A214F05C1301007C5BEAFE035C130749C8FCEAFC1EEA787CEA3FF0
+EA0FC0>38 46 2 14 43]121 dc dfe /fk df[<EB01FE903807FF8090381E01E0903878007801
+E0131CD80180130648C77E0006EC018048EC00C0A2481560481530A3481518A348150CA9006015
+18A36C1530A36C15606C15C0A26CEC01806CEC03006C6C1306D800E0131C0178137890381E01E0
+903807FF80D901FEC7FC>38 43 3 10 45]13 dc[<EA03C0EA0FF0EA1FF8EA3FFCEA7FFEA2B5FC
+A6EA7FFEA2EA3FFCEA1FF8EA0FF0EA03C0>16 18 3 -2 23]15 dc dfe /fl df[<49B4FC011F
+13C090387F81E0EBFC013901F807F01203EA07F0A4EC01C091C8FCA3EC3FF8B6FCA33807F003B3
+A33A7FFF3FFF80A3>33 42 1 0 37]12 dc[<123C127FEAFF80A213C0A3127F123E1200A2EA01
+80A3EA0300A21206120E5A5A1230>10 21 5 -21 19]39 dc[<123C127FEAFF80A213C0A3127F
+123E1200A2EA0180A3EA0300A21206120E5A5A1230>10 21 5 12 19]44 dc[<121C127FA2EAFF
+80A3EA7F00A2121C>9 9 5 0 19]46 dc[<1403EC0780A2140F1500A25C141E143E143CA2147C
+1478A214F85C13015CA213035CA213075C130F91C7FCA25B131E133E133CA2137C1378A213F85B
+12015BA212035BA212075B120F90C8FCA25A121EA2123E123C127C1278A212F85AA21260>25 60
+4 15 34]47 dc[<EB3F803801FFF03807E0FC380FC07E48487E497E481480003E130F007E14C0
+A400FE14E0AF007E14C0A46CEB1F80A26C14006D5A380FC07E6C6C5A3801FFF038003F80>27 39
+3 0 34]48 dc[<130E131E137EEA07FE12FFA212F81200B3AB387FFFFEA3>23 39 5 0 34]49
+dc[<EBFF80000713F04813FC381E03FE393800FF80007C133F00FE14C06C131F15E0140FA2127E
+003C131FC7FC15C0A2EC3F801500147E5C5C495A495AEB078049C7FC131E4913E013705B3901C0
+01C0EA0380EA0600000FB5FC5A5A5AB61280A3>27 39 3 0 34]50 dc[<EB7F803803FFF04813
+FC380F80FE381F007FEA3F80EC3F80A3121F1300C7EA7F00A2147E5C495AEB07F0EBFFC0A2EB01
+F8EB007E801580EC1FC0A215E0A2123C127EB4FCA215C0143F481480007CEB7F00003F13FE6CB4
+5A000713F0C61380>27 39 3 0 34]51 dc[<140E141E143E147E14FEA213011303EB077E130E
+A2131C1338137013E0A2EA01C0EA0380EA0700120EA25A5A5A5AB612F8A3C7EAFE00A890387FFF
+F8A3>29 39 2 0 34]52 dc[<00181303381F801FEBFFFE5C5C5C14C091C7FC001CC8FCA7EB7F
+C0381DFFF8381F80FC381E003F1208C7EA1F8015C0A215E0A21218127C12FEA315C05A0078EB3F
+80A26CEB7F00381F01FE6CB45A000313F0C61380>27 39 3 0 34]53 dc[<EB07F8EB3FFE90B5
+FC3901FC07803903F00FC03807C01FEA0F80121F130048EB0F8091C7FC127EA3EAFE02EB1FF0EB
+3FFCEB603EEB801F00FF14809038000FC0A24814E0A4127EA4123E003F14C07EEC1F80D80F8013
+003807E07E6CB45A6C5B38003FC0>27 39 3 0 34]54 dc[<1238123E003FB512F0A34814E015
+C0158015003870000EA25C485B5C5CEA00015C495A130791C7FC5B5B131E133EA2137E137CA213
+FCA41201A76C5A1370>28 41 4 0 34]55 dc[<EB3FC03801FFF04813FC3807C07E48C67E001E
+7FEC0F80123EA2123F138013C09038F01F00381FFC1E6D5A380FFFF814E06C13F800017F800007
+7FD80F0F1380D81E0313C0EA3E01397C007FE0141F48130F14071403A315C0127C007EEB07806C
+EB0F00381FC03F380FFFFC00035B38007FC0>27 39 3 0 34]56 dc[<EB7F803801FFF000077F
+380FC0FC381F803E48487E007E1480A2140F00FE14C0A315E0A5007E131FA26C133F6C132F380F
+80CF3807FF8F0001130FEA0008010013C0A3EC1F80123E127FEC3F00143E147E007E5B383E03F8
+381FFFE06C1380D801FEC7FC>27 39 3 0 34]57 dc[<121C127FA2EAFF80A3EA7F00A2121CC7
+FCA9121C127FA2EAFF80A3EA7F00A2121C>9 27 5 0 19]58 dc[<48B4FC000F13E0381E03F038
+3801F8387800FC00FC13FE7EA3127C003813FCEA0001EB03F8EB07E0EB0FC01480EB1E00A25B13
+38A25BA790C7FCA5137013F8487E487EA36C5A6C5A1370>23 42 4 0 32]63 dc[<EC0780A24A
+7EA34A7EA24A7EA3EC77F8A2ECF7FC14E3A2903801C1FEA201037F1480A249486C7EA24980010E
+133FA2496D7EA2013FB57EA39039700007F8A201F080491303A248486D7EA2000381D8FFFE013F
+13FCA3>46 41 2 0 51]65 dc[<B612F815FF16C03A03F8001FE0ED0FF0ED07F8150316FCA215
+01A3150316F8A2ED07F0150FED1FC0EDFF8090B5EAFE00EDFFC09039F8000FF0ED03F8ED01FC16
+FE1500A216FFA616FE1501ED03FC1507ED1FF8B712E016C0EDFE00>40 41 3 0 48]66 dc[<91
+387FE003903907FFFC07011FEBFF0F90397FF00F9F9039FF0001FFD801FC7F4848147F4848143F
+4848141F485A160F485A1607127FA290C9FC5AA97E7F1607123FA26C7E160E6C7E6C6C141C6C6C
+143C6C6C14786CB4EB01F090397FF007C0011FB512800107EBFE009038007FF0>40 41 4 0 49]
+67 dc[<B612FCEDFF8016E03A03FC001FF8ED03FCED00FE167FEE3F80EE1FC0A2EE0FE0A2EE07
+F0A417F8AA17F0A3EE0FE0A217C0161FEE3F80EE7F005EED03FCED1FF8B75A168003FCC7FC>45
+41 2 0 52]68 dc[<B712E0A33903FC001FED07F01501A215001670A3913801C0781638A30203
+1300A2140F90B5FCA3EBFC0F1403A20201130EA3161C91C7FCA3163C1638167816F81501150315
+1FB712F0A3>39 41 2 0 44]69 dc[<B712C0A33903FC003FED0FE015031501A21500A316F091
+3801C070A316001403A2140F90B5FCA3EBFC0F1403A21401A491C8FCA9B512FCA3>36 41 2 0
+42]70 dc[<91387FE003903907FFFC07011FEBFF0F90397FF00F9F9039FF0001FFD801FC7F4848
+80484880484880485A82485A82127FA290CAFC5AA892B512F87E7F03001300123FA26C7EA26C7E
+6C7E6C7E6C7E6CB45B90387FF007011FB5129F0107EBFE0F9039007FF003>45 41 4 0 53]71
+dc[<B5D8F00FB5FCA3D803FCC7EA3FC0AF90B7FCA301FCC7123FB1B5D8F00FB5FCA3>48 41 2 0
+53]72 dc[<B512FCA33801FE00B3B1B512FCA3>22 41 1 0 25]73 dc[<B539F001FFFCA3D803
+FCC7EA1E005E5E5E4B5A4B5A4BC7FC151E5D5D5D4A5AEC03804A7E141F4A7E4A7E4A7EEBFDE790
+38FF83FCEC03FE496C7E497E6F7E826F7E151F6F7E8215076F7E6F7E8281EE7F80B539F00FFFFE
+A3>47 41 2 0 53]75 dc[<B512FCA3D803FCC8FCB3A3ED01C0A415031680A21507A2150FA215
+1F157F913801FF00B7FCA3>34 41 2 0 40]76 dc[<D8FFFE92383FFF80A26D5D0003EFE000A2
+D9BF8014EFA2D99FC0EB01CFA2D98FE0EB038FA3D987F0EB070FA2D983F8130EA2D981FC131CA3
+D980FE1338A2027F1370A291383F80E0A391381FC1C0A291380FE380A2913807F700A3EC03FEA2
+6E5AA26E5AD8FFFE0203B51280A21570>57 41 3 0 64]77 dc[<D8FFFCEC7FFF7F7F00036DEB
+01C080EBBFE0139F80EB8FF8EB87FCEB83FEEB81FF01801380147F15C0EC3FE0EC1FF0EC0FF8EC
+07FC140315FEEC01FF6E1381ED7FC1ED3FE1ED1FF1150F16F9ED07FDED03FF8181167FA2163F16
+1F160F1607D8FFFE14031601A2>48 41 2 0 53]78 dc[<ECFFC0010F13FC90383F807F9039FE
+001FC0D801F8EB07E048486D7E48486D7E000F8148486D7EA24848147FA2007F168090C8123FA3
+4816C0AA6C16806D147FA2003F1600A26C6C14FEA26C6C495A6C6C495A6C6C495A6C6C495A6C6C
+495A90263FC0FFC7FC90380FFFFC010013C0>42 41 4 0 51]79 dc[<B612F815FF16C03A03FC
+003FE0ED07F0ED03F816FC150116FEA716FC150316F8ED07F0ED3FE090B61280EDFE0001FCC8FC
+B0B512F0A3>39 41 2 0 46]80 dc[<ECFFC0010F13FC90383FC0FF9039FE001FC048486D7ED8
+03F0EB03F000078148486D7E48486D7EA24848147FA2007F1680A290C8123FA24816C0AA6C1680
+6D147FA2003F1600A26C6C14FE143E3A0FE07F81FC00079038C1C1F83A03F180E3F0D801F9EBE7
+E0D800FFEB7FC0D93FC090C7FC90380FFFFC01004913C0EC007C811601ED3F83ED1FFF1780A26F
+1300816F5A6F5A6F5A>42 53 4 12 51]81 dc[<B612E015FE6F7E3A03FC003FE0ED0FF06F7E6F
+7E150182A65E4B5A1507ED0FE0ED3FC090B500FEC7FCA29039FC00FF80ED3FC06F7E6F7E6F7EA9
+170EA21503923801FC1CB538F000FEEE7FF8EE0FE0>47 41 2 0 50]82 dc[<01FF13C0000313
+E1000F13F9381F80FF383F003F003E130F481307A200FC1303A214017EA26C90C7FC13C0EA7FFC
+EBFFE06C13F86C13FE80000714806C14C0C6FC010F13E0EB007FEC1FF0140F140700E01303A46C
+14E0A26C13076C14C0B4EB0F80EBE01F00E3B5120000E113FC38C01FF0>28 41 4 0 37]83 dc[
+<007FB71280A39039807F807FD87C00140F00781507A20070150300F016C0A2481501A5C791C7
+FCB3A490B612C0A3>42 40 2 0 47]84 dc[<B500F0EBFFFEA3D803FCC7EA0380B3AA0001ED07
+007F0000150E137F6D143CD91FC05B90390FF003F06DB55A01001480DA1FFCC7FC>47 41 2 0
+52]85 dc[<B500F0EB7FFFA3D803FEC7EA01C00001ED0380A26C6CEC0700A26E5B017F140E8001
+3F5C80011F5CA26E1378010F14706E13F001075C800103495AA2ECFE0301015CECFF076D91C7FC
+1587EC7F8EA215DEEC3FDC15FC6E5AA26E5AA36E5AA26E5AA2>48 41 1 0 51]86 dc[<B500E0
+B539E01FFFC0A32803FC0003FCC7EA7000A26D6E14F0000102015DA26D6E13016C60A26D6C486D
+485AA26E48EBC007013F023F91C7FCA2DAE00F6D5A011FD90E1F130EA26D6C486C6C5AA217F890
+2707F838075BA2DAFC78EBFC780103D970031370A2DAFEF0EBFEF00101D9E0015BA26D6C486C6C
+5AA36E486D5AA36EC76CC8FCA3021E141EA2>66 41 1 0 69]87 dc[<3B7FFFF81FFFE0A30001
+90C7EAF0006C6D485A02C05B017F13036D6C485A6D6C48C7FC150E90380FF81E6D6C5A15389038
+03FE786D6C5A5D6D5B147F6E7EA26E7E81143F81EC7BFE14F3903801E1FF02C07F01036D7EEB07
+8049486C7E010E6D7E131E496D7E01386D7E1378496D7E48486D7EB5013F13FCA3>46 41 2 0
+51]88 dc[<B500F0EB3FFFA3D803FEC7EA03C06C6CEC07806C6D14005E6D6C131E6D6C131C163C
+6D6C5B6E1370010F14F06D6C5B6E485A01031303D901FF5B0387C7FC6D138FEC7FCE15FC143F6E
+5A5D140FAE0103B512C0A3>48 41 1 0 51]89 dc[<3803FF80000F13F0381F01FC383F80FE14
+7F801580EA1F00C7FCA4EB3FFF3801FC3FEA0FE0EA1F80EA3F00127E5AA4145F007E13DF393F83
+9FFC381FFE0F3803F803>30 27 2 0 33]97 dc[<EAFFE0A3120FACEBE1FE9038E7FF809038FE
+07E09038F803F09038F001F89038E000FCA2157EA2157FA8157EA315FCA29038F001F89038F803
+F090389C0FE090380FFF80390E01FC00>32 42 2 0 37]98 dc[<EB3FF03801FFFC3803F03E38
+0FC07FEA1F80EA3F00A248133E007E90C7FCA212FEA7127EA2127F6CEB03801380001FEB070038
+0FE00E3803F83C3801FFF838003FC0>25 27 2 0 30]99 dc[<EC7FF0A31407ACEB3F873801FF
+F73807F03F380FC00F381F8007EA3F00A2127EA312FEA8127EA27EA2381F800F380FC01F3907E0
+7FFF3801FFE738007F87>32 42 2 0 37]100 dc[<EB3FC03801FFF03803E07C380F803E001F7F
+130048EB0F80127E15C0A200FE1307A2B6FCA248C8FCA3127EA2127F6CEB01C07E390F80038039
+07C007003803F01E3800FFFCEB3FE0>26 27 2 0 31]101 dc[<EB07F8EB3FFCEB7E3E3801FC7F
+EA03F813F01207143E1400A7B512C0A33807F000B3A3387FFF80A3>24 42 2 0 21]102 dc[<90
+387F80F03901FFE3F83907C0FE1C390F807C7C381F003E151048EB3F00A66C133EA26C6C5A6C6C
+5A3805FFE0380C7F8048C8FC121CA2121E381FFFF814FF6C14C06C14E06C14F0120F383E000748
+EB01F8481300A4007CEB01F0A2003FEB07E0390FC01F806CB5120038007FF0>30 40 2 13 34]
+103 dc[<EAFFE0A3120FAC147E9038E1FF809038E30FC001E413E0EBE80701F813F013F0A213E0
+B039FFFE3FFFA3>32 42 3 0 37]104 dc[<1207EA0F80EA1FC0EA3FE0A3EA1FC0EA0F80EA0700
+C7FCA7EAFFE0A3120FB3A3EAFFFEA3>15 43 2 0 18]105 dc[<EAFFE0A3120FACEC3FF8A3EC07
+00140E143C5C5CEBE1E0EBE3C0EBE780EBEFC0EBFFE0A2EBF7F0EBE3F8EBC1FCA2EBC0FE147FA2
+EC3F80EC1FC0A239FFFC7FFCA3>30 42 2 0 35]107 dc[<EAFFE0A3120FB3B2EAFFFEA3>15 42
+2 0 18]108 dc[<26FFC07FEB1FC0903AC1FFC07FF0903AC307E0C1F8D80FC49038F101FC9039
+C803F20001D801FE7F01D05BA201E05BB03CFFFE3FFF8FFFE0A3>51 27 3 0 56]109 dc[<38FF
+C07E9038C1FF809038C30FC0D80FC413E0EBC80701D813F013D0A213E0B039FFFE3FFFA3>32 27
+3 0 37]110 dc[<EB3FE03801FFFC3803F07E390FC01F80391F800FC0393F0007E0A2007EEB03
+F0A300FE14F8A8007E14F0A26CEB07E0A2391F800FC0390FC01F803907F07F003801FFFC38003F
+E0>29 27 2 0 34]111 dc[<38FFE1FE9038E7FF809038FE0FE0390FF803F09038F001F801E013
+FC140015FEA2157FA8157E15FEA215FC140101F013F89038F803F09038FC0FE09038EFFF809038
+E1FC0001E0C7FCA9EAFFFEA3>32 39 2 12 37]112 dc[<90383F80703901FFE0F03803F07138
+0FC019381F800F123FEB00075AA2127E12FEA8127FA27E1380001F130F380FC01F3807F0773801
+FFE738007F87EB0007A9EC7FFFA3>32 39 2 12 35]113 dc[<38FFC3E0EBC7F8EBCC7C380FD8
+FE13D0A213F0EBE07C1400B0B5FCA3>23 27 2 0 27]114 dc[<3803FE30380FFFF0EA3E03EA78
+00127000F01370A27E00FE1300EAFFE06CB4FC14C06C13E06C13F0000713F8C6FCEB07FC130000
+E0137C143C7E14387E6C137038FF01E038E7FFC000C11300>22 27 2 0 27]115 dc[<1370A413
+F0A312011203A21207381FFFE0B5FCA23807F000AD1470A7000313E03801F8C0EA00FFEB3F00>
+20 38 1 0 26]116 dc[<39FFE07FF0A3000F1307B2140FA2000713173903F067FF3801FFC738
+007F87>32 27 3 0 37]117 dc[<39FFFE07FFA33907F000E0A2EBF801000314C0A23901FC0380
+A2EBFE07000014006D5AEB7F0EA2EB3F9CA214FC6D5AA26D5AA36D5AA26D5AA2>32 27 1 0 35]
+118 dc[<3BFFFC7FFC1FFCA33B0FE00FE001C02607F007EB0380A201F8EBF0070003160015F826
+01FC0F130EA29039FE1FFC1E0000011C131C15FE9039FF387E3C017F1438EC787F6D486C5AA291
+38E01FF0011F5CA26D486C5AA36D486C5AA2>46 27 1 0 49]119 dc[<39FFFC1FFEA33907F007
+80D803F813006C6C5AEBFE1E00005BEB7F78EB3FF85C6D5A130F6D7E80130F497EEB3DFEEB38FF
+EB787F9038F03F80D801E013C03903C01FE0EB800F39FFF03FFFA3>32 27 1 0 35]120 dc[<39
+FFFE07FFA33907F000E0A2EBF801000314C0A23901FC0380A2EBFE07000014006D5AEB7F0EA2EB
+3F9CA214FC6D5AA26D5AA213075CA26D5AA25CA21307003890C7FC127CEAFE0EA25B5BEA7C70EA
+3FE0EA0F80>32 39 1 12 35]121 dc[<003FB5FCA2EB00FEEA3C01383803FC007813F8EB07F0
+EA700F14E0EB1FC0EA003F1480EB7F005B5B3801FC07120313F8EA07F0000F130F13E0381FC00E
+003F131E387F803EEB00FEB5FCA2>24 27 2 0 30]122 dc dfe /fm df[<90383F07C09038E0
+DC603901C0F0F0EA0381390701E06001001300A7B6FC380700E0B2387FC3FE>28 32 0 0 26]
+11 dc[<133FEBE0C0EA01C0380381E0EA0701A290C7FCA6B512E0EA0700B2387FC3FE>23 32 0
+0 25]12 dc[<EB3FE013E0EA01C1EA0381EA0700A8B5FCEA0700B2387FE7FE>23 32 0 0 25]
+13 dc[<90381F81F89038F04F043901C07C06390380F80FEB00F05A0270C7FCA6B7FC39070070
+07B23A7FE3FE3FF0>36 32 0 0 38]14 dc[<EA7038EAF87CEAFC7EA2EA743AEA0402A3EA0804
+A2EA1008A2EA2010EA4020>15 14 2 -18 23]34 dc[<127012F812FCA212741204A31208A212
+10A212201240>6 14 4 -18 13]39 dc[<132013401380EA0100120212065AA25AA25AA3127012
+60A312E0AC1260A312701230A37EA27EA27E12027EEA008013401320>11 46 3 12 18]40 dc[<
+7E12407E7E7E120C7EA27EA2EA0180A313C01200A313E0AC13C0A312011380A3EA0300A21206A2
+5A12085A5A5A5A>11 46 3 12 18]41 dc[<EA0180A5EAC183EAF18FEA399CEA0FF0EA03C0A2EA
+0FF0EA399CEAF18FEAC183EA0180A5>16 20 3 -14 23]42 dc[<127012F812FCA212741204A3
+1208A21210A212201240>6 14 4 9 13]44 dc[<EAFFC0A2>10 2 1 -9 15]45 dc[<127012F8
+A31270>5 5 4 0 13]46 dc[<13011303A21306A3130CA31318A31330A31360A313C0A3EA0180
+A3EA0300A31206A35AA35AA35AA35AA35AA3>16 45 3 11 23]47 dc[<EA03F0EA0E1C487EEA18
+06EA380738700380A400F013C0AD00701380A3EA780700381300EA1806EA1C0E6C5AEA03F0>18
+31 2 1 23]48 dc[<EA01801203120F12F31203B3A6EA07C0EAFFFE>15 30 4 0 23]49 dc[<EA
+03F0EA0C1CEA100E487E00401380128000F013C0EAF803A3EA200712001480A2EB0F00130E5B5B
+5B13605B485A48C7FC000613405A5A00101380EA3FFF5AB5FC>18 30 2 0 23]50 dc[<EA03F0
+EA0C1CEA100EEA200F007813801307A2EA380F12001400A2130E5B5BEA03F0EA003C130E130FEB
+0780A214C0122012F8A300F013801240EB0F00EA200EEA1C3CEA03F0>18 31 2 1 23]51 dc[<
+1306A2130EA2131E132EA2134E138EA2EA010E1202A212041208A212101220A2124012C0B512F0
+38000E00A7EBFFE0>20 30 1 0 23]52 dc[<EA1803EA1FFE5B5B13E00010C7FCA6EA11F0EA16
+1CEA180EEA10071480EA0003A214C0A3127012F0A200E013801240EB0700EA2006EA100EEA0C38
+EA03E0>18 31 2 1 23]53 dc[<137CEA0182EA0701380E0380EA0C07121C3838030090C7FC12
+781270A2EAF1F0EAF21CEAF406EAF807EB0380A200F013C0A51270A214801238EB07001218EA0C
+0E6C5AEA01F0>18 31 2 1 23]54 dc[<1240387FFFC01480A238400100EA8002A25B485AA25B
+5BA25BA213C0A212015B1203A41207A76CC7FC>18 31 3 1 23]55 dc[<EA03F0EA0C0CEA1006
+EA3003382001801260A3127038780300123EEA3F06EA1FC8EA0FF0EA03F8487EEA0C7EEA103F38
+300F80EA6003384001C012C01300A31480EA600100201300EA1002EA0C0CEA03F0>18 31 2 1
+23]56 dc[<EA03F0EA0E18487E487E13071270EB038012F0A214C0A5EA7007A21238EA180BEA0E
+13EA03E338000380A3EB07001230EA7806130EEA700CEA2018EA1070EA0FC0>18 31 2 1 23]
+57 dc[<127012F8A312701200AA127012F8A31270>5 20 4 0 13]58 dc[<127012F8A3127012
+00AA127012F012F8A212781208A31210A31220A21240>5 29 4 9 13]59 dc[<007FB512E0B612
+F0C9FCA8B612F06C14E0>28 12 3 -5 35]61 dc[<EA0FC0EA3070EA4038A2EAE03C12F0A21260
+EA0038137013E013C0EA0180A213005A1202A6C7FCA51207EA0F80A3EA0700>14 32 3 0 21]
+63 dc[<5B497EA3497EA3EB09E0A3EB10F0A3EB2078A3497EA3497EA2EBFFFE3801000FA30002
+EB0780A348EB03C0120E001FEB07E039FFC03FFE>31 32 1 0 34]65 dc[<B512E0380F803800
+07131E141F801580A515005C141E5CEBFFF0EB803C80801580140715C0A51580140F15005C000F
+133CB512F0>26 31 2 0 32]66 dc[<90380FC04090387030C03801C009380380053807000300
+0E1301001E1300121C123C007C1440A2127800F81400A91278007C1440A2123C121C001E148012
+0E6CEB0100380380026C6C5A38007038EB0FC0>26 33 3 1 33]67 dc[<B512E0380F803C0007
+7F1407EC038015C0EC01E0A215F01400A215F8A915F0A3EC01E0A2EC03C01580EC0700140E000F
+133CB512E0>29 31 2 0 35]68 dc[<B6FC380F800F00071303A28015801400A314801500A313
+8113FF13811380A4EC0020A31540A315C0A2EC0180000F130FB6FC>27 31 2 0 31]69 dc[<B6
+FC380F800F00071303A28015801400A4EC8000A4138113FF13811380A491C7FCA8487EEAFFFE>
+25 31 2 0 30]70 dc[<90380FE02090387818609038E004E03803800238070001481300001E14
+60A25A1520127C127800F81400A7EC7FFCEC03E000781301127C123CA27EA27E7E380380023900
+E00460903878182090380FE000>30 33 3 1 36]71 dc[<39FFF8FFF8390F800F8000071400AC
+90B5FCEB800FAE000F148039FFF8FFF8>29 31 2 0 34]72 dc[<EAFFFCEA0FC0EA0780B3A9EA
+0FC0EAFFFC>14 31 1 0 16]73 dc[<380FFF8038007C00133CB3A3122012F8A3EAF038EA4078
+1370EA30E0EA0F80>17 32 2 1 23]74 dc[<39FFFC0FFC390FC003E03907800180150014025C
+5C5C5C5C5C0181C7FC1383EB8780138FEB93C0EB91E013A1EBC0F01380147880A280A280EC0780
+A215C0D80FC013E039FFFC3FFC>30 31 2 0 35]75 dc[<EAFFFEEA0FC06C5AB21402A4140614
+04A2140C141C000F137CB512FC>23 31 2 0 28]76 dc[<B46CEB1FF8000F158000071500D805
+C0132FA3D804E0134FA20170138FA3903838010FA3EB1C02A3EB0E04A3EB0708A3EB0390A2EB01
+E0A3380E00C0001FEC1F803AFFE0C1FFF8>37 31 2 0 42]77 dc[<39FF803FF83907C007C0EC
+03803905E00100A2EA04F01378A2133CA2131E130FA2EB0781A2EB03C1EB01E1A2EB00F1A21479
+143DA2141FA28080A2000E7F121F38FFE001>29 31 2 0 34]78 dc[<EB1F80EBF0F03801C038
+3807801E48487E000E7F001E148048EB03C0A2007C14E000781301A200F814F0A9007814E0007C
+1303A2003C14C0A26CEB0780000E1400000F5B3807801E3801C0383800F0F0EB1F80>28 33 3 1
+35]79 dc[<B512E0380F80780007131C141E801580A61500141E141C1478EBFFE00180C7FCAD48
+7EEAFFFC>25 31 2 0 31]80 dc[<EB1F80EBF0F03801C0383807801E48487E000E7F001E1480
+48EB03C0A2007C14E0A20078130100F814F0A9007814E0A2007C1303003C14C0130F391E108780
+390E20C700000F13CF3807A0FE3801E0F83900F0F010131FEB0070EC7830EC3870EC3FF015E014
+1FEC0FC0EC0780>28 41 3 9 35]81 dc[<B57E380F80F0000713788080A2141FA4141EA25C5C
+5CEBFF80EB81C0EB80E08014701478A3147CA31504147E143E390FC01E0839FFFC0F10C7EA03E0
+>30 32 2 1 33]82 dc[<3807E080EA0C19EA1007EA3003EA6001A212E01300A36C1300A21278
+127FEA3FF0EA1FFC6C7EEA03FF38001F801307EB03C0A213011280A400C01380130300E01300EA
+F006EACE0CEA81F8>18 33 3 1 25]83 dc[<007FB512E038780F010060EB006000401420A200
+C0143000801410A400001400B3497E3807FFFE>28 31 2 0 33]84 dc[<39FFFC3FF8390FC007
+C03907800380EC0100B3A300031302A2EA01C05C6C6C5AEB7018EB3820EB0FC0>29 32 2 1 34]
+85 dc[<39FFF003FE391F8000F86CC712607F00071440A26C6C1380A33901E00100A213F00000
+1302A2EBF806EB7804A26D5AA36D5AA2EB1F30EB0F20A2EB07C0A36D5AA36DC7FC>31 32 1 1
+34]86 dc[<3BFFF07FF81FF03B1F800FC007C03B0F0007800380EE010015C0D807801402A33A03
+C009E004A39039E010F00C00011508A2EC2078D800F05CA2EC403C01785CA2ECC03E90393C801E
+40A390391F000F80A3011E1307010E91C7FCA2010C7F01041302>44 32 1 1 47]87 dc[<397F
+F81FF8390FE00FC03907C00700000313026C6C5AEBF00C00001308EB7810137CEB3C20EB3E4013
+1E6D5AA213076D7E497E1305EB09F0EB18F8EB1078EB207CEB603CEB401EEB801F00017F903800
+0780000214C000071303391F8007E039FFE01FFE>31 31 1 0 34]88 dc[<39FFF003FF391F80
+00F8000F1460000714407F6C6C138012019038F0010000005BEBF802EB7C04133CEB3E08131EEB
+1F10EB0FB0EB07A014C01303AB1307EB7FFE>32 31 1 0 34]89 dc[<387FFFF8EA7C00007013
+F0386001E0124038C003C0A238800780130F1400EA001EA25BA25B13F85B485AA23803C004A2EA
+0780120FEB000C121E1408481318A248133838F801F8B5FC>22 31 3 0 28]90 dc[<12FEA212
+C0B3B3A512FEA2>7 45 4 11 13]91 dc[<EA0804EA1008EA2010A2EA4020A2EA8040A3EAB85C
+EAFC7EA2EA7C3EEA381C>15 14 5 -18 23]92 dc[<12FEA21206B3B3A512FEA2>7 45 1 11 13
+]93 dc[<120812101220A21240A21280A312B812FCA2127C1238>6 14 3 -18 13]96 dc[<EA1F
+E0EA3030EA7818131CEA300E1200A313FEEA078EEA1E0E1238127800F01310A3131E1278383867
+20380F83C0>20 20 2 0 23]97 dc[<120E12FE120EAA133EEBC380380F01C0EB00E0120E1470
+A21478A61470A214E0120F380D01C0380CC300EA083E>21 32 1 0 25]98 dc[<EA03F8EA0E0C
+EA1C1E1238130CEA7000A212F0A61270A2EA3801A2EA1C02EA0E0CEA03F0>16 20 2 0 20]99
+dc[<EB0380133F1303AAEA03E3EA061BEA1C07EA3803A21270A212F0A61270A212381307121CEA
+0E1B3803E3F8>21 32 2 0 25]100 dc[<EA03F0EA0E1C487E487EA21270EB038012F0A2B5FC00
+F0C7FCA31270A26C13801218381C0100EA0706EA01F8>17 20 1 0 20]101 dc[<137C13C6EA01
+8F1203EA07061300A7EAFFF0EA0700B2EA7FF0>16 32 0 0 14]102 dc[<14E03803E330EA0E3C
+EA1C1C38380E00EA780FA5EA380E6C5AEA1E38EA33E00020C7FCA21230A2EA3FFE381FFF806C13
+C0383001E038600070481330A4006013606C13C0381C03803803FC00>20 31 1 10 23]103 dc[
+<120E12FE120EAA133E1343EB8180380F01C0A2120EAE38FFE7FC>22 32 1 0 25]104 dc[<12
+1C123EA3121CC7FCA6120E127E120EB1EAFFC0>10 31 0 0 12]105 dc[<13E0EA01F0A3EA00E0
+1300A61370EA07F012001370B3A31260EAF06013C0EA6180EA3F00>12 40 -2 9 14]106 dc[<
+120E12FE120EAAEB0FF0EB03C0140013025B5B5B1330137013F8EA0F38EA0E1C131E130E7F1480
+130314C014E038FFCFF8>21 32 1 0 24]107 dc[<120E12FE120EB3ABEAFFE0>11 32 0 0 12]
+108 dc[<390E1F01F039FE618618390E81C81C390F00F00EA2000E13E0AE3AFFE7FE7FE0>35 20
+1 0 38]109 dc[<EA0E3EEAFE43380E8180380F01C0A2120EAE38FFE7FC>22 20 1 0 25]110
+dc[<EA01F8EA070E381C0380383801C0A2387000E0A200F013F0A6007013E0A2383801C0A2381C
+038038070E00EA01F8>20 20 1 0 23]111 dc[<EA0E3E38FEC380380F01C0EB00E0120E14F014
+701478A6147014F014E0EA0F0114C0380EC300133E90C7FCA8EAFFE0>21 29 1 9 25]112 dc[<
+3803E080EA0619EA1C05EA3C07EA38031278127012F0A61270127812381307EA1C0BEA0E13EA03
+E3EA0003A8EB3FF8>21 29 2 9 24]113 dc[<EA0E78EAFE8CEA0F1EA2130CEA0E00AEEAFFE0>
+15 20 1 0 18]114 dc[<EA1F90EA3070EA4030EAC010A3EAE0001278EA7F80EA3FE0EA0FF0EA
+0070EA80381318A212C0A2EAE030EAD060EA8F80>13 20 2 0 18]115 dc[<1202A31206A2120E
+A2123EEAFFF8EA0E00AB1308A5EA06101203EA01E0>13 28 1 0 18]116 dc[<380E01C0EAFE1F
+EA0E01AE13031206EA030D3801F1FC>22 20 1 0 25]117 dc[<38FF83F8381E01E0381C00C06C
+1380A338070100A2EA0382A3EA01C4A213ECEA00E8A21370A31320>21 20 1 0 24]118 dc[<39
+FF9FE1FC393C078070391C030060EC8020000E1440A214C0D807071380130414E0390388610014
+71EBC8733801D032143A3800F03CEBE01CA2EB6018EB4008>30 20 1 0 33]119 dc[<387FC3FC
+380F01E0000713C0148038038100EA01C2EA00E413EC13781338133C137C134E1387EA01073803
+0380380201C0000613E0121E38FF03FE>23 20 0 0 24]120 dc[<38FF83F8381E01E0381C00C0
+6C1380A338070100A2EA0382A3EA01C4A213ECEA00E8A21370A31320A25BA3EAF080A200F1C7FC
+1262123C>21 29 1 9 24]121 dc[<EA3FFFEA380E1220131CEA403813781370EA00E0120113C0
+EA038012071301120E121EEA1C03EA3802EA7006130EEAFFFE>16 20 1 0 20]122 dc[<B512FC
+>22 1 0 -12 23]123 dc[<B812F0>44 1 0 -12 45]124 dc dfe /fn df[<120FEA3F80EA7F
+C013E0EAFFF0A213F8A2127FA2123FEA0F381200A31370A313E0A2120113C0EA0380A2EA070012
+0E5A5A1210>13 29 7 -31 27]39 dc[<DB1FFE14600203B500E013E0021FECF801027FECFE03
+903B01FFFC00FF07010701C0EB1FCF4990C7EA07FFD91FFC1401D93FF0804948157F4948153F48
+49151F4890C9120F5A48481607A248481603A2485A1801A2127FA24993C7FCA212FFAB127FA27F
+F001E0123FA36C7EF003C06C7EA26C6CEE07807E6C6DED0F006C6D5D6D6C153E6D6C5DD91FFC5D
+6DB4EC03F06D01C0EB0FE0010101FCEB7F806D6CB6C7FC021F14FC020314E09126001FFEC8FC>
+59 61 5 1 70]67 dc[<B87E17F817FF18C028007FF000077F9338007FF8EF1FFC717EEF03FF71
+13807113C0F07FE0A2F03FF019F8181FA219FCA2F00FFEA519FFAC19FEA419FC181FA219F8183F
+19F0187F19E0F0FFC05F4D13804D1300EF1FFEEF7FF8933807FFF0B912C095C7FC17F81780>64
+59 4 0 74]68 dc[<B912C0A43A007FF000079338007FE0173F170F1707A21703A21701A418F0
+EEF000A41800A21501A21503150F91B5FCA4ECF00F15031501A21500A693C8FCAEB612FEA4>52
+59 4 0 61]70 dc[<DB1FFC14C00203B5EAC001021FECF003027FECFC07903B01FFFC00FE0F01
+0701C0EB1F9F4948C7EA07FFD93FF880494814004948157F485B4A153F4890C9121F485A000F17
+0F5B001F1707A2485A1803A2127FA24993C8FCA212FFAA041FB61280127FA27FDC0001EBC00012
+3FA36C7EA26C7EA26C7E7E6C7F806C7F6D6C5CEB3FFCD90FFF5C6D01C0EB1FBF010101FCEBFF1F
+6D6CB5EAFE0F021FECF8030203ECE0009126001FFEC9FC>65 61 5 1 76]71 dc[<B500F00207
+B512E0808080D8007F92390007E0006E6F5A81017B7F81137901787F6E7E6E7E81141F6E7E6E7F
+6E7F82806E7F6F7E6F7E826F7E816F13806F13C017E06F13F081EE7FF8EE3FFC17FEEE1FFF8270
+13837013C318E37013F382EF7FFBEF3FFFA283838383A28383187F183FA201FC161FB500FC150F
+18071803A2>67 59 4 0 76]78 dc[<B600F8011FB51280A426007FF0C8381F800072C7FCB3B3
+A3013F161EA280011F5EA26D6C5D010716F86E4A5A6D6C14036D6D495A6D01E0EB1FC0913A3FFC
+01FF806EB548C8FC020714F8020014E0DB0FFEC9FC>65 60 4 1 74]85 dc[<EE3F80ED3FFFA4
+150181B0ECFF80010F13F0013F13FC9038FFC03F3901FE000F4848130348487F48487F121F485A
+A2127F5BA312FFA9127FA36C7EA2121F6C6C5B00075C6C6C5BD801FE011F13C02700FF807E13FE
+90387FFFF8010F13E001011300>47 60 3 0 54]100 dc[<49B47E010F13F0013F13FC9038FF81
+FE3A03FE007F80D807F8133F000FEC1FC049EB0FE0485A003F15F01507485A16F8A212FFA290B6
+FCA301C0C8FCA4127FA36C7E1678121F7F000F15F06C6C13016C6CEB03E06C6CEB0FC03A00FFC0
+7F8090393FFFFE00010F13F8010013C0>37 38 3 0 44]101 dc[<EA01E0EA07F8487EA2487EA4
+6C5AA26C5AEA01E0C8FCAB13FE12FFA412071203B3AAB512F0A4>20 61 3 0 26]105 dc[<3901
+FC03F000FFEB0FFC4AB4FC91383C3F80EC707F00079038E0FFC000035BEBFD80A201FFEB7F8091
+38003F00151E92C7FC5BB3A3B512FCA4>34 38 3 0 40]114 dc[<90383FF0703903FFFEF04813
+FF381FC01F383F0003003E13015A140012FCA27E6C140013C013FC387FFFF06C13FEECFF806C14
+C06C14E0000314F0C614F8011F13FCEB007FEC07FE0070130100F01300157E7EA27E157C6C14FC
+6C14F890388001F09038F00FE000F9B512C0D8F07F130038C01FF8>31 38 3 0 38]115 dc[<13
+0FA55BA45BA25BA25B5A5A5A001FEBFFF0B6FCA3000190C7FCB3153CA86C14781480017F13F090
+383FC1E090381FFFC06D1380903801FE00>30 55 2 0 38]116 dc[<01FEEC3F8000FFEC3FFFA4
+00071401000380B3A45DA25D120115066C6C4913C090267F807813FE6DB45A6D5B01031380>47
+38 4 0 54]117 dc dfe end
+%%EndProlog
+%%BeginSetup
+%%Feature: *Resolution 300
+ TeXDict begin @letter
+%%EndSetup
+%%Page: 1 1
+ bop 0 693 a fn(NetCDF)32 b(User's)h(Guide)0 726 y 1950 17 v 1374 774 a fm
+(An)16 b(In)o(terface)f(for)f(Data)g(Access)1494 828 y(V)l(ersion)i(2.3,)e
+(April)i(1993)0 2467 y fl(Russ)22 b(Rew,)f(Glenn)j(Da)n(vis,)e(and)h(Stev)n
+(e)g(Emmerson)0 2534 y(Unidata)g(Program)f(Cen)n(ter)0 2570 y 1950 9 v eop
+%%Page: 2 2
+ bop 0 1690 a fm(Cop)o(yrigh)o(t)226 1689 y(c)214 1690 y fk(\015)15 b fm(1993)
+f(Universit)o(y)h(Corp)q(oration)g(for)f(A)o(tmospheric)i(Researc)o(h)0 1827 y
+(P)o(ermission)k(is)h(gran)n(ted)f(to)f(mak)n(e)h(and)g(distribute)h(v)o(erba\
+tim)e(copies)i(of)e(this)h(man)o(ual)g(pro)o(vided)h(that)e(the)0 1889 y(cop)
+o(yrigh)o(t)e(notice)h(and)f(these)h(paragraphs)e(are)h(preserv)o(ed)h(on)f
+(all)i(copies.)27 b(The)17 b(soft)n(w)o(are)g(and)g(an)o(y)g(accom-)0 1951 y
+(pan)o(ying)j(written)f(materials)h(are)f(pro)o(vided)h(\\as)f(is")h(without)
+f(w)o(arran)n(t)n(y)h(of)f(an)n(y)h(kind.)33 b(UCAR)20 b(expressly)0 2014 y
+(disclaims)e(all)g(w)o(arran)n(ties)f(of)f(an)o(y)g(kind,)i(either)f(expresse\
+d)h(or)e(implied,)j(including)g(but)e(not)f(limited)j(to)d(the)0 2076 y(impli\
+ed)i(w)n(arran)n(ties)e(of)f(merc)n(han)o(tability)g(and)h(\014tness)f(for)g
+(a)g(particular)h(purp)q(ose.)0 2213 y(The)e(Unidata)g(Program)e(Cen)o(ter)h
+(is)h(managed)f(b)o(y)g(the)h(Universit)o(y)f(Corp)q(oration)g(for)g(A)n(tmos\
+pheric)h(Research)0 2275 y(and)h(sp)q(onsored)g(b)o(y)f(the)h(National)g(Scie\
+nce)i(F)l(oundation.)j(An)o(y)14 b(opinions,)i(\014ndings,)g(conclusions,)g
+(or)e(recom-)0 2337 y(mendations)j(expressed)g(in)h(this)f(publication)i(are)
+d(those)g(of)g(the)h(author\(s\))e(and)i(do)f(not)h(necessarily)h(re\015ect)0
+2400 y(the)d(views)h(of)f(the)g(National)h(Science)h(F)l(oundation.)0 2537 y
+(Men)o(tion)e(of)g(an)o(y)g(commercial)h(compan)o(y)f(or)g(pro)q(duct)g(in)h
+(this)g(do)q(cument)f(do)q(es)g(not)g(constitute)g(an)g(endorse-)0 2599 y(men)
+o(t)j(b)o(y)g(the)h(Unidata)g(Program)e(Cen)o(ter.)29 b(Unidata)19 b(do)q(es)
+f(not)g(authorize)h(an)o(y)f(use)h(of)f(information)h(from)0 2661 y(this)d
+(publication)h(for)e(adv)n(ertising)h(or)f(publicit)q(y)g(purp)r(oses.)p eop
+%%Page: 1 3
+ bop 0 -58 a fm(F)l(orew)n(ord)1743 b(1)0 183 y fj(F)-7 b(orew)n(ord)62 378 y
+fm(Unidata)23 b(is)g(a)e(National)i(Science)h(F)l(oundation-sp)r(onsored)e
+(program)f(emp)r(o)n(w)o(ering)i(U.S.)f(univ)o(ersities,)0 440 y(through)17 b
+(inno)o(v)n(ativ)n(e)h(applications)g(of)f(computers)g(and)g(net)o(w)n(orks,)
+g(to)f(mak)n(e)h(the)h(b)q(est)f(use)g(of)g(atmospheric)0 503 y(and)i(related)
+g(data)f(for)g(enhancing)i(education)g(and)f(researc)n(h.)31 b(The)19 b(Unida\
+ta)g(Program)e(Cen)o(ter)h(currently)0 565 y(o\013ers)i(universities)g(sev)o
+(eral)g(\(supp)q(orted\))f(soft)n(w)o(are)g(pac)o(k)m(ages)h(for)e(analyzing)
+j(and)f(displaying)g(suc)o(h)g(data,)0 627 y(some)d(dev)o(elop)r(ed)h(b)o(y)f
+(Unidata)g(and)g(some)g(b)o(y)g(other)g(organizations,)g(including)j(NASA,)d
+(the)h(Univ)o(ersit)o(y)f(of)0 689 y(Wisconsin,)c(Purdue)f(Universit)o(y)l
+(,)g(and)f(MacDonald)h(Dett)n(wiler.)19 b(Underlying)14 b(these)d(is)h(a)f
+(Unidata-)h(dev)o(elop)s(ed)0 752 y(system)j(for)g(acquiring)h(and)g(managing)
+f(data)g(in)h(real)g(time,)f(making)h(practical)g(the)g(Unidata)f(principle)k
+(that)0 814 y(eac)o(h)h(univ)o(ersit)o(y)g(should)g(acquire)h(and)f(manage)f
+(its)g(o)o(wn)g(data)g(holdings)i(as)e(lo)r(cal)h(requirements)f(dictate.)0
+876 y(\(It)i(is)g(signi\014cant)g(that)f(the)h(Unidata)h(program)d(has)i(no)g
+(data)f(center)g({)h(the)g(managemen)n(t)g(of)g(data)f(is)h(a)0 939 y(\\distr\
+ibuted")16 b(function.\))62 1077 y(The)21 b(Net)n(w)o(ork)e(Common)h(Data)f
+(F)l(orm)g(\(netCDF\))g(soft)n(w)n(are)h(describ)s(ed)g(in)h(this)g(guide)g
+(w)o(as)e(originally)0 1139 y(intended)g(to)g(pro)n(vide)i(a)d(common)h(data)
+f(access)i(metho)q(d)f(for)f(the)i(v)m(arious)f(Unidata)g(applications.)34 b
+(These)0 1202 y(deal)17 b(with)g(a)f(v)n(ariet)n(y)h(of)f(data)g(t)n(yp)q(es)
+h(that)f(encompass)g(single-p)s(oint)g(observ)m(ations,)g(time)h(series,)g
+(regularly-)0 1264 y(spaced)f(grids,)f(and)g(satellite)i(or)d(radar)h(images.)
+62 1403 y(The)h(netCDF)f(soft)n(w)n(are)g(functions)i(as)e(an)g(I/O)h(library)
+m(,)f(callable)j(from)c(C)i(or)e(F)o(OR)m(TRAN,)h(which)h(stores)0 1465 y(and)
+e(retriev)o(es)f(scienti\014c)i(data)e(structures)g(in)h(self-)h(describing,)
+g(mac)o(hine-indep)t(endent)e(\014les.)20 b(Eac)o(h)14 b(netCDF)0 1527 y(\014\
+le)k(can)g(con)o(tain)f(an)h(unlimited)h(n)o(um)o(b)r(er)e(of)g(m)n(ulti-dime\
+nsional)q(,)j(named)e(v)m(ariables)g(\(with)g(di\013ering)h(t)n(yp)r(es)0 1589
+y(that)h(include)j(integers,)e(reals,)h(c)o(haracters,)f(b)o(ytes,)g(etc.\),)
+g(and)g(eac)o(h)g(v)m(ariable)h(ma)n(y)f(b)q(e)g(accompanied)h(b)o(y)0 1652 y
+(ancillary)i(data,)e(suc)o(h)h(as)e(units)i(of)e(measure)h(or)g(descriptive)g
+(text.)40 b(The)22 b(interface)g(includes)i(a)e(metho)q(d)0 1714 y(for)d(app)
+q(ending)i(data)e(to)g(existing)h(netCDF)f(\014les)h(in)h(prescrib)r(ed)f(w)n
+(a)o(ys,)g(functionality)g(that)e(is)i(not)f(unlik)q(e)0 1776 y(a)f(\(\014xed)
+h(length\))g(record)f(structure.)30 b(Ho)n(w)o(ev)o(er,)19 b(the)f(netCDF)g
+(library)i(also)e(allo)o(ws)h(direct-access)g(storage)0 1838 y(and)d(retriev)
+n(al)g(of)g(data)f(b)o(y)h(v)n(ariable)h(name)f(and)g(index)h(and)g(therefore)
+e(is)i(useful)g(only)g(for)e(disk-residen)q(t)h(\(or)0 1901 y(memory-)f(resid\
+ent\))f(\014les.)62 2039 y(NetCDF)20 b(access)h(has)g(b)r(een)g(implemen)q
+(ted)g(in)g(ab)r(out)f(half)h(of)g(Unidata's)f(soft)n(w)o(are,)i(so)e(far,)h
+(and)g(it)g(is)0 2102 y(planned)c(that)d(suc)o(h)i(commonalit)o(y)f(will)i
+(extend)f(across)e(all)i(Unidata)g(applications)g(in)g(order)f(to:)37 2240 y
+fk(\017)30 b fm(F)l(acilitate)16 b(the)f(use)h(of)f(common)g(data)f(\014les)i
+(b)o(y)f(distinct)i(applications.)37 2316 y fk(\017)30 b fm(P)o(ermit)16 b
+(data)g(\014les)h(to)e(b)r(e)h(transp)q(orted)g(b)q(et)o(w)n(een)h(or)f(share\
+d)g(b)o(y)g(dissimilar)i(computers)f(transparen)n(tly)l(,)90 2379 y(i.e.,)e
+(without)g(translation.)37 2455 y fk(\017)30 b fm(Reduce)21 b(the)f(programmi\
+ng)g(e\013ort)f(usually)j(sp)q(en)o(t)e(in)o(terpreting)g(formats)f(in)i(a)e
+(w)o(a)n(y)h(that)f(is)i(equally)90 2517 y(e\013ective)16 b(for)e(F)n(OR)n
+(TRAN)h(and)h(C)e(programmers.)37 2594 y fk(\017)30 b fm(Reduce)17 b(errors)d
+(arising)i(from)e(misinterpreting)i(data)e(and)i(ancillary)h(data.)37 2670 y
+fk(\017)30 b fm(F)l(acilitate)16 b(using)g(output)f(from)g(one)g(application)
+i(as)d(input)j(to)d(another.)p eop
+%%Page: 2 4
+ bop 0 -58 a fm(2)1488 b(NetCDF)14 b(User's)h(Guide)37 183 y fk(\017)30 b fm
+(Establish)14 b(an)f(interface)g(standard)g(whic)o(h)h(simpli\014es)h(the)f
+(inclusion)h(of)e(new)h(soft)n(w)n(are)f(into)f(the)i(Unidata)90 246 y(system\
+.)62 457 y(A)k(measure)g(of)g(success)h(has)e(b)r(een)i(ac)n(hieved.)29 b(The)
+18 b(netCDF)g(is)g(no)o(w)g(in)h(use)f(on)g(computing)g(platforms)0 519 y(tha\
+t)c(range)g(from)f(CRA)m(Ys)h(to)g(P)n(ersonal)h(Computers)f(and)g(include)j
+(man)o(y)d(\(UNIX-)h(and)f(VMS-based\))h(w)n(ork-)0 582 y(stations.)28 b(It)
+18 b(can)g(b)q(e)g(used)h(to)e(create)h(a)g(complex)h(data)e(set)h(on)f(one)i
+(computer)e(\(sa)o(y)g(in)i(F)o(OR)m(TRAN\))f(and)0 644 y(retriev)o(e)e(that)
+e(same)i(\(self-describing\))h(data)e(set)g(on)g(another)h(computer)f(\(sa)n
+(y)g(in)i(C\))e(without)g(intermediate)0 706 y(translations)h({)f(netCDF)g
+(\014les)h(can)g(b)r(e)f(transferred)g(across)g(a)h(net)n(w)o(ork,)f(or)g(the\
+y)h(can)f(b)r(e)h(accessed)g(remotely)0 769 y(using)g(a)f(suitable)h(net)o
+(w)o(ork)e(\014le)j(system.)62 906 y(Because)c(w)o(e)f(b)q(eliev)q(e)g(that)g
+(the)g(use)g(of)g(netCDF)g(access)g(in)h(non-Unidata)g(soft)n(w)n(are)f(will)
+i(b)q(ene\014t)f(Unidata's)0 968 y(primary)j(constituency)g({)g(suc)o(h)f(use)
+h(ma)o(y)f(result)h(in)h(more)e(options)h(for)f(analyzing)i(and)e(displaying)
+i(Unidata)0 1030 y(information)f({)g(the)g(netCDF)f(library)h(is)h(distribute\
+d)g(without)f(licensing)i(or)e(other)f(signi\014cant)h(restrictions,)0 1092 y
+(and)g(curren)o(t)g(v)n(ersions)h(can)f(b)q(e)g(obtained)h(via)f(anon)n(ymous)
+g(FTP)l(.)f(Apparen)o(tly)h(the)g(soft)n(w)o(are)f(has)h(b)r(een)g(w)o(ell)0
+1155 y(received)d(b)o(y)g(a)g(wide)h(range)f(of)f(institutions)j(b)q(ey)o(ond)
+e(the)h(atmospheric)f(science)i(comm)n(unity)l(,)e(and)g(a)g(substan-)0 1217 y
+(tial)k(n)o(um)n(b)r(er)f(of)g(public)i(domain)e(and)g(commercial)h(data)f
+(analysis)g(systems)g(can)g(no)o(w)f(accept)i(netCDF)e(\014les)0 1279 y(as)g
+(input.)62 1416 y(Sev)o(eral)f(organizations)f(ha)n(v)o(e)g(adopted)g(the)h
+(netCDF)e(as)g(a)h(data)f(access)i(standard,)e(and)i(there)f(is)g(an)g(e\013o\
+rt)0 1478 y(underw)o(a)o(y)g(at)f(the)h(National)h(Cen)o(ter)e(for)h(Sup)r
+(ercomputer)g(Applications)i(\(NCSA,)d(which)h(is)g(asso)q(ciated)h(with)0
+1541 y(the)k(Universit)o(y)f(of)h(Illinois)i(at)e(Urbana-Champaign\))f(to)h
+(supp)q(ort)f(the)h(netCDF)g(programming)f(in)o(terfaces)0 1603 y(as)c(a)h
+(means)g(to)f(store)g(and)h(retriev)o(e)g(data)f(in)h(\\HDF)f(\014les,")i(i.e\
+.,)e(in)i(the)f(format)e(used)j(b)o(y)e(the)h(p)r(opular)g(NCSA)0 1665 y(to)q
+(ols.)20 b(W)l(e)15 b(ha)o(v)o(e)g(encouraged)g(and)h(co)q(op)q(erated)f(with)
+h(these)f(e\013orts.)62 1802 y(Questions)25 b(o)q(ccasionally)g(arise)f(ab)q
+(out)f(the)h(lev)o(el)h(of)e(supp)r(ort)f(pro)o(vided)j(for)e(the)g(netCDF)g
+(soft)n(w)o(are.)0 1864 y(Unidata's)13 b(formal)g(p)r(osition,)h(stated)f(in)
+h(the)g(cop)o(yrigh)o(t)f(notice)h(which)f(accompanies)i(the)e(netCDF)g(libra\
+ry)m(,)g(is)0 1927 y(that)g(the)h(soft)n(w)o(are)g(is)g(pro)o(vided)h(\\as)e
+(is")h(...)19 b(In)c(practice,)f(the)g(soft)n(w)o(are)f(is)i(up)r(dated)f(fro\
+m)f(time)h(to)g(time,)g(and)0 1989 y(Unidata)k(intends)g(to)f(con)o(tin)o(ue)
+h(making)g(impro)o(v)o(emen)o(ts)g(for)f(the)h(foreseeable)g(future.)28 b(Bec\
+ause)18 b(Unidata's)0 2051 y(mission)13 b(is)f(to)f(serv)o(e)h(atmospheric)g
+(scientists)f(at)h(U.S.)f(universities,)i(problems)f(rep)r(orted)f(b)o(y)h
+(that)f(comm)n(unity)0 2114 y(necessarily)17 b(receiv)o(e)f(the)f(greatest)f
+(atten)n(tion.)62 2250 y(W)l(e)i(hop)q(e)g(the)g(reader)f(will)i(\014nd)f(the)
+g(soft)n(w)n(are)g(useful)g(and)g(will)h(giv)o(e)f(us)f(feedback)g(on)h(its)f
+(application)i(as)0 2313 y(w)o(ell)f(as)f(suggestions)g(for)g(its)g(impro)o
+(v)o(emen)o(t.)0 2450 y(Da)n(vid)h(F)l(ulker)0 2512 y(Unidata)g(Program)d(Cen)
+o(ter)i(Director)g(Universit)o(y)g(Corp)q(oration)f(for)h(A)o(tmospheric)h
+(Researc)o(h)p eop
+%%Page: 3 5
+ bop 0 -58 a fm(Summary)1736 b(3)0 183 y fj(Summary)62 370 y fm(The)19 b(purp)
+r(ose)g(of)f(the)h(Net)o(w)o(ork)f(Common)g(Data)g(F)l(orm)g(\(netCDF\))g(in)
+o(terface)h(is)g(to)g(allo)o(w)g(y)o(ou)f(to)h(cre-)0 432 y(ate,)j(access,)g
+(and)f(share)g(scienti\014c)g(data)f(in)i(a)f(form)f(that)g(is)i(self-describ\
+ing)h(and)e(net)o(w)o(ork-transparen)n(t.)0 495 y(\\Self-describing")f(means)
+d(that)g(a)h(\014le)g(includes)i(information)e(de\014ning)h(the)f(data)e(it)i
+(con)o(tains.)27 b(\\Net)o(w)n(ork-)0 557 y(transparen)n(t")18 b(means)h(that)
+f(a)g(\014le)h(is)g(represented)f(in)i(a)e(form)g(that)g(can)g(b)r(e)h(access\
+ed)g(b)o(y)f(computers)h(with)0 619 y(di\013eren)q(t)e(w)o(a)n(ys)h(of)g(stor\
+ing)f(integers,)h(c)o(haracters,)f(and)h(\015oating-p)r(oin)o(t)g(n)o(um)o
+(b)q(ers.)28 b(Using)19 b(the)f(netCDF)f(in-)0 681 y(terface)h(for)g(creating)
+h(new)g(scienti\014c)g(data)f(sets)h(can)g(impro)o(v)n(e)g(the)g(accessibilit)
+q(y)g(of)f(the)h(data.)30 b(Using)19 b(the)0 744 y(netCDF)13 b(interface)h
+(in)h(new)f(soft)n(w)n(are)g(for)g(scien)o(ti\014c)h(data)f(access,)g(managem\
+en)n(t,)g(analysis,)g(and)h(display)f(can)0 806 y(impro)o(v)o(e)h(the)g(reusa\
+bilit)q(y)g(of)g(the)g(soft)n(w)o(are)f(for)h(other)g(data)f(sets)h(and)h(b)o
+(y)f(other)g(users.)62 943 y(The)f(netCDF)g(soft)n(w)n(are)g(pro)n(vides)h
+(common)f(C)g(and)g(F)n(OR)m(TRAN)h(in)o(terfaces)f(for)f(applications)j(and)
+e(data.)0 1005 y(The)23 b(C)f(interface)g(library)h(is)g(a)o(v)m(ailable)h
+(for)e(man)o(y)g(common)h(computing)g(platforms,)g(including)i(v)n(arious)0
+1067 y(v)o(ersions)13 b(of)g(UNIX,)g(VMS,)g(MSDOS)g(and)h(OS/2)f(en)o(vironme\
+nts.)18 b(The)c(F)n(OR)m(TRAN)g(in)o(terface,)f(implemen)q(ted)0 1130 y(in)h
+(C,)e(is)h(a)n(v)n(ailable)h(for)e(man)o(y)g(of)h(the)f(platforms)h(on)f(whic\
+h)h(the)f(C)h(interface)f(is)h(a)o(v)m(ailable.)21 b(The)13 b(form)f(in)h(whi\
+ch)0 1192 y(the)21 b(F)n(OR)m(TRAN)g(in)o(terface)g(is)g(implemented)g(mak)n
+(es)g(it)f(easy)h(to)e(generate)i(and)f(test)g(a)g(new)h(F)o(OR)m(TRAN)0 1254
+y(interface)g(for)h(a)g(new)g(platform)g(b)o(y)g(sp)q(ecifying)i(the)e(con)o
+(v)o(en)o(tions)g(for)g(calling)i(C)e(from)f(F)n(OR)m(TRAN.)i(An)0 1316 y(exp)
+r(erimen)o(tal)16 b(C)p fi(++)e fm(protot)n(yp)q(e)i(in)o(terface)f(is)h(curr\
+en)o(tly)g(under)g(ev)m(aluation.)62 1453 y(The)g(netCDF)f(soft)n(w)n(are)h
+(is)g(b)q(eing)h(made)e(freely)h(a)o(v)m(ailable)i(to)c(encourage)i(the)g(sha\
+ring)g(of)f(b)q(oth)g(scienti\014c)0 1516 y(data)g(and)g(the)g(soft)n(w)o(are)
+g(that)f(mak)n(es)i(the)f(data)g(useful.)p eop
+%%Page: 4 6
+ bop 0 -58 a fm(4)1488 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 5 7
+ bop 0 -58 a fm(Chapter)15 b(1:)k(Introduction)1447 b(5)0 183 y fj(1)41 b(In)
+m(tro)s(duction)0 455 y fl(1.1)33 b(The)15 b(NetCDF)e(In)n(terface)62 592 y fm
+(The)k(Net)o(w)n(ork)g(Common)e(Data)h(F)l(orm,)g(or)g(netCDF,)g(is)h(an)f
+(interface)g(to)g(a)h(library)g(of)f(data)g(access)h(pro-)0 654 y(grams)d(for)
+g(storing)h(and)g(retrieving)h(scienti\014c)g(data.)j(NetCDF)14 b(is)i(an)f
+(abstraction)g(that)f(supp)r(orts)g(a)h(view)g(of)0 716 y(data)j(as)g(a)g(col\
+lection)i(of)e(self-describing,)j(net)o(w)o(ork-transparen)n(t)d(ob)r(jects)g
+(that)g(can)g(b)r(e)g(accessed)h(through)0 778 y(a)h(simple)i(interface.)35 b
+(Collections)22 b(of)e(named)g(m)o(ultidimensional)k(v)m(ariables)d(can)g(b)q
+(e)g(randomly)g(accessed,)0 841 y(without)14 b(kno)o(wing)g(details)h(of)f
+(ho)o(w)f(the)i(data)e(are)h(stored.)19 b(Auxiliary)c(information)g(ab)q(out)
+f(the)g(data,)f(suc)o(h)h(as)0 903 y(what)i(units)h(are)f(used,)h(can)g(b)q
+(e)g(stored)f(with)h(the)g(data.)23 b(Generic)17 b(utilities)i(and)d(applicat\
+ion)j(programs)c(can)0 965 y(b)r(e)e(written)h(that)f(access)h(arbitrary)f
+(netCDF)g(\014les)i(and)f(transform,)e(com)o(bine,)i(analyze,)h(or)e(display)
+h(sp)q(eci\014ed)0 1027 y(\014elds)h(of)e(the)h(data.)19 b(The)14 b(dev)o(elo\
+pment)f(of)g(such)h(applications)h(ma)n(y)f(lead)g(to)f(impro)o(v)o(ed)h(acce\
+ssibilit)r(y)f(of)h(data)0 1090 y(and)h(impro)o(v)o(ed)h(reusability)f(of)g
+(soft)n(w)o(are)g(for)f(scienti\014c)i(data)e(managemen)o(t,)h(analysis,)g
+(and)g(displa)q(y)l(.)62 1227 y(The)k(netCDF)f(soft)n(w)o(are)g(implemen)q
+(ts)g(an)h fh(abstract)f(data)g(t)n(yp)r(e)p fm(,)h(which)g(means)g(that)f
+(all)i(op)q(erations)f(to)0 1289 y(access)f(and)g(manipulate)h(data)e(in)i
+(a)f(netCDF)f(\014le)i(m)n(ust)f(use)g(only)h(the)f(set)f(of)h(functions)g
+(pro)o(vided)h(b)o(y)f(the)0 1351 y(interface.)h(The)c(actual)g(represen)o
+(tation)g(of)f(the)h(data)f(is)i(hidden)g(from)e(applications)j(that)d(use)h
+(the)g(interface,)0 1414 y(so)h(that)g(ho)o(w)g(the)h(data)e(are)i(stored)f
+(could)h(b)r(e)g(c)n(hanged)g(without)g(a\013ecting)g(suc)o(h)g(programs.)23 b
+(The)17 b(ph)o(ysical)0 1476 y(represen)o(tation)10 b(of)g(netCDF)f(data)h
+(is)h(designed)g(to)f(b)q(e)h(indep)r(endent)f(of)g(the)g(computer)g(on)g(whi\
+ch)g(the)h(data)e(w)o(ere)0 1538 y(written.)26 b(F)l(uture)18 b(c)n(hanges)g
+(to)e(the)i(netCDF)e(interface)h(will)i(b)r(e)e(compatible)h(with)g(the)f(int\
+erface)g(describ)s(ed)0 1600 y(here,)e(so)g(that)g(neither)h(existing)g(netCD\
+F)e(\014les)j(nor)d(programs)g(accessing)i(them)g(will)g(require)g(mo)q(di\
+\014cation.)62 1737 y(The)e(netCDF)f(interface)g(is)i(supp)r(orted)e(for)g
+(b)r(oth)g(C)g(and)h(F)o(OR)m(TRAN,)g(and)g(for)f(UNIX,)h(VMS,)f(OS/2)h(and)0
+1800 y(MSDOS)g(op)q(erating)f(systems.)19 b(The)14 b(netCDF)f(soft)n(w)n(are)
+h(that)e(implemen)q(ts)h(this)h(interface)f(is)h(freely)g(a)o(v)m(ailable)0
+1862 y(via)h(FTP)g(and)g(free)h(of)e(licensing)k(restrictions)e(to)e(encourag\
+e)h(its)h(wide)g(use.)0 2085 y fl(1.2)33 b(NetCDF)14 b(is)h(Not)f(a)h(Databas\
+e)f(Managemen)n(t)g(System)62 2222 y fm(Wh)o(y)h(not)f(use)h(an)g(existing)h
+(database)e(managemen)o(t)g(system)h(\(DBMS\))f(for)g(storing)g(scienti\014c)
+i(data?)k(W)l(e)0 2284 y(lo)r(ok)n(ed)c(at)e(a)o(v)m(ailable)j(database)e(sof\
+t)n(w)n(are,)g(b)q(oth)g(commercial)h(and)g(researc)n(h-oriented,)f(and)h(con\
+cluded)h(that)0 2346 y(existing)g(pac)o(k)m(ages)f(are)f(curren)o(tly)i(inade\
+quate)f(for)g(the)g(kinds)g(of)g(scienti\014c)g(data)g(access)g(supp)r(orted)
+f(b)o(y)h(the)0 2408 y(netCDF)f(in)o(terface.)62 2545 y(First,)e(most)g(exist\
+ing)i(DBMSs)e(ha)o(v)o(e)g(p)r(o)q(or)g(supp)r(ort)g(for)g(m)n(ultidimensiona\
+l)k(ob)r(jects)d(as)f(the)h(basic)g(unit)g(of)0 2608 y(data)h(access.)20 b
+(An)c(alternativ)o(e)g(data)e(mo)q(del)j(of)e(comparable)g(p)r(o)n(w)o(er)g
+(and)h(elegance)g(to)f(the)h(relational)g(mo)q(del)0 2670 y(for)k(databases)f
+(is)i(needed)g(for)f(scienti\014c)h(data.)34 b(If)20 b(such)g(a)g(mo)q(del)h
+(existed,)h(programs)d(that)g(shared)i(that)p eop
+%%Page: 6 8
+ bop 0 -58 a fm(6)1488 b(NetCDF)14 b(User's)h(Guide)0 183 y(mo)q(del)g(could)
+h(b)q(e)f(used)g(in)h(\015exible)g(com)o(binations)f(to)f(supp)r(ort)g(e\013e\
+ctive)g(systems)g(for)g(building)j(applications)0 246 y(and)g(visualizing)j
+(data.)25 b(Representing)18 b(m)n(ultidimensional)j(arra)n(ys)c(as)f(relation\
+s)i(mak)o(es)f(some)g(useful)h(kinds)0 308 y(of)f(data)f(access)i(a)n(wkw)n
+(ard)f(and)h(pro)n(vides)g(little)h(supp)r(ort)d(for)h(the)g(abstractions)g
+(of)g(m)n(ultidimensional)k(data)0 370 y(and)15 b(co)r(ordinate)g(systems.)62
+509 y(Related)i(to)f(this)h(is)f(a)g(second)h(problem)f(with)h(general-purp)r
+(ose)f(database)g(systems:)21 b(their)c(p)q(o)q(or)f(p)q(erfor-)0 571 y(mance)
+e(on)f(large)g(scienti\014c)h(data)f(sets.)19 b(Collections)c(of)e(satellite)
+h(images,)g(scienti\014c)g(mo)q(del)g(outputs,)f(climate)0 633 y(observ)m(ati\
+ons)k(co)n(v)o(ering)g(decades,)h(high-resolution)g(atmospheric)f(pro\014le)g
+(data,)f(and)h(other)f(large)g(data)g(sets)0 695 y(are)f(b)q(ey)o(ond)h(the)f
+(capabilities)j(of)c(most)h(DBMSs)g(to)f(organize)i(and)f(index)i(for)d(e\016\
+cient)h(retriev)n(al.)62 834 y(Finally)n(,)e(general-purp)s(ose)g(database)g
+(systems)g(pro)o(vide,)h(at)f(signi\014cant)g(cost)g(in)h(terms)f(of)g(b)r
+(oth)g(resources)0 896 y(and)21 b(access)g(p)r(erformance,)g(man)o(y)g(facili\
+ties)i(that)d(are)g(not)h(needed)h(in)g(the)f(analysis,)i(managemen)n(t,)f
+(and)0 958 y(display)h(of)f(scien)o(ti\014c)i(data.)41 b(F)-5 b(or)22 b(examp\
+le,)j(elab)r(orate)d(up)q(date)h(facilities,)j(concurrency)d(con)o(trol,)g
+(audit)0 1021 y(trails,)13 b(rep)r(ort)f(writers,)g(and)h(mec)o(hanisms)g(des\
+igned)h(for)f(transaction-processing)h(are)e(unnecessary)i(for)e(most)0 1083 y
+(scienti\014c)k(applications.)0 1321 y fl(1.3)33 b(What)15 b(ab)r(out)h(P)n
+(erformance?)62 1459 y fm(T)l(o)g(ac)o(hieve)g(net)o(w)n(ork-transparency)l
+(,)g(the)g(netCDF)f(is)i(implemen)q(ted)f(on)g(top)f(of)h(a)g(la)o(y)o(er)g
+(of)f(soft)n(w)o(are)h(for)0 1521 y(external)h(data)g(represen)o(tation)f(\(X\
+DR\).)h(XDR,)f(develop)r(ed)h(b)o(y)g(Sun)g(Microsystems,)g(Inc.,)g(is)h(a)e
+(nonpropri-)0 1584 y(etary)e(standard)g(for)f(describing)j(and)f(enco)q(ding)
+h(data.)i(It)d(supp)r(orts)e(enco)r(ding)i(arbitrary)f(C)g(data)f(structures)
+0 1646 y(into)j(mac)o(hine-indep)t(endent)g(sequences)j(of)d(bits.)26 b(The)
+17 b(enco)r(ding)g(used)h(for)e(\015oating-p)r(oin)o(t)h(n)o(um)o(b)q(ers)g
+(is)h(the)0 1708 y(Institute)i(for)f(Electrical)i(and)f(Electronics)g(Enginee\
+rs)h(\(IEEE\))e(standard)g(for)g(normalized)h(\015oating-p)r(oin)o(t)0 1770 y
+(n)o(um)o(b)q(ers.)37 b(XDR)21 b(has)f(b)r(een)h(implemen)q(ted)g(on)f(a)h
+(wide)g(v)n(ariet)o(y)f(of)h(computers,)g(including)j(Suns,)e(V)-5 b(AXs,)0
+1833 y(Apple)19 b(Macin)o(toshes,)f(IBM)f(RS)h(6000s,)f(IBM)h(PS/2s,)f(IBM)h
+(mainframes,)f(and)h(CRA)m(Ys.)27 b(It)17 b(assumes)g(only)0 1895 y(that)d
+(eight-bit)i(b)o(ytes)f(can)g(b)q(e)h(enco)q(ded)g(and)g(deco)q(ded)g(in)g
+(a)f(consistent)f(w)o(a)n(y)m(.)62 2033 y(T)l(ranslating)22 b(data)e(in)o(to)
+h(and)g(out)g(of)f(XDR)h(form)g(adds)g(o)n(v)o(erhead)g(to)f(data)h(transfers\
+,)g(but)g(for)f(man)o(y)0 2096 y(applications)c(the)f(extra)f(CPU)h(cycles)h
+(used)f(to)f(con)o(v)o(ert)g(data)g(to)g(and)h(from)f(a)g(mac)o(hine-indep)t
+(endent)h(repre-)0 2158 y(sen)o(tation)d(are)g(not)g(signi\014cant.)19 b(The)
+12 b(amoun)o(t)g(of)f(XDR)i(o)n(v)o(erhead)g(dep)r(ends)g(on)f(man)n(y)g(fact\
+ors,)g(including)j(the)0 2220 y(data)g(t)n(yp)r(e,)g(the)h(t)o(yp)q(e)g(of)f
+(computer,)h(the)f(gran)n(ularity)h(of)f(data)g(access,)g(and)h(ho)o(w)f(w)o
+(ell)i(the)f(implementation)0 2282 y(has)e(b)r(een)h(tuned)g(to)f(the)g(compu\
+ter)h(on)f(which)h(it)f(is)h(run.)20 b(F)l(or)14 b(a)g(large)h(set)f(of)g(app\
+lications,)i(the)e(o)o(v)o(erhead)g(of)0 2345 y(the)h(XDR)h(la)o(y)o(er)f(is)
+g(a)g(reasonable)h(price)g(to)f(pa)n(y)h(for)e(p)r(ortable,)g(net)o(w)o(ork-t\
+ransparen)n(t)h(data)f(access.)62 2483 y(Often)j(when)f(an)g(abstraction)g
+(la)o(y)n(er)g(is)h(added)g(to)e(hide)i(the)f(details)i(of)d(an)h(underlying)
+i(implemen)q(tation,)0 2545 y(some)10 b(computations)g(that)f(can)i(b)q(e)g
+(expressed)g(simply)g(in)g(terms)f(of)g(the)g(abstraction)g(ma)n(y)g(b)r(e)g
+(computationally)0 2608 y(exp)r(ensiv)o(e.)21 b(F)-5 b(urthermore,)15 b(it)g
+(ma)o(y)g(not)g(b)q(e)g(ob)o(vious)h(which)f(of)g(sev)o(eral)g(w)o(a)n(ys)g
+(of)g(expressing)h(a)f(computation)0 2670 y(through)c(the)g(abstract)f(in)o
+(terface)h(will)i(mak)n(e)e(e\016cient)g(use)g(of)g(computing)g(resources,)h
+(without)f(understanding)p eop
+%%Page: 7 9
+ bop 0 -58 a fm(Chapter)15 b(1:)k(Introduction)1447 b(7)0 183 y(something)14 b
+(ab)q(out)g(the)f(implemen)q(tation.)19 b(It)14 b(is)g(certainly)h(p)r(ossibl\
+e)g(to)e(use)h(the)g(netCDF)f(in)o(terface)h(to)f(access)0 246 y(data)k(in)h
+(ine\016cien)q(t)f(w)n(a)o(ys:)24 b(for)16 b(example,)j(b)o(y)e(requesting)h
+(a)f(slice)i(of)e(v)m(ariable)h(data)f(that)g(requires)h(a)f(single)0 308 y
+(v)m(alue)h(out)e(of)g(eac)o(h)g(record.)24 b(See)17 b(Chapter)f(9)g([NetCDF)
+g(File)h(Structure)g(and)f(P)o(erformance],)g(page)g(147,)g(for)0 370 y(a)g
+(discussion)i(of)e(p)r(erformance)g(c)n(haracteristics)h(of)f(the)h(implement\
+ation)f(and)h(ho)n(w)g(to)e(apply)j(kno)n(wledge)f(of)0 432 y(the)g(underlyin\
+g)j(implementation)d(to)g(use)g(the)h(in)o(terface)f(e\013ectively)h(when)g
+(p)r(erformance)e(is)i(an)f(imp)r(ortan)n(t)0 495 y(concern.)0 717 y fl(1.4)
+33 b(Is)14 b(NetCDF)g(a)h(Go)q(o)r(d)g(Arc)n(hiv)n(e)i(F)-6 b(ormat?)62 854 y
+fm(NetCDF)17 b(can)h(b)q(e)g(used)g(as)g(an)f(arc)o(hiv)o(e)h(format)f(for)g
+(storing)g(data,)g(but)h(it)g(ma)n(y)g(tak)n(e)g(more)f(space)h(than)0 916 y
+(a)h(sp)q(ecial-purp)s(ose)g(arc)n(hive)g(format)f(that)g(exploits)h(kno)o
+(wledge)h(of)e(particular)i(c)o(haracteristics)f(of)f(a)h(set)f(of)0 978 y
+(data.)h(Compression)c(of)g(data)f(is)h(p)r(ossible)h(with)f(netCDF)f(\(e.g.,)
+g(using)h(arra)n(ys)g(of)f(eight-bit)h(b)o(ytes)g(to)f(enco)r(de)0 1041 y(lo)
+o(w-resolution)19 b(\015oating-p)r(oin)o(t)f(n)o(um)o(b)q(ers)h(instead)f(of)
+g(arra)n(ys)g(of)g(32-bit)g(n)o(um)o(b)r(ers\),)g(but)g(netCDF)g(w)n(as)g(not)
+0 1103 y(designed)f(to)d(ac)o(hieve)h(optimal)h(compression)f(of)g(scienti\
+\014c)h(data.)62 1240 y(The)d(adv)m(an)o(tages)e(of)h(a)f(sp)r(ecial-purp)s
+(ose)h(arc)o(hiv)o(e)g(format)f(for)h(small)g(arc)o(hiv)o(es)h(should)g(b)q
+(e)f(compared)g(to)g(the)0 1302 y(b)r(ene\014ts)h(of)g(mac)n(hine-indep)5 b
+(endence)15 b(and)e(the)g(ability)h(to)e(store)h(ancillary)h(data)f(\(data)f
+(ab)q(out)h(the)g(data\))g(that)0 1364 y(the)h(netCDF)f(interface)h(pro)n(vid\
+es.)21 b(F)-5 b(or)14 b(large)g(arc)n(hives,)g(only)g(t)o(w)n(o)g(programs)f
+(need)i(to)e(b)r(e)h(pro)n(vided)i(for)d(eac)o(h)0 1427 y(arc)n(hive)g(format\
+,)f(one)i(to)e(translate)h(arc)o(hiv)o(ed)h(data)e(into)h(netCDF)f(form)h(and)
+g(the)g(other)g(to)g(translate)g(bac)n(k)h(to)0 1489 y(the)j(arc)n(hive)g(for\
+mat.)23 b(T)l(o)q(ols)17 b(pro)o(vided)h(for)e(manipulating)i(netCDF)e(data)g
+(will)j(then)e(b)r(e)g(a)n(v)m(ailable)i(without)0 1551 y(sacri\014cing)e(the)
+e(adv)n(an)o(tages)f(of)h(the)h(arc)n(hive)g(format)e(and)h(without)h(requiri\
+ng)h(the)e(wholesale)i(con)o(v)n(ersion)f(of)0 1613 y(large)f(existing)h(arc)
+o(hiv)o(es.)0 1836 y fl(1.5)33 b(Bac)n(kground)16 b(and)f(Ev)n(olution)i(of)e
+(the)g(NetCDF)f(In)n(terface)62 1973 y fm(The)g(dev)o(elopment)f(of)h(the)f
+(netCDF)g(interface)g(b)r(egan)g(with)h(a)f(mo)q(dest)h(goal)f(related)h(to)f
+(Unidata's)h(needs:)0 2035 y(to)f(pro)n(vide)i(a)e(common)g(interface)g(b)r
+(et)n(w)o(een)h(Unidata)g(applications)h(and)f(ingested)g(real-time)h(meteoro\
+logical)0 2097 y(data.)35 b(Since)22 b(Unidata)e(soft)n(w)o(are)g(w)o(as)g
+(in)o(tended)h(to)f(run)h(on)f(m)o(ultiple)i(hardw)o(are)e(platforms)g(with)h
+(access)0 2159 y(from)15 b(b)q(oth)g(C)g(and)h(F)n(OR)m(TRAN,)f(ac)o(hieving)
+i(Unidata's)e(goals)g(had)h(the)f(p)r(oten)n(tial)h(for)f(pro)n(viding)i(a)e
+(pac)o(k)m(age)0 2222 y(that)i(w)o(as)g(useful)i(in)f(a)g(broader)f(con)o(tex\
+t.)27 b(By)18 b(making)g(the)g(pac)o(k)m(age)f(widely)j(a)n(v)n(ailable)f(and)
+f(collab)r(orating)0 2284 y(with)g(other)f(organizations)h(with)g(similar)h
+(needs,)g(w)n(e)f(hop)q(ed)h(to)e(impro)o(v)n(e)h(the)g(curren)o(t)f(situatio\
+n)i(in)f(which)0 2346 y(scienti\014c)h(soft)n(w)n(are)f(is)g(only)g(rarely)g
+(reused)h(b)o(y)f(others)f(in)i(the)f(same)f(discipli)q(ne)k(and)d(almost)f
+(never)g(reused)0 2408 y(b)r(et)n(w)o(een)f(disciplines)i(\(F)l(ulk)o(er,)d
+(1988\).)62 2545 y(Imp)r(ortan)n(t)10 b(concepts)h(emplo)o(y)o(ed)g(in)g(the)
+g(netCDF)f(soft)n(w)n(are)h(originated)g(in)g(a)f(pap)r(er)g(\(T)l(reinish)i
+(and)f(Gough,)0 2608 y(1987\))h(that)g(describ)r(ed)i(data-access)e(soft)n
+(w)o(are)h(dev)o(elop)r(ed)g(at)g(the)g(NASA)g(Go)q(ddard)g(National)g(Space)
+h(Science)0 2670 y(Data)21 b(Cen)o(ter)h(\(NSSDC\).)f(The)i(interface)e(pro)o
+(vided)j(b)o(y)e(this)g(soft)n(w)o(are)g(w)o(as)f(called)j(the)f(Common)e(Dat\
+a)p eop
+%%Page: 8 10
+ bop 0 -58 a fm(8)1488 b(NetCDF)14 b(User's)h(Guide)0 183 y(F)l(ormat)c(\(CDF\
+\).)g(The)i(NASA)g(CDF)f(w)n(as)g(originally)j(dev)o(elop)r(ed)e(as)f(a)h(pla\
+tform-sp)q(eci\014c)h(F)n(OR)m(TRAN)f(library)0 246 y(to)i(supp)r(ort)f(an)h
+(abstraction)g(for)f(storing)h(m)o(ultidimensional)j(scienti\014c)e(data.)62
+390 y(The)11 b(NASA)g(CDF)e(pac)o(k)n(age)h(had)g(b)r(een)h(used)g(for)f(man)
+n(y)h(di\013erent)f(kinds)i(of)e(data)f(in)j(an)e(extensive)g(collection)0 452
+y(of)16 b(applications.)25 b(It)17 b(had)g(the)f(virtues)h(of)f(simplicit)q
+(y)h(\(only)g(13)f(subroutines\),)h(indep)r(endence)h(from)e(storage)0 515 y
+(format,)10 b(generality)l(,)i(ability)f(to)g(supp)r(ort)f(logical)i(user)g
+(views)g(of)e(data,)h(and)h(supp)r(ort)e(for)h(generic)h(applications.)62 659
+y(Unidata)i(held)h(a)e(w)o(orkshop)g(on)h(CDF)f(in)h(Boulder)h(in)f(August)g
+(1987.)k(W)l(e)c(prop)q(osed)g(exploring)g(the)g(p)r(ossi-)0 722 y(bilit)q
+(y)f(of)f(collab)s(orating)h(with)g(NASA)h(to)e(extend)i(the)f(CDF)g(F)n(OR)m
+(TRAN)h(in)o(terface,)f(to)g(de\014ne)h(a)f(C)g(interface,)0 784 y(and)g(to)g
+(p)q(ermit)g(the)g(access)g(of)g(data)f(aggregates)g(with)h(a)g(single)h(call\
+,)g(while)h(main)o(taining)f(compatibilit)q(y)f(with)0 846 y(the)i(existing)h
+(NASA)g(interface.)62 991 y(Indep)s(endently)l(,)23 b(Da)n(v)o(e)e(Ra)o(ymond)
+h(at)e(the)i(New)f(Mexico)h(Institute)g(of)f(Mining)h(and)g(T)l(ec)o(hnology)
+g(had)0 1053 y(dev)o(elop)r(ed)12 b(a)f(pac)o(k)m(age)g(of)g(C)g(soft)n(w)n
+(are)g(for)g(UNIX)h(that)e(supp)r(orted)h(self-describing)j(scienti\014c)e
+(data)e(along)i(with)0 1115 y(a)g(\\pip)r(es)h(and)f(\014lters")h(approac)n
+(h)g(to)f(pro)q(cessing,)h(analyzing,)h(and)e(displa)q(ying)h(scienti\014c)g
+(data.)18 b(This)13 b(pac)o(k)m(age)0 1178 y(also)d(used)h(the)g(\\Common)e
+(Data)h(F)-5 b(ormat")9 b(name,)i(later)g(c)o(hanged)f(to)g(C-Based)h(Analysi\
+s)g(and)g(Display)f(System)0 1240 y(\(CANDIS\).)17 b(Unidata)g(learned)i(of)e
+(Ra)o(ymond's)g(w)n(ork)g(\(Ra)o(ymond,)h(1988\),)e(and)h(incorp)r(orated)g
+(some)g(of)g(his)0 1302 y(ideas,)k(suc)o(h)e(as)g(the)h(use)f(of)g(named)h
+(dimensions)h(and)e(v)n(ariables)h(with)g(di\013ering)h(shap)q(es)f(in)g(a)f
+(single)i(data)0 1364 y(ob)s(ject,)14 b(into)g(the)i(Unidata)f(netCDF)g(in)o
+(terface.)62 1509 y(In)k(early)f(1988,)f(Glenn)h(Da)n(vis)h(of)e(Unidata)h
+(dev)o(elop)r(ed)g(a)g(protot)m(yp)r(e)g(netCDF)f(pac)o(k)m(age)h(in)g(C)g
+(that)f(w)n(as)0 1571 y(la)o(y)o(ered)h(on)f(a)g(nonproprietary)h(external)g
+(data)f(represen)o(tation)g(standard)h(\(XDR\))f(dev)o(elop)r(ed)h(b)o(y)f
+(Sun)i(Mi-)0 1634 y(crosystems.)28 b(This)19 b(protot)n(yp)q(e)g(pro)n(v)o
+(ed)g(that)e(a)h(single-\014le,)j(net)o(w)o(ork-transparen)n(t)d(implementati\
+on)g(of)g(the)0 1696 y(CDF)11 b(interface)h(could)h(b)r(e)f(ac)o(hieved)g(at)
+g(acceptable)h(cost)f(and)h(that)e(the)i(resulting)g(programs)e(could)i(b)r
+(e)f(imple-)0 1758 y(men)o(ted)17 b(on)f(b)r(oth)g(UNIX)h(and)g(VMS)f(systems\
+.)23 b(Ho)o(w)n(ev)o(er,)17 b(it)g(also)f(demonstrated)g(that)g(pro)n(viding)
+i(a)f(small,)0 1820 y(p)r(ortable,)j(and)h(NASA)f(CDF-compatible)h(F)n(OR)m
+(TRAN)g(in)o(terface)f(with)g(the)g(desired)i(generalit)o(y)e(w)o(as)f(not)0
+1883 y(practical.)32 b(\(NASA's)19 b(CDF)f(and)h(Unidata's)g(netCDF)f(ha)o
+(v)n(e)h(since)i(ev)n(olved)e(separately)l(,)h(but)f(recen)o(t)g(CDF)0 1945 y
+(v)o(ersions)c(share)g(man)o(y)g(c)o(haracteristics)h(with)f(netCDF.\))62 2089
+y(In)21 b(early)f(1988,)g(Jo)q(e)g(F)l(ahle)h(of)e(SeaSpace,)j(Inc.)35 b(\(a)
+19 b(commercial)i(soft)n(w)o(are)e(developmen)o(t)h(\014rm)g(in)h(San)0 2152 y
+(Diego,)d(California\),)g(a)f(participant)g(in)h(the)f(1987)g(Unidata)g(CDF)g
+(w)o(orkshop,)g(indep)s(endently)g(dev)o(elop)r(ed)h(a)0 2214 y(CDF)11 b(pac)
+o(k)n(age)h(in)h(C)f(that)g(extended)h(the)f(NASA)h(CDF)f(in)o(terface)g(in)h
+(sev)o(eral)g(imp)r(ortan)n(t)f(w)n(a)o(ys)g(\(F)l(ahle,)h(1989\).)0 2276 y
+(Like)18 b(Ra)o(ymond's)f(pac)o(k)n(age,)h(the)g(SeaSpace)h(CDF)e(soft)n(w)n
+(are)h(p)r(ermitted)g(v)m(ariables)h(with)f(unrelated)h(shap)r(es)0 2339 y
+(to)h(b)q(e)h(included)i(in)e(the)g(same)f(data)g(ob)s(ject)g(and)h(p)q(ermit\
+ted)g(a)f(general)h(\\h)o(yp)q(erslab")g(form)f(of)g(access)h(to)0 2401 y(m)o
+(ultidimensional)f(arra)n(ys.)27 b(F)l(ahle's)17 b(implemen)q(tation)g(w)o
+(as)g(used)h(at)f(SeaSpace)h(as)f(the)g(intermediate)h(form)0 2463 y(of)d(sto\
+rage)f(for)g(a)h(v)n(ariet)n(y)h(of)e(steps)h(in)h(their)g(image-pro)r(cessin\
+g)g(system.)62 2608 y(After)21 b(studying)h(F)l(ahle's)f(interface,)h(w)n(e)g
+(concluded)h(that)d(it)i(solv)o(ed)f(man)o(y)g(of)g(the)g(problems)h(w)n(e)g
+(had)0 2670 y(identi\014ed)c(in)f(trying)g(to)g(stretc)n(h)g(the)g(NASA)g(int\
+erface)f(to)g(our)h(purp)r(oses.)24 b(In)17 b(August)g(1988,)f(w)n(e)h(con)o
+(v)o(ened)p eop
+%%Page: 9 11
+ bop 0 -58 a fm(Chapter)15 b(1:)k(Introduction)1447 b(9)0 183 y(a)17 b(small)
+g(w)o(orkshop)g(to)f(agree)h(on)f(a)h(Unidata)g(netCDF)g(in)o(terface,)g(and)
+g(to)g(resolv)o(e)g(remaining)h(op)q(en)g(issues.)0 246 y(A)o(ttending)i(w)o
+(ere)f(Jo)r(e)g(F)l(ahle)i(of)e(SeaSpace,)i(Mic)o(hael)f(Gough)g(of)f(Apple)i
+(\(an)e(author)g(of)g(the)h(NASA)g(CDF)0 308 y(soft)n(w)o(are\),)i(Angel)h
+(Li)g(of)f(the)g(Universit)o(y)g(of)f(Miami)i(\(who)e(had)i(implemented)g(our)
+e(protot)n(yp)q(e)i(netCDF)0 370 y(soft)n(w)o(are)17 b(on)h(VMS)g(and)g(w)n
+(as)g(a)f(p)r(oten)n(tial)i(user\),)f(and)g(Unidata)g(systems)f(development)g
+(sta\013.)28 b(Consensus)0 432 y(w)o(as)22 b(reac)n(hed)i(at)e(the)g(w)o(orks\
+hop)g(after)g(some)g(further)g(simpli\014cations)j(w)o(ere)d(discov)o(ered.)
+42 b(A)23 b(do)q(cumen)o(t)0 495 y(incorp)r(orating)16 b(the)g(results)g(of)g
+(the)g(w)n(orkshop)g(into)f(a)h(prop)q(osed)g(Unidata)g(netCDF)g(in)o(terface)
+g(sp)r(eci\014cation)0 557 y(w)o(as)i(distributed)h(widely)h(for)e(commen)o
+(ts)g(b)q(efore)g(Glenn)i(Da)n(vis)f(implemented)g(the)f(soft)n(w)o(are)g(it)
+g(describ)s(ed.)0 619 y(Comparison)13 b(with)i(other)e(data-access)g(interfac\
+es)g(and)h(recent)f(exp)r(erience)i(in)f(using)h(netCDF)e(are)g(discussed)0
+681 y(in)j(\(Rew)f(and)h(Da)n(vis,)f(1990a\))f(and)h(\(Rew)g(and)h(Da)n(vis,)
+f(1990b\).)62 824 y(In)j(Octob)r(er)f(1991,)f(w)o(e)i(announced)g(v)o(ersion)
+g(2.0)e(of)h(the)g(netCDF)g(soft)n(w)n(are)h(distribution.)28 b(Slight)17 b
+(mo)q(d-)0 887 y(i\014cations)h(to)e(the)h(C)f(interface)g(\(declaring)i(dime\
+nsion)h(sizes)e(to)f(b)r(e)h fi(long)f fm(rather)g(than)h fi(int)p fm(\))f
+(impro)o(v)o(ed)h(the)0 949 y(usability)i(of)g(netCDF)f(on)h(inexp)r(ensive)g
+(platforms)f(suc)o(h)h(as)g(MSDOS)g(computers,)g(without)g(requiring)h(re-)0
+1011 y(compilation)15 b(on)f(other)f(platforms.)19 b(This)c(c)o(hange)f(to)f
+(the)h(in)o(terface)g(required)h(no)f(c)o(hanges)g(to)f(the)h(associated)0
+1073 y(\014le)i(format.)0 1351 y fl(1.6)33 b(What's)15 b(New)f(in)i(this)g
+(Release?)62 1494 y fm(This)k(Guide)h(do)q(cuments)e(the)g(Marc)n(h)h(1993)e
+(release)i(of)f(netCDF)g(2.3,)g(which)h(preserv)o(es)f(the)h(same)f(\014le)0
+1556 y(format)14 b(but)h(adds)h(a)e(few)h(new)h(functions)g(to)e(the)i(C)f
+(and)g(F)l(ortran)f(interfaces.)62 1699 y(The)22 b(suggested)g(extension)h
+(for)e(netCDF)h(\014les)g(has)g(b)r(een)g(c)o(hanged)h(from)e fi(.cdf)g fm
+(to)g fi(.nc)p fm(,)i(in)g(order)f(to)0 1761 y(a)n(v)o(oid)e(a)e(clash)h(with)
+h(the)e(NASA)i(CDF)e(\014le)h(extension.)32 b(Although)19 b(the)g(old)g(exten\
+sion)h(is)f(still)h(supp)r(orted)0 1824 y(in)g(a)f(bac)o(kw)n(ard)g(compatibl\
+e)i(w)n(a)o(y)l(,)f(new)f(netCDF)g(\014les)h(should)g(use)g(the)f(new)h(\014l\
+ename)g(extension,)h(where)0 1886 y(practical.)62 2029 y(Subsampling)e(along)
+d(sp)r(eci\014ed)i(dimensions)g(\(using)f(`strides'\))f(is)h(one)g(of)f(the)h
+(commonly-ask)n(ed-for)g(fea-)0 2091 y(tures)i(supp)r(orted)g(b)o(y)g(the)h
+(new)f fi(ncvarputg\(\))f fm(and)i fi(ncvargetg\(\))e fm(in)o(terfaces)h(for)
+g(generalized)i(h)o(yp)q(erslab)0 2153 y(access.)h(In)16 b(addition,)h(these)
+f(in)o(terfaces)g(p)q(ermit)g(accessing)h(data)e(that)g(is)h(not)f(con)o(tigu\
+ous)h(in)h(memory)-5 b(.)22 b(In)16 b(a)0 2216 y(generalized)j(h)o(yp)r(ersla\
+b,)f(an)g(index)h(mapping)f(v)o(ector)f(is)i(used)f(to)f(de\014ne)i(the)f(map\
+ping)g(b)r(et)n(w)o(een)g(p)r(oin)o(ts)f(in)0 2278 y(the)e(generalized)i(h)o
+(yp)q(erslab)f(and)f(the)g(memory)g(lo)q(cations)g(of)g(the)g(corresp)q(ondin\
+g)h(v)m(alues.)21 b(\(See)30 b([ncv)n(arputg)0 2340 y(NCVPTG)15 b(and)g(NCVPG\
+C],)f(page)h(93.\))62 2483 y(There)h(are)g(also)f(some)h(new)f(interfaces)g
+(that)g(can)h(b)r(e)f(used)i(to)e(write,)g(read,)h(and)g(inquire)h(ab)q(out)e
+(records,)0 2545 y(where)e(a)g(record)h(ma)n(y)f(con)o(tain)h(m)n(ultiple)i
+(v)m(ariables)e(of)f(di\013eren)q(t)g(t)n(yp)q(es)h(and)f(shap)r(es.)19 b(Whe\
+re)13 b(b)r(efore)g(y)o(ou)g(had)0 2608 y(to)h(access)h(a)g(record's)f(w)n
+(orth)h(of)f(data)g(using)i(m)n(ultiple)h(calls,)f(no)o(w)e(y)o(ou)h(ma)n(y)g
+(instead)g(use)g(a)g(single)h(call.)21 b(\(See)0 2670 y([ncrecput],)15 b(page)
+g(96.\))p eop
+%%Page: 10 12
+ bop 0 -58 a fm(10)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(New)23 b(optimi\
+zations)h(for)e(the)h(library)g(ha)o(v)o(e)g(resulted)g(in)h(signi\014cant)e
+(sp)r(eedups)i(for)e(accessing)h(cross-)0 246 y(sections)13 b(inv)n(olving)h
+(non-con)o(tiguous)f(data.)18 b(Man)o(y)12 b(bugs)h(ha)o(v)n(e)g(b)r(een)g
+(\014xed,)g(p)r(ortabilit)o(y)g(has)f(b)r(een)h(impro)o(v)o(ed,)0 308 y(and)i
+(the)h(installation)g(has)f(b)r(een)h(greatly)f(simpli\014ed)i(for)e(most)f
+(systems.)62 455 y(The)20 b(ncdump)g(utilit)q(y)f(no)o(w)g(supp)r(orts)f(sev)
+o(eral)i(new)g(command-line)h(options)e(including)j(the)e(ability)g(to)0 517 y
+(sp)q(ecify)h(for)e(which)h(v)m(ariables)h(data)e(v)m(alues)i(will)g(b)r(e)f
+(output,)g(to)f(pro)o(vide)h(brief)h(annotations)e(in)i(the)f(form)0 580 y
+(of)e(CDL)f(commen)o(ts)h(to)f(identify)h(data)g(v)m(alues)h(for)e(large)h
+(m)o(ultidimensional)j(v)m(ariables,)e(or)f(to)f(pro)o(vide)i(full)0 642 y
+(annotations)c(in)h(the)f(form)f(of)h(trailing)h(CDL)g(commen)n(ts)f(for)g
+(ev)o(ery)g(data)f(v)n(alue.)0 960 y fl(1.7)33 b(F)-6 b(uture)16 b(Plans)g
+(for)f(NetCDF)62 1107 y fm(W)l(e)i(con)o(tin)o(ue)h(to)e(use)h(netCDF)f(for)g
+(Unidata)i(system)e(soft)n(w)o(are)g(and)h(applications.)26 b(W)l(e)17 b(ha)o
+(v)o(e)g(b)q(egun)h(to)0 1169 y(use)i(netCDF)f(in)o(terfaces)h(for)f(earth-re\
+ferenced)h(image-analysis)h(soft)n(w)n(are,)f(as)f(w)o(ell)i(as)e(for)g(the)h
+(output)f(of)0 1232 y(deco)r(ders)c(for)g(a)f(wide)i(v)n(ariet)o(y)f(of)g(met\
+eorological)g(and)h(o)q(ceanographic)g(data.)62 1379 y(W)l(e)h(ha)n(v)o(e)g
+(recen)o(tly)g(released)g(a)f(preliminary)i(set)e(of)g(netCDF)g(op)q(erators)
+f(that)h(w)n(e)h(hop)q(e)g(will)h(ev)o(en)o(tually)0 1441 y(b)r(e)13 b(comple\
+ted)h(to)f(pro)n(vide)i(an)e(algebra)g(of)g(useful)h(op)r(erations)f(on)g(gen\
+eric)h(scienti\014c)g(data)f(stored)g(in)h(netCDF)0 1504 y(\014les.)21 b(The)
+16 b(complete)g(set)f(of)g(op)r(erators)f(includes)j(selectors)f(to)f(extract)
+g(subsets)g(of)g(v)m(ariables)i(or)e(reduce)h(the)0 1566 y(dimensionalit)q
+(y)h(of)f(a)h(netCDF)f(\014le;)i(com)n(biners)g(to)e(merge)h(netCDF)f(\014les\
+,)h(com)o(bine)h(v)m(ariables,)g(or)e(increase)0 1628 y(dimensionalit)q(y;)21
+b(graphics)f(generators)f(to)g(read)g(netCDF)g(\014les)h(and)g(pro)q(duce)h
+(graphical)f(output;)h(mathe-)0 1690 y(matical)e(op)q(erators;)f(and)h(sp)q
+(ecialized)i(data)d(con)o(v)o(erters)g(to)f(con)o(v)o(ert)h(units,)i(con)n
+(v)o(ert)e(to)g(or)g(from)f(standard)0 1753 y(arc)n(hive)e(forms,)f(or)h(to)f
+(con)o(v)o(ert)g(to)h(a)g(canonical)h(form)e(for)h(comparison.)k(By)d(comp)q
+(osing)f(these)h(fundamen)o(tal)0 1815 y(op)q(erators,)e(users)h(w)o(ould)h
+(ha)n(v)o(e)g(a)e(wide)i(v)n(ariet)o(y)f(of)g(capabilities.)62 1962 y(W)l(e)
+24 b(ha)o(v)o(e)g(submitted)g(a)g(prop)q(osal)g(for)f(resources)h(to)f(extend)
+h(the)g(netCDF)f(library)i(in)g(an)e(up)o(w)o(ard-)0 2024 y(compatible)f(w)n
+(a)o(y)e(to)g(supp)r(ort)g(netCDF)g(serv)o(ers)g(on)h(a)f(net)o(w)o(ork.)35 b
+(With)21 b(netCDF)f(serv)o(ers,)h(clien)q(ts)f(could)0 2087 y(access)13 b(cro\
+ss-sections)g(of)f(data)g(e\016cien)q(tly)l(,)h(as)f(if)i(they)e(w)o(ere)h
+(stored)f(in)i(a)e(lo)r(cal)h(\014le.)20 b(A)13 b(netCDF)f(serv)o(er)h(w)n
+(ould)0 2149 y(also)20 b(ha)n(v)o(e)g(the)f(abilit)q(y)g(to)g(supp)r(ort)g
+(virtual)h(netCDF)f(ob)r(jects)h(that)f(pro)n(vide)i(di\013erent)f(views)g
+(of)f(large)g(or)0 2211 y(remote)f(data)f(sets.)29 b(Serv)o(ers)18 b(migh)o
+(t)g(also)g(b)q(e)h(capable)g(of)f(pro)n(viding)i(a)e(transparen)n(t)g(netCDF)
+f(interface)h(to)0 2274 y(non-netCDF)d(arc)n(hives.)62 2421 y(Other)i(desirab\
+le)g(extensions)g(that)f(w)n(e)g(w)o(ould)h(like)f(to)g(see)g(added)h(to)e
+(netCDF)h(include)i(an)e(interface)g(for)0 2483 y(record)i(access)g(b)o(y)g
+(k)o(ey)g(or)f(co)q(ordinate)i(v)m(alue,)g(transparen)o(t)e(data)g(pac)o(king)
+i(b)o(y)f(use)g(of)g(three)g(new)g(reserv)o(ed)0 2545 y(attributes)13 b(\()p
+fi(_Nbits)p fm(,)g fi(_Scale)p fm(,)f(and)i fi(_Offset)p fm(\),)e(supp)r(ort)
+g(for)h(p)r(oin)o(ters)g(to)g(data)g(cross-sections)h(in)g(other)f(\014les)0
+2608 y(\(what)i(Jo)r(e)h(F)l(ahle)h(calls)g(\\assem)n(blies"\),)h(b)q(etter)e
+(string)g(supp)r(ort,)f(and)i(a)f(w)n(ell-tested)i(C)p fi(++)e fm(in)o(terfac\
+e.)23 b(Some)0 2670 y(of)15 b(these)g(extensions)h(ma)n(y)g(b)q(e)f(included)
+j(in)e(future)g(releases.)p eop
+%%Page: 11 13
+ bop 0 -58 a fm(Chapter)15 b(1:)k(Introduction)1425 b(11)0 183 y fl(Reference\
+s)25 320 y fm(1.)29 b(F)l(ahle,)23 b(J.,)g fh(T)l(eraScan)f(Applications)h
+(Programming)e(In)o(terface)p fm(,)i(SeaSpace,)g(San)f(Diego,)h(California,)
+90 382 y(1989.)25 457 y(2.)29 b(F)l(ulk)o(er,)18 b(D.)e(W.,)g(\\The)h(netCDF:)
+f(Self-Describing,)k(P)n(ortable)d(Files|a)i(Basis)e(for)f(`Plug-Compatible')
+90 519 y(Soft)n(w)o(are)j(Mo)q(dules)i(Connectable)g(b)o(y)e(Net)o(w)o(orks,")
+g(ICSU)i(W)-5 b(orkshop)20 b(on)g(Geoph)n(ysical)h(Informatics,)90 582 y(Mosc\
+o)n(w,)15 b(USSR,)g(August)h(1988.)25 656 y(3.)29 b(F)l(ulk)o(er,)12 b(D.)f
+(W.,)f(\\Unidata)i(Stra)n(wman)f(for)f(Storing)h(Earth-Referencing)i(Data,")d
+fh(Sev)o(en)o(th)h(International)90 719 y(Conference)h(on)f(Interactiv)n(e)h
+(Information)f(and)g(Pro)q(cessing)h(Systems)g(for)e(Meteorology)l(,)h(Oceano\
+graph)o(y)l(,)90 781 y(and)k(Hydrology)p fm(,)g(New)g(Orleans,)h(La.,)f(Ameri\
+can)h(Meteorology)e(So)q(ciet)o(y)m(,)g(Jan)o(uary)h(1991.)25 856 y(4.)29 b
+(Gough,)20 b(M.)e(L.,)i fh(NSSDC)g(CDF)e(Implemen)q(ter's)g(Guide)j(\(DEC)d
+(V)-5 b(AX/VMS\))19 b(V)m(ersion)g(1.1)p fm(,)h(National)90 918 y(Space)c(Sci\
+ence)h(Data)d(Cen)o(ter,)g(88-17,)g(NASA/Go)q(ddard)i(Space)f(Flight)g(Cen)o
+(ter,)f(1988.)25 993 y(5.)29 b(Jenter,)11 b(H.)g(L.)h(and)g(R.)g(P)l(.)f(Sign\
+ell,)j(\\NetCDF:)c(A)i(F)l(reely-Av)o(ailable)h(Soft)n(w)o(are-Solution)f(to)
+f(Data-Access)90 1055 y(Problems)19 b(for)f(Numerical)i(Mo)q(delers,")g(Pro)q
+(ceedings)g(of)e(the)h(American)h(So)q(ciet)o(y)f(of)g(Civil)h(Engineers)90
+1117 y(Conference)c(on)f(Estuarine)g(and)h(Coastal)e(Mo)q(deling,)i(T)l(ampa,)
+f(Florida,)g(1992.)25 1192 y(6.)29 b(Ra)o(ymond,)12 b(D.)e(J.,)i(\\A)f(C)g
+(Language-Based)h(Mo)q(dular)g(System)f(for)g(Analyzing)i(and)e(Displaying)h
+(Gridded)90 1254 y(Numerical)17 b(Data,")c(Journal)j(of)f(A)n(tmospheric)h
+(and)g(Oceanic)g(T)l(ec)o(hnology)m(,)f fg(5)p fm(,)f(501-511,)f(1988.)25 1329
+y(7.)29 b(Rew,)12 b(R.)g(K.)g(and)g(G.)e(P)m(.)h(Da)n(vis,)i(\\The)e(Unidata)
+h(netCDF:)f(Soft)n(w)o(are)g(for)g(Scienti\014c)i(Data)d(Access,")i fh(Sixth)
+90 1391 y(In)o(ternational)k(Conference)g(on)f(In)o(teractiv)o(e)g(Informatio\
+n)g(and)h(Processing)g(Systems)f(for)g(Meteorology)-5 b(,)90 1453 y(Oceanogra\
+ph)o(y)l(,)14 b(and)g(Hydrology)p fm(,)f(Anaheim,)i(California,)f(American)h
+(Meteorology)e(So)q(ciet)o(y)l(,)h(F)l(ebruary)90 1516 y(1990.)25 1590 y(8.)
+29 b(Rew,)18 b(R.)g(K.)g(and)g(G.)f(P)l(.)g(Da)n(vis,)i(\\NetCDF:)d(An)i(In)o
+(terface)g(for)f(Scienti\014c)i(Data)d(Access,")i fh(Computer)90 1653 y(Graph\
+ics)e(and)f(Applications)p fm(,)i(IEEE,)e(pp.)20 b(76-82,)14 b(July)i(1990.)
+25 1727 y(9.)29 b(T)l(reinish,)15 b(L.)e(A.)g(and)g(M.)f(L.)h(Gough,)g(\\A)g
+(Soft)n(w)o(are)g(P)n(ac)o(k)m(age)g(for)g(the)g(Data)f(Indep)r(endent)h(Mana\
+gemen)n(t)90 1790 y(of)19 b(Multi-Dimensional)j(Data,")d fh(EOS)i(T)l(ransact\
+ions)p fm(,)f(American)g(Geoph)o(ysical)h(Union,)g fg(68)p fm(,)f(633-635,)90
+1852 y(1987.)2 1927 y(10.)29 b(Sun)20 b(Microsystems,)g(\\External)g(Data)e
+(Representation)i(Standard:)29 b(Protocol)20 b(Sp)r(eci\014cation,")h(RF)o
+(C)90 1989 y(1014;)14 b(Information)h(Sciences)i(Institute,)e(Ma)n(y)h(1988.)
+p eop
+%%Page: 12 14
+ bop 0 -58 a fm(12)1465 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 13 15
+ bop 0 -58 a fm(Chapter)15 b(2:)k(Comp)q(onents)14 b(of)h(a)g(NetCDF)f(File)
+1062 b(13)0 183 y fj(2)41 b(Comp)s(onen)m(ts)16 b(of)f(a)g(NetCDF)g(File)62
+428 y fm(A)c(netCDF)g(\014le)h(has)f fh(dimensions)p fm(,)i fh(v)n(ariables)p
+fm(,)f(and)f fh(attributes)p fm(.)18 b(These)12 b(comp)q(onen)o(ts)f(can)g
+(b)r(e)g(used)h(together)0 490 y(to)j(capture)g(the)g(meaning)h(of)f(data)f
+(and)i(relations)f(among)g(data)f(\014elds)j(in)f(a)f(scienti\014c)h(data)e
+(set.)62 638 y(W)l(e)f(will)h(use)f(a)g(small)g(netCDF)f(example)i(to)e(illus\
+trate)h(the)g(concepts)g(of)g(netCDF)f(dimensions,)i(v)m(ariables,)0 701 y
+(and)j(attributes.)23 b(The)16 b(notation)g(used)h(to)f(describ)s(e)g(this)h
+(simple)h(netCDF)d(ob)s(ject)h(is)h(called)h(CDL)e(\(net)o(w)n(ork)0 763 y
+(Common)g(Data)f(form)g(Language\).)23 b(It)17 b(pro)n(vides)h(an)e(easily)i
+(comprehended)f(text)f(v)o(ersion)h(of)f(the)g(structure)0 825 y(and)f(con)o
+(ten)o(ts)g(of)g(a)g(binary)g(netCDF)g(\014le:)120 974 y fi(netcdf)23 b(examp\
+le_1)g({)47 b(//)24 b(example)f(of)g(CDL)h(notation)f(for)g(a)h(netCDF)f(file)
+120 1073 y(dimensions:)237 b(//)24 b(dimension)e(names)i(and)f(sizes)g(are)h
+(declared)e(first)311 1123 y(lat)h(=)h(5,)g(lon)f(=)h(10,)f(level)g(=)h(4,)g
+(time)f(=)h(unlimited;)120 1223 y(variables:)261 b(//)24 b(variable)e(types,)
+i(names,)f(shapes,)f(attributes)311 1272 y(float)71 b(temp\(time,level,lat,lo\
+n\);)597 1322 y(temp:long_name)118 b(=)23 b("temperature";)597 1372 y(temp:un\
+its)214 b(=)23 b("celsius";)311 1422 y(float)71 b(rh\(time,lat,lon\);)597 1472
+y(rh:long_name)22 b(=)i("relative)f(humidity";)597 1521 y(rh:valid_range)f
+(=)i(0.0,)f(1.0;)143 b(//)23 b(min)h(and)f(max)311 1571 y(int)119 b(lat\(lat\
+\),)22 b(lon\(lon\),)h(level\(level\);)597 1621 y(lat:units)166 b(=)24 b("deg\
+rees_north";)597 1671 y(lon:units)166 b(=)24 b("degrees_east";)597 1721 y(lev\
+el:units)118 b(=)24 b("millibars";)311 1771 y(short)71 b(time\(time\);)597
+1820 y(time:units)142 b(=)24 b("hours)f(since)g(1990-11-25)g(12:00)g(UTC";)
+311 1870 y(//)g(global)h(attributes)597 1920 y(:source)f(=)h("National)f(Weat\
+her)f(Service";)120 2020 y(data:)381 b(//)24 b(optional)e(data)i(assignments)
+311 2069 y(level)71 b(=)24 b(1000,)f(850,)g(700,)g(500;)311 2119 y(lat)119 b
+(=)24 b(20,)f(30,)g(40,)h(50,)f(60;)311 2169 y(lon)119 b(=)24 b(-160,-140,-11\
+8,-96,-84,)o(-52,-45)o(,-35,-2)o(5,-15;)311 2219 y(time)95 b(=)24 b(12;)311
+2269 y(rh)143 b(=.5,.2,.4,.2,.3,.2,.4,.5,)o(.6,.7,)526 2318 y(.1,.3,.1,.1,.1,\
+.1,.5,.7,)o(.8,.8,)526 2368 y(.1,.2,.2,.2,.2,.5,.7,.8,)o(.9,.9,)526 2418 y
+(.1,.2,.3,.3,.3,.3,.7,.8,)o(.9,.9,)550 2468 y(0,.1,.2,.4,.4,.4,.4,.7,)o(.9,.9\
+;)120 2518 y(})p eop
+%%Page: 14 16
+ bop 0 -58 a fm(14)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(The)g(CDL)g(not\
+ation)f(for)h(a)f(netCDF)g(\014le)i(can)f(b)q(e)g(generated)g(automatically)g
+(b)o(y)g(using)h fi(ncdump)p fm(,)d(a)i(utility)0 246 y(program)20 b(describ)
+r(ed)i(later)f(\(see)42 b([ncdump],)23 b(page)e(160\).)36 b(Another)21 b(netC\
+DF)f(utility)m(,)i fi(ncgen)p fm(,)f(generates)0 308 y(a)e(netCDF)f(\014le)j
+(\(or)d(optionally)j(C)e(or)f(F)o(OR)m(TRAN)h(source)h(co)q(de)g(con)o(tainin\
+g)g(calls)g(needed)h(to)d(pro)q(duce)i(a)0 370 y(netCDF)e(\014le\))h(from)f
+(CDL)g(input)i(\(see)37 b([ncgen],)18 b(page)h(157\).)28 b(It)19 b(is)g(not)f
+(necessary)h(to)f(learn)h(m)n(uc)o(h)g(ab)q(out)0 432 y(CDL)13 b(notation)h
+(to)f(use)g(the)h(netCDF)f(library;)h(w)o(e)g(use)g(it)f(in)i(this)f(do)q(cum\
+en)o(t)g(as)f(a)g(concise)i(w)n(a)o(y)e(of)g(presenting)0 495 y(netCDF)i(exam\
+ples.)62 637 y(The)f(CDL)f(notation)g(will)i(b)r(e)e(explained)i(more)e(fully)
+i(as)e(w)n(e)h(describ)r(e)g(the)f(comp)r(onen)o(ts)g(of)g(a)g(netCDF)f(\014l\
+e.)0 699 y(F)l(or)h(no)o(w,)g(note)g(that)g(CDL)h(statemen)n(ts)f(are)g(termi\
+nated)h(b)o(y)g(a)f(semicolon.)20 b(Spaces,)15 b(tabs,)e(and)g(newlines)j(can)
+0 761 y(b)r(e)h(used)h(freely)h(for)e(readability)l(.)27 b(Commen)n(ts)18 b
+(in)g(CDL)f(follow)g(the)h(c)o(haracters)f(`)p fi(//)p fm(')f(on)i(an)n(y)g
+(line.)28 b(A)18 b(CDL)0 824 y(description)f(of)d(a)h(netCDF)g(\014le)h(tak)n
+(es)g(the)f(form)168 966 y fi(netCDF)23 b fh(name)j fi({)215 1016 y(dimension\
+s:)d ff(:)7 b(:)g(:)215 1066 y fi(variables:)23 b ff(:)7 b(:)g(:)215 1115 y fi
+(data:)24 b ff(:)7 b(:)g(:)168 1165 y fi(})0 1367 y fm(where)19 b(the)h fh
+(name)h fm(is)f(used)g(only)f(as)g(a)g(default)h(in)g(constructing)f(the)g
+(name)h(of)e(the)h(\014le)i(generated)e(b)o(y)g(the)0 1429 y fi(ncgen)e fm
+(utility)l(.)27 b(The)18 b(CDL)f(description)i(consists)f(of)f(three)h(option\
+al)g(parts,)f(introduced)i(b)o(y)e(the)h(k)o(eyw)n(ords)0 1491 y fi(dimension\
+s)p fm(,)13 b fi(variables)p fm(,)h(and)h fi(data)p fm(.)k(NetCDF)14 b(dimens\
+ion)i(declarations)g(app)r(ear)e(after)g(the)h fi(dimensions)0 1553 y fm(k)o
+(eyw)n(ord,)h(netCDF)g(v)m(ariables)h(and)f(attributes)g(are)g(de\014ned)i
+(after)d(the)h fi(variables)f fm(k)o(eyw)o(ord,)g(and)i(v)m(ariable)0 1616 y
+(data)e(assignmen)o(ts)g(app)q(ear)g(after)f(the)i fi(data)e fm(k)o(eyw)o(ord\
+.)0 1887 y fl(2.1)33 b(Dimensions)62 2030 y fm(A)15 b(netCDF)g(dimension)h
+(is)g(a)f(named)g(integer)f(used)i(to)e(sp)r(ecify)i(the)f(shap)q(e)g(of)g
+(one)g(or)g(more)f(of)h(the)g(m)o(ulti-)0 2092 y(dimensional)21 b(v)m(ariable\
+s)e(con)o(tained)h(in)f(a)f(netCDF)g(\014le.)31 b(A)19 b(dimension)h(ma)n(y)f
+(b)q(e)g(used)g(to)f(represen)o(t)g(a)h(real)0 2154 y(ph)o(ysical)g(dimension\
+,)g(for)e(example,)h(time,)g(latitude,)g(longitude,)h(or)e(height.)25 b(A)18 b
+(dimension)h(migh)o(t)e(also)g(b)r(e)0 2216 y(used)d(to)f(index)h(more)f(abst\
+ract)f(quan)o(tities,)i(for)f(example,)h(color-table)g(en)o(try)f(n)o(um)o
+(b)q(er,)g(instrument)g(n)o(um)o(b)q(er,)0 2279 y(station-time)i(pair,)g(or)g
+(mo)q(del-run)i(ID.)62 2421 y(Ev)o(ery)10 b(netCDF)g(dimension)i(has)e(b)r
+(oth)g(a)g fh(name)i fm(and)f(a)f fh(size)p fm(.)19 b(A)11 b(dimension)h(name)
+e(is)h(an)f(arbitrary)g(sequence)0 2483 y(of)j(alphanumeric)i(c)o(haracters)e
+(\(as)g(w)n(ell)i(as)f(the)g(underscore)g(c)o(haracter,)f(`)p fi(_)p fm(',)g
+(and)h(the)g(h)o(yphen)g(c)o(haracter,)f(`)p fi(-)p fm('\))0 2545 y(b)r(eginn\
+ing)k(with)f(a)f(letter.)21 b(Case)16 b(is)g(distinguished)i(in)e(netCDF)f
+(names.)21 b(A)16 b(dimension)h(size)g(is)f(an)g(arbitrary)0 2608 y(p)r(ositi\
+v)o(e)g(in)o(teger,)f(except)h(that)f(one)h(dimension)h(in)f(a)g(netCDF)f(\
+\014le)h(can)g(ha)o(v)n(e)g(the)g(size)g fi(UNLIMITED)p fm(.)k(Suc)o(h)c(a)0
+2670 y(dimension)f(is)g(called)g(the)f fh(unlimited)i(dimension)g fm(or)d(the)
+h fh(record)g(dimension)p fm(.)21 b(A)14 b(v)m(ariable)h(with)f(an)g(unlimite\
+d)p eop
+%%Page: 15 17
+ bop 0 -58 a fm(Chapter)15 b(2:)k(Comp)q(onents)14 b(of)h(a)g(NetCDF)f(File)
+1062 b(15)0 183 y(dimension)17 b(can)f(gro)n(w)f(to)g(an)o(y)g(length)h(along)
+g(that)f(dimension.)22 b(The)16 b(unlimited)i(dimension)f(is)f(like)g(a)f(rec\
+ord)0 246 y(n)o(um)o(b)q(er)h(in)g(con)n(v)o(en)o(tional)g(record-oriented)f
+(\014les.)62 401 y(CDL)23 b(dimension)h(declarations)f(ma)n(y)g(app)q(ear)f
+(on)h(one)f(or)g(more)h(lines)h(follo)o(wing)f(the)f(CDL)h(k)n(eyw)o(ord)0 463
+y fi(dimensions)p fm(.)37 b(Multiple)23 b(dimension)g(declarations)f(on)g(the)
+f(same)g(line)i(ma)n(y)f(b)q(e)g(separated)f(b)o(y)g(commas.)0 525 y(Eac)o
+(h)15 b(declaration)h(is)g(of)e(the)i(form)e fh(name)k fm(=)d fh(size)p fm
+(.)62 681 y(There)21 b(are)f(four)g(dimensions)i(in)g(the)e(example:)31 b fi
+(lat)p fm(,)21 b fi(lon)p fm(,)g fi(level)p fm(,)g(and)g fi(time)p fm(.)35 b
+(The)21 b(\014rst)f(three)g(are)0 743 y(assigned)12 b(\014xed)g(sizes;)h fi
+(time)e fm(is)g(assigned)h(the)g(size)g fi(UNLIMITED)p fm(,)e(which)h(means)h
+(it)f(is)h(the)f fh(unlimited)16 b fm(dimension.)0 805 y(A)f(netCDF)g(\014le)
+h(can)f(ha)o(v)o(e)g(at)g(most)f(one)h(unlimited)j(dimension,)e(but)g(need)g
+(not)f(ha)n(v)o(e)g(an)o(y)l(.)62 961 y(There)h(are)f(sev)n(eral)h(uses)f(for)
+g(netCDF)f(dimensions:)37 1116 y fk(\017)30 b fm(Sp)r(ecifying)16 b(the)g(sha\
+p)q(es)f(and)h(sizes)g(of)f(v)m(ariables.)37 1209 y fk(\017)30 b fm(Identifyi\
+ng)16 b(and)f(relating)h(v)m(ariables)g(that)f(are)g(de\014ned)h(on)g(a)e(com\
+mon)h(grid.)37 1302 y fk(\017)30 b fm(Pro)n(viding)17 b(a)e(w)n(a)o(y)g(to)f
+(de\014ne)j(co)q(ordinate)e(systems.)62 1551 y(W)l(e)h(discuss)g(eac)o(h)f
+(of)g(these)g(uses)h(b)q(elow.)0 1923 y fe(2.1.1)30 b(Using)15 b(Dimensions)h
+(to)f(Sp)q(ecify)h(V)-5 b(ariable)15 b(Shap)r(es)62 2079 y fm(The)g(basic)h
+(unit)g(of)e(named)h(data)g(in)g(a)g(netCDF)f(\014le)i(is)g(a)e fh(v)n(ariabl\
+e)p fm(.)21 b(In)15 b(general,)g(a)g(v)m(ariable)h(is)g(a)e(m)o(ultidi-)0 2141
+y(mensional)k(ob)r(ject)e(that)g(has,)g(among)g(other)g(c)o(haracteristics,)g
+(a)g fh(shap)r(e)p fm(,)g(which)h(is)f(de\014ned)i(b)o(y)f(the)f(n)o(um)o(b)q
+(er,)0 2203 y(order,)d(and)g(sizes)g(of)g(its)g(dimensions.)21 b(When)13 b
+(a)f(netCDF)h(v)m(ariable)h(is)f(de\014ned,)i(the)e(n)o(um)n(b)r(er)g(and)g
+(order)f(of)h(the)0 2266 y(dimensions)h(that)d(de\014ne)j(its)e(shap)r(e)g
+(are)g(sp)q(eci\014ed.)21 b(Hence)13 b(y)o(ou)f(m)o(ust)g(\014rst)g(create)g
+(the)g(necessary)g(dimensions)0 2328 y(b)r(efore)i(creating)i(a)f(netCDF)f
+(v)n(ariable)i(that)e(uses)i(them.)62 2483 y(It)21 b(is)g(p)r(ossible)h(to)e
+(use)h(the)g(same)f(dimension)j(more)d(than)g(once)i(in)f(sp)r(ecifying)h(a)e
+(v)n(ariable)h(shap)r(e,)h(for)0 2545 y(example)15 b fi(var\(dim,)f(dim\))p fm
+(,)f(but)i(it)f(do)q(es)g(not)g(mak)n(e)h(m)n(uc)o(h)g(sense)f(to)g(do)g(this\
+;)g(it)g(is)h(con)o(trary)e(to)g(the)i(in)o(tuitive)0 2608 y(meaning)h(of)f
+(a)f(physical)i(dimension.)22 b(A)15 b(v)m(ariable)h(that)f(has)g(t)n(w)o(o)g
+(dimensions)i(that)d(happ)r(en)i(to)e(b)r(e)h(the)g(same)0 2670 y(size)h(is)g
+(more)f(accurately)g(mo)q(deled)i(b)o(y)e(using)h(t)n(w)o(o)f(dimensions)h
+(with)g(di\013eren)q(t)e(names)i(but)f(the)g(same)g(size.)p eop
+%%Page: 16 18
+ bop 0 -58 a fm(16)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fe(2.1.2)30 b
+(Using)15 b(Dimensions)h(to)f(Relate)f(V)-5 b(ariables)62 336 y fm(Tw)o(o)15 b
+(dimensions)i(ma)n(y)f(ha)o(v)n(e)g(the)g(same)f(size,)h(p)r(erhaps)f(b)o(y)h
+(coincidence,)i(without)d(b)r(eing)h(related)g(in)g(an)o(y)0 399 y(other)f
+(w)n(a)o(y)l(.)20 b(Dimension)c(names)f(pro)o(vide)h(a)f(w)o(a)n(y)g(to)g(dis\
+tinguish)i(dimensions)g(regardless)e(of)g(size.)62 552 y(V)m(ariables)j(are)g
+(related)g(b)o(y)g(the)g(dimensions)i(they)e(share.)28 b(F)-5 b(or)18 b(examp\
+le,)h(if)f(t)o(w)n(o)g(v)m(ariables)h(are)f(de\014ned)0 614 y(with)e(the)g
+(same)g(dimensions,)h(they)f(might)f(represent)g(observ)n(ations)h(or)f(mo)q
+(del)i(output)f(for)f(the)h(same)g(set)f(of)0 676 y(p)r(oin)o(ts.)j(In)12 b
+(the)g(example)g(netCDF)f(\014le,)i(v)m(ariables)g fi(temp)d fm(and)i fi(rh)f
+fm(share)h(the)f fi(time)p fm(,)h fi(lat)p fm(,)f(and)h fi(lon)f fm(dimension\
+s.)0 738 y(The)j(v)m(ariable)h fi(rh)f fm(do)q(es)g(not)f(ha)o(v)n(e)h fi(lev\
+el)f fm(as)h(a)f(dimension,)i(p)r(erhaps)f(b)q(ecause)g(it)g(is)h(only)f(de\
+\014ned)h(for)e(a)h(single)0 801 y(level.)0 1152 y fe(2.1.3)30 b(Using)15 b
+(Dimensions)h(to)f(De\014ne)g(Co)r(ordinate)f(Systems)62 1305 y fm(Besides)20
+b(serving)f(as)f(sizes)h(for)f(integer)g(indexes)i(to)e(m)n(ultidimensional)k
+(v)n(ariables,)d(dimensions)i(ma)n(y)d(b)r(e)0 1368 y(used)h(to)e(de\014ne)i
+(co)q(ordinate)g(systems)e(for)g(v)n(ariable)i(data.)27 b(T)m(o)17 b(do)h(thi\
+s,)h(create)f(a)f(v)n(ariable)i(with)f(the)g(same)0 1430 y(name)g(as)h(a)f
+(dimension)i(and)f(sp)q(ecify)g(co)q(ordinate)g(v)n(alues)g(for)f(that)f(v)n
+(ariable.)30 b(A)19 b(v)m(ariable)h(should)f(only)g(b)r(e)0 1492 y(giv)o(en)
+13 b(the)g(same)f(name)h(as)g(a)f(dimension)i(in)g(a)e(netCDF)g(\014le)i(when)
+f(it)g(is)h(to)e(b)q(e)h(used)g(as)g(a)f fh(co)q(ordinate)k fm(v)m(ariable.)0
+1555 y(Suc)o(h)e(v)m(ariables)g(are)f(indexed)i(b)o(y)e(the)g(dimension)i(for)
+d(which)h(they)h(pro)n(vide)g(co)q(ordinate)g(v)m(alues,)g(for)e(example,)0
+1617 y fi(lat\(lat\))p fm(.)62 1770 y(It)19 b(is)g(not)f(necessary)g(to)g(pro)
+o(vide)h(a)f(co)q(ordinate)h(v)n(ariable)g(for)f(eac)o(h)g(dimension;)k(if)c
+(no)h(suc)o(h)g(v)m(ariable)g(is)0 1832 y(de\014ned,)e(the)f(co)q(ordinate)g
+(v)m(alues)h(of)e(the)h(dimension)h(are)f(assumed)f(to)g(b)r(e)h(0,)f(1,)g
+(2,)g ff(:)8 b(:)f(:)15 b fm(\(for)g(C)g(programs\))f(or)0 1894 y(1,)f(2,)f
+(3,)h ff(:)7 b(:)g(:)13 b fm(\(for)f(F)n(OR)m(TRAN)i(programs\).)j(Although)d
+(the)f(C)g(and)g(F)n(OR)m(TRAN)h(in)o(terfaces)f(supp)r(ort)f(di\013erent)0
+1957 y(con)o(v)o(en)o(tions)19 b(for)f(index)h(n)o(um)o(b)r(ering,)g(there)g
+(is)g(no)g(di\013erence)h(b)r(et)n(w)o(een)f(the)g(actual)g(netCDF)e(\014les)
+j(written)0 2019 y(b)o(y)d(C)f(and)h(F)o(OR)m(TRAN)g(programs.)23 b(Programs)
+15 b(written)i(in)h(either)f(language)g(can)g(b)q(e)g(used)h(to)e(access)h
+(data)0 2081 y(written)e(b)o(y)g(programs)f(using)i(the)g(other)e(interface.)
+62 2234 y(In)g(the)g(CDL)g(example,)g(eac)o(h)f(dimension)j(has)d(an)h(associ\
+ated)g(co)r(ordinate)f(v)n(ariable)h(with)g(the)g(same)f(name)0 2296 y(as)18 b
+(the)g(dimension.)32 b(The)18 b(four)g(v)n(alues)h(of)f(the)g fi(level)g fm
+(index,)i(0,)e(1,)h(2,)f(3,)h(\(1,)f(2,)h(3,)f(4)g(in)h(F)o(OR)m(TRAN\))f(are)
+0 2359 y(related)h(in)h(co)q(ordinate-like)f(fashion)h(to)e(the)h(four)f(v)n
+(alues)h(\(1000,)f(850,)g(700,)h(500\))f(of)g(the)h fi(level)f fm(v)m(ariable\
+.)0 2421 y(Note)e(that)g(there)h(is)g(no)g(requirement)f(that)g(co)q(ordinate\
+s)h(b)r(e)g(equally)h(spaced)f(or)f(increasing.)26 b(It)16 b(w)o(ould)h(not)0
+2483 y(mak)n(e)c(m)o(uc)o(h)g(sense)h(for)e(t)o(w)n(o)h(co)q(ordinate)g(v)n
+(alues)g(to)g(b)q(e)g(the)g(same,)g(but)g(the)g(meaning)h(of)e(co)q(ordinate)
+i(v)m(ariables)0 2545 y(is)h(enforced)h(only)f(b)o(y)g(con)o(v)o(en)o(tions)g
+(of)g(application)h(pac)o(k)n(ages)e(and)h(utilities,)i(not)e(b)o(y)g(the)g
+(netCDF)f(interface.)0 2608 y(The)g(application)h(pac)o(k)m(ages)e(and)h(util\
+ities)i(that)d(mak)n(e)h(use)g(netCDF)e(co)r(ordinate)h(v)n(ariables)h(assume)
+g(they)f(are)0 2670 y(one-dimensional)18 b(and)d(monotonic)g(\(all)h(v)m(alue\
+s)g(either)g(increasing)h(or)d(decreasing\).)p eop
+%%Page: 17 19
+ bop 0 -58 a fm(Chapter)15 b(2:)k(Comp)q(onents)14 b(of)h(a)g(NetCDF)f(File)
+1062 b(17)0 183 y fl(2.2)33 b(V)-6 b(ariables)62 321 y fm(A)19 b fh(v)n(ariab\
+le)j fm(represents)c(a)h(m)o(ultidimensional)j(arra)n(y)c(of)h(v)n(alues)g
+(of)g(the)g(same)g(t)n(yp)r(e.)31 b(A)19 b(v)m(ariable)h(has)f(a)0 383 y(name\
+,)c(a)f(data)h(t)n(yp)r(e,)g(and)g(a)g(shap)q(e)g(describ)s(ed)g(b)o(y)g(its)
+g(list)h(of)f(dimensions,)h(all)g(of)f(whic)o(h)h(are)e(sp)r(eci\014ed)i(when)
+0 446 y(the)g(v)n(ariable)h(is)g(created.)24 b(Eac)n(h)17 b(v)m(ariable)h(ma)
+n(y)e(also)h(ha)n(v)o(e)g(data)e(v)n(alues)i(and)f(asso)q(ciated)h(attributes\
+,)f(which)0 508 y(ma)n(y)g(b)q(e)g(added)g(or)f(c)o(hanged)h(after)f(the)g
+(v)n(ariable)h(is)g(created.)21 b(V)l(ariables)c(are)e(used)h(to)f(store)g
+(the)g(bulk)i(of)e(the)0 570 y(data)h(in)h(a)f(netCDF)f(\014le,)j(and)e(are)g
+(the)h(primary)f(comp)q(onen)o(t)g(used)h(b)o(y)f(utilities)j(to)d(identify)g
+(sub-parts)g(of)g(a)0 633 y(netCDF)f(\014le.)62 833 y(Like)k(a)f(dimension)j
+(name,)e(a)f(v)n(ariable)i(name)e(is)i(an)e(arbitrary)g(sequence)i(of)f(alpha\
+n)o(umeric)h(c)o(haracters)0 895 y(\(also)15 b(includin)q(g)j(`)p fi(_)p fm
+(')d(and)h(`)p fi(-)p fm('\))e(b)r(eginning)j(with)f(a)g(letter.)22 b(Case)15
+b(is)h(distinguished)j(in)d(v)n(ariable)g(names.)22 b(Long)0 957 y(names)15 b
+(help)i(to)e(mak)n(e)h(a)f(netCDF)g(\014le)i(self-do)r(cumen)o(ting,)f(but)f
+(ancillary)i(information)f(ab)q(out)f(a)h(v)m(ariable)g(is)0 1020 y(b)r(etter)
+e(stored)h(in)h(v)m(ariable)h fh(attributes)f fm(\(discussed)h(b)q(elow\))d
+(than)h(enco)r(ded)h(as)f(part)f(of)h(the)g(name.)62 1157 y(A)22 b(v)m(ariabl\
+e)g(data)f(t)n(yp)r(e)g(is)h(one)g(of)e(a)h(small)h(set)g(of)e(netCDF)h fh
+(t)n(yp)r(es)i fm(that)e(ha)o(v)n(e)h(the)f(names)g fi(NC_BYTE)p fm(,)0 1220 y
+fi(NC_CHAR)p fm(,)14 b fi(NC_SHORT)p fm(,)f fi(NC_LONG)p fm(,)h fi(NC_FLOAT)p
+fm(,)f(and)i fi(NC_DOUBLE)f fm(in)i(the)f(C)g(in)o(terface)g(and)g(the)g(corr\
+esp)q(onding)0 1282 y(names)g fi(NCBYTE)p fm(,)e fi(NCCHAR)p fm(,)h fi(NCSHOR\
+T)p fm(,)f fi(NCLONG)p fm(,)h fi(NCFLOAT)p fm(,)g(and)h fi(NCDOUBLE)e fm(in)j
+(the)f(F)n(OR)m(TRAN)g(interface.)k(In)0 1344 y(the)e(CDL)f(notation,)g(these)
+h(t)n(yp)r(es)f(are)g(giv)o(en)h(the)g(simpler)h(names)e fi(byte)p fm(,)g fi
+(char)p fm(,)g fi(short)p fm(,)f fi(long)p fm(,)h fi(float)p fm(,)g(and)0 1407
+y fi(double)p fm(.)22 b fi(int)16 b fm(ma)n(y)g(b)r(e)g(used)h(as)f(a)g(synon)
+o(ym)g(for)f fi(long)h fm(and)g fi(real)g fm(ma)n(y)h(b)q(e)g(used)f(as)g(a)g
+(synon)o(ym)g(for)g fi(float)0 1469 y fm(in)k(the)f(CDL)h(notation.)31 b(W)l
+(e)20 b(will)h(p)q(ostp)q(one)e(a)g(discussion)i(of)e(the)h(exact)f(meaning)h
+(of)e(eac)o(h)i(of)f(the)g(t)n(yp)r(es)0 1531 y(un)o(til)d(the)e(discussion)i
+(of)e fh(data)p fm(,)g(b)q(elo)o(w.)20 b(F)l(or)14 b(no)n(w,)g(it)h(su\016ces)
+g(to)e(kno)o(w)h(that)g(the)g(c)o(hoice)i(of)e(the)g(t)o(yp)q(e)h(used)g(to)0
+1593 y(represen)o(t)i(v)n(ariable)h(data)e(dep)r(ends)i(on)f(the)g(range)g
+(of)g(v)m(alues)h(it)f(can)h(ha)n(v)o(e,)f(the)h(precision)g(to)f(whic)o(h)h
+(v)m(alues)0 1656 y(are)d(kno)o(wn,)f(and)i(the)f(n)o(um)o(b)q(er)h(of)e(bits)
+i(required)g(to)f(represen)o(t)g(the)g(v)n(ariable)h(in)g(a)f(netCDF)f(\014le)
+j(on)e(disk.)62 1794 y(The)20 b(shap)r(e)f(of)h(a)f(v)m(ariable)i(is)f(sp)r
+(eci\014ed)h(b)o(y)f(its)g(list)g(of)f(dimensions.)35 b(If)20 b(a)f(v)n(ariab\
+le)h(has)g(an)g(unlimited)0 1856 y(dimension,)i(that)e(dimension)h(m)o(ust)f
+(app)q(ear)g(\014rst)f(in)i(the)f(list)h(of)f(dimensions)h(in)g(CDL.)e(It)h
+(is)h(p)q(ossible)h(to)0 1918 y(de\014ne)c(v)n(ariables)g(with)g(no)f(dimensi\
+ons,)i(also)e(called)i fh(scalar)h fm(v)n(ariables.)27 b(There)17 b(are)g(no)
+g(scalar)h(v)m(ariables)g(in)0 1980 y(the)d(example)h(netCDF)f(\014le.)62 2118
+y(CDL)h(v)m(ariable)h(declarations)f(app)r(ear)f(after)g(the)g fi(variables)g
+fm(k)o(eyw)n(ord)h(in)g(a)f(CDL)h(unit.)22 b(They)16 b(ha)n(v)o(e)g(the)0 2181
+y(form)196 2318 y fh(t)n(yp)r(e)i(v)m(ariable)t 14 2 v 13 w(name)33 b fm(\()
+15 b fh(dim)t 14 2 v 13 w(name)s 14 2 v 14 w(1,)f(dim)t 14 2 v 13 w(name)s 14
+2 v 14 w(2,)g ff(:)7 b(:)h(:)14 b fm(\))h(;)0 2532 y(for)g(v)m(ariables)h(wit\
+h)g(dimensions,)g(or)196 2670 y fh(t)n(yp)r(e)i(v)m(ariable)t 14 2 v 13 w(nam\
+e)g fm(;)p eop
+%%Page: 18 20
+ bop 0 -58 a fm(18)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y(for)g(scalar)g
+(v)m(ariables.)62 325 y(In)k(the)e(CDL)h(example)g(there)g(are)f(six)h(v)n
+(ariables.)28 b(As)17 b(discussed)j(ab)q(o)n(v)o(e,)e(four)f(of)g(these)h(are)
+g(co)q(ordinate)0 387 y(v)m(ariables)g(for)f(dimensions.)27 b(The)17 b(remain\
+ing)i(v)m(ariables,)f fi(temp)f fm(and)g fi(rh)p fm(,)g(con)o(tain)g(what)g
+(is)g(usually)i(though)n(t)0 449 y(of)c(as)g(the)g(data.)20 b(Eac)n(h)c(of)f
+(these)g(v)n(ariables)h(has)f(the)h(unlimited)h(dimension)g fi(time)e fm(as)g
+(its)h(\014rst)f(dimension,)h(so)0 512 y(they)e(are)f(called)i fh(record)e
+(v)n(ariables)p fm(.)20 b(A)13 b(v)n(ariable)h(that)f(is)h(not)f(a)g(record)h
+(v)m(ariable)h(has)e(a)g(\014xed)h(size)h(\(n)o(um)n(b)r(er)e(of)0 574 y(data)
+h(v)n(alues\))h(giv)o(en)g(b)o(y)g(the)g(pro)q(duct)h(of)e(its)h(dimensions.)
+22 b(A)15 b(record)g(v)m(ariable)h(has)f(a)f(current)g(size,)i(giv)o(en)f(b)o
+(y)0 636 y(the)g(pro)q(duct)h(of)f(the)g(maxim)o(um)g(record)h(written)f(so)g
+(far)f(and)i(the)f(other)g(dimensions)i(of)e(the)g(v)n(ariable.)21 b(Only)0
+699 y(record)15 b(v)n(ariables)h(ma)n(y)f(gro)n(w)g(after)g(they)g(are)g(de\
+\014ned.)0 965 y fl(2.3)33 b(A)n(ttributes)62 1107 y fm(A)12 b(netCDF)f fh
+(attribute)j fm(is)e(mean)o(t)f(to)g(con)o(tain)h(information)g(ab)q(out)g
+(a)f(netCDF)g(v)n(ariable)h(or)f(ab)r(out)g(an)g(entire)0 1169 y(netCDF)k(\
+\014le.)22 b(This)16 b(information)g(is)g fh(ancillary)h(data)p fm(,)d(or)h
+(data)g(ab)q(out)h(data,)e(analogous)h(to)g(the)h(information)0 1231 y(stored)
+k(in)h(data)f(dictionaries)i(and)f(sc)o(hema)g(in)g(con)o(v)o(en)o(tional)g
+(database)f(systems.)35 b(An)21 b(attribute)g(has)f(an)0 1294 y(asso)q(ciated)
+14 b(v)n(ariable,)h(a)e(name,)h(a)g(data)g(t)n(yp)r(e,)g(a)g(length,)g(and)h
+(a)e(v)n(alue.)20 b(Individual)d(attributes)d(are)g(identi\014ed)0 1356 y(b)o
+(y)h(sp)r(ecifying)h(a)f(v)n(ariable)h(and)f(an)g(attribute)g(name.)62 1498 y
+(Eac)o(h)j(attribute)f(is)i(associated)g(with)f(a)f(single)i(v)n(ariable)g
+(when)f(it)g(is)g(created.)28 b(A)o(ttributes)18 b(for)f(di\013erent)0 1560 y
+(v)m(ariables)g(ma)n(y)e(di\013er)i(in)f(data)e(t)o(yp)q(e,)h(length,)h(and)f
+(v)m(alues)h(ev)o(en)g(though)f(they)g(share)g(the)g(same)g(name.)62 1702 y
+(A)g fh(global)h fm(attribute)f(is)f(one)h(that)e(applies)j(to)e(the)g(whole)
+h(netCDF)f(rather)g(than)g(an)o(y)g(particular)h(v)m(ariable.)0 1764 y(Global)
+h(attributes)g(are)g(de\014ned)h(and)f(accessed)h(similarly)g(to)e(v)n(ariabl\
+e)i(attributes;)e(the)h(details)h(for)e(de\014ning)0 1826 y(global)g(attribut\
+es)g(in)g(the)g(CDL)g(notation)f(and)h(in)g(the)g(netCDF)f(pro)q(cedural)i
+(in)o(terface)f(are)f(presented)g(later.)62 1968 y(A)o(ttribute)i(names)f(fol\
+lo)o(w)g(the)h(same)e(rules)j(as)d(dimension)j(and)f(v)m(ariable)h(names.)j
+(Pro)n(viding)d(meaningful)0 2030 y(names)12 b(for)f(attributes)h(is)g(imp)r
+(ortan)n(t,)g(but)g(using)h(agreed)e(on)h(con)o(v)o(en)o(tional)h(names)e(is)
+i(also)f(required)h(if)f(generic)0 2092 y(applications)19 b(and)e(utilit)q
+(y)g(programs)f(will)j(b)q(e)f(used)g(on)f(a)g(netCDF)g(\014le.)27 b(F)l(or)
+16 b(example,)j(ev)o(ery)e(v)m(ariable)i(for)0 2155 y(which)13 b(units)g(mak)
+n(e)g(sense)g(should)h(ha)o(v)o(e)f(a)f fi(units)g fm(attribute)h(de\014ned,)
+h(so)e(the)h(units)g(can)g(b)r(e)g(prin)o(ted)g(in)h(lab)r(els.)0 2217 y(F)l
+(urthermore,)19 b(if)g(the)g(netCDF)f(\014le)i(is)f(ev)o(er)f(to)g(b)r(e)h
+(used)g(as)g(input)g(to)f(generic)i(units-a)o(w)o(are)e(soft)n(w)o(are,)h(the)
+0 2279 y(v)m(alues)14 b(of)f(the)g fi(units)f fm(attributes)h(should)h(b)q
+(e)f(expressed)h(in)g(a)f(con)n(v)o(en)o(tional)h(form)e(as)h(a)f(c)o(haracte\
+r)h(string)g(that)0 2341 y(can)i(b)r(e)g(interpreted)g(b)o(y)g(that)g(soft)n
+(w)n(are.)62 2483 y(The)h(t)n(yp)r(e)f(of)g(an)h(attribute)f(is)h(sp)r(eci\
+\014ed)h(when)f(it)f(is)h(created.)21 b(The)16 b(t)n(yp)q(es)g(p)r(ermitted)f
+(for)g(attributes)g(are)0 2545 y(exactly)i(the)g(same)g(as)g(the)g(netCDF)f
+(data)g(t)o(yp)q(es)h(used)h(in)f(creating)h(v)m(ariables.)26 b(A)o(ttributes)
+17 b(with)g(the)g(same)0 2608 y(name)j(for)f(di\013erent)h(v)m(ariables)h(sho\
+uld)f(sometimes)g(b)r(e)f(of)h(di\013erent)g(t)n(yp)r(es.)33 b(F)l(or)19 b
+(example,)i(the)f(attribute)0 2670 y fi(valid_max)14 b fm(sp)q(ecifying)j(the)
+e(maxim)o(um)g(v)n(alid)h(data)f(v)m(alue)h(for)f(a)g(v)m(ariable)h(of)f(t)o
+(yp)q(e)g fi(long)g fm(should)h(b)r(e)f(of)g(t)n(yp)r(e)p eop
+%%Page: 19 21
+ bop 0 -58 a fm(Chapter)15 b(2:)k(Comp)q(onents)14 b(of)h(a)g(NetCDF)f(File)
+1062 b(19)0 183 y fi(long)p fm(,)19 b(whereas)h(the)f(attribute)g fi(valid_ma\
+x)f fm(for)h(a)g(v)m(ariable)h(of)f(t)o(yp)q(e)g fi(double)g fm(should)h(inst\
+ead)g(b)r(e)f(of)g(t)n(yp)r(e)0 246 y fi(double)p fm(.)62 398 y(In)j(addition)
+h(to)e(sp)q(ecifying)i(the)f(asso)q(ciated)g(v)m(ariable,)i(attribute)d(name,)
+i(and)f(t)n(yp)r(e,)h(the)f(length)g(and)0 460 y(v)m(alue)17 b(of)e(an)h(attr\
+ibute)g(m)n(ust)g(also)g(b)q(e)g(sp)r(eci\014ed)h(when)f(it)g(is)h(created.)k
+(The)c(information)e(in)i(an)f(attribute)f(is)0 523 y(represen)o(ted)c(b)o
+(y)f(either)h(a)f(single)i(v)m(alue)g(\(length)e(1\))g(or)g(a)g(v)o(ector)g
+(of)g(v)m(alues)h(of)f(the)h(same)f(t)n(yp)r(e.)18 b(Since)12 b(\\c)o(haracte\
+r)0 585 y(string")19 b(is)g(not)f(a)h(basic)h(netCDF)e(data)g(t)n(yp)r(e,)h
+(string-v)n(alued)h(attributes)f(ha)n(v)o(e)g(a)g(v)n(ector)g(of)f(c)o(haract\
+ers)g(as)0 647 y(their)e(v)m(alue,)g(with)f(a)g(length)h(equal)g(to)f(the)g
+(length)h(of)f(the)g(c)o(haracter)f(string.)62 800 y(A)o(ttributes)19 b(are)f
+(more)h(dynamic)g(than)g(v)m(ariables)h(or)e(dimensions;)k(they)d(can)g(ha)n
+(v)o(e)g(their)g(t)o(yp)q(e,)h(length,)0 862 y(and)d(v)m(alues)h(c)o(hanged)f
+(after)f(they)h(are)g(created.)24 b(F)l(or)16 b(example,)i(an)f(attribute)g fi
+(max_value)e fm(migh)o(t)i(store)f(the)0 924 y(maxim)o(um)e(v)n(alue)h(seen)g
+(so)e(far)h(for)g(a)g(record)g(v)m(ariable,)h(and)g(migh)o(t)f(b)q(e)h(up)r
+(dated)f(ev)o(ery)g(time)h(a)f(new)g(record)g(is)0 986 y(written.)62 1139 y
+(The)i(CDL)f(notation)g(for)f(de\014ning)j(an)e(attribute)g(is)181 1291 y fh
+(v)m(ariable)t 14 2 v 13 w(name:attribute)s 14 2 v 13 w(name)j fm(=)e fh(list)
+s 14 2 v 14 w(of)r 14 2 v 14 w(v)m(alues)i fm(;)0 1534 y(for)d(a)f(v)n(ariabl\
+e)i(attribute,)f(or)181 1686 y fh(:attribute)r 14 2 v 13 w(name)j fm(=)e fh
+(list)s 14 2 v 14 w(of)r 14 2 v 14 w(v)m(alues)i fm(;)0 1929 y(for)f(a)f(glob\
+al)i(attribute.)26 b(The)17 b(t)o(yp)q(e)g(and)h(length)g(of)e(eac)o(h)i(attr\
+ibute)f(are)f(not)h(explicitly)j(declared)e(in)g(CDL;)0 1991 y(they)13 b(are)
+g(deriv)o(ed)h(from)e(the)h(v)n(alues)g(assigned)h(to)e(the)h(attribute.)19 b
+(All)c(v)m(alues)f(of)e(an)h(attribute)g(m)o(ust)g(b)q(e)g(of)g(the)0 2054 y
+(same)k(t)n(yp)r(e.)26 b(The)17 b(notation)g(used)g(for)g(constan)n(t)g(v)n
+(alues)h(of)e(the)h(v)n(arious)g(netCDF)g(t)n(yp)q(es)h(is)f(discussed)i(late\
+r)0 2116 y(\(see)c(Section)h(10.3)e([CDL)h(Constan)n(ts],)f(page)h(155\).)62
+2268 y(In)21 b(the)g(example)g(netCDF)e(\(see)i(Chapter)f(2)g([CDL)g(example]\
+,)h(page)f(13\),)h fi(units)e fm(is)i(an)f(attribute)h(for)0 2331 y(the)e(v)n
+(ariable)h fi(lat)e fm(that)h(has)g(a)f(13)h(c)o(haracter)f(arra)n(y)h(v)m
+(alue)h(`)p fi(degrees_north)p fm('.)29 b(And)20 b fi(valid_range)d fm(is)j
+(an)0 2393 y(attribute)15 b(for)g(the)g(v)m(ariable)h fi(rh)f fm(that)g(has)g
+(length)h(2)f(and)g(v)n(alues)g(`)p fi(0.0)p fm(')f(and)i(`)p fi(1.0)p fm('.)
+62 2545 y(One)22 b(global)g(attribute|)p fi(source)p fm(|is)f(de\014ned)i(for)
+d(the)h(example)h(netCDF)e(\014le.)39 b(This)21 b(is)h(a)f(c)o(haracter)0 2608
+y(arra)n(y)15 b(intended)h(for)f(do)q(cumen)o(ting)h(the)f(data.)20 b(Real)c
+(netCDF)f(\014les)h(t)o(ypically)h(ha)o(v)o(e)e(more)g(global)h(attributes)0
+2670 y(to)f(do)q(cumen)o(t)g(the)g(origin,)h(history)l(,)f(accuracy)l(,)g(and)
+g(other)g(c)o(haracteristics)h(of)f(the)g(data.)p eop
+%%Page: 20 22
+ bop 0 -58 a fm(20)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fe(2.3.1)30 b
+(A)n(ttribute)15 b(Con)n(v)n(en)n(tions)62 320 y fm(Generic)g(applications)h
+(that)e(tak)n(e)g(netCDF)g(\014les)h(as)f(input)h(ma)n(y)f(b)o(y)h(con)o(v)n
+(en)o(tion)g(exp)r(ect)f(certain)h(v)m(ariable)0 382 y(and)i(global)h(attribu\
+tes.)25 b(A)17 b(few)g(other)g(attributes)g(are)f(handled)j(in)f(sp)q(ecial)h
+(w)n(a)o(ys)e(b)o(y)g(the)g(netCDF)f(library)0 445 y(\(these)21 b(reserv)n
+(ed)h(attributes)e(will)j(ha)o(v)n(e)f(names)e(that)h(b)q(egin)h(with)f(a)g
+(leading)h(underscore)f(c)o(haracter)g(`)p fi(_)p fm('\).)0 507 y(If)f(y)o
+(ou)f(w)o(an)o(t)g(to)g(b)r(e)h(able)g(to)f(use)h(generic)h(applications)g
+(with)f(y)o(our)g(\014les,)h(y)o(ou)f(should)g(use)g(the)g(following)0 569 y
+(con)o(v)o(en)o(tional)c(names)f(for)f(these)i(commonly)f(used)h(attributes:)
+0 706 y fi(units)120 b fm(A)16 b(c)o(haracter)f(arra)n(y)g(that)g(sp)r(eci\
+\014es)i(the)f(units)g(used)h(for)e(the)h(v)m(ariable's)g(data.)21 b(A)16 b
+(standard)g(for)240 769 y(con)o(v)o(en)o(tional)k(w)o(a)n(ys)g(to)g(name)g
+(units)g(in)h(eac)o(h)f(sp)r(eci\014c)h(discipline)i(should)e(b)r(e)f(used,)h
+(if)g(a)n(v)n(ail-)240 831 y(able.)27 b(Unidata)18 b(has)g(dev)o(elop)r(ed)g
+(a)f(freely-a)o(v)n(ailable)i(library)f(of)f(routines)h(to)f(con)o(v)o(ert)g
+(b)q(et)o(w)n(een)240 893 y(c)o(haracter)f(string)g(and)h(binary)g(forms)e
+(of)h(unit)h(sp)r(eci\014cations)g(and)g(to)f(p)q(erform)g(v)m(arious)h(usefu\
+l)240 955 y(op)q(erations)j(on)g(the)g(binary)h(forms.)33 b(This)21 b(library)
+g(is)f(used)h(in)g(some)e(netCDF)h(applications.)240 1018 y(Using)14 b(the)g
+(recommended)g(units)g(syn)o(tax)f(p)r(ermits)g(data)g(represented)g(in)i(con\
+formable)e(units)i(to)240 1080 y(b)r(e)e(automatically)h(con)o(v)o(erted)f
+(to)g(common)g(units)h(for)f(algebraic)h(op)q(erations.)20 b(See)14 b(App)q
+(endix)h(C)240 1142 y([Units],)g(page)g(175,)f(for)g(more)h(information.)0
+1214 y fi(long_name)240 1286 y fm(A)20 b(long)h(descriptive)g(name.)35 b(This)
+21 b(could)h(b)q(e)f(used)g(for)f(lab)r(elling)i(plots,)g(for)d(example.)37 b
+(If)20 b(a)240 1348 y(v)m(ariable)j(has)e(no)g fi(long_name)f fm(attribute)h
+(assigned,)i(the)f(v)m(ariable)g(name)g(will)h(b)q(e)e(used)h(as)f(a)240 1410
+y(default.)0 1482 y fi(valid_range)240 1554 y fm(An)c(arra)m(y)g(of)e(t)o(w)n
+(o)h(n)o(um)o(b)r(ers)g(sp)q(ecifying)i(the)e(minimum)h(and)f(maxim)o(um)h
+(v)m(alid)g(v)n(alues)g(for)f(this)240 1616 y(v)m(ariable.)k(The)12 b(t)n(yp)
+r(e)g(of)f(eac)o(h)h fi(valid_range)e fm(attribute)h(should)i(matc)n(h)f(the)
+g(t)n(yp)r(e)g(of)f(its)h(v)m(ariable.)0 1750 y fi(valid_min)0 1813 y(valid_m\
+ax)240 1885 y fm(One)i(or)f(b)r(oth)g(of)g(these)h(ma)n(y)g(b)q(e)g(used)g
+(instead)g(of)g fi(valid_range)p fm(;)e(this)i(handles)g(the)g(case)g(where)
+240 1947 y(it)h(only)h(mak)o(es)f(sense)g(to)g(b)r(ound)g(the)g(data)g(b)r
+(elo)o(w)g(or)f(ab)r(o)n(v)o(e.)0 2019 y fi(scale_factor)240 2090 y fm(If)h
+(presen)o(t)g(for)f(a)g(v)n(ariable,)h(the)g(data)f(are)h(to)f(b)q(e)h(m)o
+(ultiplied)j(b)o(y)c(this)i(factor)d(after)h(the)h(data)f(are)240 2153 y(read)
+h(b)o(y)g(the)h(application)g(that)f(accesses)g(the)h(data.)0 2225 y fi(add_o\
+ffset)240 2296 y fm(If)k(presen)o(t)f(for)g(a)h(v)m(ariable,)h(this)f(n)o(um)
+o(b)r(er)f(is)h(to)f(b)r(e)g(added)h(to)f(the)h(data)f(after)g(it)g(is)i(read)
+e(b)o(y)240 2359 y(the)i(application)i(that)d(accesses)h(the)g(data.)36 b(If)
+22 b(b)q(oth)f fi(scale_factor)e fm(and)i fi(add_offset)e fm(at-)240 2421 y
+(tributes)c(are)f(presen)o(t,)g(the)g(data)g(are)g(\014rst)f(scaled)j(b)q(efo\
+re)e(the)g(o\013set)h(is)f(added.)21 b(The)14 b(attributes)240 2483 y fi(scal\
+e_factor)f fm(and)j fi(add_offset)d fm(can)i(b)r(e)g(used)h(together)e(to)g
+(pro)o(vide)i(simple)g(data)f(compres-)240 2545 y(sion)d(to)f(store)f(lo)o
+(w-resolution)j(\015oating-p)q(oint)e(data)f(as)h(small)h(integers)f(in)h(a)f
+(netCDF)g(\014le.)20 b(When)240 2608 y(scaled)15 b(data)e(are)h(written,)f
+(the)h(application)i(should)f(\014rst)e(subtract)h(the)g(o\013set)g(and)g(the\
+n)g(divide)240 2670 y(b)o(y)h(the)g(scale)h(factor.)p eop
+%%Page: 21 23
+ bop 0 -58 a fm(Chapter)15 b(2:)k(Comp)q(onents)14 b(of)h(a)g(NetCDF)f(File)
+1062 b(21)240 183 y(When)21 b fi(scale_factor)e fm(and)i fi(add_offset)e fm
+(are)h(used)h(for)f(pac)o(king,)i(the)f(associated)h(v)m(ariable)240 246 y
+(\(con)o(taining)17 b(the)f(pac)o(k)o(ed)g(data\))g(is)h(t)n(ypically)h(of)e
+(t)n(yp)r(e)g(b)o(yte)h(or)e(short,)h(whereas)g(the)g(unpack)o(ed)240 308 y
+(v)m(alues)j(are)f(in)o(tended)h(to)e(b)r(e)h(of)f(t)o(yp)q(e)h(\015oat)f(or)
+h(double.)29 b(The)18 b(attributes)g fi(scale_factor)e fm(and)240 370 y fi
+(add_offset)f fm(should)j(b)r(oth)e(b)r(e)h(of)f(the)h(t)o(yp)q(e)g(intended)
+h(for)e(the)h(unpac)o(k)o(ed)g(data,)g(e.g.)24 b(\015oat)16 b(or)240 432 y
+(double.)0 512 y fi(_FillValue)240 591 y fm(If)f(a)f(scalar)h(attribute)g(wit\
+h)g(this)g(name)f(is)i(de\014ned)g(for)e(a)g(v)m(ariable)i(and)f(is)g(of)f
+(the)h(same)g(t)n(yp)r(e)f(as)240 654 y(the)e(v)n(ariable,)h(it)f(will)i(b)r
+(e)e(subsequently)g(used)h(as)f(the)g fh(\014ll)i(v)m(alue)i fm(for)11 b(that)
+h(v)m(ariable.)20 b(The)12 b(purp)r(ose)240 716 y(of)i(this)h(attribute)g(is)
+g(to)f(sa)n(v)o(e)h(the)g(applications)h(programmer)d(the)i(w)o(ork)f(of)g
+(pre\014lling)j(the)e(data)240 778 y(and)j(also)g(to)f(eliminate)j(the)d(dupl\
+icate)j(writes)e(that)f(result)h(from)f(netCDF)g(\014lling)j(in)f(missing)240
+840 y(data)11 b(with)i(its)f(default)g(\014ll)i(v)m(alue,)f(only)g(to)e(b)r
+(e)h(immediately)h(o)o(v)o(erwritten)f(b)o(y)g(the)g(programmer's)240 903 y
+(preferred)18 b(v)m(alue.)28 b(This)18 b(v)n(alue)g(is)g(considered)h(to)e
+(b)r(e)h(a)f(sp)q(ecial)i(v)n(alue)f(that)f(indicates)i(missing)240 965 y(dat\
+a,)e(and)i(is)f(returned)g(when)g(reading)h(v)m(alues)g(that)e(w)o(ere)h(not)
+f(written.)28 b(The)18 b(missing)h(v)m(alue)240 1027 y(should)13 b(b)r(e)g
+(outside)g(the)f(range)g(sp)r(eci\014ed)i(b)o(y)e fi(valid_range)f fm(for)h
+(a)g(v)m(ariable.)20 b(It)13 b(is)g(not)f(necessary)240 1089 y(to)j(de\014ne)
+i(y)o(our)f(o)n(wn)g fi(_FillValue)e fm(attribute)i(for)f(a)h(v)m(ariable)h
+(if)f(the)g(default)h fh(\014ll)g(v)m(alue)j fm(for)15 b(the)240 1152 y(t)n
+(yp)r(e)j(of)f(the)g(v)n(ariable)h(is)g(adequate.)27 b(Note)17 b(that)g(if)h
+(y)n(ou)g(c)o(hange)f(the)h(v)m(alue)h(of)e(this)g(attribute,)240 1214 y(the)
+h(c)o(hanged)g(v)m(alue)g(only)h(applies)g(to)e(subsequent)g(writes;)h(previo\
+usly)h(written)f(data)f(are)g(not)240 1276 y(c)o(hanged.)j(See)c(Section)g
+(7.13)e([Missing)i(V)l(alues],)f(page)g(115,)f(for)h(more)f(information.)0
+1356 y fi(missing_value)240 1435 y(missing_value)k fm(is)j(a)e(con)o(v)o(en)o
+(tional)i(name)f(for)f(a)g(missing)i(v)n(alue)f(that)g(will)h(not)f(b)q(e)g
+(treated)240 1498 y(in)h(an)o(y)f(sp)r(ecial)h(w)o(a)n(y)g(b)q(e)g(the)f(libr\
+ary)m(,)i(as)e(the)g fi(_FillValue)f fm(attribute)h(is.)36 b(It)21 b(is)g(als\
+o)f(useful)240 1560 y(when)c(it)g(is)g(necessary)g(to)f(distinguish)j(b)r(et)
+n(w)o(een)e(t)n(w)o(o)f(kinds)i(of)e(missing)i(v)m(alues.)22 b(F)l(or)15 b
+(example,)240 1622 y fi(_FillValue)i fm(migh)o(t)h(b)q(e)g(useful)i(to)d(indi\
+cate)j(data)d(that)g(w)o(as)h(exp)q(ected)h(but)f(did)h(not)f(app)r(ear,)240
+1684 y(whereas)e fi(missing_value)f fm(migh)o(t)i(b)q(e)g(used)g(to)f(indicat\
+e)i(grid)f(regions)f(that)g(are)g(not)h(in)o(tended)240 1747 y(to)e(con)n(tai\
+n)h(data.)j(See)d(Section)g(7.13)e([Missing)i(V)l(alues],)f(page)g(115,)f(for)
+h(more)f(information.)0 1826 y fi(signedness)240 1906 y fm(Used)20 b(to)e(ind\
+icate)j(a)d(nondefault)i(interpretation)f(of)f(the)i(signedness)g(of)f(in)o
+(teger)g(v)m(alues.)33 b(By)240 1968 y(default,)15 b(applications)h(that)e
+(deal)h(with)g(v)n(alues)g(should)h(treat)d(netCDF)h(b)o(yte)g(data)g(as)h
+(unsigned)240 2030 y(and)d(netCDF)f(short)g(and)i(long)f(in)o(teger)g(data)f
+(as)g(signed.)20 b(If)12 b(y)o(ou)g(declare)h(a)e(netCDF)g(v)n(ariable)i(for)
+240 2092 y(storing)k(b)o(ytes,)g(and)h(y)o(ou)f(intend)g(that)g(the)g(v)n(alu\
+es)h(represen)o(t)f(signed)i(quan)o(tities,)f(y)o(ou)f(should)240 2155 y(decl\
+are)h(the)f(v)n(ariable)h(attribute)f fi(signedness)f fm(with)h(v)n(alue)h fi
+("signed")p fm(.)24 b(Similarly)o(,)17 b(if)h(y)n(ou)f(de-)240 2217 y(\014ne)
+j(a)e(v)n(ariable)i(for)e(an)h(arra)n(y)g(of)g(short)f(or)h(long)g(integers)f
+(and)i(y)n(ou)f(intend)g(that)g(the)g(v)m(alues)240 2279 y(b)r(e)h(in)o(terpr\
+eted)g(as)g(unsigned,)i(it)e(w)o(ould)h(b)q(e)f(appropriate)g(to)g(de\014ne)h
+(the)f(v)m(ariable)h(attribute)240 2341 y fi(signedness)14 b(=)h("unsigned")p
+fm(.)24 b(This)17 b(attribute)g(is)h(ignored)f(b)o(y)g(the)g(netCDF)g(library)
+m(,)g(but)g(ap-)240 2404 y(plications)g(ma)o(y)e(use)h(it.)21 b(Since)c(there)
+f(are)f(no)h(standard)f(F)n(OR)m(TRAN)h(t)o(yp)q(es)g(corresp)q(onding)h(to)
+240 2466 y(unsigned)e(in)o(tegers,)e(F)o(OR)m(TRAN)g(programs)f(that)h(comput\
+e)h(with)f(or)g(use)h(the)f(ordering)h(of)f(data)240 2528 y(v)m(alues)j(ma)o
+(y)f(need)h(to)e(handle)j(this)f(attribute.)0 2608 y fi(C_format)48 b fm(A)13
+b(c)o(haracter)f(arra)m(y)h(for)f(the)h(format)e(that)h(should)i(b)q(e)f(used)
+g(to)f(print)g(v)n(alues)h(for)f(this)h(v)m(ariable)h(b)o(y)240 2670 y(C)e
+(applications.)21 b(F)l(or)12 b(example,)h(if)g(y)o(ou)f(kno)o(w)g(a)g(v)n
+(ariable)h(is)g(only)g(accurate)g(to)e(three)i(signi\014cant)p eop
+%%Page: 22 24
+ bop 0 -58 a fm(22)1465 b(NetCDF)14 b(User's)h(Guide)240 183 y(digits,)e(it)f
+(w)n(ould)h(b)q(e)f(appropriate)g(to)f(de\014ne)h(the)g fi(C_format)e fm(attr\
+ibute)i(as)f fi("%.3g")p fm(.)18 b(The)12 b fi(ncdump)240 246 y fm(utility)j
+(program)f(uses)i(this)g(attribute)f(for)f(v)n(ariables)i(for)e(which)h(it)h
+(is)f(de\014ned.)0 322 y fi(FORTRAN_format)240 399 y fm(A)i(c)o(haracter)f
+(arra)m(y)h(for)f(the)h(format)e(that)h(should)i(b)q(e)f(used)h(to)e(prin)o
+(t)h(v)m(alues)g(for)f(this)i(v)m(ariable)240 461 y(b)o(y)d(F)o(OR)m(TRAN)g
+(applications.)0 538 y fi(title)120 b fm(A)15 b(global)g(attribute)f(that)g
+(is)i(a)e(c)o(haracter)g(arra)n(y)g(pro)o(viding)i(a)e(succinct)i(description)
+g(of)e(what)g(is)240 600 y(in)i(the)f(data)g(set.)0 677 y fi(history)72 b fm
+(A)13 b(global)g(attribute)g(that)f(is)h(a)f(c)o(haracter)g(arra)n(y)h(with)g
+(a)f(line)i(for)e(eac)o(h)h(inv)o(o)q(cation)f(of)h(a)f(program)240 739 y(and)
+k(argumen)o(ts)g(that)f(w)o(ere)h(used)h(to)e(derive)h(the)g(\014le.)24 b(W)l
+(ell-b)s(eha)o(v)n(ed)17 b(generic)g(netCDF)f(\014lters)240 801 y(\(programs)
+g(that)h(tak)n(e)h(netCDF)e(\014les)j(as)e(input)i(and)e(pro)q(duce)i(netCDF)
+e(\014les)h(as)f(output\))g(will)240 864 y(automatically)d(app)r(end)g(their)
+h(name)f(and)g(the)g(parameters)f(with)h(which)g(they)g(w)n(ere)g(inv)o(ok)n
+(ed)h(to)240 926 y(the)g(global)h(history)f(attribute)g(of)g(an)g(input)h(net\
+CDF)f(\014le.)62 1142 y(A)o(ttributes)k(ma)n(y)g(b)r(e)f(added)i(to)e(a)h(net\
+CDF)f(\014le)h(long)h(after)e(it)h(is)g(\014rst)f(de\014ned,)j(so)d(y)o(ou)h
+(don't)f(ha)o(v)o(e)h(to)0 1204 y(an)o(ticipate)f(all)f(p)r(oten)o(tially)h
+(useful)g(attributes.)24 b(Ho)o(w)o(ev)n(er)17 b(adding)h(new)f(attributes)g
+(to)f(an)h(existing)h(\014le)g(can)0 1266 y(incur)12 b(the)e(same)h(exp)q(ens\
+e)g(as)f(cop)o(ying)h(the)g(\014le.)19 b(See)12 b(Chapter)e(9)g([NetCDF)f(Fil\
+e)j(Structure)f(and)f(P)o(erformance],)0 1328 y(page)15 b(147,)f(for)h(a)f
+(more)h(extensive)g(discussion.)0 1554 y fe(2.3.2)30 b(Di\013erences)15 b(b)r
+(et)n(w)n(een)h(A)n(ttributes)g(and)f(V)l(ariables)62 1693 y fm(In)i(con)n
+(trast)e(to)g(v)m(ariables,)i(whic)o(h)f(are)g(in)o(tended)h(for)e(bulk)i(dat\
+a,)d(attributes)i(are)f(intended)h(for)f(ancillary)0 1755 y(data,)e(or)g(info\
+rmation)h(ab)q(out)g(the)g(data.)k(T)o(ypically)e(the)d(data)g(in)i(v)n(ariab\
+les)f(of)f(an)h(op)q(en)h(netCDF)e(will)i(reside)0 1817 y(on)g(disk,)h(b)q
+(ecause)g(the)f(data)f(are)h(to)q(o)f(large)h(to)g(\014t)g(in)h(memory)e(all)
+i(at)f(once.)20 b(In)c(con)o(trast,)d(the)i(total)g(amoun)n(t)0 1880 y(of)j
+(ancillary)i(data)e(asso)q(ciated)h(with)g(a)f(netCDF)g(ob)s(ject)g(and)h(sto\
+red)f(in)i(its)f(attributes)f(is)h(t)o(ypically)h(small)0 1942 y(enough)c(to)
+e(b)r(e)h(memory-resident.)62 2081 y(Another)g(di\013erence)j(b)q(et)o(w)n
+(een)e(attributes)f(and)g(v)m(ariables)h(is)g(that)e(v)n(ariables)h(ma)o(y)g
+(b)q(e)g(m)o(ultidimensional.)0 2143 y(A)o(ttributes)g(are)g(all)h(either)g
+(scalars)f(\(single-v)o(alued\))h(or)e(v)o(ectors)h(\(a)f(single,)i(\014xed)g
+(dimension\).)62 2282 y(V)m(ariables)h(are)f(created)h(with)g(a)f(name,)h(t)o
+(yp)q(e,)g(and)g(shap)q(e)g(b)q(efore)g(they)g(are)f(assigned)h(data)f(v)n
+(alues,)h(so)f(a)0 2344 y(v)m(ariable)h(ma)o(y)e(exist)h(with)h(no)e(v)n(alue\
+s.)22 b(The)16 b(v)n(alue)g(of)g(an)f(attribute)h(m)o(ust)f(b)r(e)h(sp)q(eci\
+\014ed)i(when)e(it)g(is)g(created,)0 2406 y(so)f(no)g(attribute)g(ev)o(er)g
+(exists)h(without)f(a)g(v)m(alue.)62 2545 y(A)f(v)m(ariable)h(ma)n(y)f(ha)o
+(v)o(e)f(attributes,)h(but)g(an)f(attribute)h(cannot)f(ha)o(v)o(e)h(attribute\
+s.)19 b(A)o(ttributes)13 b(assigned)i(to)0 2608 y(v)m(ariables)f(ma)o(y)f(ha)
+n(v)o(e)g(the)g(same)g(units)g(as)g(the)g(v)n(ariable)g(\(for)f(example,)i fi
+(valid_range)p fm(\))d(or)i(ha)o(v)n(e)g(no)g(units)h(\(for)0 2670 y(example,)
+j fi(scale_factor)p fm(\).)22 b(If)17 b(y)n(ou)g(w)n(an)o(t)f(to)g(store)g
+(data)g(in)h(a)f(netCDF)g(\014le)i(that)d(requires)j(units)f(di\013erent)p eop
+%%Page: 23 25
+ bop 0 -58 a fm(Chapter)15 b(2:)k(Comp)q(onents)14 b(of)h(a)g(NetCDF)f(File)
+1062 b(23)0 183 y(from)11 b(those)g(of)g(the)h(asso)q(ciated)g(v)m(ariable,)h
+(it)f(is)g(b)q(etter)g(to)e(use)i(a)g(v)m(ariable)h(than)e(an)h(attribute.)18
+b(More)11 b(generally)m(,)0 246 y(if)19 b(data)f(require)h(ancillary)h(data)e
+(to)g(describ)s(e)g(them,)h(are)f(m)o(ultidimensional,)k(require)e(an)n(y)f
+(of)f(the)h(de\014ned)0 308 y(netCDF)11 b(dimensions)i(to)e(index)i(their)f
+(v)m(alues,)h(or)e(require)h(a)f(signi\014can)q(t)g(amoun)o(t)g(of)g(storage,)
+f(the)i(data)f(should)0 370 y(b)r(e)k(represen)o(ted)h(using)f(v)n(ariables)h
+(rather)f(than)g(attributes.)p eop
+%%Page: 24 26
+ bop 0 -58 a fm(24)1465 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 25 27
+ bop 0 -58 a fm(Chapter)15 b(3:)k(Data)1574 b(25)0 183 y fj(3)41 b(Data)62 397
+y fm(This)15 b(c)o(hapter)g(discusses)g(the)g(six)g(primitive)f(netCDF)g(data)
+g(t)n(yp)r(es,)g(the)h(kinds)g(of)f(data)g(access)g(supp)r(orted)0 459 y(b)o
+(y)21 b(the)g(netCDF)f(in)o(terface,)i(and)f(ho)o(w)f(data)g(structures)h(oth\
+er)f(than)h(m)o(ultidimensional)j(arra)m(ys)d(ma)o(y)f(b)r(e)0 521 y(implemen)
+q(ted)15 b(in)h(a)f(netCDF)f(\014le.)0 793 y fl(3.1)33 b(NetCDF)14 b(Data)g
+(T)n(yp)r(es)62 936 y fm(The)i(curren)o(t)f(set)g(of)g(primitive)g(t)n(yp)r
+(es)g(supp)r(orted)g(b)o(y)g(the)g(netCDF)g(interface)f(are:)0 1078 y fi(byte)
+144 b fm(Eigh)o(t-bit)15 b(data;)f(esp)r(ecially)i(go)q(o)q(d)f(for)f(sa)n
+(ving)i(space)f(when)g(only)g(a)f(few)h(v)m(alues)h(are)e(p)r(ossible)h(or)
+240 1140 y(resolution)h(is)g(lo)o(w.)0 1220 y fi(character)240 1300 y fm(Curr\
+en)o(tly)i(synon)o(ymous)g(with)h fi(byte)p fm(;)g(intended)g(for)e(represent\
+ing)h(text)g(strings)g(as)g(arra)n(ys)g(of)240 1362 y(ASCI)r(I)d(c)o(haracter\
+s.)0 1443 y fi(short)120 b fm(16-bit)15 b(integers.)0 1523 y fi(long)144 b fm
+(32-bit)15 b(integers.)0 1603 y fi(float)120 b fm(32-bit)15 b(IEEE)h(\015oati\
+ng-p)q(oint.)0 1683 y fi(double)96 b fm(64-bit)15 b(IEEE)h(\015oating-p)q(oin\
+t.)62 1905 y(Except)e(for)f(the)g(added)h fi(byte)f fm(and)h(the)g(lac)o(k)f
+(of)g(unsigned)i(t)o(yp)q(es,)f(netCDF)e(supp)r(orts)h(the)g(same)h(primitive)
+0 1967 y(data)d(t)o(yp)q(es)i(as)e(C.)h(The)g(names)g(for)g(the)g(primitive)g
+(data)g(t)n(yp)r(es)g(are)f(reserv)o(ed)i(w)n(ords)f(in)h(CDL,)e(so)h(the)g
+(names)g(of)0 2030 y(v)m(ariables,)i(dimensions,)h(and)e(attributes)g(m)o(ust)
+g(not)g(b)q(e)g(t)o(yp)q(e)g(names.)20 b(Whether)13 b(b)o(yte,)g(short,)f(or)
+h(long)g(data)f(is)0 2092 y(interpreted)i(as)h(signed)g(or)f(unsigned)i(is)g
+(not)e(part)g(of)g(the)h(netCDF)f(in)o(terface;)g(since)i(no)f(netCDF)f(op)q
+(erations)0 2154 y(dep)r(end)e(on)g(the)g(sign)g(or)f(order)h(of)f(v)n(ariabl\
+e)i(data,)e(y)o(ou)g(are)h(free)g(to)f(in)o(terpret)h(a)f(b)o(yte,)h(for)f
+(example,)i(as)f(holding)0 2216 y(v)m(alues)k(b)r(et)o(w)n(een)g(0)f(and)h
+(255)e(or)h(b)q(et)o(w)o(een)g(-128)g(and)h(127.)j(F)l(or)c(con)o(v)n(enience\
+,)i(short)e(and)g(long)h(constan)n(ts)f(are)0 2279 y(interpreted)h(as)f(signe\
+d)i(in)g(the)f(CDL)g(notation.)21 b(See)c(Section)g(2.3.1)d([A)n(ttribute)i
+(Con)o(v)o(en)o(tions],)f(page)h(20)g(for)0 2341 y(more)f(information)g(on)g
+(representing)g(signedness)i(of)d(v)n(alues.)62 2483 y(These)20 b(t)o(yp)q
+(es)g(w)o(ere)g(c)o(hosen)g(b)q(ecause)g(they)g(are)g(familiar)g(to)g(C)f(and)
+h(F)n(OR)m(TRAN)h(programmers,)e(they)0 2545 y(ha)o(v)n(e)e(w)n(ell-de\014ned)
+j(external)d(represen)o(tations)f(indep)s(endent)g(of)f(an)o(y)h(particular)h
+(computers)g(\(using)f(XDR\),)0 2608 y(and)h(they)g(are)f(su\016cient)g(for)g
+(pro)o(viding)i(a)e(reasonably)h(wide)g(range)g(of)f(trade-o\013s)g(b)r(et)o
+(w)n(een)h(data)f(precision)0 2670 y(and)f(n)o(um)o(b)r(er)g(of)g(bits)g(requ\
+ired)i(for)d(eac)o(h)h(datum.)p eop
+%%Page: 26 28
+ bop 0 -58 a fm(26)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(Additional)20 b
+(primitive)f(t)n(yp)q(es)g(ma)n(y)f(b)q(e)h(added)f(in)h(the)f(future,)h(but)
+f(only)g(in)h(a)f(w)o(a)n(y)g(that)f(is)i(compatible)0 246 y(with)g(existing)
+i(programs)d(and)h(\014les.)32 b(F)l(or)19 b(example,)i fi(hyperlong)c fm(for)
+i(64-bit)g(integers)f(will)j(ev)o(en)o(tually)f(b)r(e)0 308 y(needed,)j(along)
+d(with)h(a)g(new)f(t)o(yp)q(e)h(for)f(m)n(ultib)q(yte)g(c)o(haracters,)h(but)
+f(these)h(can)g(b)q(oth)g(b)q(e)g(added)g(without)0 370 y(a\013ecting)e(exist\
+ing)f(netCDF)f(\014les)i(or)e(applications,)i(and)f(with)g(only)h(minor)f(c)n
+(hanges)g(required)h(for)e(generic)0 432 y(applications)g(that)d(will)j(supp)
+r(ort)d(them.)0 666 y fl(3.2)33 b(Data)14 b(Access)62 805 y fm(The)i(netCDF)e
+(interface)h(supp)r(orts)f(sev)o(eral)h(kinds)h(of)f(data)g(access)g(to)g(dat\
+a)f(in)i(an)f(op)r(en)g(netCDF)g(\014le:)37 943 y fk(\017)30 b fm(direct)16 b
+(\(random\))e(access)h(to)g(single)h(data)f(v)m(alues,)37 1018 y fk(\017)30 b
+fm(direct)16 b(access)f(to)g(an)g(arbitrary)g(generalized)h(cross-section)g
+(of)f(data)f(for)h(a)g(single)h(v)n(ariable,)37 1094 y fk(\017)30 b fm(record\
+-orien)o(ted)16 b(access)f(to)g(data)f(for)h(a)g(single)h(v)n(ariable,)f(and)
+37 1170 y fk(\017)30 b fm(record-orien)o(ted)16 b(access)f(to)g(a)g(subset)g
+(of)g(the)g(v)m(ariables)i(in)f(a)e(record.)62 1384 y(T)l(o)h(directly)i(acce\
+ss)e(a)g(single)h(data)f(v)m(alue,)h(y)n(ou)f(sp)r(ecify)h(a)f(netCDF)f(\014l\
+e,)i(a)f(v)m(ariable,)h(and)f(a)g(m)n(ultidimen-)0 1446 y(sional)i(index)g
+(for)f(the)g(v)n(ariable.)23 b(Files)18 b(are)d(not)h(sp)r(eci\014ed)h(b)o
+(y)g(name)f(ev)o(ery)g(time)g(y)o(ou)g(w)o(an)n(t)g(to)g(access)g(data,)0 1509
+y(but)e(instead)g(b)o(y)g(a)g(small)g(integer)f(obtained)i(when)f(the)g(\014l\
+e)h(is)f(\014rst)g(created)g(or)f(op)q(ened.)21 b(Similarly)n(,)14 b(v)m(aria\
+bles)0 1571 y(are)i(not)f(sp)q(eci\014ed)j(b)o(y)e(name)g(for)f(ev)o(ery)h
+(data)f(access)h(either,)g(but)g(b)o(y)g(v)m(ariable)h(IDs,)f(small)g(integer\
+s)f(used)i(to)0 1633 y(identify)e(v)n(ariables)h(in)g(a)f(netCDF)f(\014le.)62
+1771 y(Data)20 b(in)i(a)f(netCDF)g(\014le)h(can)g(b)q(e)g(accessed)f(as)g(sin\
+gle)i(v)m(alues)f(or)f(as)g fh(h)o(yp)q(erslabs)p fm(.)39 b(A)21 b(h)o(yp)r
+(erslab)g(is)h(a)0 1833 y(generalized)c(piece)g(of)e(a)g(m)o(ultidimensional)
+k(v)m(ariable)e(that)d(is)i(sp)r(eci\014ed)h(b)o(y)e(giving)i(the)e(indices)j
+(of)d(a)g(corner)0 1896 y(p)r(oin)o(t)j(and)g(a)g(list)h(of)f(edge)g(lengths)
+h(along)f(eac)o(h)h(of)e(the)i(dimensions)h(of)d(the)i(v)m(ariable.)33 b(The)
+19 b(corner)g(p)r(oin)o(t)0 1958 y(sp)q(eci\014ed)j(m)o(ust)d(b)r(e)h(the)g
+(one)g(with)g(the)g(smallest)g(indices,)j(that)c(is)h(the)g(one)g(closest)g
+(to)f(the)h(origin)g(of)g(the)0 2020 y(v)m(ariable)h(index)h(space.)34 b(The)
+21 b(blo)q(c)o(k)f(of)g(data)f(v)n(alues)h(returned)h(\(or)e(written\))h(has)
+g(the)g(last)g(dimension)h(of)0 2082 y(the)d(v)n(ariable)h(v)m(arying)f(faste\
+st,)g(and)g(the)g(\014rst)g(dimension)i(v)m(arying)f(most)e(slo)o(wly)i(in)g
+(the)f(C)g(in)o(terface.)29 b(F)-5 b(or)0 2145 y(F)n(OR)m(TRAN,)17 b(the)f
+(order)g(is)g(rev)o(ersed,)g(with)h(the)f(\014rst)g(dimension)h(of)f(the)g
+(v)n(ariable)h(v)m(arying)f(fastest)g(and)g(the)0 2207 y(last)d(dimension)i
+(v)n(arying)e(most)g(slo)o(wly)l(.)19 b(These)14 b(ordering)g(con)o(v)n(entio\
+ns)f(corresp)q(ond)h(to)e(the)i(customary)e(order)0 2269 y(in)k(which)f(m)o
+(ultidimensional)j(v)n(ariables)e(are)f(stored)f(in)i(C)f(and)h(F)n(OR)m(TRAN\
+.)62 2407 y(As)k(an)g(example)g(of)g(h)o(yp)q(erslab)h(access,)f(assume)g(tha\
+t)f(in)i(the)e(example)i(netCDF)e(\014le)i(\(see)f(Chapter)f(2)0 2470 y([CDL)
+e(example],)h(page)f(13\),)g(y)n(ou)h(wish)f(to)g(read)g(all)i(the)e(data)g
+(for)f(the)i fi(temp)f fm(v)m(ariable)h(at)f(the)g(second)h(\(850)0 2532 y
+(millibar\))e(lev)o(el,)f(and)f(assume)g(that)g(there)g(are)g(curren)o(tly)g
+(three)h(records)f(\()p fi(time)f fm(v)m(alues\))i(in)g(the)f(netCDF)f(\014le\
+.)0 2594 y(Recall)k(that)d(the)i(dimensions)h(are)d(de\014ned)j(as)p eop
+%%Page: 27 29
+ bop 0 -58 a fm(Chapter)15 b(3:)k(Data)1574 b(27)311 183 y fi(lat)23 b(=)h
+(5,)g(lon)f(=)h(10,)f(level)g(=)h(4,)g(time)f(=)h(unlimited;)0 407 y fm(and)
+15 b(the)h(v)m(ariable)g fi(temp)f fm(is)h(declared)g(as)311 550 y fi(float)
+71 b(temp\(time,)22 b(level,)h(lat,)h(lon\);)0 773 y fm(in)16 b(the)f(CDL)g
+(notation.)62 916 y(A)21 b(corresp)q(onding)h(C)f(v)m(ariable)h(that)e(holds)
+i(data)e(for)h(all)h(four)e(levels)h(and)g(all)h(three)f(times)g(might)f(b)r
+(e)0 979 y(declared)c(as)120 1122 y fi(#define)23 b(LATS)47 b(5)120 1171 y
+(#define)23 b(LONS)g(10)120 1221 y(#define)g(LEVELS)g(4)120 1271 y(#define)g
+(TIMES)g(3)406 b(/*)23 b(currently)g(*/)215 1321 y ff(:)8 b(:)f(:)120 1371 y
+fi(float)71 b(temp[TIMES*LEVELS*LATS*LO)o(NS];)0 1594 y fm(to)15 b(k)n(eep)h
+(the)f(data)g(in)h(a)f(one-dimensional)i(arra)n(y)l(,)e(or)215 1737 y ff(:)8 b
+(:)f(:)120 1787 y fi(float)71 b(temp[TIMES][LEVELS][LATS])o([LONS];)0 2011 y
+fm(using)17 b(a)e(m)o(ultidimensional)k(arra)n(y)c(declaration.)23 b(T)l(o)15
+b(read)h(in)h(a)e(h)o(yp)r(erslab)h(of)f(data)g(for)h(only)g(one)g(level)g
+(at)f(a)0 2073 y(time,)g(for)g(example,)g(y)o(ou)g(could)h(leav)n(e)g(out)f
+(the)g(LEVEL)h(dimension)h(or)d(set)h(it)h(to)e(1.)62 2216 y(In)21 b(F)o(OR)m
+(TRAN,)f(the)h(dimensions)h(are)e(rev)n(ersed)h(from)f(the)g(CDL)g(declaratio\
+n)i(with)e(the)h(\014rst)f(dimen-)0 2278 y(sion)e(v)m(arying)g(fastest)e(and)
+i(the)g(record)f(dimension)i(as)e(the)h(last)f(dimension)i(of)e(a)g(record)h
+(v)m(ariable.)28 b(Th)o(us)17 b(a)0 2340 y(F)n(OR)m(TRAN)f(declaration)g(for)
+f(the)g(coresp)q(onding)h(v)n(ariable)g(that)e(holds)i(all)g(times)g(and)f
+(levels)h(is)263 2483 y fi(PARAMETER)23 b(\(LATS=5,)g(LONS=10,)f(LEVELS=4,)h
+(TIMES=3\))335 2533 y ff(:)7 b(:)g(:)263 2583 y fi(REAL)23 b(TEMP\(LONS,)g
+(LATS,)g(LEVELS,)g(TIMES\))p eop
+%%Page: 28 30
+ bop 0 -58 a fm(28)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(T)l(o)j(sp)q
+(ecify)h(the)f(h)o(yp)r(erslab)g(of)g(data)f(that)g(represents)g(the)h(second)
+h(lev)o(el,)g(all)g(times,)g(all)g(latitudes,)g(and)0 246 y(all)e(longitudes,)
+g(w)o(e)f(need)h(to)e(pro)n(vide)i(a)f(corner)g(and)g(some)g(edge)g(lengths.)
+23 b(The)16 b(corner)g(should)h(b)r(e)f(\(0,)f(1,)h(0,)0 308 y(0\))f(in)i(C|o\
+r)f(\(1,)f(1,)h(2,)f(1\))g(in)i(F)o(OR)m(TRAN|b)r(ecause)g(y)n(ou)f(w)o(an)n
+(t)g(to)f(start)g(at)h(the)g(b)q(eginning)i(of)d(eac)o(h)h(of)g(the)0 370 y fi
+(time)p fm(,)d fi(lon)p fm(,)g(and)h fi(lat)f fm(dimensions,)i(but)f(y)o(ou)f
+(w)o(an)n(t)h(to)f(b)q(egin)h(at)f(the)h(second)g(v)n(alue)g(of)f(the)h fi
+(level)f fm(dimension.)0 432 y(The)k(edge)g(lengths)h(should)f(b)r(e)g(\(3,)f
+(1,)h(5,)f(10\))g(in)i(C|or)e(\(10,)g(5,)h(1,)f(3\))g(in)i(F)n(OR)m(TRAN|sinc\
+e)h(y)o(ou)e(w)n(an)o(t)g(to)0 495 y(get)e(data)g(for)f(all)j(three)e fi(time)
+g fm(v)m(alues,)h(only)g(one)f fi(level)g fm(v)m(alue,)h(all)g(\014v)o(e)g fi
+(lat)f fm(v)m(alues,)h(and)f(all)i(10)d fi(lon)h fm(v)n(alues.)0 557 y(Y)l
+(ou)h(should)h(exp)r(ect)f(to)f(get)h(a)g(total)f(of)h(150)f(\015oat)g(v)m
+(alues)i(returned)g(\(3)e(*)h(1)f(*)h(5)g(*)f(10\),)g(and)h(should)h(pro)o
+(vide)0 619 y(enough)h(space)h(in)g(y)n(our)f(arra)n(y)g(for)f(this)i(man)n
+(y)m(.)28 b(The)18 b(order)g(in)h(whic)o(h)g(the)f(data)f(will)j(b)q(e)f(retu\
+rned)f(is)h(with)0 681 y(the)d(last)f(dimension,)i fi(lon)p fm(,)e(v)m(arying)
+h(fastest)f(for)f(C,)h(or)g(with)h(the)g(\014rst)f(dimension,)i fi(LON)p fm
+(,)e(v)m(arying)h(fastest)f(for)0 744 y(F)n(OR)m(TRAN:)454 885 y fi(C)429 b
+(FORTRAN)239 985 y(temp[0][1][0][0])141 b(TEMP\(1,)23 b(1,)h(2,)f(1\))239 1035
+y(temp[0][1][0][1])141 b(TEMP\(2,)23 b(1,)h(2,)f(1\))239 1084 y(temp[0][1][0]\
+[2])141 b(TEMP\(3,)23 b(1,)h(2,)f(1\))239 1134 y(temp[0][1][0][3])141 b(TEMP\
+\(4,)23 b(1,)h(2,)f(1\))382 1234 y ff(:)8 b(:)f(:)405 b(:)7 b(:)h(:)239 1334 y
+fi(temp[2][1][4][7])141 b(TEMP\()23 b(8,)h(5,)g(2,)f(3\))239 1383 y(temp[2][1\
+][4][8])141 b(TEMP\()23 b(9,)h(5,)g(2,)f(3\))239 1433 y(temp[2][1][4][9])141 b
+(TEMP\(10,)23 b(5,)h(2,)f(3\))62 1640 y fm(Note)18 b(that)f(the)g(di\013eren)
+q(t)g(dimension)j(orders)d(for)g(the)h(C)f(and)h(F)n(OR)m(TRAN)h(in)o(terface\
+s)e(do)h(not)f(re\015ect)h(a)0 1702 y(di\013eren)q(t)11 b(order)g(for)g(v)n
+(alues)h(stored)f(on)h(the)f(disk,)i(but)f(merely)g(di\013eren)q(t)f(orders)g
+(supp)r(orted)h(b)o(y)f(the)h(pro)q(cedural)0 1764 y(interfaces)17 b(to)g(the)
+h(t)o(w)n(o)g(languages.)28 b(In)18 b(general,)h(it)f(do)q(es)g(not)f(matter)
+g(whether)h(a)g(netCDF)f(\014le)i(is)f(written)0 1826 y(using)h(the)f(C)g(or)
+g(F)o(OR)m(TRAN)g(interface;)h(netCDF)f(\014les)h(written)f(from)g(either)h
+(language)f(ma)o(y)g(b)q(e)h(read)f(b)o(y)0 1889 y(programs)c(written)h(in)h
+(the)g(other)e(language.)62 2030 y(Besides)h(the)e(regular)h(h)o(yp)q(erslab)
+g(access)g(describ)r(ed)g(ab)q(o)o(v)o(e,)f(the)g(netCDF)g(abstraction)g(also)
+g(supp)r(orts)g(the)0 2093 y(reading)j(and)g(writing)g(of)g fh(generalized)h
+(h)o(yp)r(erslabs)p fm(.)22 b(A)16 b(generalized)h(h)o(yp)r(erslab)f(has)f
+(the)h(same)g(corner)f(p)r(oin)o(t)0 2155 y(and)20 b(edge)h(lengths)f(attribu\
+tes)g(as)g(a)f(regular)i(h)o(yp)q(erslab.)35 b(It)20 b(allows,)g(ho)o(w)n(ev)
+o(er,)h(more)f(general)g(mappings)0 2217 y(b)r(et)n(w)o(een)15 b(the)h(p)q
+(oin)o(ts)f(of)g(the)g(h)o(yp)r(erslab)g(and)g(b)r(oth)g(the)g(disk-residen)q
+(t)g(v)m(alues)h(of)f(the)g(netCDF)f(v)n(ariable)i(and)0 2279 y(the)f(lo)r
+(cations)g(for)g(those)g(v)m(alues)h(in)g(memory)l(.)62 2421 y(In)j(a)f(regul\
+ar)h(h)o(yp)q(erslab,)h(the)e(mapping)h(b)r(et)n(w)o(een)g(the)f(p)r(oin)o
+(ts)g(of)g(the)g(h)o(yp)r(erslab)h(and)f(the)h(v)m(alues)g(of)f(a)0 2483 y
+(netCDF)c(v)n(ariable)i(can)f(b)q(e)g(describ)s(ed)g(as)g(con)o(tiguous:)20 b
+(along)15 b(eac)n(h)h(dimension,)g(adjacen)o(t)f(h)o(yp)q(erslab)h(p)q(oin)o
+(ts)0 2545 y(corresp)q(ond)j(to)e(adjacen)o(t)h(netCDF)f(v)n(ariable)i(v)m
+(alues.)30 b(In)19 b(a)f(generalized)i(h)o(yp)q(erslab,)f(ho)o(w)o(ev)n(er,)g
+(this)g(is)f(not)0 2608 y(necessarily)i(true;)g(in)g(an)n(y)f(dimension,)i
+(adjacen)o(t)d(generalized)j(h)o(yp)q(erslab)e(p)r(oin)o(ts)g(corresp)q(ond)g
+(to)f(netCDF)0 2670 y(v)m(ariable)g(v)n(alues)f(that)f(are)g(separated)h(b)o
+(y)f(a)h(distance)g(of)f fh(n)h fm(v)n(alues.)25 b fh(n)17 b fm(is)g(the)g fh
+(stride)i fm(of)e(the)f(dimension)j(and)p eop
+%%Page: 29 31
+ bop 0 -58 a fm(Chapter)15 b(3:)k(Data)1574 b(29)0 183 y(needn't)16 b(b)r(e)f
+(the)h(same)g(for)f(all)h(dimensions.)23 b(Strides)17 b(ma)n(y)f(reasonably)f
+(v)n(ary)g(from)g(one)h(\(to)f(access)g(adjacen)o(t)0 246 y(netCDF)f(v)m(aria\
+ble)h(v)n(alues\))g(to)e(the)i(n)o(um)o(b)q(er)g(of)f(p)q(oints)f(in)j(a)e
+(netCDF)f(dimension.)22 b(A)14 b(regular)h(h)o(yp)q(erslab)g(has)0 308 y(unit\
+y)g(strides)g(in)h(all)g(dimensions.)62 475 y(The)d(other)f(mapping)h(allo)o
+(w)o(ed)f(b)o(y)h(generalized)h(h)o(yp)q(erslabs)f(is)g(b)q(et)o(w)n(een)g
+(the)g(p)q(oin)o(ts)f(of)g(the)g(h)o(yp)r(erslab)h(and)0 537 y(the)j(memory)f
+(lo)r(cations)g(of)h(the)f(corresp)r(onding)h(v)n(alues.)22 b(In)16 b(a)f(reg\
+ular)h(h)o(yp)r(erslab,)g(this)g(mapping)g(is)g(trivial:)0 600 y(the)c(struct\
+ure)g(of)g(the)g(in-memory)h(v)m(alues)g(\(i.e.)19 b(the)12 b(dimensional)i
+(sizes)f(and)f(their)h(order\))f(is)g(identical)h(to)f(that)0 662 y(of)i(the)
+g(h)o(yp)q(erslab.)20 b(In)15 b(a)e(generalized)j(h)o(yp)q(erslab,)f(ho)n(w)o
+(ev)o(er,)f(this)g(is)h(not)e(necessarily)j(true,)d(instead)i(an)f fh(index)0
+724 y(mapping)h(v)o(ector)i fm(is)d(used)h(to)f(de\014ne)h(the)g(mapping)g
+(b)q(et)o(w)n(een)g(p)r(oin)o(ts)f(in)h(the)f(generalized)i(h)o(yp)r(erslab)e
+(and)h(the)0 786 y(memory)h(lo)q(cations)h(of)e(the)i(corresp)q(onding)g(v)m
+(alues.)24 b(The)16 b(o\013set,)g(in)h(b)o(ytes,)f(from)g(the)g(origin)h(of)e
+(a)h(memory-)0 849 y(resident)d(arra)m(y)g(to)g(a)f(particular)i(p)q(oint)e
+(is)i(giv)o(en)f(b)o(y)g(the)g fh(inner)h(pro)q(duct)1265 832 y fd(1)1297 849
+y fm(of)f(the)g(index)h(mapping)f(v)o(ector)g(with)0 911 y(the)f(p)r(oin)o
+(t's)g fh(co)q(ordinate)g(o\013set)h(v)n(ector)684 895 y fd(2)715 911 y fm
+(.)19 b(The)12 b(index)i(mapping)f(v)o(ector)e(for)h(a)g(regular)g(h)o(yp)r
+(erslab)h(w)n(ould)g(ha)o(v)o(e)0 973 y({)g(in)g(order)g(from)f(most)g(rapidl\
+y)i(v)n(arying)f(dimension)i(to)d(most)g(slo)o(wly)h({)g(the)g(b)o(yte)g(size)
+h(of)e(a)h(memory-residen)o(t)0 1036 y(datum)k(\(e.g.)26 b(4)17 b(for)g(a)g
+(\015oating-p)r(oin)o(t)g(v)n(alue\),)h(then)f(the)h(pro)q(duct)g(of)f(that)g
+(v)m(alue)h(with)g(the)f(edge)h(length)g(of)0 1098 y(the)d(most)e(rapidly)j
+(v)m(arying)f(dimension)h(of)e(the)h(h)o(yp)q(erslab,)g(then)g(the)g(pro)q
+(duct)g(of)f(that)f(v)n(alue)i(with)g(the)g(edge)0 1160 y(length)f(of)f(the)h
+(next)g(most)e(rapidly)j(v)n(arying)e(dimension,)j(and)d(so)h(on.)19 b(In)14 b
+(a)f(generalized)j(h)o(yp)q(erslab,)e(ho)o(w)n(ev)o(er,)0 1222 y(the)h(corres\
+p)q(ondence)i(b)q(et)o(w)n(een)f(h)o(yp)r(erslab)f(p)r(oin)o(ts)g(and)g(memor\
+y)g(lo)q(cations)g(can)h(b)q(e)f(radically)i(diferent.)j(F)-5 b(or)0 1285 y
+(example,)16 b(the)f(follo)o(wing)h(C)f(de\014nitions)120 1452 y fi(struct)23
+b(vel)g({)215 1502 y(int)h(flags;)215 1552 y(float)g(u;)215 1601 y(float)g
+(v;)120 1651 y(})g(vel[NX][NY];)120 1701 y(long)f(imap[2])g(=)h({)215 1751 y
+(sizeof\(struct)f(vel\),)215 1801 y(sizeof\(struct)g(vel\)*NY};)0 1967 y 600 2
+v 21 2173 a fd(1)62 2190 y fm(The)17 b fh(inner)g(pro)q(duct)h fm(of)e(t)o
+(w)n(o)g(v)o(ectors)g([x0,)f(x1,)i ff(:)7 b(:)g(:)p fm(,)16 b(xn])g(and)h([y0\
+,)e(y1,)h ff(:)7 b(:)h(:)o fm(,)17 b(yn])f(is)h(just)f(x0*y0)f fi(+)i fm(x1*y\
+1)e fi(+)62 2252 y ff(:)7 b(:)h(:)14 b fi(+)h fm(xn*yn.)21 2465 y fd(2)62 2482
+y fm(A)k(p)r(oin)o(t's)f fh(co)q(ordinate)h(o\013set)g(v)n(ector)j fm(giv)o
+(es,)d(for)f(eac)o(h)h(dimension,)i(the)e(o\013set)f(from)g(the)h(origin)h
+(of)e(the)62 2544 y(con)o(taining)f(arra)n(y)g(to)e(the)i(p)q(oint.)23 b(In)
+17 b(C,)f(a)g(p)q(oint's)f(co)r(ordinate)h(o\013set)h(v)n(ector)f(is)h(the)g
+(same)f(as)g(it's)g(co)q(or-)62 2606 y(dinate)h(v)o(ector.)23 b(In)17 b(F)n
+(OR)m(TRAN,)g(ho)n(w)o(ev)o(er,)f(the)g(v)n(alues)h(of)f(a)g(p)q(oint's)f(co)
+q(ordinate)i(o\013set)f(v)o(ector)g(are)g(one)62 2669 y(less)g(than)f(the)g
+(corresp)r(onding)h(v)m(alues)g(of)f(the)g(p)r(oin)o(t's)f(co)q(ordinate)i
+(v)o(ector.)p eop
+%%Page: 30 32
+ bop 0 -58 a fm(30)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(where)j fi(imap)
+e fm(is)h(the)h(index)g(mapping)g(v)n(ector,)f(can)g(b)r(e)g(used)g(to)g(acce\
+ss)g(the)g(memory-resident)f(v)n(alues)h(of)0 246 y(the)i(netCDF)f(v)m(ariabl\
+e,)j fi(vel[NY][NX])p fm(,)c(ev)o(en)i(though)g(the)g(dimensions)h(are)f(tran\
+sp)q(osed)g(and)f(the)h(data)f(is)0 308 y(con)o(tained)e(in)g(a)f(2-D)f(arra)
+n(y)h(of)g(structures)g(rather)g(than)g(a)g(2-D)f(arra)n(y)h(of)g(\015oating-\
+p)r(oin)o(t)g(v)m(alues.)62 446 y(Note)j(that,)g(although)g(the)h(netCDF)e
+(abstraction)h(allo)o(ws)g(the)h(use)f(of)g(generalized)i(h)o(yp)q(erslab)f
+(access)f(if)0 509 y(w)o(arran)n(ted)12 b(b)o(y)h(the)f(situation,)h(it)g(do)
+q(es)g(not)f(mandate)g(it.)19 b(If)13 b(y)n(ou)g(do)f(not)g(need)i(generalize\
+d)g(h)o(yp)q(erslab)f(access,)0 571 y(y)o(ou)i(ma)n(y)g(ignore)h(this)f(capab\
+ilit)q(y)g(and)g(use)h(regular)f(h)o(yp)r(erslab)g(access)h(instead.)62 709 y
+(T)l(o)k(p)q(erform)f(con)o(v)o(en)o(tional)h(record-oriented)g(access,)g(y)o
+(ou)g(sp)q(ecify)h(a)e(netCDF)g(\014le,)j(a)d(record)h(v)m(ariable)0 772 y
+(\(one)e(de\014ned)i(with)f(an)f(unlimited)j(dimension\),)f(and)f(for)e(the)i
+(record)f(n)o(um)o(b)r(er)g(use)h(the)f(v)n(alue)h(of)f(the)g(\014rst)0 834 y
+(dimension)f(\(last)e(dimension)i(in)f(F)n(OR)m(TRAN\),)f(using)h(h)o(yp)q
+(erslab)g(access)f(to)g(get)g(the)g(record)g(of)g(v)m(alues.)62 972 y(Y)m(ou)
+k(ma)n(y)h(read)g(or)f(write)g(m)o(ultiple)j(record)e(v)m(ariables,)h(ev)o
+(en)f(if)g(the)g(v)m(ariables)h(are)e(of)g(di\013eren)q(t)g(t)o(yp)q(es,)0
+1035 y(with)f(a)g(single)h(call)g(in)g(the)f(C)g(in)o(terface.)28 b(In)18 b
+(this)h(case)f(y)n(ou)g(m)o(ust)f(write)h(a)g(whole)h(record's-w)n(orth)e(of)
+h(data)0 1097 y(for)e(eac)o(h)h(desired)h(v)m(ariable.)25 b(This)18 b(in)o
+(terface)f(is)g(supp)r(orted)f(as)g(a)h(con)o(v)n(enience)i(for)d(C)g(program\
+mers,)g(but)g(is)0 1159 y(not)i(strictly)g(necesary)m(,)g(since)h(the)f(same)
+g(result)g(ma)n(y)g(b)r(e)g(ac)o(hiev)o(ed)h(with)f(one)g(read)g(or)f(write)h
+(call)i(for)d(eac)o(h)0 1221 y(v)m(ariable.)k(An)13 b(equiv)o(alen)o(t)g(p)r
+(ortable)g(F)o(OR)m(TRAN)g(interface)g(that)g(replaces)h(m)n(ultiple)i(calls)
+e(with)g(a)f(single)i(call)0 1284 y(is)j(unfortunately)g(not)f(p)q(ossible.)
+28 b(Ho)n(w)o(ev)o(er,)17 b(data)g(written)g(using)i(the)e(C)g(interface)g
+(can)g(still)i(b)r(e)e(read)h(with)0 1346 y(the)d(F)o(OR)m(TRAN)g(interface,)
+f(using)i(one)g(call)g(p)r(er)f(v)m(ariable.)62 1484 y(When)20 b(e\016ciency)
+i(is)e(a)f(concern,)i(y)o(ou)f(should)g(k)o(eep)h(in)f(mind)h(the)f(order)f
+(in)i(whic)o(h)f(netCDF)f(data)g(are)0 1547 y(written)e(on)g(the)g(disk,)h
+(since)g(the)f(b)r(est)f(I/O)i(p)q(erformance)f(is)h(ac)n(hieved)f(b)o(y)g
+(reading)h(or)e(writing)i(con)o(tiguous)0 1609 y(data.)32 b(All)21 b(v)m(aria\
+ble)f(data)f(are)g(ordered)h(with)g(the)f(last)h(dimension)h(for)d(eac)o(h)i
+(v)m(ariable)h(v)m(arying)f(fastest)e(in)0 1671 y(the)f(C)h(in)o(terface,)g
+(or)e(the)i(slo)o(w)o(est)f(in)h(the)f(F)o(OR)m(TRAN)h(in)o(terface.)26 b(Thi\
+s)18 b(means)g(that)f(for)f(record)i(v)m(ariables)0 1733 y(in)i(particular,)h
+(at)e(least)h(one)f(disk)h(access)g(p)r(er)f(record)g(will)j(b)q(e)e(required)
+g(for)f(reading)h(a)f(v)n(alue)h(from)f(eac)o(h)0 1796 y(record.)30 b(Hence)
+19 b(reading)g(a)f(h)o(yp)r(erslab)h(that)f(tak)n(es)g(one)h(v)m(alue)h(out)e
+(of)g(eac)o(h)g(record)h(will)h(require)f(as)f(man)o(y)0 1858 y(disk)c(access\
+es)f(as)g(the)g(n)o(um)o(b)r(er)g(of)g(v)m(alues)h(requested.)20 b(F)l(or)12 b
+(writing,)i(the)f(situation)h(is)g(ev)o(en)f(w)o(orse,)g(since)h(eac)o(h)0
+1920 y(record)i(m)n(ust)g(\014rst)f(b)q(e)h(read)f(and)h(then)g(rewritten)g
+(to)f(c)o(hange)g(a)h(single)g(v)n(alue)g(within)h(a)e(record.)21 b(If)16 b
+(y)o(ou)f(ha)o(v)o(e)0 1983 y(a)h(c)o(hoice)i(ab)q(out)f(the)g(order)f(in)i
+(which)f(data)f(is)h(accessed)g(or)g(the)g(order)f(of)h(the)f(dimensions)j
+(that)d(de\014ne)i(the)0 2045 y(shap)q(e)e(of)f(a)f(v)n(ariable,)i(try)e(to)h
+(c)o(ho)q(ose)g(these)g(t)o(w)n(o)g(orders)g(in)h(harmon)o(y)f(to)f(a)o(v)n
+(oid)i(needless)h(ine\016ciency)o(.)0 2282 y fl(3.3)33 b(Data)14 b(Structures)
+62 2421 y fm(The)k(only)h(kind)g(of)e(data)g(structure)h(directly)h(supp)r
+(orted)f(b)o(y)g(the)g(netCDF)f(abstraction)g(is)i(a)e(collection)0 2483 y
+(of)h(named)g(scalar)g(and)h(m)n(ultidimensional)j(v)m(ariables)d(with)g(atta\
+c)m(hed)g(v)o(ector)f(attributes.)28 b(NetCDF)18 b(is)g(not)0 2545 y(particul\
+arly)e(w)o(ell-suited)h(for)e(storing)g(linked)g(lists,)h(trees,)e(sparse)h
+(matrices,)g(or)f(other)h(kinds)h(of)f(data)f(struc-)0 2608 y(tures)j(requiri\
+ng)i(p)r(oin)o(ters.)27 b(The)18 b(underlying)h(XDR)f(library)h(on)e(which)h
+(netCDF)f(is)h(implemented)g(is)g(quite)0 2670 y(suitable)c(for)f(storing)g
+(and)g(retrieving)h(arbitrary)f(data)g(structures)g(in)h(a)f(net)n(w)o(ork-tr\
+ansparen)n(t)g(w)n(a)o(y)l(,)g(but)h(suc)o(h)p eop
+%%Page: 31 33
+ bop 0 -58 a fm(Chapter)15 b(3:)k(Data)1574 b(31)0 183 y(structures)14 b(will)
+i(no)e(longer)g(b)r(e)g(self-describing)j(unless)e(y)o(ou)f(enco)r(de)g(infor\
+mation)g(ab)r(out)f(the)i(structure)f(with)0 246 y(the)g(data.)19 b(It)14 b
+(is)g(p)r(ossible)h(to)e(build)j(other)e(kinds)h(of)e(data)h(structures)f(fro\
+m)g(sets)h(of)f(m)o(ultidimensional)k(arra)n(ys)0 308 y(b)o(y)i(adopting)g
+(v)m(arious)g(con)o(v)n(entions)f(regarding)h(the)g(use)g(of)f(data)g(in)i
+(one)f(arra)n(y)f(as)h(p)q(oin)o(ters)g(in)o(to)f(another)0 370 y(arra)n(y)l
+(.)35 b(The)20 b(netCDF)f(library)i(w)o(on't)e(pro)o(vide)i(m)n(uc)o(h)g(help)
+g(or)f(hindrance)h(with)g(constructing)f(suc)o(h)h(data)0 432 y(structures,)
+15 b(but)g(netCDF)f(pro)o(vides)i(the)f(mec)o(hanisms)h(with)g(whic)o(h)g(suc)
+o(h)f(con)o(v)o(en)o(tions)g(can)h(b)q(e)g(designed.)62 569 y(F)l(or)e(exampl\
+e,)h(it)g(is)g(p)q(ossible)h(to)e(use)h(a)f(v)m(ariable)i(attribute)e(to)g
+(name)g(an)h(associated)g(index)h(v)m(ariable:)21 b(the)0 632 y(v)m(ariable)d
+(attribute)e(`)p fi(array_index_var)c(=)j("v_index")p fm(')g(migh)o(t)h(pro)n
+(vide)i(the)e(name)g(of)g(another)g(associated)0 694 y(v)m(ariable)h(to)e(b)r
+(e)h(used)g(as)g(an)g(index)h(for)e(fast)g(retriev)n(al)h(b)o(y)g(v)m(alue)h
+(in)g(the)f(v)m(ariable)h(to)e(which)h(the)g(attribute)f(is)0 756 y(attac)n
+(hed.)62 893 y(As)k(another)f(example,)h(netCDF)f(v)m(ariables)h(ma)o(y)f(b)q
+(e)h(group)q(ed)g(within)g(a)f(netCDF)g(\014le)h(b)o(y)g(de\014ning)g(at-)0
+955 y(tributes)e(that)g(list)h(the)f(names)g(of)f(the)h(v)n(ariables)h(in)f
+(eac)o(h)g(group,)g(separated)g(b)o(y)g(a)g(con)o(v)n(entional)g(delimiter)0
+1018 y(suc)o(h)e(as)f(a)g(space)g(or)g(comma.)19 b(A)14 b(con)o(v)o(en)o(tion)
+h(can)f(b)r(e)g(adopted)g(to)g(use)h(particular)g(sorts)e(of)h(attribute)g
+(names)0 1080 y(for)j(suc)o(h)h(groupings,)h(so)e(that)g(an)h(arbitrary)f(n)o
+(um)o(b)q(er)h(of)f(named)h(groups)g(of)f(v)n(ariables)h(can)g(b)r(e)g(supp)r
+(orted.)0 1142 y(If)e(needed,)h(a)f(particular)g(con)o(v)o(en)o(tional)h(attr\
+ibute)e(for)g(eac)o(h)h(v)n(ariable)h(migh)o(t)e(list)i(the)f(names)g(of)f
+(the)h(groups)0 1204 y(of)h(whic)o(h)h(it)f(is)h(a)f(mem)n(b)r(er.)25 b(Use)
+18 b(of)e(attributes)h(or)g(v)m(ariables)h(that)f(refer)g(to)f(other)h(attrib\
+utes)g(or)g(v)m(ariables)0 1267 y(pro)o(vides)f(a)f(\015exible)i(mec)o(hanism)
+f(for)e(representing)h(complex)h(structures)f(in)h(netCDF)f(\014les.)p eop
+%%Page: 32 34
+ bop 0 -58 a fm(32)1465 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 33 35
+ bop 0 -58 a fm(Chapter)15 b(4:)k(Use)d(of)f(the)g(NetCDF)f(Library)1123 b
+(33)0 183 y fj(4)41 b(Use)15 b(of)g(the)g(NetCDF)g(Library)62 379 y fm(It)d
+(is)g(not)f(necessary)h(to)f(kno)o(w)g(ab)q(out)h(the)f(whole)i(netCDF)e(in)o
+(terface)g(to)g(mak)o(e)h(use)g(of)f(the)g(netCDF)g(library)m(.)0 441 y(If)17
+b(y)o(ou)g(are)g(creating)h(a)e(netCDF)h(\014le,)h(only)g(a)f(handful)h(of)f
+(routines)h(are)e(required)j(to)d(de\014ne)i(the)g(necessary)0 503 y(dimensio\
+ns,)h(v)m(ariables,)g(and)e(attributes,)g(and)g(to)g(write)g(the)g(data)g(to)
+f(the)i(netCDF)e(\014le.)27 b(Similarly)n(,)18 b(if)f(y)o(ou)0 566 y(are)c
+(writing)h(soft)n(w)o(are)f(to)g(access)g(data)g(stored)g(in)i(a)e(particular)
+h(netCDF)f(ob)r(ject,)h(only)g(a)f(small)h(subset)g(of)f(the)0 628 y(netCDF)j
+(library)h(is)g(required)g(to)f(op)q(en)h(the)f(netCDF)g(\014le)h(and)g(acces\
+s)f(the)g(data.)23 b(Only)17 b(authors)f(of)g(generic)0 690 y(applications)g
+(that)e(access)g(arbitrary)g(netCDF)g(\014les)h(and)g(write)f(out)g(transform\
+ed)g(netCDF)g(\014les)h(need)g(to)f(b)r(e)0 752 y(familiar)f(with)g(the)g(who\
+le)g(netCDF)f(library)m(.)19 b(In)13 b(this)g(c)o(hapter)f(w)o(e)h(pro)n(vide)
+h(templates)f(of)f(common)g(sequences)0 815 y(of)17 b(netCDF)g(subroutine)i
+(calls)g(needed)g(for)e(common)g(uses.)28 b(F)l(ull)19 b(argumen)o(t)e(lists)
+h(for)f(the)h(pro)q(cedures)h(and)0 877 y(subroutines)d(are)f(describ)r(ed)h
+(in)g(later)f(c)o(hapters.)0 1117 y fl(4.1)33 b(Creating)15 b(a)g(NetCDF)f
+(File)62 1256 y fm(The)i(t)o(ypical)h(sequences)g(of)f(C)g(netCDF)f(calls)i
+(used)g(to)e(create)h(a)f(new)i(netCDF)e(\014le)i(follo)o(ws.)22 b(F)l(or)16 b
+(clarit)o(y)0 1318 y(w)o(e)d(only)g(present)g(the)g(name)g(of)f(the)i(routine\
+s,)f(omit)g(all)h(declarations,)g(parameters)e(and)h(error)g(c)o(hec)o(king,)
+h(and)0 1380 y(use)i ff(:)7 b(:)g(:)15 b fm(to)f(represent)g(arbitrary)h(sequ\
+ences)h(of)f(other)g(statemen)n(ts:)215 1519 y fi(nccreate)143 b(/*)23 b(crea\
+te)g(netCDF)g(file:)g(enter)h(define)f(mode)g(*/)335 1569 y ff(:)7 b(:)g(:)
+287 1619 y fi(ncdimdef)71 b(/*)23 b(dimension)g(definitions:)f(from)h(name)h
+(and)f(size)g(*/)335 1668 y ff(:)7 b(:)g(:)287 1718 y fi(ncvardef)71 b(/*)23 b
+(variable)g(definitions:)f(from)h(name,)h(type,)f(dimensions)f(*/)335 1768 y
+ff(:)7 b(:)g(:)287 1818 y fi(ncattput)71 b(/*)23 b(attribute)g(put:)g(assign)
+g(attribute)g(values)g(*/)335 1868 y ff(:)7 b(:)g(:)215 1918 y fi(ncendef)167
+b(/*)23 b(end)h(definitions:)e(leave)h(define)g(mode)g(*/)335 1967 y ff(:)7 b
+(:)g(:)215 2017 y fi(ncvarput)143 b(/*)23 b(variable)g(put:)g(provide)g(value\
+s)g(for)h(variables)e(*/)263 2067 y ff(:)7 b(:)h(:)215 2117 y fi(ncattput)143
+b(/*)23 b(attribute)g(put:)g(change)g(attribute)g(values)g(*/)263 2167 y ff
+(:)7 b(:)h(:)215 2216 y fi(ncclose)167 b(/*)23 b(close:)g(save)g(new)h(netCDF)
+f(file)g(*/)62 2432 y fm(In)16 b(F)n(OR)n(TRAN,)f(the)g(corresp)q(onding)h
+(sequence)h(lo)q(oks)e(like)g(this:)215 2570 y fi(NCCRE)334 b(!)24 b(create)f
+(netCDF)g(file:)g(enter)g(define)g(mode)335 2620 y ff(:)7 b(:)g(:)287 2670 y
+fi(NCDDEF)238 b(!)24 b(define)f(dimensions:)f(from)h(name)h(and)f(size)p eop
+%%Page: 34 36
+ bop 0 -58 a fm(34)1465 b(NetCDF)14 b(User's)h(Guide)335 183 y ff(:)7 b(:)g
+(:)287 233 y fi(NCVDEF)238 b(!)24 b(define)f(variables:)f(from)h(name,)h(type\
+,)f(dimensions)335 283 y ff(:)7 b(:)g(:)287 333 y fi(NCAPT)23 b(or)h(NCAPTC)f
+(!)h(attribute)e(put:)i(assign)f(attribute)f(values)335 382 y ff(:)7 b(:)g
+(:)215 432 y fi(NCENDF)310 b(!)24 b(end)f(definitions:)f(leave)h(define)g(mod\
+e)335 482 y ff(:)7 b(:)g(:)215 532 y fi(NCVPT)24 b(or)f(NCVPTC)95 b(!)24 b
+(variable)e(put:)i(provide)f(values)g(for)g(variables)263 582 y ff(:)7 b(:)h
+(:)215 632 y fi(NCAPT)24 b(or)f(NCAPTC)95 b(!)24 b(attribute)e(put:)i(change)
+f(attribute)f(values)263 681 y ff(:)7 b(:)h(:)215 731 y fi(NCCLOS)310 b(!)24 b
+(close:)f(save)g(new)g(netCDF)g(file)0 962 y fm(The)e(F)n(OR)m(TRAN)g(interfa\
+ce)f(pro)n(vides)i(t)n(w)o(o)e(subroutines)h(for)f(de\014ning)i(attributes)f
+(and)f(pro)o(viding)i(v)m(alues)0 1025 y(for)16 b(v)m(ariables,)i(dep)r(endin\
+g)g(on)e(whether)h(a)f(n)o(umeric)i(or)e(c)o(haracter)g(string)h(v)m(alue)g
+(is)h(used.)24 b(The)17 b(F)o(OR)m(TRAN)0 1087 y(template)e(indicates)i(that)
+e(either)g(of)g(these)h(subroutines)g(could)g(b)q(e)g(called.)62 1234 y(Only)
+h(one)f(call)h(is)g(needed)g(to)e(b)q(egin)i(creating)f(a)f(netCDF)h(\014le,)
+g(at)f(which)h(p)r(oin)o(t)f(y)o(ou)h(will)h(b)r(e)f(in)g(the)g(\014rst)0 1296
+y(of)h(t)o(w)n(o)h(netCDF)f fh(mo)q(des)p fm(.)28 b(When)18 b(accessing)g(a)g
+(netCDF,)e(y)o(ou)i(are)f(either)i(in)f fh(de\014ne)h(mo)q(de)i fm(or)c fh
+(data)g(mo)q(de)p fm(.)0 1358 y(In)g(de\014ne)g(mo)q(de,)f(y)o(ou)f(can)i(cre\
+ate)e(dimensions,)j(v)m(ariables,)f(and)f(new)g(attributes,)g(but)g(y)o(ou)g
+(cannot)g(read)f(or)0 1420 y(write)f(v)m(ariable)h(data.)k(In)14 b(data)g(mo)
+q(de,)g(y)n(ou)g(can)g(access)g(data)f(and)h(c)o(hange)g(existing)h(attribute\
+s,)f(but)g(y)n(ou)g(are)0 1483 y(not)h(p)q(ermitted)h(to)e(create)h(new)h(dim\
+ensions,)g(v)n(ariables,)f(or)g(attributes.)62 1629 y(One)j(call)g(to)e fi
+(ncdimdef)g fm(\(or)f fi(NCDDEF)p fm(\))h(is)h(needed)h(for)f(eac)n(h)g(dimen\
+sion)i(created.)25 b(Similarly)n(,)17 b(one)g(call)h(to)0 1692 y fi(ncvardef)
+c fm(\(or)h fi(NCVDEF)p fm(\))f(is)i(needed)h(for)d(eac)o(h)i(v)m(ariable)h
+(creation,)e(and)g(one)h(call)g(to)f fi(ncattput)f fm(\(or)h fi(NCAPT)f fm
+(or)0 1754 y fi(NCAPTC)p fm(\))j(is)h(needed)h(for)e(eac)o(h)h(attribute)f
+(de\014ned)i(and)f(assigned)h(a)e(v)n(alue.)28 b(The)18 b(only)g(w)o(a)n(y)g
+(to)f(lea)o(v)o(e)h(de\014ne)0 1816 y(mo)q(de)d(and)h(en)o(ter)f(data)f(mo)q
+(de)i(is)g(b)o(y)f(a)g(call)h(to)f fi(ncendef)f fm(\(or)g fi(NCENDF)p fm(\).)
+62 1963 y(Once)19 b(in)f(data)e(mo)q(de,)i(y)o(ou)f(can)h(add)f(new)h(data)e
+(to)h(v)n(ariables,)h(c)o(hange)f(old)h(v)n(alues,)g(and)f(c)o(hange)h(v)m
+(alues)0 2025 y(of)f(existing)h(attributes)f(\(so)f(long)i(as)f(the)g(attribu\
+te)g(c)o(hanges)g(do)g(not)g(require)h(more)f(storage)f(space)h(for)g(the)0
+2087 y(attribute\).)27 b(Single)19 b(v)n(alues)f(are)f(written)h(to)f(a)h(v)m
+(ariable)h(with)f fi(ncvarput1)e fm(\(or)h fi(NCVPT1)g fm(or)g fi(NCVP1C)p fm
+(\);)g(while)0 2150 y(arbitrary)c(h)o(yp)r(erslabs)h(of)g(data)f(are)h(writte\
+n)g(using)g fi(ncvarput)f fm(or)g fi(ncvarputg)g fm(\(or)g fi(NCVPT)p fm(,)g
+fi(NCVPTC)p fm(,)g fi(NCVPTG)p fm(,)0 2212 y(or)g fi(NCVPGC)p fm(\))e(instead\
+.)20 b(Multi-v)o(ariable)14 b(records)f(of)f(data)h(ma)n(y)g(b)r(e)g(written)
+g(using)h(m)n(ultiple)i(calls)e(to)e fi(ncvarput)0 2274 y fm(\(or)i fi(NCVPT)
+p fm(\))h(or)f(with)i(a)f(single)h(call)g(to)f fi(ncrecput)p fm(.)62 2421 y
+(Finally)n(,)j(y)o(ou)g(should)h(explicitly)i(close)e(all)g(op)r(en)f(netCDF)
+g(\014les)h(on)f(whic)o(h)h(y)o(ou)f(are)f(writing)i(b)o(y)f(calling)0 2483 y
+fi(ncclose)c fm(\(or)h fi(NCCLOS)p fm(\))f(b)r(efore)h(the)g(program)g(exits.)
+21 b(If)15 b(a)g(program)g(terminates)g(abnormally)h(with)g(netCDF)0 2545 y
+(\014les)e(op)q(en)f(for)f(writing,)i(y)o(ou)e(ma)o(y)h(lose)g(one)g(or)f(mor\
+e)g(records)h(of)g(the)f(most)g(recently)h(written)g(record)g(v)m(ariable)0
+2608 y(data)18 b(as)h(w)n(ell)i(as)d(an)o(y)h(attribute)f(c)o(hanges)h(since)
+h(the)f(last)g(call)h(to)f fi(ncsync)f fm(\(or)g fi(NCSNC)p fm(\).)30 b(It)19
+b(is)g(p)q(ossible)i(to)0 2670 y(reduce)15 b(the)g(c)n(hance)g(of)f(losing)h
+(data)f(due)h(to)f(abnormal)g(termination)h(b)o(y)f(explicitly)j(calling)f fi
+(ncsync)d fm(\()p fi(NCSNC)p fm(\))p eop
+%%Page: 35 37
+ bop 0 -58 a fm(Chapter)15 b(4:)k(Use)d(of)f(the)g(NetCDF)f(Library)1123 b
+(35)0 183 y(after)20 b(ev)o(ery)g(write)g(to)g(netCDF)g(v)m(ariables)i(or)d
+(c)o(hange)i(to)f(attribute)g(v)m(alues.)37 b(This)21 b(can)f(b)r(e)g(exp)r
+(ensive)g(in)0 246 y(computer)15 b(resources,)g(so)g(suc)o(h)g(calls)i(should)
+f(ordinarily)g(b)r(e)f(omitted)g(unless)i(they)e(are)g(really)h(needed.)0 490
+y fl(4.2)33 b(Reading)15 b(a)g(NetCDF)f(File)j(with)e(Kno)n(wn)g(Names)62 629
+y fm(If)j(y)o(ou)f(kno)o(w)g(the)h(names)f(of)g(the)h(dimensions,)h(v)n(ariab\
+les,)f(and)g(attributes)f(in)i(a)e(netCDF)g(\014le,)i(y)n(ou)f(can)0 691 y
+(write)e(calls)g(to)f(read)g(data)g(from)g(the)g(\014le;)i(y)n(ou)f(don't)f
+(need)h(to)f(include)j(the)d(\\inquire")i(calls)f(that)f(determine)0 753 y
+(the)g(dimensions,)i(v)m(ariables,)f(and)f(attributes.)k(If)d(y)o(ou)f(emplo)
+o(y)g(suc)o(h)g(kno)o(wledge)h(ab)q(out)f(particular)h(netCDF)0 816 y(\014les\
+,)f(the)g(program)f(y)n(ou)h(write)g(will)h(lac)o(k)f(generalit)o(y)m(.)k(It)
+c(will)h(only)g(w)n(ork)e(with)h(\014les)h(that)e(ha)o(v)n(e)h(the)g(assumed)
+0 878 y(names)h(and)g(structure,)g(so)f(y)o(ou)h(will)i(b)q(e)f(losing)f(some)
+g(of)g(the)g(adv)m(an)o(tages)f(of)h(using)h(the)f(netCDF)f(interface.)0 940 y
+(Ho)o(w)n(ev)o(er,)22 b(y)n(ou)f(ma)n(y)g(b)q(e)g(writing)g(soft)n(w)n(are)g
+(that)e(exp)r(ects)i(the)f(user)h(or)f(some)g(other)g(program)g(to)g(supply)0
+1003 y(v)m(ariable)c(or)e(dimension)i(names,)e(p)r(erhaps)g(as)g(subroutine)i
+(or)e(command)g(line)i(argumen)o(ts.)j(In)c(that)f(case,)g(the)0 1065 y(resul\
+ting)i(program)e(could)j(b)q(e)e(quite)h(general.)62 1204 y(When)22 b(y)n(ou)
+f(kno)o(w)g(the)g(names)g(of)f(some)h(v)m(ariables)h(of)e(interest)g(and)i
+(their)f(dimensions,)j(the)d(order)f(of)0 1266 y(t)n(ypical)d(C)e(calls)h(to)
+f(read)g(data)f(from)h(those)g(v)m(ariables)h(in)g(a)f(netCDF)g(\014le)h(is:)
+215 1406 y fi(ncopen)262 b(/*)24 b(open)f(existing)g(netCDF)g(*/)263 1455 y ff
+(:)7 b(:)h(:)215 1505 y fi(ncdimid)238 b(/*)24 b(get)f(dimension)g(IDs)g(to)h
+(use)f(in)h(accessing)f(data)g(*/)263 1555 y ff(:)7 b(:)h(:)215 1605 y fi(ncv\
+arid)238 b(/*)24 b(get)f(variable)g(IDs)g(*/)263 1655 y ff(:)7 b(:)h(:)215
+1704 y fi(ncattget)214 b(/*)24 b(get)f(attribute)g(values,)g(if)g(needed)g
+(*/)263 1754 y ff(:)7 b(:)h(:)215 1804 y fi(ncvarget)214 b(/*)24 b(get)f(valu\
+es)g(of)h(variables)e(*/)263 1854 y ff(:)7 b(:)h(:)215 1904 y fi(ncclose)238 b
+(/*)24 b(close)f(netCDF)g(*/)62 2182 y fm(In)16 b(F)n(OR)n(TRAN,)f(the)g(corr\
+esp)q(onding)h(sequence)h(lo)q(oks)e(like)g(this:)215 2321 y fi(NCOPN)286 b
+(!)48 b(open)23 b(existing)g(netCDF)263 2371 y ff(:)7 b(:)h(:)215 2421 y fi
+(NCDID)286 b(!)48 b(get)23 b(dimension)g(IDs)g(to)h(use)f(in)h(accessing)f
+(data)263 2471 y ff(:)7 b(:)h(:)215 2521 y fi(NCVID)286 b(!)48 b(get)23 b(var\
+iable)g(IDs)263 2570 y ff(:)7 b(:)h(:)215 2620 y fi(NCAGT)24 b(or)f(NCAGTC)47
+b(!)h(get)23 b(attribute)g(values,)g(if)g(needed)263 2670 y ff(:)7 b(:)h(:)p
+eop
+%%Page: 36 38
+ bop 0 -58 a fm(36)1465 b(NetCDF)14 b(User's)h(Guide)215 183 y fi(NCVGT)24 b
+(or)f(NCVGTC)47 b(!)h(get)23 b(values)g(of)h(variables)263 233 y ff(:)7 b(:)h
+(:)215 283 y fi(NCCLOS)262 b(!)48 b(close)23 b(netCDF)62 556 y fm(First,)14 b
+(a)h(single)h(call)f(op)r(ens)g(the)g(netCDF)e(\014le,)j(giv)o(en)f(the)g(\
+\014le)h(name,)e(and)h(returns)f(a)h(netCDF)f(ID)g(that)g(is)0 618 y(used)i
+(to)e(refer)h(to)g(the)g(netCDF)g(in)h(all)g(subsequent)f(calls.)62 786 y(Nex\
+t,)e(a)f(call)i(to)d fi(ncdimid)h fm(\(or)f fi(NCDID)p fm(\))h(for)g(eac)o
+(h)g(dimension)i(of)e(interest)g(gets)g(the)g(dimension)j(ID)d(from)g(the)0
+848 y(dimension)18 b(name.)23 b(Dimension)18 b(IDs,)e(like)g(netCDF)g(IDs,)g
+(are)g(small)h(integers)f(used)h(to)e(refer)i(to)e(dimensions)0 910 y(in)21 b
+(subsequent)e(calls.)35 b(Similarly)o(,)20 b(eac)o(h)g(required)h(v)n(ariable)
+g(ID)f(is)g(determined)h(from)e(its)h(name)g(b)o(y)g(a)g(call)0 973 y(to)e fi
+(ncvarid)f fm(\(or)g fi(NCVID)p fm(\).)28 b(Once)19 b(v)m(ariable)g(IDs)f(are)
+g(kno)o(wn,)h(v)m(ariable)g(attribute)f(v)n(alues)g(can)h(b)q(e)g(retriev)o
+(ed)0 1035 y(using)f(the)g(netCDF)f(ID,)g(the)h(v)n(ariable)g(ID,)g(and)f(the)
+h(desired)h(attribute)f(name)f(as)h(input)g(to)f fi(ncattget)g fm(\(or)0 1097
+y fi(NCAGT)g fm(or)h fi(NCAGTC)p fm(\))f(for)g(eac)o(h)i(desired)g(attribute.)
+28 b(V)m(ariable)19 b(data)e(v)n(alues)h(can)h(b)q(e)g(directly)g(accessed)g
+(from)0 1160 y(the)d(netCDF)f(\014le)h(with)g fi(ncvarget1)e fm(\(or)h fi(NCV\
+GT1)g fm(or)g fi(NCVG1C)p fm(\))f(for)h(single)i(v)n(alues,)f fi(ncvarget)e fm
+(or)h fi(ncvargetg)0 1222 y fm(\(or)f fi(NCVGT)p fm(,)f fi(NCVGTC)p fm(,)g fi
+(NCVGTG)p fm(,)h(or)g fi(NCVGGC)p fm(\))f(for)h(h)o(yp)q(erslabs)h(of)f(v)n
+(alues,)h(or)f fi(ncrecget)f fm(for)h(records)g(of)g(v)n(alues.)0 1284 y(T)l
+(o)h(minimize)i(the)e(n)o(um)o(b)q(er)g(of)g(disk)g(accesses,)g(y)o(ou)g(shou\
+ld)h(remem)n(b)r(er)f(that)f(the)h(last)g(dimension)h(in)g(C)f(\(\014rst)0
+1346 y(dimension)i(in)f(F)n(OR)m(TRAN\))g(v)m(aries)g(fastest)e(when)h(using)
+h(h)o(yp)r(erslab)g(access.)62 1514 y(Finally)n(,)f(the)g(netCDF)g(\014le)h
+(can)g(b)q(e)g(closed)g(with)f fi(ncclose)g fm(\(or)f fi(NCCLOS)p fm(\))g(whe\
+n)i(y)o(ou)f(are)g(\014nished)i(with)f(it)0 1576 y(to)f(free)g(system)g(resou\
+rces.)k(There)d(is)g(no)f(harm)g(in)h(not)e(closing)j(a)d(\014le)j(op)q(en)f
+(only)f(for)g(reading.)0 2077 y fl(4.3)33 b(Reading)15 b(a)g(netCDF)g(File)h
+(with)g(Unkno)n(wn)g(Names)62 2244 y fm(If)21 b(y)o(ou)f(w)o(an)o(t)g(to)g
+(write)h(generic)g(soft)n(w)o(are)f(\(i.e.,)h(a)g(program)e(that)h(transp)q
+(oses)g(sp)r(eci\014ed)i(v)n(ariables)f(b)o(y)0 2307 y(interc)n(hanging)h(sp)
+q(eci\014ed)h(dimensions\))g(y)o(ou)e(should)h(mak)n(e)g(no)f(assumptions)g
+(ab)r(out)f(the)i(dimension)h(and)0 2369 y(v)m(ariable)18 b(names)f(that)e
+(are)i(not)f(sp)q(eci\014ed.)26 b(In)18 b(suc)o(h)f(cases,)f(y)o(ou)g(m)o(ust)
+g(\014nd)i(out)e(ab)q(out)g(all)i(the)f(dimensions,)0 2431 y(v)m(ariables,)h
+(and)e(attributes)g(in)h(a)f(netCDF)g(\014le)h(b)o(y)g(calling)h(the)e(inquir\
+e)i(functions.)24 b(F)l(our)16 b(inquire)i(functions)0 2493 y(get)c(informati\
+on)g(ab)q(out)g(a)g(whole)g(netCDF)g(\014le,)h(a)e(dimension,)j(a)e(v)m(ariab\
+le,)h(or)f(an)g(attribute.)19 b(The)14 b(following)0 2556 y(template)h(illust\
+rates)i(ho)n(w)e(they)h(are)e(used:)p eop
+%%Page: 37 39
+ bop 0 -58 a fm(Chapter)15 b(4:)k(Use)d(of)f(the)g(NetCDF)f(Library)1123 b
+(37)215 183 y fi(ncopen)262 b(/*)24 b(open)f(existing)g(netCDF)g(*/)263 233 y
+ff(:)7 b(:)h(:)215 283 y fi(ncinquire)190 b(/*)24 b(find)f(out)g(what)h(is)f
+(in)h(it)g(*/)335 333 y ff(:)7 b(:)g(:)287 382 y fi(ncdiminq)142 b(/*)24 b
+(get)f(dimension)g(names,)g(sizes)g(*/)335 432 y ff(:)7 b(:)g(:)287 482 y fi
+(ncvarinq)142 b(/*)24 b(get)f(variable)g(names,)g(types,)g(shapes)g(*/)406 532
+y ff(:)8 b(:)f(:)359 582 y fi(ncattname)46 b(/*)24 b(get)f(attribute)g(names)
+g(*/)406 632 y ff(:)8 b(:)f(:)359 681 y fi(ncattinq)70 b(/*)24 b(get)f(attrib\
+ute)g(types)g(and)g(lengths)g(*/)406 731 y ff(:)8 b(:)f(:)359 781 y fi(ncattg\
+et)70 b(/*)24 b(get)f(attribute)g(values)g(*/)406 831 y ff(:)8 b(:)f(:)215 881
+y fi(ncvarget)214 b(/*)24 b(get)f(values)g(of)h(variables)e(*/)263 930 y ff
+(:)7 b(:)h(:)215 980 y fi(ncclose)238 b(/*)24 b(close)f(netCDF)g(*/)62 1248 y
+fm(In)16 b(F)n(OR)n(TRAN,)f(the)g(corresp)q(onding)h(sequence)h(lo)q(oks)e
+(like)g(this:)215 1423 y fi(NCOPN)405 b(!)48 b(open)23 b(existing)g(netCDF)
+263 1472 y ff(:)7 b(:)h(:)215 1522 y fi(NCINQ)405 b(!)48 b(find)23 b(out)h
+(what)f(is)h(in)f(it)335 1572 y ff(:)7 b(:)g(:)287 1622 y fi(NCDINQ)309 b(!)
+48 b(get)23 b(dimension)g(names,)g(sizes)335 1672 y ff(:)7 b(:)g(:)287 1722 y
+fi(NCVINQ)309 b(!)48 b(get)23 b(variable)g(names,)g(types,)g(shapes)406 1771 y
+ff(:)8 b(:)f(:)359 1821 y fi(NCANAM)237 b(!)48 b(get)23 b(attribute)g(names)
+406 1871 y ff(:)8 b(:)f(:)359 1921 y fi(NCAINQ)237 b(!)48 b(get)23 b(attribut\
+e)g(values)406 1971 y ff(:)8 b(:)f(:)359 2020 y fi(NCAGT)23 b(or)g(NCAGTC)g
+(!)48 b(get)23 b(attribute)g(values)406 2070 y ff(:)8 b(:)f(:)215 2120 y fi
+(NCVGT)24 b(or)f(NCVGTC)166 b(!)48 b(get)23 b(values)h(of)f(variables)263 2170
+y ff(:)7 b(:)h(:)215 2220 y fi(NCCLOS)381 b(!)48 b(close)23 b(netCDF)62 2483 y
+fm(As)18 b(in)g(the)g(previous)g(example,)h(a)e(single)i(call)f(op)r(ens)g
+(the)f(existing)i(netCDF)e(\014le,)h(returning)g(a)g(netCDF)0 2545 y(ID.)f
+(This)h(netCDF)f(ID)g(is)h(giv)o(en)g(to)f(the)g fi(ncinquire)f fm(\(or)h fi
+(NCINQ)p fm(\))f(routine,)i(whic)o(h)g(returns)f(the)h(n)o(um)o(b)q(er)f(of)0
+2608 y(dimensions,)g(the)e(n)o(um)o(b)r(er)g(of)g(v)m(ariables,)h(the)g(n)o
+(um)o(b)q(er)g(of)f(global)h(attributes,)f(and)g(the)h(ID)f(of)g(the)h(unlimi\
+ted)0 2670 y(dimension,)h(if)e(there)g(is)h(one.)p eop
+%%Page: 38 40
+ bop 0 -58 a fm(38)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(Another)k(inqui\
+re)h(function,)g fi(ncrecinq)p fm(,)e(is)i(pro)n(vided)g(for)e(con)o(v)o(enie\
+nce)j(to)d(return)g(information)h(ab)q(out)0 246 y(record)d(v)m(ariables,)h
+(although)f(the)h(information)f(is)g(also)g(obtainable)h(b)o(y)f(using)h(the)
+f(other)g(inquire)i(functions.)0 308 y(The)e fi(ncrecinq)f fm(function)i(retu\
+rns)g(the)f(n)o(um)o(b)q(er)g(of)g(record)g(v)n(ariables,)h(their)f(v)n(ariab\
+le)h(IDs,)f(and)g(ho)o(w)g(m)o(uc)o(h)0 370 y(memory)f(space)g(is)h(needed)g
+(for)f(a)g(record's)f(w)o(orth)h(of)f(data)h(for)g(eac)n(h)h(record)f(v)m(ari\
+able.)62 507 y(All)h(the)f(inquire)h(functions)f(are)g(quite)g(inexp)s(ensiv)
+o(e)g(to)f(use)h(and)g(require)g(no)g(I/O,)f(since)i(the)f(information)0 569 y
+(they)k(pro)o(vide)h(is)f(stored)g(in)h(a)f(table)g(in)h(memory)f(for)f(eac)o
+(h)h(op)r(en)g(netCDF)g(\014le.)32 b(In)20 b(the)f(C)g(interface,)g(the)0 632
+y(inquire)d(functions)f(also)g(supp)r(ort)e(getting)i(a)f(subset)h(of)f(infor\
+mation)g(b)o(y)h(pro)n(viding)h(NULL)f(p)r(oin)o(ters)f(instead)0 694 y(of)h
+(v)m(alid)i(addresses)e(for)g(undesired)h(information.)62 831 y(Dimension)d
+(IDs)f(are)g(assigned)g(b)o(y)g(using)h(consecutive)f(in)o(tegers)g(\(b)q(egi\
+nning)i(at)d(0)g(in)i(C,)e(1)h(in)h(F)n(OR)m(TRAN\).)0 893 y(Also)f(dimension\
+s,)i(once)f(created,)f(cannot)g(b)r(e)g(deleted.)20 b(Therefore,)12 b(kno)o
+(wing)h(the)f(n)o(um)o(b)q(er)g(of)g(dimension)i(IDs)0 955 y(in)j(a)e(netCDF)
+h(\014le)h(means)f(kno)n(wing)h(all)g(the)f(dimension)h(IDs:)22 b(they)16 b
+(are)g(the)g(in)o(tegers)g(0,)f(1,)h(2,)f ff(:)7 b(:)h(:)o fm(,)16 b(\(or)f
+(1,)h(2,)0 1018 y(3,)f ff(:)7 b(:)g(:)15 b fm(in)h(F)n(OR)m(TRAN\).)f(F)l(or)
+g(eac)o(h)g(dimension)i(ID,)e(a)g(call)i(to)d(the)i(inquire)h(function)f fi
+(ncdiminq)e fm(\(or)g fi(NCDINQ)p fm(\))0 1080 y(returns)h(the)g(dimension)i
+(name)e(and)h(size.)62 1217 y(Like)g(dimension)h(IDs,)e(v)m(ariable)h(IDs)g
+(are)f(also)g(0,)g(1,)g(2,)f ff(:)8 b(:)f(:)o fm(,)15 b(\(or)g(1,)g(2,)f(3,)h
+ff(:)7 b(:)g(:)15 b fm(in)i(F)n(OR)m(TRAN\).)e(These)h(can)0 1279 y(b)r(e)i
+(used)h(in)g fi(ncvarinq)f fm(\(or)f fi(NCVINQ)p fm(\))g(calls)j(to)e(\014nd)
+h(out)f(the)g(names,)h(t)o(yp)q(es,)g(shap)r(es,)f(and)h(the)g(n)o(um)n(b)r
+(er)f(of)0 1341 y(attributes)d(assigned)h(to)e(eac)o(h)i(v)m(ariable.)62 1478
+y(Once)d(the)g(n)o(um)n(b)r(er)f(of)g(attributes)g(for)f(a)h(v)m(ariable)h
+(is)g(kno)o(wn,)f(successive)g(calls)i(to)d fi(ncattname)g fm(\(or)g fi(NCANA\
+M)p fm(\))0 1541 y(return)g(the)h(name)g(for)f(eac)n(h)h(attribute)g(giv)o
+(en)g(the)f(netCDF)g(ID,)g(v)n(ariable)h(ID,)g(and)f(attribute)h(n)o(um)o(b)q
+(er.)19 b(Armed)0 1603 y(with)f(the)g(attribute)g(name,)g(a)f(call)i(to)e fi
+(ncattinq)g fm(\(or)g fi(NCAINQ)p fm(\))g(returns)g(its)h(t)o(yp)q(e)g(and)g
+(length.)29 b(Giv)o(en)18 b(the)0 1665 y(t)n(yp)r(e)h(and)g(length,)h(the)f
+(generic)h(application)g(can)f(allo)r(cate)g(enough)g(space)g(to)f(hold)i(the)
+f(attribute)f(v)n(alues.)0 1727 y(Then)e(a)f(call)h(to)e fi(ncattget)h fm(\(o\
+r)f fi(NCAGT)g fm(or)h fi(NCAGTC)p fm(\))f(returns)h(the)g(attribute)g(v)n
+(alues.)62 1864 y(Once)k(the)g(names,)f(IDs,)h(t)o(yp)q(es,)g(shap)q(es,)g
+(and)f(lengths)h(of)f(all)h(netCDF)f(comp)q(onen)o(ts)g(are)g(kno)o(wn,)h(dat\
+a)0 1927 y(v)m(alues)d(can)g(b)q(e)f(accessed)h(b)o(y)f(calling)i fi(ncvarget\
+1)d fm(\(or)g fi(NCVGT1)g fm(or)h fi(NCVG1C)p fm(\))f(for)g(single)j(v)m(alue\
+s,)f fi(ncvarget)d fm(or)0 1989 y fi(ncvargetg)g fm(\(or)h fi(NCVGT)p fm(,)f
+fi(NCVGTC)p fm(,)g fi(NCVGTG)p fm(,)h(or)g fi(NCVGGC)p fm(\))f(for)g(aggregat\
+es)g(of)h(v)n(alues)h(using)g(h)o(yp)q(erslab)g(access,)0 2051 y(or)g fi(ncre\
+cget)f fm(for)g(aggregates)g(of)h(v)m(alues)h(using)g(record)f(access.)0 2263
+y fl(4.4)33 b(Adding)16 b(New)e(Dimensions,)h(V)-6 b(ariables,)15 b(A)n(ttrib\
+utes)62 2400 y fm(An)i(existing)g(netCDF)f(\014le)h(can)g(b)q(e)g(extensively)
+g(altered.)24 b(New)16 b(dimensions,)i(v)m(ariables,)g(and)e(attributes)0 2462
+y(can)c(b)q(e)g(added)g(or)g(existing)g(ones)g(renamed,)g(and)g(existing)h
+(attributes)e(can)h(b)q(e)g(deleted.)20 b(Existing)13 b(dimensions,)0 2524 y
+(v)m(ariables,)18 b(and)e(attributes)g(can)g(b)r(e)g(renamed.)24 b(The)16 b
+(following)g(co)r(de)g(template)h(lists)g(a)f(t)n(ypical)i(sequence)f(of)0
+2586 y(calls)f(to)f(add)g(new)h(netCDF)e(comp)q(onents)g(to)h(an)g(existing)h
+(\014le:)p eop
+%%Page: 39 41
+ bop 0 -58 a fm(Chapter)15 b(4:)k(Use)d(of)f(the)g(NetCDF)f(Library)1123 b
+(39)215 183 y fi(ncopen)262 b(/*)24 b(open)f(existing)g(netCDF)g(file)g(*/)
+263 233 y ff(:)7 b(:)h(:)215 283 y fi(ncredef)238 b(/*)24 b(put)f(it)h(into)f
+(define)g(mode)g(*/)311 333 y ff(:)7 b(:)g(:)263 382 y fi(ncdimdef)166 b(/*)
+24 b(define)f(additional)f(dimensions)h(\(if)g(any\))h(*/)311 432 y ff(:)7 b
+(:)g(:)263 482 y fi(ncvardef)166 b(/*)24 b(define)f(additional)f(variables)h
+(\(if)g(any\))h(*/)311 532 y ff(:)7 b(:)g(:)263 582 y fi(ncattput)166 b(/*)24
+b(define)f(additional)f(attributes)h(\(if)g(any\))h(*/)311 632 y ff(:)7 b(:)g
+(:)215 681 y fi(ncendef)238 b(/*)24 b(check)f(all)g(definitions,)g(leave)g
+(define)g(mode)g(*/)263 731 y ff(:)7 b(:)h(:)215 781 y fi(ncvarput)214 b(/*)
+24 b(provide)f(values)g(for)g(new)h(variables)e(*/)263 831 y ff(:)7 b(:)h(:)
+215 881 y fi(ncclose)238 b(/*)24 b(save)f(netCDF)g(file)g(*/)62 1156 y fm(In)
+16 b(F)n(OR)n(TRAN,)f(the)g(corresp)q(onding)h(sequence)h(lo)q(oks)e(like)g
+(this:)215 1324 y fi(NCOPN)310 b(!)48 b(open)23 b(existing)g(netCDF)263 1374 y
+ff(:)7 b(:)h(:)215 1424 y fi(NCREDF)286 b(!)48 b(put)23 b(it)h(into)f(define)
+g(mode)311 1474 y ff(:)7 b(:)g(:)263 1523 y fi(NCDDEF)238 b(!)48 b(define)23 b
+(additional)f(dimensions)h(\(if)g(any\))311 1573 y ff(:)7 b(:)g(:)263 1623 y
+fi(NCVDEF)238 b(!)48 b(define)23 b(additional)f(variables)h(\(if)g(any\))311
+1673 y ff(:)7 b(:)g(:)263 1723 y fi(NCAPT)23 b(or)h(NCAPTC)f(!)48 b(define)23
+b(additional)f(attributes)h(\(if)g(any\))311 1772 y ff(:)7 b(:)g(:)215 1822 y
+fi(NCENDF)286 b(!)48 b(check)23 b(all)g(definitions,)f(leave)i(define)f(mode)
+263 1872 y ff(:)7 b(:)h(:)215 1922 y fi(NCVPT)24 b(or)f(NCVPTC)71 b(!)48 b
+(provide)22 b(values)i(for)f(new)g(variables)263 1972 y ff(:)7 b(:)h(:)215
+2021 y fi(NCCLOS)286 b(!)48 b(save)23 b(netCDF)g(file)62 2296 y fm(A)16 b(net\
+CDF)g(\014le)h(is)g(\014rst)e(op)q(ened)i(b)o(y)f(the)h fi(ncopen)e fm(\(or)g
+fi(NCOPN)p fm(\))g(call.)24 b(This)17 b(call)g(puts)f(y)o(ou)g(in)h fh(data)e
+(mo)q(de)p fm(,)0 2359 y(which)f(means)h(existing)g(data)f(v)m(alues)h(can)g
+(b)q(e)g(accessed)g(and)f(c)o(hanged,)h(existing)g(attributes)f(can)h(b)q(e)g
+(c)o(hanged)0 2421 y(\(so)10 b(long)i(as)e(they)h(do)g(not)g(gro)n(w\),)g(but)
+g(nothing)g(can)h(b)q(e)f(added.)19 b(T)l(o)11 b(add)g(new)h(netCDF)e(dimensi\
+ons,)j(v)m(ariables,)0 2483 y(or)k(attributes)h(y)o(ou)g(m)n(ust)g(lea)o(v)o
+(e)g(data)f(mo)q(de)i(and)f(en)o(ter)f fh(de\014ne)i(mo)q(de)p fm(,)g(b)o(y)f
+(calling)i fi(ncredef)c fm(\(or)i fi(NCREDF)p fm(\).)0 2545 y(In)i(de\014ne)h
+(mo)q(de,)g(call)g fi(ncdimdef)e fm(\(or)g fi(NCDDEF)p fm(\))f(to)h(de\014ne)
+i(new)f(dimensions,)i fi(ncvardef)d fm(\(or)g fi(NCVDEF)p fm(\))g(to)0 2608 y
+(de\014ne)14 b(new)f(v)m(ariables)h(\(using)f(the)g(new)g(dimensions\),)h(and)
+f fi(ncattput)e fm(\(or)h fi(NCAPT)g fm(or)g fi(NCAPTC)p fm(\))g(to)g(assign)
+h(new)0 2670 y(attributes)i(to)g(v)m(ariables)h(or)f(enlarge)g(old)h(attribut\
+es.)p eop
+%%Page: 40 42
+ bop 0 -58 a fm(40)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(Y)m(ou)10 b(can)
+h(lea)o(v)o(e)g(de\014ne)h(mo)q(de)f(and)g(reen)o(ter)f(data)g(mo)q(de,)i(c)o
+(hec)o(king)f(all)h(the)f(new)g(de\014nitions)h(for)e(consistency)0 246 y(and)
+k(committing)g(the)h(c)n(hanges)g(to)e(disk,)i(b)n(y)f(calling)i fi(ncendef)d
+fm(\(or)g fi(NCENDF)p fm(\).)19 b(If)14 b(y)o(ou)g(do)g(not)f(wish)i(to)e(ree\
+n)o(ter)0 308 y(data)k(mo)q(de,)i(just)e(call)i fi(ncclose)e fm(\(or)g fi(NCC\
+LOS)p fm(\),)h(whic)o(h)g(will)i(ha)o(v)n(e)e(the)g(e\013ect)h(of)f(\014rst)f
+(calling)j fi(ncendef)d fm(\(or)0 370 y fi(NCENDF)p fm(\).)62 508 y(Un)o(til)
+j(the)e fi(ncendef)g fm(\(or)f fi(NCENDF)p fm(\))h(call,)i(y)n(ou)f(ma)n(y)f
+(bac)o(k)h(out)f(of)g(all)h(the)g(rede\014nitions)h(made)f(in)g(de\014ne)0 571
+y(mo)q(de)h(and)g(restore)g(the)g(previous)g(state)f(of)h(the)g(netCDF)f(b)o
+(y)h(calling)i fi(ncabort)d fm(\(or)g fi(NCABOR)p fm(\).)33 b(Y)l(ou)20 b(ma)
+n(y)0 633 y(also)f(use)g(the)f fi(ncabort)g fm(call)i(to)e(restore)g(the)h
+(netCDF)e(to)h(a)h(consisten)o(t)g(state)e(if)j(the)e(call)i(to)e fi(ncendef)
+g fm(\(or)0 695 y fi(NCENDF)p fm(\))13 b(fails.)20 b(If)14 b(y)o(ou)g(ha)o
+(v)n(e)g(called)i fi(ncclose)d fm(\(or)g fi(NCCLOS)p fm(\))g(from)g(de\014nit\
+ion)j(mo)q(de)e(and)g(the)g(implied)j(call)e(to)0 757 y fi(ncendef)g fm(\(or)
+g fi(NCENDF)p fm(\))g(fails,)i fi(ncabort)e fm(\(or)g fi(NCABOR)p fm(\))g(wil\
+l)j(automatically)f(b)q(e)f(called)i(to)e(close)g(the)h(netCDF)0 820 y(in)f
+(its)f(previous)h(consistent)f(state)f(\(b)q(efore)h(y)o(ou)g(en)o(tered)h
+(de\014ne)g(mo)q(de\).)0 1056 y fl(4.5)33 b(Error)16 b(Handling)62 1195 y fm
+(By)22 b(default)h(all)g(netCDF)f(library)g(routines)h(print)e(an)h(error)g
+(message)f(and)i(exit)f(when)h(an)f(error)f(has)0 1257 y(o)q(ccurred.)34 b
+(If)20 b(this)g(error)g(b)q(eha)o(vior)g(is)g(acceptable,)i(y)n(ou)e(nev)o
+(er)g(need)h(to)e(c)o(hec)o(k)h(error)f(returns,)h(since)h(an)o(y)0 1319 y
+(condition)c(that)e(w)o(ould)h(result)g(in)h(an)e(error)g(will)j(print)d(an)h
+(explanatory)f(message)g(and)h(exit.)22 b(The)16 b(examples)0 1381 y(in)g(thi\
+s)g(guide)g(assume)f(the)g(default)h(error-handling)g(b)r(eha)o(vior,)f(so)g
+(there)g(is)h(no)f(c)o(hec)o(king)h(of)f(error)f(returns.)62 1520 y(Occasiona\
+lly)n(,)24 b(lo)o(w-lev)o(el)f(write)f(errors)f(ma)n(y)h(o)q(ccur)g(in)h(the)
+f(XDR)g(library)h(la)o(y)n(er)f(b)r(elo)o(w)g(the)g(netCDF)0 1582 y(library)m
+(.)f(F)l(or)15 b(example,)h(if)g(a)g(write)f(op)r(eration)g(causes)h(y)o(ou)f
+(to)g(exceed)i(disk)f(quotas)f(or)g(to)g(attempt)g(to)g(write)0 1644 y(to)d
+(a)g(device)i(that)d(is)i(no)g(longer)f(a)o(v)m(ailable,)i(y)o(ou)e(ma)o(y)g
+(get)g(an)g(error)g(message)g(from)g(one)g(of)g(the)h(XDR)f(functions)0 1707 y
+(rather)e(than)h(from)f(the)h(netCDF)f(library)m(.)18 b(If)11 b(y)o(ou)g(get)
+f(a)h(message)f(from)g(the)h(XDR)g(la)o(y)o(er,)g(diagnose)g(and)g(correct)0
+1769 y(whatev)n(er)16 b(is)f(causing)h(the)f(low-lev)o(el)h(write)f(errors.)
+62 1907 y(In)h(the)f(C)g(interface,)g(errors)f(ma)n(y)i(b)q(e)g(handled)g(mor\
+e)f(\015exibly)i(b)o(y)e(setting)h(the)f(external)h(in)o(teger)f fi(ncopts)p
+fm(,)0 1969 y(declared)i(in)g(the)f(\014le)h(`)p fi(netcdf.h)p fm('.)k(Tw)n
+(o)16 b(asp)q(ects)g(of)f(the)i(error-handling)g(b)q(eha)o(vior)f(can)g(b)r
+(e)g(mo)q(di\014ed)i(inde-)0 2032 y(p)r(enden)o(tly:)26 b(the)18 b(suppressio\
+n)h(of)e(error)g(messages,)h(and)g(the)g(fatalit)n(y)g(of)g(errors.)27 b(The)
+18 b(default)g(b)r(eha)o(vior)f(is)0 2094 y(sp)q(eci\014ed)g(b)o(y)e(the)h
+(assignmen)o(t)120 2232 y fi(ncopts)23 b(=)h(NC_VERBOSE)e(|)i(NC_FATAL;)0 2447
+y fm(where)15 b fi(NC_VERBOSE)f fm(and)i fi(NC_FATAL)e fm(are)h(prede\014ned)
+h(constan)o(ts)f(from)f(the)h(include)j(\014le)e(`)p fi(netcdf.h)p fm('.)62
+2585 y(If)g(y)n(ou)f(w)o(an)o(t)g(error)f(messages)h(but)g(do)g(not)g(wish)g
+(errors)g(to)f(b)r(e)h(fatal,)f(turn)h(o\013)h(the)f(fatal)g(error)f(\015ag)h
+(with:)p eop
+%%Page: 41 43
+ bop 0 -58 a fm(Chapter)15 b(4:)k(Use)d(of)f(the)g(NetCDF)f(Library)1123 b
+(41)120 183 y fi(ncopts)23 b(=)h(NC_VERBOSE;)0 406 y fm(If)15 b(y)o(ou)g(w)o
+(an)o(t)f(neither)j(error)d(messages)h(nor)g(fatal)f(errors,)h(turn)g(o\013)g
+(b)r(oth)f(\015ags)h(with:)120 548 y fi(ncopts)23 b(=)h(0;)0 771 y fm(In)15 b
+(either)f(case,)g(y)o(ou)g(should)h(c)o(heck)f(the)g(return)g(v)m(alue)h(afte\
+r)e(eac)o(h)h(call)i(to)d(a)h(netCDF)f(function.)20 b(The)15 b(in)o(teger)0
+833 y fi(-1)h fm(is)h(returned)g(whenev)o(er)g(an)f(error)g(o)q(ccurs)h(and)f
+fi(NC_FATAL)g fm(is)h(o\013,)f(so)g(y)o(ou)g(can)h(detect)g(error)e(returns)i
+(and)0 895 y(handle)k(the)e(errors)g(appropriately)l(.)33 b(Another)19 b(exte\
+rnally-de\014ned)j(in)o(teger,)e fi(ncerr)p fm(,)f(con)o(tains)h(a)e(netCDF-)
+0 957 y(sp)q(eci\014c)d(error)d(co)q(de)i(that)e(can)h(b)r(e)g(used)g(after)g
+(an)g(error)f(has)h(o)q(ccurred)g(to)g(determine)h(what)e(the)h(nature)g(of)g
+(the)0 1020 y(error)h(w)o(as.)20 b(The)15 b(names)g(and)h(descriptions)g(of)f
+(netCDF)f(error)h(co)q(des)h(are)f(included)i(in)f(the)g(\014le)g(`)p fi(netc\
+df.h)p fm('.)62 1162 y(In)e(the)f(F)n(OR)m(TRAN)h(in)o(terface,)f(the)g(error)
+f(options)i(describ)r(ed)f(ab)r(o)n(v)o(e)g(can)g(b)r(e)g(accessed)g(b)o(y)g
+(using)h(the)f(rou-)0 1224 y(tines)h(NCPOPT)f(and)g(NCGOPT.)g(The)g(default)h
+(error-)f(handling)i(b)q(eha)o(vior)e(is)h(equiv)o(alen)o(t)f(to)g(the)g(stat\
+emen)n(t)263 1367 y fi(CALL)23 b(NCPOPT\(NCVERBOS+NCFATAL\))0 1589 y fm(where)
+c(the)f(v)m(alues)h(of)f(NCVERBOS)i(and)e(NCF)-5 b(A)l(T)l(AL)19 b(are)f(pre-\
+de\014ned)i(constan)n(ts)e(from)g(the)g(F)o(OR)m(TRAN)0 1652 y(include)h(\014\
+le)e(`)p fi(netcdf.inc)p fm('.)j(If)d(y)n(ou)f(w)o(an)o(t)g(error)f(messages,)
+g(but)i(do)f(not)g(wish)g(errors)g(to)f(b)r(e)h(fatal,)g(turn)g(o\013)0 1714 y
+(the)f(fatal)g(error)g(\015ag)f(with:)263 1856 y fi(CALL)23 b(NCPOPT\(NCVERBO\
+S\))0 2079 y fm(If)15 b(y)o(ou)g(w)o(an)o(t)f(neither)j(error)d(messages)h
+(nor)g(fatal)f(errors,)h(turn)g(o\013)g(b)r(oth)f(\015ags)h(with:)263 2221 y
+fi(CALL)23 b(NCPOPT\(0\))0 2444 y fm(T)l(o)15 b(get)g(the)g(curren)o(t)g(v)n
+(alue)g(of)g(the)h(error)e(options,)h(use:)263 2586 y fi(CALL)23 b(NCGOPT\(NC\
+OPTS\))p eop
+%%Page: 42 44
+ bop 0 -58 a fm(42)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(In)h(either)h
+(case,)e(the)g(integer)g(return)g(co)q(de)h(\(the)g(last)f(parameter)g(in)h
+(all)g(of)f(the)h(F)n(OR)m(TRAN)g(subroutines)0 246 y(and)f(functions\))g(con)
+o(tains)g(the)g(non-zero)h(netCDF-sp)q(eci\014c)g(error)e(n)o(um)o(b)q(er)h
+(that)g(can)g(b)q(e)g(used)h(to)e(determine)0 308 y(the)19 b(nature)g(of)g
+(the)h(error.)31 b(Names)19 b(and)g(descriptions)i(of)e(netCDF)f(error)h(co)q
+(des)h(are)f(included)j(in)e(the)f(\014le)0 370 y(`)p fi(netcdf.inc)p fm('.)p
+eop
+%%Page: 43 45
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(43)0 183 y fj
+(5)41 b(NetCDF)15 b(Op)r(erations)62 376 y fm(This)i(c)o(hapter)g(presen)o
+(ts)f(the)h(in)o(terfaces)f(of)g(the)h(netCDF)f(routines)h(that)f(deal)h(with)
+g(a)f(netCDF)g(\014le)h(as)f(a)0 438 y(whole.)62 576 y(A)i(netCDF)e(\014le)j
+(that)d(has)h(not)g(y)o(et)g(b)r(een)h(op)q(ened)g(can)g(only)f(b)r(e)g(refer\
+red)h(to)f(b)o(y)g(its)g(\014le)i(name.)26 b(Once)18 b(a)0 639 y(netCDF)g(\
+\014le)i(is)f(op)r(ened,)h(it)f(is)g(referred)g(to)f(b)o(y)h(an)g(ID,)f(which)
+h(is)g(a)g(small)g(nonnegative)g(in)o(teger)g(returned)0 701 y(when)f(y)o(ou)
+g(create)f(or)g(op)q(en)i(the)e(\014le.)29 b(A)18 b(netCDF)f(ID)g(is)i(a)e
+(\014le)i fh(handle)p fm(,)g(m)n(uch)f(like)f(a)h(\014le)h(descriptor)f(in)g
+(C)0 763 y(or)f(a)g(logical)h(unit)g(n)o(um)o(b)q(er)f(in)h(F)o(OR)m(TRAN.)f
+(In)h(an)o(y)f(single)h(program,)e(the)i(netCDF)e(IDs)h(of)g(distinct)h(op)r
+(en)0 826 y(netCDFs)i(are)g(distinct.)37 b(A)21 b(single)h(netCDF)e(\014le)h
+(ma)o(y)f(b)r(e)g(op)r(ened)h(m)o(ultiple)i(times)d(and)h(will)h(then)f(ha)o
+(v)o(e)0 888 y(m)o(ultiple)e(distinct)f(netCDF)e(IDs;)h(ho)o(w)n(ev)o(er)g
+(at)f(most)g(one)h(of)f(the)h(op)q(en)g(instances)h(of)e(a)h(single)h(netCDF)
+e(\014le)0 950 y(should)g(p)r(ermit)f(writing.)20 b(When)c(an)f(op)q(en)h(net\
+CDF)e(\014le)i(is)g(closed,)g(its)f(ID)g(no)g(longer)h(refers)f(to)f(it,)h
+(and)h(that)0 1012 y(ID)f(ma)o(y)g(b)q(e)h(subsequently)f(reassigned)h(to)e
+(refer)h(to)g(a)g(di\013eren)q(t)f(netCDF)h(that)f(is)i(op)q(ened)g(later.)62
+1151 y(The)g(op)q(erations)f(supp)r(orted)g(on)g(a)g(netCDF)f(\014le)j(as)d
+(a)h(single)i(ob)r(ject)e(are:)37 1289 y fk(\017)30 b fm(Create,)14 b(giv)o
+(en)i(\014le)g(path)f(and)h(whether)f(to)g(o)n(v)o(erwrite)g(or)g(not.)37 1365
+y fk(\017)30 b fm(Op)r(en)15 b(for)g(access,)g(giv)o(en)h(\014le)g(path)f(and)
+g(read)h(or)e(write)h(inten)o(t.)37 1441 y fk(\017)30 b fm(Put)15 b(into)f
+(de\014ne)j(mode,)f(to)e(add)i(dimensions,)g(v)m(ariables,)g(or)f(attributes.)
+37 1516 y fk(\017)30 b fm(T)l(ak)n(e)16 b(out)f(of)f(de\014ne)j(mo)q(de,)e
+(c)o(hec)o(king)h(consistency)g(of)f(additions.)37 1592 y fk(\017)30 b fm(Clo\
+se,)15 b(writing)h(to)e(disk)i(if)g(required.)37 1668 y fk(\017)30 b fm(Get)
+18 b(n)o(um)o(b)q(er)h(of)f(dimensions,)i(n)o(um)o(b)q(er)f(of)f(v)m(ariables\
+,)i(n)o(um)o(b)q(er)e(of)g(global)h(attributes,)g(and)f(ID)h(of)f(the)90 1731
+y(unlimited)g(dimension)e(if)g(an)o(y)l(.)37 1806 y fk(\017)30 b fm(Sync)o
+(hronize)17 b(to)d(disk)i(to)f(mak)n(e)g(sure)h(it)f(is)h(curren)o(t.)37 1882
+y fk(\017)30 b fm(Set)15 b(and)h(unset)f fh(no\014ll)k fm(mode)d(for)f(optimi\
+zed)h(sequential)g(writes.)0 2096 y(After)g(a)g(summary)f(of)h(con)o(v)o(en)o
+(tions)g(used)h(in)g(describing)h(the)f(netCDF)e(C)h(and)g(F)o(OR)m(TRAN)h
+(in)o(terfaces,)f(the)0 2159 y(rest)f(of)g(this)g(c)o(hapter)g(presents)f(the)
+i(in)o(terfaces)f(for)g(these)g(op)q(erations.)0 2394 y fl(5.1)33 b(NetCDF)14
+b(Library)j(In)n(terface)e(Descriptions)62 2532 y fm(Eac)o(h)g(in)o(terface)g
+(description)h(for)e(a)h(particular)g(netCDF)f(function)h(in)h(this)f(and)g
+(later)g(c)o(hapters)f(con)o(tains:)37 2670 y fk(\017)30 b fm(A)15 b(descript\
+ion)i(of)e(the)g(purp)r(ose)g(of)g(the)g(function;)p eop
+%%Page: 44 46
+ bop 0 -58 a fm(44)1465 b(NetCDF)14 b(User's)h(Guide)37 183 y fk(\017)30 b fm
+(A)15 b(list)h(of)f(p)r(ossible)h(error)e(conditions;)37 258 y fk(\017)30 b fm
+(A)21 b(C)g(function)h(protot)m(yp)r(e)f(that)f(presents)g(the)h(t)o(yp)q(e)g
+(and)g(order)g(of)g(the)g(formal)f(parameters)h(to)f(the)90 320 y(function;)
+37 395 y fk(\017)30 b fm(A)15 b(description)i(of)e(eac)o(h)g(formal)g(paramet\
+er)f(in)i(the)g(C)f(in)o(terface;)37 470 y fk(\017)30 b fm(An)14 b(example)h
+(of)e(a)h(C)g(program)e(fragmen)o(t)h(calling)j(the)e(netCDF)f(function)i(and)
+f(p)q(erhaps)g(other)g(netCDF)90 532 y(functions)i(to)f(do)g(something)g(usef\
+ul;)37 607 y fk(\017)30 b fm(A)17 b(F)o(OR)m(TRAN)g(function)h(protot)n(yp)q
+(e)g(that)e(presents)g(the)i(t)n(yp)q(e)g(and)f(order)g(of)g(the)g(formal)g
+(parameters)90 669 y(to)c(the)h(F)n(OR)m(TRAN)g(function)g(or)f(functions)i
+(that)e(pro)n(vide)i(the)e(same)h(functionality)f(as)h(the)f(C)g(function;)37
+744 y fk(\017)30 b fm(A)15 b(description)i(of)e(eac)o(h)g(formal)g(parameter)
+f(in)i(the)g(F)n(OR)m(TRAN)g(in)o(terface;)f(and)37 818 y fk(\017)30 b fm(An)
+15 b(example)g(of)f(a)g(F)o(OR)m(TRAN)h(program)e(fragmen)n(t)h(that)g(duplic\
+ates)i(the)f(function)g(of)f(the)h(example)g(C)90 881 y(fragmen)n(t.)62 1092 y
+(The)k(C)e(function)i(protot)n(yp)q(es)g(sp)q(ecify)g(the)f(order)g(and)g(t)o
+(yp)q(e)g(of)g(eac)o(h)g(formal)g(parameter)f(and)i(conform)0 1155 y(to)e(the)
+h(ANSI)g(C)f(standard.)27 b(F)n(OR)m(TRAN)18 b(do)r(es)f(not)g(ha)o(v)o(e)h
+(function)g(protot)n(yp)q(es,)g(but)g(a)f(similar)i(syn)o(tax)d(is)0 1217 y
+(used)h(to)g(concisely)h(present)e(the)h(order)g(and)g(t)n(yp)r(es)g(of)f(F)o
+(OR)m(TRAN)h(formal)g(parameters.)24 b(In)17 b(the)g(few)g(cases)0 1279 y(in)
+h(which)g(a)f(single)i(C)e(function)i(corresp)q(onds)f(to)f(t)n(w)o(o)g(F)n
+(OR)m(TRAN)h(functions,)h(the)f(F)n(OR)m(TRAN)g(functions)0 1341 y(protot)n
+(yp)q(es)d(are)g(presented)g(together.)62 1478 y(The)e(F)o(OR)m(TRAN)g(exampl\
+es)h(use)f(t)o(w)n(o)g(nonstandard)f(notations:)19 b fi(INCLUDE)12 b fm(state\
+men)n(ts)g(and)h(in-line)j(com-)0 1541 y(men)o(ts.)k(In)15 b(eac)o(h)h(case,)
+e(w)o(e)h(use)h(the)f(VMS)g(F)o(OR)m(TRAN)g(notation,)g(as)g(in)h(the)f(follo)
+o(wing)h(example:)263 1678 y fi(INCLUDE)23 b('netcdf.inc')263 1727 y(INTEGER)
+g(NCID)167 b(!)23 b(this)h(is)f(an)h(in-line)f(comment)62 1939 y fm(F)o(OR)m
+(TRAN)18 b(examples)h(\(and)f(the)g(F)n(OR)m(TRAN)h(in)o(terface\))f(abide)h
+(b)o(y)f(the)g(six-c)o(haracter)g(limitation)h(on)0 2001 y(the)13 b(length)g
+(of)g(F)n(OR)m(TRAN)g(names,)g(except)g(that)g(parameters)e(names)i(ma)o(y)f
+(b)r(e)h(up)g(to)f(eight)g(c)o(haracters)g(long.)p eop
+%%Page: 45 47
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(45)0 183 y fl
+(5.2)33 b(Create)14 b(a)h(NetCDF)f(\014le)62 322 y fm(The)24 b(function)g fi
+(nccreate)e fm(\(or)g fi(NCCRE)g fm(for)h(F)n(OR)m(TRAN\))g(creates)g(a)g(new)
+g(netCDF)g(\014le,)j(returning)d(a)0 384 y(netCDF)e(ID)g(that)g(can)g(subsequ\
+ently)h(b)q(e)g(used)f(to)g(refer)g(to)g(the)g(netCDF)g(\014le.)39 b(The)22 b
+(new)f(netCDF)g(\014le)0 447 y(is)16 b(placed)g(in)g(de\014ne)g(mo)q(de.)62
+586 y(In)21 b(case)f(of)g(an)g(error,)g fi(nccreate)f fm(returns)h(-1;)i fi
+(NCCRE)d fm(returns)h(a)g(nonzero)g(v)n(alue)g(in)h fi(rcode)p fm(.)34 b(P)o
+(ossible)0 648 y(causes)15 b(of)g(errors)g(include::)37 787 y fk(\017)30 b fm
+(P)o(assing)15 b(a)g(\014le)h(name)f(that)g(includes)i(a)e(directory)h(that)e
+(do)q(es)i(not)e(exist.)37 863 y fk(\017)30 b fm(Sp)r(ecifying)16 b(a)f(\014l\
+e)i(name)e(of)g(a)f(\014le)j(that)d(exists)i(and)f(also)g(sp)r(ecifying)h fi
+(NC_NOCLOBBER)e fm(\(or)g fi(NCNOCLOB)p fm(\).)37 940 y fk(\017)30 b fm(A)o
+(ttempting)16 b(to)f(create)h(a)g(netCDF)f(\014le)i(in)g(a)f(directory)g(wher\
+e)g(y)o(ou)g(don't)g(ha)n(v)o(e)g(p)r(ermission)h(to)e(create)90 1002 y(\014l\
+es.)0 1320 y fl(nccreate:)22 b(C)15 b(In)n(terface)120 1459 y fi(int)23 b(ncc\
+reate)g(\(const)g(char*)g(path,)h(int)f(cmode\);)0 1598 y(path)144 b fm(The)
+18 b(\014le)h(name)f(of)f(the)h(new)g(netCDF)f(\014le.)28 b(This)19 b(can)f
+(b)q(e)g(giv)o(en)g(as)g(either)g(an)g(absolute)g(path)240 1660 y(name)j(\(fr\
+om)f(the)h(ro)q(ot)f(of)h(the)g(\014le)h(system\))e(or)h(a)g(relativ)o(e)g
+(path)g(name)g(\(from)f(the)h(curren)o(t)240 1722 y(directory\).)0 1799 y fi
+(cmode)120 b fm(Should)12 b(b)q(e)f(sp)q(eci\014ed)h(as)e(either)h fi(NC_CLOB\
+BER)e fm(or)h fi(NC_NOCLOBBER)p fm(.)16 b(These)11 b(constan)o(ts)f(are)g(de\
+\014ned)240 1861 y(in)17 b(the)g(include)i(\014le)e(named)g(`)p fi(netcdf.h)p
+fm('.)22 b fi(NC_CLOBBER)15 b fm(means)i(that)f(ev)o(en)g(if)h(the)g(\014le)h
+(already)240 1923 y(exists,)13 b(y)o(ou)g(w)n(an)o(t)f(to)g(create)h(a)f(new)
+h(\014le)h(with)f(the)g(same)g(name,)f(erasing)h(the)g(old)h(\014le's)f(con)o
+(ten)o(ts.)240 1986 y fi(NC_NOCLOBBER)g fm(means)h(y)n(ou)h(w)n(an)o(t)f(to)f
+(create)h(a)g(new)h(netCDF)e(\014le)i(only)g(if)g(the)f(giv)o(en)h(\014le)g
+(name)240 2048 y(do)q(es)h(not)e(refer)h(to)g(a)g(\014le)h(that)f(already)g
+(exists.)62 2263 y(In)i(this)f(example)h(w)n(e)f(create)g(a)f(netCDF)g(\014le)
+i(named)f(`)p fi(foo.nc)p fm(';)f(w)n(e)h(w)o(an)n(t)g(the)g(\014le)h(to)e
+(b)q(e)h(created)g(in)h(the)0 2326 y(curren)o(t)e(directory)h(only)f(if)h(a)f
+(\014le)h(with)g(that)e(name)h(do)r(es)g(not)g(already)g(exist:)120 2464 y fi
+(#include)23 b("netcdf.h")192 2514 y ff(:)7 b(:)g(:)120 2564 y fi(int)23 b
+(ncid;)192 2614 y ff(:)7 b(:)g(:)120 2664 y fi(ncid)23 b(=)h(nccreate\("foo.n\
+c",)d(NC_NOCLOBBER\);)p eop
+%%Page: 46 48
+ bop 0 -58 a fm(46)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(NCCRE:)f(F)n
+(OR)-6 b(TRAN)15 b(In)n(terface)120 320 y fi(INTEGER)23 b(FUNCTION)g(NCCRE)g
+(\(CHARACTER*\(*\))f(PATH,)h(INTEGER)g(CMODE,)693 370 y(INTEGER)g(RCODE\))0
+507 y(PATH)144 b fm(The)18 b(\014le)h(name)f(of)f(the)h(new)g(netCDF)f(\014le\
+.)28 b(This)19 b(can)f(b)q(e)g(giv)o(en)g(as)g(either)g(an)g(absolute)g(path)
+240 569 y(name)j(\(from)f(the)h(ro)q(ot)f(of)h(the)g(\014le)h(system\))e(or)h
+(a)g(relativ)o(e)g(path)g(name)g(\(from)f(the)h(curren)o(t)240 632 y(director\
+y\).)0 706 y fi(CMODE)120 b fm(Should)17 b(b)r(e)f(sp)q(eci\014ed)i(as)d(eith\
+er)i fi(NCCLOB)e fm(or)g fi(NCNOCLOB)p fm(.)20 b(These)d(constan)n(ts)f(are)f
+(de\014ned)i(in)g(the)240 769 y(include)d(\014le)f(`)p fi(netcdf.inc)p fm('.)
+j fi(NCCLOB)11 b fm(means)h(that)f(ev)o(en)h(if)g(the)g(\014le)h(already)f
+(exists,)h(y)n(ou)f(w)n(an)o(t)g(to)240 831 y(create)j(a)g(new)h(\014le)g(wit\
+h)g(the)f(same)g(name,)g(erasing)h(the)f(old)h(\014le's)g(con)o(ten)o(ts.)k fi
+(NCNOCLOB)14 b fm(means)240 893 y(y)o(ou)f(w)o(an)o(t)g(to)g(create)g(a)h(new)
+g(netCDF)f(\014le)h(only)g(if)h(the)e(giv)o(en)h(\014le)h(name)f(do)q(es)g
+(not)f(refer)h(to)f(a)g(\014le)240 955 y(that)h(already)i(exists.)0 1030 y fi
+(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q
+(ccurred,)i(0)f(is)g(returned.)62 1242 y(In)e(this)f(example)h(w)o(e)f(create)
+f(a)h(netCDF)f(\014le)i(named)g(`)p fi(foo.nc)p fm(',)d(assuming)i(w)o(e)g
+(w)o(an)n(t)g(the)g(\014le)h(to)e(b)r(e)h(created)0 1304 y(in)k(the)f(current)
+f(directory)i(only)g(if)f(a)g(\014le)h(with)g(that)e(name)i(do)q(es)f(not)g
+(already)g(exist:)263 1441 y fi(INCLUDE)23 b('netcdf.inc')335 1491 y ff(:)7 b
+(:)g(:)263 1541 y fi(INTEGER)23 b(NCID)335 1590 y ff(:)7 b(:)g(:)263 1640 y fi
+(NCID)23 b(=)h(NCCRE\('foo.nc',)e(NCNOCLOB,)h(RCODE\))p eop
+%%Page: 47 49
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(47)0 183 y fl
+(5.3)33 b(Op)q(en)15 b(a)g(NetCDF)f(File)j(for)e(Access)62 323 y fm(The)h(fun\
+ction)g fi(ncopen)e fm(\(or)g fi(NCOPN)h fm(for)f(F)o(OR)m(TRAN\))h(op)q(ens)
+h(an)f(existing)h(netCDF)f(\014le)h(for)f(access.)62 463 y(In)h(case)f(of)f
+(an)h(error,)f fi(ncopen)g fm(returns)g(-1;)h fi(NCOPN)f fm(returns)h(a)f(non\
+zero)h(v)n(alue)g(in)h fi(rcode)p fm(.)j(P)o(ossible)d(causes)0 525 y(of)f
+(errors)f(include::)37 665 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)
+d(\014le)j(do)q(es)e(not)g(exist.)37 743 y fk(\017)30 b fm(The)15 b(mo)q(de)h
+(sp)q(eci\014ed)h(is)f(something)f(other)g(than)g fi(NC_WRITE)f fm(or)h fi
+(NC_NOWRITE)p fm(.)0 1070 y fl(ncop)r(en:)23 b(C)14 b(In)n(terface)120 1209 y
+fi(int)23 b(ncopen\(const)g(char*)g(path,int)g(mode\);)0 1349 y(path)144 b fm
+(Absolute)16 b(or)f(relativ)o(e)g(\014le)i(name)e(for)f(netCDF)h(\014le)h(to)
+f(b)q(e)h(op)q(ened.)0 1427 y fi(mode)144 b fm(Either)13 b fi(NC_WRITE)p fm
+(,)e(to)h(op)q(en)h(the)g(\014le)g(for)f(writing,)h(or)f fi(NC_NOWRITE)p fm
+(,)f(to)h(op)q(en)h(the)f(\014le)h(read-only)m(.)240 1489 y(\\W)l(riting")h
+(means)g(an)o(y)f(kind)i(of)f(c)o(hange)g(to)f(the)h(\014le,)h(including)i
+(app)q(ending)e(or)f(c)o(hanging)g(data,)240 1551 y(adding)i(or)f(renaming)g
+(dimensions,)i(v)m(ariables,)f(and)f(attributes,)g(or)g(deleting)h(attributes\
+.)62 1769 y(Here)g(is)f(an)h(example)g(using)g fi(ncopen)e fm(to)g(op)r(en)h
+(an)g(existing)i(netCDF)d(\014le)i(named)g(`)p fi(foo.nc)p fm(')d(for)i(readi\
+ng:)120 1909 y fi(#include)23 b("netcdf.h")192 1958 y ff(:)7 b(:)g(:)120 2008
+y fi(int)23 b(ncid;)192 2058 y ff(:)7 b(:)g(:)120 2108 y fi(ncid)23 b(=)h(nco\
+pen\("foo.nc",)e(NC_NOWRITE\);)0 2431 y fl(NCOPN:)13 b(F)n(OR)-6 b(TRAN)15 b
+(In)n(terface)263 2570 y fi(INTEGER)23 b(FUNCTION)g(NCOPN\(CHARACTER*\(*\))e
+(PATH,)239 2620 y(+)549 b(INTEGER)23 b(RWMODE,)239 2670 y(+)549 b(INTEGER)23 b
+(RCODE\))p eop
+%%Page: 48 50
+ bop 0 -58 a fm(48)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fi(PATH)144 b fm
+(Absolute)16 b(or)f(relativ)o(e)g(\014le)i(name)e(for)f(netCDF)h(\014le)h(to)
+f(b)q(e)h(op)q(ened.)0 258 y fi(RWMODE)96 b fm(Either)18 b fi(NCWRITE)p fm
+(,)f(to)f(op)r(en)i(the)f(\014le)i(for)e(writing,)h(or)f fi(NCNOWRIT)p fm(,)f
+(to)h(op)q(en)h(the)g(\014le)g(read-only)m(.)240 320 y(\\W)l(riting")c(means)
+g(an)o(y)f(kind)i(of)f(c)o(hange)g(to)f(the)h(\014le,)h(including)i(app)q(end\
+ing)e(or)f(c)o(hanging)g(data,)240 382 y(adding)i(or)f(renaming)g(dimensions,)
+i(v)m(ariables,)f(and)f(attributes,)g(or)g(deleting)h(attributes.)0 457 y fi
+(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q
+(ccurred,)i(0)f(is)g(returned.)62 669 y(Here)g(is)f(an)h(example)g(of)e(using)
+i fi(NCOPN)f fm(to)f(op)r(en)h(an)g(existing)h(netCDF)f(\014le)h(named)g(`)p
+fi(foo.nc)p fm(')d(for)i(reading:)263 806 y fi(INCLUDE)23 b('netcdf.inc')335
+856 y ff(:)7 b(:)g(:)263 906 y fi(INTEGER)23 b(NCID)335 955 y ff(:)7 b(:)g
+(:)263 1005 y fi(NCID)23 b(=)h(NCOPN\('foo.nc',)e(NCNOWRIT,)h(RCODE\))p eop
+%%Page: 49 51
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(49)0 183 y fl
+(5.4)33 b(Put)15 b(Op)r(en)g(NetCDF)f(File)i(in)n(to)h(De\014ne)d(Mo)r(de)62
+323 y fm(The)i(function)h fi(ncredef)d fm(\(or)h fi(NCREDF)g fm(for)g(F)n(OR)
+m(TRAN\))h(puts)f(an)h(op)q(en)g(netCDF)f(\014le)i(in)o(to)e(de\014ne)i(mo)q
+(de,)0 385 y(so)e(dimensions,)h(v)n(ariables,)f(and)h(attributes)f(can)g(b)r
+(e)g(added)h(or)e(renamed)i(and)f(attributes)g(can)h(b)q(e)g(deleted.)62 525 y
+(In)21 b(case)f(of)g(an)g(error,)g fi(ncredef)f fm(returns)h(-1;)i fi(NCREDF)
+d fm(returns)h(a)g(nonzero)g(v)n(alue)g(in)h fi(rcode)p fm(.)34 b(P)o(ossible)
+0 587 y(causes)15 b(of)g(errors)g(include::)37 727 y fk(\017)30 b fm(The)15 b
+(sp)r(eci\014ed)i(netCDF)d(\014le)j(is)e(already)h(in)g(de\014ne)g(mo)q(de.)
+37 805 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(\014le)j(w)n(as)e
+(op)q(ened)h(for)f(read-only)m(.)37 882 y fk(\017)30 b fm(The)15 b(sp)r(eci\
+\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g
+(\014le.)0 1209 y fl(ncredef:)22 b(C)15 b(In)n(terface)120 1349 y fi(int)23 b
+(ncredef\(int)g(ncid\);)0 1489 y(ncid)144 b fm(netCDF)15 b(ID,)f(returned)i
+(from)e(a)h(previous)h(call)h(to)d fi(ncopen)h fm(or)f fi(nccreate)p fm(.)62
+1706 y(Here)i(is)g(an)g(example)g(using)g fi(ncredef)f fm(to)g(op)q(en)h(an)g
+(existing)g(NetCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm(')e(and)i(put)g(it)0
+1769 y(into)e(de\014ne)i(mo)q(de:)120 1909 y fi(#include)23 b("netcdf.h")192
+1958 y ff(:)7 b(:)g(:)120 2008 y fi(int)23 b(ncid;)192 2058 y ff(:)7 b(:)g
+(:)120 2108 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e(NC_WRITE\);)94 b(/*)23 b
+(open)h(file)f(*/)192 2158 y ff(:)7 b(:)g(:)120 2207 y fi(ncredef\(ncid\);)
+571 b(/*)23 b(put)h(in)f(define)g(mode)h(*/)0 2530 y fl(NCREDF:)14 b(F)n(OR)
+-6 b(TRAN)15 b(In)n(terface)120 2670 y fi(SUBROUTINE)22 b(NCREDF\(INTEGER)g
+(NCID,)i(INTEGER)f(RCODE\))p eop
+%%Page: 50 52
+ bop 0 -58 a fm(50)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fi(NCID)144 b fm
+(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm
+(or)h fi(NCCRE)p fm(.)0 258 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q
+(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 470 y(Here)
+g(is)g(an)f(example)h(of)f(using)i fi(NCREDF)d fm(to)h(op)q(en)h(an)f(existin\
+g)i(netCDF)e(\014le)h(named)g(`)p fi(foo.nc)p fm(')e(and)h(put)h(it)0 532 y
+(into)f(de\014ne)i(mo)q(de:)263 669 y fi(INCLUDE)23 b('netcdf.inc')335 719 y
+ff(:)7 b(:)g(:)263 769 y fi(INTEGER)23 b(NCID)335 818 y ff(:)7 b(:)g(:)263 868
+y fi(NCID)23 b(=)h(NCOPN\('foo.nc',)e(NCWRITE,)h(RCODE\))335 918 y ff(:)7 b
+(:)g(:)263 968 y fi(CALL)23 b(NCREDF\(NCID,)g(RCODE\))p eop
+%%Page: 51 53
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(51)0 183 y fl
+(5.5)33 b(Lea)n(v)n(e)15 b(De\014ne)g(Mo)q(de)62 324 y fm(The)d(function)h fi
+(ncendef)e fm(\(or)g fi(NCENDF)g fm(for)g(F)o(OR)m(TRAN\))h(tak)n(es)g(an)g
+(op)q(en)g(netCDF)f(\014le)i(out)f(of)f(de\014ne)i(mo)q(de.)0 386 y(The)k(c)o
+(hanges)g(made)g(to)f(the)h(netCDF)f(\014le)i(while)g(it)f(w)o(as)f(in)i(de\
+\014ne)g(mo)q(de)f(are)f(c)o(heck)n(ed)i(and)f(committed)g(to)0 449 y(disk)g
+(if)h(no)e(problems)i(o)q(ccurred.)25 b(The)17 b(netCDF)f(\014le)h(is)h(then)
+f(placed)h(in)f(data)f(mo)q(de,)h(so)g(v)m(ariable)h(data)e(can)0 511 y(b)r
+(e)f(read)g(or)g(written.)62 652 y(This)j(call)g(can)g(b)q(e)g(exp)q(ensive,)
+f(since)i(it)e(inv)o(olv)o(es)g(initializin)q(g)j(non-record)d(v)n(ariables)h
+(and)f(cop)o(ying)h(data)0 714 y(under)c(some)f(circumstances.)21 b(See)14 b
+(Chapter)f(9)g([NetCDF)f(File)j(Structure)f(and)f(P)o(erformance],)g(page)g
+(147,)g(for)0 776 y(a)i(more)g(extensiv)o(e)h(discussion.)62 917 y(In)21 b
+(case)f(of)g(an)g(error,)g fi(ncendef)f fm(returns)h(-1;)i fi(NCENDF)d fm(ret\
+urns)h(a)g(nonzero)g(v)n(alue)g(in)h fi(rcode)p fm(.)34 b(P)o(ossible)0 979 y
+(causes)15 b(of)g(errors)g(include:)37 1120 y fk(\017)30 b fm(The)15 b(sp)r
+(eci\014ed)i(netCDF)d(\014le)j(is)e(not)g(in)h(de\014ne)g(mo)q(de.)37 1198 y
+fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)
+g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1535 y fl(ncendef:)22 b(C)15 b(In)n
+(terface)120 1675 y fi(int)23 b(ncendef\(int)g(ncid\);)0 1816 y(ncid)144 b fm
+(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm
+(or)h fi(nccreate)p fm(.)62 2035 y(Here)f(is)g(an)f(example)h(using)g fi(ncen\
+def)f fm(to)f(\014nish)j(the)e(de\014nitions)i(of)e(a)g(new)h(netCDF)f(\014le)
+h(named)g(`)p fi(foo.nc)p fm(')0 2098 y(and)h(put)h(it)f(into)f(data)h(mo)q
+(de:)120 2238 y fi(#include)23 b("netcdf.h")192 2288 y ff(:)7 b(:)g(:)120 2338
+y fi(int)23 b(ncid;)192 2388 y ff(:)7 b(:)g(:)120 2438 y fi(ncid)23 b(=)h(ncc\
+reate\("foo.nc",)d(NC_NOCLOBBER\);)192 2537 y ff(:)7 b(:)g(:)143 b fi(/*)23 b
+(create)g(dimensions,)g(variables,)f(attributes)h(*/)120 2637 y(ncendef\(ncid\
+\);)46 b(/*leave)23 b(define)g(mode*/)p eop
+%%Page: 52 54
+ bop 0 -58 a fm(52)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(NCENDF:)f(F)n
+(OR)-6 b(TRAN)14 b(In)n(terface)120 320 y fi(SUBROUTINE)22 b(NCENDF\(INTEGER)
+g(NCID,)i(INTEGER)f(RCODE\))0 457 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)
+h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 532 y
+fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q
+(ccurred,)i(0)f(is)g(returned.)62 744 y(Here)g(is)h(an)e(example)i(using)g fi
+(NCENDF)e fm(to)g(\014nish)i(the)f(de\014nitions)h(of)f(a)f(new)h(netCDF)g
+(\014le)g(named)h(`)p fi(foo.nc)p fm(')0 806 y(and)f(put)h(it)f(into)f(data)h
+(mo)q(de:)263 943 y fi(INCLUDE)23 b('netcdf.inc')335 993 y ff(:)7 b(:)g(:)263
+1043 y fi(INTEGER)23 b(NCID)335 1092 y ff(:)7 b(:)g(:)263 1142 y fi(NCID)23 b
+(=)h(NCCRE\('foo.nc',)e(NCNOCLOB,)h(RCODE\))335 1242 y ff(:)7 b(:)g(:)48 b fi
+(!)f(create)23 b(dimensions,)g(variables,)f(attributes)263 1341 y(CALL)h(NCEN\
+DF\(NCID,)g(RCODE\))p eop
+%%Page: 53 55
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(53)0 183 y fl
+(5.6)33 b(Close)14 b(an)h(Op)r(en)g(NetCDF)f(File)62 323 y fm(The)20 b(functi\
+on)h fi(ncclose)e fm(\(or)g fi(NCCLOS)g fm(for)g(F)n(OR)m(TRAN\))h(closes)h
+(an)e(op)r(en)h(netCDF)f(\014le.)35 b(If)20 b(the)g(\014le)g(is)0 385 y(in)g
+(de\014ne)g(mo)q(de,)g fi(ncendef)e fm(\(or)g fi(NCENDF)p fm(\))g(will)i(b)r
+(e)f(called)i(b)q(efore)e(closing.)32 b(\(In)19 b(this)h(case,)f(if)h fi(ncen\
+def)e fm([or)0 447 y fi(NCENDF)p fm(])f(returns)i(an)g(error,)f fi(ncabort)g
+fm([or)g fi(NCABOR)p fm(])f(will)j(automatically)f(b)r(e)g(called)h(to)e(rest\
+ore)g(the)h(\014le)h(to)0 510 y(the)c(consisten)o(t)g(state)e(b)r(efore)h(de\
+\014ne)i(mo)q(de)f(w)o(as)f(last)g(entered.\))21 b(After)15 b(an)g(op)r(en)h
+(netCDF)f(\014le)h(is)g(closed,)h(its)0 572 y(netCDF)e(ID)g(will)i(b)q(e)f
+(reassigned)f(to)g(the)g(next)g(netCDF)g(\014le)h(that)f(is)g(op)r(ened)h(or)
+e(created.)62 712 y(In)21 b(case)f(of)g(an)g(error,)g fi(ncclose)f fm(returns)
+h(-1;)i fi(NCCLOS)d fm(returns)h(a)g(nonzero)g(v)n(alue)g(in)h fi(rcode)p fm
+(.)34 b(P)o(ossible)0 774 y(causes)15 b(of)g(errors)g(include:)37 929 y fk
+(\017)30 b fm(The)15 b(netCDF)g(w)o(as)f(in)i(de\014ne)h(mo)q(de)e(and)h(the)
+f(automatic)f(call)j(made)e(to)g fi(ncendef)f fm(\(or)g fi(NCENDF)p fm(\))g
+(failed.)37 1006 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i
+(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1332 y fl(ncc\
+lose:)22 b(C)15 b(In)n(terface)120 1472 y fi(int)23 b(ncclose\(int)g(ncid\);)
+0 1612 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(cal\
+l)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)62 1829 y(Here)f(is)g(an)f
+(example)h(using)g fi(ncclose)f fm(to)f(\014nish)j(the)e(de\014nitions)i(of)e
+(a)g(new)h(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm(')0 1891 y(and)h(rele\
+ase)h(its)g(netCDF)e(ID:)120 2031 y fi(#include)23 b("netcdf.h")192 2081 y ff
+(:)7 b(:)g(:)120 2131 y fi(int)23 b(ncid;)192 2180 y ff(:)7 b(:)g(:)120 2230 y
+fi(ncid)23 b(=)h(nccreate\("foo.nc",)d(NC_NOCLOBBER\);)192 2330 y ff(:)7 b
+(:)g(:)143 b fi(/*)23 b(create)g(dimensions,)g(variables,)f(attributes)h(*/)
+120 2430 y(ncclose\(ncid\);)165 b(/*)24 b(close)f(netCDF)g(file)g(*/)0 2670 y
+fl(NCCLOS:)14 b(F)n(OR)-6 b(TRAN)15 b(In)n(terface)p eop
+%%Page: 54 56
+ bop 0 -58 a fm(54)1465 b(NetCDF)14 b(User's)h(Guide)120 183 y fi(SUBROUTINE)
+22 b(NCCLOS\(INTEGER)g(NCID,)i(INTEGER)f(RCODE\))0 320 y(NCID)144 b fm(netCDF)
+15 b(ID,)f(returned)i(from)e(a)h(previous)h(call)h(to)d fi(NCOPN)h fm(or)f fi
+(NCCRE)p fm(.)0 395 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b
+(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 607 y(Here)g(is)h
+(an)e(example)i(using)g fi(NCCLOS)e fm(to)g(\014nish)i(the)f(de\014nitions)h
+(of)f(a)f(new)h(netCDF)g(\014le)g(named)h(`)p fi(foo.nc)p fm(')0 669 y(and)f
+(release)h(its)g(netCDF)e(ID:)263 806 y fi(INCLUDE)23 b('netcdf.inc')335 856 y
+ff(:)7 b(:)g(:)263 906 y fi(INTEGER)23 b(NCID,)g(RCODE)335 955 y ff(:)7 b(:)g
+(:)263 1005 y fi(NCID)23 b(=)h(NCCRE\('foo.nc',)e(NCNOCLOB,)h(RCODE\))335 1105
+y ff(:)7 b(:)g(:)48 b fi(!)23 b(create)g(dimensions,)g(variables,)f(attribute\
+s)263 1204 y(CALL)h(NCCLOS\(NCID,)g(RCODE\))p eop
+%%Page: 55 57
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(55)0 183 y fl
+(5.7)33 b(Inquire)17 b(ab)r(out)e(an)g(Op)r(en)g(NetCDF)f(File)62 321 y fm
+(The)19 b(function)g fi(ncinquire)f fm(\()p fi(NCINQ)f fm(for)h(F)o(OR)m(TRAN\
+\))g(returns)h(information)f(ab)r(out)g(an)g(op)r(en)h(netCDF)0 383 y(\014le,)
+c(giv)o(en)g(its)g(netCDF)f(ID.)g(It)h(can)f(b)r(e)h(called)h(from)d(either)j
+(de\014ne)f(mo)q(de)g(or)f(data)g(mo)q(de.)20 b(It)14 b(returns)h(v)m(alues)0
+445 y(for)i(the)h(n)o(um)o(b)q(er)g(of)f(dimensions,)j(the)d(n)o(um)o(b)r(er)
+g(of)h(v)m(ariables,)h(the)f(n)o(um)o(b)q(er)g(of)f(global)h(attributes,)g
+(and)g(the)0 507 y(dimension)h(ID)f(of)f(the)g(dimension)i(de\014ned)g(with)f
+(unlimited)i(size,)e(if)g(an)o(y)l(.)27 b(No)17 b(I/O)h(is)g(required)h(when)
+f(this)0 570 y(or)d(an)n(y)g(other)g(`inquire')h(function)g(in)g(the)f(netCDF)
+f(interface)g(is)i(called,)g(since)g(the)g(functions)f(merely)h(return)0 632 y
+(information)f(that)g(is)h(stored)e(in)i(a)f(table)h(for)e(eac)o(h)i(op)q(en)
+g(netCDF)e(\014le.)62 769 y(In)20 b(case)e(of)h(an)f(error,)h fi(ncinquire)e
+fm(returns)i(-1;)h fi(NCINQ)e fm(returns)g(a)h(nonzero)g(v)m(alue)h(in)f fi
+(rcode)p fm(.)30 b(P)o(ossible)0 832 y(cause)15 b(of)g(errors)g(includes:)37
+969 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g
+(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1272 y fl(ncinquire:)25 b(C)
+15 b(In)n(terface)120 1409 y fi(int)23 b(ncinquire\(int)g(ncid,)g(int*)g(ndim\
+s,)g(int*)g(nvars,)g(int*)h(ngatts,)454 1459 y(int*)f(recdim\);)0 1597 y(ncid)
+144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi
+(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1672 y fi(ndims)120 b fm(Returned)14 b
+(n)o(um)o(b)r(er)f(of)g(dimensions)i(de\014ned)g(for)e(this)g(netCDF)g(\014le\
+.)20 b(If)14 b(this)g(parameter)f(is)g(given)240 1734 y(as)k(`)p fi(\(int)d
+(*\))h(0)p fm(',)i(the)h(n)o(um)n(b)r(er)f(of)g(dimensions)i(will)g(not)e(b)r
+(e)g(returned)h(so)f(no)h(v)m(ariable)g(to)f(hold)240 1796 y(this)f(informati\
+on)f(needs)h(to)f(b)q(e)g(declared.)0 1871 y fi(nvars)120 b fm(Returned)18 b
+(n)o(um)o(b)q(er)f(of)f(v)m(ariables)i(de\014ned)g(for)e(this)h(netCDF)f(\014\
+le.)25 b(If)17 b(this)g(parameter)f(is)h(given)240 1934 y(as)d(`)p fi(\(int)g
+(*\))h(0)p fm(',)f(the)g(n)o(um)o(b)q(er)h(of)f(v)m(ariables)h(will)h(not)e
+(b)r(e)g(returned)h(so)f(no)g(v)m(ariable)i(to)d(hold)j(this)240 1996 y(infor\
+mation)f(needs)h(to)f(b)q(e)h(declared.)0 2071 y fi(ngatts)96 b fm(Returned)
+15 b(n)o(um)o(b)q(er)f(of)g(global)h(attributes)e(de\014ned)j(for)d(this)i
+(netCDF)e(\014le.)20 b(If)15 b(this)f(parameter)f(is)240 2133 y(giv)o(en)g
+(as)e(`)p fi(\(int)k(*\))g(0)p fm(',)c(the)i(n)o(um)o(b)q(er)f(of)g(global)h
+(attributes)f(will)h(not)f(b)r(e)g(returned)h(so)e(no)i(v)m(ariable)240 2196 y
+(to)i(hold)h(this)f(information)h(needs)g(to)e(b)r(e)h(declared.)0 2271 y fi
+(recdim)96 b fm(Returned)21 b(ID)e(of)h(the)f(unlimited)j(dimension,)g(if)e
+(there)g(is)g(one)g(for)f(this)h(netCDF)f(\014le.)34 b(If)20 b(no)240 2333 y
+(unlimited)g(size)f(dimension)g(has)f(b)q(een)g(de\014ned,)i(-1)d(is)h(return\
+ed)g(for)f(the)h(v)n(alue)g(of)f fi(recdim)p fm(.)27 b(If)240 2395 y(this)14 b
+(parameter)f(is)i(giv)o(en)f(as)f(`)p fi(\(int)i(*\))f(0)p fm(',)g(the)g(reco\
+rd)f(dimension)j(ID)e(will)h(not)f(b)q(e)g(returned)g(so)240 2457 y(no)h(v)n
+(ariable)h(to)e(hold)i(this)g(information)f(needs)h(to)f(b)q(e)h(declared.)62
+2670 y(Here)g(is)f(an)h(example)g(using)g fi(ncinquire)d fm(to)i(\014nd)h(out)
+f(ab)q(out)g(a)g(netCDF)f(\014le)i(named)g(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 56 58
+ bop 0 -58 a fm(56)1465 b(NetCDF)14 b(User's)h(Guide)120 183 y fi(#include)23
+b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(int)23 b(ncid,)h(ndims,)f
+(nvars,)g(ngatts,)g(recdim;)192 333 y ff(:)7 b(:)g(:)120 382 y fi(ncid)23 b
+(=)h(ncopen\("foo.nc",)e(NC_NOWRITE\);)192 432 y ff(:)7 b(:)g(:)120 482 y fi
+(ncinquire\(ncid,)22 b(&ndims,)h(&nvars,)g(&ngatts,)f(&recdim\);)0 702 y fl
+(NCINQ:)13 b(F)n(OR)-6 b(TRAN)15 b(In)n(terface)263 839 y fi(SUBROUTINE)23 b
+(NCINQ\(INTEGER)f(NCID,)h(INTEGER)g(NDIMS,)g(INTEGER)g(NVARS,)239 889 y(*)406
+b(INTEGER)23 b(NGATTS,)g(INTEGER)g(RECDIM,)f(INTEGER)h(RCODE\))0 1026 y(NCID)
+144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi
+(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 1100 y fi(NDIMS)120 b fm(Returned)16 b(n)o
+(um)o(b)r(er)f(of)g(dimensions)h(de\014ned)h(for)e(this)g(netCDF)g(\014le.)0
+1175 y fi(NVARS)120 b fm(Returned)16 b(n)o(um)o(b)r(er)f(of)g(v)m(ariables)h
+(de\014ned)h(for)d(this)i(netCDF)e(\014le.)0 1250 y fi(NGATTS)96 b fm(Returne\
+d)16 b(n)o(um)o(b)r(er)f(of)g(global)g(attributes)g(de\014ned)i(for)e(this)g
+(netCDF)g(\014le.)0 1325 y fi(RECDIM)96 b fm(Returned)21 b(ID)e(of)h(the)f
+(unlimited)j(dimension,)g(if)e(there)g(is)g(one)g(for)f(this)h(netCDF)f(\014l\
+e.)34 b(If)20 b(no)240 1387 y(unlimited)e(size)e(dimension)h(has)e(b)q(een)h
+(de\014ned,)g(-1)f(is)h(returned)f(for)g(the)g(v)n(alue)h(of)f fi(RECDIM)p fm
+(.)0 1462 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f
+(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 1673 y(Here)h(is)f(an)h(exampl\
+e)g(using)g fi(NCINQ)e fm(to)h(\014nd)g(out)g(ab)r(out)f(a)h(netCDF)g(\014le)
+h(named)f(`)p fi(foo.nc)p fm(':)263 1810 y fi(INCLUDE)23 b('netcdf.inc')335
+1860 y ff(:)7 b(:)g(:)263 1910 y fi(INTEGER)23 b(NCID,)g(NDIMS,)g(NVARS,)g
+(NATTS,)g(RECDIM,)g(RCODE)335 1960 y ff(:)7 b(:)g(:)263 2009 y fi(NCID)23 b
+(=)h(NCOPN\('foo.nc',)e(NCNOWRIT,)h(RCODE\))335 2059 y ff(:)7 b(:)g(:)263 2109
+y fi(CALL)23 b(NCINQ\(NCID,)g(NDIMS,)g(NVARS,)g(NATTS,)g(RECDIM,)g(RCODE\))p
+eop
+%%Page: 57 59
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(57)0 183 y fl
+(5.8)33 b(Sync)n(hronize)17 b(an)e(Op)r(en)g(NetCDF)f(File)j(to)d(Disk)62 322
+y fm(The)20 b(function)g fi(ncsync)e fm(\(or)g fi(NCSNC)h fm(for)f(F)o(OR)m
+(TRAN\))h(mak)n(es)g(sure)h(that)e(the)h(disk)h(cop)o(y)f(of)g(a)g(netCDF)0
+384 y(\014le)f(op)q(en)g(for)e(writing)h(is)h(curren)o(t.)25 b(The)17 b(netCD\
+F)f(\014le)i(m)o(ust)f(b)q(e)g(in)h(data)e(mo)q(de.)26 b(A)17 b(netCDF)f(\014\
+le)i(in)g(de\014ne)0 446 y(mo)q(de)f(is)f(synchronized)h(to)f(disk)h(only)g
+(when)g fi(ncendef)e fm(\(or)g fi(NCENDF)p fm(\))g(is)i(called.)25 b(A)16 b
+(pro)q(cess)h(that)f(is)g(reading)0 509 y(a)i(netCDF)f(\014le)i(that)e(anothe\
+r)g(pro)q(cess)h(is)h(writing)f(can)g(also)g(call)h fi(ncsync)e fm(\(or)g fi
+(NCSNC)g fm(for)g(F)o(OR)m(TRAN\))h(to)0 571 y(get)f(up)r(dated)g(with)h(the)
+f(c)o(hanges)g(made)g(b)o(y)h(the)f(writing)h(pro)q(cess)f(\(e.g.)26 b(the)17
+b(n)o(um)o(b)q(er)h(of)e(records)i(written\),)0 633 y(without)d(ha)o(ving)h
+(to)e(close)i(and)f(reop)r(en)g(the)h(\014le.)62 772 y(It)k(can)f(b)q(e)h(exp)
+r(ensiv)o(e)g(in)g(computer)f(resources)g(to)g(alw)o(a)n(ys)g(synchronize)h
+(to)e(disk)i(after)f(ev)o(ery)g(write)g(of)0 834 y(v)m(ariable)14 b(data)e
+(or)g(c)o(hange)h(of)g(an)f(attribute)h(v)m(alue.)20 b(There)13 b(are)f(t)o
+(w)n(o)h(reasons)f(y)o(ou)g(might)g(w)o(an)n(t)h(to)f(sync)o(hronize)0 896 y
+(after)i(writes:)37 1035 y fk(\017)30 b fm(T)l(o)15 b(minimize)i(data)e(loss)
+g(in)h(case)g(of)e(abnormal)h(termination,)h(or)37 1111 y fk(\017)30 b fm(T)l
+(o)13 b(mak)n(e)h(data)e(a)o(v)m(ailable)j(to)e(other)f(pro)q(cesses)i(for)e
+(reading)i(immediately)h(after)d(it)i(is)g(written.)19 b(But)13 b(note)90 1174
+y(that)i(a)f(pro)r(cess)h(that)f(already)i(had)f(the)h(\014le)g(op)q(en)g(for)
+f(reading)g(w)o(ould)h(not)f(see)g(the)h(n)o(um)o(b)q(er)f(of)g(records)90
+1236 y(increase)i(when)g(the)g(writing)g(pro)q(cess)g(calls)g fi(ncsync)p fm
+(;)f(to)g(accomplish)i(this,)f(the)g(reading)g(pro)q(cess)g(m)n(ust)90 1298 y
+(call)f fi(ncsync)p fm(.)62 1513 y(Data)d(is)i(automatically)g(sync)o(hronize\
+d)g(to)f(disk)h(when)f(a)g(netCDF)g(\014le)h(is)g(closed,)g(or)e(whenever)h
+(y)o(ou)g(lea)o(v)o(e)0 1575 y(de\014ne)i(mo)q(de.)62 1714 y(In)g(case)f(of)f
+(an)h(error,)f fi(ncsync)g fm(returns)g(-1;)h fi(NCSNC)f fm(returns)h(a)f(non\
+zero)h(v)n(alue)g(in)h fi(rcode)p fm(.)j(P)o(ossible)d(causes)0 1776 y(of)f
+(errors)f(include:)37 1915 y fk(\017)30 b fm(The)15 b(netCDF)g(\014le)h(is)g
+(in)g(de\014ne)g(mo)q(de.)37 1991 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i
+(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0
+2306 y fl(ncsync:)23 b(C)15 b(In)n(terface)120 2445 y fi(int)23 b(ncsync\(int)
+g(ncid\);)0 2584 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(prev\
+ious)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)p eop
+%%Page: 58 60
+ bop 0 -58 a fm(58)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(Here)d(is)g(an)
+g(example)g(using)g fi(ncsync)f fm(to)g(sync)o(hronize)i(the)e(disk)i(writes)
+e(of)g(a)h(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm(':)120 320 y fi(#incl\
+ude)23 b("netcdf.h")192 370 y ff(:)7 b(:)g(:)120 420 y fi(int)23 b(ncid;)192
+470 y ff(:)7 b(:)g(:)120 519 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e(NC_WRITE\
+\);)46 b(/*)24 b(open)f(for)g(writing)g(*/)192 619 y ff(:)7 b(:)g(:)238 b fi
+(/*)24 b(write)f(data)g(or)h(change)f(attributes)f(*/)120 719 y(ncsync\(ncid\
+\);)141 b(/*)24 b(synchronize)e(to)i(disk)f(*/)0 1013 y fl(NCSNC:)13 b(F)n
+(OR)-6 b(TRAN)15 b(In)n(terface)263 1150 y fi(SUBROUTINE)23 b(NCSNC\(INTEGER)
+f(NCID,)h(INTEGER)g(RCODE\))0 1287 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)
+h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 1362
+y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f
+(o)q(ccurred,)i(0)f(is)g(returned.)62 1574 y(Here)f(is)f(an)g(example)h(using)
+g fi(NCSNC)e fm(to)h(sync)o(hronize)h(the)f(disk)h(writes)f(of)f(a)h(netCDF)g
+(\014le)h(named)f(`)p fi(foo.nc)p fm(':)263 1711 y fi(INCLUDE)23 b('netcdf.in\
+c')335 1760 y ff(:)7 b(:)g(:)263 1810 y fi(INTEGER)23 b(NCID,)g(RCODE)335 1860
+y ff(:)7 b(:)g(:)263 1910 y fi(NCID)23 b(=)h(NCOPN\('foo.nc',)e(NCWRITE,)h
+(RCODE\))335 1960 y ff(:)7 b(:)g(:)120 2009 y fi(*)24 b(write)f(data)g(or)h
+(change)f(attributes)335 2059 y ff(:)7 b(:)g(:)263 2109 y fi(CALL)23 b(NCSNC\
+\(NCID,)g(RCODE\))p eop
+%%Page: 59 61
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(59)0 183 y fl
+(5.9)33 b(Bac)n(k)15 b(Out)g(of)f(Recen)n(t)h(De\014nitions)62 323 y fm(The)e
+(function)h fi(ncabort)e fm(\(or)g fi(NCABOR)g fm(for)h(F)n(OR)m(TRAN\),)g
+(if)g(not)g(in)g(de\014ne)h(mo)q(de,)g(closes)f(the)g(netCDF)f(\014le.)0 385 y
+(If)i(the)h(\014le)g(is)g(b)q(eing)g(created)f(and)g(is)h(still)h(in)f(de\014\
+ne)g(mo)q(de,)f(the)g(\014le)i(is)e(deleted.)21 b(If)15 b(de\014ne)g(mo)q(de)
+f(w)o(as)g(en)o(tered)0 447 y(b)o(y)k(a)f(call)i(to)e fi(ncredef)f fm(\(or)h
+fi(NCREDF)p fm(\),)g(the)h(netCDF)f(\014le)h(is)g(restored)g(to)f(its)g(state)
+g(b)r(efore)g(de\014nition)j(mo)q(de)0 510 y(w)o(as)c(en)o(tered)i(and)f(the)
+g(\014le)h(is)g(closed.)26 b(The)17 b(main)h(reason)e(for)h(calling)i fi(ncab\
+ort)d fm(\(or)g fi(NCABOR)p fm(\))g(is)h(to)g(restore)0 572 y(the)f(netCDF)f
+(to)g(a)g(kno)o(wn)g(consistent)g(state)g(in)h(case)g(an)o(ything)g(goes)g
+(wrong)f(during)h(the)g(de\014nition)i(of)d(new)0 634 y(dimensions,)h(v)n(ari\
+ables,)g(or)e(attributes.)62 774 y(This)h(function)g(is)g(called)g(automatica\
+lly)g(if)g fi(ncclose)e fm(\(or)g fi(NCCLOS)p fm(\))g(is)i(called)g(from)f
+(de\014ne)h(mo)q(de)g(and)f(the)0 836 y(call)i(to)f(lea)o(v)o(e)g(de\014ne)i
+(mode)f(b)r(efore)f(closing)h(fails.)62 976 y(In)21 b(case)f(of)g(an)g(error,)
+g fi(ncabort)f fm(returns)h(-1;)i fi(NCABOR)d fm(returns)h(a)g(nonzero)g(v)n
+(alue)g(in)h fi(rcode)p fm(.)34 b(P)o(ossible)0 1038 y(causes)15 b(of)g(error\
+s)g(include:)37 1177 y fk(\017)30 b fm(When)16 b(called)g(from)f(de\014ne)h
+(mo)q(de)g(while)g(creating)g(a)f(netCDF,)f(deletion)i(of)f(the)g(\014le)i
+(failed.)37 1255 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i
+(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1580 y fl(nca\
+b)r(ort:)23 b(C)15 b(In)n(terface)120 1719 y fi(int)23 b(ncabort\(int)g(ncid\
+\);)0 1859 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h
+(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)62 2076 y(Here)h(is)f(an)
+h(example)g(using)g fi(ncabort)e fm(to)g(bac)o(k)h(out)g(of)g(rede\014nitions)
+i(of)e(a)g(\014le)h(named)f(`)p fi(foo.nc)p fm(':)120 2215 y fi(#include)23 b
+("netcdf.h")192 2265 y ff(:)7 b(:)g(:)120 2315 y fi(int)23 b(ncid;)192 2365 y
+ff(:)7 b(:)g(:)120 2415 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e(NC_WRITE\);)46
+b(/*)24 b(open)f(for)g(writing)g(*/)192 2464 y ff(:)7 b(:)g(:)120 2514 y fi
+(ncredef\(ncid\);)475 b(/*)24 b(enter)f(define)g(mode)g(*/)192 2564 y ff(:)7 b
+(:)g(:)120 2614 y fi(if)24 b(\(ncdimdef\(ncid,)d("lat",)i(18L\))h(==)f(-1\))
+192 2664 y(ncabort\(ncid\);)403 b(/*)24 b(define)f(failed,)g(abort)g(*/)p eop
+%%Page: 60 62
+ bop 0 -58 a fm(60)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(NCABOR:)e(F)n
+(OR)-6 b(TRAN)15 b(In)n(terface)263 320 y fi(SUBROUTINE)23 b(NCABOR\(INTEGER)
+f(NCID,)h(INTEGER)g(RCODE\))0 457 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)
+h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 532 y
+fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q
+(ccurred,)i(0)f(is)g(returned.)62 744 y(Here)h(is)f(an)h(example)g(using)g fi
+(NCABOR)e fm(to)g(bac)o(k)h(out)g(of)g(rede\014nitions)i(of)e(a)g(\014le)h
+(named)f(`)p fi(foo.nc)p fm(':)263 881 y fi(INCLUDE)23 b('netcdf.inc')335 930
+y ff(:)7 b(:)g(:)263 980 y fi(INTEGER)23 b(NCID,)g(RCODE,)g(LATID)335 1030 y
+ff(:)7 b(:)g(:)263 1080 y fi(NCID)23 b(=)h(NCOPN\('foo.nc',)e(NCWRITE,)h(RCOD\
+E\))335 1130 y ff(:)7 b(:)g(:)263 1180 y fi(CALL)23 b(NCREDF\(NCID,)g(RCODE\))
+335 1229 y ff(:)7 b(:)g(:)263 1279 y fi(LATID)23 b(=)h(NCDDEF\(NCID,)e('LAT',)
+h(18,)h(RCODE\))263 1329 y(IF)g(\(RCODE)f(.EQ.)g(-1\))h(THEN)47 b(!)23 b(dime\
+nsion)g(definition)g(failed)335 1379 y(CALL)g(NCABOR\(NCID,)f(RCODE\))47 b
+(!)24 b(abort)f(redefinitions)263 1429 y(ENDIF)335 1478 y ff(:)7 b(:)g(:)p eop
+%%Page: 61 63
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(61)0 183 y fl
+(5.10)32 b(Set)16 b(Fill)h(Mo)q(de)e(for)g(W)-6 b(rites)62 346 y fm(These)17 b
+(calls)h(are)f(in)o(tended)h(for)e(adv)m(anced)i(usage,)e(to)g(optimize)i(wri\
+tes)f(under)g(some)g(circumstances)g(de-)0 408 y(scrib)r(ed)22 b(b)r(elo)o
+(w.)40 b(The)23 b(function)g fi(ncsetfill)d fm(\(or)h fi(NCSFIL)h fm(for)f
+(F)n(OR)m(TRAN\))i(sets)e(the)h fh(\014ll)i(mo)q(de)h fm(for)c(an)0 471 y(net\
+CDF)16 b(\014le)i(op)q(en)f(for)f(writing)h(and)g(returns)f(the)h(curren)o
+(t)f(\014ll)i(mo)q(de.)25 b(The)17 b(\014ll)h(mo)q(de)f(can)f(b)r(e)h(sp)q
+(eci\014ed)h(as)0 533 y(either)g fi(NC_FILL)f fm(or)f fi(NC_NOFILL)h fm(\()p
+fi(NCFILL)f fm(or)h fi(NCNOFILL)f fm(for)h(F)n(OR)m(TRAN\).)g(The)h(default)g
+(b)r(eha)o(vior)f(corre-)0 595 y(sp)q(onding)d(to)d fi(NC_FILL)h fm(is)g(that)
+g(data)g(is)h(pre-\014lled)h(with)f(\014ll)h(v)m(alues,)f(that)f(is)h(\014ll)
+h(v)m(alues)f(are)f(written)g(when)h(y)o(ou)0 658 y(create)k(non-record)h(v)m
+(ariables)g(or)f(when)h(y)o(ou)f(write)g(a)g(v)n(alue)h(b)r(ey)n(ond)g(data)f
+(that)f(hasn't)h(b)q(een)h(written)g(y)n(et.)0 720 y(This)13 b(mak)n(es)f(it)
+g(p)r(ossible)h(to)f(detect)g(attempts)f(to)g(read)h(data)g(b)q(efore)g(it)h
+(w)n(as)f(written.)19 b(See)12 b(Section)h(7.13)e([Miss-)0 782 y(ing)18 b(V)l
+(alues],)f(page)g(115,)g(for)f(more)h(information)g(on)g(the)g(use)g(of)g(\
+\014ll)i(v)m(alues.)26 b(See)18 b(Section)g(2.3.1)d([A)o(ttribute)0 844 y(Con)
+o(v)n(en)o(tions],)g(page)g(20)g(for)f(information)i(ab)q(out)f(ho)n(w)g(to)g
+(de\014ne)h(y)o(our)f(o)n(wn)h(\014ll)g(v)n(alues.)62 1007 y(The)f(b)q(eha)o
+(vior)g(corresp)q(onding)g(to)f fi(NC_NOFILL)f fm(o)n(v)o(errides)i(the)g(def\
+ault)f(b)r(eha)o(vior)g(of)g(pre\014lling)j(data)d(with)0 1070 y(\014ll)k(v)n
+(alues.)26 b(This)18 b(can)f(b)q(e)g(used)h(to)e(enhance)i(p)r(erformance,)f
+(b)q(ecause)h(it)f(a)n(v)o(oids)h(the)f(duplicate)i(writes)e(that)0 1132 y
+(o)q(ccur)f(when)f(the)h(netCDF)e(library)i(writes)f(\014ll)i(v)m(alues)f(tha\
+t)f(are)g(immediately)h(o)o(v)o(erwritten)f(with)g(data.)62 1295 y(A)j(v)n
+(alue)h(indicating)h(whic)o(h)f(mode)g(the)f(netCDF)f(\014le)j(w)n(as)e(alrea\
+dy)g(in)h(is)g(returned.)29 b(Y)l(ou)18 b(can)g(use)h(this)0 1357 y(v)m(alue)
+14 b(to)e(temp)q(orarily)h(c)o(hange)f(the)h(\014ll)h(mo)q(de)f(of)f(an)h(op)
+q(en)g(netCDF)f(\014le)h(and)g(then)g(restore)f(it)h(to)f(the)g(previous)0
+1419 y(mo)q(de.)62 1582 y(After)i(y)o(ou)g(turn)g(on)g fi(NC_NOFILL)f fm(mo)q
+(de)i(for)e(an)i(op)q(en)g(netCDF)e(\014le,)i(y)o(ou)f(m)o(ust)g(b)q(e)h(cert\
+ain)f(to)g(write)g(v)n(alid)0 1645 y(data)k(in)i(all)g(the)f(p)q(ositions)g
+(that)g(will)h(later)f(b)r(e)g(read.)30 b(Note)19 b(that)f fi(NC_NOFILL)g fm
+(mo)q(de)h(is)g(only)h(a)e(transien)o(t)0 1707 y(prop)q(ert)o(y)g(of)f(a)g
+(netCDF)h(\014le)g(op)r(en)g(for)f(writing:)26 b(if)18 b(y)o(ou)g(close)g(and)
+g(reop)q(en)h(the)f(\014le,)h(it)f(will)h(rev)o(ert)f(to)f(the)0 1769 y(defau\
+lt)f(b)q(eha)o(vior.)k(Y)l(ou)15 b(can)h(also)f(rev)o(ert)f(to)h(the)g(defaul\
+t)h(b)q(eha)o(vior)f(b)o(y)g(calling)i fi(ncsetfill)d fm(\(or)g fi(NCSFIL)h fm
+(for)0 1831 y(F)n(OR)m(TRAN\))h(again)f(to)g(explicitly)i(set)e(the)h(\014ll)
+g(mo)q(de)g(to)e fi(NC_FILL)p fm(.)62 1994 y(There)i(are)f(three)g(situations)
+g(where)h(it)f(is)h(adv)m(an)o(tageous)f(to)f(set)h(no\014ll)i(mo)q(de:)25
+2157 y(1.)29 b(Creating)15 b(and)g(initializi)q(ng)j(a)d(netCDF)f(\014le.)21 b
+(In)16 b(this)f(case,)g(y)o(ou)g(should)h(set)f(no\014ll)h(mo)q(de)g(b)q(efor\
+e)f(calling)90 2220 y fi(ncendef)e fm(\()p fi(NCENDF)g fm(for)h(F)n(OR)m(TRAN\
+\),)g(and)g(then)h(write)f fh(completely)19 b fm(all)d(non-record)e(v)n(ariab\
+les)h(and)f(the)90 2282 y(initial)j(records)e(of)g(all)h(the)g(record)f(v)m
+(ariables)h(y)o(ou)f(w)o(an)n(t)g(to)g(initialize.)25 2383 y(2.)29 b(Extendin\
+g)23 b(an)f(existing)i(record-orien)o(ted)f(netCDF)e(\014le.)43 b(Set)22 b
+(no\014ll)i(mo)q(de)e(after)g(op)q(ening)i(the)e(\014le)90 2445 y(for)16 b
+(writing,)i(then)f(app)r(end)g(the)h(additional)g(records)f(to)f(the)h(\014le)
+h(completely)n(,)f(lea)o(ving)h(no)f(interv)n(ening)90 2507 y(un)o(written)e
+(records.)25 2608 y(3.)29 b(Adding)13 b(new)e(v)n(ariables)h(that)f(y)o(ou)g
+(are)h(going)f(to)g(initialize)k(to)c(an)g(existing)i(netCDF)d(\014le.)20 b
+(Set)12 b(no\014ll)h(mo)q(de)90 2670 y(b)r(efore)h(calling)j fi(ncendef)e fm
+(\()p fi(NCENDF)f fm(for)g(F)o(OR)m(TRAN\),)h(then)g(write)g(all)i(the)e(new)
+g(v)n(ariables)h(completely)m(.)p eop
+%%Page: 62 64
+ bop 0 -58 a fm(62)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(If)c(the)g(netC\
+DF)f(\014le)h(has)g(an)f(unlimited)j(dimension)g(and)d(the)h(last)g(record)f
+(w)o(as)g(written)h(while)h(in)f fi(NC_NOFILL)0 246 y fm(mo)q(de,)21 b(then)f
+(the)g(\014le)h(will)h(b)q(e)e(4)g(b)o(ytes)g(longer)g(than)g(if)g fi(NC_NOFI\
+LL)f fm(mo)q(de)h(w)o(asn't)f(set,)h(but)g(this)h(will)g(b)r(e)0 308 y(comple\
+tely)c(transparen)n(t)e(if)g(y)o(ou)g(access)h(the)f(data)f(only)i(through)f
+(the)g(netCDF)g(in)o(terfaces.)62 448 y(In)j(case)g(of)f(an)g(error,)g fi(ncs\
+etfill)f fm(returns)h(-1;)h fi(NCSFIL)f fm(returns)g(a)g(nonzero)g(v)n(alue)h
+(in)g fi(rcode)p fm(.)26 b(P)o(ossible)0 510 y(causes)15 b(of)g(errors)g(incl\
+ude:)37 651 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q
+(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)37 729 y fk(\017)30 b
+fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(refers)f(to)f(a)h(\014le)h(op)q
+(en)g(for)f(read-only)h(access.)37 807 y fk(\017)30 b fm(The)18 b(\014llmo)r
+(de)g(argumen)n(t)f(is)h(neither)g fi(NC_NOFILL)e fm(nor)i fi(NC_FILL)e fm
+(\(neither)i fi(NCNOFILL)e fm(nor)h fi(NCFILL)g fm(for)90 869 y(F)n(OR)m(TRAN\
+\).)0 1202 y fl(ncset\014ll:)24 b(C)14 b(In)n(terface)120 1343 y fi(int)23 b
+(ncsetfill\(int)g(ncid,)g(int)g(fillmode\);)0 1483 y(ncid)144 b fm(NetCDF)14 b
+(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi
+(nccreate)p fm(.)0 1561 y fi(fillmode)48 b fm(Desired)16 b(\014ll)h(mode)f
+(for)f(the)g(\014le,)h(either)g fi(NC_NOFILL)e fm(or)g fi(NC_FILL)p fm(.)0
+1639 y fi(ncsetfill)240 1717 y fm(Returns)h(the)g(curren)o(t)g(\014ll)h(mo)q
+(de)f(of)f(the)h(\014le)h(b)r(efore)e(this)h(call,)h(either)g fi(NC_NOFILL)d
+fm(or)h fi(NC_FILL)p fm(.)62 1936 y(Here)j(is)g(an)g(example)g(using)g fi(ncs\
+etfill)f fm(to)g(set)g(no\014ll)i(mo)q(de)f(for)f(subsequent)g(writes)h(of)f
+(a)g(netCDF)g(\014le)0 1998 y(named)f(`)p fi(foo.nc)p fm(':)120 2139 y fi(#in\
+clude)23 b("netcdf.h")192 2188 y ff(:)7 b(:)g(:)120 2238 y fi(int)23 b(ncid;)
+192 2288 y ff(:)7 b(:)g(:)120 2338 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e(NC_\
+WRITE\);)46 b(/*)24 b(open)f(for)g(writing)g(*/)192 2438 y ff(:)7 b(:)g(:)238
+b fi(/*)24 b(write)f(data)g(with)h(default)f(prefilling)f(behavior)h(*/)120
+2537 y(ncsetfill\(ncid,)f(NC_NOFILL\);)141 b(/*)24 b(set)g(nofill)f(mode)g
+(*/)192 2637 y ff(:)7 b(:)g(:)238 b fi(/*)24 b(write)f(data)g(with)h(no)f(pre\
+filling)g(*/)p eop
+%%Page: 63 65
+ bop 0 -58 a fm(Chapter)15 b(5:)k(NetCDF)c(Op)r(erations)1269 b(63)0 183 y fl
+(NCSFIL:)15 b(F)n(OR)-6 b(TRAN)15 b(In)n(terface)263 320 y fi(INTEGER)23 b
+(FUNCTION)g(NCSFIL\(INTEGER)f(NCID,)h(INTEGER)g(FILLMODE,)239 370 y(+)573 b
+(INTEGER)23 b(RCODE\))0 507 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)
+e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 582 y fi
+(FILLMODE)48 b fm(Desired)16 b(\014ll)h(mode)f(for)f(the)g(\014le,)h(either)g
+fi(NCNOFILL)e fm(or)g fi(NCFILL)p fm(.)0 656 y fi(RCODE)120 b fm(Returned)16 b
+(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)0
+731 y fi(NCSFIL)96 b fm(Returns)16 b(the)f(curren)o(t)g(\014ll)i(mo)q(de)e
+(of)g(the)g(\014le)i(b)q(efore)e(this)h(call,)g(either)g fi(NCNOFILL)e fm(or)
+g fi(NCFILL)p fm(.)62 943 y(Here)i(is)f(an)h(example)g(using)g fi(NCSFIL)e fm
+(to)g(set)h(no\014ll)i(mo)q(de)e(for)g(a)g(netCDF)f(\014le)j(named)e(`)p fi
+(foo.nc)p fm(':)263 1080 y fi(INCLUDE)23 b('netcdf.inc')335 1130 y ff(:)7 b
+(:)g(:)263 1180 y fi(INTEGER)23 b(NCID,)g(RCODE,)g(OMODE)335 1229 y ff(:)7 b
+(:)g(:)263 1279 y fi(NCID)23 b(=)h(NCOPN\('foo.nc',)e(NCWRITE,)h(RCODE\))335
+1329 y ff(:)7 b(:)g(:)120 1379 y fi(*)24 b(write)f(data)g(with)h(default)e
+(prefilling)h(behavior)335 1429 y ff(:)7 b(:)g(:)263 1478 y fi(OMODE)23 b(=)h
+(NCSFIL\(NCID,)e(NCNOFILL,)h(RCODE\))335 1528 y ff(:)7 b(:)g(:)120 1578 y fi
+(*)24 b(write)f(data)g(with)h(no)f(prefilling)335 1628 y ff(:)7 b(:)g(:)p eop
+%%Page: 64 66
+ bop 0 -58 a fm(64)1465 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 65 67
+ bop 0 -58 a fm(Chapter)15 b(6:)k(Dimensions)1447 b(65)0 183 y fj(6)41 b(Dime\
+nsions)62 370 y fm(Dimensions)17 b(for)f(a)g(netCDF)f(\014le)i(are)f(de\014ne\
+d)h(when)g(it)f(is)g(created,)g(while)i(the)e(netCDF)f(\014le)i(is)g(in)g(de\
+\014ne)0 432 y(mo)q(de.)j(Additional)15 b(dimensions)g(ma)n(y)e(b)r(e)g(added)
+h(later)f(b)o(y)h(reen)o(tering)f(de\014ne)i(mo)q(de.)k(A)14 b(netCDF)e(dimen\
+sion)0 495 y(has)k(a)f(name)h(and)g(a)g(size.)23 b(A)n(t)16 b(most)f(one)h
+(dimension)h(in)g(a)f(netCDF)f(\014le)i(can)f(ha)o(v)n(e)g(the)g fi(NC_UNLIMI\
+TED)e fm(size,)0 557 y(which)k(means)h(a)f(v)n(ariable)h(using)g(this)g(dimen\
+sion)i(can)d(gro)n(w)h(to)e(an)o(y)i(length)g(\(like)f(a)h(record)f(n)o(um)o
+(b)q(er)h(in)g(a)0 619 y(\014le\).)62 756 y(There)d(is)g(a)g(suggested)f(limi\
+t)i(\(curren)o(tly)f(32\))f(to)g(the)h(n)o(um)o(b)q(er)g(of)f(dimensions)j
+(that)c(can)i(b)r(e)g(de\014ned)h(in)f(a)0 818 y(single)g(netCDF)e(\014le.)21
+b(The)15 b(limit)h(is)f(the)g(v)m(alue)g(of)g(the)f(prede\014ned)j(macro)d fi
+(MAX_NC_DIMS)f fm(\(MAXNCDIM)h(for)0 881 y(F)n(OR)m(TRAN\).)i(The)f(purp)r
+(ose)h(of)f(the)g(limit)i(is)f(to)f(mak)n(e)h(writing)g(generic)g(application\
+s)h(simpler.)22 b(They)16 b(need)0 943 y(only)f(pro)n(vide)g(an)f(arra)n(y)g
+(of)g fi(MAX_NC_DIMS)f fm(dimensions)i(to)f(handle)h(an)o(y)f(netCDF)g(\014le\
+.)20 b(The)15 b(implementation)0 1005 y(of)21 b(the)g(netCDF)g(library)h(do)q
+(es)f(not)g(enforce)g(this)h(advisory)f(maximium,)i(so)e(it)h(is)f(p)r(ossibl\
+e)h(to)f(use)g(more)0 1067 y(dimensions,)f(if)e(necessary;)h(just)f(don't)f
+(exp)r(ect)h(generic)h(applications)g(or)f(netCDF)f(utilities)j(to)d(b)r(e)h
+(able)h(to)0 1130 y(handle)d(the)g(resulting)g(netCDF)f(\014les.)62 1267 y
+(Ordinarily)o(,)f(the)g(name)h(and)g(size)g(of)f(a)g(dimension)i(are)f(\014xe\
+d)g(when)g(the)f(dimension)j(is)e(\014rst)f(de\014ned.)21 b(The)0 1329 y(name)
+c(ma)o(y)g(b)r(e)g(c)o(hanged)h(later,)g(but)f(the)h(size)g(of)f(a)g(dimensio\
+n)i(cannot)f(b)q(e)g(c)o(hanged)g(without)f(cop)o(ying)h(the)0 1391 y(netCDF)
+d(to)f(a)h(new)g(netCDF)g(with)g(a)g(rede\014ned)i(dimension)g(size.)62 1528 y
+(Dimension)i(sizes)g(in)f(the)g(C)g(interface)f(are)g(t)o(yp)q(e)h fi(long)g
+fm(rather)f(than)g(t)o(yp)q(e)h fi(int)g fm(to)f(mak)n(e)h(it)g(p)r(ossible)h
+(to)0 1590 y(access)d(all)h(the)f(data)f(in)i(a)e(netCDF)g(\014le)i(on)f(a)g
+(platform)f(that)g(only)i(supp)r(orts)e(a)g(16-bit)h fi(int)g fm(data)f(t)n
+(yp)r(es,)h(for)0 1653 y(example)f(MSDOS.)f(If)h(dimension)g(sizes)g(w)o(ere)
+f(t)o(yp)q(e)h fi(int)e fm(instead,)i(it)f(w)o(ould)h(not)f(b)q(e)h(p)q(ossib\
+le)h(to)d(access)i(data)0 1715 y(from)f(v)n(ariables)i(with)f(a)g(dimension)i
+(size)f(greater)f(than)g(a)g(16-bit)g fi(int)g fm(can)g(accommo)q(date.)62
+1852 y(Op)r(erations)g(supp)r(orted)g(on)g(dimensions)i(are:)37 1989 y fk(\
+\017)30 b fm(Create)15 b(a)f(dimension,)j(giv)o(en)f(its)f(name)g(and)h(size.)
+37 2064 y fk(\017)30 b fm(Get)15 b(a)g(dimension)h(ID)g(from)e(its)i(name.)37
+2138 y fk(\017)30 b fm(Get)15 b(a)g(dimension's)h(name)f(and)h(size)g(from)e
+(its)i(ID.)37 2213 y fk(\017)30 b fm(Rename)16 b(a)f(dimension.)p eop
+%%Page: 66 68
+ bop 0 -58 a fm(66)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(6.1)33 b(Crea\
+te)14 b(a)h(Dimension)62 329 y fm(The)h(function)h fi(ncdimdef)d fm(\(or)h fi
+(NCDDEF)g fm(for)g(F)n(OR)m(TRAN\))h(adds)g(a)f(new)h(dimension)i(to)d(an)g
+(op)r(en)h(netCDF)0 391 y(\014le)f(in)g(de\014ne)h(mo)q(de.)j(It)c(returns)f
+(a)g(dimension)i(ID,)e(giv)o(en)g(the)h(netCDF)e(ID,)h(the)g(dimension)i(name\
+,)e(and)h(the)0 453 y(dimension)g(size.)20 b(A)o(t)13 b(most)g(one)g(unlimite\
+d)j(size)f(dimension,)g(called)g(the)e(record)h(dimension,)h(ma)n(y)e(b)r(e)h
+(de\014ned)0 516 y(for)h(eac)n(h)h(netCDF)e(\014le.)62 661 y(In)20 b(case)e
+(of)h(an)f(error,)h fi(ncdimdef)e fm(returns)i(-1;)h fi(NCDDEF)e fm(returns)g
+(a)h(nonzero)g(v)m(alue)h(in)f fi(rcode)p fm(.)30 b(P)o(ossible)0 724 y(cause\
+s)15 b(of)g(errors)g(include:)37 869 y fk(\017)30 b fm(The)15 b(netCDF)g(\014\
+le)h(is)g(not)f(in)h(de\014nition)h(mo)q(de.)37 953 y fk(\017)30 b fm(The)15 b
+(sp)r(eci\014ed)i(dimension)g(name)e(is)h(the)f(name)g(of)g(another)g(existin\
+g)h(dimension.)37 1036 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(size)f(is)
+g(not)e(greater)h(than)g(zero.)37 1119 y fk(\017)30 b fm(The)19 b(sp)q(eci\
+\014ed)i(size)e(is)g(unlimited,)j(but)c(there)h(is)g(already)g(an)g(unlimited)
+i(size)e(dimension)i(de\014ned)f(for)90 1182 y(this)c(netCDF)e(\014le.)37 1265
+y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(ref\
+er)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1650 y fl(ncdimdef:)23 b(C)15 b
+(In)n(terface)120 1796 y fi(int)23 b(ncdimdef\(int)g(ncid,)g(const)g(char*)g
+(name,)g(long)h(size\);)0 1942 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h
+(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0
+2025 y fi(name)144 b fm(Dimension)18 b(name.)24 b(Must)16 b(b)q(egin)h(with)g
+(an)g(alphab)r(etic)g(c)o(haracter,)f(follo)o(w)o(ed)h(b)o(y)f(zero)g(or)g
+(more)240 2087 y(alphanumeric)g(c)o(haracters)e(including)k(the)d(underscore)
+h(\(`)p fi(_)p fm('\).)i(Case)d(is)h(signi\014cant.)0 2171 y fi(size)144 b fm
+(Size)15 b(of)f(dimension;)i(that)d(is,)i(n)o(um)o(b)q(er)f(of)g(v)m(alues)h
+(for)f(this)g(dimension)i(as)e(an)g(index)h(to)f(v)m(ariables)240 2233 y(that)
+j(use)g(it.)27 b(This)18 b(should)g(b)q(e)g(either)g(a)f(p)q(ositive)g(intege\
+r)g(\(of)f(t)o(yp)q(e)i fi(long)p fm(\))e(or)h(the)g(prede\014ned)240 2295 y
+(constan)o(t)d fi(NC_UNLIMITED)p fm(.)62 2524 y(Here)k(is)h(an)e(example)i
+(using)g fi(ncdimdef)d fm(to)h(create)h(a)f(dimension)j(named)e fi(lat)f fm
+(of)h(size)g(18)g(and)g(a)f(record)0 2587 y(dimension)g(named)e fi(rec)g fm
+(in)h(a)f(new)g(netCDF)g(\014le)h(named)g(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 67 69
+ bop 0 -58 a fm(Chapter)15 b(6:)k(Dimensions)1447 b(67)120 183 y fi(#include)
+23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(int)23 b(ncid,)h(latid,)
+f(recid;)192 333 y ff(:)7 b(:)g(:)120 382 y fi(ncid)23 b(=)h(nccreate\("foo.n\
+c",)d(NC_NOCLOBBER\);)192 432 y ff(:)7 b(:)g(:)120 482 y fi(latid)23 b(=)h
+(ncdimdef\(ncid,)e("lat",)h(18L\);)120 532 y(recid)g(=)h(ncdimdef\(ncid,)e
+("rec",)h(NC_UNLIMITED\);)0 823 y fl(NCDDEF:)13 b(F)n(OR)-6 b(TRAN)15 b(In)n
+(terface)263 960 y fi(INTEGER)23 b(FUNCTION)g(NCDDEF)g(\(INTEGER)g(NCID,)239
+1009 y(+)454 b(CHARACTER*\(*\))22 b(DIMNAM,)239 1059 y(+)454 b(INTEGER)22 b
+(DIMSIZ,)239 1109 y(+)454 b(INTEGER)22 b(RCODE\))0 1246 y(NCID)144 b fm(NetCD\
+F)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h
+fi(NCCRE)p fm(.)0 1321 y fi(DIMNAM)96 b fm(Dimension)18 b(name.)24 b(Must)16 b
+(b)q(egin)h(with)g(an)g(alphab)r(etic)g(c)o(haracter,)f(follo)o(w)o(ed)h(b)o
+(y)f(zero)g(or)g(more)240 1383 y(alphanumeric)g(c)o(haracters)e(including)k
+(the)d(underscore)h(\(`)p fi(_)p fm('\).)i(Case)d(is)h(signi\014cant.)0 1458 y
+fi(DIMSIZ)96 b fm(Size)15 b(of)f(dimension;)i(that)d(is,)i(n)o(um)o(b)q(er)f
+(of)g(v)m(alues)h(for)f(this)g(dimension)i(as)e(an)g(index)h(to)f(v)m(ariable\
+s)240 1520 y(that)d(use)i(it.)19 b(This)12 b(should)h(b)r(e)f(either)h(a)f
+(p)q(ositiv)o(e)h(in)o(teger)f(or)f(the)h(prede\014ned)i(constan)o(t)d fi(NCU\
+NLIM)p fm(.)0 1595 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b
+(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 1806 y(Here)21 b(is)
+g(an)g(example)g(using)h fi(NCDDEF)d fm(to)h(create)h(a)f(dimension)i(named)f
+fi(lat)f fm(of)g(size)i(18)e(and)h(a)f(record)0 1869 y(dimension)d(named)e fi
+(rec)g fm(in)h(a)f(new)g(netCDF)g(\014le)h(named)g(`)p fi(foo.nc)p fm(':)263
+2006 y fi(INCLUDE)23 b('netcdf.inc')335 2055 y ff(:)7 b(:)g(:)263 2105 y fi
+(INTEGER)23 b(NCID,)g(RCODE,)g(LATID,)g(RECID)335 2155 y ff(:)7 b(:)g(:)263
+2205 y fi(NCID)23 b(=)h(NCCRE\('foo.nc',)e(NCNOCLOB,)h(RCODE\))335 2255 y ff
+(:)7 b(:)g(:)263 2305 y fi(LATID)23 b(=)h(NCDDEF\(NCID,)e('lat',)h(18,)h(RCOD\
+E\))263 2354 y(RECID)f(=)h(NCDDEF\(NCID,)e('rec',)h(NCUNLIM,)g(RCODE\))p eop
+%%Page: 68 70
+ bop 0 -58 a fm(68)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(6.2)33 b(Get)
+14 b(a)h(Dimension)h(ID)f(from)f(Its)h(Name)62 322 y fm(The)h(function)f fi
+(ncdimid)g fm(\(or)f fi(NCDID)g fm(for)g(F)o(OR)m(TRAN\))h(returns)g(the)g
+(ID)g(of)g(a)g(netCDF)f(dimension,)i(given)0 384 y(the)g(name)h(of)f(the)g
+(dimension.)25 b(If)16 b fi(ndims)g fm(is)h(the)f(n)o(um)o(b)r(er)g(of)g(dime\
+nsions)i(de\014ned)f(for)f(a)g(netCDF)g(\014le,)h(eac)o(h)0 447 y(dimension)g
+(has)e(an)g(ID)g(b)r(et)o(w)n(een)h fi(0)f fm(and)g fi(ndims-1)f fm(\(or)h fi
+(1)g fm(and)g fi(ndims)g fm(for)f(F)o(OR)m(TRAN\).)62 585 y(In)g(case)f(of)g
+(an)g(error,)g fi(ncdimid)f fm(returns)h(-1;)h fi(NCDID)e fm(returns)h(a)g
+(nonzero)h(v)m(alue)g(in)g fi(rcode)p fm(.)19 b(P)n(ossible)c(causes)0 648 y
+(of)g(errors)f(include:)37 787 y fk(\017)30 b fm(The)13 b(name)f(that)g(w)n
+(as)g(sp)r(eci\014ed)i(is)f(not)f(the)g(name)g(of)g(an)o(y)g(currently)g(de\
+\014ned)i(dimension)g(in)f(the)g(netCDF)90 849 y(\014le.)37 925 y fk(\017)30 b
+fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g
+(op)q(en)g(netCDF)g(\014le.)0 1243 y fl(ncdimid:)25 b(C)14 b(In)n(terface)120
+1382 y fi(int)23 b(ncdimid\(int)g(ncid,)g(const)g(char*)g(name\);)0 1521 y
+(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f
+fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1597 y fi(name)144 b fm(Dimension)20
+b(name,)g(a)e(c)o(haracter)g(string)h(b)r(eginning)h(with)f(a)g(letter)g(and)
+g(follo)o(w)o(ed)g(b)o(y)g(an)o(y)g(se-)240 1660 y(quence)14 b(of)f(letters,)
+g(digits,)i(or)d(underscore)i(\(`)p fi(_)p fm('\))e(c)o(haracters.)18 b(Case)
+13 b(is)h(signi\014cant)f(in)h(dimension)240 1722 y(names.)62 1937 y(Here)k
+(is)f(an)h(example)g(using)f fi(ncdimid)g fm(to)f(determine)i(the)g(dimension)
+h(ID)e(of)g(a)f(dimension)j(named)f fi(lat)p fm(,)0 2000 y(assumed)d(to)g(ha)
+o(v)n(e)h(b)q(een)g(de\014ned)h(previously)f(in)g(an)f(existing)h(netCDF)f
+(\014le)h(named)g(`)p fi(foo.nc)p fm(':)120 2138 y fi(#include)23 b("netcdf.h\
+")192 2188 y ff(:)7 b(:)g(:)120 2238 y fi(int)23 b(ncid,)h(latid;)192 2288 y
+ff(:)7 b(:)g(:)120 2338 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e(NC_NOWRITE\);)
+46 b(/*)23 b(open)h(for)f(reading)g(*/)192 2387 y ff(:)7 b(:)g(:)120 2437 y fi
+(latid)23 b(=)h(ncdimid\(ncid,)e("lat"\);)0 2670 y fl(NCDID:)13 b(F)n(OR)-6 b
+(TRAN)15 b(In)n(terface)p eop
+%%Page: 69 71
+ bop 0 -58 a fm(Chapter)15 b(6:)k(Dimensions)1447 b(69)263 183 y fi(INTEGER)
+23 b(FUNCTION)g(NCDID)g(\(INTEGER)g(NCID,)239 233 y(+)573 b(CHARACTER*\(*\))
+22 b(DIMNAME,)239 283 y(+)573 b(INTEGER)23 b(RCODE\))0 420 y(NCID)144 b fm
+(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm
+(or)h fi(NCCRE)p fm(.)0 495 y fi(DIMNAME)72 b fm(Dimension)20 b(name,)g(a)e
+(c)o(haracter)g(string)h(b)r(eginning)h(with)f(a)g(letter)g(and)g(follo)o(w)o
+(ed)g(b)o(y)g(an)o(y)g(se-)240 557 y(quence)14 b(of)f(letters,)g(digits,)i
+(or)d(underscore)i(\(`)p fi(_)p fm('\))e(c)o(haracters.)18 b(Case)13 b(is)h
+(signi\014cant)f(in)h(dimension)240 619 y(names.)0 694 y fi(RCODE)120 b fm
+(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f
+(is)g(returned.)62 906 y(Here)21 b(is)g(an)f(example)h(using)g fi(NCDID)f fm
+(to)g(determine)h(the)g(dimension)h(ID)e(of)g(a)g(dimension)i(named)f fi(lat)
+p fm(,)0 968 y(assumed)15 b(to)g(ha)o(v)n(e)h(b)q(een)g(de\014ned)h(previousl\
+y)f(in)g(an)f(existing)h(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm(':)263
+1105 y fi(INCLUDE)23 b('netcdf.inc')335 1155 y ff(:)7 b(:)g(:)263 1204 y fi
+(INTEGER)23 b(NCID,)g(RCODE,)g(LATID)335 1254 y ff(:)7 b(:)g(:)263 1304 y fi
+(NCID)23 b(=)h(NCOPN\('foo.nc',)e(NCNOWRIT,)h(RCODE\))335 1354 y ff(:)7 b(:)g
+(:)263 1404 y fi(LATID)23 b(=)h(NCDID\(NCID,)e('lat',)h(RCODE\))p eop
+%%Page: 70 72
+ bop 0 -58 a fm(70)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(6.3)33 b(Inqu\
+ire)17 b(ab)r(out)e(a)g(Dimension)62 331 y fm(The)i(function)g fi(ncdiminq)e
+fm(\(or)g fi(NCDINQ)h fm(for)g(F)n(OR)m(TRAN\))g(returns)h(the)f(name)g(and)h
+(size)g(of)f(a)g(dimension,)0 393 y(giv)o(en)k(its)f(ID.)g(The)g(size)h(for)f
+(the)g(unlimited)i(dimension,)h(if)d(an)o(y)l(,)h(is)g(the)f(maxim)o(um)g(v)m
+(alue)h(used)g(so)f(far)f(in)0 455 y(writing)e(data)e(for)h(that)f(dimension)
+j(\(which)e(is)h(the)f(same)g(as)g(the)g(curren)o(t)g(maxim)o(um)g(record)g
+(n)o(um)o(b)r(er\).)62 603 y(In)20 b(case)e(of)h(an)f(error,)h fi(ncdiminq)e
+fm(returns)i(-1;)h fi(NCDINQ)e fm(returns)g(a)h(nonzero)g(v)m(alue)h(in)f fi
+(rcode)p fm(.)30 b(P)o(ossible)0 665 y(causes)15 b(of)g(errors)g(include:)37
+813 y fk(\017)30 b fm(The)15 b(dimension)i(ID)f(is)f(inv)m(alid)i(for)d(the)i
+(sp)q(eci\014ed)h(netCDF)d(\014le.)37 898 y fk(\017)30 b fm(The)15 b(sp)r(eci\
+\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g
+(\014le.)0 1303 y fl(ncdiminq:)25 b(C)15 b(In)n(terface)120 1450 y fi(int)23 b
+(ncdiminq\(int)g(ncid,)g(int)g(dimid,)g(char*)h(name,)f(long*)g(size\);)0 1598
+y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)
+f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1683 y fi(dimid)120 b fm(Dimension)
+16 b(ID,)f(as)g(returned)h(from)e(a)h(previous)h(call)g(to)f fi(ncdimid)f fm
+(or)h fi(ncdimdef)p fm(.)0 1768 y fi(name)144 b fm(Returned)15 b(dimension)h
+(name.)k(The)14 b(caller)i(m)n(ust)e(allo)r(cate)g(space)h(for)e(the)i(return\
+ed)f(name.)20 b(The)240 1831 y(maxim)o(um)12 b(p)q(ossible)h(length,)g(in)g
+(c)o(haracters,)e(of)g(a)h(dimension)h(name)f(is)g(given)g(b)o(y)f(the)h(pred\
+e\014ned)240 1893 y(constan)o(t)k fi(MAX_NC_NAME)p fm(.)22 b(If)17 b(the)g
+(name)f(parameter)g(is)h(giv)o(en)g(as)f(`)p fi(\(char)e(*\))h(0)p fm(',)h
+(no)h(name)f(will)240 1955 y(b)r(e)f(returned)g(so)g(no)g(space)h(needs)g(to)
+e(b)r(e)h(allo)r(cated.)0 2041 y fi(size)144 b fm(Returned)14 b(size)h(of)e
+(dimension.)21 b(F)l(or)12 b(the)i(unlimited)i(dimension,)f(this)e(is)h(the)g
+(curren)o(t)f(maxim)o(um)240 2103 y(v)m(alue)k(used)g(for)e(writing)h(an)o
+(y)g(v)n(ariables)g(with)h(this)f(dimension,)h(that)f(is)g(the)g(maxim)o(um)g
+(record)240 2165 y(n)o(um)o(b)q(er.)k(If)14 b(this)h(parameter)f(is)g(giv)o
+(en)h(as)f(`)p fi(\(long)g(*\))h(0)p fm(',)e(the)i(size)g(will)h(not)e(b)q
+(e)h(returned,)f(so)g(no)240 2227 y(space)h(for)g(this)h(information)f(need)h
+(b)r(e)f(declared)h(or)f(allo)r(cated.)62 2460 y(Here)j(is)g(an)f(example)h
+(using)g fi(ncdiminq)e fm(to)h(determine)h(the)g(size)g(of)f(a)g(dimension)i
+(named)e fi(lat)p fm(,)g(and)h(the)0 2522 y(name)13 b(and)h(curren)o(t)f(maxi\
+m)o(um)g(size)h(of)f(the)g(unlimited)i(\(or)e(record\))g(dimension)i(for)d
+(an)h(existing)h(netCDF)f(\014le)0 2585 y(named)i(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 71 73
+ bop 0 -58 a fm(Chapter)15 b(6:)k(Dimensions)1447 b(71)120 183 y fi(#include)
+23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(int)23 b(ncid,)h(latid,)
+f(ndims,)g(nvars,)g(ngatts,)g(recid;)120 333 y(long)g(latsize,)g(recs;)120 382
+y(char)g(recname[MAX_NC_NAME];)192 432 y ff(:)7 b(:)g(:)120 482 y fi(ncid)23 b
+(=)h(ncopen\("foo.nc",)e(NC_NOWRITE\);)46 b(/*)23 b(open)h(for)f(reading)g
+(*/)192 532 y ff(:)7 b(:)g(:)120 582 y fi(latid)23 b(=)h(ncdimid\(ncid,)e("la\
+t"\);)120 632 y(/*)i(get)f(lat)g(size,)h(but)f(don't)g(get)h(name,)f(since)g
+(we)h(already)f(know)g(it)h(*/)120 681 y(ncdiminq\(ncid,)e(latid,)h(\(char)g
+(*\))h(0,)f(&latsize\);)120 731 y(/*)h(get)f(ID)h(of)f(record)g(dimension)g
+(\(among)g(other)g(things\))g(*/)120 781 y(ncinquire\(ncid,)f(&ndims,)h(&nvar\
+s,)g(&ngatts,)f(&recid\);)120 831 y(/*)i(get)f(record)g(dimension)g(name)g
+(and)g(current)g(size)h(*/)120 881 y(ncdiminq\(ncid,)e(recid,)h(recname,)g
+(&recs\);)0 1261 y fl(NCDINQ:)13 b(F)n(OR)-6 b(TRAN)15 b(In)n(terface)263 1406
+y fi(SUBROUTINE)23 b(NCDINQ)g(\(INTEGER)f(NCID,)i(INTEGER)f(DIMID,)239 1456 y
+(+)454 b(CHARACTER*\(*\))22 b(DIMNAM,)h(INTEGER)f(DIMSIZ,)239 1506 y(+)454 b
+(INTEGER)22 b(RCODE\))0 1651 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)h(fro\
+m)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 1735 y fi
+(DIMID)120 b fm(Dimension)16 b(ID,)f(as)g(returned)h(from)e(a)h(previous)h
+(call)g(to)f fi(NCDID)f fm(or)h fi(NCDDEF)p fm(.)0 1818 y fi(DIMNAM)96 b fm
+(Returned)15 b(dimension)h(name.)k(The)14 b(caller)i(m)n(ust)e(allo)r(cate)g
+(space)h(for)e(the)i(returned)f(name.)20 b(The)240 1880 y(maxim)o(um)12 b(p)q
+(ossible)h(length,)g(in)g(c)o(haracters,)e(of)g(a)h(dimension)h(name)f(is)g
+(given)g(b)o(y)f(the)h(prede\014ned)240 1942 y(constan)o(t)i fi(MAXNCNAM)p fm
+(.)0 2026 y fi(DIMSIZ)96 b fm(Returned)14 b(size)h(of)e(dimension.)21 b(F)l
+(or)12 b(the)i(unlimited)i(dimension,)f(this)e(is)h(the)g(curren)o(t)f(maxim)
+o(um)240 2088 y(v)m(alue)k(used)g(for)e(writing)h(an)o(y)g(v)n(ariables)g(wit\
+h)h(this)f(dimension,)h(that)f(is)g(the)g(maxim)o(um)g(record)240 2150 y(n)o
+(um)o(b)q(er.)0 2233 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b
+(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 2462 y(Here)21 b(is)
+g(an)f(example)h(using)g fi(NCDINQ)e fm(to)h(determine)h(the)f(size)i(of)d
+(a)h(dimension)i(named)f fi(lat)p fm(,)f(and)h(the)0 2524 y(name)13 b(and)h
+(curren)o(t)f(maxim)o(um)g(size)h(of)f(the)g(unlimited)i(\(or)e(record\))g
+(dimension)i(for)d(an)h(existing)h(netCDF)f(\014le)0 2587 y(named)i(`)p fi
+(foo.nc)p fm(':)p eop
+%%Page: 72 74
+ bop 0 -58 a fm(72)1465 b(NetCDF)14 b(User's)h(Guide)263 183 y fi(INCLUDE)23 b
+('netcdf.inc')335 233 y ff(:)7 b(:)g(:)263 283 y fi(INTEGER)23 b(NCID,)g(RCOD\
+E,)g(LATID,)g(LATSIZ)263 333 y(INTEGER)g(NDIMS,)g(NVARS,)g(NGATTS,)g(RECID,)g
+(NRECS)120 382 y(*)h(31)f(in)h(following)f(statement)f(is)i(parameter)e(MAXNC\
+NAM)263 432 y(CHARACTER*31)g(LATNAM,)h(RECNAM)335 482 y ff(:)7 b(:)g(:)263 532
+y fi(NCID)23 b(=)h(NCOPN\('foo.nc',)e(NCNOWRIT,)h(RCODE\))335 582 y ff(:)7 b
+(:)g(:)263 632 y fi(LATID)23 b(=)h(NCDID\(NCID,)e('lat',)h(RCODE\))120 681 y
+(*)h(get)f(lat)h(name)f(and)g(size,)h(\(even)f(though)g(we)g(already)g(know)h
+(name\))263 731 y(CALL)f(NCDINQ\(NCID,)g(LATID,)g(LATNAM,)g(LATSIZ,)g(RCODE\))
+120 781 y(*)h(get)f(ID)h(of)f(record)g(dimension)g(\(among)g(other)g(things\))
+263 831 y(CALL)g(NCINQ\(NCID,)g(NDIMS,)g(NVARS,)g(NGATTS,)g(RECID,)g(RCODE\))
+120 881 y(*)h(get)f(record)g(dimension)g(name)g(and)h(current)f(size)263 930 y
+(CALL)g(NCDINQ\(NCID,)g(RECID,)g(RECNAME,)g(NRECS,)g(RCODE\))p eop
+%%Page: 73 75
+ bop 0 -58 a fm(Chapter)15 b(6:)k(Dimensions)1447 b(73)0 183 y fl(6.4)33 b
+(Rename)14 b(a)h(Dimension)62 324 y fm(The)22 b(function)h fi(ncdimrename)d fm
+(\(or)h fi(NCDREN)f fm(for)h(F)o(OR)m(TRAN\))h(renames)f(an)h(existing)g(dime\
+nsion)i(in)e(a)0 386 y(netCDF)15 b(\014le)j(op)q(en)f(for)e(writing.)23 b(If)
+17 b(the)f(new)g(name)h(is)f(longer)h(than)f(the)g(old)h(name,)f(the)g(netCDF)
+g(m)n(ust)g(b)r(e)0 448 y(in)g(de\014ne)g(mo)q(de.)k(Y)m(ou)15 b(cannot)g(ren\
+ame)g(a)g(dimension)i(to)d(ha)o(v)o(e)h(the)h(same)e(name)i(as)e(another)h
+(dimension.)62 588 y(In)g(case)g(of)f(an)h(error,)e fi(ncdimrename)g fm(retur\
+ns)i(-1;)f fi(NCDREN)g fm(returns)g(a)g(nonzero)h(v)m(alue)h(in)f fi(rcode)p
+fm(.)k(P)o(ossible)0 651 y(causes)c(of)g(errors)g(include:)37 791 y fk(\017)
+30 b fm(The)15 b(new)h(name)f(is)h(the)f(name)g(of)g(another)g(dimension.)37
+869 y fk(\017)30 b fm(The)15 b(dimension)i(ID)f(is)f(inv)m(alid)i(for)d(the)i
+(sp)q(eci\014ed)h(netCDF)d(\014le.)37 947 y fk(\017)30 b fm(The)15 b(sp)r(eci\
+\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g
+(\014le.)0 1280 y fl(ncdimrename:)24 b(C)14 b(In)n(terface)120 1420 y fi(int)
+23 b(ncdimrename\(int)f(ncid,)h(int)h(dimid,)f(const)g(char*)g(name\);)0 1560
+y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)
+f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1638 y fi(dimid)120 b fm(Dimension)
+16 b(ID,)f(as)g(returned)h(from)e(a)h(previous)h(call)g(to)f fi(ncdimid)f fm
+(or)h fi(ncdimdef)p fm(.)0 1716 y fi(name)144 b fm(New)15 b(dimension)i(name.)
+62 1935 y(Here)d(is)g(an)f(example)h(using)g fi(ncdimrename)e fm(to)g(rename)
+i(the)f(dimension)i fi(lat)e fm(to)f fi(latitude)h fm(in)h(an)f(existing)0
+1997 y(netCDF)i(\014le)h(named)f(`)p fi(foo.nc)p fm(':)120 2137 y fi(#include)
+23 b("netcdf.h")192 2187 y ff(:)7 b(:)g(:)120 2237 y fi(int)23 b(ncid,)h(lati\
+d;)192 2287 y ff(:)7 b(:)g(:)120 2337 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e
+(NC_WRITE\);)46 b(/*)24 b(open)f(for)g(writing)g(*/)192 2386 y ff(:)7 b(:)g
+(:)120 2436 y fi(ncredef\(ncid\);)46 b(/*)23 b(put)h(in)f(define)g(mode)h(to)
+f(rename)g(dimension)g(*/)120 2486 y(latid)g(=)h(ncdimid\(ncid,)e("lat"\);)
+120 2536 y(ncdimrename\(ncid,)g(latid,)h("latitude"\);)120 2586 y(ncendef\(nc\
+id\);)46 b(/*)23 b(leave)h(define)f(mode)g(*/)p eop
+%%Page: 74 76
+ bop 0 -58 a fm(74)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(NCDREN:)e(F)n
+(OR)-6 b(TRAN)15 b(In)n(terface)263 320 y fi(SUBROUTINE)23 b(NCDREN)g(\(INTEG\
+ER)f(NCID,)i(INTEGER)f(DIMID,)239 370 y(+)454 b(CHARACTER*\(*\))22 b(DIMNAME,)
+g(INTEGER)h(RCODE\))0 507 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e
+(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 582 y fi(DIM\
+ID)120 b fm(Dimension)16 b(ID,)f(as)g(returned)h(from)e(a)h(previous)h(call)g
+(to)f fi(NCDID)f fm(or)h fi(NCDDEF)p fm(.)0 656 y fi(DIMNAM)96 b fm(New)15 b
+(name)g(for)g(the)g(dimension.)0 731 y fi(RCODE)120 b fm(Returned)16 b(error)
+f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 943 y
+(Here)k(is)g(an)g(example)g(using)g fi(NCDREN)f fm(to)g(rename)h(the)f(dimens\
+ion)j fi(")p fm(lat)p fi(")d fm(to)g fi(")p fm(latitude)p fi(")h fm(in)g(an)g
+(existing)0 1005 y(netCDF)c(\014le)h(named)f(`)p fi(foo.nc)p fm(':)263 1142 y
+fi(INCLUDE)23 b('netcdf.inc')335 1192 y ff(:)7 b(:)g(:)263 1242 y fi(INTEGER)
+23 b(NCID,)g(RCODE,)g(LATID)335 1292 y ff(:)7 b(:)g(:)263 1341 y fi(NCID)23 b
+(=)h(NCOPN\('foo.nc',)e(NCWRITE,)h(RCODE\))335 1391 y ff(:)7 b(:)g(:)120 1441
+y fi(*)24 b(put)f(in)h(define)f(mode)g(to)h(rename)f(dimension)263 1491 y(CAL\
+L)g(NCREDF\(NCID,)g(RCODE\))263 1541 y(LATID)g(=)h(NCDID\(NCID,)e('lat',)h
+(RCODE\))263 1590 y(CALL)g(NCDREN\(NCID,)g(LATID,)g('latitude',)f(RCODE\))120
+1640 y(*)i(leave)f(define)g(mode)263 1690 y(CALL)g(NCENDF\(NCID,)g(RCODE\))p
+eop
+%%Page: 75 77
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(75)0 183 y fj(7)41 b
+(V)-7 b(ariables)62 370 y fm(V)m(ariables)13 b(for)f(a)g(netCDF)g(\014le)i
+(are)e(de\014ned)i(when)f(the)g(\014le)g(is)g(created,)g(while)h(the)f(netCDF)
+f(\014le)h(is)g(in)h(de\014ne)0 432 y(mo)q(de.)27 b(Other)17 b(v)n(ariables)h
+(ma)o(y)f(b)q(e)h(added)g(later)f(b)o(y)h(reen)o(tering)g(de\014ne)g(mo)q(de.)
+27 b(A)17 b(netCDF)g(v)n(ariable)h(has)f(a)0 495 y(name,)d(a)f(t)o(yp)q(e,)h
+(and)g(a)f(shap)r(e,)h(whic)o(h)g(are)g(sp)q(eci\014ed)i(when)e(it)g(is)g(de\
+\014ned.)21 b(A)14 b(v)m(ariable)h(ma)n(y)f(also)g(ha)o(v)n(e)g(v)n(alues,)0
+557 y(which)h(are)g(established)i(later)e(in)h(data)f(mode.)62 694 y(Ordinari\
+ly)o(,)j(the)g(name,)g(t)n(yp)r(e,)g(and)g(shap)r(e)g(are)f(\014xed)i(when)f
+(the)g(v)n(ariable)h(is)f(\014rst)f(de\014ned.)30 b(The)18 b(name)0 756 y(ma)
+n(y)h(b)r(e)g(c)o(hanged,)g(but)g(the)g(t)o(yp)q(e)g(and)g(shap)r(e)g(of)f
+(a)h(v)m(ariable)h(cannot)f(b)q(e)g(c)o(hanged.)32 b(Ho)n(w)o(ev)o(er,)19 b
+(a)g(v)m(ariable)0 818 y(de\014ned)e(in)f(terms)e(of)h(the)g(unlimited)j(dime\
+nsion)f(can)e(gro)n(w)g(without)g(b)r(ound)g(in)h(that)f(dimension.)62 955 y
+(A)20 b(netCDF)f(v)m(ariable)i(is)f(referred)g(to)f(b)o(y)g(a)h(small)g(integ\
+er)f(called)i(a)e(v)n(ariable)h(ID.)g(A)o(ttributes)f(ma)o(y)g(b)r(e)0 1018 y
+(asso)q(ciated)d(with)h(a)f(v)m(ariable)h(to)f(sp)q(ecify)h(such)f(prop)q(ert\
+ies)h(as)f(units,)g(\014ll)i(v)n(alues,)e(maxim)o(um)g(and)h(minimum)0 1080 y
+(v)m(alid)g(v)m(alues,)f(scaling)g(factors,)e(and)h(o\013sets.)62 1217 y(Op)r
+(erations)g(supp)r(orted)g(on)g(v)n(ariables)h(are:)37 1354 y fk(\017)30 b fm
+(Create)15 b(a)f(v)n(ariable,)i(giv)o(en)f(its)h(name,)f(data)f(t)o(yp)q(e,)h
+(and)g(shap)r(e.)37 1429 y fk(\017)30 b fm(Get)15 b(a)g(v)m(ariable)h(ID)f
+(from)g(its)g(name.)37 1503 y fk(\017)30 b fm(Get)15 b(a)g(v)m(ariable's)h
+(name,)f(data)f(t)o(yp)q(e,)h(shap)q(e,)g(and)h(n)o(um)o(b)q(er)f(of)g(attrib\
+utes)g(from)f(its)i(ID.)37 1578 y fk(\017)30 b fm(Put)15 b(a)g(data)f(v)n(alu\
+e)i(in)o(to)f(a)g(v)m(ariable,)h(giv)o(en)g(v)m(ariable)g(ID,)f(indices,)i
+(and)f(v)m(alue.)37 1653 y fk(\017)30 b fm(Put)16 b(a)f(h)o(yp)r(erslab)h(of)
+g(v)m(alues)h(in)o(to)f(a)f(v)n(ariable,)h(giv)o(en)h(v)m(ariable)g(ID,)f(cor\
+ner)f(indices,)j(edge)e(lengths,)h(and)90 1715 y(a)e(blo)r(c)o(k)g(of)g(v)m
+(alues.)37 1790 y fk(\017)30 b fm(Put)17 b(a)h(generalized)h(h)o(yp)q(erslab)
+f(of)g(v)m(alues)g(into)f(a)g(v)m(ariable,)i(giv)o(en)f(v)n(ariable)g(ID,)f
+(corner)h(indices,)i(edge)90 1852 y(lengths,)15 b(stride)h(v)o(ector,)e(index)
+j(mapping)f(v)n(ector,)f(and)g(a)g(blo)r(c)o(k)g(of)g(v)m(alues.)37 1927 y fk
+(\017)30 b fm(Put)15 b(v)m(alues)h(into)f(record)g(v)m(ariables,)h(giv)o(en)g
+(record)f(n)o(um)o(b)q(er)g(and)h(p)q(oin)o(ters)f(to)g(blo)r(c)o(ks)g(of)f
+(v)n(alues.)37 2001 y fk(\017)30 b fm(Get)15 b(a)g(data)f(v)n(alue)i(from)e
+(a)h(v)m(ariable,)h(giv)o(en)g(v)m(ariable)g(ID)g(and)f(indices.)37 2076 y fk
+(\017)30 b fm(Get)14 b(a)h(h)o(yp)r(erslab)g(of)f(v)n(alues)i(from)e(a)g(v)n
+(ariable,)h(giv)o(en)h(v)m(ariable)g(ID,)f(corner)g(indices,)h(and)f(edge)h
+(lengths.)37 2151 y fk(\017)30 b fm(Get)16 b(a)g(generalized)i(h)o(yp)r(ersla\
+b)f(of)f(v)n(alues)h(from)e(a)i(v)m(ariable,)h(giv)o(en)f(v)m(ariable)g(ID,)g
+(corner)f(indices,)j(edge)90 2213 y(lengths,)c(stride)h(v)o(ector,)e(and)i
+(index)g(mapping)g(v)o(ector.)37 2288 y fk(\017)30 b fm(Get)15 b(v)m(alues)i
+(from)d(record)i(v)m(ariables,)g(giv)o(en)g(record)g(n)o(um)o(b)q(er)f(and)h
+(p)r(oin)o(ters)f(to)g(where)h(the)f(data)g(should)90 2350 y(b)r(e)g(stored)g
+(for)f(eac)o(h)h(record)h(v)m(ariable.)37 2425 y fk(\017)30 b fm(Rename)16 b
+(a)f(v)m(ariable.)37 2500 y fk(\017)30 b fm(Get)15 b(n)o(um)o(b)q(er)g(of)g
+(b)o(ytes)g(for)g(a)f(giv)o(en)i(data)f(t)n(yp)r(e.)37 2574 y fk(\017)30 b fm
+(Get)15 b(the)g(n)o(um)o(b)q(er)h(of)e(record)h(v)n(ariables,)h(their)f(IDs,)
+g(and)g(their)h(record)f(sizes.)p eop
+%%Page: 76 78
+ bop 0 -58 a fm(76)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(7.1)33 b(Crea\
+te)14 b(a)h(V)-6 b(ariable)62 321 y fm(The)19 b(function)h fi(ncvardef)e fm
+(\(or)g fi(NCVDEF)g fm(for)g(F)n(OR)m(TRAN\))h(adds)g(a)g(new)g(v)m(ariable)h
+(to)e(an)h(op)q(en)h(netCDF)0 383 y(\014le)c(in)f(de\014ne)h(mo)q(de.)k(It)14
+b(returns)h(a)f(v)n(ariable)h(ID,)g(giv)o(en)g(the)f(netCDF)g(ID,)h(the)f(v)n
+(ariable)h(name,)g(the)g(v)m(ariable)0 445 y(t)n(yp)r(e,)g(the)g(n)o(um)o(b)r
+(er)g(of)f(dimensions,)j(and)e(a)g(list)h(of)f(the)g(dimension)i(IDs.)62 583 y
+(In)j(case)e(of)h(an)f(error,)h fi(ncvardef)e fm(returns)i(-1;)h fi(NCVDEF)e
+fm(returns)g(a)h(nonzero)g(v)m(alue)h(in)f fi(rcode)p fm(.)30 b(P)o(ossible)0
+645 y(causes)15 b(of)g(errors)g(include:)37 782 y fk(\017)30 b fm(The)15 b
+(netCDF)g(\014le)h(is)g(not)f(in)h(de\014ne)g(mo)q(de.)37 858 y fk(\017)30 b
+fm(The)15 b(sp)r(eci\014ed)i(v)m(ariable)f(name)g(is)f(the)h(name)f(of)g(anot\
+her)f(existing)j(v)m(ariable.)37 933 y fk(\017)30 b fm(The)15 b(sp)r(eci\014e\
+d)i(t)n(yp)r(e)e(is)h(not)f(a)f(v)n(alid)i(netCDF)f(t)n(yp)r(e.)37 1008 y fk
+(\017)30 b fm(The)15 b(sp)q(eci\014ed)i(n)o(um)o(b)q(er)e(of)f(dimensions)i
+(is)g(negativ)o(e)e(or)h(more)f(than)g(the)h(constan)o(t)f fi(MAX_VAR_DIMS)p
+fm(,)f(the)90 1070 y(maxim)o(um)i(n)o(um)o(b)q(er)h(of)e(dimensions)j(p)r(erm\
+itted)e(for)g(a)g(netCDF)f(v)n(ariable.)37 1146 y fk(\017)30 b fm(One)15 b
+(or)e(more)h(of)g(the)g(dimension)h(IDS)g(in)g(the)f(list)h(of)e(dimensions)j
+(is)f(not)e(a)h(v)m(alid)i(dimension)f(ID)f(for)g(the)90 1208 y(netCDF)h(\014\
+le.)37 1283 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q
+(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1587 y fl(ncv)l
+(ardef:)23 b(C)15 b(In)n(terface)120 1724 y fi(int)23 b(ncvardef\(int)g(ncid,)
+g(const)g(char*)g(name,)g(nc_type)g(datatype,)430 1774 y(int)h(ndims,)f(const)
+g(int)g(dimids[]\);)0 1912 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)
+e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1987 y
+fi(name)144 b fm(V)l(ariable)21 b(name.)33 b(Must)19 b(b)r(egin)h(with)g(an)g
+(alphab)r(etic)g(c)o(haracter,)g(follo)o(w)o(ed)g(b)o(y)g(zero)f(or)g(more)
+240 2049 y(alphanumeric)d(c)o(haracters)e(including)k(the)d(underscore)h(\(`)
+p fi(_)p fm('\).)i(Case)d(is)h(signi\014cant.)0 2124 y fi(datatype)48 b fm
+(One)14 b(of)f(the)h(set)f(of)h(prede\014ned)h(netCDF)e(data)g(t)n(yp)r(es.)
+19 b(The)14 b(t)n(yp)r(e)f(of)h(this)g(parameter,)e fi(nc_type)p fm(,)240 2186
+y(is)23 b(de\014ned)g(in)g(the)g(netCDF)e(header)i(\014le.)42 b(The)22 b(v)n
+(alid)h(netCDF)f(data)f(t)o(yp)q(es)h(are)g fi(NC_BYTE)p fm(,)240 2249 y fi
+(NC_CHAR)p fm(,)14 b fi(NC_SHORT)p fm(,)g fi(NC_LONG)p fm(,)f fi(NC_FLOAT)p fm
+(,)h(and)h fi(NC_DOUBLE)p fm(.)0 2324 y fi(ndims)120 b fm(Num)o(b)q(er)15 b
+(of)f(dimensions)i(for)e(the)g(v)n(ariable.)20 b(F)l(or)14 b(example,)h fi
+(2)f fm(sp)r(eci\014es)i(a)e(matrix,)g fi(1)g fm(sp)q(eci\014es)i(a)240 2386 y
+(v)o(ector,)e(and)g fi(0)h fm(means)f(the)h(v)m(ariable)h(is)f(a)f(scalar)h
+(with)g(no)f(dimensions.)21 b(Must)14 b(not)h(b)q(e)g(negativ)o(e)240 2448 y
+(or)g(greater)f(than)h(the)g(prede\014ned)i(constan)o(t)d fi(MAX_VAR_DIMS)p fm
+(.)0 2524 y fi(dimids)96 b fm(V)l(ector)16 b(of)f fi(ndims)g fm(dimension)i
+(IDs)f(corresp)q(onding)g(to)f(the)h(v)n(ariable)g(dimensions.)23 b(If)16 b
+(the)g(ID)f(of)240 2586 y(the)g(unlimited)j(dimension)f(is)e(included,)j(it)d
+(m)o(ust)g(b)q(e)h(\014rst.)p eop
+%%Page: 77 79
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(77)62 183 y(Here)21 b
+(is)h(an)f(example)h(using)f fi(ncvardef)f fm(to)g(create)h(a)g(v)m(ariable)h
+(named)f fi(rh)g fm(of)f(t)o(yp)q(e)h fi(long)g fm(with)g(three)0 246 y(dimen\
+sions,)16 b fi(time)p fm(,)f fi(lat)p fm(,)f(and)h fi(lon)g fm(in)h(a)f(new)h
+(netCDF)e(\014le)i(named)g(`)p fi(foo.nc)p fm(':)120 385 y fi(#include)23 b
+("netcdf.h")192 435 y ff(:)7 b(:)g(:)120 484 y fi(int)47 b(ncid;)596 b(/*)24 b
+(netCDF)f(ID)g(*/)120 534 y(int)47 b(lat_dim,)23 b(lon_dim,)g(time_dim;)70 b
+(/*)24 b(dimension)e(IDs)i(*/)120 584 y(int)47 b(rh_id;)572 b(/*)24 b(variabl\
+e)f(ID)g(*/)120 634 y(int)47 b(rh_dimids[3];)404 b(/*)24 b(variable)f(shape)g
+(*/)192 684 y ff(:)7 b(:)g(:)120 734 y fi(ncid)23 b(=)h(nccreate\("foo.nc",)d
+(NC_CLOBBER\);)192 783 y ff(:)7 b(:)g(:)955 833 y fi(/*)24 b(define)f(dimensi\
+ons)f(*/)120 883 y(lat_dim)h(=)h(ncdimdef\(ncid,)e("lat",)h(5L\);)120 933 y
+(lon_dim)g(=)h(ncdimdef\(ncid,)e("lon",)h(10L\);)120 983 y(time_dim)g(=)g(ncd\
+imdef\(ncid,)f("time",)h(NC_UNLIMITED\);)192 1032 y ff(:)7 b(:)g(:)931 1082 y
+fi(/*)24 b(define)f(variable)g(*/)120 1132 y(rh_dimids[0])f(=)i(time_dim;)120
+1182 y(rh_dimids[1])e(=)i(lat_dim;)120 1232 y(rh_dimids[2])e(=)i(lon_dim;)120
+1281 y(rh_id)f(=)h(ncvardef)f(\(ncid,)g("rh",)g(NC_DOUBLE,)f(3,)i(rh_dimids\)\
+;)0 1595 y fl(NCVDEF:)14 b(F)n(OR)-6 b(TRAN)15 b(In)n(terface)263 1735 y fi
+(INTEGER)23 b(FUNCTION)g(NCVDEF\(INTEGER)f(NCID,)h(CHARACTER*\(*\))f(VARNAM,)
+239 1784 y(+)573 b(INTEGER)23 b(VARTYP,)g(INTEGER)g(NVDIMS,)239 1834 y(+)573 b
+(INTEGER)23 b(VDIMS\(*\),)f(INTEGER)h(RCODE\))0 1973 y(NCID)144 b fm(NetCDF)
+14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi
+(NCCRE)p fm(.)0 2051 y fi(VARNAM)96 b fm(V)l(ariable)17 b(name.)j(Must)15 b
+(b)q(egin)h(with)g(an)f(alphab)r(etic)h(c)o(haracter,)e(which)i(is)f(follow)n
+(ed)h(b)o(y)f(zero)g(or)240 2113 y(more)g(alphan)o(umeric)h(c)o(haracters)f
+(including)j(the)d(underscore)h(\(`)p fi(_)p fm('\).)i(Case)d(is)h(signi\014c\
+ant.)0 2190 y fi(VARTYP)96 b fm(One)20 b(of)e(the)h(set)g(of)g(prede\014ned)i
+(netCDF)d(data)g(t)o(yp)q(es.)32 b(The)19 b(v)m(alid)i(netCDF)d(data)g(t)o
+(yp)q(es)h(are)240 2252 y fi(NCBYTE)p fm(,)14 b fi(NCCHAR)p fm(,)g fi(NCSHORT)
+p fm(,)g fi(NCLONG)p fm(,)g fi(NCFLOAT)p fm(,)g(and)h fi(NCDOUBLE)p fm(.)0
+2329 y fi(NVDIMS)96 b fm(Num)o(b)q(er)15 b(of)f(dimensions)i(for)e(the)g(v)n
+(ariable.)20 b(F)l(or)14 b(example,)h fi(2)f fm(sp)r(eci\014es)i(a)e(matrix,)
+g fi(1)g fm(sp)q(eci\014es)i(a)240 2391 y(v)o(ector,)e(and)g fi(0)h fm(means)
+f(the)h(v)m(ariable)h(is)f(a)f(scalar)h(with)g(no)f(dimensions.)21 b(Must)14 b
+(not)h(b)q(e)g(negativ)o(e)240 2454 y(or)g(greater)f(than)h(the)g(prede\014ne\
+d)i(constan)o(t)d fi(MAXVDIMS)p fm(.)0 2531 y fi(VDIMS)120 b fm(V)l(ector)14 b
+(of)f fi(NVDIMS)g fm(dimension)j(IDs)d(corresp)r(onding)h(to)f(the)h(v)n(aria\
+ble)g(dimensions.)21 b(If)15 b(the)e(ID)h(of)240 2593 y(the)h(unlimited)j(dim\
+ension)f(is)e(included,)j(it)d(m)o(ust)g(b)q(e)h(last.)0 2670 y fi(RCODE)120 b
+fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f
+(is)g(returned.)p eop
+%%Page: 78 80
+ bop 0 -58 a fm(78)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(Here)g(is)g(an)
+f(example)i(using)f fi(NCVDEF)f fm(to)f(create)i(a)f(v)m(ariable)i(named)f fi
+(rh)f fm(of)g(t)n(yp)r(e)g fi(long)g fm(with)h(three)g(dimen-)0 246 y(sions,)
+g fi(time)p fm(,)f fi(lat)p fm(,)h(and)g fi(lon)g fm(in)h(a)f(new)g(netCDF)g
+(\014le)h(named)g(`)p fi(foo.nc)p fm(':)263 382 y fi(INCLUDE)23 b('netcdf.inc\
+')335 432 y ff(:)7 b(:)g(:)263 482 y fi(INTEGER)47 b(NCID,)23 b(RCODE)263 532
+y(INTEGER)47 b(LATDIM,)23 b(LONDIM,)g(TIMDIM)g(!)h(dimension)e(IDs)263 582 y
+(INTEGER)47 b(RHID)477 b(!)23 b(variable)g(ID)263 632 y(INTEGER)47 b(RHDIMS\(\
+3\))357 b(!)23 b(variable)g(shape)335 681 y ff(:)7 b(:)g(:)263 731 y fi(NCID)
+23 b(=)h(NCCRE)f(\('foo.nc',)g(NC_CLOBBER,)f(RCODE\))335 781 y ff(:)7 b(:)g
+(:)1051 831 y fi(!)23 b(define)g(dimensions)263 881 y(LATDIM)g(=)h(NCDDEF\(NC\
+ID,)e('lat',)h(5,)h(RCODE\))263 930 y(LONDIM)f(=)h(NCDDEF\(NCID,)e('lon',)h
+(10,)h(RCODE\))263 980 y(TIMDIM)f(=)h(NCDDEF\(NCID,)e('time',)h(NCUNLIM,)g
+(RCODE\))335 1030 y ff(:)7 b(:)g(:)1051 1080 y fi(!)23 b(define)g(variable)
+263 1130 y(RHDIMS\(1\))g(=)h(LONDIM)263 1180 y(RHDIMS\(2\))f(=)h(LATDIM)263
+1229 y(RHDIMS\(3\))f(=)h(TIMDIM)263 1279 y(RHID)f(=)h(NCVDEF)f(\(NCID,)g('rh'\
+,)g(NCDOUBLE,)g(3,)h(RHDIMS,)f(RCODE\))p eop
+%%Page: 79 81
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(79)0 183 y fl(7.2)33 b
+(Get)14 b(a)h(V)-6 b(ariable)17 b(ID)e(from)f(Its)h(Name)62 320 y fm(The)f
+(function)h fi(ncvarid)e fm(\(or)g fi(NCVID)g fm(for)g(F)n(OR)m(TRAN\))h(retu\
+rns)g(the)g(ID)g(of)f(a)g(netCDF)g(v)n(ariable,)h(given)g(its)0 382 y(name.)
+62 519 y(In)g(case)f(of)g(an)g(error,)g fi(ncvarid)f fm(returns)h(-1;)h fi
+(NCVID)e fm(returns)h(a)g(nonzero)h(v)m(alue)g(in)g fi(rcode)p fm(.)19 b(P)n
+(ossible)c(causes)0 582 y(of)g(errors)f(include:)37 719 y fk(\017)30 b fm(The)
+15 b(sp)r(eci\014ed)i(v)m(ariable)f(name)g(is)f(not)g(a)g(v)m(alid)i(name)e
+(for)g(a)f(v)n(ariable)i(in)g(the)f(sp)r(eci\014ed)i(netCDF)d(\014le.)37 793 y
+fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)
+g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1088 y fl(ncv)l(arid:)25 b(C)14 b
+(In)n(terface)120 1225 y fi(int)23 b(ncvarid\(int)g(ncid,)g(const)g(char*)g
+(name\);)0 1362 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previ\
+ous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1436 y fi(name)144
+b fm(V)l(ariable)16 b(name)g(for)e(which)h(ID)h(is)f(desired.)62 1648 y(Here)
+20 b(is)g(an)g(example)h(using)f fi(ncvarid)f fm(to)g(\014nd)h(out)g(the)g
+(ID)f(of)h(a)f(v)n(ariable)h(named)g fi(rh)g fm(in)g(an)g(existing)0 1710 y
+(netCDF)15 b(\014le)h(named)f(`)p fi(foo.nc)p fm(':)120 1847 y fi(#include)23
+b("netcdf.h")192 1897 y ff(:)7 b(:)g(:)120 1947 y fi(int)47 b(ncid;)596 b(/*)
+24 b(netCDF)f(ID)g(*/)120 1997 y(int)47 b(rh_id;)572 b(/*)24 b(variable)f(ID)
+g(*/)192 2046 y ff(:)7 b(:)g(:)120 2096 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)
+e(NC_NOWRITE\);)192 2146 y ff(:)7 b(:)g(:)120 2196 y fi(rh_id)23 b(=)h(ncvari\
+d)f(\(ncid,)g("rh"\);)0 2483 y fl(NCVID:)13 b(F)n(OR)-6 b(TRAN)15 b(In)n(terf\
+ace)263 2620 y fi(INTEGER)23 b(FUNCTION)g(NCVID\(INTEGER)f(NCID,)239 2670 y
+(+)549 b(CHARACTER*\(*\))22 b(VARNAM,)p eop
+%%Page: 80 82
+ bop 0 -58 a fm(80)1465 b(NetCDF)14 b(User's)h(Guide)239 183 y fi(+)549 b(INT\
+EGER)23 b(RCODE\))0 320 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e
+(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 395 y fi(VAR\
+NAM)96 b fm(V)l(ariable)16 b(name)g(for)e(which)h(ID)h(is)f(desired.)0 470 y
+fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q
+(ccurred,)i(0)f(is)g(returned.)62 681 y(Here)e(is)h(an)e(example)i(using)f fi
+(NCVID)f fm(to)h(\014nd)g(out)f(the)h(ID)g(of)f(a)h(v)m(ariable)h(named)f fi
+(rh)g fm(in)g(an)g(existing)h(netCDF)0 744 y(\014le)i(named)g(`)p fi(foo.nc)p
+fm(':)263 881 y fi(INCLUDE)23 b('netcdf.inc')335 930 y ff(:)7 b(:)g(:)263 980
+y fi(INTEGER)47 b(NCID,)23 b(RCODE)263 1030 y(INTEGER)47 b(RHID)477 b(!)23 b
+(variable)g(ID)335 1080 y ff(:)7 b(:)g(:)263 1130 y fi(NCID)23 b(=)h(NCOPN)f
+(\('foo.nc',)g(NCNOWRIT,)g(RCODE\))335 1180 y ff(:)7 b(:)g(:)263 1229 y fi
+(RHID)23 b(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\))p eop
+%%Page: 81 83
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(81)0 183 y fl(7.3)33 b
+(Get)14 b(Information)i(ab)r(out)f(a)g(V)-6 b(ariable)17 b(from)e(Its)f(ID)62
+320 y fm(The)j(function)g fi(ncvarinq)e fm(\(or)g fi(NCVINQ)g fm(for)h(F)n
+(OR)m(TRAN\))h(returns)f(information)g(ab)q(out)g(a)g(netCDF)f(v)n(ari-)0 382
+y(able,)21 b(giv)o(en)f(its)f(ID.)g(The)h(information)f(returned)h(is)g(the)f
+(name,)h(t)n(yp)r(e,)g(n)o(um)o(b)q(er)g(of)f(dimensions,)i(a)e(list)h(of)0
+445 y(dimension)14 b(IDs)f(describing)i(the)e(shap)q(e)g(of)f(the)h(v)n(ariab\
+le,)g(and)g(the)g(n)o(um)o(b)r(er)f(of)h(v)m(ariable)h(attributes)e(that)g
+(ha)o(v)o(e)0 507 y(b)r(een)j(assigned)h(to)f(the)g(v)m(ariable.)62 644 y(In)
+20 b(case)e(of)h(an)f(error,)h fi(ncvarinq)e fm(returns)i(-1;)h fi(NCVINQ)e fm
+(returns)g(a)h(nonzero)g(v)m(alue)h(in)f fi(rcode)p fm(.)30 b(P)o(ossible)0
+706 y(causes)15 b(of)g(errors)g(include:)37 843 y fk(\017)30 b fm(The)15 b
+(v)n(ariable)h(ID)f(is)h(inv)m(alid)g(for)f(the)g(sp)r(eci\014ed)i(netCDF)d
+(\014le.)37 918 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)
+q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1215 y fl(ncv)l
+(arinq:)25 b(C)15 b(In)n(terface)120 1352 y fi(int)23 b(ncvarinq\(int)g(ncid,)
+g(int)g(varid,)g(char*)h(name,)f(nc_type*)f(datatype,)430 1402 y(int*)i(ndims\
+,)f(int)g(dimids[],)g(int*)g(natts\);)0 1613 y(ncid)144 b fm(NetCDF)14 b(ID,)
+h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreat\
+e)p fm(.)0 1688 y fi(varid)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e
+(a)h(previous)h(call)h(to)d fi(ncvardef)g fm(or)h fi(ncvarid)p fm(.)0 1762 y
+fi(name)144 b fm(Returned)18 b(v)n(ariable)g(name.)26 b(The)18 b(caller)g(m)o
+(ust)f(allo)r(cate)g(space)h(for)e(the)i(returned)f(name.)27 b(The)240 1824 y
+(maxim)o(um)15 b(p)r(ossible)h(length,)g(in)g(c)o(haracters,)e(of)h(a)g(v)n
+(ariable)h(name)f(is)h(giv)o(en)g(b)o(y)f(the)g(prede\014ned)240 1887 y(const\
+an)o(t)h fi(MAX_NC_NAME)p fm(.)22 b(If)17 b(the)g(name)f(parameter)g(is)h(giv)
+o(en)g(as)f(`)p fi(\(char)e(*\))h(0)p fm(',)h(no)h(name)f(will)240 1949 y(b)r
+(e)f(returned)g(so)g(no)g(space)h(needs)g(to)e(b)r(e)h(allo)r(cated.)0 2023 y
+fi(datatype)48 b fm(Returned)17 b(v)n(ariable)g(t)o(yp)q(e,)g(one)f(of)g(the)
+g(set)h(of)f(prede\014ned)i(netCDF)d(data)h(t)n(yp)r(es.)23 b(The)17 b(t)n
+(yp)r(e)f(of)240 2085 y(this)e(parameter,)f fi(nc_type)p fm(,)g(is)h(de\014ne\
+d)h(in)g(the)f(netCDF)f(header)h(\014le.)20 b(The)14 b(v)n(alid)h(netCDF)e
+(data)240 2148 y(t)n(yp)r(es)18 b(are)g fi(NC_BYTE)p fm(,)f fi(NC_CHAR)p fm
+(,)g fi(NC_SHORT)p fm(,)h fi(NC_LONG)p fm(,)f fi(NC_FLOAT)p fm(,)g(and)h fi
+(NC_DOUBLE)p fm(.)27 b(If)19 b(this)240 2210 y(parameter)14 b(is)i(giv)o(en)f
+(as)g(`)p fi(\(nc_type)f(*\))h(0)p fm(',)f(no)h(t)n(yp)r(e)g(will)i(b)q(e)e
+(returned)h(so)e(no)h(v)n(ariable)h(to)e(hold)240 2272 y(the)h(t)o(yp)q(e)h
+(needs)g(to)e(b)r(e)h(declared.)0 2347 y fi(ndims)120 b fm(Returned)22 b(n)o
+(um)o(b)q(er)f(of)f(dimensions)i(the)f(v)n(ariable)g(w)o(as)f(de\014ned)i(as)
+e(using.)38 b(F)-5 b(or)21 b(example,)h fi(2)240 2409 y fm(sp)q(eci\014es)e
+(a)e(matrix,)h fi(1)f fm(sp)r(eci\014es)i(a)e(v)n(ector,)h(and)g fi(0)f fm
+(means)g(the)h(v)m(ariable)h(is)f(a)f(scalar)g(with)h(no)240 2471 y(dimension\
+s.)i(If)15 b(this)g(parameter)f(is)h(giv)o(en)g(as)f(`)p fi(\(int)g(*\))h(0)p
+fm(',)f(no)g(n)o(um)o(b)q(er)h(of)f(dimensions)i(will)g(b)r(e)240 2533 y(retu\
+rned)g(so)e(no)i(v)m(ariable)g(to)f(hold)h(this)f(information)h(needs)g(to)e
+(b)r(e)h(declared.)0 2608 y fi(dimids)96 b fm(Returned)13 b(v)n(ector)e(of)h
+fi(ndims)e fm(dimension)k(IDs)d(corresp)r(onding)h(to)f(the)g(v)n(ariable)h
+(dimensions.)21 b(The)240 2670 y(caller)14 b(m)o(ust)f(allo)r(cate)g(enough)h
+(space)f(for)g(a)f(v)o(ector)h(of)g(at)f(least)i fi(ndims)e fm(integers)g(to)
+h(b)r(e)g(returned.)p eop
+%%Page: 82 84
+ bop 0 -58 a fm(82)1465 b(NetCDF)14 b(User's)h(Guide)240 183 y(The)g(maxim)o
+(um)g(p)q(ossible)h(n)o(um)o(b)r(er)e(of)h(dimensions)h(for)e(a)h(v)m(ariable)
+h(is)f(giv)o(en)h(b)o(y)e(the)h(prede\014ned)240 246 y(constan)o(t)j fi(MAX_V\
+AR_DIMS)p fm(.)29 b(If)20 b(this)f(parameter)f(is)i(giv)o(en)f(as)g(`)p fi
+(\(int)14 b(*\))h(0)p fm(',)k(no)f(v)o(ector)h(will)h(b)r(e)240 308 y(returne\
+d)c(so)e(no)i(space)f(to)g(hold)h(the)f(dimension)i(IDs)e(needs)h(to)f(b)q
+(e)g(declared)i(or)d(allo)r(cated.)0 390 y fi(natts)120 b fm(Returned)18 b
+(n)n(um)o(b)r(er)e(of)g(v)n(ariable)h(attributes)f(assigned)h(to)f(this)h(v)n
+(ariable.)24 b(If)17 b(this)g(parameter)e(is)240 452 y(giv)o(en)g(as)e(`)p fi
+(\(int)i(*\))g(0)p fm(',)e(the)h(n)o(um)o(b)r(er)g(of)f(attributes)h(will)i
+(not)e(b)q(e)h(returned)f(so)g(no)g(space)h(to)e(hold)240 514 y(this)j(inform\
+ation)f(needs)h(to)f(b)q(e)g(declared)i(or)d(allo)r(cated.)62 802 y(Here)f
+(is)f(an)g(example)h(using)g fi(ncvarinq)e fm(to)h(\014nd)h(out)f(ab)q(out)g
+(a)g(v)m(ariable)h(named)g fi(rh)e fm(in)i(an)f(existing)i(netCDF)0 865 y(\
+\014le)i(named)g(`)p fi(foo.nc)p fm(':)120 1009 y fi(#include)23 b("netcdf.h")
+192 1059 y ff(:)7 b(:)g(:)120 1109 y fi(int)47 b(ncid;)596 b(/*)24 b(netCDF)f
+(ID)g(*/)120 1158 y(int)47 b(rh_id;)572 b(/*)24 b(variable)f(ID)g(*/)120 1208
+y(nc_type)g(rh_type;)452 b(/*)24 b(variable)f(type)g(*/)120 1258 y(int)g(rh_n\
+dims;)524 b(/*)24 b(number)f(of)g(dims)h(*/)120 1308 y(int)47 b(rh_dims[MAX_V\
+AR_DIMS];)188 b(/*)24 b(variable)f(shape)g(*/)120 1358 y(int)g(rh_natts)548 b
+(/*)24 b(number)f(of)g(attributes)g(*/)192 1407 y ff(:)7 b(:)g(:)120 1457 y fi
+(ncid)23 b(=)h(ncopen)f(\("foo.nc",)g(NC_NOWRITE\);)192 1507 y ff(:)7 b(:)g
+(:)120 1557 y fi(rh_id)23 b(=)h(ncvarid)f(\(ncid,)g("rh"\);)120 1607 y(/*)h
+(we)f(don't)g(need)h(name,)f(since)g(we)h(already)f(know)g(it)g(*/)120 1656 y
+(ncvarinq)g(\(ncid,)g(rh_id,)g(\(char)g(*\))h(0,)f(&rh_type,)g(&rh_ndims,)f
+(rh_dims,)359 1706 y(&rh_natts\);)0 2069 y fl(NCVINQ:)13 b(F)n(OR)-6 b(TRAN)
+15 b(In)n(terface)263 2213 y fi(SUBROUTINE)23 b(NCVINQ)g(\(INTEGER)f(NCID,)i
+(INTEGER)f(VARID,)239 2262 y(+)454 b(CHARACTER*\(*\))22 b(VARNAM,)h(INTEGER)f
+(VARTYP,)239 2312 y(+)454 b(INTEGER)22 b(NVDIMS,)h(INTEGER)g(VDIMS\(*\),)239
+2362 y(+)454 b(INTEGER)22 b(NVATTS,)h(INTEGER)g(RCODE\))0 2588 y(NCID)144 b fm
+(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm
+(or)h fi(NCCRE)p fm(.)0 2670 y fi(VARID)120 b fm(V)l(ariable)16 b(ID,)f(retur\
+ned)h(from)e(a)h(previous)h(call)h(to)d fi(NCVDEF)g fm(or)h fi(NCVID)p fm(.)p
+eop
+%%Page: 83 85
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(83)0 183 y fi(VARNAM)96
+b fm(Returned)18 b(v)n(ariable)g(name.)26 b(The)18 b(caller)g(m)o(ust)f(allo)
+r(cate)g(space)h(for)e(the)i(returned)f(name.)27 b(The)240 246 y(maxim)o(um)
+15 b(p)r(ossible)h(length,)g(in)g(c)o(haracters,)e(of)h(a)g(v)n(ariable)h(nam\
+e)f(is)h(giv)o(en)g(b)o(y)f(the)g(prede\014ned)240 308 y(constan)o(t)f fi(MAX\
+NCNAM)p fm(.)0 382 y fi(VARTYP)96 b fm(Returned)20 b(v)n(ariable)g(t)o(yp)q
+(e,)g(one)g(of)f(the)g(set)g(of)g(prede\014ned)i(netCDF)e(data)f(t)o(yp)q(es.)
+33 b(The)19 b(v)n(alid)240 445 y(netCDF)c(data)f(t)n(yp)r(es)h(are)g fi(NCBYT\
+E)p fm(,)f fi(NCCHAR)p fm(,)g fi(NCSHORT)p fm(,)g fi(NCLONG)p fm(,)g fi(NCFLO\
+AT)p fm(,)g(and)h fi(NCDOUBLE)p fm(.)0 519 y fi(NVDIMS)96 b fm(Returned)17 b
+(n)o(um)o(b)r(er)f(of)f(dimensions)j(for)d(the)i(v)m(ariable.)24 b(F)l(or)15 b
+(example,)i fi(2)f fm(sp)q(eci\014es)i(a)e(matrix,)f fi(1)240 582 y fm(sp)q
+(eci\014es)i(a)e(v)o(ector,)f(and)h fi(0)g fm(means)h(the)f(v)m(ariable)h(is)
+g(a)f(scalar)g(with)h(no)f(dimensions.)0 656 y fi(VDIMS)120 b fm(Returned)20 b
+(v)o(ector)e(of)h fi(NVDIMS)f fm(dimension)i(IDs)f(corresp)q(onding)h(to)e
+(the)h(v)n(ariable)h(dimensions.)240 719 y(The)f(caller)g(m)o(ust)f(allo)r
+(cate)h(enough)g(space)f(for)g(a)h(v)n(ector)f(of)h(at)e(least)i fi(NVDIMS)f
+fm(in)o(tegers)g(to)g(b)r(e)240 781 y(returned.)23 b(The)16 b(maxim)o(um)g
+(p)q(ossible)i(n)o(um)o(b)q(er)e(of)g(dimensions)h(for)f(a)f(v)n(ariable)i
+(is)f(giv)o(en)h(b)o(y)f(the)240 843 y(prede\014ned)h(constan)n(t)e fi(MAXVDI\
+MS)p fm(.)0 918 y fi(NVATTS)96 b fm(Returned)16 b(n)o(um)o(b)r(er)f(of)g(v)m
+(ariable)h(attributes)f(assigned)h(to)e(this)i(v)n(ariable.)0 993 y fi(RCODE)
+120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)
+i(0)f(is)g(returned.)62 1204 y(Here)g(is)h(an)f(example)h(using)f fi(NCVINQ)g
+fm(to)f(\014nd)i(out)e(ab)q(out)h(a)g(v)m(ariable)h(named)f fi(rh)g fm(in)h
+(an)f(existing)h(netCDF)0 1267 y(\014le)g(named)g(`)p fi(foo.nc)p fm(':)263
+1404 y fi(INCLUDE)23 b('netcdf.inc')335 1453 y ff(:)7 b(:)g(:)263 1503 y fi
+(INTEGER)47 b(NCID,)23 b(RCODE)263 1553 y(INTEGER)47 b(RHID)357 b(!)24 b(vari\
+able)f(ID)263 1603 y(CHARACTER*31)f(RHNAME)214 b(!)24 b(variable)f(name)263
+1653 y(INTEGER)47 b(RHTYPE)309 b(!)24 b(variable)f(type)263 1703 y(INTEGER)47
+b(RHN)381 b(!)24 b(number)f(of)h(dimensions)263 1752 y(INTEGER)47 b(RHDIMS\(M\
+AXVDIMS\))69 b(!)24 b(variable)f(shape)263 1802 y(INTEGER)47 b(RHNATT)309 b
+(!)24 b(number)f(of)h(attributes)335 1852 y ff(:)7 b(:)g(:)263 1902 y fi(NCID)
+23 b(=)h(NCOPN)f(\('foo.nc',)g(NCNOWRIT,)g(RCODE\))335 1952 y ff(:)7 b(:)g
+(:)263 2001 y fi(RHID)23 b(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\)!)f(get)g(ID)
+263 2051 y(CALL)g(NCVINQ)h(\(NCID,)f(RHID,)g(RHNAME,)g(RHTYPE,)g(RHN,)g(RHDIM\
+S,)g(RHNATT,)239 2101 y(+)310 b(RCODE\))p eop
+%%Page: 84 86
+ bop 0 -58 a fm(84)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(7.4)33 b(W)-6
+b(rite)17 b(a)d(Single)j(Data)d(V)-6 b(alue)62 321 y fm(The)16 b(function)h fi
+(ncvarput1)d fm(\(or)h fi(NCVPT1)g fm(or)h fi(NCVP1C)e fm(for)i(F)n(OR)m(TRAN\
+\))g(puts)g(a)f(single)i(data)e(v)n(alue)i(in)o(to)e(a)0 383 y(v)m(ariable)i
+(of)d(an)i(op)q(en)g(netCDF)e(\014le)i(that)f(is)h(in)g(data)e(mo)q(de.)21 b
+(Inputs)16 b(are)e(the)i(netCDF)e(ID,)h(the)h(v)m(ariable)g(ID,)0 446 y(a)f
+(m)n(ultidimensional)k(index)d(that)f(sp)q(eci\014es)i(which)e(v)m(alue)h(to)
+f(add)g(or)g(alter,)g(and)g(the)g(data)g(v)m(alue.)62 583 y(In)j(case)g(of)f
+(an)g(error,)g fi(ncvarput1)f fm(returns)h(-1;)h fi(NCVPT1)f fm(returns)g(a)g
+(nonzero)g(v)n(alue)h(in)g fi(rcode)p fm(.)26 b(P)o(ossible)0 646 y(causes)15
+b(of)g(errors)g(include:)37 784 y fk(\017)30 b fm(The)15 b(v)n(ariable)h(ID)f
+(is)h(inv)m(alid)g(for)f(the)g(sp)r(eci\014ed)i(netCDF)d(\014le.)37 859 y fk
+(\017)30 b fm(The)19 b(sp)q(eci\014ed)h(indices)h(w)o(ere)d(out)g(of)h(range)
+f(for)g(the)g(dimensionalit)q(y)h(of)f(the)h(sp)q(eci\014ed)h(v)n(ariable.)31
+b(F)-5 b(or)90 921 y(example,)14 b(a)f(negativ)n(e)h(index)g(or)e(an)h(index)
+h(that)f(is)g(larger)g(than)g(the)g(corresp)q(onding)h(dimension)g(size)g(wil\
+l)90 984 y(cause)h(an)h(error.)37 1059 y fk(\017)30 b fm(The)15 b(sp)r(eci\
+\014ed)i(netCDF)d(is)i(in)g(de\014ne)g(mo)q(de)g(rather)e(than)h(data)g(mo)q
+(de.)37 1135 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q
+(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1443 y fl(ncv)l
+(arput1:)24 b(C)15 b(In)n(terface)120 1580 y fi(int)23 b(ncvarput1\(int)g(nci\
+d,)g(int)g(varid,)g(const)g(long)h(mindex[],)e(const)i(void)f(*value\);)0 1794
+y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)
+f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1869 y fi(varid)120 b fm(V)l(ariab\
+le)16 b(ID,)f(returned)h(from)e(a)h(previous)h(call)h(to)d fi(ncvardef)g fm
+(or)h fi(ncvarid)p fm(.)0 1945 y fi(mindex)96 b fm(The)12 b(m)n(ultidimension\
+al)j(index)e(of)e(the)g(the)h(data)f(v)m(alue)h(to)f(b)r(e)g(written.)19 b
+(The)12 b(indices)h(are)e(relative)240 2007 y(to)g(0,)h(so)g(for)f(example,)j
+(the)e(\014rst)f(data)h(v)m(alue)h(of)f(a)f(t)o(w)n(o-dimensional)j(v)n(ariab\
+le)f(w)n(ould)g(ha)o(v)n(e)g(index)240 2070 y fi(\(0,0\))p fm(.)18 b(The)12 b
+(elements)g(of)f fi(mindex)g fm(m)n(ust)h(corresp)q(ond)g(to)f(the)h(v)n(aria\
+ble's)g(dimensions.)20 b(Hence,)13 b(if)240 2132 y(the)f(v)n(ariable)h(is)g
+(a)f(record)g(v)n(ariable,)h(the)g(\014rst)f(index)h(w)o(ould)g(corresp)q(ond)
+g(to)e(the)i(record)f(n)o(um)o(b)q(er.)0 2207 y fi(value)120 b fm(P)o(oin)o
+(ter)16 b(to)g(the)g(data)g(v)m(alue)h(to)f(b)q(e)h(written.)23 b(The)17 b
+(p)q(oin)o(ter)f(is)h(declared)h(to)d(b)r(e)h(of)g(t)o(yp)q(e)h fi(void)d(*)
+240 2270 y fm(b)r(ecause)h(it)h(can)f(p)r(oin)o(t)g(to)f(data)h(of)g(an)n(y)h
+(of)e(the)i(basic)g(netCDF)e(t)o(yp)q(es.)20 b(The)c(data)e(should)i(b)r(e)f
+(of)240 2332 y(the)g(appropriate)g(t)o(yp)q(e)g(for)g(the)g(netCDF)f(v)n(aria\
+ble.)20 b fg(W)l(arning:)i(neither)16 b(the)f(compiler)i(nor)f(the)240 2394 y
+(netCDF)g(soft)n(w)n(are)g(can)g(detect)f(whether)h(the)g(wrong)f(t)n(yp)r
+(e)g(of)g(data)g(is)h(used.)62 2608 y fm(Here)i(is)g(an)g(example)g(using)h fi
+(ncvarput1)d fm(to)h(set)h(the)f fi(\(1,2,3\))g fm(element)g(of)h(the)f(v)n
+(ariable)h(named)g fi(rh)g fm(to)0 2670 y fi(0.5)g fm(in)h(an)f(existing)i
+(netCDF)d(\014le)j(named)e(`)p fi(foo.nc)p fm('.)28 b(F)l(or)17 b(simplicit)r
+(y)h(in)h(this)g(example,)g(w)o(e)f(assume)h(that)p eop
+%%Page: 85 87
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(85)0 183 y(w)o(e)16 b
+(kno)o(w)g(that)g fi(rh)h fm(is)g(dimensioned)h(with)f fi(time)p fm(,)f fi
+(lat)p fm(,)g(and)h fi(lon)p fm(,)f(so)h(w)n(e)g(w)n(an)o(t)f(to)g(set)h(the)
+f(v)n(alue)h(of)f fi(rh)h fm(that)0 246 y(corresp)q(onds)e(to)g(the)g(second)
+h fi(time)f fm(v)m(alue,)h(the)f(third)h fi(lat)e fm(v)n(alue,)i(and)f(the)g
+(fourth)g fi(lon)g fm(v)m(alue:)120 386 y fi(#include)23 b("netcdf.h")192 436
+y ff(:)7 b(:)g(:)120 486 y fi(int)47 b(ncid;)596 b(/*)24 b(netCDF)f(ID)g(*/)
+120 535 y(int)47 b(rh_id;)572 b(/*)24 b(variable)f(ID)g(*/)120 585 y(static)g
+(long)g(rh_index[])g(=)h({1,)f(2,)h(3};)f(/*)h(where)f(to)g(put)h(value)f(*/)
+120 635 y(static)g(double)g(rh_val)g(=)h(0.5;)190 b(/*)24 b(value)f(to)h(put)
+f(*/)192 685 y ff(:)7 b(:)g(:)120 735 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e
+(NC_WRITE\);)192 784 y ff(:)7 b(:)g(:)120 834 y fi(rh_id)23 b(=)h(ncvarid)f
+(\(ncid,)g("rh"\);)192 884 y ff(:)7 b(:)g(:)120 934 y fi(ncvarput1\(ncid,)22 b
+(rh_id,)h(rh_index,)f(\(void)i(*\))f(&rh_val\);)0 1263 y fl(NCVPT1:)e(F)n(OR)
+-6 b(TRAN)15 b(In)n(terface)263 1404 y fi(SUBROUTINE)23 b(NCVPT1)g(\(INTEGER)
+f(NCID,)i(INTEGER)f(VARID,)239 1454 y(+)454 b(INTEGER)22 b(MINDEX\(*\),)h fh
+(t)n(yp)r(e)k fi(VALUE,)239 1503 y(+)454 b(INTEGER)22 b(RCODE\))263 1603 y
+(SUBROUTINE)h(NCVP1C)g(\(INTEGER)f(NCID,)i(INTEGER)f(VARID,)239 1653 y(+)454 b
+(INTEGER)22 b(MINDEX\(*\),)h(CHARACTER)g(CHVAL,)239 1703 y(+)454 b(INTEGER)22
+b(RCODE\))62 1921 y fm(There)g(are)f(t)n(w)o(o)g(F)n(OR)m(TRAN)h(subroutines,)
+i fi(NCVPT1)c fm(and)i fi(NCVP1C)p fm(,)f(for)g(putting)h(a)f(single)h(v)n
+(alue)g(in)g(a)0 1984 y(v)m(ariable.)38 b(The)21 b(\014rst)f(puts)h(a)f(n)o
+(umeric)i(v)m(alue)g(in)f(a)g(v)m(ariable)h(of)e(n)o(umeric)i(t)n(yp)r(e,)g
+(and)e(the)h(second)g(puts)g(a)0 2046 y(c)o(haracter)14 b(v)n(alue)i(in)g(a)f
+(v)m(ariable)h(of)f(c)o(haracter)g(t)n(yp)r(e.)0 2186 y fi(NCID)144 b fm(NetC\
+DF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h
+fi(NCCRE)p fm(.)0 2265 y fi(VARID)120 b fm(V)l(ariable)16 b(ID,)f(returned)h
+(from)e(a)h(previous)h(call)h(to)d fi(NCVDEF)g fm(or)h fi(NCVID)p fm(.)0 2343
+y fi(MINDEX)96 b fm(The)12 b(m)n(ultidimensional)j(index)e(of)e(the)g(the)h
+(data)f(v)m(alue)h(to)f(b)r(e)g(written.)19 b(The)12 b(indices)h(are)e(relati\
+ve)240 2405 y(to)g(1,)h(so)g(for)f(example,)j(the)e(\014rst)f(data)h(v)m(alue)
+h(of)f(a)f(t)o(w)n(o-dimensional)j(v)n(ariable)f(w)n(ould)g(ha)o(v)n(e)g(inde\
+x)240 2467 y fi(\(1,1\))p fm(.)18 b(The)12 b(elements)g(of)f fi(mindex)g fm
+(m)n(ust)h(corresp)q(ond)g(to)f(the)h(v)n(ariable's)g(dimensions.)20 b(Hence,)
+13 b(if)240 2530 y(the)g(v)m(ariable)h(is)g(a)e(record)h(v)n(ariable,)g(the)g
+(last)g(index)h(w)o(ould)g(corresp)q(ond)f(to)f(the)h(record)g(n)o(um)o(b)q
+(er.)0 2608 y fi(VALUE)120 b fm(F)l(or)17 b fi(NCVPT1)p fm(,)f(the)i(data)f
+(v)m(alue)h(to)f(b)q(e)h(written.)26 b(The)18 b(data)f(ma)n(y)g(b)r(e)h(of)e
+(a)i(t)n(yp)q(e)g(corresp)q(onding)240 2670 y(to)h(an)o(y)h(of)f(the)h(netCDF)
+f(t)o(yp)q(es)h fi(NCSHORT)p fm(,)g fi(NCLONG)p fm(,)g fi(NCFLOAT)p fm(,)f
+(or)h fi(NCDOUBLE)p fm(,)f(but)h(m)o(ust)f(b)r(e)p eop
+%%Page: 86 88
+ bop 0 -58 a fm(86)1465 b(NetCDF)14 b(User's)h(Guide)240 183 y(appropriate)i
+(for)f(the)h(t)o(yp)q(e)g(of)g(the)g(netCDF)f(v)m(ariable.)26 b fg(W)l(arning\
+:)f(neither)19 b(the)e(compiler)i(nor)240 246 y(the)c(netCDF)h(soft)n(w)o(are)
+f(can)h(detect)g(whether)g(the)f(wrong)g(t)o(yp)q(e)h(of)e(data)i(is)f(used.)
+0 320 y fi(CHVAL)120 b fm(F)l(or)19 b fi(NCVP1C)p fm(,)g(the)h(data)e(v)n(alu\
+e)i(to)f(b)q(e)h(written.)32 b(The)20 b(data)f(should)h(b)r(e)f(of)g(a)h(t)n
+(yp)q(e)g(c)o(haracter,)240 382 y(corresp)q(onding)c(to)f(the)g(netCDF)g(t)n
+(yp)q(es)h fi(NCCHAR)e fm(or)h fi(NCBYTE)p fm(.)0 457 y fi(RCODE)120 b fm(Ret\
+urned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g
+(returned.)62 669 y(Here)f(is)g(an)g(example)g(using)g fi(NCVPT1)f fm(to)g
+(set)h(the)f fi(\(4,3,2\))g fm(element)g(of)g(the)h(v)m(ariable)h(named)f fi
+(rh)f fm(to)g fi(0.5)g fm(in)0 731 y(an)j(existing)g(netCDF)f(\014le)i(named)
+f(`)p fi(foo.nc)p fm('.)k(F)-5 b(or)16 b(simplicit)q(y)f(in)i(this)f(example,)
+g(w)o(e)g(assume)f(that)g(w)o(e)g(kno)o(w)0 793 y(that)e fi(rh)g fm(is)g(dime\
+nsioned)j(with)d fi(lon)p fm(,)g fi(lat)p fm(,)g(and)h fi(time)p fm(,)e(so)h
+(w)o(e)g(w)o(an)o(t)g(to)f(set)h(the)h(v)m(alue)g(of)f fi(rh)g fm(that)g(corr\
+esp)q(onds)0 856 y(to)i(the)g(fourth)g fi(lon)f fm(v)n(alue,)h(the)h(third)f
+fi(lat)g fm(v)n(alue,)g(and)h(the)f(second)h fi(time)e fm(v)n(alue:)263 993 y
+fi(INCLUDE)23 b('netcdf.inc')335 1043 y ff(:)7 b(:)g(:)263 1092 y fi(INTEGER)
+47 b(NCID,)23 b(RCODE)263 1142 y(INTEGER)47 b(RHID)357 b(!)24 b(variable)f
+(ID)263 1192 y(INTEGER)47 b(RHINDX\(3\))237 b(!)24 b(where)f(to)h(put)f(value)
+263 1242 y(DATA)g(RHINDX)h(/4,)f(3,)h(2/)335 1292 y ff(:)7 b(:)g(:)263 1341 y
+fi(NCID)23 b(=)h(NCOPN)f(\('foo.nc',)g(NCWRITE,)g(RCODE\))335 1391 y ff(:)7 b
+(:)g(:)263 1441 y fi(RHID)23 b(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\))47 b(!)
+23 b(get)h(ID)263 1491 y(CALL)f(NCVPT1)h(\(NCID,)f(RHID,)g(RHINDX,)g(0.5,)g
+(RCODE\))p eop
+%%Page: 87 89
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(87)0 183 y fl(7.5)33 b
+(W)-6 b(rite)17 b(a)d(Hyp)s(erslab)h(of)g(V)-6 b(alues)62 320 y fm(The)17 b
+(function)g fi(ncvarput)e fm(\(or)h fi(NCVPT)f fm(or)h fi(NCVPTC)f fm(for)h
+(F)o(OR)m(TRAN\))g(writes)g(a)g(h)o(yp)r(erslab)h(of)f(v)m(alues)h(into)0 382
+y(a)h(netCDF)g(v)m(ariable)h(of)f(an)h(op)q(en)g(netCDF)e(\014le.)31 b(The)18
+b(h)o(yp)r(erslab)h(is)f(sp)r(eci\014ed)i(b)o(y)e(giving)h(a)f(corner)h(and)f
+(a)0 445 y(v)o(ector)12 b(of)g(edge)h(lengths.)20 b(The)12 b(v)n(alues)h(are)
+f(sp)r(eci\014ed)i(as)e(a)h(v)n(ector)f(whose)h(elements)f(are)g(ordered)h
+(b)o(y)g(assuming)0 507 y(that)j(the)h(last)f(dimension)i(of)e(the)h(h)o(yp)r
+(erslab)g(v)m(aries)g(fastest)f(for)g(C,)g(the)g(\014rst)g(dimension)j(v)m
+(aries)e(fastest)f(for)0 569 y(F)n(OR)m(TRAN.)g(The)f(netCDF)g(\014le)h(m)n
+(ust)f(b)r(e)g(in)h(data)f(mo)q(de.)62 706 y(In)21 b(case)f(of)g(an)g(error,)
+g fi(ncvarput)f fm(returns)h(-1;)i fi(NCVPT)d fm(returns)h(a)g(nonzero)g(v)n
+(alue)g(in)h fi(rcode)p fm(.)34 b(P)o(ossible)0 769 y(causes)15 b(of)g(errors)
+g(include:)37 906 y fk(\017)30 b fm(The)15 b(v)n(ariable)h(ID)f(is)h(inv)m
+(alid)g(for)f(the)g(sp)r(eci\014ed)i(netCDF)d(\014le.)37 980 y fk(\017)30 b fm
+(The)16 b(sp)q(eci\014ed)h(corner)e(indices)i(w)o(ere)e(out)g(of)g(range)g
+(for)g(the)g(dimensionalit)q(y)g(of)g(the)h(sp)q(eci\014ed)h(v)m(ariable.)90
+1042 y(F)l(or)h(example,)h(a)f(negativ)o(e)h(index,)g(or)f(an)g(index)i(that)
+e(is)g(larger)g(than)h(the)f(corresp)q(onding)h(dimension)90 1104 y(size)d
+(will)h(cause)e(an)h(error.)37 1179 y fk(\017)30 b fm(The)20 b(sp)q(eci\014ed)
+h(edge)f(lengths)g(added)g(to)e(the)i(sp)q(eci\014ed)h(corner)f(w)n(ould)g
+(ha)o(v)o(e)f(referenced)i(data)d(out)h(of)90 1241 y(range)h(for)f(the)h(dime\
+nsionalit)q(y)g(of)f(the)h(sp)r(eci\014ed)h(v)n(ariable.)35 b(F)l(or)19 b(exa\
+mple,)j(an)d(edge)i(length)f(that)f(is)90 1303 y(larger)c(than)g(the)g(corres\
+p)r(onding)h(dimension)g(size)h(min)o(us)e(the)h(corner)f(index)h(will)h(caus\
+e)f(an)f(error.)37 1378 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d
+(\014le)j(is)e(in)h(de\014ne)h(mode)f(rather)f(than)g(data)f(mo)q(de.)37 1452
+y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(ref\
+er)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1749 y fl(ncv)l(arput:)24 b(C)15 b
+(In)n(terface)120 1886 y fi(int)23 b(ncvarput\(int)g(ncid,)g(int)g(varid,)g
+(const)h(long)f(start[],)g(const)g(long)g(count[],)430 1936 y(const)g(void)h
+(*values\);)0 2148 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h
+(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 2222 y fi
+(varid)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e(a)h(previous)h(call)
+h(to)d fi(ncvardef)g fm(or)h fi(ncvarid)p fm(.)0 2296 y fi(start)120 b fm(A)
+19 b(v)o(ector)g(of)g(long)h(in)o(tegers)f(sp)r(ecifying)i(the)e(m)o(ultidime\
+nsional)j(index)f(of)e(the)h(corner)f(of)g(the)240 2359 y(h)o(yp)q(erslab)g
+(where)f(the)g(\014rst)f(of)g(the)h(data)f(v)n(alues)h(will)i(b)q(e)e(written\
+.)28 b(The)18 b(indices)i(are)d(relative)240 2421 y(to)h(0,)g(so)g(for)g(exam\
+ple,)h(the)g(\014rst)f(data)f(v)n(alue)i(of)f(a)g(v)m(ariable)h(w)o(ould)g
+(ha)o(v)n(e)g(index)g fi(\(0,)c(0,)g ff(:)7 b(:)h(:)o fi(,)240 2483 y(0\))p fm
+(.)22 b(The)16 b(size)h(of)f fi(start)f fm(m)o(ust)g(b)r(e)h(the)g(same)g(as)
+g(the)g(n)o(um)n(b)r(er)g(of)g(dimensions)h(of)f(the)g(sp)q(eci\014ed)240 2545
+y(v)m(ariable.)21 b(The)13 b(elements)f(of)h fi(start)f fm(m)o(ust)h(corresp)
+q(ond)g(to)f(the)h(v)n(ariable's)g(dimensions)i(in)f(order.)240 2608 y(Hence,)
+23 b(if)f(the)f(v)n(ariable)h(is)g(a)f(record)g(v)n(ariable,)i(the)e(\014rst)
+g(index)i(w)n(ould)g(corresp)q(ond)e(to)g(the)240 2670 y(starting)15 b(record)
+g(n)o(um)o(b)q(er)g(for)g(writing)h(the)f(data)f(v)n(alues.)p eop
+%%Page: 88 90
+ bop 0 -58 a fm(88)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fi(count)120 b fm
+(A)15 b(v)n(ector)f(of)g(long)h(integers)f(sp)q(ecifying)i(the)f(m)n(ultidime\
+nsional)j(edge)d(lengths)g(from)e(the)i(corner)240 246 y(of)i(the)h(h)o(yp)q
+(erslab)h(where)f(the)f(\014rst)h(of)f(the)g(data)g(v)n(alues)h(will)i(b)q
+(e)e(written.)27 b(T)l(o)18 b(write)f(a)h(single)240 308 y(v)m(alue,)c(for)e
+(example,)h(sp)r(ecify)g fi(count)f fm(as)g fi(\(1,)j(1,)f ff(:)8 b(:)f(:)o fi
+(,)15 b(1\))p fm(.)k(The)13 b(size)g(of)f fi(count)g fm(is)h(the)g(n)o(um)n
+(b)r(er)f(of)240 370 y(dimensions)h(of)e(the)h(sp)q(eci\014ed)i(v)m(ariable.)
+20 b(The)11 b(elemen)q(ts)g(of)g fi(count)g fm(corresp)q(ond)g(to)g(the)h(v)m
+(ariable's)240 432 y(dimensions.)42 b(Hence,)24 b(if)e(the)g(v)n(ariable)g
+(is)h(a)f(record)f(v)n(ariable,)j(the)e(\014rst)g(element)f(of)h fi(count)240
+495 y fm(corresp)q(onds)15 b(to)g(a)g(coun)o(t)g(of)g(the)g(n)o(um)o(b)q(er)h
+(of)e(records)h(to)g(write.)0 570 y fi(value)120 b fm(P)o(oin)o(ter)17 b(to)g
+(a)g(blo)r(c)o(k)g(of)g(data)g(v)m(alues)h(to)f(b)r(e)g(written.)27 b(The)17 b
+(order)g(in)i(whic)o(h)f(the)f(data)g(will)i(b)r(e)240 632 y(written)f(to)g
+(the)g(netCDF)f(v)n(ariable)i(is)f(with)h(the)f(last)g(dimension)i(of)e(the)g
+(sp)q(eci\014ed)i(h)o(yp)q(erslab)240 695 y(v)m(arying)c(fastest.)21 b(The)c
+(p)q(ointer)e(is)h(declared)i(to)d(b)q(e)h(of)g(the)g(t)n(yp)r(e)g fi(void)f
+(*)g fm(b)r(ecause)h(it)g(can)g(p)r(oin)o(t)240 757 y(to)e(data)g(of)g(an)o
+(y)g(of)g(the)h(basic)g(netCDF)f(t)o(yp)q(es.)20 b(The)15 b(data)f(should)h
+(b)r(e)f(of)h(the)f(appropriate)h(t)n(yp)r(e)240 819 y(for)e(the)h(netCDF)f
+(v)n(ariable.)20 b fg(W)l(arning:)h(neither)15 b(the)f(compiler)i(nor)e(the)g
+(netCDF)g(soft)n(w)o(are)g(can)240 882 y(detect)i(whether)g(the)f(wrong)g(t)o
+(yp)q(e)g(of)g(data)h(is)f(used.)62 1095 y fm(Here)g(is)g(an)g(example)h(usin\
+g)f fi(ncvarput)f fm(to)g(add)h(or)f(c)o(hange)h(all)g(the)g(v)n(alues)g(of)f
+(the)h(v)n(ariable)g(named)g fi(rh)g fm(to)0 1157 y fi(0.5)f fm(in)h(an)f(exi\
+sting)i(netCDF)d(\014le)j(named)e(`)p fi(foo.nc)p fm('.)k(F)l(or)c(simplicit)
+q(y)g(in)i(this)e(example,)h(w)o(e)f(assume)h(that)e(w)o(e)0 1220 y(kno)o(w)j
+(that)g fi(rh)h fm(is)g(dimensioned)i(with)e fi(time)p fm(,)f fi(lat)p fm(,)g
+(and)h fi(lon)p fm(,)g(and)g(that)f(there)g(are)h(three)g fi(time)f fm(v)m
+(alues,)i(\014v)o(e)0 1282 y fi(lat)d fm(v)m(alues,)h(and)f(ten)g fi(lon)g fm
+(v)n(alues.)120 1420 y fi(#include)23 b("netcdf.h")192 1470 y ff(:)7 b(:)g
+(:)120 1519 y fi(#define)23 b(TIMES)g(3)120 1569 y(#define)g(LATS)47 b(5)120
+1619 y(#define)23 b(LONS)47 b(10)120 1669 y(int)g(ncid;)596 b(/*)24 b(netCDF)
+f(ID)g(*/)120 1719 y(int)47 b(rh_id;)572 b(/*)24 b(variable)f(ID)g(*/)120 1769
+y(static)g(long)g(start[])g(=)h({0,)f(0,)h(0};)95 b(/*)24 b(start)f(at)g(firs\
+t)h(value)f(*/)120 1818 y(static)g(long)g(count[])g(=)h({TIMES,)f(LATS,)g(LON\
+S};)120 1868 y(double)g(rh_vals[TIMES*LATS*LONS];)68 b(/*)24 b(array)f(to)h
+(hold)f(values)g(*/)120 1918 y(int)g(i;)192 1968 y ff(:)7 b(:)g(:)120 2018 y
+fi(ncid)23 b(=)h(ncopen\("foo.nc",)e(NC_WRITE\);)192 2067 y ff(:)7 b(:)g(:)
+120 2117 y fi(rh_id)23 b(=)h(ncvarid)f(\(ncid,)g("rh"\);)192 2167 y ff(:)7 b
+(:)g(:)120 2217 y fi(for)23 b(\(i)h(=)g(0;)f(i)h(<)g(TIMES*LATS*LONS;)d(i++\))
+215 2267 y(rh_vals[i])i(=)h(0.5;)120 2316 y(/*)g(write)f(hyperslab)f(of)i(val\
+ues)f(into)g(netCDF)g(variable)g(*/)120 2366 y(ncvarput\(ncid,)f(rh_id,)h(sta\
+rt,)g(count,)g(\(void)g(*\))h(rh_vals\);)0 2670 y fl(NCVPT:)13 b(F)n(OR)-6 b
+(TRAN)15 b(In)n(terface)p eop
+%%Page: 89 91
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(89)263 183 y fi(SUBROUT\
+INE)23 b(NCVPT)g(\(INTEGER)g(NCID,)g(INTEGER)g(VARID,)239 233 y(+)430 b(INTEG\
+ER)23 b(START\(*\),)f(INTEGER)h(COUNT\(*\),)239 283 y(+)430 b fh(t)n(yp)r(e)
+26 b fi(VALUES,)d(INTEGER)g(RCODE\))263 382 y(SUBROUTINE)g(NCVPTC\(INTEGER)f
+(NCID,)h(INTEGER)g(VARID,)239 432 y(+)430 b(INTEGER)23 b(START\(*\),)f(INTEGE\
+R)h(COUNTS\(*\),)239 482 y(+)430 b(CHARACTER*\(*\))22 b(STRING,)h(INTEGER)g
+(LENSTR,)239 532 y(+)430 b(INTEGER)23 b(RCODE\))62 771 y fm(There)13 b(are)g
+(t)n(w)o(o)f(F)o(OR)m(TRAN)h(subroutines,)h fi(NCVPT)e fm(and)h fi(NCVPTC)p fm
+(,)f(for)g(writing)h(a)g(h)o(yp)q(erslab)h(of)e(v)m(alues)i(into)0 833 y(a)g
+(netCDF)f(v)m(ariable.)21 b(The)14 b(\014rst)f(writes)h(n)o(umeric)h(v)m(alue\
+s)g(in)o(to)f(a)f(v)n(ariable)h(of)g(n)o(umeric)h(t)n(yp)r(e,)e(and)h(the)g
+(second)0 895 y(writes)h(c)o(haracter)g(v)m(alues)h(into)e(a)h(v)n(ariable)h
+(of)e(c)o(haracter)h(t)n(yp)r(e.)0 1046 y fi(NCID)144 b fm(NetCDF)14 b(ID,)h
+(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm
+(.)0 1134 y fi(VARID)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e(a)h
+(previous)h(call)h(to)d fi(NCVDEF)g fm(or)h fi(NCVID)p fm(.)0 1222 y fi(START)
+120 b fm(A)11 b(v)o(ector)g(of)f(integers)g(sp)r(ecifying)j(the)e(m)n(ultidim\
+ensional)k(index)d(of)f(the)g(corner)g(of)g(the)g(h)o(yp)q(erslab)240 1284 y
+(where)16 b(the)g(\014rst)g(of)g(the)g(data)f(v)n(alues)h(will)i(b)r(e)e(writ\
+ten.)22 b(The)17 b(indices)h(are)d(relative)h(to)f(1,)h(so)g(for)240 1347 y
+(example,)h(the)g(\014rst)f(data)g(v)m(alue)h(of)g(a)f(v)m(ariable)i(w)n(ould)
+f(ha)o(v)o(e)f(index)i fi(\(1,)d(1,)g ff(:)7 b(:)g(:)p fi(,)15 b(1\))p fm(.)
+23 b(The)17 b(size)240 1409 y(of)d fi(START)g fm(m)o(ust)g(b)r(e)h(the)g(same)
+f(as)g(the)h(n)o(um)o(b)q(er)g(of)f(dimensions)j(of)d(the)h(sp)q(eci\014ed)i
+(v)m(ariable.)k(The)240 1471 y(elements)14 b(of)f fi(START)g fm(m)o(ust)g(cor\
+resp)r(ond)h(to)f(the)h(v)m(ariable's)h(dimensions)g(in)g(order.)k(Hence,)c
+(if)f(the)240 1534 y(v)m(ariable)21 b(is)f(a)f(record)g(v)m(ariable,)i(the)f
+(last)f(index)i(w)n(ould)f(corresp)r(ond)f(to)g(the)g(starting)g(record)240
+1596 y(n)o(um)o(b)q(er)d(for)e(writing)i(the)f(data)g(v)m(alues.)0 1684 y fi
+(COUNT)120 b fm(A)18 b(v)o(ector)g(of)g(integers)f(sp)r(ecifying)j(the)e(m)o
+(ultidimensional)j(edge)e(lengths)g(from)f(the)g(corner)g(of)240 1746 y(the)j
+(h)o(yp)q(erslab)h(where)f(the)g(\014rst)f(of)h(the)g(data)f(v)m(alues)i(will)
+g(b)r(e)f(written.)37 b(T)l(o)20 b(write)h(a)g(single)240 1809 y(v)m(alue,)14
+b(for)e(example,)h(sp)r(ecify)g fi(COUNT)f fm(as)g fi(\(1,)j(1,)f ff(:)8 b
+(:)f(:)o fi(,)15 b(1\))p fm(.)k(The)13 b(size)g(of)f fi(COUNT)g fm(is)h(the)g
+(n)o(um)n(b)r(er)f(of)240 1871 y(dimensions)h(of)e(the)h(sp)q(eci\014ed)i(v)m
+(ariable.)20 b(The)11 b(elemen)q(ts)g(of)g fi(COUNT)g fm(corresp)q(ond)g(to)g
+(the)h(v)m(ariable's)240 1933 y(dimensions.)43 b(Hence,)25 b(if)e(the)f(v)n
+(ariable)h(is)g(a)f(record)g(v)n(ariable,)j(the)d(last)h(element)f(of)g fi
+(COUNT)240 1995 y fm(corresp)q(onds)15 b(to)g(a)g(coun)o(t)g(of)g(the)g(n)o
+(um)o(b)q(er)h(of)e(records)h(to)g(write.)0 2084 y fi(VALUES)96 b fm(F)l(or)
+14 b fi(NCVPT)p fm(,)f(the)i(blo)r(c)o(k)f(of)g(data)g(v)m(alues)i(to)d(b)r
+(e)i(written.)k(The)c(order)f(in)h(which)g(the)f(data)g(will)i(b)r(e)240 2146
+y(written)e(into)f(the)h(sp)r(eci\014ed)i(h)o(yp)q(erslab)f(is)f(with)h(the)f
+(\014rst)f(dimension)j(v)n(arying)e(fastest)f(\(like)h(the)240 2208 y(ordinar\
+y)h(F)o(OR)m(TRAN)h(con)o(v)n(en)o(tion\).)21 b(The)15 b(data)g(ma)n(y)g(b)r
+(e)g(of)g(a)g(t)o(yp)q(e)g(corresp)r(onding)h(to)e(an)o(y)h(of)240 2270 y(the)
+h(netCDF)g(t)n(yp)r(es)g fi(NCSHORT)p fm(,)f fi(NCLONG)p fm(,)h fi(NCFLOAT)p
+fm(,)f(or)h fi(NCDOUBLE)p fm(,)f(but)h(m)o(ust)g(b)q(e)h(appropriate)240 2333
+y(for)f(the)g(t)n(yp)r(e)g(of)g(the)g(netCDF)g(v)m(ariable.)24 b fg(W)l(arnin\
+g:)f(neither)18 b(the)f(compiler)h(nor)e(the)h(netCDF)240 2395 y(soft)n(w)o
+(are)e(can)h(detect)g(whether)g(the)f(wrong)g(t)o(yp)q(e)h(of)e(data)i(is)f
+(used.)0 2483 y fi(STRING)96 b fm(F)l(or)17 b fi(NCVPTC)p fm(,)h(the)g(c)o
+(haracters)f(to)h(b)q(e)g(written.)29 b(The)18 b(order)g(in)g(which)g(the)g
+(c)o(haracters)g(will)h(b)r(e)240 2545 y(written)f(to)e(the)i(netCDF)f(v)m
+(ariable)i(is)f(with)g(the)f(\014rst)g(dimension)j(of)d(the)g(sp)r(eci\014ed)
+i(h)o(yp)q(erslab)240 2608 y(v)m(arying)h(fastest)e(\(lik)o(e)h(the)g(F)o(OR)
+m(TRAN)g(con)o(v)o(en)o(tion\).)31 b(The)20 b(data)e(ma)n(y)h(b)r(e)g(of)f
+(a)h(t)n(yp)r(e)g(corre-)240 2670 y(sp)q(onding)d(to)f(the)g(netCDF)g(t)n(yp)
+r(es)g fi(NCCHAR)f fm(or)h fi(NCBYTE)p fm(.)p eop
+%%Page: 90 92
+ bop 0 -58 a fm(90)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fi(LENSTR)96 b fm
+(F)l(or)18 b fi(NCVPTC)p fm(,)g(the)h(total)f(declared)i(length)f(\(in)h(c)n
+(haracters\))e(of)g(the)h fi(STRING)f fm(argumen)n(t.)30 b(This)240 246 y(sho\
+uld)13 b(b)q(e)f(at)f(least)h(as)f(large)h(as)f(the)h(pro)q(duct)g(of)f(the)h
+(elements)f(of)h(the)f fi(COUNT)g fm(v)o(ector.)18 b(Note)12 b(that)240 308 y
+(this)j(is)g(not)g(necessarily)h(the)f(same)f(as)g(the)h(v)n(alue)g(returned)
+g(b)o(y)g(the)g(F)n(OR)m(TRAN)g fi(LEN)f fm(function,)240 370 y(b)r(ecause)h
+(an)g(arra)n(y)g(argumen)o(t)g(ma)n(y)g(b)r(e)g(pro)o(vided.)0 445 y fi(RCODE)
+120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)
+i(0)f(is)g(returned.)62 656 y(Here)k(is)g(an)g(example)h(using)f fi(NCVPT)f fm
+(to)g(add)h(or)f(c)o(hange)h(all)g(the)g(v)n(alues)g(of)f(the)h(v)n(ariable)g
+(named)g fi(rh)g fm(to)0 719 y fi(0.5)14 b fm(in)h(an)f(existing)i(netCDF)d
+(\014le)j(named)e(`)p fi(foo.nc)p fm('.)k(F)l(or)c(simplicit)q(y)g(in)i(this)
+e(example,)h(w)o(e)f(assume)h(that)e(w)o(e)0 781 y(kno)o(w)i(that)f fi(rh)i fm
+(is)f(dimensioned)j(with)e fi(lon)p fm(,)e fi(lat)p fm(,)h(and)g fi(time)p fm
+(,)g(and)g(that)g(there)g(are)g(ten)h fi(lon)f fm(v)m(alues,)h(\014v)o(e)f fi
+(lat)0 843 y fm(v)m(alues,)h(and)f(three)h fi(time)e fm(v)n(alues.)263 980 y
+fi(INCLUDE)23 b('netcdf.inc')335 1030 y ff(:)7 b(:)g(:)263 1080 y fi(PARAMETE\
+R)23 b(\(NDIMS=3\))213 b(!)24 b(number)f(of)h(dimensions)263 1130 y(PARAMETER)
+f(\(TIMES=3,)f(LATS=5,)h(LONS=10\))g(!)h(dimension)e(sizes)263 1180 y(INTEGER)
+47 b(NCID,)23 b(RCODE)263 1229 y(INTEGER)47 b(RHID)357 b(!)24 b(variable)f
+(ID)263 1279 y(INTEGER)47 b(START\(NDIMS\),)22 b(COUNT\(NDIMS\))g(!)i(hypersl\
+ab)263 1329 y(DOUBLE)f(RHVALS\(LONS,)f(LATS,)i(TIMES\))263 1379 y(DATA)f(STAR\
+T)h(/1,)f(1,)h(1/)190 b(!)24 b(start)f(at)h(first)f(value)263 1429 y(DATA)g
+(COUNT)h(/LONS,)f(LATS,)g(TIMES/)335 1478 y ff(:)7 b(:)g(:)263 1528 y fi(NCID)
+23 b(=)h(NCOPN)f(\('foo.nc',)g(NCWRITE,)g(RCODE\))335 1578 y ff(:)7 b(:)g(:)
+263 1628 y fi(RHID)23 b(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\))70 b(!)24 b(get)
+g(ID)263 1678 y(DO)g(10)f(ILON)h(=)f(1,)h(LONS)335 1727 y(DO)f(10)h(ILAT)f
+(=)h(1,)g(LATS)406 1777 y(DO)g(10)g(ITIME)f(=)g(1,)h(TIMES)478 1827 y(RHVALS\
+\(ILON,)e(ILAT,)h(ITIME\))g(=)h(0.5)192 1877 y(10)f(CONTINUE)263 1927 y(CALL)
+g(NCVPT)h(\(NCID,)f(RHID,)g(START,)g(COUNT,)g(RHVALS,)g(RCODE\))p eop
+%%Page: 91 93
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(91)0 183 y fl(7.6)33 b
+(W)-6 b(rite)17 b(a)d(Generalized)j(Hyp)r(erslab)e(of)g(V)-6 b(alues)62 320 y
+fm(The)17 b(function)g fi(ncvarputg)e fm(\(or)g fi(NCVPTG)g fm(or)h fi(NCVPGC)
+f fm(for)h(F)n(OR)n(TRAN\))g(writes)g(a)g(generalized)i(h)o(yp)q(erslab)0 382
+y(of)g(v)m(alues)h(in)o(to)f(a)f(netCDF)h(v)m(ariable)h(of)e(an)h(op)r(en)g
+(netCDF)f(\014le.)29 b(The)19 b(generalized)g(h)o(yp)r(erslab)f(is)h(sp)q(eci\
+\014ed)0 445 y(b)o(y)g(giving)h(a)f(corner,)h(a)e(v)o(ector)h(of)f(edge)i(len\
+gths,)g(a)f(stride)h(v)n(ector,)g(and)f(an)g(index)h(mapping)g(v)o(ector.)31 b
+(No)0 507 y(assumptions)14 b(are)g(made)g(ab)q(out)g(the)g(ordering)g(or)g
+(size)h(of)e(the)h(dimensions)i(of)e(the)g(data)f(arra)n(y)l(.)19 b(The)c(net\
+CDF)0 569 y(\014le)h(m)o(ust)f(b)q(e)h(in)g(data)e(mo)q(de.)62 706 y(In)h(cas\
+e)g(of)f(an)g(error,)g fi(ncvarputg)f fm(returns)i(-1;)f fi(NCVPTG)f fm(and)i
+fi(NCVPGC)f fm(return)g(a)g(nonzero)h(v)m(alue)h(in)f fi(rcode)p fm(.)0 769 y
+(P)o(ossible)h(causes)g(of)e(errors)h(include:)37 906 y fk(\017)30 b fm(The)
+15 b(v)n(ariable)h(ID)f(is)h(inv)m(alid)g(for)f(the)g(sp)r(eci\014ed)i(netCDF)
+d(\014le.)37 979 y fk(\017)30 b fm(The)16 b(sp)q(eci\014ed)h(corner)e(indices)
+i(w)o(ere)e(out)g(of)g(range)g(for)g(the)g(dimensionalit)q(y)g(of)g(the)h(sp)
+q(eci\014ed)h(v)m(ariable.)90 1041 y(F)l(or)h(example,)h(a)f(negativ)o(e)h
+(index,)g(or)f(an)g(index)i(that)e(is)g(larger)g(than)h(the)f(corresp)q(ondin\
+g)h(dimension)90 1103 y(size)d(will)h(cause)e(an)h(error.)37 1177 y fk(\017)
+30 b fm(The)12 b(sp)r(eci\014ed)i(edge)e(lengths)h(and)f(strides)h(added)g
+(to)e(the)i(sp)q(eci\014ed)h(corner)e(w)o(ould)h(ha)n(v)o(e)f(referenced)i
+(data)90 1239 y(out)g(of)g(range)g(for)g(the)h(dimensionalit)q(y)f(of)g(the)h
+(sp)q(eci\014ed)h(v)n(ariable.)k(F)l(or)14 b(example,)h(an)g(edge)g(length)g
+(that)90 1301 y(is)h(larger)f(than)g(the)g(corresp)q(onding)h(dimension)h(siz\
+e)f(minus)f(the)g(corner)g(index)i(will)g(cause)e(an)g(error,)f(as)90 1363 y
+(will)19 b(accessing)g(t)n(w)o(o)f(or)f(more)g(p)r(oin)o(ts)g(using)i(a)e(str\
+ide)i(that)e(is)h(greater)f(than)h(the)g(size)g(of)g(the)g(netCDF)90 1426 y
+(v)m(ariable)f(in)f(the)f(corresp)q(onding)h(dimension.)37 1499 y fk(\017)30 b
+fm(A)15 b(non-p)r(ositiv)o(e)h(stride.)37 1572 y fk(\017)30 b fm(The)15 b(sp)
+r(eci\014ed)i(netCDF)d(is)i(in)g(de\014ne)g(mo)q(de)g(rather)e(than)h(data)g
+(mo)q(de.)37 1645 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i
+(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1938 y fl(ncv)
+l(arputg:)24 b(C)15 b(In)n(terface)120 2075 y fi(int)23 b(ncvarputg\(int)g
+(ncid,)g(int)g(varid,)g(const)g(long)h(start[],)e(const)i(long)f(count[],)454
+2125 y(const)g(long)h(stride[],)e(const)h(long)h(imap[],)f(const)g(void)g(*va\
+lues\);)0 2337 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previo\
+us)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 2410 y fi(varid)120
+b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e(a)h(previous)h(call)h(to)d fi
+(ncvardef)g fm(or)h fi(ncvarid)p fm(.)0 2483 y fi(start)120 b fm(A)19 b(v)o
+(ector)g(of)g(long)h(in)o(tegers)f(sp)r(ecifying)i(the)e(m)o(ultidimensional)
+j(index)f(of)e(the)h(corner)f(of)g(the)240 2545 y(h)o(yp)q(erslab)g(where)f
+(the)g(\014rst)f(of)g(the)h(data)f(v)n(alues)h(will)i(b)q(e)e(written.)28 b
+(The)18 b(indices)i(are)d(relative)240 2608 y(to)h(0,)g(so)g(for)g(example,)h
+(the)g(\014rst)f(data)f(v)n(alue)i(of)f(a)g(v)m(ariable)h(w)o(ould)g(ha)o(v)n
+(e)g(index)g fi(\(0,)c(0,)g ff(:)7 b(:)h(:)o fi(,)240 2670 y(0\))p fm(.)22 b
+(The)16 b(size)h(of)f fi(start)f fm(m)o(ust)g(b)r(e)h(the)g(same)g(as)g(the)g
+(n)o(um)n(b)r(er)g(of)g(dimensions)h(of)f(the)g(sp)q(eci\014ed)p eop
+%%Page: 92 94
+ bop 0 -58 a fm(92)1465 b(NetCDF)14 b(User's)h(Guide)240 183 y(v)m(ariable.)
+21 b(The)13 b(elements)f(of)h fi(start)f fm(m)o(ust)h(corresp)q(ond)g(to)f
+(the)h(v)n(ariable's)g(dimensions)i(in)f(order.)240 246 y(Hence,)23 b(if)f
+(the)f(v)n(ariable)h(is)g(a)f(record)g(v)n(ariable,)i(the)e(\014rst)g(index)i
+(w)n(ould)g(corresp)q(ond)e(to)g(the)240 308 y(starting)15 b(record)g(n)o(um)
+o(b)q(er)g(for)g(writing)h(the)f(data)f(v)n(alues.)0 390 y fi(count)120 b fm
+(A)15 b(v)n(ector)f(of)g(long)h(integers)f(sp)q(ecifying)i(the)f(m)n(ultidime\
+nsional)j(edge)d(lengths)g(from)e(the)i(corner)240 452 y(of)i(the)h(h)o(yp)q
+(erslab)h(where)f(the)f(\014rst)h(of)f(the)g(data)g(v)n(alues)h(will)i(b)q
+(e)e(written.)27 b(T)l(o)18 b(write)f(a)h(single)240 515 y(v)m(alue,)c(for)e
+(example,)h(sp)r(ecify)g fi(count)f fm(as)g fi(\(1,)j(1,)f ff(:)8 b(:)f(:)o fi
+(,)15 b(1\))p fm(.)k(The)13 b(size)g(of)f fi(count)g fm(is)h(the)g(n)o(um)n
+(b)r(er)f(of)240 577 y(dimensions)h(of)e(the)h(sp)q(eci\014ed)i(v)m(ariable.)
+20 b(The)11 b(elemen)q(ts)g(of)g fi(count)g fm(corresp)q(ond)g(to)g(the)h(v)m
+(ariable's)240 639 y(dimensions.)42 b(Hence,)24 b(if)e(the)g(v)n(ariable)g
+(is)h(a)f(record)f(v)n(ariable,)j(the)e(\014rst)g(element)f(of)h fi(count)240
+701 y fm(corresp)q(onds)15 b(to)g(a)g(coun)o(t)g(of)g(the)g(n)o(um)o(b)q(er)h
+(of)e(records)h(to)g(write.)0 784 y fi(stride)96 b fm(A)17 b(v)o(ector)g(of)g
+(long)g(integers)g(sp)q(ecifying,)i(for)e(eac)o(h)g(dimension,)i(the)f(in)o
+(terv)m(al)g(b)q(et)o(w)o(een)g(the)f(ac-)240 846 y(cessed)e(v)m(alues)g(of)e
+(a)h(netCDF)f(v)m(ariable.)21 b(The)14 b(size)g(of)g(the)g(v)o(ector)f(shall)
+i(b)q(e)f(at)g(least)g(the)g(n)o(um)n(b)r(er)240 908 y(of)20 b(dimensions)i
+(of)f(the)f(asso)q(ciated)h(netCDF)f(v)n(ariable)h(and)g(its)g(elements)f(sha\
+ll)i(corresp)q(ond,)240 971 y(in)f(order,)g(to)e(the)h(v)n(ariable's)g(dimens\
+ions.)36 b(A)20 b(v)n(alue)h(of)e(1)h(accesses)g(adjacen)o(t)g(v)m(alues)h
+(of)f(the)240 1033 y(netCDF)g(v)n(ariable)i(in)f(the)g(corresp)r(onding)g(dim\
+ension;)k(a)c(v)m(alue)h(of)f(2)f(accesses)i(ev)n(ery)f(other)240 1095 y(v)m
+(alue)14 b(of)e(the)h(netCDF)f(v)n(ariable)i(in)f(the)g(corresp)q(onding)h
+(dimension;)h(and)e(so)f(on.)19 b(A)13 b fi(NULL)g fm(stride)240 1157 y(argum\
+en)o(t)f(obtains)g(the)h(default)g(b)q(eha)o(vior)f(in)i(whic)o(h)f(adjacen)o
+(t)f(v)m(alues)h(are)g(accessed)f(along)h(eac)o(h)240 1220 y(dimension.)0 1302
+y fi(imap)144 b fm(A)19 b(v)o(ector)f(of)h(long)g(integers)f(sp)r(ecifying,)j
+(for)d(eac)o(h)h(dimension,)j(ho)n(w)d(data)g(v)m(alues)h(associated)240 1364
+y(with)12 b(a)g(netCDF)f(v)m(ariable)i(are)f(arranged)f(in)i(memory)l(.)18 b
+(The)13 b(o\013set,)f(in)g(b)o(ytes,)g(from)g(the)g(memory)240 1427 y(lo)r
+(cation)i(p)q(ointed)g(to)f(b)o(y)i(the)f fi(value)f fm(argumen)o(t)g(to)h
+(a)g(particular)g(datum)g(is)h(giv)o(en)g(b)o(y)f(the)g(inner)240 1489 y(pro)
+q(duct)k(of)f(the)h(index)h(mapping)f(v)o(ector)f(with)h(the)g(co)q(ordinates)
+g(of)f(the)g(datum.)27 b(\(The)18 b fh(inner)240 1551 y(pro)q(duct)c fm(of)e
+(t)o(w)n(o)g(v)o(ectors)g([x0,)g(x1,)h ff(:)7 b(:)g(:)p fm(,)12 b(xn])h(and)f
+([y0,)g(y1,)h ff(:)7 b(:)g(:)p fm(,)13 b(yn])f(is)h(just)f(x0*y0)g fi(+)g fm
+(x1*y1)g fi(+)h ff(:)7 b(:)g(:)12 b fi(+)240 1613 y fm(xn*yn.\))19 b(The)12 b
+(v)o(ector)f(ma)o(y)h(con)o(tain)g(negativ)o(e)g(v)n(alues)g(if)h(the)f fi
+(value)f fm(argumen)o(t)h(is)g(appropriately)240 1676 y(sp)q(eci\014ed.)21 b
+(A)13 b fi(NULL)g fm(argumen)n(t)g(obtains)g(the)g(default)h(b)q(eha)o(vior)f
+(in)h(whic)o(h)g(the)f(memory-residen)o(t)240 1738 y(v)m(alues)j(are)f(assume\
+d)h(to)e(ha)o(v)o(e)h(the)g(same)g(structure)g(as)g(the)g(asso)q(ciated)h(net\
+CDF)e(v)n(ariable.)0 1820 y fi(value)120 b fm(P)o(oin)o(ter)17 b(to)g(a)g(blo)
+r(c)o(k)g(of)g(data)g(v)m(alues)h(to)f(b)r(e)g(written.)27 b(The)17 b(order)g
+(in)i(whic)o(h)f(the)f(data)g(will)i(b)r(e)240 1883 y(written)14 b(to)g(the)g
+(netCDF)f(v)n(ariable)i(is)g(with)f(the)g(last)g(dimension)i(of)e(the)g(gener\
+alized)i(h)o(yp)q(erslab)240 1945 y(v)m(arying)g(fastest.)21 b(The)c(p)q(oint\
+er)e(is)h(declared)i(to)d(b)q(e)h(of)g(the)g(t)n(yp)r(e)g fi(void)f(*)g fm
+(b)r(ecause)h(it)g(can)g(p)r(oin)o(t)240 2007 y(to)e(data)g(of)g(an)o(y)g(of)
+g(the)h(basic)g(netCDF)f(t)o(yp)q(es.)20 b(The)15 b(data)f(should)h(b)r(e)f
+(of)h(the)f(appropriate)h(t)n(yp)r(e)240 2069 y(for)e(the)h(netCDF)f(v)n(aria\
+ble.)20 b fg(W)l(arning:)h(neither)15 b(the)f(compiler)i(nor)e(the)g(netCDF)g
+(soft)n(w)o(are)g(can)240 2132 y(detect)i(whether)g(the)f(wrong)g(t)o(yp)q
+(e)g(of)g(data)h(is)f(used.)62 2359 y fm(Here)j(is)f(an)g(example)h(using)g fi
+(ncvarputg)e fm(to)h(add)g(or)g(c)o(hange)g(ev)o(ery)g(other)g(v)m(alue)h(in)
+g(eac)o(h)g(dimension)g(of)0 2421 y(the)e(v)m(ariable)h(named)f fi(rh)f fm
+(to)g fi(0.5)g fm(in)i(an)e(existing)i(netCDF)e(\014le)i(named)f(`)p fi(foo.n\
+c)p fm('.)j(V)m(alues)d(are)f(tak)n(en,)h(using)0 2483 y(the)f(same)f(dimensi\
+onal)j(strides,)d(from)g(p)r(oin)o(ts)g(in)h(a)g(3-dimensional)h(arra)n(y)e
+(of)h(structures)f(whose)g(dimensions)0 2545 y(are)j(the)g(rev)o(erse)g(of)g
+(the)g(netCDF)g(v)m(ariable.)27 b(F)l(or)16 b(simplicit)q(y)i(in)f(this)h(exa\
+mple,)g(w)o(e)f(assume)g(that)g(w)n(e)g(kno)o(w)0 2608 y(that)h fi(rh)g fm
+(is)h(dimensioned)i(with)e fi(time)p fm(,)f fi(lat)p fm(,)g(and)h fi(lon)p fm
+(,)g(and)f(that)g(there)h(are)f(three)h fi(time)f fm(v)m(alues,)i(\014v)o(e)e
+fi(lat)0 2670 y fm(v)m(alues,)e(and)f(ten)h fi(lon)e fm(v)n(alues.)p eop
+%%Page: 93 95
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(93)120 183 y fi(#includ\
+e)23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(#define)23 b(TIMES)g
+(3)120 333 y(#define)g(LATS)47 b(5)120 382 y(#define)23 b(LONS)47 b(10)120 432
+y(int)g(ncid;)596 b(/*)24 b(netCDF)f(ID)g(*/)120 482 y(int)47 b(rh_id;)572 b
+(/*)24 b(variable)f(ID)g(*/)120 532 y(static)g(long)g(start[])g(=)h({0,)f(0,)
+h(0};)71 b(/*)24 b(start)f(at)h(first)f(value)g(*/)120 582 y(static)g(long)g
+(count[])g(=)h({TIMES,)f(LATS,)g(LONS};)120 632 y(static)g(long)g(stride[])g
+(=)h({2,)f(2,)h(2};)47 b(/*)24 b(every)f(other)g(value)g(*/)120 681 y(long)g
+(imap[3];)524 b(/*)24 b(set)f(to)h(reverse)f(of)g(variable)g(*/)120 731 y(str\
+uct)g(datum)g({)215 781 y(int)95 b(dummy;)429 b(/*)24 b(to)f(illustrate)g(map\
+ping)g(vector)g(*/)215 831 y(double)g(rh_val;)405 b(/*)24 b(actual)f(value)g
+(to)h(be)f(written)g(*/)120 881 y(})143 b(data[LONS][LATS][TIMES];)92 b(/*)24
+b(reversed)f(array)g(to)g(hold)h(values.)f(*/)120 930 y(int)g(itime,)g(ilat,)
+h(ilon;)192 980 y ff(:)7 b(:)g(:)120 1030 y fi(ncid)23 b(=)h(ncopen\("foo.nc"\
+,)e(NC_WRITE\);)192 1080 y ff(:)7 b(:)g(:)120 1130 y fi(rh_id)23 b(=)h(ncvari\
+d)f(\(ncid,)g("rh"\);)192 1180 y ff(:)7 b(:)g(:)120 1229 y fi(for)23 b(\(ilon)
+h(=)f(0;)h(ilon)f(<)h(LONS;)f(ilon)g(+=)h(stride[2]\))215 1279 y(for)g(\(ilat)
+f(=)h(0;)f(ilat)h(<)f(LATS;)h(ilat)f(+=)h(stride[1]\))311 1329 y(for)f(\(itim\
+e)g(=)h(0;)g(itime)f(<)h(TIMES;)f(itime)g(+=)g(stride[0]\))406 1379 y(data[il\
+on][ilat][itime].rh_va)o(l)e(=)j(0.5;)120 1429 y(/*)g(access)f(every)g(`strid\
+e')g(in-memory)f(value)h(using)h(reversed)e(dimensions)h(*/)120 1478 y(imap[0\
+])g(=)h(stride[2]*sizeof\(struct)c(datum\);)120 1528 y(imap[1])j(=)h(stride[1\
+]*\(1+\(LONS-1\)/s)o(tride[0])o(\)*imap[)o(0];)120 1578 y(imap[2])f(=)h(strid\
+e[0]*\(1+\(LATS-1\)/s)o(tride[1])o(\)*imap[)o(1];)120 1628 y(/*)g(write)f(gen\
+eralized)f(hyperslab)h(of)g(values)g(into)h(netCDF)f(variable)g(*/)120 1678 y
+(ncvarputg\(ncid,)f(rh_id,)h(start,)g(count,)g(stride,)g(imap,)g(\(void)g(*\))
+h(data\);)0 2120 y fl(NCVPTG,)13 b(NCVPGC:)g(F)n(OR)-6 b(TRAN)15 b(In)n(terfa\
+ce)263 2271 y fi(SUBROUTINE)23 b(NCVPTG)g(\(INTEGER)f(NCID,)i(INTEGER)f(VARID\
+,)239 2321 y(+)454 b(INTEGER)22 b(START\(*\),)h(INTEGER)g(COUNT\(*\),)239 2371
+y(+)454 b(INTEGER)22 b(STRIDE\(*\),)h(INTEGER)g(IMAP\(*\),)239 2421 y(+)454 b
+fh(t)n(yp)r(e)26 b fi(VALUES,)d(INTEGER)g(RCODE\))263 2521 y(SUBROUTINE)g(NCV\
+PGC)g(\(INTEGER)f(NCID,)i(INTEGER)f(VARID,)239 2570 y(+)454 b(INTEGER)22 b
+(START\(*\),)h(INTEGER)g(COUNT\(*\),)239 2620 y(+)454 b(INTEGER)22 b(STRIDE\(\
+*\),)h(INTEGER)g(IMAP\(*\),)239 2670 y(+)454 b(CHARACTER*\(*\))22 b(STRING,)h
+(INTEGER)f(RCODE\))p eop
+%%Page: 94 96
+ bop 0 -58 a fm(94)1465 b(NetCDF)14 b(User's)h(Guide)62 183 y(There)g(are)f
+(t)n(w)n(o)g(F)o(OR)m(TRAN)g(subroutines,)h fi(NCVPTG)f fm(and)g fi(NCVPGC)p
+fm(,)f(for)h(writing)g(a)g(generalized)i(h)o(yp)q(erslab)0 246 y(of)g(v)m(alu\
+es)h(in)o(to)f(a)f(netCDF)h(v)m(ariable.)23 b(The)16 b(\014rst)g(writes)g(n)o
+(umeric)h(v)m(alues)g(into)e(a)g(v)n(ariable)i(of)e(n)o(umeric)i(t)o(yp)q(e,)
+0 308 y(and)e(the)h(second)f(writes)h(c)o(haracter)e(v)n(alues)h(into)g(a)f
+(v)n(ariable)i(of)f(c)o(haracter)f(t)o(yp)q(e.)0 450 y fi(NCID)144 b fm(NetCD\
+F)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h
+fi(NCCRE)p fm(.)0 529 y fi(VARID)120 b fm(V)l(ariable)16 b(ID,)f(returned)h
+(from)e(a)h(previous)h(call)h(to)d fi(NCVDEF)g fm(or)h fi(NCVID)p fm(.)0 609 y
+fi(START)120 b fm(A)11 b(v)o(ector)g(of)f(integers)g(sp)r(ecifying)j(the)e
+(m)n(ultidimensional)k(index)d(of)f(the)g(corner)g(of)g(the)g(h)o(yp)q(erslab)
+240 671 y(where)16 b(the)g(\014rst)g(of)g(the)g(data)f(v)n(alues)h(will)i(b)r
+(e)e(written.)22 b(The)17 b(indices)h(are)d(relative)h(to)f(1,)h(so)g(for)240
+733 y(example,)h(the)g(\014rst)f(data)g(v)m(alue)h(of)g(a)f(v)m(ariable)i(w)n
+(ould)f(ha)o(v)o(e)f(index)i fi(\(1,)d(1,)g ff(:)7 b(:)g(:)p fi(,)15 b(1\))p
+fm(.)23 b(The)17 b(size)240 795 y(of)d fi(START)g fm(m)o(ust)g(b)r(e)h(the)g
+(same)f(as)g(the)h(n)o(um)o(b)q(er)g(of)f(dimensions)j(of)d(the)h(sp)q(eci\
+\014ed)i(v)m(ariable.)k(The)240 858 y(elements)14 b(of)f fi(START)g fm(m)o
+(ust)g(corresp)r(ond)h(to)f(the)h(v)m(ariable's)h(dimensions)g(in)g(order.)k
+(Hence,)c(if)f(the)240 920 y(v)m(ariable)21 b(is)f(a)f(record)g(v)m(ariable,)
+i(the)f(last)f(index)i(w)n(ould)f(corresp)r(ond)f(to)g(the)g(starting)g(recor\
+d)240 982 y(n)o(um)o(b)q(er)d(for)e(writing)i(the)f(data)g(v)m(alues.)0 1062 y
+fi(COUNT)120 b fm(A)18 b(v)o(ector)g(of)g(integers)f(sp)r(ecifying)j(the)e
+(m)o(ultidimensional)j(edge)e(lengths)g(from)f(the)g(corner)g(of)240 1124 y
+(the)j(h)o(yp)q(erslab)h(where)f(the)g(\014rst)f(of)h(the)g(data)f(v)m(alues)
+i(will)g(b)r(e)f(written.)37 b(T)l(o)20 b(write)h(a)g(single)240 1186 y(v)m
+(alue,)14 b(for)e(example,)h(sp)r(ecify)g fi(COUNT)f fm(as)g fi(\(1,)j(1,)f ff
+(:)8 b(:)f(:)o fi(,)15 b(1\))p fm(.)k(The)13 b(size)g(of)f fi(COUNT)g fm(is)h
+(the)g(n)o(um)n(b)r(er)f(of)240 1248 y(dimensions)h(of)e(the)h(sp)q(eci\014ed)
+i(v)m(ariable.)20 b(The)11 b(elemen)q(ts)g(of)g fi(COUNT)g fm(corresp)q(ond)g
+(to)g(the)h(v)m(ariable's)240 1311 y(dimensions.)43 b(Hence,)25 b(if)e(the)f
+(v)n(ariable)h(is)g(a)f(record)g(v)n(ariable,)j(the)d(last)h(element)f(of)g fi
+(COUNT)240 1373 y fm(corresp)q(onds)15 b(to)g(a)g(coun)o(t)g(of)g(the)g(n)o
+(um)o(b)q(er)h(of)e(records)h(to)g(write.)0 1452 y fi(STRIDE)96 b fm(A)17 b
+(v)o(ector)f(of)g(integers)g(sp)r(ecifying,)i(for)e(eac)o(h)h(dimension,)i
+(the)d(interv)m(al)h(b)r(et)n(w)o(een)g(the)g(accessed)240 1515 y(v)m(alues)j
+(of)e(a)h(netCDF)f(v)n(ariable)h(or)g(the)g(v)m(alue)h fi(0)p fm(.)31 b(The)
+19 b(size)h(of)e(the)h(v)o(ector)f(shall)i(b)r(e)f(at)f(least)240 1577 y(the)
+i(n)o(um)o(b)r(er)g(of)g(dimensions)h(of)f(the)h(associated)g(netCDF)f(v)m
+(ariable)h(and)g(its)f(elements)g(shall)240 1639 y(corresp)q(ond,)k(in)f(orde\
+r,)g(to)e(the)i(v)m(ariable's)g(dimensions.)42 b(A)22 b(v)n(alue)g(of)g(1)g
+(accesses)g(adjacen)o(t)240 1702 y(v)m(alues)e(of)e(the)g(netCDF)g(v)n(ariabl\
+e)h(in)h(the)e(corresp)q(onding)i(dimension;)h(a)e(v)m(alue)g(of)f(2)h(access\
+es)240 1764 y(ev)o(ery)e(other)f(v)n(alue)h(of)g(the)f(netCDF)h(v)m(ariable)h
+(in)f(the)g(corresp)q(onding)h(dimension;)h(and)e(so)f(on.)240 1826 y(An)c fi
+(0)g fm(argumen)n(t)g(obtains)f(the)h(default)h(b)q(eha)o(vior)f(in)g(which)g
+(adjacen)o(t)f(v)n(alues)h(are)g(accessed)g(along)240 1888 y(eac)o(h)j(dimens\
+ion.)0 1968 y fi(IMAP)144 b fm(A)19 b(v)o(ector)f(of)h(long)g(integers)f(sp)r
+(ecifying,)j(for)d(eac)o(h)h(dimension,)j(ho)n(w)d(data)g(v)m(alues)h(associa\
+ted)240 2030 y(with)d(a)f(netCDF)g(v)n(ariable)h(are)f(arranged)h(in)g(memory)
+f(or)g(the)h(v)m(alue)h fi(0)p fm(.)24 b(The)17 b(o\013set,)f(in)i(b)o(ytes,)
+240 2092 y(from)c(the)i(memory)e(lo)r(cation)h(p)r(oin)o(ted)g(to)g(b)o(y)g
+(the)g fi(value)f fm(argumen)o(t)h(to)f(a)h(particular)h(datum)e(is)240 2155 y
+(giv)o(en)g(b)o(y)f(the)h(inner)g(pro)q(duct)g(of)f(the)h(index)g(mapping)g
+(v)o(ector)f(with)h(the)f(\(origin-0\))h(co)q(ordinates)240 2217 y(of)i(the)g
+(datum.)21 b(\(The)16 b fh(inner)h(pro)q(duct)h fm(of)d(t)n(w)o(o)h(v)n(ector\
+s)g([x1,)f(x2,)g ff(:)8 b(:)f(:)o fm(,)16 b(xn])g(and)g([y1,)f(y2,)g ff(:)8 b
+(:)f(:)o fm(,)16 b(yn])240 2279 y(is)i(just)g(x1*y1)f fi(+)g fm(x2*y2)g fi
+(+)h ff(:)7 b(:)g(:)18 b fi(+)f fm(xn*yn.\))28 b(The)18 b(v)n(ector)g(ma)n
+(y)g(con)o(tain)g(negativ)o(e)g(v)m(alues)h(if)f(the)240 2341 y fi(value)c fm
+(argumen)n(t)g(is)h(appropriately)g(sp)q(eci\014ed.)22 b(A)14 b fi(0)g fm(arg\
+umen)o(t)g(obtains)g(the)h(default)f(b)r(eha)o(vior)240 2404 y(in)19 b(which)
+g(the)f(memory-resident)g(v)m(alues)h(are)g(assumed)f(to)g(ha)o(v)n(e)h(the)f
+(same)h(structure)f(as)g(the)240 2466 y(asso)q(ciated)d(netCDF)g(v)m(ariable.)
+0 2545 y fi(VALUES)96 b fm(F)l(or)16 b fi(NCVPTG)p fm(,)g(the)g(blo)r(c)o(k)h
+(of)f(data)g(v)n(alues)h(to)f(b)q(e)h(written.)24 b(The)17 b(order)g(in)g(whi\
+ch)g(the)f(data)g(will)240 2608 y(b)r(e)h(written)g(from)g(the)g(sp)r(eci\014\
+ed)i(h)o(yp)q(erslab)f(is)g(with)g(the)f(\014rst)g(dimension)i(of)e(the)g(gen\
+eralized)240 2670 y(h)o(yp)q(erslab)j(v)n(arying)f(fastest)g(\(lik)o(e)h(the)
+f(ordinary)h(F)n(OR)m(TRAN)g(con)o(v)o(en)o(tion\).)32 b(The)20 b(data)f(ma)n
+(y)p eop
+%%Page: 95 97
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(95)240 183 y(b)r(e)19 b
+(of)f(a)h(t)n(yp)r(e)g(corresp)q(onding)h(to)e(an)o(y)h(of)g(the)g(netCDF)f
+(t)n(yp)r(es)h fi(NCSHORT)p fm(,)g fi(NCLONG)p fm(,)f fi(NCFLOAT)p fm(,)240
+246 y(or)d fi(NCDOUBLE)p fm(,)f(but)i(m)n(ust)g(b)q(e)g(appropriate)g(for)f
+(the)g(t)o(yp)q(e)h(of)f(the)h(netCDF)e(v)n(ariable.)22 b fg(W)l(arning:)240
+308 y(neither)c(the)e(compiler)i(nor)e(the)g(netCDF)h(soft)n(w)n(are)g(can)g
+(detect)f(whether)h(the)f(wrong)g(t)o(yp)q(e)g(of)240 370 y(data)f(is)h(used.)
+0 445 y fi(STRING)96 b fm(F)l(or)17 b fi(NCVPGC)p fm(,)h(the)g(c)o(haracters)
+f(to)h(b)q(e)g(written.)29 b(The)18 b(order)g(in)g(which)g(the)g(c)o(haracter\
+s)g(will)h(b)r(e)240 507 y(written)f(to)g(the)h(netCDF)e(v)n(ariable)i(is)g
+(with)g(the)f(\014rst)h(dimension)h(of)e(the)g(generalized)i(h)o(yp)r(er-)240
+569 y(slab)i(v)m(arying)g(fastest)e(\(like)h(the)h(F)n(OR)m(TRAN)g(con)o(v)o
+(en)o(tion\).)38 b(The)22 b(data)e(ma)o(y)h(b)q(e)h(of)f(a)g(t)n(yp)r(e)240
+632 y(corresp)q(onding)16 b(to)f(the)g(netCDF)g(t)n(yp)q(es)h fi(NCCHAR)e fm
+(or)h fi(NCBYTE)p fm(.)0 706 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q
+(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 918 y(Here)
+i(is)g(an)g(example)g(using)h fi(NCVPTG)e fm(to)g(add)g(or)h(c)o(hange)f(ev)o
+(ery)h(other)f(v)n(alue)h(in)h(eac)n(h)f(dimension)i(of)d(the)0 980 y(v)m(ari\
+able)22 b(named)e fi(rh)g fm(to)g fi(0.5)f fm(in)i(an)g(existing)g(netCDF)e
+(\014le)j(named)e(`)p fi(foo.nc)p fm('.)33 b(V)m(alues)21 b(are)f(tak)n(en,)h
+(using)0 1043 y(the)d(same)g(dimensional)i(strides,)f(from)f(a)g(2-parameter)
+f(arra)n(y)h(whose)g(dimensions)i(are)e(the)g(rev)o(erse)g(of)g(the)0 1105 y
+(netCDF)d(v)m(ariable.)22 b(F)l(or)15 b(simplicit)q(y)g(in)i(this)e(example,)
+h(w)o(e)g(assume)f(that)g(w)n(e)h(kno)o(w)f(that)g fi(rh)g fm(is)h(dimensione\
+d)0 1167 y(with)e fi(lon)p fm(,)g fi(lat)p fm(,)f(and)h fi(time)p fm(,)f(and)
+h(that)f(there)h(are)g(ten)g fi(lon)f fm(v)n(alues,)h(\014v)o(e)g fi(lat)g fm
+(v)m(alues,)h(and)f(three)g fi(time)f fm(v)n(alues.)263 1304 y fi(INCLUDE)23 b
+('netcdf.inc')335 1354 y ff(:)7 b(:)g(:)263 1404 y fi(PARAMETER)23 b(\(NDIMS=\
+3\))213 b(!)24 b(number)f(of)h(dimensions)263 1453 y(PARAMETER)f(\(TIMES=3,)f
+(LATS=5,)h(LONS=10\))g(!)h(dimension)e(sizes)263 1503 y(INTEGER)47 b(NCID,)23
+b(RCODE)263 1553 y(INTEGER)47 b(RHID)357 b(!)24 b(variable)f(ID)263 1603 y
+(INTEGER)47 b(START\(NDIMS\),)22 b(COUNT\(NDIMS\),)239 1653 y(+)215 b(STRIDE\
+\(NDIMS\),)22 b(IMAP\(NDIMS\))46 b(!)24 b(generalized)e(hyperslab)263 1703 y
+(DOUBLE)h(DATA\(2,)g(TIMES,)g(LATS,)g(LONS\))95 b(!)24 b(rh)f(is)h(second)f
+(parameter)263 1752 y(DATA)g(START)h(/1,)f(1,)h(1/)190 b(!)24 b(start)f(at)h
+(first)f(value)263 1802 y(DATA)g(COUNT)h(/LONS,)f(LATS,)g(TIMES/)263 1852 y
+(DATA)g(STRIDE)h(/2,)f(2,)h(2/)335 1902 y ff(:)7 b(:)g(:)263 1952 y fi(NCID)
+23 b(=)h(NCOPN)f(\('foo.nc',)g(NCWRITE,)g(RCODE\))335 2001 y ff(:)7 b(:)g(:)
+263 2051 y fi(RHID)23 b(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\))70 b(!)24 b(get)
+g(ID)263 2101 y(DO)g(10)f(ILON)h(=)f(1,)h(LONGS,)f(STRIDE\(1\))335 2151 y(DO)
+g(10)h(ILAT)f(=)h(1,)g(LATS,)f(STRIDE\(2\))406 2201 y(DO)h(10)g(ITIME)f(=)g
+(1,)h(TIMES,)f(STRIDE\(3\))478 2250 y(DATA\(2,)g(ITIME,)g(ILAT,)g(ILON\))g
+(=)h(0.5)192 2300 y(10)f(CONTINUE)263 2350 y(IMAP\(3\))g(=)h(8*2*2)71 b(!)23 b
+(every)h(other)f(point)g(of)h(vector)f(of)g(2-doubles)263 2400 y(IMAP\(2\))g
+(=)h(IMAP\(3\)*\(1+\(TIMES-1\)/STRI)o(DE\(3\)\)*)o(2)263 2450 y(IMAP\(1\))f
+(=)h(IMAP\(2\)*\(1+\(LATS-1\)/STRID)o(E\(2\)\)*2)263 2500 y(CALL)f(NCVPTG)h
+(\(NCID,)f(RHID,)g(START,)g(COUNT,)g(STRIDE,)g(IMAP,)239 2549 y(+)310 b(DATA\
+\(2,1,1,1\),)22 b(RCODE\))p eop
+%%Page: 96 98
+ bop 0 -58 a fm(96)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(7.7)33 b(Put)
+15 b(a)g(Record)62 321 y fm(The)j(function)g fi(ncrecput)e fm(writes)h(a)g
+(m)o(ulti-v)o(ariable)h(record)f(of)g(v)m(alues)h(\(or)f(part)f(of)h(a)g(reco\
+rd)g(of)g(v)n(alues\))0 383 y(into)12 b(the)h(record)f(v)n(ariables)i(of)e
+(an)h(op)q(en)g(netCDF)f(\014le.)20 b(The)13 b(record)g(is)g(sp)r(eci\014ed)h
+(b)o(y)f(giving)h(a)e(record)h(n)o(um)o(b)q(er.)0 445 y(The)f(v)n(alues)h(to)
+e(b)r(e)h(written)g(are)g(sp)q(eci\014ed)i(b)o(y)e(an)g(arra)n(y)g(of)f(p)r
+(oin)o(ters,)h(one)g(for)g(eac)o(h)g(record)g(v)n(ariable,)h(to)e(blo)r(c)o
+(ks)0 507 y(of)16 b(v)m(alues.)24 b(Eac)o(h)17 b(blo)q(c)o(k)g(of)f(v)m(alues)
+h(should)g(b)r(e)f(of)g(the)h(appropriate)f(size)h(and)g(t)n(yp)r(e)f(for)g
+(a)g(record's)g(w)o(orth)f(of)0 570 y(data)i(for)g(the)h(corresp)q(onding)g
+(record)g(v)m(ariable.)28 b(Eac)o(h)18 b(suc)o(h)g(p)q(oin)o(ter)g(m)n(ust)g
+(b)q(e)g(either)g(NULL,)g(to)f(indicate)0 632 y(that)d(no)g(data)g(is)h(to)f
+(b)q(e)h(written)g(for)e(that)h(v)n(ariable,)h(or)f(m)n(ust)h(p)q(oint)f(to)g
+(an)g(en)o(tire)h(record's)f(w)o(orth)f(of)i(data)e(of)0 694 y(the)h(appropri\
+ate)g(t)o(yp)q(e)h(for)e(the)h(corresp)q(onding)h(record)f(v)n(ariable.)20 b
+(The)15 b(v)m(alues)g(for)e(eac)o(h)i(record)f(v)m(ariable)h(are)0 757 y(assu\
+med)i(to)e(b)r(e)h(ordered)h(with)g(the)f(last)h(dimension)h(v)m(arying)f(fas\
+test.)22 b(The)17 b(netCDF)f(\014le)h(m)o(ust)f(b)r(e)g(in)i(data)0 819 y(mo)
+q(de.)62 956 y(The)i fi(ncrecput)e fm(function)j(is)f(not)f(strictly)h(necess\
+ary)l(,)g(since)h(the)e(same)g(data)g(ma)n(y)h(b)q(e)g(written)f(with)h(a)0
+1018 y(sequence)11 b(of)f(calls)h(to)f fi(ncvarput)p fm(,)f(one)i(for)e(eac)o
+(h)h(record)h(v)m(ariable)g(for)f(whic)o(h)h(a)e(non-NULL)j(p)q(ointer)e(is)g
+(sp)r(eci\014ed.)0 1081 y(This)i(function)h(is)f(pro)n(vided)h(in)g(the)e(C)h
+(interface)f(for)g(con)o(v)n(enience)j(only;)f(no)f(corresp)q(onding)g(F)l
+(ortran)f(in)o(terface)0 1143 y(is)16 b(a)n(v)n(ailable,)g(so)f(F)l(ortran)f
+(users)h(should)h(use)g(m)o(ultiple)h(calls)f(to)f fi(NCVPT)f fm(or)h fi(NCVP\
+TC)f fm(instead.)62 1280 y(T)l(o)i(use)h fi(ncrecput)d fm(prop)r(erly)m(,)i
+(y)n(ou)g(m)o(ust)g(kno)o(w)f(the)i(n)o(um)n(b)r(er,)f(order,)g(and)g(t)n(yp)
+r(es)g(of)g(record)g(v)m(ariables)h(in)0 1343 y(the)d(netCDF)g(\014le,)h(info\
+rmation)f(that)g(can)g(b)r(e)g(determined)i(with)e(a)g(call)i(to)d fi(ncrecin\
+q)p fm(.)19 b(If)14 b(y)o(our)g(assumptions)0 1405 y(ab)q(out)j(the)g(n)o(um)
+o(b)q(er,)g(order,)g(or)f(t)o(yp)q(es)h(of)g(record)f(v)n(ariables)i(in)f(the)
+g(\014le)h(is)g(incorrect,)f(calling)i(this)e(function)0 1467 y(ma)n(y)e(lead)
+g(to)f(incorrect)h(results)g(or)f(ev)o(en)g(a)h(segmen)o(tation)f(violation.)
+20 b fg(W)l(arning:)h(neither)c(the)d(compiler)j(nor)0 1529 y(the)e(netCDF)h
+(soft)n(w)o(are)f(can)h(detect)g(errors)g(with)g(the)f(p)q(ointer)g(array)g
+(argument)g(to)f fi(ncrecput)p fg(.)62 1667 y fm(In)i(case)f(of)g(a)g(detecte\
+d)h(error,)e fi(ncrecput)g fm(returns)h(-1.)20 b(P)n(ossible)d(causes)e(of)g
+(detectable)h(errors)f(include:)37 1804 y fk(\017)30 b fm(The)15 b(sp)r(eci\
+\014ed)i(record)e(n)o(um)o(b)q(er)g(is)h(less)g(than)f(zero.)37 1879 y fk(\
+\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(\014le)j(is)e(in)h(de\014ne)h
+(mode)f(rather)f(than)g(data)f(mo)q(de.)37 1955 y fk(\017)30 b fm(The)15 b
+(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g
+(netCDF)g(\014le.)0 2258 y fl(ncrecput:)24 b(C)14 b(In)n(terface)120 2395 y fi
+(int)23 b(ncrecput\(int)g(ncid,)g(long)g(recnum,)g(const)g(void)h(*datap[]\);)
+0 2533 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(cal\
+l)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 2608 y fi(recnum)96 b fm
+(Record)18 b(n)o(um)o(b)r(er,)f(sp)r(ecifying)i(the)e(v)n(alue)h(of)f(the)h
+(unlimited)i(dimension)f(for)e(which)h(data)f(is)h(to)240 2670 y(b)r(e)f(writ\
+ten.)26 b(The)18 b(\014rst)f(record)g(is)h(record)f(n)o(um)o(b)q(er)g fi(0)p
+fm(.)26 b(Note)17 b(that)g(if)h(y)n(ou)g(sp)q(ecify)g(a)f(v)n(alue)h(for)p eop
+%%Page: 97 99
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(97)240 183 y fi(recnum)
+20 b fm(that)g(is)h(larger)f(than)h(the)g(curren)o(t)f(size)i(of)e(the)h(unli\
+mited)i(dimension,)g(interv)n(ening)240 246 y(records)13 b(will)i(b)q(e)e(wri\
+tten)g(with)h(\014ll)g(v)m(alues)g(b)r(efore)e(the)i(data)e(is)h(written)g
+(in)h(the)f(sp)r(eci\014ed)h(record,)240 308 y(unless)i fi(ncsetfill)e fm(has)
+h(b)r(een)h(called)g(to)f(sp)q(ecify)h(no)g(pre\014lling.)0 382 y fi(datap)
+120 b fm(Arra)n(y)16 b(of)g(p)r(oin)o(ters)g(to)g(blo)r(c)o(ks)g(of)g(data)f
+(v)n(alues)i(to)f(b)q(e)h(written,)f(one)h(for)e(eac)o(h)i(record)f(v)m(ariab\
+le.)240 445 y fi(datap[i])p fm(,)i(if)h(non-NULL,)g(m)o(ust)f(p)q(oint)g(to)f
+(an)i(en)o(tire)g(record's)f(w)n(orth)g(of)g(data)g(for)g(the)g fi(i)p fm(-th)
+240 507 y(record)i(v)n(ariable.)36 b(F)l(or)20 b(NULL)i(p)q(ointers,)f(no)f
+(data)g(will)i(b)q(e)f(written)g(for)e(the)i(corresp)q(onding)240 569 y(recor\
+d)c(v)n(ariables.)27 b(This)18 b(p)q(ermits)g(y)o(ou)f(to)g(sp)q(ecify)h(an)g
+(arbitrary)e(subset)i(of)f(record)g(v)m(ariables.)240 632 y(The)d(data)g(p)q
+(ointed)g(to)f(should)i(b)r(e)f(of)g(the)g(appropriate)g(t)o(yp)q(e)g(for)g
+(eac)o(h)g(record)g(v)m(ariable.)21 b fg(W)l(arn-)240 694 y(ing:)e(neither)c
+(the)e(compiler)h(nor)f(the)g(netCDF)g(soft)n(w)o(are)g(can)h(detect)f(whethe\
+r)g(the)g(wrong)g(t)n(yp)r(e)240 756 y(of)i(data)g(is)h(used.)62 968 y fm(Her\
+e)h(is)g(an)g(example)g(using)g fi(ncrecput)f fm(to)g(write)h(the)f(v)n(alue)
+h(of)f(a)h(C)f(struct)g(into)g(a)g(netCDF)g(\014le)h(with)g(a)0 1030 y(single)
+h(call.)25 b(This)17 b(example)g(assumes)f(that)g(record)g(v)n(ariables)h(of)
+f(the)h(appropriate)f(shap)r(es)g(and)h(t)n(yp)r(es)f(ha)o(v)o(e)0 1092 y(pre\
+viously)h(b)q(een)f(created)f(in)h(the)f(netCDF)g(\014le.)120 1229 y fi(#incl\
+ude)23 b("netcdf.h")192 1279 y ff(:)7 b(:)g(:)215 1329 y fi(static)23 b(struc\
+t)h({)215 1379 y(char)g(city[20];)215 1429 y(long)g(date;)215 1478 y(float)g
+(lat;)215 1528 y(float)g(lon;)215 1578 y(float)g(precip[24];)261 b(/*)23 b
+(hourly)g(precipitation)f(*/)215 1628 y(})i(rec)g(=)f({)311 1678 y("Pocatello\
+",)311 1727 y(930228,)311 1777 y(42.92,)311 1827 y(-112.60,)311 1877 y({0,0,.\
+1,.2,.2,.3,.2,0,0,0)o(,0,0,0,0)o(,0,0,.3)o(,1.1,0,)o(0,0,0,0,)o(0})215 1927 y
+(};)215 2026 y(int)h(ncid;)453 b(/*)23 b(id)h(of)f(open)h(netcdf)f(file)g(*/)
+215 2076 y(long)h(recnum;)381 b(/*)23 b(number)g(of)h(record)f(to)g(write)h
+(*/)215 2126 y(void)g(*datap[5];)309 b(/*)23 b(array)g(of)h(address)f(pointer\
+s)g(for)g(record)120 2176 y(vars)g(*/)215 2226 y ff(:)8 b(:)f(:)215 2275 y fi
+(datap[0])23 b(=)h(&rec.city[0];)215 2325 y(datap[1])f(=)h(&rec.date;)215 2375
+y(datap[2])f(=)h(&rec.lat;)215 2425 y(datap[3])f(=)h(&rec.lon;)215 2475 y(dat\
+ap[4])f(=)h(&rec.precip[0];)215 2574 y(ncrecput\(ncid,)e(recnum,)h(datap\);)
+47 b(/*)24 b(instead)f(of)g(5)h(calls)f(to)h(ncvarget)e(*/)p eop
+%%Page: 98 100
+ bop 0 -58 a fm(98)1465 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(7.8)33 b(Read)
+15 b(a)f(Single)j(Data)d(V)-6 b(alue)62 324 y fm(The)16 b(function)g fi(ncvar\
+get1)e fm(\(or)g fi(NCVGT1)h fm(or)f fi(NCVG1C)h fm(for)g(F)n(OR)m(TRAN\))g
+(gets)g(a)g(single)i(data)d(v)n(alue)i(from)e(a)0 387 y(v)m(ariable)j(of)d
+(an)i(op)q(en)g(netCDF)e(\014le)i(that)f(is)h(in)g(data)e(mo)q(de.)21 b(Input\
+s)16 b(are)e(the)i(netCDF)e(ID,)h(the)h(v)m(ariable)g(ID,)0 449 y(a)d(m)o(ult\
+idimensional)j(index)f(that)d(sp)r(eci\014es)i(which)g(v)m(alue)g(to)f(get,)g
+(and)g(the)h(address)f(of)g(a)g(lo)q(cation)h(in)o(to)f(which)0 511 y(the)i
+(data)g(v)m(alue)h(will)h(b)r(e)e(read.)62 652 y(In)j(case)g(of)f(an)g(error,)
+g fi(ncvarget1)f fm(returns)h(-1;)h fi(NCVGT1)f fm(returns)g(a)g(nonzero)g
+(v)n(alue)h(in)g fi(rcode)p fm(.)26 b(P)o(ossible)0 715 y(causes)15 b(of)g
+(errors)g(include:)37 856 y fk(\017)30 b fm(The)15 b(v)n(ariable)h(ID)f(is)h
+(inv)m(alid)g(for)f(the)g(sp)r(eci\014ed)i(netCDF)d(\014le.)37 935 y fk(\017)
+30 b fm(The)19 b(sp)q(eci\014ed)h(indices)h(w)o(ere)d(out)g(of)h(range)f(for)
+g(the)g(dimensionalit)q(y)h(of)f(the)h(sp)q(eci\014ed)h(v)n(ariable.)31 b(F)
+-5 b(or)90 997 y(example,)14 b(a)f(negativ)n(e)h(index)g(or)e(an)h(index)h
+(that)f(is)g(larger)g(than)g(the)g(corresp)q(onding)h(dimension)g(size)g(will)
+90 1059 y(cause)h(an)h(error.)37 1138 y fk(\017)30 b fm(The)15 b(sp)r(eci\014\
+ed)i(netCDF)d(is)i(in)g(de\014ne)g(mo)q(de)g(rather)e(than)h(data)g(mo)q(de.)
+37 1217 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f
+(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1557 y fl(ncv)l(arget1:)
+23 b(C)14 b(In)n(terface)120 1699 y fi(int)23 b(ncvarget1\(int)g(ncid,)g(int)
+g(varid,)g(const)g(long)h(mindex[],)e(void)i(*value\);)0 1919 y(ncid)144 b fm
+(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm
+(or)h fi(nccreate)p fm(.)0 1997 y fi(varid)120 b fm(V)l(ariable)16 b(ID,)f
+(returned)h(from)e(a)h(previous)h(call)h(to)d fi(ncvardef)g fm(or)h fi(ncvari\
+d)p fm(.)0 2076 y fi(mindex)96 b fm(The)16 b(m)o(ultidimensional)j(index)e
+(of)e(the)h(the)f(data)g(v)n(alue)h(to)g(b)q(e)g(read.)21 b(The)16 b(indices)
+i(are)d(relative)240 2139 y(to)c(0,)h(so)g(for)f(example,)j(the)e(\014rst)f
+(data)h(v)m(alue)h(of)f(a)f(t)o(w)n(o-dimensional)j(v)n(ariable)f(w)n(ould)g
+(ha)o(v)n(e)g(index)240 2201 y fi(\(0,0\))p fm(.)20 b(The)c(elements)g(of)f fi
+(mindex)f fm(m)o(ust)h(corresp)r(ond)g(to)g(the)h(v)n(ariable's)g(dimensions.)
+22 b(Hence,)240 2263 y(if)16 b(the)f(v)m(ariable)i(is)e(a)g(record)g(v)n(aria\
+ble,)g(the)h(\014rst)f(index)h(is)g(the)f(record)g(n)o(um)o(b)r(er.)0 2342 y
+fi(value)120 b fm(P)o(oin)o(ter)14 b(to)f(the)h(lo)q(cation)g(into)f(which)h
+(the)g(data)f(v)n(alue)h(is)h(read.)k(The)14 b(p)r(oin)o(ter)g(is)g(declared)
+h(to)e(b)r(e)240 2404 y(of)h(the)g(t)n(yp)r(e)g fi(void)g(*)g fm(b)r(ecause)g
+(it)g(can)g(p)r(oin)o(t)g(to)f(data)g(of)h(an)o(y)g(of)f(the)h(basic)h(netCDF)
+e(t)o(yp)q(es.)20 b(The)240 2467 y(data)13 b(should)i(b)r(e)f(of)g(the)g(appr\
+opriate)g(t)n(yp)r(e)g(for)f(the)h(netCDF)f(v)n(ariable.)20 b fg(W)l(arning:)
+h(neither)16 b(the)240 2529 y(compiler)21 b(nor)e(the)g(netCDF)g(soft)n(w)o
+(are)g(can)h(detect)f(whether)g(the)g(wrong)g(t)o(yp)q(e)g(for)g(the)g(data)
+240 2591 y(v)m(alue)e(is)f(used.)p eop
+%%Page: 99 101
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1491 b(99)62 183 y(Here)14 b
+(is)g(an)g(example)g(using)h fi(ncvarget1)d fm(to)h(get)g(the)h fi(\(1,2,3\))
+f fm(element)g(of)g(the)h(v)n(ariable)g(named)g fi(rh)g fm(in)g(an)0 246 y
+(existing)g(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm('.)j(F)l(or)c(simpli\
+cit)q(y)g(in)h(this)g(example,)g(w)o(e)f(assume)g(that)g(w)n(e)h(kno)o(w)f
+(that)0 308 y fi(rh)i fm(is)h(dimensioned)h(with)f fi(time)p fm(,)f fi(lat)p
+fm(,)f(and)i fi(lon)p fm(,)e(so)h(w)o(e)g(w)o(an)o(t)g(to)f(get)h(the)h(v)m
+(alue)g(of)f fi(rh)g fm(that)g(corresp)q(onds)h(to)0 370 y(the)f(second)h fi
+(time)f fm(v)m(alue,)h(the)f(third)h fi(lat)e fm(v)n(alue,)h(and)h(the)f(four\
+th)g fi(lon)g fm(v)m(alue:)120 511 y fi(#include)23 b("netcdf.h")192 561 y ff
+(:)7 b(:)g(:)120 611 y fi(int)23 b(ncid;)716 b(/*)23 b(netCDF)g(ID)h(*/)120
+661 y(int)f(rh_id;)692 b(/*)23 b(variable)g(ID)h(*/)120 711 y(static)f(long)g
+(rh_index[])g(=)h({1,)f(2,)h(3};)47 b(/*)24 b(where)f(to)g(get)h(value)f(from)
+g(*/)120 761 y(double)g(rh_val;)596 b(/*)23 b(where)g(to)h(put)f(it)h(*/)192
+810 y ff(:)7 b(:)g(:)120 860 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e(NC_NOWRIT\
+E\);)192 910 y ff(:)7 b(:)g(:)120 960 y fi(rh_id)23 b(=)h(ncvarid)f(\(ncid,)g
+("rh"\);)192 1010 y ff(:)7 b(:)g(:)120 1059 y fi(ncvarget1\(ncid,)22 b(rh_id,)
+h(rh_index,)f(\(void)i(*\))f(&rh_val\);)0 1398 y fl(NCV)n(GT1:)e(F)n(OR)-6 b
+(TRAN)15 b(In)n(terface)263 1540 y fi(SUBROUTINE)23 b(NCVGT1)g(\(INTEGER)f
+(NCID,)i(INTEGER)f(VARID,)239 1589 y(+)h(INTEGER)f(MINDEX\(*\),)f fh(t)o(yp)q
+(e)27 b fi(VALUE,)239 1639 y(+)d(INTEGER)f(RCODE\))263 1739 y(SUBROUTINE)g
+(NCVG1C)g(\(INTEGER)f(NCID,)i(INTEGER)f(VARID,)239 1789 y(+)h(INTEGER)f(MINDE\
+X\(*\),)f(CHARACTER)h(CHVAL,)239 1838 y(+)h(INTEGER)f(RCODE\))62 2059 y fm
+(There)18 b(are)f(t)o(w)n(o)h(F)n(OR)m(TRAN)g(subroutines,)h fi(NCVGT1)e fm
+(and)g fi(NCVG1C)p fm(,)g(for)g(reading)h(a)g(single)h(v)m(alue)f(from)f(a)0
+2121 y(v)m(ariable.)32 b(The)19 b(\014rst)g(reads)g(a)f(n)o(umeric)i(v)m(alue)
+g(in)g(a)e(v)n(ariable)h(of)g(n)o(umeric)h(t)n(yp)r(e,)f(and)g(the)g(second)h
+(reads)e(a)0 2183 y(c)o(haracter)c(v)n(alue)i(in)g(a)f(v)m(ariable)h(of)f(c)o
+(haracter)g(t)n(yp)r(e.)0 2325 y fi(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)
+h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 2404
+y fi(VARID)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e(a)h(previous)h
+(call)h(to)d fi(NCVDEF)g fm(or)h fi(NCVID)p fm(.)0 2483 y fi(MINDEX)96 b fm
+(The)16 b(m)o(ultidimensional)j(index)e(of)e(the)h(the)f(data)g(v)n(alue)h
+(to)g(b)q(e)g(read.)21 b(The)16 b(indices)i(are)d(relative)240 2545 y(to)d
+(1,)h(so)f(for)g(example,)h(the)g(\014rst)f(data)g(v)n(alue)h(of)g(a)f(t)n
+(w)o(o-dimensional)j(v)m(ariable)f(has)e(index)i fi(\(1,1\))p fm(.)240 2608 y
+(The)g(elements)f(of)g fi(mindex)f fm(corresp)r(ond)h(to)g(the)h(v)m(ariable'\
+s)g(dimensions.)21 b(Hence,)14 b(if)g(the)g(v)m(ariable)240 2670 y(is)i(a)f
+(record)g(v)m(ariable,)h(the)f(last)g(index)i(is)f(the)f(record)g(n)o(um)o
+(b)q(er.)p eop
+%%Page: 100 102
+ bop 0 -58 a fm(100)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fi(VALUE)120 b
+fm(F)l(or)19 b fi(NCVGT1)p fm(,)g(the)h(lo)r(cation)g(in)o(to)f(which)h(the)f
+(data)g(v)n(alue)h(will)h(b)r(e)f(read.)33 b(The)19 b(data)g(ma)o(y)g(b)r(e)
+240 246 y(of)g(a)g(t)n(yp)r(e)g(corresp)r(onding)h(to)f(an)n(y)h(of)f(the)g
+(netCDF)g(t)n(yp)r(es)g fi(NCSHORT)p fm(,)g fi(NCLONG)p fm(,)g fi(NCFLOAT)p fm
+(,)g(or)240 308 y fi(NCDOUBLE)p fm(,)g(but)h(m)n(ust)g(b)q(e)g(appropriate)f
+(for)g(the)h(t)n(yp)r(e)f(of)g(the)h(netCDF)f(v)m(ariable.)34 b fg(W)l(arning\
+:)240 370 y(neither)18 b(the)e(compiler)i(nor)e(the)g(netCDF)h(soft)n(w)n(are)
+g(can)g(detect)f(whether)h(the)f(wrong)g(t)o(yp)q(e)g(of)240 432 y(data)f(is)
+h(used.)0 507 y fi(CHVAL)120 b fm(F)l(or)16 b fi(NCVG1C)p fm(,)h(the)g(lo)q
+(cation)h(in)o(to)f(whic)o(h)h(the)f(data)f(v)n(alue)h(will)i(b)r(e)e(read.)
+25 b(This)18 b(should)g(b)q(e)g(of)e(a)240 569 y(t)n(yp)r(e)f(c)o(haracter,)f
+(corresp)r(onding)i(to)e(the)h(netCDF)g(t)n(yp)r(es)g fi(NCCHAR)f fm(or)h fi
+(NCBYTE)p fm(.)0 644 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b
+(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 856 y(Here)j(is)h
+(an)f(example)g(using)h fi(NCVGT1)e fm(to)g(get)h(the)g fi(\(4,3,2\))e fm(ele\
+ment)i(of)f(the)h(v)n(ariable)h(named)f fi(rh)f fm(in)i(an)0 918 y(existing)
+14 b(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm('.)j(F)l(or)c(simplicit)q
+(y)g(in)h(this)g(example,)g(w)o(e)f(assume)g(that)g(w)n(e)h(kno)o(w)f(that)0
+980 y fi(rh)i fm(is)h(dimensioned)h(with)f fi(lon)p fm(,)f fi(lat)p fm(,)f
+(and)i fi(time)p fm(,)e(so)h(w)o(e)g(w)o(an)o(t)g(to)f(get)h(the)h(v)m(alue)g
+(of)f fi(rh)g fm(that)g(corresp)q(onds)h(to)0 1043 y(the)f(fourth)g fi(lon)g
+fm(v)m(alue,)h(the)f(third)h fi(lat)f fm(v)m(alue,)h(and)f(the)g(second)h fi
+(time)f fm(v)m(alue:)263 1180 y fi(INCLUDE)23 b('netcdf.inc')335 1229 y ff
+(:)7 b(:)g(:)263 1279 y fi(INTEGER)23 b(NCID,)g(RCODE)263 1329 y(INTEGER)g
+(RHID)g(!)h(variable)f(ID)263 1379 y(INTEGER)g(RHINDX\(3\))g(!)g(where)h(to)f
+(get)h(value)263 1429 y(DOUBLE)f(PRECISION)g(RHVAL)g(!)h(put)f(it)h(here)263
+1478 y(DATA)f(RHINDX)h(/4,)f(3,)h(2/)335 1528 y ff(:)7 b(:)g(:)263 1578 y fi
+(NCID)23 b(=)h(NCOPN)f(\('foo.nc',)g(NCNOWRIT,)g(RCODE\))335 1628 y ff(:)7 b
+(:)g(:)263 1678 y fi(RHID)23 b(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\)!)f(get)g
+(ID)263 1727 y(CALL)g(NCVGT1)h(\(NCID,)f(RHID,)g(RHINDX,)g(RHVAL,)g(RCODE\))p
+eop
+%%Page: 101 103
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(101)0 183 y fl(7.9)33 b
+(Read)15 b(a)f(Hyp)s(erslab)h(of)g(V)-6 b(alues)62 323 y fm(The)17 b(function)
+g fi(ncvarget)e fm(\(or)h fi(NCVGT)f fm(or)h fi(NCVGTC)f fm(for)h(F)n(OR)n
+(TRAN\))g(reads)g(a)g(h)o(yp)r(erslab)g(of)g(v)n(alues)h(from)0 385 y(a)h(net\
+CDF)g(v)m(ariable)h(of)f(an)h(op)q(en)g(netCDF)e(\014le.)31 b(The)18 b(h)o
+(yp)r(erslab)h(is)f(sp)r(eci\014ed)i(b)o(y)e(giving)h(a)f(corner)h(and)f(a)0
+447 y(v)o(ector)g(of)g(edge)i(lengths.)31 b(The)19 b(v)n(alues)g(are)g(read)f
+(into)g(consecutive)h(lo)q(cations)g(with)h(the)e(last)h(\(or)f(\014rst)h(for)
+0 510 y(F)n(OR)m(TRAN\))d(dimension)h(of)d(the)i(h)o(yp)q(erslab)g(v)m(arying)
+g(fastest.)i(The)e(netCDF)e(\014le)j(m)n(ust)e(b)r(e)g(in)h(data)f(mo)q(de.)
+62 649 y(In)21 b(case)f(of)g(an)g(error,)g fi(ncvarget)f fm(returns)h(-1;)i fi
+(NCVGT)d fm(returns)h(a)g(nonzero)g(v)n(alue)g(in)h fi(rcode)p fm(.)34 b(P)o
+(ossible)0 712 y(causes)15 b(of)g(errors)g(include:)37 851 y fk(\017)30 b fm
+(The)15 b(v)n(ariable)h(ID)f(is)h(inv)m(alid)g(for)f(the)g(sp)r(eci\014ed)i
+(netCDF)d(\014le.)37 929 y fk(\017)30 b fm(The)16 b(sp)q(eci\014ed)h(corner)e
+(indices)i(w)o(ere)e(out)g(of)g(range)g(for)g(the)g(dimensionalit)q(y)g(of)g
+(the)h(sp)q(eci\014ed)h(v)m(ariable.)90 991 y(F)l(or)c(example,)h(a)f(negativ)
+o(e)g(index)i(or)d(an)h(index)i(that)e(is)g(larger)g(than)h(the)f(corresp)q
+(onding)h(dimension)h(size)90 1053 y(will)i(cause)e(an)g(error.)37 1131 y fk
+(\017)30 b fm(The)20 b(sp)q(eci\014ed)h(edge)f(lengths)g(added)g(to)e(the)i
+(sp)q(eci\014ed)h(corner)f(w)n(ould)g(ha)o(v)o(e)f(referenced)i(data)d(out)h
+(of)90 1193 y(range)h(for)f(the)h(dimensionalit)q(y)g(of)f(the)h(sp)r(eci\014\
+ed)h(v)n(ariable.)35 b(F)l(or)19 b(example,)j(an)d(edge)i(length)f(that)f(is)
+90 1255 y(larger)c(than)g(the)g(corresp)r(onding)h(dimension)g(size)h(min)o
+(us)e(the)h(corner)f(index)h(will)h(cause)f(an)f(error.)37 1332 y fk(\017)30 b
+fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(is)i(in)g(de\014ne)g(mo)q(de)g(rather)e
+(than)h(data)g(mo)q(de.)37 1410 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i
+(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0
+1735 y fl(ncv)l(arget:)23 b(C)15 b(In)n(terface)120 1875 y fi(int)23 b(ncvarg\
+et\(int)g(ncid,)g(int)g(varid,)g(const)h(long)f(start[],)g(const)g(long)g(cou\
+nt[],)430 1925 y(void)h(*values\);)0 2142 y(ncid)144 b fm(NetCDF)14 b(ID,)h
+(returned)h(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)
+p fm(.)0 2219 y fi(varid)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e
+(a)h(previous)h(call)h(to)d fi(ncvardef)g fm(or)h fi(ncvarid)p fm(.)0 2296 y
+fi(start)120 b fm(A)19 b(v)o(ector)g(of)g(long)h(in)o(tegers)f(sp)r(ecifying)
+i(the)e(m)o(ultidimensional)j(index)f(of)e(the)h(corner)f(of)g(the)240 2359 y
+(h)o(yp)q(erslab)d(where)f(the)f(\014rst)h(of)f(the)h(data)e(v)n(alues)i(will)
+i(b)q(e)e(read)g(from.)j(The)d(indices)i(are)d(relative)240 2421 y(to)k(0,)g
+(so)g(for)g(example,)h(the)g(\014rst)f(data)f(v)n(alue)i(of)f(a)g(v)m(ariable)
+h(w)o(ould)g(ha)o(v)n(e)g(index)g fi(\(0,)c(0,)g ff(:)7 b(:)h(:)o fi(,)240
+2483 y(0\))p fm(.)22 b(The)16 b(size)h(of)f fi(start)f fm(m)o(ust)g(b)r(e)h
+(the)g(same)g(as)g(the)g(n)o(um)n(b)r(er)g(of)g(dimensions)h(of)f(the)g(sp)q
+(eci\014ed)240 2545 y(v)m(ariable.)21 b(The)13 b(elements)f(of)h fi(start)f fm
+(m)o(ust)h(corresp)q(ond)g(to)f(the)h(v)n(ariable's)g(dimensions)i(in)f(order\
+.)240 2608 y(Hence,)23 b(if)f(the)f(v)n(ariable)h(is)g(a)f(record)g(v)n(ariab\
+le,)i(the)e(\014rst)g(index)i(w)n(ould)g(corresp)q(ond)e(to)g(the)240 2670 y
+(starting)15 b(record)g(n)o(um)o(b)q(er)g(for)g(reading)h(the)f(data)f(v)n
+(alues.)p eop
+%%Page: 102 104
+ bop 0 -58 a fm(102)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fi(count)120 b
+fm(A)15 b(v)n(ector)f(of)g(long)h(integers)f(sp)q(ecifying)i(the)f(m)n(ultidi\
+mensional)j(edge)d(lengths)g(from)e(the)i(corner)240 246 y(of)f(the)h(h)n(yp)
+r(erslab)g(where)g(the)f(\014rst)g(of)g(the)h(data)e(v)n(alues)i(will)h(b)r
+(e)e(read.)20 b(T)l(o)14 b(read)g(a)g(single)i(v)n(alue,)240 308 y(for)21 b
+(example,)i(sp)r(ecify)f fi(count)f fm(as)g fi(\(1,)14 b(1,)h ff(:)7 b(:)h
+(:)o fi(,)15 b(1\))p fm(.)39 b(The)21 b(size)i(of)e fi(count)f fm(is)i(the)g
+(n)o(um)n(b)r(er)f(of)240 370 y(dimensions)13 b(of)e(the)h(sp)q(eci\014ed)i
+(v)m(ariable.)20 b(The)11 b(elemen)q(ts)g(of)g fi(count)g fm(corresp)q(ond)g
+(to)g(the)h(v)m(ariable's)240 432 y(dimensions.)42 b(Hence,)24 b(if)e(the)g
+(v)n(ariable)g(is)h(a)f(record)f(v)n(ariable,)j(the)e(\014rst)g(element)f(of)
+h fi(count)240 495 y fm(corresp)q(onds)15 b(to)g(a)g(coun)o(t)g(of)g(the)g
+(n)o(um)o(b)q(er)h(of)e(records)h(to)g(read.)0 575 y fi(value)120 b fm(P)o
+(oin)o(ter)15 b(to)f(the)h(\014rst)g(of)g(the)g(lo)r(cations)g(in)o(to)g(whic)
+o(h)h(the)f(data)f(v)n(alues)i(will)g(b)r(e)f(read.)20 b(The)15 b(order)240
+637 y(in)h(which)f(the)g(data)g(will)i(b)q(e)e(read)g(from)g(the)g(netCDF)g
+(v)m(ariable)h(is)g(with)f(the)g(last)h(dimension)g(of)240 700 y(the)f(sp)r
+(eci\014ed)h(h)o(yp)r(erslab)g(v)m(arying)f(fastest.)k(The)c(p)r(oin)o(ter)g
+(is)h(declared)g(to)f(b)q(e)g(of)g(the)g(t)o(yp)q(e)h fi(void)240 762 y(*)g fm
+(b)q(ecause)h(it)f(can)g(p)q(oint)f(to)g(data)h(of)f(an)o(y)h(of)f(the)h(basi\
+c)h(netCDF)e(t)n(yp)r(es.)22 b(The)16 b(data)f(should)i(b)r(e)240 824 y(of)f
+(the)h(appropriate)g(t)o(yp)q(e)g(for)g(the)g(netCDF)f(v)m(ariable.)26 b fg
+(W)l(arning:)f(neither)19 b(the)e(compiler)i(nor)240 886 y(the)c(netCDF)h(sof\
+t)n(w)o(are)f(can)h(detect)g(whether)g(the)f(wrong)g(t)o(yp)q(e)h(of)e(data)i
+(is)f(used.)62 1110 y fm(Here)20 b(is)g(an)f(example)h(using)g fi(ncvarget)e
+fm(to)h(read)g(all)h(the)g(v)m(alues)g(of)f(the)g(v)n(ariable)h(named)g fi
+(rh)e fm(from)h(an)0 1172 y(existing)14 b(netCDF)f(\014le)h(named)g(`)p fi
+(foo.nc)p fm('.)j(F)l(or)c(simplicit)q(y)g(in)h(this)g(example,)g(w)o(e)f(ass\
+ume)g(that)g(w)n(e)h(kno)o(w)f(that)0 1234 y fi(rh)i fm(is)i(dimensioned)h
+(with)e fi(time)p fm(,)f fi(lat)p fm(,)g(and)h fi(lon)p fm(,)f(and)h(that)f
+(there)h(are)f(three)h fi(time)f fm(v)n(alues,)h(\014v)o(e)g fi(lat)f fm(v)n
+(alues,)0 1297 y(and)g(ten)h fi(lon)e fm(v)n(alues.)120 1440 y fi(#include)23
+b("netcdf.h")192 1489 y ff(:)7 b(:)g(:)23 b fi(#define)g(TIMES)h(3)f(#define)
+g(LATS)h(5)f(#define)g(LONS)g(10)h(int)g(ncid;)f(/*)120 1539 y(netCDF)g(ID)h
+(*/)f(int)h(rh_id;)f(/*)g(variable)g(ID)h(*/)f(static)g(long)h(start[])f(=)g
+({0,)h(0,)120 1589 y(0};)f(/*)h(start)f(at)h(first)f(value)g(*/)h(static)f
+(long)g(count[])g(=)h({TIMES,)f(LATS,)120 1639 y(LONS};)g(double)g(rh_vals[TI\
+MES*LATS*LONS];)e(/*)i(array)g(to)h(hold)f(values)g(*/)192 1689 y ff(:)7 b
+(:)g(:)23 b fi(ncid)h(=)g(ncopen\("foo.nc",)d(NC_NOWRITE\);)192 1738 y ff(:)7
+b(:)g(:)23 b fi(rh_id)h(=)f(ncvarid)g(\(ncid,)g("rh"\);)192 1788 y ff(:)7 b
+(:)g(:)23 b fi(/*)h(read)f(hyperslab)g(of)h(values)f(from)g(netCDF)g(variable)
+g(*/)120 1838 y(ncvarget\(ncid,)f(rh_id,)h(start,)g(count,)g(\(void)g(*\))h
+(rh_vals\);)0 2191 y fl(NCV)n(GT,)14 b(NCV)n(GTC:)f(F)n(OR)-6 b(TRAN)15 b(In)
+n(terface)263 2334 y fi(SUBROUTINE)23 b(NCVGT)g(\(INTEGER)g(NCID,)g(INTEGER)g
+(VARID,)239 2384 y(+)h(INTEGER)f(START\(*\),)g(INTEGER)f(COUNT\(*\),)239 2434
+y(+)i fh(t)n(yp)r(e)j fi(VALUES,)22 b(INTEGER)h(RCODE\))263 2533 y(SUBROUTINE)
+g(NCVGTC\(INTEGER)f(NCID,)h(INTEGER)g(VARID,)239 2583 y(+)h(INTEGER)f(START\(\
+*\),)g(INTEGER)f(COUNTS\(*\),)239 2633 y(+)i(CHARACTER*\(*\))e(STRING,)h(INTE\
+GER)g(LENSTR,)239 2683 y(+)h(INTEGER)f(RCODE\))p eop
+%%Page: 103 105
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(103)62 183 y(There)20 b
+(are)f(t)n(w)o(o)g(F)n(OR)m(TRAN)h(subroutines,)g fi(NCVGT)f fm(and)g fi(NCVG\
+TC)p fm(,)g(for)g(reading)h(a)f(h)o(yp)q(erslab)h(of)f(v)m(alues)0 246 y(from)
+c(a)h(netCDF)g(v)m(ariable.)24 b(The)17 b(\014rst)f(reads)g(n)o(umeric)h(v)m
+(alues)g(from)f(a)g(v)m(ariable)h(of)f(n)o(umeric)h(t)o(yp)q(e,)f(and)h(the)0
+308 y(second)f(reads)f(c)o(haracter)f(v)n(alues)i(from)e(a)h(v)m(ariable)i
+(of)d(c)o(haracter)h(t)n(yp)r(e.)0 459 y fi(NCID)144 b fm(NetCDF)14 b(ID,)h
+(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm
+(.)0 547 y fi(VARID)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e(a)h(pre\
+vious)h(call)h(to)d fi(NCVDEF)g fm(or)h fi(NCVID)p fm(.)0 636 y fi(START)120 b
+fm(A)11 b(v)o(ector)g(of)f(integers)g(sp)r(ecifying)j(the)e(m)n(ultidimension\
+al)k(index)d(of)f(the)g(corner)g(of)g(the)g(h)o(yp)q(erslab)240 698 y(where)
+19 b(the)g(\014rst)g(of)g(the)g(data)f(v)n(alues)i(will)g(b)r(e)f(read.)31 b
+(The)20 b(indices)h(are)e(relativ)o(e)g(to)g(1,)g(so)g(for)240 760 y(example,)
+e(the)g(\014rst)f(data)g(v)m(alue)h(of)g(a)f(v)m(ariable)i(w)n(ould)f(ha)o
+(v)o(e)f(index)i fi(\(1,)d(1,)g ff(:)7 b(:)g(:)p fi(,)15 b(1\))p fm(.)23 b
+(The)17 b(size)240 822 y(of)d fi(START)g fm(m)o(ust)g(b)r(e)h(the)g(same)f
+(as)g(the)h(n)o(um)o(b)q(er)g(of)f(dimensions)j(of)d(the)h(sp)q(eci\014ed)i
+(v)m(ariable.)k(The)240 885 y(elements)14 b(of)f fi(START)g fm(m)o(ust)g(corr\
+esp)r(ond)h(to)f(the)h(v)m(ariable's)h(dimensions)g(in)g(order.)k(Hence,)c
+(if)f(the)240 947 y(v)m(ariable)21 b(is)f(a)f(record)g(v)m(ariable,)i(the)f
+(last)f(index)i(w)n(ould)f(corresp)r(ond)f(to)g(the)g(starting)g(record)240
+1009 y(n)o(um)o(b)q(er)d(for)e(reading)i(the)f(data)g(v)m(alues.)0 1098 y fi
+(COUNT)120 b fm(A)18 b(v)o(ector)g(of)g(integers)f(sp)r(ecifying)j(the)e(m)o
+(ultidimensional)j(edge)e(lengths)g(from)f(the)g(corner)g(of)240 1160 y(the)f
+(h)o(yp)r(erslab)h(where)f(the)h(\014rst)f(of)g(the)g(data)g(v)m(alues)i(will)
+g(b)q(e)f(read.)26 b(T)l(o)17 b(read)g(a)g(single)i(v)n(alue,)240 1222 y(for)
+i(example,)i(sp)r(ecify)f fi(COUNT)f fm(as)g fi(\(1,)14 b(1,)h ff(:)7 b(:)h
+(:)o fi(,)15 b(1\))p fm(.)39 b(The)21 b(size)i(of)e fi(COUNT)f fm(is)i(the)g
+(n)o(um)n(b)r(er)f(of)240 1285 y(dimensions)13 b(of)e(the)h(sp)q(eci\014ed)i
+(v)m(ariable.)20 b(The)11 b(elemen)q(ts)g(of)g fi(COUNT)g fm(corresp)q(ond)g
+(to)g(the)h(v)m(ariable's)240 1347 y(dimensions.)43 b(Hence,)25 b(if)e(the)f
+(v)n(ariable)h(is)g(a)f(record)g(v)n(ariable,)j(the)d(last)h(element)f(of)g fi
+(COUNT)240 1409 y fm(corresp)q(onds)15 b(to)g(a)g(coun)o(t)g(of)g(the)g(n)o
+(um)o(b)q(er)h(of)e(records)h(to)g(read.)0 1498 y fi(VALUES)96 b fm(F)l(or)11
+b fi(NCVGT)p fm(,)g(the)h(lo)r(cations)g(in)o(to)f(which)h(the)g(data)f(v)m
+(alues)i(will)g(b)r(e)f(read.)18 b(The)12 b(order)g(in)g(which)g(the)240 1560
+y(data)i(will)i(b)r(e)f(read)f(from)g(the)h(netCDF)f(v)m(ariable)i(is)f(with)
+g(the)f(\014rst)h(dimension)h(of)e(the)h(sp)q(eci\014ed)240 1622 y(h)o(yp)q
+(erslab)20 b(v)n(arying)f(fastest)g(\(lik)o(e)h(the)f(ordinary)h(F)n(OR)m(TRA\
+N)g(con)o(v)o(en)o(tion\).)32 b(The)20 b(data)f(ma)n(y)240 1684 y(b)r(e)g(of)
+f(a)h(t)n(yp)r(e)g(corresp)q(onding)h(to)e(an)o(y)h(of)g(the)g(netCDF)f(t)n
+(yp)r(es)h fi(NCSHORT)p fm(,)g fi(NCLONG)p fm(,)f fi(NCFLOAT)p fm(,)240 1747 y
+(or)d fi(NCDOUBLE)p fm(,)f(but)i(m)n(ust)g(b)q(e)g(appropriate)g(for)f(the)g
+(t)o(yp)q(e)h(of)f(the)h(netCDF)e(v)n(ariable.)22 b fg(W)l(arning:)240 1809 y
+(neither)c(the)e(compiler)i(nor)e(the)g(netCDF)h(soft)n(w)n(are)g(can)g(detec\
+t)f(whether)h(the)f(wrong)g(t)o(yp)q(e)g(of)240 1871 y(data)f(is)h(used.)0
+1960 y fi(STRING)96 b fm(F)l(or)21 b fi(NCVGTC)p fm(,)i(the)f(c)o(haracter)f
+(string)h(into)f(which)h(the)g(c)o(haracter)g(data)f(will)j(b)q(e)e(read.)41 b
+(The)240 2022 y(order)17 b(in)g(which)g(the)g(c)o(haracters)g(will)h(b)r(e)f
+(read)g(from)f(the)h(netCDF)f(v)n(ariable)i(is)f(with)g(the)g(\014rst)240 2084
+y(dimension)g(of)f(the)g(sp)q(eci\014ed)i(h)o(yp)q(erslab)e(v)n(arying)g(fast\
+est)e(\(like)i(the)g(F)n(OR)m(TRAN)h(con)n(v)o(en)o(tion\).)240 2147 y(The)e
+(data)g(ma)n(y)g(b)r(e)g(of)g(a)g(t)n(yp)r(e)g(corresp)q(onding)h(to)f(the)g
+(netCDF)g(t)n(yp)r(es)g fi(NCCHAR)f fm(or)h fi(NCBYTE)p fm(.)0 2235 y fi(LENS\
+TR)96 b fm(F)l(or)18 b fi(NCVGTC)p fm(,)g(the)h(total)f(declared)i(length)f
+(\(in)h(c)n(haracters\))e(of)g(the)h fi(STRING)f fm(argumen)n(t.)30 b(This)
+240 2297 y(should)18 b(b)r(e)g(at)e(least)i(as)f(large)h(as)f(the)g(pro)q(duc\
+t)h(of)f(the)h(elements)f(of)g(the)h fi(COUNT)e fm(v)o(ector.)26 b(Note)240
+2360 y(that)21 b(this)g(is)h(not)f(necessarily)i(the)e(same)g(as)g(the)g(v)n
+(alue)h(returned)g(b)o(y)f(the)g(F)o(OR)m(TRAN)g fi(LEN)240 2422 y fm(functio\
+n,)14 b(b)r(ecause)g(an)f(arra)n(y)g(argumen)o(t)g(ma)n(y)h(b)q(e)g(pro)n(vid\
+ed.)21 b fi(NCVGTC)12 b fm(will)j(c)o(heck)e(to)g(mak)n(e)h(sure)240 2484 y
+(the)h(requested)h(data)e(will)j(\014t)e(in)h fi(LENSTR)f fm(c)o(haracters.)0
+2573 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)
+f(o)q(ccurred,)i(0)f(is)g(returned.)p eop
+%%Page: 104 106
+ bop 0 -58 a fm(104)1442 b(NetCDF)14 b(User's)h(Guide)62 183 y(Here)f(is)g
+(an)g(example)h(using)f fi(NCVGT)f fm(to)g(read)h(all)g(the)g(v)n(alues)g(of)
+f(the)h(v)m(ariable)h(named)f fi(rh)f fm(from)g(an)h(existing)0 246 y(netCDF)
+i(\014le)i(named)g(`)p fi(foo.nc)p fm('.)23 b(F)l(or)16 b(simplicit)r(y)h(in)
+g(this)h(example,)g(w)n(e)f(assume)g(that)f(w)o(e)h(kno)o(w)g(that)f fi(rh)g
+fm(is)0 308 y(dimensioned)g(with)e fi(lon)p fm(,)f fi(lat)p fm(,)g(and)h fi
+(time)p fm(,)f(and)h(that)f(there)h(are)f(ten)h fi(lon)f fm(v)n(alues,)h(\014\
+v)o(e)g fi(lat)f fm(v)n(alues,)h(and)g(three)0 370 y fi(time)h fm(v)m(alues.)
+263 507 y fi(INCLUDE)23 b('netcdf.inc')335 557 y ff(:)7 b(:)g(:)263 607 y fi
+(PARAMETER)23 b(\(NDIMS=3\))f(!)i(number)f(of)h(dimensions)263 656 y(PARAMETE\
+R)f(\(TIMES=3,)f(LATS=5,)h(LONS=10\))g(!)h(dimension)e(sizes)263 706 y(INTEGE\
+R)h(NCID,)g(RCODE)263 756 y(INTEGER)g(RHID)g(!)h(variable)f(ID)263 806 y(INTE\
+GER)g(START\(NDIMS\),)f(COUNT\(NDIMS\))g(!)i(hyperslab)263 856 y(DOUBLE)f(RHV\
+ALS\(LONS,)f(LATS,)i(TIMES\))263 906 y(DATA)f(START)h(/1,)f(1,)h(1/)f(!)h(sta\
+rt)f(at)h(first)f(value)263 955 y(DATA)g(COUNT)h(/LONS,)f(LATS,)g(TIMES/)335
+1005 y ff(:)7 b(:)g(:)263 1055 y fi(NCID)23 b(=)h(NCOPN)f(\('foo.nc',)g(NCNOW\
+RIT,)g(RCODE\))335 1105 y ff(:)7 b(:)g(:)263 1155 y fi(RHID)23 b(=)h(NCVID)f
+(\(NCID,)g('rh',)h(RCODE\)!)f(get)g(ID)263 1204 y(CALL)g(NCVGT)h(\(NCID,)f
+(RHID,)g(START,)g(COUNT,)g(RHVALS,)g(RCODE\))p eop
+%%Page: 105 107
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(105)0 183 y fl(7.10)32 b
+(Read)15 b(a)g(Generalized)h(Hyp)s(erslab)f(of)f(V)-6 b(alues)62 320 y fm(The)
+14 b(function)g fi(ncvargetg)e fm(\(or)h fi(NCVGTG)f fm(or)h fi(NCVGGC)f fm
+(for)h(F)n(OR)m(TRAN\))h(reads)f(a)g(generalized)i(h)o(yp)r(erslab)e(of)0 382
+y(v)m(alues)18 b(from)d(a)h(netCDF)g(v)m(ariable)i(of)e(an)g(op)q(en)h(netCDF)
+f(\014le.)24 b(The)17 b(generalized)h(h)o(yp)r(erslab)f(is)f(sp)r(eci\014ed)i
+(b)o(y)0 445 y(giving)d(a)f(corner,)g(a)g(v)n(ector)g(of)g(edge)g(lengths,)h
+(a)f(stride)h(v)n(ector,)f(and)g(an)g(index)i(mapping)f(v)n(ector.)k(The)c
+(v)m(alues)0 507 y(are)20 b(read)h(with)g(the)f(last)h(\(or)e(\014rst)i(for)e
+(F)o(OR)m(TRAN\))i(dimension)h(of)e(the)h(generalized)h(h)o(yp)q(erslab)f(v)n
+(arying)0 569 y(fastest.)e(The)c(netCDF)g(\014le)h(m)o(ust)f(b)q(e)h(in)g(dat\
+a)e(mo)q(de.)62 706 y(In)h(case)g(of)f(an)g(error,)g fi(ncvargetg)f fm(return\
+s)i(-1;)f fi(NCVGTG)f fm(and)i fi(NCVGGC)f fm(return)g(a)g(nonzero)h(v)m(alue)
+h(in)f fi(rcode)p fm(.)0 769 y(P)o(ossible)h(causes)g(of)e(errors)h(include:)
+37 906 y fk(\017)30 b fm(The)15 b(v)n(ariable)h(ID)f(is)h(inv)m(alid)g(for)f
+(the)g(sp)r(eci\014ed)i(netCDF)d(\014le.)37 979 y fk(\017)30 b fm(The)16 b
+(sp)q(eci\014ed)h(corner)e(indices)i(w)o(ere)e(out)g(of)g(range)g(for)g(the)g
+(dimensionalit)q(y)g(of)g(the)h(sp)q(eci\014ed)h(v)m(ariable.)90 1041 y(F)l
+(or)c(example,)h(a)f(negativ)o(e)g(index)i(or)d(an)h(index)i(that)e(is)g(larg\
+er)g(than)h(the)f(corresp)q(onding)h(dimension)h(size)90 1103 y(will)i(cause)
+e(an)g(error.)37 1177 y fk(\017)30 b fm(The)12 b(sp)r(eci\014ed)i(edge)e(leng\
+ths)h(and)f(strides)h(added)g(to)e(the)i(sp)q(eci\014ed)h(corner)e(w)o(ould)h
+(ha)n(v)o(e)f(referenced)i(data)90 1239 y(out)g(of)g(range)g(for)g(the)h(dime\
+nsionalit)q(y)f(of)g(the)h(sp)q(eci\014ed)h(v)n(ariable.)k(F)l(or)14 b(exampl\
+e,)h(an)g(edge)g(length)g(that)90 1301 y(is)h(larger)f(than)g(the)g(corresp)q
+(onding)h(dimension)h(size)f(minus)f(the)g(corner)g(index)i(will)g(cause)e
+(an)g(error,)f(as)90 1363 y(will)19 b(accessing)g(t)n(w)o(o)f(or)f(more)g(p)r
+(oin)o(ts)g(using)i(a)e(stride)i(that)e(is)h(greater)f(than)h(the)g(size)g
+(of)g(the)g(netCDF)90 1426 y(v)m(ariable)f(in)f(the)f(corresp)q(onding)h(dime\
+nsion.)37 1499 y fk(\017)30 b fm(A)15 b(non-p)r(ositiv)o(e)h(stride.)37 1572 y
+fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(is)i(in)g(de\014ne)g(mo)q
+(de)g(rather)e(than)h(data)g(mo)q(de.)37 1645 y fk(\017)30 b fm(The)15 b(sp)r
+(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)
+g(\014le.)0 1938 y fl(ncv)l(argetg:)23 b(C)14 b(In)n(terface)120 2075 y fi
+(int)23 b(ncvargetg\(int)g(ncid,)g(int)g(varid,)g(const)g(long)h(start[],)e
+(const)i(long)f(count[],)454 2125 y(const)g(long)h(stride[],)e(const)h(long)h
+(imap[],)f(void)g(*values\);)0 2337 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returne\
+d)h(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm
+(.)0 2410 y fi(varid)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e(a)h
+(previous)h(call)h(to)d fi(ncvardef)g fm(or)h fi(ncvarid)p fm(.)0 2483 y fi
+(start)120 b fm(A)19 b(v)o(ector)g(of)g(long)h(in)o(tegers)f(sp)r(ecifying)i
+(the)e(m)o(ultidimensional)j(index)f(of)e(the)h(corner)f(of)g(the)240 2545 y
+(h)o(yp)q(erslab)d(where)f(the)f(\014rst)h(of)f(the)h(data)e(v)n(alues)i(will)
+i(b)q(e)e(read)g(from.)j(The)d(indices)i(are)d(relative)240 2608 y(to)k(0,)g
+(so)g(for)g(example,)h(the)g(\014rst)f(data)f(v)n(alue)i(of)f(a)g(v)m(ariable)
+h(w)o(ould)g(ha)o(v)n(e)g(index)g fi(\(0,)c(0,)g ff(:)7 b(:)h(:)o fi(,)240
+2670 y(0\))p fm(.)22 b(The)16 b(size)h(of)f fi(start)f fm(m)o(ust)g(b)r(e)h
+(the)g(same)g(as)g(the)g(n)o(um)n(b)r(er)g(of)g(dimensions)h(of)f(the)g(sp)q
+(eci\014ed)p eop
+%%Page: 106 108
+ bop 0 -58 a fm(106)1442 b(NetCDF)14 b(User's)h(Guide)240 183 y(v)m(ariable.)
+21 b(The)13 b(elements)f(of)h fi(start)f fm(m)o(ust)h(corresp)q(ond)g(to)f
+(the)h(v)n(ariable's)g(dimensions)i(in)f(order.)240 246 y(Hence,)23 b(if)f
+(the)f(v)n(ariable)h(is)g(a)f(record)g(v)n(ariable,)i(the)e(\014rst)g(index)i
+(w)n(ould)g(corresp)q(ond)e(to)g(the)240 308 y(starting)15 b(record)g(n)o(um)
+o(b)q(er)g(for)g(reading)h(the)f(data)f(v)n(alues.)0 390 y fi(count)120 b fm
+(A)15 b(v)n(ector)f(of)g(long)h(integers)f(sp)q(ecifying)i(the)f(m)n(ultidime\
+nsional)j(edge)d(lengths)g(from)e(the)i(corner)240 452 y(of)f(the)h(h)n(yp)r
+(erslab)g(where)g(the)f(\014rst)g(of)g(the)h(data)e(v)n(alues)i(will)h(b)r
+(e)e(read.)20 b(T)l(o)14 b(read)g(a)g(single)i(v)n(alue,)240 515 y(for)21 b
+(example,)i(sp)r(ecify)f fi(count)f fm(as)g fi(\(1,)14 b(1,)h ff(:)7 b(:)h
+(:)o fi(,)15 b(1\))p fm(.)39 b(The)21 b(size)i(of)e fi(count)f fm(is)i(the)g
+(n)o(um)n(b)r(er)f(of)240 577 y(dimensions)13 b(of)e(the)h(sp)q(eci\014ed)i
+(v)m(ariable.)20 b(The)11 b(elemen)q(ts)g(of)g fi(count)g fm(corresp)q(ond)g
+(to)g(the)h(v)m(ariable's)240 639 y(dimensions.)42 b(Hence,)24 b(if)e(the)g
+(v)n(ariable)g(is)h(a)f(record)f(v)n(ariable,)j(the)e(\014rst)g(element)f(of)
+h fi(count)240 701 y fm(corresp)q(onds)15 b(to)g(a)g(coun)o(t)g(of)g(the)g
+(n)o(um)o(b)q(er)h(of)e(records)h(to)g(read.)0 784 y fi(stride)96 b fm(A)17 b
+(v)o(ector)g(of)g(long)g(integers)g(sp)q(ecifying,)i(for)e(eac)o(h)g(dimensio\
+n,)i(the)f(in)o(terv)m(al)g(b)q(et)o(w)o(een)g(the)f(ac-)240 846 y(cessed)e
+(v)m(alues)g(of)e(a)h(netCDF)f(v)m(ariable.)21 b(The)14 b(size)g(of)g(the)g
+(v)o(ector)f(shall)i(b)q(e)f(at)g(least)g(the)g(n)o(um)n(b)r(er)240 908 y(of)
+20 b(dimensions)i(of)f(the)f(asso)q(ciated)h(netCDF)f(v)n(ariable)h(and)g(its)
+g(elements)f(shall)i(corresp)q(ond,)240 971 y(in)f(order,)g(to)e(the)h(v)n
+(ariable's)g(dimensions.)36 b(A)20 b(v)n(alue)h(of)e(1)h(accesses)g(adjacen)o
+(t)g(v)m(alues)h(of)f(the)240 1033 y(netCDF)g(v)n(ariable)i(in)f(the)g(corres\
+p)r(onding)g(dimension;)k(a)c(v)m(alue)h(of)f(2)f(accesses)i(ev)n(ery)f(other)
+240 1095 y(v)m(alue)14 b(of)e(the)h(netCDF)f(v)n(ariable)i(in)f(the)g(corresp)
+q(onding)h(dimension;)h(and)e(so)f(on.)19 b(A)13 b fi(NULL)g fm(stride)240
+1157 y(argumen)o(t)f(obtains)g(the)h(default)g(b)q(eha)o(vior)f(in)i(whic)o
+(h)f(adjacen)o(t)f(v)m(alues)h(are)g(accessed)f(along)h(eac)o(h)240 1220 y
+(dimension.)0 1302 y fi(imap)144 b fm(A)19 b(v)o(ector)f(of)h(long)g(integers)
+f(sp)r(ecifying,)j(for)d(eac)o(h)h(dimension,)j(ho)n(w)d(data)g(v)m(alues)h
+(associated)240 1364 y(with)12 b(a)g(netCDF)f(v)m(ariable)i(are)f(arranged)f
+(in)i(memory)l(.)18 b(The)13 b(o\013set,)f(in)g(b)o(ytes,)g(from)g(the)g(memo\
+ry)240 1427 y(lo)r(cation)i(p)q(ointed)g(to)f(b)o(y)i(the)f fi(value)f fm(arg\
+umen)o(t)g(to)h(a)g(particular)g(datum)g(is)h(giv)o(en)g(b)o(y)f(the)g(inner)
+240 1489 y(pro)q(duct)k(of)f(the)h(index)h(mapping)f(v)o(ector)f(with)h(the)g
+(co)q(ordinates)g(of)f(the)g(datum.)27 b(\(The)18 b fh(inner)240 1551 y(pro)q
+(duct)c fm(of)e(t)o(w)n(o)g(v)o(ectors)g([x0,)g(x1,)h ff(:)7 b(:)g(:)p fm(,)
+12 b(xn])h(and)f([y0,)g(y1,)h ff(:)7 b(:)g(:)p fm(,)13 b(yn])f(is)h(just)f
+(x0*y0)g fi(+)g fm(x1*y1)g fi(+)h ff(:)7 b(:)g(:)12 b fi(+)240 1613 y fm(xn*y\
+n.\))19 b(The)12 b(v)o(ector)f(ma)o(y)h(con)o(tain)g(negativ)o(e)g(v)n(alues)
+g(if)h(the)f fi(value)f fm(argumen)o(t)h(is)g(appropriately)240 1676 y(sp)q
+(eci\014ed.)21 b(A)13 b fi(NULL)g fm(argumen)n(t)g(obtains)g(the)g(default)h
+(b)q(eha)o(vior)f(in)h(whic)o(h)g(the)f(memory-residen)o(t)240 1738 y(v)m(alu\
+es)j(are)f(assumed)h(to)e(ha)o(v)o(e)h(the)g(same)g(structure)g(as)g(the)g
+(asso)q(ciated)h(netCDF)e(v)n(ariable.)0 1820 y fi(value)120 b fm(P)o(oin)o
+(ter)15 b(to)f(the)h(\014rst)g(of)g(the)g(lo)r(cations)g(in)o(to)g(whic)o(h)h
+(the)f(data)f(v)n(alues)i(will)g(b)r(e)f(read.)20 b(The)15 b(order)240 1883 y
+(in)k(which)g(the)g(data)f(will)i(b)q(e)f(read)g(from)e(the)i(netCDF)f(v)m
+(ariable)i(is)f(with)g(the)g(last)f(dimension)240 1945 y(of)d(the)h(generaliz\
+ed)h(h)o(yp)r(erslab)f(v)m(arying)g(fastest.)k(The)c(p)q(ointer)f(is)h(declar\
+ed)h(to)e(b)q(e)h(of)f(the)h(t)n(yp)r(e)240 2007 y fi(void)f(*)d fm(b)r(ecaus\
+e)h(it)g(can)g(p)r(oin)o(t)g(to)f(data)g(of)h(an)n(y)g(of)g(the)g(basic)g(net\
+CDF)f(t)o(yp)q(es.)20 b(The)13 b(data)f(should)240 2069 y(b)r(e)18 b(of)g(the)
+g(appropriate)g(t)o(yp)q(e)h(for)f(the)g(netCDF)f(v)n(ariable.)30 b fg(W)l
+(arning:)e(neither)20 b(the)e(compiler)240 2132 y(nor)e(the)f(netCDF)h(soft)n
+(w)n(are)g(can)g(detect)f(whether)h(the)g(wrong)f(t)n(yp)r(e)g(of)g(data)g
+(is)h(used.)62 2359 y fm(Here)e(is)g(an)g(example)h(using)f fi(ncvargetg)e fm
+(to)h(read)h(ev)o(ery)g(other)f(v)m(alue)i(in)f(eac)o(h)g(dimension)i(of)d
+(the)h(v)m(ariable)0 2421 y(named)21 b fi(rh)g fm(from)g(an)g(existing)h(netC\
+DF)e(\014le)j(named)e(`)p fi(foo.nc)p fm('.)36 b(V)m(alues)21 b(are)g(assigne\
+d,)i(using)f(the)f(same)0 2483 y(dimensional)i(strides,)g(to)e(p)r(oin)o(ts)g
+(in)h(a)f(3-dimensional)i(arra)n(y)f(of)e(structures)i(whose)f(dimensions)i
+(are)e(the)0 2545 y(rev)o(erse)14 b(of)g(the)g(netCDF)f(v)n(ariable.)20 b(F)l
+(or)14 b(simplicit)q(y)g(in)h(this)g(example,)f(w)o(e)g(assume)g(that)g(w)n
+(e)h(kno)n(w)f(that)g fi(rh)f fm(is)0 2608 y(dimensioned)19 b(with)e fi(time)
+p fm(,)g fi(lat)p fm(,)f(and)i fi(lon)p fm(,)e(and)h(that)g(there)g(are)f(thr\
+ee)h fi(time)g fm(v)m(alues,)h(\014v)o(e)f fi(lat)g fm(v)m(alues,)h(and)0 2670
+y(ten)d fi(lon)g fm(v)m(alues.)p eop
+%%Page: 107 109
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(107)120 183 y fi(#inclu\
+de)23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)23 b fi(#define)g(TIMES)h(3)f(#de\
+fine)g(LATS)h(5)f(#define)g(LONS)g(10)h(int)g(ncid;)f(/*)120 283 y(netCDF)g
+(ID)h(*/)f(int)h(rh_id;)f(/*)g(variable)g(ID)h(*/)f(static)g(long)h(start[])f
+(=)g({0,)h(0,)120 333 y(0};)f(/*)h(start)f(at)h(first)f(value)g(*/)h(static)f
+(long)g(count[])g(=)h({TIMES,)f(LATS,)120 382 y(LONS};)g(static)g(long)g(stri\
+de[])g(=)h({2,)f(2,)h(2};)f(/*)h(every)f(other)g(value)h(*/)f(long)120 432 y
+(imap[3];)g(/*)g(set)h(to)f(reverse)g(of)h(variable)f(*/)g(struct)g(datum)g
+({)215 482 y(int)h(dummy;)f(/*)h(to)f(illustrate)g(mapping)g(vector)g(usage)g
+(*/)215 532 y(double)g(rh_val;)g(/*)h(actual)f(value)g(to)h(be)f(read)h(*/)f
+(})120 582 y(data[TIMES][LATS][LONS];)e(/*)i(array)g(to)h(hold)f(values)g(*/)
+192 632 y ff(:)7 b(:)g(:)23 b fi(ncid)h(=)g(ncopen\("foo.nc",)d(NC_NOWRITE\);)
+192 681 y ff(:)7 b(:)g(:)23 b fi(rh_id)h(=)f(ncvarid)g(\(ncid,)g("rh"\);)192
+731 y ff(:)7 b(:)g(:)23 b fi(/*)h(access)f(every)g(`stride')g(in-memory)g(val\
+ue)g(using)g(reversed)120 781 y(dimensions)f(*/)i(imap[0])f(=)h(stride[2]*siz\
+eof\(struct)c(datum\);)j(imap[1])g(=)120 831 y(stride[1]*\(1+\(LONS-1\)/stri)
+o(de[0]\)*)o(imap[0];)d(imap[2])j(=)120 881 y(stride[0]*\(1+\(LATS-1\)/stri)o
+(de[1]\)*)o(imap[1];)d(/*)k(read)f(generalized)g(hyperslab)120 930 y(of)h(val\
+ues)f(from)g(netCDF)g(variable)g(*/)g(ncvargetg\(ncid,)f(rh_id,)h(start,)g
+(count,)120 980 y(stride,)g(imap,)g(\(void)g(*\))h(data\);)0 1279 y fl(NCV)n
+(GTG,)13 b(NCV)n(GGC:)h(F)n(OR)-6 b(TRAN)14 b(In)n(terface)263 1416 y fi(SUBR\
+OUTINE)23 b(NCVGTG)g(\(INTEGER)f(NCID,)i(INTEGER)f(VARID,)239 1466 y(+)h(INTE\
+GER)f(START\(*\),)g(INTEGER)f(COUNT\(*\),)239 1516 y(+)i(INTEGER)f(STRIDE\(*\
+\),)f(INTEGER)h(IMAP\(*\),)239 1565 y(+)h fh(t)n(yp)r(e)j fi(VALUES,)22 b(INT\
+EGER)h(RCODE\))263 1665 y(SUBROUTINE)g(NCVGGC)g(\(INTEGER)f(NCID,)i(INTEGER)f
+(VARID,)239 1715 y(+)h(INTEGER)f(START\(*\),)g(INTEGER)f(COUNT\(*\),)239 1765
+y(+)i(INTEGER)f(STRIDE\(*\),)f(INTEGER)h(IMAP\(*\),)239 1814 y(+)h(CHARACTER*\
+\(*\))e(STRING,)h(INTEGER)g(RCODE\))62 2009 y fm(There)14 b(are)g(t)n(w)o(o)f
+(F)n(OR)m(TRAN)i(subroutines,)f fi(NCVGTG)f fm(and)h fi(NCVGGC)p fm(,)f(for)g
+(reading)h(a)f(generalized)j(h)o(yp)q(erslab)0 2071 y(of)f(v)m(alues)h(from)e
+(a)h(netCDF)f(v)n(ariable.)21 b(The)15 b(\014rst)g(reads)g(n)o(umeric)h(v)m
+(alues)g(from)e(a)h(v)n(ariable)h(of)e(n)o(umeric)i(t)o(yp)q(e,)0 2133 y(and)
+f(the)h(second)f(reads)g(c)o(haracter)g(v)m(alues)h(from)f(a)g(v)m(ariable)h
+(of)f(c)o(haracter)f(t)o(yp)q(e.)0 2271 y fi(NCID)144 b fm(NetCDF)14 b(ID,)h
+(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm
+(.)0 2346 y fi(VARID)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e(a)h
+(previous)h(call)h(to)d fi(NCVDEF)g fm(or)h fi(NCVID)p fm(.)0 2421 y fi(START)
+120 b fm(A)11 b(v)o(ector)g(of)f(integers)g(sp)r(ecifying)j(the)e(m)n(ultidim\
+ensional)k(index)d(of)f(the)g(corner)g(of)g(the)g(h)o(yp)q(erslab)240 2483 y
+(where)19 b(the)g(\014rst)g(of)g(the)g(data)f(v)n(alues)i(will)g(b)r(e)f(read\
+.)31 b(The)20 b(indices)h(are)e(relativ)o(e)g(to)g(1,)g(so)g(for)240 2545 y
+(example,)e(the)g(\014rst)f(data)g(v)m(alue)h(of)g(a)f(v)m(ariable)i(w)n(ould)
+f(ha)o(v)o(e)f(index)i fi(\(1,)d(1,)g ff(:)7 b(:)g(:)p fi(,)15 b(1\))p fm(.)
+23 b(The)17 b(size)240 2608 y(of)d fi(START)g fm(m)o(ust)g(b)r(e)h(the)g(same)
+f(as)g(the)h(n)o(um)o(b)q(er)g(of)f(dimensions)j(of)d(the)h(sp)q(eci\014ed)i
+(v)m(ariable.)k(The)240 2670 y(elements)14 b(of)f fi(START)g fm(m)o(ust)g(cor\
+resp)r(ond)h(to)f(the)h(v)m(ariable's)h(dimensions)g(in)g(order.)k(Hence,)c
+(if)f(the)p eop
+%%Page: 108 110
+ bop 0 -58 a fm(108)1442 b(NetCDF)14 b(User's)h(Guide)240 183 y(v)m(ariable)
+21 b(is)f(a)f(record)g(v)m(ariable,)i(the)f(last)f(index)i(w)n(ould)f(corresp)
+r(ond)f(to)g(the)g(starting)g(record)240 246 y(n)o(um)o(b)q(er)d(for)e(readin\
+g)i(the)f(data)g(v)m(alues.)0 333 y fi(COUNT)120 b fm(A)18 b(v)o(ector)g(of)g
+(integers)f(sp)r(ecifying)j(the)e(m)o(ultidimensional)j(edge)e(lengths)g(from)
+f(the)g(corner)g(of)240 395 y(the)f(h)o(yp)r(erslab)h(where)f(the)h(\014rst)f
+(of)g(the)g(data)g(v)m(alues)i(will)g(b)q(e)f(read.)26 b(T)l(o)17 b(read)g
+(a)g(single)i(v)n(alue,)240 457 y(for)i(example,)i(sp)r(ecify)f fi(COUNT)f fm
+(as)g fi(\(1,)14 b(1,)h ff(:)7 b(:)h(:)o fi(,)15 b(1\))p fm(.)39 b(The)21 b
+(size)i(of)e fi(COUNT)f fm(is)i(the)g(n)o(um)n(b)r(er)f(of)240 519 y(dimensio\
+ns)13 b(of)e(the)h(sp)q(eci\014ed)i(v)m(ariable.)20 b(The)11 b(elemen)q(ts)g
+(of)g fi(COUNT)g fm(corresp)q(ond)g(to)g(the)h(v)m(ariable's)240 582 y(dimens\
+ions.)43 b(Hence,)25 b(if)e(the)f(v)n(ariable)h(is)g(a)f(record)g(v)n(ariable\
+,)j(the)d(last)h(element)f(of)g fi(COUNT)240 644 y fm(corresp)q(onds)15 b(to)
+g(a)g(coun)o(t)g(of)g(the)g(n)o(um)o(b)q(er)h(of)e(records)h(to)g(read.)0 731
+y fi(STRIDE)96 b fm(A)17 b(v)o(ector)f(of)g(integers)g(sp)r(ecifying,)i(for)e
+(eac)o(h)h(dimension,)i(the)d(interv)m(al)h(b)r(et)n(w)o(een)g(the)g(accessed)
+240 793 y(v)m(alues)j(of)e(a)h(netCDF)f(v)n(ariable)h(or)g(the)g(v)m(alue)h fi
+(0)p fm(.)31 b(The)19 b(size)h(of)e(the)h(v)o(ector)f(shall)i(b)r(e)f(at)f
+(least)240 856 y(the)i(n)o(um)o(b)r(er)g(of)g(dimensions)h(of)f(the)h(associa\
+ted)g(netCDF)f(v)m(ariable)h(and)g(its)f(elements)g(shall)240 918 y(corresp)q
+(ond,)k(in)f(order,)g(to)e(the)i(v)m(ariable's)g(dimensions.)42 b(A)22 b(v)n
+(alue)g(of)g(1)g(accesses)g(adjacen)o(t)240 980 y(v)m(alues)e(of)e(the)g(netC\
+DF)g(v)n(ariable)h(in)h(the)e(corresp)q(onding)i(dimension;)h(a)e(v)m(alue)g
+(of)f(2)h(accesses)240 1042 y(ev)o(ery)e(other)f(v)n(alue)h(of)g(the)f(netCDF)
+h(v)m(ariable)h(in)f(the)g(corresp)q(onding)h(dimension;)h(and)e(so)f(on.)240
+1105 y(An)c fi(0)g fm(argumen)n(t)g(obtains)f(the)h(default)h(b)q(eha)o(vior)
+f(in)g(which)g(adjacen)o(t)f(v)n(alues)h(are)g(accessed)g(along)240 1167 y
+(eac)o(h)j(dimension.)0 1254 y fi(IMAP)144 b fm(A)19 b(v)o(ector)f(of)h(long)
+g(integers)f(sp)r(ecifying,)j(for)d(eac)o(h)h(dimension,)j(ho)n(w)d(data)g
+(v)m(alues)h(associated)240 1316 y(with)d(a)f(netCDF)g(v)n(ariable)h(are)f
+(arranged)h(in)g(memory)f(or)g(the)h(v)m(alue)h fi(0)p fm(.)24 b(The)17 b(o\
+\013set,)f(in)i(b)o(ytes,)240 1379 y(from)c(the)i(memory)e(lo)r(cation)h(p)r
+(oin)o(ted)g(to)g(b)o(y)g(the)g fi(value)f fm(argumen)o(t)h(to)f(a)h(particul\
+ar)h(datum)e(is)240 1441 y(giv)o(en)g(b)o(y)f(the)h(inner)g(pro)q(duct)g(of)f
+(the)h(index)g(mapping)g(v)o(ector)f(with)h(the)f(\(origin-0\))h(co)q(ordinat\
+es)240 1503 y(of)i(the)g(datum.)21 b(\(The)16 b fh(inner)h(pro)q(duct)h fm
+(of)d(t)n(w)o(o)h(v)n(ectors)g([x1,)f(x2,)g ff(:)8 b(:)f(:)o fm(,)16 b(xn])g
+(and)g([y1,)f(y2,)g ff(:)8 b(:)f(:)o fm(,)16 b(yn])240 1565 y(is)i(just)g(x1*\
+y1)f fi(+)g fm(x2*y2)g fi(+)h ff(:)7 b(:)g(:)18 b fi(+)f fm(xn*yn.\))28 b(The)
+18 b(v)n(ector)g(ma)n(y)g(con)o(tain)g(negativ)o(e)g(v)m(alues)h(if)f(the)240
+1628 y fi(value)c fm(argumen)n(t)g(is)h(appropriately)g(sp)q(eci\014ed.)22 b
+(A)14 b fi(0)g fm(argumen)o(t)g(obtains)g(the)h(default)f(b)r(eha)o(vior)240
+1690 y(in)19 b(which)g(the)f(memory-resident)g(v)m(alues)h(are)g(assumed)f
+(to)g(ha)o(v)n(e)h(the)f(same)h(structure)f(as)g(the)240 1752 y(asso)q(ciated)
+d(netCDF)g(v)m(ariable.)0 1839 y fi(VALUES)96 b fm(F)l(or)15 b fi(NCVGTG)p fm
+(,)f(the)h(lo)r(cations)g(into)g(whic)o(h)h(the)f(data)g(v)m(alues)h(will)h
+(b)r(e)e(read.)20 b(The)c(order)f(in)h(which)240 1902 y(the)22 b(data)f(will)
+i(b)q(e)f(read)g(from)f(the)g(netCDF)g(v)n(ariable)h(is)g(with)g(the)g(\014rs\
+t)f(dimension)j(of)d(the)240 1964 y(generalized)e(h)o(yp)q(erslab)e(v)n(aryin\
+g)g(fastest)e(\(like)i(the)g(ordinary)g(F)n(OR)m(TRAN)g(con)o(v)o(en)o(tion\)\
+.)25 b(The)240 2026 y(data)18 b(ma)n(y)g(b)r(e)g(of)g(a)g(t)n(yp)r(e)g(corres\
+p)r(onding)h(to)e(an)o(y)h(of)g(the)h(netCDF)e(t)o(yp)q(es)h fi(NCSHORT)p fm
+(,)g fi(NCLONG)p fm(,)240 2088 y fi(NCFLOAT)p fm(,)d(or)h fi(NCDOUBLE)p fm
+(,)f(but)h(m)o(ust)g(b)q(e)h(appropriate)f(for)g(the)g(t)n(yp)r(e)g(of)g(the)
+g(netCDF)g(v)m(ariable.)240 2151 y fg(W)l(arning:)k(neither)13 b(the)g(compil\
+er)g(nor)g(the)f(netCDF)g(soft)n(w)o(are)g(can)h(detect)f(whether)h(the)f(wro\
+ng)240 2213 y(t)n(yp)r(e)j(of)g(data)g(is)h(used.)0 2300 y fi(STRING)96 b fm
+(F)l(or)13 b fi(NCVGGC)p fm(,)h(the)g(c)o(haracter)f(string)h(into)f(which)h
+(the)g(c)o(haracter)g(data)f(will)j(b)q(e)e(read.)20 b(The)14 b(order)240 2362
+y(in)d(which)g(the)f(c)o(haracters)g(will)i(b)r(e)f(read)f(from)g(the)h(netCD\
+F)f(v)m(ariable)h(is)h(with)e(the)h(\014rst)f(dimension)240 2425 y(of)i(the)g
+(generalized)h(h)o(yp)r(erslab)f(v)n(arying)g(fastest)f(\(like)h(the)g(F)n
+(OR)m(TRAN)h(con)o(v)n(ention\).)18 b(The)13 b(data)240 2487 y(ma)n(y)i(b)r
+(e)g(of)g(a)g(t)n(yp)r(e)g(corresp)q(onding)h(to)f(the)g(netCDF)g(t)n(yp)r
+(es)g fi(NCCHAR)f fm(or)h fi(NCBYTE)p fm(.)0 2574 y fi(RCODE)120 b fm(Returne\
+d)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(retur\
+ned.)p eop
+%%Page: 109 111
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(109)62 183 y(Here)19 b
+(is)f(an)g(example)h(using)g fi(NCVGTG)f fm(to)f(read)h(ev)o(ery)g(other)g
+(v)n(alue)g(in)h(eac)o(h)g(dimension)h(of)d(the)i(v)m(ariable)0 246 y(named)e
+fi(rh)g fm(from)f(an)h(existing)g(netCDF)g(\014le)h(named)f(`)p fi(foo.nc)p fm
+('.)23 b(V)l(alues)18 b(are)e(assigned,)i(using)f(the)g(same)g(di-)0 308 y
+(mensional)d(strides,)f(to)f(a)h(2-parameter)e(arra)n(y)i(whose)g(dimensions)
+h(are)e(the)h(rev)o(erse)g(of)f(the)h(netCDF)f(v)m(ariable.)0 370 y(F)l(or)h
+(simplicit)q(y)h(in)h(this)f(example,)h(w)n(e)f(assume)g(that)f(w)o(e)h(kno)n
+(w)g(that)f fi(rh)h fm(is)g(dimensioned)i(with)e fi(lon)p fm(,)f fi(lat)p fm
+(,)h(and)0 432 y fi(time)p fm(,)g(and)i(that)e(there)h(are)g(ten)h fi(lon)e fm
+(v)n(alues,)h(\014v)o(e)h fi(lat)e fm(v)n(alues,)h(and)h(three)f fi(time)g fm
+(v)m(alues.)263 569 y fi(INCLUDE)23 b('netcdf.inc')335 619 y ff(:)7 b(:)g(:)
+263 669 y fi(PARAMETER)23 b(\(NDIMS=3\))f(!)i(number)f(of)h(dimensions)263 719
+y(PARAMETER)f(\(TIMES=3,)f(LATS=5,)h(LONS=10\))g(!)h(dimension)e(sizes)263 769
+y(INTEGER)h(NCID,)g(RCODE)263 818 y(INTEGER)g(RHID)g(!)h(variable)f(ID)263 868
+y(INTEGER)g(START\(NDIMS\),)f(COUNT\(NDIMS\))239 918 y(+)i(STRIDE\(NDIMS\),)e
+(IMAP\(NDIMS\))g(!)i(generalized)e(hyperslab)263 968 y(DOUBLE)h(DATA\(2,)g
+(TIMES,)g(LATS,)g(LONS\))h(!)f(rh)h(is)f(second)g(parameter)263 1018 y(DATA)g
+(START)h(/1,)f(1,)h(1/)f(!)h(start)f(at)h(first)f(value)263 1067 y(DATA)g(COU\
+NT)h(/LONS,)f(LATS,)g(TIMES/)263 1117 y(DATA)g(STRIDE)h(/2,)f(2,)h(2/)335 1167
+y ff(:)7 b(:)g(:)263 1217 y fi(NCID)23 b(=)h(NCOPN)f(\('foo.nc',)g(NCNOWRIT,)
+g(RCODE\))335 1267 y ff(:)7 b(:)g(:)263 1316 y fi(RHID)23 b(=)h(NCVID)f(\(NCI\
+D,)g('rh',)h(RCODE\)!)f(get)g(ID)263 1366 y(IMAP\(3\))g(=)h(8*2*2)f(!)h(every)
+f(other)g(point)g(of)h(vector)f(of)g(2-doubles)263 1416 y(IMAP\(2\))g(=)h(IMA\
+P\(3\)*\(1+\(TIMES-1\)/STRI)o(DE\(3\)\)*)o(2)263 1466 y(IMAP\(1\))f(=)h(IMAP\
+\(2\)*\(1+\(LATS-1\)/STRID)o(E\(2\)\)*2)263 1516 y(CALL)f(NCVGTG)h(\(NCID,)f
+(RHID,)g(START,)g(COUNT,)g(STRIDE,)g(IMAP,)239 1566 y(+)h(DATA\(2,1,1,1\),)e
+(RCODE\))p eop
+%%Page: 110 112
+ bop 0 -58 a fm(110)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(7.11)32 b
+(Get)15 b(a)g(Record)62 321 y fm(The)k(function)g fi(ncrecget)e fm(reads)h
+(a)g(m)o(ulti-v)o(ariable)h(record)f(of)g(v)m(alues)h(\(or)f(part)f(of)h(a)g
+(record)g(of)g(v)n(alues\))0 383 y(from)11 b(the)h(record)g(v)m(ariables)h
+(of)e(an)h(op)r(en)g(netCDF)f(\014le.)20 b(The)12 b(record)g(is)g(sp)r(eci\
+\014ed)h(b)o(y)f(giving)h(a)e(record)h(n)o(um)o(b)q(er.)0 445 y(The)17 b(lo)r
+(cations)g(in)o(to)f(which)h(the)g(data)f(will)i(b)r(e)f(read)g(are)f(sp)r
+(eci\014ed)i(b)o(y)f(an)g(arra)m(y)g(of)g(p)q(oin)o(ters,)g(one)g(for)f(eac)o
+(h)0 507 y(record)d(v)m(ariable,)h(to)e(blo)r(c)o(ks)h(of)f(data.)19 b(Eac)o
+(h)13 b(blo)q(c)o(k)g(of)g(data)f(should)i(b)q(e)f(of)g(the)g(appropriate)g
+(size)h(and)f(t)n(yp)r(e)g(for)0 570 y(a)k(record's)f(w)o(orth)g(of)g(data)h
+(for)f(the)h(corresp)q(onding)h(record)f(v)m(ariable.)26 b(Eac)o(h)17 b(suc)o
+(h)g(p)q(ointer)f(m)o(ust)h(b)q(e)g(either)0 632 y(NULL,)h(to)f(indicate)j
+(that)d(no)h(data)f(is)h(to)f(b)r(e)h(written)f(for)g(that)h(v)m(ariable,)h
+(or)e(m)o(ust)g(p)r(oin)o(t)h(to)f(space)h(for)f(an)0 694 y(en)o(tire)h(recor\
+d's)g(w)n(orth)g(of)f(data)h(of)f(the)h(appropriate)g(t)n(yp)r(e)g(for)f(the)
+h(corresp)r(onding)g(record)g(v)n(ariable.)29 b(The)0 757 y(v)m(alues)14 b
+(for)e(eac)n(h)h(record)g(v)m(ariable)h(will)g(b)q(e)f(ordered)g(with)g(the)f
+(last)h(dimension)h(v)m(arying)f(fastest.)18 b(The)13 b(netCDF)0 819 y(\014le)
+j(m)o(ust)f(b)q(e)h(in)g(data)e(mo)q(de.)62 956 y(The)e fi(ncrecget)d fm(func\
+tion)j(is)g(not)f(strictly)g(necessary)m(,)g(since)h(the)f(same)g(data)g(ma)n
+(y)g(b)q(e)h(read)f(with)g(a)g(sequence)0 1018 y(of)k(calls)h(to)f fi(ncvarge\
+t)p fm(,)e(one)j(for)e(eac)o(h)h(record)g(v)n(ariable)h(for)f(whic)o(h)h(a)e
+(non-NULL)j(p)r(oin)o(ter)e(is)g(sp)r(eci\014ed.)21 b(This)0 1081 y(function)
+c(is)f(pro)o(vided)h(in)f(the)g(C)g(interface)f(for)g(con)o(v)o(enience)j(onl\
+y;)e(no)g(corresp)q(onding)h(F)l(ortran)d(interface)h(is)0 1143 y(a)n(v)n(ail\
+able,)h(so)f(F)l(ortran)f(users)i(should)g(use)f(m)o(ultiple)i(calls)g(to)d fi
+(NCVGT)h fm(or)f fi(NCVGTC)h fm(instead.)62 1280 y(T)l(o)h(use)h fi(ncrecget)
+d fm(prop)r(erly)m(,)i(y)n(ou)g(m)o(ust)g(kno)o(w)f(the)i(n)o(um)n(b)r(er,)f
+(order,)g(and)g(t)n(yp)r(es)g(of)g(record)g(v)m(ariables)h(in)0 1343 y(the)d
+(netCDF)g(\014le,)h(information)f(that)g(can)g(b)r(e)g(determined)i(with)e
+(a)g(call)i(to)d fi(ncrecinq)p fm(.)19 b(If)14 b(y)o(our)g(assumptions)0 1405
+y(ab)q(out)j(the)g(n)o(um)o(b)q(er,)g(order,)g(or)f(t)o(yp)q(es)h(of)g(record)
+f(v)n(ariables)i(in)f(the)g(\014le)h(is)g(incorrect,)f(calling)i(this)e(funct\
+ion)0 1467 y(ma)n(y)e(lead)g(to)f(incorrect)h(results)g(or)f(ev)o(en)g(a)h
+(segmen)o(tation)f(violation.)20 b fg(W)l(arning:)h(neither)c(the)d(compiler)
+j(nor)0 1529 y(the)e(netCDF)h(soft)n(w)o(are)f(can)h(detect)g(errors)g(with)g
+(the)f(p)q(ointer)g(array)g(argument)g(to)f fi(ncrecget)p fg(.)62 1667 y fm
+(In)i(case)f(of)g(a)g(detected)h(error,)e fi(ncrecget)g fm(returns)h(-1.)20 b
+(P)n(ossible)d(causes)e(of)g(detectable)h(errors)f(include:)37 1804 y fk(\017)
+30 b fm(The)15 b(sp)r(eci\014ed)i(record)e(n)o(um)o(b)q(er)g(is)h(less)g(than)
+f(zero.)37 1879 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(\014le)j
+(is)e(in)h(de\014ne)h(mode)f(rather)f(than)g(data)f(mo)q(de.)37 1955 y fk(\
+\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g
+(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 2258 y fl(ncrecget:)22 b(C)15 b(In)n
+(terface)120 2395 y fi(int)23 b(ncrecget\(int)g(ncid,)g(long)g(recnum,)g(void)
+g(*datap[]\);)0 2533 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h
+(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 2608 y fi
+(recnum)96 b fm(Record)18 b(n)o(um)o(b)r(er,)f(sp)r(ecifying)i(the)e(v)n(alue)
+h(of)f(the)h(unlimited)i(dimension)f(for)e(which)h(data)f(is)h(to)240 2670 y
+(b)r(e)d(read.)20 b(The)15 b(\014rst)g(record)g(is)h(record)f(n)o(um)o(b)q
+(er)g fi(0)p fm(.)p eop
+%%Page: 111 113
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(111)0 183 y fi(datap)
+120 b fm(Arra)n(y)18 b(of)f(p)q(ointers)g(to)g(blo)q(c)o(ks)h(of)f(data)g(in)
+o(to)g(which)h(the)f(requested)h(v)n(alues)g(will)h(b)q(e)f(read,)g(one)240
+246 y(for)d(eac)o(h)g(record)h(v)m(ariable.)21 b fi(datap[i])p fm(,)14 b(if)i
+(non-NULL,)h(m)n(ust)e(p)r(oin)o(t)g(to)g(enough)h(space)f(to)g(hold)240 308 y
+(an)i(en)o(tire)h(record's)f(w)n(orth)g(of)g(data)g(for)f(the)i fi(i)p fm(-th)
+f(record)g(v)n(ariable.)27 b(F)l(or)17 b(NULL)h(p)r(oin)o(ters,)f(no)240 370 y
+(data)12 b(will)i(b)q(e)f(read)f(for)g(the)h(corresp)q(onding)g(record)f(v)n
+(ariables.)19 b(This)13 b(p)r(ermits)f(y)o(ou)h(to)e(sp)r(ecify)i(an)240 432 y
+(arbitrary)h(subset)h(of)g(record)g(v)m(ariables.)21 b(The)15 b(data)g(p)q
+(oin)o(ted)g(to)g(should)h(b)q(e)f(of)g(the)g(appropriate)240 495 y(t)n(yp)r
+(e)e(for)g(eac)o(h)g(record)g(v)n(ariable.)20 b fg(W)l(arning:)g(neither)15 b
+(the)e(compiler)i(nor)f(the)f(netCDF)h(soft)n(w)n(are)240 557 y(can)i(detect)
+f(whether)h(the)g(wrong)f(t)n(yp)r(e)g(of)g(data)g(is)h(used.)62 769 y fm(Her\
+e)21 b(is)g(an)g(example)h(using)f fi(ncrecget)f fm(to)g(read)g(v)n(alues)h
+(into)f(sev)o(eral)h(C)f(arra)n(ys)h(and)g(scalars)f(with)h(a)0 831 y(single)
+d(call.)25 b(This)17 b(example)g(assumes)f(that)g(record)g(v)n(ariables)h(of)
+f(the)h(appropriate)f(shap)r(es)g(and)h(t)n(yp)r(es)f(ha)o(v)o(e)0 893 y(prev\
+iously)h(b)q(een)f(created)f(in)h(the)f(netCDF)g(\014le.)120 1030 y fi(#inclu\
+de)23 b("netcdf.h")192 1080 y ff(:)7 b(:)g(:)215 1130 y fi(static)23 b(struct)
+h({)215 1180 y(char)g(city[20];)215 1229 y(long)g(date;)215 1279 y(float)g
+(lat;)215 1329 y(float)g(lon;)215 1379 y(float)g(precip[24];)215 1429 y(})g
+(rec[10];)215 1528 y(int)g(ncid;)262 b(/*)23 b(id)h(of)f(open)h(netcdf)f(file)
+g(*/)215 1578 y(long)h(i;)310 b(/*)23 b(number)g(of)h(record)f(to)h(read)f
+(*/)215 1628 y(void)h(*datap[5];)118 b(/*)23 b(array)g(of)h(address)f(pointer\
+s)g(for)g(record)g(vars)h(*/)215 1678 y ff(:)8 b(:)f(:)215 1777 y fi(/*)24 b
+(Get)f(first)h(10)f(records)g(of)h(data)f(*/)215 1827 y(for\(i=0;)g(i<10;)g
+(i++\))h({)311 1877 y(datap[0])f(=)g(&rec[i].city[0];)311 1927 y(datap[1])g
+(=)g(&rec[i].date;)311 1977 y(datap[2])g(=)g(&rec[i].lat;)311 2026 y(datap[3])
+g(=)g(&rec[i].lon;)311 2076 y(datap[4])g(=)g(&rec[i].precip[0];)311 2126 y
+(ncrecget\(ncid,)f(i,)h(datap\);)47 b(/*)24 b(instead)f(of)g(5)h(calls)f(to)h
+(ncvarget)f(*/)215 2176 y(})p eop
+%%Page: 112 114
+ bop 0 -58 a fm(112)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(7.12)32 b
+(Reading)16 b(and)f(W)-6 b(ritin)q(g)17 b(Character)f(String)g(V)-6 b(alues)
+62 331 y fm(Character)16 b(strings)g(are)g(not)f(a)h(primitive)h(netCDF)e(dat\
+a)h(t)n(yp)r(e,)g(in)h(part)f(b)q(ecause)h(F)n(OR)m(TRAN)g(do)q(es)f(not)0 393
+y(supp)r(ort)g(the)g(abstraction)g(of)g(v)m(ariable-length)j(c)n(haracter)d
+(strings)h(\(the)f(F)n(OR)m(TRAN)h fi(LEN)f fm(function)h(returns)0 455 y(the)
+j(static)f(length)i(of)e(a)g(c)o(haracter)g(string,)h(not)g(its)g(dynamic)g
+(length\).)34 b(As)19 b(a)h(result,)h(a)e(c)o(haracter)g(string)0 517 y(canno\
+t)e(b)q(e)g(written)g(or)g(read)g(as)f(a)h(single)h(ob)s(ject)f(in)h(the)f
+(netCDF)f(interface.)25 b(Instead,)17 b(a)g(c)o(haracter)f(string)0 580 y(m)o
+(ust)h(b)r(e)h(treated)f(as)h(an)g(arra)m(y)g(of)g(c)o(haracters,)f(and)h(h)o
+(yp)r(erslab)g(access)g(m)o(ust)g(b)q(e)g(used)h(to)e(read)h(and)g(write)0 642
+y(c)o(haracter)h(strings)g(as)h(v)m(ariable)h(data)e(in)h(netCDF)f(\014les.)
+34 b(F)l(urthermore,)20 b(v)m(ariable-length)i(strings)d(are)g(not)0 704 y
+(supp)r(orted)14 b(b)o(y)g(the)h(netCDF)f(in)o(terface)h(except)f(b)o(y)h(con)
+o(v)o(en)o(tion;)f(for)g(example,)h(y)o(ou)f(ma)o(y)g(treat)g(a)g(n)o(ull)i
+(\(zero\))0 766 y(b)o(yte)g(as)g(terminating)h(a)f(c)o(haracter)g(string,)g
+(but)h(y)n(ou)g(m)n(ust)g(explicitly)i(sp)q(ecify)f(the)e(length)h(of)f(strin\
+gs)h(to)e(b)r(e)0 829 y(read)g(from)g(and)g(written)g(to)g(netCDF)f(v)n(ariab\
+les.)62 976 y(Character)i(strings)g(as)h(attribute)f(v)m(alues)i(are)e(easier)
+h(to)f(use,)g(since)i(the)f(strings)f(are)g(treated)g(as)g(a)h(single)0 1038 y
+(unit)i(for)f(access;)h(no)f(h)o(yp)r(erslab)h(access)f(is)h(necessary)f(\(or)
+g(p)q(ossible\))h(for)f(attributes.)29 b(Ho)n(w)o(ev)o(er,)18 b(the)h(v)m(alu\
+e)0 1101 y(of)e(a)g(c)o(haracter-string)f(attribute)h(is)h(still)h(an)e(arra)
+n(y)g(of)g(c)o(haracters)f(with)i(an)f(explicit)i(length)f(that)f(m)n(ust)g
+(b)r(e)0 1163 y(sp)q(eci\014ed)g(when)f(the)f(attribute)g(is)h(de\014ned.)62
+1310 y(When)23 b(y)o(ou)g(de\014ne)g(a)g(v)m(ariable)h(that)e(will)i(ha)o(v)o
+(e)f(c)n(haracter-string)g(v)m(alues,)i(use)e(a)f fh(c)o(haracter-p)q(osition)
+0 1373 y(dimension)13 b fm(as)d(the)i(most)e(quickly)h(v)n(arying)g(dimension)
+i(for)d(the)h(v)n(ariable)g(\(the)g(last)g(dimension)i(for)d(the)i(v)m(ariabl\
+e)0 1435 y(in)17 b(C,)f(the)h(\014rst)f(in)h(F)n(OR)m(TRAN\).)g(The)f(size)i
+(of)e(the)g(c)o(haracter-p)q(osition)h(dimension)h(will)g(b)r(e)f(the)f(maxim)
+o(um)0 1497 y(string)i(length)h(of)e(an)o(y)h(v)m(alue)h(to)e(b)r(e)h(stored)
+f(in)i(the)f(c)o(haracter-string)g(v)m(ariable.)29 b(Space)19 b(for)e(maxim)o
+(um-size)0 1559 y(strings)c(will)h(b)r(e)f(allo)r(cated)g(in)h(the)f(disk)h
+(represen)o(tation)f(of)f(c)o(haracter-string)h(v)m(ariables)h(whether)f(y)o
+(ou)g(use)g(the)0 1622 y(space)h(or)f(not.)19 b(If)13 b(t)o(w)n(o)h(or)e(more)
+i(v)m(ariables)g(ha)o(v)o(e)f(the)h(same)f(maxim)o(um)h(length,)g(the)f(same)
+g(c)o(haracter-p)q(osition)0 1684 y(dimension)k(ma)n(y)e(b)r(e)g(used)h(in)g
+(de\014ning)h(the)e(v)n(ariable)h(shap)q(es.)62 1831 y(T)l(o)j(write)g(a)g
+(c)o(haracter-string)g(v)m(alue)h(in)o(to)f(a)g(c)o(haracter-string)f(v)n(ari\
+able,)i(use)g(h)o(yp)q(erslab)g(access.)31 b(This)0 1894 y(requires)23 b(that)
+f(y)o(ou)g(sp)r(ecify)h(b)r(oth)f(a)g(corner)g(and)h(a)f(v)o(ector)g(of)g(edg\
+e)h(lengths.)43 b(The)22 b(c)o(haracter-p)q(osition)0 1956 y(dimension)g(at)e
+(the)h(corner)g(should)g(b)r(e)f(zero)h(\(one)f(for)g(F)o(OR)m(TRAN\).)g(If)h
+(the)g(length)g(of)f(the)h(string)f(to)g(b)r(e)0 2018 y(written)14 b(is)h fi
+(n)p fm(,)f(then)g(the)g(v)o(ector)g(of)g(edge)g(lengths)h(will)h(sp)q(ecify)
+f fi(n)f fm(in)h(the)f(c)o(haracter-p)q(osition)h(dimension,)h(and)0 2080 y
+(one)f(for)g(all)h(the)f(other)g(dimensions,)i(i.e.,)d fi(\(1,)h(1,)g ff(:)7 b
+(:)g(:)p fi(,)15 b(1,)g(n\))g fm(or)g fi(\(n,)f(1,)h(1,)g ff(:)7 b(:)g(:)p fi
+(,)15 b(1\))g fm(in)h(F)n(OR)m(TRAN.)0 2398 y fl(C)f(In)n(terface)62 2545 y fm
+(In)j(C,)e(\014xed-size)j(strings)d(ma)o(y)g(b)r(e)h(written)g(to)f(a)h(netCD\
+F)f(\014le)i(without)e(the)h(terminating)h(n)o(ull)g(b)o(yte,)f(to)0 2608 y
+(sa)n(v)o(e)k(space.)36 b(V)l(ariable-length)23 b(strings)d(should)i(b)q(e)f
+(written)f fh(with)h fm(a)g(terminating)g(n)o(ull)h(b)o(yte)e(so)g(that)g(the)
+0 2670 y(intended)c(length)f(of)g(the)h(string)f(can)g(b)r(e)g(determined)h
+(when)g(it)g(is)f(later)g(read.)p eop
+%%Page: 113 115
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(113)62 183 y(Here)12 b
+(is)g(an)f(example)h(that)f(de\014nes)h(a)g(record)f(v)m(ariable,)i fi(tx)p fm
+(,)f(for)e(c)o(haracter)h(strings)g(and)h(stores)e(a)i(c)n(haracter-)0 246 y
+(string)k(v)m(alue)h(into)e(the)h(third)h(record)f(using)h fi(ncvarput)p fm
+(.)k(In)c(this)f(example,)h(w)n(e)g(assume)e(the)i(string)f(v)m(ariable)0 308
+y(and)e(data)f(are)g(to)g(b)q(e)h(added)g(to)f(an)h(existing)g(netCDF)f(\014l\
+e)i(named)f(`)p fi(foo.nc)p fm(')e(that)h(already)h(has)f(an)h(unlimited)0 370
+y(record)h(dimension)i fi(time)p fm(.)120 514 y fi(#include)23 b("netcdf.h")
+192 564 y ff(:)7 b(:)g(:)120 613 y fi(int)47 b(ncid;)286 b(/*)24 b(netCDF)f
+(ID)g(*/)120 663 y(int)47 b(chid;)286 b(/*)24 b(dimension)e(ID)i(for)f(char)h
+(positions)e(*/)120 713 y(int)47 b(timeid;)238 b(/*)24 b(dimension)e(ID)i(for)
+f(record)g(dimension)g(*/)120 763 y(int)47 b(tx_id;)262 b(/*)24 b(variable)e
+(ID)i(*/)120 813 y(#define)f(TDIMS)g(2)167 b(/*)24 b(dimensionality)e(of)h
+(tx)h(variable)e(*/)120 863 y(int)h(tx_dims[TDIMS];)70 b(/*)24 b(variable)e
+(shape)i(*/)120 912 y(long)f(tx_start[TDIMS];)120 962 y(long)g(tx_count[TDIMS\
+];)120 1012 y(static)g(char)g(tx_val[])g(=)311 1062 y("example)g(string";)f
+(/*)i(string)f(to)h(be)f(put)h(*/)192 1112 y ff(:)7 b(:)g(:)120 1161 y fi(nci\
+d)23 b(=)h(ncopen\("foo.nc",)e(NC_WRITE\);)120 1211 y(ncredef\(ncid\);)165 b
+(/*)24 b(enter)f(define)g(mode)g(*/)192 1261 y ff(:)7 b(:)g(:)120 1311 y fi
+(/*)24 b(define)f(character-position)e(dimension)i(for)g(strings)g(of)h(max)f
+(length)g(40)h(*/)120 1361 y(chid)f(=)h(ncdimdef\(ncid,)e("chid",)h(40L\);)
+192 1411 y ff(:)7 b(:)g(:)120 1460 y fi(/*)24 b(define)f(a)g(character-string)
+f(variable)h(*/)120 1510 y(tx_dims[0])f(=)i(timeid;)120 1560 y(tx_dims[1])e
+(=)i(chid;)95 b(/*)24 b(character-position)d(dimension)i(last)g(*/)120 1610 y
+(tx_id)g(=)h(ncvardef)f(\(ncid,)g("tx",)g(NC_CHAR,)g(TDIMS,)g(tx_dims\);)192
+1660 y ff(:)7 b(:)g(:)120 1709 y fi(ncendef\(ncid\);)165 b(/*)24 b(leave)f
+(define)g(mode)g(*/)192 1759 y ff(:)7 b(:)g(:)120 1809 y fi(/*)24 b(write)f
+(tx_val)g(into)g(tx)h(netCDF)f(variable)g(in)g(record)g(3)h(*/)120 1859 y(tx_\
+start[0])e(=)i(3;)143 b(/*)24 b(record)f(number)g(to)g(write)g(*/)120 1909 y
+(tx_start[1])f(=)i(0;)143 b(/*)24 b(start)f(at)g(beginning)g(of)h(variable)e
+(*/)120 1958 y(tx_count[0])g(=)i(1;)143 b(/*)24 b(only)f(write)g(one)h(record)
+f(*/)120 2008 y(tx_count[1])f(=)i(strlen\(tx_val\))e(+)i(1;)47 b(/*)24 b(numb\
+er)f(of)g(chars)h(to)f(write)g(*/)120 2058 y(ncvarput\(ncid,)f(tx_id,)h(tx_st\
+art,)g(tx_count,)f(\(void)h(*\))h(tx_val\);)0 2339 y fl(F)n(OR)-6 b(TRAN)15 b
+(In)n(terface)62 2483 y fm(In)i(F)o(OR)m(TRAN,)f(\014xed-size)i(strings)e(ma)
+o(y)g(b)q(e)h(written)f(to)g(a)g(netCDF)g(\014le)h(without)f(a)g(terminating)
+h(c)o(har-)0 2545 y(acter,)d(to)g(sa)n(v)o(e)h(space.)20 b(V)l(ariable-length)
+d(strings)d(should)i(follo)o(w)f(the)f(C)h(con)o(v)o(en)o(tion)g(of)f(writing)
+h(strings)g(with)0 2608 y(a)e(terminating)i(n)o(ull)g(b)o(yte)e(so)h(that)f
+(the)h(in)o(tended)h(length)f(of)g(the)f(string)h(can)g(b)q(e)g(determined)h
+(when)g(it)f(is)g(later)0 2670 y(read)h(b)o(y)g(either)h(C)f(or)g(F)n(OR)m
+(TRAN)h(programs.)p eop
+%%Page: 114 116
+ bop 0 -58 a fm(114)1442 b(NetCDF)14 b(User's)h(Guide)62 183 y(The)d(F)o(OR)m
+(TRAN)g(interface)f(for)g(reading)i(and)f(writing)g(strings)g(requires)g(the)
+g(use)h(of)e(di\013eren)q(t)g(subroutines)0 246 y(for)16 b(accessing)h(string)
+f(v)n(alues)h(and)g(n)o(umeric)g(v)m(alues,)g(b)r(ecause)g(standard)f(F)n(OR)
+m(TRAN)h(do)q(es)g(not)f(p)q(ermit)h(the)0 308 y(same)h(formal)h(parameter)f
+(to)g(b)q(e)h(used)g(for)f(b)r(oth)g(c)o(haracter)g(v)m(alues)i(and)f(n)o(ume\
+ric)g(v)n(alues.)31 b(An)19 b(additional)0 370 y(argumen)o(t,)d(sp)q(ecifying)
+i(the)f(declared)h(length)f(of)f(the)h(c)o(haracter)f(string)h(passed)f(as)h
+(a)f(v)m(alue,)i(is)f(required)h(for)0 432 y fi(NCVPTC)i fm(and)h fi(NCVGTC)p
+fm(.)35 b(The)21 b(actual)g(length)g(of)f(the)h(string)f(is)h(sp)r(eci\014ed)
+h(as)e(the)h(v)n(alue)g(of)f(the)h(h)o(yp)q(erslab)0 495 y(edge-length)16 b
+(v)o(ector)f(corresp)q(onding)h(to)f(the)g(c)o(haracter-p)q(osition)h(dimensi\
+on.)62 672 y(Here)c(is)g(an)f(example)h(that)f(de\014nes)h(a)g(record)f(v)m
+(ariable,)i fi(tx)p fm(,)f(for)e(c)o(haracter)h(strings)g(and)h(stores)e(a)i
+(c)n(haracter-)0 734 y(string)19 b(v)m(alue)h(in)o(to)f(the)f(third)i(record)
+f(using)g fi(NCVPTC)p fm(.)30 b(In)19 b(this)h(example,)g(w)n(e)f(assume)g
+(the)g(string)g(v)m(ariable)0 797 y(and)14 b(data)f(are)g(to)g(b)q(e)h(added)
+g(to)f(an)h(existing)g(netCDF)f(\014le)i(named)f(`)p fi(foo.nc)p fm(')e(that)
+h(already)h(has)f(an)h(unlimited)0 859 y(record)h(dimension)i fi(time)p fm
+(.)263 1036 y fi(INCLUDE)23 b('netcdf.inc')335 1086 y ff(:)7 b(:)g(:)263 1136
+y fi(PARAMETER)23 b(\(TDIMS=2\))94 b(!)24 b(number)f(of)g(TX)h(dimensions)263
+1186 y(PARAMETER)f(\(TXLEN)g(=)h(15\))f(!)h(length)f(of)g(example)g(string)
+263 1236 y(INTEGER)47 b(NCID,)23 b(RCODE)263 1286 y(INTEGER)47 b(CHID)238 b
+(!)24 b(char)f(position)g(dimension)f(id)263 1335 y(INTEGER)47 b(TIMEID)190 b
+(!)24 b(record)f(dimension)f(id)263 1385 y(INTEGER)47 b(TXID)238 b(!)24 b(var\
+iable)f(ID)263 1435 y(INTEGER)47 b(TXDIMS\(TDIMS\))22 b(!)i(variable)f(shape)
+263 1485 y(INTEGER)47 b(TSTART\(TDIMS\),)22 b(TCOUNT\(TDIMS\))g(!)i(hyperslab)
+263 1535 y(CHARACTER*40)e(TXVAL)119 b(!)24 b(max)f(length)g(40)263 1584 y(DAT\
+A)g(TXVAL)h(/'example)e(string'/)335 1634 y ff(:)7 b(:)g(:)263 1684 y fi(TXVA\
+L\(TXLEN:TXLEN\))22 b(=)h(CHAR\(0\))71 b(!)24 b(null)f(terminate)335 1734 y ff
+(:)7 b(:)g(:)263 1784 y fi(NCID)23 b(=)h(NCOPN\('foo.nc',)e(NCWRITE,)h(RCODE\
+\))263 1833 y(CALL)g(NCREDF\(NCID,)g(RCODE\))g(!)g(enter)h(define)f(mode)335
+1883 y ff(:)7 b(:)g(:)120 1933 y fi(*)24 b(define)f(character-position)e(dime\
+nsion)i(for)g(strings)g(of)h(max)f(length)g(40)263 1983 y(CHID)g(=)h(NCDDEF\(\
+NCID,)e("chid",)h(40,)h(RCODE\))335 2033 y ff(:)7 b(:)g(:)120 2083 y fi(*)24 b
+(define)f(a)g(character-string)f(variable)263 2132 y(TXDIMS[1])h(=)h(CHID)71 b
+(!)23 b(character-position)f(dimension)g(first)263 2182 y(TXDIMS[2])h(=)h(TIM\
+EID)263 2232 y(TXID)f(=)h(NCVDEF\(NCID,)e("tx",)i(NCCHAR,)f(TDIMS,)g(TXDIMS,)
+f(RCODE\))335 2282 y ff(:)7 b(:)g(:)263 2332 y fi(CALL)23 b(NCENDF\(NCID,)g
+(RCODE\))g(!)g(leave)h(define)f(mode)335 2381 y ff(:)7 b(:)g(:)120 2431 y fi
+(*)24 b(write)f(txval)g(into)g(tx)h(netCDF)f(variable)g(in)g(record)g(3)263
+2481 y(TSTART[1])g(=)h(0)143 b(!)23 b(start)g(at)h(beginning)f(of)g(variable)
+263 2531 y(TSTART[2])g(=)h(3)143 b(!)23 b(record)g(number)g(to)h(write)263
+2581 y(TCOUNT[1])f(=)h(TXLEN)47 b(!)23 b(number)g(of)h(chars)f(to)h(write)263
+2630 y(TCOUNT[2])f(=)h(1)143 b(!)23 b(only)h(write)f(one)g(record)263 2680 y
+(CALL)g(NCVPTC)h(\(NCID,)f(TXID,)g(TSTART,)g(TCOUNT,)g(TXVAL,)g(40,)g(RCODE\))
+p eop
+%%Page: 115 117
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(115)0 183 y fl(7.13)32 b
+(Missing)16 b(V)-6 b(alues)62 357 y fm(What)17 b(happ)r(ens)h(when)g(y)o(ou)g
+(try)f(to)g(read)h(a)f(v)n(alue)h(that)f(w)o(as)g(nev)o(er)h(written)g(in)g
+(an)g(op)q(en)g(netCDF)f(\014le?)0 419 y(Y)l(ou)g(migh)o(t)g(exp)r(ect)g(that)
+f(this)h(should)h(alw)o(a)n(ys)f(b)r(e)g(an)g(error,)f(and)h(that)f(y)o(ou)h
+(should)h(get)e(an)h(error)f(message)0 481 y(or)e(an)h(error)f(status)f(retur\
+ned.)20 b(Y)m(ou)14 b fh(do)j fm(get)d(an)h(error)f(if)h(y)o(ou)f(try)g(to)g
+(read)h(data)f(from)g(a)g(netCDF)g(\014le)i(that)d(is)0 544 y(not)j(op)r(en)h
+(for)f(reading,)i(if)f(the)g(v)m(ariable)h(ID)f(is)g(inv)m(alid)h(for)e(the)h
+(sp)r(eci\014ed)h(netCDF)e(\014le,)i(or)f(if)g(the)g(sp)q(eci\014ed)0 606 y
+(h)o(yp)q(erslab)f(is)f(not)f(prop)r(erly)h(within)h(the)f(range)f(de\014ned)
+i(b)o(y)f(the)g(dimension)h(sizes)g(of)e(the)h(sp)r(eci\014ed)h(v)m(ariable.)
+0 668 y(Otherwise,)d(reading)f(a)g(v)m(alue)h(that)e(w)o(as)g(not)g(written)h
+(returns)g(a)f(sp)r(ecial)i fh(\014ll)g(v)n(alue)i fm(used)d(to)g(\014ll)h
+(in)g(an)n(y)f(missing)0 730 y(v)m(alues)k(when)g(a)f(netCDF)f(v)n(ariable)i
+(is)g(\014rst)f(written.)62 904 y(Y)m(ou)k(ma)n(y)h(also)f(ignore)h(\014ll)h
+(v)m(alues)f(and)g(use)g(the)f(en)o(tire)h(range)f(of)g(a)g(netCDF)g(data)g
+(t)n(yp)q(e,)i(but)e(in)i(this)0 966 y(case)15 b(y)o(ou)g(should)i(mak)n(e)f
+(sure)f(y)o(ou)g(write)h(all)g(data)f(v)m(alues)h(b)r(efore)f(reading)h(them.)
+21 b(If)15 b(y)o(ou)g(kno)o(w)g(y)o(ou)g(will)i(b)r(e)0 1029 y(writing)e(all)
+h(the)f(data)f(b)q(efore)h(reading)g(it,)g(y)n(ou)g(can)g(sp)q(ecify)h(that)e
+(no)g(pre\014lling)j(of)e(v)m(ariables)h(with)f(\014ll)h(v)m(alues)0 1091 y
+(will)j(o)q(ccur)f(b)o(y)f(calling)i fi(ncsetfill)d fm(b)r(efore)h(writing.)
+26 b(This)18 b(ma)o(y)f(pro)o(vide)h(a)f(signi\014cant)g(p)r(erformance)g(gai\
+n)0 1153 y(for)e(netCDF)f(writes.)62 1327 y(There)g(are)g(sev)o(eral)g(reason\
+s)f(for)h(using)g(a)g(\014ll)h(v)n(alue)f(instead)h(of)e(an)h(error)f(return)
+h(for)f(missing)i(data.)k(First,)0 1389 y(the)14 b(in)o(terface)g(for)f(h)o
+(yp)q(erslab)h(access)g(w)o(ould)g(necessarily)h(b)r(e)e(more)g(complex)i(and)
+f(slo)o(w)n(er)g(if)g(information)g(had)0 1451 y(to)f(b)q(e)h(returned)g(ab)q
+(out)f(whether)h(eac)o(h)f(v)n(alue)h(read)f(had)h(b)q(een)h(written.)k(Since)
+c(data)e(ma)n(y)g(ha)o(v)o(e)g(b)r(een)h(written)0 1513 y(in)19 b(a)e(di\013e\
+ren)q(t)g(order)h(from)f(that)g(in)i(which)f(it)g(is)g(later)g(read,)g(it)g
+(is)g(p)r(ossibile)i(that)d(only)h(a)g(few)g(v)m(alues)h(in)f(a)0 1576 y(blo)
+r(c)o(k)c(of)g(retrieved)h(v)m(alues)g(w)o(ere)g(nev)o(er)f(written.)20 b(Sec\
+ond,)15 b(it)g(is)g(usually)h(preferable)g(to)d(delay)i(the)f(detection)0 1638
+y(of)k(missing)i(v)m(alues)f(until)g(there)g(is)g(a)f(need)i(for)e(the)h(v)m
+(alues,)h(since)g(they)e(ma)o(y)g(not)g(b)r(e)h(used)g(in)g(subsequent)0 1700
+y(computations.)g(Finally)n(,)14 b(the)h(use)g(of)e(missing)j(v)m(alues)f(is)
+g(a)f(common)g(w)o(a)n(y)h(to)e(represent)h(data)g(p)q(oin)o(ts)g(outside)0
+1762 y(the)d(b)q(oundaries)h(of)e(irregular)h(regions)g(of)f(data)g(enclosed)
+i(b)o(y)f(a)f(h)o(yp)r(erslab,)h(making)g(it)g(p)r(ossible)h(to)e(handle)i
+(suc)o(h)0 1825 y(data)h(in)h(a)f(simpler)i(w)n(a)o(y)e(than)g(w)o(ould)h(b)r
+(e)f(p)r(ossible)h(with)g(a)f(more)g(compact)g(representation)g(that)f(repres\
+ented)0 1887 y(the)j(b)r(oundary)g(explicitly)o(.)62 2061 y(The)h(default)g
+(\014ll)h(v)m(alues)g(for)d(eac)o(h)i(t)n(yp)r(e)g(are)f(de\014ned)i(in)f(the)
+g(include)h(\014le)g(`)p fi(netcdf.h)p fm(')c(\(or)i(`)p fi(netcdf.inc)p fm
+(')0 2123 y(for)i(F)o(OR)m(TRAN\).)h(It)g(is)g(usually)i(b)q(etter)e(to)f(use)
+i(y)n(our)f(o)o(wn)g(\014ll)h(v)n(alue)f(instead,)h(b)o(y)f(de\014ning)i(the)
+e(attribute)0 2185 y fi(_FillValue)d fm(for)h(a)h(v)m(ariable)h(b)q(efore)f
+(writing)g(it.)24 b(A)17 b(disadv)n(an)o(tage)f(of)g(the)h(default)g(\014ll)h
+(v)n(alues)f(for)f(\015oating-)0 2247 y(p)r(oin)o(t)c(and)i(double-precision)
+h(t)o(yp)q(es)e(is)h(that)e(they)h(ma)n(y)g(b)r(e)g(de\014ned)h(di\013eren)q
+(tly)f(for)f(di\013eren)q(t)g(platforms,)h(and)0 2310 y(ma)n(y)i(b)q(e)g(di\
+\016cult)h(to)e(compare)h(with)g(other)f(v)m(alues,)h(since)h(they)f(are)f
+(de\014ned)i(to)e(b)r(e)h(righ)o(t)f(at)g(the)h(edge)g(of)f(the)0 2372 y(v)m
+(alid)j(\015oating-p)r(oin)o(t)e(n)o(um)o(b)q(er)g(ranges)g(for)g(eac)n(h)h
+(mac)n(hine.)62 2545 y(Fill)j(v)m(alues)f(are)e(used)i(for)e(\014lling)j(in)e
+(missing)h(data)e(whenever)g(a)h(v)m(alue)h(is)f(put)g(b)r(ey)o(ond)g(the)g
+(end)g(of)g(data)0 2608 y(that)d(has)i(already)f(b)r(een)g(written.)20 b(A)c
+(default)f(\014ll)i(v)m(alue)f(has)f(no)h(other)e(sp)r(ecial)i(meaning,)g(so)
+f(it)g(can)g(b)r(e)g(used)0 2670 y(for)g(v)m(alid)h(v)n(alues)g(if)f(y)o(ou)g
+(use)h(y)o(our)e(o)o(wn)h(\014ll)i(v)m(alue)f(instead.)p eop
+%%Page: 116 118
+ bop 0 -58 a fm(116)1442 b(NetCDF)14 b(User's)h(Guide)62 183 y(Curren)o(tly)d
+(the)g(only)g(di\013erence)i(b)r(et)n(w)o(een)e(the)g(netCDF)f(b)o(yte)h(and)
+g(c)o(haracter)f(t)n(yp)r(es)g(is)i(that)e(the)h(t)n(w)o(o)f(t)n(yp)r(es)0 246
+y(ha)o(v)n(e)17 b(di\013eren)q(t)f(default)i(\014ll)g(v)m(alues.)26 b(The)17 b
+(\014ll)h(v)m(alue)g(for)e(b)o(ytes)h(is)g(on)g(the)g(edge)g(of)f(the)h(range\
+,)f(representing)0 308 y(the)f(largest)g(negativ)o(e)h(v)m(alue)g(for)f(signe\
+d)h(b)o(ytes.)k(The)c(\014ll)h(v)m(alue)f(for)f(c)o(haracters,)f(ho)o(w)n(ev)
+o(er,)h(is)h(the)f(zero)h(b)o(yte,)0 370 y(a)f(more)g(useful)h(v)m(alue)g(for)
+f(detecting)h(the)f(end)h(of)f(C)g(c)o(haracter)f(strings.)62 507 y(Sometimes)
+k(there)g(is)g(need)g(for)f(more)g(than)h(one)g(v)m(alue)g(to)f(represent)g
+(di\013eren)q(t)g(kinds)h(of)f(missing)i(data.)0 569 y(In)g(this)h(case,)f
+(the)g(user)g(should)h(use)f(one)g(or)f(more)g(other)h(v)m(ariable)h(attribut\
+es)f(for)f(the)h(di\013erent)g(kinds)g(of)0 632 y(missing)h(data.)30 b(F)l
+(or)18 b(example,)i(it)f(migh)o(t)g(b)q(e)g(appropriate)g(to)f(use)h fi(_Fill\
+Value)f fm(to)g(mean)g(that)h(data)f(that)0 694 y(w)o(as)f(exp)r(ected)h(nev)
+o(er)f(app)r(eared,)h(but)g fi(missing_value)e fm(where)i(the)f(creator)g(of)
+g(the)h(data)f(intends)h(data)f(to)0 756 y(b)r(e)e(missing,)h(as)e(around)i
+(an)f(irregular)g(region)h(represen)o(ted)g(b)o(y)f(a)g(rectangular)g(grid.)p
+eop
+%%Page: 117 119
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(117)0 183 y fl(7.14)32 b
+(Rename)15 b(a)g(V)-6 b(ariable)62 322 y fm(The)15 b(function)g fi(ncvarrenam\
+e)e fm(\(or)g fi(NCVREN)h fm(for)f(F)o(OR)m(TRAN\))h(c)o(hanges)g(the)h(name)
+f(of)g(a)g(netCDF)g(v)m(ariable)0 384 y(in)j(an)g(op)q(en)g(netCDF.)e(If)i
+(the)f(new)h(name)f(is)h(longer)g(than)f(the)h(old)g(name,)f(the)h(netCDF)f
+(m)n(ust)g(b)r(e)h(in)g(de\014ne)0 447 y(mo)q(de.)j(Y)l(ou)c(cannot)f(rename)
+g(a)g(v)m(ariable)h(to)f(ha)o(v)n(e)h(the)f(name)g(of)g(an)o(y)g(existing)h
+(v)m(ariable.)62 586 y(In)f(case)g(of)f(an)h(error,)e fi(ncvarrename)g fm(ret\
+urns)i(-1;)f fi(NCVREN)g fm(returns)g(a)g(nonzero)h(v)m(alue)h(in)f fi(rcode)
+p fm(.)k(P)o(ossible)0 648 y(causes)c(of)g(errors)g(include:)37 787 y fk(\017)
+30 b fm(The)15 b(new)h(name)f(is)h(in)g(use)f(as)g(the)g(name)h(of)e(another)
+h(v)n(ariable.)37 863 y fk(\017)30 b fm(The)15 b(v)n(ariable)h(ID)f(is)h(inv)
+m(alid)g(for)f(the)g(sp)r(eci\014ed)i(netCDF)d(\014le.)37 940 y fk(\017)30 b
+fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g
+(op)q(en)g(netCDF)g(\014le.)0 1258 y fl(ncv)l(arrename:)23 b(C)15 b(In)n(terf\
+ace)120 1397 y fi(int)23 b(ncvarrename\(int)f(ncid,)h(int)h(varid,)f(const)g
+(char*)g(name\);)0 1612 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e
+(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1689 y fi
+(varid)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e(a)h(previous)h(call)
+h(to)d fi(ncvardef)g fm(or)h fi(ncvarid)p fm(.)0 1765 y fi(name)144 b fm(New)
+15 b(name)g(for)g(the)g(sp)r(eci\014ed)i(v)m(ariable.)62 1981 y(Here)j(is)g
+(an)f(example)h(using)h fi(ncvarrename)d fm(to)g(rename)i(the)f(v)n(ariable)h
+fi(rh)f fm(to)g fi(rel_hum)f fm(in)j(an)e(existing)0 2043 y(netCDF)c(\014le)h
+(named)f(`)p fi(foo.nc)p fm(':)120 2182 y fi(#include)23 b("netcdf.h")192 2232
+y ff(:)7 b(:)g(:)120 2282 y fi(int)47 b(ncid;)596 b(/*)24 b(netCDF)f(ID)g(*/)
+120 2332 y(int)47 b(rh_id;)572 b(/*)24 b(variable)f(ID)g(*/)192 2381 y ff(:)7
+b(:)g(:)120 2431 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e(NC_WRITE\);)192 2481 y
+ff(:)7 b(:)g(:)120 2531 y fi(ncredef\(ncid\);)46 b(/*)23 b(put)h(in)f(define)
+g(mode)h(to)f(rename)g(variable)g(*/)120 2581 y(rh_id)g(=)h(ncvarid)f(\(ncid,)
+g("rh"\);)120 2630 y(ncvarrename)f(\(ncid,)h(rh_id,)g("rel_hum"\);)120 2680 y
+(ncendef\(ncid\);)46 b(/*)23 b(leave)h(define)f(mode)g(*/)p eop
+%%Page: 118 120
+ bop 0 -58 a fm(118)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(NCVREN:)f
+(F)n(OR)-6 b(TRAN)15 b(In)n(terface)263 320 y fi(SUBROUTINE)23 b(NCVREN)g(\(I\
+NTEGER)f(NCID,)i(INTEGER)f(VARID,)239 370 y(+)454 b(CHARACTER*\(*\))22 b(NEWN\
+AM,)h(INTEGER)f(RCODE\))0 582 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)h
+(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 656 y
+fi(VARID)120 b fm(V)l(ariable)16 b(ID,)f(returned)h(from)e(a)h(previous)h(cal\
+l)h(to)d fi(NCVDEF)g fm(or)h fi(NCVID)p fm(.)0 731 y fi(NEWNAM)96 b fm(New)15
+b(name)g(for)g(the)g(sp)r(eci\014ed)i(v)m(ariable.)62 943 y(Here)f(is)g(an)g
+(example)g(using)h fi(NCVREN)e fm(to)g(rename)g(the)h(v)m(ariable)h fi(rh)e fm
+(to)g fi(rel_hum)g fm(in)h(an)g(existing)h(netCDF)0 1005 y(\014le)f(named)g
+(`)p fi(foo.nc)p fm(':)263 1142 y fi(INCLUDE)23 b('netcdf.inc')335 1192 y ff
+(:)7 b(:)g(:)263 1242 y fi(INTEGER)47 b(NCID,)23 b(RCODE)263 1292 y(INTEGER)
+47 b(RHID)357 b(!)24 b(variable)f(ID)335 1341 y ff(:)7 b(:)g(:)263 1391 y fi
+(NCID)23 b(=)h(NCOPN)f(\('foo.nc',)g(NCWRITE,)g(RCODE\))335 1441 y ff(:)7 b
+(:)g(:)263 1491 y fi(CALL)23 b(NCREDF)h(\(CDFFID,)e(RCODE\))47 b(!)24 b(enter)
+f(definition)g(mode)263 1541 y(RHID)g(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\))
+47 b(!)23 b(get)h(ID)263 1590 y(CALL)f(NCVREN)h(\(NCID,)f(RHID,)g('rel_hum',)
+f(RCODE\))263 1640 y(CALL)h(NCENDF)h(\(CDFFID,)e(RCODE\))47 b(!)24 b(leave)f
+(definition)g(mode)p eop
+%%Page: 119 121
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(119)0 183 y fl(7.15)32 b
+(Get)15 b(Num)n(b)r(er)h(of)e(Bytes)h(for)g(a)f(Data)h(T)n(yp)r(e)62 363 y fm
+(The)i(function)g fi(nctypelen)e fm(\(or)g fi(NCTLEN)g fm(for)h(F)n(OR)m(TRAN\
+\))h(returns)f(the)g(n)o(um)o(b)q(er)g(of)g(b)o(ytes)g(p)r(er)g(netCDF)0 426 y
+(data)f(t)n(yp)q(e.)62 606 y(In)d(case)g(of)f(an)h(error,)f fi(nctypelen)f fm
+(returns)i(-1;)g fi(NCTLEN)e fm(returns)i(a)f(nonzero)h(v)m(alue)h(in)f fi
+(rcode)p fm(.)18 b(One)12 b(p)r(ossible)0 668 y(cause)j(of)g(errors)g(is:)37
+848 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(data)d(t)o(yp)q(e)i(is)f(not)
+g(a)g(v)m(alid)i(netCDF)d(data)h(t)n(yp)r(e.)0 1580 y fl(nct)n(yp)s(elen:)23 b
+(C)15 b(In)n(terface)120 1760 y fi(int)23 b(nctypelen)g(\(nc_type)g(datatype\
+\);)0 2058 y(datatype)48 b fm(One)14 b(of)f(the)h(set)f(of)h(prede\014ned)h
+(netCDF)e(data)g(t)n(yp)r(es.)19 b(The)14 b(t)n(yp)r(e)f(of)h(this)g(paramete\
+r,)e fi(nc_type)p fm(,)240 2120 y(is)23 b(de\014ned)g(in)g(the)g(netCDF)e(hea\
+der)i(\014le.)42 b(The)22 b(v)n(alid)h(netCDF)f(data)f(t)o(yp)q(es)h(are)g fi
+(NC_BYTE)p fm(,)240 2183 y fi(NC_CHAR)p fm(,)14 b fi(NC_SHORT)p fm(,)g fi(NC_\
+LONG)p fm(,)f fi(NC_FLOAT)p fm(,)h(and)h fi(NC_DOUBLE)p fm(.)62 2481 y(Here)f
+(is)g(an)f(example)h(using)g fi(nctypelen)e fm(to)g(determine)j(ho)n(w)e(man)
+o(y)g(b)o(ytes)g(are)g(required)i(to)d(store)h(a)g(single)0 2543 y(v)m(alue)j
+(of)f(the)g(v)n(ariable)h fi(rh)f fm(in)h(an)f(existing)h(netCDF)f(\014le)h
+(named)f(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 120 122
+ bop 0 -58 a fm(120)1442 b(NetCDF)14 b(User's)h(Guide)120 183 y fi(#include)
+23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(int)47 b(ncid;)191 b
+(/*)23 b(netCDF)g(ID)h(*/)120 333 y(int)47 b(rh_id;)167 b(/*)23 b(variable)g
+(ID)g(*/)120 382 y(nc_type)g(rh_type;)261 b(/*)24 b(variable)f(type)g(*/)120
+432 y(int)g(rh_ndims;)333 b(/*)24 b(number)f(of)h(dims)f(*/)120 482 y(int)g
+(rh_dims[MAX_VAR_DIMS];)e(/*)j(variable)f(shape)g(*/)120 532 y(int)g(rh_natts\
+;)333 b(/*)24 b(number)f(of)h(attributes)e(*/)120 582 y(int)h(rhbytes;)143 b
+(/*)23 b(number)g(of)h(bytes)f(per)g(value)h(for)f("rh")g(*/)192 632 y ff(:)7
+b(:)g(:)120 681 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e(NC_NOWRITE\);)192 731 y
+ff(:)7 b(:)g(:)120 781 y fi(rh_id)23 b(=)h(ncvarid)f(\(ncid,)g("rh"\);)120 831
+y(/*)h(get)f(type.)47 b(we)24 b(don't)f(need)g(name,)g(since)h(we)f(already)g
+(know)g(it)h(*/)120 881 y(ncvarinq)f(\(ncid,)g(rh_id,)g(\(char)g(*\))h(0,)f
+(&rh_type,)g(&rh_ndims,)f(rh_dims,)359 930 y(&rh_natts\);)120 980 y(rhbytes)h
+(=)h(nctypelen)e(\(rh_type\);)0 1636 y fl(NCTLEN:)14 b(F)n(OR)-6 b(TRAN)15 b
+(In)n(terface)263 1809 y fi(INTEGER)23 b(FUNCTION)g(NCTLEN)g(\(INTEGER)g(TYPE)
+g(,INTEGER)g(RCODE\))0 2031 y(TYPE)144 b fm(One)20 b(of)e(the)h(set)g(of)g
+(prede\014ned)i(netCDF)d(data)g(t)o(yp)q(es.)32 b(The)19 b(v)m(alid)i(netCDF)
+d(data)g(t)o(yp)q(es)h(are)240 2093 y fi(NCBYTE)p fm(,)14 b fi(NCCHAR)p fm
+(,)g fi(NCSHORT)p fm(,)g fi(NCLONG)p fm(,)g fi(NCFLOAT)p fm(,)g(and)h fi(NCDO\
+UBLE)p fm(.)0 2204 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b
+(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 2488 y(Here)j(is)g
+(an)g(example)h(using)f fi(NCTLEN)f fm(to)g(determine)i(ho)o(w)e(man)o(y)g
+(b)o(ytes)h(are)f(required)i(to)e(store)g(a)h(single)0 2550 y(v)m(alue)e(of)f
+(the)g(v)n(ariable)h fi(rh)f fm(in)h(an)f(existing)h(netCDF)f(\014le)h(named)
+f(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 121 123
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(121)263 183 y fi(INCLUD\
+E)23 b('netcdf.inc')335 233 y ff(:)7 b(:)g(:)263 283 y fi(INTEGER)47 b(NCID)
+333 b(!)24 b(netCDF)f(ID)263 333 y(INTEGER)47 b(RHID)357 b(!)24 b(variable)f
+(ID)263 382 y(CHARACTER*31)f(RHNAME)214 b(!)24 b(variable)f(name)263 432 y
+(INTEGER)47 b(RHTYPE)309 b(!)24 b(variable)f(type)263 482 y(INTEGER)47 b(RHN)
+381 b(!)24 b(number)f(of)h(dimensions)263 532 y(INTEGER)47 b(RHDIMS\(MAXVDIMS\
+\))69 b(!)24 b(variable)f(shape)263 582 y(INTEGER)47 b(RHNATT)309 b(!)24 b
+(number)f(of)h(attributes)263 632 y(INTEGER)47 b(RHBYTS)309 b(!)24 b(bytes)f
+(per)h(value)335 681 y ff(:)7 b(:)g(:)263 731 y fi(NCID)23 b(=)h(NCOPN)f(\('f\
+oo.nc',)g(NCNOWRIT,)g(RCODE\))335 781 y ff(:)7 b(:)g(:)263 831 y fi(RHID)23 b
+(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\))120 881 y(*)g(get)f(type)g(of)h("rh")
+263 930 y(CALL)f(NCVINQ)h(\(NCID,)f(RHID,)g(RHNAME,)g(RHTYPE,)g(RHN,)g(RHDIMS\
+,)g(RHNATT,)239 980 y(+)310 b(RCODE\))263 1030 y(RHBYTS)23 b(=)h(NCTLEN)f(\(R\
+HTYPE\))p eop
+%%Page: 122 124
+ bop 0 -58 a fm(122)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(7.16)32 b
+(Get)15 b(Information)h(Ab)r(out)f(Record)g(V)-6 b(ariables)62 325 y fm(The)
+18 b(function)g fi(ncrecinq)e fm(returns)h(information)g(ab)r(out)f(the)i(rec\
+ord)f(v)m(ariables)i(\(v)m(ariables)f(that)e(use)i(the)0 387 y(unlimited)d
+(dimension\))f(in)f(a)f(netCDF)g(\014le.)20 b(The)13 b(information)g(returned)
+g(is)g(the)g(n)n(um)o(b)r(er)f(of)h(record)f(v)m(ariables,)0 449 y(their)k
+(v)m(ariable)g(IDs,)f(and)h(the)f(size)h(\(in)g(b)o(ytes\))e(for)h(a)g(record\
+'s)f(w)o(orth)h(of)f(data)h(for)f(eac)o(h)i(record)f(v)m(ariable.)62 591 y
+(The)c fi(ncrecinq)f fm(function)i(is)f(not)f(strictly)i(necessary)l(,)f(sinc\
+e)h(the)f(information)g(it)g(returns)g(can)g(b)r(e)g(computed)0 653 y(from)k
+(information)h(returned)g(b)o(y)f fi(ncinquire)p fm(,)f fi(ncdiminq)p fm(,)g
+(and)i fi(ncvarinq)f fm(functions)h(or)f(their)h(F)o(OR)m(TRAN)0 715 y(coun)o
+(terparts.)24 b(This)17 b(function)h(is)f(pro)o(vided)h(in)g(the)f(C)f(interf\
+ace)g(for)h(con)o(v)n(enience)i(only)m(,)e(to)f(assist)h(in)g(using)0 777 y
+(the)e(C)g(functions)h fi(ncrecput)e fm(and)i fi(ncrecget)p fm(.)62 919 y(In)
+g(case)f(of)g(an)g(error,)f fi(ncrecinq)g fm(returns)h(-1.)20 b(P)o(ossible)c
+(causes)g(of)e(errors)h(include:)37 1060 y fk(\017)30 b fm(The)15 b(sp)r(eci\
+\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g
+(\014le.)0 1403 y fl(ncrecinq:)24 b(C)15 b(In)n(terface)120 1544 y fi(int)23 b
+(ncrecinq\(int)g(ncid,)g(int*)g(nrvars,)g(int)h(rvarids[],)e(long)h(rsizes[]\
+\);)0 1685 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h
+(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1765 y fi(nrvars)96 b fm
+(Num)o(b)q(er)16 b(of)e(record)i(v)m(ariables.)0 1844 y fi(rvarids)72 b fm
+(Returned)20 b(v)n(ector)f(of)f fi(nrvars)g fm(v)m(ariable)i(IDs)e(for)g(the)
+h(record)g(v)m(ariables)h(in)f(this)g(netCDF)f(\014le.)240 1906 y(The)h(calle\
+r)g(m)o(ust)f(allo)r(cate)h(enough)g(space)f(for)g(a)h(v)n(ector)f(of)h(at)e
+(least)i fi(nrvars)f fm(in)o(tegers)g(to)g(b)r(e)240 1968 y(returned.)38 b
+(The)22 b(maxim)o(um)f(p)q(ossible)i(n)o(um)o(b)q(er)e(of)g(v)m(ariable)i(IDs)
+e(returned)g(is)h(giv)o(en)g(b)o(y)f(the)240 2030 y(prede\014ned)c(constan)o
+(t)e fi(MAX_NC_VARS)p fm(.)k(If)d(this)g(parameter)f(is)h(giv)o(en)g(as)f(`)p
+fi(\(int)g(*\))f(0)p fm(',)h(no)h(v)n(ector)240 2093 y(will)k(b)q(e)f(returne\
+d)f(so)g(no)g(space)g(to)g(hold)h(the)f(record)g(v)n(ariable)h(IDs)f(needs)h
+(to)e(b)r(e)h(declared)h(or)240 2155 y(allo)r(cated.)0 2234 y fi(rsizes)96 b
+fm(Returned)23 b(v)n(ector)f(of)f fi(nrvars)g fm(sizes)h(for)f(the)h(record)g
+(v)m(ariables)h(in)f(this)g(netCDF)f(\014le.)41 b(The)240 2296 y(size)20 b
+(of)e(a)g(record)h(v)m(ariable)h(is)f(the)g(n)o(um)n(b)r(er)g(of)f(b)o(ytes)g
+(required)i(to)e(hold)h(a)g(record's)f(w)n(orth)g(of)240 2359 y(data,)e(whic)
+o(h)h(is)g(the)f(pro)q(duct)h(of)f(the)g(non-record)h(dimensions)h(and)e(the)
+h(size)g(of)f(data)g(t)n(yp)r(e,)g(in)240 2421 y(b)o(ytes.)24 b(The)17 b(call\
+er)h(m)o(ust)f(allo)r(cate)f(enough)h(space)g(for)g(a)f(v)o(ector)g(of)h(at)f
+(least)h fi(nrvars)f fm(longs)h(to)240 2483 y(b)r(e)f(returned.)25 b(The)17 b
+(maxim)o(um)f(p)r(ossible)i(n)o(um)o(b)q(er)f(of)f(v)n(ariable)h(IDs)g(return\
+ed)g(is)g(giv)o(en)g(b)o(y)g(the)240 2545 y(prede\014ned)g(constan)o(t)e fi
+(MAX_NC_VARS)p fm(.)k(If)d(this)g(parameter)f(is)h(giv)o(en)g(as)f(`)p fi(\(i\
+nt)g(*\))f(0)p fm(',)h(no)h(v)n(ector)240 2608 y(will)j(b)q(e)e(returned)g
+(so)g(no)g(space)g(to)f(hold)i(the)f(record)g(v)m(ariable)h(sizes)g(needs)g
+(to)e(b)q(e)h(declared)h(or)240 2670 y(allo)r(cated.)p eop
+%%Page: 123 125
+ bop 0 -58 a fm(Chapter)15 b(7:)k(V)m(ariables)1468 b(123)62 183 y(Here)13 b
+(is)g(an)g(example)h(using)f fi(ncrecinq)f fm(to)g(\014nd)h(out)g(ab)q(out)f
+(the)h(record)g(v)m(ariables)h(in)f(an)g(existing)h(netCDF)0 246 y(\014le)i
+(named)g(`)p fi(foo.nc)p fm(':)120 382 y fi(#include)23 b("netcdf.h")192 432 y
+ff(:)7 b(:)g(:)120 482 y fi(int)47 b(ncid;)501 b(/*)23 b(netCDF)g(ID)h(*/)120
+532 y(int)47 b(nrvars;)453 b(/*)23 b(number)g(of)h(record)f(variables)g(*/)
+120 582 y(int)47 b(rvarids[MAX_NC_VARS];)117 b(/*)23 b(IDs)h(of)f(record)g
+(variables)g(*/)120 632 y(long)g(rvarsizes[MAX_NC_VARS];)69 b(/*)23 b(record)
+g(sizes)h(of)f(record)g(variables)g(*/)192 681 y ff(:)7 b(:)g(:)120 731 y fi
+(ncid)23 b(=)h(ncopen)f(\("foo.nc",)g(NC_NOWRITE\);)192 781 y ff(:)7 b(:)g
+(:)120 831 y fi(ncrecinq)23 b(\(ncid,)g(&nrvars,)g(rvarids,)f(rvarsizes\);)p
+eop
+%%Page: 124 126
+ bop 0 -58 a fm(124)1442 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 125 127
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(125)0 183 y fj(8)41 b
+(A)m(ttributes)62 370 y fm(A)o(ttributes)19 b(ma)n(y)g(b)r(e)g(asso)q(ciated)
+g(with)h(eac)n(h)g(netCDF)e(v)m(ariable)i(to)f(sp)q(ecify)h(suc)o(h)f(prop)r
+(erties)g(as)g(units,)0 432 y(sp)q(ecial)i(v)n(alues,)g(maxim)o(um)e(and)h
+(minimum)f(v)n(alid)i(v)m(alues,)g(scaling)g(factors,)e(and)g(o\013sets.)33 b
+(A)o(ttributes)20 b(for)0 495 y(a)e(netCDF)f(\014le)i(are)f(de\014ned)i(when)
+e(the)h(\014le)g(is)f(\014rst)g(created,)h(while)g(the)g(netCDF)e(\014le)i
+(is)g(in)g(de\014ne)g(mo)q(de.)0 557 y(Additional)h(attributes)e(ma)n(y)g(b)q
+(e)h(added)f(later)g(b)o(y)g(reen)o(tering)h(de\014ne)g(mo)q(de.)28 b(A)18 b
+(netCDF)g(attribute)f(has)h(a)0 619 y(netCDF)d(v)n(ariable)i(to)e(which)h(it)
+g(is)h(assigned,)f(a)g(name,)g(a)g(t)n(yp)r(e,)g(a)f(length,)i(and)f(a)g(sequ\
+ence)h(of)f(one)g(or)f(more)0 681 y(v)m(alues.)23 b(An)16 b(attribute)g(is)g
+(designated)g(b)o(y)g(its)g(v)n(ariable)g(ID)g(and)g(name,)g(except)g(in)h
+(one)e(case)h(\()p fi(ncattname)e fm(or)0 744 y fi(NCANAM)h fm(in)h(F)o(OR)m
+(TRAN\),)f(where)h(attributes)g(are)f(designated)i(b)o(y)f(v)m(ariable)h(ID)f
+(and)g(n)o(um)n(b)r(er)g(b)q(ecause)g(their)0 806 y(names)f(are)g(unkno)o(wn.)
+62 943 y(The)e(attributes)g(asso)q(ciated)g(with)h(a)e(v)n(ariable)i(are)f
+(t)n(ypically)i(de\014ned)f(righ)o(t)f(after)f(the)h(v)n(ariable)h(is)f(creat\
+ed,)0 1005 y(while)18 b(still)f(in)g(de\014ne)g(mo)q(de.)23 b(The)17 b(data)e
+(t)n(yp)r(e,)h(length,)h(and)f(v)m(alue)h(of)f(an)g(attribute)g(ma)n(y)g(b)r
+(e)g(c)o(hanged)h(ev)o(en)0 1067 y(when)f(in)f(data)g(mo)q(de,)g(as)f(long)i
+(as)e(the)i(c)n(hanged)g(attribute)f(requires)h(no)f(more)f(space)h(than)g
+(the)g(attribute)g(as)0 1130 y(originally)i(de\014ned.)62 1267 y(It)12 b(is)h
+(also)f(p)q(ossible)h(to)f(assign)g(attributes)f(not)h(associated)h(with)f
+(an)o(y)g(v)m(ariable)h(to)e(the)h(netCDF)g(as)f(a)h(whole,)0 1329 y(b)o(y)18
+b(using)g(the)g fi(NC_GLOBAL)f fm(v)m(ariable)i(pseudo-ID.)f(Global)g(attribu\
+tes)g(ma)n(y)g(b)q(e)g(used)h(for)e(purp)r(oses)g(suc)o(h)h(as)0 1391 y(pro)o
+(viding)e(a)f(title)h(or)f(pro)q(cessing)h(history)f(for)f(a)h(netCDF)g(data)
+f(set.)62 1528 y(Op)r(erations)h(supp)r(orted)g(on)g(attributes)g(are:)37 1665
+y fk(\017)30 b fm(Create)15 b(an)g(attribute,)f(giv)o(en)i(its)f(v)n(ariable)
+h(ID,)f(name,)g(data)f(t)o(yp)q(e,)h(length,)h(and)f(v)n(alue.)37 1740 y fk
+(\017)30 b fm(Get)15 b(attribute's)f(data)h(t)n(yp)r(e)g(and)g(length)h(from)
+f(its)g(v)n(ariable)h(ID)f(and)g(name.)37 1815 y fk(\017)30 b fm(Get)15 b(att\
+ribute's)f(v)n(alue)i(from)e(its)i(v)m(ariable)g(ID)f(and)h(name.)37 1889 y fk
+(\017)30 b fm(Cop)o(y)15 b(attribute)g(from)f(one)i(netCDF)e(to)h(another.)37
+1964 y fk(\017)30 b fm(Get)15 b(name)g(of)g(attribute)g(from)f(its)i(n)o(um)n
+(b)r(er.)37 2039 y fk(\017)30 b fm(Rename)16 b(an)f(attribute.)37 2114 y fk
+(\017)30 b fm(Delete)16 b(an)f(attribute.)p eop
+%%Page: 126 128
+ bop 0 -58 a fm(126)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(8.1)33 b(Cre\
+ate)14 b(an)h(A)n(ttribute)62 322 y fm(The)d(function)g fi(ncattput)d fm(\(or)
+i fi(NCAPT)f fm(or)h fi(NCAPTC)f fm(for)g(F)o(OR)m(TRAN\))h(adds)g(or)g(c)o
+(hanges)g(a)g(v)m(ariable)h(attribute)0 384 y(or)h(global)h(attribute)g(of)f
+(an)h(op)q(en)g(netCDF)f(\014le.)20 b(If)14 b(this)g(attribute)g(is)g(new,)g
+(or)f(if)h(the)g(space)g(required)h(to)e(store)0 446 y(the)i(attribute)g(is)h
+(greater)e(than)h(b)r(efore,)g(the)g(netCDF)f(\014le)j(m)n(ust)e(b)r(e)g(in)h
+(de\014ne)g(mo)q(de.)62 585 y(In)21 b(case)f(of)g(an)g(error,)g fi(ncattput)f
+fm(returns)h(-1;)i fi(NCAPT)d fm(returns)h(a)g(nonzero)g(v)n(alue)g(in)h fi
+(rcode)p fm(.)34 b(P)o(ossible)0 647 y(causes)15 b(of)g(errors)g(include:)37
+785 y fk(\017)30 b fm(The)15 b(v)n(ariable)h(ID)f(is)h(inv)m(alid)g(for)f(the)
+g(sp)r(eci\014ed)i(netCDF)d(\014le.)37 861 y fk(\017)30 b fm(The)15 b(sp)r
+(eci\014ed)i(netCDF)d(t)o(yp)q(e)i(is)f(inv)m(alid.)37 937 y fk(\017)30 b fm
+(The)15 b(sp)r(eci\014ed)i(length)f(is)f(negativ)o(e.)37 1014 y fk(\017)30 b
+fm(The)15 b(sp)r(eci\014ed)i(op)q(en)f(netCDF)e(\014le)i(is)g(in)g(data)f(mod\
+e)h(and)f(the)h(sp)q(eci\014ed)h(attribute)e(w)o(ould)h(expand.)37 1090 y fk
+(\017)30 b fm(The)17 b(sp)r(eci\014ed)i(op)q(en)e(netCDF)g(\014le)h(is)g(in)g
+(data)e(mo)q(de)i(and)f(the)g(sp)r(eci\014ed)h(attribute)f(do)r(es)g(not)g
+(already)90 1152 y(exist.)37 1228 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i
+(netCDF)d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0
+1541 y fl(ncattput:)24 b(C)14 b(In)n(terface)120 1679 y fi(int)23 b(ncattput\
+\(int)g(ncid,)g(int)g(varid,)g(const)h(char*)f(name,)g(nc_type)g(datatype,)
+430 1729 y(int)h(len,)f(const)g(void*)g(values\);)0 1867 y(ncid)144 b fm(NetC\
+DF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)
+h fi(nccreate)p fm(.)0 1944 y fi(varid)120 b fm(V)l(ariable)17 b(ID)e(of)g
+(the)g(v)n(ariable)h(to)f(whic)o(h)h(the)f(attribute)h(will)h(b)q(e)f(assigne\
+d)g(or)e fi(NC_GLOBAL)h fm(for)f(a)240 2006 y(global)i(attribute.)0 2082 y fi
+(name)144 b fm(A)o(ttribute)18 b(name.)29 b(Must)17 b(b)r(egin)h(with)h(an)f
+(alphab)r(etic)h(c)o(haracter,)e(follow)n(ed)i(b)o(y)f(zero)g(or)f(more)240
+2144 y(alphanumeric)g(c)o(haracters)f(including)j(the)d(underscore)h(\(`)p fi
+(_)p fm('\).)22 b(Case)16 b(is)h(signi\014can)q(t.)23 b(A)o(ttribute)240 2206
+y(name)12 b(con)o(v)o(en)o(tions)g(are)g(assumed)g(b)o(y)g(some)g(netCDF)f
+(generic)i(applications,)h(e.g.,)e fi(units)f fm(as)h(the)240 2269 y(name)g
+(for)f(a)h(string)g(attribute)g(that)f(giv)o(es)h(the)g(units)h(for)e(a)h(net\
+CDF)f(v)m(ariable.)20 b(See)13 b(Section)g(2.3.1)240 2331 y([A)n(ttribute)j
+(Con)n(v)o(en)o(tions],)f(page)g(20,)f(for)h(examples)h(of)e(attribute)h(con)
+o(v)o(en)o(tions.)0 2407 y fi(datatype)48 b fm(One)14 b(of)f(the)h(set)f(of)h
+(prede\014ned)h(netCDF)e(data)g(t)n(yp)r(es.)19 b(The)14 b(t)n(yp)r(e)f(of)h
+(this)g(parameter,)e fi(nc_type)p fm(,)240 2469 y(is)23 b(de\014ned)g(in)g
+(the)g(netCDF)e(header)i(\014le.)42 b(The)22 b(v)n(alid)h(netCDF)f(data)f(t)o
+(yp)q(es)h(are)g fi(NC_BYTE)p fm(,)240 2532 y fi(NC_CHAR)p fm(,)14 b fi(NC_SH\
+ORT)p fm(,)g fi(NC_LONG)p fm(,)f fi(NC_FLOAT)p fm(,)h(and)h fi(NC_DOUBLE)p fm
+(.)0 2608 y fi(len)168 b fm(Num)o(b)q(er)17 b(of)f(v)m(alues)h(pro)o(vided)g
+(for)f(the)h(attribute.)23 b(If)16 b(the)h(attribute)f(is)h(of)f(t)n(yp)r(e)g
+fi(NC_CHAR)p fm(,)g(this)240 2670 y(is)g(one)f(more)g(than)g(the)g(string)g
+(length)h(\(since)g(the)g(terminating)f(n)o(ull)i(c)o(haracter)d(is)i(stored\
+\).)p eop
+%%Page: 127 129
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(127)0 183 y fi(values)
+96 b fm(P)o(oin)o(ter)16 b(to)g(one)h(or)f(more)g(data)g(v)n(alues.)25 b(The)
+17 b(p)q(oin)o(ter)g(is)g(declared)h(to)e(b)q(e)h(of)f(the)h(t)n(yp)r(e)g fi
+(void)d(*)240 246 y fm(b)r(ecause)k(it)g(can)h(p)q(oint)e(to)h(data)f(of)h
+(an)o(y)g(of)f(the)i(basic)f(netCDF)g(t)n(yp)r(es.)28 b(The)19 b(data)e(shoul\
+d)i(b)r(e)240 308 y(of)c(the)h(appropriate)f(t)o(yp)q(e)h(for)e(the)i(netCDF)
+f(attribute.)20 b fg(W)m(arning:)h(neither)d(the)d(compiler)j(nor)240 370 y
+(the)d(netCDF)h(soft)n(w)o(are)f(can)h(detect)g(whether)g(the)f(wrong)g(t)o
+(yp)q(e)h(of)e(data)i(is)f(used.)62 582 y fm(Here)c(is)g(an)g(example)g(using)
+h fi(ncattput)d fm(to)h(add)h(a)g(v)m(ariable)h(attribute)e(named)h fi(valid_\
+range)e fm(for)h(a)h(netCDF)0 644 y(v)m(ariable)k(named)f fi(rh)f fm(and)g
+(a)g(global)i(attribute)e(named)h fi(title)e fm(to)h(an)h(existing)g(netCDF)f
+(\014le)h(named)g(`)p fi(foo.nc)p fm(':)120 781 y fi(#include)23 b("netcdf.h")
+192 831 y ff(:)7 b(:)g(:)120 881 y fi(int)47 b(ncid;)596 b(/*)24 b(netCDF)f
+(ID)g(*/)120 930 y(int)47 b(rh_id;)572 b(/*)24 b(variable)f(ID)g(*/)120 980 y
+(static)g(double)g(rh_range[])g(=)g({0.0,)g(100.0};)47 b(/*)24 b(attribute)e
+(vals)i(*/)120 1030 y(static)f(char)g(title[])g(=)h("example)f(netCDF)g(file"\
+;)192 1080 y ff(:)7 b(:)g(:)120 1130 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e
+(NC_WRITE\);)192 1180 y ff(:)7 b(:)g(:)120 1229 y fi(ncredef\(ncid\);)475 b
+(/*)24 b(enter)f(define)g(mode)g(*/)120 1279 y(rh_id)g(=)h(ncvarid)f(\(ncid,)
+g("rh"\);)192 1329 y ff(:)7 b(:)g(:)120 1379 y fi(ncattput)23 b(\(ncid,)g(rh_\
+id,)g("valid_range",)f(NC_DOUBLE,)g(2,)i(rh_range\);)120 1429 y(ncattput)f
+(\(ncid,)g(NC_GLOBAL,)f("title",)h(NC_CHAR,)g(strlen\(title\)+1,)359 1478 y
+(title\);)192 1528 y ff(:)7 b(:)g(:)120 1578 y fi(ncendef\(ncid\);)475 b(/*)
+24 b(leave)f(define)g(mode)g(*/)0 1861 y fl(NCAPT,)13 b(NCAPTC:)h(F)n(OR)-6 b
+(TRAN)14 b(In)n(terface)263 1998 y fi(SUBROUTINE)23 b(NCAPT)g(\(INTEGER)g(NCI\
+D,)g(INTEGER)g(VARID,)239 2047 y(+)430 b(CHARACTER*\(*\))22 b(ATTNAM,)h(INTEG\
+ER)g(ATTYPE,)239 2097 y(+)430 b(INTEGER)23 b(ATTLEN,)g(type)g(VALUE,)239 2147
+y(+)430 b(INTEGER)23 b(RCODE\))263 2247 y(SUBROUTINE)g(NCAPTC)g(\(INTEGER)f
+(NCID,)i(INTEGER)f(VARID,)239 2296 y(+)454 b(CHARACTER*\(*\))22 b(ATTNAM,)h
+(INTEGER)f(ATTYPE,)239 2346 y(+)454 b(INTEGER)22 b(LENSTR,)h(CHARACTER*\(*\))
+f(STRING,)239 2396 y(+)454 b(INTEGER)22 b(RCODE\))62 2608 y fm(There)17 b(are)
+e(t)o(w)n(o)h(F)n(OR)m(TRAN)h(subroutines,)f fi(NCAPT)g fm(and)g fi(NCAPTC)p
+fm(,)f(for)g(creating)h(attributes.)23 b(The)16 b(\014rst)f(is)0 2670 y(for)g
+(attributes)g(of)f(n)o(umeric)i(t)o(yp)q(e,)f(and)h(the)f(second)h(is)f(for)g
+(attributes)g(of)g(c)o(haracter-string)f(t)o(yp)q(e.)p eop
+%%Page: 128 130
+ bop 0 -58 a fm(128)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fi(NCID)144 b fm
+(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm
+(or)h fi(NCCRE)p fm(.)0 260 y fi(VARID)120 b fm(V)l(ariable)16 b(ID,)f(return\
+ed)h(from)e(a)h(previous)h(call)h(to)d fi(NCVDEF)g fm(or)h fi(NCVID)p fm(.)0
+336 y fi(ATTNAM)96 b fm(A)o(ttribute)18 b(name.)29 b(Must)17 b(b)r(egin)h(wit\
+h)h(an)f(alphab)r(etic)h(c)o(haracter,)e(follow)n(ed)i(b)o(y)f(zero)g(or)f
+(more)240 398 y(alphanumeric)g(c)o(haracters)f(including)j(the)d(underscore)h
+(\(`)p fi(_)p fm('\).)22 b(Case)16 b(is)h(signi\014can)q(t.)23 b(A)o(ttribute)
+240 461 y(name)c(con)o(v)o(en)o(tions)g(are)f(assumed)h(b)o(y)g(some)g(netCDF)
+f(generic)i(applications,)h(e.g.,)d fi(units)g fm(as)240 523 y(the)h(name)g
+(for)f(a)g(string)h(attribute)g(that)f(giv)o(es)h(the)g(units)g(for)f(a)h(net\
+CDF)f(v)m(ariable.)32 b(A)19 b(table)240 585 y(of)i(con)o(v)o(en)o(tional)i
+(attribute)e(names)h(is)h(presen)o(ted)f(in)h(the)e(earlier)i(c)o(hapter)f
+(on)g(the)g(netCDF)240 647 y(interface.)0 724 y fi(ATTYPE)96 b fm(One)20 b
+(of)e(the)h(set)g(of)g(prede\014ned)i(netCDF)d(data)g(t)o(yp)q(es.)32 b(The)
+19 b(v)m(alid)i(netCDF)d(data)g(t)o(yp)q(es)h(are)240 786 y fi(NCBYTE)p fm
+(,)14 b fi(NCCHAR)p fm(,)g fi(NCSHORT)p fm(,)g fi(NCLONG)p fm(,)g fi(NCFLOAT)
+p fm(,)g(and)h fi(NCDOUBLE)p fm(.)0 863 y fi(ATTLEN)96 b fm(In)16 b fi(NCAPT)
+p fm(,)e(the)h(n)o(um)o(b)r(er)g(of)f(n)o(umeric)j(v)m(alues)f(pro)n(vided)h
+(for)e(the)g(attribute.)0 939 y fi(VALUE)120 b fm(In)15 b fi(NCAPT)p fm(,)f
+(an)g(arra)n(y)h(of)f fi(ATTLEN)g fm(data)g(v)m(alues.)21 b(The)14 b(data)g
+(should)i(b)r(e)e(of)h(the)f(appropriate)h(t)n(yp)r(e)240 1001 y(for)j(the)g
+(netCDF)g(attribute.)30 b fg(W)l(arning:)e(neither)20 b(the)f(compiler)h(nor)
+f(the)g(netCDF)g(soft)n(w)n(are)240 1064 y(can)d(detect)f(if)h(the)f(wrong)g
+(t)o(yp)q(e)h(of)e(data)i(is)g(used.)0 1140 y fi(STRING)96 b fm(In)16 b fi
+(NCAPTC)p fm(,)e(the)h(c)o(haracter-string)g(v)m(alue)h(of)f(the)g(attribute.)
+0 1216 y fi(LENSTR)96 b fm(In)12 b fi(NCAPTC)p fm(,)f(the)h(total)f(declared)
+h(length)h(\(in)f(c)o(haracters\))e(of)h(the)h fi(STRING)f fm(parameter.)17 b
+(Note)12 b(that)240 1279 y(this)j(is)g(not)g(necessarily)h(the)f(same)f(as)g
+(the)h(v)n(alue)g(returned)g(b)o(y)g(the)g(F)n(OR)m(TRAN)g fi(LEN)f fm(functi\
+on,)240 1341 y(b)r(ecause)h(an)g(arra)n(y)g(argumen)o(t)g(ma)n(y)g(b)r(e)g
+(pro)o(vided.)0 1417 y fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b
+(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 1632 y(Here)h(is)g
+(an)f(example)i(using)f fi(NCAPT)e fm(to)h(add)h(a)f(v)m(ariable)i(attribute)
+e(named)h fi(valid_range)e fm(for)h(a)g(netCDF)0 1695 y(v)m(ariable)g(named)f
+fi(rh)f fm(and)g(a)g(global)i(attribute)e(named)h fi(title)e fm(to)h(an)h(exi\
+sting)g(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm(':)263 1833 y fi(INCLUDE)
+23 b('netcdf.inc')335 1883 y ff(:)7 b(:)g(:)263 1933 y fi(INTEGER)47 b(NCID,)
+23 b(RCODE)263 1983 y(INTEGER)47 b(RHID)357 b(!)24 b(variable)f(ID)263 2033 y
+(DOUBLE)g(RHRNGE\(2\))263 2083 y(DATA)g(RHRNGE)h(/0.0D0,)e(100.0D0/)335 2132 y
+ff(:)7 b(:)g(:)263 2182 y fi(NCID)23 b(=)h(NCOPN)f(\('foo.nc',)g(NCWRITE,)g
+(RCODE\))335 2232 y ff(:)7 b(:)g(:)263 2282 y fi(CALL)23 b(NCREDF)h(\(NCID,)f
+(RCODE\))118 b(!)24 b(enter)f(define)g(mode)263 2332 y(RHID)g(=)h(NCVID)f(\(N\
+CID,)g('rh',)h(RCODE\)!)f(get)g(ID)335 2381 y ff(:)7 b(:)g(:)263 2431 y fi
+(CALL)23 b(NCAPT)h(\(NCID,)f(RHID,)g('valid_range',)f(NCDOUBLE,)g(2,)239 2481
+y(+)287 b(RHRNGE,)22 b(RCODE\))263 2531 y(CALL)h(NCAPTC)h(\(NCID,)f(NCGLOBAL,)
+f('title',)h(NCCHAR,)g(19,)239 2581 y(+)287 b('example)22 b(netCDF)h(file',)g
+(RCODE\))335 2630 y ff(:)7 b(:)g(:)263 2680 y fi(CALL)23 b(NCENDF)h(\(NCID,)f
+(RCODE\))118 b(!)24 b(leave)f(define)g(mode)p eop
+%%Page: 129 131
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(129)0 183 y fl(8.2)33 b
+(Get)14 b(Information)i(ab)r(out)f(an)h(A)n(ttribute)62 322 y fm(The)k(functi\
+on)f fi(ncattinq)f fm(\(or)g fi(NCAINQ)h fm(for)f(F)n(OR)m(TRAN\))i(returns)e
+(information)i(ab)q(out)e(a)h(netCDF)f(at-)0 384 y(tribute,)g(given)g(its)g
+(v)m(ariable)h(ID)f(and)g(name.)27 b(The)18 b(information)g(returned)g(is)g
+(the)g(t)o(yp)q(e)g(and)g(length)h(of)e(the)0 447 y(attribute.)62 586 y(In)j
+(case)e(of)h(an)f(error,)h fi(ncattinq)e fm(returns)i(-1;)h fi(NCAINQ)e fm
+(returns)g(a)h(nonzero)g(v)m(alue)h(in)f fi(rcode)p fm(.)30 b(P)o(ossible)0
+648 y(causes)15 b(of)g(errors)g(include:)37 787 y fk(\017)30 b fm(The)15 b
+(v)n(ariable)h(ID)f(is)h(inv)m(alid)g(for)f(the)g(sp)r(eci\014ed)i(netCDF)d
+(\014le.)37 864 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(attribute)e(do)q
+(es)g(not)g(exist.)37 940 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)
+d(ID)i(do)q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1259 y
+fl(ncattinq:)24 b(C)15 b(In)n(terface)120 1398 y fi(int)23 b(ncattinq\(int)g
+(ncid,)g(int)g(varid,)g(const)h(char*)f(name,)430 1448 y(nc_type*)g(datatype,)
+g(int*)g(len\);)0 1587 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e
+(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1664 y fi
+(varid)120 b fm(V)l(ariable)16 b(ID)g(of)e(the)i(attribute's)e(v)n(ariable,)i
+(or)e fi(NC_GLOBAL)g fm(for)h(a)g(global)g(attribute.)0 1740 y fi(name)144 b
+fm(A)o(ttribute)15 b(name.)0 1817 y fi(datatype)48 b fm(Returned)16 b(attribu\
+te)f(t)n(yp)r(e,)g(one)g(of)f(the)i(set)e(of)h(prede\014ned)i(netCDF)d(data)g
+(t)o(yp)q(es.)20 b(The)15 b(t)o(yp)q(e)g(of)240 1879 y(this)f(parameter,)f fi
+(nc_type)p fm(,)g(is)h(de\014ned)h(in)g(the)f(netCDF)f(header)h(\014le.)20 b
+(The)14 b(v)n(alid)h(netCDF)e(data)240 1942 y(t)n(yp)r(es)18 b(are)g fi(NC_BY\
+TE)p fm(,)f fi(NC_CHAR)p fm(,)g fi(NC_SHORT)p fm(,)h fi(NC_LONG)p fm(,)f fi
+(NC_FLOAT)p fm(,)g(and)h fi(NC_DOUBLE)p fm(.)27 b(If)19 b(this)240 2004 y(par\
+ameter)14 b(is)i(giv)o(en)f(as)g(`)p fi(\(nc_type)f(*\))h(0)p fm(',)f(no)h
+(t)n(yp)r(e)g(will)i(b)q(e)e(returned)h(so)e(no)h(v)n(ariable)h(to)e(hold)240
+2066 y(the)h(t)o(yp)q(e)h(needs)g(to)e(b)r(e)h(declared.)0 2143 y fi(len)168 b
+fm(Returned)15 b(n)o(um)o(b)q(er)f(of)g(v)m(alues)h(curren)o(tly)g(stored)e
+(in)i(the)f(attribute.)20 b(If)14 b(the)g(attribute)g(is)g(of)g(t)n(yp)r(e)
+240 2205 y fi(NC_CHAR)p fm(,)g(this)i(is)g(one)g(more)f(than)g(the)g(string)h
+(length)g(\(since)g(the)g(terminating)g(n)o(ull)h(c)o(haracter)240 2268 y(is)
+h(stored\).)24 b(If)18 b(this)f(parameter)f(is)i(giv)o(en)f(as)g(`)p fi(\(int)
+d(*\))h(0)p fm(',)i(no)g(length)g(will)i(b)r(e)e(returned)g(so)g(no)240 2330 y
+(v)m(ariable)g(to)d(hold)i(this)g(information)f(needs)h(to)f(b)q(e)h(declared\
+.)62 2545 y(Here)d(is)g(an)f(example)h(using)g fi(ncattinq)e fm(to)g(\014nd)i
+(out)f(the)h(t)n(yp)q(e)g(and)f(length)h(of)f(a)g(v)m(ariable)i(attribute)e
+(named)0 2608 y fi(valid_range)i fm(for)h(a)h(netCDF)f(v)m(ariable)i(named)f
+fi(rh)f fm(and)h(a)f(global)h(attribute)g(named)g fi(title)f fm(in)h(an)g(exi\
+sting)0 2670 y(netCDF)f(\014le)h(named)f(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 130 132
+ bop 0 -58 a fm(130)1442 b(NetCDF)14 b(User's)h(Guide)120 183 y fi(#include)
+23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(int)47 b(ncid;)405 b
+(/*)24 b(netCDF)f(ID)h(*/)120 333 y(int)47 b(rh_id;)381 b(/*)24 b(variable)f
+(ID)g(*/)120 382 y(nc_type)g(vr_type,)g(t_type;)70 b(/*)24 b(attribute)f(type\
+s)g(*/)120 432 y(int)47 b(vr_len,)23 b(t_len;)190 b(/*)24 b(attribute)f(lengt\
+hs)f(*')192 532 y ff(:)7 b(:)g(:)120 582 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)
+e(NC_NOWRITE\);)192 632 y ff(:)7 b(:)g(:)120 681 y fi(rh_id)23 b(=)h(ncvarid)
+f(\(ncid,)g("rh"\);)192 731 y ff(:)7 b(:)g(:)120 781 y fi(ncattinq)23 b(\(nci\
+d,)g(rh_id,)g("valid_range",)f(&vr_type,)g(&vr_len\);)120 831 y(ncattinq)h
+(\(ncid,)g(NC_GLOBAL,)f("title",)h(&t_type,)g(&t_len\);)192 881 y ff(:)7 b
+(:)g(:)0 1261 y fl(NCAINQ:)13 b(F)n(OR)-6 b(TRAN)15 b(In)n(terface)263 1407 y
+fi(SUBROUTINE)23 b(NCAINQ)g(\(INTEGER)f(NCID,)i(INTEGER)f(VARID,)239 1457 y
+(+)454 b(CHARACTER*\(*\))22 b(ATTNAM,)h(INTEGER)f(ATTYPE,)239 1507 y(+)454 b
+(INTEGER)22 b(ATTLEN,INTEGER)g(RCODE\))0 1738 y(NCID)144 b fm(NetCDF)14 b(ID,)
+h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p
+fm(.)0 1822 y fi(VARID)120 b fm(V)l(ariable)16 b(ID)g(of)e(the)i(attribute's)
+e(v)n(ariable,)i(or)e fi(NCGLOBAL)g fm(for)h(a)g(global)h(attribute.)0 1906 y
+fi(ATTNAM)96 b fm(A)o(ttribute)15 b(name.)0 1991 y fi(ATTYPE)96 b fm(Returned)
+19 b(attribute)f(t)n(yp)r(e,)g(one)g(of)g(the)g(set)f(of)h(prede\014ned)h(net\
+CDF)f(data)f(t)n(yp)r(es.)28 b(The)18 b(v)n(alid)240 2053 y(netCDF)d(data)f
+(t)n(yp)r(es)h(are)g fi(NCBYTE)p fm(,)f fi(NCCHAR)p fm(,)g fi(NCSHORT)p fm
+(,)g fi(NCLONG)p fm(,)g fi(NCFLOAT)p fm(,)g(and)h fi(NCDOUBLE)p fm(.)0 2137 y
+fi(ATTLEN)96 b fm(Returned)19 b(n)o(um)o(b)q(er)f(of)g(v)m(alues)h(curren)o
+(tly)f(stored)g(in)g(the)g(attribute.)28 b(F)l(or)17 b(a)h(string-v)n(alued)g
+(at-)240 2199 y(tribute,)d(this)h(is)g(the)f(n)o(um)o(b)q(er)g(of)g(c)o(harac\
+ters)g(in)h(the)f(string.)0 2284 y fi(RCODE)120 b fm(Returned)16 b(error)f
+(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 2515 y
+(Here)f(is)h(an)f(example)g(using)h fi(NCAINQ)e fm(to)g(add)h(a)g(v)m(ariable)
+h(attribute)e(named)i fi(valid_range)d fm(for)h(a)h(netCDF)0 2577 y(v)m(ariab\
+le)h(named)f fi(rh)f fm(and)g(a)g(global)i(attribute)e(named)h fi(title)e fm
+(to)h(an)h(existing)g(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 131 133
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(131)263 183 y fi(INCLU\
+DE)23 b('netcdf.inc')335 233 y ff(:)7 b(:)g(:)263 283 y fi(INTEGER)47 b(NCID,)
+23 b(RCODE)263 333 y(INTEGER)47 b(RHID)357 b(!)24 b(variable)f(ID)263 382 y
+(INTEGER)47 b(VRTYPE,)23 b(TTYPE)142 b(!)24 b(attribute)f(types)263 432 y(INT\
+EGER)47 b(VRLEN,)23 b(TLEN)190 b(!)24 b(attribute)f(lengths)335 482 y ff(:)7 b
+(:)g(:)263 532 y fi(NCID)23 b(=)h(NCOPN)f(\('foo.nc',)g(NCNOWRIT,)g(RCODE\))
+335 582 y ff(:)7 b(:)g(:)263 632 y fi(RHID)23 b(=)h(NCVID)f(\(NCID,)g('rh',)h
+(RCODE\)!)f(get)g(ID)335 681 y ff(:)7 b(:)g(:)263 731 y fi(CALL)23 b(NCAINQ)h
+(\(NCID,)f(RHID,)g('valid_range',)f(VRTYPE,)h(VRLEN,)239 781 y(+)310 b(RCODE\
+\))263 831 y(CALL)23 b(NCAINQ)h(\(NCID,)f(NCGLOBAL,)f('title',)h(TTYPE,)g(TLE\
+N,)239 881 y(+)310 b(RCODE\))p eop
+%%Page: 132 134
+ bop 0 -58 a fm(132)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(8.3)33 b(Get)
+14 b(A)n(ttribute's)j(V)-6 b(alues)62 335 y fm(The)20 b(function)h fi(ncattge\
+t)e fm(\(or)g fi(NCAGT)g fm(or)g fi(NCAGTC)g fm(for)h(F)n(OR)m(TRAN\))g(gets)
+f(the)h(v)n(alue\(s\))g(of)f(a)h(netCDF)0 397 y(attribute,)15 b(giv)o(en)g
+(its)h(v)m(ariable)g(ID)g(and)f(name.)62 549 y(In)21 b(case)f(of)g(an)g(error\
+,)g fi(ncattget)f fm(returns)h(-1;)i fi(NCAGT)d fm(returns)h(a)g(nonzero)g
+(v)n(alue)g(in)h fi(rcode)p fm(.)34 b(P)o(ossible)0 611 y(causes)15 b(of)g
+(errors)g(include:)37 763 y fk(\017)30 b fm(The)15 b(v)n(ariable)h(ID)f(is)h
+(inv)m(alid)g(for)f(the)g(sp)r(eci\014ed)i(netCDF)d(\014le.)37 852 y fk(\017)
+30 b fm(The)15 b(sp)r(eci\014ed)i(attribute)e(do)q(es)g(not)g(exist.)37 941 y
+fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)
+g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1386 y fl(ncattget:)22 b(C)15 b(In)n
+(terface)120 1538 y fi(int)23 b(ncattget\(int)g(ncid,)g(int)g(varid,)g(const)
+h(char*)f(name,)g(void*)g(value\);)0 1689 y(ncid)144 b fm(NetCDF)14 b(ID,)h
+(returned)h(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)
+p fm(.)0 1779 y fi(varid)120 b fm(V)l(ariable)16 b(ID)g(of)e(the)i(attribute'\
+s)e(v)n(ariable,)i(or)e fi(NC_GLOBAL)g fm(for)h(a)g(global)g(attribute.)0 1868
+y fi(name)144 b fm(A)o(ttribute)15 b(name.)0 1957 y fi(value)120 b fm(Returne\
+d)16 b(attribute)f(v)n(alues.)21 b(All)16 b(elements)f(of)g(the)g(v)o(ector)g
+(of)g(attribute)g(v)m(alues)h(are)f(returned,)240 2020 y(so)h(y)o(ou)h(m)o
+(ust)f(allo)r(cate)h(enough)g(space)g(to)g(hold)g(them.)25 b(If)17 b(y)o(ou)g
+(don't)f(kno)o(w)g(ho)o(w)h(m)n(uch)g(space)240 2082 y(to)e(reserv)n(e,)g(cal\
+l)i fi(ncattinq)d fm(\014rst)g(to)h(\014nd)h(out)f(the)g(length)h(of)f(the)g
+(attribute.)62 2323 y(Here)23 b(is)g(an)g(example)g(using)g fi(ncattget)f fm
+(to)g(determine)h(the)g(v)n(alues)g(of)f(a)g(v)n(ariable)h(attribute)g(named)
+0 2385 y fi(valid_range)14 b fm(for)h(a)h(netCDF)f(v)m(ariable)i(named)f fi
+(rh)f fm(and)h(a)f(global)h(attribute)g(named)g fi(title)f fm(in)h(an)g(exist\
+ing)0 2447 y(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm('.)i(In)e(this)g
+(example,)g(it)f(is)h(assumed)g(that)e(w)o(e)h(don't)g(kno)o(w)g(ho)o(w)g(man)
+o(y)g(v)m(alues)0 2510 y(will)h(b)q(e)f(returned,)f(but)h(that)e(w)o(e)h(do)g
+(kno)o(w)g(the)g(t)n(yp)r(es)g(of)g(the)g(attributes.)20 b(Hence,)15 b(to)e
+(allo)r(cate)h(enough)h(space)0 2572 y(to)g(store)f(them,)h(w)n(e)h(m)n(ust)f
+(\014rst)g(inquire)i(ab)q(out)e(the)g(length)h(of)f(the)g(attributes.)p eop
+%%Page: 133 135
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(133)120 183 y fi(#incl\
+ude)23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(int)47 b(ncid;)405 b
+(/*)24 b(netCDF)f(ID)h(*/)120 333 y(int)47 b(rh_id;)381 b(/*)24 b(variable)f
+(ID)g(*/)120 382 y(nc_type)g(vr_type,)g(t_type;)70 b(/*)24 b(attribute)f(type\
+s)g(*/)120 432 y(int)47 b(vr_len,)23 b(t_len;)190 b(/*)24 b(attribute)f(lengt\
+hs)f(*/)120 482 y(double)h(*vr_val;)285 b(/*)24 b(ptr)f(to)h(attribute)f(valu\
+es)g(*/)120 532 y(char)g(*title;)357 b(/*)24 b(ptr)f(to)h(attribute)f(values)
+g(*/)120 582 y(extern)g(char)g(*malloc\(\);)118 b(/*)24 b(memory)f(allocator)
+g(*/)192 681 y ff(:)7 b(:)g(:)120 731 y fi(ncid)23 b(=)h(ncopen\("foo.nc",)e
+(NC_NOWRITE\);)192 781 y ff(:)7 b(:)g(:)120 831 y fi(rh_id)23 b(=)h(ncvarid)f
+(\(ncid,)g("rh"\);)192 881 y ff(:)7 b(:)g(:)120 930 y fi(/*)24 b(find)f(out)g
+(how)h(much)f(space)g(is)h(needed)f(for)g(attribute)g(values)g(*/)120 980 y
+(ncattinq)g(\(ncid,)g(rh_id,)g("valid_range",)f(&vr_type,)g(&vr_len\);)120
+1030 y(ncattinq)h(\(ncid,)g(NC_GLOBAL,)f("title",)h(&t_type,)g(&t_len\);)120
+1130 y(/*)h(allocate)e(required)h(space)g(before)g(retrieving)g(values)g(*/)
+120 1180 y(vr_val)g(=)h(\(double)f(*\))g(malloc\(vr_len)f(*)i(nctypelen\(vr_t\
+ype\)\);)120 1229 y(title)f(=)h(\(char)f(*\))h(malloc\(t_len)e(*)i(nctypelen\
+\(t_type\)\);)120 1329 y(/*)g(get)f(attribute)g(values)g(*/)120 1379 y(ncattg\
+et\(ncid,)f(rh_id,)h("valid_range",)f(\(void)h(*\)vr_val\);)120 1429 y(ncattg\
+et\(ncid,)f(NC_GLOBAL,)g("title",)h(\(void)g(*\)title\);)192 1478 y ff(:)7 b
+(:)g(:)0 1751 y fl(NCA)n(GT,)14 b(NCA)n(GTC:)f(F)n(OR)-6 b(TRAN)15 b(In)n(ter\
+face)263 1888 y fi(SUBROUTINE)23 b(NCAGT)g(\(INTEGER)g(NCID,)g(INTEGER)g(VARI\
+D,)239 1938 y(+)430 b(CHARACTER*\(*\))22 b(ATTNAM,)h(type)g(VALUES,)239 1988 y
+(+)430 b(INTEGER)23 b(RCODE\))263 2088 y(SUBROUTINE)g(NCAGTC)g(\(INTEGER)f
+(NCID,)i(INTEGER)f(VARID,)239 2137 y(+)430 b(CHARACTER*\(*\))22 b(ATTNAM,)h
+(CHARACTER*\(*\))f(STRING,)239 2187 y(+)430 b(INTEGER)23 b(LENSTR,)g(INTEGER)
+f(RCODE\))62 2399 y fm(There)16 b(are)f(t)n(w)o(o)g(F)n(OR)n(TRAN)g(subroutin\
+es,)h fi(NCAGT)f fm(and)h fi(NCAGTC)p fm(,)e(for)h(retrieving)h(attribute)f
+(v)n(alues.)21 b(The)0 2461 y(\014rst)15 b(is)h(for)e(attributes)h(of)g(n)o
+(umeric)h(t)n(yp)r(e,)f(and)g(the)h(second)f(is)h(for)f(attributes)f(of)h(c)o
+(haracter-string)g(t)n(yp)r(e.)0 2598 y fi(NCID)144 b fm(NetCDF)14 b(ID,)h
+(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm
+(.)0 2670 y fi(VARID)120 b fm(V)l(ariable)16 b(ID)g(of)e(the)i(attribute's)e
+(v)n(ariable,)i(or)e fi(NCGLOBAL)g fm(for)h(a)g(global)h(attribute.)p eop
+%%Page: 134 136
+ bop 0 -58 a fm(134)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fi(ATTNAM)96 b
+fm(A)o(ttribute)15 b(name.)0 441 y fi(VALUES)96 b fm(Returned)16 b(attribute)
+f(v)n(alues.)21 b(All)16 b(elements)f(of)g(the)g(v)o(ector)g(of)g(attribute)g
+(v)m(alues)h(are)f(returned,)240 503 y(so)e(y)o(ou)h(m)o(ust)f(pro)o(vide)i
+(enough)f(space)g(to)f(hold)i(them.)k(If)14 b(y)o(ou)g(don't)f(kno)o(w)g(ho)o
+(w)h(m)n(uc)o(h)g(space)h(to)240 565 y(reserv)o(e,)g(call)h fi(NCAINQ)e fm
+(\014rst)h(to)g(\014nd)h(out)e(the)i(length)g(of)e(the)i(attribute.)j fg(W)m
+(arning:)i(neither)c(the)240 627 y(compiler)g(nor)f(the)f(netCDF)h(soft)n(w)n
+(are)g(can)g(detect)f(if)h(the)f(wrong)g(t)o(yp)q(e)h(of)f(data)g(is)h(used.)
+0 885 y fi(STRING)96 b fm(In)16 b fi(NCAGTC)p fm(,)e(the)h(c)o(haracter-strin\
+g)g(v)m(alue)h(of)f(the)g(attribute.)0 1142 y fi(LENSTR)96 b fm(In)20 b fi
+(NCAGTC)p fm(,)e(the)h(total)g(declared)h(length)g(\(in)f(c)o(haracters\))f
+(of)h(the)g fi(STRING)f fm(parameter)g(in)i(the)240 1205 y(caller.)28 b(Note)
+17 b(that)g(this)h(is)g(not)f(necessarily)i(the)e(same)g(as)h(the)f(v)n(alue)
+h(returned)g(b)o(y)f(the)h(F)n(OR-)240 1267 y(TRAN)f fi(LEN)e fm(function,)i
+(b)q(ecause)g(an)f(arra)n(y)g(argumen)n(t)g(ma)o(y)g(b)q(e)g(pro)o(vided.)24 b
+fi(NCAGTC)15 b fm(will)j(c)o(hec)o(k)240 1329 y(to)d(mak)n(e)g(sure)h(the)f
+(requested)h(data)e(will)j(\014t)e(in)h fi(LENSTR)e fm(c)o(haracters.)0 1586 y
+fi(RCODE)120 b fm(Returned)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q
+(ccurred,)i(0)f(is)g(returned.)62 2164 y(Here)f(is)g(an)f(example)h(using)h fi
+(NCAGT)d fm(to)h(determine)h(the)g(v)m(alues)g(of)f(an)h(attribute)f(named)h
+fi(valid_range)e fm(for)0 2226 y(a)g(netCDF)g(v)n(ariable)h(named)g fi(rh)g fm
+(and)f(a)h(global)g(attribute)g(named)f fi(title)g fm(in)i(an)e(existing)i
+(netCDF)e(\014le)i(named)0 2288 y(`)p fi(foo.nc)p fm('.)27 b(In)19 b(this)f
+(example,)h(it)g(is)f(assumed)h(that)e(w)o(e)h(don't)f(kno)o(w)h(ho)o(w)g(man)
+n(y)g(v)n(alues)g(will)i(b)r(e)e(returned,)0 2350 y(so)e(w)o(e)g(\014rst)g
+(inquire)i(ab)q(out)e(the)h(length)g(of)f(the)g(attributes)g(to)g(mak)n(e)h
+(sure)g(w)n(e)g(ha)n(v)o(e)g(enough)f(space)h(to)f(store)0 2413 y(them:)p eop
+%%Page: 135 137
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(135)263 183 y fi(INCLU\
+DE)23 b('netcdf.inc')335 233 y ff(:)7 b(:)g(:)263 283 y fi(PARAMETER)23 b(\(M\
+VRLEN=3\))f(!)i(max)f(number)h(of)f("valid_range")f(values)263 333 y(PARAMETE\
+R)h(\(MTLEN=80\))f(!)i(max)f(length)h(of)f("title")g(attribute)263 382 y(INTE\
+GER)47 b(NCID,)23 b(RCODE)263 432 y(INTEGER)47 b(RHID)357 b(!)24 b(variable)f
+(ID)263 482 y(INTEGER)47 b(VRTYPE,)23 b(TTYPE)142 b(!)24 b(attribute)f(types)
+263 532 y(INTEGER)47 b(VRLEN,)23 b(TLEN)190 b(!)24 b(attribute)f(lengths)263
+582 y(DOUBLE)g(PRECISION)g(VRVAL\(MVRLEN\))f(!)i(vr)f(attribute)g(values)263
+632 y(CHARACTER*80)f(TITLE)238 b(!)24 b(title)f(attribute)g(values)335 681 y
+ff(:)7 b(:)g(:)263 731 y fi(NCID)23 b(=)h(NCOPN)f(\('foo.nc',)g(NCWRITE,)g
+(RCODE\))335 781 y ff(:)7 b(:)g(:)263 831 y fi(RHID)23 b(=)h(NCVID)f(\(NCID,)
+g('rh',)h(RCODE\))f(!)g(get)h(ID)335 881 y ff(:)7 b(:)g(:)120 930 y fi(*)24 b
+(find)f(out)g(attribute)g(lengths,)g(to)g(make)h(sure)f(we)h(have)f(enough)g
+(space)263 980 y(CALL)g(NCAINQ)h(\(NCID,)f(RHID,)g('valid_range',)f(VRTYPE,)h
+(VRLEN,)239 1030 y(+)310 b(RCODE\))263 1080 y(CALL)23 b(NCAINQ)h(\(NCID,)f
+(NCGLOBAL,)f('title',)h(TTYPE,)g(TLEN,)239 1130 y(+)310 b(RCODE\))120 1180 y
+(*)24 b(get)f(attribute)g(values,)g(if)g(not)h(too)f(big)263 1229 y(IF)h(\(VR\
+LEN)f(>)h(MVRLEN\))e(THEN)359 1279 y(WRITE)h(\(*,*\))g('valid_range)f(attribu\
+te)h(too)g(big!')359 1329 y(CALL)g(EXIT)263 1379 y(ELSE)359 1429 y(CALL)g(NCA\
+GT)g(\(NCID,)g(RHID,)g('valid_range',)f(VRVAL,)h(RCODE\))263 1478 y(ENDIF)263
+1528 y(IF)h(\(TLEN)f(>)h(MTLEN\))f(THEN)359 1578 y(WRITE)g(\(*,*\))g('title)g
+(attribute)g(too)g(big!')359 1628 y(CALL)g(EXIT)263 1678 y(ELSE)359 1727 y
+(CALL)g(NCAGTC)g(\(NCID,)g(NCGLOBAL,)g('title',)f(TITLE,)h(MTLEN,)h(RCODE\))
+263 1777 y(ENDIF)p eop
+%%Page: 136 138
+ bop 0 -58 a fm(136)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(8.4)33 b(Cop)
+n(y)15 b(A)n(ttribute)i(from)e(One)f(NetCDF)g(to)h(Another)62 321 y fm(The)f
+(function)g fi(ncattcopy)e fm(\(or)g fi(NCACPY)g fm(for)h(F)n(OR)m(TRAN\))h
+(copies)g(an)f(attribute)g(from)f(one)i(op)q(en)g(netCDF)0 383 y(\014le)k(to)
+f(another.)26 b(It)17 b(can)h(also)f(b)q(e)h(used)g(to)e(cop)o(y)i(an)f(attri\
+bute)g(from)g(one)g(v)n(ariable)h(to)e(another)h(within)i(the)0 446 y(same)c
+(netCDF.)62 583 y(In)j(case)g(of)f(an)g(error,)g fi(ncattcopy)f fm(returns)h
+(-1;)h fi(NCACPY)f fm(returns)g(a)g(nonzero)g(v)n(alue)h(in)g fi(rcode)p fm
+(.)26 b(P)o(ossible)0 646 y(causes)15 b(of)g(errors)g(include:)37 784 y fk
+(\017)30 b fm(The)15 b(input)i(or)d(output)h(v)n(ariable)h(ID)f(is)h(inv)m
+(alid)g(for)f(the)g(sp)r(eci\014ed)i(netCDF)d(\014le.)37 859 y fk(\017)30 b fm
+(The)15 b(sp)r(eci\014ed)i(attribute)e(do)q(es)g(not)g(exist.)37 935 y fk(\
+\017)30 b fm(The)14 b(output)g(netCDF)g(is)g(not)g(in)h(de\014ne)g(mo)q(de)g
+(and)f(the)g(attribute)g(is)h(new)g(for)e(the)h(output)g(\014le)h(is)g(larger)
+90 997 y(than)g(the)g(existing)i(attribute.)37 1073 y fk(\017)30 b fm(The)15 b
+(input)i(or)d(output)h(netCDF)g(ID)g(do)q(es)h(not)e(refer)h(to)g(an)g(op)q
+(en)h(netCDF)f(\014le.)0 1380 y fl(ncattcop)n(y:)23 b(C)15 b(In)n(terface)120
+1518 y fi(int)23 b(ncattcopy\(int)g(incdf,)g(int)g(invar,)g(const)g(char*)g
+(name,)h(int)f(outcdf,)g(int)g(outvar\);)0 1656 y(incdf)120 b fm(The)22 b(net\
+CDF)g(ID)g(of)f(an)h(input)h(netCDF)f(\014le)h(from)e(which)h(the)g(attribute)
+g(will)h(b)r(e)f(copied,)240 1718 y(returned)16 b(from)e(a)h(previous)h(call)
+g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 1794 y fi(invar)120 b fm(ID)
+15 b(of)f(the)h(v)m(ariable)h(in)f(the)g(input)h(netCDF)e(\014le)h(from)f(whi\
+ch)h(the)g(attribute)f(will)j(b)q(e)e(copied,)g(or)240 1856 y fi(NC_GLOBAL)f
+fm(for)g(a)h(global)h(attribute.)0 1932 y fi(name)144 b fm(Name)15 b(of)g(the)
+g(attribute)g(in)h(the)f(input)i(netCDF)d(\014le)i(to)f(b)q(e)h(copied.)0 2007
+y fi(outcdf)96 b fm(The)23 b(netCDF)f(ID)h(of)f(the)h(output)f(netCDF)g(\014l\
+e)i(to)e(whic)o(h)h(the)g(attribute)f(will)j(b)q(e)e(copied,)240 2070 y(retur\
+ned)18 b(from)f(a)g(previous)h(call)h(to)e fi(ncopen)f fm(or)h fi(nccreate)p
+fm(.)26 b(It)17 b(is)h(p)r(ermissible)h(for)e(the)h(input)240 2132 y(and)f
+(output)f(netCDF)f(IDs)i(to)e(b)r(e)h(the)h(same.)23 b(The)16 b(output)g(netC\
+DF)g(\014le)h(should)h(b)q(e)f(in)g(de\014ne)240 2194 y(mo)q(de)g(if)f(the)h
+(attribute)f(to)g(b)q(e)h(copied)g(do)q(es)g(not)f(already)g(exist)h(for)f
+(the)g(target)f(v)n(ariable,)i(or)e(if)240 2256 y(it)g(w)o(ould)h(cause)f(an)
+h(existing)g(target)e(attribute)h(to)f(gro)n(w.)0 2332 y fi(outvar)96 b fm
+(ID)16 b(of)g(the)g(v)n(ariable)h(in)g(the)f(output)g(netCDF)g(\014le)h(to)e
+(which)h(the)h(attribute)f(will)h(b)r(e)f(copied,)h(or)240 2394 y fi(NC_GLOBA\
+L)d fm(to)g(cop)o(y)i(to)e(a)h(global)h(attribute.)62 2608 y(Here)g(is)g(an)f
+(example)i(using)f fi(ncattcopy)e fm(to)h(cop)o(y)g(the)g(v)n(ariable)h(attri\
+bute)g fi(units)e fm(from)h(the)g(v)n(ariable)h fi(rh)0 2670 y fm(in)i(an)f
+(existing)h(netCDF)e(\014le)i(named)f(`)p fi(foo.nc)p fm(')e(to)i(the)g(v)m
+(ariable)h fi(avgrh)e fm(in)i(another)f(existing)h(netCDF)e(\014le)p eop
+%%Page: 137 139
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(137)0 183 y(named)17 b
+(`)p fi(bar.nc)p fm(',)e(assuming)i(that)f(the)h(v)n(ariable)h fi(avgrh)e fm
+(already)h(exists,)g(but)g(do)q(es)g(not)f(y)o(et)h(ha)n(v)o(e)g(a)g fi(units)
+0 246 y fm(attribute:)120 386 y fi(#include)23 b("netcdf.h")192 436 y ff(:)7 b
+(:)g(:)120 485 y fi(int)47 b(ncid1,)23 b(ncid2;)167 b(/*)23 b(netCDF)g(IDs)h
+(*/)120 535 y(int)47 b(rh_id,)23 b(avgrh_id;)142 b(/*)24 b(variable)f(IDs)g
+(*/)192 585 y ff(:)7 b(:)g(:)120 635 y fi(ncid1)23 b(=)h(ncopen\("foo.nc",)e
+(NC_NOWRITE\);)120 685 y(ncid2)h(=)h(ncopen\("bar.nc",)e(NC_WRITE\);)192 734 y
+ff(:)7 b(:)g(:)120 784 y fi(rh_id)23 b(=)h(ncvarid)f(\(ncid1,)g("rh"\);)120
+834 y(avgrh_id)g(=)g(ncvarid)g(\(ncid2,)g("avgrh"\);)192 884 y ff(:)7 b(:)g
+(:)120 934 y fi(ncredef\(ncid2\);)260 b(/*)24 b(enter)f(define)g(mode)h(*/)
+120 983 y(/*)g(copy)f(variable)g(attribute)f(from)i("rh")f(to)h("avgrh")e(*/)
+120 1033 y(ncattcopy\(ncid1,)g(rh_id,)h("units",)f(ncid2,)i(avgrh_id\);)192
+1083 y ff(:)7 b(:)g(:)120 1133 y fi(ncendef\(ncid2\);)260 b(/*)24 b(leave)f
+(define)g(mode)h(*/)0 1456 y fl(NCA)n(CPY:)13 b(F)n(OR)-6 b(TRAN)15 b(In)n
+(terface)263 1596 y fi(SUBROUTINE)23 b(NCACPY)g(\(INTEGER)f(INCDF,)i(INTEGER)
+e(INVAR,)239 1646 y(+)454 b(CHARACTER*\(*\))22 b(ATTNAM,)h(INTEGER)f(OUTCDF,)
+239 1695 y(+)454 b(INTEGER)22 b(OUTVAR,)h(INTEGER)g(RCODE\))0 1836 y(INCDF)
+120 b fm(The)22 b(netCDF)g(ID)g(of)f(an)h(input)h(netCDF)f(\014le)h(from)e
+(which)h(the)g(attribute)g(will)h(b)r(e)f(copied,)240 1898 y(returned)16 b
+(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 1976 y
+fi(INVAR)120 b fm(ID)15 b(of)f(the)h(v)m(ariable)h(in)f(the)g(input)h(netCDF)
+e(\014le)h(from)f(which)h(the)g(attribute)f(will)j(b)q(e)e(copied,)g(or)240
+2038 y fi(NCGLOBAL)f fm(for)h(a)g(global)g(attribute.)0 2116 y fi(ATTNAM)96 b
+fm(Name)15 b(of)g(the)g(attribute)g(in)h(the)f(input)i(netCDF)d(\014le)i(to)f
+(b)q(e)h(copied.)0 2194 y fi(OUTCDF)96 b fm(The)23 b(netCDF)f(ID)h(of)f(the)h
+(output)f(netCDF)g(\014le)i(to)e(whic)o(h)h(the)g(attribute)f(will)j(b)q(e)e
+(copied,)240 2256 y(returned)18 b(from)f(a)h(previous)g(call)h(to)e fi(NCOPN)
+g fm(or)h fi(NCCRE)p fm(.)26 b(It)18 b(is)h(p)q(ermissible)h(for)d(the)h(inpu\
+t)h(and)240 2319 y(output)14 b(netCDF)f(IDs)i(to)e(b)r(e)h(the)g(same.)19 b
+(The)c(output)f(netCDF)f(\014le)i(should)h(b)q(e)e(in)h(de\014ne)h(mo)q(de)
+240 2381 y(if)d(the)g(attribute)g(to)g(b)q(e)g(copied)h(do)r(es)f(not)f(alrea\
+dy)i(exist)f(for)f(the)h(target)f(v)n(ariable,)h(or)g(if)g(it)h(w)n(ould)240
+2443 y(cause)h(an)h(existing)g(target)e(attribute)h(to)f(gro)n(w.)0 2521 y fi
+(OUTVAR)96 b fm(ID)16 b(of)g(the)g(v)n(ariable)h(in)g(the)f(output)g(netCDF)g
+(\014le)h(to)e(which)h(the)h(attribute)f(will)h(b)r(e)f(copied,)h(or)240 2583
+y fi(NCGLOBAL)d fm(to)h(cop)o(y)g(to)f(a)h(global)h(attribute.)p eop
+%%Page: 138 140
+ bop 0 -58 a fm(138)1442 b(NetCDF)14 b(User's)h(Guide)62 183 y(Here)e(is)h
+(an)e(example)i(using)f fi(NCACPY)f fm(to)h(cop)n(y)g(the)g(v)m(ariable)h(att\
+ribute)f fi(units)f fm(from)g(the)h(v)m(ariable)h fi(rh)e fm(in)i(an)0 246 y
+(existing)i(netCDF)e(\014le)i(named)f(`)p fi(foo.nc)p fm(')f(to)g(the)h(v)m
+(ariable)h fi(avgrh)e fm(in)i(another)f(existing)h(netCDF)e(\014le)i(named)0
+308 y(`)p fi(bar.nc)p fm(',)11 b(assuming)j(that)e(the)h(v)m(ariable)h fi(avg\
+rh)e fm(already)i(exists,)f(but)g(do)q(es)g(not)g(y)n(et)g(ha)o(v)o(e)g(a)f fi
+(units)g fm(attribute:)263 445 y fi(INCLUDE)23 b('netcdf.inc')335 495 y ff
+(:)7 b(:)g(:)263 544 y fi(INTEGER)47 b(NCID1,)23 b(NCID2)119 b(!)23 b(netCDF)
+g(IDs)263 594 y(INTEGER)47 b(RHID,)23 b(AVRHID)166 b(!)24 b(variable)f(IDs)
+335 644 y ff(:)7 b(:)g(:)263 694 y fi(NCID1)23 b(=)h(NCOPN)f(\('foo.nc',)g
+(NCNOWRIT,)f(RCODE\))263 744 y(NCID2)h(=)h(NCOPN)f(\('bar.nc',)g(NCWRITE,)g
+(RCODE\))335 793 y ff(:)7 b(:)g(:)263 843 y fi(RHID)23 b(=)h(NCVID)f(\(NCID1,)
+g('rh',)g(RCODE\))263 893 y(AVRHID)g(=)h(NCVID)f(\(NCID2,)g('avgrh',)g(RCODE\
+\))335 943 y ff(:)7 b(:)g(:)263 993 y fi(CALL)23 b(NCREDF)h(\(NCID2,)e(RCODE\
+\))47 b(!)24 b(enter)f(define)g(mode)120 1043 y(*)h(copy)f(variable)g(attribu\
+te)f(from)i("rh")f(to)h("avgrh")263 1092 y(CALL)f(NCACPY)h(\(NCID1,)e(RHID,)i
+('units',)e(NCID2,)h(AVRHID,)g(RCODE\))335 1142 y ff(:)7 b(:)g(:)263 1192 y fi
+(CALL)23 b(NCENDF)h(\(NCID2,)e(RCODE\))47 b(!)24 b(leave)f(define)g(mode)p eop
+%%Page: 139 141
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(139)0 183 y fl(8.5)33 b
+(Get)14 b(Name)h(of)f(A)n(ttribute)j(from)e(Its)g(Num)n(b)r(er)62 320 y fm
+(The)k(function)g fi(ncattname)e fm(\(or)h fi(NCANAM)f fm(for)h(F)n(OR)m(TRAN\
+\))h(gets)e(the)i(name)f(of)g(an)g(attribute,)h(giv)o(en)g(its)0 382 y(v)m
+(ariable)d(ID)e(and)g(n)o(um)o(b)r(er.)19 b(This)c(function)g(is)g(useful)g
+(in)g(generic)h(applications)g(that)d(need)i(to)f(get)g(the)g(names)0 445 y
+(of)i(all)h(the)g(attributes)f(associated)h(with)g(a)f(v)m(ariable,)h(since)h
+(attributes)e(are)g(accessed)h(b)o(y)f(name)g(rather)g(than)0 507 y(n)o(um)o
+(b)q(er)d(in)g(all)g(other)f(attribute)g(functions.)20 b(The)13 b(n)o(um)n
+(b)r(er)f(of)g(an)g(attribute)h(is)g(more)e(v)o(olatile)j(than)e(the)g(name,)
+0 569 y(since)i(it)f(can)g(c)o(hange)g(when)g(other)g(attributes)g(of)f(the)h
+(same)g(v)m(ariable)h(are)e(deleted.)21 b(This)13 b(is)h(wh)n(y)f(an)g(attrib\
+ute)0 632 y(n)o(um)o(b)q(er)j(is)f(not)g(called)i(an)e(attribute)g(ID.)62 769
+y(In)j(case)g(of)f(an)g(error,)g fi(ncattname)f fm(returns)h(-1;)h fi(NCANAM)
+f fm(returns)g(a)g(nonzero)g(v)n(alue)h(in)g fi(rcode)p fm(.)26 b(P)o(ossible)
+0 831 y(causes)15 b(of)g(errors)g(include:)37 968 y fk(\017)30 b fm(The)15 b
+(sp)r(eci\014ed)i(v)m(ariable)f(ID)g(is)f(not)g(v)n(alid.)37 1038 y fk(\017)
+30 b fm(The)16 b(sp)q(eci\014ed)i(attribute)e(n)o(um)o(b)q(er)g(is)g(negativ)
+o(e)g(or)f(more)h(than)f(the)h(n)o(um)o(b)r(er)f(of)h(attributes)f(de\014ned)
+j(for)90 1101 y(the)d(sp)r(eci\014ed)i(v)m(ariable.)37 1171 y fk(\017)30 b fm
+(The)15 b(sp)r(eci\014ed)i(attribute)e(do)q(es)g(not)g(exist.)37 1242 y fk
+(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g
+(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1524 y fl(ncattname:)22 b(C)15 b(In)n
+(terface)120 1661 y fi(int)23 b(ncattname)g(\(int)g(ncid,)h(int)f(varid,)g
+(int)h(attnum,)e(char*)i(name\);)0 1873 y(ncid)144 b fm(NetCDF)14 b(ID,)h(ret\
+urned)h(from)e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm
+(.)0 1944 y fi(varid)120 b fm(ID)15 b(of)g(the)g(attribute's)g(v)m(ariable,)h
+(or)f fi(NC_GLOBAL)f fm(for)g(a)h(global)h(attribute.)0 2014 y fi(attnum)96 b
+fm(Num)o(b)q(er)18 b(of)f(the)h(attribute.)27 b(The)18 b(attributes)f(for)g
+(eac)o(h)g(v)n(ariable)h(are)g(n)o(um)o(b)q(ered)g(from)f(0)g(\(the)240 2076 y
+(\014rst)c(attribute\))g(to)f fi(nvatts-1)p fm(,)g(where)i fi(nvatts)e fm(is)
+i(the)f(n)o(um)o(b)r(er)g(of)g(attributes)g(for)g(the)g(v)m(ariable,)240 2139
+y(as)i(returned)g(from)g(a)g(call)h(to)f fi(ncvarinq)p fm(.)0 2209 y fi(name)
+144 b fm(Returned)17 b(attribute)f(name.)22 b(The)16 b(caller)h(m)o(ust)f(all\
+o)r(cate)f(space)i(for)e(the)h(returned)h(name.)22 b(The)240 2271 y(maxim)o
+(um)12 b(p)q(ossible)h(length,)g(in)f(c)o(haracters,)f(of)g(an)h(attribute)f
+(name)h(is)g(giv)o(en)g(b)o(y)g(the)f(prede\014ned)240 2334 y(constan)o(t)i fi
+(MAX_NC_NAME)p fm(.)18 b(If)c(the)g(name)f(parameter)g(is)i(giv)o(en)f(as)f fi
+(\(char)i(*\))g(0)p fm(,)e(no)h(name)g(will)h(b)r(e)240 2396 y(returned)h(and)
+f(no)g(space)h(needs)g(to)e(b)r(e)h(allo)r(cated.)62 2608 y(Here)f(is)g(an)g
+(example)h(using)f fi(ncattname)e fm(to)h(determine)i(the)f(name)g(of)f(the)h
+(\014rst)f(attribute)h(of)f(the)h(v)m(ariable)0 2670 y fi(rh)h fm(in)h(an)f
+(existing)h(netCDF)f(\014le)h(named)f(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 140 142
+ bop 0 -58 a fm(140)1442 b(NetCDF)14 b(User's)h(Guide)120 183 y fi(#include)
+23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(int)47 b(ncid;)191 b
+(/*)23 b(netCDF)g(ID)h(*/)120 333 y(int)47 b(rh_id;)167 b(/*)23 b(variable)g
+(ID)g(*/)120 382 y(char)g(attname[MAX_NC_NAME];)45 b(/*)24 b(maximum-size)e
+(attribute)h(name)g(*/)192 432 y ff(:)7 b(:)g(:)120 482 y fi(ncid)23 b(=)h
+(ncopen\("foo.nc",)e(NC_NOWRITE\);)192 532 y ff(:)7 b(:)g(:)120 582 y fi(rh_i\
+d)23 b(=)h(ncvarid)f(\(ncid,)g("rh"\);)192 632 y ff(:)7 b(:)g(:)120 681 y fi
+(/*)24 b(get)f(name)g(of)h(first)f(attribute)g(\(number)g(0\))g(*/)120 731 y
+(ncattname\(ncid,)f(rh_id,)h(0,)g(attname\);)0 1216 y fl(NCANAM:)13 b(F)n(OR)
+-6 b(TRAN)15 b(In)n(terface)263 1373 y fi(SUBROUTINE)23 b(NCANAM)g(\(INTEGER)
+f(NCID,)i(INTEGER)f(VARID,)239 1422 y(+)454 b(INTEGER)22 b(ATTNUM,)h(CHARACTE\
+R*\(*\))f(ATTNAM,)239 1472 y(+)454 b(INTEGER)22 b(RCODE\))0 1629 y(NCID)144 b
+fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)g(to)f fi(NCOPN)f
+fm(or)h fi(NCCRE)p fm(.)0 1723 y fi(VARID)120 b fm(ID)15 b(of)g(the)g(attribu\
+te's)g(v)m(ariable,)h(or)f fi(NCGLOBAL)f fm(for)g(a)h(global)h(attribute.)0
+1817 y fi(ATTNUM)96 b fm(Num)o(b)q(er)18 b(of)f(the)h(attribute.)27 b(The)18 b
+(attributes)f(for)g(eac)o(h)g(v)n(ariable)h(are)g(n)o(um)o(b)q(ered)g(from)f
+(1)g(\(the)240 1879 y(\014rst)g(attribute\))f(to)g fi(NVATTS)p fm(,)g(where)i
+fi(NVATTS)e fm(is)h(the)g(n)o(um)o(b)r(er)f(of)h(attributes)g(for)f(the)h(v)m
+(ariable,)240 1941 y(as)e(returned)g(from)g(a)g(call)h(to)f fi(NCVINQ)p fm
+(.)0 2036 y fi(ATTNAM)96 b fm(Returned)17 b(attribute)f(name.)22 b(The)16 b
+(caller)h(m)o(ust)f(allo)r(cate)f(space)i(for)e(the)h(returned)h(name.)22 b
+(The)240 2098 y(maxim)o(um)12 b(p)q(ossible)h(length,)g(in)f(c)o(haracters,)f
+(of)g(an)h(attribute)f(name)h(is)g(giv)o(en)g(b)o(y)g(the)f(prede\014ned)240
+2160 y(constan)o(t)j fi(MAXNCNAM)p fm(.)0 2254 y fi(RCODE)120 b fm(Returned)
+16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returne\
+d.)62 2505 y(Here)g(is)g(an)f(example)i(using)f fi(NCANAM)e fm(determine)j
+(the)e(name)h(of)f(the)g(\014rst)g(attribute)h(of)f(the)g(v)n(ariable)h fi
+(rh)f fm(in)0 2567 y(an)h(existing)h(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)
+p fm(':)p eop
+%%Page: 141 143
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(141)263 183 y fi(INCLU\
+DE)23 b('netcdf.inc')335 233 y ff(:)7 b(:)g(:)263 283 y fi(INTEGER)47 b(NCID)
+119 b(!)23 b(netCDF)g(ID)263 333 y(INTEGER)47 b(RHID)143 b(!)23 b(variable)g
+(ID)120 382 y(*)h(31)f(in)h(the)f(following)g(should)g(be)h(MAXNCNAM)263 432 y
+(CHARACTER*31)e(ATTNAM)335 482 y ff(:)7 b(:)g(:)263 532 y fi(NCID)23 b(=)h
+(NCOPN)f(\('foo.nc',)g(NCNOWRIT,)g(RCODE\))335 582 y ff(:)7 b(:)g(:)263 632 y
+fi(RHID)23 b(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\))335 681 y ff(:)7 b(:)g(:)
+120 731 y fi(*)24 b(get)f(name)g(of)h(first)f(attribute)g(\(number)g(1\))263
+781 y(CALL)g(NCANAM)h(\(NCID,)f(RHID,)g(1,)g(ATTNAM,)g(RCODE\))p eop
+%%Page: 142 144
+ bop 0 -58 a fm(142)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(8.6)33 b(Ren\
+ame)14 b(an)i(A)n(ttribute)62 332 y fm(The)j(function)h fi(ncattrename)d fm
+(\(or)h fi(NCAREN)g fm(for)g(F)o(OR)m(TRAN\))h(c)o(hanges)f(the)h(name)g(of)f
+(an)h(attribute.)31 b(If)0 394 y(the)16 b(new)g(name)g(is)g(longer)g(than)g
+(the)g(original)h(name,)f(the)f(netCDF)h(m)n(ust)g(b)q(e)g(in)h(de\014ne)g
+(mo)q(de.)22 b(Y)l(ou)16 b(cannot)0 456 y(rename)f(an)g(attribute)g(to)g(ha)o
+(v)n(e)h(the)f(same)g(name)g(as)g(another)g(attribute)g(of)g(the)g(same)g(v)m
+(ariable.)62 605 y(In)g(case)g(of)f(an)h(error,)e fi(ncattrename)g fm(returns)
+i(-1;)f fi(NCAREN)g fm(returns)g(a)g(nonzero)h(v)m(alue)h(in)f fi(rcode)p fm
+(.)k(P)o(ossible)0 667 y(causes)c(of)g(errors)g(include:)37 815 y fk(\017)30 b
+fm(The)15 b(sp)r(eci\014ed)i(v)m(ariable)f(ID)g(is)f(not)g(v)n(alid.)37 902 y
+fk(\017)30 b fm(The)15 b(new)h(attribute)f(name)g(is)h(already)f(in)h(use)g
+(for)e(another)h(attribute)g(of)g(the)g(sp)r(eci\014ed)i(v)m(ariable.)37 988 y
+fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(\014le)j(is)e(in)h(data)f
+(mo)q(de)g(and)h(the)f(new)g(name)h(is)f(longer)h(than)f(the)g(old)h(name.)37
+1074 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(attribute)e(do)q(es)g(not)g
+(exist.)37 1160 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)
+q(es)f(not)g(refer)g(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1574 y fl(ncattre\
+name:)23 b(C)14 b(In)n(terface)120 1722 y fi(int)23 b(ncattrename)g(\(int)g
+(ncid,)g(int)h(varid,)f(const)g(char*)g(name,)g(const)h(char*)f(newname\);)0
+1957 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)e(a)h(previous)h(call)
+g(to)f fi(ncopen)f fm(or)h fi(nccreate)0 2043 y(varid)120 b fm(ID)15 b(of)g
+(the)g(attribute's)g(v)m(ariable,)h(or)f fi(NC_GLOBAL)f fm(for)g(a)h(global)h
+(attribute)0 2130 y fi(name)144 b fm(The)15 b(original)i(attribute)e(name.)0
+2216 y fi(newname)72 b fm(The)13 b(new)g(name)g(to)g(b)q(e)h(assigned)f(to)f
+(the)i(sp)q(eci\014ed)h(attribute.)k(If)13 b(the)g(new)g(name)g(is)h(longer)f
+(than)240 2278 y(the)i(old)h(name,)f(the)g(netCDF)g(\014le)h(m)o(ust)f(b)q
+(e)g(in)h(de\014ne)h(mo)q(de.)62 2513 y(Here)g(is)h(an)e(example)i(using)g fi
+(ncattrename)d fm(to)h(rename)h(the)g(v)m(ariable)h(attribute)f fi(units)f fm
+(to)g fi(Units)g fm(for)g(a)0 2575 y(v)m(ariable)h fi(rh)d fm(in)i(an)g(exist\
+ing)g(netCDF)e(\014le)j(named)e(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 143 145
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(143)120 183 y fi(#incl\
+ude)23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(int)47 b(ncid;)191 b
+(/*)23 b(netCDF)g(ID)h(*/)120 333 y(int)47 b(rh_id;)167 b(/*)23 b(variable)g
+(id)g(*/)192 382 y ff(:)7 b(:)g(:)120 432 y fi(ncid)23 b(=)h(ncopen\("foo.nc"\
+,)e(NC_NOWRITE\);)192 482 y ff(:)7 b(:)g(:)120 532 y fi(rh_id)23 b(=)h(ncvari\
+d)f(\(ncid,)g("rh"\);)192 582 y ff(:)7 b(:)g(:)120 632 y fi(/*)24 b(rename)f
+(attribute)f(*/)120 681 y(ncattrename\(ncid,)g(rh_id,)h("units",)f("Units"\);)
+0 959 y fl(NCAREN:)14 b(F)n(OR)-6 b(TRAN)15 b(In)n(terface)263 1096 y fi(SUBR\
+OUTINE)23 b(NCAREN)g(\(INTEGER)f(NCID,)i(INTEGER)f(VARID,)239 1145 y(+)454 b
+(CHARACTER*\(*\))22 b(ATTNAM,)239 1195 y(+)454 b(CHARACTER*\(*\))22 b(NEWNAM,)
+h(INTEGER)f(RCODE\))0 1332 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)
+e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)0 1404 y(VARID)120 b
+fm(ID)15 b(of)g(the)g(attribute's)g(v)m(ariable,)h(or)f fi(NCGLOBAL)f fm(for)
+g(a)h(global)h(attribute)0 1475 y fi(ATTNAM)96 b fm(The)15 b(original)i(attri\
+bute)e(name.)0 1546 y fi(NEWNAM)96 b fm(The)13 b(new)g(name)g(to)g(b)q(e)h
+(assigned)f(to)f(the)i(sp)q(eci\014ed)h(attribute.)k(If)13 b(the)g(new)g(name)
+g(is)h(longer)f(than)240 1609 y(the)i(old)h(name,)f(the)g(netCDF)g(\014le)h
+(m)o(ust)f(b)q(e)g(in)h(de\014ne)h(mo)q(de.)0 1680 y fi(RCODE)120 b fm(Return\
+ed)16 b(error)f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(retu\
+rned.)62 1892 y(Here)f(is)g(an)g(example)g(using)g fi(NCAREN)f fm(to)g(rename)
+g(the)h(v)m(ariable)h(attribute)e fi(units)g fm(to)g fi(Units)f fm(for)h(a)h
+(v)m(ariable)0 1954 y fi(rh)h fm(in)h(an)f(existing)h(netCDF)f(\014le)h(named)
+f(`)p fi(foo.nc)p fm(':)263 2091 y fi(INCLUDE)23 b("netcdf.inc")335 2141 y ff
+(:)7 b(:)g(:)263 2190 y fi(INTEGER)47 b(NCID)119 b(!)23 b(netCDF)g(ID)263 2240
+y(INTEGER)47 b(RHID)143 b(!)23 b(variable)g(ID)335 2290 y ff(:)7 b(:)g(:)263
+2340 y fi(NCID)23 b(=)h(NCOPN)f(\("foo.nc",)g(NCNOWRIT,)g(RCODE\))335 2390 y
+ff(:)7 b(:)g(:)263 2440 y fi(RHID)23 b(=)h(NCVID)f(\(NCID,)g("rh",)h(RCODE\))
+335 2489 y ff(:)7 b(:)g(:)120 2539 y fi(*)24 b(rename)f(attribute)263 2589 y
+(CALL)g(NCAREN)h(\(NCID,)f(RHID,)g("units",)g("Units",)f(RCODE\))p eop
+%%Page: 144 146
+ bop 0 -58 a fm(144)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(8.7)33 b(Del\
+ete)14 b(an)h(A)n(ttribute)62 344 y fm(The)j(function)g fi(ncattdel)e fm(\(or)
+h fi(NCADEL)f fm(for)h(F)o(OR)m(TRAN\))g(deletes)h(a)f(netCDF)g(attribute)g
+(from)g(an)g(op)r(en)0 406 y(netCDF)e(\014le.)20 b(The)c(netCDF)e(\014le)j
+(m)n(ust)e(b)r(e)g(in)h(de\014ne)g(mo)q(de.)62 567 y(In)k(case)e(of)h(an)f
+(error,)h fi(ncattdel)e fm(returns)i(-1;)h fi(NCADEL)e fm(returns)g(a)h(nonze\
+ro)g(v)m(alue)h(in)f fi(rcode)p fm(.)30 b(P)o(ossible)0 629 y(causes)15 b(of)
+g(errors)g(include:)37 790 y fk(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(v)m
+(ariable)f(ID)g(is)f(not)g(v)n(alid.)37 889 y fk(\017)30 b fm(The)15 b(sp)r
+(eci\014ed)i(netCDF)d(\014le)j(is)e(in)h(data)f(mo)q(de.)37 987 y fk(\017)30 b
+fm(The)15 b(sp)r(eci\014ed)i(attribute)e(do)q(es)g(not)g(exist.)37 1086 y fk
+(\017)30 b fm(The)15 b(sp)r(eci\014ed)i(netCDF)d(ID)i(do)q(es)f(not)g(refer)g
+(to)g(an)g(op)q(en)g(netCDF)g(\014le.)0 1623 y fl(ncattdel:)23 b(C)15 b(In)n
+(terface)120 1784 y fi(int)23 b(ncattdel)g(\(int)h(ncid,)f(int)g(varid,)g(con\
+st)g(char*)h(name\);)0 2044 y(ncid)144 b fm(NetCDF)14 b(ID,)h(returned)h(from)
+e(a)h(previous)h(call)g(to)f fi(ncopen)f fm(or)h fi(nccreate)p fm(.)0 2142 y
+fi(varid)120 b fm(ID)15 b(of)g(the)g(attribute's)g(v)m(ariable,)h(or)f fi(NC_\
+GLOBAL)f fm(for)g(a)h(global)h(attribute.)0 2241 y fi(name)144 b fm(The)15 b
+(name)h(of)e(the)i(attribute)f(to)f(b)r(e)h(deleted.)62 2500 y(Here)i(is)h
+(an)f(example)g(using)h fi(ncattdel)e fm(to)g(delete)i(the)f(v)n(ariable)g
+(attribute)g fi(Units)f fm(for)h(a)f(v)n(ariable)i fi(rh)e fm(in)0 2563 y(an)
+f(existing)h(netCDF)f(\014le)h(named)g(`)p fi(foo.nc)p fm(':)p eop
+%%Page: 145 147
+ bop 0 -58 a fm(Chapter)15 b(8:)k(A)o(ttributes)1445 b(145)120 183 y fi(#incl\
+ude)23 b("netcdf.h")192 233 y ff(:)7 b(:)g(:)120 283 y fi(int)47 b(ncid;)191 b
+(/*)23 b(netCDF)g(ID)h(*/)120 333 y(int)47 b(rh_id;)167 b(/*)23 b(variable)g
+(ID)g(*/)192 382 y ff(:)7 b(:)g(:)120 432 y fi(ncid)23 b(=)h(ncopen\("foo.nc"\
+,)e(NC_WRITE\);)192 482 y ff(:)7 b(:)g(:)120 532 y fi(rh_id)23 b(=)h(ncvarid)
+f(\(ncid,)g("rh"\);)192 582 y ff(:)7 b(:)g(:)120 632 y fi(/*)24 b(delete)f
+(attribute)f(*/)120 681 y(ncredef\(ncid\);)428 b(/*)23 b(enter)g(define)g(mod\
+e)h(*/)120 731 y(ncattdel\(ncid,)e(rh_id,)h("Units"\);)120 781 y(ncendef\(nci\
+d\);)428 b(/*)23 b(leave)g(define)g(mode)h(*/)0 1101 y fl(NCADEL:)14 b(F)n
+(OR)-6 b(TRAN)15 b(In)n(terface)263 1240 y fi(SUBROUTINE)23 b(NCADEL)g(\(INTE\
+GER)f(NCID,)i(INTEGER)f(VARID,)239 1290 y(+)454 b(CHARACTER*\(*\))22 b(ATTNAM\
+,)h(INTEGER)f(RCODE\))0 1430 y(NCID)144 b fm(NetCDF)14 b(ID,)h(returned)h(fro\
+m)e(a)h(previous)h(call)g(to)f fi(NCOPN)f fm(or)h fi(NCCRE)p fm(.)0 1508 y fi
+(VARID)120 b fm(ID)15 b(of)g(the)g(attribute's)g(v)m(ariable,)h(or)f fi(NCGLO\
+BAL)f fm(for)g(a)h(global)h(attribute.)0 1585 y fi(ATTNAM)96 b fm(The)15 b
+(original)i(attribute)e(name.)0 1663 y fi(RCODE)120 b fm(Returned)16 b(error)
+f(co)q(de.)20 b(If)c(no)f(errors)f(o)q(ccurred,)i(0)f(is)g(returned.)62 1880 y
+(Here)h(is)h(an)f(example)g(using)h fi(NCADEL)e fm(to)g(delete)i(the)f(v)n
+(ariable)h(attribute)e fi(Units)h fm(for)f(a)g(v)n(ariable)i fi(rh)e fm(in)i
+(an)0 1943 y(existing)f(netCDF)f(\014le)h(named)f(`)p fi(foo.nc)p fm(':)263
+2083 y fi(INCLUDE)23 b('netcdf.inc')335 2132 y ff(:)7 b(:)g(:)263 2182 y fi
+(INTEGER)47 b(NCID)119 b(!)23 b(netCDF)g(ID)263 2232 y(INTEGER)47 b(RHID)143 b
+(!)23 b(variable)g(ID)335 2282 y ff(:)7 b(:)g(:)263 2332 y fi(NCID)23 b(=)h
+(NCOPN)f(\('foo.nc',)g(NCWRITE,)g(RCODE\))335 2381 y ff(:)7 b(:)g(:)263 2431 y
+fi(RHID)23 b(=)h(NCVID)f(\(NCID,)g('rh',)h(RCODE\))335 2481 y ff(:)7 b(:)g
+(:)120 2531 y fi(*)24 b(delete)f(attribute)263 2581 y(CALL)g(NCREDF)h(\(NCID,)
+f(RCODE\))46 b(!)24 b(enter)f(define)g(mode)263 2630 y(CALL)g(NCADEL)h(\(NCID\
+,)f(RHID,)g('Units',)g(RCODE\))263 2680 y(CALL)g(NCENDF)h(\(NCID,)f(RCODE\))
+46 b(!)24 b(leave)f(define)g(mode)p eop
+%%Page: 146 148
+ bop 0 -58 a fm(146)1442 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 147 149
+ bop 0 -58 a fm(Chapter)15 b(9:)k(NetCDF)c(File)h(Structure)f(and)h(P)n(erfor\
+mance)836 b(147)0 183 y fj(9)41 b(NetCDF)15 b(File)f(Structure)h(and)g(P)m
+(erformance)62 391 y fm(NetCDF)20 b(is)g(a)g(data)g(abstraction)f(for)h(scien\
+ti\014c)h(data)e(access)i(and)f(a)g(soft)n(w)n(are)g(library)h(that)e(pro)o
+(vides)0 453 y(a)g(concrete)g(implemen)q(tation)g(of)g(the)g(interfaces)f(tha\
+t)h(supp)r(ort)f(that)h(abstraction.)31 b(The)20 b(implementation)0 515 y(pro)
+o(vides)c(a)f(mac)o(hine-indep)t(endent)g(format)f(for)h(represen)o(ting)h
+(scienti\014c)g(data.)k(Although)c(the)f(netCDF)g(\014le)0 578 y(format)g(is)
+i(completely)h(hidden)h(b)q(elo)o(w)e(the)f(interfaces,)g(some)g(understandin\
+g)i(of)e(the)h(implemen)q(tation)f(and)0 640 y(asso)q(ciated)f(\014le)i(struc\
+ture)e(ma)n(y)g(help)i(to)d(mak)n(e)i(clear)f(which)g(netCDF)g(op)q(erations)
+g(are)g(exp)r(ensive)g(and)g(wh)o(y)l(.)62 781 y(A)g(detailed)i(description)f
+(of)e(the)h(netCDF)f fh(format)h fm(is)g(not)g(appropriate)g(for)f(this)h(Use\
+r's)g(Guide,)g(ho)o(w)n(ev)o(er.)0 843 y(It)g(is)g(not)f(needed)j(to)d(read)g
+(and)h(write)g(netCDF)f(\014les)i(or)e(understand)h(e\016ciency)i(issues.)j
+(Programs)14 b(that)g(use)0 906 y(only)f(the)f(do)r(cumen)o(ted)h(in)o(terfac\
+es)f(and)h(that)e(mak)o(e)h(no)g(other)g(assumptions)h(ab)q(out)f(the)g(forma\
+t)f(will)j(con)o(tinue)0 968 y(to)f(w)o(ork)g(ev)o(en)h(if)g(the)g(netCDF)f
+(format)g(is)h(c)o(hanged)g(in)h(the)f(future,)g(b)q(ecause)g(an)o(y)g(suc)o
+(h)g(c)o(hange)g(will)h(b)r(e)f(made)0 1030 y(b)r(elo)o(w)h(the)g(do)q(cument\
+ed)g(interfaces)g(and)g(will)i(supp)r(ort)d(earlier)i(v)o(ersions)g(of)e(netC\
+DF)h(data.)62 1171 y(This)f(c)o(hapter)g(describ)r(es)g(the)f(structure)g(of)
+g(a)g(netCDF)g(\014le)i(and)e(some)g(c)o(haracteristics)h(of)f(the)h(XDR)f
+(la)o(y)o(er)0 1234 y(that)h(pro)o(vides)i(net)o(w)o(ork)e(transparency)h(in)
+h(enough)g(detail)g(to)f(understand)g(netCDF)g(p)q(erformance)g(issues.)0 1495
+y fl(9.1)33 b(P)n(arts)15 b(of)f(a)h(NetCDF)f(File)62 1636 y fm(A)i(netCDF)e
+(data)h(set)g(is)g(stored)g(as)g(a)g(single)h(\014le)g(comprising)h(three)e
+(parts:)37 1777 y fk(\017)30 b fm(a)13 b fh(header)p fm(,)h(con)o(taining)h
+(all)f(the)g(information)g(ab)q(out)f(dimensions,)i(attributes,)f(and)g(v)m
+(ariables)g(except)h(for)90 1840 y(the)g(v)n(ariable)h(data;)37 1919 y fk(\
+\017)30 b fh(\014xed-size)17 b(data)p fm(,)d(con)o(taining)h(the)g(data)g(for)
+f(v)m(ariables)i(that)e(don't)h(ha)n(v)o(e)g(an)g(unlimited)i(dimension;)g
+(and)37 1997 y fk(\017)30 b fh(record)15 b(data)p fm(,)f(con)o(taining)i(the)
+g(data)e(records)h(for)g(v)m(ariables)h(that)f(ha)n(v)o(e)h(an)f(unlimited)i
+(dimension.)62 2218 y(All)g(the)e(data)g(are)f(represented)h(in)h(XDR)g(form)
+e(to)h(mak)n(e)g(them)g(mac)o(hine-indep)t(endent.)62 2359 y(The)h(descriptiv\
+e)g(header)g(at)e(the)i(b)q(eginning)h(of)e(the)h(netCDF)e(\014le)j(is)f(an)f
+(XDR)h(enco)q(ding)h(of)e(a)g(high-level)0 2421 y(data)h(structure)h(that)g
+(represen)o(ts)g(information)g(ab)q(out)g(the)g(dimensions,)h(v)n(ariables,)g
+(and)f(attributes)g(in)h(the)0 2483 y(\014le.)i(The)14 b(v)m(ariable)g(descri\
+ptions)h(in)f(this)g(header)f(con)o(tain)h(o\013sets)f(to)g(the)g(b)q(eginnin\
+g)i(of)e(eac)o(h)g(v)n(ariable's)h(data)0 2545 y(or)f(the)h(relativ)o(e)g(o\
+\013set)g(of)g(a)f(v)m(ariable)i(within)g(a)f(record.)19 b(The)14 b(descripti\
+ons)h(also)f(con)o(tain)g(the)g(dimension)h(size)0 2608 y(and)f(information)g
+(needed)h(to)e(determine)i(ho)n(w)f(to)f(map)g(m)o(ultidimensional)k(indices)
+f(for)d(eac)o(h)h(v)m(ariable)h(to)e(the)0 2670 y(appropriate)i(o\013sets.)p
+eop
+%%Page: 148 150
+ bop 0 -58 a fm(148)1442 b(NetCDF)14 b(User's)h(Guide)62 183 y(This)i(header)
+g(has)f(no)h(usable)g(extra)f(space;)h(it)f(is)h(only)g(as)f(large)h(as)f(it)
+g(needs)i(to)d(b)r(e)h(for)g(the)h(dimensions,)0 246 y(v)m(ariables,)12 b(and)
+f(attributes)f(in)h(eac)o(h)f(netCDF)g(\014le.)19 b(This)11 b(has)f(the)h(adv)
+m(an)o(tage)e(that)h(netCDF)f(\014les)j(are)e(compact,)0 308 y(requiring)21 b
+(v)o(ery)e(little)i(o)o(v)o(erhead)f(to)f(store)g(the)g(ancillary)j(data)d
+(that)g(mak)n(es)h(the)f(\014les)i(self-describing.)36 b(A)0 370 y(p)r(oten)n
+(tial)19 b(disadv)o(an)n(tage)f(of)h(this)g(organization)g(is)g(that)f(an)o
+(y)g(op)r(eration)g(on)h(a)f(netCDF)g(\014le)i(that)e(requires)0 432 y(expand\
+ing)c(the)g(header,)f(for)g(example)h(adding)g(a)f(set)g(of)g(new)g(dimension\
+s)i(and)e(new)h(v)m(ariables)g(to)f(an)g(existing)0 495 y(netCDF)i(\014le,)i
+(will)g(b)r(e)f(as)f(exp)r(ensive)g(as)h(cop)o(ying)g(the)g(\014le.)23 b(This)
+16 b(exp)r(ense)g(is)g(incurred)i(when)e fi(ncendef\(\))e fm(is)0 557 y(calle\
+d,)k(after)d(a)h(call)h(to)f fi(ncredef\(\))p fm(.)22 b(If)16 b(y)o(ou)g(crea\
+te)g(all)h(necessary)g(dimensions,)g(v)n(ariables,)g(and)f(attributes)0 619 y
+fh(b)r(efore)g fm(writing)f(v)m(ariable)h(data,)d(and)i(a)n(v)o(oid)g(later)f
+(additions)i(and)e(renamings)h(of)f(netCDF)f(comp)r(onen)o(ts)h(that)0 681 y
+(require)h(more)g(space)f(in)i(the)f(header)g(part)f(of)g(the)g(\014le,)i(y)o
+(ou)e(a)o(v)n(oid)h(the)g(cost)f(asso)q(ciated)h(with)g(expanding)h(the)0 744
+y(header.)62 881 y(The)f(\014xed-size)h(data)e(part)g(that)f(follows)h(the)g
+(header)h(con)o(tains)g(all)g(the)g(v)m(ariable)g(data)f(for)g(v)m(ariables)i
+(that)0 943 y(do)e(not)g(employ)g(the)h(unlimited)i(\(record\))c(dimension.)
+22 b(The)14 b(data)g(for)g(eac)o(h)g(v)n(ariable)h(is)g(stored)f(con)o(tiguou\
+sly)0 1006 y(in)i(this)g(part)e(of)h(the)g(\014le.)21 b(If)16 b(there)f(is)h
+(no)f(unlimited)i(dimension,)g(this)f(is)f(the)h(last)f(part)f(of)h(the)g(net\
+CDF)g(\014le.)62 1143 y(The)j(record-data)e(part)h(that)f(follows)h(the)g(\
+\014xed-size)i(data)e(consists)g(of)g(a)g(v)m(ariable)h(n)o(um)o(b)r(er)f(of)
+f(records,)0 1206 y(eac)o(h)e(of)g(whic)o(h)h(con)o(tains)f(data)f(for)h(all)
+h(the)f(record)g(v)n(ariables.)20 b(The)14 b(record)g(data)g(for)f(eac)o(h)h
+(v)n(ariable)h(is)f(stored)0 1268 y(con)o(tiguously)i(in)g(eac)o(h)f(record.)
+62 1405 y(The)h(order)f(in)i(which)e(the)h(data)f(in)h(the)g(\014xed-size)h
+(data)e(part)g(and)h(in)h(eac)n(h)f(record)g(app)q(ears)f(is)i(the)e(same)0
+1468 y(as)f(the)g(order)g(in)h(which)f(the)h(v)m(ariables)g(w)o(ere)f(de\014n\
+ed,)i(in)f(increasing)g(n)o(umerical)h(order)e(b)o(y)g(netCDF)g(v)m(ariable)0
+1530 y(ID.)e(This)i(kno)n(wledge)g(can)f(sometimes)f(b)r(e)g(used)i(to)e(enha\
+nce)h(data)f(access)h(p)r(erformance,)f(since)i(the)f(b)q(est)g(data)0 1592 y
+(access)i(is)h(curren)o(tly)g(ac)n(hieved)g(b)o(y)f(reading)h(or)e(writing)i
+(the)f(data)g(in)h(sequen)o(tial)g(order.)0 1821 y fl(9.2)33 b(The)15 b(XDR)f
+(La)n(y)n(er)62 1959 y fm(XDR)g(is)g(a)f(standard)h(for)f(describing)i(and)f
+(enco)q(ding)h(data)e(and)g(a)h(library)g(of)f(functions)i(for)e(external)h
+(data)0 2021 y(represen)o(tation,)21 b(allowing)f(programmers)f(to)h(enco)q
+(de)h(data)f(structures)g(in)h(a)e(mac)o(hine-indep)t(endent)h(w)o(a)n(y)l
+(.)0 2084 y(NetCDF)13 b(emplo)o(ys)h(XDR)g(for)f(represen)o(ting)h(all)h(data\
+,)e(in)h(b)r(oth)f(the)h(header)g(part)f(and)h(the)g(data)f(parts.)19 b(XDR)0
+2146 y(is)e(used)g(to)f(write)h(p)r(ortable)f(data)g(that)g(can)h(b)q(e)g(rea\
+d)g(on)f(an)o(y)g(other)h(mac)n(hine)h(for)e(which)h(the)f(XDR)h(library)0
+2208 y(has)e(b)r(een)g(implemen)q(ted.)62 2346 y(Man)o(y)20 b(v)o(endors)g
+(pro)o(vide)h(an)g(XDR)f(library)h(along)g(with)g(other)f(C)g(run-time)h(libr\
+aries.)37 b(The)21 b(netCDF)0 2408 y(soft)n(w)o(are)13 b(distribution)j(also)
+e(includes)j(Sun's)d(p)q(ortable)h(implementation)f(of)g(XDR)g(for)f(platform\
+s)h(that)f(don't)0 2470 y(already)i(ha)o(v)o(e)g(a)g(v)o(endor-supplied)j(XDR)
+d(library)m(.)62 2608 y(An)d(I/O)g(la)o(y)o(er)f(implemen)q(ted)g(m)o(uc)o
+(h)h(like)f(the)h(C)f(standard)g(I/O)h(\(stdio\))f(library)h(is)g(used)h(b)o
+(y)e(the)g(XDR)h(la)o(y)o(er)0 2670 y(to)g(read)g(and)h(write)g(XDR-enco)r
+(ded)g(data)f(to)g(netCDF)f(\014les.)20 b(Hence)14 b(an)e(understanding)i(of)
+e(the)g(standard)h(I/O)p eop
+%%Page: 149 151
+ bop 0 -58 a fm(Chapter)15 b(9:)k(NetCDF)c(File)h(Structure)f(and)h(P)n(erfor\
+mance)836 b(149)0 183 y(library)19 b(pro)n(vides)g(answ)n(ers)f(to)f(most)g
+(questions)h(ab)r(out)f(m)o(ultiple)j(pro)q(cesses)e(accessing)g(data)f(concu\
+rrently)l(,)0 246 y(the)k(use)g(of)g(I/O)g(bu\013ers,)i(and)f(the)f(costs)f
+(of)h(op)q(ening)h(and)f(closing)h(netCDF)f(\014les.)38 b(In)21 b(particular,)
+i(it)e(is)0 308 y(p)r(ossible)d(to)e(ha)o(v)n(e)h(one)g(pro)q(cess)g(writing)
+h(a)e(netCDF)g(\014le)i(while)h(other)d(pro)q(cesses)h(read)g(it.)25 b(Data)
+16 b(reads)h(and)0 370 y(writes)e(are)g(no)g(more)f(atomic)h(than)g(calls)h
+(to)e(stdio)h fi(fread\(\))f fm(and)h fi(fwrite\(\))p fm(.)k(An)c fi(ncsync\(\
+\))f fm(call)i(\()p fi(NCSNC\(\))0 432 y fm(for)g(F)o(OR)m(TRAN\))h(is)g(anal\
+ogous)f(to)h(the)g fi(fflush\(\))e fm(call)j(in)g(the)f(standard)f(I/O)h(libr\
+ary)n(,)f(writing)i(un)o(written)0 495 y(bu\013ered)e(data)d(so)h(other)g(pro)
+q(cesses)h(can)f(read)h(it;)f fi(ncsync\(\))f fm(also)h(brings)h(header)g(c)o
+(hanges)f(up-to-date)h(\(e.g.,)0 557 y(c)o(hanges)g(to)g(attribute)g(v)m(alue\
+s\).)62 701 y(As)20 b(in)h(the)f(stdio)h(library)m(,)g(\015ushes)f(are)g(also)
+g(p)r(erformed)g(when)g(\\seeks")g(o)q(ccur)g(to)g(a)g(di\013erent)g(area)f
+(of)0 764 y(the)c(\014le.)21 b(Hence)16 b(the)g(order)f(of)f(read)i(and)f(wri\
+te)g(op)r(erations)g(can)g(in\015uence)i(I/O)f(p)r(erformance)f(signi\014cant\
+ly)l(.)0 826 y(Reading)20 b(data)d(in)j(the)e(same)g(order)g(in)i(whic)o(h)f
+(it)g(w)n(as)f(written)h(within)g(eac)o(h)g(record)f(will)i(minimize)h(bu\013\
+er)0 888 y(\015ushes.)62 1033 y(There)f(is)g(one)g(un)o(usual)g(case)g(where)
+f(the)h(situation)g(is)g(more)f(complex:)29 b(when)20 b(a)f(writer)h(en)o(ter\
+s)f(de\014ne)0 1095 y(mo)q(de)e(to)f(add)h(some)g(additional)h(dimensions,)h
+(v)m(ariables,)f(or)e(attributes)h(to)f(an)h(existing)h(netCDF)e(\014le)i(tha\
+t)0 1157 y(is)c(also)g(op)q(en)h(for)e(reading)h(b)o(y)g(other)g(pro)q(cesses\
+.)20 b(In)14 b(this)g(case,)g(when)g(the)g(writer)g(lea)o(v)o(es)g(de\014ne)h
+(mo)q(de,)f(a)g(new)0 1220 y(cop)o(y)i(of)g(the)h(\014le)g(is)g(created)g(wit\
+h)f(the)h(new)f(dimensions,)i(attributes,)e(or)g(v)n(ariables)h(and)g(the)f
+(old)h(data,)f(but)0 1282 y(readers)g(that)f(still)i(ha)n(v)o(e)f(the)g(\014l\
+e)g(op)r(en)g(will)h(not)e(see)h(the)g(c)o(hanges.)21 b(Y)m(ou)15 b(should)i
+(not)e(exp)r(ect)h(netCDF)f(data)0 1344 y(access)g(to)g(w)n(ork)g(with)h(m)n
+(ultiple)i(writers)d(ha)n(ving)h(the)f(same)g(\014le)i(op)q(en)e(for)g(writin\
+g)h(sim)o(ultaneously)m(.)62 1489 y(F)l(or)k(VMS)h(systems,)g(the)f(p)r(erfor\
+mance)g(p)q(enalty)g(for)g(p)q(ermitting)h(shared)g(access)g(\(under)f(the)h
+(curren)o(t)0 1551 y(implemen)q(tation)e(of)f(stdio)i(in)g(the)g(C)f(run-time)
+h(library\))f(seemed)h(to)q(o)f(great)f(to)h(mak)o(e)g(shared)g(access)h(the)
+0 1613 y(default,)c(so)f(netCDF)g(\014les)i(on)f(VMS)g(are)f(op)q(ened)i(non-\
+shared.)22 b(This)16 b(still)h(p)r(ermits)f(m)n(ultiple)i(sim)o(ultaneous)0
+1676 y(readers)d(of)f(the)h(same)g(\014le,)h(but)f(one)g(writer)g(prev)o(en)o
+(ts)f(an)o(y)h(readers)g(from)f(accessing)i(the)f(\014le.)20 b(Implemen)q(tor\
+s)0 1738 y(can)g(easily)g(allow)f(shared)h(access)g(for)f(a)g(VMS)h(implement\
+ation,)g(if)g(shared)g(access)g(is)g(a)f(more)g(imp)r(ortan)n(t)0 1800 y(requ\
+irement)c(than)g(access)g(sp)r(eed.)62 1945 y(It)k(is)g(p)q(ossible)h(to)e
+(tune)h(an)f(implemen)q(tation)g(of)g(netCDF)g(for)g(some)g(platforms)g(b)o
+(y)h(replacing)h(the)f(I/O)0 2007 y(la)o(y)o(er)d(b)r(eneath)h(XDR)g(with)g
+(a)f(di\013eren)q(t)g(platform-sp)q(eci\014c)i(I/O)f(la)o(y)o(er.)24 b(This)
+17 b(ma)o(y)f(c)o(hange)h(the)g(similarities)0 2069 y(b)r(et)n(w)o(een)h(netC\
+DF)g(and)g(standard)g(I/O,)g(and)g(hence)h(c)o(haracteristics)g(related)f(to)
+g(data)f(sharing,)i(bu\013ering,)0 2132 y(and)c(the)h(cost)e(of)h(I/O)h(op)q
+(erations.)62 2276 y(The)h(cost)e(of)h(using)h(a)f(canonical)i(represen)o(tat\
+ion)e(for)f(data)h(like)g(XDR)h(v)m(aries)g(according)f(to)g(the)g(t)o(yp)q
+(e)g(of)0 2339 y(data)g(and)g(whether)g(the)h(XDR)f(form)g(is)g(the)h(same)e
+(as)h(the)h(mac)n(hine's)g(nativ)o(e)f(form)g(for)g(that)f(t)n(yp)r(e.)23 b
+(XDR)16 b(is)0 2401 y(esp)r(ecially)h(e\016cient)e(for)f(b)o(yte,)h(c)o(harac\
+ter,)f(and)h(short)g(integer)f(data.)62 2545 y(F)l(or)k(some)g(data)f(t)o(yp)
+q(es)i(on)f(some)g(mac)n(hines,)i(the)f(time)f(required)h(to)f(con)o(v)o(ert)
+g(data)f(to)h(and)g(from)g(XDR)0 2608 y(form)i(can)h(b)q(e)g(signi\014can)q
+(t.)36 b(The)21 b(b)r(est)f(case)h(is)g(b)o(yte)g(arra)n(ys,)g(for)f(which)h
+(v)o(ery)g(little)h(con)o(v)n(ersion)g(exp)q(ense)0 2670 y(o)q(ccurs,)13 b
+(since)i(the)e(XDR)g(library)h(has)f(built-in)j(supp)r(ort)c(for)g(them.)19 b
+(The)14 b(netCDF)e(implemen)q(tation)h(includes)p eop
+%%Page: 150 152
+ bop 0 -58 a fm(150)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y(similar)j(supp)
+r(ort)f(added)h(to)e(XDR)i(for)f(arra)m(ys)h(of)e(short)h(\(16-bit\))g(in)o
+(tegers.)26 b(The)18 b(w)n(orst)f(case)g(is)h(reading)f(or)0 246 y(writing)c
+(large)f(arra)n(ys)h(of)f(\015oating-p)q(oint)g(data)g(on)g(a)g(mac)o(hine)h
+(that)f(do)q(es)h(not)f(use)h(IEEE)g(\015oating-p)q(oint)f(as)g(its)0 308 y
+(nativ)o(e)h(represen)o(tation.)19 b(The)13 b(XDR)g(library)h(incurs)f(the)g
+(exp)r(ense)g(of)f(a)h(function)g(call)h(for)e(eac)o(h)h(\015oating-p)r(oin)o
+(t)0 370 y(quan)o(tit)o(y)j(accessed.)23 b(On)16 b(some)g(arc)o(hitectures)g
+(the)g(cost)g(of)g(a)f(function)i(inv)o(o)q(cation)f(for)f(eac)o(h)h(\015oati\
+ng-p)r(oin)o(t)0 432 y(n)o(um)o(b)q(er)g(can)f(dominate)g(the)h(cost)e(of)h
+(netCDF)g(access)g(to)g(\015oating-p)q(oint)f(\014elds.)62 569 y(The)j(distri\
+buted)g(netCDF)f(implementation)g(is)h(mean)n(t)f(to)g(b)q(e)g(p)r(ortable.)
+23 b(Platform-speci\014c)18 b(p)q(orts)e(that)0 632 y(further)j(optimize)i
+(the)e(implemen)q(tation)g(for)f(b)r(etter)h(I/O)g(p)r(erformance)g(or)f(that)
+h(unroll)i(the)e(lo)r(ops)g(in)h(the)0 694 y(XDR)f(library)h(to)e(optimize)j
+(XDR)e(con)o(v)n(ersion)h(of)e(long)i(in)o(teger)f(and)g(\015oating-p)r(oin)o
+(t)g(arra)n(ys)f(are)h(practical)0 756 y(and)c(desirable)i(in)f(cases)f(where)
+h(higher)g(p)q(erformance)f(for)g(data)f(access)i(is)f(necessary)m(.)p eop
+%%Page: 151 153
+ bop 0 -58 a fm(Chapter)15 b(10:)k(Higher-Level)d(netCDF)f(Op)r(erations)965 b
+(151)0 183 y fj(10)41 b(Higher-Lev)m(el)14 b(netCDF)i(Op)q(erations)62 422 y
+fm(One)i(of)f(the)h(primary)f(reasons)g(for)g(using)h(the)g(netCDF)f(in)o(ter\
+face)g(for)g(b)r(oth)g(scienti\014c)h(data)f(and)g(appli-)0 484 y(cations)g
+(that)g(deal)h(with)g(scienti\014c)g(data)e(is)i(to)f(tak)n(e)g(adv)n(an)o
+(tage)f(of)h(higher-lev)q(el)h(netCDF)e(op)r(erations)h(and)0 546 y(generic)k
+(applications)h(for)d(pro)q(cessing)i(netCDF)e(\014les.)36 b(NetCDF)19 b fh
+(op)q(erators)i fm(read)f(one)g(or)g(more)g(netCDF)0 609 y(input)e(\014les)g
+(and)g(write)f(a)g(netCDF)f(output)h(\014le.)27 b(NetCDF)16 b fh(utilities)21
+b fm(read)d(one)f(or)f(more)h(netCDF)g(\014les)h(and)0 671 y(pro)q(duce)f(som\
+e)e(other)h(kind)h(of)e(output)h(\(e.g.)21 b(a)16 b(text)f(\014le)i(or)e(grap\
+hics\),)h(or)g(read)f(some)h(other)g(kind)g(of)g(input)0 733 y(\(e.g.)i(a)13 b
+(text)g(\014le\))g(and)h(write)f(netCDF)f(\014les.)20 b(Curren)o(tly)13 b(t)o
+(w)n(o)g(netCDF)f(utilities)k(are)c(a)o(v)m(ailable)j(as)e(part)f(of)h(the)0
+795 y(netCDF)f(soft)n(w)o(are)h(distribution:)20 b fi(ncgen)12 b fm(and)h fi
+(ncdump)p fm(.)19 b(A)13 b(preliminary)h(set)f(of)g(example)h(netCDF)e(op)q
+(erators)0 858 y(is)k(a)n(v)n(ailable)h(as)d(a)h(separate)g(pac)o(k)m(age.)62
+1005 y(This)h(c)o(hapter)e(describ)s(es)h(the)f fi(ncgen)g fm(and)h fi(ncdump)
+f fm(utilities.)22 b(These)15 b(t)o(w)n(o)g(tools)g(con)o(v)o(ert)f(b)r(et)n
+(w)o(een)h(binary)0 1067 y(netCDF)h(\014les)i(and)g(an)f(ASCI)r(I)g(represen)
+o(tation)g(of)g(netCDF)f(\014les.)27 b(The)17 b(output)g(of)f fi(ncdump)h fm
+(and)g(the)g(input)0 1129 y(to)i fi(ncgen)g fm(is)i(an)e(ASCI)r(I)h(descripti\
+on)i(of)d(a)h(netCDF)f(\014le)h(in)h(a)f(tin)o(y)g(language)g(kno)n(wn)g(as)g
+(CDL)f(\(net)o(w)n(ork)0 1192 y(Common)14 b(data)h(form)f(Description)j(Langu\
+age\).)62 1339 y(The)h(preliminary)h(set)e(of)g(example)i(netCDF)d(op)r(erato\
+rs)g(is)i(a)n(v)n(ailable)h(via)f(anon)n(ymous)g(FTP)e(of)h(the)h(\014le)0
+1401 y fi(pub/sdm/ncopers<version>.t)o(ar.Z)8 b fm(from)i(host)g fi(unidata.u\
+car.edu)p fm(.)16 b(The)11 b(programs)f(include:)20 b fi(ncextr)p fm(,)0 1464
+y(which)i(extracts)g(a)g(subset)h(of)f(v)n(ariables)h(from)f(a)g(netCDF)g(\
+\014le)h(into)f(an)g(output)h(netCDF)e(\014le;)27 b fi(ncstat)p fm(,)0 1526 y
+(which)18 b(reads)g(a)g(netCDF)f(\014le)j(and)e(writes)g(selected)i(statistic\
+s)e(along)g(one)g(or)g(more)g(summary)f(dimensions)0 1588 y(into)g(another)h
+(netCDF)g(\014le;)i(and)f fi(ncbarne)p fm(,)f(whic)o(h)h(p)q(erforms)f(a)g
+(Barnes)g(ob)s(jectiv)o(e)g(analysis)h(of)f(ra)o(w)g(data)0 1650 y(con)o(tain\
+ed)h(in)f(a)g(netCDF)f(\014le)j(and)e(writes)g(the)g(result)g(to)g(an)g(outpu\
+t)f(netCDF)h(\014le.)29 b(These)18 b(programs)f(are)0 1713 y(do)q(cumented)e
+(in)h(the)f(ncop)r(ers)g(release.)62 1860 y(A)j(n)o(um)o(b)q(er)g(of)f(freely\
+-a)o(v)n(ailable)i(and)f(commercial)g(soft)n(w)o(are)f(pac)o(k)n(ages)g(are)g
+(also)h(a)n(v)n(ailable)h(for)e(manipu-)0 1922 y(lating)j(or)f(graphically)h
+(displaying)g(netCDF)f(data.)31 b(A)19 b(list)h(of)f(these)h(pac)n(k)n(ages)f
+(is)g(maintained)h(in)g(the)f(\014le)0 1985 y fi(pub/netcdf/utilities.txt)12 b
+fm(from)i(host)h fi(unidata.ucar.edu)p fm(.)0 2302 y fl(10.1)32 b(CDL)15 b
+(Syn)n(tax)62 2449 y fm(Below)k(is)g(an)g(example)h(of)f(CDL,)g(describing)i
+(a)e(netCDF)f(\014le)i(with)g(sev)n(eral)g(named)f(dimensions)i(\()p fi(lat)p
+fm(,)0 2511 y fi(lon)p fm(,)i fi(time)p fm(\),)h(v)m(ariables)f(\()p fi(z)p fm
+(,)h fi(t)p fm(,)f fi(p)p fm(,)h fi(rh)p fm(,)g fi(lat)p fm(,)f fi(lon)p fm
+(,)h fi(time)p fm(\),)f(v)m(ariable)h(attributes)e(\()p fi(units)p fm(,)h fi
+(valid_range)p fm(,)0 2574 y fi(_FillValue)p fm(\),)13 b(and)i(some)g(data.)p
+eop
+%%Page: 152 154
+ bop 0 -58 a fm(152)1442 b(NetCDF)14 b(User's)h(Guide)120 183 y fi(netcdf)23 b
+(foo)g({)96 b(//)23 b(example)g(netCDF)g(specification)f(in)i(CDL)120 283 y
+(dimensions:)120 333 y(lat)f(=)h(10,)g(lon)f(=)h(5,)f(time)h(=)f(unlimited)g
+(;)120 432 y(variables:)168 482 y(long)95 b(lat\(lat\),)22 b(lon\(lon\),)h
+(time\(time\);)168 532 y(float)71 b(z\(time,lat,lon\),)21 b(t\(time,lat,lon\)\
+;)168 582 y(double)47 b(p\(time,lat,lon\);)168 632 y(long)95 b(rh\(time,lat,l\
+on\);)168 731 y(lat:units)22 b(=)i("degrees_north";)168 781 y(lon:units)e(=)i
+("degrees_east";)168 831 y(time:units)e(=)i("seconds";)168 881 y(z:units)f
+(=)g("meters";)168 930 y(z:valid_range)f(=)i(0.,)f(5000.;)168 980 y(p:_FillVa\
+lue)f(=)i(-9999.;)168 1030 y(rh:_FillValue)e(=)i(-1;)120 1130 y(data:)168 1180
+y(lat)71 b(=)24 b(0,)f(10,)h(20,)f(30,)h(40,)f(50,)g(60,)h(70,)f(80,)h(90;)
+168 1229 y(lon)71 b(=)24 b(-140,)f(-118,)g(-96,)g(-84,)h(-52;)120 1279 y(})62
+1537 y fm(All)d(CDL)e(statemen)n(ts)f(are)h(terminated)h(b)o(y)f(a)f(semicolo\
+n.)33 b(Spaces,)20 b(tabs,)f(and)h(newlines)g(can)g(b)q(e)f(used)0 1599 y(fre\
+ely)d(for)e(readabilit)q(y)l(.)20 b(Commen)n(ts)15 b(ma)n(y)g(follow)g(the)g
+(double)i(slash)e(c)o(haracters)g fi(//)f fm(on)i(an)n(y)f(line.)62 1769 y
+(A)23 b(CDL)f(description)i(consists)f(of)f(three)h(optional)g(parts:)34 b
+(dimensions,)25 b(v)n(ariables,)g(and)d(data.)42 b(The)0 1831 y(v)m(ariable)
+17 b(part)d(ma)o(y)h(con)o(tain)g(v)m(ariable)i(declarations)f(and)f(attribut\
+e)g(assignmen)o(ts.)62 2002 y(A)j(dimension)i(is)e(used)h(to)e(de\014ne)i(the)
+f(shap)q(e)g(of)f(one)h(or)g(more)f(of)h(the)g(m)n(ultidimensional)j(v)n(aria\
+bles)d(de-)0 2064 y(scrib)r(ed)g(b)o(y)f(the)g(CDL)h(description.)27 b(A)18 b
+(dimension)h(has)e(a)g(name)g(and)g(a)g(size.)27 b(A)o(t)17 b(most)g(one)g
+(dimension)i(in)0 2126 y(a)e(CDL)g(description)i(can)e(ha)o(v)n(e)h(the)f(unl\
+imited)j(size,)e(whic)o(h)g(means)f(a)g(v)m(ariable)h(using)g(this)g(dimensio\
+n)h(can)0 2188 y(gro)n(w)c(to)g(an)n(y)g(length)h(\(like)f(a)g(record)g(n)o
+(um)o(b)r(er)g(in)h(a)f(\014le\).)62 2359 y(A)k(v)n(ariable)h(represen)o(ts)f
+(a)g(m)o(ultidimensional)j(arra)n(y)d(of)g(v)m(alues)h(of)f(the)g(same)g(t)n
+(yp)r(e.)32 b(A)19 b(v)m(ariable)h(has)f(a)0 2421 y(name,)e(a)g(data)f(t)o
+(yp)q(e,)i(and)f(a)g(shap)q(e)g(describ)s(ed)g(b)o(y)g(its)h(list)g(of)e(dime\
+nsions.)28 b(Eac)n(h)17 b(v)n(ariable)h(ma)n(y)f(also)g(ha)o(v)o(e)0 2483 y
+(asso)q(ciated)j(attributes)g(\(see)g(b)r(elo)o(w\))f(as)h(w)o(ell)h(as)f(dat\
+a)f(v)m(alues.)35 b(The)21 b(name,)g(data)e(t)n(yp)r(e,)i(and)f(shap)r(e)g
+(of)f(a)0 2545 y(v)m(ariable)g(are)f(sp)r(eci\014ed)h(b)o(y)g(its)f(declarati\
+on)h(in)g(the)f(v)m(ariable)h(section)g(of)f(a)f(CDL)h(description.)30 b(A)19
+b(v)m(ariable)0 2608 y(ma)n(y)g(ha)o(v)o(e)g(the)g(same)f(name)h(as)g(a)g(dim\
+ension;)j(b)o(y)d(con)o(v)n(ention)g(suc)o(h)g(a)g(v)m(ariable)h(is)f(one-dim\
+ensional)j(and)0 2670 y(con)o(tains)13 b(co)q(ordinates)g(of)f(the)h(dimensio\
+n)h(it)f(names.)19 b(Dimensions)13 b(need)h(not)e(ha)o(v)o(e)g(corresp)r(ondi\
+ng)h(v)m(ariables.)p eop
+%%Page: 153 155
+ bop 0 -58 a fm(Chapter)15 b(10:)k(Higher-Level)d(netCDF)f(Op)r(erations)965 b
+(153)62 183 y(An)18 b(attribute)f(con)o(tains)g(information)g(ab)r(out)f(a)h
+(v)n(ariable)h(or)f(ab)q(out)g(the)g(whole)h(netCDF)e(data)h(set.)25 b(A)o
+(t-)0 246 y(tributes)16 b(are)f(used)h(to)e(sp)r(ecify)i(suc)o(h)f(prop)r(ert\
+ies)g(as)g(units,)h(sp)q(ecial)h(v)n(alues,)e(maxim)o(um)g(and)h(minimum)f
+(v)n(alid)0 308 y(v)m(alues,)h(scaling)h(factors,)d(o\013sets,)g(and)i(parame\
+ters.)k(A)n(ttribute)c(information)f(is)h(represented)f(b)o(y)g(single)i(v)m
+(al-)0 370 y(ues)g(or)e(arra)n(ys)h(of)g(v)m(alues.)24 b(F)l(or)16 b(example,)
+h fi(units)e fm(is)i(an)f(attribute)g(represented)g(b)o(y)g(a)g(c)o(haracter)
+g(arra)m(y)h(suc)o(h)0 432 y(as)f fi(celsius)p fm(.)23 b(An)17 b(attribute)f
+(has)g(an)h(associated)g(v)n(ariable,)g(a)f(name,)h(a)f(data)g(t)n(yp)q(e,)h
+(a)f(length,)h(and)g(a)f(v)n(alue.)0 495 y(In)f(con)o(trast)f(to)f(v)n(ariabl\
+es)i(that)f(are)h(in)o(tended)h(for)e(data,)f(attributes)i(are)f(in)o(tended)
+i(for)e(ancillary)i(data)e(\(data)0 557 y(ab)q(out)h(data\).)62 733 y(In)f
+(CDL,)f(an)h(attribute)f(is)h(designated)h(b)o(y)e(a)g(v)n(ariable)h(and)g
+(attribute)f(name,)h(separated)f(b)o(y)h(a)f(colon)h(\(`)p fi(:)p fm('\).)0
+795 y(It)j(is)h(p)q(ossible)h(to)d(assign)h(global)h(attributes)f(not)g(assoc\
+iated)h(with)f(an)o(y)g(v)m(ariable)h(to)f(the)g(netCDF)f(\014le)j(as)d(a)0
+857 y(whole)i(b)o(y)f(using)h(the)g(colon)g(\(`)p fi(:)p fm('\))e(b)q(efore)h
+(the)h(attribute)f(name.)26 b(The)18 b(data)f(t)n(yp)r(e)g(of)g(an)h(attribut\
+e)f(in)h(CDL)0 919 y(is)g(deriv)o(ed)g(from)f(the)g(t)o(yp)q(e)h(of)f(the)g
+(v)n(alue)h(assigned)g(to)f(it.)26 b(The)18 b(length)g(of)f(an)g(attribute)g
+(is)h(the)g(n)o(um)o(b)q(er)f(of)0 982 y(data)e(v)m(alues)i(or)e(the)g(n)o
+(um)o(b)r(er)g(of)g(c)o(haracters)g(in)i(the)e(c)o(haracter)g(string)h(assign\
+ed)g(to)f(it.)21 b(Multiple)d(v)m(alues)e(are)0 1044 y(assigned)d(to)f(nonc)o
+(haracter)g(attributes)g(b)o(y)h(separating)f(the)g(v)n(alues)h(with)g(commas)
+f(\(`)p fi(,)p fm('\).)17 b(All)d(v)m(alues)f(assigned)0 1106 y(to)i(an)g(att\
+ribute)g(m)n(ust)g(b)r(e)g(of)g(the)g(same)g(t)o(yp)q(e.)62 1282 y(CDL)h(name\
+s)f(for)g(v)n(ariables,)h(attributes,)f(and)g(dimensions)j(ma)n(y)d(b)r(e)h
+(an)n(y)g(com)n(bination)h(of)e(alphab)r(etic)h(or)0 1344 y(n)o(umeric)g(c)o
+(haracters)f(as)g(w)o(ell)i(as)e(`)p fi(_)p fm(')f(and)i(`)p fi(-)p fm(')e
+(c)o(haracters,)h(but)g(names)h(b)q(eginning)i(with)d(`)p fi(_)p fm(')g(are)g
+(reserv)o(ed)h(for)0 1407 y(use)i(b)o(y)g(the)f(library)n(.)27 b(Case)17 b
+(is)h(signi\014can)q(t)f(in)i(CDL)e(names.)28 b(The)18 b(netCDF)f(library)h
+(do)q(es)g(not)f(enforce)h(an)o(y)0 1469 y(restrictions)13 b(on)g(netCDF)g
+(names,)g(so)f(it)h(is)h(p)q(ossible)h(\(though)d(un)o(wise\))i(to)e(de\014ne)
+i(v)n(ariables)f(with)h(names)f(that)0 1531 y(are)j(not)f(v)n(alid)i(CDL)f
+(names.)22 b(The)17 b(names)f(for)f(the)h(primitive)g(data)g(t)n(yp)r(es)g
+(are)g(reserv)n(ed)h(w)n(ords)f(in)h(CDL,)e(so)0 1593 y(the)g(names)g(of)g
+(v)n(ariables,)g(dimensions,)i(and)e(attributes)g(m)o(ust)g(not)g(b)q(e)g(t)o
+(yp)q(e)h(names.)62 1831 y(The)h(optional)g(data)f(section)i(of)e(a)g(CDL)h
+(description)h(is)f(where)g(netCDF)f(v)m(ariables)i(ma)n(y)f(b)q(e)g(initiali\
+zed.)0 1894 y(The)e(syn)o(tax)g(of)g(an)g(initialization)j(is)e(simple:)241
+2069 y fh(v)n(ariable)i fm(=)e fh(v)m(alue)t 14 2 v 13 w(1)p fm(,)f fh(v)m
+(alue)t 14 2 v 14 w(2)p fm(,)f ff(:)7 b(:)h(:)o fm(;)62 2359 y(The)20 b(comma\
+-delimited)h(list)f(of)f(constan)n(ts)g(ma)n(y)h(b)q(e)g(separated)f(b)o(y)g
+(spaces,)h(tabs,)f(and)h(newlines.)34 b(F)-5 b(or)0 2421 y(m)o(ultidimensiona\
+l)22 b(arra)n(ys,)e(the)g(last)f(dimension)i(v)m(aries)f(fastest.)32 b(Th)n
+(us,)21 b(ro)n(w-order)e(rather)g(than)g(column)0 2483 y(order)h(is)h(used)g
+(for)f(matrices.)35 b(If)21 b(few)o(er)f(v)m(alues)i(are)e(supplied)i(than)f
+(are)f(needed)h(to)f(\014ll)i(a)e(v)n(ariable,)i(it)e(is)0 2545 y(extended)13
+b(with)g(a)f(t)n(yp)q(e-dep)s(endent)f(\014ll)j(v)n(alue.)19 b(The)13 b(t)n
+(yp)r(es)f(of)g(constan)n(ts)g(need)h(not)f(matc)n(h)g(the)g(t)o(yp)q(e)h(dec\
+lared)0 2608 y(for)h(a)f(v)n(ariable;)i(co)q(ercions)g(are)f(done)g(to)g(con)
+o(v)n(ert)g(integers)f(to)h(\015oating)g(p)q(oint,)f(for)h(example.)20 b(All)
+c(meaningful)0 2670 y(t)n(yp)r(e)f(con)o(v)o(ersions)h(are)e(supp)r(orted.)p
+eop
+%%Page: 154 156
+ bop 0 -58 a fm(154)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(10.2)32 b
+(CDL)15 b(Data)f(T)n(yp)s(es)62 320 y fm(The)i(CDL)f(data)f(t)o(yp)q(es)i(are\
+:)0 457 y fi(char)144 b fm(Characters.)0 530 y fi(byte)g fm(Eigh)o(t-bit)16 b
+(data,)e(including)k(zero)d(b)o(ytes.)0 602 y fi(short)120 b fm(16-bit)15 b
+(signed)h(integers.)0 674 y fi(long)144 b fm(32-bit)15 b(signed)h(integers.)0
+747 y fi(int)168 b fm(\(Synon)o(ymous)15 b(with)g(long\).)0 819 y fi(float)
+120 b fm(IEEE)15 b(single-precisi)q(on)j(\015oating)d(p)q(oint)f(\(32)h(bits\
+\).)0 892 y fi(real)144 b fm(\(Synon)o(ymous)15 b(with)g(\015oat\).)0 964 y fi
+(double)96 b fm(IEEE)15 b(double-precision)k(\015oating)c(p)q(oint)f(\(64)h
+(bits\).)62 1176 y(Except)e(for)g(the)g(added)h(data-t)m(yp)r(e)f fi(byte)g fm
+(and)g(the)g(lac)o(k)g(of)g(the)g(t)n(yp)r(e)g(quali\014er)h fi(unsigned)p fm
+(,)e(CDL)h(supp)r(orts)0 1238 y(the)j(same)g(primitiv)q(e)g(data)g(t)n(yp)r
+(es)g(as)g(C.)g(In)h(declarations,)g(t)n(yp)r(e)f(names)h(ma)n(y)f(b)r(e)g
+(sp)r(eci\014ed)i(in)f(either)g(upp)r(er)0 1300 y(or)e(lo)o(w)n(er)g(case.)62
+1437 y fi(Byte)p fm(s)i(di\013er)h(from)e(c)o(haracters)g(in)i(that)e(they)h
+(are)g(in)o(tended)h(to)e(hold)i(eigh)o(t)f(bits)g(of)g(data,)f(and)h(the)g
+(zero)0 1499 y(b)o(yte)h(has)h(no)f(sp)r(ecial)h(signi\014cance,)i(as)d(it)h
+(ma)o(y)f(for)g(c)o(haracter)g(data.)29 b fi(Ncgen)18 b fm(con)o(v)n(erts)g fi
+(byte)g fm(declarations)0 1562 y(to)h fi(char)f fm(declarations)i(in)g(the)f
+(output)g(C)g(co)q(de)h(and)f(to)g(the)g(nonstandard)g fi(BYTE)g fm(declarati\
+on)g(\(or)g(similar)0 1624 y(platform-sp)q(eci\014c)e(declaration\))e(in)h
+(output)f(F)o(OR)m(TRAN)h(co)q(de.)62 1761 y fi(Short)p fm(s)e(can)g(hold)h
+(v)m(alues)g(b)q(et)o(w)o(een)f(-32768)f(and)h(32767.)k fi(Ncgen)c fm(con)o
+(v)n(erts)g fi(short)f fm(declarations)i(to)f fi(short)0 1823 y fm(declaratio\
+ns)i(in)g(the)f(output)g(C)g(co)q(de)h(and)f(to)g(the)g(nonstandard)g fi(INTE\
+GER*2)f fm(declaration)i(in)g(output)f(F)n(OR-)0 1885 y(TRAN)h(co)q(de.)62
+2022 y fi(Long)p fm(s)e(can)h(hold)h(v)n(alues)f(b)r(et)n(w)o(een)g(-21474836\
+48)e(and)i(2147483647.)i fi(Ncgen)d fm(con)o(v)o(erts)g fi(long)g fm(declarat\
+ions)0 2085 y(to)f fi(long)f fm(declarations)i(in)g(the)g(output)f(C)g(co)q
+(de)h(and)f(to)g fi(INTEGER)f fm(declarations)i(in)g(output)g(F)n(OR)m(TRAN)g
+(co)q(de.)0 2147 y(In)i(CDL)f(declarations)h fi(int)f fm(and)g fi(integer)f fm
+(are)h(accepted)h(as)f(synon)o(yms)g(for)f fi(long)p fm(.)62 2284 y fi(Float)
+p fm(s)i(can)h(hold)g(v)n(alues)g(b)q(et)o(w)o(een)g(ab)q(out)f(-3.4)p fi(+)p
+fm(38)f(and)i(3.4)p fi(+)p fm(38.)22 b(Their)c(external)f(represen)o(tation)f
+(is)h(as)0 2346 y(32-bit)12 b(IEEE)h(normalized)h(single-precision)h(\015oati\
+ng-p)r(oin)o(t)d(n)o(um)o(b)r(ers.)18 b fi(Ncgen)12 b fm(con)o(v)o(erts)g fi
+(float)f fm(declarations)0 2408 y(to)16 b fi(float)g fm(declarations)h(in)g
+(the)g(output)f(C)g(co)q(de)h(and)g(to)f fi(REAL)g fm(declarations)h(in)g(out\
+put)f(F)o(OR)m(TRAN)h(co)q(de.)0 2471 y(In)f(CDL)f(declarations)h fi(real)e fm
+(is)i(accepted)g(as)f(a)g(synon)o(ym)g(for)f fi(float)p fm(.)62 2608 y fi(Dou\
+ble)p fm(s)d(can)g(hold)h(v)n(alues)f(b)r(et)o(w)n(een)h(ab)q(out)f(-1.7)p fi
+(+)p fm(308)f(and)h(1.7)p fi(+)p fm(308.)17 b(Their)12 b(external)f(represent\
+ation)g(is)g(as)0 2670 y(64-bit)i(IEEE)h(standard)e(normalized)j(double-preci\
+sion,)h(\015oating-p)r(oin)o(t)d(n)o(um)n(b)r(ers.)19 b fi(Ncgen)12 b fm(con)
+o(v)o(erts)h fi(double)p eop
+%%Page: 155 157
+ bop 0 -58 a fm(Chapter)15 b(10:)k(Higher-Level)d(netCDF)f(Op)r(erations)965 b
+(155)0 183 y(declarations)15 b(to)e(double)j(declarations)f(in)g(the)f(output)
+g(C)g(co)q(de)g(and)h(to)e fi(DOUBLE)h(PRECISION)f fm(declarations)i(in)0 246
+y(output)g(F)n(OR)m(TRAN)h(co)q(de.)0 477 y fl(10.3)32 b(CDL)15 b(Notation)g
+(for)g(Data)f(Constan)n(ts)62 615 y fm(This)i(section)g(explains)h(the)e(CDL)
+g(notation)g(for)f(netCDF)h(constan)n(ts.)62 753 y(A)o(ttributes)i(are)f(init\
+ialized)k(in)d(the)g fi(variables)e fm(section)i(of)f(a)g(CDL)h(description)h
+(b)o(y)e(pro)o(viding)i(a)e(list)h(of)0 815 y(constan)o(ts)f(that)h(determine\
+s)h(the)f(attribute's)f(t)o(yp)q(e)i(and)f(length.)26 b(\(In)18 b(the)f(C)g
+(and)g(F)n(OR)m(TRAN)h(pro)q(cedural)0 878 y(interfaces)e(to)g(the)h(netCDF)f
+(library)m(,)h(the)f(t)o(yp)q(e)h(and)g(length)h(of)e(an)h(attribute)f(m)o
+(ust)g(b)r(e)h(explicitly)i(pro)o(vided)0 940 y(when)13 b(it)g(is)g(de\014ned\
+.\))20 b(Since)14 b(neither)g(C)f(nor)f(F)n(OR)m(TRAN)i(pro)n(vide)g(suitable)
+g(standard)e(syn)o(tax)g(to)g(distinguish)0 1002 y(b)r(et)n(w)o(een)20 b(cons\
+tan)o(ts)f(of)g(t)o(yp)q(e)h fi(byte)f fm(and)h fi(char)p fm(,)g fi(short)f fm
+(and)h fi(long)p fm(,)g(or)f fi(float)g fm(and)h fi(double)f fm(\(except)h
+(that)0 1064 y(F)n(OR)m(TRAN)11 b(pro)o(vides)g(the)g(latter\),)f(CDL)h(de\
+\014nes)g(a)g(syn)o(tax)e(for)h(constan)o(t)g(v)m(alues)i(that)e(allo)o(ws)g
+(it)h(to)f(determine)0 1127 y(the)18 b(netCDF)f(t)o(yp)q(e)h(of)g(an)o(y)f
+(constan)o(t.)28 b(The)18 b(syn)o(tax)f(for)g(CDL)h(constan)o(ts)f(is)i(simil\
+ar)g(to)e(C)h(syn)o(tax,)f(except)0 1189 y(that)12 b(t)n(yp)r(e)g(su\016xes)h
+(are)f(app)r(ended)i(to)d fi(short)p fm(s)h(and)h fi(float)p fm(s)f(to)g(dist\
+inguish)i(them)f(from)f fi(long)p fm(s)g(and)g fi(double)p fm(s.)62 1327 y
+(A)22 b fi(byte)f fm(constan)n(t)h(is)g(represen)o(ted)g(b)o(y)f(a)g(single)i
+(c)o(haracter)e(or)g(m)o(ultiple)j(c)o(haracter)c(escap)r(e)i(sequence)0 1389
+y(enclosed)17 b(in)f(single)g(quotes.)k(F)l(or)14 b(example:)120 1527 y fi
+('a')119 b(//)23 b(ASCII)h(a)120 1577 y('\\0')95 b(//)23 b(a)h(zero)g(byte)
+120 1627 y('\\n')95 b(//)23 b(ASCII)h(newline)f(character)120 1676 y('\\33')
+71 b(//)23 b(ASCII)h(escape)f(character)f(\(33)i(octal\))120 1726 y('\\x2b')
+47 b(//)23 b(ASCII)h(plus)f(\(2b)g(hex\))120 1776 y('\\377')47 b(//)23 b(377)
+h(octal)f(=)h(255)f(decimal,)g(a)h(non-ASCII)e(byte)62 1989 y fm(Character)15
+b(constan)o(ts)g(are)h(enclosed)h(in)g(double)g(quotes.)22 b(A)16 b(c)o(harac\
+ter)f(arra)n(y)h(ma)n(y)g(b)q(e)g(represented)g(as)f(a)0 2052 y(string)d(encl\
+osed)i(in)e(double)i(quotes.)k(Multiple)c(strings)e(are)g(concatenated)g(into)
+f(a)h(single)i(arra)m(y)e(of)g(c)o(haracters,)0 2114 y(p)r(ermitting)k(long)h
+(c)o(haracter)e(arra)n(ys)h(to)f(app)r(ear)h(on)g(m)o(ultiple)i(lines.)24 b
+(T)l(o)16 b(supp)r(ort)g(m)n(ultiple)j(v)m(ariable-length)0 2176 y(string)i
+(v)m(alues,)h(a)e(con)o(v)o(en)o(tional)h(delimiter)i(suc)o(h)e(as)f(`)p fi
+(,)p fm(')g(ma)n(y)g(b)r(e)h(used,)h(but)f(in)o(terpretation)f(of)g(an)o(y)h
+(suc)o(h)0 2239 y(con)o(v)o(en)o(tion)14 b(for)f(a)h(string)g(delimiter)h(m)o
+(ust)e(b)r(e)h(implemen)q(ted)g(in)g(soft)n(w)o(are)f(ab)r(o)n(v)o(e)h(the)g
+(netCDF)f(library)i(la)o(y)n(er.)0 2301 y(The)g(usual)h(escap)r(e)f(con)o(v)o
+(en)o(tions)h(for)e(C)h(strings)g(are)g(honored.)20 b(F)l(or)15 b(example:)
+120 2439 y fi("a")286 b(//)24 b(ASCII)f(`a')120 2488 y("Two\\nlines\\n")f(//)
+i(a)f(10-character)f(string)i(with)f(two)g(embedded)g(newlines)120 2538 y("a)
+h(bell:\\007")46 b(//)24 b(a)f(string)g(containing)g(an)g(ASCII)h(bell)120
+2588 y("ab","cde")118 b(//)24 b(the)f(same)g(as)h("abcde")p eop
+%%Page: 156 158
+ bop 0 -58 a fm(156)1442 b(NetCDF)14 b(User's)h(Guide)62 183 y(The)k(form)e
+(of)h(a)g fi(short)f fm(constan)o(t)h(is)g(an)g(integer)g(constan)n(t)g(with)
+h(an)f(`)p fi(s)p fm(')f(or)h(`)p fi(S)p fm(')f(app)q(ended.)30 b(If)19 b(a)f
+fi(short)0 246 y fm(constan)o(t)e(b)r(egins)h(with)g(`)p fi(0)p fm(',)f(it)h
+(is)h(in)o(terpreted)f(as)g(o)q(ctal.)25 b(When)17 b(it)g(b)r(egins)g(with)g
+fi(0x)p fm(,)g(it)g(is)g(interpreted)g(as)f(a)0 308 y(hexadecimal)h(constan)n
+(t.)j(F)l(or)14 b(example:)120 454 y fi(2s)143 b(//)23 b(a)h(short)f(2)120 504
+y(0123s)71 b(//)23 b(octal)120 554 y(0x7ffs)47 b(//)23 b(hexadecimal)62 784 y
+fm(The)13 b(form)f(of)h(a)f fi(long)g fm(constan)o(t)g(is)h(an)g(ordinary)g
+(in)o(teger)g(constan)n(t,)g(although)g(it)g(is)g(acceptable)h(to)e(app)q(end)
+0 846 y(an)j(optional)g(`)p fi(l)p fm(')f(or)h(`)p fi(L)p fm('.)k(If)c(a)g fi
+(long)f fm(constan)o(t)g(b)r(egins)h(with)h(`)p fi(0)p fm(',)d(it)j(is)f(inte\
+rpreted)g(as)f(o)q(ctal.)20 b(When)c(it)f(b)q(egins)0 908 y(with)h fi(0x)p fm
+(,)e(it)h(is)h(interpreted)f(as)g(a)g(hexadecimal)i(constan)n(t.)j(Examples)
+15 b(of)g(v)n(alid)h fi(long)e fm(constan)o(ts)h(include:)120 1055 y fi(-2)
+120 1104 y(1234567890L)120 1154 y(0123)286 b(//)23 b(octal)120 1204 y(0x7ff)
+262 b(//)23 b(hexadecimal)62 1434 y fm(The)17 b fi(float)e fm(t)n(yp)r(e)h
+(is)g(appropriate)g(for)g(represen)o(ting)g(data)g(with)g(ab)q(out)g(sev)o
+(en)g(signi\014can)q(t)f(digits)i(of)f(pre-)0 1497 y(cision.)33 b(The)20 b
+(form)e(of)h(a)g fi(float)f fm(constan)o(t)h(is)g(the)h(same)f(as)f(a)h(C)g
+(\015oating-p)r(oin)o(t)g(constan)o(t)f(with)i(an)f(`)p fi(f)p fm(')f(or)0
+1559 y(`)p fi(F)p fm(')e(app)q(ended.)26 b(A)16 b(decimal)i(p)r(oin)o(t)f(is)
+g(required)h(in)f(a)f(CDL)h fi(float)f fm(to)g(distinguish)j(it)e(from)f(an)g
+(integer.)24 b(F)-5 b(or)0 1621 y(example,)16 b(the)f(follo)o(wing)h(are)f
+(all)h(acceptable)g fi(float)f fm(constan)n(ts:)120 1767 y fi(-2.0f)120 1817 y
+(3.14159265358979f)165 b(//)23 b(will)h(be)f(truncated)g(to)g(less)h(precisio\
+n)120 1867 y(1.f)120 1917 y(.1f)62 2147 y fm(The)19 b fi(double)e fm(t)n(yp)r
+(e)h(is)h(appropriate)f(for)f(representing)h(\015oating-p)r(oin)o(t)g(data)f
+(with)i(ab)q(out)e(16)h(signi\014cant)0 2209 y(digits)f(of)e(precision.)23 b
+(The)16 b(form)f(of)g(a)h fi(double)f fm(constan)n(t)h(is)g(the)g(same)f(as)h
+(a)f(C)h(\015oating-p)q(oint)f(constan)n(t.)22 b(An)0 2271 y(optional)17 b
+(`)p fi(d)p fm(')e(or)g(`)p fi(D)p fm(')g(ma)o(y)h(b)q(e)g(app)r(ended.)23 b
+(A)16 b(decimal)i(p)q(oint)d(is)i(required)g(in)g(a)e(CDL)h fi(double)f fm
+(to)h(distinguish)0 2334 y(it)f(from)g(an)g fi(integer)p fm(.)k(F)l(or)14 b
+(example,)i(the)f(following)g(are)g(all)h(acceptable)h(double)f(constan)o(ts:)
+120 2521 y fi(-2.0)120 2570 y(3.141592653589793)120 2620 y(1.0e-20)120 2670 y
+(1.d)p eop
+%%Page: 157 159
+ bop 0 -58 a fm(Chapter)15 b(10:)k(Higher-Level)d(netCDF)f(Op)r(erations)965 b
+(157)0 183 y fl(10.4)32 b(ncgen)62 322 y fm(The)14 b fi(ncgen)e fm(to)q(ol)i
+(generates)f(a)g(netCDF)f(\014le)j(or)d(the)i(C)f(or)g(F)n(OR)m(TRAN)h(progra\
+ms)e(required)i(to)f(create)g(the)0 384 y(netCDF)j(\014le.)23 b(If)17 b(no)f
+(options)g(are)g(sp)r(eci\014ed)i(in)f(in)o(v)o(oking)f fi(ncgen)p fm(,)g(the)
+g(program)f(merely)i(c)o(hec)o(ks)f(the)h(syn)o(tax)0 446 y(of)e(the)h(CDL)g
+(input,)h(pro)q(ducing)g(error)e(messages)g(for)g(an)o(y)h(violations)h(of)e
+(CDL)h(syn)o(tax.)21 b(Other)16 b(options)g(can)0 508 y(b)r(e)d(used)g(to)g
+(create)f(a)h(netCDF)f(\014le)i(or)f(to)f(generate)h(a)f(program)g(in)i(C)f
+(or)f(F)o(OR)m(TRAN)h(that)f(calls)i(the)g(routines)0 571 y(required)i(to)f
+(create)g(the)g(netCDF)g(\014le.)62 709 y(UNIX)h(syn)o(tax)f(for)f(inv)n(okin\
+g)i fi(ncgen)p fm(:)120 848 y fi(ncgen)23 b([-b])g([-o)h fh(output-\014le)t fi
+(])f([-c])h([-f])f([-n])g([)p fh(input-\014le)5 b fi(])0 1062 y fm(where:)0
+1215 y(`)p fi(-b)p fm(')166 b(Create)15 b(a)g(\(binary\))h(netCDF)f(\014le.)
+22 b(If)16 b(the)g(`)p fi(-o)p fm(')f(option)h(is)g(absen)o(t,)f(a)g(default)
+i(\014le)f(name)g(will)h(b)r(e)240 1277 y(constructed)f(from)e(the)i(netCDF)e
+(name)i(\(sp)q(eci\014ed)h(after)e(the)g fi(netcdf)g fm(k)o(eyw)n(ord)h(in)g
+(the)f(input\))240 1339 y(b)o(y)e(app)r(ending)h(the)f(`)p fi(.nc)p fm(')g
+(extension.)20 b(If)13 b(a)g(\014le)h(already)g(exists)f(with)h(the)f(sp)r
+(eci\014ed)i(name)e(it)g(will)240 1401 y(b)r(e)i(o)n(v)o(erwritten.)0 1478 y
+(`)p fi(-o)g(outputfile)p fm(')240 1554 y(Name)f(for)f(the)i(netCDF)e(\014le)
+i(created.)20 b(If)14 b(this)g(option)h(is)f(sp)r(eci\014ed,)h(it)g(implies)h
+(the)e(`)p fi(-b)p fm(')f(option.)240 1616 y(\(This)i(option)f(is)h(necessary)
+g(b)q(ecause)g(netCDF)f(\014les)h(are)f(direct-access)h(\014les)h(created)e
+(with)h(seek)240 1678 y(calls,)h(and)f(hence)i(cannot)e(b)q(e)g(written)h(to)
+e(standard)h(output.\))0 1754 y(`)p fi(-c)p fm(')166 b(Generate)14 b(C)g(sour\
+ce)g(co)q(de)g(that)g(will)h(create)f(a)g(netCDF)f(\014le)j(matc)n(hing)f(the)
+f(netCDF)f(sp)r(eci\014ca-)240 1817 y(tion.)20 b(The)c(C)f(source)g(co)q(de)h
+(is)f(written)h(to)e(standard)h(output.)0 1893 y(`)p fi(-f)p fm(')166 b(Gener\
+ate)14 b(F)n(OR)m(TRAN)h(source)f(co)q(de)g(that)g(will)h(create)f(a)g(netCDF)
+f(\014le)i(matc)o(hing)g(the)f(netCDF)240 1955 y(sp)q(eci\014cation.)22 b(The)
+15 b(F)o(OR)m(TRAN)g(source)h(co)q(de)f(is)h(written)f(to)g(standard)g(output\
+.)0 2031 y(`)p fi(-n)p fm(')166 b(Like)17 b(the)h(`)p fi(-b)p fm(')f(option,)
+h(except)g(creates)f(a)g(netCDF)g(\014le)i(with)e(the)h(obsolete)g(`)p fi(.cd\
+f)p fm(')e(extension)240 2094 y(instead)j(of)f(the)h(`)p fi(.nc)p fm(')e(exte\
+nsion,)j(in)f(the)f(absence)i(of)e(an)g(output)g(\014lename)i(sp)q(eci\014ed)
+g(b)o(y)f(the)240 2156 y(`)p fi(-O)p fm(')14 b(option.)20 b(This)c(option)f
+(is)h(only)g(supp)r(orted)f(for)f(bac)o(kw)o(ard)h(compatibility)l(.)0 2393 y
+fl(Examples)62 2532 y fm(Chec)o(k)h(the)f(syn)o(tax)f(of)h(the)g(CDL)h(\014le)
+g(`)p fi(foo.cdl)p fm(':)120 2670 y fi(ncgen)23 b(foo.cdl)p eop
+%%Page: 158 160
+ bop 0 -58 a fm(158)1442 b(NetCDF)14 b(User's)h(Guide)62 183 y(F)l(rom)g(the)
+g(CDL)g(\014le)h(`)p fi(foo.cdl)p fm(',)d(generate)i(an)g(equiv)o(alent)f(bin\
+ary)i(netCDF)f(\014le)h(named)f(`)p fi(flu.nc)p fm(':)120 320 y fi(ncgen)23 b
+(-o)h(flu.nc)f(foo.cdl)62 532 y fm(F)l(rom)12 b(the)g(CDL)g(\014le)h(`)p fi
+(foo.cdl)p fm(',)e(generate)g(a)h(C)g(program)f(con)o(taining)i(the)f(netCDF)
+g(function)h(in)o(v)o(o)q(cations)0 594 y(necessary)i(to)g(create)g(an)g(equi\
+v)o(alen)o(t)g(binary)h(netCDF)e(\014le)i(named)g(`)p fi(flu.nc)p fm(':)120
+731 y fi(ncgen)23 b(-c)h(-o)f(flu.nc)g(foo.cdl)0 951 y fl(10.5)32 b(ncdump)62
+1088 y fm(The)14 b fi(ncdump)e fm(to)q(ol)i(generates)f(an)g(ASCI)r(I)h(repre\
+sen)o(tation)f(of)g(a)h(netCDF)e(\014le)j(on)e(standard)g(output,)g(either)0
+1151 y(with)h(or)f(without)g(an)h(ASCI)r(I)g(represen)o(tation)f(of)g(the)h
+(v)n(ariable)g(data)f(in)h(the)g(\014le.)20 b(The)14 b(ASCI)r(I)g(represen)o
+(tation)0 1213 y(used)19 b(is)f(the)h(CDL)f(notation)g(that)f fi(ncgen)g fm
+(accepts)i(as)e(input.)30 b(Th)o(us)18 b fi(ncdump)g fm(and)g fi(ncgen)f fm
+(can)i(b)q(e)g(used)f(as)0 1275 y(inv)n(erses)e(to)e(transform)g(data)g(repre\
+sentation)h(b)q(et)o(w)n(een)h(binary)g(and)f(ASCI)r(I)h(represen)o(tations.)
+62 1412 y fi(ncdump)g fm(ma)o(y)h(also)g(b)q(e)h(used)f(as)g(a)g(simple)h(bro)
+o(wser)e(for)h(netCDF)f(data)g(\014les,)j(to)d(display)h(the)g(dimension)0
+1474 y(names)h(and)g(sizes;)i(v)m(ariable)f(names,)f(t)o(yp)q(es,)g(and)h(sha\
+p)q(es;)g(attribute)f(names)g(and)g(v)m(alues;)i(and)e(optionally)m(,)0 1537 y
+(the)d(v)n(alues)h(of)e(data)h(for)g(all)h(v)m(ariables)g(or)f(selected)h(v)n
+(ariables)g(in)g(a)f(netCDF)f(\014le.)62 1674 y fi(ncdump)k fm(de\014nes)h
+(a)f(default)g(format)f(used)i(for)e(eac)o(h)h(t)o(yp)q(e)h(of)e(netCDF)h(v)m
+(ariable)h(data,)f(but)g(this)h(can)f(b)r(e)0 1736 y(o)n(v)o(erridden)k(if)f
+(a)f fi(C_format)g fm(attribute)g(is)h(de\014ned)h(for)e(a)g(netCDF)g(v)m(ari\
+able.)37 b(In)21 b(this)g(case,)h fi(ncdump)d fm(will)0 1798 y(use)d(the)h fi
+(C_format)e fm(attribute)h(to)f(format)g(v)m(alues)i(for)f(that)f(v)m(ariable\
+.)24 b(F)l(or)15 b(example,)i(if)g(\015oating-p)r(oin)o(t)f(data)0 1861 y(for)
+j(the)h(netCDF)f(v)n(ariable)h fi(Z)g fm(is)g(kno)o(wn)g(to)f(b)q(e)h(accurat\
+e)g(to)f(only)h(three)g(signi\014cant)g(digits,)h(it)f(w)o(ould)g(b)r(e)0 1923
+y(appropriate)15 b(to)g(use)g(the)h(v)m(ariable)g(attribute)120 2060 y fi(Z:C\
+_format)22 b(=)i("%.3g")62 2271 y fm(UNIX)16 b(syn)o(tax)f(for)f(inv)n(oking)
+i fi(ncdump)p fm(:)120 2408 y fi(ncdump)47 b([)24 b(-c)f(|)h(-h])47 b([-v)24 b
+fh(v)m(ar1)p fi(,)p ff(:)7 b(:)g(:)o fi(])48 b([-b)23 b fh(lang)5 b fi(])47 b
+([-f)24 b fh(lang)t fi(])120 2458 y([-l)f fh(len)p fi(])49 b([)24 b(-d)f(fdig\
+[,ddig]])g([)g(-n)h fh(name)s fi(])47 b([)p fh(input-\014le)5 b fi(])0 2670 y
+fm(where:)p eop
+%%Page: 159 161
+ bop 0 -58 a fm(Chapter)15 b(10:)k(Higher-Level)d(netCDF)f(Op)r(erations)965 b
+(159)0 183 y(`)p fi(-c)p fm(')166 b(Sho)o(w)20 b(the)f(v)n(alues)h(of)g fh
+(co)q(ordinate)i fm(v)n(ariables)e(\(v)n(ariables)g(that)f(are)h(also)g(dimen\
+sions\))h(as)e(w)o(ell)240 246 y(as)f(the)g(declarations)h(of)f(all)h(dimensi\
+ons,)h(v)m(ariables,)g(and)e(attribute)g(v)n(alues.)29 b(Data)17 b(v)n(alues)
+h(of)240 308 y(non-co)r(ordinate)12 b(v)n(ariables)h(are)f(not)g(included)j
+(in)e(the)f(output.)19 b(This)13 b(is)g(often)f(the)g(most)g(suitable)240 370
+y(option)j(to)g(use)h(for)e(a)h(brief)h(lo)q(ok)f(at)g(the)g(structure)g(and)
+h(con)n(ten)o(ts)f(of)g(a)g(netCDF)f(\014le.)0 447 y(`)p fi(-h)p fm(')166 b
+(Sho)o(w)15 b(only)h(the)f fh(header)k fm(information)d(in)g(the)f(output,)g
+(that)f(is,)i(output)f(only)h(the)f(declarations)240 510 y(for)20 b(the)g(net\
+CDF)g(dimensions,)i(v)n(ariables,)g(and)e(attributes)g(of)g(the)h(input)g(\
+\014le,)h(but)e(no)h(data)240 572 y(v)m(alues)d(for)f(an)o(y)g(v)n(ariables.)
+27 b(The)17 b(output)g(is)h(identical)g(to)f(using)h(the)f(`)p fi(-c)p fm(')f
+(option)i(except)g(that)240 634 y(the)13 b(v)n(alues)h(of)e(co)q(ordinate)i
+(v)m(ariables)g(are)f(not)g(included.)22 b(\(A)n(t)13 b(most)f(one)h(of)g(`)p
+fi(-c)p fm(')f(or)h(`)p fi(-h)p fm(')f(options)240 696 y(ma)n(y)j(b)r(e)g(pre\
+sent.\))0 774 y(`)p fi(-v)g(var1,)p ff(:)6 b(:)h(:)p fm(')240 851 y(The)16 b
+(output)f(will)j(include)g(data)d(v)m(alues)i(for)e(the)h(sp)q(eci\014ed)h
+(v)n(ariables,)f(in)h(addition)f(to)f(the)h(dec-)240 913 y(larations)h(of)g
+(all)i(dimensions,)g(v)m(ariables,)g(and)e(attributes.)27 b(One)18 b(or)f(mor\
+e)g(v)m(ariables)h(m)o(ust)f(b)r(e)240 976 y(sp)q(eci\014ed)h(b)o(y)e(name)g
+(in)h(the)e(comma-delimited)j(list)f(follo)o(wing)g(this)f(option.)22 b(The)
+16 b(list)h(m)o(ust)e(b)r(e)240 1038 y(a)g(single)i(argumen)o(t)e(to)g(the)h
+(command,)f(hence)i(cannot)e(con)o(tain)h(blanks)g(or)f(other)h(white)g(space)
+240 1100 y(c)o(haracters.)i(The)c(named)f(v)n(ariables)g(m)o(ust)g(b)q(e)h
+(v)m(alid)g(netCDF)f(v)m(ariables)h(in)g(the)f(input-\014le.)22 b(The)240 1162
+y(default,)14 b(without)h(this)f(option)g(and)h(in)f(the)h(absence)f(of)g(the)
+g(`)p fi(-c)p fm(')f(or)h(`)p fi(-h)p fm(')f(options,)h(is)g(to)g(include)240
+1225 y(data)h(v)m(alues)h(for)e fh(all)k fm(v)n(ariables)e(in)g(the)f(output.)
+0 1302 y(`)p fi(-b)g(lang)p fm(')55 b(A)14 b(brief)h(annotation)f(in)h(the)g
+(form)e(of)h(a)g(CDL)g(commen)o(t)g(\(text)f(b)r(eginning)j(with)e(the)h(c)o
+(haracters)240 1364 y(`)p fi(//)p fm('\))g(will)j(b)q(e)f(included)h(in)g(the)
+e(data)f(section)i(of)f(the)g(output)g(for)g(eac)o(h)g(`ro)n(w')g(of)g(data,)
+f(to)h(help)240 1427 y(identify)c(data)e(v)n(alues)i(for)f(m)n(ultidimensiona\
+l)k(v)m(ariables.)20 b(If)11 b fh(lang)16 b fm(b)q(egins)d(with)e(`)p fi(C)p
+fm(')g(or)g(`)p fi(c)p fm(',)f(then)i(C)240 1489 y(language)j(con)o(v)o(en)o
+(tions)h(will)h(b)q(e)f(used)f(\(zero-based)h(indices,)h(last)e(dimension)i
+(v)m(arying)f(fastest\).)240 1551 y(If)c fh(lang)k fm(b)r(egins)c(with)h(`)p
+fi(F)p fm(')d(or)i(`)p fi(f)p fm(',)f(then)h(F)l(ortran)f(language)h(con)o
+(v)o(en)o(tions)g(will)i(b)q(e)e(used)h(\(one-based)240 1613 y(indices,)20 b
+(\014rst)d(dimension)i(v)m(arying)f(fastest\).)25 b(In)17 b(either)i(case,)e
+(the)h(data)e(will)j(b)r(e)e(presented)g(in)240 1676 y(the)j(same)g(order;)h
+(only)g(the)f(annotations)f(will)j(di\013er.)35 b(This)20 b(option)g(is)h(use\
+ful)g(for)e(bro)o(wsing)240 1738 y(through)c(large)g(v)o(olumes)h(of)e(m)o
+(ultidimensional)k(data.)0 1815 y(`)p fi(-f)d(lang)p fm(')55 b(F)l(ull)16 b
+(annotations)e(in)i(the)f(form)f(of)g(trailing)i(CDL)e(commen)o(ts)g(\(text)g
+(b)r(eginning)i(with)f(the)g(c)o(har-)240 1878 y(acters)f(`)p fi(//)p fm('\))
+g(for)g(ev)o(ery)g(data)h(v)m(alue)h(\(except)f(individual)i(c)o(haracters)d
+(in)i(c)o(haracter)e(arra)n(ys\))g(will)240 1940 y(b)r(e)g(included)i(in)f
+(the)f(data)g(section.)20 b(If)14 b fh(lang)k fm(b)r(egins)c(with)h(`)p fi
+(C)p fm(')e(or)g(`)p fi(c)p fm(',)g(then)i(C)f(language)g(con)o(v)n(en-)240
+2002 y(tions)k(will)h(b)q(e)f(used)f(\(zero-based)h(indices,)h(last)f(dimensi\
+on)h(v)m(arying)f(fastest\).)25 b(If)17 b fh(lang)22 b fm(b)q(egins)240 2064 y
+(with)14 b(`)p fi(F)p fm(')g(or)f(`)p fi(f)p fm(',)g(then)i(F)l(ortran)e(lang\
+uage)h(con)o(v)o(en)o(tions)g(will)i(b)r(e)e(used)h(\(one-based)f(indices,)i
+(\014rst)240 2127 y(dimension)e(v)n(arying)e(fastest\).)18 b(In)13 b(either)h
+(case,)e(the)h(data)f(will)i(b)r(e)e(presented)g(in)i(the)e(same)h(order;)240
+2189 y(only)k(the)f(annotations)g(will)i(di\013er.)25 b(This)17 b(option)g
+(ma)n(y)g(b)q(e)g(useful)g(for)f(piping)i(data)e(into)f(other)240 2251 y(\014\
+lters,)g(since)i(eac)o(h)e(data)f(v)n(alue)i(app)q(ears)f(on)g(a)g(separate)g
+(line,)h(fully)h(identi\014ed.)0 2329 y(`)p fi(-l)e(len)p fm(')79 b(Changes)
+12 b(the)g(default)h(maxim)o(um)f(line)i(length)f(\(80\))e(used)i(in)g(format\
+ting)e(lists)i(of)e(non-character)240 2391 y(data)k(v)m(alues.)0 2468 y(`)p fi
+(-d)g(float_digits[,double_d)o(igits])p fm(')240 2545 y(Sp)r(eci\014es)d(defa\
+ult)f(n)o(um)o(b)q(er)g(of)f(signi\014cant)g(digits)i(to)e(use)h(in)g(display\
+ing)g(\015oating-p)r(oin)o(t)g(or)f(double)240 2608 y(precision)21 b(data)d
+(v)m(alues)i(for)f(v)m(ariables)h(that)e(don't)h(ha)o(v)n(e)h(a)e(`C)s 14 2 v
+13 w(format')g(attribute.)31 b(Floating-)240 2670 y(p)r(oin)o(t)15 b(data)g
+(will)j(b)q(e)e(displa)q(y)n(ed)h(with)f fh(\015oat)r 14 2 v 14 w(digits)i fm
+(signi\014cant)e(digits.)22 b(If)16 b fh(double)5 b 14 2 v 13 w(digits)19 b fm
+(is)d(also)p eop
+%%Page: 160 162
+ bop 0 -58 a fm(160)1442 b(NetCDF)14 b(User's)h(Guide)240 183 y(sp)q(ecoi\014\
+ed,)e(double-precisi)q(on)h(v)m(alues)e(will)h(b)r(e)e(display)o(ed)g(with)h
+(that)e(man)o(y)h(signi\014can)q(t)f(digits.)20 b(If)240 246 y(a)12 b(v)m(ari\
+able)h(has)e(a)h(`C)r 14 2 v 14 w(format')e(attribute,)i(that)f(o)n(v)o(errid\
+es)i(an)o(y)e(sp)r(eci\014ed)i(\015oating-p)r(oin)o(t)f(default.)240 308 y
+(In)18 b(the)f(absence)h(of)e(an)o(y)h(`)p fi(-d)p fm(')f(sp)q(eci\014cations\
+,)j(\015oating-p)r(oin)o(t)e(and)g(double-precision)j(data)c(are)240 370 y
+(display)o(ed)g(with)g(7)g(and)g(15)f(signi\014cant)h(digits)g(resp)r(ectiv)o
+(ely)m(.)22 b(CDL)15 b(\014les)i(can)f(b)q(e)g(made)g(smaller)240 432 y(if)i
+(less)g(precision)g(is)g(required.)27 b(If)18 b(b)q(oth)f(\015oating-p)r(oin)
+o(t)g(and)g(double-presision)k(precisions)d(are)240 495 y(sp)q(eci\014ed,)j
+(the)d(t)n(w)o(o)g(v)m(alues)h(m)o(ust)f(app)q(ear)g(separated)g(b)o(y)g(a)g
+(comma)g(\(no)f(blanks\))i(as)f(a)g(single)240 557 y(argumen)o(t)c(to)h(the)g
+(command.)0 647 y(`)p fi(-n)g(name)p fm(')55 b(CDL)19 b(requires)i(a)e(name)h
+(for)f(a)g(netCDF)g(data)g(set,)h(for)f(use)h(b)o(y)f(`)p fi(ncgen)14 b(-b)p
+fm(')19 b(in)i(generating)e(a)240 710 y(default)j(netCDF)f(\014le)h(name.)39 b
+(By)22 b(default,)h fi(ncdump)e fm(constructs)g(this)h(name)g(from)e(the)i
+(last)240 772 y(comp)q(onen)o(t)15 b(of)g(the)g(pathname)g(of)g(the)g(input)h
+(netCDF)e(\014le)j(b)o(y)e(stripping)h(o\013)f(an)o(y)g(extension)h(it)240 834
+y(has.)27 b(Use)18 b(the)g(`)p fi(-n)p fm(')f(option)h(to)f(sp)r(ecify)h(a)g
+(di\013erent)g(name.)27 b(Although)19 b(the)f(output)f(\014le)i(name)240 896 y
+(used)c(b)o(y)g(`)p fi(ncgen)f(-b)p fm(')f(can)i(b)r(e)f(sp)r(eci\014ed,)i
+(it)f(ma)n(y)f(b)r(e)g(wise)i(to)d(ha)o(v)o(e)i fi(ncdump)e fm(c)o(hange)i
+(the)f(default)240 959 y(name)k(to)g(a)o(v)n(oid)i(inadv)o(ertan)n(tly)f(o)o
+(v)n(erwriting)g(a)f(v)n(aluable)i(netCDF)e(\014le)h(when)g(using)g fi(ncdump)
+p fm(,)240 1021 y(editing)13 b(the)f(resulting)i(CDL)d(\014le,)j(and)e(using)
+h(`)p fi(ncgen)h(-b)p fm(')d(to)h(generate)f(a)h(new)g(netCDF)g(\014le)h(from)
+240 1083 y(the)i(edited)i(CDL)e(\014le.)0 1449 y fl(Examples)62 1601 y fm(Lo)
+r(ok)g(at)f(the)h(structure)g(of)g(the)g(data)g(in)h(the)f(netCDF)g(\014le)h
+(`)p fi(foo.nc)p fm(':)120 1754 y fi(ncdump)23 b(-c)h(foo.nc)62 1997 y fm(Pro)
+q(duce)14 b(an)f(annotated)f(CDL)h(v)o(ersion)h(of)e(the)i(structure)e(and)i
+(data)e(in)i(the)f(netCDF)g(\014le)h(`)p fi(foo.nc)p fm(',)d(using)0 2059 y
+(C-st)n(yle)16 b(indexing)h(for)e(the)g(annotations:)120 2212 y fi(ncdump)23 b
+(-b)h(c)f(foo.nc)g(>)h(foo.cdl)62 2455 y fm(Output)17 b(data)e(for)g(only)i
+(the)f(v)n(ariables)g fi(uwind)g fm(and)g fi(vwind)f fm(from)h(the)g(netCDF)f
+(\014le)i(`)p fi(foo.nc)p fm(',)d(and)j(sho)n(w)0 2517 y(the)e(\015oating-p)r
+(oin)o(t)g(data)g(with)g(only)h(three)f(signi\014can)q(t)f(digits)i(of)f(prec\
+ision:)120 2670 y fi(ncdump)23 b(-v)h(uwind,vwind)e(-d)i(3)f(foo.nc)p eop
+%%Page: 161 163
+ bop 0 -58 a fm(Chapter)15 b(10:)k(Higher-Level)d(netCDF)f(Op)r(erations)965 b
+(161)62 183 y(Pro)q(duce)18 b(a)f(fully-annotated)h(\(one)e(data)h(v)m(alue)h
+(p)q(er)f(line\))i(listing)f(of)f(the)g(data)f(for)h(the)g(v)m(ariable)h fi
+(omega)p fm(,)0 246 y(using)13 b(F)l(ortran)e(con)o(v)o(en)o(tions)i(for)f
+(indices,)i(and)f(c)o(hanging)g(the)f(netCDF)g(dataset)f(name)i(in)g(the)g
+(resulting)g(CDL)0 308 y(\014le)j(to)f fi(omega)p fm(:)120 445 y fi(ncdump)23
+b(-v)h(omega)f(-f)g(fortran)g(-n)h(omega)f(foo.nc)g(>)h(Z.cdl)p eop
+%%Page: 162 164
+ bop 0 -58 a fm(162)1442 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 163 165
+ bop 0 -58 a fm(Chapter)15 b(11:)k(Answ)o(ers)c(to)g(Some)g(F)l(requen)o(tly)
+h(Ask)n(ed)g(Questions)714 b(163)0 183 y fj(11)41 b(Answ)n(ers)14 b(to)i(Some)
+g(F)-7 b(requen)l(tly)15 b(Ask)m(ed)g(Questions)62 369 y fm(Here)20 b(w)n(e)g
+(collect,)h(in)f(one)f(place,)i(answ)n(ers)f(to)e(some)h(of)g(the)g(most)g
+(frequen)o(tly)g(ask)o(ed)g(questions)h(ab)q(out)0 431 y(netCDF)10 b(a)n(v)n
+(ailabilit)q(y)g(and)g(supp)r(ort.)18 b(A)10 b(more)g(comprehensive)g(and)h
+(up-to-date)f(list)h(of)f(answ)o(ers)g(to)f(frequently)0 494 y(ask)n(ed)16 b
+(questions)g(ab)q(out)f(netCDF)f(is)i(main)o(tained)g(in)g(a)f(\014le)h(a)o
+(v)m(ailable)h(for)e(anon)n(ymous)g(FTP)g(access)g(from:)120 631 y fi(host:)
+47 b(unidata.ucar.edu)120 680 y(file:)g(pub/netcdf/FAQ)0 904 y fl(What)16 b
+(is)f(netCDF?)62 1041 y fm(NetCDF)i(\(net)n(w)o(ork)g(Common)g(Data)f(F)l(orm\
+\))g(is)i(an)f(interface)g(for)g(scienti\014c)h(data)f(access)g(and)h(a)f(fre\
+ely-)0 1103 y(distributed)f(soft)n(w)o(are)f(library)g(that)g(pro)n(vides)h
+(an)f(implemen)q(tation)f(of)h(the)g(interface.)k(It)c(w)o(as)f(develop)r(ed)
+h(b)o(y)0 1165 y(Glenn)d(Da)n(vis,)g(Russ)g(Rew,)g(and)f(Stev)o(e)g(Emmerson)
+f(at)h(the)g(Unidata)g(Program)f(Cen)o(ter)h(in)g(Boulder,)i(Colorado.)0 1227
+y(The)21 b(netCDF)e(library)j(also)e(de\014nes)i(a)e(mac)n(hine-indep)5 b(end\
+ent)20 b(format)f(for)h(represen)o(ting)h(scienti\014c)g(data.)0 1290 y(T)l
+(ogether,)c(the)g(interface,)f(library)n(,)h(and)g(format)f(supp)r(ort)g(the)
+h(creation,)h(access,)f(and)g(sharing)h(of)e(scienti\014c)0 1352 y(data.)62
+1489 y(NetCDF)f(data)f(is:)37 1626 y fk(\017)30 b fm(Self-Describing.)22 b
+(A)16 b(netCDF)e(\014le)i(includes)i(information)d(ab)q(out)g(the)g(data)g
+(it)g(con)o(tains.)37 1700 y fk(\017)30 b fm(Net)o(w)n(ork-transparen)n(t.)18
+b(A)11 b(netCDF)f(\014le)i(is)f(represented)g(in)g(a)g(form)f(that)g(can)h
+(b)q(e)g(accessed)g(b)o(y)g(computers)90 1763 y(with)16 b(di\013erent)f(w)o
+(a)n(ys)g(of)g(storing)g(in)o(tegers,)g(c)o(haracters,)f(and)h(\015oating-p)r
+(oin)o(t)g(n)o(um)o(b)q(ers.)37 1837 y fk(\017)30 b fm(Direct-access.)40 b
+(A)22 b(small)h(subset)e(of)h(a)f(large)h(dataset)f(ma)n(y)h(b)r(e)g(accessed)
+g(e\016ciently)m(,)h(without)e(\014rst)90 1899 y(reading)16 b(through)f(all)h
+(the)f(preceding)i(data.)37 1974 y fk(\017)30 b fm(App)r(endable.)20 b(Data)
+11 b(can)g(b)r(e)h(app)q(ended)h(to)e(a)h(netCDF)f(dataset)g(along)g(one)h
+(dimension)i(without)d(cop)o(ying)90 2036 y(the)18 b(dataset)g(or)g(rede\014n\
+ing)i(its)e(structure.)29 b(The)19 b(structure)f(of)f(a)h(netCDF)g(dataset)g
+(can)g(b)r(e)g(c)o(hanged,)90 2098 y(though)d(this)h(sometimes)f(causes)g(the)
+h(dataset)e(to)g(b)r(e)h(copied.)37 2173 y fk(\017)30 b fm(Sharable.)21 b(One)
+16 b(writer)f(and)g(m)o(ultiple)i(readers)e(ma)o(y)g(sim)o(ultaneously)h(acce\
+ss)g(the)f(same)g(netCDF)f(\014le.)0 2396 y fl(Ho)n(w)g(do)h(I)g(get)g(the)g
+(netCDF)g(soft)n(w)n(are)f(pac)n(k)l(age?)62 2533 y fm(Via)i(anon)o(ymous)e
+(FTP)h(from)120 2670 y fi(host:)166 b(unidata.ucar.edu)p eop
+%%Page: 164 166
+ bop 0 -58 a fm(164)1442 b(NetCDF)14 b(User's)h(Guide)120 183 y fi(file:)166 b
+(pub/netcdf/netcdf.tar.Z)62 395 y fm(Mak)n(e)12 b(sure)g(the)g(\014le)h(is)f
+(transmitted)g(in)h(BINAR)m(Y)f(mo)q(de.)19 b(This)12 b(is)h(v)o(ersion)f(2.3\
+,)f(last)h(up)r(dated)f(in)i(F)l(ebruary)0 457 y(1993,)h(or)g(later.)0 674 y
+fl(What)i(do)r(es)e(netCDF)h(run)h(on?)62 811 y fm(V)m(ersion)f(2.3)f(of)h
+(netCDF)g(has)g(b)q(een)h(tested)f(on)g(the)h(follo)o(wing)g(platforms:)37 948
+y fk(\017)30 b fm(SP)l(ARCstation,)14 b(SunOS)i(4.1.3)37 1021 y fk(\017)30 b
+fm(DECstation)14 b(or)h(V)-5 b(AXstation,)15 b(Ultrix)h(4.3)37 1094 y fk(\017)
+30 b fm(V)-5 b(AXstation,)15 b(VMS)37 1167 y fk(\017)30 b fm(IBM)15 b(RS-6000\
+,)g(AIX)h(3.x)37 1240 y fk(\017)30 b fm(IBM)15 b(PS/2,)g(MSDOS)g(5.0)37 1313 y
+fk(\017)30 b fm(IBM)15 b(PS/2,)g(OS/2)37 1386 y fk(\017)30 b fm(CRA)m(Y)15 b
+(YMP)l(,)g(UNICOS)37 1459 y fk(\017)30 b fm(SGI,)15 b(IRIX)37 1531 y fk(\017)
+30 b fm(HP)l(,)15 b(HPUX)62 1743 y(The)k(exp)r(erience)i(of)d(outside)i(dev)o
+(elop)r(ers)f(indicates)h(that)e(netCDF)h(is)g(relatively)g(easy)g(to)f(p)r
+(ort)g(to)g(an)o(y)0 1805 y(system)f(that)f(has)h(a)g(C)f(compiler)j(and)e
+(an)g(XDR)g(library)h(\(eXternal)f(Data)f(Representation,)h(used)h(for)e(NFS)
+0 1868 y(and)f(usually)i(supplied)g(b)o(y)f(v)n(endors\).)0 2085 y fl(What)g
+(is)f(the)h(connection)f(b)s(et)n(w)n(een)f(netCDF)h(and)g(CDF?)62 2222 y fm
+(CDF)c(w)o(as)g(dev)o(elop)s(ed)h(at)f(the)h(NASA)g(Space)h(Science)g(Data)e
+(Cen)o(ter)h(at)f(Goddard,)i(and)f(is)g(freely)h(a)n(v)n(ailable.)0 2284 y
+(It)g(w)o(as)f(originally)j(a)e(VMS)g(F)o(OR)m(TRAN)g(interface)g(for)f(scien\
+ti\014c)i(data)e(access.)20 b(Unidata)13 b(reimplemen)q(ted)g(the)0 2346 y
+(library)h(from)f(scratc)o(h)h(to)f(use)h(XDR)g(for)f(a)g(mac)o(hine-indep)t
+(endent)g(representation,)g(designed)i(the)f(CDL)f(text)0 2408 y(represen)o
+(tation)e(for)f(netCDF)g(data,)h(wrote)f(a)h(User's)f(Guide)i(and)f(made)g
+(other)g(additions)h(including)h(aggregate)0 2471 y(data)i(access,)g(single-\
+\014le)i(implemen)q(tation,)d(named)i(dimensions,)g(and)g(v)m(ariable-sp)s
+(eci\014c)g(attributes.)62 2608 y(NetCDF)f(and)i(CDF)e(ha)n(v)o(e)h(ev)o(olv)
+o(ed)h(indep)r(endently)m(.)22 b(CDF)15 b(no)o(w)h(supp)r(orts)f(man)n(y)h
+(of)g(the)g(same)f(features)0 2670 y(as)f(netCDF)g(\(aggregate)f(data)h(acces\
+s,)h(XDR)f(representation,)g(single-\014le)j(represen)o(tation,)d(v)n(ariable\
+-sp)s(eci\014c)p eop
+%%Page: 165 167
+ bop 0 -58 a fm(Chapter)15 b(11:)k(Answ)o(ers)c(to)g(Some)g(F)l(requen)o(tly)
+h(Ask)n(ed)g(Questions)714 b(165)0 183 y(attributes\),)10 b(but)h(some)f(di\
+\013erences)j(remain)e(\(netCDF)e(do)q(esn't)h(supp)r(ort)g(nativ)o(e-mo)q
+(de)h(represen)o(tation,)g(CDF)0 246 y(do)q(esn't)k(supp)r(ort)f(named)i(dime\
+nsions\).)0 477 y fl(What)g(is)f(the)h(connection)f(b)s(et)n(w)n(een)f(netCDF)
+h(and)g(HDF?)62 615 y fm(The)20 b(National)g(Cen)o(ter)g(for)f(Sup)r(ercomput\
+ing)h(Applications)h(\(NCSA\))f(dev)o(elop)r(ed)g(the)g(HDF)f(soft)n(w)n(are)
+0 677 y(and)f(mak)n(es)g(it)f(freely)i(a)n(v)n(ailable.)28 b(HDF)17 b(is)h
+(an)g(extensible)h(data)e(format)f(for)h(self-describing)j(\014les)f(that)e
+(w)n(as)0 740 y(dev)o(elop)r(ed)i(indep)s(endently)g(of)f(netCDF.)f(Applicati\
+ons)j(and)f(utilities)h(based)f(on)g(HDF)e(are)i(a)n(v)m(ailable)i(that)0 802
+y(supp)r(ort)c(raster-image)g(manipulation)j(and)e(display)f(and)h(bro)o(wsin\
+g)g(through)g(m)n(ultidimensional)j(scienti\014c)0 864 y(data.)f(The)15 b(HDF)
+g(soft)n(w)o(are)g(includes)j(a)d(pac)o(k)m(age)g(of)g(routines)h(for)f(acces\
+sing)h(eac)o(h)f(HDF)g(data)g(t)n(yp)r(e,)g(as)g(w)o(ell)0 926 y(as)i(a)g(lo)
+o(w)n(er-level)h(in)o(terface)f(for)g(building)i(pac)o(k)n(ages)d(to)h(supp)r
+(ort)f(new)h(t)o(yp)q(es.)26 b(HDF)17 b(supp)q(orts)g(b)q(oth)g(C)g(and)0 989
+y(F)l(ortran)10 b(in)o(terfaces,)h(and)g(it)h(has)e(b)r(een)i(successfully)g
+(p)r(orted)f(to)f(a)g(wide)i(v)n(ariet)n(y)f(of)g(mac)n(hine)i(arc)n(hitectur\
+es)f(and)0 1051 y(op)q(erating)17 b(systems.)25 b(HDF)16 b(emphasizes)i(a)f
+(single)h(common)f(format)f(for)g(data,)g(on)h(which)g(man)o(y)g(in)o(terface\
+s)0 1113 y(can)e(b)r(e)g(built.)62 1251 y(NCSA)f(has)f(implemen)q(ted)h(soft)
+n(w)n(are)f(that)g(pro)o(vides)h(a)f(netCDF)g(interface)g(to)g(HDF.)f(With)i
+(this)g(soft)n(w)o(are,)0 1313 y(it)e(is)g(p)r(ossible)h(to)e(use)h(the)f(net\
+CDF)g(calling)j(in)o(terface)e(to)f(place)h(data)f(into)g(an)h(HDF)f(\014le.)
+19 b(The)12 b(netCDF)f(calling)0 1376 y(interface)f(has)h(not)g(c)o(hanged)g
+(and)h(netCDF)e(\014les)i(stored)f(in)g(XDR)h(format)d(are)i(readable,)h(so)f
+(existing)h(programs)0 1438 y(and)h(data)g(will)i(still)f(b)r(e)f(usable)h
+(\(although)g(programs)e(will)i(need)g(to)f(b)r(e)g(relinked)h(to)e(the)i(new)
+f(library\).)20 b(There)0 1500 y(is)13 b(currently)g(no)g(supp)q(ort)f(for)h
+(the)g(mixing)h(of)e(HDF)g(and)h(netCDF)g(structures.)18 b(F)l(or)13 b(exampl\
+e,)g(a)g(raster)f(image)0 1562 y(can)17 b(exist)g(in)h(the)e(same)h(\014le)h
+(as)e(a)g(netCDF)h(ob)r(ject,)g(but)g(y)n(ou)g(ha)o(v)n(e)g(to)f(use)i(the)e
+(Raster)h(Image)g(in)o(terface)g(to)0 1625 y(read)g(the)g(image)h(and)f(the)g
+(netCDF)g(in)o(terface)g(to)g(read)g(the)g(netCDF)g(ob)r(ject.)26 b(The)17 b
+(other)g(HDF)g(in)o(terfaces)0 1687 y(are)c(curren)o(tly)g(b)r(eing)h(mo)q
+(di\014ed)g(to)f(allo)o(w)g(m)o(ulti-\014le)i(access,)f(closer)f(integration)
+g(with)g(the)g(netCDF)g(in)o(terface)0 1749 y(will)k(probably)f(b)q(e)g(dela)
+o(y)o(ed)f(until)h(the)f(end)h(of)f(that)f(pro)r(ject.)62 1887 y(Ev)o(en)o
+(tually)m(,)g(it)h(ma)n(y)f(b)r(e)g(p)r(ossible)h(to)e(integrate)g(netCDF)h
+(ob)r(jects)g(with)h(the)f(rest)g(of)g(the)g(HDF)g(tool)h(suite.)0 1949 y(Suc)
+o(h)j(an)f(integration)g(will)i(then)f(allo)o(w)f(to)q(ols)h(written)f(for)g
+(netCDF)g(and)h(tools)g(written)f(for)g(HDF)g(to)g(b)q(oth)0 2012 y(interact)
+d(intelligently)i(with)f(the)h(new)f(data)g(\014les.)0 2243 y fl(What)h(are)f
+(the)g(\014les)h(in)g(pub/netcdf/)f(on)g(unidata.ucar.edu?)0 2381 y fm(`)p fi
+(README)p fm(')70 b(general)16 b(information)f(ab)q(out)g(netCDF)0 2457 y(`)p
+fi(FAQ)p fm(')142 b(this)16 b(\014le)g(of)f(frequen)o(tly)g(ask)o(ed)g(questi\
+ons)0 2532 y(`)p fi(utilities.txt)p fm(')240 2608 y(a)h(list)i(of)e(soft)n
+(w)o(are)g(pac)o(k)m(ages)h(curren)o(tly)g(a)n(v)n(ailable)h(or)e(under)i(dev)
+o(elopment)e(for)g(manipulating)240 2670 y(and)f(displa)q(ying)g(netCDF)g(dat\
+a)p eop
+%%Page: 166 168
+ bop 0 -58 a fm(166)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y(`)p fi(guide.ps\
+.Z)p fm(')240 259 y(a)21 b(compressed)g(P)o(ostScript)g(\014le)h(of)e(the)h
+(NetCDF)g(User's)f(Guide.)38 b(This)22 b(is)f(included)j(in)e(the)240 321 y
+(netcdf.tar.Z)14 b(distribution,)i(so)f(y)o(ou)g(don't)g(need)h(b)q(oth.)0 396
+y(`)p fi(ncprogs.ps)p fm(')240 472 y(a)h(draft)g(P)o(ostScript)g(do)q(cument)
+g(describing)i(an)f(initial)h(set)f(of)f(netCDF)f(op)r(erator)g(and)i(utility)
+240 534 y(programs)c(under)i(dev)o(elopment)0 609 y(`)p fi(ncprogs.txt)p fm
+(')240 685 y(an)f(ASCI)r(I)h(v)n(ersion)g(of)f(ncprogs.ps)0 760 y(`)p fi(conv\
+entions.info)p fm(')240 836 y(a)g(draft)f(do)r(cumen)o(t)h(of)g(some)g(prop)q
+(osed)g(netCDF)g(con)o(v)n(entions)0 911 y(`)p fi(cdl/)p fm(')118 b(a)10 b
+(directory)h(con)o(taining)g(some)g(examples)g(of)f(CDL)h(\014les)g(\(an)f
+(ASCI)r(I)h(represen)o(tation)g(for)f(netCDF)240 973 y(\014les\).)0 1049 y
+(`)p fi(msdos/)p fm(')70 b(a)15 b(directory)g(con)o(taining)h(executables)h
+(and)e(binaries)h(for)f(netCDF)f(under)i(MSDOS)g(5.0.)j(These)240 1111 y(can)
+d(also)g(b)q(e)g(built)h(from)e(the)h(sources)g(in)h(netcdf.tar.Z,)d(if)i(y)o
+(ou)f(ha)o(v)o(e)h(the)g(necessary)g(Microsoft)240 1173 y(compilers.)0 1249 y
+(`)p fi(mac/)p fm(')118 b(a)14 b(directory)h(con)o(taining)g(notes)g(and)f
+(Macintosh)g(MPW)f(mak)o(e\014les)j(for)d(p)r(orting)h(netCDF)g(to)g(an)240
+1311 y(Apple)i(Macintosh.)j(These)c(w)o(ere)g(con)o(tributed)h(b)o(y)f(Ch)o
+(uc)o(k)g(Denham,)f(U.S.)h(Geological)h(Surv)o(ey)l(.)0 1542 y fl(Wh)n(y)h
+(do)e(I)g(get)g(XDR)f(error)i(messages)c(when)k(trying)h(to)d(write)i(data?)
+62 1679 y fm(Probably)23 b(due)g(to)f(a)g(write)g(error,)i(p)q(erhaps)f(b)q
+(ecause)g(of)f(exceeding)i(disk)f(quotas,)g(a)f(full)i(device,)h(or)0 1741 y
+(p)r(ermission)14 b(problems.)20 b(The)14 b(netCDF)f(library)i(is)f(usually)h
+(built)g(on)f(a)f(v)o(endor-supplied)j(XDR)e(library)h(la)o(y)n(er.)0 1804 y
+(Sometimes)g(errors)f(o)q(ccur)h(in)h(the)e(XDR)h(la)o(y)o(er)g(rather)f(than)
+h(the)f(netCDF)g(la)o(y)o(er,)h(and)f(in)i(this)f(case)g(the)g(error)0 1866 y
+(messages)g(from)f(the)h(XDR)g(la)o(y)o(er)g(can)g(b)r(e)g(cryptic.)21 b(F)-5
+b(or)15 b(example,)g(if)h(the)f(user)g(is)h(writing)f(data)g(and)g(exceeds)0
+1928 y(a)h(disk)i(space)f(quota,)f(this)h(might)f(b)r(e)g(detected)i(\014rst)
+e(in)i(the)f(XDR)g(la)o(y)o(er.)24 b(Although)17 b(w)o(e)g(try)f(to)g(catc)o
+(h)h(and)0 1991 y(elab)r(orate)12 b(on)i(errors)e(that)h(o)q(ccur)g(in)h(the)
+g(XDR)f(la)o(y)o(er,)g(sometimes)h(there)f(is)h(not)f(enough)g(information)h
+(passed)0 2053 y(up)20 b(to)f(calling)j(routines)e(from)f(the)h(XDR)g(la)o
+(y)o(er)f(to)g(mak)o(e)h(construction)g(of)f(a)g(meaningful)i(error)e(message)
+0 2115 y(p)r(ossible.)0 2346 y fl(What's)c(the)g(b)s(est)f(w)n(a)n(y)h(to)g
+(represen)n(t)h(data)f(using)h(netCDF?)62 2483 y fm(There)k(are)f(man)n(y)h
+(w)n(a)o(ys)f(to)g(represen)o(t)g(the)g(same)g(information)h(in)g(an)o(y)f
+(general-purp)s(ose)g(data)f(mo)q(del.)0 2545 y(Choices)12 b(left)g(up)g(to)f
+(the)h(user)g(in)g(the)g(case)g(of)f(netCDF)g(include)j(whic)o(h)e(informatio\
+n)g(to)f(represen)o(t)g(as)h(v)m(ariables)0 2608 y(or)19 b(as)h(v)m(ariable)h
+(attributes;)h(what)d(names)h(to)f(c)o(ho)q(ose)h(for)f(v)m(ariables,)j(dimen\
+sions,)g(and)e(attributes;)i(what)0 2670 y(order)12 b(to)h(use)g(for)f(the)h
+(dimensions)h(of)e(m)o(ultidimensional)k(v)m(ariables;)e(what)f(v)m(ariables)
+h(to)e(include)j(in)e(the)g(same)p eop
+%%Page: 167 169
+ bop 0 -58 a fm(Chapter)15 b(11:)k(Answ)o(ers)c(to)g(Some)g(F)l(requen)o(tly)
+h(Ask)n(ed)g(Questions)714 b(167)0 183 y(netCDF)14 b(\014le;)h(and)g(ho)o(w)f
+(to)g(use)h(v)n(ariable)g(attributes)g(to)f(capture)g(the)h(structure)g(and)f
+(meaning)i(of)e(data.)19 b(W)l(e)0 246 y(pro)o(vide)c(some)e(guidelines)k(in)
+e(the)f(NetCDF)f(User's)g(Guide)i(\(See)g(Section)g(2.3.2)d([A)n(ttributes)i
+(and)h(V)l(ariables],)0 308 y(page)e(22\),)f(but)i(w)n(e'v)o(e)f(found)h(that)
+e(a)h(little)i(exp)r(erience)f(helps.)21 b(Occasionally)15 b(w)o(e)e(ha)o(v)n
+(e)h(decided)h(it)e(w)o(as)g(useful)0 370 y(to)i(c)n(hange)h(the)f(structure)
+g(of)g(netCDF)f(\014les)i(after)f(exp)r(erience)h(with)g(ho)o(w)f(the)g(data)
+f(is)i(used.)0 802 y fl(Are)f(there)h(plans)f(to)g(add)h(facilities)g(for)f
+(data)g(compression)g(to)g(netCDF?)62 962 y fm(W)l(e)f(ha)n(v)o(e)f(no)h(plan\
+s)g(to)e(add)h(data)g(compression)h(to)e(netCDF)h(\(although)g(w)o(e)g(do)g
+(plan)h(to)f(ev)o(en)o(tually)h(add)f(a)0 1025 y(form)g(of)g(transparen)n(t)h
+(data)e(pac)o(king)i(on)g(write)g(and)f(unpacking)h(on)f(read)h(whenev)o(er)g
+(the)g(reserv)n(ed)g(attributes)0 1087 y fi(_Nbits)p fm(,)g fi(_Scale)p fm
+(,)g(and)h fi(_Offset)f fm(are)h(de\014ned\).)62 1247 y(Hyp)r(erslab)k(access)
+h(and)f(direct)h(access)f(to)f(individual)23 b(arra)n(y)c(v)m(alues)h(con\015\
+ict)g(with)f(most)f(simple)j(com-)0 1309 y(pression)16 b(sc)o(hemes.)k(With)
+15 b(netCDF,)f(the)i(elements)f(of)f(an)h(arra)n(y)g(v)n(ariable)h(can)f(b)r
+(e)g(\014lled)i(in)f(an)o(y)f(order)g(or)f(as)0 1371 y(cross-sections)j(in)h
+(an)n(y)f(direction.)26 b(NetCDF)16 b(p)q(ermits)h(writing)g(elements)g(in)g
+(one)g(order)g(and)g(reading)g(them)0 1434 y(later)e(in)h(di\013eren)q(t)f
+(orders.)62 1594 y(Some)e(compression)g(metho)q(ds)f(require)i(that)e(all)h
+(the)g(data)e(to)h(b)r(e)g(compressed)h(are)g(kno)n(wn)g(b)q(efore)g(starting)
+0 1656 y(the)22 b(compression.)41 b(T)l(echniques)23 b(like)f(run-length)i
+(enco)q(ding)f(or)f(an)o(ything)g(that)g(dep)r(ends)g(on)g(exploiting)0 1718 y
+(similarities)16 b(in)e(nearb)o(y)g(v)m(alues)h(can't)e(b)q(e)h(used)g(if)g
+(nearb)o(y)g(v)m(alues)h(aren't)e(all)h(kno)o(wn)g(at)f(the)g(time)h(some)g
+(of)f(the)0 1781 y(data)i(are)f(to)h(b)q(e)h(written.)62 1941 y(An)f(alternat\
+iv)o(e)g(that)f(can)h(b)r(e)g(implemented)g(ab)q(o)o(v)n(e)g(the)g(netCDF)f
+(library)i(is)f(to)f(adopt)g(a)h(con)o(v)n(ention)g(for)0 2003 y(compressed)h
+(data)e(that)h(uses)g(a)g fi(")p fm(compression)p fi(")g fm(attribute)g(to)g
+(enco)r(de)g(the)g(metho)q(d)h(of)f(compression,)g(e.g.)120 2163 y fi(x:compr\
+ession)22 b(=)i("rle")f(;)62 2421 y fm(for)17 b(run-length)i(enco)q(ding)f
+(of)f(the)h(data)e(in)j(a)e(v)m(ariable)h fi(x)p fm(.)27 b(Then)17 b(when)h
+(y)o(ou)f(write)h(the)f(data,)g(compress)0 2483 y(them)f(into)f(a)h(bland)h
+(arra)n(y)f(of)f(b)o(ytes)h(and)h(write)f(all)h(the)f(b)o(ytes.)22 b(Note)16 b
+(that)f(it)i(w)n(ould)g(b)r(e)f(di\016cult)h(to)f(de\014ne)0 2545 y(the)g(siz\
+e)h(of)f(suc)o(h)g(a)g(v)m(ariable)h(in)g(adv)n(ance,)f(since)h(its)f(compres\
+sed)h(size)g(dep)r(ends)f(on)g(its)h(v)m(alues.)23 b(Y)m(ou)16 b(w)n(ould)0
+2608 y(also)f(ha)o(v)o(e)g(to)f(giv)o(e)i(up)f(on)g(h)o(yp)r(erslab)g(access)
+h(for)e(suc)o(h)h(v)n(ariables,)h(but)f(instead)h(read)f(the)g(compressed)g
+(arra)n(y)0 2670 y(in)h(all)g(at)f(once)g(and)h(uncompress)f(it)h(b)q(efore)f
+(using)h(it.)p eop
+%%Page: 168 170
+ bop 0 -58 a fm(168)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fl(What)h(utili\
+ties)i(are)d(a)n(v)l(ailable)i(for)e(netCDF?)62 322 y fm(The)23 b(only)g(util\
+ities)i(a)n(v)n(ailable)f(in)f(the)g(curren)o(t)f(netCDF)g(distribution)i(are)
+e(ncdump)h(and)g(ncgen,)i(for)0 384 y(con)o(v)o(erting)c(netCDF)f(\014les)h
+(to)f(an)h(ASCI)r(I)g(h)o(uman-readable)h(form)d(and)i(for)f(con)o(v)o(erting)
+h(from)f(the)h(ASCI)r(I)0 446 y(h)o(uman-readable)13 b(form)d(bac)o(k)i(to)f
+(a)g(binary)h(netCDF)f(\014le)i(or)e(a)g(C)g(or)g(F)o(OR)m(TRAN)h(program)e
+(for)h(generating)h(the)0 508 y(netCDF)g(\014le.)20 b(In)14 b(addition,)g(the)
+f(\014rst)f(release)i(of)e(the)h(netcdf)g(op)r(erators)e(pac)o(k)n(age,)h(con)
+o(taining)i(a)f(few)f(general-)0 571 y(purp)r(ose)k(netCDF)f(op)r(erators,)g
+(is)i(a)n(v)m(ailable)h(from)e fi(unidata.ucar.edu)e fm(in)j(the)f(\014le)i
+(`)p fi(ncopers.tar.Z)p fm('.)i(See)0 633 y(the)c(description)h(of)e(the)h
+(\014le)g(`)p fi(utilities.txt)p fm(')d(in)k(the)e(answ)o(er)g(to)g(the)h(que\
+stion)g(ab)q(o)o(v)o(e)f(on)h(imp)r(ortan)n(t)f(\014les)0 695 y(in)h(`)p fi
+(/pub/netcdf)p fm(')d(on)i fi(unidata.ucar.edu)e fm(for)i(more)f(information.)
+0 931 y fl(Is)h(there)g(a)g(mailing)i(list)f(for)f(netCDF)g(discussions)g(and)
+g(questions?)62 1070 y fm(Y)m(es)i(-)h(there)g(are)g(t)n(w)o(o.)27 b(The)18 b
+(mailing)h(list)g fi(netcdfgroup at unidata.ucar.e)o(du)c fm(has)j(o)n(v)o(er)g
+(t)n(w)o(o)f(h)o(undred)0 1132 y(readers)k(and)f(gatew)n(a)o(ys;)j(y)n(ou)e
+(can)g(subscrib)r(e)g(or)f(unsubscrib)s(e)h(to)f(the)h(mailing)h(list)g(b)o
+(y)e(sending)i(mail)g(to)0 1194 y fi(netcdfgroup-adm at unidata.uc)o(ar.edu)p fm
+(.)62 1333 y(If)15 b(y)o(ou)f(w)o(ould)h(prefer)g(to)e(get)h(only)h(a)g(singl\
+e)g(daily)h(digest)f(of)f(the)g(p)r(ostings)g(to)g(the)h fi(netcdfgroup)e fm
+(mailing)0 1395 y(list,)f(subscrib)r(e)e(instead)h(to)f(the)g fi(netcdfdigest)
+e fm(mailing)k(list)f(b)o(y)f(sending)h(a)f(request)g(to)g fi(netcdfdigest-ad\
+m at unidata.)o(ucar.ed)o(u)p fm(.)62 1533 y(All)i(the)e(p)q(ostings)g(to)g(the)
+g fi(netcdfgroup)f fm(mailing)i(list)g(are)f(arc)o(hiv)o(ed)h(in)g(the)f(\014\
+le)h(`)p fi(mail-archives/netcdfgrou)o(p)p fm(')0 1596 y(a)n(v)n(ailable)17 b
+(via)e(anon)o(ymous)g(FTP)g(from)f fi(unidata.ucar.edu)p fm(.)0 1832 y fl(Ho)
+n(w)g(do)h(I)g(mak)n(e)h(a)e(bug)i(rep)r(ort?)62 1970 y fm(If)g(y)n(ou)g(\014\
+nd)f(a)g(bug,)g(please)h(send)g(a)f(description)i(to)d fi(support at unidata.uca\
+r.edu)p fm(.)62 2109 y(This)k(is)f(also)g(a)g(b)q(etter)g(address)g(to)f(use)
+h(for)g(questions)g(or)g(discussions)h(ab)r(out)e(netCDF)g(that)h(y)n(ou)g
+(think)0 2171 y(are)e(not)g(appropriate)g(for)f(the)i(en)o(tire)f fi(netcdfgr\
+oup)f fm(mailing)j(list.)0 2407 y fl(Ho)n(w)d(widely)j(is)e(netCDF)g(used?)62
+2545 y fm(W)l(e)j(don't)g(really)h(kno)o(w,)f(but)g(the)g(netcdfgroup)g(and)g
+(netcdfdigest)h(mailing)h(lists)e(ha)o(v)o(e)g(260)f(addresses,)0 2608 y(some)
+h(of)f(which)h(are)g(aliases)h(to)e(more)h(addresses,)h(in)g(fourteen)f(coun)
+o(tries.)28 b(Users)18 b(in)h(sev)o(eral)g(groups)e(ha)o(v)o(e)0 2670 y(adopt\
+ed)e(netCDF)g(as)g(a)f(standard)h(w)o(a)n(y)g(to)g(represen)o(t)g(at)g(least)
+g(some)g(kinds)h(of)f(scienti\014c)h(datasets.)p eop
+%%Page: 169 171
+ bop 0 -58 a fm(Chapter)15 b(11:)k(Answ)o(ers)c(to)g(Some)g(F)l(requen)o(tly)
+h(Ask)n(ed)g(Questions)714 b(169)0 183 y fl(Is)15 b(there)g(an)n(y)h(W)-7 b
+(AIS)15 b(or)h(gopher)f(access)e(to)i(netCDF)g(information?)62 320 y fm(Y)m
+(es,)h(`)p fi(netcdf-group.src)p fm(')e(is)j(a)f(W)-5 b(AIS)18 b(source)e(tha\
+t)g(pro)o(vides)h(a)g(full-text)g(searc)o(h)g(of)f(the)h(netcdfgroup)0 382 y
+(mailing)g(list)f(arc)n(hive)f(and)g(is)h(registered)g(with)f(think.com)h(for)
+e(general)i(use.)62 519 y(Another)g(W)-5 b(AIS)17 b(source,)e(`)p fi(unidata-\
+support-netcdf.src)p fm(')o(,)e(pro)n(vides)k(a)f(full-text)h(searc)o(h)f(of)
+f(the)h(sup-)0 582 y(p)r(ort)e(questions)i(and)f(answ)n(ers)h(ab)q(out)f(netC\
+DF)f(pro)o(vided)i(b)o(y)f(Unidata)h(supp)r(ort)e(sta\013.)62 719 y(Both)e
+(of)g(these)g(W)-5 b(AIS)13 b(serv)n(ers)f(and)h(access)f(to)g(other)f(inform\
+ation)i(ab)q(out)f(Unidata)g(can)g(b)r(e)g(accessed)h(most)0 781 y(easily)j
+(through)f(the)g(Unidata)h(gopher)f(serv)o(er)g(at)f(gopher.unidata.ucar.edu.)
+p eop
+%%Page: 170 172
+ bop 0 -58 a fm(170)1442 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 171 173
+ bop 0 -58 a fm(App)r(endix)16 b(A:)f(Summary)g(of)g(C)g(In)o(terface)1133 b
+(171)0 183 y fj(App)r(endix)13 b(A)41 b(Summary)15 b(of)g(C)g(In)n(terface)
+120 370 y fi(int)23 b(nccreate)g(\(const)g(char*)g(path,)h(int)f(cmode\);)120
+420 y(int)g(ncopen)g(\(const)h(char*)f(path,)g(int)g(mode\);)120 470 y(int)g
+(ncredef)g(\(int)h(ncid\);)120 519 y(int)f(ncendef)g(\(int)h(ncid\);)120 569 y
+(int)f(ncclose)g(\(int)h(ncid\);)120 619 y(int)f(ncinquire)g(\(int)g(ncid,)h
+(int*)f(ndims,)g(int*)g(nvars,)g(int*)h(natts,)f(int*)g(recdim\);)120 669 y
+(int)g(ncsync)g(\(int)h(ncid\);)120 719 y(int)f(ncabort)g(\(int)h(ncid\);)120
+769 y(int)f(ncdimdef)g(\(int)h(ncid,)f(const)g(char*)g(name,)g(long)h(length\
+\);)120 818 y(int)f(ncdimid)g(\(int)h(ncid,)f(const)g(char*)g(name\);)120 868
+y(int)g(ncdiminq)g(\(int)h(ncid,)f(int)g(dimid,)g(char*)g(name,)h(long*)f(len\
+gth\);)120 918 y(int)g(ncdimrename)g(\(int)g(ncid,)g(int)h(dimid,)f(const)g
+(char*)g(name\);)120 968 y(int)g(ncvardef)g(\(int)h(ncid,)f(const)g(char*)g
+(name,)g(nc_type)g(datatype,)g(int)g(ndims,)454 1018 y(const)g(int)h(dimids[]\
+\);)120 1067 y(int)f(ncvarid)g(\(int)h(ncid,)f(const)g(char*)g(name\);)120
+1117 y(int)g(ncvarinq)g(\(int)h(ncid,)f(int)g(varid,)g(char*)g(name,)h(nc_typ\
+e*)e(datatype,)h(int*)g(ndims,)454 1167 y(int)h(dimids[],)e(int*)h(natts\);)
+120 1217 y(int)g(ncvarput1)g(\(int)g(ncid,)h(int)f(varid,)g(const)g(long)h
+(coords[],)e(const)h(void*)h(value\);)120 1267 y(int)f(ncvarget1)g(\(int)g
+(ncid,)h(int)f(varid,)g(const)g(long)h(coords[],)e(void*)h(value\);)120 1316 y
+(int)g(ncvarput)g(\(int)h(ncid,)f(int)g(varid,)g(const)g(long)h(start[],)e
+(const)i(long)f(count[],)454 1366 y(const)g(void*)g(value\);)120 1416 y(int)g
+(ncvarget)g(\(int)h(ncid,)f(int)g(varid,)g(const)g(long)h(start[],)e(const)i
+(long)f(count[],)454 1466 y(void*)g(value\);)120 1516 y(int)g(ncvarputg)g(\(i\
+nt)g(ncid,)h(int)f(varid,)g(const)g(long)h(start[],)e(const)i(long)f(count[],)
+454 1566 y(const)g(long)h(stride[],)e(const)h(long)h(imap[],)f(const)g(void*)
+g(value\);)120 1615 y(int)g(ncvargetg)g(\(int)g(ncid,)h(int)f(varid,)g(const)
+g(long)h(start[],)e(const)i(long)f(count[],)454 1665 y(const)g(long)h(stride[\
+],)e(const)h(long)h(imap[],)f(void*)g(value\);)120 1715 y(int)g(ncvarrename)g
+(\(int)g(ncid,)g(int)h(varid,)f(const)g(char*)g(name\);)120 1765 y(int)g(ncat\
+tput)g(\(int)h(ncid,)f(int)g(varid,)g(const)g(char*)h(name,)f(nc_type)g(datat\
+ype,)f(int)i(len,)454 1815 y(const)f(void*)g(value\);)120 1864 y(int)g(ncatti\
+nq)g(\(int)h(ncid,)f(int)g(varid,)g(const)g(char*)h(name,)f(nc_type*)g(dataty\
+pe,)454 1914 y(int*)g(len\);)120 1964 y(int)g(ncattget)g(\(int)h(ncid,)f(int)
+g(varid,)g(const)g(char*)h(name,)f(void*)g(value\);)120 2014 y(int)g(ncattcop\
+y)g(\(int)g(incdf,)g(int)h(invar,)f(const)g(char*)g(name,)g(int)h(outcdf,)f
+(int)g(outvar\);)120 2064 y(int)g(ncattname)g(\(int)g(ncid,)h(int)f(varid,)g
+(int)h(attnum,)e(char*)i(name\);)120 2114 y(int)f(ncattrename)g(\(int)g(ncid,)
+g(int)h(varid,)f(const)g(char*)g(name,)g(const)h(char*)f(newname\);)120 2163 y
+(int)g(ncattdel)g(\(int)h(ncid,)f(int)g(varid,)g(const)g(char*)h(name\);)120
+2213 y(int)f(nctypelen)g(\(nc_type)g(datatype\);)120 2263 y(int)g(ncsetfill)g
+(\(int)g(ncid,)h(int)f(fillmode\);)120 2313 y(int)g(ncrecput\(int)g(ncid,)g
+(long)g(recnum,)g(void*)g(const)g(datap[]\);)120 2363 y(int)g(ncrecget\(int)g
+(ncid,)g(long)g(recnum,)g(void*)g(datap[]\);)120 2412 y(int)g(ncrecinq\(int)g
+(ncid,)g(int)g(*nrecvars,)g(int)g(recvarids[],)f(long)i(recsizes[]\);)p eop
+%%Page: 172 174
+ bop 0 -58 a fm(172)1442 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 173 175
+ bop 0 -58 a fm(App)r(endix)16 b(B:)f(Summary)g(of)g(F)n(OR)m(TRAN)h(In)o(ter\
+face)940 b(173)0 183 y fj(App)r(endix)13 b(B)41 b(Summary)15 b(of)g(F)n(OR)-7
+b(TRAN)15 b(In)n(terface)62 377 y fm(Input)f(parameters)e(are)h(in)h(upp)r
+(er)f(case,)g(output)g(parameters)f(are)h(in)h(lo)o(w)o(er)f(case.)19 b(The)
+13 b(F)n(OR)m(TRAN)h(t)n(yp)r(es)0 439 y(of)h(all)h(the)f(parameters)g(are)f
+(listed)j(b)q(elow)e(the)g(subroutine)h(and)f(function)h(declarations.)120 578
+y fi(INTEGER)23 b(FUNCTION)g(NCCRE)g(\(PATHNAME,CLOBMODE,)e(rcode\))120 628 y
+(INTEGER)i(FUNCTION)g(NCOPN)g(\(PATHNAME,RWMODE,)e(rcode\))120 677 y(SUBROUTI\
+NE)h(NCREDF)i(\(NCID,)f(rcode\))120 727 y(SUBROUTINE)f(NCENDF)i(\(NCID,)f(rco\
+de\))120 777 y(SUBROUTINE)f(NCCLOS)i(\(NCID,)f(rcode\))120 827 y(SUBROUTINE)f
+(NCINQ)i(\(NCID,)f(ndims,nvars,natts,recdim)o(,rcode\))120 877 y(SUBROUTINE)f
+(NCSNC)i(\(NCID,)f(rcode\))120 927 y(SUBROUTINE)f(NCABOR)i(\(NCID,)f(rcode\))
+120 976 y(INTEGER)g(FUNCTION)g(NCDDEF)g(\(NCID,DIMNAME,SIZE,)e(rcode\))120
+1026 y(INTEGER)i(FUNCTION)g(NCDID)g(\(NCID,DIMNAME,)f(rcode\))120 1076 y(SUBR\
+OUTINE)g(NCDINQ)i(\(NCID,DIMID,)e(dimname,size,rcode\))120 1126 y(SUBROUTINE)
+g(NCDREN)i(\(NCID,DIMID,DIMNAME,)d(rcode\))120 1176 y(INTEGER)i(FUNCTION)g
+(NCVDEF)g(\(NCID,VARNAME,DATATYPE,N)o(VDIMS,V)o(DIMS,)e(rcode\))120 1225 y
+(INTEGER)i(FUNCTION)g(NCVID)g(\(NCID,VARNAME,)f(rcode\))120 1275 y(SUBROUTINE)
+g(NCVINQ)i(\(NCID,VARID,)e(varname,datatype,nvdims,)o(vdims,nv)o(atts,rc)o
+(ode\))120 1325 y(SUBROUTINE)g(NCVPT1)i(\(NCID,VARID,INDICES,VAL)o(UE,)d(rcod\
+e\))120 1375 y(SUBROUTINE)h(NCVP1C)i(\(NCID,VARID,INDICES,)d(CHVAL,)i(rcode\))
+120 1425 y(SUBROUTINE)f(NCVGT1)i(\(NCID,VARID,INDICES,)d(value,)i(rcode\))120
+1474 y(SUBROUTINE)f(NCVG1C)i(\(NCID,VARID,INDICES,)d(chval,)i(rcode\))120 1524
+y(SUBROUTINE)f(NCVPT)i(\(NCID,VARID,START,COUNTS)o(,VALUE,)c(rcode\))120 1574
+y(SUBROUTINE)i(NCVPTC)i(\(NCID,VARID,START,COUNT)o(S,STRIN)o(G,LENST)o(R,)d
+(rcode\))120 1624 y(SUBROUTINE)h(NCVPTG)i(\(NCID,VARID,START,COUNT)o(S,STRID)
+o(E,IMAP,)o(VALUE,)d(rcode\))120 1674 y(SUBROUTINE)h(NCVPGC)i(\(NCID,VARID,ST\
+ART,COUNT)o(S,STRID)o(E,IMAP,)o(STRING,r)o(code\))120 1724 y(SUBROUTINE)e(NCV\
+GT)i(\(NCID,VARID,START,COUNTS)o(,)d(value,rcode\))120 1773 y(SUBROUTINE)h
+(NCVGTC)i(\(NCID,VARID,START,COUNT)o(S,)d(string,LENSTR,rcode\))120 1823 y
+(SUBROUTINE)h(NCVGTG)i(\(NCID,VARID,START,COUNT)o(S,STRID)o(E,IMAP,)o(value,r\
+c)o(ode\))120 1873 y(SUBROUTINE)e(NCVGGC)i(\(NCID,VARID,START,COUNT)o(S,STRID)
+o(E,IMAP,)o(string,r)o(code\))120 1923 y(SUBROUTINE)e(NCVREN)i(\(NCID,VARID,V\
+ARNAME,)d(rcode\))120 1973 y(SUBROUTINE)h(NCAPT)i(\(NCID,VARID,ATTNAME,DATA)o
+(TYPE,AT)o(TLEN,VA)o(LUE,)d(rcode\))120 2022 y(SUBROUTINE)h(NCAPTC)i(\(NCID,V\
+ARID,ATTNAME,DAT)o(ATYPE,L)o(ENSTR,s)o(tring,)d(rcode\))120 2072 y(SUBROUTINE)
+h(NCAINQ)i(\(NCID,VARID,ATTNAME,)d(datatype,attlen,rcode\))120 2122 y(SUBROUT\
+INE)h(NCAGT)i(\(NCID,VARID,ATTNAME,)d(value,rcode\))120 2172 y(SUBROUTINE)h
+(NCAGTC)i(\(NCID,VARID,ATTNAME,)d(string,LENSTR,rcode\))120 2222 y(SUBROUTINE)
+h(NCACPY)i(\(INNCID,INVARID,ATTNAME)o(,OUTNCI)o(D,OUTVA)o(RID,)d(rcode\))120
+2271 y(SUBROUTINE)h(NCANAM)i(\(NCID,VARID,ATTNUM,)d(attname,rcode\))120 2321 y
+(SUBROUTINE)h(NCAREN)i(\(NCID,VARID,ATTNAME,NEW)o(NAME,)d(rcode\))120 2371 y
+(SUBROUTINE)h(NCADEL)i(\(NCID,VARID,ATTNAME,)d(rcode\))120 2421 y(INTEGER)i
+(FUNCTION)g(NCTLEN)g(\(DATATYPE,)f(rcode\))120 2471 y(SUBROUTINE)g(NCPOPT)i
+(\(NCOPTS\))120 2521 y(SUBROUTINE)e(NCGOPT)i(\(ncopts\))120 2570 y(INTEGER)f
+(FUNCTION)g(NCSFIL)g(\(NCID,FILLMODE,)f(rcode\))120 2670 y(CHARACTER*\(*\))g
+(PATHNAME)47 b(!)23 b(absolute)g(or)h(relative)f(name)g(of)g(netCDF)h(file)p
+eop
+%%Page: 174 176
+ bop 0 -58 a fm(174)1442 b(NetCDF)14 b(User's)h(Guide)120 183 y fi(INTEGER)23
+b(CLOBMODE)190 b(!)23 b(either)g(NCCLOB)h(or)f(NCNOCLOB)120 233 y(INTEGER)g
+(RWMODE)238 b(!)23 b(either)g(NCWRITE)g(or)h(NCNOWRIT)120 283 y(INTEGER)f(RCO\
+DE)262 b(!)23 b(returned)g(error)g(code,)h(0)f(if)h(no)f(errors)120 333 y(INT\
+EGER)g(NCID)286 b(!)23 b(netCDF)g(ID,)h(returned)f(by)g(NCCRE)g(or)h(NCOPN)
+120 382 y(INTEGER)f(NDIMS)262 b(!)23 b(number)g(of)h(dimensions)f(in)g(netCDF)
+120 432 y(INTEGER)g(NVARS)262 b(!)23 b(number)g(of)h(variables)f(in)g(netCDF)
+120 482 y(INTEGER)g(NATTS)262 b(!)23 b(number)g(of)h(global)f(attributes)g
+(in)g(netCDF)120 532 y(INTEGER)g(RECDIM)238 b(!)23 b(dimension)g(ID)h(of)f
+(unlimited)g(dimension)120 582 y(CHARACTER*\(*\))f(DIMNAME)71 b(!)23 b(name)h
+(for)f(dimension)120 632 y(INTEGER)g(SIZE)286 b(!)23 b(size)h(of)f(dimension)
+120 681 y(INTEGER)g(DIMID)262 b(!)23 b(dimension)g(ID)h(from)f(NCDDEF)g(or)h
+(NCDID)120 731 y(CHARACTER*\(*\))e(VARNAME)71 b(!)23 b(name)h(for)f(variable)
+120 781 y(INTEGER)g(DATATYPE)190 b(!)23 b(data)h(type)f(code,)g(one)h(of)f
+(NCBYTE,)g ff(:)7 b(:)h(:)o fi(,)24 b(NCDOUBLE)120 831 y(INTEGER)f(NVDIMS)238
+b(!)23 b(number)g(of)h(dimensions)f(in)g(a)h(variable)120 881 y(INTEGER)f(VDI\
+MS\(NDIMS\))94 b(!)23 b(dimension)g(IDs)h(for)f(a)h(variable,)e(giving)h(its)
+h(shape)120 930 y(INTEGER)f(VARID)262 b(!)23 b(variable)g(ID)h(from)f(NCVDEF)
+g(or)h(NCVID,)f(or)g(NCGLOBAL)120 980 y(INTEGER)g(NVATTS)238 b(!)23 b(number)
+g(of)h(attributes)f(assigned)f(to)i(a)g(variable)120 1030 y(INTEGER)f(INDICES\
+\(NDIMS\))46 b(!)23 b(coordinates)g(of)g(a)h(single)f(element)g(of)h(a)f(vari\
+able)120 1080 y(CHARACTER)g(CHVAL)214 b(!)23 b(character)g(value)g(of)h(varia\
+ble)f(or)g(attribute)120 1130 y(CHARACTER*\(*\))f(STRING)95 b(!)23 b(characte\
+r)g(array)g(value)g(of)h(variable)f(or)g(attribute)120 1180 y(INTEGER)g(LENST\
+R)238 b(!)23 b(length)g(of)h(character)f(array)g(value)120 1229 y(DOUBLE)g
+(VALUE)286 b(!)23 b(double)g(precision)g(value)g(of)h(variable)f(or)g(attribu\
+te)120 1279 y(REAL)g(VALUE)334 b(!)23 b(real)h(value)f(of)h(variable)e(or)i
+(attribute)120 1329 y(INTEGER)f(VALUE)262 b(!)23 b(integer)g(value)h(of)f(var\
+iable)g(or)g(attribute)120 1379 y(INTEGER)g(START\(NVDIMS\))70 b(!)23 b(corne\
+r)g(of)h(hyperslab)f(of)g(values)g(of)h(a)g(variable)120 1429 y(INTEGER)f(COU\
+NTS\(NVDIMS\))46 b(!)23 b(edge)h(lengths)f(of)g(hyperslab)g(of)g(values)120
+1478 y(INTEGER)g(STRIDE\(NVDIMS\))46 b(!)23 b(netCDF)g(variable)g(dimensional)
+g(strides)120 1528 y(INTEGER)g(IMAP\(NVDIMS\))94 b(!)23 b(index)h(mapping)f
+(vector)120 1578 y(CHARACTER*\(*\))f(ATTNAME)71 b(!)23 b(attribute)g(name)120
+1628 y(INTEGER)g(ATTLEN)238 b(!)23 b(number)g(of)h(elements)f(in)g(an)h(attri\
+bute)f(vector)120 1678 y(INTEGER)g(INNCID)238 b(!)23 b(input)h(netCDF)f(ID)
+120 1727 y(INTEGER)g(INVARID)214 b(!)23 b(input)h(variable)e(ID)120 1777 y
+(INTEGER)h(OUTNCID)214 b(!)23 b(output)g(netCDF)h(ID)120 1827 y(INTEGER)f(OUT\
+VARID)190 b(!)23 b(output)g(variable)g(ID)120 1877 y(INTEGER)g(ATTNUM)238 b
+(!)23 b(attribute)g(number)120 1927 y(CHARACTER*\(*\))f(NEWNAME)71 b(!)23 b
+(new)h(attribute)f(name)120 1977 y(INTEGER)g(FILLMODE)190 b(!)23 b(NCNOFILL)g
+(or)h(NCFILL,)f(for)g(setting)g(fill)g(mode)p eop
+%%Page: 175 177
+ bop 0 -58 a fm(App)r(endix)16 b(C:)f(Units)1506 b(175)0 183 y fj(App)r(endix)
+13 b(C)41 b(Units)62 366 y fm(The)17 b(Unidata)g(Program)e(Cen)o(ter)h(has)g
+(dev)o(elop)r(ed)h(a)f(units)h(library)g(to)f(con)o(v)o(ert)g(b)q(et)o(w)o
+(een)h(formatted)e(and)0 428 y(binary)21 b(forms)e(of)h(units)h(sp)r(eci\014c\
+ations)g(and)g(p)q(erform)f(unit)h(algebra)f(on)h(the)f(binary)h(form.)35 b
+(Though)20 b(the)0 491 y(units)i(library)h(is)f(self-contained)g(and)g(there)
+g(is)g(no)g(dep)r(endency)h(b)q(et)o(w)n(een)g(it)f(and)g(the)f(netCDF)g(libr\
+ary)m(,)0 553 y(it)g(is)h(nev)o(ertheless)f(useful)h(in)g(writing)f(generic)h
+(netCDF)e(programs)g(and)h(w)o(e)g(suggest)f(y)o(ou)h(obtain)g(it.)37 b(A)0
+615 y(compressed)16 b(tar)f(\014le)i(for)e(the)h(library)g(is)g(a)o(v)m(ailab\
+le)i(from)d(the)h(\014le)h fi(pub/sdm/udunits<version)o(>.tar.Z)12 b fm(in)0
+677 y(the)j(anon)o(ymous)g(FTP)f(directory)i(of)f fi(unidata.ucar.edu)p fm
+(.)62 814 y(The)f(following)g(are)f(examples)i(of)e(units)h(strings)g(that)f
+(can)h(b)q(e)g(interpreted)g(b)o(y)f(the)h fi(utScan\(\))f fm(function)h(of)0
+877 y(the)h(Unidata)h(units)g(library:)120 1014 y fi(10)24 b(kilogram.meters/\
+seconds)o(2)120 1064 y(10)g(kg-m/sec2)120 1113 y(10)g(kg)f(m/s^2)120 1163 y
+(10)h(kilogram)e(meter)i(second-2)120 1213 y(\(PI)f(radian\)2)120 1263 y(degF)
+120 1313 y(100rpm)120 1362 y(geopotential)f(meters)120 1412 y(33)i(feet)f(wat\
+er)120 1462 y(milliseconds)f(since)h(1992-12-31)g(12:34:0.1)g(-7:00)62 1674 y
+fm(A)f(unit)g(is)g(sp)r(eci\014ed)h(as)e(an)g(arbitrary)g(pro)q(duct)h(of)f
+(constan)o(ts)g(and)g(unit-names)i(raised)f(to)f(arbitrary)0 1736 y(integral)
+16 b(p)r(o)n(w)o(ers.)25 b(Division)19 b(is)e(indicated)i(b)o(y)e(a)g(slash)g
+(`)p fi(/)p fm('.)24 b(Multiplication)c(is)e(indicated)g(b)o(y)f(whitespace,)
+h(a)0 1798 y(p)r(erio)q(d)12 b(`)p fi(.)p fm(',)f(or)g(a)g(h)o(yphen)i(`)p fi
+(-)p fm('.)18 b(Exp)q(onen)o(tiation)12 b(is)g(indicated)i(b)o(y)d(an)h(integ\
+er)f(su\016x)g(or)h(b)o(y)f(the)h(exp)r(onen)o(tiation)0 1861 y(op)q(erators)
+i(`)p fi(^)p fm(')f(and)i(`)p fi(**)p fm('.)j(P)o(aren)o(theses)c(ma)o(y)g
+(b)r(e)g(used)h(for)f(grouping)h(and)g(disam)o(biguation.)20 b(The)15 b(times\
+tamp)0 1923 y(in)h(the)f(last)g(example)h(is)g(handled)h(as)e(a)g(sp)q(ecial)
+i(case.)62 2060 y(Arbitrary)h(Galilean)i(transformations)d(\(i.e.)28 b fh(y)
+19 b(=)f(ax)g fi(+)g fh(b)q fm(\))g(are)g(allo)o(w)o(ed.)29 b(In)19 b(particu\
+lar,)g(temp)q(erature)0 2122 y(con)o(v)o(ersions)c(are)g(correctly)h(handled.)
+21 b(The)15 b(sp)r(eci\014cation:)120 2259 y fi(degF)23 b(@)h(32)62 2471 y fm
+(indicates)15 b(a)e(F)l(ahrenheit)h(scale)g(with)g(the)f(origin)h(shifted)g
+(to)f(thirt)n(y-t)o(w)o(o)f(degrees)i(F)l(ahrenheit)g(\(i.e.)19 b(to)13 b(zer\
+o)0 2533 y(Celsius\).)21 b(Th)o(us,)15 b(the)g(Celsius)i(scale)e(is)h(equiv)o
+(alen)o(t)f(to)g(the)g(follo)o(wing)h(unit:)120 2670 y fi(1.8)23 b(degF)h(@)f
+(32)p eop
+%%Page: 176 178
+ bop 0 -58 a fm(176)1442 b(NetCDF)14 b(User's)h(Guide)62 183 y(Note)f(that)g
+(the)g(origin-shift)h(op)q(eration)g(tak)n(es)f(precedence)i(o)n(v)o(er)e(m)o
+(ultiplication.)22 b(In)15 b(order)f(of)g(increasing)0 246 y(precedence,)j
+(the)e(op)q(erations)g(are)g(division,)i(m)n(ultiplication,)h(origin-shift,)e
+(and)g(exp)q(onen)o(tiation.)62 387 y fi(utScan\(\))j fm(understands)h(all)g
+(the)g(SI)g(pre\014xes)g(\(e.g.)32 b fi(")p fm(mega)p fi(")19 b fm(and)g fi
+(")p fm(milli)p fi(")p fm(\))j(plus)e(their)g(abbreviations)0 449 y(\(e.g.)f
+fi(")p fm(M)p fi(")c fm(and)g fi(")p fm(m)p fi(")p fm(\))62 591 y(The)h(funct\
+ion)h(utPrin)o(t\(\))e(alw)o(a)n(ys)h(enco)q(des)g(a)g(unit)g(sp)q(eci\014cat\
+ion)i(one)d(w)o(a)n(y)m(.)21 b(T)l(o)15 b(reduce)i(misunderstand-)0 653 y(ing\
+s,)c(it)f(is)g(recommended)h(that)e(this)h(enco)r(ding)h(st)n(yle)g(b)q(e)f
+(used)h(as)e(the)h(default.)20 b(In)12 b(general,)h(a)f(unit)g(is)h(enco)q
+(ded)0 715 y(in)i(terms)f(of)f(basic)i(units,)g(factors,)e(and)h(exp)r(onen)o
+(ts.)19 b(Basic)c(units)f(are)g(separated)g(b)o(y)g(spaces,)g(and)h(an)n(y)f
+(exp)r(o-)0 778 y(nen)o(t)h(directly)i(app)q(ends)f(its)f(asso)q(ciated)h(uni\
+t.)21 b(The)15 b(ab)q(o)o(v)n(e)h(examples)g(w)n(ould)g(b)r(e)f(enco)r(ded)h
+(as)e(follows:)120 919 y fi(10)24 b(kilogram)e(meter)i(second-2)120 969 y(9.8\
+696044)f(radian2)120 1019 y(0.555556)g(kelvin)g(@)h(255.372)120 1069 y(10.471\
+976)f(radian)g(second-1)120 1119 y(9.80665)g(meter2)g(second-2)120 1168 y(986\
+36.5)g(kilogram)g(meter-1)g(second-2)120 1218 y(0.001)g(seconds)g(since)g(199\
+2-12-31)g(19:34:0.1000)f(UTC)62 1439 y fm(\(Note)17 b(that)f(the)h(F)l(ahrenh\
+eit)h(unit)g(is)g(enco)q(ded)g(as)f(a)g(deviation,)h(in)g(fractional)f(k)o
+(elvins,)i(from)d(an)h(origin)0 1501 y(at)e(255.372)e(k)n(elvin,)k(and)e(that)
+g(the)g(time)h(in)g(the)f(last)g(example)h(has)f(b)r(een)g(referenced)i(to)d
+(UTC.\))62 1643 y(The)i(database)g(for)f(the)h(units)h(library)g(is)f(a)g(for\
+matted)e(\014le)j(con)o(taining)g(unit)g(de\014nitions)g(and)g(is)f(used)h
+(to)0 1705 y(initialize)h(this)e(pac)o(k)m(age.)k(It)15 b(is)h(the)f(\014rst)
+g(place)h(to)f(lo)q(ok)g(to)g(disco)o(v)o(er)g(the)g(set)g(of)g(v)m(alid)i
+(names)e(and)g(sym)o(b)q(ols.)62 1847 y(The)h(format)d(for)i(the)g(units-\014\
+le)i(is)e(do)r(cumen)o(ted)g(internally)h(and)f(the)g(\014le)h(ma)o(y)f(b)q
+(e)g(mo)q(di\014ed)i(b)o(y)e(the)g(user)0 1909 y(as)g(necessary)m(.)21 b(In)c
+(particular,)f(additional)h(units)f(and)g(constan)o(ts)f(ma)o(y)g(b)r(e)h(eas\
+ily)g(added)h(\(including)h(v)m(arian)o(t)0 1971 y(sp)q(ellings)g(of)c(existi\
+ng)j(units)e(or)g(constan)o(ts\).)62 2113 y fi(utScan\(\))i fm(is)i(case-sens\
+itive.)28 b(If)18 b(this)h(causes)f(di\016culties,)i(y)o(ou)e(migh)o(t)g(try)
+f(making)h(appropriate)g(addi-)0 2175 y(tional)e(en)o(tries)f(to)g(the)g(unit\
+s-\014le.)62 2317 y(Some)k(unit)h(abbreviations)g(in)g(the)f(default)h(units-\
+\014le)h(migh)o(t)e(seem)g(coun)o(ter-intuitiv)o(e.)32 b(In)20 b(particular,)
+0 2379 y(note)15 b(the)g(following:)120 2521 y fi(For)167 b(Use)357 b(Not)119
+b(Which)23 b(Instead)g(Means)120 2620 y(Celsius)71 b(`Celsius')213 b(`C')119 b
+(coulomb)120 2670 y(gram)143 b(`gram')285 b(`g')119 b(<standard)23 b(free)g
+(fall>)p eop
+%%Page: 177 179
+ bop 0 -58 a fm(App)r(endix)16 b(C:)f(Units)1506 b(177)120 183 y fi(gallon)95
+b(`gallon')237 b(`gal')71 b(<acceleration>)120 233 y(radian)95 b(`radian')237
+b(`rad')71 b(<absorbed)23 b(dose>)120 283 y(Newton)95 b(`newton')22 b(or)i
+(`N')71 b(`nt')95 b(nit)24 b(\(unit)f(of)g(photometry\))62 495 y fm(F)l(or)12
+b(additional)j(information)d(on)h(this)g(units)h(library)m(,)f(please)g(consu\
+lt)h(the)e(man)o(ual)h(pages)g(that)f(come)h(with)0 557 y(the)i(distribution.)
+p eop
+%%Page: 178 180
+ bop 0 -58 a fm(178)1442 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Page: 179 181
+ bop 0 -58 a fm(F)l(unction)16 b(and)f(V)m(ariable)h(Index)1314 b(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(:)g(:)g(:)h(:)21 b fc(17,)13 b(76,)g(81,)g(119,)g(126,)g
+(129)0 1109 y(NC)r 12 2 v 11 w(CHAR)f fb(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)24 b fc(17,)13 b(76,)g(81,)g(112,)g(119,)g(126,)g(127,)g(129)0 1167 y(NC)r
+12 2 v 11 w(CLOBBER)6 b fb(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)17 b fc
+(45,)c(76,)g(78)0 1225 y(NC)r 12 2 v 11 w(DOUBLE)d fb(:)c(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)22 b fc(17,)13 b(76,)g(81,)g(119,)g(126,)g(127,)g(129)0
+1284 y(NC)r 12 2 v 11 w(F)l(A)m(T)l(AL)7 b fb(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fc(40)0 1342 y(NC)r 12
+2 v 11 w(FLO)o(A)m(T)7 b fb(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)19 b fc(17,)13 b(76,)g(81,)g(119,)g(126,)g(129)0 1400 y
+(NC)r 12 2 v 11 w(GLOBAL)c fb(:)d(:)g(:)21 b fc(125,)14 b(126,)f(127,)g(129,)
+g(132,)g(136,)g(139,)g(144)0 1458 y(NC)r 12 2 v 11 w(LONG)8 b fb(:)e(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fc(17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g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)24 b fc(142)1015 656 y(NCBYTE)5 b fb(:)h(:)g(:)g(:)18 b fc(17,)13 b
+(77,)g(83,)g(86,)g(89,)g(95,)g(100,)g(103,)g(108,)g(120,)1092 715 y(128,)g
+(130)1015 773 y(NCCHAR)s fb(:)6 b(:)g(:)g(:)16 b fc(17,)d(77,)g(83,)g(86,)g
+(89,)g(95,)g(100,)g(103,)g(108,)g(114,)1092 831 y(120,)g(128,)g(130)1015 889 y
+(NCCLOB)t fb(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fc(46)1015 947 y fa(NCCLOS)s fb(:)6 b(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fc(33,)13 b(34,)g(35,)f(36,)h(37,)
+g(39,)g(40,)g(53,)g(54,)g(59)1015 1005 y fa(ncclose)7 b fb(:)f(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)22 b fc(33,)13 b(34,)f(35,)h(36,)g(38,)
+g(39,)g(40,)g(53,)g(59)1015 1063 y fa(NCCRE)t fb(:)6 b(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)17 b fc
+(33,)c(45,)g(46,)g(52,)g(54,)g(67,)g(78)1015 1121 y fa(nccreate)t fb(:)6 b
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)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g(:)g(:)g(:)17 b fc(73)1015 1528 y
+fa(NCDINQ)10 b fb(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)24 b fc
+(37,)13 b(38,)g(70,)g(71)1015 1586 y(NCDOUBLE)6 b fb(:)g(:)17 b fc(17,)c(77,)
+g(83,)f(85,)h(89,)g(94,)f(99,)h(103,)g(108,)g(120,)1092 1644 y(128,)g(130)
+1015 1703 y fa(NCDREN)s fb(:)6 b(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fc(73,)13 b(74)1015 1761 y fa(ncd\
+ump)7 b fb(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)20 b fc(13,)13 b(151,)
+g(155,)g(158)1015 1819 y fa(ncendef)6 b fb(:)g(:)g(:)g(:)21 b fc(33,)13 b(34,)
+g(38,)g(39,)f(40,)h(51,)g(53,)g(57,)g(73,)g(112,)g(117,)1092 1877 y(127,)g
+(136,)g(144)1015 1935 y fa(NCENDF)8 b fb(:)e(:)g(:)g(:)g(:)22 b fc(33,)13 b
+(34,)g(39,)g(40,)f(51,)h(52,)g(53,)g(57,)g(74,)g(114,)g(118,)1092 1993 y(128,)
+g(137,)g(145)1015 2051 y(ncerr)e fb(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(: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h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fc(37,)c(55,)g(56,)g(71)1015 2516 y fa
+(ncinquire)5 b fb(:)h(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)20 b fc(36,)13 b
+(37,)g(55,)g(70)1015 2574 y(NCLONG)5 b fb(:)h(:)g(:)g(:)g(:)18 b fc(17,)12 b
+(77,)h(83,)g(85,)g(89,)g(94,)g(99,)g(103,)g(108,)g(120,)1092 2632 y(128,)g
+(130)p eop
+%%Page: 180 182
+ bop 0 -58 a fm(180)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fc(NCNOCLOB)s fb
+(:)6 b(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)17 b fc(45,)c(46,)f(52,)h(54,)g(67)0 241 y(NCNO)n(WRIT)
+e fb(:)c(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fc
+(48,)13 b(56,)g(58,)g(69,)f(71,)h(80,)g(83)0 299 y fa(ncopen)t fb(:)6 b(:)g
+(:)g(:)19 b fc(35,)13 b(36,)g(38,)g(39,)f(47,)h(49,)g(55,)g(57,)g(59,)g(62,)g
+(68,)f(70,)77 358 y(73,)h(79,)g(82,)f(84,)h(88,)g(92,)g(98,)g(102,)g(106,)g
+(112,)g(117,)g(119,)77 416 y(127,)g(129,)g(132,)g(136,)g(139,)g(142,)g(144)0
+474 y fa(NCOPN)s fb(:)6 b(:)18 b fc(35,)12 b(36,)g(37,)h(39,)f(47,)h(48,)f
+(50,)g(56,)h(58,)f(60,)h(69,)f(71,)g(74,)77 532 y(80,)g(83,)g(86,)h(90,)f(95,)
+g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fa(ncredef)t fb(:)7 b(:)f(:)g(:)g(:)19 b fc(38,)13 b(39,)g
+(49,)g(59,)g(73,)g(112,)g(117,)g(127,)g(136,)g(144)0 997 y fa(NCREDF)c fb(:)d
+(:)24 b fc(39,)13 b(49,)g(50,)g(59,)g(60,)g(74,)g(114,)g(118,)g(128,)g(137,)g
+(145)0 1055 y fa(ncsetfill)6 b fb(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)22 b fc(61,)13 b(62)0 1113 y fa(NCSFIL)s fb(:)6 b
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)17 b fc(61,)c(63)0 1171 y(NCSHOR)m(T)s fb(:)6 b(:)g(:)g(:)16 b fc(17,)
+d(77,)g(83,)g(85,)g(89,)f(94,)h(99,)g(103,)g(108,)g(120,)77 1229 y(128,)g(130)
+0 1287 y fa(NCSNC)8 b fb(:)e(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)22 b fc(34,)13 b(57,)g(58)0 1346 y fa(ncsync)s fb(:)6 b
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(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:)g(:)g(:)g(:)g
+(:)g(:)g(:)17 b fc(36,)c(38,)g(98)0 1752 y fa(ncvargetg)r fb(:)6 b(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)18 b fc(36,)13 b(38,)g(105,)g(106)1015 183 y fa(ncvari\
+d)5 b fb(:)h(:)g(:)20 b fc(35,)13 b(36,)f(79,)h(82,)g(84,)g(88,)g(92,)g(98,)g
+(102,)g(106,)g(117,)1092 241 y(119,)g(127,)g(129,)g(132,)h(136,)f(139,)g(142,)
+g(144)1015 299 y fa(ncvarinq)r fb(:)6 b(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)17 b fc(36,)c(38,)g(81,)f(82,)
+h(119,)g(139)1015 358 y fa(ncvarput)s fb(:)6 b(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)18 b fc(33,)13 b
+(34,)g(38,)g(87,)g(88,)f(112)1015 416 y fa(ncvarput1)7 b fb(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fc(34,)13 b(84)
+1015 474 y fa(ncvarputg)r fb(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)17 b fc(34,)c(91,)g(92)1015 532 y fa(ncv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g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)18 b fc(36,)13 b(38,)g(98,)g(99,)f(100)1015 939 y fa(NCVGTC)e fb
+(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)24 b fc(35,)13 b(36,)f
+(37,)h(38,)g(101,)g(102,)g(112,)g(113)1015 997 y fa(NCVGTG)8 b fb(:)e(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)22 b fc(35,)13
+b(36,)g(37,)f(38,)h(105,)g(107,)g(108)1015 1055 y fa(NCVID)8 b fb(:)e(:)g(:)g
+(:)h(:)22 b fc(35,)13 b(36,)f(79,)h(80,)g(83,)g(86,)g(90,)g(95,)g(100,)g(103,)
+g(108,)1092 1113 y(118,)g(120,)g(128,)g(130,)h(134,)f(137,)g(140,)g(143,)g
+(145)1015 1171 y fa(NCVINQ)c fb(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fc(37,)13 b(38,)g(81,)g(82,)f(83,)h
+(120,)g(140)1015 1229 y fa(NCVP1C)s fb(:)6 b(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fc(34,)13 b(84)1015
+1287 y fa(NCVPGC)6 b fb(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fc(34,)13 b(39,)g(91,)f(93,)h
+(112,)g(113)1015 1346 y fa(NCVPT)s fb(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fc(33,)c(34,)g
+(39,)g(87,)g(88,)g(90,)f(112)1015 1404 y fa(NCVPT1)e fb(:)c(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)24 b fc(34,)13 b(84,)g(85,)g(86)1015 1462 y
+fa(NCVPTC)8 b fb(:)e(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)22 b fc(33,)13 b(34,)g(39,)f(87,)h(112,)g(113,)g(114)1015 1520
+y fa(NCVPTG)8 b fb(:)e(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)22 b fc(33,)13 b(34,)g(39,)g
+(91,)g(93,)g(95)1015 1578 y fa(NCVREN)d fb(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fc(117,)13 b(118)1015 1636 y
+(NCWRITE)c fb(:)d(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)21 b fc(48,)13 b(50,)g(60,)
+g(74)1015 1744 y fl(R)1015 1810 y fc(rco)r(de)7 b fb(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)20 b fc(41)p eop
+%%Trailer
+ eos end TeXDict begin 300 @start bos /fa df[<127812FCA41278>6 6 5 0 16]58 dc
+dfe /fb df[<EA01C0A7B51280A33801C000A7>17 17 1 -3 20]43 dc dfe /fc df[<126012
+F0A21260>4 4 3 0 11]58 dc dfe /fd df[<EBFC7C380183C63807078E00061304000E1300A6
+B512F0380E0700AE387F0FF0>23 26 0 0 22]11 dc[<13FCEA0182EA0703EA0607EA0E0290C7
+FCA5B5FCEA0E07AE387F0FE0>19 26 0 0 21]12 dc[<13FFEA0387EA07071206120EA6B5FCEA
+0E07AE387F9FE0>19 26 0 0 21]13 dc[<90387E1F803901C17040390703C0600006EB80E000
+0E14401500A5B612E0380E0380AE397F8FE3FC>30 26 0 0 32]14 dc[<1380EA010012025A12
+0C120812185AA35AA412E0AA1260A47EA37E1208120C12047E7EEA0080>9 38 3 10 15]40 dc[
+<7E12407E7E12181208120C7EA37EA41380AA1300A41206A35A1208121812105A5A5A>9 38 2
+10 15]41 dc[<126012F0A212701210A31220A212401280>4 11 3 7 11]44 dc[<EAFFC0A2>
+10 2 0 -7 13]45 dc[<126012F0A21260>4 4 3 0 11]46 dc[<1304130C1318A31330A31360
+A313C0A3EA0180A3EA0300A31206A35AA35AA35AA35AA35AA2>14 37 2 9 19]47 dc[<EA0780
+EA1860EA3030A2EA6018A2EAE01CACEA6018A2EA7038EA3030EA1860EA0780>14 24 2 0 19]
+48 dc[<12035AB4FC1207B3A2EAFFF0>12 24 3 0 19]49 dc[<EA0F80EA1060EA2030EA4038EA
+803CEAC01C12E01240EA003C1338A21370136013C0EA018013001202EA040412081210EA3008EA
+3FF8127F12FF>14 24 2 0 19]50 dc[<EA0F80EA10E0EA2070EA6078EA70381220EA00781370
+A2136013C0EA0F80EA00E013701338133CA212E0A212C0EA40381370EA30E0EA0F80>14 24 2 0
+19]51 dc[<1330A2137013F0A2EA0170120312021204120C1208121012301220124012C0B5FCEA
+0070A6EA07FF>16 24 1 0 19]52 dc[<EA3018EA3FF013E013C0EA2000A5EA27C0EA3860EA20
+30EA00381318131CA2124012E0A2EA8018EA40381330EA30E0EA0F80>14 24 2 0 19]53 dc[<
+EA01E0EA0610EA0C18EA1838123013001270126012E0EAE7C0EAE860EAF030131812E0131CA312
+60A2EA701812301330EA1860EA07C0>14 24 2 0 19]54 dc[<1240EA7FFE13FCA2EA4008EA80
+10A21320EA0040A213801201A213005AA45AA61202>15 25 2 0 19]55 dc[<EA0780EA1860EA
+3030EA20181260A3EA7010EA3C30EA3E60EA0F80EA07C0EA19F0EA30F8EA6038EA401CEAC00CA4
+EA6008EA2010EA1860EA0FC0>14 24 2 0 19]56 dc[<EA0780EA1860EA30301270EA601812E0
+A2131CA31260133C1230EA185CEA0F9CEA001C1318A21338EA70301360EA6040EA2180EA1F00>
+14 24 2 0 19]57 dc[<130CA3131EA2133F1327A2EB4380A3EB81C0A348C67EA213FF38020070
+A20006137800041338A2487FA2001C131EB4EBFFC0>26 26 1 0 29]65 dc[<B5FC380E01C0EB
+00E014701478A514F014E0EB03C0380FFF80380E01E0EB00701478143CA51438147814F0EB01E0
+B51280>22 26 2 0 27]66 dc[<EB3F023801C0C63803002E000E131E48130E14065A00781302
+1270A200F01300A600701302A21278003813047E14087E000313303801C0C038003F00>23 26 2
+0 28]67 dc[<B5FC380E01C0EB00E014301438141CA2140EA2140FA8140EA2141E141C1438A214
+70EB01C0B51200>24 26 2 0 29]68 dc[<B512F0380E00701430141014181408A3EB0400A313
+0CEA0FFCEA0E0C1304A3EB0004A21408A3141814381470B512F0>22 26 2 0 26]69 dc[<B512
+E0EA0E001460142014301410A3EB0400A3130CEA0FFCEA0E0C1304A390C7FCA8EAFFF0>20 26 2
+0 25]70 dc[<EB3F023801C0C63803002E000E131E48130E14065A007813021270A200F090C7FC
+A5903801FFC03970000E00A2127812387EA27E000313163801C06638003F82>26 26 2 0 30]
+71 dc[<38FFE7FF380E0070AB380FFFF0380E0070AC38FFE7FF>24 26 2 0 29]72 dc[<EAFFE0
+EA0E00B3A6EAFFE0>11 26 1 0 14]73 dc[<EAFFF0000EC7FCB01420A314601440A214C01303
+B5FC>19 26 2 0 24]76 dc[<B4EB03FC000F14C0A2380B8005A33809C009A33808E011A3EB70
+21A2EB3841A3EB1C81A3EB0F01A31306121C39FF861FFC>30 26 2 0 35]77 dc[<38FE01FF38
+0F00381410EA0B80A2EA09C0EA08E0A21370A21338131CA2130EA21307EB0390A2EB01D0A2EB00
+F01470A21430121C38FF8010>24 26 2 0 29]78 dc[<137F3801C1C038070070000E7F487F00
+3C131E0038130E0078130F00707F00F01480A80078EB0F00A20038130E003C131E001C131C6C5B
+6C5B3801C1C0D8007FC7FC>25 26 2 0 30]79 dc[<B5FC380E03C0EB00E01470A21478A41470
+A214E0EB03C0380FFF00000EC7FCABEAFFE0>21 26 2 0 26]80 dc[<EAFFFC380E0780EB01C0
+6D7E80A55C495AEB0780D80FFCC7FCEA0E067F6D7E80A380A31580EB00F0EC710038FFE03E>25
+26 2 0 28]82 dc[<EA0FC2EA1836EA200EEA600612C01302A3EAE0001270127EEA3FE0EA1FF8
+EA07FCEA003E130E130713031280A3EAC0021306EAE004EAD818EA87E0>16 26 2 0 21]83 dc[
+<007FB5FC38701C0700401301A200C0148000801300A300001400B13803FFE0>25 26 1 0 28]
+84 dc[<38FFE1FF380E00381410B20006132012076C1340EA01803800C180EB3E00>24 26 2 0
+29]85 dc[<39FF801FC0391E000F00001C13066C1304A26C5BA36C6C5AA2EBC03000011320A26C
+6C5AA3EB7080A20139C7FCA3131EA3130CA2>26 26 1 0 29]86 dc[<3AFF83FF0FF03A3C0078
+01C0001CEC0080A26CEC0100A2149C6C1402A2EB010EA2D803815BEB8207A2D801C25B9038C403
+88A2D800E41390A29038E801D0017813E0A2EB7000A201305B01201340>36 26 1 0 39]87 dc[
+<387FC0FF380F003C6C1330EB8020000313603801C0406D5AEA00E10171C7FC137A133C131C13
+1EA21317EB27801343EB41C0EB81E0EA0100147000021378481338000C7F001E133E39FF80FFC0
+>26 26 1 0 29]88 dc[<39FF801FE0391E000700000E1306000F13046C5B13806C6C5A000113
+30EBE0206C6C5A1370EB78801338011DC7FC131F130EAAEBFFE0>27 26 1 0 29]89 dc[<EA3F
+80EA70C013E0EA20701200A2EA07F0EA1C701230127012E01371A213F1EA71FBEA1E3C>16 16 2
+0 19]97 dc[<12FC121CA913F8EA1F0EEA1E07381C0380130114C0A6EB03801400EA1E07EA1B0C
+EA10F0>18 26 1 0 21]98 dc[<EA07F8EA0C1C1238EA3008EA70005AA61270EA3004EA3808EA
+0C18EA07E0>14 16 1 0 17]99 dc[<137E130EA9EA03CEEA0C3EEA380E1230127012E0A61260
+1270EA381EEA1C2E3807CFC0>18 26 1 0 21]100 dc[<EA07C0EA1C30EA30181270EA600C12E0
+EAFFFCEAE000A41260EA3004EA3808EA0C18EA07E0>14 16 1 0 17]101 dc[<EA01F0EA0318EA
+0738EA0E101300A6EAFFC0EA0E00AEEA7FE0>13 26 0 0 12]102 dc[<EA0FCEEA1873EA3030EA
+7038A4EA3030EA1860EA2FC0EA200012601270EA3FF013FCEA1FFEEA600FEAC003A4EA6006EA38
+1CEA07E0>16 24 1 8 19]103 dc[<12FC121CA913F8EA1D0CEA1E0EA2121CAB38FF9FC0>18 26
+1 0 21]104 dc[<1218123CA21218C7FCA612FC121CAEEAFF80>9 26 0 0 10]105 dc[<12FC12
+1CA9EB3F80EB1E00131813105B5BEA1DC0EA1FE0121C1370137813387F131E131F38FF3FC0>18
+26 1 0 20]107 dc[<12FC121CB3A6EAFF80>9 26 0 0 10]108 dc[<38FC7C1F391D8E638039
+1E0781C0A2001C1301AB39FF9FE7F8>29 16 1 0 32]109 dc[<EAFCF8EA1D0CEA1E0EA2121CAB
+38FF9FC0>18 16 1 0 21]110 dc[<EA07E0EA1C38EA300CEA700EEA6006EAE007A6EA6006EA70
+0EEA381CEA1C38EA07E0>16 16 1 0 19]111 dc[<EAFCF8EA1F0EEA1E07381C0380A2EB01C0A6
+EB03801400EA1E07EA1F0CEA1CF090C7FCA6B47E>18 23 1 7 21]112 dc[<EA03C2EA0C26EA38
+1EEA300E127012E0A61270A2EA381EEA1C2EEA07CEEA000EA6EB7FC0>18 23 1 7 20]113 dc[<
+EAFCE0EA1D70121E1320EA1C00ABEAFFC0>12 16 1 0 15]114 dc[<EA1F20EA60E0EA402012C0
+A2EAF000127FEA3FC0EA1FE0EA00F0EA8070133012C01320EAF040EA8F80>12 16 1 0 15]115
+dc[<1204A3120CA2121C123CEAFFC0EA1C00A81320A5EA0E40EA0380>11 23 1 0 15]116 dc[<
+EAFC7EEA1C0EAC131EEA0C2E3807CFC0>18 16 1 0 21]117 dc[<38FF1F80383C0600EA1C04A2
+EA1E0CEA0E08A26C5AA21390EA03A0A2EA01C0A36C5A>17 16 1 0 20]118 dc[<39FF3F9F8039
+3C0E070000381306381C16041317001E130C380E23081488000F13983807419014D03803C1E013
+80A200015BEB0040>25 16 1 0 28]119 dc[<38FF3F80383C1C00EA1C18EA0E106C5A13606C5A
+12017F1203EA0270487E1208EA181CEA381E38FC3FC0>18 16 1 0 20]120 dc[<38FF1F80383C
+0600EA1C04A2EA1E0CEA0E08A26C5AA21390EA03A0A2EA01C0A36C5AA248C7FCA212E112E212E4
+1278>17 23 1 7 20]121 dc[<EA7FF8EA6070124013E0EA41C0A2EA0380EA0700A2EA0E08121C
+A2EA381012701330EAFFF0>13 16 1 0 17]122 dc dfe /fe df[<127012F8A31270>5 5 4 0
+13]58 dc dfe /ff df[<913A03FF800180023FEBF00349B5EAFC0701079038003F0FD91FF8EB
+079FD93FC0EB01FFD9FF807F4848C8127F4848153F0007161F49150F485A001F1607A2485A1703
+127FA24992C7FCA212FFA9127FA27FEF0380123FA26C7E1707000F17006C7E6D150E0003161E6C
+6C151C6C6C6C1478D93FC05CD91FF8EB03E0D907FFEB3F800101D9FFFEC7FCD9003F13F8020313
+80>49 49 4 0 58]67 dc[<DA03FF1303027FEBF00749B5EAFC0F01079038007E1FD91FF0EB0F
+BFD97FC0EB03FF49487F4848C87E485A0007824848815B001F82A2484881A2127FA24992C7FC12
+FFAA0307B512FC127F7FDB00011300123FA26C7EA2120F7F6C7E12036C7E6C6C7E6D6C5BD91FF8
+497ED907FFEB3E3F01019038FFFC1F6D6CEBF00F0203EB8003>54 49 4 0 63]71 dc[<B61280
+A3C6EB8000B3B3A7B61280A3>25 49 2 0 30]73 dc[<007FB8FCA39039C00FF801D87E00EC00
+3F007C82007882A200708200F01780A3481603A5C792C7FCB3AA017FB6FCA3>49 48 3 0 56]
+84 dc[<EBFFF0000313FE390F803F809038C00FE0486C6C7EA26E7ED80FC07FEA0780C7FCA414
+FF131FEBFFE33803FC03EA0FF0EA1FC0123FEA7F80A2EAFF00A31407A2387F800D393FC019FE3A
+1FE070FFF03907FFE07FC6EB803F>36 32 2 0 39]97 dc[<EA01F812FFA3120F1207ADEC3FE0
+ECFFFC9038FBE07F9039FF001F8049EB0FC04914E049EB07F016F8A2ED03FCA316FEA816FCA3ED
+07F8A216F06DEB0FE06D14C001E7EB3F809039C3C0FE00903880FFF89038003FC0>39 50 2 0
+45]98 dc[<ED0FC0EC07FFA3EC007F153FADEB07F8EB3FFF9038FE07BF3903F801FF3907E0007F
+120F4848133F123FA2485AA312FFA8127FA36C7EA2121F6C6C137F000714FF2603F00313E03A01
+FC0F3FFE38007FFEEB0FF0>39 50 3 0 45]100 dc[<EB0FFC90387FFF803901FC0FC03903F003
+E03907E001F0000F14F8391FC000FC003F14FEA24848137E157FA212FFA290B6FCA20180C7FCA4
+127FA36C6C1307121F150E6C7E6C6C131C6C6C13783900FE03E090383FFFC0903807FE00>32 32
+2 0 37]101 dc[<EB01FE90380FFF8090381FC3C090387F07E09038FE0FF0120113FC1203EC07
+E0EC018091C7FCA8B512FCA3D803FCC7FCB3A8387FFFF0A3>28 50 2 0 25]102 dc[<EA01F812
+FFA3120F1207B3B3A6B512C0A3>18 50 3 0 23]108 dc[<3903F007F800FFEB3FFEEC783F02C0
+13803A0FF1801FC03807F30001F614E013FCA35BB3B500C3B5FCA3>40 32 3 0 45]110 dc[<EB
+07FC90387FFFC03901FC07F03903F001F848486C7E4848137E001F147F003F158049133F007F15
+C0A300FF15E0A8007F15C0A36C6CEB7F80A2001F15006C6C13FE00075C3903F803F83901FE0FF0
+39007FFFC0D907FCC7FC>35 32 2 0 40]111 dc[<3803F03F00FFEB7FC09038F1C3E01487390F
+F30FF0EA07F6A29038FC07E0EC03C091C7FCA25BB2B512E0A3>28 32 2 0 33]114 dc[<3801FF
+86000713FEEA1F00003C133E48131E140E12F8A36C90C7FCB47E13FC387FFFC014F06C7F6C7F00
+077F00017FEA003F01001380143F0060131F00E0130FA27E15007E6C131E6C131C38FF807838F3
+FFF038C07F80>25 32 3 0 32]115 dc[<131CA5133CA3137CA213FC120112031207381FFFFEB5
+FCA2D803FCC7FCB0EC0380A71201EC0700EA00FEEB7F0EEB3FFCEB07F0>25 46 1 0 31]116 dc
+[<3A7FFF807FFCA33A03FE000F000001141E6C6C5B6E5AEB7FC06D6C5A90381FE1E090380FF3C0
+ECFF806D90C7FC6D5A13016D7E81815B903803DFE09038078FF08190380F07FCEB1E03496C7E49
+6C7E49148049EB7FC00001143F26FFFC01B5FCA3>40 32 1 0 43]120 dc dfe /fg df[<B5FC
+A6>16 6 1 -11 22]45 dc[<EB3F803801FFF03807E0FC380FC07E48487E497E481480003E130F
+007E14C0A400FE14E0AF007E14C0A46CEB1F80A26C14006D5A380FC07E6C6C5A3801FFF038003F
+80>27 39 3 0 34]48 dc[<130E131E137EEA07FE12FFA212F81200B3AB387FFFFEA3>23 39 5
+0 34]49 dc[<EBFF80000713F04813FC381E03FE393800FF80007C133F00FE14C06C131F15E014
+0FA2127E003C131FC7FC15C0A2EC3F801500147E5C5C495A495AEB078049C7FC131E4913E01370
+5B3901C001C0EA0380EA0600000FB5FC5A5A5AB61280A3>27 39 3 0 34]50 dc[<EB7F803803
+FFF04813FC380F80FE381F007FEA3F80EC3F80A3121F1300C7EA7F00A2147E5C495AEB07F0EBFF
+C0A2EB01F8EB007E801580EC1FC0A215E0A2123C127EB4FCA215C0143F481480007CEB7F00003F
+13FE6CB45A000713F0C61380>27 39 3 0 34]51 dc[<140E141E143E147E14FEA213011303EB
+077E130EA2131C1338137013E0A2EA01C0EA0380EA0700120EA25A5A5A5AB612F8A3C7EAFE00A8
+90387FFFF8A3>29 39 2 0 34]52 dc[<00181303381F801FEBFFFE5C5C5C14C091C7FC001CC8
+FCA7EB7FC0381DFFF8381F80FC381E003F1208C7EA1F8015C0A215E0A21218127C12FEA315C05A
+0078EB3F80A26CEB7F00381F01FE6CB45A000313F0C61380>27 39 3 0 34]53 dc[<EB07F8EB
+3FFE90B5FC3901FC07803903F00FC03807C01FEA0F80121F130048EB0F8091C7FC127EA3EAFE02
+EB1FF0EB3FFCEB603EEB801F00FF14809038000FC0A24814E0A4127EA4123E003F14C07EEC1F80
+D80F8013003807E07E6CB45A6C5B38003FC0>27 39 3 0 34]54 dc[<1238123E003FB512F0A3
+4814E015C0158015003870000EA25C485B5C5CEA00015C495A130791C7FC5B5B131E133EA2137E
+137CA213FCA41201A76C5A1370>28 41 4 0 34]55 dc[<EB3FC03801FFF04813FC3807C07E48
+C67E001E7FEC0F80123EA2123F138013C09038F01F00381FFC1E6D5A380FFFF814E06C13F80001
+7F8000077FD80F0F1380D81E0313C0EA3E01397C007FE0141F48130F14071403A315C0127C007E
+EB07806CEB0F00381FC03F380FFFFC00035B38007FC0>27 39 3 0 34]56 dc[<EB7F803801FF
+F000077F380FC0FC381F803E48487E007E1480A2140F00FE14C0A315E0A5007E131FA26C133F6C
+132F380F80CF3807FF8F0001130FEA0008010013C0A3EC1F80123E127FEC3F00143E147E007E5B
+383E03F8381FFFE06C1380D801FEC7FC>27 39 3 0 34]57 dc[<EC0780A24A7EA34A7EA24A7E
+A3EC77F8A2ECF7FC14E3A2903801C1FEA201037F1480A249486C7EA24980010E133FA2496D7EA2
+013FB57EA39039700007F8A201F080491303A248486D7EA2000381D8FFFE013F13FCA3>46 41 2
+0 51]65 dc[<B612F815FF16C03A03F8001FE0ED0FF0ED07F8150316FCA21501A3150316F8A2ED
+07F0150FED1FC0EDFF8090B5EAFE00EDFFC09039F8000FF0ED03F8ED01FC16FE1500A216FFA616
+FE1501ED03FC1507ED1FF8B712E016C0EDFE00>40 41 3 0 48]66 dc[<91387FE003903907FF
+FC07011FEBFF0F90397FF00F9F9039FF0001FFD801FC7F4848147F4848143F4848141F485A160F
+485A1607127FA290C9FC5AA97E7F1607123FA26C7E160E6C7E6C6C141C6C6C143C6C6C14786CB4
+EB01F090397FF007C0011FB512800107EBFE009038007FF0>40 41 4 0 49]67 dc[<B612FCED
+FF8016E03A03FC001FF8ED03FCED00FE167FEE3F80EE1FC0A2EE0FE0A2EE07F0A417F8AA17F0A3
+EE0FE0A217C0161FEE3F80EE7F005EED03FCED1FF8B75A168003FCC7FC>45 41 2 0 52]68 dc[
+<B712E0A33903FC001FED07F01501A215001670A3913801C0781638A302031300A2140F90B5FC
+A3EBFC0F1403A20201130EA3161C91C7FCA3163C1638167816F815011503151FB712F0A3>39 41
+2 0 44]69 dc[<B712C0A33903FC003FED0FE015031501A21500A316F0913801C070A316001403
+A2140F90B5FCA3EBFC0F1403A21401A491C8FCA9B512FCA3>36 41 2 0 42]70 dc[<91387FE0
+03903907FFFC07011FEBFF0F90397FF00F9F9039FF0001FFD801FC7F484880484880484880485A
+82485A82127FA290CAFC5AA892B512F87E7F03001300123FA26C7EA26C7E6C7E6C7E6C7E6CB45B
+90387FF007011FB5129F0107EBFE0F9039007FF003>45 41 4 0 53]71 dc[<B5D8F00FB5FCA3
+D803FCC7EA3FC0AF90B7FCA301FCC7123FB1B5D8F00FB5FCA3>48 41 2 0 53]72 dc[<B512FC
+A33801FE00B3B1B512FCA3>22 41 1 0 25]73 dc[<B539F001FFFCA3D803FCC7EA1E005E5E5E
+4B5A4B5A4BC7FC151E5D5D5D4A5AEC03804A7E141F4A7E4A7E4A7EEBFDE79038FF83FCEC03FE49
+6C7E497E6F7E826F7E151F6F7E8215076F7E6F7E8281EE7F80B539F00FFFFEA3>47 41 2 0 53]
+75 dc[<B512FCA3D803FCC8FCB3A3ED01C0A415031680A21507A2150FA2151F157F913801FF00
+B7FCA3>34 41 2 0 40]76 dc[<D8FFFE92383FFF80A26D5D0003EFE000A2D9BF8014EFA2D99F
+C0EB01CFA2D98FE0EB038FA3D987F0EB070FA2D983F8130EA2D981FC131CA3D980FE1338A2027F
+1370A291383F80E0A391381FC1C0A291380FE380A2913807F700A3EC03FEA26E5AA26E5AD8FFFE
+0203B51280A21570>57 41 3 0 64]77 dc[<D8FFFCEC7FFF7F7F00036DEB01C080EBBFE0139F
+80EB8FF8EB87FCEB83FEEB81FF01801380147F15C0EC3FE0EC1FF0EC0FF8EC07FC140315FEEC01
+FF6E1381ED7FC1ED3FE1ED1FF1150F16F9ED07FDED03FF8181167FA2163F161F160F1607D8FFFE
+14031601A2>48 41 2 0 53]78 dc[<ECFFC0010F13FC90383F807F9039FE001FC0D801F8EB07
+E048486D7E48486D7E000F8148486D7EA24848147FA2007F168090C8123FA34816C0AA6C16806D
+147FA2003F1600A26C6C14FEA26C6C495A6C6C495A6C6C495A6C6C495A6C6C495A90263FC0FFC7
+FC90380FFFFC010013C0>42 41 4 0 51]79 dc[<B612F815FF16C03A03FC003FE0ED07F0ED03
+F816FC150116FEA716FC150316F8ED07F0ED3FE090B61280EDFE0001FCC8FCB0B512F0A3>39 41
+2 0 46]80 dc[<ECFFC0010F13FC90383FC0FF9039FE001FC048486D7ED803F0EB03F000078148
+486D7E48486D7EA24848147FA2007F1680A290C8123FA24816C0AA6C16806D147FA2003F1600A2
+6C6C14FE143E3A0FE07F81FC00079038C1C1F83A03F180E3F0D801F9EBE7E0D800FFEB7FC0D93F
+C090C7FC90380FFFFC01004913C0EC007C811601ED3F83ED1FFF1780A26F1300816F5A6F5A6F5A
+>42 53 4 12 51]81 dc[<B612E015FE6F7E3A03FC003FE0ED0FF06F7E6F7E150182A65E4B5A15
+07ED0FE0ED3FC090B500FEC7FCA29039FC00FF80ED3FC06F7E6F7E6F7EA9170EA21503923801FC
+1CB538F000FEEE7FF8EE0FE0>47 41 2 0 50]82 dc[<01FF13C0000313E1000F13F9381F80FF
+383F003F003E130F481307A200FC1303A214017EA26C90C7FC13C0EA7FFCEBFFE06C13F86C13FE
+80000714806C14C0C6FC010F13E0EB007FEC1FF0140F140700E01303A46C14E0A26C13076C14C0
+B4EB0F80EBE01F00E3B5120000E113FC38C01FF0>28 41 4 0 37]83 dc[<007FB71280A39039
+807F807FD87C00140F00781507A20070150300F016C0A2481501A5C791C7FCB3A490B612C0A3>
+42 40 2 0 47]84 dc[<B500F0EBFFFEA3D803FCC7EA0380B3AA0001ED07007F0000150E137F6D
+143CD91FC05B90390FF003F06DB55A01001480DA1FFCC7FC>47 41 2 0 52]85 dc[<B500F0EB
+7FFFA3D803FEC7EA01C00001ED0380A26C6CEC0700A26E5B017F140E80013F5C80011F5CA26E13
+78010F14706E13F001075C800103495AA2ECFE0301015CECFF076D91C7FC1587EC7F8EA215DEEC
+3FDC15FC6E5AA26E5AA36E5AA26E5AA2>48 41 1 0 51]86 dc[<B500E0B539E01FFFC0A32803
+FC0003FCC7EA7000A26D6E14F0000102015DA26D6E13016C60A26D6C486D485AA26E48EBC00701
+3F023F91C7FCA2DAE00F6D5A011FD90E1F130EA26D6C486C6C5AA217F8902707F838075BA2DAFC
+78EBFC780103D970031370A2DAFEF0EBFEF00101D9E0015BA26D6C486C6C5AA36E486D5AA36EC7
+6CC8FCA3021E141EA2>66 41 1 0 69]87 dc[<3B7FFFF81FFFE0A3000190C7EAF0006C6D485A
+02C05B017F13036D6C485A6D6C48C7FC150E90380FF81E6D6C5A1538903803FE786D6C5A5D6D5B
+147F6E7EA26E7E81143F81EC7BFE14F3903801E1FF02C07F01036D7EEB078049486C7E010E6D7E
+131E496D7E01386D7E1378496D7E48486D7EB5013F13FCA3>46 41 2 0 51]88 dc[<3803FF80
+000F13F0381F01FC383F80FE147F801580EA1F00C7FCA4EB3FFF3801FC3FEA0FE0EA1F80EA3F00
+127E5AA4145F007E13DF393F839FFC381FFE0F3803F803>30 27 2 0 33]97 dc[<EAFFE0A312
+0FACEBE1FE9038E7FF809038FE07E09038F803F09038F001F89038E000FCA2157EA2157FA8157E
+A315FCA29038F001F89038F803F090389C0FE090380FFF80390E01FC00>32 42 2 0 37]98 dc[
+<EB3FF03801FFFC3803F03E380FC07FEA1F80EA3F00A248133E007E90C7FCA212FEA7127EA212
+7F6CEB03801380001FEB0700380FE00E3803F83C3801FFF838003FC0>25 27 2 0 30]99 dc[<
+EC7FF0A31407ACEB3F873801FFF73807F03F380FC00F381F8007EA3F00A2127EA312FEA8127EA2
+7EA2381F800F380FC01F3907E07FFF3801FFE738007F87>32 42 2 0 37]100 dc[<EB3FC03801
+FFF03803E07C380F803E001F7F130048EB0F80127E15C0A200FE1307A2B6FCA248C8FCA3127EA2
+127F6CEB01C07E390F8003803907C007003803F01E3800FFFCEB3FE0>26 27 2 0 31]101 dc[<
+EB07F8EB3FFCEB7E3E3801FC7FEA03F813F01207143E1400A7B512C0A33807F000B3A3387FFF80
+A3>24 42 2 0 21]102 dc[<90387F80F03901FFE3F83907C0FE1C390F807C7C381F003E151048
+EB3F00A66C133EA26C6C5A6C6C5A3805FFE0380C7F8048C8FC121CA2121E381FFFF814FF6C14C0
+6C14E06C14F0120F383E000748EB01F8481300A4007CEB01F0A2003FEB07E0390FC01F806CB512
+0038007FF0>30 40 2 13 34]103 dc[<EAFFE0A3120FAC147E9038E1FF809038E30FC001E413
+E0EBE80701F813F013F0A213E0B039FFFE3FFFA3>32 42 3 0 37]104 dc[<1207EA0F80EA1FC0
+EA3FE0A3EA1FC0EA0F80EA0700C7FCA7EAFFE0A3120FB3A3EAFFFEA3>15 43 2 0 18]105 dc[<
+EAFFE0A3120FACEC3FF8A3EC0700140E143C5C5CEBE1E0EBE3C0EBE780EBEFC0EBFFE0A2EBF7F0
+EBE3F8EBC1FCA2EBC0FE147FA2EC3F80EC1FC0A239FFFC7FFCA3>30 42 2 0 35]107 dc[<EAFF
+E0A3120FB3B2EAFFFEA3>15 42 2 0 18]108 dc[<26FFC07FEB1FC0903AC1FFC07FF0903AC307
+E0C1F8D80FC49038F101FC9039C803F20001D801FE7F01D05BA201E05BB03CFFFE3FFF8FFFE0A3
+>51 27 3 0 56]109 dc[<38FFC07E9038C1FF809038C30FC0D80FC413E0EBC80701D813F013D0
+A213E0B039FFFE3FFFA3>32 27 3 0 37]110 dc[<EB3FE03801FFFC3803F07E390FC01F80391F
+800FC0393F0007E0A2007EEB03F0A300FE14F8A8007E14F0A26CEB07E0A2391F800FC0390FC01F
+803907F07F003801FFFC38003FE0>29 27 2 0 34]111 dc[<38FFE1FE9038E7FF809038FE0FE0
+390FF803F09038F001F801E013FC140015FEA2157FA8157E15FEA215FC140101F013F89038F803
+F09038FC0FE09038EFFF809038E1FC0001E0C7FCA9EAFFFEA3>32 39 2 12 37]112 dc[<9038
+3F80703901FFE0F03803F071380FC019381F800F123FEB00075AA2127E12FEA8127FA27E138000
+1F130F380FC01F3807F0773801FFE738007F87EB0007A9EC7FFFA3>32 39 2 12 35]113 dc[<
+38FFC3E0EBC7F8EBCC7C380FD8FE13D0A213F0EBE07C1400B0B5FCA3>23 27 2 0 27]114 dc[<
+3803FE30380FFFF0EA3E03EA7800127000F01370A27E00FE1300EAFFE06CB4FC14C06C13E06C13
+F0000713F8C6FCEB07FC130000E0137C143C7E14387E6C137038FF01E038E7FFC000C11300>22
+27 2 0 27]115 dc[<1370A413F0A312011203A21207381FFFE0B5FCA23807F000AD1470A70003
+13E03801F8C0EA00FFEB3F00>20 38 1 0 26]116 dc[<39FFE07FF0A3000F1307B2140FA20007
+13173903F067FF3801FFC738007F87>32 27 3 0 37]117 dc[<39FFFE07FFA33907F000E0A2EB
+F801000314C0A23901FC0380A2EBFE07000014006D5AEB7F0EA2EB3F9CA214FC6D5AA26D5AA36D
+5AA26D5AA2>32 27 1 0 35]118 dc[<3BFFFC7FFC1FFCA33B0FE00FE001C02607F007EB0380A2
+01F8EBF0070003160015F82601FC0F130EA29039FE1FFC1E0000011C131C15FE9039FF387E3C01
+7F1438EC787F6D486C5AA29138E01FF0011F5CA26D486C5AA36D486C5AA2>46 27 1 0 49]119
+dc[<39FFFC1FFEA33907F00780D803F813006C6C5AEBFE1E00005BEB7F78EB3FF85C6D5A130F6D
+7E80130F497EEB3DFEEB38FFEB787F9038F03F80D801E013C03903C01FE0EB800F39FFF03FFFA3
+>32 27 1 0 35]120 dc[<39FFFE07FFA33907F000E0A2EBF801000314C0A23901FC0380A2EBFE
+07000014006D5AEB7F0EA2EB3F9CA214FC6D5AA26D5AA213075CA26D5AA25CA21307003890C7FC
+127CEAFE0EA25B5BEA7C70EA3FE0EA0F80>32 39 1 12 35]121 dc dfe /fh df[<90383F07C0
+9038E0DC603901C0F0F0EA0381390701E06001001300A7B6FC380700E0B2387FC3FE>28 32 0 0
+26]11 dc[<133FEBE0C0EA01C0380381E0EA0701A290C7FCA6B512E0EA0700B2387FC3FE>23 32
+0 0 25]12 dc[<127012F812FCA212741204A31208A21210A212201240>6 14 4 -18 13]39 dc
+[<127012F812FCA212741204A31208A21210A212201240>6 14 4 9 13]44 dc[<127012F8A312
+70>5 5 4 0 13]46 dc[<13011303A21306A3130CA31318A31330A31360A313C0A3EA0180A3EA
+0300A31206A35AA35AA35AA35AA35AA3>16 45 3 11 23]47 dc[<EA03F0EA0E1C487EEA1806EA
+380738700380A400F013C0AD00701380A3EA780700381300EA1806EA1C0E6C5AEA03F0>18 31 2
+1 23]48 dc[<EA01801203120F12F31203B3A6EA07C0EAFFFE>15 30 4 0 23]49 dc[<EA03F0
+EA0C1CEA100E487E00401380128000F013C0EAF803A3EA200712001480A2EB0F00130E5B5B5B13
+605B485A48C7FC000613405A5A00101380EA3FFF5AB5FC>18 30 2 0 23]50 dc[<EA03F0EA0C
+1CEA100EEA200F007813801307A2EA380F12001400A2130E5B5BEA03F0EA003C130E130FEB0780
+A214C0122012F8A300F013801240EB0F00EA200EEA1C3CEA03F0>18 31 2 1 23]51 dc[<1306
+A2130EA2131E132EA2134E138EA2EA010E1202A212041208A212101220A2124012C0B512F03800
+0E00A7EBFFE0>20 30 1 0 23]52 dc[<EA1803EA1FFE5B5B13E00010C7FCA6EA11F0EA161CEA
+180EEA10071480EA0003A214C0A3127012F0A200E013801240EB0700EA2006EA100EEA0C38EA03
+E0>18 31 2 1 23]53 dc[<137CEA0182EA0701380E0380EA0C07121C3838030090C7FC127812
+70A2EAF1F0EAF21CEAF406EAF807EB0380A200F013C0A51270A214801238EB07001218EA0C0E6C
+5AEA01F0>18 31 2 1 23]54 dc[<1240387FFFC01480A238400100EA8002A25B485AA25B5BA2
+5BA213C0A212015B1203A41207A76CC7FC>18 31 3 1 23]55 dc[<EA03F0EA0C0CEA1006EA30
+03382001801260A3127038780300123EEA3F06EA1FC8EA0FF0EA03F8487EEA0C7EEA103F38300F
+80EA6003384001C012C01300A31480EA600100201300EA1002EA0C0CEA03F0>18 31 2 1 23]
+56 dc[<EA03F0EA0E18487E487E13071270EB038012F0A214C0A5EA7007A21238EA180BEA0E13
+EA03E338000380A3EB07001230EA7806130EEA700CEA2018EA1070EA0FC0>18 31 2 1 23]57
+dc[<127012F8A312701200AA127012F8A31270>5 20 4 0 13]58 dc[<EA0FC0EA3070EA4038A2
+EAE03C12F0A21260EA0038137013E013C0EA0180A213005A1202A6C7FCA51207EA0F80A3EA0700
+>14 32 3 0 21]63 dc[<5B497EA3497EA3EB09E0A3EB10F0A3EB2078A3497EA3497EA2EBFFFE
+3801000FA30002EB0780A348EB03C0120E001FEB07E039FFC03FFE>31 32 1 0 34]65 dc[<B5
+12E0380F80380007131E141F801580A515005C141E5CEBFFF0EB803C80801580140715C0A51580
+140F15005C000F133CB512F0>26 31 2 0 32]66 dc[<90380FC04090387030C03801C0093803
+800538070003000E1301001E1300121C123C007C1440A2127800F81400A91278007C1440A2123C
+121C001E1480120E6CEB0100380380026C6C5A38007038EB0FC0>26 33 3 1 33]67 dc[<B512
+E0380F803C00077F1407EC038015C0EC01E0A215F01400A215F8A915F0A3EC01E0A2EC03C01580
+EC0700140E000F133CB512E0>29 31 2 0 35]68 dc[<B6FC380F800F00071303A28015801400
+A314801500A3138113FF13811380A4EC0020A31540A315C0A2EC0180000F130FB6FC>27 31 2 0
+31]69 dc[<B6FC380F800F00071303A28015801400A4EC8000A4138113FF13811380A491C7FCA8
+487EEAFFFE>25 31 2 0 30]70 dc[<90380FE02090387818609038E004E03803800238070001
+481300001E1460A25A1520127C127800F81400A7EC7FFCEC03E000781301127C123CA27EA27E7E
+380380023900E00460903878182090380FE000>30 33 3 1 36]71 dc[<39FFF8FFF8390F800F
+8000071400AC90B5FCEB800FAE000F148039FFF8FFF8>29 31 2 0 34]72 dc[<EAFFFCEA0FC0
+EA0780B3A9EA0FC0EAFFFC>14 31 1 0 16]73 dc[<39FFFC0FFC390FC003E039078001801500
+14025C5C5C5C5C5C0181C7FC1383EB8780138FEB93C0EB91E013A1EBC0F01380147880A280A280
+EC0780A215C0D80FC013E039FFFC3FFC>30 31 2 0 35]75 dc[<EAFFFEEA0FC06C5AB21402A4
+14061404A2140C141C000F137CB512FC>23 31 2 0 28]76 dc[<B46CEB1FF8000F1580000715
+00D805C0132FA3D804E0134FA20170138FA3903838010FA3EB1C02A3EB0E04A3EB0708A3EB0390
+A2EB01E0A3380E00C0001FEC1F803AFFE0C1FFF8>37 31 2 0 42]77 dc[<39FF803FF83907C0
+07C0EC03803905E00100A2EA04F01378A2133CA2131E130FA2EB0781A2EB03C1EB01E1A2EB00F1
+A21479143DA2141FA28080A2000E7F121F38FFE001>29 31 2 0 34]78 dc[<EB1F80EBF0F038
+01C0383807801E48487E000E7F001E148048EB03C0A2007C14E000781301A200F814F0A9007814
+E0007C1303A2003C14C0A26CEB0780000E1400000F5B3807801E3801C0383800F0F0EB1F80>28
+33 3 1 35]79 dc[<B512E0380F80780007131C141E801580A61500141E141C1478EBFFE00180
+C7FCAD487EEAFFFC>25 31 2 0 31]80 dc[<EB1F80EBF0F03801C0383807801E48487E000E7F
+001E148048EB03C0A2007C14E0A20078130100F814F0A9007814E0A2007C1303003C14C0130F39
+1E108780390E20C700000F13CF3807A0FE3801E0F83900F0F010131FEB0070EC7830EC3870EC3F
+F015E0141FEC0FC0EC0780>28 41 3 9 35]81 dc[<B57E380F80F0000713788080A2141FA414
+1EA25C5C5CEBFF80EB81C0EB80E08014701478A3147CA31504147E143E390FC01E0839FFFC0F10
+C7EA03E0>30 32 2 1 33]82 dc[<3807E080EA0C19EA1007EA3003EA6001A212E01300A36C13
+00A21278127FEA3FF0EA1FFC6C7EEA03FF38001F801307EB03C0A213011280A400C01380130300
+E01300EAF006EACE0CEA81F8>18 33 3 1 25]83 dc[<007FB512E038780F010060EB00600040
+1420A200C0143000801410A400001400B3497E3807FFFE>28 31 2 0 33]84 dc[<39FFFC3FF8
+390FC007C03907800380EC0100B3A300031302A2EA01C05C6C6C5AEB7018EB3820EB0FC0>29 32
+2 1 34]85 dc[<39FFF003FE391F8000F86CC712607F00071440A26C6C1380A33901E00100A213
+F000001302A2EBF806EB7804A26D5AA36D5AA2EB1F30EB0F20A2EB07C0A36D5AA36DC7FC>31 32
+1 1 34]86 dc[<3BFFF07FF81FF03B1F800FC007C03B0F0007800380EE010015C0D807801402A3
+3A03C009E004A39039E010F00C00011508A2EC2078D800F05CA2EC403C01785CA2ECC03E90393C
+801E40A390391F000F80A3011E1307010E91C7FCA2010C7F01041302>44 32 1 1 47]87 dc[<
+397FF81FF8390FE00FC03907C00700000313026C6C5AEBF00C00001308EB7810137CEB3C20EB3E
+40131E6D5AA213076D7E497E1305EB09F0EB18F8EB1078EB207CEB603CEB401EEB801F00017F90
+38000780000214C000071303391F8007E039FFE01FFE>31 31 1 0 34]88 dc[<39FFF003FF39
+1F8000F8000F1460000714407F6C6C138012019038F0010000005BEBF802EB7C04133CEB3E0813
+1EEB1F10EB0FB0EB07A014C01303AB1307EB7FFE>32 31 1 0 34]89 dc[<EA1FE0EA3030EA78
+18131CEA300E1200A313FEEA078EEA1E0E1238127800F01310A3131E127838386720380F83C0>
+20 20 2 0 23]97 dc[<120E12FE120EAA133EEBC380380F01C0EB00E0120E1470A21478A61470
+A214E0120F380D01C0380CC300EA083E>21 32 1 0 25]98 dc[<EA03F8EA0E0CEA1C1E123813
+0CEA7000A212F0A61270A2EA3801A2EA1C02EA0E0CEA03F0>16 20 2 0 20]99 dc[<EB038013
+3F1303AAEA03E3EA061BEA1C07EA3803A21270A212F0A61270A212381307121CEA0E1B3803E3F8
+>21 32 2 0 25]100 dc[<EA03F0EA0E1C487E487EA21270EB038012F0A2B5FC00F0C7FCA31270
+A26C13801218381C0100EA0706EA01F8>17 20 1 0 20]101 dc[<137C13C6EA018F1203EA0706
+1300A7EAFFF0EA0700B2EA7FF0>16 32 0 0 14]102 dc[<14E03803E330EA0E3CEA1C1C38380E
+00EA780FA5EA380E6C5AEA1E38EA33E00020C7FCA21230A2EA3FFE381FFF806C13C0383001E038
+600070481330A4006013606C13C0381C03803803FC00>20 31 1 10 23]103 dc[<120E12FE12
+0EAA133E1343EB8180380F01C0A2120EAE38FFE7FC>22 32 1 0 25]104 dc[<121C123EA3121C
+C7FCA6120E127E120EB1EAFFC0>10 31 0 0 12]105 dc[<120E12FE120EAAEB0FF0EB03C01400
+13025B5B5B1330137013F8EA0F38EA0E1C131E130E7F1480130314C014E038FFCFF8>21 32 1 0
+24]107 dc[<120E12FE120EB3ABEAFFE0>11 32 0 0 12]108 dc[<390E1F01F039FE61861839
+0E81C81C390F00F00EA2000E13E0AE3AFFE7FE7FE0>35 20 1 0 38]109 dc[<EA0E3EEAFE4338
+0E8180380F01C0A2120EAE38FFE7FC>22 20 1 0 25]110 dc[<EA01F8EA070E381C0380383801
+C0A2387000E0A200F013F0A6007013E0A2383801C0A2381C038038070E00EA01F8>20 20 1 0
+23]111 dc[<EA0E3E38FEC380380F01C0EB00E0120E14F014701478A6147014F014E0EA0F0114
+C0380EC300133E90C7FCA8EAFFE0>21 29 1 9 25]112 dc[<3803E080EA0619EA1C05EA3C07EA
+38031278127012F0A61270127812381307EA1C0BEA0E13EA03E3EA0003A8EB3FF8>21 29 2 9
+24]113 dc[<EA0E78EAFE8CEA0F1EA2130CEA0E00AEEAFFE0>15 20 1 0 18]114 dc[<EA1F90
+EA3070EA4030EAC010A3EAE0001278EA7F80EA3FE0EA0FF0EA0070EA80381318A212C0A2EAE030
+EAD060EA8F80>13 20 2 0 18]115 dc[<1202A31206A2120EA2123EEAFFF8EA0E00AB1308A5EA
+06101203EA01E0>13 28 1 0 18]116 dc[<380E01C0EAFE1FEA0E01AE13031206EA030D3801F1
+FC>22 20 1 0 25]117 dc[<38FF83F8381E01E0381C00C06C1380A338070100A2EA0382A3EA01
+C4A213ECEA00E8A21370A31320>21 20 1 0 24]118 dc[<39FF9FE1FC393C078070391C030060
+EC8020000E1440A214C0D807071380130414E039038861001471EBC8733801D032143A3800F03C
+EBE01CA2EB6018EB4008>30 20 1 0 33]119 dc[<387FC3FC380F01E0000713C0148038038100
+EA01C2EA00E413EC13781338133C137C134E1387EA010738030380380201C0000613E0121E38FF
+03FE>23 20 0 0 24]120 dc[<38FF83F8381E01E0381C00C06C1380A338070100A2EA0382A3EA
+01C4A213ECEA00E8A21370A31320A25BA3EAF080A200F1C7FC1262123C>21 29 1 9 24]121 dc
+[<EA3FFFEA380E1220131CEA403813781370EA00E0120113C0EA038012071301120E121EEA1C03
+EA3802EA7006130EEAFFFE>16 20 1 0 20]122 dc dfe end
+ TeXDict begin @letter
+%%Page: 181 183
+ bop 0 -58 a fh(General)16 b(Index)1602 b(181)0 183 y ff(General)15 b(Index)4
+425 y 21 3 v 2 491 a 12 2 v 12 w fd(FillV)n(alue)g(attribute)8 b fc(:)e(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd(116)0 618 y fg(A)0 685 y fd
+(abnormal)15 b(termination)7 b fc(:)f(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18
+b fd(34)0 743 y(ab)r(orting)c(de\014ne)g(mo)q(de)d fc(:)6 b(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)23 b fd(40)0 801 y(ab)r(orting)14 b(de\014nitions)d fc
+(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)20 b fd(59)0 859 y(abs\
+tract)14 b(data)f(t)o(yp)r(e)c fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)21 b fd(5)0 917 y(add)s 12 2 v 12 w(o\013set)13 b(attribute)d
+fc(:)c(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd(20)0 975 y(add\
+ing)15 b(attributes)6 b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)16
+b fd(38,)d(49)0 1033 y(adding)i(dimensions)f fc(:)6 b(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)24 b fd(38,)13 b(49)0 1091 y(adding)i(v)n(ariables)7 b fc(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(38,)c(49)0 1150 y(ancillar\
+y)j(data)9 b fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)20
+b fd(18,)13 b(22)0 1208 y(app)r(ending)i(data)7 b fc(:)f(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)20 b fd(14,)12 b(30,)h(65,)g(75,)g(96,)g(148,)g(152)0
+1266 y(arc)o(hive)g(formats)d fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)22 b fd(7)0 1324 y(ASCI)q(I)12 b(c)o(haracters)f fc
+(:)c(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)22 b fd(25)0 1382 y
+(attribute)14 b(conv)o(en)o(tions)e fc(:)6 b(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)23 b fd(20)0 1440 y(attribute)14 b(deletion)9 b fc(:)d(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(139)0 1498 y(attribute)14 b(ID)9 b
+fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)21 b fd(139)0 1556 y(attribute)14 b(inquire)8 b fc(:)e(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)18 b fd(129)0 1614 y(attribute)c(length)8 b
+fc(:)e(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)19 b fd(19,)13 b(112,)g(125,)
+g(130,)g(133,)g(155)0 1673 y(attribute)h(names)6 b fc(:)g(:)18 b fd(18,)13 b
+(119,)g(125,)g(126,)g(128,)g(129,)g(130,)g(133,)77 1731 y(139,)g(142,)g(144)0
+1789 y(attribute)h(n)o(umb)q(ers)c fc(:)c(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)23 b fd(139)0 1847 y(attribute)14 b(op)r(erations)e fc(:)7 b(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fd(125)0 1905 y(attribute)14 b(space)
+e fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)23 b fd
+(125)0 1963 y(attribute)14 b(t)o(yp)r(e)c fc(:)c(:)g(:)g(:)g(:)23 b fd(18,)13
+b(19,)g(125,)g(126,)g(128,)g(130,)g(133,)g(155)0 2021 y(attribute)h(v)n(alues)
+d fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)21 b fd(19,)13 b(22,)
+g(125,)g(126,)g(132,)g(134)0 2079 y(attribute)h(v)n(ariable)h(ID)7 b fc(:)f
+(:)g(:)g(:)g(:)g(:)20 b fd(130,)13 b(132,)g(139,)g(140,)g(144,)g(145)0 2137 y
+(attributes)7 b fc(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)18 b fd(18,)13 b(19,)f(22,)h(34,)g(36,)g(38,)g(125)0 2196 y
+(a)o(v)n(ailabil)q(it)r(y)g(of)g(netCDF)g(soft)o(w)o(are)t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(:)h(:)f(:)17 b fd
+(154)0 2679 y(b)o(yte)c(t)o(yp)r(e)c fc(:)d(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)22 b fd(25,)13 b(155)1015 425 y(byte)g(vs.)
+k(c)o(haracter)11 b fc(:)6 b(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)23
+b fd(115)1015 579 y fg(C)1015 645 y fd(C)13 b(interface)t fc(:)6 b(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)17 b fd(3)1015 703 y(C,)c(generation)i(of)10 b fc(:)c(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)22 b fd(157)1015 762 y(C)s 12 2 v 11 w(for\
+mat)13 b(attribute)7 b fc(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)18 b fd(21)1015 820 y(C)p fb(++)12 b fd(interface)f fc(:)6 b(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(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:)f(:)g(:)18 b fd(13,)12 b(157)1015 1168 y(CDL)h(attribu\
+te)i(initializa)q(tion)9 b fc(:)d(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)17 b fd(155)1015 1226 y(CDL)c(attr\
+ibutes)e fc(:)c(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)22 b fd(152,)13 b(153)
+1015 1285 y(CDL)g(constants)f fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)23 b fd(155)1015 1343 y(CDL)13 b(data)h(t)o(yp)q(es)d
+fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)22 b fd(154)
+1015 1401 y(CDL)13 b(dimensions)d fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)18 b fd(152)1015 1459 y(CDL)13 b(example)c fc(:)d(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd(13,)12 b(151)1015 1517 y
+(CDL)h(names)7 b fc(:)g(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)19 b fd(14,)12 b(153)1015 1575 y(CDL)h(notation)c fc(:)d(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)19 b fd(13,)13 b(19)1015 1633 y
+(CDL)g(reserved)g(w)o(ords)t fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)16 b fd(25,)c
+(154)1015 1691 y(CDL)h(syntax)c fc(:)e(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)21 b fd(151)1015 1749 y(CDL)13 b(v)n(ariab\
+le)i(declarations)7 b fc(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)16 b fd(17)1015 1808 y(CDL)
+d(v)n(ariable)i(initial)q(izati)q(on)10 b fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(153)
+1015 1866 y(CDL)13 b(v)n(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)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)16 b fd(112)1015 2214 y(c)o(haracter)e(strings)7 b fc
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(112)1015
+2273 y(c)o(haracter)c(t)o(yp)r(e)7 b fc(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd(155)1015 2331 y(c)o(haracter)14 b(vs.)
+j(byte)10 b fc(:)c(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fd
+(115)1015 2389 y(c)o(haracter-p)s(osition)14 b(dimension)e fc(:)6 b(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)20 b fd(112,)13 b(113)
+1015 2447 y(c)o(haracter-string)i(attributes)d fc(:)6 b(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)22 b fd
+(112)1015 2505 y(c)o(haracter-string)15 b(v)n(alues)9 b fc(:)d(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)19 b fd(113)1015 2563 y(closing)d(a)d(netCDF)g(\014le)5 b
+fc(:)h(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)16 b fd(36,)d(53,)g(57,)g(59)1015 2621 y(closing)j(\014les)9 b fc(:)d
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)21 b fd(34)1015 2679 y(common)14 b(netCDF)f(calls)f fc(:)6 b(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)23 b fd(33)p eop
+%%Page: 182 184
+ bop 0 -58 a fh(182)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fd(computing)g
+(en)o(vironmen)q(ts)7 b fc(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)19 b fd(164)0 241 y
+(concurrency)12 b fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)23 b fd(148)0 299 y(conv)o(en)o(tional)15 b(attributes)
+9 b fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd(18,)13 b(20)0 358 y(conv)o(en)o(tions)
+h(in)g(examples)5 b fc(:)h(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)16 b fd(43)0 416 y
+(co)q(ordinate)f(o\013set)e(vector)c fc(:)d(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)22
+b fd(29)0 474 y(co)q(ordinate)15 b(v)n(ariables)9 b fc(:)d(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)19 b fd(16,)13 b(152)0 532 y(co)q(ordinates)d fc(:)c(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)20 b fd
+(16)0 590 y(copying)14 b(attributes)d fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)22 b fd(136)0 648 y(creating)14 b(a)f(dimension)c fc(:)d
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(66)0 706 y(creating)14 b
+(a)f(netCDF)h(\014le)8 b fc(:)e(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(33,)13 b(45,)g(59)0 764 y(crea\
+ting)h(a)f(v)n(ariable)e fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)20 b fd(76)0 823 y(creating)14 b(attributes)8 b fc(:)e(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(126)0 976 y fg(D)0 1043 y fd(data)13 b
+(compression)f fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)22 b fd(20)0 1101 y(data)13 b(loss)6 b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)16 b fd(34)0
+1159 y(data)d(mo)r(de)t fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(34,)12 b(39,)h(51,)g(57,)g(59,)
+g(125)0 1217 y(data)g(order)d fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)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 b(t)o(yp)r(es)8 b fc(:)e(:)g(:)g(:)21 b fd(17,)13 b
+(76,)g(77,)f(81,)h(83,)g(85,)g(86,)g(89,)g(94,)g(95,)f(99,)77 1624 y(100,)h
+(103,)g(108,)g(120,)g(126,)g(129,)g(130)0 1682 y(database)h(managemen)q(t)e
+(systems)5 b fc(:)h(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)16 b fd(5,)d(18)0 1740 y(default)h(error)f(handling)8 b fc(:)e
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)17 b fd(40)0 1798 y(default)d(\014ll)h
+(v)n(alues)d fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)23 b fd
+(115)0 1856 y(de\014ne)14 b(mo)q(de)5 b fc(:)i(:)f(:)g(:)g(:)g(:)17 b fd(34,)
+c(39,)g(49,)g(51,)g(57,)f(59,)h(65,)g(75,)g(76,)g(125)0 1914 y(de\014ning)i
+(attributes)9 b fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd
+(126)0 1973 y(de\014ning)15 b(co)q(ordinate)g(systems)9 b fc(:)d(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)21 b fd(16)0 2031 y(deleting)15 b(a)e(netCDF)g(\014le)f fc(:)6 b(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fd(59)0 2089 y(deleting)15 b(attributes)7 b fc
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)18 b fd(38,)13 b(49,)g(144)0 2147 y(di\013erences)i
+(b)q(et)o(w)o(een)e(attributes)i(and)e(v)n(ariables)f fc(:)7 b(:)f(:)g(:)g
+(:)g(:)g(:)g(:)22 b fd(22)0 2205 y(dimension)16 b(ID)8 b fc(:)e(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd(65)0 2263 y
+(dimension)16 b(IDs)8 b fc(:)e(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd(36,)13 b(38,)g(66,)f(68,)h(70,)g(76)0 2321
+y(dimension)j(inquire)8 b fc(:)e(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)18 b fd(70)0 2379 y(dimension)e(name)11 b fc(:)6 b(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fd(65)0 2438 y(dimension)16 b
+(names)11 b fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)23 b fd(14,)13 b(66,)g(68,)f(70,)h(71,)g(73)0 2496 y(dimension)j(size)10 b
+fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)22 b fd(14,)12 b(65,)h(66,)g(70)0 2554 y(dimen\
+sions)g fc(:)6 b(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)23 b fd(14,)13 b(19,)g(34,)f(36,)h(38,)g(65)0 2612 y
+(double)i(CDL)e(t)n(yp)r(e)c fc(:)d(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)21 b fd(17)0 2670 y(double)15 b(constant)t fc(:)6 b(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)16 b fd(156)1015 183 y(dou\
+ble)f(t)o(yp)r(e)c fc(:)6 b(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)23 b fd(25,)13 b(154,)g(155,)g
+(156)1015 306 y fg(E)1015 373 y fd(e\016ciency)6 b fc(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)16 b fd(6,)d(30,)g
+(34,)g(36,)g(57,)g(61,)f(146)1015 431 y(error)i(conditions)8 b fc(:)e(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(43)1015 489 y
+(error)c(handling)e fc(:)6 b(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)22 b fd(40)1015 547 y(error)14 b(messages)8 b fc(:)e(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd(40)
+1015 605 y(error)14 b(options)6 b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(40)1015 663 y(error)d(returns)
+6 b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)18 b fd(40)1015 722 y(example)d(con)o(ven)o(tions)9 b fc(:)d(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd(43)1015 780 y(examples)12 b fc
+(:)6 b(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)23 b fd(43)1015 838 y(exp)r(ense)14 b(of)e(op)r(erations)d
+fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)19 b fd(147)1015 896 y(external)c
+(data)e(representation)h(\(XDR\))8 b fc(:)f(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)20 b fd(6)1015 1019 y fg(F)1015 1086 y fd(fata\
+l)14 b(errors)e fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fd(40)1015 1144 y(\014le)14 b(size)9 b fc(:)d
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)19 b fd(147)1015 1202 y(\014le)14 b(structure)5 b fc(:)h(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)16 b fd
+(146)1015 1260 y(\014ll)f(v)n(alues)d fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fd(21,)12 b(115)1015 1318 y(FillV)
+o(alue)i(attribute)8 b fc(:)e(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)20 b fd(21)1015 1376 y(\014xed-length)c(c)o(haracter)d(strings)g fc(:)6 b
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)24 b fd(112)1015 1434 y(\014xed-size)15 b(data)f(part)9 b fc(:)d(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)21 b fd(147)1015 1492 y(\014xed-size)15 b
+(strings)10 b fc(:)c(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd(112,)13 b(113)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(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)24 b fd(148)1015 1899 y(format)t fc(:)6 b(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)16 b fd(146)
+1015 1957 y(F)o(OR)m(TRAN)d(interface)7 b fc(:)f(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)20 b fd(3)1015 2015 y(F)o(OR)m(TRAN,)12 b(generation)j(of)
+5 b fc(:)h(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(157)1015 2074 y(F)o(OR)m(TRAN)r 12 2 v
+12 w(format)c(attribute)c fc(:)d(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)21 b fd(22)1015 2132 y(FTP)13 b
+(access)7 b fc(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)18 b fd(163)1015 2190 y(function)d(protot)o(yp)r(es)8 b fc
+(:)e(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)20 b fd(43)1015 2248 y(fut\
+ure)14 b(c)o(hanges)g(planned)e fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)22 b fd(5,)13 b(25,)f(155)1015 2306
+y(F)m(uture)i(Plans)5 b fc(:)h(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(10)1015 2429 y fg(G)1015 2496 y fd(gen\
+eralized)f(h)o(yp)r(erslab)e(access)6 b fc(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)18 b fd(91,)12 b(105)1015 2554 y
+(generalized)k(h)o(yp)r(erslabs)11 b fc(:)6 b(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)23 b fd(28)1015 2612 y(generating)15 b(co)r(de)5 b fc(:)h(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(157)1015 2670 y(generating)
+e(netCDF)f(\014les)6 b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(157)p eop
+%%Page: 183 185
+ bop 0 -58 a fh(General)16 b(Index)1602 b(183)0 183 y fd(generic)14 b(applica\
+tion)q(s)c fc(:)c(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)20 b fd(18,)13 b(20,)f(22,)h
+(35,)g(36,)g(65,)g(139)0 241 y(generic)h(\014lters)c fc(:)c(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd(22)0 299 y(get\
+ting)14 b(attribute)g(name)6 b fc(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd
+(139)0 358 y(getting)c(attribute)g(v)n(alues)c fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)20 b fd(132)0 416 y(getting)14 b(c)o(haracter)g(string)g(data)7 b fc(:)f
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)19 b fd(112)0 474 y(getting)14 b(dimension)i(ID)11 b fc(:)6 b(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fd(68)0 532 y(getting)14 b(dimension)i
+(name)6 b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(70)0 590 y(getting)c
+(dimension)i(size)c fc(:)6 b(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fd(70)0
+648 y(getting)14 b(v)n(ariable)h(data)7 b fc(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)18 b fd(98)0 706 y(getting)c(v)n(ariable)h(name)8 b fc(:)e(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)19 b fd(81)0 764 y(getting)14 b(v)n(ariabl\
+e)h(shap)r(e)5 b fc(:)h(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(81)0
+823 y(getting)d(v)n(ariable)h(t)o(yp)r(e)6 b fc(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)19 b fd(81)0 881 y(global)c(attributes)d fc(:)6 b(:)g(:)23
+b fd(18,)13 b(19,)g(55,)g(125,)g(126,)g(129,)g(130,)g(133,)77 939 y(153)0 997
+y(grouping)i(v)n(ariables)e fc(:)6 b(:)g(:)g(:)g(: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 b fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)20 b fd(36,)13 b(87,)g(101,)g(112)0 1535 y(h)o(yp)r(erslab)
+h(access)g(example)e fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fd(26)0 1593 y(h)o
+(yp)r(erslab)14 b(corner)8 b fc(:)e(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(26,)13 b(27,)g(28,)g
+(112)0 1651 y(h)o(yp)r(erslab)h(edge)g(lengths)8 b fc(:)e(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(26,)13 b(27,)g(28,)g(112)0
+1710 y(h)o(yp)r(erslabs)8 b fc(:)e(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)19 b fd(26)0 1833 y fg(I)0 1899 y
+fd(IEEE)13 b(\015oating-p)s(oint)e fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)23 b fd(6,)13 b(25)0 1957 y(index)h(mapping)h(vector)7 b fc(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)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(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)18 b fd(55)0 2364 y(inquire)d(functions)7 b fc(:)f(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(36)0 2422 y(inquiring)
+e(ab)r(out)d(records)c fc(:)d(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd(122)0 2480 y
+(interface)13 b(descriptions)h fc(:)6 b(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)24 b fd(43)0 2604 y fg(K)0 2670 y fd(known)13 b(names)8 b fc(:)e(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd(35)
+1015 183 y fg(L)1015 250 y fd(language)15 b(interfaces)5 b fc(:)h(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(28)1015 308 y(languages)f(supp)
+r(orted)10 b fc(:)c(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)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015 792 y fd(MAX)s 12 2 v 11 w(NC)r 12 2 v 11 w(DIMS)9 b fc(:)d(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd(65)1015 850 y(maxi\
+m)q(um)13 b(dimensions)d fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)20 b fd
+(76)1015 908 y(maxim)q(um)13 b(name)g(length)5 b fc(:)h(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)16 b fd(81,)c(82,)h(139,)g(140)1015 966
+y(maxim)q(um)g(n)o(um)o(b)r(er)g(of)f(dimensions)h fc(:)6 b(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)22 b fd(65)1015 1024 y
+(maxim)q(um)13 b(n)o(um)o(b)r(er)g(of)f(records)c fc(:)e(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)20 b fd
+(70)1015 1082 y(maxim)q(um)13 b(v)n(ariable)i(dimensions)7 b fc(:)f(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)17 b fd(76,)c(77,)g(81,)g(83)1015 1140 y(missi\
+ng)i(v)o(alues)t fc(:)7 b(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(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20 b fd(13)1015 1973 y(netCDF)14 b(com\
+p)q(onents)7 b fc(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd(13)
+1015 2031 y(netCDF)14 b(data)f(t)o(yp)r(es)f fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)25 b fd(25,)12 b(119)1015 2089 y(netCDF)i(dimensions)8 b fc(:)e(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(13)1015 2147 y(netCDF)14 b(dis\
+k)g(representation)7 b fc(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(112)1015 2205 y(netCDF)c(\014l\
+e)g(creation)e fc(:)6 b(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fd(33,)13 b(45)1015
+2263 y(netCDF)h(\014le)g(extension)6 b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)16 b fd(157)1015 2321 y(netCDF)e(\014le)g(name)5 b fc(:)h(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(43)1015 2379 y(netCDF)c(\014le)
+g(size)t fc(:)6 b(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)16 b fd(112,)d(113)
+1015 2438 y(netCDF)h(\014le)g(structure)7 b fc(:)f(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)19 b fd(146)1015 2496 y(netCDF)14 b(format)6 b fc(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)18 b fd(146)1015 2554 y(netCDF)
+c(handle)c fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)21 b fd(43)1015 2612 y(netCDF)14 b(ID)d fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fd(43,)13 b(53)1015 2670 y(netCDF)
+h(implemen)q(tation)d fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fd(65)p eop
+%%Page: 184 186
+ bop 0 -58 a fh(184)1442 b(NetCDF)14 b(User's)h(Guide)0 183 y fd(netCDF)e(lib\
+rary)i(use)9 b fc(:)d(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd
+(33)0 241 y(netCDF)13 b(names)f fc(:)6 b(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fd(14)0 299 y(netCDF)13 b(op)r(erations)f fc
+(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fd(43)0 358 y(net\
+CDF)13 b(v)n(ariables)d fc(:)c(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)20 b fd(13)0 416 y(netCDF,)13 b(development)g(of)c fc(:)d(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)21 b fd(7)0 474 y(net)o(w)o(ork)13 b(Common)g(Data)h
+(F)m(orm)f(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g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(55)0 881 y(n)o(umb)q
+(er)13 b(of)g(global)i(attributes)c fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)22 b fd(55)0 939 y
+(n)o(umb)q(er)13 b(of)g(records)g(written)5 b fc(:)h(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)16
+b fd(70)0 997 y(n)o(umb)q(er)d(of)g(v)n(ariables)c fc(:)d(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)19 b fd(55)0 1055 y(n)o(umeric)14 b(v)n(alues)6 b
+fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd
+(113)0 1178 y fg(O)0 1245 y fd(obtaining)f(netCDF)d(soft)o(w)o(are)d fc(:)c
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)23 b fd(163)0 1303 y(op)r(ening)14 b(a)f(netCDF)g(\014le)7 b fc
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(36,)13 b(47)0 1361 y(op)r(erating)h(system\
+s)f(supp)s(orted)c fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd(5)0 1419 y(order)13 b(of)g(dat\
+a)f fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)24 b fd(28)0 1477 y(order)13 b(of)g(dimensions)e fc(:)6 b(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)20 b fd(30)0 1600 y fg(P)0 1667 y fd(parts)
+13 b(of)g(a)g(netCDF)g(\014le)f fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)23 b fd
+(147)0 1725 y(p)q(erformance)6 b fc(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)18 b fd(6,)13 b(30,)g(34,)f(36,)h(38,)g(57,)g(61,)g(146)0 1783
+y(platform-sp)r(eci\014c)h(optimization)q(s)9 b fc(:)d(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(150)0 1841 y
+(platforms)7 b fc(:)f(:)g(:)g(:)g(:)g(:)g(:)g(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)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)22 b fd(21)0 2190 y(putting)15 b(c)o(haracter)e(string)h(data)t fc
+(:)7 b(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)16 b fd(112)0 2248 y(putting)f(v)n(ariable)g(data)5 b fc(:)h
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(84,)c(87,)g(91,)g
+(101,)g(105)0 2371 y fg(R)0 2438 y fd(reading)i(a)e(netCDF)g(\014le)7 b fc
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)18 b fd(35)0 2496 y(reading)d(a)e
+(record)c fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)21 b fd
+(110)0 2554 y(reading)15 b(c)o(haracter)e(string)h(data)5 b fc(:)h(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)16
+b fd(112)0 2612 y(reading)f(data)5 b fc(:)h(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(98,)c
+(101,)g(105,)g(112)0 2670 y(record)h(dimension)c fc(:)c(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)20 b fd(14,)13 b(65,)f
+(66,)h(70,)g(75)1015 183 y(record)h(I/O)t fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)17 b fd(30,)12 b(96,)h(110,)g(122)1015 241 y(record)h(v)n(ariables)9 b
+fc(:)d(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)19 b fd(14,)13 b(18,)g(30,)g(37)1015 299 y(record-\
+data)h(part)8 b fc(:)e(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)19 b fd(147)1015 358 y(record-orien)q(ted)13 b(access)7 b fc(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)18 b fd(30)1015 416 y(recording)d(data)f(histo\
+ry)e fc(:)6 b(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fd(22)1015 474 y(records)
+9 b fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)20 b fd(30,)13 b(65,)g(70)1015 532 y(relating)i(v)o(ariables)e fc(:)6 b
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)24 b fd(16)1015 590 y
+(relational)16 b(database)e(systems)e fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)23 b fd
+(5)1015 648 y(removing)14 b(attributes)7 b fc(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)17 b fd(144)1015 706 y(renaming)e(attributes)d fc(:)6 b(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)23 b fd(38,)13 b(49,)f(142)1015 764 y(renaming)j(dimensions)e fc(:)7 b
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)23 b fd(38,)13 b(49,)g(73)1015 823 y(renaming)i(v)n(ariables)f fc
+(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)24 b fd(38,)13 b(49,)f(117)1015 881 y(represen)q(tatio\
+n)i(on)f(disk)g fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)24 b fd(30)1015 939
+y(restoring)15 b(old)f(de\014nitions)c fc(:)c(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)20
+b fd(40)1015 1070 y fg(S)1015 1136 y fd(scalar)15 b(v)n(ariables)d fc(:)6 b
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fd(17)
+1015 1194 y(scale)t 12 2 v 11 w(factor)13 b(attribute)6 b fc(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(20)1015 1252 y(scaling)f(data)c fc(:)6
+b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)25
+b fd(20)1015 1310 y(SeaSpace)15 b(CDF)6 b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(8)1015 1369 y(self-describ\
+in)q(g)6 b fc(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(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:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)19 b fd(28)1015 2066 y(string)
+c(length,)f(actual)d fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)22 b fd
+(113)1015 2124 y(string)15 b(length,)f(declared)c fc(:)c(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)20 b fd(113)1015 2182 y(string-valued)14 b(attributes)d fc(:)6 b
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)22 b fd(19)1015 2240 y(subscript)15 b(order)7 b
+fc(:)f(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(26,)13 b
+(27)1015 2298 y(suppressing)j(error)d(messages)8 b fc(:)e(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20
+b fd(40)1015 2356 y(synchronize)15 b(a)e(netCDF)g(\014le)6 b fc(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)18 b fd(57)1015 2487 y fg(T)1015 2554 y fd(title)d(attribute)6
+b fc(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)18 b fd(22)1015 2612 y(trees)5 b fc(:)h(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)17
+b fd(30)1015 2670 y(t)o(yp)r(e)c(lengths)d fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd(119)p eop
+%%Page: 185 187
+ bop 0 -58 a fh(General)16 b(Index)1602 b(185)0 183 y fd(t)o(ypical)15 b(netC\
+DF)e(calls)c fc(:)d(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)19 b fd(33)0
+291 y fg(U)0 358 y fd(Unidata)14 b(CDF)f(W)m(orkshops)g fc(:)6 b(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)23 b fd(8)0 416 y(units)14 b(attribute)6 b fc(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)16 b fd(18,)d(20,)g(22)0 474 y(unlimited)j(dimensi\
+on)e fc(:)6 b(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)24 b fd(14,)13 b(15,)g(17,)g(65,)
+f(66,)h(70,)g(75)0 532 y(unlimited)j(dimension)f(ID)c fc(:)6 b(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)23 b fd(55,)13 b(56)0 590 y(unsigned)d fc(:)c(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20 b fd(21,)13 b(25)0 698 y fg
+(V)0 764 y fd(v)n(alid)t 12 2 v 12 w(max)g(attribute)d fc(:)c(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)20 b fd(20)0 823 y(v)n(alid)t 12 2 v 12 w(min)
+14 b(attribute)t fc(:)6 b(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)16
+b fd(20)0 881 y(v)n(alid)t 12 2 v 12 w(range)d(attribute)8 b fc(:)e(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)19 b fd(20)0 939 y(v)n(ariable)14 b fc(:)6
+b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)24 b fd(137)0 997 y(v)n(ariable)15 b(attributes)e fc(:)6 b(:)g(:)g
+(:)23 b fd(17,)13 b(18,)g(19,)g(81,)g(82,)g(126,)g(129,)g(153)0 1055 y(v)n
+(ariable)i(data)9 b fc(:)d(:)g(:)g(:)20 b fd(36,)13 b(84,)g(85,)g(87,)g(89,)g
+(91,)g(94,)g(98,)f(99,)h(101,)77 1113 y(103,)g(105,)g(107,)g(127)0 1171 y(v)n
+(ariable)i(data)f(t)n(yp)r(es)e fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)24 b fd(17)0 1229 y(v)n(ariable)15 b(data)f(v)n(alues)6 b fc(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)18 b fd(17)0 1287 y(v)n(ariabl\
+e)d(dimensions)f fc(:)6 b(:)24 b fd(81,)12 b(82,)h(84,)g(85,)g(87,)g(89,)g
+(91,)g(94,)f(98,)77 1346 y(99,)h(101,)g(103,)g(105,)g(107,)g(127)0 1404 y(v)n
+(ariable)i(ID)8 b fc(:)e(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)20
+b fd(75,)13 b(76,)g(79)0 1462 y(v)n(ariable)i(IDs)c fc(:)6 b(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)23 b fd(36)1015 183
+y(v)o(ariable)15 b(indices)e fc(:)6 b(:)g(:)g(:)g(:)24 b fd(84,)13 b(85,)g
+(87,)f(89,)h(91,)g(94,)g(98,)g(99,)g(101,)1092 241 y(103,)g(105,)g(107,)g(127)
+1015 299 y(v)o(ariable)i(inquire)9 b fc(:)d(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)20 b fd(81)1015 358 y(v)o(ariable)15 b(name)10
+b fc(:)c(:)g(:)h(:)f(:)g(:)22 b fd(17,)13 b(20,)g(75,)g(76,)g(79,)g(81,)f(82,)
+h(117,)g(118)1015 416 y(v)o(ariable)i(o\013sets)5 b fc(:)h(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)16 b fd(147)1015 474 y(v)o(ari\
+able)f(shap)r(e)t fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(17,)c(75,)g(76,)g(81,)f(112)1015
+532 y(v)o(ariable)j(size)c fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)23 b fd(18)1015 590 y(v)o(ariable)15 b(t)n
+(yp)r(e)t fc(:)7 b(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(75,)c(76,)g(81,)g
+(82)1015 648 y(v)o(ariable)i(v)n(alues)c fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)22 b fd(22,)13 b(75)1015 706 y(v)o(ariable-length)j
+(strings)5 b fc(:)h(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)16 b fd(112,)d(113)1015 764 y(v)o(ariables)
+6 b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)17 b fd(16,)12 b(17,)
+h(19,)g(22,)g(34,)g(36,)g(38,)g(75,)f(136)1015 823 y(VMS)i(p)q(erformance)c fc
+(:)c(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)22 b fd(149)1015 959 y fg
+(W)1015 1026 y fd(write)14 b(errors)6 b fc(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)19 b fd(40)1015 1084 y(wri\
+ting)c(a)e(record)f fc(:)6 b(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)25 b fd(96)1015 1142 y(writing)15 b(c)o(haracter)e(string)i(data)6
+b fc(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)18 b fd(112)1015 1200 y(writing)d(data)9 b fc(:)d(:)g(:)g(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)21 b fd(84,)13 b(87,)g(91,)f(112)1015 1337 y fg(X)1015 1404 y
+fd(XDR)f fc(:)6 b(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)h(:)22 b fd(6,)13 b(8,)g(25,)f(30,)h(147,)g(148,)g(149)
+1015 1462 y(XDR)h(errors)8 b fc(:)e(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g
+(:)g(:)g(:)g(:)g(:)21 b fd(40,)12 b(166)p eop
+%%Page: 186 188
+ bop 0 -58 a fh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etCDF)14 b(is)i(Not)f(a)g(Database)f
+(Managemen)n(t)h(System)6 b fe(:)i(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)21 b fh(5)149 840 y(1.3)45 b(What)15 b(ab)q
+(out)g(P)n(erformance?)6 b fe(:)h(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)20 b fh(6)149 902 y(1.4)45 b(Is)15 b
+(NetCDF)g(a)g(Goo)q(d)h(Arc)o(hiv)o(e)g(F)-5 b(ormat?)6 b fe(:)h(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)20 b fh(7)149 965 y(1.5)45 b(Bac)o(kground)15 b
+(and)g(Ev)o(olution)h(of)f(the)g(NetCDF)f(Interface)t fe(:)7 b(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)18 b fh(7)149 1027 y(1.6)45 b
+(What's)14 b(New)h(in)h(this)g(Release?)6 b fe(:)h(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)19 b fh(9)149 1089 y(1.7)
+45 b(F)l(uture)15 b(Plans)h(for)e(NetCDF)e fe(:)7 b(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)28 b fh(10)149 1151 y
+(References)15 b fe(:)7 b(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)28 b fh(11)0 1276 y fg(2)67 b(Comp)q(onen)n
+(ts)23 b(of)e(a)h(NetCDF)f(File)8 b fa(:)i(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)29 b fg(13)149 1354 y fh(2.1)
+45 b(Dimensions)14 b fe(:)7 b(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)28 b fh(14)299 1416 y(2.1.1)44 b(Using)16 b(Dimensions)g(to)e(Sp)r
+(ecify)i(V)m(ariable)g(Shap)q(es)9 b fe(:)e(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)23 b fh(15)299 1478 y(2.1.2)44 b(Using)16 b(Dimensions)g(to)e(Rela\
+te)i(V)m(ariables)d fe(:)8 b(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)28 b fh(16)299 1541 y(2.1.3)44 b(Using)16 b(Dimensions)
+g(to)e(De\014ne)i(Co)q(ordinate)f(Systems)7 b fe(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)22 b fh(16)149 1603 y(2.2)45 b(V)l(ariables)6 b fe(:)i(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)20 b fh(17)149 1665 y
+(2.3)45 b(A)o(ttributes)t fe(:)7 b(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)19 b fh(18)299 1727 y(2.3.1)44 b(A)o(ttribute)15 b
+(Con)n(v)o(en)o(tions)f fe(:)8 b(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)29 b fh(20)299 1790 y(2.3.2)44 b(Di\013erences)17 b(b)q(et)o(w)n
+(een)f(A)o(ttributes)f(and)h(V)l(ariables)11 b fe(:)c(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)25 b f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g(Library)13 b fa(:)d(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)34 b fg(33)149
+2319 y fh(4.1)45 b(Creating)15 b(a)g(NetCDF)f(File)7 b fe(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)21 b fh
+(33)149 2381 y(4.2)45 b(Reading)16 b(a)f(NetCDF)g(File)h(with)f(Kno)o(wn)h
+(Names)9 b fe(:)e(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)24 b fh(35)149 2444 y(4.3)45 b(Reading)16 b(a)f(netCDF)
+g(File)h(with)g(Unkno)o(wn)f(Names)9 b fe(:)f(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)25 b fh(36)149 2506 y(4.4)45 b(Add\
+ing)16 b(New)g(Dimensions,)g(V)l(ariables,)g(A)n(ttributes)e fe(:)7 b(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)29 b fh(38)149
+2568 y(4.5)45 b(Error)14 b(Handling)7 b fe(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)21 b fh(40)p eop
+%%Page: -2 190
+ bop 0 -58 a fh(ii)1487 b(NetCDF)14 b(User's)h(Guide)0 42 y fg(5)67 b(NetCDF)
+21 b(Op)r(erations)c fa(:)10 b(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)40 b fg(43)149 119 y fh(5.1)45 b(NetCDF)14 b(Library)i(In)o(terface)f(Desc\
+riptions)10 b fe(:)d(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)24 b fh(43)149 182 y(5.2)45 b
+(Create)15 b(a)f(NetCDF)h(\014le)5 b fe(:)i(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)19 b fh
+(45)299 244 y(nccreate:)h(C)15 b(In)o(terface)6 b fe(:)h(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)21 b fh
+(45)299 306 y(NCCRE:)15 b(F)n(OR)m(TRAN)h(In)o(terface)c fe(:)7 b(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)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:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)22 b fh(105)299 1925 y(ncv)n(argetg:)c(C)d(Interface)c fe
+(:)c(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)26 b fh(105)299 1987 y(NCV)o(GTG,)14 b(NCV)n(GGC:)g(F)o(OR)m(TRAN)h
+(Interface)5 b fe(:)j(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)21 b fh(107)149 2050 y(7.11)45 b(Get)14 b(a)h(Record)d fe(:)7 b
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)26 b fh(110)299 2112 y(ncrecget:)
+20 b(C)15 b(In)o(terface)t fe(:)8 b(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)19 b fh(110)149 2174 y(7.12)45
+b(Reading)16 b(and)f(W)l(riting)h(Character)f(String)g(V)l(alues)e fe(:)8 b
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)27 b fh
+(112)299 2236 y(C)15 b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:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)26 b fh(117)299 2548 y(NCVREN:)15 b
+(F)o(OR)m(TRAN)g(Interface)d fe(:)7 b(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)28
+b fh(118)149 2610 y(7.15)45 b(Get)14 b(Num)o(b)r(er)h(of)g(Bytes)g(for)g(a)f
+(Data)g(T)o(yp)q(e)g fe(:)8 b(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)29 b fh(119)p eop
+%%Page: -4 192
+ bop 0 -58 a fh(iv)1475 b(NetCDF)14 b(User's)h(Guide)299 42 y(nct)o(yp)q(elen\
+:)21 b(C)15 b(Interface)c fe(:)c(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)26 b fh(119)299 104 y(NCTLEN:)15 b(F)n(OR)
+m(TRAN)h(In)o(terface)6 b fe(:)h(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)21
+b fh(120)149 166 y(7.16)45 b(Get)14 b(Information)i(Ab)q(out)f(Record)h(V)l
+(ariables)9 b fe(:)e(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g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:)h(:)19 b fh
+(132)299 929 y(NCA)o(GT,)14 b(NCA)o(GTC:)g(F)n(OR)m(TRAN)i(In)o(terface)5 b fe
+(:)i(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)20 b fh(133)149 991 y(8.4)45 b(Cop)o(y)15 b(A)n(ttribute)h(from)e(One)
+i(NetCDF)f(to)f(Another)5 b fe(:)i(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)20 b fh(136)299 1053 y(ncattcop)n(y:)g(C)15 b
+(Interface)9 b fe(:)e(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)24 b fh(136)299 1116 y(NCA)o(CPY:)14 b(F)o(OR)m(TRAN)h
+(Interface)e fe(:)8 b(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)29 b fh(137)149
+1178 y(8.5)45 b(Get)15 b(Name)g(of)f(A)o(ttribute)i(from)e(Its)h(Num)o(b)r
+(er)t fe(:)7 b(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)19 b fh(139)299 1240 y(ncattname:)g(C)c
+(Interface)c fe(:)d(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(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)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)26 b fh(144)299 1614 y(ncattdel:)20 b(C)15 b(Inter\
+face)5 b fe(:)i(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)21 b fh(144)299 1676 y(NCADEL:)15 b(F)n(OR)m(TRAN)
+h(In)o(terface)5 b fe(:)i(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)20 b fh
+(145)0 1801 y fg(9)67 b(NetCDF)21 b(File)j(Structure)g(and)f(P)n(erformance)8
+b fa(:)i(:)g(:)g(:)h(:)f(:)g(:)g(:)31 b fg(147)149 1878 y fh(9.1)45 b(P)o(art\
+s)14 b(of)h(a)g(NetCDF)f(File)f fe(:)7 b(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)26 b fh(147)149 1941 y(9.2)45 b
+(The)15 b(XDR)h(La)o(y)n(er)5 b fe(:)j(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)20 b fh(148)0 2065 y fg(10)66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(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)29 b fg(163)149 182 y fh(What)15 b(is)h
+(netCDF?)9 b fe(:)e(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)25 b fh
+(163)149 244 y(Ho)o(w)15 b(do)g(I)h(get)e(the)i(netCDF)e(soft)n(w)o(are)h(pac)
+o(k)m(age?)9 b fe(:)e(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)24 b fh(163)149 306 y(What)15 b
+(do)q(es)g(netCDF)g(run)g(on?)10 b fe(:)d(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)24 b fh(164)149 368 y(What)
+15 b(is)h(the)f(connection)h(b)r(et)n(w)o(een)g(netCDF)e(and)i(CDF?)11 b fe
+(:)d(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)27 b fh
+(164)149 431 y(What)15 b(is)h(the)f(connection)h(b)r(et)n(w)o(een)g(netCDF)e
+(and)i(HDF?)11 b fe(:)c(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)g(:)h(:)26 b fh(165)149 493 y(What)15 b(are)g(the)g(\014les)h(in)g(pub\
+/netcdf/)g(on)f(unidata.ucar.edu?)c fe(:)c(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)24 b fh(165)149 555 y(Wh)o(y)15 b(do)g(I)h(get)f(XDR)g
+(error)g(messages)f(when)i(trying)f(to)g(write)g(data?)e fe(:)7 b(:)g(:)g(:)h
+(:)f(:)g(:)g(:)28 b fh(166)149 617 y(What's)15 b(the)g(b)q(est)g(w)o(a)n(y)g
+(to)g(represen)o(t)g(data)g(using)h(netCDF?)9 b fe(:)e(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)25 b fh(166)149 680 y(Are)16 b(there)f
+(plans)h(to)e(add)i(facilities)h(for)e(data)f(compression)i(to)e(netCDF?)7 b
+fe(:)g(:)g(:)g(:)h(:)21 b fh(167)149 742 y(What)15 b(utilities)i(are)e(a)o
+(v)m(ailable)i(for)e(netCDF?)6 b fe(:)h(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)21 b fh(168)149 804 y(Is)16 b(there)f(a)g(mailing)i(list)f(for)e(netCDF)h
+(discussions)i(and)e(questions?)7 b fe(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)21 b fh(168)149 867 y(Ho)o(w)15 b(do)g(I)h(mak)n(e)f(a)g(bug)h(rep)q(ort?)
+t fe(:)8 b(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)20 b fh(168)149 929 y(Ho)o(w)15 b(widely)i(is)e(netCDF)g
+(used?)10 b fe(:)e(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)24 b fh(168)149 991 y(Is)16 b(there)f(an)o(y)g(W)
+-5 b(AIS)16 b(or)e(gopher)h(access)h(to)e(netCDF)h(information?)8 b fe(:)g
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)23 b fh(169)0 1116 y fg(App)r(endix)h(A)67
+b(Summary)24 b(of)e(C)g(In)n(terface)15 b fa(:)10 b(:)g(:)h(:)f(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)38 b fg(171)0 1256 y(App)r(endix)24 b(B)67 b(Summa\
+ry)24 b(of)e(F)n(OR)-6 b(TRAN)22 b(In)n(terface)17 b fa(:)11 b(:)f(:)40 b fg
+(173)0 1396 y(App)r(endix)24 b(C)67 b(Units)17 b fa(:)10 b(:)h(:)f(:)g(:)g
+(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h
+(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)39 b fg(175)0 1536 y(F)-6 b(unctio\
+n)25 b(and)d(V)-6 b(ariable)24 b(Index)8 b fa(:)i(:)g(:)h(:)f(:)g(:)g(:)h(:)f
+(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)29 b fg
+(179)0 1676 y(General)23 b(Index)9 b fa(:)h(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g
+(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)g
+(:)g(:)h(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)h(:)f(:)g(:)31 b fg(181)p eop
+%%Page: -6 194
+ bop 0 -58 a fh(vi)1475 b(NetCDF)14 b(User's)h(Guide)p eop
+%%Trailer
+ eos end
+%%EOF

Added: packages/libhdf4/branches/upstream/current/mfhdf/doc/guide.txn
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/doc/guide.txn	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/doc/guide.txn	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,9824 @@
+\input texinfo   @c -*-texinfo-*-
+
+ at c %**start of header
+ at setfilename netcdf.info
+ at settitle NetCDF User's Guide
+ at setchapternewpage odd
+ at c %**end of header
+
+ at c Combine the variable and function indices.
+ at synindex vr fn
+
+ at iftex
+ at finalout
+ at end iftex
+
+ at ifinfo
+This file documents the Unidata netCDF interface, library, and
+utilities.  
+
+Copyright (C) 1993 University Corporation for Atmospheric Research.
+Permission is granted to make and distribute verbatim copies of
+this file provided the copyright notice and this permission notice
+are preserved on all copies.
+ at end ifinfo
+
+ at titlepage
+ at title NetCDF User's Guide
+ at subtitle An Interface for Data Access
+ at subtitle Version 2.3, April 1993
+ at author Russ Rew, Glenn Davis, and Steve Emmerson
+ at author Unidata Program Center
+ at page
+ at vskip 0pt plus 1filll
+Copyright @copyright{} 1993 University Corporation for Atmospheric Research
+
+Permission is granted to make and distribute verbatim copies of this 
+manual provided that the copyright notice and these paragraphs are 
+preserved on all copies.  The software and any accompanying written 
+materials are provided ``as is'' without warranty of any kind.  UCAR 
+expressly disclaims all warranties of any kind, either expressed or 
+implied, including but not limited to the implied warranties of 
+merchantability and fitness for a particular purpose.  
+
+The Unidata Program Center is managed by the University 
+Corporation for Atmospheric Research and sponsored by the National 
+Science Foundation.  Any opinions, findings, conclusions, or 
+recommendations expressed in this publication are those of the 
+author(s) and do not necessarily reflect the views of the National 
+Science Foundation.
+
+Mention of any commercial company or product in this document 
+does not constitute an endorsement by the Unidata Program Center.  
+Unidata does not authorize any use of information from this 
+publication for advertising or publicity purposes.
+ at end titlepage
+
+ at node     Top, Foreword, (dir), (dir)
+ at ifinfo
+ at top NetCDF User's Guide
+
+The Unidata netCDF library provides an application- and
+machine-independent interface to self-describing, multidimensional
+scientific data.  It supports an abstract view of scientific data as a
+collection of named variables and their attributes, and provides
+high-level access to data that is faithful to the abstraction.  This
+on-line document describes the netCDF abstraction, applications programming
+interfaces, and utilities.  It includes the following chapters:
+
+ at menu
+* Foreword::                    What is Unidata?
+* Summary::                     Brief purpose and description of netCDF.
+* Introduction::                Overview and background of netCDF.
+* Components::                  The components of a netCDF file.
+* Data::                        The primitive netCDF data types and forms of data
+                    access.
+* Usage::                       How to use the netCDF library.
+* File Operations::             The interface for handling netCDF files.
+* Dimensions::                  The interface for handling netCDF dimensions.
+* Variables::                   The interface for handling netCDF variables.
+* Attributes::                  The interface for handling netCDF attributes.
+* File Structure::              The netCDF format and performance considerations.
+* Utilities::                   Higher-level netCDF operations implemented as separate
+                    programs.
+* FAQ::                         Answers to some frequently asked questions about netCDF.
+* C Interface::                 A summary of the C interface.
+* Fortran Interface::           A summary of the Fortran interface.
+* Units::                       The recommended syntax for representing units.
+* Name Index::                  Index of cross-references for names of netCDF functions
+                    and variables.
+* General Index::               Index of concepts.
+
+ --- The Detailed Node Listing ---
+
+The NetCDF Interface
+
+* Not a DBMS::   NetCDF is not a database management system.
+* Performance::  Some performance considerations.
+* Archiving::    Is netCDF a good archive format?
+* History::      Background and Evolution of the netCDF Interface.
+* Recent Changes::  Changes since the last release
+* Future Plans:: Future plans for netCDF.
+* References::   References.
+
+Components of a NetCDF File
+
+* What Are Dimensions?::  The components of and operations on netCDF
+                          dimensions.
+
+* What Are Variables?::  The components of and operations on netCDF
+                          variables.
+
+* What Are Attributes?::  The components of and operations on netCDF
+                          attributes.
+
+Dimensions
+
+* Specifying Variable Shapes::  Using Dimensions to Specify the Shapes
+                                of Variables
+
+* Relating Variables::          Using Dimensions to Relate Variables
+
+* Defining Coordinates::        Using Dimensions to Define Coordinates
+
+Attributes
+
+* Attribute Conventions::    Conventions for Commonly Used Attributes
+
+* Attributes and Variables:: Differences Between Attributes and Variables
+
+Data
+
+* Data Types::      The six basic netCDF data types.
+
+* Data Access::     Direct access, hyperslab access, and record access.
+
+* Data Structures:: Representing other structures with netCDF arrays.
+
+Use of the NetCDF Library
+
+* Creating a netCDF File::     How to create a new netCDF file.
+
+* Reading with Known Names::   How to read a netCDF file with known names.
+
+* Reading with Unknown Names:: How to read a generic netCDF.
+
+* Adding Components::          How to add new dimensions, variables, and
+                               attributes.
+
+* Error Handling::             How to handle errors.
+
+NetCDF Operations
+
+* Interface Descriptions::   Conventions for netCDF library interface
+                             descriptions.
+* nccreate and NCCRE::       Create a netCDF file.
+* ncopen and NCOPN::         Open a netCDF file for access.
+* ncredef and NCREDF::       Put open netCDF file into define mode.
+* ncendef and NCENDF::       Leave Define Mode.
+* ncclose and NCCLOS::       Close an Open netCDF File.
+* ncinquire and NCINQ::      Inquire about an Open netCDF File.
+* ncsync and NCSNC::         Synchronize an Open netCDF File to Disk.
+* ncabort and NCABOR::       Back Out of Recent Definitions.
+* ncsetfill and NCSFIL::     Set fill mode for optimized writes.
+
+Dimensions
+
+* ncdimdef and NCDDEF::    Create a Dimension
+* ncdimid and NCDID::      Get a Dimension ID from Its Name
+* ncdiminq and NCDINQ::    Inquire about a Dimension
+* ncdimrename and NCDREN:: Rename a Dimension
+
+Variables
+
+* ncvardef and NCVDEF::     Create a Variable
+* ncvarid and NCVID::       Get a Variable ID from Its Name
+* ncvarinq and NCVINQ::     Get Information about a Variable from Its ID
+* ncvarput1 and NCVPT1::    Write a Single Data Value
+* ncvarput and NCVPT::      Write a Hyperslab of Values
+* ncvarputg NCVPTG and NCVPGC::    Write a Generalized Hyperslab of Values
+* ncrecput::                Write a Record of Values
+* ncvarget1 and NCVGT1::    Read a Single Data Value
+* ncvarget and NCVGT(C)::   Read a Hyperslab of Values
+* ncvargetg NCVGTG and NCVGGC::    Read a Generalized Hyperslab of Values
+* ncrecget::                Read a Record of Values
+* Character String I/O::    Reading and Writing Character String Values
+* Missing Values::          Conventions for Missing Values
+* ncvarrename and NCVREN::  Rename a Variable
+* nctypelen and NCTLEN::    Get Number of Bytes for a Data Type
+* ncrecinq::                Get Information about Record Variables
+
+Attributes
+
+* ncattput and NCAPT::      Create an Attribute
+* ncattinq and NCAINQ::      Get Information about an Attribute
+* ncattget and NCAGT(C)::      Get Attribute's Values
+* ncattcopy and NCACPY::      Copy Attribute from One netCDF to Another
+* ncattname and NCANAM::      Get Name of Attribute from Its Number
+* ncattrename and NCAREN::      Rename an Attribute
+* ncattdel and NCADEL::      Delete an Attribute
+
+NetCDF File Structure and Performance
+
+* File parts::  Parts of a netCDF File
+* XDR layer::   The XDR Layer
+
+Higher-Level netCDF Operations
+
+* CDL Syntax::    The syntax of CDL, a tiny language for representing
+                  netCDF files or their structure in ASCII.
+* CDL Data Types::The data types of CDL.
+* CDL Constants:: The CDL notation for data constants.
+* ncgen::         Check CDL syntax or generate netCDF file (or C or Fortran)
+                  from netCDF file.
+* ncdump::        Generate CDL file (or a portion of a CDL file) from a netCDF
+                  file.
+
+Answers to Some Frequently Asked Questions
+
+* What is netCDF?::       
+* How to get it::         Availability of the netCDF software
+* Platforms::             What platforms it runs on
+* netCDF and CDF::        Connection with NASA's Common Data Format
+* netCDF and HDF::        Connection with NCSA's Hierarchical Data Format
+* pub/netcdf::            Some files with volatile netCDF information
+* XDR error messages::    Why occasional error messages from XDR layer
+* representing data::     Ways to represent data in netCDF
+* data compression::      Data compression in netCDF
+* Other utilities::             What netCDF utilities exist
+* mailing list::          The netCDF mailing lists
+* bug reports::           Where to send bug reports
+* Popularity::            Is netCDF widely used?
+* WAIS/gopher access::    WIAS or gopher access to netCDF information
+ at end menu
+
+ at end ifinfo
+
+ at node Foreword, Summary, Top, Top
+ at unnumbered Foreword
+Unidata is a National Science Foundation-sponsored program empowering 
+U.S. universities, through innovative applications of computers and 
+networks, to make the best use of atmospheric and related data for 
+enhancing education and research.  The Unidata Program Center currently 
+offers universities several (supported) software packages for analyzing 
+and displaying such data, some developed by Unidata and some by other 
+organizations, including NASA, the University of Wisconsin, Purdue 
+University, and MacDonald Dettwiler.  Underlying these is a Unidata-
+developed system for acquiring and managing data in real time, making 
+practical the Unidata principle that each university should acquire and 
+manage its own data holdings as local requirements dictate.  (It is 
+significant that the Unidata program has no data center -- the 
+management of data is a ``distributed'' function.)
+
+The Network Common Data Form (netCDF) software described in this guide 
+was originally intended to provide a common data access method for the 
+various Unidata applications.  These deal with a variety of data types 
+that encompass single-point observations, time series, regularly-spaced 
+grids, and satellite or radar images.  
+
+The netCDF software functions as an I/O library, callable from C or 
+FORTRAN, which stores and retrieves scientific data structures in self-
+describing, machine-independent files.  Each netCDF file can contain an 
+unlimited number of multi-dimensional, named variables (with differing 
+types that include integers, reals, characters, bytes, etc.), and each 
+variable may be accompanied by ancillary data, such as units of measure 
+or descriptive text.  The interface includes a method for appending data 
+to existing netCDF files in prescribed ways, functionality that is not 
+unlike a (fixed length) record structure.  However, the netCDF library 
+also allows direct-access storage and retrieval of data by variable name 
+and index and therefore is useful only for disk-resident (or memory-
+resident) files.
+
+NetCDF access has been implemented in about half of Unidata's software, 
+so far, and it is planned that such commonality will extend across all 
+Unidata applications in order to:
+
+ at itemize @bullet
+ at item
+Facilitate the use of common data files by distinct applications.
+
+ at item
+Permit data files to be transported between or shared by dissimilar 
+computers transparently, i.e., without translation.
+
+ at item
+Reduce the programming effort usually spent interpreting formats in a 
+way that is equally effective for FORTRAN and C programmers.
+
+ at item
+Reduce errors arising from misinterpreting data and ancillary data.
+
+ at item
+Facilitate using output from one application as input to another.
+
+ at item
+Establish an interface standard which simplifies the inclusion of new 
+software into the Unidata system.
+ at end itemize
+
+A measure of success has been achieved.  The netCDF is now in use on 
+computing platforms that range from CRAYs to Personal Computers and 
+include many (UNIX- and VMS-based) workstations.  It can be used to 
+create a complex data set on one computer (say in FORTRAN) and retrieve 
+that same (self-describing) data set on another computer (say in C) 
+without intermediate translations -- netCDF files can be transferred 
+across a network, or they can be accessed remotely using a suitable 
+network file system.
+
+Because we believe that the use of netCDF access in non-Unidata software 
+will benefit Unidata's primary constituency -- such use may result in 
+more options for analyzing and displaying Unidata information -- the 
+netCDF library is distributed without licensing or other significant 
+restrictions, and current versions can be obtained via anonymous FTP.  
+Apparently the software has been well received by a wide range of 
+institutions beyond the atmospheric science community, and a substantial 
+number of public domain and commercial data analysis systems can now 
+accept netCDF files as input.  
+
+Several organizations have adopted the netCDF as a data access standard, 
+and there is an effort underway at the National Center for Supercomputer 
+Applications (NCSA, which is associated with the University of Illinois 
+at Urbana-Champaign) to support the netCDF programming interfaces as a 
+means to store and retrieve data in ``HDF files,'' i.e., in the format 
+used by the popular NCSA tools.  We have encouraged and cooperated with 
+these efforts.
+
+Questions occasionally arise about the level of support provided for the 
+netCDF software.  Unidata's formal position, stated in the copyright 
+notice which accompanies the netCDF library, is that the software is 
+provided ``as is'' ...  In practice, the software is updated from time 
+to time, and Unidata intends to continue making improvements for the 
+foreseeable future.  Because Unidata's mission is to serve atmospheric 
+scientists at U.S. universities, problems reported by that community 
+necessarily receive the greatest attention.
+
+We hope the reader will find the software useful and will give us 
+feedback on its application as well as suggestions for its improvement.
+
+
+ at noindent
+David Fulker@*
+Unidata Program Center Director
+University Corporation for Atmospheric Research
+
+ at node Summary, Introduction, Foreword, Top
+ at unnumbered Summary
+ at cindex self-describing
+ at cindex network-transparent
+The purpose of the Network Common Data Form (netCDF) interface is to
+allow you to create, access, and share scientific data in a form that is
+self-describing and network-transparent.  ``Self-describing'' means that a
+file includes information defining the data it contains.
+``Network-transparent'' means that a file is represented in a form that
+can be accessed by computers with different ways of storing integers,
+characters, and floating-point numbers.  Using the netCDF interface for
+creating new scientific data sets can improve the accessibility of the
+data.  Using the netCDF interface in new software for scientific data
+access, management, analysis, and display can improve the reusability of
+the software for other data sets and by other users.
+
+ at cindex FORTRAN interface
+ at cindex C++ interface
+ at cindex C interface
+The netCDF software provides common C and FORTRAN interfaces for
+applications and data.  The C interface library is available for many
+common computing platforms, including various versions of UNIX, VMS,
+MSDOS and OS/2 environments.  The FORTRAN interface, implemented in C,
+is available for many of the platforms on which the C interface is
+available.  The form in which the FORTRAN interface is implemented makes
+it easy to generate and test a new FORTRAN interface for a new platform
+by specifying the conventions for calling C from FORTRAN.  An
+experimental C++ prototype interface is currently under evaluation.
+
+The netCDF software is being made freely available to encourage the
+sharing of both scientific data and the software that makes the data
+useful.
+
+ at node Introduction, Components, Summary, Top
+ at chapter Introduction
+ at section The NetCDF Interface
+
+ at cindex netCDF
+The Network Common Data Form, or netCDF, is an interface to a library of
+data access programs for storing and retrieving scientific data.  NetCDF
+is an abstraction that supports a view of data as a collection of
+self-describing, network-transparent objects that can be accessed
+through a simple interface.  Collections of named multidimensional
+variables can be randomly accessed, without knowing details of how the
+data are stored.  Auxiliary information about the data, such as what
+units are used, can be stored with the data.  Generic utilities and
+application programs can be written that access arbitrary netCDF files
+and transform, combine, analyze, or display specified fields of the
+data.  The development of such applications may lead to improved
+accessibility of data and improved reusability of software for
+scientific data management, analysis, and display.
+
+ at cindex availability of netCDF software
+ at cindex languages supported
+ at cindex operating systems supported
+ at cindex portability
+ at cindex abstract data type
+ at cindex future changes planned
+The netCDF software implements an @dfn{abstract data type}, which means
+that all operations to access and manipulate data in a netCDF file must use
+only the set of functions provided by the interface.  The actual
+representation of the data is hidden from applications that use the
+interface, so that how the data are stored could be changed without
+affecting such programs.  The physical representation of netCDF data is
+designed to be independent of the computer on which the data were
+written.  Future changes to the netCDF interface will be compatible with
+the interface described here, so that neither existing netCDF files nor
+programs accessing them will require modification.
+
+The netCDF interface is supported for both C and FORTRAN, and for UNIX,
+VMS, OS/2 and MSDOS operating systems.  The netCDF software that
+implements this interface is freely available via FTP and free of
+licensing restrictions to encourage its wide use.
+
+ at menu
+* Not a DBMS::   NetCDF is not a database management system.
+* Performance::  Some performance considerations.
+* Archiving::    Is netCDF a good archive format?
+* History::      Background and Evolution of the netCDF Interface.
+* Recent Changes::  Changes since the last release
+* Future Plans:: Future plans for netCDF.
+* References::   References.
+ at end menu
+
+ at node Not a DBMS, Performance, Introduction, Introduction
+ at section NetCDF is Not a Database Management System
+
+ at cindex database management systems
+Why not use an existing database management system (DBMS) for storing
+scientific data?  We looked at available database software, both
+commercial and research-oriented, and concluded that existing
+packages are currently inadequate for the kinds of scientific data
+access supported by the netCDF interface.
+
+ at cindex relational database systems
+First, most existing DBMSs have poor support for multidimensional
+objects as the basic unit of data access.  An alternative data model of
+comparable power and elegance to the relational model for databases is
+needed for scientific data.  If such a model existed, programs that
+shared that model could be used in flexible combinations to support
+effective systems for building applications and visualizing data.
+Representing multidimensional arrays as relations makes some useful
+kinds of data access awkward and provides little support for the
+abstractions of multidimensional data and coordinate systems.
+
+Related to this is a second problem with general-purpose database
+systems: their poor performance on large scientific data sets.
+Collections of satellite images, scientific model outputs, climate
+observations covering decades, high-resolution atmospheric profile data,
+and other large data sets are beyond the capabilities of most DBMSs to
+organize and index for efficient retrieval.
+
+Finally, general-purpose database systems provide, at significant cost
+in terms of both resources and access performance, many facilities that
+are not needed in the analysis, management, and display of scientific
+data.  For example, elaborate update facilities, concurrency control,
+audit trails, report writers, and mechanisms designed for
+transaction-processing are unnecessary for most scientific applications.
+
+ at node Performance, Archiving, Not a DBMS, Introduction
+ at section What about Performance?
+
+ at cindex efficiency
+ at cindex performance
+ at cindex external data representation (XDR)
+ at cindex XDR
+To achieve network-transparency, the netCDF is implemented on top of a
+layer of software for external data representation (XDR).  XDR,
+developed by Sun Microsystems, Inc., is a nonproprietary standard for
+describing and encoding data.  It supports encoding arbitrary C
+data structures into machine-independent sequences of bits.
+ at cindex IEEE floating-point
+The encoding used for floating-point numbers is the Institute for
+Electrical and Electronics Engineers (IEEE) standard for normalized
+floating-point numbers.  XDR has been implemented on a wide variety of
+computers, including Suns, VAXs, Apple Macintoshes, IBM RS 6000s, IBM
+PS/2s, IBM mainframes, and CRAYs.  It assumes only that eight-bit bytes can
+be encoded and decoded in a consistent way.
+
+Translating data into and out of XDR form adds overhead to data
+transfers, but for many applications the extra CPU cycles used to
+convert data to and from a machine-independent representation are not
+significant.  The amount of XDR overhead depends on many factors,
+including the data type, the type of computer, the granularity of data
+access, and how well the implementation has been tuned to the computer
+on which it is run.  For a large set of applications, the overhead of
+the XDR layer is a reasonable price to pay for portable,
+network-transparent data access.
+
+ at cindex performance
+ at cindex efficiency
+Often when an abstraction layer is added to hide the details of an
+underlying implementation, some computations that can be expressed
+simply in terms of the abstraction may be computationally expensive.
+Furthermore, it may not be obvious which of several ways of expressing a
+computation through the abstract interface will make efficient use of
+computing resources, without understanding something about the
+implementation.  It is certainly possible to use the netCDF interface to
+access data in inefficient ways: for example, by requesting a slice of
+variable data that requires a single value out of each record.
+ at xref{File Structure, , NetCDF File Structure and Performance}, for a
+discussion of performance characteristics of the implementation and how
+to apply knowledge of the underlying implementation to use the interface
+effectively when performance is an important concern.
+
+ at node Archiving, History, Performance, Introduction
+ at section Is NetCDF a Good Archive Format?
+
+ at cindex archive formats
+NetCDF can be used as an archive format for storing data, but it may
+take more space than a special-purpose archive format that exploits
+knowledge of particular characteristics of a set of data.
+Compression of data is possible with netCDF (e.g., using arrays of
+eight-bit bytes to encode low-resolution floating-point numbers instead
+of arrays of 32-bit numbers), but netCDF was not designed to achieve
+optimal compression of scientific data.
+
+The advantages of a special-purpose archive format for small archives
+should be compared to the benefits of machine-independence and the
+ability to store ancillary data (data about the data) that the netCDF
+interface provides.  For large archives, only two programs need to be
+provided for each archive format, one to translate archived data into
+netCDF form and the other to translate back to the archive format.
+Tools provided for manipulating netCDF data will then be available
+without sacrificing the advantages of the archive format and without
+requiring the wholesale conversion of large existing archives.
+
+ at node History, Recent Changes, Archiving, Introduction
+ at section Background and Evolution of the NetCDF Interface
+
+ at cindex history of the netCDF
+ at cindex netCDF, development of
+The development of the netCDF interface began with a modest goal related to
+Unidata's needs: to provide a common interface between Unidata
+applications and ingested real-time meteorological data.  Since Unidata
+software was intended to run on multiple hardware platforms with access
+from both C and FORTRAN, achieving Unidata's goals had the
+potential for providing a package that was useful in a broader context.
+By making the package widely available and collaborating with other
+organizations with similar needs, we hoped to improve the current
+situation in which scientific software is only rarely reused by others
+in the same discipline and almost never reused between disciplines
+(Fulker, 1988).
+
+ at cindex NASA CDF
+ at cindex NSSDC CDF
+Important concepts employed in the netCDF software originated in a paper
+(Treinish and Gough, 1987) that described data-access software developed
+at the NASA Goddard National Space Science Data Center (NSSDC).  The
+interface provided by this software was called the Common Data Format
+(CDF).  The NASA CDF was originally developed as a platform-specific
+FORTRAN library to support an abstraction for storing multidimensional
+scientific data.
+
+The NASA CDF package had been used for many different kinds
+of data in an extensive collection of applications.  It
+had the virtues of simplicity (only 13 subroutines), independence from
+storage format, generality, ability to support logical user views of
+data, and support for generic applications.
+
+ at cindex Unidata CDF Workshops
+Unidata held a workshop on CDF in Boulder in August 1987.  We proposed
+exploring the possibility of collaborating with NASA to extend the CDF
+FORTRAN interface, to define a C interface, and to permit the access of
+data aggregates with a single call, while maintaining compatibility with
+the existing NASA interface.
+
+ at cindex New Mexico Tech. CDF
+ at cindex CANDIS
+Independently, Dave Raymond at the New Mexico Institute of Mining and
+Technology had developed a package of C software for UNIX that supported
+self-describing scientific data along with a ``pipes and filters''
+approach to processing, analyzing, and displaying scientific data.
+This package also used the ``Common Data Format'' name,
+later changed to C-Based Analysis and Display System (CANDIS).
+Unidata learned of Raymond's work (Raymond, 1988), and
+incorporated some of his ideas, such as the use of named dimensions and
+variables with differing shapes in a single data object, into the
+Unidata netCDF interface.
+
+ at cindex XDR
+In early 1988, Glenn Davis of Unidata developed a prototype netCDF
+package in C that was layered on a nonproprietary external data
+representation standard (XDR) developed by Sun Microsystems.  This
+prototype proved that a single-file, network-transparent implementation
+of the CDF interface could be achieved at acceptable cost and that the
+resulting programs could be implemented on both UNIX and VMS systems.
+However, it also demonstrated that providing a small, portable, and NASA
+CDF-compatible FORTRAN interface with the desired generality was not
+practical.  (NASA's CDF and Unidata's netCDF have since evolved
+separately, but recent CDF versions share many characteristics with
+netCDF.)
+
+ at cindex SeaSpace CDF
+In early 1988, Joe Fahle of SeaSpace, Inc. (a commercial software
+development firm in San Diego, California), a participant in the 1987
+Unidata CDF workshop, independently developed a CDF package in C that
+extended the NASA CDF interface in several important ways (Fahle, 1989).
+Like Raymond's package, the SeaSpace CDF software permitted variables
+with unrelated shapes to be included in the same data object and
+permitted a general ``hyperslab'' form of access to multidimensional
+arrays.  Fahle's implementation was used at SeaSpace as the intermediate
+form of storage for a variety of steps in their image-processing system.
+
+ at cindex Unidata CDF Workshops
+After studying Fahle's interface, we concluded that it solved many of
+the problems we had identified in trying to stretch the NASA interface
+to our purposes.  In August 1988, we convened a small workshop to agree
+on a Unidata netCDF interface, and to resolve remaining open issues.
+Attending were Joe Fahle of SeaSpace, Michael Gough of Apple (an author
+of the NASA CDF software), Angel Li of the University of Miami (who had
+implemented our prototype netCDF software on VMS and was a potential
+user), and Unidata systems development staff.  Consensus was reached at
+the workshop after some further simplifications were discovered.  A
+document incorporating the results of the workshop into a proposed
+Unidata netCDF interface specification was distributed widely for
+comments before Glenn Davis implemented the software it described.
+Comparison with other data-access interfaces and recent experience in
+using netCDF are discussed in (Rew and Davis, 1990a) and (Rew and Davis,
+1990b).
+
+In October 1991, we announced version 2.0 of the netCDF software
+distribution.  Slight modifications to the C interface (declaring
+dimension sizes to be @code{long} rather than @code{int}) improved the
+usability of netCDF on inexpensive platforms such as MSDOS computers,
+without requiring recompilation on other platforms.  This change to the
+interface required no changes to the associated file format.
+
+ at node Recent Changes, Future Plans, History, Introduction
+ at section What's New in this Release?
+
+This Guide documents the March 1993 release of netCDF 2.3, which
+preserves the same file format but adds a few new functions to the C and
+Fortran interfaces.
+
+The suggested extension for netCDF files has been changed from
+ at code{.cdf} to @code{.nc}, in order to avoid a clash with the NASA CDF
+file extension.  Although the old extension is still supported in a
+backward compatible way, new netCDF files should use the new filename
+extension, where practical.
+
+Subsampling along specified dimensions (using `strides') is one of the
+commonly-asked-for features supported by the new @code{ncvarputg()} and
+ at code{ncvargetg()} interfaces for generalized hyperslab access.  In
+addition, these interfaces permit accessing data that is not contiguous
+in memory.  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.  (@xref{ncvarputg
+NCVPTG and NCVPGC}.)
+
+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 may instead use a single
+call.  (@xref{ncrecput}.)
+
+New optimizations for the library have resulted in significant speedups
+for accessing cross-sections involving non-contiguous data.  Many bugs
+have been fixed, portability has been improved, and the installation has
+been greatly simplified for most systems.
+
+The ncdump utility now 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.
+
+ at node Future Plans, References, Recent Changes, Introduction
+ at section Future Plans for NetCDF
+
+ at cindex Future Plans
+We continue to use netCDF for Unidata system software and applications.
+We have begun to use netCDF interfaces for earth-referenced
+image-analysis software, as well as for the output of decoders for a
+wide variety of meteorological and oceanographic data.
+
+We have recently released a preliminary set of netCDF operators that we
+hope will eventually be completed to provide an algebra of useful
+operations on generic scientific data stored in netCDF files.  The
+complete set of operators includes selectors to extract subsets of
+variables or reduce the dimensionality of a netCDF file; combiners to
+merge netCDF files, combine variables, or increase dimensionality;
+graphics generators to read netCDF files and produce graphical output;
+mathematical operators; and specialized data converters to convert
+units, convert to or from standard archive forms, or to convert to a
+canonical form for comparison.  By composing these fundamental
+operators, users would have a wide variety of capabilities.
+
+We have submitted a proposal for resources to extend the netCDF library
+in an upward-compatible way to support netCDF servers on a network.
+With netCDF servers, clients could access cross-sections of data
+efficiently, as if they were stored in a local file.  A netCDF server
+would also have the ability to support virtual netCDF objects that
+provide different views of large or remote data sets.  Servers might
+also be capable of providing a transparent netCDF interface to
+non-netCDF archives.
+
+Other desirable extensions that we would like to see added to netCDF
+include an interface for record access by key or coordinate value,
+transparent data packing by use of three new reserved attributes
+(@code{_Nbits}, @code{_Scale}, and @code{_Offset}), support for pointers
+to data cross-sections in other files (what Joe Fahle calls
+``assemblies''), better string support, and a well-tested C++ interface.
+Some of these extensions may be included in future releases.
+
+ at node References,  , Future Plans, Introduction
+ at unnumberedsec References
+
+ at enumerate
+
+ at item
+Fahle, J., @emph{TeraScan Applications Programming Interface}, SeaSpace,
+San Diego, California, 1989.
+ at item
+Fulker, D. W., ``The netCDF:  Self-Describing, Portable Files---a Basis
+for `Plug-Compatible' Software Modules Connectable by Networks,'' ICSU
+Workshop on Geophysical Informatics, Moscow, USSR, August 1988.
+ at item
+Fulker, D. W., ``Unidata Strawman for Storing Earth-Referencing Data,''
+ at emph{Seventh International Conference on Interactive Information
+and Processing Systems for Meteorology, Oceanography, and Hydrology}, New
+Orleans, La., American Meteorology Society, January 1991.
+ at item
+Gough, M. L., @emph{NSSDC CDF Implementer's Guide (DEC VAX/VMS) Version
+1.1}, National Space Science Data Center, 88-17, NASA/Goddard Space
+Flight Center, 1988.
+ at item
+Jenter, H. L. and R. P. Signell, ``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, 1992.
+ at item
+Raymond, D. J., ``A C Language-Based Modular System for Analyzing and
+Displaying Gridded Numerical Data,'' Journal of Atmospheric and Oceanic
+Technology, @strong{5}, 501-511, 1988.
+ at item
+Rew, R. K. and G. P. Davis, ``The Unidata netCDF: Software for
+Scientific Data Access,'' @emph{Sixth International Conference on Interactive
+Information and Processing Systems for Meteorology, Oceanography, and
+Hydrology}, Anaheim, California, American Meteorology Society, February 1990.
+ at item
+Rew, R. K. and G. P. Davis, ``NetCDF: An Interface for
+Scientific Data Access,'' @emph{Computer Graphics and Applications},
+IEEE, pp. 76-82, July 1990.
+ at item
+Treinish, L. A. and M. L. Gough, ``A Software Package for the Data
+Independent Management of Multi-Dimensional Data,'' @emph{EOS
+Transactions}, American Geophysical Union, @strong{68}, 633-635, 1987.
+ at item
+Sun Microsystems, ``External Data Representation Standard: Protocol
+Specification,'' RFC 1014; Information Sciences Institute, May 1988.
+ at end enumerate
+
+ at node Components, Data, Introduction, Top
+ at chapter Components of a NetCDF File
+ at cindex netCDF components
+ at cindex netCDF dimensions
+ at cindex netCDF variables
+ at cindex netCDF attributes
+A netCDF file has @dfn{dimensions}, @dfn{variables}, and
+ at dfn{attributes}.  These components can be used together to capture the
+meaning of data and relations among data fields in a scientific data set.
+
+ at cindex CDL
+ at cindex CDL example
+ at cindex network Common Data Form Language (CDL)
+ at vindex NC_UNLIMITED
+We will use a small netCDF example to illustrate the concepts of netCDF
+dimensions, variables, and attributes.  The notation used to describe
+this simple netCDF object is called CDL (network Common Data form
+Language).  It provides an easily comprehended text version of the
+structure and contents of a binary netCDF file:
+ at example
+ at group
+netcdf example_1 @{  // example of CDL notation for a netCDF file
+
+dimensions:          // dimension names and sizes are declared first
+        lat = 5, lon = 10, level = 4, time = unlimited;
+
+variables:           // variable types, names, shapes, attributes
+        float   temp(time,level,lat,lon);
+                    temp:long_name     = "temperature";
+                    temp:units         = "celsius";
+        float   rh(time,lat,lon);
+                    rh:long_name = "relative humidity";
+                    rh:valid_range = 0.0, 1.0;      // min and max
+        int     lat(lat), lon(lon), level(level);
+                    lat:units       = "degrees_north";      
+                    lon:units       = "degrees_east";
+                    level:units     = "millibars";
+        short   time(time);
+                    time:units      = "hours since 1990-11-25 12:00 UTC";
+        // global attributes
+                    :source = "National Weather Service";
+
+data:                // optional data assignments
+        level   = 1000, 850, 700, 500;
+        lat     = 20, 30, 40, 50, 60;
+        lon     = -160,-140,-118,-96,-84,-52,-45,-35,-25,-15;
+        time    = 12;
+        rh      =.5,.2,.4,.2,.3,.2,.4,.5,.6,.7,
+                 .1,.3,.1,.1,.1,.1,.5,.7,.8,.8,
+                 .1,.2,.2,.2,.2,.5,.7,.8,.9,.9,
+                 .1,.2,.3,.3,.3,.3,.7,.8,.9,.9,
+                  0,.1,.2,.4,.4,.4,.4,.7,.9,.9;
+@}
+ at end group
+ at end example
+
+ at findex ncdump
+ at findex ncgen
+ at sp 1
+ at cindex CDL notation
+The CDL notation for a netCDF file can be generated automatically by
+using @code{ncdump}, a utility program described later (@pxref{ncdump}).
+Another netCDF utility, @code{ncgen}, generates a netCDF file (or
+optionally C or FORTRAN source code containing calls needed to produce a
+netCDF file) from CDL input (@pxref{ncgen}).  It is not necessary to
+learn much about CDL notation to use the netCDF library; we use it in
+this document as a concise way of presenting netCDF examples.
+
+The CDL notation will be explained more fully as we describe the
+components of a netCDF file.  For now, note that CDL statements are
+terminated by a semicolon.  Spaces, tabs, and newlines can be used freely
+for readability.  Comments in CDL follow the characters @samp{//} on any
+line.  A CDL description of a netCDF file takes the form
+ at example
+ at group
+  netCDF @var{name} @{
+    dimensions: @dots{}
+    variables: @dots{}
+    data: @dots{}
+  @}
+ at end group
+ at end example
+ at noindent
+where the @var{name} is used only as a default in constructing the name
+of the file generated by the @code{ncgen} utility.  The CDL description
+consists of three optional parts, introduced by the keywords
+ at code{dimensions}, @code{variables}, and @code{data}.  NetCDF dimension
+declarations appear after the @code{dimensions} keyword, netCDF
+variables and attributes are defined after the @code{variables} keyword,
+and variable data assignments appear after the @code{data} keyword.
+
+ at menu
+* What Are Dimensions?::  The components of and operations on netCDF
+                          dimensions.
+
+* What Are Variables?::  The components of and operations on netCDF
+                          variables.
+
+* What Are Attributes?::  The components of and operations on netCDF
+                          attributes.
+ at end menu
+
+ at node What Are Dimensions?, What Are Variables?,  , Components
+ at section Dimensions
+
+ at cindex dimensions
+A netCDF dimension is a named integer used to specify the shape of one
+or more of the multi-dimensional variables contained in a netCDF file.
+A dimension may be used to represent a real physical dimension, for
+example, time, latitude, longitude, or height.  A dimension might also be
+used to index more abstract quantities, for example, color-table entry
+number, instrument number, station-time pair, or model-run ID.
+
+ at cindex dimension names
+ at cindex dimension size
+ at cindex netCDF names
+ at cindex CDL names
+ at cindex unlimited dimension
+ at cindex record dimension
+ at cindex record variables
+ at cindex appending data
+Every netCDF dimension has both a @dfn{name} and a @dfn{size}.  A
+dimension name is an arbitrary sequence of alphanumeric characters
+(as well as the underscore character, @samp{_}, and the hyphen character,
+ at samp{-}) beginning with a letter.  Case is distinguished in netCDF
+names.  A dimension size is an arbitrary positive integer, except that
+one dimension in a netCDF file can have the size @code{UNLIMITED}.  Such
+a dimension is called the @dfn{unlimited dimension} or the @dfn{record
+dimension}.  A variable with an unlimited dimension can grow to any
+length along that dimension.  The unlimited dimension is like a record
+number in conventional record-oriented files.
+
+CDL dimension declarations may appear on one or more lines following the
+CDL keyword @code{dimensions}.  Multiple dimension declarations on the
+same line may be separated by commas.  Each declaration is of the form
+ at var{name} = @var{size}.
+
+ at cindex unlimited dimension
+There are four dimensions in the example: @code{lat}, @code{lon},
+ at code{level}, and @code{time}.  The first three are assigned
+fixed sizes; @code{time} is assigned the size @code{UNLIMITED}, which means
+it is the @dfn{unlimited} dimension.  A netCDF file can have at most one
+unlimited dimension, but need not have any.
+
+There are several uses for netCDF dimensions:
+ at itemize @bullet
+ at item
+Specifying the shapes and sizes of variables.
+ at item
+Identifying and relating variables that are defined on a common grid.
+ at item
+Providing a way to define coordinate systems.
+ at end itemize
+We discuss each of these uses below.
+
+ at menu
+* Specifying Variable Shapes::  Using Dimensions to Specify the Shapes
+                                of Variables
+
+* Relating Variables::          Using Dimensions to Relate Variables
+
+* Defining Coordinates::        Using Dimensions to Define Coordinates
+ at end menu
+
+ at node Specifying Variable Shapes, Relating Variables,  , What Are Dimensions?
+ at subsection Using Dimensions to Specify Variable Shapes
+
+ at cindex specifying variable shapes
+The basic unit of named data in a netCDF file is a @dfn{variable}.  In
+general, a variable is a multidimensional object that has, among other
+characteristics, a @dfn{shape}, which is defined by the number, order,
+and sizes of its dimensions.  When a netCDF variable is defined, the
+number and order of the dimensions that define its shape are specified.
+Hence you must first create the necessary dimensions before creating a
+netCDF variable that uses them.
+
+It is possible to use the same dimension more than once in specifying a
+variable shape, for example @code{var(dim, dim)}, but it does not make
+much sense to do this; it is contrary to the intuitive meaning of a
+physical dimension.  A variable that has two dimensions that happen to
+be the same size is more accurately modeled by using two dimensions with
+different names but the same size.
+
+ at node Relating Variables, Defining Coordinates, Specifying Variable Shapes, What Are Dimensions?
+ at subsection Using Dimensions to Relate Variables
+
+ at cindex relating variables
+Two dimensions may have the same size, perhaps by coincidence, without
+being related in any other way.  Dimension names provide a way to distinguish
+dimensions regardless of size.
+
+ at cindex variables
+Variables are related by the dimensions they share.  For example, if two
+variables are defined with the same dimensions, they might represent
+observations or model output for the same set of points.  In the example
+netCDF file, variables @code{temp} and @code{rh} share the
+ at code{time}, @code{lat}, and @code{lon} dimensions.  The variable
+ at code{rh} does not have @code{level} as a dimension, perhaps because it is only
+defined for a single level.
+
+ at node Defining Coordinates,  , Relating Variables, What Are Dimensions?
+ at subsection Using Dimensions to Define Coordinate Systems
+
+ at cindex defining coordinate systems
+ at cindex coordinates
+ at cindex coordinate variables
+Besides serving as sizes for integer indexes to multidimensional
+variables, dimensions may be used to define coordinate systems for
+variable data.  To do this, create a variable with the same name as a
+dimension and specify coordinate values for that variable.  A variable
+should only be given the same name as a dimension in a netCDF file when it is
+to be used as a @dfn{coordinate} variable.  Such variables are
+indexed by the dimension for which they provide coordinate values, for
+example, @code{lat(lat)}.
+
+It is not necessary to provide a coordinate variable for each dimension;
+if no such variable is defined, the coordinate values of the dimension
+are assumed to be 0, 1, 2, @dots{} (for C programs) or 1, 2, 3, @dots{}
+(for FORTRAN programs).  Although the C and FORTRAN interfaces support
+different conventions for index numbering, there is no difference
+between the actual netCDF files written by C and FORTRAN programs.
+Programs written in either language can be used to access data written
+by programs using the other interface.
+
+In the CDL example, each dimension has an associated coordinate variable
+with the same name as the dimension.  The four values of the
+ at code{level} index, 0, 1, 2, 3, (1, 2, 3, 4 in FORTRAN) are related in
+coordinate-like fashion to the four values (1000, 850, 700, 500) of the
+ at code{level} variable.  Note that there is no requirement that
+coordinates be equally spaced or increasing.  It would not make much
+sense for two coordinate values to be the same, but the meaning of
+coordinate variables is enforced only by conventions of application
+packages and utilities, not by the netCDF interface.  The application
+packages and utilities that make use netCDF coordinate variables assume
+they are one-dimensional and monotonic (all values either increasing or
+decreasing).
+
+ at node What Are Variables?, What Are Attributes?, What Are Dimensions?, Components
+ at section Variables
+ at cindex variables
+
+ at cindex data types
+ at cindex variable shape
+ at cindex shape of a netCDF variable
+ at cindex variable attributes
+ at cindex variable data values
+A @dfn{variable} 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, all of which are specified when the variable is
+created.  Each variable may also have data values and associated
+attributes, which may be added or changed after the variable is created.
+Variables are used to store the bulk of the data in a netCDF file, and
+are the primary component used by utilities to identify sub-parts of a
+netCDF file.
+ at sp 1
+ at cindex variable name
+Like a dimension name, a variable name is an arbitrary sequence of
+alphanumeric characters (also including @samp{_} and @samp{-}) beginning
+with a letter.  Case is distinguished in variable names.  Long names
+help to make a netCDF file self-documenting, but ancillary information
+about a variable is better stored in variable @dfn{attributes}
+(discussed below) than encoded as part of the name.
+
+ at cindex data types
+ at cindex variable data types
+ at cindex NC_BYTE type specifier
+ at cindex NC_CHAR type specifier
+ at cindex NC_SHORT type specifier
+ at cindex NC_LONG type specifier
+ at cindex NC_FLOAT type specifier
+ at cindex NC_DOUBLE type specifier
+ at cindex byte CDL type
+ at cindex char CDL type
+ at cindex short CDL type
+ at cindex long CDL type
+ at cindex float CDL type
+ at cindex double CDL type
+ at vindex NC_BYTE
+ at vindex NC_CHAR
+ at vindex NC_SHORT
+ at vindex NC_LONG
+ at vindex NC_FLOAT
+ at vindex NC_DOUBLE
+ at vindex NCBYTE
+ at vindex NCCHAR
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+A variable data type is one of a small set of netCDF @dfn{types} that
+have the names @code{NC_BYTE}, @code{NC_CHAR}, @code{NC_SHORT},
+ at code{NC_LONG}, @code{NC_FLOAT}, and @code{NC_DOUBLE} in the C interface
+and the corresponding names @code{NCBYTE}, @code{NCCHAR}, @code{NCSHORT},
+ at code{NCLONG}, @code{NCFLOAT}, and @code{NCDOUBLE} in the
+FORTRAN interface.  In the CDL notation, these types are given the
+simpler names @code{byte}, @code{char}, @code{short}, @code{long},
+ at code{float}, and @code{double}.  @code{int} may be used as a synonym
+for @code{long} and @code{real} may be used as a synonym for
+ at code{float} in the CDL notation.  We will postpone a discussion of the
+exact meaning of each of the types until the discussion of @dfn{data},
+below.  For now, it suffices to know that the choice of the type used to
+represent variable data depends on the range of values it can have, the
+precision to which values are known, and the number of bits required to
+represent the variable in a netCDF file on disk.
+
+ at cindex unlimited dimension
+ at cindex scalar variables
+The shape of a variable is specified by its list of dimensions.  If a
+variable has an unlimited dimension, that dimension must appear
+first in the list of dimensions in CDL.  It is possible to define variables
+with no dimensions, also called @dfn{scalar} variables.  There are no
+scalar variables in the example netCDF file.
+
+ at cindex CDL variable declarations
+CDL variable declarations appear after the @code{variables} keyword in
+a CDL unit.  They have the form
+ at display
+     @i{type} @i{variable_name}  ( @i{dim_name_1, dim_name_2, @dots{}} ) ;
+ at end display
+ at noindent
+for variables with dimensions, or
+ at display
+     @i{type} @i{variable_name} ;
+ at end display
+ at noindent
+for scalar variables.
+
+ at cindex record variables
+ at cindex variable size
+In the CDL example there are six variables.  As discussed above, four of
+these are coordinate variables for dimensions.  The remaining variables,
+ at code{temp} and @code{rh}, contain what is usually thought of as the
+data.  Each of these variables has the unlimited dimension @code{time}
+as its first dimension, so they are called @dfn{record variables}.  A
+variable that is not a record variable has a fixed size (number of data
+values) given by the product of its dimensions.  A record variable has a
+current size, given by the product of the maximum record written so far
+and the other dimensions of the variable.  Only record variables may
+grow after they are defined.
+
+ at node What Are Attributes?,  , What Are Variables?, Components
+ at section Attributes
+
+ at cindex attributes
+ at cindex ancillary data
+ at cindex database management systems
+A netCDF @dfn{attribute} is meant to contain information about a netCDF
+variable or about an entire netCDF file.  This information is
+ at dfn{ancillary data}, or data about data, analogous to the information
+stored in data dictionaries and schema in conventional database systems.
+An attribute has an associated variable, a name, a data type, a length,
+and a value.  Individual attributes are identified by specifying a
+variable and an attribute name.
+
+ at cindex variable attributes
+Each attribute is associated with a single variable when it is created.
+Attributes for different variables may differ in data type, length, and
+values even though they share the same name.  
+
+ at cindex global attributes
+A @dfn{global} attribute is one that applies to the whole netCDF rather
+than any particular variable.  Global attributes are defined and
+accessed similarly to variable attributes; the details for defining
+global attributes in the CDL notation and in the netCDF procedural
+interface are presented later.
+
+ at cindex attribute names
+ at cindex conventional attributes
+ at cindex generic applications
+ at cindex units attribute
+Attribute names follow the same rules as dimension and variable names.
+Providing meaningful names for attributes is important, but using agreed
+on conventional names is also required if generic applications and
+utility programs will be used on a netCDF file.  For example, every
+variable for which units make sense should have a @code{units} attribute
+defined, so the units can be printed in labels.  Furthermore, if the
+netCDF file is ever to be used as input to generic units-aware software,
+the values of the @code{units} attributes should be expressed in a
+conventional form as a character string that can be interpreted by that
+software.
+
+ at cindex attribute type
+The type of an attribute is specified when it is created.  The types
+permitted for attributes are exactly the same as the netCDF data types
+used in creating variables.  Attributes with the same name for different
+variables should sometimes be of different types.  For example, the
+attribute @code{valid_max} specifying the maximum valid data value for a
+variable of type @code{long} should be of type @code{long}, whereas the
+attribute @code{valid_max} for a variable of type @code{double} should
+instead be of type @code{double}.
+
+ at cindex attribute length
+ at cindex attribute values
+ at cindex string-valued attributes
+In addition to specifying the associated variable, attribute name, and
+type, the length and value of an attribute must also be specified when it is
+created.  The information in an attribute is represented by either a single
+value (length 1) or a vector of values of the same type.  Since
+``character string'' is not a basic netCDF data type, string-valued
+attributes have a vector of characters as their value, with a length
+equal to the length of the character string.
+
+ at cindex attributes
+ at cindex dimensions
+ at cindex variables
+Attributes are more dynamic than variables or dimensions; they
+can have their type, length, and values changed after they are created.
+For example, an attribute @code{max_value} might store the 
+maximum value seen so far for a record variable, and might 
+be updated every time a new record is written.
+
+ at cindex CDL notation
+ at cindex variable attributes
+ at cindex global attributes
+ at cindex attribute type
+ at cindex attribute length
+The CDL notation for defining an attribute is
+ at display
+    @i{variable_name:attribute_name} = @i{list_of_values} ;
+ at end display
+ at noindent
+for a variable attribute, or
+ at display
+    @i{:attribute_name} = @i{list_of_values} ;
+ at end display
+ at noindent
+for a global attribute.  The type and length of each attribute are not
+explicitly declared in CDL; they are derived from the values assigned to
+the attribute.  All values of an attribute must be of the same type.
+The notation used for constant values of the various netCDF types is
+discussed later (@pxref{CDL Constants}).
+
+In the example netCDF (@pxref{Components, , CDL example}), @code{units}
+is an attribute for the variable @code{lat} that has a
+13 character array value @samp{degrees_north}. And @code{valid_range} is an
+attribute for the variable @code{rh} that has length 2 and values
+ at samp{0.0} and @samp{1.0}.
+
+ at cindex global attributes
+One global attribute--- at code{source}---is defined
+for the example netCDF file.  This is a character array intended for
+documenting the data.  Real netCDF files typically have more global
+attributes to document the origin, history, accuracy, and other
+characteristics of the data.
+
+ at menu
+* Attribute Conventions::    Conventions for Commonly Used Attributes
+
+* Attributes and Variables:: Differences Between Attributes and Variables
+ at end menu
+
+ at node    Attribute Conventions, Attributes and Variables,  , What Are Attributes?
+ at comment  node-name,  next,  previous,  up
+ at subsection Attribute Conventions
+
+ at cindex attribute conventions
+ at cindex conventional attributes
+ at cindex generic applications
+Generic applications that take netCDF files as input may by
+convention expect certain variable and global attributes.  A few other
+attributes are handled in special ways by the netCDF library (these
+reserved attributes will have names that begin with a leading underscore
+character @samp{_}).  If you want to be able to use generic
+applications with your files, you should use the following conventional
+names for these commonly used attributes:
+
+ at cindex units attribute
+ at table @code
+ at item units
+A character array that specifies the units used for the variable's data.
+A standard for conventional ways to name units in each specific
+discipline should be used, if available.  Unidata has developed a
+freely-available library of routines to convert between character string
+and binary forms of unit specifications and to perform various useful
+operations on the binary forms.  This library is used in some netCDF
+applications.  Using the recommended units syntax permits data
+represented in conformable units to be automatically converted to common
+units for algebraic operations.  @xref{Units}, for more information.
+
+ at cindex long_name attribute
+ at cindex variable name
+ at item long_name
+A long descriptive name.  This could be used for labelling plots, for
+example.  If a variable has no @code{long_name} attribute assigned, the
+variable name will be used as a default.
+ at cindex valid_range attribute
+ at item valid_range
+An array of two numbers specifying the minimum and maximum valid values
+for this variable.  The type of each @code{valid_range} attribute should
+match the type of its variable.
+ at cindex valid_min attribute
+ at cindex valid_max attribute
+ at item valid_min
+ at itemx valid_max
+One or both of these may be used instead of @code{valid_range}; this
+handles the case where it only makes sense to bound the data below
+or above.
+ at cindex scaling data
+ at cindex scale_factor attribute
+ at item scale_factor
+If present for a variable, the data are to be multiplied by this factor
+after the data are read by the application that accesses the data.
+ at cindex data packing
+ at cindex data compression
+ at cindex data resolution
+ at cindex add_offset attribute
+ at item add_offset
+If present for a variable, this number is to be added to the data after
+it is read by the application that accesses the data.  If
+both @code{scale_factor} and @code{add_offset} attributes are present,
+the data are first scaled before the offset is added.
+The attributes @code{scale_factor} and @code{add_offset} can be used
+together to provide simple data compression to store low-resolution
+floating-point data as small integers in a netCDF file.  When scaled data
+are written, the application should first subtract the offset and then
+divide by the scale factor.
+
+When @code{scale_factor} and @code{add_offset} are used for packing, the
+associated variable (containing the packed data) is typically of type
+byte or short, whereas the unpacked values are intended to be of type
+float or double.  The attributes @code{scale_factor} and
+ at code{add_offset} should both be of the type intended for the unpacked
+data, e.g. float or double.
+
+ at cindex missing values
+ at cindex fill values
+ at cindex FillValue attribute
+ at item _FillValue
+If a scalar attribute with this name is defined for a variable and is of
+the same type as the variable, it will be subsequently used as the
+ at emph{fill value} for that variable.  The purpose of this attribute is
+to save the applications programmer the work of prefilling the data and
+also to eliminate the duplicate writes that result from netCDF filling
+in missing data with its default fill value, only to be immediately
+overwritten by the programmer's preferred value.  This value is
+considered to be a special value that indicates missing data, and is
+returned when reading values that were not written.  The missing value
+should be outside the range specified by @code{valid_range} for a
+variable.  It is not necessary to define your own @code{_FillValue}
+attribute for a variable if the default @dfn{fill value} for the type of
+the variable is adequate.  Note that if you change the value of this
+attribute, the changed value only applies to subsequent writes;
+previously written data are not changed.  @xref{Missing Values}, for
+more information.
+
+ at cindex missing_value
+ at item missing_value
+ at code{missing_value} is a conventional name for a missing value that
+will not be treated in any special way be the library, as the
+ at code{_FillValue} attribute is.  It is also useful when it is necessary
+to distinguish between two kinds of missing values.  For example,
+ at code{_FillValue} might be useful to indicate data that was expected but
+did not appear, whereas @code{missing_value} might be used to indicate
+grid regions that are not intended to contain data.  @xref{Missing
+Values}, for more information.
+
+ at cindex signedness
+ at cindex signed
+ at cindex unsigned
+ at item signedness
+Used to indicate a nondefault interpretation of the signedness of
+integer values.  By default, applications that deal with values should
+treat netCDF byte data as unsigned and netCDF short and long integer
+data as signed.  If you declare a netCDF variable for storing bytes, and
+you intend that the values represent signed quantities, you should
+declare the variable attribute @code{signedness} with value
+ at code{"signed"}.  Similarly, if you define a variable for an array of
+short or long integers and you intend that the values be interpreted as
+unsigned, it would be appropriate to define the variable attribute
+ at code{signedness = "unsigned"}.  This attribute is ignored by the netCDF
+library, but applications may use it.  Since there are no standard
+FORTRAN types corresponding to unsigned integers, FORTRAN programs that
+compute with or use the ordering of data values may need to handle this
+attribute.
+
+ at cindex print formats
+ at cindex C_format attribute
+ at item C_format
+A character array for the format that should be used to print values for
+this variable by C applications.  For example, if you know a variable is
+only accurate to three significant digits, it would be appropriate to
+define the @code{C_format} attribute as @code{"%.3g"}.  The
+ at code{ncdump} utility program uses this attribute for variables for
+which it is defined.
+
+ at cindex FORTRAN_format attribute
+ at item FORTRAN_format
+A character array for the format that should be used to print values for
+this variable by FORTRAN applications.
+
+ at cindex title attribute
+ at item title
+A global attribute that is a character array providing a succinct
+description of what is in the data set.
+
+ at cindex recording data history
+ at cindex generic applications
+ at cindex generic filters
+ at cindex history attribute
+ at item history
+A global attribute that is a character array with a line for each
+invocation of a program and arguments that were used to derive the file.
+Well-behaved generic netCDF filters (programs that take netCDF files as
+input and produce netCDF files as output) will automatically append
+their name and the parameters with which they were invoked to the global
+history attribute of an input netCDF file.
+ at end table
+Attributes may be added to a netCDF file long after it is first defined,
+so you don't have to anticipate all potentially useful attributes.
+However adding new attributes to an existing file can incur the same
+expense as copying the file.  @xref{File Structure, , NetCDF File
+Structure and Performance}, for a more extensive discussion.
+
+ at node   Attributes and Variables,  , Attribute Conventions, What Are Attributes?
+ at subsection Differences between Attributes and Variables
+
+ at cindex variables
+ at cindex attributes
+ at cindex differences between attributes and variables
+ at cindex ancillary data
+In contrast to variables, which are intended for bulk data, attributes
+are intended for ancillary data, or information about the data.
+Typically the data in variables of an open netCDF will reside on disk,
+because the data are too large to fit in memory all at once.  In
+contrast, the total amount of ancillary data associated with a netCDF
+object and stored in its attributes is typically small enough to be
+memory-resident.
+
+Another difference between attributes and variables is that variables
+may be multidimensional.  Attributes are all either scalars
+(single-valued) or vectors (a single, fixed dimension).
+
+ at cindex variable values
+ at cindex attribute values
+Variables are created with a name, type, and shape before they are assigned
+data values, so a variable may exist with no values.  The value of an
+attribute must be specified when it is created, so no attribute ever
+exists without a value.
+
+ at cindex units attribute
+A variable may have attributes, but an attribute cannot have attributes.
+Attributes assigned to variables may have the same units as the variable
+(for example, @code{valid_range}) or have no units (for example,
+ at code{scale_factor}).  If you want to store data in a netCDF file that
+requires units different from those of the associated variable, it is
+better to use a variable than an attribute.  More generally, if data
+require ancillary data to describe them, are multidimensional, require
+any of the defined netCDF dimensions to index their values, or require a
+significant amount of storage, the data should be represented using
+variables rather than attributes.
+
+ at node Data, Usage, Components, Top
+ at chapter Data
+
+This chapter discusses the six primitive netCDF data types, the kinds of
+data access supported by the netCDF interface, and how data structures other
+than multidimensional arrays may be implemented in a netCDF file.
+
+ at menu
+* Data Types::      The six basic netCDF data types.
+
+* Data Access::     Direct access, hyperslab access, and record access.
+
+* Data Structures:: Representing other structures with netCDF arrays.
+ at end menu
+
+ at node Data Types, Data Access,  , Data
+ at section NetCDF Data Types
+
+ at cindex netCDF data types
+ at cindex byte type
+ at cindex char type
+ at cindex short type
+ at cindex long type
+ at cindex float type
+ at cindex double type
+ at cindex primitive netCDF types
+ at cindex ASCII characters
+ at cindex IEEE floating-point
+The current set of primitive types supported by the netCDF interface are:
+ at table @code
+ at item byte
+Eight-bit data; especially good for saving space when
+only a few values are possible or resolution is low.
+ at item character
+Currently synonymous with @code{byte}; intended for
+representing text strings as arrays of ASCII characters.
+ at item short
+16-bit integers.
+ at item long
+32-bit integers.
+ at item float
+32-bit IEEE floating-point.
+ at item double
+64-bit IEEE floating-point.
+ at end table
+
+ at cindex unsigned
+ at cindex CDL reserved words
+Except for the added @code{byte} and the lack of
+unsigned types, netCDF 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.
+Whether byte, short, or long data is interpreted as signed or unsigned
+is not part of the netCDF interface; since no netCDF operations depend
+on the sign or order of variable data, you are free to interpret a byte,
+for example, as holding values between 0 and 255 or between -128 and
+127.  For convenience, short and long constants are interpreted as
+signed in the CDL notation.  @xref{Attribute Conventions} for more
+information on representing signedness of values.
+
+ at cindex XDR
+These types were chosen because they are familiar to C and FORTRAN
+programmers, they have well-defined external representations independent
+of any particular computers (using XDR), and they are sufficient for
+providing a reasonably wide range of trade-offs between data precision
+and number of bits required for each datum.
+
+ at cindex future changes planned
+Additional primitive types may be added in the future, but only in a way
+that is compatible with existing programs and files.  For example,
+ at code{hyperlong} for 64-bit integers will eventually be needed, along
+with a new type for multibyte characters, but these can both be added
+without affecting existing netCDF files or applications, and with
+only minor changes required for generic applications that will support
+them.
+
+ at node Data Access, Data Structures, Data Types, Data
+ at section Data Access
+
+The netCDF interface supports several kinds of data access to data in an
+open netCDF file:
+ at itemize @bullet
+ at item
+direct (random) access to single data values,
+ at item
+direct access to an arbitrary generalized cross-section of data
+for a single variable,
+ at item
+record-oriented access to data for a single variable, and
+ at item
+record-oriented access to a subset of the variables in a record.
+ at end itemize
+
+To directly access a single data value, you specify a netCDF file, a
+variable, and a multidimensional index for the variable.  Files are not
+specified by name every time you want to access data, but instead by a
+small integer obtained when the file is first created or opened.
+Similarly, variables are not specified by name for every data access
+either, but by variable IDs, small integers used to identify variables
+in a netCDF file.
+
+ at cindex hyperslabs
+ at cindex hyperslab corner
+ at cindex hyperslab edge lengths
+ at cindex subscript order
+ at cindex index order
+ at cindex data order
+Data in a netCDF file can be accessed as single values or as
+ at dfn{hyperslabs}.  A hyperslab is a generalized piece of a
+multidimensional variable that is specified by giving the indices of a
+corner point and a list of edge lengths along each of the dimensions of
+the variable.  The corner point specified must be the one with the
+smallest indices, that is the one closest to the origin of the variable
+index space.  The block of data values returned (or written) has the
+last dimension of the variable varying fastest, and the first dimension
+varying most slowly in the C interface.  For FORTRAN, the order is
+reversed, with the first dimension of the variable varying fastest and
+the last dimension varying most slowly.  These ordering conventions
+correspond to the customary order in which multidimensional variables
+are stored in C and FORTRAN.
+
+ at cindex hyperslab access example
+As an example of hyperslab access, assume that in the example
+netCDF file (@pxref{Components, , CDL example}), you wish to read all the
+data for the @code{temp} variable at the second (850 millibar) level, and
+assume that there are currently three records (@code{time} values) in
+the netCDF file.  Recall that the dimensions are defined as
+ at example
+        lat = 5, lon = 10, level = 4, time = unlimited;
+ at end example
+ at noindent
+and the variable @code{temp} is declared as
+ at example
+        float   temp(time, level, lat, lon);
+ at end example
+ at noindent
+in the CDL notation.
+
+A corresponding C variable that holds data for all four levels and all
+three times might be declared as
+ at example
+#define LATS  5
+#define LONS 10
+#define LEVELS 4
+#define TIMES 3                 /* currently */
+    @dots{}
+float   temp[TIMES*LEVELS*LATS*LONS];
+ at end example
+ at noindent
+to keep the data in a one-dimensional array, or
+ at example
+    @dots{}
+float   temp[TIMES][LEVELS][LATS][LONS];
+ at end example
+ at noindent
+using a multidimensional array declaration.  To read in a hyperslab of
+data for only one level at a time, for example, you could leave out the
+LEVEL dimension or set it to 1.
+
+In FORTRAN, the dimensions are reversed from the CDL declaration with the
+first dimension varying fastest and the record dimension as the last
+dimension of a record variable.  Thus a FORTRAN declaration for the
+coresponding variable that holds all times and levels is
+ at example
+ at group
+      PARAMETER (LATS=5, LONS=10, LEVELS=4, TIMES=3)
+         @dots{}
+      REAL TEMP(LONS, LATS, LEVELS, TIMES)
+ at end group
+ at end example
+
+ at cindex hyperslab corner
+ at cindex hyperslab edge lengths
+ at cindex subscript order
+ at cindex index order
+ at cindex data order
+To specify the hyperslab of data that represents the second level, all
+times, all latitudes, and all longitudes, we need to provide a corner
+and some edge lengths.  The corner should be (0, 1, 0, 0) in C---or (1,
+1, 2, 1) in FORTRAN---because you want to start at the beginning of each
+of the @code{time}, @code{lon}, and @code{lat} dimensions, but you want
+to begin at the second value of the @code{level} dimension.  The edge
+lengths should be (3, 1, 5, 10) in C---or (10, 5, 1, 3) in
+FORTRAN---since you want to get data for all three @code{time} values,
+only one @code{level} value, all five @code{lat} values, and all 10
+ at code{lon} values.  You should expect to get a total of 150 float values
+returned (3 * 1 * 5 * 10), and should provide enough space in your array
+for this many.  The order in which the data will be returned is with the
+last dimension, @code{lon}, varying fastest for C, or with the first
+dimension, @code{LON}, varying fastest for FORTRAN:
+ at example
+ at group
+              C                  FORTRAN
+
+     temp[0][1][0][0]      TEMP(1, 1, 2, 1)
+     temp[0][1][0][1]      TEMP(2, 1, 2, 1)
+     temp[0][1][0][2]      TEMP(3, 1, 2, 1)
+     temp[0][1][0][3]      TEMP(4, 1, 2, 1)
+
+           @dots{}                 @dots{}
+
+     temp[2][1][4][7]      TEMP( 8, 5, 2, 3)
+     temp[2][1][4][8]      TEMP( 9, 5, 2, 3)
+     temp[2][1][4][9]      TEMP(10, 5, 2, 3)
+ at end group
+ at end example
+
+ at cindex language interfaces
+ at cindex data order
+ at cindex order of data
+Note that the different dimension orders for the C and FORTRAN
+interfaces do not reflect a different order for values stored on the
+disk, but merely different orders supported by the procedural interfaces
+to the two languages.  In general, it does not matter whether a netCDF
+file is written using the C or FORTRAN interface; netCDF files written
+from either language may be read by programs written in the other
+language.
+
+ at cindex generalized hyperslabs
+ at cindex hyperslab corner
+ at cindex hyperslab edge lengths
+Besides the regular hyperslab access described above, the netCDF
+abstraction also supports the reading and writing of @dfn{generalized
+hyperslabs}.  A generalized hyperslab has the same corner point and edge
+lengths attributes as a regular hyperslab.  It allows, however, more
+general mappings between the points of the hyperslab and both the
+disk-resident values of the netCDF variable and the locations for those
+values in memory.
+
+ at cindex strides
+In a regular hyperslab, the mapping between the points of the hyperslab and 
+the values of a netCDF variable can be described as contiguous: along each
+dimension, adjacent hyperslab points correspond to adjacent netCDF variable
+values.
+In a generalized hyperslab, however, this is not necessarily true;
+in any dimension, adjacent generalized hyperslab points correspond to
+netCDF variable values that are separated by a distance of @dfn{n} values.
+ at dfn{n} is the @dfn{stride} of the dimension and needn't be the same for all
+dimensions.
+Strides may reasonably vary from one (to access adjacent netCDF variable 
+values) to the number of points in a netCDF dimension.
+A regular hyperslab has unity strides in all dimensions.
+
+ at cindex index mapping vector
+The other mapping allowed by generalized hyperslabs is between the
+points of the hyperslab and the memory locations of the corresponding
+values.  In a regular hyperslab, this mapping is trivial: the structure
+of the in-memory values (i.e. the dimensional sizes and their order) is
+identical to that of the hyperslab.  In a generalized hyperslab,
+however, this is not necessarily true, instead an @dfn{index mapping
+vector} is used to define the mapping between points in the generalized
+hyperslab and the memory locations of the corresponding values.  The
+offset, in bytes, from the origin of a memory-resident array to a
+particular point is given by the
+ at cindex inner product
+ at dfn{inner product}
+ at footnote{
+The @dfn{inner product} of two vectors 
+[x0, x1, @dots{}, xn] and [y0, y1, @dots{}, yn] is just x0*y0 + x1*y1 + @dots{} + 
+xn*yn.
+}
+of the index mapping vector with the point's 
+ at cindex coordinate offset vector
+ at dfn{coordinate offset vector}
+ at footnote{
+A point's @dfn{coordinate offset vector} gives,
+for each dimension, the offset from the origin of the containing array
+to the point.
+In C, a point's coordinate offset vector is the same as it's coordinate
+vector.
+In FORTRAN, however, the values of a point's coordinate offset vector
+are one less than the corresponding values of the point's coordinate vector.
+}
+.
+The index
+mapping vector for a regular hyperslab would have -- in order from most
+rapidly varying dimension to most slowly -- the byte size of a
+memory-resident datum (e.g. 4 for a floating-point value), then the
+product of that value with the edge length of the most rapidly varying
+dimension of the hyperslab, then the product of that value with the edge
+length of the next most rapidly varying dimension, and so on.  In a
+generalized hyperslab, however, the correspondence between hyperslab
+points and memory locations can be radically diferent.  For example, the
+following C definitions
+ at example 
+ at group
+struct vel @{
+    int flags;
+    float u;
+    float v;
+@} vel[NX][NY];
+long imap[2] = @{
+    sizeof(struct vel),
+    sizeof(struct vel)*NY@};
+ at end group
+ at end example
+where @code{imap} is the index mapping vector,
+can be used to access the memory-resident values of the netCDF variable,
+ at code{vel[NY][NX]}, even
+though the dimensions are transposed and the data is contained in a 2-D array
+of structures rather than a 2-D array of floating-point values.
+
+Note that, although the netCDF abstraction allows the use of generalized 
+hyperslab access if warranted by the situation, it does not mandate it.
+If you do not need generalized hyperslab access, you may ignore this
+capability and use regular hyperslab access instead.
+
+ at cindex records
+ at cindex record-oriented access
+ at cindex record variables
+ at cindex appending data
+To perform conventional record-oriented access, you specify a netCDF
+file, a record variable (one defined with an unlimited dimension),
+and for the record number use the value of the first dimension (last
+dimension in FORTRAN), using hyperslab access to get the record of
+values.
+
+ at cindex record I/O
+You may read or write multiple record variables, even if the variables
+are of different types, with a single call in the C interface.  In this
+case you must write a whole record's-worth of data for each desired
+variable.  This interface is supported as a convenience for C
+programmers, but is not strictly necesary, since the same result may be
+achieved with one read or write call for each variable.  An equivalent
+portable FORTRAN interface that replaces multiple calls with a single
+call is unfortunately not possible.  However, data written using the C
+interface can still be read with the FORTRAN interface, using one call
+per variable.
+
+ at cindex efficiency
+ at cindex performance
+ at cindex order of dimensions
+ at cindex data order
+ at cindex representation on disk
+When efficiency is a concern, you should keep in mind the order in which
+netCDF data are written on the disk, since the best I/O performance is
+achieved by reading or writing contiguous data.  All variable data are
+ordered with the last dimension for each variable varying fastest in the
+C interface, or the slowest in the FORTRAN interface.  This means that
+for record variables in particular, at least one disk access per record
+will be required for reading a value from each record.  Hence reading a
+hyperslab that takes one value out of each record will require as many
+disk accesses as the number of values requested.  For writing, the
+situation is even worse, since each record must first be read and then
+rewritten to change a single value within a record.  If you have a
+choice about the order in which data is accessed or the order of the
+dimensions that define the shape of a variable, try to choose these two
+orders in harmony to avoid needless inefficiency.
+
+ at node Data Structures,  , Data Access, Data
+ at section Data Structures
+ at cindex data structures
+ at cindex sparse matrices
+ at cindex trees
+ at cindex linked lists
+ at cindex pointers
+ at cindex XDR
+The only kind of data structure directly supported by the netCDF
+abstraction is a collection of named scalar and multidimensional
+variables with attached vector attributes.  NetCDF is not particularly
+well-suited for storing linked lists, trees, sparse matrices, or other
+kinds of data structures requiring pointers.  The underlying XDR library
+on which netCDF is implemented is quite suitable for storing and
+retrieving arbitrary data structures in a network-transparent way, but
+such structures will no longer be self-describing unless you encode
+information about the structure with the data.
+ at cindex index variables
+It is possible to build other kinds of data structures from sets of
+multidimensional arrays by adopting various conventions regarding the
+use of data in one array as pointers into another array.  The netCDF
+library won't provide much help or hindrance with constructing such data
+structures, but netCDF provides the mechanisms with which such
+conventions can be designed.  
+
+ at cindex indexing values
+For example, it is possible to use a variable attribute to name an
+associated index variable: the variable attribute @samp{array_index_var
+= "v_index"} might provide the name of another associated variable to be
+used as an index for fast retrieval by value in the variable to which
+the attribute is attached.
+
+ at cindex grouping variables
+As another example, netCDF variables may be grouped within a netCDF file
+by defining attributes that list the names of the variables in each
+group, separated by a conventional delimiter such as a space or comma.
+A convention can be adopted to use particular sorts of attribute names
+for such groupings, so that an arbitrary number of named groups of
+variables can be supported.  If needed, a particular conventional
+attribute for each variable might list the names of the groups of which
+it is a member.  Use of attributes or variables that refer to other
+attributes or variables provides a flexible mechanism for representing
+complex structures in netCDF files.
+
+ at node Usage, File Operations, Data, Top
+ at chapter Use of the NetCDF Library
+
+ at cindex netCDF library use
+ at cindex common netCDF calls
+ at cindex typical netCDF calls
+It is not necessary to know about the whole netCDF interface to make use
+of the netCDF library.  If you are creating a netCDF file, only a
+handful of routines are required to define the necessary dimensions,
+variables, and attributes, and to write the data to the netCDF file.
+Similarly, if you are writing software to access data stored in a
+particular netCDF object, only a small subset of the netCDF library is
+required to open the netCDF file and access the data.  Only authors of
+generic applications that access arbitrary netCDF files and write out
+transformed netCDF files need to be familiar with the whole netCDF
+library.  In this chapter we provide templates of common sequences of
+netCDF subroutine calls needed for common uses.  Full argument lists for
+the procedures and subroutines are described in later chapters.
+
+ at menu
+* Creating a netCDF File::     How to create a new netCDF file.
+
+* Reading with Known Names::   How to read a netCDF file with known names.
+
+* Reading with Unknown Names:: How to read a generic netCDF.
+
+* Adding Components::          How to add new dimensions, variables, and
+                               attributes.
+
+* Error Handling::             How to handle errors.
+ at end menu
+
+ at node Creating a netCDF File, Reading with Known Names,  , Usage
+ at section Creating a NetCDF File
+
+ at cindex netCDF file creation
+ at cindex creating a netCDF file
+The typical sequences of C netCDF calls used to create a new netCDF file
+follows. For clarity we only present the name of the
+routines, omit all declarations, parameters and error checking, and use
+ at code{@dots{}} to represent arbitrary sequences of other statements:
+
+ at findex nccreate
+ at findex ncdimdef
+ at findex ncvardef
+ at findex ncattput
+ at findex ncendef
+ at findex ncvarput
+ at findex ncclose
+ at example
+    nccreate      /* create netCDF file: enter define mode */
+         @dots{}
+       ncdimdef   /* dimension definitions: from name and size */
+         @dots{}
+       ncvardef   /* variable definitions: from name, type, dimensions */
+         @dots{}
+       ncattput   /* attribute put: assign attribute values */
+         @dots{}
+    ncendef       /* end definitions: leave define mode */
+         @dots{}
+    ncvarput      /* variable put: provide values for variables */
+      @dots{}
+    ncattput      /* attribute put: change attribute values */
+      @dots{}
+    ncclose       /* close: save new netCDF file */
+ at end example
+
+In FORTRAN, the corresponding sequence looks like this:
+ at findex NCCRE
+ at findex NCDDEF
+ at findex NCVDEF
+ at findex NCAPT
+ at findex NCAPTC
+ at findex NCENDF
+ at findex NCVPT
+ at findex NCVPTC
+ at findex NCVPTG
+ at findex NCCLOS
+ at example
+    NCCRE              ! create netCDF file: enter define mode
+         @dots{}
+       NCDDEF          ! define dimensions: from name and size
+         @dots{}
+       NCVDEF          ! define variables: from name, type, dimensions
+         @dots{}
+       NCAPT or NCAPTC ! attribute put: assign attribute values
+         @dots{}
+    NCENDF             ! end definitions: leave define mode
+         @dots{}
+    NCVPT or NCVPTC    ! variable put: provide values for variables
+      @dots{}
+    NCAPT or NCAPTC    ! attribute put: change attribute values
+      @dots{}
+    NCCLOS             ! close: save new netCDF file
+ at end example
+
+ at noindent
+The FORTRAN interface provides two subroutines for defining attributes
+and providing values for variables, depending on whether a numeric or
+character string value is used.  The FORTRAN template indicates that
+either of these subroutines could be called.
+
+ at cindex define mode
+ at cindex data mode
+ at cindex dimensions
+ at cindex variables
+ at cindex attributes
+Only one call is needed to begin creating a netCDF file, at which
+point you will be in the first of two netCDF @dfn{modes}.  When
+accessing a netCDF, you are either in @dfn{define mode} or @dfn{data
+mode}.  In define mode, you can create dimensions, variables, and new
+attributes, but you cannot read or write variable data.  In data mode,
+you can access data and change existing attributes, but you are not
+permitted to create new dimensions, variables, or attributes.
+
+ at cindex attributes
+ at cindex variables
+ at cindex dimensions
+ at cindex define mode
+ at findex ncdimdef
+ at findex NCDDEF
+ at findex ncvardef
+ at findex NCVDEF
+ at findex ncattput
+ at findex NCAPT
+ at findex NCAPTC
+ at findex ncendef
+ at findex NCENDF
+One call to @code{ncdimdef} (or @code{NCDDEF}) is needed for each
+dimension created.  Similarly, one call to @code{ncvardef} (or
+ at code{NCVDEF}) is needed for each variable creation, and one call to
+ at code{ncattput} (or @code{NCAPT} or @code{NCAPTC}) is needed for each
+attribute defined and assigned a value.  The only way to leave define
+mode and enter data mode is by a call to @code{ncendef} (or
+ at code{NCENDF}).
+
+ at cindex data mode
+ at cindex attributes
+ at cindex variables
+ at findex ncvarput1
+ at findex NCVPT1
+ at findex NCVP1C
+ at findex ncvarput
+ at findex ncvarputg
+ at findex ncrecput
+ at findex NCVPT
+ at findex NCVPTC
+ at findex NCVPTG
+ at findex NCVPGC
+Once in data mode, you can add new data to variables, change old values,
+and change values of existing attributes (so long as the attribute
+changes do not require more storage space for the attribute).  Single
+values are written to a variable with @code{ncvarput1} (or @code{NCVPT1}
+or @code{NCVP1C}); while arbitrary hyperslabs of data are written using
+ at code{ncvarput} or @code{ncvarputg} (or @code{NCVPT}, @code{NCVPTC},
+ at code{NCVPTG}, or @code{NCVPGC}) instead.  Multi-variable records of
+data may be written using multiple calls to @code{ncvarput} (or @code{NCVPT})
+or with a single call to @code{ncrecput}.
+
+ at cindex data loss
+ at cindex abnormal termination
+ at cindex closing files
+ at cindex attributes
+ at cindex variables
+ at cindex performance
+ at cindex efficiency
+ at findex ncclose
+ at findex NCCLOS
+ at findex ncsync
+ at findex NCSNC
+Finally, you should explicitly close all open netCDF
+files on which you are writing by calling @code{ncclose} (or
+ at code{NCCLOS}) before the program exits.  If a program terminates
+abnormally with netCDF files open for writing, you may lose one or more
+records of the most recently written record variable data as well as any
+attribute changes since the last call to @code{ncsync} (or
+ at code{NCSNC}).  It is possible to reduce the chance of losing data due
+to abnormal termination by explicitly calling @code{ncsync}
+(@code{NCSNC}) after every write to netCDF variables or change to
+attribute values.  This can be expensive in computer resources, so
+such calls should ordinarily be omitted unless they are really needed.
+
+ at node Reading with Known Names, Reading with Unknown Names, Creating a netCDF File, Usage
+ at section Reading a NetCDF File with Known Names
+
+ at cindex known names
+ at cindex reading a netCDF file
+ at cindex generic applications
+If you know the names of the dimensions, variables, and attributes in a
+netCDF file, you can write calls to read data from the file; you don't
+need to include the ``inquire'' calls that determine the dimensions,
+variables, and attributes.  If you employ such knowledge
+about particular netCDF files, the program you write will lack
+generality.  It will only work with files that have the assumed names
+and structure, so you will be losing some of the advantages of using the
+netCDF interface.  However, you may be writing software that expects the
+user or some other program to supply variable or dimension names,
+perhaps as subroutine or command line arguments.  In that case, the
+resulting program could be quite general.
+
+When you know the names of some variables of interest and their
+dimensions, the order of typical C calls to read data from those
+variables in a netCDF file is:
+
+ at findex ncopen
+ at findex ncdimid
+ at findex ncvarid
+ at findex ncattget
+ at findex ncvarget
+ at findex ncclose
+ at example
+    ncopen           /* open existing netCDF */
+      @dots{}
+    ncdimid          /* get dimension IDs to use in accessing data */
+      @dots{}
+    ncvarid          /* get variable IDs */
+      @dots{}
+    ncattget         /* get attribute values, if needed */
+      @dots{}
+    ncvarget         /* get values of variables */
+      @dots{}
+    ncclose          /* close netCDF */
+ at end example
+ at sp 1
+In FORTRAN, the corresponding sequence looks like this:
+ at findex NCOPN
+ at findex NCDID
+ at findex NCVID
+ at findex NCAGT
+ at findex NCAGTC
+ at findex NCVGT
+ at findex NCVGTC
+ at findex NCVGTG
+ at findex NCCLOS
+ at example
+    NCOPN            !  open existing netCDF 
+      @dots{}
+    NCDID            !  get dimension IDs to use in accessing data 
+      @dots{}
+    NCVID            !  get variable IDs 
+      @dots{}
+    NCAGT or NCAGTC  !  get attribute values, if needed 
+      @dots{}
+    NCVGT or NCVGTC  !  get values of variables 
+      @dots{}
+    NCCLOS           !  close netCDF 
+ at end example
+
+ at cindex opening a netCDF file
+First, a single call opens the netCDF file, given the file name, and
+returns a netCDF ID that is used to refer to the netCDF in all
+subsequent calls.  
+
+ at cindex dimensions
+ at cindex dimension IDs
+ at cindex variables
+ at cindex variable IDs
+ at cindex variable data
+ at cindex efficiency
+ at cindex performance
+ at cindex hyperslab access
+ at findex ncopen
+ at findex NCOPN
+ at findex ncvarid
+ at findex NCVID
+ at findex ncattget
+ at findex NCAGT
+ at findex NCAGTC
+ at findex ncvarget1
+ at findex NCVGT1
+ at findex NCVG1C
+ at findex ncvarget
+ at findex ncvargetg
+ at findex NCVGT
+ at findex NCVGTC
+ at findex NCVGTG
+ at findex NCVGGC
+Next, a call to @code{ncdimid} (or @code{NCDID}) for each dimension of
+interest gets the dimension ID from the dimension name.  Dimension IDs,
+like netCDF IDs, are small integers used to refer to dimensions in
+subsequent calls.  Similarly, each required variable ID is determined
+from its name by a call to @code{ncvarid} (or @code{NCVID}).  Once
+variable IDs are known, variable attribute values can be retrieved using
+the netCDF ID, the variable ID, and the desired attribute name as input
+to @code{ncattget} (or @code{NCAGT} or @code{NCAGTC}) for each desired
+attribute.  Variable data values can be directly accessed from the
+netCDF file with @code{ncvarget1} (or @code{NCVGT1} or @code{NCVG1C})
+for single values, @code{ncvarget} or @code{ncvargetg} (or @code{NCVGT},
+ at code{NCVGTC}, @code{NCVGTG}, or @code{NCVGGC}) for hyperslabs of
+values, or @code{ncrecget} for records of values.  To minimize the
+number of disk accesses, you should remember that the last dimension in
+C (first dimension in FORTRAN) varies fastest when using hyperslab
+access.
+
+ at cindex closing a netCDF file
+ at findex ncclose
+ at findex NCCLOS
+Finally, the netCDF file can be closed with @code{ncclose} (or
+ at code{NCCLOS}) when you are finished with it to free system
+resources.  There is no harm in not closing a file open only for
+reading.
+ at node Reading with Unknown Names, Adding Components, Reading with Known Names, Usage
+ at section Reading a netCDF File with Unknown Names
+ at cindex generic applications
+ at cindex inquire functions
+ at cindex dimensions
+ at cindex variables
+ at cindex attributes
+If you want to write generic software (i.e., a program that transposes
+specified variables by interchanging specified dimensions) you should
+make no assumptions about the dimension and variable names that are not
+specified.  In such cases, you must find out about all the dimensions,
+variables, and attributes in a netCDF file by calling the inquire
+functions.  Four inquire functions get information about a whole netCDF
+file, a dimension, a variable, or an attribute.  The following template
+illustrates how they are used:
+ at findex ncopen
+ at findex ncinquire
+ at findex ncdiminq
+ at findex ncvarinq
+ at findex ncattname
+ at findex ncattinq
+ at findex ncattget
+ at findex ncvarget
+ at findex ncclose
+ at example
+ at group
+    ncopen           /* open existing netCDF */
+      @dots{}
+    ncinquire        /* find out what is in it */
+         @dots{}
+       ncdiminq      /* get dimension names, sizes */
+         @dots{}
+       ncvarinq      /* get variable names, types, shapes */
+            @dots{}
+          ncattname  /* get attribute names */
+            @dots{}
+          ncattinq   /* get attribute types and lengths */
+            @dots{}
+          ncattget   /* get attribute values */
+            @dots{}
+    ncvarget         /* get values of variables */
+      @dots{}
+    ncclose          /* close netCDF */
+ at end group
+ at end example
+
+In FORTRAN, the corresponding sequence looks like this:
+ at findex NCOPN
+ at findex NCINQ
+ at findex NCDINQ
+ at findex NCVINQ
+ at findex NCAINQ
+ at findex NCAGT
+ at findex NCAGTC
+ at findex NCVGT
+ at findex NCVGTC
+ at findex NCVGTG
+ at findex NCCLOS
+ at example
+ at group
+    NCOPN                 !  open existing netCDF 
+      @dots{}
+    NCINQ                 !  find out what is in it 
+         @dots{}
+       NCDINQ             !  get dimension names, sizes 
+         @dots{}
+       NCVINQ             !  get variable names, types, shapes 
+            @dots{}
+          NCANAM          !  get attribute names 
+            @dots{}
+          NCAINQ          !  get attribute values 
+            @dots{}
+          NCAGT or NCAGTC !  get attribute values 
+            @dots{}
+    NCVGT or NCVGTC       !  get values of variables 
+      @dots{}
+    NCCLOS                !  close netCDF 
+ at end group
+ at end example
+
+ at findex ncinquire
+ at findex NCINQ
+As in the previous example, a single call opens the existing netCDF
+file, returning a netCDF ID.  This netCDF ID is given to the
+ at code{ncinquire} (or @code{NCINQ}) routine, which returns the number of
+dimensions, the number of variables, the number of global attributes,
+and the ID of the unlimited dimension, if there is one.
+
+ at findex ncrecinq
+ at cindex record variables
+Another inquire function, @code{ncrecinq}, is provided for convenience
+to return information about record variables, although the information
+is also obtainable by using the other inquire functions.  The
+ at code{ncrecinq} function returns the number of record variables, their
+variable IDs, and how much memory space is needed for a record's worth
+of data for each record variable.
+
+ at cindex performance
+All the inquire functions are quite inexpensive to use and require no
+I/O, since the information they provide is stored in a table in memory
+for each open netCDF file.  In the C interface, the inquire functions
+also support getting a subset of information by providing NULL pointers
+instead of valid addresses for undesired information.
+
+ at cindex dimension IDs
+ at cindex dimensions
+ at findex ncdiminq
+ at findex NCDINQ
+Dimension IDs are assigned by using consecutive integers (beginning at 0
+in C, 1 in FORTRAN).  Also dimensions, once created, cannot be deleted.
+Therefore, knowing the number of dimension IDs in a netCDF file means knowing
+all the dimension IDs: they are the integers 0, 1, 2, @dots{}, (or 1, 2,
+3, @dots{} in FORTRAN).  For each dimension ID, a call to the inquire
+function @code{ncdiminq} (or @code{NCDINQ}) returns the dimension name
+and size.
+
+ at cindex variables
+ at findex ncvarinq
+ at findex NCVINQ
+Like dimension IDs, variable IDs are also 0, 1, 2, @dots{}, (or 1, 2, 3,
+ at dots{} in FORTRAN).  These can be used in @code{ncvarinq} (or
+ at code{NCVINQ}) calls to find out the names, types, shapes, and the
+number of attributes assigned to each variable.
+
+ at cindex attributes
+ at findex ncattname
+ at findex NCANAM
+ at findex ncattinq
+ at findex NCAINQ
+ at findex ncattget
+ at findex NCAGT
+ at findex NCAGTC
+Once the number of attributes for a variable is known, successive calls
+to @code{ncattname} (or @code{NCANAM}) return the name for
+each attribute given the netCDF ID, variable ID, and attribute number.
+Armed with the attribute name, a call to @code{ncattinq} (or
+ at code{NCAINQ}) returns its type and length.  Given the type
+and length, the generic application can allocate enough space to hold
+the attribute values.  Then a call to @code{ncattget} (or @code{NCAGT}
+or @code{NCAGTC}) returns the attribute values.
+
+ at findex ncvarget1
+ at findex NCVGT1
+ at findex NCVG1C
+ at findex ncvarget
+ at findex ncvargetg
+ at findex ncrecget
+ at findex NCVGT
+ at findex NCVGTC
+ at findex NCVGTG
+ at findex NCVGGC
+Once the names, IDs, types, shapes, and lengths of all netCDF components
+are known, data values can be accessed by calling @code{ncvarget1} (or
+ at code{NCVGT1} or @code{NCVG1C}) for single values, @code{ncvarget} or
+ at code{ncvargetg}
+(or @code{NCVGT}, @code{NCVGTC}, @code{NCVGTG}, or @code{NCVGGC}) for
+aggregates of values using hyperslab access, or @code{ncrecget} for
+aggregates of values using record access.
+
+ at node Adding Components, Error Handling, Reading with Unknown Names, Usage
+ at section Adding New Dimensions, Variables, Attributes
+
+ at cindex adding dimensions
+ at cindex adding variables
+ at cindex adding attributes
+ at cindex deleting attributes
+ at cindex renaming attributes
+ at cindex renaming dimensions
+ at cindex renaming variables
+An existing netCDF file can be extensively altered.  New dimensions,
+variables, and attributes can be added or existing ones renamed, and
+existing attributes can be deleted.  Existing dimensions, variables, and
+attributes can be renamed.  The following code template lists a typical
+sequence of calls to add new netCDF components to an existing file:
+
+ at findex ncopen
+ at findex ncredef
+ at findex ncdimdef
+ at findex ncvardef
+ at findex ncattput
+ at findex ncendef
+ at findex ncvarput
+ at findex ncclose
+ at example
+    ncopen           /* open existing netCDF file */
+      @dots{}
+    ncredef          /* put it into define mode */
+        @dots{}
+      ncdimdef       /* define additional dimensions (if any) */
+        @dots{}
+      ncvardef       /* define additional variables (if any) */
+        @dots{}
+      ncattput       /* define additional attributes (if any) */
+        @dots{}
+    ncendef          /* check all definitions, leave define mode */
+      @dots{}
+    ncvarput         /* provide values for new variables */
+      @dots{}
+    ncclose          /* save netCDF file */
+ at end example
+
+In FORTRAN, the corresponding sequence looks like this:
+ at findex NCOPN
+ at findex NCREDF
+ at findex NCDDEF
+ at findex NCVDEF
+ at findex NCAPT
+ at findex NCAPTC
+ at findex NCENDF
+ at findex NCVPT
+ at findex NCVPTC
+ at findex NCVPTG
+ at findex NCVPGC
+ at findex NCCLOS
+ at example
+    NCOPN             !  open existing netCDF 
+      @dots{}
+    NCREDF            !  put it into define mode 
+        @dots{}
+      NCDDEF          !  define additional dimensions (if any) 
+        @dots{}
+      NCVDEF          !  define additional variables (if any) 
+        @dots{}
+      NCAPT or NCAPTC !  define additional attributes (if any) 
+        @dots{}
+    NCENDF            !  check all definitions, leave define mode 
+      @dots{}
+    NCVPT or NCVPTC   !  provide values for new variables 
+      @dots{}
+    NCCLOS            !  save netCDF file 
+ at end example
+
+ at cindex data mode
+ at cindex define mode
+ at findex ncopen
+ at findex NCOPN
+ at findex ncredef
+ at findex NCREDF
+ at findex ncdimdef
+ at findex NCDDEF
+ at findex ncvardef
+ at findex NCVDEF
+ at findex ncattput
+ at findex NCAPT
+ at findex NCAPTC
+A netCDF file is first opened by the @code{ncopen} (or @code{NCOPN})
+call.  This call puts you in @dfn{data mode}, which means existing data
+values can be accessed and changed, existing attributes can be changed
+(so long as they do not grow), but nothing can be added.  To add new
+netCDF dimensions, variables, or attributes you must leave data mode and
+enter @dfn{define mode}, by calling @code{ncredef} (or @code{NCREDF}).
+In define mode, call @code{ncdimdef} (or @code{NCDDEF}) to define new
+dimensions, @code{ncvardef} (or @code{NCVDEF}) to define new variables
+(using the new dimensions), and @code{ncattput} (or @code{NCAPT} or
+ at code{NCAPTC}) to assign new attributes to variables or enlarge old
+attributes.
+
+ at findex ncendef
+ at findex NCENDF
+ at findex ncclose
+ at findex NCCLOS
+You can leave define mode and reenter data mode, checking
+all the new definitions for consistency and committing the changes to
+disk, by calling @code{ncendef} (or @code{NCENDF}).  If you do not wish
+to reenter data mode, just call @code{ncclose} (or @code{NCCLOS}), which
+will have the effect of first calling @code{ncendef} (or @code{NCENDF}).
+
+ at cindex aborting define mode
+ at cindex restoring old definitions
+ at findex ncendef
+ at findex NCENDF
+ at findex ncabort
+ at findex NCABOR
+ at findex ncclose
+ at findex NCCLOS
+Until the @code{ncendef} (or @code{NCENDF}) call, you may back out of
+all the redefinitions made in define mode and restore the previous state
+of the netCDF by calling @code{ncabort} (or @code{NCABOR}).  You may
+also use the @code{ncabort} call to restore the netCDF to a consistent
+state if the call to @code{ncendef} (or @code{NCENDF}) fails.  If you
+have called @code{ncclose} (or @code{NCCLOS}) from definition mode and
+the implied call to @code{ncendef} (or @code{NCENDF}) fails,
+ at code{ncabort} (or @code{NCABOR}) will automatically be called to close
+the netCDF in its previous consistent state (before you entered define
+mode).
+
+ at node Error Handling,  , Adding Components, Usage
+ at section Error Handling
+
+ at cindex error handling
+ at cindex error messages
+ at cindex suppressing error messages
+ at cindex error returns
+ at cindex default error handling
+By default all netCDF library routines print an error message and exit
+when an error has occurred.  If this error behavior is acceptable, you
+never need to check error returns, since any condition that would result
+in an error will print an explanatory message and exit.  The examples in
+this guide assume the default error-handling behavior, so there is no
+checking of error returns.
+
+ at cindex XDR errors
+ at cindex write errors
+Occasionally, low-level write errors may occur in the XDR library layer
+below the netCDF library.  For example, if a write operation causes you
+to exceed disk quotas or to attempt to write to a device that is no
+longer available, you may get an error message from one of the XDR
+functions rather than from the netCDF library.  If you get a message
+from the XDR layer, diagnose and correct whatever is causing the
+low-level write errors.
+
+ at vindex ncopts
+ at vindex NC_VERBOSE
+ at vindex NC_FATAL
+ at cindex error options
+ at cindex fatal errors
+ at cindex error messages
+In the C interface, errors may be handled more flexibly by setting the
+external integer @code{ncopts}, declared in the file @file{netcdf.h}.
+Two aspects of the error-handling behavior can be modified
+independently: the suppression of error messages, and the fatality of
+errors.  The default behavior is specified by the assignment
+ at example
+ncopts = NC_VERBOSE | NC_FATAL;
+ at end example
+ at noindent
+where @code{NC_VERBOSE} and @code{NC_FATAL} are predefined constants
+from the include file @file{netcdf.h}.
+
+ at vindex ncerr
+ at vindex error returns
+If you want error messages but do not wish errors to be fatal, turn off
+the fatal error flag with:
+ at example
+ncopts = NC_VERBOSE;
+ at end example
+ at noindent
+If you want neither error messages nor fatal errors, turn off both flags
+with:
+ at example
+ncopts = 0;
+ at end example
+ at noindent
+In either case, you should check the return value after each call to a
+netCDF function.  The integer @code{-1} is returned whenever an error
+occurs and @code{NC_FATAL} is off, so you can detect error returns and
+handle the errors appropriately.  Another externally-defined integer,
+ at code{ncerr}, contains a netCDF-specific error code that can be used
+after an error has occurred to determine what the nature of the error
+was.  The names and descriptions of netCDF error codes are included in
+the file @file{netcdf.h}.
+
+ at vindex NCPOPT
+ at vindex NCGOPT
+ at vindex NCVERBOS
+ at vindex NCFATAL
+In the FORTRAN interface, the error options described above can
+be accessed by using the routines NCPOPT and NCGOPT.  The default error-
+handling behavior is equivalent to the statement
+ at example
+      CALL NCPOPT(NCVERBOS+NCFATAL)
+ at end example
+ at noindent
+where the values of NCVERBOS and NCFATAL are pre-defined constants from
+the FORTRAN include file @file{netcdf.inc}.
+ at noindent
+If you want error messages, but do not wish errors to be fatal, turn
+off the fatal error flag with:
+ at example
+      CALL NCPOPT(NCVERBOS)
+ at end example
+ at noindent
+If you want neither error messages nor fatal errors, turn off both flags
+with:
+ at example
+      CALL NCPOPT(0)
+ at end example
+ at noindent
+To get the current value of the error options, use:
+ at example
+      CALL NCGOPT(NCOPTS)
+ at end example
+
+ at vindex rcode
+In either case, the integer return code (the last parameter in all of the
+FORTRAN subroutines and functions) contains the non-zero netCDF-specific
+error number that can be used to determine the nature of the error.  Names
+and descriptions of netCDF error codes are included in the file
+ at file{netcdf.inc}.
+
+ at node File Operations, Dimensions, Usage, Top
+ at chapter NetCDF Operations
+
+This chapter presents the interfaces of the netCDF routines that deal
+with a netCDF file as a whole.
+
+ at cindex netCDF file name
+ at cindex netCDF ID
+ at cindex netCDF handle
+A netCDF file that has not yet been opened can only be referred to by
+its file name.  Once a netCDF file is opened, it is referred to by an
+ID, which is a small nonnegative integer returned when you create or
+open the file.  A netCDF ID is a file @dfn{handle}, much like a file
+descriptor in C or a logical unit number in FORTRAN.  In any single
+program, the netCDF IDs of distinct open netCDFs are distinct.  A single
+netCDF file may be opened multiple times and will then have multiple
+distinct netCDF IDs; however at most one of the open instances of a
+single netCDF file should permit writing.  When an open netCDF file is
+closed, its ID no longer refers to it, and that ID may be subsequently
+reassigned to refer to a different netCDF that is opened later.
+
+ at cindex netCDF operations
+The operations supported on a netCDF file as a single object are:
+ at itemize @bullet
+
+ at item
+Create, given file path and whether to overwrite or not.
+
+ at item
+Open for access, given file path and read or write intent.
+
+ at item
+Put into define mode, to add dimensions, variables, or attributes.
+
+ at item
+Take out of define mode, checking consistency of additions.
+
+ at item
+Close, writing to disk if required.
+
+ at item
+Get number of dimensions, number of variables, number of global
+attributes, and ID of the unlimited dimension if any.
+
+ at item
+Synchronize to disk to make sure it is current.
+
+ at item
+Set and unset @emph{nofill} mode for optimized sequential writes.
+
+ at end itemize
+ at noindent
+After a summary of conventions used in describing the netCDF C and
+FORTRAN interfaces, the rest of this chapter presents the interfaces for
+these operations.
+
+ at menu
+* Interface Descriptions::   Conventions for netCDF library interface
+                             descriptions.
+* nccreate and NCCRE::       Create a netCDF file.
+* ncopen and NCOPN::         Open a netCDF file for access.
+* ncredef and NCREDF::       Put open netCDF file into define mode.
+* ncendef and NCENDF::       Leave Define Mode.
+* ncclose and NCCLOS::       Close an Open netCDF File.
+* ncinquire and NCINQ::      Inquire about an Open netCDF File.
+* ncsync and NCSNC::         Synchronize an Open netCDF File to Disk.
+* ncabort and NCABOR::       Back Out of Recent Definitions.
+* ncsetfill and NCSFIL::     Set fill mode for optimized writes.
+ at end menu
+
+ at node Interface Descriptions, nccreate and NCCRE,  , File Operations
+ at section NetCDF Library Interface Descriptions
+
+ at cindex interface descriptions
+ at cindex example conventions
+ at cindex conventions in examples
+ at cindex error conditions
+ at cindex examples
+ at cindex function prototypes
+
+Each interface description for a particular netCDF function in this and
+later chapters contains:
+ at itemize @bullet
+
+ at item
+A description of the purpose of the function;
+
+ at item
+A list of possible error conditions;
+
+ at item
+A C function prototype that presents the type and order of the formal
+parameters to the function;
+
+ at item
+A description of each formal parameter in the C interface;
+
+ at item
+An example of a C program fragment calling the netCDF function and
+perhaps other netCDF functions to do something useful;
+
+ at item
+A FORTRAN function prototype that presents the type and order of the
+formal parameters to the FORTRAN function or functions that provide the
+same functionality as the C function;
+
+ at item
+A description of each formal parameter in the FORTRAN interface; and
+
+ at item
+An example of a FORTRAN program fragment that duplicates the function of
+the example C fragment.
+ at end itemize
+
+The C function prototypes specify the order and type of each formal
+parameter and conform to the ANSI C standard.  FORTRAN does not have
+function prototypes, but a similar syntax is used to concisely present
+the order and types of FORTRAN formal parameters.  In the few cases in
+which a single C function corresponds to two FORTRAN functions, the
+FORTRAN functions prototypes are presented together.
+
+The FORTRAN examples use two nonstandard notations: @code{INCLUDE}
+statements and in-line comments.  In each case, we use the VMS FORTRAN
+notation, as in the following example:
+ at example
+      INCLUDE 'netcdf.inc'
+      INTEGER NCID       ! this is an in-line comment
+ at end example
+FORTRAN examples (and the FORTRAN interface) abide by the six-character
+limitation on the length of FORTRAN names, except that
+parameters names may be up to eight characters long.
+
+ at page
+ at node nccreate and NCCRE, ncopen and NCOPN, Interface Descriptions, File Operations
+ at section  Create a NetCDF file
+
+ at cindex netCDF file creation
+ at cindex creating a netCDF file
+ at findex nccreate
+ at findex NCCRE
+The function @code{nccreate} (or @code{NCCRE} for FORTRAN) creates a
+new netCDF file, returning a netCDF ID that can subsequently be used to
+refer to the netCDF file.  The new netCDF file is placed in define mode.
+
+In case of an error, @code{nccreate} returns -1; @code{NCCRE} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include::
+ at itemize @bullet
+
+ at item
+Passing a file name that includes a directory that does not exist.
+
+ at vindex NC_NOCLOBBER
+ at vindex NCNOCLOB
+ at item
+Specifying a file name of a file that exists and also specifying
+ at code{NC_NOCLOBBER} (or @code{NCNOCLOB}).
+
+ at item
+Attempting to create a netCDF file in a directory where you don't have
+permission to create files.
+ at end itemize
+
+ at findex nccreate
+ at unnumberedsubsec nccreate:  C Interface
+ at example
+int nccreate (const char* path, int cmode);
+ at end example
+
+ at table @code
+
+ at item path
+The file name of the new netCDF file.  This can be given as either an
+absolute path name (from the root of the file system) or a relative
+path name (from the current directory).
+
+ at vindex NC_CLOBBER
+ at vindex NC_NOCLOBBER
+ at item cmode
+Should be specified as either @code{NC_CLOBBER} or @code{NC_NOCLOBBER}.  These
+constants are defined in the include file named @file{netcdf.h}.
+ at code{NC_CLOBBER} means that even if the file already exists, you want to
+create a new file with the same name, erasing the old file's contents.
+ at code{NC_NOCLOBBER} means you want to create a new netCDF file only if the
+given file name does not refer to a file that already exists.
+ at end table
+
+ at findex nccreate
+ at vindex NC_NOCLOBBER
+In this example we create a netCDF file named
+ at file{foo.nc}; we want the file to be created in the current
+directory only if a file with that name does not already exist:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid;
+   @dots{}
+ncid = nccreate("foo.nc", NC_NOCLOBBER);
+ at end group
+ at end example
+
+ at unnumberedsubsec NCCRE:  FORTRAN Interface
+
+ at findex NCCRE
+ at example
+INTEGER FUNCTION NCCRE (CHARACTER*(*) PATH, INTEGER CMODE,
+                        INTEGER RCODE)
+ at end example
+
+ at table @code
+
+ at item PATH
+The file name of the new netCDF file.  This can be given as either an
+absolute path name (from the root of the file system) or a relative
+path name (from the current directory).
+
+ at vindex NCCLOB
+ at vindex NCNOCLOB
+ at item CMODE
+Should be specified as either @code{NCCLOB} or @code{NCNOCLOB}.  These
+constants are defined in the include file @file{netcdf.inc}.
+ at code{NCCLOB} means that even if the file already exists, you want to
+create a new file with the same name, erasing the old file's contents.
+ at code{NCNOCLOB} means you want to create a new netCDF file only if the
+given file name does not refer to a file that already exists.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCCRE
+In this example we create a netCDF file named
+ at file{foo.nc}, assuming we want the file to be created in the current
+directory only if a file with that name does not already exist:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID
+         @dots{}
+      NCID = NCCRE('foo.nc', NCNOCLOB, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncopen and NCOPN, ncredef and NCREDF, nccreate and NCCRE, File Operations
+ at section Open a NetCDF File for Access
+
+ at cindex opening a netCDF file
+ at findex ncopen
+ at findex NCOPN
+The function @code{ncopen} (or @code{NCOPN} for FORTRAN) 
+opens an existing netCDF file for access.
+
+In case of an error, @code{ncopen} returns -1; @code{NCOPN} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include::
+ at itemize @bullet
+
+ at item
+The specified netCDF file does not exist.
+
+ at vindex NC_WRITE
+ at vindex NC_NOWRITE
+ at item
+The mode specified is something other than @code{NC_WRITE} or
+ at code{NC_NOWRITE}.
+ at end itemize
+
+ at findex ncopen
+ at unnumberedsubsec ncopen:  C Interface
+ at example
+int ncopen(const char* path,int mode);
+ at end example
+
+ at table @code
+
+ at item path
+Absolute or relative file name for netCDF file to be opened.
+
+ at vindex NC_WRITE
+ at vindex NC_NOWRITE
+ at item mode
+Either @code{NC_WRITE}, to open the file for writing, or @code{NC_NOWRITE}, to
+open the file read-only.  ``Writing'' means any kind of change to the
+file, including appending or changing data, adding or renaming dimensions,
+variables, and attributes, or deleting attributes.
+ at end table
+
+ at findex ncopen
+ at vindex NC_NOWRITE
+Here is an example using @code{ncopen} to open an existing netCDF file
+named @file{foo.nc} for reading:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid;
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);
+ at end group
+ at end example
+
+ at findex NCOPN
+ at unnumberedsubsec NCOPN:  FORTRAN Interface
+ at example
+      INTEGER FUNCTION NCOPN(CHARACTER*(*) PATH,
+     +                       INTEGER RWMODE,
+     +                       INTEGER RCODE)
+ at end example
+
+ at table @code
+
+ at item PATH
+Absolute or relative file name for netCDF file to be opened.
+
+ at vindex NCWRITE
+ at vindex NCNOWRIT
+ at item RWMODE
+Either @code{NCWRITE}, to open the file for writing, or @code{NCNOWRIT}, to
+open the file read-only.  ``Writing'' means any kind of change to the
+file, including appending or changing data, adding or renaming dimensions,
+variables, and attributes, or deleting attributes.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+Here is an example of using @code{NCOPN} to open an existing netCDF file
+named @file{foo.nc} for reading:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID
+         @dots{}
+      NCID = NCOPN('foo.nc', NCNOWRIT, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncredef and NCREDF, ncendef and NCENDF, ncopen and NCOPN, File Operations
+ at section Put Open NetCDF File into Define Mode
+
+ at cindex define mode
+ at cindex adding dimensions
+ at cindex adding variables
+ at cindex adding attributes
+ at cindex renaming dimensions
+ at cindex renaming variables
+ at cindex renaming attributes
+ at cindex deleting attributes
+ at findex ncredef
+ at findex NCREDF
+The function @code{ncredef} (or @code{NCREDF} for FORTRAN) 
+puts an open netCDF file into define mode, so dimensions, variables,
+and attributes can be added or renamed and attributes can be deleted.
+
+In case of an error, @code{ncredef} returns -1; @code{NCREDF} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include::
+ at itemize @bullet
+
+ at item
+The specified netCDF file is already in define mode.
+
+ at item
+The specified netCDF file was opened for read-only.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncredef
+ at unnumberedsubsec ncredef:  C Interface
+ at example
+int ncredef(int ncid);
+ at end example
+
+ at table @code
+
+ at item ncid
+netCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+ at end table
+
+ at findex ncopen
+ at findex ncredef
+ at vindex NC_WRITE
+Here is an example using @code{ncredef} to open an existing NetCDF file
+named @file{foo.nc} and put it into define mode:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid;
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);    /* open file */
+   @dots{}
+ncredef(ncid);                        /* put in define mode */
+ at end group
+ at end example
+
+ at findex NCREDF
+ at unnumberedsubsec NCREDF:  FORTRAN Interface
+ at example
+SUBROUTINE NCREDF(INTEGER NCID, INTEGER RCODE)
+ at end example
+
+ at table @code
+
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCREDF
+ at vindex NCWRITE
+Here is an example of using @code{NCREDF} to open an existing netCDF file
+named @file{foo.nc} and put it into define mode:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID
+         @dots{}
+      NCID = NCOPN('foo.nc', NCWRITE, RCODE)
+         @dots{}
+      CALL NCREDF(NCID, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncendef and NCENDF, ncclose and NCCLOS, ncredef and NCREDF, File Operations
+ at section Leave Define Mode
+
+ at cindex define mode
+ at cindex data mode
+ at findex ncendef
+ at findex NCENDF
+The function @code{ncendef} (or @code{NCENDF} for FORTRAN) takes an open
+netCDF file out of define mode.  The changes made to the netCDF file
+while it was in define mode are checked and committed to disk if no
+problems occurred.  The netCDF file is then placed in data mode, so
+variable data can be read or written.
+
+This call can be expensive, since it involves initializing non-record
+variables and copying data under some circumstances.  @xref{File
+Structure, , NetCDF File Structure and Performance}, for a more
+extensive discussion.
+
+In case of an error, @code{ncendef} returns -1; @code{NCENDF} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+
+ at item
+The specified netCDF file is not in define mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncendef
+ at unnumberedsubsec ncendef:  C Interface
+ at example
+int ncendef(int ncid);
+ at end example
+
+ at table @code
+
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+ at end table
+ at findex nccreate
+ at findex ncendef
+ at vindex NC_NOCLOBBER
+Here is an example using @code{ncendef} to finish the definitions of a
+new netCDF file named @file{foo.nc} and put it into data mode:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid;
+   @dots{}
+ncid = nccreate("foo.nc", NC_NOCLOBBER);
+
+   @dots{}      /* create dimensions, variables, attributes */
+
+ncendef(ncid);  /*leave define mode*/
+
+ at end group
+ at end example
+ at sp 1
+ at findex NCENDF
+ at unnumberedsubsec NCENDF:  FORTRAN Interface
+ at example
+SUBROUTINE NCENDF(INTEGER NCID, INTEGER RCODE)
+ at end example
+
+ at table @code
+
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCENDF
+ at findex NCCRE
+ at vindex NCNOCLOB
+Here is an example using @code{NCENDF} to finish the definitions of a
+new netCDF file named @file{foo.nc} and put it into data mode:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID
+         @dots{}
+      NCID = NCCRE('foo.nc', NCNOCLOB, RCODE)
+
+         @dots{}  !  create dimensions, variables, attributes
+
+      CALL NCENDF(NCID, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncclose and NCCLOS, ncinquire and NCINQ, ncendef and NCENDF, File Operations
+ at section Close an Open NetCDF File
+
+ at cindex closing a netCDF file
+ at findex ncclose
+ at findex NCCLOS
+ at findex ncendef
+ at findex NCENDF
+ at findex ncabort
+ at findex NCABOR
+ at cindex netCDF ID
+The function @code{ncclose} (or @code{NCCLOS} for FORTRAN) closes an
+open netCDF file.  If the file is in define mode, @code{ncendef} (or
+ at code{NCENDF}) will be called before closing.  (In this case, if
+ at code{ncendef} [or @code{NCENDF}] returns an error, @code{ncabort} [or
+ at code{NCABOR}] will automatically be called to restore the file to the
+consistent state before define mode was last entered.)  After an open
+netCDF file is closed, its netCDF ID will be reassigned to the next
+netCDF file that is opened or created.
+
+In case of an error, @code{ncclose} returns -1; @code{NCCLOS} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+
+ at findex ncendef
+ at findex NCENDF
+ at item
+The netCDF was in define mode and the automatic call made to
+ at code{ncendef} (or @code{NCENDF}) failed.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncclose
+ at unnumberedsubsec ncclose:  C Interface
+ at example
+int ncclose(int ncid);
+ at end example
+
+ at table @code
+
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+ at end table
+
+ at findex nccreate
+ at findex ncclose
+ at vindex NC_NOCLOBBER
+Here is an example using @code{ncclose} to finish the definitions of a
+new netCDF file named @file{foo.nc} and release its netCDF ID:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid;
+   @dots{}
+ncid = nccreate("foo.nc", NC_NOCLOBBER);
+
+   @dots{}      /* create dimensions, variables, attributes */
+
+ncclose(ncid);       /* close netCDF file */
+ at end group
+ at end example
+
+ at unnumberedsubsec NCCLOS:  FORTRAN Interface
+
+ at findex NCCLOS
+ at example
+SUBROUTINE NCCLOS(INTEGER NCID, INTEGER RCODE)
+ at end example
+
+ at table @code
+
+ at item NCID
+netCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCCLOS
+ at findex NCCRE
+ at vindex NCNOCLOB
+Here is an example using @code{NCCLOS} to finish the definitions of a
+new netCDF file named @file{foo.nc} and release its netCDF ID:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, RCODE
+         @dots{}
+      NCID = NCCRE('foo.nc', NCNOCLOB, RCODE)
+
+         @dots{}  ! create dimensions, variables, attributes
+
+      CALL NCCLOS(NCID, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncinquire and NCINQ, ncsync and NCSNC, ncclose and NCCLOS, File Operations
+ at section Inquire about an Open NetCDF File
+
+ at cindex inquire about a netCDF file
+ at findex ncinquire
+ at findex NCINQ
+The function @code{ncinquire} (@code{NCINQ} for FORTRAN) returns
+information about an open netCDF file, given its netCDF ID.  It can be
+called from either define mode or data mode.  It returns values for the
+number of dimensions, the number of variables, the number of global
+attributes, and the dimension ID of the dimension defined with
+unlimited size, if any.  No I/O is required when this or any other
+`inquire' function in the netCDF interface is called, since the
+functions merely return information that is stored in a table for each
+open netCDF file.
+
+In case of an error, @code{ncinquire} returns -1; @code{NCINQ} returns a
+nonzero value in @code{rcode}.  Possible cause of errors includes:
+ at itemize @bullet
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncinquire
+ at unnumberedsubsec ncinquire:  C Interface
+ at example
+int ncinquire(int ncid, int* ndims, int* nvars, int* ngatts,
+              int* recdim);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at cindex number of dimensions
+ at item ndims
+Returned number of dimensions defined for this netCDF file.  If this
+parameter is given as @samp{(int *) 0}, the number of dimensions will not be
+returned so no variable to hold this information needs to be declared.
+
+ at cindex number of variables
+ at item nvars
+Returned number of variables defined for this netCDF file.  If this
+parameter is given as @samp{(int *) 0}, the number of variables will not be
+returned so no variable to hold this information needs to be declared.
+
+ at cindex number of global attributes
+ at cindex global attributes
+ at item ngatts
+Returned number of global attributes defined for this netCDF file.  If
+this parameter is given as @samp{(int *) 0}, the number of global attributes
+will not be returned so no variable to hold this information needs to be
+declared.
+
+ at cindex unlimited dimension ID
+ at item recdim
+Returned ID of the unlimited dimension, if there is one for this netCDF
+file.  If no unlimited size dimension has been defined, -1 is returned
+for the value of @code{recdim}.  If this parameter is given as
+ at samp{(int *) 0}, the record dimension ID will not be returned so no
+variable to hold this information needs to be declared.
+ at end table
+
+ at findex ncopen
+ at findex ncinquire
+ at vindex NC_NOWRITE
+Here is an example using @code{ncinquire} to find out about a netCDF
+file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid, ndims, nvars, ngatts, recdim;
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{}
+ncinquire(ncid, &ndims, &nvars, &ngatts, &recdim);
+ at end group
+ at end example
+
+ at unnumberedsubsec NCINQ:  FORTRAN Interface
+
+ at findex NCINQ
+ at example
+      SUBROUTINE NCINQ(INTEGER NCID, INTEGER NDIMS, INTEGER NVARS,
+     *                 INTEGER NGATTS, INTEGER RECDIM, INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item NDIMS
+Returned number of dimensions defined for this netCDF file.
+
+ at item NVARS
+Returned number of variables defined for this netCDF file.
+
+ at item NGATTS
+Returned number of global attributes defined for this netCDF file.
+
+ at cindex unlimited dimension ID
+ at item RECDIM
+Returned ID of the unlimited dimension, if there is one for this netCDF
+file.  If no unlimited size dimension has been defined, -1 is returned
+for the value of @code{RECDIM}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCINQ
+ at vindex NCNOWRIT
+Here is an example using @code{NCINQ} to find out about a netCDF
+file named @file{foo.nc}:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, NDIMS, NVARS, NATTS, RECDIM, RCODE
+         @dots{}
+      NCID = NCOPN('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      CALL NCINQ(NCID, NDIMS, NVARS, NATTS, RECDIM, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncsync and NCSNC, ncabort and NCABOR, ncinquire and NCINQ, File Operations
+ at section Synchronize an Open NetCDF File to Disk
+
+ at cindex synchronize a netCDF file
+ at cindex data mode
+ at cindex define mode
+ at cindex performance
+ at cindex efficiency
+ at findex ncsync
+ at findex NCSNC
+ at findex ncendef
+ at findex NCENDF
+The function @code{ncsync} (or @code{NCSNC} for FORTRAN) makes sure that
+the disk copy of a netCDF file open for writing is current.  The netCDF
+file must be in data mode.  A netCDF file in define mode is synchronized
+to disk only when @code{ncendef} (or @code{NCENDF}) is called.  A
+process that is reading a netCDF file that another process is writing
+can also call @code{ncsync} (or @code{NCSNC} for FORTRAN) to get updated
+with the changes made by the writing process (e.g. the number of records
+written), without having to close and reopen the file.
+
+It can be expensive in computer resources to always synchronize to disk
+after every write of variable data or change of an attribute value.
+There are two reasons you might want to synchronize after writes:
+ at itemize @bullet
+ at item
+To minimize data loss in case of abnormal termination, or
+
+ at cindex shared access
+ at item
+To make data available to other processes for reading immediately after it
+is written.  But note that a process that already had the file open for
+reading would not see the number of records increase when the writing
+process calls @code{ncsync}; to accomplish this, the reading process
+must call @code{ncsync}.
+ at end itemize
+
+ at cindex closing a netCDF file
+ at cindex define mode
+ at cindex data mode
+Data is automatically synchronized to disk when a netCDF file is closed,
+or whenever you leave define mode.
+
+In case of an error, @code{ncsync} returns -1; @code{NCSNC} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+
+ at item
+The netCDF file is in define mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncsync
+ at unnumberedsubsec ncsync:  C Interface
+ at example
+int ncsync(int ncid);
+ at end example
+
+ at table @code
+
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+ at end table
+
+ at findex ncsync
+ at findex ncopen
+ at vindex NC_WRITE
+Here is an example using @code{ncsync} to synchronize the disk writes of
+a netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid;
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);  /* open for writing */
+
+   @dots{}          /* write data or change attributes */
+
+ncsync(ncid);      /* synchronize to disk */
+ at end group
+ at end example
+
+ at findex NCSNC
+ at unnumberedsubsec NCSNC:  FORTRAN Interface
+ at example
+      SUBROUTINE NCSNC(INTEGER NCID, INTEGER RCODE)
+ at end example
+
+ at table @code
+
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCSNC
+ at findex NCOPN
+ at vindex NCNOWRIT
+Here is an example using @code{NCSNC} to synchronize the disk writes of
+a netCDF file named @file{foo.nc}:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, RCODE
+         @dots{}
+      NCID = NCOPN('foo.nc', NCWRITE, RCODE)
+         @dots{}
+* write data or change attributes
+         @dots{}
+      CALL NCSNC(NCID, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncabort and NCABOR, ncsetfill and NCSFIL, ncsync and NCSNC, File Operations
+ at section Back Out of Recent Definitions
+
+ at cindex canceling definitions
+ at cindex backing out of definitions
+ at cindex aborting definitions
+ at findex ncabort
+ at findex NCABOR
+ at cindex define mode
+ at cindex data mode
+ at cindex closing a netCDF file
+ at cindex creating a netCDF file
+ at cindex deleting a netCDF file
+ at findex ncredef
+ at findex NCREDF
+The function @code{ncabort} (or @code{NCABOR} for FORTRAN), if not in
+define mode, closes the netCDF file.  If the file is being created and
+is still in define mode, the file is deleted.  If define mode was
+entered by a call to @code{ncredef} (or @code{NCREDF}), the netCDF file
+is restored to its state before definition mode was entered and the file
+is closed.  The main reason for calling @code{ncabort} (or
+ at code{NCABOR}) is to restore the netCDF to a known consistent state in
+case anything goes wrong during the definition of new dimensions,
+variables, or attributes.
+
+ at findex ncclose
+ at findex NCCLOS
+This function is called automatically if @code{ncclose} (or
+ at code{NCCLOS}) is called from define mode and the call to leave define
+mode before closing fails.
+
+In case of an error, @code{ncabort} returns -1; @code{NCABOR} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+
+ at item
+When called from define mode while creating a netCDF, deletion of the
+file failed.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncabort
+ at unnumberedsubsec ncabort:  C Interface
+ at example
+int ncabort(int ncid);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+ at end table
+
+ at findex ncdimdef
+ at findex ncopen
+ at vindex NC_WRITE
+ at findex ncredef
+ at findex ncabort
+Here is an example using @code{ncabort} to back out of redefinitions of
+a file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid;
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);  /* open for writing */
+   @dots{}
+ncredef(ncid);                    /* enter define mode */
+   @dots{}
+if (ncdimdef(ncid, "lat", 18L) == -1)
+   ncabort(ncid);                 /* define failed, abort */
+ at end group
+ at end example
+
+ at unnumberedsubsec NCABOR:  FORTRAN Interface
+
+ at findex NCABOR
+ at example
+      SUBROUTINE NCABOR(INTEGER NCID, INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at vindex NCWRITE
+ at findex NCREDF
+ at findex NCDDEF
+ at findex NCABOR
+Here is an example using @code{NCABOR} to back out of redefinitions of
+a file named @file{foo.nc}:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, RCODE, LATID
+         @dots{}
+      NCID = NCOPN('foo.nc', NCWRITE, RCODE)
+         @dots{}
+      CALL NCREDF(NCID, RCODE)
+         @dots{}
+      LATID = NCDDEF(NCID, 'LAT', 18, RCODE)
+      IF (RCODE .EQ. -1) THEN  ! dimension definition failed
+         CALL NCABOR(NCID, RCODE)  ! abort redefinitions
+      ENDIF
+         @dots{}
+ at end group
+ at end example
+
+ at page
+ at node ncsetfill and NCSFIL,  , ncabort and NCABOR, File Operations
+ at section Set Fill Mode for Writes
+
+ at cindex nofill mode
+ at cindex performance
+ at cindex efficiency
+ at findex ncsetfill
+ at findex NCSFIL
+These calls are intended for advanced usage, to optimize writes under
+some circumstances described below.  The function @code{ncsetfill} (or
+ at code{NCSFIL} for FORTRAN) sets the @dfn{fill mode} for an netCDF file
+open for writing and returns the current fill mode.  The fill mode can
+be specified as either @code{NC_FILL} or @code{NC_NOFILL} (@code{NCFILL}
+or @code{NCNOFILL} for FORTRAN).  The default behavior corresponding to
+ at code{NC_FILL} is that data is pre-filled with fill values, that is fill
+values are written when you create non-record variables or when you
+write a value beyond data that hasn't been written yet.  This makes it
+possible to detect attempts to read data before it was written.
+ at xref{Missing Values}, for more information on the use of fill values.
+ at xref{Attribute Conventions} for information about how to define your
+own fill values.
+
+The behavior corresponding to @code{NC_NOFILL} overrides the default
+behavior of prefilling data with fill values.  This can be used to
+enhance performance, because it avoids the duplicate writes that occur
+when the netCDF library writes fill values that are immediately
+overwritten with data.
+
+A value indicating which mode the netCDF file was already in is
+returned.  You can use this value to temporarily change the fill mode of
+an open netCDF file and then restore it to the previous mode.
+
+After you turn on @code{NC_NOFILL} mode for an open netCDF file, you
+must be certain to write valid data in all the positions that will later
+be read.  Note that @code{NC_NOFILL} mode is only a transient property
+of a netCDF file open for writing: if you close and reopen the file, it
+will revert to the default behavior.  You can also revert to the default
+behavior by calling @code{ncsetfill} (or @code{NCSFIL} for FORTRAN)
+again to explicitly set the fill mode to @code{NC_FILL}.
+
+There are three situations where it is advantageous to set nofill mode:
+
+ at enumerate
+ at item
+Creating and initializing a netCDF file.  In this case, you should set
+nofill mode before calling @code{ncendef} (@code{NCENDF} for FORTRAN),
+and then write @emph{completely} all non-record variables and the
+initial records of all the record variables you want to initialize.
+ at item
+Extending an existing record-oriented netCDF file.  Set nofill mode
+after opening the file for writing, then append the additional records
+to the file completely, leaving no intervening unwritten records.
+ at item
+Adding new variables that you are going to initialize to an existing
+netCDF file.  Set nofill mode before calling @code{ncendef}
+(@code{NCENDF} for FORTRAN), then write all the new variables
+completely.
+ at end enumerate
+ at sp 2
+If the netCDF file has an unlimited dimension and the last record was
+written while in @code{NC_NOFILL} mode, then the file will be 4 bytes
+longer than if @code{NC_NOFILL} mode wasn't set, but this will be
+completely transparent if you access the data only through the netCDF
+interfaces.
+
+In case of an error, @code{ncsetfill} returns -1; @code{NCSFIL} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at item
+The specified netCDF ID refers to a file open for read-only access.
+ at item
+The fillmode argument is neither @code{NC_NOFILL} nor @code{NC_FILL}
+(neither @code{NCNOFILL} nor @code{NCFILL} for FORTRAN).
+ at end itemize
+
+ at findex ncsetfill
+ at unnumberedsubsec ncsetfill:  C Interface
+ at example
+int ncsetfill(int ncid, int fillmode);
+ at end example
+
+ at table @code
+
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item fillmode
+Desired fill mode for the file, either @code{NC_NOFILL} or
+ at code{NC_FILL}.
+
+ at item ncsetfill
+Returns the current fill mode of the file before this call, either
+ at code{NC_NOFILL} or @code{NC_FILL}.
+ at end table
+
+ at findex ncsetfill
+ at findex ncopen
+ at vindex NC_WRITE
+Here is an example using @code{ncsetfill} to set nofill mode for
+subsequent writes of a netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid;
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);  /* open for writing */
+
+   @dots{}          /* write data with default prefilling behavior */
+
+ncsetfill(ncid, NC_NOFILL);      /* set nofill mode */
+
+   @dots{}          /* write data with no prefilling */
+
+ at end group
+ at end example
+ at sp 2
+ at findex NCSFIL
+ at unnumberedsubsec NCSFIL:  FORTRAN Interface
+ at example
+      INTEGER FUNCTION NCSFIL(INTEGER NCID, INTEGER FILLMODE,
+     +                        INTEGER RCODE)
+ at end example
+
+ at table @code
+
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item FILLMODE
+Desired fill mode for the file, either @code{NCNOFILL} or
+ at code{NCFILL}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+
+ at item NCSFIL
+Returns the current fill mode of the file before this call, either
+ at code{NCNOFILL} or @code{NCFILL}.
+ at end table
+
+ at findex NCSFIL
+Here is an example using @code{NCSFIL} to set nofill mode for
+a netCDF file named @file{foo.nc}:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, RCODE, OMODE
+         @dots{}
+      NCID = NCOPN('foo.nc', NCWRITE, RCODE)
+         @dots{}
+* write data with default prefilling behavior
+         @dots{}
+      OMODE = NCSFIL(NCID, NCNOFILL, RCODE)
+         @dots{}
+* write data with no prefilling
+         @dots{}
+ at end group
+ at end example
+
+
+
+ at node Dimensions, Variables, File Operations, Top
+ at chapter Dimensions
+
+ at cindex dimensions
+ at cindex define mode
+ at cindex appending data
+ at cindex unlimited dimension
+ at cindex record dimension
+ at cindex records
+ at cindex dimension ID
+Dimensions for a netCDF file are defined when it is created, while the
+netCDF file is in define mode.  Additional dimensions may be added
+later by reentering define mode.  A netCDF dimension has a name and a
+size.  At most one dimension in a netCDF file can
+have the @code{NC_UNLIMITED} size, which means a variable using this
+dimension can grow to any length (like a record number in a file).
+
+ at cindex maximum number of dimensions
+ at cindex MAX_NC_DIMS
+ at cindex generic applications
+ at cindex netCDF implementation
+There is a suggested limit (currently 32) to the number of dimensions
+that can be defined in a single netCDF file.  The limit is the value of
+the predefined macro @code{MAX_NC_DIMS} (MAXNCDIM for FORTRAN).  The
+purpose of the limit is to make writing generic applications simpler.
+They need only provide an array of
+ at code{MAX_NC_DIMS} dimensions to handle any netCDF file.  The
+implementation of the netCDF library does not enforce this advisory
+maximium, so it is possible to use more dimensions, if necessary; just
+don't expect generic applications or netCDF utilities to be able to
+handle the resulting netCDF files.
+
+ at cindex dimension name
+ at cindex dimension size
+Ordinarily, the name and size of a dimension are fixed when the
+dimension is first defined.  The name may be changed later, but the size
+of a dimension cannot be changed without copying the netCDF to a new
+netCDF with a redefined dimension size.
+
+Dimension sizes in the C interface are type @code{long} rather than type
+ at code{int} to make it possible to access all the data in a netCDF file
+on a platform that only supports a 16-bit @code{int} data types, for
+example MSDOS.  If dimension sizes were type @code{int} instead, it
+would not be possible to access data from variables with a dimension
+size greater than a 16-bit @code{int} can accommodate.
+
+Operations supported on dimensions are:
+ at itemize @bullet
+ at item
+Create a dimension, given its name and size.
+ at item
+Get a dimension ID from its name.
+ at item
+Get a dimension's name and size from its ID.
+ at item
+Rename a dimension.
+ at end itemize
+
+ at menu
+* ncdimdef and NCDDEF::    Create a Dimension
+* ncdimid and NCDID::      Get a Dimension ID from Its Name
+* ncdiminq and NCDINQ::    Inquire about a Dimension
+* ncdimrename and NCDREN:: Rename a Dimension
+ at end menu
+
+ at page
+ at node ncdimdef and NCDDEF, ncdimid and NCDID,  , Dimensions
+ at section Create a Dimension
+
+ at cindex creating a dimension
+ at cindex dimension IDs
+ at cindex dimension names
+ at cindex dimension size
+ at cindex unlimited dimension
+ at cindex record dimension
+ at findex ncdimdef
+ at findex NCDDEF
+The function @code{ncdimdef} (or @code{NCDDEF} for FORTRAN) adds a new
+dimension to an open netCDF file in define mode.  It returns a dimension
+ID, given the netCDF ID, the dimension name, and the dimension size.  At
+most one unlimited size dimension, called the record dimension,
+may be defined for each netCDF file.
+
+In case of an error, @code{ncdimdef} returns -1; @code{NCDDEF} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The netCDF file is not in definition mode.
+
+ at item
+The specified dimension name is the name of another existing dimension.
+
+ at item
+The specified size is not greater than zero.
+
+ at item
+The specified size is unlimited, but there is already an
+unlimited size dimension defined for this netCDF file.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncdimdef
+ at unnumberedsubsec ncdimdef:  C Interface
+ at example
+int ncdimdef(int ncid, const char* name, long size);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item name
+Dimension name.  Must begin with an alphabetic character, followed by
+zero or more alphanumeric characters including the underscore
+(@samp{_}).  Case is significant.
+
+ at vindex NC_UNLIMITED
+ at item size
+Size of dimension; that is, number of values for this dimension as an
+index to variables that use it.  This should be either a positive
+integer (of type @code{long}) or the predefined constant @code{NC_UNLIMITED}.
+ at end table
+
+ at findex ncdimdef
+ at findex nccreate
+ at vindex NC_UNLIMITED
+ at vindex NC_NOCLOBBER
+Here is an example using @code{ncdimdef} to create a dimension named
+ at code{lat} of size 18 and a record dimension named @code{rec} in a new
+netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid, latid, recid;
+   @dots{}
+ncid = nccreate("foo.nc", NC_NOCLOBBER);
+   @dots{}
+latid = ncdimdef(ncid, "lat", 18L);
+recid = ncdimdef(ncid, "rec", NC_UNLIMITED);
+ at end group
+ at end example
+
+ at findex NCDDEF
+ at unnumberedsubsec NCDDEF:  FORTRAN Interface
+ at example
+      INTEGER FUNCTION NCDDEF (INTEGER NCID,
+     +                   CHARACTER*(*) DIMNAM,
+     +                   INTEGER DIMSIZ,
+     +                   INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item DIMNAM
+Dimension name.  Must begin with an alphabetic character, followed by
+zero or more alphanumeric characters including the underscore
+(@samp{_}).  Case is significant.
+
+ at vindex NCUNLIM
+ at item DIMSIZ
+Size of dimension; that is, number of values for this dimension as an
+index to variables that use it.  This should be either a positive
+integer or the predefined constant @code{NCUNLIM}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCDDEF
+ at findex NCCRE
+ at vindex NCNOCLOB
+ at vindex NCUNLIM
+Here is an example using @code{NCDDEF} to create a dimension named
+ at code{lat} of size 18 and a record dimension named @code{rec} in a new
+netCDF file named @file{foo.nc}:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, RCODE, LATID, RECID
+         @dots{}
+      NCID = NCCRE('foo.nc', NCNOCLOB, RCODE)
+         @dots{}
+      LATID = NCDDEF(NCID, 'lat', 18, RCODE)
+      RECID = NCDDEF(NCID, 'rec', NCUNLIM, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncdimid and NCDID, ncdiminq and NCDINQ, ncdimdef and NCDDEF, Dimensions
+ at section Get a Dimension ID from Its Name
+ at cindex getting dimension ID
+ at cindex dimension IDs
+ at cindex dimension names
+ at findex ncdimid
+ at findex NCDID
+The function @code{ncdimid} (or @code{NCDID} for FORTRAN) returns the ID
+of a netCDF dimension, given the name of the dimension.  If @code{ndims}
+is the number of dimensions defined for a netCDF file, each dimension
+has an ID between @code{0} and @code{ndims-1} (or @code{1} and
+ at code{ndims} for FORTRAN).
+
+In case of an error, @code{ncdimid} returns -1; @code{NCDID} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+
+ at item
+The name that was specified is not the name of any currently defined
+dimension in the netCDF file.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncdimid
+ at unnumberedsubsec ncdimid:  C Interface
+ at example
+int ncdimid(int ncid, const char* name);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item name
+Dimension name, a character string beginning with a letter and followed
+by any sequence of letters, digits, or underscore (@samp{_}) characters.
+Case is significant in dimension names.
+ at end table
+
+ at findex ncdimid
+ at findex ncopen
+ at vindex NC_NOWRITE
+Here is an example using @code{ncdimid} to determine the dimension ID of
+a dimension named @code{lat}, assumed to have been defined previously in
+an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid, latid;
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);  /* open for reading */
+   @dots{}
+latid = ncdimid(ncid, "lat");
+ at end group
+ at end example
+
+ at unnumberedsubsec NCDID:  FORTRAN Interface
+
+ at findex NCDID
+ at example
+      INTEGER FUNCTION NCDID (INTEGER NCID,
+     +                        CHARACTER*(*) DIMNAME,
+     +                        INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item DIMNAME
+Dimension name, a character string beginning with a letter and followed
+by any sequence of letters, digits, or underscore (@samp{_}) characters.
+Case is significant in dimension names.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCDID
+ at findex NCOPN
+ at vindex NCNOWRIT
+Here is an example using @code{NCDID} to determine the dimension ID of
+a dimension named @code{lat}, assumed to have been defined previously in
+an existing netCDF file named @file{foo.nc}:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, RCODE, LATID
+         @dots{}
+      NCID = NCOPN('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      LATID = NCDID(NCID, 'lat', RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncdiminq and NCDINQ, ncdimrename and NCDREN, ncdimid and NCDID, Dimensions
+ at section Inquire about a Dimension
+
+ at cindex getting dimension name
+ at cindex getting dimension size
+ at cindex dimension IDs
+ at cindex dimension names
+ at cindex dimension size
+ at cindex dimension inquire
+ at cindex maximum number of records
+ at cindex number of records written
+ at cindex records
+ at cindex unlimited dimension
+ at cindex record dimension
+ at findex ncdiminq
+ at findex NCDINQ
+The function @code{ncdiminq} (or @code{NCDINQ} for FORTRAN) returns the
+name and size of a dimension, given its ID.  The size for the
+unlimited dimension, if any, is the maximum value used so far in
+writing data for that dimension (which is the same as the current
+maximum record number).
+
+In case of an error, @code{ncdiminq} returns -1; @code{NCDINQ} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The dimension ID is invalid for the specified netCDF file.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncdiminq
+ at unnumberedsubsec ncdiminq:  C Interface
+ at example
+int ncdiminq(int ncid, int dimid, char* name, long* size);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item dimid
+Dimension ID, as returned from a previous call to @code{ncdimid} or
+ at code{ncdimdef}.
+
+ at cindex dimension names
+ at vindex MAX_NC_NAME
+ at item name
+Returned dimension name.  The caller must allocate space for the
+returned name.  The maximum possible length, in characters, of a
+dimension name is given by the predefined constant @code{MAX_NC_NAME}.
+If the name parameter is given as @samp{(char *) 0}, no name will be
+returned so no space needs to be allocated.
+
+ at item size
+Returned size of dimension.  For the unlimited dimension, this is the
+current maximum value used for writing any variables with this
+dimension, that is the maximum record number.  If this parameter is
+given as @samp{(long *) 0}, the size will not be returned, so no space
+for this information need be declared or allocated.
+ at end table
+
+ at findex ncdiminq
+ at findex ncopen
+ at findex ncinquire
+ at vindex NC_NOWRITE
+ at findex ncdimid
+ at vindex MAX_NC_NAME
+Here is an example using @code{ncdiminq} to determine the size of a
+dimension named @code{lat}, and the name and current maximum size of the
+unlimited (or record) dimension for an existing netCDF file named
+ at file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid, latid, ndims, nvars, ngatts, recid;
+long latsize, recs;
+char recname[MAX_NC_NAME];
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);  /* open for reading */
+   @dots{}
+latid = ncdimid(ncid, "lat");
+/* get lat size, but don't get name, since we already know it */
+ncdiminq(ncid, latid, (char *) 0, &latsize);
+/* get ID of record dimension (among other things) */
+ncinquire(ncid, &ndims, &nvars, &ngatts, &recid);
+/* get record dimension name and current size */
+ncdiminq(ncid, recid, recname, &recs);
+ at end group
+ at end example
+
+ at findex NCDINQ
+ at unnumberedsubsec NCDINQ:  FORTRAN Interface
+ at example
+      SUBROUTINE NCDINQ (INTEGER NCID, INTEGER DIMID,
+     +                   CHARACTER*(*) DIMNAM, INTEGER DIMSIZ,
+     +                   INTEGER RCODE)
+ at end example
+
+ at table @code
+
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item DIMID
+Dimension ID, as returned from a previous call to @code{NCDID} or @code{NCDDEF}.
+
+ at cindex dimension names
+ at vindex MAXNCNAM
+ at item DIMNAM
+Returned dimension name.  The caller must allocate space for the
+returned name.  The maximum possible length, in characters, of a
+dimension name is given by the predefined constant @code{MAXNCNAM}.
+
+ at item DIMSIZ
+Returned size of dimension.  For the unlimited dimension, this is
+the current maximum value used for writing any variables with this
+dimension, that is the maximum record number.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCDINQ
+ at findex NCOPN
+ at findex NCINQ
+ at vindex NCNOWRIT
+ at findex NCDID
+ at vindex MAXNCNAM
+Here is an example using @code{NCDINQ} to determine the size of a
+dimension named @code{lat}, and the name and current maximum size of the
+unlimited (or record) dimension for an existing netCDF file named
+ at file{foo.nc}:
+ at example
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, RCODE, LATID, LATSIZ
+      INTEGER NDIMS, NVARS, NGATTS, RECID, NRECS
+* 31 in following statement is parameter MAXNCNAM
+      CHARACTER*31 LATNAM, RECNAM
+         @dots{}
+      NCID = NCOPN('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      LATID = NCDID(NCID, 'lat', RCODE)
+* get lat name and size, (even though we already know name)
+      CALL NCDINQ(NCID, LATID, LATNAM, LATSIZ, RCODE)
+* get ID of record dimension (among other things)
+      CALL NCINQ(NCID, NDIMS, NVARS, NGATTS, RECID, RCODE)
+* get record dimension name and current size
+      CALL NCDINQ(NCID, RECID, RECNAME, NRECS, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncdimrename and NCDREN,  , ncdiminq and NCDINQ, Dimensions
+ at section Rename a Dimension
+
+ at cindex renaming dimensions
+ at cindex dimension names
+ at findex ncdimrename
+ at findex NCDREN
+The function @code{ncdimrename} (or @code{NCDREN} for FORTRAN) renames
+an existing dimension in a netCDF file open for writing.  If the new name is
+longer than the old name, the netCDF must be in define mode.  You cannot
+rename a dimension to have the same name as another dimension.
+
+In case of an error, @code{ncdimrename} returns -1; @code{NCDREN} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The new name is the name of another dimension.
+
+ at item
+The dimension ID is invalid for the specified netCDF file.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncdimrename
+ at unnumberedsubsec ncdimrename:  C Interface
+ at example
+int ncdimrename(int ncid, int dimid, const char* name);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item dimid
+Dimension ID, as returned from a previous call to @code{ncdimid} or @code{ncdimdef}.
+
+ at item name
+New dimension name.
+ at end table
+
+ at findex ncdimrename
+ at findex ncopen
+ at findex ncredef
+ at findex ncendef
+ at vindex NC_WRITE
+ at findex ncdimid
+Here is an example using @code{ncdimrename} to rename the dimension
+ at code{lat} to @code{latitude} in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int ncid, latid;
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);  /* open for writing */
+   @dots{}
+ncredef(ncid);  /* put in define mode to rename dimension */
+latid = ncdimid(ncid, "lat");
+ncdimrename(ncid, latid, "latitude");
+ncendef(ncid);  /* leave define mode */
+ at end group
+ at end example
+
+ at findex NCDREN
+ at unnumberedsubsec NCDREN:  FORTRAN Interface
+ at example
+      SUBROUTINE NCDREN (INTEGER NCID, INTEGER DIMID,
+     +                   CHARACTER*(*) DIMNAME, INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item DIMID
+Dimension ID, as returned from a previous call to @code{NCDID} or
+ at code{NCDDEF}.
+
+ at item DIMNAM
+New name for the dimension.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCDREN
+ at findex NCREDF
+ at findex NCOPN
+ at vindex NCWRITE
+ at findex NCDID
+ at findex NCENDF
+Here is an example using @code{NCDREN} to rename the dimension
+"lat" to "latitude" in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, RCODE, LATID
+         @dots{}
+      NCID = NCOPN('foo.nc', NCWRITE, RCODE)
+         @dots{}
+* put in define mode to rename dimension
+      CALL NCREDF(NCID, RCODE)
+      LATID = NCDID(NCID, 'lat', RCODE)
+      CALL NCDREN(NCID, LATID, 'latitude', RCODE)
+* leave define mode
+      CALL NCENDF(NCID, RCODE)
+ at end group
+ at end example
+
+ at node Variables, Attributes, Dimensions, Top
+ at chapter Variables
+
+ at cindex variables
+ at cindex define mode
+ at cindex variable name
+ at cindex variable type
+ at cindex variable shape
+ at cindex variable values
+Variables for a netCDF file are defined when the file is created, while the
+netCDF file is in define mode.  Other variables may be added later
+by reentering define mode.  A netCDF variable has a name, a type, and a
+shape, which are specified when it is defined.  A variable may also have
+values, which are established later in data mode.
+
+ at cindex appending data
+ at cindex unlimited dimension
+ at cindex record dimension
+Ordinarily, the name, type, and shape are fixed when the variable is
+first defined.  The name may be changed, but the type and shape of a
+variable cannot be changed.  However, a variable defined in terms of
+the unlimited dimension can grow without bound in that dimension.
+
+ at cindex variable ID
+A netCDF variable is referred to by a small integer called a variable
+ID.  Attributes may be associated with a variable to specify such
+properties as units, fill values, maximum and minimum valid values,
+scaling factors, and offsets.
+
+Operations supported on variables are:
+ at itemize @bullet
+ at item
+Create a variable, given its name, data type, and shape.
+
+ at item
+Get a variable ID from its name.
+
+ at item
+Get a variable's name, data type, shape, and number of attributes from its ID.
+
+ at item
+Put a data value into a variable, given variable ID, indices, and value.
+
+ at item
+Put a hyperslab of values into a variable, given variable ID, corner
+indices, edge lengths, and a block of values.
+
+ at item
+Put a generalized hyperslab of values into a variable, given variable ID, 
+corner indices, edge lengths, stride vector, index mapping vector, 
+and a block of values.
+
+ at item
+Put values into record variables, given record number and pointers to
+blocks of values.
+
+ at item
+Get a data value from a variable, given variable ID and indices.
+
+ at item
+Get a hyperslab of values from a variable, given variable ID, corner
+indices, and edge lengths.
+
+ at item
+Get a generalized hyperslab of values from a variable, given variable ID, 
+corner indices, edge lengths, stride vector, and index mapping vector.
+
+ at item
+Get values from record variables, given record number and pointers to
+where the data should be stored for each record variable.
+
+ at item
+Rename a variable.
+
+ at item
+Get number of bytes for a given data type.
+
+ at item
+Get the number of record variables, their IDs, and their record sizes.
+
+ at end itemize
+
+ at menu
+* ncvardef and NCVDEF::     Create a Variable
+* ncvarid and NCVID::       Get a Variable ID from Its Name
+* ncvarinq and NCVINQ::     Get Information about a Variable from Its ID
+* ncvarput1 and NCVPT1::    Write a Single Data Value
+* ncvarput and NCVPT::      Write a Hyperslab of Values
+* ncvarputg NCVPTG and NCVPGC::    Write a Generalized Hyperslab of Values
+* ncrecput::                Write a Record of Values
+* ncvarget1 and NCVGT1::    Read a Single Data Value
+* ncvarget and NCVGT(C)::   Read a Hyperslab of Values
+* ncvargetg NCVGTG and NCVGGC::    Read a Generalized Hyperslab of Values
+* ncrecget::                Read a Record of Values
+* Character String I/O::    Reading and Writing Character String Values
+* Missing Values::          Conventions for Missing Values
+* ncvarrename and NCVREN::  Rename a Variable
+* nctypelen and NCTLEN::    Get Number of Bytes for a Data Type
+* ncrecinq::                Get Information about Record Variables
+ at end menu
+
+ at page
+ at node ncvardef and NCVDEF, ncvarid and NCVID,  , Variables
+ at section Create a Variable
+
+ at cindex creating a variable
+ at cindex variable ID
+ at cindex variable name
+ at cindex variable type
+ at cindex variable shape
+ at findex ncvardef
+ at findex NCVDEF
+The function @code{ncvardef} (or @code{NCVDEF} for FORTRAN) adds a new
+variable to an open netCDF file in define mode.  It returns a variable
+ID, given the netCDF ID, the variable name, the variable type, the
+number of dimensions, and a list of the dimension IDs.
+
+ at cindex define mode
+ at cindex maximum dimensions
+ at cindex dimension IDs
+In case of an error, @code{ncvardef} returns -1; @code{NCVDEF} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The netCDF file is not in define mode.
+
+ at item
+The specified variable name is the name of another existing variable.
+
+ at item
+The specified type is not a valid netCDF type.
+
+ at cindex maximum variable dimensions
+ at vindex MAX_VAR_DIMS
+ at item
+The specified number of dimensions is negative or more than the
+constant @code{MAX_VAR_DIMS}, the maximum number of dimensions
+permitted for a netCDF variable.
+
+ at item
+One or more of the dimension IDS in the list of dimensions is not a
+valid dimension ID for the netCDF file.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvardef
+ at unnumberedsubsec ncvardef:  C Interface
+ at example
+int ncvardef(int ncid, const char* name, nc_type datatype,
+             int ndims, const int dimids[]);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item name
+Variable name.  Must begin with an alphabetic character, followed by
+zero or more alphanumeric characters including the underscore (@samp{_}).  Case is
+significant.
+
+ at cindex data types
+ at vindex nc_type
+ at vindex NC_BYTE
+ at vindex NC_CHAR
+ at vindex NC_SHORT
+ at vindex NC_LONG
+ at vindex NC_FLOAT
+ at vindex NC_DOUBLE
+ at item datatype
+One of the set of predefined netCDF data types.  The type of this
+parameter, @code{nc_type}, is defined in the netCDF header file.  The
+valid netCDF data types are @code{NC_BYTE}, @code{NC_CHAR},
+ at code{NC_SHORT}, @code{NC_LONG}, @code{NC_FLOAT}, and @code{NC_DOUBLE}.
+
+ at cindex maximum variable dimensions
+ at vindex MAX_VAR_DIMS
+ at item ndims
+Number of dimensions for the variable.  For example, @code{2} specifies
+a matrix, @code{1} specifies a vector, and @code{0} means the variable
+is a scalar with no dimensions.  Must not be negative or greater than
+the predefined constant @code{MAX_VAR_DIMS}.
+
+ at item dimids
+Vector of @code{ndims} dimension IDs corresponding to the variable
+dimensions.  If the ID of the unlimited dimension is included, it
+must be first.
+ at end table
+
+ at findex nccreate
+ at findex ncdimdef
+ at findex ncvardef
+ at vindex NC_UNLIMITED
+ at vindex NC_CLOBBER
+Here is an example using @code{ncvardef} to create a variable named
+ at code{rh} of type @code{long} with three dimensions, @code{time},
+ at code{lat}, and @code{lon} in a new netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;                         /* netCDF ID */
+int  lat_dim, lon_dim, time_dim;   /* dimension IDs */
+int  rh_id;                        /* variable ID */
+int  rh_dimids[3];                 /* variable shape */
+   @dots{}
+ncid = nccreate("foo.nc", NC_CLOBBER);
+   @dots{}
+                                   /* define dimensions */
+lat_dim = ncdimdef(ncid, "lat", 5L);
+lon_dim = ncdimdef(ncid, "lon", 10L);
+time_dim = ncdimdef(ncid, "time", NC_UNLIMITED);
+   @dots{}
+                                  /* define variable */
+rh_dimids[0] = time_dim;
+rh_dimids[1] = lat_dim;
+rh_dimids[2] = lon_dim;
+rh_id = ncvardef (ncid, "rh", NC_DOUBLE, 3, rh_dimids);
+ at end group
+ at end example
+
+ at findex NCVDEF
+ at unnumberedsubsec NCVDEF:  FORTRAN Interface
+ at example
+      INTEGER FUNCTION NCVDEF(INTEGER NCID, CHARACTER*(*) VARNAM,
+     +                        INTEGER VARTYP, INTEGER NVDIMS,
+     +                        INTEGER VDIMS(*), INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item VARNAM
+Variable name.  Must begin with an alphabetic character, which is
+followed by zero or more alphanumeric characters including the underscore (@samp{_}).
+Case is significant.
+
+ at cindex data types
+ at vindex NCBYTE
+ at vindex NCCHAR
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item VARTYP
+One of the set of predefined netCDF data types.  The valid netCDF data
+types are @code{NCBYTE}, @code{NCCHAR}, @code{NCSHORT}, @code{NCLONG}, @code{NCFLOAT}, and @code{NCDOUBLE}.
+
+ at cindex maximum variable dimensions
+ at vindex MAXVDIMS
+ at item NVDIMS
+Number of dimensions for the variable.  For example, @code{2} specifies
+a matrix, @code{1} specifies a vector, and @code{0} means the variable
+is a scalar with no dimensions.  Must not be negative or greater than
+the predefined constant @code{MAXVDIMS}.
+
+ at item VDIMS
+Vector of @code{NVDIMS} dimension IDs corresponding to the variable
+dimensions.  If the ID of the unlimited dimension is included, it
+must be last.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCCRE
+ at findex NCDDEF
+ at findex NCVDEF
+ at vindex NC_CLOBBER
+ at vindex NCUNLIM
+Here is an example using @code{NCVDEF} to create a variable named
+ at code{rh} of type @code{long} with three dimensions, @code{time},
+ at code{lat}, and @code{lon} in a new netCDF file named @file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID, RCODE
+      INTEGER  LATDIM, LONDIM, TIMDIM ! dimension IDs
+      INTEGER  RHID                    ! variable ID
+      INTEGER  RHDIMS(3)               ! variable shape
+         @dots{}
+      NCID = NCCRE ('foo.nc', NC_CLOBBER, RCODE)
+         @dots{}
+                                       ! define dimensions
+      LATDIM = NCDDEF(NCID, 'lat', 5, RCODE)
+      LONDIM = NCDDEF(NCID, 'lon', 10, RCODE)
+      TIMDIM = NCDDEF(NCID, 'time', NCUNLIM, RCODE)
+         @dots{}
+                                       ! define variable
+      RHDIMS(1) = LONDIM
+      RHDIMS(2) = LATDIM
+      RHDIMS(3) = TIMDIM
+      RHID = NCVDEF (NCID, 'rh', NCDOUBLE, 3, RHDIMS, RCODE)
+ at end group
+ at end example
+
+
+ at page
+ at node ncvarid and NCVID, ncvarinq and NCVINQ, ncvardef and NCVDEF, Variables
+ at section Get a Variable ID from Its Name
+
+ at cindex variable ID
+ at cindex variable name
+ at findex ncvarid
+ at findex NCVID
+The function @code{ncvarid} (or @code{NCVID} for FORTRAN) returns the ID
+of a netCDF variable, given its name.
+
+In case of an error, @code{ncvarid} returns -1; @code{NCVID} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The specified variable name is not a valid name for a variable in the
+specified netCDF file.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvarid
+ at unnumberedsubsec ncvarid:  C Interface
+ at example
+int ncvarid(int ncid, const char* name);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item name
+Variable name for which ID is desired.
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at vindex NC_NOWRITE
+Here is an example using @code{ncvarid} to find out the ID of a variable
+named @code{rh} in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;                         /* netCDF ID */
+int  rh_id;                        /* variable ID */
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+ at end group
+ at end example
+
+ at findex NCVID
+ at unnumberedsubsec NCVID:  FORTRAN Interface
+ at example
+      INTEGER FUNCTION NCVID(INTEGER NCID,
+     +                       CHARACTER*(*) VARNAM,
+     +                       INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item VARNAM
+Variable name for which ID is desired.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at vindex NCNOWRIT
+Here is an example using @code{NCVID} to find out the ID of a variable
+named @code{rh} in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID, RCODE
+      INTEGER  RHID                    ! variable ID
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncvarinq and NCVINQ, ncvarput1 and NCVPT1, ncvarid and NCVID, Variables
+ at section Get Information about a Variable from Its ID
+
+ at cindex getting variable name
+ at cindex getting variable type
+ at cindex getting variable shape
+ at cindex variable name
+ at cindex variable type
+ at cindex variable shape
+ at cindex variable inquire
+ at cindex variable dimensions
+ at findex ncvarinq
+ at findex NCVINQ
+The function @code{ncvarinq} (or @code{NCVINQ} for FORTRAN) returns
+information about a netCDF variable, given its ID.  The information
+returned is the name, type, number of dimensions, a list of
+dimension IDs describing the shape of the variable, and the number of
+variable attributes that have been assigned to the variable.
+
+In case of an error, @code{ncvarinq} returns -1; @code{NCVINQ} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvarinq
+ at unnumberedsubsec ncvarinq:  C Interface
+ at example
+int ncvarinq(int ncid, int varid, char* name, nc_type* datatype,
+             int* ndims, int dimids[], int* natts);
+ at end example
+
+ at cindex variable name
+ at cindex variable type
+ at cindex variable dimensions
+ at cindex variable attributes
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item varid
+Variable ID, returned from a previous call to @code{ncvardef} or
+ at code{ncvarid}.
+
+ at cindex maximum name length
+ at vindex MAX_NC_NAME
+ at item name
+Returned variable name.  The caller must allocate space for the
+returned name.  The maximum possible length, in characters, of a
+variable name is given by the predefined constant @code{MAX_NC_NAME}.
+If the name parameter is given as @samp{(char *) 0}, no name will be
+returned so no space needs to be allocated.
+
+ at cindex data types
+ at vindex nc_type
+ at vindex NC_BYTE
+ at vindex NC_CHAR
+ at vindex NC_SHORT
+ at vindex NC_LONG
+ at vindex NC_FLOAT
+ at vindex NC_DOUBLE
+ at item datatype
+Returned variable type, one of the set of predefined netCDF data types.
+The type of this parameter, @code{nc_type}, is defined in the netCDF
+header file.  The valid netCDF data types are @code{NC_BYTE},
+ at code{NC_CHAR}, @code{NC_SHORT}, @code{NC_LONG}, @code{NC_FLOAT}, and
+ at code{NC_DOUBLE}.  If this parameter is given as @samp{(nc_type *) 0},
+no type will be returned so no variable to hold the type needs to be
+declared.
+
+ at item ndims
+Returned number of dimensions the variable was defined as using.  For
+example, @code{2} specifies a matrix, @code{1} specifies a vector, and
+ at code{0} means the variable is a scalar with no dimensions.  If this
+parameter is given as @samp{(int *) 0}, no number of dimensions will be
+returned so no variable to hold this information needs to be declared.
+
+ at cindex variable dimensions
+ at cindex maximum variable dimensions
+ at vindex MAX_VAR_DIMS
+ at item dimids
+Returned vector of @code{ndims} dimension IDs corresponding to the
+variable dimensions.  The caller must allocate enough space for a vector
+of at least @code{ndims} integers to be returned.  The maximum possible
+number of dimensions for a variable is given by the predefined constant
+ at code{MAX_VAR_DIMS}.  If this parameter is given as @samp{(int *) 0}, no
+vector will be returned so no space to hold the dimension IDs needs to
+be declared or allocated.
+
+ at item natts
+Returned number of variable attributes assigned to this variable.  If
+this parameter is given as @samp{(int *) 0}, the number of attributes
+will not be returned so no space to hold this information needs to be
+declared or allocated.
+ at end table
+ at sp 1
+ at findex ncopen
+ at findex ncvarid
+ at findex ncvarinq
+ at vindex nc_type
+ at vindex NC_NOWRITE
+ at vindex MAX_VAR_DIMS
+Here is an example using @code{ncvarinq} to find out about a variable
+named @code{rh} in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;                         /* netCDF ID */
+int  rh_id;                        /* variable ID */
+nc_type rh_type;                   /* variable type */
+int rh_ndims;                      /* number of dims */
+int  rh_dims[MAX_VAR_DIMS];        /* variable shape */
+int rh_natts                       /* number of attributes */
+   @dots{}
+ncid = ncopen ("foo.nc", NC_NOWRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+/* we don't need name, since we already know it */
+ncvarinq (ncid, rh_id, (char *) 0, &rh_type, &rh_ndims, rh_dims,
+          &rh_natts);
+ at end group
+ at end example
+
+ at findex NCVINQ
+ at unnumberedsubsec NCVINQ:  FORTRAN Interface
+ at example
+      SUBROUTINE NCVINQ (INTEGER NCID, INTEGER VARID,
+     +                   CHARACTER*(*) VARNAM, INTEGER VARTYP,
+     +                   INTEGER NVDIMS, INTEGER VDIMS(*),
+     +                   INTEGER NVATTS, INTEGER RCODE)
+ at end example
+
+ at cindex variable name
+ at cindex variable type
+ at cindex variable dimensions
+ at cindex variable attributes
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item VARID
+Variable ID, returned from a previous call to @code{NCVDEF} or
+ at code{NCVID}.
+
+ at cindex maximum name length
+ at vindex MAXNCNAM
+ at item VARNAM
+Returned variable name.  The caller must allocate space for the
+returned name.  The maximum possible length, in characters, of a
+variable name is given by the predefined constant @code{MAXNCNAM}.
+
+ at cindex data types
+ at vindex NCBYTE
+ at vindex NCCHAR
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item VARTYP
+Returned variable type, one of the set of predefined netCDF data types.
+The valid netCDF data types are @code{NCBYTE}, @code{NCCHAR},
+ at code{NCSHORT}, @code{NCLONG}, @code{NCFLOAT}, and @code{NCDOUBLE}.
+
+ at item NVDIMS
+Returned number of dimensions for the variable.  For example, @code{2}
+specifies a matrix, @code{1} specifies a vector, and @code{0} means the
+variable is a scalar with no dimensions.
+
+ at cindex maximum variable dimensions
+ at vindex MAXVDIMS
+ at item VDIMS
+Returned vector of @code{NVDIMS} dimension IDs corresponding to the
+variable dimensions.  The caller must allocate enough space for a vector
+of at least @code{NVDIMS} integers to be returned.  The maximum possible
+number of dimensions for a variable is given by the predefined constant
+ at code{MAXVDIMS}.
+
+ at item NVATTS
+Returned number of variable attributes assigned to this variable.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCVINQ
+ at vindex NCNOWRIT
+ at vindex MAXVDIMS
+Here is an example using @code{NCVINQ} to find out about a variable
+named @code{rh} in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID, RCODE
+      INTEGER  RHID               ! variable ID
+      CHARACTER*31 RHNAME         ! variable name
+      INTEGER  RHTYPE             ! variable type
+      INTEGER  RHN                ! number of dimensions
+      INTEGER  RHDIMS(MAXVDIMS)   ! variable shape
+      INTEGER  RHNATT             ! number of attributes
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)! get ID
+      CALL NCVINQ (NCID, RHID, RHNAME, RHTYPE, RHN, RHDIMS, RHNATT,
+     +             RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncvarput1 and NCVPT1, ncvarput and NCVPT, ncvarinq and NCVINQ, Variables
+ at section Write a Single Data Value
+
+ at cindex putting variable data
+ at cindex writing data
+ at findex ncvarput1
+ at findex NCVPT1
+ at findex NCVP1C
+The function @code{ncvarput1} (or @code{NCVPT1} or @code{NCVP1C} for
+FORTRAN) puts a single data value into a variable of an open netCDF file
+that is in data mode.  Inputs are the netCDF ID, the variable ID, a
+multidimensional index that specifies which value to add or alter, and
+the data value.
+
+In case of an error, @code{ncvarput1} returns -1; @code{NCVPT1} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified indices were out of range for the dimensionality of the
+specified variable.  For example, a negative index or an index that is
+larger than the corresponding dimension size will cause an error.
+
+ at item
+The specified netCDF is in define mode rather than data mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvarput1
+ at unnumberedsubsec ncvarput1:  C Interface
+ at example
+int ncvarput1(int ncid, int varid, const long mindex[], const void *value);
+ at end example
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item varid
+Variable ID, returned from a previous call to @code{ncvardef} or
+ at code{ncvarid}.
+
+ at item mindex
+The multidimensional index of the the data value to be written.  The
+indices are relative to 0, so for example, the first data value of a
+two-dimensional variable would have index @code{(0,0)}.  The elements
+of @code{mindex} must correspond to the variable's dimensions.  Hence, if
+the variable is a record variable, the first index would correspond to
+the record number.
+
+ at item value
+Pointer to the data value to be written.  The pointer is declared to be
+of type @code{void *} because it can point to data of any of the basic
+netCDF types.  The data should be of the appropriate type for the netCDF
+variable.  @strong{Warning: neither the compiler nor the netCDF software
+can detect whether the wrong type of data is used.}
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncvarput1
+ at vindex NC_WRITE
+Here is an example using @code{ncvarput1} to set the @code{(1,2,3)}
+element of the variable named @code{rh} to @code{0.5} in an existing
+netCDF file named @file{foo.nc}.  For simplicity in this example, we
+assume that we know that @code{rh} is dimensioned with @code{time},
+ at code{lat}, and @code{lon}, so we want to set the value of @code{rh} that
+corresponds to the second @code{time} value, the third @code{lat} value,
+and the fourth @code{lon} value:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;                         /* netCDF ID */
+int  rh_id;                        /* variable ID */
+static long rh_index[] = @{1, 2, 3@}; /* where to put value */
+static double rh_val = 0.5;        /* value to put */
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+ncvarput1(ncid, rh_id, rh_index, (void *) &rh_val);
+ at end group
+ at end example
+
+ at findex NCVPT1
+ at unnumberedsubsec NCVPT1:  FORTRAN Interface
+ at example
+      SUBROUTINE NCVPT1 (INTEGER NCID, INTEGER VARID,
+     +                   INTEGER MINDEX(*), @var{type} VALUE,
+     +                   INTEGER RCODE)
+
+      SUBROUTINE NCVP1C (INTEGER NCID, INTEGER VARID,
+     +                   INTEGER MINDEX(*), CHARACTER CHVAL,
+     +                   INTEGER RCODE)
+ at end example
+
+There are two FORTRAN subroutines, @code{NCVPT1} and @code{NCVP1C}, for
+putting a single value in a variable.  The first puts a
+numeric value in a variable of numeric type, and the second puts
+a character value in a variable of character type.
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item VARID
+Variable ID, returned from a previous call to @code{NCVDEF} or
+ at code{NCVID}.
+
+ at item MINDEX
+The multidimensional index of the the data value to be written.  The
+indices are relative to 1, so for example, the first data value of a
+two-dimensional variable would have index @code{(1,1)}.  The elements
+of @code{mindex} must correspond to the variable's dimensions.  Hence, if
+the variable is a record variable, the last index would correspond to
+the record number.
+
+ at cindex data types
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item VALUE
+For @code{NCVPT1}, the data value to be written.  The data may be of a
+type corresponding to any of the netCDF types @code{NCSHORT},
+ at code{NCLONG}, @code{NCFLOAT}, or @code{NCDOUBLE}, but must be appropriate
+for the type of the netCDF variable.  @strong{Warning: neither the
+compiler nor the netCDF software can detect whether the wrong type of data is
+used.}
+
+ at cindex data types
+ at vindex NCCHAR
+ at vindex NCBYTE
+ at item CHVAL
+For @code{NCVP1C}, the data value to be written.  The data should be of
+a type character, corresponding to the netCDF types @code{NCCHAR} or
+ at code{NCBYTE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCVPT1
+Here is an example using @code{NCVPT1} to set the @code{(4,3,2)}
+element of the variable named @code{rh} to @code{0.5} in an existing
+netCDF file named @file{foo.nc}.  For simplicity in this example, we
+assume that we know that @code{rh} is dimensioned with @code{lon},
+ at code{lat}, and @code{time}, so we want to set the value of @code{rh} that
+corresponds to the fourth @code{lon} value, the third @code{lat} value,
+and the second @code{time} value:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID, RCODE
+      INTEGER  RHID               ! variable ID
+      INTEGER  RHINDX(3)          ! where to put value
+      DATA RHINDX /4, 3, 2/
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCWRITE, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)  ! get ID
+      CALL NCVPT1 (NCID, RHID, RHINDX, 0.5, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncvarput and NCVPT, ncvarputg NCVPTG and NCVPGC, ncvarput1 and NCVPT1, Variables
+ at section Write a Hyperslab of Values
+
+ at cindex putting variable data
+ at cindex writing data
+ at cindex hyperslab access
+ at findex ncvarput
+ at findex NCVPT
+ at findex NCVPTC
+The function @code{ncvarput} (or @code{NCVPT} or @code{NCVPTC} for
+FORTRAN) writes a hyperslab of values into a netCDF variable of an open
+netCDF file.  The hyperslab is specified by giving a corner and a vector
+of edge lengths.  The values are specified as a vector whose elements
+are ordered by assuming that the last dimension of the hyperslab varies
+fastest for C, the first dimension varies fastest for FORTRAN.  The
+netCDF file must be in data mode.
+
+In case of an error, @code{ncvarput} returns -1; @code{NCVPT} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified corner indices were out of range for the dimensionality of
+the specified variable.  For example, a negative index, or an index that
+is larger than the corresponding dimension size will cause an error.
+
+ at item
+The specified edge lengths added to the specified corner would have
+referenced data out of range for the dimensionality of the specified
+variable.  For example, an edge length that is larger than the
+corresponding dimension size minus the corner index will cause an error.
+
+ at item
+The specified netCDF file is in define mode rather than data mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvarput
+ at unnumberedsubsec ncvarput:  C Interface
+ at example
+int ncvarput(int ncid, int varid, const long start[], const long count[],
+             const void *values);
+ at end example
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item varid
+Variable ID, returned from a previous call to @code{ncvardef} or
+ at code{ncvarid}.
+
+ at item start
+A vector of long integers specifying the multidimensional index of the
+corner of the hyperslab where the first of the data values will be
+written.  The indices are relative to 0, so for example, the first data
+value of a variable would have index @code{(0, 0, @dots{}, 0)}.  The
+size of @code{start} must be the same as the number of dimensions of the
+specified variable.  The elements of @code{start} must correspond to the
+variable's dimensions in order.  Hence, if the variable is a record
+variable, the first index would correspond to the starting record number
+for writing the data values.
+
+ at item count
+A vector of long integers specifying the multidimensional edge lengths from
+the corner of the hyperslab where the first of the data values will be
+written.  To write a single value, for example, specify @code{count} as
+ at code{(1, 1, @dots{}, 1)}.  The size of @code{count} is the number of
+dimensions of the specified variable.  The elements of @code{count}
+correspond to the variable's dimensions.  Hence, if the variable is a
+record variable, the first element of @code{count} corresponds to a
+count of the number of records to write.
+
+ at item value
+Pointer to a block of data values to be written.  The order in which the
+data will be written to the netCDF variable 
+is with the last dimension of the specified hyperslab
+varying fastest.
+The pointer is declared to be of the type
+ at code{void *} because it can point to data of any of the basic netCDF
+types.  The data should be of the appropriate type for the netCDF
+variable.  @strong{Warning: neither the compiler nor the netCDF software
+can detect whether the wrong type of data is used.}
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncvarput
+Here is an example using @code{ncvarput} to add or change all the values
+of the variable named @code{rh} to @code{0.5} in an existing netCDF file
+named @file{foo.nc}.  For simplicity in this example, we assume that we
+know that @code{rh} is dimensioned with @code{time}, @code{lat}, and
+ at code{lon}, and that there are three @code{time} values, five @code{lat}
+values, and ten @code{lon} values.
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+#define TIMES 3
+#define LATS  5
+#define LONS  10
+int  ncid;                         /* netCDF ID */
+int  rh_id;                        /* variable ID */
+static long start[] = @{0, 0, 0@};    /* start at first value */
+static long count[] = @{TIMES, LATS, LONS@};
+double rh_vals[TIMES*LATS*LONS];   /* array to hold values */
+int i;
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+for (i = 0; i < TIMES*LATS*LONS; i++)
+    rh_vals[i] = 0.5;
+/* write hyperslab of values into netCDF variable */
+ncvarput(ncid, rh_id, start, count, (void *) rh_vals);
+ at end group
+ at end example
+
+ at findex NCVPT
+ at unnumberedsubsec NCVPT:  FORTRAN Interface
+ at example
+      SUBROUTINE NCVPT (INTEGER NCID, INTEGER VARID,
+     +                  INTEGER START(*), INTEGER COUNT(*),
+     +                  @var{type} VALUES, INTEGER RCODE)
+
+      SUBROUTINE NCVPTC(INTEGER NCID, INTEGER VARID,
+     +                  INTEGER START(*), INTEGER COUNTS(*),
+     +                  CHARACTER*(*) STRING, INTEGER LENSTR,
+     +                  INTEGER RCODE)
+ at end example
+
+There are two FORTRAN subroutines, @code{NCVPT} and @code{NCVPTC}, for
+writing a hyperslab of values into a netCDF variable.  The first writes
+numeric values into a variable of numeric type, and the second 
+writes character values into a variable of character type.
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item VARID
+Variable ID, returned from a previous call to @code{NCVDEF} or
+ at code{NCVID}.
+
+ at item START
+A vector of integers specifying the multidimensional index of the
+corner of the hyperslab where the first of the data values will be
+written.  The indices are relative to 1, so for example, the first data
+value of a variable would have index @code{(1, 1, @dots{}, 1)}.  The
+size of @code{START} must be the same as the number of dimensions of the
+specified variable.  The elements of @code{START} must correspond to the
+variable's dimensions in order.  Hence, if the variable is a record
+variable, the last index would correspond to the starting record number
+for writing the data values.
+
+ at item COUNT
+A vector of integers specifying the multidimensional edge lengths from
+the corner of the hyperslab where the first of the data values will be
+written.  To write a single value, for example, specify @code{COUNT} as
+ at code{(1, 1, @dots{}, 1)}.  The size of @code{COUNT} is the number of
+dimensions of the specified variable.  The elements of @code{COUNT}
+correspond to the variable's dimensions.  Hence, if the variable is a
+record variable, the last element of @code{COUNT} corresponds to a
+count of the number of records to write.
+
+ at cindex data types
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item VALUES
+For @code{NCVPT}, the block of data values to be written.  The order in
+which the data will be written into the specified hyperslab is with the
+first dimension varying fastest (like the ordinary FORTRAN convention).
+The data may be of a type corresponding to any of the netCDF types
+ at code{NCSHORT}, @code{NCLONG}, @code{NCFLOAT}, or @code{NCDOUBLE}, but
+must be appropriate for the type of the netCDF variable.
+ at strong{Warning: neither the compiler nor the netCDF software can detect
+whether the wrong type of data is used.}
+
+ at cindex data types
+ at vindex NCCHAR
+ at vindex NCBYTE
+ at item STRING
+For @code{NCVPTC}, the characters to be written.  The order in which the
+characters will be written to the netCDF variable
+is with the first dimension of the
+specified hyperslab
+varying fastest (like the FORTRAN convention).  The data
+may be of a type corresponding to the netCDF types @code{NCCHAR} or
+ at code{NCBYTE}.
+
+ at item LENSTR
+For @code{NCVPTC}, the total declared length (in characters) of the
+ at code{STRING} argument.  This should be at least as large as the product
+of the elements of the @code{COUNT} vector.  Note that this is not
+necessarily the same as the value returned by the FORTRAN @code{LEN}
+function, because an array argument may be provided.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCVPT
+Here is an example using @code{NCVPT} to add or change all the
+values of the variable named @code{rh} to @code{0.5} in an existing
+netCDF file named @file{foo.nc}.  For simplicity in this example, we
+assume that we know that @code{rh} is dimensioned with @code{lon},
+ at code{lat}, and @code{time}, and that there are ten @code{lon} values, five
+ at code{lat} values, and three @code{time} values.
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      PARAMETER (NDIMS=3)         ! number of dimensions
+      PARAMETER (TIMES=3, LATS=5, LONS=10) ! dimension sizes
+      INTEGER  NCID, RCODE
+      INTEGER  RHID               ! variable ID
+      INTEGER  START(NDIMS), COUNT(NDIMS) ! hyperslab
+      DOUBLE RHVALS(LONS, LATS, TIMES)      
+      DATA START /1, 1, 1/        ! start at first value
+      DATA COUNT /LONS, LATS, TIMES/
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCWRITE, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)   ! get ID
+      DO 10 ILON = 1, LONS
+         DO 10 ILAT = 1, LATS
+            DO 10 ITIME = 1, TIMES
+               RHVALS(ILON, ILAT, ITIME) = 0.5
+   10 CONTINUE
+      CALL NCVPT (NCID, RHID, START, COUNT, RHVALS, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncvarputg NCVPTG and NCVPGC, ncrecput, ncvarput and NCVPT, Variables
+ at comment  node-name,  next,  previous,  up
+ at section Write a Generalized Hyperslab of Values
+
+ at cindex putting variable data
+ at cindex writing data
+ at cindex generalized hyperslab access
+ at findex ncvarputg
+ at findex NCVPTG
+ at findex NCVPGC
+The function @code{ncvarputg} (or @code{NCVPTG} or @code{NCVPGC} for
+FORTRAN) writes a generalized hyperslab of values into a netCDF variable 
+of an open
+netCDF file.  The generalized hyperslab is specified by giving a corner,
+a vector of edge lengths, a stride vector, and an index mapping vector.
+No assumptions are made about the ordering or size of the dimensions of the
+data array.
+The netCDF file must be in data mode.
+
+In case of an error, @code{ncvarputg} returns -1; @code{NCVPTG} and
+ at code{NCVPGC} return a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified corner indices were out of range for the dimensionality of
+the specified variable.  For example, a negative index, or an index that
+is larger than the corresponding dimension size will cause an error.
+
+ at item
+The specified edge lengths and strides added to the specified corner would have
+referenced data out of range for the dimensionality of the specified
+variable.  For example, an edge length that is larger than the
+corresponding dimension size minus the corner index will cause an error,
+as will accessing two or more points using a stride that is greater than the
+size of the netCDF variable in the corresponding dimension.
+
+ at item
+A non-positive stride.
+
+ at item
+The specified netCDF is in define mode rather than data mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvarputg
+ at unnumberedsubsec ncvarputg:  C Interface
+ at example
+int ncvarputg(int ncid, int varid, const long start[], const long count[],
+              const long stride[], const long imap[], const void *values);
+ at end example
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item varid
+Variable ID, returned from a previous call to @code{ncvardef} or
+ at code{ncvarid}.
+
+ at item start
+A vector of long integers specifying the multidimensional index of the
+corner of the hyperslab where the first of the data values will be
+written.  The indices are relative to 0, so for example, the first data
+value of a variable would have index @code{(0, 0, @dots{}, 0)}.  The
+size of @code{start} must be the same as the number of dimensions of the
+specified variable.  The elements of @code{start} must correspond to the
+variable's dimensions in order.  Hence, if the variable is a record
+variable, the first index would correspond to the starting record number
+for writing the data values.
+
+ at item count
+A vector of long integers specifying the multidimensional edge lengths from
+the corner of the hyperslab where the first of the data values will be
+written.  To write a single value, for example, specify @code{count} as
+ at code{(1, 1, @dots{}, 1)}.  The size of @code{count} is the number of
+dimensions of the specified variable.  The elements of @code{count}
+correspond to the variable's dimensions.  Hence, if the variable is a
+record variable, the first element of @code{count} corresponds to a
+count of the number of records to write.
+
+ at item stride
+A vector of long integers specifying,
+for each dimension,
+the interval between the accessed values of a netCDF variable.
+The size of the vector shall be at least the number of dimensions of the
+associated
+netCDF variable and its elements shall correspond, in order, to the
+variable's dimensions.
+A value of 1 accesses adjacent values of the netCDF variable 
+in the corresponding dimension;
+a value of 2 accesses every other value of the netCDF variable in the
+corresponding dimension; and so on.
+A @code{NULL} stride argument obtains the default behavior in which
+adjacent values are accessed along each dimension.
+
+ at item imap
+A vector of long integers specifying,
+for each dimension,
+how data values associated with a 
+netCDF variable are arranged in memory.
+The offset, in bytes, from the memory location pointed to by the @code{value}
+argument to a particular datum is given by the
+inner product of the index mapping vector with the coordinates of 
+the datum.
+(The @dfn{inner product} of two vectors [x0, x1, @dots{}, xn] and
+[y0, y1, @dots{}, yn] is just x0*y0 + x1*y1 + @dots{} + xn*yn.)
+The vector may contain negative values if the
+ at code{value} argument is appropriately specified.
+A @code{NULL} argument obtains the default behavior in
+which the memory-resident values are assumed to have the same structure as the 
+associated netCDF variable.
+
+ at item value
+Pointer to a block of data values to be written.  The order in which the
+data will be written to the netCDF variable
+is with the last
+dimension of the generalized hyperslab varying fastest.
+The pointer is declared to be of the type
+ at code{void *} because it can point to data of any of the basic netCDF
+types.  The data should be of the appropriate type for the netCDF
+variable.  @strong{Warning: neither the compiler nor the netCDF software
+can detect whether the wrong type of data is used.}
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncvarputg
+Here is an example using @code{ncvarputg} to add or change every other value
+in each dimension
+of the variable named @code{rh} to @code{0.5} in an existing netCDF file
+named @file{foo.nc}.
+Values are taken, using the same dimensional strides, from points 
+in a 3-dimensional array of 
+structures whose dimensions are the reverse of the netCDF variable.
+For simplicity in this example, we assume that we
+know that @code{rh} is dimensioned with @code{time}, @code{lat}, and
+ at code{lon}, and that there are three @code{time} values, five @code{lat}
+values, and ten @code{lon} values.
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+#define TIMES 3
+#define LATS  5
+#define LONS  10
+int  ncid;                         /* netCDF ID */
+int  rh_id;                        /* variable ID */
+static long start[] = @{0, 0, 0@};   /* start at first value */
+static long count[] = @{TIMES, LATS, LONS@};
+static long stride[] = @{2, 2, 2@};  /* every other value */
+long imap[3];                      /* set to reverse of variable */
+struct datum @{
+    int    dummy;                  /* to illustrate mapping vector */
+    double rh_val;                 /* actual value to be written */
+@}      data[LONS][LATS][TIMES];    /* reversed array to hold values. */
+int itime, ilat, ilon;
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+for (ilon = 0; ilon < LONS; ilon += stride[2])
+    for (ilat = 0; ilat < LATS; ilat += stride[1])
+        for (itime = 0; itime < TIMES; itime += stride[0])
+            data[ilon][ilat][itime].rh_val = 0.5;
+/* access every `stride' in-memory value using reversed dimensions */
+imap[0] = stride[2]*sizeof(struct datum);
+imap[1] = stride[1]*(1+(LONS-1)/stride[0])*imap[0];
+imap[2] = stride[0]*(1+(LATS-1)/stride[1])*imap[1];
+/* write generalized hyperslab of values into netCDF variable */
+ncvarputg(ncid, rh_id, start, count, stride, imap, (void*)&data[0][0][0].rh_val);
+ at end group
+ at end example
+
+ at findex NCVPTG
+ at findex NCVPGC
+ at unnumberedsubsec NCVPTG, NCVPGC:  FORTRAN Interface
+ at example
+      SUBROUTINE NCVPTG (INTEGER NCID, INTEGER VARID,
+     +                   INTEGER START(*), INTEGER COUNT(*),
+     +                   INTEGER STRIDE(*), INTEGER IMAP(*),
+     +                   @var{type} VALUES, INTEGER RCODE)
+
+      SUBROUTINE NCVPGC (INTEGER NCID, INTEGER VARID,
+     +                   INTEGER START(*), INTEGER COUNT(*),
+     +                   INTEGER STRIDE(*), INTEGER IMAP(*),
+     +                   CHARACTER*(*) STRING, INTEGER RCODE)
+ at end example
+
+There are two FORTRAN subroutines, @code{NCVPTG} and @code{NCVPGC}, for
+writing a generalized hyperslab of values into a netCDF variable.  
+The first writes
+numeric values into a variable of numeric type, and the second 
+writes character values into a variable of character type.
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item VARID
+Variable ID, returned from a previous call to @code{NCVDEF} or
+ at code{NCVID}.
+
+ at item START
+A vector of integers specifying the multidimensional index of the
+corner of the hyperslab where the first of the data values will be
+written.  The indices are relative to 1, so for example, the first data
+value of a variable would have index @code{(1, 1, @dots{}, 1)}.  The
+size of @code{START} must be the same as the number of dimensions of the
+specified variable.  The elements of @code{START} must correspond to the
+variable's dimensions in order.  Hence, if the variable is a record
+variable, the last index would correspond to the starting record number
+for writing the data values.
+
+ at item COUNT
+A vector of integers specifying the multidimensional edge lengths from
+the corner of the hyperslab where the first of the data values will be
+written.  To write a single value, for example, specify @code{COUNT} as
+ at code{(1, 1, @dots{}, 1)}.  The size of @code{COUNT} is the number of
+dimensions of the specified variable.  The elements of @code{COUNT}
+correspond to the variable's dimensions.  Hence, if the variable is a
+record variable, the last element of @code{COUNT} corresponds to a
+count of the number of records to write.
+
+ at item STRIDE
+A vector of integers specifying,
+for each dimension,
+the interval between the accessed values of a netCDF variable or the value
+ at code{0}.
+The size of the vector shall be at least the number of dimensions of the
+associated
+netCDF variable and its elements shall correspond, in order, to the
+variable's dimensions.
+A value of 1 accesses adjacent values of the netCDF variable 
+in the corresponding dimension;
+a value of 2 accesses every other value of the netCDF variable in the
+corresponding dimension; and so on.
+An @code{0} argument obtains the default behavior in which
+adjacent values are accessed along each dimension.
+
+ at item IMAP
+A vector of long integers specifying,
+for each dimension,
+how data values associated with a 
+netCDF variable are arranged in memory or the value @code{0}.
+The offset, in bytes, from the memory location pointed to by the @code{value}
+argument to a particular datum is given by the
+inner product of the index mapping vector with the (origin-0) coordinates of 
+the datum.
+(The @dfn{inner product} of two vectors [x1, x2, @dots{}, xn] and
+[y1, y2, @dots{}, yn] is just x1*y1 + x2*y2 + @dots{} + xn*yn.)
+The vector may contain negative values if the
+ at code{value} argument is appropriately specified.
+A @code{0} argument obtains the default behavior in
+which the memory-resident values are assumed to have the same structure as the 
+associated netCDF variable.
+
+ at cindex data types
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item VALUES
+For @code{NCVPTG}, the block of data values to be written.  The order in
+which the data will be written from the specified hyperslab is with the
+first dimension of the generalized hyperslab varying fastest (like the 
+ordinary FORTRAN convention).
+The data may be of a type corresponding to any of the netCDF types
+ at code{NCSHORT}, @code{NCLONG}, @code{NCFLOAT}, or @code{NCDOUBLE}, but
+must be appropriate for the type of the netCDF variable.
+ at strong{Warning: neither the compiler nor the netCDF software can detect
+whether the wrong type of data is used.}
+
+ at cindex data types
+ at vindex NCCHAR
+ at vindex NCBYTE
+ at item STRING
+For @code{NCVPGC}, the characters to be written.  The order in which the
+characters will be written to the netCDF variable
+is with the
+first dimension 
+of the generalized hyperslab
+varying fastest (like the FORTRAN convention).
+The data
+may be of a type corresponding to the netCDF types @code{NCCHAR} or
+ at code{NCBYTE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCVPTG
+Here is an example using @code{NCVPTG} to add or change every other
+value in each dimension
+of the variable named @code{rh} to @code{0.5} in an existing
+netCDF file named @file{foo.nc}.
+Values are taken, using the same dimensional strides, from a 2-parameter
+array whose dimensions
+are the reverse of the netCDF variable.
+For simplicity in this example, we
+assume that we know that @code{rh} is dimensioned with @code{lon},
+ at code{lat}, and @code{time}, and that there are ten @code{lon} values, five
+ at code{lat} values, and three @code{time} values.
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      PARAMETER (NDIMS=3)         ! number of dimensions
+      PARAMETER (TIMES=3, LATS=5, LONS=10) ! dimension sizes
+      INTEGER  NCID, RCODE
+      INTEGER  RHID               ! variable ID
+      INTEGER  START(NDIMS), COUNT(NDIMS),
+     +         STRIDE(NDIMS), IMAP(NDIMS)  ! generalized hyperslab
+      DOUBLE DATA(2, TIMES, LATS, LONS)    ! rh is second parameter
+      DATA START /1, 1, 1/        ! start at first value
+      DATA COUNT /LONS, LATS, TIMES/
+      DATA STRIDE /2, 2, 2/
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCWRITE, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)   ! get ID
+      DO 10 ILON = 1, LONGS, STRIDE(1)
+         DO 10 ILAT = 1, LATS, STRIDE(2)
+            DO 10 ITIME = 1, TIMES, STRIDE(3)
+               DATA(2, ITIME, ILAT, ILON) = 0.5
+   10 CONTINUE
+      IMAP(3) = 8*2*2   ! every other point of vector of 2-doubles
+      IMAP(2) = IMAP(3)*(1+(TIMES-1)/STRIDE(3))*2
+      IMAP(1) = IMAP(2)*(1+(LATS-1)/STRIDE(2))*2
+      CALL NCVPTG (NCID, RHID, START, COUNT, STRIDE, IMAP, 
+     +             DATA(2,1,1,1), RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncrecput, ncvarget1 and NCVGT1, ncvarputg NCVPTG and NCVPGC, Variables
+ at section Put a Record
+
+ at cindex record I/O
+ at cindex writing a record
+The function @code{ncrecput} writes a multi-variable record of values
+(or part of a record of values) into the record variables of an open
+netCDF file.  The record is specified by giving a record number.  The
+values to be written are specified by an array of pointers, one for each
+record variable, to blocks of values.  Each block of values should be of
+the appropriate size and type for a record's worth of data for the
+corresponding record variable.  Each such pointer must be either NULL,
+to indicate that no data is to be written for that variable, or must
+point to an entire record's worth of data of the appropriate type for
+the corresponding record variable.  The values for each record variable are assumed to be ordered with the
+last dimension varying fastest.  The netCDF file must be in data mode.
+
+The @code{ncrecput} function is not strictly necessary, since the same
+data may be written with a sequence of calls to @code{ncvarput}, one for
+each record variable for which a non-NULL pointer is specified.  This
+function is provided in the C interface for convenience only; no
+corresponding Fortran interface is available, so Fortran users should
+use multiple calls to @code{NCVPT} or @code{NCVPTC} instead.
+
+To use @code{ncrecput} properly, you must know the number, order, and
+types of record variables in the netCDF file, information that can be
+determined with a call to @code{ncrecinq}.  If your assumptions about
+the number, order, or types of record variables in the file is
+incorrect, calling this function may lead to incorrect results or even a
+segmentation violation.  @strong{Warning: neither the compiler nor the
+netCDF software can detect errors with the pointer array argument to
+ at code{ncrecput}.}
+
+In case of a detected error, @code{ncrecput} returns -1.  Possible
+causes of detectable errors include:
+ at itemize @bullet
+ at item
+The specified record number is less than zero.
+
+ at item
+The specified netCDF file is in define mode rather than data mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncrecput
+ at unnumberedsubsec ncrecput:  C Interface
+ at example
+int ncrecput(int ncid, long recnum, const void *datap[]);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or
+ at code{nccreate}.
+
+ at cindex appending data
+ at item recnum
+Record number, specifying the value of the unlimited dimension for which
+data is to be written.  The first record is record number @code{0}.
+Note that if you specify a value for @code{recnum} that is larger than
+the current size of the unlimited dimension, intervening records will be
+written with fill values before the data is written in the specified
+record, unless @code{ncsetfill} has been called to specify no
+prefilling.
+
+ at item datap
+Array of pointers to blocks of data values to be written, one for each
+record variable.  @code{datap[i]}, if non-NULL, must point to an entire
+record's worth of data for the @code{i}-th record variable.  For NULL
+pointers, no data will be written for the corresponding record
+variables.  This permits you to specify an arbitrary subset of record
+variables.  The data pointed to should be of the appropriate type for
+each record variable.  @strong{Warning: neither the compiler nor the
+netCDF software can detect whether the wrong type of data is used.}
+ at end table
+
+ at findex ncrecput
+Here is an example using @code{ncrecput} to write the value of a C
+struct into a netCDF file with a single call.  This example assumes that
+record variables of the appropriate shapes and types have previously
+been created in the netCDF file.
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{} 
+    static struct @{
+    char city[20];
+    long date;
+    float lat;
+    float lon;
+    float precip[24];           /* hourly precipitation */
+    @} rec = @{
+        "Pocatello", 
+        930228, 
+        42.92, 
+        -112.60, 
+        @{0,0,.1,.2,.2,.3,.2,0,0,0,0,0,0,0,0,0,.3,1.1,0,0,0,0,0,0@}
+    @};
+
+    int ncid;                   /* id of open netcdf file */
+    long recnum;                /* number of record to write */
+    void *datap[5];             /* array of address pointers for record
+vars */
+    @dots{}
+    datap[0] = &rec.city[0];
+    datap[1] = &rec.date;
+    datap[2] = &rec.lat;
+    datap[3] = &rec.lon;
+    datap[4] = &rec.precip[0];
+
+    ncrecput(ncid, recnum, datap);  /* instead of 5 calls to ncvarget */
+ at end group
+ at end example
+
+ at page
+ at node ncvarget1 and NCVGT1, ncvarget and NCVGT(C), ncrecput, Variables
+ at section Read a Single Data Value
+
+ at cindex getting variable data
+ at cindex reading data
+ at findex ncvarget1
+ at findex NCVGT1
+ at findex NCVG1C
+The function @code{ncvarget1} (or @code{NCVGT1} or @code{NCVG1C} for
+FORTRAN) gets a single data value from a variable of an open netCDF file
+that is in data mode.  Inputs are the netCDF ID, the variable ID, a
+multidimensional index that specifies which value to get, and the
+address of a location into which the data value will be read.
+
+In case of an error, @code{ncvarget1} returns -1; @code{NCVGT1} returns
+a nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified indices were out of range for the dimensionality of the
+specified variable.  For example, a negative index or an index that is
+larger than the corresponding dimension size will cause an error.
+
+ at item
+The specified netCDF is in define mode rather than data mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvarget1
+ at unnumberedsubsec ncvarget1:  C Interface
+ at example
+int ncvarget1(int ncid, int varid, const long mindex[], void *value);
+ at end example
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or
+ at code{nccreate}.
+
+ at item varid
+Variable ID, returned from a previous call to @code{ncvardef} or
+ at code{ncvarid}.
+
+ at item mindex
+The multidimensional index of the the data value to be read.  The
+indices are relative to 0, so for example, the first data value of a
+two-dimensional variable would have index @code{(0,0)}.  The elements of
+ at code{mindex} must correspond to the variable's dimensions.  Hence, if
+the variable is a record variable, the first index is the record number.
+
+ at item value
+Pointer to the location into which the data value is read.  The pointer
+is declared to be of the type @code{void *} because it can point to data
+of any of the basic netCDF types.  The data should be of the appropriate
+type for the netCDF variable.  @strong{Warning: neither the compiler nor
+the netCDF software can detect whether the wrong type for the data value
+is used.}
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncvarget1
+Here is an example using @code{ncvarget1} to get the @code{(1,2,3)}
+element of the variable named @code{rh} in an existing netCDF file named
+ at file{foo.nc}.  For simplicity in this example, we assume that we know
+that @code{rh} is dimensioned with @code{time}, @code{lat}, and
+ at code{lon}, so we want to get the value of @code{rh} that corresponds to
+the second @code{time} value, the third @code{lat} value, and the fourth
+ at code{lon} value:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{} 
+int ncid;                              /* netCDF ID */ 
+int rh_id;                             /* variable ID */ 
+static long rh_index[] = @{1, 2, 3@};  /* where to get value from */ 
+double rh_val;                         /* where to put it */
+   @dots{} 
+ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+ncvarget1(ncid, rh_id, rh_index, (void *) &rh_val);
+ at end group
+ at end example
+
+ at findex NCVGT1
+ at unnumberedsubsec NCVGT1:  FORTRAN Interface
+ at example
+      SUBROUTINE NCVGT1 (INTEGER NCID, INTEGER VARID,
+     + INTEGER MINDEX(*), @var{type} VALUE,
+     + INTEGER RCODE)
+
+      SUBROUTINE NCVG1C (INTEGER NCID, INTEGER VARID,
+     + INTEGER MINDEX(*), CHARACTER CHVAL,
+     + INTEGER RCODE)
+ at end example
+
+There are two FORTRAN subroutines, @code{NCVGT1} and @code{NCVG1C}, for
+reading a single value from a variable.  The first reads a numeric value
+in a variable of numeric type, and the second reads a character value in
+a variable of character type.
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or
+ at code{NCCRE}.
+
+ at item VARID
+Variable ID, returned from a previous call to @code{NCVDEF} or
+ at code{NCVID}.
+
+ at item MINDEX
+The multidimensional index of the the data value to be read.  The
+indices are relative to 1, so for example, the first data value of a
+two-dimensional variable has index @code{(1,1)}.  The elements of
+ at code{mindex} correspond to the variable's dimensions.  Hence, if the
+variable is a record variable, the last index is the record number.
+
+ at cindex data types
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item VALUE
+For @code{NCVGT1}, the location into which the data value will be read.
+The data may be of a type corresponding to any of the netCDF types
+ at code{NCSHORT}, @code{NCLONG}, @code{NCFLOAT}, or @code{NCDOUBLE}, but
+must be appropriate for the type of the netCDF variable.
+ at strong{Warning: neither the compiler nor the netCDF software can detect
+whether the wrong type of data is used.}
+
+ at cindex data types
+ at vindex NCCHAR
+ at vindex NCBYTE
+ at item CHVAL
+For @code{NCVG1C}, the location into which the data value will be read.
+This should be of a type character, corresponding to the netCDF types
+ at code{NCCHAR} or @code{NCBYTE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCVGT1
+Here is an example using @code{NCVGT1} to get the @code{(4,3,2)} element
+of the variable named @code{rh} in an existing netCDF file named
+ at file{foo.nc}.  For simplicity in this example, we assume that we know
+that @code{rh} is dimensioned with @code{lon}, @code{lat}, and
+ at code{time}, so we want to get the value of @code{rh} that corresponds
+to the fourth @code{lon} value, the third @code{lat} value, and the
+second @code{time} value:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER NCID, RCODE
+      INTEGER RHID ! variable ID
+      INTEGER RHINDX(3) ! where to get value
+      DOUBLE PRECISION RHVAL ! put it here
+      DATA RHINDX /4, 3, 2/
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)! get ID
+      CALL NCVGT1 (NCID, RHID, RHINDX, RHVAL, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncvarget and NCVGT(C), ncvargetg NCVGTG and NCVGGC, ncvarget1 and NCVGT1, Variables
+ at section Read a Hyperslab of Values
+
+ at cindex putting variable data
+ at cindex reading data
+ at cindex hyperslab access
+ at findex ncvarget
+ at findex NCVGT
+ at findex NCVGTC
+The function @code{ncvarget} (or @code{NCVGT} or @code{NCVGTC} for
+FORTRAN) reads a hyperslab of values from a netCDF variable of an open
+netCDF file.  The hyperslab is specified by giving a corner and a vector
+of edge lengths.  The values are read into consecutive locations with
+the last (or first for FORTRAN) dimension of the hyperslab varying
+fastest.  The netCDF file must be in data mode.
+
+In case of an error, @code{ncvarget} returns -1; @code{NCVGT} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified corner indices were out of range for the dimensionality of
+the specified variable.  For example, a negative index or an index that
+is larger than the corresponding dimension size will cause an error.
+
+ at item
+The specified edge lengths added to the specified corner would have
+referenced data out of range for the dimensionality of the specified
+variable.  For example, an edge length that is larger than the
+corresponding dimension size minus the corner index will cause an error.
+
+ at item
+The specified netCDF is in define mode rather than data mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvarget
+ at unnumberedsubsec ncvarget:  C Interface
+ at example
+int ncvarget(int ncid, int varid, const long start[], const long count[],
+             void *values);
+ at end example
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or
+ at code{nccreate}.
+
+ at item varid
+Variable ID, returned from a previous call to @code{ncvardef} or
+ at code{ncvarid}.
+
+ at item start
+A vector of long integers specifying the multidimensional index of the
+corner of the hyperslab where the first of the data values will be read
+from.  The indices are relative to 0, so for example, the first data
+value of a variable would have index @code{(0, 0, @dots{}, 0)}.  The
+size of @code{start} must be the same as the number of dimensions of the
+specified variable.  The elements of @code{start} must correspond to the
+variable's dimensions in order.  Hence, if the variable is a record
+variable, the first index would correspond to the starting record number
+for reading the data values.
+
+ at item count
+A vector of long integers specifying the multidimensional edge lengths
+from the corner of the hyperslab where the first of the data values will
+be read.  To read a single value, for example, specify @code{count} as
+ at code{(1, 1, @dots{}, 1)}.  The size of @code{count} is the number of
+dimensions of the specified variable.  The elements of @code{count}
+correspond to the variable's dimensions.  Hence, if the variable is a
+record variable, the first element of @code{count} corresponds to a
+count of the number of records to read.
+
+ at item value
+Pointer to the first of the locations into which the data values will be
+read.  The order in which the data will be read from the netCDF variable
+is with the last dimension of the specified hyperslab varying fastest.
+The pointer is declared to be of the type @code{void *} because it can
+point to data of any of the basic netCDF types.  The data should be of
+the appropriate type for the netCDF variable.  @strong{Warning: neither
+the compiler nor the netCDF software can detect whether the wrong type
+of data is used.}
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncvarget
+Here is an example using @code{ncvarget} to read all the values of the
+variable named @code{rh} from an existing netCDF file named
+ at file{foo.nc}.  For simplicity in this example, we assume that we know
+that @code{rh} is dimensioned with @code{time}, @code{lat}, and
+ at code{lon}, and that there are three @code{time} values, five @code{lat}
+values, and ten @code{lon} values.
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{} #define TIMES 3 #define LATS 5 #define LONS 10 int ncid; /*
+netCDF ID */ int rh_id; /* variable ID */ static long start[] = @{0, 0,
+0@}; /* start at first value */ static long count[] = @{TIMES, LATS,
+LONS@}; double rh_vals[TIMES*LATS*LONS]; /* array to hold values */
+   @dots{} ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{} rh_id = ncvarid (ncid, "rh");
+   @dots{} /* read hyperslab of values from netCDF variable */
+ncvarget(ncid, rh_id, start, count, (void *) rh_vals);
+ at end group
+ at end example
+
+ at findex NCVGT
+ at findex NCVGTC
+ at unnumberedsubsec NCVGT, NCVGTC:  FORTRAN Interface
+ at example
+ at group
+      SUBROUTINE NCVGT (INTEGER NCID, INTEGER VARID,
+     + INTEGER START(*), INTEGER COUNT(*),
+     + @var{type} VALUES, INTEGER RCODE)
+
+      SUBROUTINE NCVGTC(INTEGER NCID, INTEGER VARID,
+     + INTEGER START(*), INTEGER COUNTS(*),
+     + CHARACTER*(*) STRING, INTEGER LENSTR,
+     + INTEGER RCODE)
+ at end group
+ at end example
+
+There are two FORTRAN subroutines, @code{NCVGT} and @code{NCVGTC}, for
+reading a hyperslab of values from a netCDF variable.  The first reads
+numeric values from a variable of numeric type, and the second reads
+character values from a variable of character type.
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or
+ at code{NCCRE}.
+
+ at item VARID
+Variable ID, returned from a previous call to @code{NCVDEF} or
+ at code{NCVID}.
+
+ at item START
+A vector of integers specifying the multidimensional index of the corner
+of the hyperslab where the first of the data values will be read.  The
+indices are relative to 1, so for example, the first data value of a
+variable would have index @code{(1, 1, @dots{}, 1)}.  The size of
+ at code{START} must be the same as the number of dimensions of the
+specified variable.  The elements of @code{START} must correspond to the
+variable's dimensions in order.  Hence, if the variable is a record
+variable, the last index would correspond to the starting record number
+for reading the data values.
+
+ at item COUNT
+A vector of integers specifying the multidimensional edge lengths from
+the corner of the hyperslab where the first of the data values will be
+read.  To read a single value, for example, specify @code{COUNT} as
+ at code{(1, 1, @dots{}, 1)}.  The size of @code{COUNT} is the number of
+dimensions of the specified variable.  The elements of @code{COUNT}
+correspond to the variable's dimensions.  Hence, if the variable is a
+record variable, the last element of @code{COUNT} corresponds to a count
+of the number of records to read.
+
+ at cindex data types
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item VALUES
+For @code{NCVGT}, the locations into which the data values will be read.
+The order in which the data will be read from the netCDF variable is
+with the first dimension of the specified hyperslab varying fastest
+(like the ordinary FORTRAN convention).  The data may be of a type
+corresponding to any of the netCDF types @code{NCSHORT}, @code{NCLONG},
+ at code{NCFLOAT}, or @code{NCDOUBLE}, but must be appropriate for the type
+of the netCDF variable.  @strong{Warning: neither the compiler nor the
+netCDF software can detect whether the wrong type of data is used.}
+
+ at cindex data types
+ at vindex NCCHAR
+ at vindex NCBYTE
+ at item STRING
+For @code{NCVGTC}, the character string into which the character data
+will be read.  The order in which the characters will be read from the
+netCDF variable is with the first dimension of the specified hyperslab
+varying fastest (like the FORTRAN convention).  The data may be of a
+type corresponding to the netCDF types @code{NCCHAR} or @code{NCBYTE}.
+
+ at item LENSTR
+For @code{NCVGTC}, the total declared length (in characters) of the
+ at code{STRING} argument.  This should be at least as large as the product
+of the elements of the @code{COUNT} vector.  Note that this is not
+necessarily the same as the value returned by the FORTRAN @code{LEN}
+function, because an array argument may be provided.  @code{NCVGTC} will
+check to make sure the requested data will fit in @code{LENSTR}
+characters.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCVGT
+Here is an example using @code{NCVGT} to read all the values of the
+variable named @code{rh} from an existing netCDF file named
+ at file{foo.nc}.  For simplicity in this example, we assume that we know
+that @code{rh} is dimensioned with @code{lon}, @code{lat}, and
+ at code{time}, and that there are ten @code{lon} values, five @code{lat}
+values, and three @code{time} values.
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      PARAMETER (NDIMS=3) ! number of dimensions
+      PARAMETER (TIMES=3, LATS=5, LONS=10) ! dimension sizes
+      INTEGER NCID, RCODE
+      INTEGER RHID ! variable ID
+      INTEGER START(NDIMS), COUNT(NDIMS) ! hyperslab
+      DOUBLE RHVALS(LONS, LATS, TIMES)
+      DATA START /1, 1, 1/ ! start at first value
+      DATA COUNT /LONS, LATS, TIMES/
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)! get ID
+      CALL NCVGT (NCID, RHID, START, COUNT, RHVALS, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncvargetg NCVGTG and NCVGGC, ncrecget, ncvarget and NCVGT(C), Variables
+ at section Read a Generalized Hyperslab of Values
+
+ at cindex putting variable data
+ at cindex reading data
+ at cindex generalized hyperslab access
+ at findex ncvargetg
+ at findex NCVGTG
+ at findex NCVGGC
+The function @code{ncvargetg} (or @code{NCVGTG} or @code{NCVGGC} for
+FORTRAN) reads a generalized hyperslab of values from a netCDF variable
+of an open netCDF file.  The generalized hyperslab is specified by
+giving a corner, a vector of edge lengths, a stride vector, and an index
+mapping vector.  The values are read with the last (or first for
+FORTRAN) dimension of the generalized hyperslab varying fastest.  The
+netCDF file must be in data mode.
+
+In case of an error, @code{ncvargetg} returns -1; @code{NCVGTG} and
+ at code{NCVGGC} return a nonzero value in @code{rcode}.  Possible causes
+of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified corner indices were out of range for the dimensionality of
+the specified variable.  For example, a negative index or an index that
+is larger than the corresponding dimension size will cause an error.
+
+ at item
+The specified edge lengths and strides added to the specified corner
+would have referenced data out of range for the dimensionality of the
+specified variable.  For example, an edge length that is larger than the
+corresponding dimension size minus the corner index will cause an error,
+as will accessing two or more points using a stride that is greater than
+the size of the netCDF variable in the corresponding dimension.
+
+ at item
+A non-positive stride.
+
+ at item
+The specified netCDF is in define mode rather than data mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvargetg
+ at unnumberedsubsec ncvargetg:  C Interface
+ at example
+int ncvargetg(int ncid, int varid, const long start[], const long count[],
+              const long stride[], const long imap[], void *values);
+ at end example
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or
+ at code{nccreate}.
+
+ at item varid
+Variable ID, returned from a previous call to @code{ncvardef} or
+ at code{ncvarid}.
+
+ at item start
+A vector of long integers specifying the multidimensional index of the
+corner of the hyperslab where the first of the data values will be read
+from.  The indices are relative to 0, so for example, the first data
+value of a variable would have index @code{(0, 0, @dots{}, 0)}.  The
+size of @code{start} must be the same as the number of dimensions of the
+specified variable.  The elements of @code{start} must correspond to the
+variable's dimensions in order.  Hence, if the variable is a record
+variable, the first index would correspond to the starting record number
+for reading the data values.
+
+ at item count
+A vector of long integers specifying the multidimensional edge lengths
+from the corner of the hyperslab where the first of the data values will
+be read.  To read a single value, for example, specify @code{count} as
+ at code{(1, 1, @dots{}, 1)}.  The size of @code{count} is the number of
+dimensions of the specified variable.  The elements of @code{count}
+correspond to the variable's dimensions.  Hence, if the variable is a
+record variable, the first element of @code{count} corresponds to a
+count of the number of records to read.
+
+ at item stride
+A vector of long integers specifying, for each dimension, the interval
+between the accessed values of a netCDF variable.  The size of the
+vector shall be at least the number of dimensions of the associated
+netCDF variable and its elements shall correspond, in order, to the
+variable's dimensions.  A value of 1 accesses adjacent values of the
+netCDF variable in the corresponding dimension; a value of 2 accesses
+every other value of the netCDF variable in the corresponding dimension;
+and so on.  A @code{NULL} stride argument obtains the default behavior
+in which adjacent values are accessed along each dimension.
+
+ at item imap
+A vector of long integers specifying, for each dimension, how data
+values associated with a netCDF variable are arranged in memory.  The
+offset, in bytes, from the memory location pointed to by the
+ at code{value} argument to a particular datum is given by the inner
+product of the index mapping vector with the coordinates of the datum.
+(The @dfn{inner product} of two vectors [x0, x1, @dots{}, xn] and [y0,
+y1, @dots{}, yn] is just x0*y0 + x1*y1 + @dots{} + xn*yn.)  The vector
+may contain negative values if the @code{value} argument is
+appropriately specified.  A @code{NULL} argument obtains the default
+behavior in which the memory-resident values are assumed to have the
+same structure as the associated netCDF variable.
+
+ at item value
+Pointer to the first of the locations into which the data values will be
+read.  The order in which the data will be read from the netCDF variable
+is with the last dimension of the generalized hyperslab varying fastest.
+The pointer is declared to be of the type @code{void *} because it can
+point to data of any of the basic netCDF types.  The data should be of
+the appropriate type for the netCDF variable.  @strong{Warning: neither
+the compiler nor the netCDF software can detect whether the wrong type
+of data is used.}
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncvargetg
+Here is an example using @code{ncvargetg} to read every other value in
+each dimension of the variable named @code{rh} from an existing netCDF
+file named @file{foo.nc}.  Values are assigned, using the same
+dimensional strides, to points in a 3-dimensional array of structures
+whose dimensions are the reverse of the netCDF variable.  For simplicity
+in this example, we assume that we know that @code{rh} is dimensioned
+with @code{time}, @code{lat}, and @code{lon}, and that there are three
+ at code{time} values, five @code{lat} values, and ten @code{lon} values.
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+#define TIMES 3
+#define LATS  5
+#define LONS 10
+int ncid;                           /* netCDF ID */
+int rh_id;                          /* variable ID */
+static long start[] = @{0, 0, 0@};  /* start at first value */
+static long count[] = @{TIMES, LATS, LONS@};
+static long stride[] = @{2, 2, 2@}; /* every other value */
+long imap[3];                       /* set to reverse of variable */
+struct datum @{
+    int dummy;                      /* to illustrate mapping vector usage */
+    double rh_val;                  /* actual value to be read */
+@}      data[TIMES][LATS][LONS];    /* array to hold values */
+   @dots{}
+   ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{}
+   rh_id = ncvarid (ncid, "rh");
+   @dots{}
+   /* access every `stride' in-memory value using reversed dimensions */
+   imap[0] = stride[2]*sizeof(struct datum);
+   imap[1] = stride[1]*(1+(LONS-1)/stride[0])*imap[0];
+   imap[2] = stride[0]*(1+(LATS-1)/stride[1])*imap[1];
+   /* read generalized hyperslab of values from netCDF variable */
+   ncvargetg(ncid, rh_id, start, count, stride, imap, (void*)&data[0][0][0].rh_val);
+   @dots{}
+ at end group
+ at end example
+
+ at findex NCVGTG
+ at findex NCVGGC
+ at unnumberedsubsec NCVGTG, NCVGGC:  FORTRAN Interface
+ at example
+ at group
+      SUBROUTINE NCVGTG (INTEGER NCID, INTEGER VARID,
+     + INTEGER START(*), INTEGER COUNT(*),
+     + INTEGER STRIDE(*), INTEGER IMAP(*),
+     + @var{type} VALUES, INTEGER RCODE)
+
+      SUBROUTINE NCVGGC (INTEGER NCID, INTEGER VARID,
+     + INTEGER START(*), INTEGER COUNT(*),
+     + INTEGER STRIDE(*), INTEGER IMAP(*),
+     + CHARACTER*(*) STRING, INTEGER RCODE)
+ at end group
+ at end example
+
+There are two FORTRAN subroutines, @code{NCVGTG} and @code{NCVGGC}, for
+reading a generalized hyperslab of values from a netCDF variable.  The
+first reads numeric values from a variable of numeric type, and the
+second reads character values from a variable of character type.
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or
+ at code{NCCRE}.
+
+ at item VARID
+Variable ID, returned from a previous call to @code{NCVDEF} or
+ at code{NCVID}.
+
+ at item START
+A vector of integers specifying the multidimensional index of the corner
+of the hyperslab where the first of the data values will be read.  The
+indices are relative to 1, so for example, the first data value of a
+variable would have index @code{(1, 1, @dots{}, 1)}.  The size of
+ at code{START} must be the same as the number of dimensions of the
+specified variable.  The elements of @code{START} must correspond to the
+variable's dimensions in order.  Hence, if the variable is a record
+variable, the last index would correspond to the starting record number
+for reading the data values.
+
+ at item COUNT
+A vector of integers specifying the multidimensional edge lengths from
+the corner of the hyperslab where the first of the data values will be
+read.  To read a single value, for example, specify @code{COUNT} as
+ at code{(1, 1, @dots{}, 1)}.  The size of @code{COUNT} is the number of
+dimensions of the specified variable.  The elements of @code{COUNT}
+correspond to the variable's dimensions.  Hence, if the variable is a
+record variable, the last element of @code{COUNT} corresponds to a count
+of the number of records to read.
+
+ at item STRIDE
+A vector of integers specifying, for each dimension, the interval
+between the accessed values of a netCDF variable or the value @code{0}.
+The size of the vector shall be at least the number of dimensions of the
+associated netCDF variable and its elements shall correspond, in order,
+to the variable's dimensions.  A value of 1 accesses adjacent values of
+the netCDF variable in the corresponding dimension; a value of 2
+accesses every other value of the netCDF variable in the corresponding
+dimension; and so on.  An @code{0} argument obtains the default behavior
+in which adjacent values are accessed along each dimension.
+
+ at item IMAP
+A vector of long integers specifying, for each dimension, how data
+values associated with a netCDF variable are arranged in memory or the
+value @code{0}.  The offset, in bytes, from the memory location pointed
+to by the @code{value} argument to a particular datum is given by the
+inner product of the index mapping vector with the (origin-0)
+coordinates of the datum.  (The @dfn{inner product} of two vectors [x1,
+x2, @dots{}, xn] and [y1, y2, @dots{}, yn] is just x1*y1 + x2*y2 +
+ at dots{} + xn*yn.)  The vector may contain negative values if the
+ at code{value} argument is appropriately specified.  A @code{0} argument
+obtains the default behavior in which the memory-resident values are
+assumed to have the same structure as the associated netCDF variable.
+
+ at cindex data types
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item VALUES
+For @code{NCVGTG}, the locations into which the data values will be
+read.  The order in which the data will be read from the netCDF variable
+is with the first dimension of the generalized hyperslab varying fastest
+(like the ordinary FORTRAN convention).  The data may be of a type
+corresponding to any of the netCDF types @code{NCSHORT}, @code{NCLONG},
+ at code{NCFLOAT}, or @code{NCDOUBLE}, but must be appropriate for the type
+of the netCDF variable.  @strong{Warning: neither the compiler nor the
+netCDF software can detect whether the wrong type of data is used.}
+
+ at cindex data types
+ at vindex NCCHAR
+ at vindex NCBYTE
+ at item STRING
+For @code{NCVGGC}, the character string into which the character data
+will be read.  The order in which the characters will be read from the
+netCDF variable is with the first dimension of the generalized hyperslab
+varying fastest (like the FORTRAN convention).  The data may be of a
+type corresponding to the netCDF types @code{NCCHAR} or @code{NCBYTE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCVGTG
+Here is an example using @code{NCVGTG} to read every other value in each
+dimension of the variable named @code{rh} from an existing netCDF file
+named @file{foo.nc}.  Values are assigned, using the same dimensional
+strides, to a 2-parameter array whose dimensions are the reverse of the
+netCDF variable.  For simplicity in this example, we assume that we know
+that @code{rh} is dimensioned with @code{lon}, @code{lat}, and
+ at code{time}, and that there are ten @code{lon} values, five @code{lat}
+values, and three @code{time} values.
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      PARAMETER (NDIMS=3) ! number of dimensions
+      PARAMETER (TIMES=3, LATS=5, LONS=10) ! dimension sizes
+      INTEGER NCID, RCODE
+      INTEGER RHID ! variable ID
+      INTEGER START(NDIMS), COUNT(NDIMS)
+     + STRIDE(NDIMS), IMAP(NDIMS) ! generalized hyperslab
+      DOUBLE DATA(2, TIMES, LATS, LONS) ! rh is second parameter
+      DATA START /1, 1, 1/ ! start at first value
+      DATA COUNT /LONS, LATS, TIMES/
+      DATA STRIDE /2, 2, 2/
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)! get ID
+      IMAP(3) = 8*2*2 ! every other point of vector of 2-doubles
+      IMAP(2) = IMAP(3)*(1+(TIMES-1)/STRIDE(3))*2
+      IMAP(1) = IMAP(2)*(1+(LATS-1)/STRIDE(2))*2
+      CALL NCVGTG (NCID, RHID, START, COUNT, STRIDE, IMAP,
+     + DATA(2,1,1,1), RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncrecget, Character String I/O, ncvargetg NCVGTG and NCVGGC, Variables
+ at section Get a Record
+
+ at cindex record I/O
+ at cindex reading a record
+The function @code{ncrecget} reads a multi-variable record of values (or
+part of a record of values) from the record variables of an open netCDF
+file.  The record is specified by giving a record number.  The locations
+into which the data will be read are specified by an array of pointers,
+one for each record variable, to blocks of data.  Each block of data
+should be of the appropriate size and type for a record's worth of data
+for the corresponding record variable.  Each such pointer must be either
+NULL, to indicate that no data is to be written for that variable, or
+must point to space for an entire record's worth of data of the
+appropriate type for the corresponding record variable.  The values for
+each record variable will be ordered with the last dimension varying
+fastest.  The netCDF file must be in data mode.
+
+The @code{ncrecget} function is not strictly necessary, since the same
+data may be read with a sequence of calls to @code{ncvarget}, one for
+each record variable for which a non-NULL pointer is specified.  This
+function is provided in the C interface for convenience only; no
+corresponding Fortran interface is available, so Fortran users should
+use multiple calls to @code{NCVGT} or @code{NCVGTC} instead.
+
+To use @code{ncrecget} properly, you must know the number, order, and
+types of record variables in the netCDF file, information that can be
+determined with a call to @code{ncrecinq}.  If your assumptions about
+the number, order, or types of record variables in the file is
+incorrect, calling this function may lead to incorrect results or even a
+segmentation violation.  @strong{Warning: neither the compiler nor the
+netCDF software can detect errors with the pointer array argument to
+ at code{ncrecget}.}
+
+In case of a detected error, @code{ncrecget} returns -1.  Possible
+causes of detectable errors include:
+ at itemize @bullet
+ at item
+The specified record number is less than zero.
+
+ at item
+The specified netCDF file is in define mode rather than data mode.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncrecget
+ at unnumberedsubsec ncrecget:  C Interface
+ at example
+int ncrecget(int ncid, long recnum, void *datap[]);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or
+ at code{nccreate}.
+
+ at item recnum
+Record number, specifying the value of the unlimited dimension for which
+data is to be read.  The first record is record number @code{0}.
+
+ at item datap
+Array of pointers to blocks of data into which the requested values will
+be read, one for each record variable.  @code{datap[i]}, if non-NULL,
+must point to enough space to hold an entire record's worth of data for
+the @code{i}-th record variable.  For NULL pointers, no data will be
+read for the corresponding record variables.  This permits you to
+specify an arbitrary subset of record variables.  The data pointed to
+should be of the appropriate type for each record variable.
+ at strong{Warning: neither the compiler nor the netCDF software can detect
+whether the wrong type of data is used.}
+ at end table
+
+ at findex ncrecget
+Here is an example using @code{ncrecget} to read values into several C
+arrays and scalars with a single call.  This example assumes that record
+variables of the appropriate shapes and types have previously been
+created in the netCDF file.
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{} 
+    static struct @{
+    char city[20];
+    long date;
+    float lat;
+    float lon;
+    float precip[24];
+    @} rec[10];
+
+    int ncid;           /* id of open netcdf file */
+    long i;             /* number of record to read */
+    void *datap[5];     /* array of address pointers for record vars */
+    @dots{}
+
+    /* Get first 10 records of data */
+    for(i=0; i<10; i++) @{
+        datap[0] = &rec[i].city[0];
+        datap[1] = &rec[i].date;
+        datap[2] = &rec[i].lat;
+        datap[3] = &rec[i].lon;
+        datap[4] = &rec[i].precip[0];
+        ncrecget(ncid, i, datap);  /* instead of 5 calls to ncvarget */
+    @}
+ at end group
+ at end example
+
+ at page
+ at node Character String I/O, Missing Values, ncrecget, Variables
+ at section Reading and Writing Character String Values
+
+ at cindex putting character string data
+ at cindex writing character string data
+ at cindex getting character string data
+ at cindex reading character string data
+ at cindex character string data
+ at cindex character strings
+ at cindex writing data
+ at cindex hyperslab access
+ at cindex fixed-length character strings
+ at cindex variable-length strings
+ at findex ncvarput
+ at findex NCVPT
+ at findex NCVPTC
+ at findex NCVPGC
+ at cindex reading data
+ at findex ncvarget
+ at findex NCVGT
+ at findex NCVGTC
+ at findex NCVGGC
+
+Character strings are not a primitive netCDF data type, in part because
+FORTRAN does not support the abstraction of variable-length character
+strings (the FORTRAN @code{LEN} function returns the static length of a
+character string, not its dynamic length).  As a result, a character
+string cannot be written or read as a single object in the netCDF
+interface.  Instead, a character string must be treated as an array of
+characters, and hyperslab access must be used to read and write
+character strings as variable data in netCDF files.  Furthermore,
+variable-length strings are not supported by the netCDF interface except
+by convention; for example, you may treat a null (zero) byte as
+terminating a character string, but you must explicitly specify the
+length of strings to be read from and written to netCDF variables.
+
+ at cindex character-string attributes
+ at cindex attribute length
+Character strings as attribute values are easier to use, since the
+strings are treated as a single unit for access; no hyperslab access is
+necessary (or possible) for attributes.  However, the value of a
+character-string attribute is still an array of characters with an
+explicit length that must be specified when the attribute is defined.
+
+ at cindex character-position dimension
+ at cindex netCDF disk representation
+ at cindex netCDF file size
+ at cindex variable shape
+When you define a variable that will have character-string values, use a
+ at var{character-position dimension} as the most quickly varying dimension
+for the variable (the last dimension for the variable in C, the first in
+FORTRAN).  The size of the character-position dimension will be the
+maximum string length of any value to be stored in the character-string
+variable.  Space for maximum-size strings will be allocated in the disk
+representation of character-string variables whether you use the space
+or not.  If two or more variables have the same maximum length, the same
+character-position dimension may be used in defining the variable shapes.
+
+ at cindex hyperslab access
+ at cindex hyperslab corner
+ at cindex hyperslab edge lengths
+To write a character-string value into a character-string variable, use
+hyperslab access.  This requires that you specify both a corner and a
+vector of edge lengths.  The character-position dimension at the corner
+should be zero (one for FORTRAN).  If the length of the string to be
+written is @code{n}, then the vector of edge lengths will specify
+ at code{n} in the character-position dimension, and one for all the other
+dimensions, i.e., @code{(1, 1, @dots{}, 1, n)} or @code{(n, 1, 1, @dots{},
+1)} in FORTRAN.
+
+ at unnumberedsubsec C Interface
+
+ at cindex fixed-size strings
+ at cindex null byte
+ at cindex netCDF file size
+ at cindex variable-length strings
+In C, fixed-size strings may be written to a netCDF file without the
+terminating null byte, to save space.  Variable-length strings should be
+written @emph{with} a terminating null byte so that the intended length
+of the string can be determined when it is later read.
+
+ at findex ncvarput
+ at findex ncopen
+ at findex ncredef
+ at findex ncdimdef
+ at findex ncvardef
+ at findex ncendef
+ at vindex NC_CHAR
+Here is an example that defines a record variable, @code{tx}, for
+character strings and stores a character-string value into the third
+record using @code{ncvarput}.  In this example, we assume the string
+variable and data are to be added to an existing netCDF file named
+ at file{foo.nc} that already has an unlimited record dimension @code{time}.
+
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;            /* netCDF ID */
+int  chid;            /* dimension ID for char positions */
+int  timeid;          /* dimension ID for record dimension */
+int  tx_id;           /* variable ID */
+#define TDIMS 2       /* dimensionality of tx variable */
+int tx_dims[TDIMS];   /* variable shape */
+long tx_start[TDIMS];
+long tx_count[TDIMS];
+static char tx_val[] =
+        "example string"; /* string to be put */
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);
+ncredef(ncid);       /* enter define mode */
+   @dots{}
+/* define character-position dimension for strings of max length 40 */
+chid = ncdimdef(ncid, "chid", 40L);
+   @dots{}
+/* define a character-string variable */
+tx_dims[0] = timeid;
+tx_dims[1] = chid;    /* character-position dimension last */
+tx_id = ncvardef (ncid, "tx", NC_CHAR, TDIMS, tx_dims);
+   @dots{}
+ncendef(ncid);       /* leave define mode */
+   @dots{}
+/* write tx_val into tx netCDF variable in record 3 */
+tx_start[0] = 3;      /* record number to write */
+tx_start[1] = 0;      /* start at beginning of variable */
+tx_count[0] = 1;      /* only write one record */
+tx_count[1] = strlen(tx_val) + 1;  /* number of chars to write */
+ncvarput(ncid, tx_id, tx_start, tx_count, (void *) tx_val);
+ at end group
+ at end example
+
+
+ at unnumberedsubsec FORTRAN Interface
+
+ at cindex fixed-size strings
+ at cindex null byte
+ at cindex netCDF file size
+ at cindex variable-length strings
+In FORTRAN, fixed-size strings may be written to a netCDF file without a
+terminating character, to save space.  Variable-length strings
+should follow the C convention of writing strings with a terminating
+null byte so that the intended length of the string can be determined
+when it is later read by either C or FORTRAN programs.
+
+ at cindex character-string values
+ at cindex numeric values
+ at cindex string length, actual
+ at cindex string length, declared
+ at cindex character-position dimension
+ at findex NCVPTC
+ at findex NCVPGC
+ at findex NCVGTC
+ at findex NCVGGC
+The FORTRAN interface for reading and writing strings requires the use
+of different subroutines for accessing string values and numeric values,
+because standard FORTRAN does not permit the same formal parameter to be
+used for both character values and numeric values.  An additional
+argument, specifying the declared length of the character string passed
+as a value, is required for @code{NCVPTC} and @code{NCVGTC}.  The actual
+length of the string is specified as the value of the hyperslab
+edge-length vector corresponding to the character-position dimension.
+
+ at findex NCOPN
+ at findex NCREDF
+ at findex NCDDEF
+ at findex NCENDF
+ at findex NCVPTC
+ at findex NCVDEF
+ at vindex NCCHAR
+Here is an example that defines a record variable, @code{tx}, for
+character strings and stores a character-string value into the third
+record using @code{NCVPTC}.  In this example, we assume the string
+variable and data are to be added to an existing netCDF file named
+ at file{foo.nc} that already has an unlimited record dimension
+ at code{time}.
+
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      PARAMETER (TDIMS=2)    ! number of TX dimensions
+      PARAMETER (TXLEN = 15) ! length of example string
+      INTEGER  NCID, RCODE
+      INTEGER  CHID          ! char position dimension id
+      INTEGER  TIMEID        ! record dimension id
+      INTEGER  TXID          ! variable ID
+      INTEGER  TXDIMS(TDIMS) ! variable shape
+      INTEGER  TSTART(TDIMS), TCOUNT(TDIMS) ! hyperslab
+      CHARACTER*40 TXVAL     ! max length 40
+      DATA TXVAL /'example string'/
+         @dots{}
+      TXVAL(TXLEN:TXLEN) = CHAR(0)   ! null terminate
+         @dots{}
+      NCID = NCOPN('foo.nc', NCWRITE, RCODE)
+      CALL NCREDF(NCID, RCODE) ! enter define mode
+         @dots{}
+* define character-position dimension for strings of max length 40
+      CHID = NCDDEF(NCID, "chid", 40, RCODE)
+         @dots{}
+* define a character-string variable
+      TXDIMS[1] = CHID   ! character-position dimension first
+      TXDIMS[2] = TIMEID
+      TXID = NCVDEF(NCID, "tx", NCCHAR, TDIMS, TXDIMS, RCODE)
+         @dots{}
+      CALL NCENDF(NCID, RCODE) ! leave define mode
+         @dots{}
+* write txval into tx netCDF variable in record 3
+      TSTART[1] = 0      ! start at beginning of variable
+      TSTART[2] = 3      ! record number to write
+      TCOUNT[1] = TXLEN  ! number of chars to write
+      TCOUNT[2] = 1      ! only write one record
+      CALL NCVPTC (NCID, TXID, TSTART, TCOUNT, TXVAL, 40, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node Missing Values, ncvarrename and NCVREN, Character String I/O, Variables
+ at section Missing Values
+
+ at cindex missing values
+ at cindex fill values
+What happens when you try to read a value that was never written in an
+open netCDF file?  You might expect that this should always be an error,
+and that you should get an error message or an error status returned.
+You @emph{do} get an error if you try to read data from a netCDF file
+that is not open for reading, if the variable ID is invalid for the
+specified netCDF file, or if the specified hyperslab is not properly
+within the range defined by the dimension sizes of the specified
+variable.  Otherwise, reading a value that was not written returns a
+special @dfn{fill value} used to fill in any missing values when a
+netCDF variable is first written.
+
+You may also ignore fill values and use the entire range of a netCDF
+data type, but in this case you should make sure you write all data
+values before reading them.  If you know you will be writing all
+the data before reading it, you can specify that no prefilling of
+variables with fill values will occur by calling @code{ncsetfill}
+before writing.  This may provide a significant performance gain for
+netCDF writes.
+
+There are several reasons for using a fill value instead of an error
+return for missing data.  First, the interface for hyperslab access
+would necessarily be more complex and slower if information had to be
+returned about whether each value read had been written.  Since data may
+have been written in a different order from that in which it is later
+read, it is possibile that only a few values in a block of retrieved
+values were never written.  Second, it is usually preferable to delay
+the detection of missing values until there is a need for the values,
+since they may not be used in subsequent computations.  Finally, the use
+of missing values is a common way to represent data points outside the
+boundaries of irregular regions of data enclosed by a hyperslab,
+making it possible to handle such data in a simpler way than would be
+possible with a more compact representation that represented the
+boundary explicitly.
+
+ at cindex default fill values
+The default fill values for each type are defined in the include file
+ at file{netcdf.h} (or @file{netcdf.inc} for FORTRAN).  It is usually
+better to use your own fill value instead, by defining the attribute
+ at code{_FillValue} for a variable before writing it.  A disadvantage of
+the default fill values for floating-point and double-precision types is
+that they may be defined differently for different platforms, and may be
+difficult to compare with other values, since they are defined to be
+right at the edge of the valid floating-point number ranges for each
+machine.
+
+Fill values are used for filling in missing data whenever a value is put
+beyond the end of data that has already been written.  A default fill
+value has no other special meaning, so it can be used for valid values
+if you use your own fill value instead.
+
+ at cindex byte vs. character
+ at cindex character vs. byte
+Currently the only difference between the netCDF byte and character
+types is that the two types have different default fill values.  The
+fill value for bytes is on the edge of the range, representing the
+largest negative value for signed bytes.  The fill value for characters,
+however, is the zero byte, a more useful value for detecting the end of
+C character strings.
+
+ at cindex _FillValue attribute
+ at cindex missing_value attribute
+Sometimes there is need for more than one value to represent different
+kinds of missing data.  In this case, the user should use one or more
+other variable attributes for the different kinds of missing data.  For
+example, it might be appropriate to use @code{_FillValue} to mean that
+data that was expected never appeared, but @code{missing_value} where
+the creator of the data intends data to be missing, as around an
+irregular region represented by a rectangular grid.
+
+ at page
+ at node ncvarrename and NCVREN, nctypelen and NCTLEN, Missing Values, Variables
+ at section Rename a Variable
+
+ at cindex renaming variables
+ at cindex variable name
+ at findex ncvarrename
+ at findex NCVREN
+The function @code{ncvarrename} (or @code{NCVREN} for FORTRAN) changes
+the name of a netCDF variable in an open netCDF.  If the new name is
+longer than the old name, the netCDF must be in define mode.  You cannot
+rename a variable to have the name of any existing variable.
+
+In case of an error, @code{ncvarrename} returns -1; @code{NCVREN} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The new name is in use as the name of another variable.
+
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncvarrename
+ at unnumberedsubsec ncvarrename:  C Interface
+ at example
+int ncvarrename(int ncid, int varid, const char* name);
+ at end example
+
+ at cindex variable name
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item varid
+Variable ID, returned from a previous call to @code{ncvardef} or
+ at code{ncvarid}.
+
+ at item name
+New name for the specified variable.
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncredef
+ at findex ncendef
+ at findex ncvarrename
+Here is an example using @code{ncvarrename} to rename the variable
+ at code{rh} to @code{rel_hum} in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;                         /* netCDF ID */
+int  rh_id;                        /* variable ID */
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);
+   @dots{}
+ncredef(ncid);  /* put in define mode to rename variable */
+rh_id = ncvarid (ncid, "rh");
+ncvarrename (ncid, rh_id, "rel_hum");
+ncendef(ncid);  /* leave define mode */
+ at end group
+ at end example
+
+ at findex NCVREN
+ at unnumberedsubsec NCVREN:  FORTRAN Interface
+ at example
+      SUBROUTINE NCVREN (INTEGER NCID, INTEGER VARID,
+     +                   CHARACTER*(*) NEWNAM, INTEGER RCODE)
+ at end example
+
+ at cindex variable name
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item VARID
+Variable ID, returned from a previous call to @code{NCVDEF} or
+ at code{NCVID}.
+
+ at item NEWNAM
+New name for the specified variable.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCVREN
+ at findex NCREDF
+ at findex NCENDF
+Here is an example using @code{NCVREN} to rename the variable @code{rh}
+to @code{rel_hum} in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID, RCODE
+      INTEGER  RHID               ! variable ID
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCWRITE, RCODE)
+         @dots{}
+      CALL NCREDF (CDFFID, RCODE)  ! enter definition mode
+      RHID = NCVID (NCID, 'rh', RCODE)  ! get ID
+      CALL NCVREN (NCID, RHID, 'rel_hum', RCODE)
+      CALL NCENDF (CDFFID, RCODE)  ! leave definition mode
+ at end group
+ at end example
+
+ at page
+ at node nctypelen and NCTLEN, ncrecinq, ncvarrename and NCVREN, Variables
+ at section Get Number of Bytes for a Data Type
+
+ at cindex netCDF data types
+ at cindex data sizes
+ at cindex type lengths
+ at findex nctypelen
+ at findex NCTLEN
+The function @code{nctypelen} (or @code{NCTLEN} for FORTRAN) returns
+the number of bytes per netCDF data type.
+
+In case of an error, @code{nctypelen} returns -1; @code{NCTLEN} returns a
+nonzero value in @code{rcode}.  One possible cause of errors is:
+ at itemize @bullet
+ at item
+The specified data type is not a valid netCDF data type.
+ at end itemize
+ at findex nctypelen
+ at unnumberedsubsec nctypelen:  C Interface
+ at example
+int nctypelen (nc_type datatype);
+ at end example
+ at cindex attribute names
+ at vindex nc_type
+ at vindex NC_BYTE
+ at vindex NC_CHAR
+ at vindex NC_SHORT
+ at vindex NC_LONG
+ at vindex NC_FLOAT
+ at vindex NC_DOUBLE
+ at table @code
+ at item datatype
+One of the set of predefined netCDF data types.  The type of this
+parameter, @code{nc_type}, is defined in the netCDF header file.  The
+valid netCDF data types are @code{NC_BYTE}, @code{NC_CHAR},
+ at code{NC_SHORT}, @code{NC_LONG}, @code{NC_FLOAT}, and @code{NC_DOUBLE}.
+ at end table
+ at findex ncopen
+ at findex ncvarid
+ at findex ncvarinq
+ at findex nctypelen
+ at vindex nc_type
+ at vindex MAX_VAR_DIMS
+Here is an example using @code{nctypelen} to determine how many bytes
+are required to store a single value of the variable @code{rh} in an
+existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;        /* netCDF ID */
+int  rh_id;       /* variable ID */
+nc_type rh_type;           /* variable type */
+int rh_ndims;              /* number of dims */
+int rh_dims[MAX_VAR_DIMS]; /* variable shape */
+int rh_natts;              /* number of attributes */
+int rhbytes;      /* number of bytes per value for "rh" */
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+/* get type.  we don't need name, since we already know it */
+ncvarinq (ncid, rh_id, (char *) 0, &rh_type, &rh_ndims, rh_dims,
+          &rh_natts);
+rhbytes = nctypelen (rh_type);
+ at end group
+ at end example
+
+ at findex NCTLEN
+ at unnumberedsubsec NCTLEN:  FORTRAN Interface
+ at example
+      INTEGER FUNCTION NCTLEN (INTEGER TYPE ,INTEGER RCODE)
+ at end example
+
+ at table @code
+
+ at cindex data types
+ at vindex NCBYTE
+ at vindex NCCHAR
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item TYPE
+One of the set of predefined netCDF data types.  The valid netCDF data
+types are @code{NCBYTE}, @code{NCCHAR}, @code{NCSHORT}, @code{NCLONG},
+ at code{NCFLOAT}, and @code{NCDOUBLE}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCVINQ
+ at findex NCTLEN
+ at vindex MAXVDIMS
+Here is an example using @code{NCTLEN} to determine how many bytes are
+required to store a single value of the variable @code{rh} in an existing
+netCDF file named @file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID              ! netCDF ID
+      INTEGER  RHID               ! variable ID
+      CHARACTER*31 RHNAME         ! variable name
+      INTEGER  RHTYPE             ! variable type
+      INTEGER  RHN                ! number of dimensions
+      INTEGER  RHDIMS(MAXVDIMS)   ! variable shape
+      INTEGER  RHNATT             ! number of attributes
+      INTEGER  RHBYTS             ! bytes per value
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)
+* get type of "rh"
+      CALL NCVINQ (NCID, RHID, RHNAME, RHTYPE, RHN, RHDIMS, RHNATT,
+     +             RCODE)
+      RHBYTS = NCTLEN (RHTYPE)
+ at end group
+ at end example
+
+ at page
+ at node ncrecinq,  , nctypelen and NCTLEN, Variables
+ at section Get Information About Record Variables
+
+ at cindex record I/O
+ at cindex inquiring about records
+The function @code{ncrecinq} returns information about the record
+variables (variables that use the unlimited dimension) in a netCDF file.
+The information returned is the number of record variables, their
+variable IDs, and the size (in bytes) for a record's worth of data for
+each record variable.
+
+The @code{ncrecinq} function is not strictly necessary, since the
+information it returns can be computed from information returned by
+ at code{ncinquire}, @code{ncdiminq}, and @code{ncvarinq} functions or
+their FORTRAN counterparts.  This function is provided in the C
+interface for convenience only, to assist in using the C functions
+ at code{ncrecput} and @code{ncrecget}.
+
+In case of an error, @code{ncrecinq} returns -1.  Possible causes of
+errors include:
+ at itemize @bullet
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncrecinq
+ at unnumberedsubsec ncrecinq:  C Interface
+ at example
+int ncrecinq(int ncid, int* nrvars, int rvarids[], long rsizes[]);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item nrvars
+Number of record variables.
+
+ at item rvarids
+Returned vector of @code{nrvars} variable IDs for the record variables
+in this netCDF file.  The caller must allocate enough space for a vector
+of at least @code{nrvars} integers to be returned.  The maximum possible
+number of variable IDs returned is given by the predefined constant
+ at code{MAX_NC_VARS}.  If this parameter is given as @samp{(int *) 0}, no
+vector will be returned so no space to hold the record variable IDs
+needs to be declared or allocated.
+
+ at item rsizes
+Returned vector of @code{nrvars} sizes for the record variables in this
+netCDF file.  The size of a record variable is the number of bytes
+required to hold a record's worth of data, which is the product of the
+non-record dimensions and the size of data type, in bytes.  The caller
+must allocate enough space for a vector of at least @code{nrvars} longs
+to be returned.  The maximum possible number of variable IDs returned is
+given by the predefined constant @code{MAX_NC_VARS}.  If this parameter
+is given as @samp{(int *) 0}, no vector will be returned so no space to
+hold the record variable sizes needs to be declared or allocated.
+ at end table
+ at sp 1
+Here is an example using @code{ncrecinq} to find out about the record
+variables in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;                     /* netCDF ID */
+int  nrvars;                   /* number of record variables */
+int  rvarids[MAX_NC_VARS];     /* IDs of record variables */
+long rvarsizes[MAX_NC_VARS];   /* record sizes of record variables */
+   @dots{}
+ncid = ncopen ("foo.nc", NC_NOWRITE);
+   @dots{}
+ncrecinq (ncid, &nrvars, rvarids, rvarsizes);
+ at end group
+ at end example
+
+ at node Attributes, File Structure, Variables, Top
+ at chapter Attributes
+
+ at cindex attributes
+ at cindex define mode
+ at cindex attribute names
+ at cindex attribute type
+ at cindex attribute length
+ at cindex attribute values
+ at findex ncattname
+ at findex NCANAM
+Attributes may be associated with each netCDF variable to specify such
+properties as units, special values, maximum and minimum valid values,
+scaling factors, and offsets.  Attributes for a netCDF file are
+defined when the file is first created, while the netCDF file is in define
+mode.  Additional attributes may be added later by reentering define
+mode.  A netCDF attribute has a netCDF variable to which it is assigned,
+a name, a type, a length, and a sequence of one or more values.  An
+attribute is designated by its variable ID and name, except in one case
+(@code{ncattname} or @code{NCANAM} in FORTRAN), where attributes are
+designated by variable ID and number because their names are unknown.
+
+ at cindex data mode
+ at cindex define mode
+ at cindex attribute type
+ at cindex attribute length
+ at cindex attribute values
+ at cindex attribute space
+The attributes associated with a variable are typically defined right
+after the variable is created, while still in define mode.  The data
+type, length, and value of an attribute may be changed even when in data
+mode, as long as the changed attribute requires no more space than the
+attribute as originally defined.
+
+ at cindex global attributes
+ at vindex NC_GLOBAL
+ at cindex define mode
+ at cindex data mode
+It is also possible to assign attributes not associated with any
+variable to the netCDF as a whole, by using the @code{NC_GLOBAL} variable
+pseudo-ID.  Global attributes may be used for purposes such as providing
+a title or processing history for a netCDF data set.
+
+ at cindex attribute operations
+Operations supported on attributes are:
+ at itemize @bullet
+ at item
+Create an attribute, given its variable ID, name, data type, length, and
+value.
+
+ at item
+Get attribute's data type and length from its variable ID and name.
+
+ at item
+Get attribute's value from its variable ID and name.
+
+ at item
+Copy attribute from one netCDF to another.
+
+ at item
+Get name of attribute from its number.
+
+ at item
+Rename an attribute.
+
+ at item
+Delete an attribute.
+ at end itemize
+
+ at menu
+* ncattput and NCAPT::      Create an Attribute
+* ncattinq and NCAINQ::      Get Information about an Attribute
+* ncattget and NCAGT(C)::      Get Attribute's Values
+* ncattcopy and NCACPY::      Copy Attribute from One netCDF to Another
+* ncattname and NCANAM::      Get Name of Attribute from Its Number
+* ncattrename and NCAREN::      Rename an Attribute
+* ncattdel and NCADEL::      Delete an Attribute
+ at end menu
+
+ at page
+ at node ncattput and NCAPT, ncattinq and NCAINQ,  , Attributes
+ at section Create an Attribute
+
+ at cindex creating attributes
+ at cindex defining attributes
+ at cindex variable attributes
+ at cindex global attributes
+ at findex ncattput
+ at findex NCAPT
+ at findex NCAPTC
+The function @code{ncattput} (or @code{NCAPT} or @code{NCAPTC} for
+FORTRAN) adds or changes a variable attribute or global attribute of an
+open netCDF file.  If this attribute is new, or if the space required to
+store the attribute is greater than before, the netCDF file must be in
+define mode.
+
+In case of an error, @code{ncattput} returns -1; @code{NCAPT} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified netCDF type is invalid.
+
+ at item
+The specified length is negative.
+
+ at item
+The specified open netCDF file is in data mode and the specified
+attribute would expand.
+
+ at item
+The specified open netCDF file is in data mode and the specified
+attribute does not already exist.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncattput
+ at unnumberedsubsec ncattput:  C Interface
+ at example
+int ncattput(int ncid, int varid, const char* name, nc_type datatype,
+             int len, const void* values);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at cindex global attributes
+ at vindex NC_GLOBAL
+ at item varid
+Variable ID of the variable to which the attribute will be assigned or
+ at code{NC_GLOBAL} for a global attribute.
+
+ at cindex attribute names
+ at item name
+Attribute name.  Must begin with an alphabetic character, followed by
+zero or more alphanumeric characters including the underscore
+(@samp{_}).  Case is significant.  Attribute name conventions are
+assumed by some netCDF generic applications, e.g., @code{units} as the
+name for a string attribute that gives the units for a netCDF variable.
+ at xref{Attribute Conventions}, for examples of attribute conventions.
+
+ at cindex attribute type
+ at cindex data types
+ at vindex nc_type
+ at vindex NC_BYTE
+ at vindex NC_CHAR
+ at vindex NC_SHORT
+ at vindex NC_LONG
+ at vindex NC_FLOAT
+ at vindex NC_DOUBLE
+ at item datatype
+One of the set of predefined netCDF data types.  The type of this
+parameter, @code{nc_type}, is defined in the netCDF header file.  The
+valid netCDF data types are @code{NC_BYTE}, @code{NC_CHAR},
+ at code{NC_SHORT}, @code{NC_LONG}, @code{NC_FLOAT}, and @code{NC_DOUBLE}.
+
+ at cindex data types
+ at vindex NC_CHAR
+ at item len
+Number of values provided for the attribute.  If the attribute is of type
+ at code{NC_CHAR}, this is one more than the string length (since the
+terminating null character is stored).
+
+ at cindex attribute values
+ at item values
+Pointer to one or more data values.  The pointer is declared to be of
+the type @code{void *} because it can point to data of any of the basic
+netCDF types.  The data should be of the appropriate type for the netCDF
+attribute.  @strong{Warning: neither the compiler nor the netCDF
+software can detect whether the wrong type of data is used.}
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncattput
+ at findex ncredef
+ at vindex NC_GLOBAL
+ at vindex NC_CHAR
+ at vindex NC_DOUBLE
+ at findex ncendef
+Here is an example using @code{ncattput} to add a variable attribute
+named @code{valid_range} for a netCDF variable named @code{rh} and a
+global attribute named @code{title} to an existing netCDF file named
+ at file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;                         /* netCDF ID */
+int  rh_id;                        /* variable ID */
+static double rh_range[] = @{0.0, 100.0@};  /* attribute vals */
+static char title[] = "example netCDF file";
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);
+   @dots{}
+ncredef(ncid);                    /* enter define mode */
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+ncattput (ncid, rh_id, "valid_range", NC_DOUBLE, 2, rh_range);
+ncattput (ncid, NC_GLOBAL, "title", NC_CHAR, strlen(title)+1,
+          title);
+   @dots{}
+ncendef(ncid);                    /* leave define mode */
+ at end group
+ at end example
+
+ at findex NCAPT
+ at findex NCAPTC
+ at unnumberedsubsec NCAPT, NCAPTC:  FORTRAN Interface
+ at example
+      SUBROUTINE NCAPT (INTEGER NCID, INTEGER VARID,
+     +                  CHARACTER*(*) ATTNAM, INTEGER ATTYPE,
+     +                  INTEGER ATTLEN, type VALUE,
+     +                  INTEGER RCODE)
+
+      SUBROUTINE NCAPTC (INTEGER NCID, INTEGER VARID,
+     +                   CHARACTER*(*) ATTNAM, INTEGER ATTYPE,
+     +                   INTEGER LENSTR, CHARACTER*(*) STRING,
+     +                   INTEGER RCODE)
+ at end example
+
+There are two FORTRAN subroutines, @code{NCAPT} and @code{NCAPTC}, for
+creating attributes.  The first is for attributes of numeric type, and
+the second is for attributes of character-string type.
+
+ at cindex variable data
+ at cindex variable indices
+ at cindex variable dimensions
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item VARID
+Variable ID, returned from a previous call to @code{NCVDEF} or
+ at code{NCVID}.
+
+ at cindex attribute names
+ at item ATTNAM
+Attribute name.  Must begin with an alphabetic character, followed by
+zero or more alphanumeric characters including the underscore
+(@samp{_}).  Case is significant.  Attribute name conventions are
+assumed by some netCDF generic applications, e.g., @code{units} as the
+name for a string attribute that gives the units for a netCDF variable.
+A table of conventional attribute names is presented in the earlier
+chapter on the netCDF interface.
+
+ at cindex attribute type
+ at vindex NCBYTE
+ at vindex NCCHAR
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item ATTYPE
+One of the set of predefined netCDF data types.  The valid netCDF data
+types are @code{NCBYTE}, @code{NCCHAR}, @code{NCSHORT}, @code{NCLONG},
+ at code{NCFLOAT}, and @code{NCDOUBLE}.
+
+ at item ATTLEN
+In @code{NCAPT}, the number of numeric values provided for the
+attribute.
+
+ at item VALUE
+In @code{NCAPT}, an array of @code{ATTLEN} data values.  The data should
+be of the appropriate type for the netCDF attribute.  @strong{Warning:
+neither the compiler nor the netCDF software can detect if the wrong
+type of data is used.}
+
+ at item STRING
+In @code{NCAPTC}, the character-string value of the attribute.
+
+ at item LENSTR
+In @code{NCAPTC}, the total declared length (in characters) of the
+ at code{STRING} parameter.  Note that this is not necessarily the same as
+the value returned by the FORTRAN @code{LEN} function, because an array
+argument may be provided.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCAPT
+ at findex NCREDF
+ at vindex NCDOUBLE
+ at findex NCAPTC
+ at vindex NCGLOBAL
+ at vindex NCCHAR
+ at findex NCENDF
+Here is an example using @code{NCAPT} to add a variable attribute
+named @code{valid_range} for a netCDF variable named @code{rh} and a
+global attribute named @code{title} to an existing netCDF file named
+ at file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID, RCODE
+      INTEGER  RHID               ! variable ID
+      DOUBLE RHRNGE(2)
+      DATA RHRNGE /0.0D0, 100.0D0/
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCWRITE, RCODE)
+         @dots{}
+      CALL NCREDF (NCID, RCODE)     ! enter define mode
+      RHID = NCVID (NCID, 'rh', RCODE)! get ID
+         @dots{}
+      CALL NCAPT (NCID, RHID, 'valid_range', NCDOUBLE, 2,
+     +            RHRNGE, RCODE)
+      CALL NCAPTC (NCID, NCGLOBAL, 'title', NCCHAR, 19,
+     +            'example netCDF file', RCODE)
+         @dots{}
+      CALL NCENDF (NCID, RCODE)     ! leave define mode
+ at end group
+ at end example
+
+ at page
+ at node ncattinq and NCAINQ, ncattget and NCAGT(C), ncattput and NCAPT, Attributes
+ at section Get Information about an Attribute
+
+ at cindex attribute inquire
+ at cindex attribute names
+ at cindex variable attributes
+ at cindex global attributes
+ at findex ncattinq
+ at findex NCAINQ
+The function @code{ncattinq} (or @code{NCAINQ} for FORTRAN) returns
+information about a netCDF attribute, given its variable ID and name.
+The information returned is the type and length of the attribute.
+
+In case of an error, @code{ncattinq} returns -1; @code{NCAINQ} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified attribute does not exist.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncattinq
+ at unnumberedsubsec ncattinq:  C Interface
+ at example
+int ncattinq(int ncid, int varid, const char* name,
+             nc_type* datatype, int* len);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at item varid
+Variable ID of the attribute's variable, or @code{NC_GLOBAL} for a
+global attribute.
+
+ at item name
+Attribute name.
+
+ at cindex data types
+ at vindex nc_type
+ at vindex NC_BYTE
+ at vindex NC_CHAR
+ at vindex NC_SHORT
+ at vindex NC_LONG
+ at vindex NC_FLOAT
+ at vindex NC_DOUBLE
+ at vindex NC_CHAR
+ at item datatype
+Returned attribute type, one of the set of predefined netCDF data types.
+The type of this parameter, @code{nc_type}, is defined in the netCDF
+header file.  The valid netCDF data types are @code{NC_BYTE},
+ at code{NC_CHAR}, @code{NC_SHORT}, @code{NC_LONG}, @code{NC_FLOAT}, and
+ at code{NC_DOUBLE}.  If this parameter is given as @samp{(nc_type *) 0},
+no type will be returned so no variable to hold the type needs to be
+declared.
+
+ at cindex data types
+ at item len
+Returned number of values currently stored in the attribute.  If the
+attribute is of type @code{NC_CHAR}, this is one more than the string
+length (since the terminating null character is stored).  If this
+parameter is given as @samp{(int *) 0}, no length will be returned so no
+variable to hold this information needs to be declared.
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncattinq
+ at vindex nc_type
+ at vindex NC_GLOBAL
+Here is an example using @code{ncattinq} to find out the type and length
+of a variable attribute named @code{valid_range} for a netCDF variable
+named @code{rh} and a global attribute named @code{title} in an existing
+netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;                 /* netCDF ID */
+int  rh_id;                /* variable ID */
+nc_type vr_type, t_type;   /* attribute types */
+int  vr_len, t_len;        /* attribute lengths *'
+
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+ncattinq (ncid, rh_id, "valid_range", &vr_type, &vr_len);
+ncattinq (ncid, NC_GLOBAL, "title", &t_type, &t_len);
+   @dots{}
+ at end group
+ at end example
+
+ at findex NCAINQ
+ at unnumberedsubsec NCAINQ:  FORTRAN Interface
+ at example
+      SUBROUTINE NCAINQ (INTEGER NCID, INTEGER VARID,
+     +                   CHARACTER*(*) ATTNAM, INTEGER ATTYPE,
+     +                   INTEGER ATTLEN,INTEGER RCODE)
+ at end example
+
+ at cindex attribute names
+ at cindex attribute type
+ at cindex attribute length
+ at cindex global attributes
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at cindex attribute variable ID
+ at vindex NCGLOBAL
+ at item VARID
+Variable ID of the attribute's variable, or @code{NCGLOBAL} for a
+global attribute.
+
+ at item ATTNAM
+Attribute name.
+
+ at cindex data types
+ at vindex NCBYTE
+ at vindex NCCHAR
+ at vindex NCSHORT
+ at vindex NCLONG
+ at vindex NCFLOAT
+ at vindex NCDOUBLE
+ at item ATTYPE
+Returned attribute type, one of the set of predefined netCDF data types.  The
+valid netCDF data types are @code{NCBYTE}, @code{NCCHAR},
+ at code{NCSHORT}, @code{NCLONG}, @code{NCFLOAT}, and @code{NCDOUBLE}.
+
+ at item ATTLEN
+Returned number of values currently stored in the attribute.  For a
+string-valued attribute, this is the number of characters in the string.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCAINQ
+ at vindex NCGLOBAL
+Here is an example using @code{NCAINQ} to add a variable attribute
+named @code{valid_range} for a netCDF variable named @code{rh} and a
+global attribute named @code{title} to an existing netCDF file named
+ at file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID, RCODE
+      INTEGER  RHID               ! variable ID
+      INTEGER  VRTYPE, TTYPE      ! attribute types
+      INTEGER  VRLEN, TLEN        ! attribute lengths
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)! get ID
+         @dots{}
+      CALL NCAINQ (NCID, RHID, 'valid_range', VRTYPE, VRLEN,
+     +             RCODE)
+      CALL NCAINQ (NCID, NCGLOBAL, 'title', TTYPE, TLEN,
+     +             RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncattget and NCAGT(C), ncattcopy and NCACPY, ncattinq and NCAINQ, Attributes
+ at section Get Attribute's Values
+
+ at cindex getting attribute values
+ at cindex attribute values
+ at findex ncattget
+ at findex NCAGT
+ at findex NCAGTC
+The function @code{ncattget} (or @code{NCAGT} or @code{NCAGTC} for
+FORTRAN) gets the value(s) of a netCDF attribute, given its
+variable ID and name.
+
+In case of an error, @code{ncattget} returns -1; @code{NCAGT} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified attribute does not exist.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncattget
+ at unnumberedsubsec ncattget:  C Interface
+ at example
+int ncattget(int ncid, int varid, const char* name, void* value);
+ at end example
+
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at cindex attribute variable ID
+ at vindex NC_GLOBAL
+ at item varid
+Variable ID of the attribute's variable, or @code{NC_GLOBAL} for a
+global attribute.
+
+ at item name
+Attribute name.
+
+ at cindex attribute values
+ at findex ncattinq
+ at item value
+Returned attribute values.  All elements of the vector of attribute
+values are returned, so you must allocate enough space to hold
+them.  If you don't know how much space to reserve, call @code{ncattinq}
+first to find out the length of the attribute.
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncattget
+ at vindex nc_type
+ at vindex NC_GLOBAL
+ at findex nctypelen
+Here is an example using @code{ncattget} to determine the values of a
+variable attribute named @code{valid_range} for a netCDF variable named
+ at code{rh} and a global attribute named @code{title} in an existing
+netCDF file named @file{foo.nc}.  In this example, it is assumed that
+we don't know how many values will be returned, but that we do know the
+types of the attributes.  Hence, to allocate enough space to store them,
+we must first inquire about the length of the attributes.
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;                 /* netCDF ID */
+int  rh_id;                /* variable ID */
+nc_type vr_type, t_type;   /* attribute types */
+int  vr_len, t_len;        /* attribute lengths */
+double *vr_val;            /* ptr to attribute values */
+char *title;               /* ptr to attribute values */
+extern char *malloc();     /* memory allocator */
+
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+/* find out how much space is needed for attribute values */
+ncattinq (ncid, rh_id, "valid_range", &vr_type, &vr_len);
+ncattinq (ncid, NC_GLOBAL, "title", &t_type, &t_len);
+
+/* allocate required space before retrieving values */
+vr_val = (double *) malloc(vr_len * nctypelen(vr_type));
+title = (char *) malloc(t_len * nctypelen(t_type));
+
+/* get attribute values */
+ncattget(ncid, rh_id, "valid_range", (void *)vr_val);
+ncattget(ncid, NC_GLOBAL, "title", (void *)title);
+   @dots{}
+ at end group
+ at end example
+
+ at findex NCAGT
+ at findex NCAGTC
+ at unnumberedsubsec NCAGT, NCAGTC:  FORTRAN Interface
+ at example
+      SUBROUTINE NCAGT (INTEGER NCID, INTEGER VARID,
+     +                  CHARACTER*(*) ATTNAM, type VALUES,
+     +                  INTEGER RCODE)
+
+      SUBROUTINE NCAGTC (INTEGER NCID, INTEGER VARID,
+     +                  CHARACTER*(*) ATTNAM, CHARACTER*(*) STRING,
+     +                  INTEGER LENSTR, INTEGER RCODE)
+ at end example
+
+There are two FORTRAN subroutines, @code{NCAGT} and @code{NCAGTC}, for
+retrieving attribute values.  The first is for attributes of numeric
+type, and the second is for attributes of character-string type.
+
+ at cindex attribute names
+ at cindex attribute type
+ at cindex attribute length
+ at cindex global attributes
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item VARID
+Variable ID of the attribute's variable, or @code{NCGLOBAL} for a
+global attribute.
+
+ at item ATTNAM
+Attribute name.
+
+ at cindex attribute values
+ at findex NCAINQ
+ at item VALUES
+Returned attribute values.  All elements of the vector of attribute
+values are returned, so you must provide enough space to hold
+them.  If you don't know how much space to reserve, call @code{NCAINQ}
+first to find out the length of the attribute.  @strong{Warning:
+neither the compiler nor the netCDF software can detect if the wrong
+type of data is used.}
+
+ at item STRING
+In @code{NCAGTC}, the character-string value of the attribute.
+
+ at item LENSTR
+In @code{NCAGTC}, the total declared length (in characters) of the
+ at code{STRING} parameter in the caller.  Note that this is not
+necessarily the same as the value returned by the FORTRAN @code{LEN}
+function, because an array argument may be provided.  @code{NCAGTC} will
+check to make sure the requested data will fit in @code{LENSTR}
+characters.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCAGT
+ at findex NCAGTC
+ at findex NCAINQ
+ at vindex NCGLOBAL
+Here is an example using @code{NCAGT} to determine the values of an
+attribute named @code{valid_range} for a netCDF variable named @code{rh}
+and a global attribute named @code{title} in an existing netCDF file
+named @file{foo.nc}.  In this example, it is assumed that we don't know
+how many values will be returned, so we first inquire about the length
+of the attributes to make sure we have enough space to store them:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      PARAMETER (MVRLEN=3) ! max number of "valid_range" values
+      PARAMETER (MTLEN=80) ! max length of "title" attribute
+      INTEGER  NCID, RCODE
+      INTEGER  RHID               ! variable ID
+      INTEGER  VRTYPE, TTYPE      ! attribute types
+      INTEGER  VRLEN, TLEN        ! attribute lengths
+      DOUBLE PRECISION VRVAL(MVRLEN) ! vr attribute values
+      CHARACTER*80 TITLE          ! title attribute values
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCWRITE, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE) ! get ID
+         @dots{}
+* find out attribute lengths, to make sure we have enough space
+      CALL NCAINQ (NCID, RHID, 'valid_range', VRTYPE, VRLEN,
+     +             RCODE)
+      CALL NCAINQ (NCID, NCGLOBAL, 'title', TTYPE, TLEN,
+     +             RCODE)
+* get attribute values, if not too big
+      IF (VRLEN > MVRLEN) THEN
+          WRITE (*,*) 'valid_range attribute too big!'
+          CALL EXIT
+      ELSE
+          CALL NCAGT (NCID, RHID, 'valid_range', VRVAL, RCODE)
+      ENDIF
+      IF (TLEN > MTLEN) THEN
+          WRITE (*,*) 'title attribute too big!'
+          CALL EXIT
+      ELSE
+          CALL NCAGTC (NCID, NCGLOBAL, 'title', TITLE, MTLEN, RCODE)
+      ENDIF
+ at end group
+ at end example
+
+ at page
+ at node ncattcopy and NCACPY, ncattname and NCANAM, ncattget and NCAGT(C), Attributes
+ at section Copy Attribute from One NetCDF to Another
+
+ at cindex copying attributes
+ at findex ncattcopy
+ at findex NCACPY
+The function @code{ncattcopy} (or @code{NCACPY} for FORTRAN) copies an
+attribute from one open netCDF file to another.  It can also be used to
+copy an attribute from one variable to another within the same netCDF.
+
+In case of an error, @code{ncattcopy} returns -1; @code{NCACPY} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The input or output variable ID is invalid for the specified netCDF file.
+
+ at item
+The specified attribute does not exist.
+
+ at item
+The output netCDF is not in define mode and the attribute is new for the
+output file is larger than the existing attribute.
+
+ at item
+The input or output netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncattcopy
+ at unnumberedsubsec ncattcopy:  C Interface
+ at example
+int ncattcopy(int incdf, int invar, const char* name, int outcdf, int outvar);
+ at end example
+
+ at table @code
+ at item incdf
+The netCDF ID of an input netCDF file from which the attribute will be copied,
+returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at cindex variables
+ at vindex NC_GLOBAL
+ at item invar
+ID of the variable in the input netCDF file from which the
+attribute will be copied, or @code{NC_GLOBAL} for a global attribute.
+
+ at item name
+Name of the attribute in the input netCDF file to be copied.
+
+ at item outcdf
+The netCDF ID of the output netCDF file to which the attribute will be copied,
+returned from a previous call to @code{ncopen} or @code{nccreate}.  It
+is permissible for the input and output netCDF IDs to be the same.  The
+output netCDF file should be in define mode if the attribute to be
+copied does not already exist for the target variable, or if it would
+cause an existing target attribute to grow.
+
+ at cindex variables
+ at vindex NC_GLOBAL
+ at item outvar
+ID of the variable in the output netCDF file to which the attribute will
+be copied, or @code{NC_GLOBAL} to copy to a global attribute.
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncredef
+ at findex ncendef
+ at findex ncattcopy
+Here is an example using @code{ncattcopy} to copy the variable attribute
+ at code{units} from the variable @code{rh} in an existing netCDF file
+named @file{foo.nc} to the variable @code{avgrh} in another existing
+netCDF file named @file{bar.nc}, assuming that the variable
+ at code{avgrh} already exists, but does not yet have a @code{units}
+attribute:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid1, ncid2;       /* netCDF IDs */
+int  rh_id, avgrh_id;      /* variable IDs */
+   @dots{}
+ncid1 = ncopen("foo.nc", NC_NOWRITE);
+ncid2 = ncopen("bar.nc", NC_WRITE);
+   @dots{}
+rh_id = ncvarid (ncid1, "rh");
+avgrh_id = ncvarid (ncid2, "avgrh");
+   @dots{}
+ncredef(ncid2);           /* enter define mode */
+/* copy variable attribute from "rh" to "avgrh" */
+ncattcopy(ncid1, rh_id, "units", ncid2, avgrh_id);
+   @dots{}
+ncendef(ncid2);           /* leave define mode */
+ at end group
+ at end example
+
+ at findex NCACPY
+ at unnumberedsubsec NCACPY:  FORTRAN Interface
+ at example
+      SUBROUTINE NCACPY (INTEGER INCDF, INTEGER INVAR,
+     +                   CHARACTER*(*) ATTNAM, INTEGER OUTCDF,
+     +                   INTEGER OUTVAR, INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item INCDF
+The netCDF ID of an input netCDF file from which the attribute will be copied,
+returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at item INVAR
+ID of the variable in the input netCDF file from which the
+attribute will be copied, or @code{NCGLOBAL} for a global attribute.
+
+ at item ATTNAM
+Name of the attribute in the input netCDF file to be copied.
+
+ at item OUTCDF
+The netCDF ID of the output netCDF file to which the attribute will be copied,
+returned from a previous call to @code{NCOPN} or @code{NCCRE}.  It
+is permissible for the input and output netCDF IDs to be the same.  The
+output netCDF file should be in define mode if the attribute to be
+copied does not already exist for the target variable, or if it would
+cause an existing target attribute to grow.
+
+ at cindex variable
+ at vindex NCGLOBAL
+ at item OUTVAR
+ID of the variable in the output netCDF file to which the
+attribute will be copied, or @code{NCGLOBAL} to copy to a global
+attribute.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCREDF
+ at findex NCENDF
+ at findex NCACPY
+ at vindex NCGLOBAL
+Here is an example using @code{NCACPY} to copy the variable attribute
+ at code{units} from the variable @code{rh} in an existing netCDF file
+named @file{foo.nc} to the variable @code{avgrh} in another existing
+netCDF file named @file{bar.nc}, assuming that the variable
+ at code{avgrh} already exists, but does not yet have a @code{units}
+attribute:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID1, NCID2     ! netCDF IDs
+      INTEGER  RHID, AVRHID       ! variable IDs
+         @dots{}
+      NCID1 = NCOPN ('foo.nc', NCNOWRIT, RCODE)
+      NCID2 = NCOPN ('bar.nc', NCWRITE, RCODE)
+         @dots{}
+      RHID = NCVID (NCID1, 'rh', RCODE)
+      AVRHID = NCVID (NCID2, 'avgrh', RCODE)
+         @dots{}
+      CALL NCREDF (NCID2, RCODE)  ! enter define mode
+* copy variable attribute from "rh" to "avgrh"
+      CALL NCACPY (NCID1, RHID, 'units', NCID2, AVRHID, RCODE)
+         @dots{}
+      CALL NCENDF (NCID2, RCODE)  ! leave define mode
+ at end group
+ at end example
+
+ at page
+ at node ncattname and NCANAM, ncattrename and NCAREN, ncattcopy and NCACPY, Attributes
+ at section Get Name of Attribute from Its Number
+
+ at cindex getting attribute name
+ at cindex attribute names
+ at cindex attribute numbers
+ at cindex generic applications
+ at cindex attribute deletion
+ at cindex attribute ID
+ at findex ncattname
+ at findex NCANAM
+The function @code{ncattname} (or @code{NCANAM} for FORTRAN) gets the
+name of an attribute, given its variable ID and number. 
+This function is useful in generic applications that
+need to get the names of all the attributes associated with a variable,
+since attributes are accessed by name rather than number in all other
+attribute functions.  The number of an attribute is more volatile than
+the name, since it can change when other attributes of the same variable
+are deleted.  This is why an attribute number is not called an attribute
+ID.
+
+In case of an error, @code{ncattname} returns -1; @code{NCANAM} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The specified variable ID is not valid.
+
+ at item
+The specified attribute number is negative or more than the number of
+attributes defined for the specified variable.
+
+ at item
+The specified attribute does not exist.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncattname
+ at unnumberedsubsec ncattname:  C Interface
+ at example
+int ncattname (int ncid, int varid, int attnum, char* name);
+ at end example
+
+ at cindex attribute numbers
+ at cindex attribute names
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at cindex attribute variable ID
+ at vindex NC_GLOBAL
+ at item varid
+ID of the attribute's variable, or @code{NC_GLOBAL} for a global
+attribute.
+
+ at findex ncvarinq
+ at item attnum
+Number of the attribute.  The attributes for each variable are numbered
+from 0 (the first attribute) to @code{nvatts-1}, where @code{nvatts} is
+the number of attributes for the variable, as returned from a call to
+ at code{ncvarinq}.
+
+ at cindex maximum name length
+ at vindex MAX_NC_NAME
+ at item name
+Returned attribute name.  The caller must allocate space for the
+returned name.  The maximum possible length, in characters, of an
+attribute name is given by the predefined constant @code{MAX_NC_NAME}.
+If the name parameter is given as @code{(char *) 0}, no name will be
+returned and no space needs to be allocated.
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncattname
+ at vindex MAX_NC_NAME
+Here is an example using @code{ncattname} to determine the name of the
+first attribute of the variable @code{rh} in an existing netCDF file
+named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;        /* netCDF ID */
+int  rh_id;       /* variable ID */
+char attname[MAX_NC_NAME];  /* maximum-size attribute name */
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+/* get name of first attribute (number 0) */
+ncattname(ncid, rh_id, 0, attname);
+ at end group
+ at end example
+
+ at findex NCANAM
+ at unnumberedsubsec NCANAM:  FORTRAN Interface
+ at example
+      SUBROUTINE NCANAM (INTEGER NCID, INTEGER VARID,
+     +                   INTEGER ATTNUM, CHARACTER*(*) ATTNAM,
+     +                   INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at cindex attribute variable ID
+ at vindex NCGLOBAL
+ at item VARID
+ID of the attribute's variable, or @code{NCGLOBAL} for a global
+attribute.
+
+ at findex NCVINQ
+ at item ATTNUM
+Number of the attribute.  The attributes for each variable are numbered
+from 1 (the first attribute) to @code{NVATTS}, where @code{NVATTS} is
+the number of attributes for the variable, as returned from a call to
+ at code{NCVINQ}.
+
+ at cindex maximum name length
+ at vindex MAXNCNAM
+ at item ATTNAM
+Returned attribute name.  The caller must allocate space for the
+returned name.  The maximum possible length, in characters, of an
+attribute name is given by the predefined constant @code{MAXNCNAM}.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCANAM
+ at vindex MAXNCNAM
+Here is an example using @code{NCANAM} determine the name of the
+first attribute of the variable @code{rh} in an existing netCDF file
+named @file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID     ! netCDF ID
+      INTEGER  RHID      ! variable ID
+* 31 in the following should be MAXNCNAM
+      CHARACTER*31 ATTNAM
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCNOWRIT, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)
+         @dots{}
+* get name of first attribute (number 1)
+      CALL NCANAM (NCID, RHID, 1, ATTNAM, RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncattrename and NCAREN, ncattdel and NCADEL, ncattname and NCANAM, Attributes
+ at section Rename an Attribute
+
+
+ at cindex renaming attributes
+ at cindex attribute names
+ at findex ncattrename
+ at findex NCAREN
+The function @code{ncattrename} (or @code{NCAREN} for FORTRAN) changes the
+name of an attribute.  If the new name is longer than the original name,
+the netCDF must be in define mode.  You cannot rename an attribute to
+have the same name as another attribute of the same variable.
+
+In case of an error, @code{ncattrename} returns -1; @code{NCAREN} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The specified variable ID is not valid.
+ at item
+The new attribute name is already in use for another attribute of the
+specified variable.
+ at item
+The specified netCDF file is in data mode and the new name is longer
+than the old name.
+ at item
+The specified attribute does not exist.
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncattrename
+ at unnumberedsubsec ncattrename:  C Interface
+ at example
+int ncattrename (int ncid, int varid, const char* name, const char* newname);
+ at end example
+
+ at cindex attribute names
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}
+ at item varid
+ID of the attribute's variable, or @code{NC_GLOBAL} for a
+global attribute
+ at item name
+The original attribute name.
+ at item newname
+The new name to be assigned to the specified attribute.  If the new name
+is longer than the old name, the netCDF file must be in define mode.
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncattrename
+Here is an example using @code{ncattrename} to rename the variable
+attribute @code{units} to @code{Units} for a variable @code{rh}
+in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;        /* netCDF ID */
+int  rh_id;       /* variable id */
+   @dots{}
+ncid = ncopen("foo.nc", NC_NOWRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+/* rename attribute */
+ncattrename(ncid, rh_id, "units", "Units");
+ at end group
+ at end example
+
+ at findex NCAREN
+ at unnumberedsubsec NCAREN:  FORTRAN Interface
+ at example
+      SUBROUTINE NCAREN (INTEGER NCID, INTEGER VARID,
+     +                   CHARACTER*(*) ATTNAM,
+     +                   CHARACTER*(*) NEWNAM, INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}
+ at item VARID
+ID of the attribute's variable, or @code{NCGLOBAL} for a
+global attribute
+ at item ATTNAM
+The original attribute name.
+ at item NEWNAM
+The new name to be assigned to the specified attribute.  If the new name
+is longer than the old name, the netCDF file must be in define mode.
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCAREN
+Here is an example using @code{NCAREN} to rename the variable
+attribute @code{units} to @code{Units} for a variable @code{rh}
+in an existing netCDF file named @file{foo.nc}:
+ at example 
+ at group
+      INCLUDE "netcdf.inc"
+         @dots{}
+      INTEGER  NCID     ! netCDF ID
+      INTEGER  RHID      ! variable ID
+         @dots{}
+      NCID = NCOPN ("foo.nc", NCNOWRIT, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, "rh", RCODE)
+         @dots{}
+* rename attribute
+      CALL NCAREN (NCID, RHID, "units", "Units", RCODE)
+ at end group
+ at end example
+
+ at page
+ at node ncattdel and NCADEL,  , ncattrename and NCAREN, Attributes
+ at section Delete an Attribute
+
+ at cindex deleting attributes
+ at cindex removing attributes
+ at findex ncattdel
+ at findex NCADEL
+The function @code{ncattdel} (or @code{NCADEL} for FORTRAN) deletes a
+netCDF attribute from an open netCDF file.  The netCDF file must be in
+define mode.
+
+In case of an error, @code{ncattdel} returns -1; @code{NCADEL} returns a
+nonzero value in @code{rcode}.  Possible causes of errors include:
+ at itemize @bullet
+ at item
+The specified variable ID is not valid.
+
+ at item
+The specified netCDF file is in data mode.
+
+ at item
+The specified attribute does not exist.
+
+ at item
+The specified netCDF ID does not refer to an open netCDF file.
+ at end itemize
+
+ at findex ncattdel
+ at unnumberedsubsec ncattdel:  C Interface
+ at example
+int ncattdel (int ncid, int varid, const char* name);
+ at end example
+
+ at cindex attribute names
+ at table @code
+ at item ncid
+NetCDF ID, returned from a previous call to @code{ncopen} or @code{nccreate}.
+
+ at cindex attribute variable ID
+ at vindex NC_GLOBAL
+ at item varid
+ID of the attribute's variable, or @code{NC_GLOBAL} for a
+global attribute.
+
+ at item name
+The name of the attribute to be deleted.
+ at end table
+
+ at findex ncopen
+ at findex ncvarid
+ at findex ncattdel
+ at findex ncredef
+ at findex ncendef
+Here is an example using @code{ncattdel} to delete the variable
+attribute @code{Units} for a variable @code{rh} in an existing netCDF
+file named @file{foo.nc}:
+ at example 
+ at group
+#include "netcdf.h"
+   @dots{}
+int  ncid;        /* netCDF ID */
+int  rh_id;       /* variable ID */
+   @dots{}
+ncid = ncopen("foo.nc", NC_WRITE);
+   @dots{}
+rh_id = ncvarid (ncid, "rh");
+   @dots{}
+/* delete attribute */
+ncredef(ncid);                  /* enter define mode */
+ncattdel(ncid, rh_id, "Units");
+ncendef(ncid);                  /* leave define mode */
+ at end group
+ at end example
+
+ at findex NCADEL
+ at unnumberedsubsec NCADEL:  FORTRAN Interface
+ at example
+      SUBROUTINE NCADEL (INTEGER NCID, INTEGER VARID,
+     +                   CHARACTER*(*) ATTNAM, INTEGER RCODE)
+ at end example
+
+ at table @code
+ at item NCID
+NetCDF ID, returned from a previous call to @code{NCOPN} or @code{NCCRE}.
+
+ at cindex attribute variable ID
+ at vindex NCGLOBAL
+ at item VARID
+ID of the attribute's variable, or @code{NCGLOBAL} for a
+global attribute.
+
+ at item ATTNAM
+The original attribute name.
+
+ at item RCODE
+Returned error code.  If no errors occurred, 0 is returned.
+ at end table
+
+ at findex NCOPN
+ at findex NCVID
+ at findex NCADEL
+ at findex NCREDF
+ at findex NCENDF
+Here is an example using @code{NCADEL} to delete the variable attribute
+ at code{Units} for a variable @code{rh} in an existing netCDF file named
+ at file{foo.nc}:
+ at example 
+ at group
+      INCLUDE 'netcdf.inc'
+         @dots{}
+      INTEGER  NCID     ! netCDF ID
+      INTEGER  RHID      ! variable ID
+         @dots{}
+      NCID = NCOPN ('foo.nc', NCWRITE, RCODE)
+         @dots{}
+      RHID = NCVID (NCID, 'rh', RCODE)
+         @dots{}
+* delete attribute
+      CALL NCREDF (NCID, RCODE)  ! enter define mode
+      CALL NCADEL (NCID, RHID, 'Units', RCODE)
+      CALL NCENDF (NCID, RCODE)  ! leave define mode
+ at end group
+ at end example
+
+ at cindex efficiency
+ at cindex performance
+ at cindex format
+ at cindex netCDF format
+ at cindex file structure
+ at cindex netCDF file structure
+ at node File Structure, Utilities, Attributes, Top
+ at chapter NetCDF File Structure and Performance
+
+NetCDF is a data abstraction for scientific data access and a software
+library that provides a concrete implementation of the interfaces that
+support that abstraction.  The implementation provides a
+machine-independent format for representing scientific data.  Although
+the netCDF file format is completely hidden below the interfaces, some
+understanding of the implementation and associated file structure may
+help to make clear which netCDF operations are expensive and why.
+
+A detailed description of the netCDF @emph{format} is not appropriate
+for this User's Guide, however.  It is not needed to read and
+write netCDF files or understand efficiency issues.  Programs that use
+only the documented interfaces and that make no other assumptions about
+the format will continue to work even if the netCDF format is changed in
+the future, because any such change will be made below the documented
+interfaces and will support earlier versions of netCDF data.
+
+This chapter describes the structure of a netCDF file and some
+characteristics of the XDR layer that provides network transparency in
+enough detail to understand netCDF performance issues.
+
+ at menu
+* File parts::  Parts of a netCDF File
+* XDR layer::   The XDR Layer
+ at end menu
+
+ at cindex header part
+ at cindex parts of a netCDF file
+ at cindex fixed-size data part
+ at cindex record-data part
+ at cindex XDR
+ at node File parts, XDR layer,  , File Structure
+ at section Parts of a NetCDF File
+
+A netCDF data set is stored as a single file comprising three parts:
+ at itemize @bullet
+ at item
+a @dfn{header}, containing all the information about dimensions,
+attributes, and variables except for the variable data;
+ at item
+ at dfn{fixed-size data}, containing the data for variables that
+don't have an unlimited dimension; and
+ at item
+ at dfn{record data}, containing the data records for variables that
+have an unlimited dimension.
+ at end itemize
+All the data are represented in XDR form to make them machine-independent.
+
+ at cindex variable offsets
+The descriptive header at the beginning of the netCDF file is an XDR
+encoding of a high-level data structure that represents information
+about the dimensions, variables, and attributes in the file.  The
+variable descriptions in this header contain offsets to the beginning of
+each variable's data or the relative offset of a variable within a
+record. The descriptions also contain the dimension size and information
+needed to determine how to map multidimensional indices for each
+variable to the appropriate offsets.
+
+ at cindex file size
+ at cindex expense of operations
+This header has no usable extra space; it is only as large as it needs
+to be for the dimensions, variables, and attributes in each netCDF file.
+This has the advantage that netCDF files are compact, requiring very
+little overhead to store the ancillary data that makes the files
+self-describing.  A potential disadvantage of this organization is
+that any operation on a netCDF file that requires expanding the header,
+for example adding a set of new dimensions and new variables to an
+existing netCDF file, will be as expensive as copying the file.  This
+expense is incurred when @code{ncendef()} is called, after a call to
+ at code{ncredef()}.  If you create all necessary dimensions, variables,
+and attributes @emph{before} writing variable data, and avoid later
+additions and renamings of netCDF components that require more space in
+the header part of the file, you avoid the cost associated with
+expanding the header.
+
+The fixed-size data part that follows the header contains all the
+variable data for variables that do not employ the unlimited (record)
+dimension.  The data for each variable is stored contiguously in this
+part of the file.  If there is no unlimited dimension, this is the last
+part of the netCDF file.
+
+ at cindex appending data
+The record-data part that follows the fixed-size data consists of a
+variable number of records, each of which contains data for all
+the record variables.  The record data for each variable is stored
+contiguously in each record.
+
+The order in which the data in the fixed-size data part and in each
+record appears is the same as the order in which the variables were
+defined, in increasing numerical order by netCDF variable ID.  This
+knowledge can sometimes be used to enhance data access performance,
+since the best data access is currently achieved by reading or writing
+the data in sequential order.
+
+ at cindex XDR
+ at node XDR layer,  , File parts, File Structure
+ at section The XDR Layer
+
+XDR is a standard for describing and encoding data and a library of
+functions for external data representation, allowing programmers to
+encode data structures in a machine-independent way.  NetCDF employs XDR
+for representing all data, in both the header part and the data parts.
+XDR is used to write portable data that can be read on any other machine
+for which the XDR library has been implemented.
+
+Many vendors provide an XDR library along with other C run-time
+libraries.  The netCDF software distribution also includes Sun's
+portable implementation of XDR for platforms that don't already have a
+vendor-supplied XDR library.
+
+ at cindex stdio
+ at cindex concurrency
+ at cindex buffers
+ at cindex flushing
+An I/O layer implemented much like the C standard I/O (stdio) library is
+used by the XDR layer to read and write XDR-encoded data to netCDF
+files.  Hence an understanding of the standard I/O library provides
+answers to most questions about multiple processes accessing data
+concurrently, the use of I/O buffers, and the costs of opening and
+closing netCDF files.  In particular, it is possible to have one process
+writing a netCDF file while other processes read it.  Data reads and
+writes are no more atomic than calls to stdio @code{fread()} and
+ at code{fwrite()}.  An @code{ncsync()} call (@code{NCSNC()} for FORTRAN)
+is analogous to the @code{fflush()} call in the standard I/O library,
+writing unwritten buffered data so other processes can read it;
+ at code{ncsync()} also brings header changes up-to-date (e.g., changes to
+attribute values).
+
+As in the stdio library, flushes are also performed when ``seeks'' occur
+to a different area of the file.  Hence the order of read and write
+operations can influence I/O performance significantly.  Reading data in
+the same order in which it was written within each record will minimize
+buffer flushes.
+
+There is one unusual case where the situation is more complex: when a
+writer enters define mode to add some additional dimensions, variables,
+or attributes to an existing netCDF file that is also open for reading
+by other processes.  In this case, when the writer leaves define mode, a
+new copy of the file is created with the new dimensions, attributes, or
+variables and the old data, but readers that still have the file open
+will not see the changes.  You should not expect netCDF data access to
+work with multiple writers having the same file open for writing
+simultaneously.
+
+ at cindex VMS performance
+For VMS systems, the performance penalty for permitting shared access
+(under the current implementation of stdio in the C run-time library)
+seemed too great to make shared access the default, so netCDF files on VMS
+are opened non-shared.  This still permits multiple simultaneous readers
+of the same file, but one writer prevents any readers from accessing the
+file.  Implementors can easily allow shared access for a VMS
+implementation, if shared access is a more important requirement than
+access speed.
+
+It is possible to tune an implementation of netCDF for some platforms by
+replacing the I/O layer beneath XDR with a different platform-specific
+I/O layer.  This may change the similarities between netCDF and standard
+I/O, and hence characteristics related to data sharing, buffering, and
+the cost of I/O operations.
+
+The cost of using a canonical representation for data like XDR varies
+according to the type of data and whether the XDR form is the same as the
+machine's native form for that type.  XDR is especially efficient for
+byte, character, and short integer data.
+
+ at cindex XDR
+ at cindex floating-point conversion costs
+For some data types on some machines, the time required to convert data
+to and from XDR form can be significant.  The best case is byte arrays,
+for which very little conversion expense occurs, since the XDR library
+has built-in support for them.  The netCDF implementation
+includes similar support added to XDR for arrays of short (16-bit)
+integers.  The worst case is reading or writing large arrays of
+floating-point data on a machine that does not use IEEE floating-point
+as its native representation.  The XDR library incurs the expense of a
+function call for each floating-point quantity accessed.  On some
+architectures the cost of a function invocation for each floating-point
+number can dominate the cost of netCDF access to floating-point fields.
+
+ at cindex portability
+ at cindex platform-specific optimizations
+The distributed netCDF implementation is meant to be portable.
+Platform-specific ports that further optimize the implementation for
+better I/O performance or that unroll the loops in the XDR library to
+optimize XDR conversion of long integer and floating-point arrays are
+practical and desirable in cases where higher performance for data
+access is necessary.
+
+ at node Utilities, FAQ, File Structure, Top
+ at chapter Higher-Level netCDF Operations
+
+ at cindex higher-level netCDF operations
+ at findex ncgen
+ at findex ncdump
+One of the primary reasons for using the netCDF interface for both
+scientific data and applications that deal with scientific data is to
+take advantage of higher-level netCDF operations and generic
+applications for processing netCDF files.  NetCDF @dfn{operators} read
+one or more netCDF input files and write a netCDF output file.  NetCDF
+ at dfn{utilities} read one or more netCDF files and produce some other
+kind of output (e.g. a text file or graphics), or read some other kind
+of input (e.g. a text file) and write netCDF files.  Currently two
+netCDF utilities are available as part of the netCDF software
+distribution: @code{ncgen} and @code{ncdump}.  A preliminary set of
+example netCDF operators is available as a separate package.
+
+This chapter describes the @code{ncgen} and @code{ncdump} utilities.
+These two tools convert between binary netCDF files and an ASCII
+representation of netCDF files.  The output of @code{ncdump} and the
+input to @code{ncgen} is an ASCII description of a netCDF file in a tiny
+language known as CDL (network Common data form Description Language).
+
+The preliminary set of example netCDF operators is available via
+anonymous FTP of the file @code{pub/sdm/ncopers<version>.tar.Z} from
+host @code{unidata.ucar.edu}.  The programs include: @code{ncextr},
+which extracts a subset of variables from a netCDF file into an output
+netCDF file; @code{ncstat}, which reads a netCDF file and writes
+selected statistics along one or more summary dimensions into another
+netCDF file; and @code{ncbarne}, which performs a Barnes objective
+analysis of raw data contained in a netCDF file and writes the result to
+an output netCDF file.  These programs are documented in the ncopers
+release.
+
+A number of freely-available and commercial software packages are also
+available for manipulating or graphically displaying netCDF data.  A
+list of these packages is maintained in the file
+ at code{pub/netcdf/utilities.txt} from host @code{unidata.ucar.edu}.
+
+ at menu
+
+* CDL Syntax::    The syntax of CDL, a tiny language for representing
+                  netCDF files or their structure in ASCII.
+* CDL Data Types::The data types of CDL.
+* CDL Constants:: The CDL notation for data constants.
+* ncgen::         Check CDL syntax or generate netCDF file (or C or Fortran)
+                  from netCDF file.
+* ncdump::        Generate CDL file (or a portion of a CDL file) from a netCDF
+                  file.
+ at end menu
+
+ at node CDL Syntax, CDL Data Types,  , Utilities
+ at section CDL Syntax
+
+ at cindex CDL syntax
+ at cindex CDL example
+Below is an example of CDL, describing a netCDF file with several named
+dimensions (@code{lat}, @code{lon}, @code{time}), variables
+(@code{z}, @code{t}, @code{p}, @code{rh}, @code{lat}, @code{lon},
+ at code{time}), variable attributes (@code{units}, @code{valid_range},
+ at code{_FillValue}), and some data.
+
+ at example
+ at group
+netcdf foo @{    // example netCDF specification in CDL
+
+dimensions:
+lat = 10, lon = 5, time = unlimited ;
+
+variables:
+  long    lat(lat), lon(lon), time(time);
+  float   z(time,lat,lon), t(time,lat,lon);
+  double  p(time,lat,lon);
+  long    rh(time,lat,lon);
+
+  lat:units = "degrees_north";
+  lon:units = "degrees_east";
+  time:units = "seconds";
+  z:units = "meters";
+  z:valid_range = 0., 5000.;
+  p:_FillValue = -9999.;
+  rh:_FillValue = -1;
+
+data:
+  lat   = 0, 10, 20, 30, 40, 50, 60, 70, 80, 90;
+  lon   = -140, -118, -96, -84, -52;
+@}
+ at end group
+ at end example
+
+All CDL statements are terminated by a semicolon.  Spaces, tabs, and
+newlines can be used freely for readability.  Comments may follow the
+double slash characters @code{//} on any line.
+
+A CDL description consists of three optional parts: dimensions,
+variables, and data.  The variable part may contain variable
+declarations and attribute assignments.
+
+ at cindex CDL dimensions
+ at cindex appending data
+A dimension is used to define the shape of one or
+more of the multidimensional variables described by the
+CDL description.   A dimension has a name and a size.   At
+most one dimension in a CDL description can have the unlimited size,
+which means a variable using this dimension can grow to any
+length (like a record number in a file).
+
+ at cindex CDL variables
+ at cindex coordinate variables
+A variable 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 attributes
+(see below) as well as data values.  The name, data type, and shape of a
+variable are specified by its declaration in the variable 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.
+
+ at cindex CDL attributes
+An attribute contains information about a variable or about the whole
+netCDF data set.  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, @code{units} is an
+attribute represented by a character array such as @code{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 ancillary data (data about data).
+
+ at cindex CDL attributes
+ at cindex variable attributes
+ at cindex global attributes
+In CDL, an attribute is designated by a variable and attribute name,
+separated by a colon (@samp{:}).  It is possible to assign global
+attributes not associated with any variable to the netCDF file as a
+whole by using the colon (@samp{:}) 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
+or the number of characters in the character string assigned to it.
+Multiple values are assigned to noncharacter attributes by separating
+the values with commas (@samp{,}).  All values assigned to an attribute
+must be of the same type.
+
+ at cindex CDL names
+CDL names for variables, attributes, and dimensions may be any
+combination of alphabetic or numeric characters as well as @samp{_} and
+ at samp{-} characters, but names beginning with @samp{_} are reserved for
+use by the library.  Case is significant in CDL names.  The netCDF
+library does not enforce any restrictions on netCDF names, so it is
+possible (though unwise) to define variables with names that are not
+valid CDL names.  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.
+ at sp 1
+ at cindex data section
+ at cindex CDL variable initialization
+ at cindex CDL variables
+The optional data section of a CDL description is where
+netCDF variables may be initialized.  The syntax of an initialization
+is simple:
+ at display
+        @i{variable} = @i{value_1}, @i{value_2}, @dots{};
+ at end display
+The comma-delimited list of constants may be separated by spaces, tabs,
+and newlines.  For multidimensional 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.  The types of
+constants need not match the type declared for a variable; coercions are
+done to convert integers to floating point, for example.  All
+meaningful type conversions are supported.
+
+ at node CDL Data Types, CDL Constants, CDL Syntax, Utilities
+ at section CDL Data Types
+
+ at cindex CDL data types
+The CDL data types are:
+ at table @code
+ at item char
+Characters.
+
+ at item byte
+Eight-bit data, including zero bytes.
+
+ at item short
+16-bit signed integers.
+
+ at item long
+32-bit signed integers.
+
+ at item int
+(Synonymous with long).
+
+ at item float
+IEEE single-precision floating point (32 bits).
+
+ at item real
+(Synonymous with float).
+
+ at item double
+IEEE double-precision floating point (64 bits).
+ at end table
+
+ at cindex CDL reserved words
+Except for the added data-type @code{byte} and the lack of the type
+qualifier @code{unsigned}, CDL supports the same primitive data types as
+C.  In declarations, type names may be specified in either upper or
+lower case.
+
+ at cindex byte data type
+ at cindex char data type
+ at code{Byte}s differ from characters in that they are intended to hold
+eight bits of data, and the zero byte has no special significance, as it
+may for character data.  @code{Ncgen} converts @code{byte} declarations
+to @code{char} declarations in the output C code and to the nonstandard
+ at code{BYTE} declaration (or similar platform-specific declaration) in
+output FORTRAN code.
+
+ at cindex short type
+ at code{Short}s can hold values between -32768 and 32767.  @code{Ncgen} converts
+ at code{short} declarations to @code{short} declarations in the output
+C code and to the nonstandard @code{INTEGER*2} declaration in output
+FORTRAN code.
+
+ at cindex long type
+ at code{Long}s can hold values between -2147483648 and 2147483647.
+ at code{Ncgen} converts @code{long} declarations to @code{long}
+declarations in the output C code and to @code{INTEGER} declarations in
+output FORTRAN code.  In CDL declarations @code{int} and @code{integer}
+are accepted as synonyms for @code{long}.
+
+ at cindex float data type
+ at code{Float}s 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.  @code{Ncgen} converts
+ at code{float} declarations to @code{float} declarations in the output C
+code and to @code{REAL} declarations in output FORTRAN code.  
+In CDL declarations @code{real} is accepted as a synonym for @code{float}.
+
+ at cindex double type
+ at code{Double}s 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.  @code{Ncgen}
+converts @code{double} declarations to double declarations in the
+output C code and to @code{DOUBLE PRECISION} declarations in output
+FORTRAN code.
+
+ at node CDL Constants, ncgen, CDL Data Types, Utilities
+ at section CDL Notation for Data Constants
+
+ at cindex future changes planned
+ at cindex CDL constants
+ at findex ncdump
+ at findex ncgen
+This section explains the CDL notation for netCDF constants.
+
+ at cindex CDL attribute initialization
+ at cindex attribute type
+ at cindex attribute length
+Attributes are initialized in the @code{variables} section of a CDL description
+by providing a list of constants that determines the attribute's type
+and length.  (In the C and FORTRAN procedural interfaces to the netCDF
+library, the type and length of an attribute must be explicitly provided
+when it is defined.)  Since neither C nor FORTRAN provide suitable
+standard syntax to distinguish between constants of type @code{byte} and
+ at code{char}, @code{short} and @code{long}, or @code{float} and
+ at code{double} (except that FORTRAN provides the latter), CDL defines a
+syntax for constant values that allows it to determine the netCDF type
+of any constant.
+ at cindex double type
+ at cindex float type
+ at cindex long type
+ at cindex short type
+ at cindex CDL constants
+The syntax for CDL constants is similar to C syntax, except that type
+suffixes are appended to @code{short}s and @code{float}s to distinguish
+them from @code{long}s and @code{double}s.
+
+ at cindex byte type
+ at cindex byte constant
+A @code{byte} constant is represented by a single character or multiple
+character escape sequence enclosed in single quotes.  For example:
+ at example
+'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, a non-ASCII byte
+ at end example
+
+ at cindex character type
+ at cindex character constant
+Character constants are enclosed in double quotes.  A character array
+may be represented as a string enclosed in double quotes.  Multiple
+strings are concatenated into a single array of characters, permitting
+long character arrays to appear on multiple lines.  To support multiple
+variable-length string values, a conventional delimiter such as @samp{,}
+may be used, but interpretation of any such convention for a string
+delimiter must be implemented in software above the netCDF library
+layer.  The usual escape conventions for C strings are honored.  For
+example:
+ at example
+"a"            // ASCII `a'
+"Two\nlines\n" // a 10-character string with two embedded newlines
+"a bell:\007"  // a string containing an ASCII bell
+"ab","cde"     // the same as "abcde"
+ at end example
+
+ at cindex short type
+ at cindex short constant
+The form of a @code{short} constant is an integer constant with an
+ at samp{s} or @samp{S} appended.  If a @code{short} constant begins with
+ at samp{0}, it is interpreted as octal.  When it begins with
+ at code{0x}, it is interpreted as a hexadecimal constant.  For example:
+ at example
+2s      // a short 2
+0123s   // octal
+0x7ffs  // hexadecimal
+ at end example
+
+ at cindex long type
+ at cindex long constant
+The form of a @code{long} constant is an ordinary integer constant,
+although it is acceptable to append an optional @samp{l} or @samp{L}.
+If a @code{long} constant begins with @samp{0}, it is interpreted as
+octal.  When it begins with @code{0x}, it is interpreted as a
+hexadecimal constant.  Examples of valid @code{long} constants include:
+ at example
+-2
+1234567890L
+0123            // octal
+0x7ff           // hexadecimal
+ at end example
+
+ at cindex float type
+ at cindex float constant
+The @code{float} type is appropriate for representing
+data with about seven significant digits of precision.
+The form of a @code{float} constant is the same as a C floating-point constant
+with an @samp{f} or @samp{F} appended.  A decimal point is required in a CDL
+ at code{float} to distinguish it from an integer.  For example,
+the following are all acceptable @code{float} constants:
+ at example
+-2.0f
+3.14159265358979f       // will be truncated to less precision
+1.f
+.1f
+ at end example
+
+ at cindex double type
+ at cindex double constant
+The @code{double} type is appropriate for representing floating-point
+data with about 16 significant digits of precision.  The form of a
+ at code{double} constant is the same as a C floating-point constant.  An
+optional @samp{d} or @samp{D} may be appended.  A decimal point is
+required in a CDL @code{double} to distinguish it from an
+ at code{integer}.  For example, the following are all acceptable double
+constants:
+ at sp 2
+ at example
+-2.0
+3.141592653589793
+1.0e-20
+1.d
+ at end example
+
+ at node ncgen, ncdump, CDL Constants, Utilities
+ at section ncgen
+
+ at findex ncgen
+ at cindex CDL
+ at cindex C, generation of
+ at cindex FORTRAN, generation of
+ at cindex CDF Description Language
+ at cindex generating code
+ at cindex generating netCDF files
+The @code{ncgen} tool generates a netCDF file or the C or FORTRAN
+programs required to create the netCDF file.  If no options are 
+specified in invoking @code{ncgen}, the program merely checks the 
+syntax of the CDL input, producing error messages for any violations 
+of CDL syntax.  Other options can be used to create a netCDF file 
+or to generate a program in C or FORTRAN that calls the routines 
+required to create the netCDF file.
+
+UNIX syntax for invoking @code{ncgen}:
+ at example
+ncgen [-b] [-o @var{output-file}] [-c] [-f] [-n] [@var{input-file}]
+ at end example
+ at noindent
+where:
+ at table @samp
+ at cindex netCDF file extension
+ at item -b
+Create a (binary) netCDF file.  If the @samp{-o} option is absent, a
+default file name will be constructed from the netCDF name (specified
+after the @code{netcdf} keyword in the input) by appending the
+ at samp{.nc} extension.  If a file already exists with the specified name
+it will be overwritten.
+
+ at item -o outputfile
+Name for the netCDF file created.  If this option is specified, it
+implies the @samp{-b} option.  (This option is necessary because netCDF
+files are direct-access files created with seek calls, and
+hence cannot be written to standard output.)
+
+ at item -c
+Generate C source code that will create a netCDF file matching the
+netCDF specification.  The C source code is written to standard output.
+
+ at item -f
+Generate FORTRAN source code that will create a netCDF file matching the
+netCDF specification.  The FORTRAN source code is written to standard
+output.
+
+ at item -n
+Like the @samp{-b} option, except creates a netCDF file with the
+obsolete @samp{.cdf} extension instead of the @samp{.nc} extension, in
+the absence of an output filename specified by the @samp{-O} option.
+This option is only supported for backward compatibility.
+ at end table
+
+ at unnumberedsubsec Examples
+
+Check the syntax of the CDL file @file{foo.cdl}:
+ at example 
+ncgen foo.cdl
+ at end example
+
+From the CDL file @file{foo.cdl}, generate an equivalent binary netCDF file
+named @file{flu.nc}:
+ at example 
+ncgen -o flu.nc foo.cdl
+ at end example
+
+From the CDL file @file{foo.cdl}, generate a C program containing the
+netCDF function invocations necessary to create an equivalent binary netCDF
+file named @file{flu.nc}:
+ at example 
+ncgen -c -o flu.nc foo.cdl
+ at end example
+
+ at node ncdump,  , ncgen, Utilities
+ at section ncdump
+
+ at findex ncdump
+ at findex ncgen
+The @code{ncdump} tool generates an ASCII representation of a netCDF
+file on standard output, either with or without an ASCII representation
+of the variable data in the file.  The ASCII representation used is the
+CDL notation that @code{ncgen} accepts as input.  Thus @code{ncdump} and
+ at code{ncgen} can be used as inverses to transform data representation
+between binary and ASCII representations.  
+
+ at code{ncdump} 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.
+
+ at code{ncdump} defines a default format used for each type of netCDF
+variable data, but this can be overridden if a @code{C_format} attribute is
+defined for a netCDF variable.  In this case, @code{ncdump} will use the
+ at code{C_format} attribute to format values for that variable.  For example,
+if floating-point data for the netCDF variable @code{Z} is known to be
+accurate to only three significant digits, it would be appropriate to
+use the variable attribute
+ at example
+Z:C_format = "%.3g"
+ at end example
+
+UNIX syntax for invoking @code{ncdump}:
+ at example
+ncdump  [ -c | -h]  [-v @var{var1}, at dots{}]  [-b @var{lang}]  [-f @var{lang}]
+[-l @var{len}]  [ -d fdig[,ddig]] [ -n @var{name}]  [@var{input-file}]
+ at end example
+ at noindent
+where:
+ at table @samp
+
+ at item -c
+Show the values of @dfn{coordinate} 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 often
+the most suitable option to use for a brief look at the structure and
+contents of a netCDF file.
+
+ at item -h
+Show only the @dfn{header} information in the output, that is, output
+only the declarations for the netCDF dimensions, variables, and
+attributes of the input file, but no data values for any variables.  The
+output is identical to using the @samp{-c} option except that the values
+of coordinate variables are not included.  (At most one of @samp{-c} or
+ at samp{-h} options may be present.)
+
+ at item -v var1, at dots{}
+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 @samp{-c} or @samp{-h} options, is to include data values for @emph{all}
+variables in the output.
+
+ at item -b lang
+A brief annotation in the form of a CDL comment (text beginning with the
+characters @samp{//}) will be included in the data section of the output
+for each `row' of data, to help identify data values for
+multidimensional variables.  If @var{lang} begins with @samp{C} or
+ at samp{c}, then C language conventions will be used (zero-based indices,
+last dimension varying fastest).  If @var{lang} begins with @samp{F} or
+ at samp{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.
+
+ at item -f lang
+Full annotations in the form of trailing CDL comments (text beginning
+with the characters @samp{//}) for every data value (except individual
+characters in character arrays) will be included in the data section.
+If @var{lang} begins with @samp{C} or @samp{c}, then C language
+conventions will be used (zero-based indices, last dimension varying
+fastest).  If @var{lang} begins with @samp{F} or @samp{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.
+
+ at item -l len
+Changes the default maximum line length (80) used in formatting lists of
+non-character data values.
+
+ at item -d float_digits[,double_digits]
+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
+ at var{float_digits} significant digits.  If @var{double_digits} is also
+specoified, 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
+ at samp{-d} 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.
+
+ at item -n name
+CDL requires a name for a netCDF data set, for use by @samp{ncgen -b} in
+generating a default netCDF file name.  By default, @code{ncdump}
+constructs this name from the last component of the pathname of the
+input netCDF file by stripping off any extension it has.  Use the
+ at samp{-n} option to specify a different name.  Although the output file
+name used by @samp{ncgen -b} can be specified, it may be wise to have
+ at code{ncdump} change the default name to avoid inadvertantly overwriting
+a valuable netCDF file when using @code{ncdump}, editing the resulting
+CDL file, and using @samp{ncgen -b} to generate a new netCDF file from
+the edited CDL file.
+ at end table
+
+ at unnumberedsubsec Examples
+
+Look at the structure of the data in the netCDF file @file{foo.nc}:
+ at example 
+ncdump -c foo.nc
+ at end example
+
+Produce an annotated CDL version of the structure and data in the
+netCDF file @file{foo.nc}, using C-style indexing for the annotations:
+ at example 
+ncdump -b c foo.nc > foo.cdl
+ at end example
+
+Output data for only the variables @code{uwind} and @code{vwind} from
+the netCDF file @file{foo.nc}, and show the floating-point data with
+only three significant digits of precision:
+ at example 
+ncdump -v uwind,vwind -d 3 foo.nc
+ at end example
+
+Produce a fully-annotated (one data value per line) listing of the data
+for the variable @code{omega}, using Fortran conventions for indices,
+and changing the netCDF dataset name in the resulting CDL file to
+ at code{omega}:
+ at example 
+ncdump -v omega -f fortran -n omega foo.nc > Z.cdl
+ at end example
+
+ at node FAQ, C Interface, Utilities, Top
+ at chapter Answers to Some Frequently Asked Questions
+
+Here we collect, in one place, answers to some of the most frequently
+asked questions about netCDF availability and support.  A more
+comprehensive and up-to-date list of answers to frequently asked
+questions about netCDF is maintained in a file available for anonymous
+FTP access from:
+ at example
+host:  unidata.ucar.edu
+file:  pub/netcdf/FAQ
+ at end example
+
+ at menu
+* What is netCDF?::       
+* How to get it::         Availability of the netCDF software
+* Platforms::             What platforms it runs on
+* netCDF and CDF::        Connection with NASA's Common Data Format
+* netCDF and HDF::        Connection with NCSA's Hierarchical Data Format
+* pub/netcdf::            Some files with volatile netCDF information
+* XDR error messages::    Why occasional error messages from XDR layer
+* representing data::     Ways to represent data in netCDF
+* data compression::      Data compression in netCDF
+* Other utilities::             What netCDF utilities exist
+* mailing list::          The netCDF mailing lists
+* bug reports::           Where to send bug reports
+* Popularity::            Is netCDF widely used?
+* WAIS/gopher access::    WIAS or gopher access to netCDF information
+ at end menu
+
+ at node What is netCDF?, How to get it,  , FAQ
+ at unnumberedsec What is netCDF?
+
+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:
+
+ at itemize @bullet
+ at item
+Self-Describing.  A netCDF file includes information about the data it
+contains.
+ at item
+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.
+ at item
+Direct-access.  A small subset of a large dataset may be accessed
+efficiently, without first reading through all the preceding data.
+ at item
+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.
+ at item
+Sharable.  One writer and multiple readers may simultaneously access
+the same netCDF file.
+ at end itemize
+
+ at node How to get it, Platforms, What is netCDF?, FAQ
+ at unnumberedsec How do I get the netCDF software package?
+
+ at cindex obtaining netCDF software
+ at cindex FTP access
+Via anonymous FTP from
+ at example
+host:       unidata.ucar.edu
+file:       pub/netcdf/netcdf.tar.Z
+ at end example
+
+Make sure the file is transmitted in BINARY mode.  This is version 2.3,
+last updated in February 1993, or later.
+
+ at node Platforms, netCDF and CDF, How to get it, FAQ
+ at unnumberedsec What does netCDF run on?
+
+ at cindex computing environments
+ at cindex ports of netCDF
+ at cindex platforms
+Version 2.3 of netCDF has been tested on the following platforms:
+ at itemize @bullet
+ at item
+SPARCstation, SunOS 4.1.3
+ at item
+DECstation or VAXstation, Ultrix 4.3
+ at item
+VAXstation, VMS
+ at item
+IBM RS-6000, AIX 3.x
+ at item
+IBM PS/2, MSDOS 5.0
+ at item
+IBM PS/2, OS/2
+ at item
+CRAY YMP, UNICOS
+ at item
+SGI, IRIX
+ at item
+HP, HPUX
+ at end itemize
+
+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).
+
+ at node netCDF and CDF, netCDF and HDF, Platforms, FAQ
+ at unnumberedsec What is the connection between netCDF and CDF?
+
+ at cindex CDF
+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).
+
+ at node netCDF and HDF, pub/netcdf, netCDF and CDF, FAQ
+ at unnumberedsec What is the connection between netCDF and HDF?
+
+ at cindex HDF
+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.
+
+ at node pub/netcdf, XDR error messages, netCDF and HDF, FAQ
+ at unnumberedsec What are the files in pub/netcdf/ on unidata.ucar.edu?
+ at cindex information files
+ at table @file
+ at item README
+general information about netCDF
+
+ at item FAQ
+this file of frequently asked questions
+
+ at item utilities.txt
+a list of software packages currently available or under development for
+manipulating and displaying netCDF data
+
+ at item 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.
+
+ at item ncprogs.ps
+a draft PostScript document describing an initial set of netCDF operator
+and utility programs under development
+
+ at item ncprogs.txt
+an ASCII version of ncprogs.ps
+
+ at item conventions.info
+a draft document of some proposed netCDF conventions
+
+ at item cdl/
+a directory containing some examples of CDL files (an ASCII
+representation for netCDF files).
+
+ at item 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.
+
+ at item 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.
+ at end table
+
+ at node XDR error messages, representing data, pub/netcdf, FAQ
+ at unnumberedsec Why do I get XDR error messages when trying to write data?
+ at cindex XDR errors
+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.
+
+ at node representing data, data compression, XDR error messages, FAQ
+ at unnumberedsec What's the best way to represent data using netCDF?
+
+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 (@xref{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.
+
+ at node data compression, Other utilities, representing data, FAQ
+ at unnumberedsec Are there plans to add facilities for data compression to netCDF?
+
+We have no plans to add data compression to netCDF (although we do plan
+to eventually add a form of transparent data packing on write and
+unpacking on read whenever the reserved attributes @code{_Nbits},
+ at code{_Scale}, and @code{_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.
+ at example
+x:compression = "rle" ;
+ at end example
+for run-length encoding of the data in a variable @code{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.
+
+ at node Other utilities, mailing list, data compression, FAQ
+ at unnumberedsec What utilities are available for netCDF?
+
+The only utilities available in the current netCDF distribution 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 a few general-purpose netCDF operators, is available from
+ at code{unidata.ucar.edu} in the file @file{ncopers.tar.Z}.  See the
+description of the file @file{utilities.txt} in the answer to the
+question above on important files in @file{/pub/netcdf} on
+ at code{unidata.ucar.edu} for more information.
+
+ at node mailing list, bug reports, Other utilities, FAQ
+ at unnumberedsec Is there a mailing list for netCDF discussions and questions?
+
+Yes - there are two.  The mailing list
+ at code{netcdfgroup@@unidata.ucar.edu} has over two hundred readers and
+gateways; you can subscribe or unsubscribe to the mailing list by
+sending mail to @code{netcdfgroup-adm@@unidata.ucar.edu}.
+
+If you would prefer to get only a single daily digest of the postings to
+the @code{netcdfgroup} mailing list, subscribe instead to the
+ at code{netcdfdigest} mailing list by sending a request to
+ at code{netcdfdigest-adm@@unidata.ucar.edu}.
+
+All the postings to the @code{netcdfgroup} mailing list are archived in the
+file @file{mail-archives/netcdfgroup} available via anonymous FTP from
+ at code{unidata.ucar.edu}.
+
+ at node bug reports, Popularity, mailing list, FAQ
+ at unnumberedsec How do I make a bug report?
+
+If you find a bug, please send a description to
+ at code{support@@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
+ at code{netcdfgroup} mailing list.
+
+ at node Popularity, WAIS/gopher access, bug reports, FAQ
+ at unnumberedsec How widely is netCDF used?
+
+We don't really know, but the netcdfgroup and netcdfdigest mailing lists
+have 260 addresses, some of which are aliases to more addresses, in
+fourteen countries.  Users in several groups have adopted netCDF as a
+standard way to represent at least some kinds of scientific datasets.
+
+ at node WAIS/gopher access,  , Popularity, FAQ
+ at unnumberedsec Is there any WAIS or gopher access to netCDF information?
+
+Yes, @file{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, @file{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.
+
+
+ at node C Interface, Fortran Interface, FAQ, Top
+ at appendix Summary of C Interface
+
+ at example
+int nccreate (const char* path, int cmode);
+int ncopen (const char* path, int mode);
+int ncredef (int ncid);
+int ncendef (int ncid);
+int ncclose (int ncid);
+int ncinquire (int ncid, int* ndims, int* nvars, int* natts, int* recdim);
+int ncsync (int ncid);
+int ncabort (int ncid);
+int ncdimdef (int ncid, const char* name, long length);
+int ncdimid (int ncid, const char* name);
+int ncdiminq (int ncid, int dimid, char* name, long* length);
+int ncdimrename (int ncid, int dimid, const char* name);
+int ncvardef (int ncid, const char* name, nc_type datatype, int ndims, 
+              const int dimids[]);
+int ncvarid (int ncid, const char* name);
+int ncvarinq (int ncid, int varid, char* name, nc_type* datatype, int* ndims,
+              int dimids[], int* natts);
+int ncvarput1 (int ncid, int varid, const long coords[], const void* value);
+int ncvarget1 (int ncid, int varid, const long coords[], void* value);
+int ncvarput (int ncid, int varid, const long start[], const long count[],
+              const void* value);
+int ncvarget (int ncid, int varid, const long start[], const long count[],
+              void* value);
+int ncvarputg (int ncid, int varid, const long start[], const long count[],
+              const long stride[], const long imap[], const void* value);
+int ncvargetg (int ncid, int varid, const long start[], const long count[],
+              const long stride[], const long imap[], void* value);
+int ncvarrename (int ncid, int varid, const char* name);
+int ncattput (int ncid, int varid, const char* name, nc_type datatype, int len,
+              const void* value);
+int ncattinq (int ncid, int varid, const char* name, nc_type* datatype,
+              int* len);
+int ncattget (int ncid, int varid, const char* name, void* value);
+int ncattcopy (int incdf, int invar, const char* name, int outcdf, int outvar);
+int ncattname (int ncid, int varid, int attnum, char* name);
+int ncattrename (int ncid, int varid, const char* name, const char* newname);
+int ncattdel (int ncid, int varid, const char* name);
+int nctypelen (nc_type datatype);
+int ncsetfill (int ncid, int fillmode);
+int ncrecput(int ncid, long recnum, void* const datap[]);
+int ncrecget(int ncid, long recnum, void* datap[]);
+int ncrecinq(int ncid, int *nrecvars, int recvarids[], long recsizes[]);
+ at end example
+
+ at node Fortran Interface, Units, C Interface, Top
+ at appendix Summary of FORTRAN Interface
+
+Input parameters are in upper case, output parameters are in lower
+case.  The FORTRAN types of all the parameters are listed below the
+subroutine and function declarations.
+
+ at example
+INTEGER FUNCTION NCCRE (PATHNAME,CLOBMODE, rcode)
+INTEGER FUNCTION NCOPN (PATHNAME,RWMODE, rcode)
+SUBROUTINE NCREDF (NCID, rcode)
+SUBROUTINE NCENDF (NCID, rcode)
+SUBROUTINE NCCLOS (NCID, rcode)
+SUBROUTINE NCINQ (NCID, ndims,nvars,natts,recdim,rcode)
+SUBROUTINE NCSNC (NCID, rcode)
+SUBROUTINE NCABOR (NCID, rcode)
+INTEGER FUNCTION NCDDEF (NCID,DIMNAME,SIZE, rcode)
+INTEGER FUNCTION NCDID (NCID,DIMNAME, rcode)
+SUBROUTINE NCDINQ (NCID,DIMID, dimname,size,rcode)
+SUBROUTINE NCDREN (NCID,DIMID,DIMNAME, rcode)
+INTEGER FUNCTION NCVDEF (NCID,VARNAME,DATATYPE,NVDIMS,VDIMS, rcode)
+INTEGER FUNCTION NCVID (NCID,VARNAME, rcode)
+SUBROUTINE NCVINQ (NCID,VARID, varname,datatype,nvdims,vdims,nvatts,rcode)
+SUBROUTINE NCVPT1 (NCID,VARID,INDICES,VALUE, rcode)
+SUBROUTINE NCVP1C (NCID,VARID,INDICES, CHVAL, rcode)
+SUBROUTINE NCVGT1 (NCID,VARID,INDICES, value, rcode)
+SUBROUTINE NCVG1C (NCID,VARID,INDICES, chval, rcode)
+SUBROUTINE NCVPT (NCID,VARID,START,COUNTS,VALUE, rcode)
+SUBROUTINE NCVPTC (NCID,VARID,START,COUNTS,STRING,LENSTR, rcode)
+SUBROUTINE NCVPTG (NCID,VARID,START,COUNTS,STRIDE,IMAP,VALUE, rcode)
+SUBROUTINE NCVPGC (NCID,VARID,START,COUNTS,STRIDE,IMAP,STRING,rcode)
+SUBROUTINE NCVGT (NCID,VARID,START,COUNTS, value,rcode)
+SUBROUTINE NCVGTC (NCID,VARID,START,COUNTS, string,LENSTR,rcode)
+SUBROUTINE NCVGTG (NCID,VARID,START,COUNTS,STRIDE,IMAP,value,rcode)
+SUBROUTINE NCVGGC (NCID,VARID,START,COUNTS,STRIDE,IMAP,string,rcode)
+SUBROUTINE NCVREN (NCID,VARID,VARNAME, rcode)
+SUBROUTINE NCAPT (NCID,VARID,ATTNAME,DATATYPE,ATTLEN,VALUE, rcode)
+SUBROUTINE NCAPTC (NCID,VARID,ATTNAME,DATATYPE,LENSTR,string, rcode)
+SUBROUTINE NCAINQ (NCID,VARID,ATTNAME, datatype,attlen,rcode)
+SUBROUTINE NCAGT (NCID,VARID,ATTNAME, value,rcode)
+SUBROUTINE NCAGTC (NCID,VARID,ATTNAME, string,LENSTR,rcode)
+SUBROUTINE NCACPY (INNCID,INVARID,ATTNAME,OUTNCID,OUTVARID, rcode)
+SUBROUTINE NCANAM (NCID,VARID,ATTNUM, attname,rcode)
+SUBROUTINE NCAREN (NCID,VARID,ATTNAME,NEWNAME, rcode)
+SUBROUTINE NCADEL (NCID,VARID,ATTNAME, rcode)
+INTEGER FUNCTION NCTLEN (DATATYPE, rcode)
+SUBROUTINE NCPOPT (NCOPTS)
+SUBROUTINE NCGOPT (ncopts)
+INTEGER FUNCTION NCSFIL (NCID,FILLMODE, rcode)
+
+CHARACTER*(*) PATHNAME  ! absolute or relative name of netCDF file
+INTEGER CLOBMODE        ! either NCCLOB or NCNOCLOB
+INTEGER RWMODE          ! either NCWRITE or NCNOWRIT
+INTEGER RCODE           ! returned error code, 0 if no errors
+INTEGER NCID            ! netCDF ID, returned by NCCRE or NCOPN
+INTEGER NDIMS           ! number of dimensions in netCDF
+INTEGER NVARS           ! number of variables in netCDF
+INTEGER NATTS           ! number of global attributes in netCDF
+INTEGER RECDIM          ! dimension ID of unlimited dimension
+CHARACTER*(*) DIMNAME   ! name for dimension
+INTEGER SIZE            ! size of dimension
+INTEGER DIMID           ! dimension ID from NCDDEF or NCDID
+CHARACTER*(*) VARNAME   ! name for variable
+INTEGER DATATYPE        ! data type code, one of NCBYTE, @dots{}, NCDOUBLE
+INTEGER NVDIMS          ! number of dimensions in a variable
+INTEGER VDIMS(NDIMS)    ! dimension IDs for a variable, giving its shape
+INTEGER VARID           ! variable ID from NCVDEF or NCVID, or NCGLOBAL
+INTEGER NVATTS          ! number of attributes assigned to a variable
+INTEGER INDICES(NDIMS)  ! coordinates of a single element of a variable
+CHARACTER CHVAL         ! character value of variable or attribute
+CHARACTER*(*) STRING    ! character array value of variable or attribute
+INTEGER LENSTR          ! length of character array value
+DOUBLE VALUE            ! double precision value of variable or attribute
+REAL VALUE              ! real value of variable or attribute
+INTEGER VALUE           ! integer value of variable or attribute
+INTEGER START(NVDIMS)   ! corner of hyperslab of values of a variable
+INTEGER COUNTS(NVDIMS)  ! edge lengths of hyperslab of values
+INTEGER STRIDE(NVDIMS)  ! netCDF variable dimensional strides
+INTEGER IMAP(NVDIMS)    ! index mapping vector
+CHARACTER*(*) ATTNAME   ! attribute name
+INTEGER ATTLEN          ! number of elements in an attribute vector
+INTEGER INNCID          ! input netCDF ID
+INTEGER INVARID         ! input variable ID
+INTEGER OUTNCID         ! output netCDF ID
+INTEGER OUTVARID        ! output variable ID
+INTEGER ATTNUM          ! attribute number
+CHARACTER*(*) NEWNAME   ! new attribute name
+INTEGER FILLMODE        ! NCNOFILL or NCFILL, for setting fill mode
+ at end example
+
+ at node Units, Name Index, Fortran Interface, Top
+ at appendix Units
+
+The Unidata Program Center has developed a units library to 
+convert between
+formatted and binary forms of units specifications and perform unit
+algebra on the binary form.  
+Though the units library is self-contained and there is no dependency 
+between it and the netCDF library, it is nevertheless useful in writing
+generic netCDF programs and we suggest you obtain it.
+A compressed tar file for the library is
+available from the file @code{pub/sdm/udunits<version>.tar.Z} in the 
+anonymous FTP directory of @code{unidata.ucar.edu}.
+
+The following are examples of units strings that can be interpreted by
+the @code{utScan()} function of the Unidata units library:
+ at example
+10 kilogram.meters/seconds2
+10 kg-m/sec2
+10 kg m/s^2
+10 kilogram meter second-2
+(PI radian)2
+degF
+100rpm
+geopotential meters
+33 feet water
+milliseconds since 1992-12-31 12:34:0.1 -7:00
+ at end example
+
+A unit is specified as an arbitrary product of constants and unit-names
+raised to arbitrary integral powers.  Division is indicated by a slash
+ at samp{/}.  Multiplication is indicated by whitespace, a period @samp{.},
+or a hyphen @samp{-}.  Exponentiation is indicated by an integer suffix
+or by the exponentiation operators @samp{^} and @samp{**}.  Parentheses
+may be used for grouping and disambiguation.  The timestamp in the last
+example is handled as a special case.
+
+Arbitrary Galilean transformations (i.e. @emph{y = ax + b}) are
+allowed.  In particular, temperature conversions are
+correctly handled.  The specification:
+
+ at example
+degF @@ 32
+ at end example
+
+indicates a Fahrenheit scale with the origin shifted to
+thirty-two degrees Fahrenheit (i.e. to zero Celsius).  Thus,
+the Celsius scale is equivalent to the following unit:
+
+ at example
+1.8 degF @@ 32
+ at end example
+
+Note that the origin-shift operation takes precedence over
+multiplication.  In order of increasing precedence, the
+operations are division, multiplication, origin-shift, and
+exponentiation.
+
+ at code{utScan()} understands all the SI prefixes (e.g.  "mega" and
+"milli") plus their abbreviations (e.g. "M" and "m")
+
+The function utPrint() always encodes a unit specification
+one way.  To reduce misunderstandings, it is recommended
+that this encoding style be used as the default. In general,
+a unit is encoded in terms of basic units, factors, and
+exponents.  Basic units are separated by spaces, and any
+exponent directly appends its associated unit.  The above
+examples would be encoded as follows:
+
+ at example
+10 kilogram meter second-2
+9.8696044 radian2
+0.555556 kelvin @@ 255.372
+10.471976 radian second-1
+9.80665 meter2 second-2
+98636.5 kilogram meter-1 second-2
+0.001 seconds since 1992-12-31 19:34:0.1000 UTC
+ at end example
+
+(Note that the Fahrenheit unit is encoded as a deviation, in
+fractional kelvins, from an origin at 255.372 kelvin, and that the time
+in the last example has been referenced to UTC.)
+
+The database for the units library is a formatted file containing unit 
+definitions and is
+used to initialize this package.  It is the first place to look to
+discover the set of valid names and symbols.
+
+The format for the units-file is documented internally and the file may be
+modified by the user as necessary.  In particular, additional units and
+constants may be easily added (including variant spellings of existing
+units or constants).
+
+ at code{utScan()} is case-sensitive.  If this causes difficulties, you
+might try making appropriate additional entries to the
+units-file.
+
+Some unit abbreviations in the default units-file might seem
+counter-intuitive.  In particular, note the following:
+
+ at example
+For       Use               Not     Which Instead Means
+
+Celsius   `Celsius'         `C'     coulomb
+gram      `gram'            `g'     <standard free fall>
+gallon    `gallon'          `gal'   <acceleration>
+radian    `radian'          `rad'   <absorbed dose>
+Newton    `newton' or `N'   `nt'    nit (unit of photometry)
+ at end example
+
+For additional information on this units library, please consult the manual
+pages that come with the distribution.
+
+ at node Name Index, General Index, Units, Top
+ at unnumbered Function and Variable Index
+
+ at printindex fn
+
+ at node General Index,  , Name Index, Top
+ at unnumbered General Index
+
+ at printindex cp
+
+
+ at c Print the tables of contents
+ at contents
+
+ at c That's all
+ at bye

Added: packages/libhdf4/branches/upstream/current/mfhdf/doc/texindex.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/doc/texindex.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/doc/texindex.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1592 @@
+/* Prepare Tex index dribble output into an actual index.
+   Copyright (C) 1987 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ In other words, you are welcome to use, share and improve this program.
+ You are forbidden to forbid anyone else to use, share and improve
+ what you give them.   Help stamp out software-hoarding!  */
+
+
+#include <stdio.h>
+#include <ctype.h>
+
+#ifdef VMS
+#include <file.h>
+
+#define EXIT_SUCCESS ((1 << 28) | 1)
+#define EXIT_FATAL ((1 << 28) | 4)
+#define unlink delete
+#define tell(fd) lseek(fd, 0L, 1)
+#else
+#include <sys/file.h>
+
+#define EXIT_SUCCESS 0
+#define EXIT_FATAL 1
+#endif
+
+
+#ifndef L_XTND
+#define L_XTND 2
+#endif
+
+/* When sorting in core, this structure describes one line
+ and the position and length of its first keyfield.  */
+
+struct lineinfo
+  {
+    char *text;		/* The actual text of the line */
+    union
+      {			/* The start of the key (for textual comparison) */
+	char *text;
+	long number;	/* or the numeric value (for numeric comparison) */
+      } key;
+    long keylen;	/* Length of key field */
+  };
+
+/* This structure describes a field to use as a sort key */
+
+struct keyfield
+  {
+    int startwords;		/* # words to skip  */
+    int startchars;		/*  and # additional chars to skip, to start of field */
+    int endwords;		/* similar, from beg (or end) of line, to find end of field */
+    int endchars;
+    char ignore_blanks;		/* Ignore spaces and tabs within the field */
+    char fold_case;		/* Convert upper case to lower before comparing */
+    char reverse;		/* Compare in reverse order */
+    char numeric;		/* Parse text as an integer and compare the integers */
+    char positional;		/* Sort according to position within the file */
+    char braced;		/* Count balanced-braced groupings as fields */
+  };
+
+/* Vector of keyfields to use */
+
+struct keyfield keyfields[3];
+
+/* Number of keyfields stored in that vector.  */
+
+int num_keyfields = 3;
+
+/* Vector of input file names, terminated with a zero (null pointer) */
+
+char **infiles;
+
+/* Vector of corresponding output file names, or zero meaning default it */
+
+char **outfiles;
+
+/* Length of `infiles' */
+
+int num_infiles;
+
+/* Pointer to the array of pointers to lines being sorted */
+
+char **linearray;
+
+/* The allocated length of `linearray'. */
+
+long lines;
+
+/* Directory to use for temporary files.  On Unix, it ends with a slash.  */
+
+char *tempdir;
+
+/* Start of filename to use for temporary files.  */
+
+char *tempbase;
+
+/* Number of last temporary file.  */
+
+int tempcount;
+
+/* Number of last temporary file already deleted.
+ Temporary files are deleted by `flush_tempfiles' in order of creation.  */
+
+int last_deleted_tempcount;
+
+/* During in-core sort, this points to the base of the data block
+ which contains all the lines of data.  */
+
+char *text_base;
+
+/* Additional command switches */
+
+int keep_tempfiles;	/* Nonzero means do not delete tempfiles -- for debugging */
+
+/* Forward declarations of functions in this file */
+
+void decode_command ();
+void sort_in_core ();
+void sort_offline ();
+char **parsefile ();
+char *find_field ();
+char *find_pos ();
+long find_value ();
+char *find_braced_pos ();
+char *find_braced_end ();
+void writelines ();
+int compare_full ();
+long readline ();
+int merge_files ();
+int merge_direct ();
+char *concat ();
+char *maketempname ();
+void flush_tempfiles ();
+char *tempcopy ();
+
+extern char *mktemp ();
+
+#define MAX_IN_CORE_SORT 500000
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int i;
+
+  tempcount = 0;
+  last_deleted_tempcount = 0;
+
+  /* Describe the kind of sorting to do. */
+  /* The first keyfield uses the first braced field and folds case */
+  keyfields[0].braced = 1;
+  keyfields[0].fold_case = 1;
+  keyfields[0].endwords = -1;
+  keyfields[0].endchars = -1;
+  /* The second keyfield uses the second braced field, numerically */
+  keyfields[1].braced = 1;
+  keyfields[1].numeric = 1;
+  keyfields[1].startwords = 1;
+  keyfields[1].endwords = -1;
+  keyfields[1].endchars = -1;
+  /* The third keyfield (which is ignored while discarding duplicates)
+     compares the whole line */
+  keyfields[2].endwords = -1;
+  keyfields[2].endchars = -1;
+
+  decode_command (argc, argv);
+
+  tempbase = mktemp (concat ("txiXXXXXX", "", ""));
+
+  /* Process input files completely, one by one.  */
+
+  for (i = 0; i < num_infiles; i++)
+    {
+      int desc;
+      long ptr;
+      char *outfile;
+      char *p;
+
+      desc = open (infiles[i], 0, 0);
+      if (desc < 0) pfatal_with_name (infiles[i]);
+      lseek (desc, 0, L_XTND);
+      ptr = tell (desc);
+      close (desc);
+
+      outfile = outfiles[i];
+      if (!outfile)
+	{
+	  outfile = concat (infiles[i], "s", "");
+	}
+
+      if (ptr < MAX_IN_CORE_SORT)
+        /* Sort a small amount of data */
+        sort_in_core (infiles[i], ptr, outfile);
+      else
+        sort_offline (infiles[i], ptr, outfile);
+    }
+
+  flush_tempfiles (tempcount);
+  exit (EXIT_SUCCESS);
+}
+
+/* This page decodes the command line arguments to set the parameter variables
+ and set up the vector of keyfields and the vector of input files */
+
+void
+decode_command (argc, argv)
+     int argc;
+     char **argv;
+{
+  int i;
+  char **ip;
+  char **op;
+
+  /* Store default values into parameter variables */
+
+#ifdef VMS
+  tempdir = "sys$scratch:";
+#else
+  tempdir = "/tmp/";
+#endif
+
+  keep_tempfiles = 0;
+
+  /* Allocate argc input files, which must be enough.  */
+
+  infiles = (char **) xmalloc (argc * sizeof (char *));
+  outfiles = (char **) xmalloc (argc * sizeof (char *));
+  ip = infiles;
+  op = outfiles;
+
+  /* First find all switches that control the default kind-of-sort */
+
+  for (i = 1; i < argc; i++)
+    {
+      int tem = classify_arg (argv[i]);
+      char c;
+      char *p;
+
+      if (tem <= 0)
+	{
+	  *ip++ = argv[i];
+	  *op++ = 0;
+	  continue;
+	}
+      if (tem > 1)
+	{
+	  if (i + 1 == argc)
+	    fatal ("switch %s given with no argument following it", argv[i]);
+	  else if (!strcmp (argv[i], "-T"))
+	    tempdir = argv[i + 1];
+	  else if (!strcmp (argv[i], "-o"))
+	    *(op - 1) = argv[i + 1];
+	  i += tem - 1;
+	  continue;
+	}
+
+      p = &argv[i][1];
+      while (c = *p++)
+	switch (c)
+	  {
+	  case 'k':
+	    keep_tempfiles = 1;
+	    break;
+
+	  default:
+	    fatal ("invalid command switch %c", c);
+	  }
+    switchdone: ;
+    }
+
+  /* Record number of keyfields, terminate list of filenames */
+
+  num_infiles = ip - infiles;
+  *ip = 0;
+}
+
+/* Return 0 for an argument that is not a switch;
+ for a switch, return 1 plus the number of following arguments that the switch swallows.
+*/
+
+int
+classify_arg (arg)
+     char *arg;
+{
+  if (!strcmp (arg, "-T") || !strcmp (arg, "-o"))
+    return 2;
+  if (arg[0] == '-')
+    return 1;
+  return 0;
+}
+
+/* Create a name for a temporary file */
+
+char *
+maketempname (count)
+     int count;
+{
+  char tempsuffix[10];
+  sprintf (tempsuffix, "%d", count);
+  return concat (tempdir, tempbase, tempsuffix);
+}
+
+/* Delete all temporary files up to the specified count */
+
+void
+flush_tempfiles (to_count)
+     int to_count;
+{
+  if (keep_tempfiles) return;
+  while (last_deleted_tempcount < to_count)
+    unlink (maketempname (++last_deleted_tempcount));
+}
+
+/* Copy an input file into a temporary file, and return the temporary file name */
+
+#define BUFSIZE 1024
+
+char *
+tempcopy (idesc)
+     int idesc;
+{
+  char *outfile = maketempname (++tempcount);
+  int odesc;
+  char buffer[BUFSIZE];
+
+  odesc = open (outfile, O_WRONLY | O_CREAT, 0666);
+
+  if (odesc < 0) pfatal_with_name (outfile);
+
+  while (1)
+    {
+      int nread = read (idesc, buffer, BUFSIZE);
+      write (odesc, buffer, nread);
+      if (!nread) break;
+    }
+
+  close (odesc);
+
+  return outfile;
+}
+
+/* Compare two lines, provided as pointers to pointers to text,
+ according to the specified set of keyfields */
+
+int
+compare_full (line1, line2)
+     char **line1, **line2;
+{
+  int i;
+
+  /* Compare using the first keyfield;
+     if that does not distinguish the lines, try the second keyfield; and so on. */
+
+  for (i = 0; i < num_keyfields; i++)
+    {
+      long length1, length2;
+      char *start1 = find_field (&keyfields[i], *line1, &length1);
+      char *start2 = find_field (&keyfields[i], *line2, &length2);
+      int tem = compare_field (&keyfields[i], start1, length1, *line1 - text_base,
+					      start2, length2, *line2 - text_base);
+      if (tem)
+	{
+	  if (keyfields[i].reverse)
+	    return - tem;
+          return tem;
+	}
+    }
+
+  return 0;    /* Lines match exactly */
+}
+
+/* Compare two lines described by structures
+ in which the first keyfield is identified in advance.
+ For positional sorting, assumes that the order of the lines in core
+ reflects their nominal order.  */
+
+int
+compare_prepared (line1, line2)
+     struct lineinfo *line1, *line2;
+{
+  int i;
+  int tem;
+  char *text1, *text2;
+
+  /* Compare using the first keyfield, which has been found for us already */
+  if (keyfields->positional)
+    {
+      if (line1->text - text_base > line2->text - text_base)
+	tem = 1;
+      else
+	tem = -1;
+    }
+  else if (keyfields->numeric)
+    tem = line1->key.number - line2->key.number;
+  else
+    tem = compare_field (keyfields, line1->key.text, line1->keylen, 0, line2->key.text, line2->keylen, 0);
+  if (tem)
+    {
+      if (keyfields->reverse)
+	return - tem;
+      return tem;
+    }
+
+  text1 = line1->text;
+  text2 = line2->text;
+
+  /* Compare using the second keyfield;
+     if that does not distinguish the lines, try the third keyfield; and so on. */
+
+  for (i = 1; i < num_keyfields; i++)
+    {
+      long length1, length2;
+      char *start1 = find_field (&keyfields[i], text1, &length1);
+      char *start2 = find_field (&keyfields[i], text2, &length2);
+      int tem = compare_field (&keyfields[i], start1, length1, text1 - text_base,
+					      start2, length2, text2 - text_base);
+      if (tem)
+	{
+	  if (keyfields[i].reverse)
+	    return - tem;
+          return tem;
+	}
+    }
+
+  return 0;    /* Lines match exactly */
+}
+
+/* Like compare_full but more general.
+ You can pass any strings, and you can say how many keyfields to use.
+ `pos1' and `pos2' should indicate the nominal positional ordering of
+ the two lines in the input.  */
+
+int
+compare_general (str1, str2, pos1, pos2, use_keyfields)
+     char *str1, *str2;
+     long pos1, pos2;
+     int use_keyfields;
+{
+  int i;
+
+  /* Compare using the first keyfield;
+     if that does not distinguish the lines, try the second keyfield; and so on. */
+
+  for (i = 0; i < use_keyfields; i++)
+    {
+      long length1, length2;
+      char *start1 = find_field (&keyfields[i], str1, &length1);
+      char *start2 = find_field (&keyfields[i], str2, &length2);
+      int tem = compare_field (&keyfields[i], start1, length1, pos1, start2, length2, pos2);
+      if (tem)
+	{
+	  if (keyfields[i].reverse)
+	    return - tem;
+          return tem;
+	}
+    }
+
+  return 0;    /* Lines match exactly */
+}
+
+/* Find the start and length of a field in `str' according to `keyfield'.
+ A pointer to the starting character is returned, and the length
+ is stored into the int that `lengthptr' points to.  */
+
+char *
+find_field (keyfield, str, lengthptr)
+     struct keyfield *keyfield;
+     char *str;
+     long *lengthptr;
+{
+  char *start;
+  char *end;
+  char *(*fun) ();
+
+  if (keyfield->braced) fun = find_braced_pos;
+  else fun = find_pos;
+
+  start = ( *fun )(str, keyfield->startwords, keyfield->startchars,
+	       keyfield->ignore_blanks);
+  if (keyfield->endwords < 0)
+    {
+      if (keyfield->braced)
+	end = find_braced_end (start);
+      else
+	{
+	  end = start;
+	  while (*end && *end != '\n') end++;
+	}
+    }
+  else
+    {
+      end = ( *fun )(str, keyfield->endwords, keyfield->endchars, 0);
+      if (end - str < start - str) end = start;
+    }
+  *lengthptr = end - start;
+  return start;
+}
+
+/* Find a pointer to a specified place within `str',
+ skipping (from the beginning) `words' words and then `chars' chars.
+ If `ignore_blanks' is nonzero, we skip all blanks
+ after finding the specified word.  */
+
+char *
+find_pos (str, words, chars, ignore_blanks)
+     char *str;
+     int words, chars;
+     int ignore_blanks;
+{
+  int i;
+  char *p = str;
+
+  for (i = 0; i < words; i++)
+    {
+      char c;
+      /* Find next bunch of nonblanks and skip them. */
+      while ((c = *p) == ' ' || c == '\t') p++;
+      while ((c = *p) && c != '\n' && !(c == ' ' || c == '\t')) p++;
+      if (!*p || *p == '\n') return p;
+    }
+
+  while (*p == ' ' || *p == '\t') p++;
+
+  for (i = 0; i < chars; i++)
+    {
+      if (!*p  || *p == '\n') break;
+      p++;
+    }
+  return p;
+}
+
+/* Like find_pos but assumes that each field is surrounded by braces
+ and that braces within fields are balanced. */
+
+char *
+find_braced_pos (str, words, chars, ignore_blanks)
+     char *str;
+     int words, chars;
+     int ignore_blanks;
+{
+  int i;
+  int bracelevel;
+  char *p = str;
+  char c;
+
+  for (i = 0; i < words; i++)
+    {
+      bracelevel = 1;
+      while ((c = *p++) != '{' && c != '\n' && c);
+      if (c != '{')
+	return p - 1;
+      while (bracelevel)
+	{
+	  c = *p++;
+	  if (c == '{') bracelevel++;
+	  if (c == '}') bracelevel--;
+	  if (c == '\\') c = *p++;	/* \ quotes braces and \ */
+	  if (c == 0 || c == '\n') return p-1;
+	}
+    }
+
+  while ((c = *p++) != '{' && c != '\n' && c);
+
+  if (c != '{')
+    return p-1;
+
+  if (ignore_blanks)
+    while ((c = *p) == ' ' || c == '\t') p++;
+  
+  for (i = 0; i < chars; i++)
+    {
+      if (!*p  || *p == '\n') break;
+      p++;
+    }
+  return p;
+}
+
+/* Find the end of the balanced-brace field which starts at `str'.
+  The position returned is just before the closing brace. */
+
+char *
+find_braced_end (str)
+     char *str;
+{
+  int bracelevel;
+  char *p = str;
+  char c;
+
+  bracelevel = 1;
+  while (bracelevel)
+    {
+      c = *p++;
+      if (c == '{') bracelevel++;
+      if (c == '}') bracelevel--;
+      if (c == '\\') c = *p++;
+      if (c == 0 || c == '\n') return p-1;
+    }
+  return p - 1;
+}
+
+long
+find_value (start, length)
+     char *start;
+     long length;
+{
+  while (length != 0L) {
+    if (isdigit(*start))
+      return atol(start);
+    length--;
+    start++;
+  }
+  return 0l;
+}
+
+/* Vector used to translate characters for comparison.
+   This is how we make all alphanumerics follow all else,
+   and ignore case in the first sorting.  */
+int char_order[256];
+
+init_char_order ()
+{
+  int i;
+  for (i = 1; i < 256; i++)
+    char_order[i] = i;
+
+  for (i = '0'; i <= '9'; i++)
+    char_order[i] += 512;
+
+  for (i = 'a'; i <= 'z'; i++) {
+    char_order[i] = 512 + i;
+    char_order[i + 'A' - 'a'] = 512 + i;
+  }
+}
+
+/* Compare two fields (each specified as a start pointer and a character count)
+ according to `keyfield'.  The sign of the value reports the relation between the fields */
+
+int
+compare_field (keyfield, start1, length1, pos1, start2, length2, pos2)
+     struct keyfield *keyfield;
+     char *start1;
+     long length1;
+     long pos1;
+     char *start2;
+     long length2;
+     long pos2;
+{
+  if (keyfields->positional)
+    {
+      if (pos1 > pos2)
+	return 1;
+      else
+	return -1;
+    }
+  if (keyfield->numeric)
+    {
+	long value = find_value (start1, length1) - find_value (start2, length2);
+      if (value > 0) return 1;
+      if (value < 0) return -1;
+      return 0;
+    }
+  else
+    {
+      char *p1 = start1;
+      char *p2 = start2;
+      char *e1 = start1 + length1;
+      char *e2 = start2 + length2;
+
+      int fold_case = keyfield->fold_case;
+
+      while (1)
+	{
+	  int c1, c2;
+
+	  if (p1 == e1) c1 = 0;
+	  else c1 = *p1++;
+	  if (p2 == e2) c2 = 0;
+	  else c2 = *p2++;
+
+	  if (char_order[c1] != char_order[c2])
+	    return char_order[c1] - char_order[c2];
+	  if (!c1) break;
+	}
+
+      /* Strings are equal except possibly for case.  */
+      p1 = start1;
+      p2 = start2;
+      while (1)
+	{
+	  int c1, c2;
+
+	  if (p1 == e1) c1 = 0;
+	  else c1 = *p1++;
+	  if (p2 == e2) c2 = 0;
+	  else c2 = *p2++;
+
+	  if (c1 != c2)
+	    /* Reverse sign here so upper case comes out last.  */
+	    return c2 - c1;
+	  if (!c1) break;
+	}
+
+      return 0;
+    }
+}
+
+/* A `struct linebuffer' is a structure which holds a line of text.
+ `readline' reads a line from a stream into a linebuffer
+ and works regardless of the length of the line.  */
+
+struct linebuffer
+  {
+    long size;
+    char *buffer;
+  };
+
+/* Initialize a linebuffer for use */
+
+void
+initbuffer (linebuffer)
+     struct linebuffer *linebuffer;
+{
+  linebuffer->size = 200;
+  linebuffer->buffer = (char *) xmalloc (200);
+}
+
+/* Read a line of text from `stream' into `linebuffer'.
+ Return the length of the line.  */
+
+long
+readline (linebuffer, stream)
+     struct linebuffer *linebuffer;
+     FILE *stream;
+{
+  char *buffer = linebuffer->buffer;
+  char *p = linebuffer->buffer;
+  char *end = p + linebuffer->size;
+
+  while (1)
+    {
+      int c = getc (stream);
+      if (p == end)
+	{
+	  buffer = (char *) xrealloc (buffer, linebuffer->size *= 2);
+	  p += buffer - linebuffer->buffer;
+	  end += buffer - linebuffer->buffer;
+	  linebuffer->buffer = buffer;
+	}
+      if (c < 0 || c == '\n')
+	{
+	  *p = 0;
+	  break;
+	}
+      *p++ = c;
+    }
+
+  return p - buffer;
+}
+
+/* Sort an input file too big to sort in core.  */
+
+void
+sort_offline (infile, nfiles, total, outfile)
+     char *infile;
+     long total;
+     char *outfile;
+{
+  int ntemps = 2 * (total + MAX_IN_CORE_SORT - 1) / MAX_IN_CORE_SORT;  /* More than enough */
+  char **tempfiles = (char **) xmalloc (ntemps * sizeof (char *));
+  FILE *istream = fopen (infile, "r");
+  int i;
+  struct linebuffer lb;
+  long linelength;
+  int failure = 0;
+
+  initbuffer (&lb);
+
+  /* Read in one line of input data.  */
+
+  linelength = readline (&lb, istream);
+
+  if (lb.buffer[0] != '\\')
+    {
+      error ("%s: not a texinfo index file", infile);
+      return;
+    }
+
+  /* Split up the input into `ntemps' temporary files, or maybe fewer,
+    and put the new files' names into `tempfiles' */
+
+  for (i = 0; i < ntemps; i++)
+    {
+      char *outname = maketempname (++tempcount);
+      FILE *ostream = fopen (outname, "w");
+      long tempsize = 0;
+
+      if (!ostream) pfatal_with_name (outname);
+      tempfiles[i] = outname;
+
+      /* Copy lines into this temp file as long as it does not make file "too big"
+	or until there are no more lines.  */
+
+      while (tempsize + linelength + 1 <= MAX_IN_CORE_SORT)
+	{
+	  tempsize += linelength + 1;
+	  fputs (lb.buffer, ostream);
+	  putc ('\n', ostream);
+
+	  /* Read another line of input data.  */
+
+	  linelength = readline (&lb, istream);
+	  if (!linelength && feof (istream)) break;
+
+	  if (lb.buffer[0] != '\\')
+	    {
+	      error ("%s: not a texinfo index file", infile);
+	      failure = 1;
+	      goto fail;
+	    }
+	}
+      fclose (ostream);
+      if (feof (istream)) break;
+    }
+
+  free (lb.buffer);
+
+ fail:
+  /* Record number of temp files we actually needed.  */
+
+  ntemps = i;
+
+  /* Sort each tempfile into another tempfile.
+    Delete the first set of tempfiles and put the names of the second into `tempfiles' */
+
+  for (i = 0; i < ntemps; i++)
+    {
+      char *newtemp = maketempname (++tempcount);
+      sort_in_core (&tempfiles[i], MAX_IN_CORE_SORT, newtemp);
+      if (!keep_tempfiles)
+        unlink (tempfiles[i]);
+      tempfiles[i] = newtemp;
+    }
+
+  if (failure)
+    return;
+
+  /* Merge the tempfiles together and indexify */
+
+  merge_files (tempfiles, ntemps, outfile);
+}
+
+/* Sort `infile', whose size is `total',
+ assuming that is small enough to be done in-core,
+ then indexify it and send the output to `outfile' (or to stdout).  */
+
+void
+sort_in_core (infile, total, outfile)
+     char *infile;
+     long total;
+     char *outfile;
+{
+  char **nextline;
+  char *data = (char *) xmalloc (total + 1);
+  char *file_data;
+  long file_size;
+  int i;
+  FILE *ostream = stdout;
+  struct lineinfo *lineinfo;
+
+  /* Read the contents of the file into the moby array `data' */
+
+  int desc = open (infile, 0, 0);
+
+  if (desc < 0)
+    fatal ("failure reopening %s", infile);
+  for (file_size = 0; ; )
+    {
+      if ((i = read (desc, data + file_size, total - file_size)) <= 0)
+	break;
+      file_size += i;
+    }
+  file_data = data;
+  data[file_size] = 0;
+
+  close (desc);
+
+  if (file_size > 0 && data[0] != '\\')
+    {
+      error ("%s: not a texinfo index file", infile);
+      return;
+    }
+
+  init_char_order ();
+
+  /* Sort routines want to know this address */
+
+  text_base = data;
+
+  /* Create the array of pointers to lines, with a default size frequently enough.  */
+
+  lines = total / 50;
+  if (!lines) lines = 2;
+  linearray = (char **) xmalloc (lines * sizeof (char *));
+
+  /* `nextline' points to the next free slot in this array.
+     `lines' is the allocated size.  */
+
+  nextline = linearray;
+
+  /* Parse the input file's data, and make entries for the lines.  */
+
+  nextline = parsefile (infile, nextline, file_data, file_size);
+  if (nextline == 0)
+    {
+      error ("%s: not a texinfo index file", infile);
+      return;
+    }
+
+  /* Sort the lines */
+
+  /* If we have enough space, find the first keyfield of each line in advance.
+    Make a `struct lineinfo' for each line, which records the keyfield
+    as well as the line, and sort them.  */
+
+  lineinfo = (struct lineinfo *) malloc ((nextline - linearray) * sizeof (struct lineinfo));
+
+  if (lineinfo)
+    {
+      struct lineinfo *lp;
+      char **p;
+
+      for (lp = lineinfo, p = linearray; p != nextline; lp++, p++)
+	{
+	  lp->text = *p;
+	  lp->key.text = find_field (keyfields, *p, &lp->keylen);
+	  if (keyfields->numeric)
+	    lp->key.number = find_value (lp->key.text, lp->keylen);
+	}
+
+      qsort (lineinfo, nextline - linearray, sizeof (struct lineinfo), compare_prepared);
+
+      for (lp = lineinfo, p = linearray; p != nextline; lp++, p++)
+	*p = lp->text;
+
+      free (lineinfo);
+    }
+  else
+    qsort (linearray, nextline - linearray, sizeof (char *), compare_full);
+
+  /* Open the output file */
+
+  if (outfile)
+    {
+      ostream = fopen (outfile, "w");
+      if (!ostream)
+	pfatal_with_name (outfile);
+    }
+
+  writelines (linearray, nextline - linearray, ostream);
+  if (outfile) fclose (ostream);
+
+  free (linearray);
+  free (data);
+}
+
+/* Parse an input string in core into lines.
+   DATA is the input string, and SIZE is its length.
+   Data goes in LINEARRAY starting at NEXTLINE.
+   The value returned is the first entry in LINEARRAY still unused.
+   Value 0 means input file contents are invalid.  */
+
+char **
+parsefile (filename, nextline, data, size)
+     char *filename;
+     char **nextline;
+     char *data;
+     long size;
+{
+  char *p, *end;
+  char **line = nextline;
+
+  p = data;
+  end = p + size;
+  *end = 0;
+
+  while (p != end)
+    {
+      if (p[0] != '\\')
+	return 0;
+
+      *line = p;
+      while (*p && *p != '\n') p++;
+      if (p != end) p++;
+
+      line++;
+      if (line == linearray + lines)
+	{
+	  char **old = linearray;
+	  linearray = (char **) xrealloc (linearray, sizeof (char *) * (lines *= 4));
+	  line += linearray - old;
+	}
+    }
+
+  return line;
+}
+
+/* Indexification is a filter applied to the sorted lines
+ as they are being written to the output file.
+ Multiple entries for the same name, with different page numbers,
+ get combined into a single entry with multiple page numbers.
+ The first braced field, which is used for sorting, is discarded.
+ However, its first character is examined, folded to lower case,
+ and if it is different from that in the previous line fed to us
+ a \initial line is written with one argument, the new initial.
+
+ If an entry has four braced fields, then the second and third
+ constitute primary and secondary names.
+ In this case, each change of primary name
+ generates a \primary line which contains only the primary name,
+ and in between these are \secondary lines which contain
+ just a secondary name and page numbers.
+*/
+
+/* The last primary name we wrote a \primary entry for.
+ If only one level of indexing is being done, this is the last name seen */
+char *lastprimary;
+int lastprimarylength;  /* Length of storage allocated for lastprimary */
+
+/* Similar, for the secondary name. */
+char *lastsecondary;
+int lastsecondarylength;
+
+/* Zero if we are not in the middle of writing an entry.
+ One if we have written the beginning of an entry but have not
+  yet written any page numbers into it.
+ Greater than one if we have written the beginning of an entry
+  plus at least one page number. */
+int pending;
+
+/* The initial (for sorting purposes) of the last primary entry written.
+ When this changes, a \initial {c} line is written */
+
+char * lastinitial;
+
+int lastinitiallength;
+
+/* When we need a string of length 1 for the value of lastinitial,
+   store it here.  */
+
+char lastinitial1[2];
+
+/* Initialize static storage for writing an index */
+
+void
+init_index ()
+{
+  pending = 0;
+  lastinitial = lastinitial1;
+  lastinitial1[0] = 0;
+  lastinitial1[1] = 0;
+  lastinitiallength = 0;
+  lastprimarylength = 100;
+  lastprimary = (char *) xmalloc (lastprimarylength + 1);
+  bzero (lastprimary, lastprimarylength + 1);
+  lastsecondarylength = 100;
+  lastsecondary = (char *) xmalloc (lastsecondarylength + 1);
+  bzero (lastsecondary, lastsecondarylength + 1);
+}
+
+/* Indexify.  Merge entries for the same name,
+ insert headers for each initial character, etc.  */
+
+indexify (line, ostream)
+     char *line;
+     FILE *ostream;
+{
+  char *primary, *secondary, *pagenumber;
+  int primarylength, secondarylength, pagelength;
+  int len = strlen (line);
+  int nosecondary;
+  int initiallength;
+  char *initial;
+  char initial1[2];
+  register char *p;
+
+  /* First, analyze the parts of the entry fed to us this time */
+
+  p = find_braced_pos (line, 0, 0, 0);
+  if (*p == '{')
+    {
+      initial = p;
+      /* Get length of inner pair of braces starting at p,
+	 including that inner pair of braces.  */
+      initiallength = find_braced_end (p + 1) + 1 - p;
+    }
+  else
+    {
+      initial = initial1;
+      initial1[0] = *p;
+      initial1[1] = 0;
+      initiallength = 1;
+
+      if (initial1[0] >= 'a' && initial1[0] <= 'z')
+	initial1[0] -= 040;
+    }
+
+  pagenumber = find_braced_pos (line, 1, 0, 0);
+  pagelength = find_braced_end (pagenumber) - pagenumber;
+  if (pagelength == 0)
+    abort ();
+
+  primary = find_braced_pos (line, 2, 0, 0);
+  primarylength = find_braced_end (primary) - primary;
+
+  secondary = find_braced_pos (line, 3, 0, 0);
+  nosecondary = !*secondary;
+  if (!nosecondary)
+    secondarylength = find_braced_end (secondary) - secondary;
+
+  /* If the primary is different from before, make a new primary entry */
+  if (strncmp (primary, lastprimary, primarylength))
+    {
+      /* Close off current secondary entry first, if one is open */
+      if (pending)
+	{
+	  fputs ("}\n", ostream);
+	  pending = 0;
+	}
+
+      /* If this primary has a different initial, include an entry for the initial */
+      if (initiallength != lastinitiallength ||
+	  strncmp (initial, lastinitial, initiallength))
+	{
+	  fprintf (ostream, "\\initial {");
+	  fwrite (initial, 1, initiallength, ostream);
+	  fprintf (ostream, "}\n", initial);
+	  if (initial == initial1)
+	    {
+	      lastinitial = lastinitial1;
+	      *lastinitial1 = *initial1;
+	    }
+	  else
+	    {
+	      lastinitial = initial;
+	    }
+	  lastinitiallength = initiallength;
+	}
+
+      /* Make the entry for the primary.  */
+      if (nosecondary)
+	fputs ("\\entry {", ostream);
+      else
+	fputs ("\\primary {", ostream);
+      fwrite (primary, primarylength, 1, ostream);
+      if (nosecondary)
+	{
+	  fputs ("}{", ostream);
+	  pending = 1;
+	}
+      else
+	fputs ("}\n", ostream);
+
+      /* Record name of most recent primary */
+      if (lastprimarylength < primarylength)
+	{
+          lastprimarylength = primarylength + 100;
+	  lastprimary = (char *) xrealloc (lastprimary,
+					   1 + lastprimarylength);
+	}
+      strncpy (lastprimary, primary, primarylength);
+      lastprimary[primarylength] = 0;
+
+      /* There is no current secondary within this primary, now */
+      lastsecondary[0] = 0;
+    }
+
+  /* Should not have an entry with no subtopic following one with a subtopic */
+
+  if (nosecondary && *lastsecondary)
+    error ("entry %s follows an entry with a secondary name", line);
+
+  /* Start a new secondary entry if necessary */
+  if (!nosecondary && strncmp (secondary, lastsecondary, secondarylength))
+    {
+      if (pending)
+	{
+	  fputs ("}\n", ostream);
+	  pending = 0;
+	}
+
+      /* Write the entry for the secondary.  */
+      fputs ("\\secondary {", ostream);
+      fwrite (secondary, secondarylength, 1, ostream);
+      fputs ("}{", ostream);
+      pending = 1;
+
+      /* Record name of most recent secondary */
+      if (lastsecondarylength < secondarylength)
+	{
+          lastsecondarylength = secondarylength + 100;
+	  lastsecondary = (char *) xrealloc (lastsecondary,
+					   1 + lastsecondarylength);
+	}
+      strncpy (lastsecondary, secondary, secondarylength);
+      lastsecondary[secondarylength] = 0;
+    }
+
+  /* Here to add one more page number to the current entry */
+  if (pending++ != 1)
+    fputs (", ", ostream);	/* Punctuate first, if this is not the first */
+  fwrite (pagenumber, pagelength, 1, ostream);
+}
+
+/* Close out any unfinished output entry */
+
+void
+finish_index (ostream)
+     FILE *ostream;
+{
+  if (pending)
+    fputs ("}\n", ostream);
+  free (lastprimary);
+  free (lastsecondary);
+}
+
+/* Copy the lines in the sorted order.
+ Each line is copied out of the input file it was found in. */
+
+void
+writelines (linearray, nlines, ostream)
+     char **linearray;
+     int nlines;
+     FILE *ostream;
+{
+  char **stop_line = linearray + nlines;
+  char **next_line;
+
+  init_index ();
+
+  /* Output the text of the lines, and free the buffer space */
+
+  for (next_line = linearray; next_line != stop_line; next_line++)
+    {
+      /* If -u was specified, output the line only if distinct from previous one.  */
+      if (next_line == linearray
+	  /* Compare previous line with this one, using only the explicitly specd keyfields */
+	  || compare_general (*(next_line - 1), *next_line, 0L, 0L, num_keyfields - 1))
+	{
+	  char *p = *next_line;
+	  char c;
+	  while ((c = *p++) && c != '\n');
+	  *(p-1) = 0;
+	  indexify (*next_line, ostream);
+	}
+    }
+
+  finish_index (ostream);
+}
+
+/* Assume (and optionally verify) that each input file is sorted;
+ merge them and output the result.
+ Returns nonzero if any input file fails to be sorted.
+
+ This is the high-level interface that can handle an unlimited number of files.  */
+
+#define MAX_DIRECT_MERGE 10
+
+int
+merge_files (infiles, nfiles, outfile)
+     char **infiles;
+     int nfiles;
+     char *outfile;
+{
+  char **tempfiles;
+  int ntemps;
+  int i;
+  int value = 0;
+  int start_tempcount = tempcount;
+
+  if (nfiles <= MAX_DIRECT_MERGE)
+    return merge_direct (infiles, nfiles, outfile);
+
+  /* Merge groups of MAX_DIRECT_MERGE input files at a time,
+     making a temporary file to hold each group's result.  */
+
+  ntemps = (nfiles + MAX_DIRECT_MERGE - 1) / MAX_DIRECT_MERGE;
+  tempfiles = (char **) xmalloc (ntemps * sizeof (char *));
+  for (i = 0; i < ntemps; i++)
+    {
+      int nf = MAX_DIRECT_MERGE;
+      if (i + 1 == ntemps)
+	nf = nfiles - i * MAX_DIRECT_MERGE;
+      tempfiles[i] = maketempname (++tempcount);
+      value |= merge_direct (&infiles[i * MAX_DIRECT_MERGE], nf, tempfiles[i]);
+    }
+
+  /* All temporary files that existed before are no longer needed
+     since their contents have been merged into our new tempfiles.
+     So delete them.  */
+  flush_tempfiles (start_tempcount);
+
+  /* Now merge the temporary files we created.  */
+
+  merge_files (tempfiles, ntemps, outfile);
+
+  free (tempfiles);
+
+  return value;
+}  
+
+/* Assume (and optionally verify) that each input file is sorted;
+ merge them and output the result.
+ Returns nonzero if any input file fails to be sorted.
+
+ This version of merging will not work if the number of
+ input files gets too high.  Higher level functions
+ use it only with a bounded number of input files.  */
+
+int
+merge_direct (infiles, nfiles, outfile)
+     char **infiles;
+     int nfiles;
+     char *outfile;
+{
+  char **ip = infiles;
+  struct linebuffer *lb1, *lb2;
+  struct linebuffer **thisline, **prevline;
+  FILE **streams;
+  int i;
+  int nleft;
+  int lossage = 0;
+  int *file_lossage;
+  struct linebuffer *prev_out = 0;
+  FILE *ostream = stdout;
+
+  if (outfile)
+    {
+      ostream = fopen (outfile, "w");
+    }
+  if (!ostream) pfatal_with_name (outfile);
+
+  init_index ();
+
+  if (nfiles == 0)
+    {
+      if (outfile)
+        fclose (ostream);
+      return 0;
+    }
+
+  /* For each file, make two line buffers.
+     Also, for each file, there is an element of `thisline'
+     which points at any time to one of the file's two buffers,
+     and an element of `prevline' which points to the other buffer.
+     `thisline' is supposed to point to the next available line from the file,
+     while `prevline' holds the last file line used,
+     which is remembered so that we can verify that the file is properly sorted. */
+
+  /* lb1 and lb2 contain one buffer each per file */
+  lb1 = (struct linebuffer *) xmalloc (nfiles * sizeof (struct linebuffer));
+  lb2 = (struct linebuffer *) xmalloc (nfiles * sizeof (struct linebuffer));
+
+  /* thisline[i] points to the linebuffer holding the next available line in file i,
+     or is zero if there are no lines left in that file.  */
+  thisline = (struct linebuffer **) xmalloc (nfiles * sizeof (struct linebuffer *));
+  /* prevline[i] points to the linebuffer holding the last used line from file i.
+     This is just for verifying that file i is properly sorted.  */
+  prevline = (struct linebuffer **) xmalloc (nfiles * sizeof (struct linebuffer *));
+  /* streams[i] holds the input stream for file i.  */
+  streams = (FILE **) xmalloc (nfiles * sizeof (FILE *));
+  /* file_lossage[i] is nonzero if we already know file i is not properly sorted.  */
+  file_lossage = (int *) xmalloc (nfiles * sizeof (int));
+
+  /* Allocate and initialize all that storage */
+
+  for (i = 0; i < nfiles; i++)
+    {
+      initbuffer (&lb1[i]);
+      initbuffer (&lb2[i]);
+      thisline[i] = &lb1[i];
+      prevline[i] = &lb2[i];
+      file_lossage[i] = 0;
+      streams[i] = fopen (infiles[i], "r");
+      if (!streams[i])
+	pfatal_with_name (infiles[i]);
+
+      readline (thisline[i], streams[i]);
+    }
+
+  /* Keep count of number of files not at eof */
+  nleft = nfiles;
+
+  while (nleft)
+    {
+      struct linebuffer *best = 0;
+      struct linebuffer *exch;
+      int bestfile = -1;
+      int i;
+
+      /* Look at the next avail line of each file; choose the least one.  */
+
+      for (i = 0; i < nfiles; i++)
+	{
+	  if (thisline[i] &&
+	      (!best ||
+	       0 < compare_general (best->buffer, thisline[i]->buffer,
+				    (long) bestfile, (long) i, num_keyfields)))
+	    {
+	      best = thisline[i];
+	      bestfile = i;
+	    }
+	}
+
+      /* Output that line, unless it matches the previous one and we don't want duplicates */
+
+      if (!(prev_out &&
+	    !compare_general (prev_out->buffer, best->buffer, 0L, 1L, num_keyfields - 1)))
+	indexify (best->buffer, ostream);
+      prev_out = best;
+
+      /* Now make the line the previous of its file, and fetch a new line from that file */
+
+      exch = prevline[bestfile];
+      prevline[bestfile] = thisline[bestfile];
+      thisline[bestfile] = exch;
+
+      while (1)
+	{
+	  /* If the file has no more, mark it empty */
+
+	  if (feof (streams[bestfile]))
+	    {
+	      thisline[bestfile] = 0;
+	      nleft--;		/* Update the number of files still not empty */
+	      break;
+	    }
+	  readline (thisline[bestfile], streams[bestfile]);
+	  if (thisline[bestfile]->buffer[0] || !feof (streams[bestfile])) break;
+	}
+    }
+
+  finish_index (ostream);
+
+  /* Free all storage and close all input streams */
+
+  for (i = 0; i < nfiles; i++)
+    {
+      fclose (streams[i]);
+      free (lb1[i].buffer);
+      free (lb2[i].buffer);
+    }
+  free (file_lossage);
+  free (lb1);
+  free (lb2);
+  free (thisline);
+  free (prevline);
+  free (streams);
+
+  if (outfile)
+    fclose (ostream);
+
+  return lossage;
+}
+
+/* Print error message and exit.  */
+
+fatal (s1, s2)
+     char *s1, *s2;
+{
+  error (s1, s2);
+  exit (EXIT_FATAL);
+}
+
+/* Print error message.  `s1' is printf control string, `s2' is arg for it. */
+
+error (s1, s2)
+     char *s1, *s2;
+{
+  printf ("texindex: ");
+  printf (s1, s2);
+  printf ("\n");
+}
+
+perror_with_name (name)
+     char *name;
+{
+#ifdef VMS
+#include <errno.h>
+  extern noshare int sys_nerr;
+  extern noshare char *sys_errlist[];
+#else
+  extern int errno, sys_nerr;
+  extern char *sys_errlist[];
+#endif
+  char *s;
+
+  if (errno < sys_nerr)
+    s = concat ("", sys_errlist[errno], " for %s");
+  else
+    s = "cannot open %s";
+  error (s, name);
+}
+
+pfatal_with_name (name)
+     char *name;
+{
+  extern int errno, sys_nerr;
+  extern char *sys_errlist[];
+  char *s;
+
+  if (errno < sys_nerr)
+    s = concat ("", sys_errlist[errno], " for %s");
+  else
+    s = "cannot open %s";
+  fatal (s, name);
+}
+
+/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3.  */
+
+char *
+concat (s1, s2, s3)
+     char *s1, *s2, *s3;
+{
+  int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
+  char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
+
+  strcpy (result, s1);
+  strcpy (result + len1, s2);
+  strcpy (result + len1 + len2, s3);
+  *(result + len1 + len2 + len3) = 0;
+
+  return result;
+}
+
+/* Like malloc but get fatal error if memory is exhausted.  */
+
+int
+xmalloc (size)
+     int size;
+{
+  int result = malloc (size);
+  if (!result)
+    fatal ("virtual memory exhausted", 0);
+  return result;
+}
+
+
+int
+xrealloc (ptr, size)
+     char *ptr;
+     int size;
+{
+  int result = realloc (ptr, size);
+  if (!result)
+    fatal ("virtual memory exhausted");
+  return result;
+}
+
+bzero (b, length)
+     register char *b;
+     register int length;
+{
+#ifdef VMS
+  short zero = 0;
+  long max_str = 65535;
+
+  while (length > max_str) {
+    (void) LIB$MOVC5 (&zero, &zero, &zero, &max_str, b);
+    length -= max_str;
+    b += max_str;
+  }
+  (void) LIB$MOVC5 (&zero, &zero, &zero, &length, b);
+#else
+  while (length-- > 0)
+    *b++ = 0;
+#endif /* not VMS */
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/doc/texinfo.tex
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/doc/texinfo.tex	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/doc/texinfo.tex	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,3815 @@
+%% TeX macros to handle texinfo files
+
+%   Copyright (C) 1985, 86, 88, 90, 91, 92, 1993 Free Software Foundation, Inc.
+
+%This texinfo.tex 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, or (at
+%your option) any later version.
+
+%This texinfo.tex file 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 texinfo.tex file; see the file COPYING.  If not, write
+%to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
+%USA.
+
+
+%In other words, you are welcome to use, share and improve this program.
+%You are forbidden to forbid anyone else to use, share and improve
+%what you give them.   Help stamp out software-hoarding!
+
+\def\texinfoversion{2.93}
+\message{Loading texinfo package [Version \texinfoversion]:}
+\message{}
+
+% Print the version number if in a .fmt file.
+\everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
+
+% Save some parts of plain tex whose names we will redefine.
+
+\let\ptexlbrace=\{
+\let\ptexrbrace=\}
+\let\ptexdots=\dots
+\let\ptexdot=\.
+\let\ptexstar=\*
+\let\ptexend=\end
+\let\ptexbullet=\bullet
+\let\ptexb=\b
+\let\ptexc=\c
+\let\ptexi=\i
+\let\ptext=\t
+\let\ptexl=\l
+\let\ptexL=\L
+
+\def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
+
+\message{Basics,}
+\chardef\other=12
+
+% If this character appears in an error message or help string, it
+% starts a new line in the output.
+\newlinechar = `^^J
+
+% Ignore a token.
+% 
+\def\gobble#1{}
+
+\hyphenation{ap-pen-dix}
+\hyphenation{mini-buf-fer mini-buf-fers}
+\hyphenation{eshell}
+
+% Margin to add to right of even pages, to left of odd pages.
+\newdimen \bindingoffset  \bindingoffset=0pt
+\newdimen \normaloffset   \normaloffset=\hoffset
+\newdimen\pagewidth \newdimen\pageheight
+\pagewidth=\hsize \pageheight=\vsize
+
+% Sometimes it is convenient to have everything in the transcript file
+% and nothing on the terminal.  We don't just call \tracingall here,
+% since that produces some useless output on the terminal.
+%
+\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
+\def\loggingall{\tracingcommands2 \tracingstats2 
+   \tracingpages1 \tracingoutput1 \tracinglostchars1 
+   \tracingmacros2 \tracingparagraphs1 \tracingrestores1 
+   \showboxbreadth\maxdimen\showboxdepth\maxdimen
+}%
+
+%---------------------Begin change-----------------------
+%
+%%%% For @cropmarks command.
+% Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
+%
+\newdimen\cornerlong \newdimen\cornerthick
+\newdimen \topandbottommargin
+\newdimen \outerhsize \newdimen \outervsize
+\cornerlong=1pc\cornerthick=.3pt	% These set size of cropmarks
+\outerhsize=7in
+%\outervsize=9.5in
+% Alternative @smallbook page size is 9.25in
+\outervsize=9.25in
+\topandbottommargin=.75in
+%
+%---------------------End change-----------------------
+
+% \onepageout takes a vbox as an argument.  Note that \pagecontents
+% does insertions itself, but you have to call it yourself.
+\chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
+\def\onepageout#1{\hoffset=\normaloffset
+\ifodd\pageno  \advance\hoffset by \bindingoffset
+\else \advance\hoffset by -\bindingoffset\fi
+{\escapechar=`\\\relax % makes sure backslash is used in output files.
+\shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
+{\let\hsize=\pagewidth \makefootline}}}%
+\advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
+
+%%%% For @cropmarks command %%%%
+
+% Here is a modification of the main output routine for Near East Publications
+% This provides right-angle cropmarks at all four corners.
+% The contents of the page are centerlined into the cropmarks,
+% and any desired binding offset is added as an \hskip on either
+% site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
+%
+\def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
+{\escapechar=`\\\relax % makes sure backslash is used in output files.
+		 \shipout
+		 \vbox to \outervsize{\hsize=\outerhsize
+                 \vbox{\line{\ewtop\hfill\ewtop}}
+                 \nointerlineskip
+                 \line{\vbox{\moveleft\cornerthick\nstop}
+                       \hfill
+                       \vbox{\moveright\cornerthick\nstop}}
+                 \vskip \topandbottommargin
+                 \centerline{\ifodd\pageno\hskip\bindingoffset\fi
+			\vbox{
+			{\let\hsize=\pagewidth \makeheadline}
+			\pagebody{#1}
+			{\let\hsize=\pagewidth \makefootline}}
+			\ifodd\pageno\else\hskip\bindingoffset\fi}
+		 \vskip \topandbottommargin plus1fill minus1fill
+                 \boxmaxdepth\cornerthick
+                 \line{\vbox{\moveleft\cornerthick\nsbot}
+                       \hfill
+                       \vbox{\moveright\cornerthick\nsbot}}
+                 \nointerlineskip
+                 \vbox{\line{\ewbot\hfill\ewbot}}
+	}}
+  \advancepageno 
+  \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
+%
+% Do @cropmarks to get crop marks
+\def\cropmarks{\let\onepageout=\croppageout }
+
+\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
+{\catcode`\@ =11
+\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
+\dimen@=\dp#1 \unvbox#1
+\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
+\ifr at ggedbottom \kern-\dimen@ \vfil \fi}
+}
+
+%
+% Here are the rules for the cropmarks.  Note that they are
+% offset so that the space between them is truly \outerhsize or \outervsize
+% (P. A. MacKay, 12 November, 1986)
+%
+\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
+\def\nstop{\vbox
+  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
+\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
+\def\nsbot{\vbox
+  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
+
+% Parse an argument, then pass it to #1.  The argument is the rest of
+% the input line (except we remove a trailing comment).  #1 should be a
+% macro which expects an ordinary undelimited TeX argument.
+%
+\def\parsearg#1{%
+  \let\next = #1%
+  \begingroup
+    \obeylines
+    \futurelet\temp\parseargx
+}
+
+% If the next token is an obeyed space (from an @example environment or
+% the like), remove it and recurse.  Otherwise, we're done.
+\def\parseargx{%
+  \ifx\obeyedspace\temp
+    \expandafter\parseargdiscardspace
+  \else
+    \expandafter\parseargline
+  \fi
+}
+
+% Remove a single space (as the delimiter token to the macro call).
+{\obeyspaces %
+ \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
+
+\def\obeyedspace{\ }
+
+{\obeylines %
+  \gdef\parseargline#1^^M{%
+    \endgroup % End of the group started in \parsearg.
+    %
+    % First remove any @c comment, then any @comment.
+    % Result of each macro is put in \toks0.
+    \argremovec #1\c\relax %
+    \expandafter\argremovecomment \the\toks0 \comment\relax %
+    %
+    % Call the caller's macro, saved as \next in \parsearg.
+    \expandafter\next\expandafter{\the\toks0}%
+  }%
+}
+
+% Since all \c{,omment} does is throw away the argument, we can let TeX
+% do that for us.  The \relax here is matched by the \relax in the call
+% in \parseargline; it could be more or less anything, its purpose is
+% just to delimit the argument to the \c.
+\def\argremovec#1\c#2\relax{\toks0 = {#1}}
+\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
+
+% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
+%    @end itemize  @c foo
+% will have two active spaces as part of the argument with the
+% `itemize'.  Here we remove all active spaces from #1, and assign the
+% result to \toks0.
+%
+% This loses if there are any *other* active characters besides spaces
+% in the argument -- _ ^ +, for example -- since they get expanded.
+% Fortunately, Texinfo does not define any such commands.  (If it ever
+% does, the catcode of the characters in questionwill have to be changed
+% here.)  But this means we cannot call \removeactivespaces as part of
+% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
+% that \parsearg gets might well have any character at all in it.
+% 
+\def\removeactivespaces#1{%
+  \begingroup
+    \ignoreactivespaces
+    \edef\temp{#1}%
+    \global\toks0 = \expandafter{\temp}%
+  \endgroup
+}
+
+% Change the active space to expand to nothing.
+% 
+\begingroup
+  \obeyspaces
+  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
+\endgroup
+
+
+\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
+
+%% These are used to keep @begin/@end levels from running away
+%% Call \inENV within environments (after a \begingroup)
+\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
+\def\ENVcheck{%
+\ifENV\errmessage{Still within an environment.  Type Return to continue.}
+\endgroup\fi} % This is not perfect, but it should reduce lossage
+
+% @begin foo  is the same as @foo, for now.
+\newhelp\EMsimple{Type <Return> to continue.}
+
+\outer\def\begin{\parsearg\beginxxx}
+
+\def\beginxxx #1{%
+\expandafter\ifx\csname #1\endcsname\relax
+{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
+\csname #1\endcsname\fi}
+
+% @end foo executes the definition of \Efoo.
+%
+\def\end{\parsearg\endxxx}
+\def\endxxx #1{%
+  \removeactivespaces{#1}%
+  \edef\endthing{\the\toks0}%
+  %
+  \expandafter\ifx\csname E\endthing\endcsname\relax
+    \expandafter\ifx\csname \endthing\endcsname\relax
+      % There's no \foo, i.e., no ``environment'' foo.
+      \errhelp = \EMsimple
+      \errmessage{Undefined command `@end \endthing'}%
+    \else
+      \unmatchedenderror\endthing
+    \fi
+  \else
+    % Everything's ok; the right environment has been started.
+    \csname E\endthing\endcsname
+  \fi
+}
+
+% There is an environment #1, but it hasn't been started.  Give an error.
+% 
+\def\unmatchedenderror#1{%
+  \errhelp = \EMsimple
+  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
+}
+
+% Define the control sequence \E#1 to give an unmatched @end error.
+% 
+\def\defineunmatchedend#1{%
+  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
+}
+
+
+% Single-spacing is done by various environments.
+
+\newskip\singlespaceskip \singlespaceskip = \baselineskip
+\def\singlespace{%
+{\advance \baselineskip by -\singlespaceskip
+\kern \baselineskip}%
+\baselineskip=\singlespaceskip
+}
+
+%% Simple single-character @ commands
+
+% @@ prints an @
+% Kludge this until the fonts are right (grr).
+\def\@{{\tt \char '100}}
+
+% This is turned off because it was never documented
+% and you can use @w{...} around a quote to suppress ligatures.
+%% Define @` and @' to be the same as ` and '
+%% but suppressing ligatures.
+%\def\`{{`}}
+%\def\'{{'}}
+
+% Used to generate quoted braces.
+
+\def\mylbrace {{\tt \char '173}}
+\def\myrbrace {{\tt \char '175}}
+\let\{=\mylbrace
+\let\}=\myrbrace
+
+% @: forces normal size whitespace following.
+\def\:{\spacefactor=1000 }
+
+% @* forces a line break.
+\def\*{\hfil\break\hbox{}\ignorespaces}
+
+% @. is an end-of-sentence period.
+\def\.{.\spacefactor=3000 }
+
+% @w prevents a word break.  Without the \leavevmode, @w at the
+% beginning of a paragraph, when TeX is still in vertical mode, would
+% produce a whole line of output instead of starting the paragraph.
+\def\w#1{\leavevmode\hbox{#1}}
+
+% @group ... @end group forces ... to be all on one page, by enclosing
+% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
+% to keep its height that of a normal line.  According to the rules for
+% \topskip (p.114 of the TeXbook), the glue inserted is
+% max (\topskip - \ht (first item), 0).  If that height is large,
+% therefore, no glue is inserted, and the space between the headline and
+% the text is small, which looks bad.
+% 
+\def\group{\begingroup
+  \ifnum\catcode13=\active \else
+    \errhelp = \groupinvalidhelp
+    \errmessage{@group invalid in context where filling is enabled}%
+  \fi
+  %
+  % The \vtop we start below produces a box with large depth; thus, TeX
+  % puts \baselineskip glue before it, and (when the next line of text
+  % is done) \lineskip glue after it.  (See p.82 of the TeXbook.)  But
+  % the next line of text also gets us \parskip glue.  Final result:
+  % space below is slightly more than space above.
+  \def\Egroup{%
+    \egroup           % End the \vtop.
+    \endgroup         % End the \group.
+  }%
+  %
+  \vtop\bgroup
+    % We do @comment here in case we are called inside an environment,
+    % such as @example, where each end-of-line in the input causes an
+    % end-of-line in the output.  We don't want the end-of-line after
+    % the `@group' to put extra space in the output.  Since @group
+    % should appear on a line by itself (according to the Texinfo
+    % manual), we don't worry about eating any user text.
+    \comment
+}
+%
+% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
+% message, so this ends up printing `@group can only ...'.
+% 
+\newhelp\groupinvalidhelp{%
+group can only be used in environments such as @example,^^J%
+where each line of input produces a line of output.}
+
+% @need space-in-mils
+% forces a page break if there is not space-in-mils remaining.
+
+\newdimen\mil  \mil=0.001in
+
+\def\need{\parsearg\needx}
+
+% Old definition--didn't work.
+%\def\needx #1{\par %
+%% This method tries to make TeX break the page naturally
+%% if the depth of the box does not fit.
+%{\baselineskip=0pt%
+%\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
+%\prevdepth=-1000pt
+%}}
+
+\def\needx#1{%
+  % Go into vertical mode, so we don't make a big box in the middle of a
+  % paragraph.
+  \par
+  %
+  % Don't add any leading before our big empty box, but allow a page
+  % break, since the best break might be right here.
+  \allowbreak
+  \nointerlineskip
+  \vtop to #1\mil{\vfil}%
+  % 
+  % TeX does not even consider page breaks if a penalty added to the
+  % main vertical list is 10000 or more.  But in order to see if the
+  % empty box we just added fits on the page, we must make it consider
+  % page breaks.  On the other hand, we don't want to actually break the
+  % page after the empty box.  So we use a penalty of 9999.
+  % 
+  % There is an extremely small chance that TeX will actually break the
+  % page at this \penalty, if there are no other feasible breakpoints in
+  % sight.  (If the user is using lots of big @group commands, which
+  % almost-but-not-quite fill up a page, TeX will have a hard time doing
+  % good page breaking, for example.)  However, I could not construct an
+  % example where a page broke at this \penalty; if it happens in a real
+  % document, then we can reconsider our strategy.
+  \penalty9999
+  %
+  % Back up by the size of the box, whether we did a page break or not.
+  \kern -#1\mil
+  %
+  % Do not allow a page break right after this kern.
+  \nobreak
+}
+
+% @br   forces paragraph break
+
+\let\br = \par
+
+% @dots{}  output some dots
+
+\def\dots{$\ldots$}
+
+% @page    forces the start of a new page
+
+\def\page{\par\vfill\supereject}
+
+% @exdent text....
+% outputs text on separate line in roman font, starting at standard page margin
+
+% This records the amount of indent in the innermost environment.
+% That's how much \exdent should take out.
+\newskip\exdentamount
+
+% This defn is used inside fill environments such as @defun.
+\def\exdent{\parsearg\exdentyyy}
+\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
+
+% This defn is used inside nofill environments such as @example.
+\def\nofillexdent{\parsearg\nofillexdentyyy}
+\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
+\leftline{\hskip\leftskip{\rm#1}}}}
+
+%\hbox{{\rm#1}}\hfil\break}}
+
+% @include file    insert text of that file as input.
+
+\def\include{\parsearg\includezzz}
+\def\includezzz #1{{\def\thisfile{#1}\input #1
+}}
+
+\def\thisfile{}
+
+% @center line   outputs that line, centered
+
+\def\center{\parsearg\centerzzz}
+\def\centerzzz #1{{\advance\hsize by -\leftskip
+\advance\hsize by -\rightskip
+\centerline{#1}}}
+
+% @sp n   outputs n lines of vertical space
+
+\def\sp{\parsearg\spxxx}
+\def\spxxx #1{\par \vskip #1\baselineskip}
+
+% @comment ...line which is ignored...
+% @c is the same as @comment
+% @ignore ... @end ignore  is another way to write a comment
+
+\def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
+\parsearg \commentxxx}
+
+\def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
+
+\let\c=\comment
+
+% Prevent errors for section commands.
+% Used in @ignore and in failing conditionals.
+\def\ignoresections{%
+\let\chapter=\relax
+\let\unnumbered=\relax
+\let\top=\relax
+\let\unnumberedsec=\relax
+\let\unnumberedsection=\relax
+\let\unnumberedsubsec=\relax
+\let\unnumberedsubsection=\relax
+\let\unnumberedsubsubsec=\relax
+\let\unnumberedsubsubsection=\relax
+\let\section=\relax
+\let\subsec=\relax
+\let\subsubsec=\relax
+\let\subsection=\relax
+\let\subsubsection=\relax
+\let\appendix=\relax
+\let\appendixsec=\relax
+\let\appendixsection=\relax
+\let\appendixsubsec=\relax
+\let\appendixsubsection=\relax
+\let\appendixsubsubsec=\relax
+\let\appendixsubsubsection=\relax
+\let\contents=\relax
+\let\smallbook=\relax
+\let\titlepage=\relax
+}
+
+% Used in nested conditionals, where we have to parse the Texinfo source
+% and so want to turn off most commands, in case they are used
+% incorrectly.  
+% 
+\def\ignoremorecommands{%
+  \let\defcv = \relax
+  \let\deffn = \relax
+  \let\deffnx = \relax
+  \let\defindex = \relax
+  \let\defivar = \relax
+  \let\defmac = \relax
+  \let\defmethod = \relax
+  \let\defop = \relax
+  \let\defopt = \relax
+  \let\defspec = \relax
+  \let\deftp = \relax
+  \let\deftypefn = \relax
+  \let\deftypefun = \relax
+  \let\deftypevar = \relax
+  \let\deftypevr = \relax
+  \let\defun = \relax
+  \let\defvar = \relax
+  \let\defvr = \relax
+}
+
+% Ignore @ignore ... @end ignore.
+% 
+\def\ignore{\doignore{ignore}}
+
+% Also ignore @ifinfo, @menu, and @direntry text.
+% 
+\def\ifinfo{\doignore{ifinfo}}
+\def\menu{\doignore{menu}}
+\def\direntry{\doignore{direntry}}
+
+% Ignore text until a line `@end #1'.
+% 
+\def\doignore#1{\begingroup
+  % Don't complain about control sequences we have declared \outer.
+  \ignoresections
+  %
+  % Define a command to swallow text until we reach `@end #1'.
+  \long\def\doignoretext##1\end #1{\enddoignore}%
+  %
+  % Make sure that spaces turn into tokens that match what \doignoretext wants.
+  \catcode32 = 10
+  %
+  % And now expand that command.
+  \doignoretext
+}
+
+% What we do to finish off ignored text.
+% 
+\def\enddoignore{\endgroup\ignorespaces}%
+
+% Ignore text, except that we keep track of conditional commands for
+% purposes of nesting, up to an `@end #1' command.
+% 
+\def\nestedignore#1{%
+  % We must actually expand the ignored text to look for the @end
+  % command, so that nested ignore constructs work.  Thus, we put the
+  % text into a \vbox and then do nothing with the result.  To minimize
+  % the change of memory overflow, we follow the approach outlined on
+  % page 401 of the TeXbook: make the current font be a dummy font.
+  % 
+  \setbox0 = \vbox\bgroup
+    % Don't complain about control sequences we have declared \outer.
+    \ignoresections
+    %
+    % Define `@end #1' to end the box, which will in turn undefine the
+    % @end command again.
+    \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
+    %
+    % We are going to be parsing Texinfo commands.  Most cause no
+    % trouble when they are used incorrectly, but some commands do
+    % complicated argument parsing or otherwise get confused, so we
+    % undefine them.
+    %
+    % We can't do anything about stray @-signs, unfortunately;
+    % they'll produce `undefined control sequence' errors.
+    \ignoremorecommands
+    % 
+    % Set the current font to be \nullfont, a TeX primitive, and define
+    % all the font commands to also use \nullfont.  We don't use
+    % dummy.tfm, as suggested in the TeXbook, because not all sites
+    % might have that installed.  Therefore, math mode will still
+    % produce output, but that should be an extremely small amount of
+    % stuff compared to the main input.
+    \nullfont
+    \let\tenrm = \nullfont  \let\tenit = \nullfont  \let\tensl = \nullfont
+    \let\tenbf = \nullfont  \let\tentt = \nullfont  \let\smallcaps = \nullfont
+    \let\tensf = \nullfont
+    %
+    % Don't complain when characters are missing from the fonts.
+    \tracinglostchars = 0
+    %
+    % Don't bother to do space factor calculations.
+    \frenchspacing
+    %
+    % Don't report underfull hboxes.
+    \hbadness = 10000
+    %
+    % Do minimal line-breaking.
+    \pretolerance = 10000
+}
+
+% @set VAR sets the variable VAR to an empty value.
+% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
+% 
+% Since we want to separate VAR from REST-OF-LINE (which might be
+% empty), we can't just use \parsearg; we have to insert a space of our
+% own to delimit the rest of the line, and then take it out again if we
+% didn't need it.
+%
+\def\set{\parsearg\setxxx}
+\def\setxxx#1{\setyyy#1 \endsetyyy}
+\def\setyyy#1 #2\endsetyyy{%
+  \def\temp{#2}%
+  \ifx\temp\empty \expandafter\let\csname SET#1\endcsname = \empty
+  \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
+  \fi
+}
+\def\setzzz#1#2 \endsetzzz{\expandafter\edef\csname SET#1\endcsname{#2}}
+
+% @clear VAR clears (i.e., unsets) the variable VAR.
+%
+\def\clear{\parsearg\clearxxx}
+\def\clearxxx#1{\expandafter\let\csname SET#1\endcsname=\relax}
+
+% @value{foo} gets the text saved in variable foo.
+%
+\def\value#1{\expandafter
+		\ifx\csname SET#1\endcsname\relax
+			{\{No value for ``#1''\}}
+		\else \csname SET#1\endcsname \fi}
+
+% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
+% with @set.
+% 
+\def\ifset{\parsearg\ifsetxxx}
+\def\ifsetxxx #1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    \expandafter\ifsetfail
+  \else
+    \expandafter\ifsetsucceed
+  \fi
+}
+\def\ifsetsucceed{\conditionalsucceed{ifset}}
+\def\ifsetfail{\nestedignore{ifset}}
+\defineunmatchedend{ifset}
+
+% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
+% defined with @set, or has been undefined with @clear.
+% 
+\def\ifclear{\parsearg\ifclearxxx}
+\def\ifclearxxx #1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    \expandafter\ifclearsucceed
+  \else
+    \expandafter\ifclearfail
+  \fi
+}
+\def\ifclearsucceed{\conditionalsucceed{ifclear}}
+\def\ifclearfail{\nestedignore{ifclear}}
+\defineunmatchedend{ifclear}
+
+% @iftex always succeeds; we read the text following, through @end
+% iftex).  But `@end iftex' should be valid only after an @iftex.
+% 
+\def\iftex{\conditionalsucceed{iftex}}
+\defineunmatchedend{iftex}
+
+% We can't just want to start a group at @iftex (for example) and end it
+% at @end iftex, since then @set commands inside the conditional have no
+% effect (they'd get reverted at the end of the group).  So we must
+% define \Eiftex to redefine itself to be its previous value.  (We can't
+% just define it to fail again with an ``unmatched end'' error, since
+% the @ifset might be nested.)
+% 
+\def\conditionalsucceed#1{%
+  \edef\temp{%
+    % Remember the current value of \E#1.
+    \let\nece{prevE#1} = \nece{E#1}%
+    %
+    % At the `@end #1', redefine \E#1 to be its previous value.
+    \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
+  }%
+  \temp
+}
+
+% We need to expand lots of \csname's, but we don't want to expand the
+% control sequences after we've constructed them.
+%
+\def\nece#1{\expandafter\noexpand\csname#1\endcsname}
+
+% @asis just yields its argument.  Used with @table, for example.
+% 
+\def\asis#1{#1}
+
+% @math means output in math mode.
+% We don't use $'s directly in the definition of \math because control
+% sequences like \math are expanded when the toc file is written.  Then,
+% we read the toc file back, the $'s will be normal characters (as they
+% should be, according to the definition of Texinfo).  So we must use a
+% control sequence to switch into and out of math mode.
+% 
+% This isn't quite enough for @math to work properly in indices, but it
+% seems unlikely it will ever be needed there.
+% 
+\let\implicitmath = $
+\def\math#1{\implicitmath #1\implicitmath}
+
+% @bullet and @minus need the same treatment as @math, just above.
+\def\bullet{\implicitmath\ptexbullet\implicitmath}
+\def\minus{\implicitmath-\implicitmath}
+
+\def\node{\ENVcheck\parsearg\nodezzz}
+\def\nodezzz#1{\nodexxx [#1,]}
+\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
+\let\lastnode=\relax
+
+\def\donoderef{\ifx\lastnode\relax\else
+\expandafter\expandafter\expandafter\setref{\lastnode}\fi
+\let\lastnode=\relax}
+
+\def\unnumbnoderef{\ifx\lastnode\relax\else
+\expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
+\let\lastnode=\relax}
+
+\def\appendixnoderef{\ifx\lastnode\relax\else
+\expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
+\let\lastnode=\relax}
+
+\let\refill=\relax
+  
+% @setfilename is done at the beginning of every texinfo file.
+% So open here the files we need to have open while reading the input.
+% This makes it possible to make a .fmt file for texinfo.
+\def\setfilename{%
+   \readauxfile
+   \opencontents
+   \openindices
+   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
+   \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
+   \comment % Ignore the actual filename.
+}
+
+\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
+
+\def\inforef #1{\inforefzzz #1,,,,**}
+\def\inforefzzz #1,#2,#3,#4**{See Info file \file{\ignorespaces #3{}},
+  node \samp{\ignorespaces#1{}}}
+
+\message{fonts,}
+
+% Font-change commands.
+
+% Texinfo supports the sans serif font style, which plain TeX does not.
+% So we set up a \sf analogous to plain's \rm, etc.
+\newfam\sffam
+\def\sf{\fam=\sffam \tensf}
+\let\li = \sf % Sometimes we call it \li, not \sf.
+
+%% Try out Computer Modern fonts at \magstephalf
+\let\mainmagstep=\magstephalf
+
+\ifx\bigger\relax
+\let\mainmagstep=\magstep1
+\font\textrm=cmr12
+\font\texttt=cmtt12
+\else
+\font\textrm=cmr10 scaled \mainmagstep
+\font\texttt=cmtt10 scaled \mainmagstep
+\fi
+% Instead of cmb10, you many want to use cmbx10.
+% cmbx10 is a prettier font on its own, but cmb10
+% looks better when embedded in a line with cmr10.
+\font\textbf=cmb10 scaled \mainmagstep 
+\font\textit=cmti10 scaled \mainmagstep
+\font\textsl=cmsl10 scaled \mainmagstep
+\font\textsf=cmss10 scaled \mainmagstep
+\font\textsc=cmcsc10 scaled \mainmagstep
+\font\texti=cmmi10 scaled \mainmagstep
+\font\textsy=cmsy10 scaled \mainmagstep
+
+% A few fonts for @defun, etc.
+\font\defbf=cmbx10 scaled \magstep1 %was 1314
+\font\deftt=cmtt10 scaled \magstep1
+\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
+
+% Fonts for indices and small examples.
+% We actually use the slanted font rather than the italic, 
+% because texinfo normally uses the slanted fonts for that.
+% Do not make many font distinctions in general in the index, since they
+% aren't very useful.
+\font\ninett=cmtt9
+\font\indrm=cmr9
+\font\indit=cmsl9
+\let\indsl=\indit
+\let\indtt=\ninett
+\let\indsf=\indrm
+\let\indbf=\indrm
+\let\indsc=\indrm
+\font\indi=cmmi9
+\font\indsy=cmsy9
+
+% Fonts for headings
+\font\chaprm=cmbx12 scaled \magstep2
+\font\chapit=cmti12 scaled \magstep2
+\font\chapsl=cmsl12 scaled \magstep2
+\font\chaptt=cmtt12 scaled \magstep2
+\font\chapsf=cmss12 scaled \magstep2
+\let\chapbf=\chaprm
+\font\chapsc=cmcsc10 scaled\magstep3
+\font\chapi=cmmi12 scaled \magstep2
+\font\chapsy=cmsy10 scaled \magstep3
+
+\font\secrm=cmbx12 scaled \magstep1
+\font\secit=cmti12 scaled \magstep1
+\font\secsl=cmsl12 scaled \magstep1
+\font\sectt=cmtt12 scaled \magstep1
+\font\secsf=cmss12 scaled \magstep1
+\font\secbf=cmbx12 scaled \magstep1
+\font\secsc=cmcsc10 scaled\magstep2
+\font\seci=cmmi12 scaled \magstep1
+\font\secsy=cmsy10 scaled \magstep2
+
+% \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
+% \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
+% \font\ssecsl=cmsl10 scaled \magstep1
+% \font\ssectt=cmtt10 scaled \magstep1
+% \font\ssecsf=cmss10 scaled \magstep1
+
+%\font\ssecrm=cmb10 scaled 1315	% Note the use of cmb rather than cmbx.
+%\font\ssecit=cmti10 scaled 1315	% Also, the size is a little larger than
+%\font\ssecsl=cmsl10 scaled 1315	% being scaled magstep1.
+%\font\ssectt=cmtt10 scaled 1315
+%\font\ssecsf=cmss10 scaled 1315
+
+%\let\ssecbf=\ssecrm
+
+\font\ssecrm=cmbx12 scaled \magstephalf
+\font\ssecit=cmti12 scaled \magstephalf
+\font\ssecsl=cmsl12 scaled \magstephalf
+\font\ssectt=cmtt12 scaled \magstephalf
+\font\ssecsf=cmss12 scaled \magstephalf
+\font\ssecbf=cmbx12 scaled \magstephalf
+\font\ssecsc=cmcsc10 scaled \magstep1 
+\font\sseci=cmmi12 scaled \magstephalf
+\font\ssecsy=cmsy10 scaled \magstep1
+% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
+% but that is not a standard magnification.
+
+% Fonts for title page:
+\font\titlerm = cmbx12 scaled \magstep3
+\let\authorrm = \secrm
+
+% In order for the font changes to affect most math symbols and letters,
+% we have to define the \textfont of the standard families.  Since
+% texinfo doesn't allow for producing subscripts and superscripts, we
+% don't bother to reset \scriptfont and \scriptscriptfont (which would
+% also require loading a lot more fonts).
+% 
+\def\resetmathfonts{%
+  \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
+  \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
+  \textfont\ttfam = \tentt \textfont\sffam = \tensf
+}
+
+
+% The font-changing commands redefine the meanings of \tenSTYLE, instead
+% of just \STYLE.  We do this so that font changes will continue to work
+% in math mode, where it is the current \fam that is relevant in most
+% cases, not the current.  Plain TeX does, for example,
+% \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
+% to redefine \bf itself.  
+\def\textfonts{%
+  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
+  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
+  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
+  \resetmathfonts}
+\def\chapfonts{%
+  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl 
+  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
+  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
+  \resetmathfonts}
+\def\secfonts{%
+  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
+  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
+  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
+  \resetmathfonts}
+\def\subsecfonts{%
+  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
+  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
+  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
+  \resetmathfonts}
+\def\indexfonts{%
+  \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
+  \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
+  \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
+  \resetmathfonts}
+
+% Set up the default fonts, so we can use them for creating boxes.
+% 
+\textfonts
+
+% Count depth in font-changes, for error checks
+\newcount\fontdepth \fontdepth=0
+
+% Fonts for short table of contents.
+\font\shortcontrm=cmr12
+\font\shortcontbf=cmbx12
+\font\shortcontsl=cmsl12
+
+%% Add scribe-like font environments, plus @l for inline lisp (usually sans
+%% serif) and @ii for TeX italic
+
+% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
+% unless the following character is such as not to need one.
+\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
+\def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
+
+\let\i=\smartitalic
+\let\var=\smartitalic
+\let\dfn=\smartitalic
+\let\emph=\smartitalic
+\let\cite=\smartitalic
+
+\def\b#1{{\bf #1}}
+\let\strong=\b
+
+% We can't just use \exhyphenpenalty, because that only has effect at
+% the end of a paragraph.  Restore normal hyphenation at the end of the
+% group within which \nohyphenation is presumably called.
+% 
+\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
+\def\restorehyphenation{\hyphenchar\font = `- }
+
+\def\t#1{%
+  {\tt \nohyphenation \rawbackslash \frenchspacing #1}%
+  \null
+}
+\let\ttfont = \t
+%\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
+\def\samp #1{`\tclose{#1}'\null}
+\def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
+\def\ctrl #1{{\tt \rawbackslash \hat}#1}
+
+\let\file=\samp
+
+% @code is a modification of @t,
+% which makes spaces the same size as normal in the surrounding text.
+\def\tclose#1{%
+  {%
+    % Change normal interword space to be same as for the current font.
+    \spaceskip = \fontdimen2\font
+    %
+    % Switch to typewriter.
+    \tt
+    %
+    % But `\ ' produces the large typewriter interword space.
+    \def\ {{\spaceskip = 0pt{} }}%
+    %
+    % Turn off hyphenation.
+    \nohyphenation
+    % 
+    \rawbackslash
+    \frenchspacing
+    #1%
+  }%
+  \null
+}
+\let\code=\tclose
+%\let\exp=\tclose  %Was temporary
+
+% @kbd is like @code, except that if the argument is just one @key command, 
+% then @kbd has no effect.
+
+\def\xkey{\key}
+\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
+\ifx\one\xkey\ifx\threex\three \key{#2}%
+\else\tclose{\look}\fi
+\else\tclose{\look}\fi}
+
+% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
+% argument is to make the input look right: @dmn{pt} instead of
+% @dmn{}pt.
+% 
+\def\dmn#1{\thinspace #1}
+
+\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
+
+\def\l#1{{\li #1}\null}		% 
+
+\def\r#1{{\rm #1}}		% roman font
+% Use of \lowercase was suggested.
+\def\sc#1{{\smallcaps#1}}	% smallcaps font
+\def\ii#1{{\it #1}}		% italic font
+
+\message{page headings,}
+
+\newskip\titlepagetopglue \titlepagetopglue = 1.5in
+\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
+
+% First the title page.  Must do @settitle before @titlepage.
+\def\titlefont#1{{\titlerm #1}}
+
+\newtoks\realeverypar
+\newif\ifseenauthor
+\newif\iffinishedtitlepage
+
+\def\shorttitlepage{\parsearg\shorttitlepagezzz}
+\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
+	\endgroup\page\hbox{}\page}
+
+\def\titlepage{\begingroup \parindent=0pt \textfonts
+   \let\subtitlerm=\tenrm
+% I deinstalled the following change because \cmr12 is undefined.
+% This change was not in the ChangeLog anyway.  --rms.
+%   \let\subtitlerm=\cmr12
+   \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
+   %
+   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
+   %
+   % Leave some space at the very top of the page.
+   \vglue\titlepagetopglue
+   %
+   % Now you can print the title using @title.
+   \def\title{\parsearg\titlezzz}%
+   \def\titlezzz##1{\leftline{\titlefont{##1}}
+		    % print a rule at the page bottom also.
+		    \finishedtitlepagefalse
+		    \vskip4pt \hrule height 4pt \vskip4pt}%
+   % No rule at page bottom unless we print one at the top with @title.
+   \finishedtitlepagetrue
+   %
+   % Now you can put text using @subtitle.
+   \def\subtitle{\parsearg\subtitlezzz}%
+   \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
+   %
+   % @author should come last, but may come many times.
+   \def\author{\parsearg\authorzzz}%
+   \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
+      {\authorfont \leftline{##1}}}%
+   %  
+   % Most title ``pages'' are actually two pages long, with space
+   % at the top of the second.  We don't want the ragged left on the second.
+   \let\oldpage = \page
+   \def\page{%
+      \iffinishedtitlepage\else
+	 \finishtitlepage
+      \fi
+      \oldpage
+      \let\page = \oldpage
+      \hbox{}}%
+%   \def\page{\oldpage \hbox{}}
+}
+
+\def\Etitlepage{%
+   \iffinishedtitlepage\else
+      \finishtitlepage
+   \fi
+   % It is important to do the page break before ending the group,
+   % because the headline and footline are only empty inside the group.
+   % If we use the new definition of \page, we always get a blank page
+   % after the title page, which we certainly don't want.
+   \oldpage
+   \endgroup
+   \HEADINGSon
+}
+
+\def\finishtitlepage{%
+   \vskip4pt \hrule height 2pt
+   \vskip\titlepagebottomglue
+   \finishedtitlepagetrue
+}
+
+%%% Set up page headings and footings.
+
+\let\thispage=\folio
+
+\newtoks \evenheadline    % Token sequence for heading line of even pages
+\newtoks \oddheadline     % Token sequence for heading line of odd pages
+\newtoks \evenfootline    % Token sequence for footing line of even pages
+\newtoks \oddfootline     % Token sequence for footing line of odd pages
+
+% Now make Tex use those variables
+\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
+                            \else \the\evenheadline \fi}}
+\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
+                            \else \the\evenfootline \fi}\HEADINGShook}
+\let\HEADINGShook=\relax
+
+% Commands to set those variables.
+% For example, this is what  @headings on  does
+% @evenheading @thistitle|@thispage|@thischapter
+% @oddheading @thischapter|@thispage|@thistitle
+% @evenfooting @thisfile||
+% @oddfooting ||@thisfile
+
+\def\evenheading{\parsearg\evenheadingxxx}
+\def\oddheading{\parsearg\oddheadingxxx}
+\def\everyheading{\parsearg\everyheadingxxx}
+
+\def\evenfooting{\parsearg\evenfootingxxx}
+\def\oddfooting{\parsearg\oddfootingxxx}
+\def\everyfooting{\parsearg\everyfootingxxx}
+
+{\catcode`\@=0 %
+
+\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
+\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
+\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
+\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
+\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
+\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
+\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
+\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
+\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
+\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+%
+}% unbind the catcode of @.
+
+% @headings double	turns headings on for double-sided printing.
+% @headings single	turns headings on for single-sided printing.
+% @headings off		turns them off.
+% @headings on		same as @headings double, retained for compatibility.
+% @headings after	turns on double-sided headings after this page.
+% @headings doubleafter	turns on double-sided headings after this page.
+% @headings singleafter turns on single-sided headings after this page.
+% By default, they are off.
+
+\def\headings #1 {\csname HEADINGS#1\endcsname}
+
+\def\HEADINGSoff{
+\global\evenheadline={\hfil} \global\evenfootline={\hfil}
+\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
+\HEADINGSoff
+% When we turn headings on, set the page number to 1.
+% For double-sided printing, put current file name in lower left corner,
+% chapter name on inside top of right hand pages, document
+% title on inside top of left hand pages, and page numbers on outside top
+% edge of all pages.
+\def\HEADINGSdouble{
+%\pagealignmacro
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+}
+% For single-sided printing, chapter title goes across top left of page,
+% page number on top right.
+\def\HEADINGSsingle{
+%\pagealignmacro
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+}
+\def\HEADINGSon{\HEADINGSdouble}
+
+\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
+\let\HEADINGSdoubleafter=\HEADINGSafter
+\def\HEADINGSdoublex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+}
+
+\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
+\def\HEADINGSsinglex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+}
+
+% Subroutines used in generating headings
+% Produces Day Month Year style of output.
+\def\today{\number\day\space
+\ifcase\month\or
+January\or February\or March\or April\or May\or June\or
+July\or August\or September\or October\or November\or December\fi
+\space\number\year}
+
+% Use this if you want the Month Day, Year style of output.
+%\def\today{\ifcase\month\or
+%January\or February\or March\or April\or May\or June\or
+%July\or August\or September\or October\or November\or December\fi
+%\space\number\day, \number\year}
+
+% @settitle line...  specifies the title of the document, for headings
+% It generates no output of its own
+
+\def\thistitle{No Title}
+\def\settitle{\parsearg\settitlezzz}
+\def\settitlezzz #1{\gdef\thistitle{#1}}
+
+\message{tables,}
+
+% @tabs -- simple alignment
+
+% These don't work.  For one thing, \+ is defined as outer.
+% So these macros cannot even be defined.
+
+%\def\tabs{\parsearg\tabszzz}
+%\def\tabszzz #1{\settabs\+#1\cr}
+%\def\tabline{\parsearg\tablinezzz}
+%\def\tablinezzz #1{\+#1\cr}
+%\def\&{&}
+
+% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
+
+% default indentation of table text
+\newdimen\tableindent \tableindent=.8in
+% default indentation of @itemize and @enumerate text
+\newdimen\itemindent  \itemindent=.3in
+% margin between end of table item and start of table text.
+\newdimen\itemmargin  \itemmargin=.1in
+
+% used internally for \itemindent minus \itemmargin
+\newdimen\itemmax
+
+% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
+% these defs.
+% They also define \itemindex
+% to index the item name in whatever manner is desired (perhaps none).
+
+\def\internalBitem{\smallbreak \parsearg\itemzzz}
+\def\internalBitemx{\par \parsearg\itemzzz}
+
+\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
+\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
+
+\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
+\def\internalBkitemx{\par \parsearg\kitemzzz}
+
+\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
+                 \itemzzz {#1}}
+
+\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
+                 \itemzzz {#1}}
+
+\def\itemzzz #1{\begingroup %
+  \advance\hsize by -\rightskip
+  \advance\hsize by -\tableindent
+  \setbox0=\hbox{\itemfont{#1}}%
+  \itemindex{#1}%
+  \nobreak % This prevents a break before @itemx.
+  %
+  % Be sure we are not still in the middle of a paragraph.
+  \parskip=0in
+  \par
+  %
+  % If the item text does not fit in the space we have, put it on a line
+  % by itself, and do not allow a page break either before or after that
+  % line.  We do not start a paragraph here because then if the next
+  % command is, e.g., @kindex, the whatsit would get put into the
+  % horizontal list on a line by itself, resulting in extra blank space.
+  \ifdim \wd0>\itemmax
+    \setbox0=\hbox{\hskip \leftskip \hskip -\tableindent \unhbox0}\box0
+    \nobreak
+  \else
+    % The item text fits into the space.  Start a paragraph, so that the
+    % following text (if any) will end up on the same line.  Since that
+    % text will be indented by \tableindent, we make the item text be in
+    % a zero-width box.
+    \noindent
+    \rlap{\hskip -\tableindent\box0}%
+  \fi
+  \endgroup
+}
+
+\def\item{\errmessage{@item while not in a table}}
+\def\itemx{\errmessage{@itemx while not in a table}}
+\def\kitem{\errmessage{@kitem while not in a table}}
+\def\kitemx{\errmessage{@kitemx while not in a table}}
+\def\xitem{\errmessage{@xitem while not in a table}}
+\def\xitemx{\errmessage{@xitemx while not in a table}}
+
+%% Contains a kludge to get @end[description] to work
+\def\description{\tablez{\dontindex}{1}{}{}{}{}}
+
+\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
+{\obeylines\obeyspaces%
+\gdef\tablex #1^^M{%
+\tabley\dontindex#1        \endtabley}}
+
+\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
+{\obeylines\obeyspaces%
+\gdef\ftablex #1^^M{%
+\tabley\fnitemindex#1        \endtabley
+\def\Eftable{\endgraf\endgroup\afterenvbreak}%
+\let\Etable=\relax}}
+
+\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
+{\obeylines\obeyspaces%
+\gdef\vtablex #1^^M{%
+\tabley\vritemindex#1        \endtabley
+\def\Evtable{\endgraf\endgroup\afterenvbreak}%
+\let\Etable=\relax}}
+
+\def\dontindex #1{}
+\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
+\def\vritemindex #1{\doind {vr}{\code{#1}}}%
+
+{\obeyspaces %
+\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
+\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
+
+\def\tablez #1#2#3#4#5#6{%
+\aboveenvbreak %
+\begingroup %
+\def\Edescription{\Etable}% Neccessary kludge.
+\let\itemindex=#1%
+\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
+\ifnum 0#4>0 \tableindent=#4\mil \fi %
+\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
+\def\itemfont{#2}%
+\itemmax=\tableindent %
+\advance \itemmax by -\itemmargin %
+\advance \leftskip by \tableindent %
+\exdentamount=\tableindent
+\parindent = 0pt
+\parskip = \smallskipamount
+\ifdim \parskip=0pt \parskip=2pt \fi%
+\def\Etable{\endgraf\endgroup\afterenvbreak}%
+\let\item = \internalBitem %
+\let\itemx = \internalBitemx %
+\let\kitem = \internalBkitem %
+\let\kitemx = \internalBkitemx %
+\let\xitem = \internalBxitem %
+\let\xitemx = \internalBxitemx %
+}
+
+% This is the counter used by @enumerate, which is really @itemize
+
+\newcount \itemno
+
+\def\itemize{\parsearg\itemizezzz}
+
+\def\itemizezzz #1{%
+  \begingroup % ended by the @end itemsize
+  \itemizey {#1}{\Eitemize}
+}
+
+\def\itemizey #1#2{%
+\aboveenvbreak %
+\itemmax=\itemindent %
+\advance \itemmax by -\itemmargin %
+\advance \leftskip by \itemindent %
+\exdentamount=\itemindent
+\parindent = 0pt %
+\parskip = \smallskipamount %
+\ifdim \parskip=0pt \parskip=2pt \fi%
+\def#2{\endgraf\endgroup\afterenvbreak}%
+\def\itemcontents{#1}%
+\let\item=\itemizeitem}
+
+% Set sfcode to normal for the chars that usually have another value.
+% These are `.?!:;,'
+\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
+  \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
+
+% \splitoff TOKENS\endmark defines \first to be the first token in
+% TOKENS, and \rest to be the remainder.
+% 
+\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
+
+% Allow an optional argument of an uppercase letter, lowercase letter,
+% or number, to specify the first label in the enumerated list.  No
+% argument is the same as `1'.
+% 
+\def\enumerate{\parsearg\enumeratezzz}
+\def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
+\def\enumeratey #1 #2\endenumeratey{%
+  \begingroup % ended by the @end enumerate
+  %
+  % If we were given no argument, pretend we were given `1'.
+  \def\thearg{#1}%
+  \ifx\thearg\empty \def\thearg{1}\fi
+  %
+  % Detect if the argument is a single token.  If so, it might be a
+  % letter.  Otherwise, the only valid thing it can be is a number.
+  % (We will always have one token, because of the test we just made.
+  % This is a good thing, since \splitoff doesn't work given nothing at
+  % all -- the first parameter is undelimited.)
+  \expandafter\splitoff\thearg\endmark
+  \ifx\rest\empty
+    % Only one token in the argument.  It could still be anything.
+    % A ``lowercase letter'' is one whose \lccode is nonzero.
+    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
+    %   not equal to itself.
+    % Otherwise, we assume it's a number.
+    % 
+    % We need the \relax at the end of the \ifnum lines to stop TeX from
+    % continuing to look for a <number>.
+    % 
+    \ifnum\lccode\expandafter`\thearg=0\relax 
+      \numericenumerate % a number (we hope)
+    \else
+      % It's a letter.
+      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
+        \lowercaseenumerate % lowercase letter
+      \else
+        \uppercaseenumerate % uppercase letter
+      \fi
+    \fi
+  \else
+    % Multiple tokens in the argument.  We hope it's a number.
+    \numericenumerate
+  \fi
+}
+
+% An @enumerate whose labels are integers.  The starting integer is
+% given in \thearg.
+% 
+\def\numericenumerate{%
+  \itemno = \thearg
+  \startenumeration{\the\itemno}%
+}
+
+% The starting (lowercase) letter is in \thearg.
+\def\lowercaseenumerate{%
+  \itemno = \expandafter`\thearg
+  \startenumeration{%
+    % Be sure we're not beyond the end of the alphabet.
+    \ifnum\itemno=0
+      \errmessage{No more lowercase letters in @enumerate; get a bigger
+                  alphabet}%
+    \fi
+    \char\lccode\itemno
+  }%
+}
+
+% The starting (uppercase) letter is in \thearg.
+\def\uppercaseenumerate{%
+  \itemno = \expandafter`\thearg
+  \startenumeration{%
+    % Be sure we're not beyond the end of the alphabet.
+    \ifnum\itemno=0
+      \errmessage{No more uppercase letters in @enumerate; get a bigger
+                  alphabet}
+    \fi
+    \char\uccode\itemno
+  }%
+}
+
+% Call itemizey, adding a period to the first argument and supplying the
+% common last two arguments.  Also subtract one from the initial value in
+% \itemno, since @item increments \itemno.
+% 
+\def\startenumeration#1{%
+  \advance\itemno by -1
+  \itemizey{#1.}\Eenumerate\flushcr
+}
+
+% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
+% to @enumerate.
+% 
+\def\alphaenumerate{\enumerate{a}}
+\def\capsenumerate{\enumerate{A}}
+\def\Ealphaenumerate{\Eenumerate}
+\def\Ecapsenumerate{\Eenumerate}
+
+% Definition of @item while inside @itemize.
+
+\def\itemizeitem{%
+\advance\itemno by 1
+{\let\par=\endgraf \smallbreak}%
+\ifhmode \errmessage{\in hmode at itemizeitem}\fi
+{\parskip=0in \hskip 0pt
+\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
+\vadjust{\penalty 1200}}%
+\flushcr}
+
+\message{indexing,}
+% Index generation facilities
+
+% Define \newwrite to be identical to plain tex's \newwrite
+% except not \outer, so it can be used within \newindex.
+{\catcode`\@=11
+\gdef\newwrite{\alloc at 7\write\chardef\sixt@@n}}
+
+% \newindex {foo} defines an index named foo.
+% It automatically defines \fooindex such that
+% \fooindex ...rest of line... puts an entry in the index foo.
+% It also defines \fooindfile to be the number of the output channel for
+% the file that	accumulates this index.  The file's extension is foo.
+% The name of an index should be no more than 2 characters long
+% for the sake of vms.
+
+\def\newindex #1{
+\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
+\openout \csname#1indfile\endcsname \jobname.#1	% Open the file
+\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
+\noexpand\doindex {#1}}
+}
+
+% @defindex foo  ==  \newindex{foo}
+
+\def\defindex{\parsearg\newindex}
+
+% Define @defcodeindex, like @defindex except put all entries in @code.
+
+\def\newcodeindex #1{
+\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
+\openout \csname#1indfile\endcsname \jobname.#1	% Open the file
+\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
+\noexpand\docodeindex {#1}}
+}
+
+\def\defcodeindex{\parsearg\newcodeindex}
+
+% @synindex foo bar    makes index foo feed into index bar.
+% Do this instead of @defindex foo if you don't want it as a separate index.
+\def\synindex #1 #2 {%
+\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
+\expandafter\let\csname#1indfile\endcsname=\synindexfoo
+\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
+\noexpand\doindex {#2}}%
+}
+
+% @syncodeindex foo bar   similar, but put all entries made for index foo
+% inside @code.
+\def\syncodeindex #1 #2 {%
+\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
+\expandafter\let\csname#1indfile\endcsname=\synindexfoo
+\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
+\noexpand\docodeindex {#2}}%
+}
+
+% Define \doindex, the driver for all \fooindex macros.
+% Argument #1 is generated by the calling \fooindex macro,
+%  and it is "foo", the name of the index.
+
+% \doindex just uses \parsearg; it calls \doind for the actual work.
+% This is because \doind is more useful to call from other macros.
+
+% There is also \dosubind {index}{topic}{subtopic}
+% which makes an entry in a two-level index such as the operation index.
+
+\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
+\def\singleindexer #1{\doind{\indexname}{#1}}
+
+% like the previous two, but they put @code around the argument.
+\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
+\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
+
+\def\indexdummies{%
+\def\_{{\realbackslash _}}%
+\def\w{\realbackslash w }%
+\def\bf{\realbackslash bf }%
+\def\rm{\realbackslash rm }%
+\def\sl{\realbackslash sl }%
+\def\sf{\realbackslash sf}%
+\def\tt{\realbackslash tt}%
+\def\gtr{\realbackslash gtr}%
+\def\less{\realbackslash less}%
+\def\hat{\realbackslash hat}%
+\def\char{\realbackslash char}%
+\def\TeX{\realbackslash TeX}%
+\def\dots{\realbackslash dots }%
+\def\copyright{\realbackslash copyright }%
+\def\tclose##1{\realbackslash tclose {##1}}%
+\def\code##1{\realbackslash code {##1}}%
+\def\samp##1{\realbackslash samp {##1}}%
+\def\t##1{\realbackslash r {##1}}%
+\def\r##1{\realbackslash r {##1}}%
+\def\i##1{\realbackslash i {##1}}%
+\def\b##1{\realbackslash b {##1}}%
+\def\cite##1{\realbackslash cite {##1}}%
+\def\key##1{\realbackslash key {##1}}%
+\def\file##1{\realbackslash file {##1}}%
+\def\var##1{\realbackslash var {##1}}%
+\def\kbd##1{\realbackslash kbd {##1}}%
+}
+
+% \indexnofonts no-ops all font-change commands.
+% This is used when outputting the strings to sort the index by.
+\def\indexdummyfont#1{#1}
+\def\indexdummytex{TeX}
+\def\indexdummydots{...}
+
+\def\indexnofonts{%
+\let\w=\indexdummyfont
+\let\t=\indexdummyfont
+\let\r=\indexdummyfont
+\let\i=\indexdummyfont
+\let\b=\indexdummyfont
+\let\emph=\indexdummyfont
+\let\strong=\indexdummyfont
+\let\cite=\indexdummyfont
+\let\sc=\indexdummyfont
+%Don't no-op \tt, since it isn't a user-level command
+% and is used in the definitions of the active chars like <, >, |...
+%\let\tt=\indexdummyfont
+\let\tclose=\indexdummyfont
+\let\code=\indexdummyfont
+\let\file=\indexdummyfont
+\let\samp=\indexdummyfont
+\let\kbd=\indexdummyfont
+\let\key=\indexdummyfont
+\let\var=\indexdummyfont
+\let\TeX=\indexdummytex
+\let\dots=\indexdummydots
+}
+
+% To define \realbackslash, we must make \ not be an escape.
+% We must first make another character (@) an escape
+% so we do not become unable to do a definition.
+
+{\catcode`\@=0 \catcode`\\=\other
+ at gdef@realbackslash{\}}
+
+\let\indexbackslash=0  %overridden during \printindex.
+
+\def\doind #1#2{%
+{\count10=\lastpenalty %
+{\indexdummies % Must do this here, since \bf, etc expand at this stage
+\escapechar=`\\%
+{\let\folio=0% Expand all macros now EXCEPT \folio
+\def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
+% so it will be output as is; and it will print as backslash in the indx.
+%
+% Now process the index-string once, with all font commands turned off,
+% to get the string to sort the index by.
+{\indexnofonts
+\xdef\temp1{#2}%
+}%
+% Now produce the complete index entry.  We process the index-string again,
+% this time with font commands expanded, to get what to print in the index.
+\edef\temp{%
+\write \csname#1indfile\endcsname{%
+\realbackslash entry {\temp1}{\folio}{#2}}}%
+\temp }%
+}\penalty\count10}}
+
+\def\dosubind #1#2#3{%
+{\count10=\lastpenalty %
+{\indexdummies % Must do this here, since \bf, etc expand at this stage
+\escapechar=`\\%
+{\let\folio=0%
+\def\rawbackslashxx{\indexbackslash}%
+%
+% Now process the index-string once, with all font commands turned off,
+% to get the string to sort the index by.
+{\indexnofonts
+\xdef\temp1{#2 #3}%
+}%
+% Now produce the complete index entry.  We process the index-string again,
+% this time with font commands expanded, to get what to print in the index.
+\edef\temp{%
+\write \csname#1indfile\endcsname{%
+\realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
+\temp }%
+}\penalty\count10}}
+
+% The index entry written in the file actually looks like
+%  \entry {sortstring}{page}{topic}
+% or
+%  \entry {sortstring}{page}{topic}{subtopic}
+% The texindex program reads in these files and writes files
+% containing these kinds of lines:
+%  \initial {c}
+%     before the first topic whose initial is c
+%  \entry {topic}{pagelist}
+%     for a topic that is used without subtopics
+%  \primary {topic}
+%     for the beginning of a topic that is used with subtopics
+%  \secondary {subtopic}{pagelist}
+%     for each subtopic.
+
+% Define the user-accessible indexing commands 
+% @findex, @vindex, @kindex, @cindex.
+
+\def\findex {\fnindex}
+\def\kindex {\kyindex}
+\def\cindex {\cpindex}
+\def\vindex {\vrindex}
+\def\tindex {\tpindex}
+\def\pindex {\pgindex}
+
+\def\cindexsub {\begingroup\obeylines\cindexsub}
+{\obeylines %
+\gdef\cindexsub "#1" #2^^M{\endgroup %
+\dosubind{cp}{#2}{#1}}}
+
+% Define the macros used in formatting output of the sorted index material.
+
+% This is what you call to cause a particular index to get printed.
+% Write
+% @unnumbered Function Index
+% @printindex fn
+
+\def\printindex{\parsearg\doprintindex}
+
+\def\doprintindex#1{%
+  \tex
+  \dobreak \chapheadingskip {10000}
+  \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
+  \catcode`\$=\other\catcode`\_=\other
+  \catcode`\~=\other
+  %
+  % The following don't help, since the chars were translated
+  % when the raw index was written, and their fonts were discarded
+  % due to \indexnofonts.
+  %\catcode`\"=\active
+  %\catcode`\^=\active
+  %\catcode`\_=\active
+  %\catcode`\|=\active
+  %\catcode`\<=\active
+  %\catcode`\>=\active
+  % %
+  \def\indexbackslash{\rawbackslashxx}
+  \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
+  \begindoublecolumns
+  %
+  % See if the index file exists and is nonempty.
+  \openin 1 \jobname.#1s
+  \ifeof 1 
+    % \enddoublecolumns gets confused if there is no text in the index,
+    % and it loses the chapter title and the aux file entries for the
+    % index.  The easiest way to prevent this problem is to make sure
+    % there is some text.
+    (Index is nonexistent)
+    \else
+    %
+    % If the index file exists but is empty, then \openin leaves \ifeof
+    % false.  We have to make TeX try to read something from the file, so
+    % it can discover if there is anything in it.
+    \read 1 to \temp
+    \ifeof 1
+      (Index is empty)
+    \else
+      \input \jobname.#1s
+    \fi
+  \fi
+  \closein 1
+  \enddoublecolumns
+  \Etex
+}
+
+% These macros are used by the sorted index file itself.
+% Change them to control the appearance of the index.
+
+% Same as \bigskipamount except no shrink.
+% \balancecolumns gets confused if there is any shrink.
+\newskip\initialskipamount \initialskipamount 12pt plus4pt
+
+\def\initial #1{%
+{\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
+\ifdim\lastskip<\initialskipamount
+\removelastskip \penalty-200 \vskip \initialskipamount\fi
+\line{\secbf#1\hfill}\kern 2pt\penalty10000}}
+
+% This typesets a paragraph consisting of #1, dot leaders, and then #2
+% flush to the right margin.  It is used for index and table of contents
+% entries.  The paragraph is indented by \leftskip.
+% 
+\def\entry #1#2{\begingroup
+  %
+  % Start a new paragraph if necessary, so our assignments below can't
+  % affect previous text.
+  \par
+  %
+  % Do not fill out the last line with white space.
+  \parfillskip = 0in
+  %
+  % No extra space above this paragraph.
+  \parskip = 0in
+  %
+  % Do not prefer a separate line ending with a hyphen to fewer lines.
+  \finalhyphendemerits = 0
+  %
+  % \hangindent is only relevant when the entry text and page number
+  % don't both fit on one line.  In that case, bob suggests starting the
+  % dots pretty far over on the line.  Unfortunately, a large
+  % indentation looks wrong when the entry text itself is broken across
+  % lines.  So we use a small indentation and put up with long leaders.
+  % 
+  % \hangafter is reset to 1 (which is the value we want) at the start
+  % of each paragraph, so we need not do anything with that.
+  \hangindent=2em
+  %
+  % When the entry text needs to be broken, just fill out the first line
+  % with blank space.
+  \rightskip = 0pt plus1fil
+  %
+  % Start a ``paragraph'' for the index entry so the line breaking
+  % parameters we've set above will have an effect.
+  \noindent
+  %
+  % Insert the text of the index entry.  TeX will do line-breaking on it.
+  #1%
+  %
+  % If we must, put the page number on a line of its own, and fill out
+  % this line with blank space.  (The \hfil is overwhelmed with the
+  % fill leaders glue in \indexdotfill if the page number does fit.)
+  \hfil\penalty50
+  \null\nobreak\indexdotfill % Have leaders before the page number.
+  %
+  % The `\ ' here is removed by the implicit \unskip that TeX does as
+  % part of (the primitive) \par.  Without it, a spurious underfull
+  % \hbox ensues.
+  \ #2% The page number ends the paragraph.
+  \par
+\endgroup}
+
+% Like \dotfill except takes at least 1 em.
+\def\indexdotfill{\cleaders
+  \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
+
+\def\primary #1{\line{#1\hfil}}
+
+\newskip\secondaryindent \secondaryindent=0.5cm
+
+\def\secondary #1#2{
+{\parfillskip=0in \parskip=0in
+\hangindent =1in \hangafter=1
+\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
+}}
+
+%% Define two-column mode, which is used in indexes.
+%% Adapted from the TeXbook, page 416.
+\catcode `\@=11
+
+\newbox\partialpage
+
+\newdimen\doublecolumnhsize
+
+\def\begindoublecolumns{\begingroup
+  % Grab any single-column material above us.
+  \output = {\global\setbox\partialpage
+    =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
+  \eject
+  %
+  % Now switch to the double-column output routine.
+  \output={\doublecolumnout}%
+  %
+  % Change the page size parameters.  We could do this once outside this
+  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
+  % format, but then we repeat the same computation.  Repeating a couple
+  % of assignments once per index is clearly meaningless for the
+  % execution time, so we may as well do it once.
+  % 
+  % First we halve the line length, less a little for the gutter between
+  % the columns.  We compute the gutter based on the line length, so it
+  % changes automatically with the paper format.  The magic constant
+  % below is chosen so that the gutter has the same value (well, +- <
+  % 1pt) as it did when we hard-coded it.
+  % 
+  % We put the result in a separate register, \doublecolumhsize, so we
+  % can restore it in \pagesofar, after \hsize itself has (potentially)
+  % been clobbered.
+  % 
+  \doublecolumnhsize = \hsize
+    \advance\doublecolumnhsize by -.04154\hsize
+    \divide\doublecolumnhsize by 2
+  \hsize = \doublecolumnhsize
+  %
+  % Double the \vsize as well.  (We don't need a separate register here,
+  % since nobody clobbers \vsize.)
+  \vsize = 2\vsize
+  \doublecolumnpagegoal
+}
+
+\def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
+
+\def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
+  \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
+  \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
+  \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
+  \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
+  \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
+}
+\def\doublecolumnpagegoal{%
+  \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
+}
+\def\pagesofar{\unvbox\partialpage %
+  \hsize=\doublecolumnhsize % have to restore this since output routine
+  \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
+\def\doublecolumnout{%
+  \setbox5=\copy255
+  {\vbadness=10000 \doublecolumnsplit}
+  \ifvbox255
+    \setbox0=\vtop to\dimen@{\unvbox0}
+    \setbox2=\vtop to\dimen@{\unvbox2}
+    \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
+  \else
+    \setbox0=\vbox{\unvbox5}
+    \ifvbox0
+      \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
+      \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
+      {\vbadness=10000
+	\loop \global\setbox5=\copy0
+          \setbox1=\vsplit5 to\dimen@
+          \setbox3=\vsplit5 to\dimen@
+          \ifvbox5 \global\advance\dimen@ by1pt \repeat
+        \setbox0=\vbox to\dimen@{\unvbox1}
+        \setbox2=\vbox to\dimen@{\unvbox3}
+        \global\setbox\partialpage=\vbox{\pagesofar}
+        \doublecolumnpagegoal
+      }
+    \fi
+  \fi
+}
+
+\catcode `\@=\other
+\message{sectioning,}
+% Define chapters, sections, etc.
+
+\newcount \chapno
+\newcount \secno        \secno=0
+\newcount \subsecno     \subsecno=0
+\newcount \subsubsecno  \subsubsecno=0
+
+% This counter is funny since it counts through charcodes of letters A, B, ...
+\newcount \appendixno  \appendixno = `\@
+\def\appendixletter{\char\the\appendixno}
+
+\newwrite \contentsfile
+% This is called from \setfilename.
+\def\opencontents{\openout \contentsfile = \jobname.toc}
+
+% Each @chapter defines this as the name of the chapter.
+% page headings and footings can use it.  @section does likewise
+
+\def\thischapter{} \def\thissection{}
+\def\seccheck#1{\if \pageno<0 %
+\errmessage{@#1 not allowed after generating table of contents}\fi
+%
+}
+
+\def\chapternofonts{%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\def\result{\realbackslash result}
+\def\equiv{\realbackslash equiv}
+\def\expansion{\realbackslash expansion}
+\def\print{\realbackslash print}
+\def\TeX{\realbackslash TeX}
+\def\dots{\realbackslash dots}
+\def\copyright{\realbackslash copyright}
+\def\tt{\realbackslash tt}
+\def\bf{\realbackslash bf }
+\def\w{\realbackslash w}
+\def\less{\realbackslash less}
+\def\gtr{\realbackslash gtr}
+\def\hat{\realbackslash hat}
+\def\char{\realbackslash char}
+\def\tclose##1{\realbackslash tclose {##1}}
+\def\code##1{\realbackslash code {##1}}
+\def\samp##1{\realbackslash samp {##1}}
+\def\r##1{\realbackslash r {##1}}
+\def\b##1{\realbackslash b {##1}}
+\def\key##1{\realbackslash key {##1}}
+\def\file##1{\realbackslash file {##1}}
+\def\kbd##1{\realbackslash kbd {##1}}
+% These are redefined because @smartitalic wouldn't work inside xdef.
+\def\i##1{\realbackslash i {##1}}
+\def\cite##1{\realbackslash cite {##1}}
+\def\var##1{\realbackslash var {##1}}
+\def\emph##1{\realbackslash emph {##1}}
+\def\dfn##1{\realbackslash dfn {##1}}
+}
+
+\def\thischaptername{No Chapter Title}
+\outer\def\chapter{\parsearg\chapterzzz}
+\def\chapterzzz #1{\seccheck{chapter}%
+\secno=0 \subsecno=0 \subsubsecno=0
+\global\advance \chapno by 1 \message{Chapter \the\chapno}%
+\chapmacro {#1}{\the\chapno}%
+\gdef\thissection{#1}%
+\gdef\thischaptername{#1}%
+% We don't substitute the actual chapter name into \thischapter
+% because we don't want its macros evaluated now.
+\xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
+{\chapternofonts%
+\edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp  %
+\donoderef %
+\global\let\section = \numberedsec
+\global\let\subsection = \numberedsubsec
+\global\let\subsubsection = \numberedsubsubsec
+}}
+
+\outer\def\appendix{\parsearg\appendixzzz}
+\def\appendixzzz #1{\seccheck{appendix}%
+\secno=0 \subsecno=0 \subsubsecno=0
+\global\advance \appendixno by 1 \message{Appendix \appendixletter}%
+\chapmacro {#1}{Appendix \appendixletter}%
+\gdef\thissection{#1}%
+\gdef\thischaptername{#1}%
+\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
+{\chapternofonts%
+\edef\temp{{\realbackslash chapentry 
+  {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp  %
+\appendixnoderef %
+\global\let\section = \appendixsec
+\global\let\subsection = \appendixsubsec
+\global\let\subsubsection = \appendixsubsubsec
+}}
+
+\outer\def\top{\parsearg\unnumberedzzz}
+\outer\def\unnumbered{\parsearg\unnumberedzzz}
+\def\unnumberedzzz #1{\seccheck{unnumbered}%
+\secno=0 \subsecno=0 \subsubsecno=0
+%
+% This used to be simply \message{#1}, but TeX fully expands the
+% argument to \message.  Therefore, if #1 contained @-commands, TeX
+% expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
+% expanded @cite (which turns out to cause errors because \cite is meant
+% to be executed, not expanded).  
+% 
+% Anyway, we don't want the fully-expanded definition of @cite to appear
+% as a result of the \message, we just want `@cite' itself.  We use
+% \the<toks register> to achieve this: TeX expands \the<toks> only once,
+% simply yielding the contents of the <toks register>.
+\toks0 = {#1}\message{(\the\toks0)}%
+%
+\unnumbchapmacro {#1}%
+\gdef\thischapter{#1}\gdef\thissection{#1}%
+{\chapternofonts%
+\edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp  %
+\unnumbnoderef %
+\global\let\section = \unnumberedsec
+\global\let\subsection = \unnumberedsubsec
+\global\let\subsubsection = \unnumberedsubsubsec
+}}
+
+\outer\def\numberedsec{\parsearg\seczzz}
+\def\seczzz #1{\seccheck{section}%
+\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
+\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
+{\chapternofonts%
+\edef\temp{{\realbackslash secentry %
+{#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\donoderef %
+\penalty 10000 %
+}}
+
+\outer\def\appendixsection{\parsearg\appendixsectionzzz}
+\outer\def\appendixsec{\parsearg\appendixsectionzzz}
+\def\appendixsectionzzz #1{\seccheck{appendixsection}%
+\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
+\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
+{\chapternofonts%
+\edef\temp{{\realbackslash secentry %
+{#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\appendixnoderef %
+\penalty 10000 %
+}}
+
+\outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
+\def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
+\plainsecheading {#1}\gdef\thissection{#1}%
+{\chapternofonts%
+\edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\unnumbnoderef %
+\penalty 10000 %
+}}
+
+\outer\def\numberedsubsec{\parsearg\numberedsubseczzz}
+\def\numberedsubseczzz #1{\seccheck{subsection}%
+\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
+\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
+{\chapternofonts%
+\edef\temp{{\realbackslash subsecentry %
+{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\donoderef %
+\penalty 10000 %
+}}
+
+\outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
+\def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
+\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
+\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
+{\chapternofonts%
+\edef\temp{{\realbackslash subsecentry %
+{#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\appendixnoderef %
+\penalty 10000 %
+}}
+
+\outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
+\def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
+\plainsecheading {#1}\gdef\thissection{#1}%
+{\chapternofonts%
+\edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\unnumbnoderef %
+\penalty 10000 %
+}}
+
+\outer\def\numberedsubsubsec{\parsearg\numberedsubsubseczzz}
+\def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
+\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
+\subsubsecheading {#1}
+  {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
+{\chapternofonts%
+\edef\temp{{\realbackslash subsubsecentry %
+  {#1}
+  {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
+  {\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\donoderef %
+\penalty 10000 %
+}}
+
+\outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
+\def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
+\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
+\subsubsecheading {#1}
+  {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
+{\chapternofonts%
+\edef\temp{{\realbackslash subsubsecentry{#1}%
+  {\appendixletter}
+  {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\appendixnoderef %
+\penalty 10000 %
+}}
+
+\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
+\def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
+\plainsecheading {#1}\gdef\thissection{#1}%
+{\chapternofonts%
+\edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\unnumbnoderef %
+\penalty 10000 %
+}}
+
+% These are variants which are not "outer", so they can appear in @ifinfo.
+% Actually, they should now be obsolete; ordinary section commands should work.
+\def\infotop{\parsearg\unnumberedzzz}
+\def\infounnumbered{\parsearg\unnumberedzzz}
+\def\infounnumberedsec{\parsearg\unnumberedseczzz}
+\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
+\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
+
+\def\infoappendix{\parsearg\appendixzzz}
+\def\infoappendixsec{\parsearg\appendixseczzz}
+\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
+\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
+
+\def\infochapter{\parsearg\chapterzzz}
+\def\infosection{\parsearg\sectionzzz}
+\def\infosubsection{\parsearg\subsectionzzz}
+\def\infosubsubsection{\parsearg\subsubsectionzzz}
+
+% These macros control what the section commands do, according
+% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
+% Define them by default for a numbered chapter.
+\global\let\section = \numberedsec
+\global\let\subsection = \numberedsubsec
+\global\let\subsubsection = \numberedsubsubsec
+
+% Define @majorheading, @heading and @subheading
+
+% NOTE on use of \vbox for chapter headings, section headings, and
+% such:
+%	1) We use \vbox rather than the earlier \line to permit
+%	   overlong headings to fold.
+%	2) \hyphenpenalty is set to 10000 because hyphenation in a
+%	   heading is obnoxious; this forbids it.
+%       3) Likewise, headings look best if no \parindent is used, and
+%          if justification is not attempted.  Hence \raggedright.
+
+
+\def\majorheading{\parsearg\majorheadingzzz}
+\def\majorheadingzzz #1{%
+{\advance\chapheadingskip by 10pt \chapbreak }%
+{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                  \parindent=0pt\raggedright
+                  \rm #1\hfill}}\bigskip \par\penalty 200}
+
+\def\chapheading{\parsearg\chapheadingzzz}
+\def\chapheadingzzz #1{\chapbreak %
+{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                  \parindent=0pt\raggedright
+                  \rm #1\hfill}}\bigskip \par\penalty 200}
+
+\def\heading{\parsearg\secheadingi}
+
+\def\subheading{\parsearg\subsecheadingi}
+
+\def\subsubheading{\parsearg\subsubsecheadingi}
+
+% These macros generate a chapter, section, etc. heading only
+% (including whitespace, linebreaking, etc. around it),
+% given all the information in convenient, parsed form.
+
+%%% Args are the skip and penalty (usually negative)
+\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
+
+\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
+
+%%% Define plain chapter starts, and page on/off switching for it
+% Parameter controlling skip before chapter headings (if needed)
+
+\newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
+
+\def\chapbreak{\dobreak \chapheadingskip {-4000}}
+\def\chappager{\par\vfill\supereject}
+\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
+
+\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
+
+\def\CHAPPAGoff{
+\global\let\pchapsepmacro=\chapbreak
+\global\let\pagealignmacro=\chappager}
+
+\def\CHAPPAGon{
+\global\let\pchapsepmacro=\chappager
+\global\let\pagealignmacro=\chappager
+\global\def\HEADINGSon{\HEADINGSsingle}}
+
+\def\CHAPPAGodd{
+\global\let\pchapsepmacro=\chapoddpage
+\global\let\pagealignmacro=\chapoddpage
+\global\def\HEADINGSon{\HEADINGSdouble}}
+
+\CHAPPAGon
+
+\def\CHAPFplain{
+\global\let\chapmacro=\chfplain
+\global\let\unnumbchapmacro=\unnchfplain}
+
+\def\chfplain #1#2{%
+  \pchapsepmacro
+  {%
+    \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                     \parindent=0pt\raggedright
+                     \rm #2\enspace #1}%
+  }%
+  \bigskip
+  \penalty5000
+}
+
+\def\unnchfplain #1{%
+\pchapsepmacro %
+{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                  \parindent=0pt\raggedright
+                  \rm #1\hfill}}\bigskip \par\penalty 10000 %
+}
+\CHAPFplain % The default
+
+\def\unnchfopen #1{%
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                       \parindent=0pt\raggedright
+                       \rm #1\hfill}}\bigskip \par\penalty 10000 %
+}
+
+\def\chfopen #1#2{\chapoddpage {\chapfonts
+\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
+\par\penalty 5000 %
+}
+
+\def\CHAPFopen{
+\global\let\chapmacro=\chfopen
+\global\let\unnumbchapmacro=\unnchfopen}
+
+% Parameter controlling skip before section headings.
+
+\newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
+\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
+
+\newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
+\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
+
+% @paragraphindent  is defined for the Info formatting commands only.
+\let\paragraphindent=\comment
+
+% Section fonts are the base font at magstep2, which produces
+% a size a bit more than 14 points in the default situation.	
+
+\def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
+\def\plainsecheading #1{\secheadingi {#1}}
+\def\secheadingi #1{{\advance \secheadingskip by \parskip %
+\secheadingbreak}%
+{\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                 \parindent=0pt\raggedright
+                 \rm #1\hfill}}%
+\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
+
+
+% Subsection fonts are the base font at magstep1, 
+% which produces a size of 12 points.
+
+\def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
+\def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
+\subsecheadingbreak}%
+{\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                     \parindent=0pt\raggedright
+                     \rm #1\hfill}}%
+\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
+
+\def\subsubsecfonts{\subsecfonts} % Maybe this should change:
+				  % Perhaps make sssec fonts scaled
+				  % magstep half
+\def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
+\def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
+\subsecheadingbreak}%
+{\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                       \parindent=0pt\raggedright
+                       \rm #1\hfill}}%
+\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
+
+
+\message{toc printing,}
+
+% Finish up the main text and prepare to read what we've written
+% to \contentsfile.
+
+\newskip\contentsrightmargin \contentsrightmargin=1in
+\def\startcontents#1{%
+   \pagealignmacro
+   \immediate\closeout \contentsfile
+   \ifnum \pageno>0
+      \pageno = -1		% Request roman numbered pages.
+   \fi
+   % Don't need to put `Contents' or `Short Contents' in the headline. 
+   % It is abundantly clear what they are.
+   \unnumbchapmacro{#1}\def\thischapter{}%
+   \begingroup   		% Set up to handle contents files properly.
+      \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
+      \raggedbottom             % Worry more about breakpoints than the bottom.
+      \advance\hsize by -\contentsrightmargin % Don't use the full line length.
+}
+
+  
+% Normal (long) toc.
+\outer\def\contents{%
+   \startcontents{Table of Contents}%
+      \input \jobname.toc
+   \endgroup
+   \vfill \eject
+}
+
+% And just the chapters.
+\outer\def\summarycontents{%
+   \startcontents{Short Contents}%
+      %
+      \let\chapentry = \shortchapentry
+      \let\unnumbchapentry = \shortunnumberedentry
+      % We want a true roman here for the page numbers.
+      \secfonts
+      \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
+      \rm
+      \advance\baselineskip by 1pt % Open it up a little.
+      \def\secentry ##1##2##3##4{}
+      \def\unnumbsecentry ##1##2{}
+      \def\subsecentry ##1##2##3##4##5{}
+      \def\unnumbsubsecentry ##1##2{}
+      \def\subsubsecentry ##1##2##3##4##5##6{}
+      \def\unnumbsubsubsecentry ##1##2{}
+      \input \jobname.toc
+   \endgroup
+   \vfill \eject
+}
+\let\shortcontents = \summarycontents
+
+% These macros generate individual entries in the table of contents.
+% The first argument is the chapter or section name.
+% The last argument is the page number.
+% The arguments in between are the chapter number, section number, ...
+
+% Chapter-level things, for both the long and short contents.
+\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
+
+% See comments in \dochapentry re vbox and related settings
+\def\shortchapentry#1#2#3{%
+  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
+}
+
+% Typeset the label for a chapter or appendix for the short contents.
+% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
+% We could simplify the code here by writing out an \appendixentry
+% command in the toc file for appendices, instead of using \chapentry
+% for both, but it doesn't seem worth it.
+\setbox0 = \hbox{\shortcontrm Appendix }
+\newdimen\shortappendixwidth \shortappendixwidth = \wd0
+
+\def\shortchaplabel#1{%
+  % We typeset #1 in a box of constant width, regardless of the text of
+  % #1, so the chapter titles will come out aligned.
+  \setbox0 = \hbox{#1}%
+  \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
+  %
+  % This space should be plenty, since a single number is .5em, and the
+  % widest letter (M) is 1em, at least in the Computer Modern fonts.
+  % (This space doesn't include the extra space that gets added after
+  % the label; that gets put in in \shortchapentry above.)
+  \advance\dimen0 by 1.1em
+  \hbox to \dimen0{#1\hfil}%
+}
+
+\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
+\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
+
+% Sections.
+\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
+\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
+
+% Subsections.
+\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
+\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
+
+% And subsubsections.
+\def\subsubsecentry#1#2#3#4#5#6{%
+  \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
+\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
+
+
+% This parameter controls the indentation of the various levels.
+\newdimen\tocindent \tocindent = 3pc
+
+% Now for the actual typesetting. In all these, #1 is the text and #2 is the 
+% page number.
+%
+% If the toc has to be broken over pages, we would want to be at chapters 
+% if at all possible; hence the \penalty.
+\def\dochapentry#1#2{%
+   \penalty-300 \vskip\baselineskip
+   \begingroup
+     \chapentryfonts
+     \tocentry{#1}{\dopageno{#2}}%
+   \endgroup
+   \nobreak\vskip .25\baselineskip
+}
+
+\def\dosecentry#1#2{\begingroup
+  \secentryfonts \leftskip=\tocindent
+  \tocentry{#1}{\dopageno{#2}}%
+\endgroup}
+
+\def\dosubsecentry#1#2{\begingroup
+  \subsecentryfonts \leftskip=2\tocindent
+  \tocentry{#1}{\dopageno{#2}}%
+\endgroup}
+
+\def\dosubsubsecentry#1#2{\begingroup
+  \subsubsecentryfonts \leftskip=3\tocindent
+  \tocentry{#1}{\dopageno{#2}}%
+\endgroup}
+
+% Final typesetting of a toc entry; we use the same \entry macro as for
+% the index entries, but we want to suppress hyphenation here.  (We
+% can't do that in the \entry macro, since index entries might consist
+% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
+% 
+\def\tocentry#1#2{\begingroup
+  \hyphenpenalty = 10000
+  \entry{#1}{#2}%
+\endgroup}
+
+% Space between chapter (or whatever) number and the title.
+\def\labelspace{\hskip1em \relax}
+
+\def\dopageno#1{{\rm #1}}
+\def\doshortpageno#1{{\rm #1}}
+
+\def\chapentryfonts{\secfonts \rm}
+\def\secentryfonts{\textfonts}
+\let\subsecentryfonts = \textfonts
+\let\subsubsecentryfonts = \textfonts
+
+
+\message{environments,}
+
+% Since these characters are used in examples, it should be an even number of 
+% \tt widths. Each \tt character is 1en, so two makes it 1em.
+% Furthermore, these definitions must come after we define our fonts.
+\newbox\dblarrowbox    \newbox\longdblarrowbox
+\newbox\pushcharbox    \newbox\bullbox
+\newbox\equivbox       \newbox\errorbox
+
+\let\ptexequiv = \equiv
+
+%{\tentt
+%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
+%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
+%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
+%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
+% Adapted from the manmac format (p.420 of TeXbook)
+%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
+%                                      depth .1ex\hfil}
+%}
+
+\def\point{$\star$}
+
+\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
+\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
+\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
+
+\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
+
+% Adapted from the TeXbook's \boxit.
+{\tentt \global\dimen0 = 3em}% Width of the box.
+\dimen2 = .55pt % Thickness of rules
+% The text. (`r' is open on the right, `e' somewhat less so on the left.)
+\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
+
+\global\setbox\errorbox=\hbox to \dimen0{\hfil
+   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
+   \advance\hsize by -2\dimen2 % Rules.
+   \vbox{
+      \hrule height\dimen2
+      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
+         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
+         \kern3pt\vrule width\dimen2}% Space to right.
+      \hrule height\dimen2}
+    \hfil}
+
+% The @error{} command.
+\def\error{\leavevmode\lower.7ex\copy\errorbox}
+
+% @tex ... @end tex    escapes into raw Tex temporarily.
+% One exception: @ is still an escape character, so that @end tex works.
+% But \@ or @@ will get a plain tex @ character.
+
+\def\tex{\begingroup
+\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
+\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
+\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
+\catcode `\%=14
+\catcode 43=12
+\catcode`\"=12
+\catcode`\==12
+\catcode`\|=12
+\catcode`\<=12
+\catcode`\>=12
+\escapechar=`\\
+%
+\let\{=\ptexlbrace
+\let\}=\ptexrbrace
+\let\.=\ptexdot
+\let\*=\ptexstar
+\let\dots=\ptexdots
+\def\@{@}%
+\let\bullet=\ptexbullet
+\let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
+\let\L=\ptexL
+%
+\let\Etex=\endgroup}
+
+% Define @lisp ... @endlisp.
+% @lisp does a \begingroup so it can rebind things,
+% including the definition of @endlisp (which normally is erroneous).
+
+% Amount to narrow the margins by for @lisp.
+\newskip\lispnarrowing \lispnarrowing=0.4in
+
+% This is the definition that ^M gets inside @lisp
+% phr: changed space to \null, to avoid overfull hbox problems.
+{\obeyspaces%
+\gdef\lisppar{\null\endgraf}}
+
+% Cause \obeyspaces to make each Space cause a word-separation
+% rather than the default which is that it acts punctuation.
+% This is because space in tt font looks funny.
+{\obeyspaces %
+\gdef\sepspaces{\def {\ }}}
+
+% This space is always present above and below environments.
+\newskip\envskipamount \envskipamount = 0pt
+
+% Make spacing and below environment symmetrical.
+\def\aboveenvbreak{{\advance\envskipamount by \parskip
+\endgraf \ifdim\lastskip<\envskipamount
+\removelastskip \penalty-50 \vskip\envskipamount \fi}}
+
+\let\afterenvbreak = \aboveenvbreak
+
+% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
+\let\nonarrowing=\relax
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \cartouche: draw rectangle w/rounded corners around argument
+\font\circle=lcircle10
+\newdimen\circthick
+\newdimen\cartouter\newdimen\cartinner
+\newskip\normbskip\newskip\normpskip\newskip\normlskip
+\circthick=\fontdimen8\circle
+%
+\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
+\def\ctr{{\hskip 6pt\circle\char'010}}
+\def\cbl{{\circle\char'012\hskip -6pt}}
+\def\cbr{{\hskip 6pt\circle\char'011}}
+\def\carttop{\hbox to \cartouter{\hskip\lskip
+	\ctl\leaders\hrule height\circthick\hfil\ctr
+	\hskip\rskip}}
+\def\cartbot{\hbox to \cartouter{\hskip\lskip
+	\cbl\leaders\hrule height\circthick\hfil\cbr
+	\hskip\rskip}}
+%
+\newskip\lskip\newskip\rskip
+
+\long\def\cartouche{%
+\begingroup
+	\lskip=\leftskip \rskip=\rightskip
+	\leftskip=0pt\rightskip=0pt %we want these *outside*.
+	\cartinner=\hsize \advance\cartinner by-\lskip 
+		 	  \advance\cartinner by-\rskip
+	\cartouter=\hsize
+	\advance\cartouter by 18pt % allow for 3pt kerns on either
+%				     side, and for 6pt waste from
+%				     each corner char
+	\normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
+	% Flag to tell @lisp, etc., not to narrow margin.
+	\let\nonarrowing=\comment
+	\vbox\bgroup
+		\baselineskip=0pt\parskip=0pt\lineskip=0pt
+		\carttop
+		\hbox\bgroup
+			\hskip\lskip
+			\vrule\kern3pt
+			\vbox\bgroup
+				\hsize=\cartinner
+				\kern3pt
+				\begingroup
+					\baselineskip=\normbskip
+					\lineskip=\normlskip
+					\parskip=\normpskip
+					\vskip -\parskip
+\def\Ecartouche{%
+				\endgroup
+				\kern3pt
+			\egroup
+			\kern3pt\vrule
+			\hskip\rskip
+		\egroup
+		\cartbot
+	\egroup
+\endgroup
+}}	
+
+\def\lisp{\aboveenvbreak
+\begingroup\inENV % This group ends at the end of the @lisp body
+\hfuzz=12truept % Don't be fussy
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% Single space lines
+\singlespace %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+\let\par=\lisppar
+\def\Elisp{\endgroup\afterenvbreak}%
+\parskip=0pt
+% @cartouche defines \nonarrowing to inhibit narrowing
+% at next level down.
+\ifx\nonarrowing\relax
+\advance \leftskip by \lispnarrowing
+\exdentamount=\lispnarrowing
+\let\exdent=\nofillexdent
+\let\nonarrowing=\relax
+\fi
+\parindent=0pt
+\obeyspaces \obeylines \tt \rawbackslash
+\gobble
+}
+
+% Define the \E... control sequence only if we are inside the
+% environment, so the error checking in \end will work.
+% 
+% We must call \lisp last in the definition, since it reads the
+% return following the @example (or whatever) command.
+%
+\def\example{\begingroup \def\Eexample{\Elisp\endgroup}\lisp}
+\def\smallexample{\begingroup \def\Esmallexample{\Elisp\endgroup}\lisp}
+
+% Macro for 9 pt. examples, necessary to print with 5" lines.
+% From Pavel at xerox.  This is not really used unless the
+% @smallbook command is given.
+
+\def\smalllispx{\aboveenvbreak\begingroup\inENV
+%			This group ends at the end of the @lisp body
+\hfuzz=12truept % Don't be fussy
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% Single space lines
+\singlespace %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+\let\par=\lisppar
+\def\Esmalllisp{\endgroup\afterenvbreak}%
+%%%% Smaller baseline skip for small examples.
+\baselineskip 10pt
+\parskip=0pt
+% @cartouche defines \nonarrowing to inhibit narrowing
+% at next level down.
+\ifx\nonarrowing\relax
+\advance \leftskip by \lispnarrowing
+\exdentamount=\lispnarrowing
+\let\exdent=\nofillexdent
+\let\nonarrowing=\relax
+\fi
+\parindent=0pt
+\obeyspaces \obeylines \ninett \indexfonts \rawbackslash
+\def\next##1{}\next}
+
+% This is @display; same as @lisp except use roman font.
+
+\def\display{\begingroup\inENV %This group ends at the end of the @display body
+\aboveenvbreak
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% Single space lines
+\singlespace %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+\let\par=\lisppar
+\def\Edisplay{\endgroup\afterenvbreak}%
+\parskip=0pt
+% @cartouche defines \nonarrowing to inhibit narrowing
+% at next level down.
+\ifx\nonarrowing\relax
+\advance \leftskip by \lispnarrowing
+\exdentamount=\lispnarrowing
+\let\exdent=\nofillexdent
+\let\nonarrowing=\relax
+\fi
+\parindent=0pt
+\obeyspaces \obeylines
+\def\next##1{}\next}
+
+% This is @format; same as @lisp except use roman font and don't narrow margins
+
+\def\format{\begingroup\inENV %This group ends at the end of the @format body
+\aboveenvbreak
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+\singlespace %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+\let\par=\lisppar
+\def\Eformat{\endgroup\afterenvbreak}
+\parskip=0pt \parindent=0pt
+\obeyspaces \obeylines
+\def\next##1{}\next}
+
+% @flushleft and @flushright
+
+\def\flushleft{%
+\begingroup\inENV %This group ends at the end of the @format body
+\aboveenvbreak
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+% This also causes @ to work when the directive name
+% is terminated by end of line.
+\let\par=\lisppar
+\def\Eflushleft{\endgroup\afterenvbreak}%
+\parskip=0pt \parindent=0pt
+\obeyspaces \obeylines
+\def\next##1{}\next}
+
+\def\flushright{%
+\begingroup\inENV %This group ends at the end of the @format body
+\aboveenvbreak
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+% This also causes @ to work when the directive name
+% is terminated by end of line.
+\let\par=\lisppar
+\def\Eflushright{\endgroup\afterenvbreak}%
+\parskip=0pt \parindent=0pt
+\advance \leftskip by 0pt plus 1fill
+\obeyspaces \obeylines
+\def\next##1{}\next}
+
+% @quotation - narrow the margins.
+
+\def\quotation{%
+\begingroup\inENV %This group ends at the end of the @quotation body
+{\parskip=0pt  % because we will skip by \parskip too, later
+\aboveenvbreak}%
+\singlespace
+\parindent=0pt
+\def\Equotation{\par\endgroup\afterenvbreak}%
+% @cartouche defines \nonarrowing to inhibit narrowing
+% at next level down.
+\ifx\nonarrowing\relax
+\advance \leftskip by \lispnarrowing
+\advance \rightskip by \lispnarrowing
+\exdentamount=\lispnarrowing
+\let\nonarrowing=\relax
+\fi}
+
+\message{defuns,}
+% Define formatter for defuns
+% First, allow user to change definition object font (\df) internally
+\def\setdeffont #1 {\csname DEF#1\endcsname}
+
+\newskip\defbodyindent \defbodyindent=.4in
+\newskip\defargsindent \defargsindent=50pt
+\newskip\deftypemargin \deftypemargin=12pt
+\newskip\deflastargmargin \deflastargmargin=18pt
+
+\newcount\parencount
+% define \functionparens, which makes ( and ) and & do special things.
+% \functionparens affects the group it is contained in.
+\def\activeparens{%
+\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
+\catcode`\[=\active \catcode`\]=\active}
+
+% Make control sequences which act like normal parenthesis chars.
+\let\lparen = ( \let\rparen = )
+
+{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
+
+% Be sure that we always have a definition for `(', etc.  For example,
+% if the fn name has parens in it, \boldbrax will not be in effect yet,
+% so TeX would otherwise complain about undefined control sequence.
+\global\let(=\lparen \global\let)=\rparen
+\global\let[=\lbrack \global\let]=\rbrack
+
+\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
+\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
+
+% Definitions of (, ) and & used in args for functions.
+% This is the definition of ( outside of all parentheses.
+\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
+\global\advance\parencount by 1 }
+%
+% This is the definition of ( when already inside a level of parens.
+\gdef\opnested{\char`\(\global\advance\parencount by 1 }
+%
+\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
+% also in that case restore the outer-level definition of (.
+\ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
+\global\advance \parencount by -1 }
+% If we encounter &foo, then turn on ()-hacking afterwards
+\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
+%
+\gdef\normalparens{\boldbrax\let&=\ampnr}
+} % End of definition inside \activeparens
+%% These parens (in \boldbrax) actually are a little bolder than the
+%% contained text.  This is especially needed for [ and ]
+\def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
+\def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
+
+% First, defname, which formats the header line itself.
+% #1 should be the function name.
+% #2 should be the type of definition, such as "Function".
+
+\def\defname #1#2{%
+% Get the values of \leftskip and \rightskip as they were
+% outside the @def...
+\dimen2=\leftskip
+\advance\dimen2 by -\defbodyindent
+\dimen3=\rightskip
+\advance\dimen3 by -\defbodyindent
+\noindent        %
+\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
+\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
+\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
+\parshape 2 0in \dimen0 \defargsindent \dimen1     %
+% Now output arg 2 ("Function" or some such)
+% ending at \deftypemargin from the right margin,
+% but stuck inside a box of width 0 so it does not interfere with linebreaking
+{% Adjust \hsize to exclude the ambient margins,
+% so that \rightline will obey them.
+\advance \hsize by -\dimen2 \advance \hsize by -\dimen3
+\rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
+% Make all lines underfull and no complaints:
+\tolerance=10000 \hbadness=10000    
+\advance\leftskip by -\defbodyindent
+\exdentamount=\defbodyindent
+{\df #1}\enskip        % Generate function name
+}
+
+% Actually process the body of a definition
+% #1 should be the terminating control sequence, such as \Edefun.
+% #2 should be the "another name" control sequence, such as \defunx.
+% #3 should be the control sequence that actually processes the header,
+%    such as \defunheader.
+
+\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
+\parindent=0in
+\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup %
+\catcode 61=\active %
+\obeylines\activeparens\spacesplit#3}
+
+\def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
+\parindent=0in
+\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
+
+\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2##1 ##2 {\def#4{##1}%
+\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
+\parindent=0in
+\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
+
+% These parsing functions are similar to the preceding ones
+% except that they do not make parens into active characters.
+% These are used for "variables" since they have no arguments.
+
+\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2{\begingroup\obeylines\spacesplit#3}%
+\parindent=0in
+\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup %
+\catcode 61=\active %
+\obeylines\spacesplit#3}
+
+\def\defvrparsebody #1#2#3#4 {\begingroup\inENV %
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
+\parindent=0in
+\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup\obeylines\spacesplit{#3{#4}}}
+
+% This seems to work right in all cases.
+\let\deftpparsebody=\defvrparsebody
+% This fails to work.  When given `@deftp {Data Type} foo_t',
+% it thinks the type name is just `f'.
+%%% This is the same as all the others except for the last line.  We need
+%%% to parse the arguments differently for @deftp, since the ``attributes''
+%%% there are optional.
+%%% 
+%%\def\deftpparsebody #1#2#3#4 {\begingroup\inENV %
+%%\medbreak %
+%%% Define the end token that this defining construct specifies
+%%% so that it will exit this group.
+%%\def#1{\endgraf\endgroup\medbreak}%
+%%\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
+%%\parindent=0in
+%%\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
+%%\exdentamount=\defbodyindent
+%%\begingroup\obeylines\parsetpheaderline{#3{#4}}}
+
+%%{\obeylines %
+%%  % Parse the type name and any attributes (field names, etc.).
+%%  % #1 is the beginning of the macro call that will produce the output,
+%%  %   i.e., \deftpheader{CLASS}; this is passed from \deftpparsebody.
+%%  % #2 is the type name, e.g., `struct termios'.
+%%  % #3 is the (possibly empty) attribute list.
+%%  % 
+%%  \gdef\parsetpheaderline#1#2#3^^M{%
+%%    \endgroup % Started in \deftpparsebody.
+%%    %
+%%    % If the attribute list is in fact empty, there will be no space after
+%%    % #2; so we can't put a space in our TeX parameter list.  But if it
+%%    % isn't empty, then #3 will begin with an unwanted space.
+%%    \def\theargs{\ignorespaces #3}%
+%%    %
+%%    % Call the macro to produce the output.
+%%    #1{#2}\theargs %
+%%  }%
+%%}
+
+\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2##1 ##2 {\def#4{##1}%
+\begingroup\obeylines\spacesplit{#3{##2}}}%
+\parindent=0in
+\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup\obeylines\spacesplit{#3{#5}}}
+
+% Split up #2 at the first space token.
+% call #1 with two arguments:
+%  the first is all of #2 before the space token,
+%  the second is all of #2 after that space token.
+% If #2 contains no space token, all of it is passed as the first arg
+% and the second is passed as empty.
+
+{\obeylines
+\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
+\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
+\ifx\relax #3%
+#1{#2}{}\else #1{#2}{#3#4}\fi}}
+
+% So much for the things common to all kinds of definitions.
+
+% Define @defun.
+
+% First, define the processing that is wanted for arguments of \defun
+% Use this to expand the args and terminate the paragraph they make up
+
+\def\defunargs #1{\functionparens \sl
+% Expand, preventing hyphenation at `-' chars.
+% Note that groups don't affect changes in \hyphenchar.
+\hyphenchar\tensl=0
+#1%
+\hyphenchar\tensl=45
+\ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
+\interlinepenalty=10000
+\advance\rightskip by 0pt plus 1fil
+\endgraf\penalty 10000\vskip -\parskip\penalty 10000%
+}
+
+\def\deftypefunargs #1{%
+% Expand, preventing hyphenation at `-' chars.
+% Note that groups don't affect changes in \hyphenchar.
+\functionparens
+\code{#1}%
+\interlinepenalty=10000
+\advance\rightskip by 0pt plus 1fil
+\endgraf\penalty 10000\vskip -\parskip\penalty 10000%
+}
+
+% Do complete processing of one @defun or @defunx line already parsed.
+
+% @deffn Command forward-char nchars
+
+\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
+
+\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
+\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defun == @deffn Function
+
+\def\defun{\defparsebody\Edefun\defunx\defunheader}
+
+\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{Function}%
+\defunargs {#2}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @deftypefun int foobar (int @var{foo}, float @var{bar})
+
+\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
+
+% #1 is the data type.  #2 is the name and args.
+\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
+% #1 is the data type, #2 the name, #3 the args.
+\def\deftypefunheaderx #1#2 #3\relax{%
+\doind {fn}{\code{#2}}% Make entry in function index
+\begingroup\defname {\code{#1} #2}{Function}%
+\deftypefunargs {#3}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
+
+\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
+
+% #1 is the classification.  #2 is the data type.  #3 is the name and args.
+\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
+% #1 is the classification, #2 the data type, #3 the name, #4 the args.
+\def\deftypefnheaderx #1#2#3 #4\relax{%
+\doind {fn}{\code{#3}}% Make entry in function index
+\begingroup\defname {\code{#2} #3}{#1}%
+\deftypefunargs {#4}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defmac == @deffn Macro
+
+\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
+
+\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{Macro}%
+\defunargs {#2}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defspec == @deffn Special Form
+
+\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
+
+\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{Special Form}%
+\defunargs {#2}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% This definition is run if you use @defunx
+% anywhere other than immediately after a @defun or @defunx.
+
+\def\deffnx #1 {\errmessage{@deffnx in invalid context}}
+\def\defunx #1 {\errmessage{@defunx in invalid context}}
+\def\defmacx #1 {\errmessage{@defmacx in invalid context}}
+\def\defspecx #1 {\errmessage{@defspecx in invalid context}}
+\def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
+\def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
+
+% @defmethod, and so on
+
+% @defop {Funny Method} foo-class frobnicate argument
+
+\def\defop #1 {\def\defoptype{#1}%
+\defopparsebody\Edefop\defopx\defopheader\defoptype}
+
+\def\defopheader #1#2#3{%
+\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
+\begingroup\defname {#2}{\defoptype{} on #1}%
+\defunargs {#3}\endgroup %
+}
+
+% @defmethod == @defop Method
+
+\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
+
+\def\defmethodheader #1#2#3{%
+\dosubind {fn}{\code{#2}}{on #1}% entry in function index
+\begingroup\defname {#2}{Method on #1}%
+\defunargs {#3}\endgroup %
+}
+
+% @defcv {Class Option} foo-class foo-flag
+
+\def\defcv #1 {\def\defcvtype{#1}%
+\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
+
+\def\defcvarheader #1#2#3{%
+\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
+\begingroup\defname {#2}{\defcvtype{} of #1}%
+\defvarargs {#3}\endgroup %
+}
+
+% @defivar == @defcv {Instance Variable}
+
+\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
+
+\def\defivarheader #1#2#3{%
+\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
+\begingroup\defname {#2}{Instance Variable of #1}%
+\defvarargs {#3}\endgroup %
+}
+
+% These definitions are run if you use @defmethodx, etc.,
+% anywhere other than immediately after a @defmethod, etc.
+
+\def\defopx #1 {\errmessage{@defopx in invalid context}}
+\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
+\def\defcvx #1 {\errmessage{@defcvx in invalid context}}
+\def\defivarx #1 {\errmessage{@defivarx in invalid context}}
+
+% Now @defvar
+
+% First, define the processing that is wanted for arguments of @defvar.
+% This is actually simple: just print them in roman.
+% This must expand the args and terminate the paragraph they make up
+\def\defvarargs #1{\normalparens #1%
+\interlinepenalty=10000
+\endgraf\penalty 10000\vskip -\parskip\penalty 10000}
+
+% @defvr Counter foo-count
+
+\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
+
+\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
+\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
+
+% @defvar == @defvr Variable
+
+\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
+
+\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
+\begingroup\defname {#1}{Variable}%
+\defvarargs {#2}\endgroup %
+}
+
+% @defopt == @defvr {User Option}
+
+\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
+
+\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
+\begingroup\defname {#1}{User Option}%
+\defvarargs {#2}\endgroup %
+}
+
+% @deftypevar int foobar
+
+\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
+
+% #1 is the data type.  #2 is the name.
+\def\deftypevarheader #1#2{%
+\doind {vr}{\code{#2}}% Make entry in variables index
+\begingroup\defname {\code{#1} #2}{Variable}%
+\interlinepenalty=10000
+\endgraf\penalty 10000\vskip -\parskip\penalty 10000
+\endgroup}
+
+% @deftypevr {Global Flag} int enable
+
+\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
+
+\def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
+\begingroup\defname {\code{#2} #3}{#1}
+\interlinepenalty=10000
+\endgraf\penalty 10000\vskip -\parskip\penalty 10000
+\endgroup}
+
+% This definition is run if you use @defvarx
+% anywhere other than immediately after a @defvar or @defvarx.
+
+\def\defvrx #1 {\errmessage{@defvrx in invalid context}}
+\def\defvarx #1 {\errmessage{@defvarx in invalid context}}
+\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
+\def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
+\def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
+
+% Now define @deftp
+% Args are printed in bold, a slight difference from @defvar.
+
+\def\deftpargs #1{\bf \defvarargs{#1}}
+
+% @deftp Class window height width ...
+
+\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
+
+\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
+\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
+
+% This definition is run if you use @deftpx, etc
+% anywhere other than immediately after a @deftp, etc.
+
+\def\deftpx #1 {\errmessage{@deftpx in invalid context}}
+
+\message{cross reference,}
+% Define cross-reference macros
+\newwrite \auxfile
+
+\newif\ifhavexrefs  % True if xref values are known.
+\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
+
+% \setref{foo} defines a cross-reference point named foo.
+
+\def\setref#1{%
+%\dosetq{#1-title}{Ytitle}%
+\dosetq{#1-pg}{Ypagenumber}%
+\dosetq{#1-snt}{Ysectionnumberandtype}}
+
+\def\unnumbsetref#1{%
+%\dosetq{#1-title}{Ytitle}%
+\dosetq{#1-pg}{Ypagenumber}%
+\dosetq{#1-snt}{Ynothing}}
+
+\def\appendixsetref#1{%
+%\dosetq{#1-title}{Ytitle}%
+\dosetq{#1-pg}{Ypagenumber}%
+\dosetq{#1-snt}{Yappendixletterandtype}}
+
+% \xref, \pxref, and \ref generate cross-references to specified points.
+% For \xrefX, #1 is the node name, #2 the name of the Info
+% cross-reference, #3 the printed node name, #4 the name of the Info
+% file, #5 the name of the printed manual.  All but the node name can be
+% omitted.
+% 
+\def\pxref#1{see \xrefX[#1,,,,,,,]}
+\def\xref#1{See \xrefX[#1,,,,,,,]}
+\def\ref#1{\xrefX[#1,,,,,,,]}
+\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
+\def\printedmanual{\ignorespaces #5}%
+\def\printednodename{\ignorespaces #3}%
+%
+\setbox1=\hbox{\printedmanual}%
+\setbox0=\hbox{\printednodename}%
+\ifdim \wd0=0pt%
+\def\printednodename{\ignorespaces #1}%
+%%% Uncommment the following line to make the actual chapter or section title
+%%% appear inside the square brackets.
+%\def\printednodename{#1-title}%
+\fi%
+%
+%
+% If we use \unhbox0 and \unhbox1 to print the node names, TeX does
+% not insert empty discretionaries after hyphens, which means that it
+% will not find a line break at a hyphen in a node names.  Since some
+% manuals are best written with fairly long node names, containing
+% hyphens, this is a loss.  Therefore, we simply give the text of
+% the node name again, so it is as if TeX is seeing it for the first
+% time.
+\ifdim \wd1>0pt
+section ``\printednodename'' in \cite{\printedmanual}%
+\else%
+\turnoffactive%
+\refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
+\fi
+\endgroup}
+
+% \dosetq is the interface for calls from other macros
+
+% Use \turnoffactive so that punctuation chars such as underscore
+% work in node names.
+\def\dosetq #1#2{{\let\folio=0 \turnoffactive%
+\edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
+\next}}
+
+% \internalsetq {foo}{page} expands into
+% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
+% When the aux file is read, ' is the escape character
+
+\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
+
+% Things to be expanded by \internalsetq
+
+\def\Ypagenumber{\folio}
+
+\def\Ytitle{\thischapter}
+
+\def\Ynothing{}
+
+\def\Ysectionnumberandtype{%
+\ifnum\secno=0 Chapter\xreftie\the\chapno %
+\else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
+\else \ifnum \subsubsecno=0 %
+Section\xreftie\the\chapno.\the\secno.\the\subsecno %
+\else %
+Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
+\fi \fi \fi }
+
+\def\Yappendixletterandtype{%
+\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
+\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
+\else \ifnum \subsubsecno=0 %
+Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
+\else %
+Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
+\fi \fi \fi }
+
+\gdef\xreftie{'tie}
+
+% Use TeX 3.0's \inputlineno to get the line number, for better error
+% messages, but if we're using an old version of TeX, don't do anything.
+% 
+\ifx\inputlineno\thisisundefined
+  \let\linenumber = \empty % Non-3.0.
+\else
+  \def\linenumber{\the\inputlineno:\space}
+\fi
+
+% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
+% If its value is nonempty, SUFFIX is output afterward.
+
+\def\refx#1#2{%
+  \expandafter\ifx\csname X#1\endcsname\relax
+    % If not defined, say something at least.
+    $\langle$un\-de\-fined$\rangle$%
+    \ifhavexrefs
+      \message{\linenumber Undefined cross reference `#1'.}%
+    \else
+      \ifwarnedxrefs\else
+        \global\warnedxrefstrue
+        \message{Cross reference values unknown; you must run TeX again.}%
+      \fi
+    \fi
+  \else
+    % It's defined, so just use it.
+    \csname X#1\endcsname
+  \fi
+  #2% Output the suffix in any case.
+}
+
+% Read the last existing aux file, if any.  No error if none exists.
+
+% This is the macro invoked by entries in the aux file.
+\def\xrdef #1#2{
+{\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
+
+\def\readauxfile{%
+\begingroup
+\catcode `\^^@=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\^^C=\other
+\catcode `\^^D=\other
+\catcode `\^^E=\other
+\catcode `\^^F=\other
+\catcode `\^^G=\other
+\catcode `\^^H=\other
+\catcode `\=\other
+\catcode `\^^L=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode 26=\other
+\catcode `\^^[=\other
+\catcode `\^^\=\other
+\catcode `\^^]=\other
+\catcode `\^^^=\other
+\catcode `\^^_=\other
+\catcode `\@=\other
+\catcode `\^=\other
+\catcode `\~=\other
+\catcode `\[=\other
+\catcode `\]=\other
+\catcode`\"=\other
+\catcode`\_=\other
+\catcode`\|=\other
+\catcode`\<=\other
+\catcode`\>=\other
+\catcode `\$=\other
+\catcode `\#=\other
+\catcode `\&=\other
+% `\+ does not work, so use 43.
+\catcode 43=\other
+% the aux file uses ' as the escape.
+% Turn off \ as an escape so we do not lose on
+% entries which were dumped with control sequences in their names.
+% For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
+% Reference to such entries still does not work the way one would wish,
+% but at least they do not bomb out when the aux file is read in.
+\catcode `\{=1 \catcode `\}=2
+\catcode `\%=\other
+\catcode `\'=0
+\catcode `\\=\other
+\openin 1 \jobname.aux
+\ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
+\fi
+% Open the new aux file.  Tex will close it automatically at exit.
+\openout \auxfile=\jobname.aux
+\endgroup}
+
+
+% Footnotes.
+
+\newcount \footnoteno
+
+% The trailing space in the following definition for supereject is
+% vital for proper filling; pages come out unaligned when you do a
+% pagealignmacro call if that space before the closing brace is
+% removed.
+\def\supereject{\par\penalty -20000\footnoteno =0 }
+
+% @footnotestyle is meaningful for info output only..
+\let\footnotestyle=\comment
+
+\let\ptexfootnote=\footnote
+
+{\catcode `\@=11
+\long\gdef\footnote #1{\global\advance \footnoteno by \@ne
+\unskip
+\edef\thisfootno{$^{\the\footnoteno}$}%
+\let\@sf\empty
+\ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
+\thisfootno\@sf \footnotezzz{#1}}
+% \parsearg\footnotezzz}
+
+\long\gdef\footnotezzz #1{\insert\footins{
+\interlinepenalty\interfootnotelinepenalty
+\splittopskip\ht\strutbox % top baseline for broken footnotes
+\splitmaxdepth\dp\strutbox \floatingpenalty\@MM
+\leftskip\z at skip \rightskip\z at skip \spaceskip\z at skip \xspaceskip\z at skip
+\footstrut\parindent=\defaultparindent\hang\textindent{\thisfootno}#1\strut}}
+
+}%end \catcode `\@=11
+
+% Set the baselineskip to #1, and the lineskip and strut size
+% correspondingly.  There is no deep meaning behind these magic numbers
+% used as factors; they just match (closely enough) what Knuth defined.
+% 
+\def\lineskipfactor{.1}
+\def\strutheightpercent{.71}
+\def\strutdepthpercent{.29}
+%
+\def\setleading#1{%
+  \baselineskip = #1\relax
+  \normalbaselineskip = \baselineskip
+  \lineskip = \lineskipfactor\baselineskip
+  \setbox\strutbox =\hbox{%
+    \vrule width0pt height\strutheightpercent\baselineskip
+                    depth \strutdepthpercent \baselineskip
+  }%
+}
+
+% @| inserts a changebar to the left of the current line.  It should
+% surround any changed text.  This approach does *not* work if the
+% change spans more than two lines of output.  To handle that, we would
+% have adopt a much more difficult approach (putting marks into the main
+% vertical list for the beginning and end of each change).
+% 
+\def\|{%
+  % \vadjust can only be used in horizontal mode.
+  \leavevmode
+  %
+  % Append this vertical mode material after the current line in the output.
+  \vadjust{%
+    % We want to insert a rule with the height and depth of the current
+    % leading; that is exactly what \strutbox is supposed to record.
+    \vskip-\baselineskip
+    %
+    % \vadjust-items are inserted at the left edge of the type.  So
+    % the \llap here moves out into the left-hand margin.
+    \llap{%
+      %
+      % For a thicker or thinner bar, change the `1pt'.
+      \vrule height\baselineskip width1pt
+      %
+      % This is the space between the bar and the text.
+      \hskip 12pt
+    }%
+  }%
+}
+
+% For a final copy, take out the rectangles
+% that mark overfull boxes (in case you have decided
+% that the text looks ok even though it passes the margin).
+% 
+\def\finalout{\overfullrule=0pt}
+
+
+% End of control word definitions.
+
+\message{and turning on texinfo input format.}
+
+\def\openindices{%
+   \newindex{cp}%
+   \newcodeindex{fn}%
+   \newcodeindex{vr}%
+   \newcodeindex{tp}%
+   \newcodeindex{ky}%
+   \newcodeindex{pg}%
+}
+
+% Set some numeric style parameters, for 8.5 x 11 format.
+
+%\hsize = 6.5in
+\newdimen\defaultparindent \defaultparindent = 15pt
+\parindent = \defaultparindent
+\parskip 18pt plus 1pt
+\setleading{15pt}
+\advance\topskip by 1.2cm
+
+% Prevent underfull vbox error messages.
+\vbadness=10000
+
+% Following George Bush, just get rid of widows and orphans.
+\widowpenalty=10000
+\clubpenalty=10000
+
+% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
+% using an old version of TeX, don't do anything.  We want the amount of
+% stretch added to depend on the line length, hence the dependence on
+% \hsize.  This makes it come to about 9pt for the 8.5x11 format.
+% 
+\ifx\emergencystretch\thisisundefined \else
+  \emergencystretch = \hsize
+  \divide\emergencystretch by 45
+\fi
+
+% Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
+\def\smallbook{
+
+% These values for secheadingskip and subsecheadingskip are
+% experiments.  RJC 7 Aug 1992
+\global\secheadingskip = 17pt plus 6pt minus 3pt
+\global\subsecheadingskip = 14pt plus 6pt minus 3pt
+
+\global\lispnarrowing = 0.3in
+\setleading{12pt}
+\advance\topskip by -1cm
+\global\parskip 3pt plus 1pt
+\global\hsize = 5in
+\global\vsize=7.5in
+\global\tolerance=700
+\global\hfuzz=1pt
+\global\contentsrightmargin=0pt
+
+\global\pagewidth=\hsize
+\global\pageheight=\vsize
+
+\global\let\smalllisp=\smalllispx
+\global\let\smallexample=\smalllispx
+\global\def\Esmallexample{\Esmalllisp}
+}
+
+% Use @afourpaper to print on European A4 paper.
+\def\afourpaper{
+\global\tolerance=700
+\global\hfuzz=1pt
+\setleading{12pt}
+\global\parskip 15pt plus 1pt
+
+\global\vsize= 53\baselineskip
+\advance\vsize by \topskip
+%\global\hsize=   5.85in     % A4 wide 10pt
+\global\hsize=  6.5in
+\global\outerhsize=\hsize
+\global\advance\outerhsize by 0.5in
+\global\outervsize=\vsize
+\global\advance\outervsize by 0.6in
+
+\global\pagewidth=\hsize
+\global\pageheight=\vsize
+}
+
+% Define macros to output various characters with catcode for normal text.
+\catcode`\"=\other
+\catcode`\~=\other
+\catcode`\^=\other
+\catcode`\_=\other
+\catcode`\|=\other
+\catcode`\<=\other
+\catcode`\>=\other
+\catcode`\+=\other
+\def\normaldoublequote{"}
+\def\normaltilde{~}
+\def\normalcaret{^}
+\def\normalunderscore{_}
+\def\normalverticalbar{|}
+\def\normalless{<}
+\def\normalgreater{>}
+\def\normalplus{+}
+
+% This macro is used to make a character print one way in ttfont
+% where it can probably just be output, and another way in other fonts,
+% where something hairier probably needs to be done.
+%
+% #1 is what to print if we are indeed using \tt; #2 is what to print
+% otherwise.  Since all the Computer Modern typewriter fonts have zero
+% interword stretch (and shrink), and it is reasonable to expect all
+% typewriter fonts to have this, we can check that font parameter.
+% 
+\def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
+
+% Turn off all special characters except @
+% (and those which the user can use as if they were ordinary).
+% Most of these we simply print from the \tt font, but for some, we can
+% use math or other variants that look better in normal text.
+
+\catcode`\"=\active
+\def\activedoublequote{{\tt \char '042}}
+\let"=\activedoublequote
+\catcode`\~=\active
+\def~{{\tt \char '176}}
+\chardef\hat=`\^
+\catcode`\^=\active
+\def^{{\tt \hat}}
+
+\catcode`\_=\active
+\def_{\ifusingtt\normalunderscore\_}
+% Subroutine for the previous macro.
+\def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
+
+% \lvvmode is equivalent in function to \leavevmode.
+% Using \leavevmode runs into trouble when written out to
+% an index file due to the expansion of \leavevmode into ``\unhbox
+% \voidb at x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
+% magic tricks with @.
+\def\lvvmode{\vbox to 0pt{}}
+
+\catcode`\|=\active
+\def|{{\tt \char '174}}
+\chardef \less=`\<
+\catcode`\<=\active
+\def<{{\tt \less}}
+\chardef \gtr=`\>
+\catcode`\>=\active
+\def>{{\tt \gtr}}
+\catcode`\+=\active
+\def+{{\tt \char 43}}
+%\catcode 27=\active
+%\def^^[{$\diamondsuit$}
+
+% Used sometimes to turn off (effectively) the active characters
+% even after parsing them.
+\def\turnoffactive{\let"=\normaldoublequote
+\let~=\normaltilde
+\let^=\normalcaret
+\let_=\normalunderscore
+\let|=\normalverticalbar
+\let<=\normalless
+\let>=\normalgreater
+\let+=\normalplus}
+
+% Set up an active definition for =, but don't enable it most of the time.
+{\catcode`\==\active
+\global\def={{\tt \char 61}}}
+
+\catcode`\@=0
+
+% \rawbackslashxx output one backslash character in current font
+\global\chardef\rawbackslashxx=`\\
+%{\catcode`\\=\other
+%@gdef at rawbackslashxx{\}}
+
+% \rawbackslash redefines \ as input to do \rawbackslashxx.
+{\catcode`\\=\active
+ at gdef@rawbackslash{@let\=@rawbackslashxx }}
+
+% \normalbackslash outputs one backslash in fixed width font.
+\def\normalbackslash{{\tt\rawbackslashxx}}
+
+% Say @foo, not \foo, in error messages.
+\escapechar=`\@
+
+% \catcode 17=0   % Define control-q
+\catcode`\\=\active
+
+% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
+% That is what \eatinput is for; after that, the `\' should revert to printing 
+% a backslash.
+%
+ at gdef@eatinput input texinfo{@fixbackslash}
+ at global@let\ = @eatinput
+
+% On the other hand, perhaps the file did not have a `\input texinfo'. Then
+% the first `\{ in the file would cause an error. This macro tries to fix 
+% that, assuming it is called before the first `\' could plausibly occur.
+% 
+ at gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
+
+%% These look ok in all fonts, so just make them not special.  The @rm below
+%% makes sure that the current font starts out as the newly loaded cmr10
+ at catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
+
+ at textfonts
+ at rm
+
+ at c Local variables:
+ at c page-delimiter: "^\\\\message"
+ at c End:

Added: packages/libhdf4/branches/upstream/current/mfhdf/doc/udunits.dat
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/doc/udunits.dat	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/doc/udunits.dat	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,644 @@
+# The first column is the unit name.  The second column indicates whether or
+# not the unit name has a plural form (i.e. with an 's' appended).  
+# A 'P' indicates that the unit has a plural form, whereas, a 'S' indicates
+# that the unit has a singular form only.  The remainder of the line is the 
+# definition for the unit.
+#
+# '#' is the to-end-of-line comment-character.
+#
+# NB: When adding to this table, be *very* careful to distinquish between
+# the letter 'O' and the numeral zero '0'.  For example, the following two
+# entries don't do what one might otherwise expect:
+#
+#	mercury_0C		mercury_32F
+#	millimeter_Hg_0C	mm mercury_OC
+
+#
+# BASE UNITS.  These must be first and are identified by a nil definition.
+#
+ampere			P			# electric current
+bit			P			# unit of information
+candela			P			# luminous intensity
+kelvin			P			# thermodynamic temperature
+kilogram		P			# mass
+meter			P			# length
+mole			P			# amount of substance
+second			P			# time
+radian			P			# plane angle
+
+#
+# CONSTANTS
+#
+percent			S 0.01
+PI			S 3.14159265358979323846
+bakersdozen		S 13
+
+%			S percent
+pi			S PI
+
+#
+# NB: All subsequent definitions must be given in terms of
+# earlier definitions.  Forward referencing is not permitted.
+#
+
+#
+# The following are non-base units of the fundamental quantities
+#
+
+#
+# UNITS OF ELECTRIC CURRENT
+#
+A			S ampere
+amp			P ampere
+abampere		P 10 ampere		# exact
+gilbert			P 7.957747e-1 ampere
+statampere		P 3.335640e-10 ampere
+biot			P 10 ampere
+
+#
+# UNITS OF LUMINOUS INTENSITY
+#
+cd			S candela
+candle			P candela
+
+#
+# UNITS OF THERMODYNAMIC TEMPERATURE
+#
+degree_Kelvin		P kelvin
+degree_Celsius		S kelvin @ 273.15
+degree_Rankine		P kelvin/1.8
+degree_Fahrenheit	P degree_Rankine @ 459.67
+
+#C			S degree_Celsius	# `C' means `coulomb'
+Celsius			S degree_Celsius
+celsius			S degree_Celsius
+centigrade		S degree_Celsius
+degC			S degree_Celsius
+degreeC			S degree_Celsius
+degree_C		S degree_Celsius
+degree_c		S degree_Celsius
+deg_C			S degree_Celsius
+deg_c			S degree_Celsius
+degK			S kelvin
+degreeK			S kelvin
+degree_K		S kelvin
+degree_k		S kelvin
+deg_K			S kelvin
+deg_k			S kelvin
+K			S kelvin
+Kelvin			P kelvin
+
+degF			S degree_Fahrenheit
+degreeF			S degree_Fahrenheit
+degree_F		S degree_Fahrenheit
+degree_f		S degree_Fahrenheit
+deg_F			S degree_Fahrenheit
+deg_f			S degree_Fahrenheit
+F			S degree_Fahrenheit
+Fahrenheit		P degree_Fahrenheit
+fahrenheit		P degree_Fahrenheit
+
+degR			S degree_Rankine
+degreeR			S degree_Rankine
+degree_R		S degree_Rankine
+degree_r		S degree_Rankine
+deg_R			S degree_Rankine
+deg_r			S degree_Rankine
+#R			S degree_Rankine	# `R' means `roentgen'
+Rankine			P degree_Rankine
+rankine			P degree_Rankine
+
+#
+# UNITS OF MASS
+#
+assay_ton		P 2.916667e2 kilogram
+avoirdupois_ounce	P 2.834952e-2 kilogram
+avoirdupois_pound	P 4.5359237e-1 kilogram	# exact
+carat			P 2e-4 kilogram
+grain			P 6.479891e-5 kilogram	# exact
+gram			P 1e-3 kilogram		# exact
+kg			S kilogram
+long_hundredweight	P 5.080235e1 kilogram
+metric_ton		P 1e3 kilogram		# exact
+pennyweight		P 1.555174e-3 kilogram
+short_hundredweight	P 4.535924e1 kilogram
+slug			P 1.459390 kilogram
+troy_ounce		P 3.110348e-2 kilogram
+troy_pound		P 3.732417e-1 kilogram
+atomic_mass_unit	P 1.66044e-27 kilogram
+
+tonne			P metric_ton
+apothecary_ounce	P troy_ounce
+apothecary_pound	P avoirdupois_pound
+pound			P avoirdupois_pound
+metricton		P metric_ton
+gr			S grain
+scruple			P 20 grain
+apdram			P 60 grain
+apounce			P 480 grain
+appound			P 5760 grain
+atomicmassunit		P atomic_mass_unit
+amu			P atomic_mass_unit
+
+t			S tonne
+lb			P pound
+bag			P 94 pound
+short_ton		P 2000 pound
+long_ton		P 2240 pound
+
+ton			P short_ton
+shortton		P short_ton
+longton			P long_ton
+
+#
+# UNITS OF LENGTH
+#
+angstrom		P decinanometer
+astronomical_unit	P 1.495979e11 meter
+fathom			P 1.828804 meter
+fermi			P 1e-15 meter		# exact
+m			S meter
+metre			P meter
+light_year		P 9.46055e15 meter
+micron			P 1e-6 meter		# exact
+mil			P 2.54e-5 meter		# exact
+nautical_mile		P 1.852000e3 meter	# exact
+parsec			P 3.085678e16 meter
+printers_pica		P 4.217518e-3 meter
+printers_point		P 3.514598e-4 meter	# exact
+US_statute_mile		P 1.609347e3 meter	# = intn'l mile + .000003 meter
+US_survey_foot		P 3.048006e-1 meter
+chain			P 2.011684e1 meter
+
+inch			S 2.54 cm		# exact
+astronomicalunit	P astronomical_unit
+au			S astronomical_unit
+nmile			P nautical_mile
+nmi			S nautical_mile
+
+inches			S inch
+foot			S 12 inch		# exact
+in			S inch
+barleycorn		P inch/3
+
+ft			S foot
+feet			S foot
+yard			P 3 foot
+furlong			P 660 foot
+international_mile	P 5280 foot		# exact
+arpentlin		P 191.835 foot
+
+yd			S yard
+rod			P 5.5 yard
+mile			P international_mile
+
+arpentcan		P 27.52 mile
+
+#
+# UNITS OF AMOUNT OF SUBSTANCE
+#
+mol			S mole
+
+#
+# UNITS OF TIME
+#
+day			P 8.64e4 second		# exact
+hour			P 3.6e3 second		# exact
+minute			P 60 second		# exact
+s			S second
+sec			P second
+shake			P 1e-8 second		# exact
+sidereal_day		P 8.616409e4 second
+sidereal_minute		P 5.983617e1 second
+sidereal_second		P 0.9972696 second
+sidereal_year		P 3.155815e7 second
+tropical_year		P 3.155693e7 second
+year			P 3.153600e7 second	# exact
+eon			P 1e9 year
+
+d			S day
+min			P minute
+hr			P hour
+h			S hour
+fortnight		P 14 day
+yr			P year
+a			S year			# "anno"
+
+#
+# UNITS OF PLANE ANGLE
+#
+#rad			P radian		# `rad' means `grey'
+circle			P 2 pi radian
+angular_degree		P (pi/180) radian
+
+turn			P circle
+degree			P angular_degree
+degree_north		S angular_degree
+degree_east		S angular_degree
+degree_true		S angular_degree
+arcdeg			P angular_degree
+angular_minute		P angular_degree/60
+angular_second		P angular_minute/60
+grade			P 0.9 angular_degree	# exact
+
+degrees_north		S degree_north
+degreeN			S degree_north
+degree_N		S degree_north
+degreesN		S degree_north
+degrees_N		S degree_north
+
+degrees_east		S degree_east
+degreeE			S degree_east
+degree_E		S degree_east
+degreesE		S degree_east
+degrees_E		S degree_east
+
+degrees_true		S degree_true
+degreeT			S degree_true
+degree_T		S degree_true
+degreesT		S degree_true
+degrees_T		S degree_true
+
+arcminute		P angular_minute
+arcsecond		P angular_second
+
+arcmin			P arcminute
+arcsec			P arcsecond
+
+#
+# The following are derived units with special names.  They are useful for
+# defining other derived units.
+#
+steradian		P radian2
+hertz			S 1/second
+newton			P kilogram.meter/second2
+coulomb			P ampere.second
+lumen			P candela steradian
+becquerel		P 1/second		# SI unit of activity of a 
+#						# radionuclide
+standard_free_fall	S 9.806650 meter/second2	# exact
+
+pascal			P newton/meter2
+joule			P newton.meter
+hz			S hertz
+sr			S steradian
+force			S standard_free_fall
+gravity			S standard_free_fall
+free_fall		S standard_free_fall
+lux			S lumen/meter2
+sphere			P 4 pi steradian
+
+luxes			S lux
+watt			P joule/second
+gray			P joule/kilogram	# absorbed dose. derived unit
+sievert			P joule/kilogram	# dose equivalent. derived unit
+mercury_32F		S gravity 13595.065 kg/m3
+mercury_60F		S gravity 13556.806 kg/m3
+water_39F		S gravity 999.97226 kg/m3	# actually 39.2 F
+water_60F		S gravity 999.00072 kg/m3
+g			S gravity
+
+volt			P watt/ampere
+mercury_0C		S mercury_32F
+mercury			S mercury_32F
+water			S water_39F
+
+farad			P coulomb/volt
+ohm			P volt/ampere
+siemens			S ampere/volt
+weber			P volt.second
+Hg			S mercury
+hg			S mercury
+H2O			S water
+h2o			S water
+
+tesla			P weber/meter2
+henry			P weber/ampere
+
+#
+# The following are compound units: units whose definitions consist 
+# of two or more base units.  They may now be defined in terms of the 
+# preceding units.
+#
+
+#
+# ACCELERATION
+#
+gal			P 1e-2 meter/second2	# exact
+
+#
+# Area
+#
+are			P 1e2 m2		# exact
+barn			P 1e-28 m2		# exact
+circular_mil		P 5.067075e-10 m2
+darcy			P 9.869233e-13 m2	# permeability of porous solids
+hectare			P 1e4 m2		# exact
+acre			P 4840 yard2
+
+#
+# ELECTRICITY AND MAGNETISM
+#
+abfarad			P 1e9 farad		# exact
+abhenry			P 1e-9 henry		# exact
+abmho			P 1e9 siemens		# exact
+abohm			P 1e-9 ohm		# exact
+abvolt			P 1e-8 volt		# exact
+C			S coulomb
+e			S 1.6021917e-19 coulomb	# charge of electron
+chemical_faraday	P 9.64957e4 coulomb
+physical_faraday	P 9.65219e4 coulomb
+C12_faraday		P 9.64870e4 coulomb
+gamma			P 1e-9 tesla		# exact
+gauss			S 1e-4 tesla		# exact
+H			S henry
+maxwell			P 1e-8 weber		# exact
+oersted			P 7.957747e1 ampere/meter
+S			S siemens
+statcoulomb		P 3.335640e-10 coulomb
+statfarad		P 1.112650e-12 farad
+stathenry		P 8.987554e11 henry
+statmho			P 1.112650e-12 siemens
+statohm			P 8.987554e11 ohm
+statvolt		P 2.997925e2 volt
+T			S tesla
+unit_pole		P 1.256637e-7 weber
+V			S volt
+Wb			S weber
+mho			P siemens
+Oe			S oersted
+faraday			P C12_faraday		# charge of 1 mole of 
+#						# electrons
+
+#
+# ENERGY (INCLUDES WORK)
+#
+electronvolt		P 1.60219e-19 joule
+erg			P 1e-7 joule		# exact
+IT_Btu			P 1.055056 joule	# exact
+EC_therm		P 1.05506e8 joule
+thermochemical_calorie	P 4.184000 joule	# exact
+IT_calorie		P 4.1868 joule		# exact
+J			S joule
+ton_TNT			S 4.184e9 joule
+US_therm		P 1.054804e8 joule	# exact
+watthour		P watt hour
+
+therm			P US_therm
+Wh			S watthour
+Btu			P IT_Btu
+calorie			P IT_calorie
+electron_volt		P electronvolt
+
+thm			S therm
+cal			S calorie
+eV			S electronvolt
+bev			S gigaelectron_volt
+
+#
+# FORCE
+#
+dyne			P 1e-5 newton		# exact
+pond			P 1.806650e-3 newton	# exact
+force_kilogram		S 9.806650 newton	# exact
+force_ounce		S 2.780139e-1 newton
+force_pound		S 4.4482216152605 newton# exact
+poundal			P 1.382550e-1 newton
+N			S newton
+gf			S gram force
+
+force_gram		P 1e-3 force_kilogram
+force_ton		P 2000 force_pound	# exact
+lbf			S force_pound
+ounce_force		S force_ounce
+kilogram_force		S force_kilogram
+pound_force		S force_pound
+ozf			S force_ounce
+kgf			S force_kilogram
+
+kip			P 1000 lbf
+ton_force		S force_ton
+gram_force		S force_gram
+
+#
+# HEAT
+#
+clo			P 1.55e-1 kelvin.meter2/watt
+
+#
+# LIGHT
+#
+lm			S lumen
+lx			S lux
+footcandle		P 1.076391e-1 lux
+footlambert		P 3.426259 candela/meter2
+lambert			P (1e4/PI) candela/meter2	# exact
+stilb			P 1e4 candela/meter2	# exact
+phot			P 1e4 lumen/meter2	# exact
+nit			P 1 candela/meter2	# exact
+langley			P 4.184000e4 joule/meter2	# exact
+blondel			P candela/(pi meter2)
+
+apostilb		P blondel
+nt			S nit
+ph			S phot
+sb			S stilb
+
+#
+# MASS PER UNIT LENGTH
+#
+denier			P 1.111111e-7 kilogram/meter
+tex			P 1e-6 kilogram/meter	# exact
+
+#
+# MASS PER UNIT TIME (INCLUDES FLOW)
+#
+perm_0C			S 5.72135e-11 kg/(Pa.s.m2)
+perm_23C		S 5.74525e-11 kg/(Pa.s.m2)
+
+#
+# POWER
+#
+voltampere		P volt ampere
+VA			S volt ampere
+boiler_horsepower	P 9.80950e3 watt
+shaft_horsepower	P 7.456999e2 watt
+metric_horsepower	P 7.35499 watt
+electric_horsepower	P 7.460000e2 watt	# exact
+W			S watt
+water_horsepower	P 7.46043e2 watt
+UK_horsepower		P 7.4570e2 watt
+refrigeration_ton	P 12000 Btu/hour
+
+horsepower		P shaft_horsepower
+ton_of_refrigeration	P refrigeration_ton
+
+hp			S horsepower
+
+#
+# PRESSURE OR STRESS
+#
+bar			P 1e5 pascal		# exact
+standard_atmosphere	P 1.01325e5 pascal	# exact
+technical_atmosphere	P 1 kg gravity/cm2	# exact
+inch_H2O_39F		S inch water_39F
+inch_H2O_60F		S inch water_60F
+inch_Hg_32F		S inch mercury_32F
+inch_Hg_60F		S inch mercury_60F
+millimeter_Hg_0C	S mm mercury_0C
+footH2O			S foot water
+cmHg			S cm Hg
+cmH2O			S cm water
+Pa			S pascal
+inch_Hg			S inch Hg
+inch_hg			S inch Hg
+inHg			S inch Hg
+in_Hg			S inch Hg
+in_hg			S inch Hg
+millimeter_Hg		S mm Hg
+mmHg			S mm Hg
+mm_Hg			S mm Hg
+mm_hg			S mm Hg
+torr			P mm Hg
+foot_H2O		S foot water
+ftH2O			S foot water
+psi			S 1 pound gravity/in2
+ksi			S kip/in2
+barie			P 0.1 newton/meter2
+
+at			S technical_atmosphere
+atmosphere		P standard_atmosphere
+atm			P standard_atmosphere
+barye			P barie
+
+#
+# RADIATION UNITS
+#
+Bq			S becquerel
+curie			P 3.7e10 becquerel	# exact
+rem			P 1e-2 sievert		# dose equivalent. exact
+rad			P 1e-2 gray		# absorbed dose. exact
+roentgen		P 2.58e-4 coulomb/kg	# exact
+Sv			S sievert
+Gy			S gray
+
+Ci			S curie
+R			S roentgen
+rd			S rad
+
+#
+# VELOCITY (INCLUDES SPEED)
+#
+c			S 2.997925e+8 meter/sec
+knot			P nautical_mile/hour
+
+knot_international	S knot
+international_knot	S knot
+kt			P knot
+
+#
+# VISCOSITY
+#
+poise			S 1e-1 pascal second	# absolute viscosity. 
+#						# exact
+stokes			S 1e-4 meter2/second	# exact
+rhe			S 10/(pascal second)	# exact
+
+St			S stokes
+
+#
+# VOLUME (INCLUDES CAPACITY)
+#
+acre_foot		S 1.233489e3 m3
+board_foot		S 2.359737e-3 m3
+bushel			P 3.523907e-2 m3
+UK_liquid_gallon	P 4.546092e-3 m3
+Canadian_liquid_gallon	P 4.546090e-3 m3
+US_dry_gallon		P 4.404884e-3 m3
+US_liquid_gallon	P 3.785412e-3 m3
+cc			S cm3
+liter			P 1e-3 m3		# exact. However, from 1901 to 
+#						# 1964, 1 liter = 1.000028 dm3
+stere			P 1 m3			# exact
+register_ton		P 3.831685 m3
+
+US_dry_quart		P US_dry_gallon/4
+US_dry_pint		P US_dry_gallon/8
+
+US_liquid_quart		P US_liquid_gallon/4
+US_liquid_pint		P US_liquid_gallon/8
+US_liquid_cup		P US_liquid_gallon/16
+US_liquid_gill		P US_liquid_gallon/32
+US_fluid_ounce		P US_liquid_gallon/128
+US_liquid_ounce		P US_fluid_ounce
+
+UK_liquid_quart		P UK_liquid_gallon/4
+UK_liquid_pint		P UK_liquid_gallon/8
+UK_liquid_cup		P UK_liquid_gallon/16
+UK_liquid_gill		P UK_liquid_gallon/32
+UK_fluid_ounce		P UK_liquid_gallon/160
+UK_liquid_ounce		P UK_fluid_ounce
+
+liquid_gallon		P US_liquid_gallon
+fluid_ounce		P US_fluid_ounce
+#liquid_gallon		P UK_liquid_gallon
+#fluid_ounce		P UK_fluid_ounce
+
+dry_quart		P US_dry_quart
+dry_pint		P US_dry_pint
+
+liquid_quart		P liquid_gallon/4
+liquid_pint		P liquid_gallon/8
+
+barrel			P 42 US_liquid_gallon	# petroleum industry definition
+quart			P liquid_quart
+pint			P liquid_pint
+cup			P liquid_gallon/16
+gill			P liquid_gallon/32
+tablespoon		P US_fluid_ounce/2
+teaspoon		P tablespoon/3
+peck			P bushel/4
+
+oz			P fluid_ounce
+floz			S fluid_ounce
+acre_feet		S acre_foot
+board_feet		S board_foot
+Tbl			P tablespoon
+Tbsp			S tablespoon
+tbsp			S tablespoon
+Tblsp			S tablespoon
+tblsp			S tablespoon
+litre			P liter
+l			S liter
+tsp			S teaspoon
+pk			S peck
+bu			S bushel
+
+fldr			S floz/8
+dram			P floz/16
+
+bbl			S barrel
+pt			S pint
+dr			S dram
+
+
+#
+# COMPUTERS AND COMMUNICATION
+#
+baud			S 1/second		# exact
+b			S bit
+bps			S bit/second
+cps			S hertz
+
+Bd			S baud
+
+#
+# MISC
+#
+kayser			P 1e2/meter		# exact
+rps			S hertz
+rpm			S hertz/60
+geopotential		S gravity
+
+gp			S geopotential
+dynamic			S geopotential

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/Example6.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/Example6.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/Image_with_Palette.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/Image_with_Palette.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/LongDataset.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/LongDataset.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,724 @@
+# Makefile for HDF dumper(1).
+#
+# Makefile.in,v 1.2 1994/05/19 20:18:53 sxu Exp
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+ZLIB_LIB = $(TOP_SRCDIR)/hdf/zlib/libz.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+PROGRAM		= hdp
+BINFILES	= $(PROGRAM)
+#HDF_LIB         = @HDF_LIB@
+#HDF_INC         = @HDF_INC@
+#JPEG_LIB        = @JPEG_LIB@
+#CPP_NETCDF	= -I../libsrc -I../port $(HDF_INC)
+#CPPFLAGS	= $(CPPFLAGS_HDP)
+#CFLAGS		= @CFLAGS@
+#FFLAGS		= @FFLAGS@
+MANIFEST = $(DISTFILES)
+DISTFILES	= Makefile.in depend hdp.h hdp.c hdp_list.c hdp_sds.c hdp_util.c hdp_vd.c hdp_vg.c hdp_rig.c show.c hdp_dump.c hdp_gr.c
+MANUALS		= 
+LIBNAME		= mfhdf
+LD_NETCDF	= ../libsrc/libmfhdf.a
+OBJS		=  hdp.o hdp_list.o hdp_sds.o hdp_util.o hdp_vd.o hdp_vg.o hdp_rig.o show.o hdp_dump.o hdp_gr.o
+#LD_XDR		= @LD_XDR@
+LD_NETCDF	= -L../libsrc -lmfhdf
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(LIBSX) $(JPEG_LIB) $(ZLIB_LIB)
+prefix		= ../../..
+GARBAGE		= $(PROGRAM) *.o
+
+#all::		$(PROGRAM)
+all::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" $(PROGRAM); \
+	fi
+
+debug:  $(PROGRAM)  ../libsrc/libmfhdf.a
+	purify $(CC) $(CFLAGS) $(CFLAGS_NETCDF) $(OBJS) $(LIBS) -o phdp
+
+
+test: hdp
+	sh testhdp.sh
+
+install::	installed_program installed_manuals
+install-utils::	installed_program
+install-man::	installed_manuals
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF) '; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/dumper
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+# Override the default definition for ncgen(1) in the master makefile.
+#
+NCGEN		= ../ncgen/ncgen
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,40 @@
+# Makefile for HDF dumper(1).
+#
+# Makefile.in,v 1.2 1994/05/19 20:18:53 sxu Exp
+
+PROGRAM		= hdp
+BINFILES	= $(PROGRAM)
+HDF_LIB         = @HDF_LIB@
+HDF_INC         = @HDF_INC@
+JPEG_LIB        = @JPEG_LIB@
+CPP_NETCDF	= -I../libsrc -I../port $(HDF_INC)
+CPPFLAGS	= $(CPP_NETCDF) @CPPFLAGS@
+CFLAGS		= @CFLAGS@
+FFLAGS		= @FFLAGS@
+MANIFEST	= Makefile.in depend hdp.h hdp.c hdp_list.c hdp_sds.c hdp_util.c hdp_vd.c hdp_vg.c hdp_rig.c show.c hdp_dump.c
+MANUALS		= 
+LIBNAME		= netcdf
+LD_NETCDF	= ../libsrc/libnetcdf.a
+OBJS		=  hdp.o hdp_list.o hdp_sds.o hdp_util.o hdp_vd.o hdp_vg.o hdp_rig.o show.o hdp_dump.o
+LD_XDR		= @LD_XDR@
+LD_NETCDF	= -L../libsrc -lnetcdf
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(LIBSX) $(JPEG_LIB)
+prefix		= ../../..
+GARBAGE		= $(PROGRAM) *.o
+
+all::		$(PROGRAM)
+
+
+test:	echo "*** there is no testing for $(PROGRAM) ***" ; 
+
+install::	installed_program installed_manuals
+
+include ../port/master.mk
+
+# Override the default definition for ncgen(1) in the master makefile.
+#
+NCGEN		= ../ncgen/ncgen
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/README
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,17 @@
+		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 ncsa.uiuc.edu.
+
+
+
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/TEST
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/TEST	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/TEST	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/TEST.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/TEST.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/TEST.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,65 @@
+$ define sys$output hdp.out
+$ hdp :== $sys$disk:[--.bin]hdp.exe
+$ 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 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
+$!
+$ 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
+$!
+$ 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
+$!
+$ 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
+$!
+$ 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
+$ hdp dumpgr -p image_with_palette.hdf
+$ hdp dumpgr -p -h image_with_palette.hdf
+$ hdp dumpgr -r 2,4 -p -d image_with_palette.hdf
+$ exit

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/ctxtr2r.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/ctxtr2r.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,132 @@
+hdp.o: hdp.c
+hdp.o: hdp.h
+hdp.o: ../../hdf/src//hdf.h
+hdp.o: ../../hdf/src//hdfi.h
+hdp.o: ../../hdf/src//hlimits.h
+hdp.o: ../../hdf/src//hntdefs.h
+hdp.o: ../../hdf/src//htags.h
+hdp.o: ../../hdf/src//hbitio.h
+hdp.o: ../../hdf/src//hcomp.h
+hdp.o: ../../hdf/src//herr.h
+hdp.o: ../../hdf/src//hproto.h
+hdp.o: ../../hdf/src//hfile.h
+hdp_dump.o: hdp_dump.c
+hdp_dump.o: ../../mfhdf/libsrc/mfhdf.h
+hdp_dump.o: ../../mfhdf/libsrc/local_nc.h
+hdp_dump.o: ../../mfhdf/libsrc/netcdf.h
+hdp_dump.o: ../../hdf/src//hlimits.h
+hdp_dump.o: ../../hdf/src//hdf.h
+hdp_dump.o: ../../hdf/src//hdfi.h
+hdp_dump.o: ../../hdf/src//hntdefs.h
+hdp_dump.o: ../../hdf/src//htags.h
+hdp_dump.o: ../../hdf/src//hbitio.h
+hdp_dump.o: ../../hdf/src//hcomp.h
+hdp_dump.o: ../../hdf/src//herr.h
+hdp_dump.o: ../../hdf/src//hproto.h
+hdp_dump.o: ../../hdf/src//vg.h
+hdp_dump.o: ../../hdf/src//hfile.h
+hdp_dump.o: ../../hdf/src//tbbt.h
+hdp_dump.o: hdp.h
+hdp_list.o: hdp_list.c
+hdp_list.o: ../../mfhdf/libsrc/mfhdf.h
+hdp_list.o: ../../mfhdf/libsrc/local_nc.h
+hdp_list.o: ../../mfhdf/libsrc/netcdf.h
+hdp_list.o: ../../hdf/src//hlimits.h
+hdp_list.o: ../../hdf/src//hdf.h
+hdp_list.o: ../../hdf/src//hdfi.h
+hdp_list.o: ../../hdf/src//hntdefs.h
+hdp_list.o: ../../hdf/src//htags.h
+hdp_list.o: ../../hdf/src//hbitio.h
+hdp_list.o: ../../hdf/src//hcomp.h
+hdp_list.o: ../../hdf/src//herr.h
+hdp_list.o: ../../hdf/src//hproto.h
+hdp_list.o: ../../hdf/src//vg.h
+hdp_list.o: ../../hdf/src//hfile.h
+hdp_list.o: ../../hdf/src//tbbt.h
+hdp_list.o: hdp.h
+hdp_rig.o: hdp_rig.c
+hdp_rig.o: ../../mfhdf/libsrc/mfhdf.h
+hdp_rig.o: ../../mfhdf/libsrc/local_nc.h
+hdp_rig.o: ../../mfhdf/libsrc/netcdf.h
+hdp_rig.o: ../../hdf/src//hlimits.h
+hdp_rig.o: ../../hdf/src//hdf.h
+hdp_rig.o: ../../hdf/src//hdfi.h
+hdp_rig.o: ../../hdf/src//hntdefs.h
+hdp_rig.o: ../../hdf/src//htags.h
+hdp_rig.o: ../../hdf/src//hbitio.h
+hdp_rig.o: ../../hdf/src//hcomp.h
+hdp_rig.o: ../../hdf/src//herr.h
+hdp_rig.o: ../../hdf/src//hproto.h
+hdp_rig.o: ../../hdf/src//vg.h
+hdp_rig.o: ../../hdf/src//hfile.h
+hdp_rig.o: ../../hdf/src//tbbt.h
+hdp_rig.o: hdp.h
+hdp_sds.o: hdp_sds.c
+hdp_sds.o: ../../mfhdf/libsrc/mfhdf.h
+hdp_sds.o: ../../mfhdf/libsrc/local_nc.h
+hdp_sds.o: ../../mfhdf/libsrc/netcdf.h
+hdp_sds.o: ../../hdf/src//hlimits.h
+hdp_sds.o: ../../hdf/src//hdf.h
+hdp_sds.o: ../../hdf/src//hdfi.h
+hdp_sds.o: ../../hdf/src//hntdefs.h
+hdp_sds.o: ../../hdf/src//htags.h
+hdp_sds.o: ../../hdf/src//hbitio.h
+hdp_sds.o: ../../hdf/src//hcomp.h
+hdp_sds.o: ../../hdf/src//herr.h
+hdp_sds.o: ../../hdf/src//hproto.h
+hdp_sds.o: ../../hdf/src//vg.h
+hdp_sds.o: ../../hdf/src//hfile.h
+hdp_sds.o: ../../hdf/src//tbbt.h
+hdp_sds.o: hdp.h
+hdp_util.o: hdp_util.c
+hdp_util.o: hdp.h
+hdp_util.o: ../../hdf/src//hdf.h
+hdp_util.o: ../../hdf/src//hdfi.h
+hdp_util.o: ../../hdf/src//hlimits.h
+hdp_util.o: ../../hdf/src//hntdefs.h
+hdp_util.o: ../../hdf/src//htags.h
+hdp_util.o: ../../hdf/src//hbitio.h
+hdp_util.o: ../../hdf/src//hcomp.h
+hdp_util.o: ../../hdf/src//herr.h
+hdp_util.o: ../../hdf/src//hproto.h
+hdp_util.o: ../../hdf/src//hfile.h
+hdp_vd.o: hdp_vd.c
+hdp_vd.o: hdp.h
+hdp_vd.o: ../../hdf/src//hdf.h
+hdp_vd.o: ../../hdf/src//hdfi.h
+hdp_vd.o: ../../hdf/src//hlimits.h
+hdp_vd.o: ../../hdf/src//hntdefs.h
+hdp_vd.o: ../../hdf/src//htags.h
+hdp_vd.o: ../../hdf/src//hbitio.h
+hdp_vd.o: ../../hdf/src//hcomp.h
+hdp_vd.o: ../../hdf/src//herr.h
+hdp_vd.o: ../../hdf/src//hproto.h
+hdp_vd.o: ../../hdf/src//hfile.h
+hdp_vg.o: hdp_vg.c
+hdp_vg.o: hdp.h
+hdp_vg.o: ../../hdf/src//hdf.h
+hdp_vg.o: ../../hdf/src//hdfi.h
+hdp_vg.o: ../../hdf/src//hlimits.h
+hdp_vg.o: ../../hdf/src//hntdefs.h
+hdp_vg.o: ../../hdf/src//htags.h
+hdp_vg.o: ../../hdf/src//hbitio.h
+hdp_vg.o: ../../hdf/src//hcomp.h
+hdp_vg.o: ../../hdf/src//herr.h
+hdp_vg.o: ../../hdf/src//hproto.h
+hdp_vg.o: ../../hdf/src//hfile.h
+hdp_vg.o: ../../hdf/src//vg.h
+hdp_vg.o: ../../hdf/src//tbbt.h
+show.o: show.c
+show.o: hdp.h
+show.o: ../../hdf/src//hdf.h
+show.o: ../../hdf/src//hdfi.h
+show.o: ../../hdf/src//hlimits.h
+show.o: ../../hdf/src//hntdefs.h
+show.o: ../../hdf/src//htags.h
+show.o: ../../hdf/src//hbitio.h
+show.o: ../../hdf/src//hcomp.h
+show.o: ../../hdf/src//herr.h
+show.o: ../../hdf/src//hproto.h
+show.o: ../../hdf/src//hfile.h
+show.o: ../../hdf/src//vg.h
+show.o: ../../hdf/src//tbbt.h

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfi322.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfi322.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui162.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui162.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui82.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui82.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui83.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui83.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui84.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/grtdfui84.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,465 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.23 $";
+#endif
+
+/* $Id: hdp.c,v 1.23 2000/09/05 14:28:10 bmribler Exp $ */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#define HDP_MASTER
+#define VSET_INTERFACE
+#include "hdp.h"
+
+/* 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 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_type = DASCII;    /* default output is ASCII file */
+    dump_opts->print_pal = FALSE;     /* GR only, don't print palette */
+
+    /* 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 */
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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");
+
+#ifdef HAVE_PABLO
+/*
+  TRACE_ON(VS_mask, ID_VShdfsize);
+*/
+#endif /* HAVE_PABLO */
+
+    /* 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
+      {  /* 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 */
+#ifdef HAVE_PABLO
+/*
+  TRACE_OFF(VS_mask, ID_VShdfsize);
+*/
+#endif /* HAVE_PABLO */
+
+  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;
+
+#ifdef HAVE_PABLO
+/*
+     TRACE_ON(V_mask, ID_VSattrhdfsize);
+*/
+#endif /* HAVE_PABLO */
+
+     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 */
+#ifdef HAVE_PABLO
+/*
+      TRACE_OFF(V_mask, ID_VSattrhdfsize);
+*/
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}  /* VSattrhdfsize */
+
+/* ----------   Vattrhdfsize ----------------------
+NAME
+       Vattrhdfsize -- get hdfsize of a vgroup attribute
+USAGE
+        intn Vattrinfo(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;
+    int32 fid, vsid;
+    int32 ret_value = SUCCEED;
+
+#ifdef HAVE_PABLO
+/*
+    TRACE_ON(V_mask, ID_Vattrhdfsize);
+*/
+#endif /* HAVE_PABLO */
+
+    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);
+    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 */
+#ifdef HAVE_PABLO
+/*
+      TRACE_OFF(V_mask, ID_Vattrhdfsize);
+*/
+#endif /* HAVE_PABLO */
+
+  return ret_value;
+}  /* Vattrhdfsize */

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,569 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.23 $";
+#endif
+
+/* $Id: hdp.h,v 1.23 2000/09/05 14:28:10 bmribler Exp $ */
+
+#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 */
+
+/* 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;
+
+/* Which contents to dump */
+typedef enum
+  {
+	  DVERBOSE, DHEADER, DDATA
+  }
+content_t;
+
+/* What kind of data to dump to file */
+typedef enum
+  {
+	  DASCII, DBINARY
+  }
+file_type_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;
+
+/* '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 */
+   int32       num_chosen;	/* number of items chosen, totally (-1==ALL) */
+   content_t   contents;        /* what contents to dump */
+   intn        dump_to_file;	/* whether to dump to a file */
+   file_type_t file_type;	/* 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 */
+  }
+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    class[VSNAMELENMAX];	/* vdata class */
+	char    name[VSNAMELENMAX];	/* 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   name[MAXNAMELEN];
+    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 */
+extern intn do_dumpsds(intn curr_arg, intn argc, char *argv[], intn help);
+
+/* 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, char *file_name, int32 tag, int32 ref);
+extern intn print_file_annotations( int32 file_id, char *file_name );
+void print_fields( char *fields, char *field_title, FILE *fp );
+
+/* hdp_vd.c */
+extern intn do_dumpvd(intn curr_arg, intn argc, char *argv[], intn help);
+extern 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 */
+extern intn do_dumpgr(intn curr_arg, intn argc, char *argv[], intn help);
+
+
+/* hdp_dump.c */
+extern intn fmtchar(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtuchar8(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtbyte(unsigned char *x, file_type_t ft, FILE * ofp);
+extern intn fmtint(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtshort(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtint8(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtuint8(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtint16(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtuint16(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtint32(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtuint32(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtfloat32(VOIDP x, file_type_t ft, FILE * ofp);
+extern intn fmtfloat64(VOIDP x, file_type_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_type_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_type_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);
+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);
+extern int32* free_num_list(int32 *num_list );
+extern char* free_char_list(char *char_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 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 */

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.txt
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.txt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp.txt	2007-05-14 09:41:34 UTC (rev 808)
@@ -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.

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_dump.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_dump.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_dump.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,572 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 1.18 $";
+#endif
+
+/* $Id: hdp_dump.c,v 1.18 2000/10/06 04:04:01 bmribler Exp $ */
+
+#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
+/* 
+ * 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_type_t    ft, 
+        FILE          *ofp)
+{
+    unsigned char s;
+
+    if(ft == 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_type_t ft, 
+        FILE       *ofp)
+{
+    int8 s;
+
+    if(ft == 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_type_t ft, 
+         FILE       *ofp)
+{
+    uint8 s;
+
+    if(ft == 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_type_t ft, 
+         FILE       *ofp)
+{
+    int16 s;
+
+    HDmemcpy(&s, x, sizeof(int16));
+
+    if(ft == DASCII)
+        return (fprintf(ofp, "%d", (int) s));
+    else
+        return(fwrite(&s, sizeof(int16), 1, ofp));
+}
+
+intn 
+fmtuint16(VOIDP       x, 
+          file_type_t ft, 
+          FILE       *ofp)
+{
+    uint16      s;
+
+    HDmemcpy(&s, x, sizeof(uint16));
+
+    if(ft == DASCII)
+        return (fprintf(ofp, "%u", (unsigned) s));
+    else
+        return(fwrite(&s, sizeof(uint16), 1, ofp));
+}
+
+intn 
+fmtchar(VOIDP       x, 
+        file_type_t ft, 
+        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_type_t ft, 
+          FILE       *ofp)
+{   
+    uchar8 s;
+
+    if(ft == 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_type_t ft, 
+       FILE       *ofp)
+{
+    intn        i;
+
+    HDmemcpy(&i, x, sizeof(intn));
+
+    if(ft == 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_type_t ft, 
+           FILE       *ofp)
+{
+    float32     fdata;
+
+    HDmemcpy(&fdata, x, sizeof(float32));
+
+    if(ft == 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_type_t ft, 
+         FILE       *ofp)
+{
+    int32       l;
+
+    HDmemcpy(&l, x, sizeof(int32));
+
+    if(ft == DASCII)
+        return (fprintf(ofp, "%ld", (long) l));
+    else
+        return(fwrite(&l, sizeof(int32), 1, ofp));
+}
+
+intn 
+fmtuint32(VOIDP       x, 
+          file_type_t ft, 
+          FILE       *ofp)
+{
+    uint32      l;
+
+    HDmemcpy(&l, x, sizeof(uint32));
+
+    if(ft == DASCII)
+        return (fprintf(ofp, "%lu", (unsigned long) l));
+    else
+        return(fwrite(&l, sizeof(uint32), 1, ofp));
+}
+
+intn 
+fmtshort(VOIDP       x, 
+         file_type_t ft, 
+         FILE       *ofp)
+{
+    short s;
+
+    HDmemcpy(&s, x, sizeof(short));
+
+    if(ft == 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_type_t ft, 
+           FILE       *ofp)
+{
+    float64     d;
+
+    HDmemcpy(&d, x, sizeof(float64));
+
+    if(ft == 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));
+      }
+}
+
+typedef intn (*fmtfunct_t) (VOIDP, file_type_t, FILE *);
+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_type_t ft = dump_opts->file_type;
+   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(ft == 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, ft, 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, ft, 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, ft, 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 && bufptr != NULL; 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;
+
+   }	/* end for every item in buffer */
+
+   putc('\n', ofp); /* newline */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* dumpclean */
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_gr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_gr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_gr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1240 @@
+/**********************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)Revision";
+#endif
+
+/* $Id: hdp_gr.c,v 1.14 2000/09/05 14:28:10 bmribler Exp $ */
+
+#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[])
+{
+    printf("Usage:\n");
+    printf("%s dumpgr [-a|-i <indices>|-r <refs>|-n <names>] [-m <interlace>] [-p] [-cdhvs] [-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-c\tPrint space characters as they are, not \\digit\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-s\tDump data as a stream, i.e. do not add carriage returns\n");
+    printf("\t-p\tDump palette data\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 and -p must not be used together" );
+
+             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 '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_type = DBINARY;
+             (*curr_arg)++;
+             break;
+
+         case 'x':   /* dump data in ascii, also default */
+             dumpgr_opts->file_type = DASCII;
+             (*curr_arg)++;
+             break;
+
+         case 'p':   /* dump palette data */
+	     /* make sure -p is not also given */
+	     if( dumpgr_opts->contents == DHEADER )
+		ERROR_GOTO_0( "Option -h and -p must not be used together" );
+
+             dumpgr_opts->print_pal = TRUE;
+             (*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(ncomps * sizeof(int32));
+   CHECK_ALLOC( start, "start", "grdumpfull" );
+
+   edge = (int32 *) HDmalloc(ncomps * sizeof(int32));
+   CHECK_ALLOC( edge, "edge", "grdumpfull" );
+
+   stride = (int32 *) HDmalloc(ncomps * 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, 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 */
+      ret_value = GRattrinfo(gr_id, attr_index, attr_name, &attr_nt, &attr_count);
+      if (FAIL == ret_value ) /* to the next attribute */
+         ERROR_CONT_2( "in %s: GRattrinfo failed for %d'th attribute", 
+			"print_GRattrs", (int)attr_index );
+
+      /* 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 );
+
+      /* 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 */
+      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 */
+      resetBuff( &attr_buf );
+   } /* 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 );
+
+      /* 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 );
+
+      /* 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 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 );
+      }
+
+      /* free buffer and reset it to NULL */
+      resetBuff( &attr_buf );
+   } /* 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;
+
+   /* 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 no palette data, print message for both cases:
+         header-only and verbose (data+header) */
+      if( n_entries <= 0 )
+         fprintf( fp, "\t No palette\n");
+
+      /* else, if there are palette data, print header info */
+      else /* have palette data */
+         fprintf (fp, "\t Palette: %d components; %d entries\n",
+                        (int)n_comps, (int)n_entries);
+
+   } /* end of for each palette */
+
+   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 */
+   intn  status, ret_value = SUCCEED;
+
+   /* 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);
+
+      /* 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 no palette data, print message for both cases:   
+         header-only and verbose (data+header) */
+      if( n_entries <= 0 )
+      {
+         if( dumpgr_opts->contents != DDATA )
+            fprintf( fp, "\t No palette data\n");
+      }
+      /* else, if there are palette data, print header info when not 
+         data-only and print palette data when not header-only */
+      else /* have palette data */
+      {
+         if( dumpgr_opts->contents != DDATA )
+            fprintf (fp, "\t Palette: %d components; %d entries\n", 
+			(int)n_comps, (int)n_entries);
+
+         if( dumpgr_opts->contents != DHEADER )
+         {  /* not header only */
+            /* 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);
+            }
+
+	    /* if printing data only, print palette data with no indentation */
+	    if( dumpgr_opts->contents == DDATA )
+               status = dumpfull(data_type, dumpgr_opts, n_entries*n_comps, 
+			palette_data, fp, 0, 0 );
+
+            /* display the palette data with the title line and indentation */
+	    else
+	    {
+               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)ri_id );
+         }  /* not header only */
+      } /* have palette data */
+   } /* end of for each palette */
+done:
+   if (ret_value == FAIL)
+   { /* Failure cleanup */
+   }
+   /* Normal cleanup */
+   return ret_value;
+}  /* end of print_Palette */
+
+char*
+Il_mode_text( gr_interlace_t interlace_mode )
+{
+   char* il_text;
+   switch( interlace_mode )
+   {
+	case MFGR_INTERLACE_PIXEL:
+	   il_text = "PIXEL";
+	   break;
+	case MFGR_INTERLACE_LINE:
+	   il_text = "LINE";
+	   break;
+	case MFGR_INTERLACE_COMPONENT: 
+           il_text = "COMPONENT";
+	   break;
+	default:
+	   il_text = "INVALID";
+   } /* end switch */
+   return( il_text );
+}
+
+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 */
+	 /* BMR: can this check be skipped */
+         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 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(il) );
+
+	    /* if palette data is not to be printed, print the palette
+	       info now so it won't be lost after the image data; currently,
+	       only 1 palette per image (second arg.) */
+            if( !dumpgr_opts->print_pal )
+		print_PaletteInfo( ri_id, 1, fp );
+
+            /* 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 */
+
+      /* print image palette's info with/without data depending on the
+         content's option (-h, -d, or none, taken care by print_Palette) */
+      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_ASCII", (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_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 */
+      }
+
+      /* output data in binary format   */
+      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 );
+
+      /* print image palette's data print_Palette) */
+      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 );
+
+      /* 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;			/* 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.\n" );
+
+   /* 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)
+   {
+      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 ); 
+
+      /* open current hdf file for processing */
+      file_id = Hopen(file_name, DFACC_RDONLY, 0);
+      if (file_id == FAIL)
+         ERROR_CONT_1( "in dgr: Hopen failed for file %s\n", file_name);
+
+      /* initiate the GR interface */
+      gr_id = GRstart(file_id);
+      if (FAIL == gr_id) /* to the next file */
+      {
+HEprint( stderr, 0 );  /* what is this??? BMR - 7/14/00 */
+         ERROR_CONT_1( "in dgr: GRstart failed for file %s\n", 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\n", file_name);
+
+      fp = stdout;  /* assume that output option is not given */
+
+      /* display images in requested format for the current file */
+      switch(dumpgr_opts->file_type)
+      {
+         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\n", 
+                                    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\n", 
+                                 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 (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 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);
+      ret_value = FAIL; /* return status to caller */
+      goto done;
+   }		/* end if */
+
+   /* parse the user's command and store the inputs in dumpgr_opts */
+   ret_value = parse_dumpgr_opts( &dumpgr_opts, &curr_arg, argc, argv );
+   if( ret_value == FAIL )
+   {
+      dumpgr_usage(argc, argv);
+      goto done;  /* skip dgr */
+   }
+
+   /* display data and information as specified in dumpgr_opts */
+   ret_value = dgr( &dumpgr_opts, curr_arg, argc, argv );
+   if( ret_value == FAIL )
+      ERROR_GOTO_0( "in do_dumpgr\n" );
+
+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() */

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_list.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_list.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_list.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1246 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.29 $";
+#endif
+
+/* $Id: hdp_list.c,v 1.29 2000/09/05 14:28:11 bmribler Exp $ */
+
+#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 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[80];	/* 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() */

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_rig.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_rig.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_rig.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,714 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.27 $";
+#endif
+
+/* $Id: hdp_rig.c,v 1.27 2000/09/05 14:28:11 bmribler Exp $ */
+
+#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_type = 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_type = DBINARY;
+                (*curr_arg)++;
+                break;
+
+            case 'x':   /* dump data in ascii, also default */
+                dumprig_opts->file_type = 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_type_t ft;
+    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? */
+          ft = dumprig_opts->file_type;
+          switch(ft)
+            {
+            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]". */
+
+                /* is this normal output here or debugging? leave for now */
+                printf("ndsets=%d, dumpall=%d, num_chosen=%d\n",
+                       (int)ndsets,(int)dumpall,(int)dumprig_opts->num_chosen);
+
+                /* 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);
+                            if (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 and the compression scheme is ");
+                                  switch (compr_type)
+                                    {
+                                    case DFTAG_RLE:
+                                        fprintf(fp, "RLE compression.\n");
+                                        break;
+                                    case DFTAG_IMCOMP:
+                                        fprintf(fp, "IMCOMP conmpression.\n");
+                                        break;
+                                    case DFTAG_JPEG:
+                                        fprintf(fp, "JPEG conmpression (24-bit data).\n");
+                                        break;
+                                    case DFTAG_GREYJPEG:
+                                        fprintf(fp, "JPEG conmpression (8-bit data).\n");
+                                        break;
+                                    default:
+                                        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 (num_rig_chosen == -1)		/* If all RIGs will be dumped, set the flat. */
+                    dumpall = 1;
+
+                x = 0;	/* Used as the index of the array of "rig_chosen[x]". */
+
+                /* why was this left here uncommented out for binary dump? */
+#if 0
+                printf("ndsets=%d, dumpall=%d, num_chosen=%d\n",(int)ndsets,(int)dumpall,(int)dumprig_opts->num_chosen);
+#endif
+
+                /* 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() */
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_sds.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_sds.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_sds.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1154 @@
+/**********************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)Revision";
+#endif
+
+/* $Id: hdp_sds.c,v 1.39 2000/10/05 14:14:20 ymuqun Exp $ */
+
+#include <stdio.h>
+#include "mfhdf.h"
+#include "hdp.h"
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+
+void 
+dumpsds_usage(intn argc, 
+              char *argv[])
+{
+    printf("Usage:\n");
+    printf("%s dumpsds [-a|-i <indices>|-r <refs>|-n <names>] [-cdhvs] [-o <filename>] [-bx] <filelist>\n", argv[0]);
+    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-c\tPrint space characters as they are, not \\digit\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-s\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() */
+
+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 '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 */
+            dumpsds_opts->filter |= DINDEX;  /* set bit DINDEX */
+            (*curr_arg)++;
+
+            /* parse and store the given indices in structure by_index */
+            parse_number_opts( argv, curr_arg, &dumpsds_opts->by_index);
+            (*curr_arg)++;
+            break;
+
+         case 'r':	/* dump by reference */
+            dumpsds_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, &dumpsds_opts->by_ref);
+           (*curr_arg)++;
+            break;
+
+         case 'n':	/* dump by names */
+            dumpsds_opts->filter |= DNAME;   /* set bit DNAME */
+            (*curr_arg)++;
+
+            /* parse and store the given names in structure by_name */
+            parse_string_opts( argv, curr_arg, &dumpsds_opts->by_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 '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_type = DBINARY;
+                (*curr_arg)++;
+                break;
+
+         case 'x':   /* dump data in ascii, also default */
+                dumpsds_opts->file_type = 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 */
+
+   /* add the number of datasets requested by index, by ref#, and by name
+      to have a total number of requested datasets */
+   dumpsds_opts->num_chosen = dumpsds_opts->by_index.num_items +
+                             dumpsds_opts->by_ref.num_items +
+                             dumpsds_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(dumpsds_opts->by_index.num_list );
+      free_num_list(dumpsds_opts->by_ref.num_list );
+      free_str_list(dumpsds_opts->by_name.str_list, dumpsds_opts->by_name.num_items);
+   }
+   /* 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_type_t ft;
+   intn     status;
+   int32    status32;
+   int32    ret_value = SUCCEED;
+
+   /* temp. names for ease of use */
+   ft = dumpsds_opts->file_type;
+
+   /* 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 */
+   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( ft == 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 */
+   }
+   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))
+         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)
+      {
+         status = SDreaddata(sds_id, start, NULL, edge, buf);
+         if( FAIL == status )
+            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( ft==DASCII && !dumpsds_opts->as_stream )*/
+               if( ft==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 (ft == DASCII && !dumpsds_opts->as_stream )*/
+    if (ft == 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     i;
+   int32    index,          /* index of an SDS */
+            sds_count = 0,  /* number of SDSs to be processed */
+            num_sds_chosen = dumpsds_opts->num_chosen;
+   filter_t filter = dumpsds_opts->filter; /* temporary name */
+   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( filter == DALL )
+      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 );
+
+   /* if there are some SDSs requested by index, store the indices in
+      the array sds_chosen */
+   if( filter & DINDEX )
+         /* Note: Don't replace this with HDmemcpy unless you change 
+                  the sizes of the objects correctly -QAK */
+      for (i = 0; i < dumpsds_opts->by_index.num_items; i++)
+      {
+         (*sds_chosen)[sds_count] = dumpsds_opts->by_index.num_list[i];
+         sds_count++;
+      }
+
+   /* if there are some SDSs requested by ref#, convert the ref#s to indices
+      and store the indices in the array provided by the caller, sds_chosen */
+   if( filter & DREFNUM )
+      for (i = 0; i < dumpsds_opts->by_ref.num_items; i++)
+      {
+         index = SDreftoindex(sd_id, dumpsds_opts->by_ref.num_list[i]);
+         if (index == FAIL)
+         {
+            printf( "SDS with reference number %d: not found\n",
+                               (int)dumpsds_opts->by_ref.num_list[i]);
+            *index_error = TRUE; /* error */
+         }
+         else
+         {
+            (*sds_chosen)[sds_count] = index;
+            sds_count++;
+         }
+      }
+
+   /* if there are some SDSs requested by name, convert the names to indices 
+      and store the indices in the array provided by the caller, sds_chosen */
+   if( filter & DNAME )
+      for (i = 0; i < dumpsds_opts->by_name.num_items; i++)
+      {
+         index = SDnametoindex(sd_id, dumpsds_opts->by_name.str_list[i]);
+         if (index == FAIL)
+         {
+            printf( "SDS with name %s: not found\n",
+                              dumpsds_opts->by_name.str_list[i]);
+            *index_error = TRUE; /* error */
+         }
+         else
+         {
+            (*sds_chosen)[sds_count] = index;
+            sds_count++;
+         }
+      }
+
+   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 
+   Note: the reason for dumpsds_opts is not passed for ft and no_cret
+   is print_SDattrs is also called by a function of hdp list, which has 
+   a different option structure than all the dump commands, 
+   list_info_t vs. dump_info_t */
+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,          /* 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 );
+     
+      /* 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 );
+
+      /* 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 then free buffer */
+      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 */
+      /* Note that filetype is DASCII since binary format does not contain
+         these information - it's data only */
+      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 );
+      }
+
+      resetBuff( &attr_buf );  /* free buffer and reset it to NULL */
+   }/* 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,   /* 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 );
+
+      /* 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|DFNT_NATIVE) * attr_count;
+
+      /* make sure we are not allocating 0 elements */
+      CHECK_POS( attr_buf_size, "attr_buf_size", "print_SDSattrs" );
+
+      /* 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 );
+
+      /* 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 then free the 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 then free buffer */
+      /* Note that filetype is DASCII since binary format does not contain
+         these information - it's data only */
+      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 in 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 );
+      }
+
+      resetBuff( &attr_buf );  /* free buffer and reset it to NULL */
+   } /* 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 */
+
+/* printSDS_ASCII (yea, not SD_ASCII) prints all of the requested SDSs in
+   the file
+*/
+intn printSD_ASCII( 
+	int32 sd_id,
+	dump_info_t *dumpsds_opts,
+	int32 ndsets,         /* # of datasets in the file */
+	int32 *sds_chosen,    /* list of indices of SDSs */
+	int32 num_sds_chosen, /* # of items in sds_chosen */
+	FILE *fp )
+{
+   int32 sds_id = FAIL, /* SDS id, always reset to FAIL when not used */
+         sds_ref,       /* ref# of an SDS */
+         sds_count,     /* count of SDSs being printed */
+         sds_index,     /* index of SDSs in the file */
+         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 */
+         name[MAXNAMELEN],      /* 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 */
+   intn  isdimvar,      /* TRUE if curr SDS is used for a dim */
+         j,
+         dumpall = FALSE,    /* TRUE if all SDSs are to be dumped */
+         status,             /* status returned from a routine */
+         ret_value = SUCCEED;/* returned value of printSD_ASCII */
+
+   /* temp. name for curr input file name for ease of use */
+/* curr_file_name can be removed from this routine after changing resetSDS API */
+   HDstrcpy( curr_file_name, dumpsds_opts->ifile_name );
+
+   /* when there are no SDS specified, dumper dumps all datasets */
+   if (num_sds_chosen == (NO_SPECIFIC))  /* NO_SPECIFIC = -1 */
+      dumpall = TRUE;
+   else		/* otherwise, sort index list */
+      sort(sds_chosen, num_sds_chosen);
+
+   /* for each valid index, if the user request to dump all SDSs or if
+      there are more requested SDSs to be processed, process the curr SDS */
+   sds_count = 0;   /* no SDS has been processed yet */
+   for (sds_index = 0; sds_index < ndsets  /* validate index */
+        && (dumpall                /* either all datasets are dumped or */
+        || sds_count < num_sds_chosen); /* or more requested datasets */
+        sds_index++)
+   {
+      /* if the user neither requests dump all nor the current dataset */
+      if ((!dumpall) && (sds_index != sds_chosen[sds_count]))
+         continue; /* skip */
+
+      sds_count++;   /* count the # of datasets being processed */
+
+      /* 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_CONT_3( "in %s: %s failed for %d'th SDS",
+                      "printSD_ASCII", "SDselect", (int)sds_index );
+
+      /* get dataset's information */
+      status = SDgetinfo(sds_id, name, &rank, dimsizes, &nt, &nattrs);
+      if( status == FAIL )
+      {
+         resetSDS( &sds_id, sds_index, curr_file_name );
+         ERROR_CONT_3( "in %s: %s failed for %d'th SDS", 
+                       "printSD_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 )
+         {
+            resetSDS( &sds_id, sds_index, curr_file_name );
+            ERROR_CONT_3( "in %s: %s failed for %d'th SDS", 
+                       "printSD_ASCII", "SDgetdimid", (int)sds_index );
+         }
+
+         /* get information of current dimension */
+         if( SDdiminfo(dim_id, NULL, &size, &nt, &num_attrs) == FAIL )
+         {
+            resetSDS( &sds_id, sds_index, curr_file_name );
+            ERROR_CONT_3( "in %s: %s failed for %d'th SDS", 
+                       "printSD_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", 
+			"printSD_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 ", name);
+               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 = ", name);
+               fprintf(fp, "%d\n\t Type= %s\n", (int)sds_index, nt_desc);
+            }
+
+            resetBuff(( VOIDP *) &nt_desc );  /* done with nt_desc */
+
+            /* get SDS's ref# from its id */
+            if ((sds_ref = SDidtoref(sds_id)) == FAIL)
+               ERROR_BREAK_3( "in %s: %s failed for %d'th SDS", 
+			"printSD_ASCII", "SDidtoref", (int)sds_index, FAIL );
+
+            fprintf(fp, "\t Ref. = %d\n", (int) sds_ref);
+            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", 
+			"printSD_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", 
+			"printSD_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", 
+		     "printSD_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",
+		"printSD_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 (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", 
+			"printSD_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 */
+
+   }	/* for each SDS in the file */
+
+   return( ret_value );
+} /* end of printSD_ASCII() */
+
+intn
+printSD_BINARY( int32 sd_id,
+             FILE *fp,
+             dump_info_t *dumpsds_opts,
+             int32 *sds_chosen,
+             int32 num_sds_chosen,
+             int32 ndsets )
+{
+   int32 sds_id,
+         sds_index,
+         sds_count,
+         dimsizes[MAXRANK],
+         dimNT[MAXRANK],
+         dimnattr[MAXRANK],
+         rank,
+         nt,
+         nattrs;
+   char  name[MAXNAMELEN],
+         curr_file_name[MAXFNLEN];
+   intn  dumpall = FALSE,
+         status,
+         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 );
+
+   /* when there are no datasets specified, dumper dumps all datasets */
+   if (num_sds_chosen == NO_SPECIFIC )
+      dumpall = TRUE;
+   else
+      sort(sds_chosen, num_sds_chosen);
+
+   /* for each valid index, if the user request to dump all datasets or
+      if there are more requested datasets to be processed, process the
+      indexed dataset */
+   sds_count = 0;   /* no requested dataset has been processed yet */
+   for (sds_index = 0; sds_index < ndsets  /* validate index */
+        && (dumpall                /* either all datasets are dumped or */
+        || sds_count < num_sds_chosen); /* more requested datasets */
+        sds_index++)
+   {
+      /* if the user neither requests dump all nor the current dataset */
+      if ((!dumpall) && (sds_index != sds_chosen[sds_count]))
+         continue; /* skip */
+
+      sds_count++;   /* count the # of datasets have been processed */
+
+      /* Reset variables. */
+      HDmemset(dimsizes, 0, sizeof(int32) * MAXRANK);
+      HDmemset(dimNT, 0, sizeof(int32) * MAXRANK);
+      HDmemset(dimnattr, 0, sizeof(int32) * MAXRANK);
+
+      sds_id = SDselect(sd_id, sds_index);
+      if (sds_id == FAIL)
+         ERROR_CONT_3( "in %s: %s failed for %d'th SDS",
+			"printSD_BINARY", "SDselect", (int)sds_index );
+
+      status = SDgetinfo(sds_id, name, &rank, dimsizes, &nt, &nattrs);
+      if( FAIL == status )
+      {
+         resetSDS( &sds_id, sds_index, curr_file_name );
+         ERROR_CONT_3( "in %s: %s failed for %d'th SDS",
+			"printSD_BINARY", "SDgetinfo", (int)sds_index );
+      }
+
+      /* 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_CONT_3( "in %s: %s failed for %d'th SDS", 
+			"printSD_BINARY", "sdsdumpfull", (int)sds_index );
+      }
+      resetSDS( &sds_id, sds_index, curr_file_name );
+   }  /* for each dataset in file */
+
+   return( ret_value );
+} /* end of printSD_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_type_t ft = dumpsds_opts->file_type;
+   intn   index_error = 0,
+          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, 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]);
+      HDstrcpy( dumpsds_opts->ifile_name, file_name ); /* record file name */
+      curr_arg++;
+
+      /* if SDstart fails, shoudl ret_value be set to FAIL or SUCCEED? */
+      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);}
+	 /* otherwise, print message, then continue processing the next file */
+	 else
+            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 the number of items in it */
+      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( ft )
+      {
+         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" );
+            }
+            status = printSD_ASCII( sd_id, dumpsds_opts, ndsets, sds_chosen, num_sds_chosen, fp );
+            if( status == FAIL )
+               fprintf( stderr, "HDP ERROR>>> in dsd: %s failed for file %s\n", 
+				"printSD_ASCII", file_name );
+
+            /* 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");
+            status = printSD_BINARY( sd_id, fp, dumpsds_opts, sds_chosen, num_sds_chosen, ndsets );
+            if( status == FAIL )
+               fprintf( stderr, "HDP ERROR>>> in dsd: %s failed for file %s\n", 
+			"printSD_BINARY", file_name );
+
+            /* 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 (sds_chosen != NULL)
+            {
+                HDfree(sds_chosen);
+                sds_chosen=NULL;
+            } /* end if */
+      }
+    /* 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, 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);
+      ret_value = FAIL; /* so caller can be traced in debugging */
+      goto done;
+   }            /* 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" );
+
+  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(dumpsds_opts.by_index.num_list );
+   free_num_list(dumpsds_opts.by_ref.num_list );
+   free_str_list(dumpsds_opts.by_name.str_list, dumpsds_opts.by_name.num_items);
+
+   return ret_value;
+}	/* end do_dumpsds() */
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_util.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_util.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_util.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,755 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#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;
+
+    ret = HDgettagsname(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_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 )
+            HDfree( nodelist[i] );
+      HDfree( nodelist );
+   }
+   return( 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++ )
+         free_char_list( str_list[i] );
+      HDfree( str_list );
+   }
+   return( NULL );
+}  /* end of free_str_list */
+
+/* free_num_list use HDfree to free the string of characters; this routine
+   is short but can be used in many different places and very convenient */
+char* free_char_list( char *char_list )
+{
+   if( char_list != NULL)
+      HDfree( char_list );
+   return( NULL );
+}  /* end of free_char_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 */
+
+/*
+printf("make_group_list for tag/ref = %d/%d\n", tag, ref );
+*/
+                      for (i = 0; i < nobj; i++)
+                        {
+                            ret->dd_arr[i].tag = (uint16) temp_tag[i];
+                            ret->dd_arr[i].ref = (uint16) temp_ref[i];
+/*
+printf("element %d: tag/ref = %d/%d\n", i, temp_tag[i], 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;
+
+   /* 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++;
+
+   /* 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 */
+
+/* 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 */
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_vd.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_vd.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_vd.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1125 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.45 $";
+#endif
+
+/* $Id: hdp_vd.c,v 1.45 2000/09/05 14:28:12 bmribler Exp $ */
+
+#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_type = DBINARY;
+             (*curr_arg)++;
+             break;
+
+         case 'x':   /* dump data in ascii, also default */
+             dumpvd_opts->file_type = 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)
+   {
+      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 */
+
+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 = 0;
+
+         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 = 1;
+         }
+         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 )
+{ 
+/*   int32 lastItem;
+   int32 count = 0;
+   char  *tempPtr = NULL;
+   char  *ptr = NULL;
+   int32 i;
+*/
+   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 dumpvd also uses this routine and 
+      has different indentation format than dumpvg */
+   print_fields( fields, "   fields = ", fp );
+
+   if( curr_vd->vsize > 0 ) /* print vdata record size */
+      fprintf(fp, "   record size (in bytes) = %d;\n", (int)curr_vd->vsize);
+   else
+      fprintf(fp, "   record size = <Undefined>;\n");
+
+   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->class[0] == '\0' || curr_vd->class == NULL )
+      fprintf(fp, " class = <Undefined>;\n");
+   else
+      fprintf(fp, " class = %s;\n", curr_vd->class);
+
+} /* 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;
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+	/* macintosh cannot handle >32K locals */
+   char *tempflds = (char *)HDmalloc(VSFIELDMAX*FIELDNAMELENMAX* sizeof(char));
+   CHECK_ALLOC( tempflds, "tempflds", "getFieldIndices" );
+#else /* !macintosh */
+   char   tempflds[VSFIELDMAX*FIELDNAMELENMAX];
+#endif /* !macintosh */    
+
+   /* 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...) */
+
+/* free dynamic space if on MAC */
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+   if(tempflds != NULL)
+   {
+      HDfree(tempflds);
+      tempflds = NULL;
+   } 
+#endif /* macintosh */
+
+   /* 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,
+             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];
+   char        vdname[VSNAMELENMAX];
+   char        fldstring[MAXNAMELEN];
+   intn        dumpall = 0;
+   file_type_t ft = DASCII;
+   vd_info_t   curr_vd;
+   int32       vd_id = FAIL;
+   int32       an_handle   = FAIL;
+   intn        status = SUCCEED, ret_value = SUCCEED;
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+	/* macintosh cannot handle >32K locals */
+   char *fields = (char *)HDmalloc(VSFIELDMAX*FIELDNAMELENMAX* sizeof(char));
+   CHECK_ALLOC( fields, "fields", "dumpvd_ascii" );
+
+#else /* !macintosh */
+   char   fields[VSFIELDMAX*FIELDNAMELENMAX];
+#endif /* !macintosh */    
+
+   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 */
+      if (FAIL == VSinquire( vd_id, &nvf, &interlace, fields, &vsize, vdname ))
+	 ERROR_CONT_END( "in %s: VSinquire failed for vdata with ref#=%d", 
+                        "dumpvd_ascii", (int) vdata_ref, vd_id );
+
+      /* Get the size of the specified fields of the vdata */
+      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.class, 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, ft, 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 )
+                      ERROR_BREAK_0( "<No data written>\n\n", SUCCEED );
+                }
+                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, ft, 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 */
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+   if(fields != NULL)
+   {
+      HDfree(fields);
+      fields = NULL;
+    } 
+#endif /* macintosh */
+
+    return ret_value;
+} /* dumpvd_ascii() */
+
+
+intn
+dumpvd_binary(dump_info_t * dumpvd_opts, 
+              int32 file_id,
+              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       vsize;
+   int32       vdata_ref = -1;
+   char        vdname[VSNAMELENMAX];
+   intn        dumpall = 0;
+   file_type_t ft = DBINARY;
+   int32       vd_id = FAIL;
+   intn        status;
+   intn        ret_value = SUCCEED;
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+	/* macintosh cannot handle >32K locals */
+   char *fields = (char *)HDmalloc(VSFIELDMAX*FIELDNAMELENMAX* sizeof(char));
+
+   CHECK_ALLOC( fields, "fields", "dumpvd_binary" );
+
+#else /* !macintosh */
+    char        fields[VSFIELDMAX*FIELDNAMELENMAX]; 
+#endif /* !macintosh */    
+
+    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, &vsize, 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, ft, 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 */
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+   if(fields != NULL)
+   {
+      HDfree(fields);
+      fields = NULL;
+    } 
+#endif /* macintosh */
+
+   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 */
+    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_type_t ft;
+    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 */
+
+   /* 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 );
+
+   /* try opening file */
+   file_id = Hopen(file_name, DFACC_READ, 0);
+   if (file_id == FAIL)
+      ERROR_CONT_1( "in dvd: Hopen failed on file %s\n", file_name);
+
+   if (FAIL == Vstart(file_id))
+      ERROR_CONT_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 */
+
+   ft = dumpvd_opts->file_type;
+   fp = stdout;	/* default file pointer to the standard output */
+   switch(ft)
+   {
+       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", 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", 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);
+      goto done;
+   }            /* 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);
+
+   ret_value = status; /* return status to caller */
+
+  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() */
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_vg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_vg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/hdp_vg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1521 @@
+/***************************************************************************e
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.37 $";
+#endif
+
+/* $Id: hdp_vg.c,v 1.37 2000/09/05 14:28:13 bmribler Exp $ */
+
+#include "hdp.h"
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+#include "vg.h"
+
+/* 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[]) 
+{
+
+   /* 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 */
+             dumpvg_opts->filter |= DINDEX;  /* set bit DINDEX */
+             (*curr_arg)++;
+
+             /* parse and store the given indices in structure by_index */
+             parse_number_opts( argv, curr_arg, &dumpvg_opts->by_index);
+             (*curr_arg)++;
+             break;
+
+         case 'r':	/* dump by reference */
+             dumpvg_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, &dumpvg_opts->by_ref);
+             (*curr_arg)++;
+             break;
+
+         case 'n':	/* dump by names */
+             dumpvg_opts->filter |= DNAME;   /* set bit DNAME */
+             (*curr_arg)++;
+
+             /* parse and store the given names in structure by_name */
+             parse_string_opts( argv, curr_arg, &dumpvg_opts->by_name);
+             (*curr_arg)++;
+             break;
+
+         case 'c':	/* dump by class */
+             dumpvg_opts->filter |= DCLASS;   /* set bit DCLASS */
+             (*curr_arg)++;
+
+             /* parse and store the given classes in structure by_class */
+             parse_string_opts( argv, curr_arg, &dumpvg_opts->by_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_type = DASCII;
+             (*curr_arg)++;
+             break;
+
+         default:	/* invalid dumpvg option */
+             printf("Warning>>> Invalid dumpvg option %s\n", argv[*curr_arg]);
+                return (FAIL);
+            }	/* end switch */
+      }		/* end while */
+
+   /* add the number of vgroups requested by index, by ref#, and by name
+      to have a total number of requested vgroups */
+   dumpvg_opts->num_chosen = dumpvg_opts->by_index.num_items +
+                             dumpvg_opts->by_ref.num_items +
+                             dumpvg_opts->by_name.num_items +
+                             dumpvg_opts->by_class.num_items;
+
+    return (SUCCEED);
+}	/* end parse_dumpvg_opts */
+
+/* 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 */
+
+/* Vstr_index searches for a vgroup that has a given name or class and
+returns the vgroup's index or FAIL. */
+int32 
+Vstr_index(int32 file_id, 
+           char filter_str[MAXNAMELEN], /* vg's name or vg's class */
+           int is_name,   /* TRUE if searching vg's name, FALSE if class */
+           int32 *find_ref, /* current ref#, will return next one */
+           int32 *index)  /* index of the vgroup w/ref# *find_ref */
+{
+    int32  vg_id = FAIL;
+    char   vg_name[MAXNAMELEN];
+    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 filter_str; 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_index", (int)*find_ref );
+
+      /* if the string searched is a vg's name */
+      if (is_name)
+      {
+         if (FAIL == Vgetname(vg_id, vg_name))
+            ERROR_GOTO_2( "in %s: Vgetname failed for vgroup with ref#(%d)",
+                "Vstr_index", (int)*find_ref );
+      }
+
+      /* or the string searched is a vg's class */
+      else
+      {
+         if (FAIL == Vgetclass(vg_id, vg_name))
+         ERROR_GOTO_2( "in %s: Vgetclass failed for vgroup with ref#(%d)",
+                "Vstr_index", (int)*find_ref );
+      }
+
+      if (FAIL == Vdetach(vg_id))
+         ERROR_GOTO_2( "in %s: Vdetach failed for vgroup with ref#(%d)",
+                "Vstr_index", (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(vg_name, filter_str) == 0)
+      {
+             /* store the current index to return first */
+         ret_value = (*index);
+            /* then increment index for next vgroup - same class vgroups*/
+         (*index)++;
+         goto done;
+      }
+      /* Note: in either case, vg or vs, increment the index for the 
+	 next vgroup */
+      (*index)++;
+   } /* end while getting vgroups */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    
+    return ret_value;
+} /* Vstr_index() */
+
+/* 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,
+         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[0] == NULL)
+      fprintf( fp, "\n");
+
+   /* 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; 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]->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");
+
+   /* BMR: reset for the next node in the list - 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,
+               char  *file_name,
+               int32 *n_entries,
+               char  *vgname,
+               char  *vgclass )
+{
+   intn status, ret_value = SUCCEED;
+
+   /* 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 );
+
+   status = Vinquire(*vg_id, n_entries, vgname);
+   if (FAIL == status) /* go to done and return a FAIL */
+   {
+      /* stuff values to these variables so they can be printed */
+      *n_entries = -1;
+      HDstrcpy( vgname, "<Unknown>" );
+
+      ERROR_GOTO_2( "in %s: Vinquire failed for vg ref=%d",
+		"get_VGandInfo", (int) vg_ref );
+   }
+   else if( HDstrcmp( vgname, "" ) == 0) 
+      HDstrcpy( vgname, "<Unknown>" );
+
+   status = Vgetclass(*vg_id, vgclass);
+   if( FAIL == status ) /* go to done and return a FAIL */
+   {
+      /* stuff values to the class so it can be printed */
+      HDstrcpy( vgclass, "<Unknown>" );
+
+      ERROR_GOTO_2( "in %s: Vgetclass failed for vgroup ref#=%d",
+		"get_VGandInfo", (int) vg_ref );
+   }
+   else if( HDstrcmp( vgclass, "" ) == 0) 
+      HDstrcpy( vgclass, "<Unknown>" ); 
+done:
+   if( ret_value == FAIL )
+   {
+   }
+   /* Normal cleanup */
+
+   return( ret_value );
+} /* end of get_VGandInfo */
+
+intn 
+print_data_annots( int32 file_id,
+                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, tag, 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, tag, 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;
+   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. */
+   ptr = (char **) HDmalloc(sizeof(char *) * (num_entries+1));
+
+   /* 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;
+
+   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, *tempPtr,
+          fldname[MAXNAMELEN],
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+
+   /* Lets allocate space for tmpflds */
+   *tempflds = (char *)HDmalloc(VSFIELDMAX * FIELDNAMELENMAX * sizeof(char *));
+   CHECK_ALLOC( tempflds, "*tempflds", "print_fields" );
+
+#else /* !macintosh */
+   tempflds[VSFIELDMAX*FIELDNAMELENMAX];
+#endif /* !macintosh */
+
+   /* 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);
+      ptr = tempflds;
+      for (i = 0; !lastItem; i++)
+      {
+         tempPtr = HDstrchr(ptr, ',');
+         if (tempPtr == NULL)
+            lastItem = 1;
+         else
+            *tempPtr = '\0';
+         HDstrcpy(fldname, ptr);
+         count += HDstrlen(fldname);
+         if (count > 50)
+         {
+            fprintf(fp, "%s", field_title );
+            count = 0;
+         }
+         fprintf(fp, "%s", fldname);
+         if (!lastItem)
+            fprintf(fp, ", ");
+         ptr = tempPtr + 1;
+      }  /* end of if skip */
+      fprintf(fp, "];\n");
+   }  /* there are fields to print */
+   
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+   if(tempflds != NULL)
+   {
+      HDfree(tempflds);
+      tempflds = NULL;
+    } 
+#endif /* macintosh */ 
+
+}  /* 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     i;
+   int32    index,
+            find_ref,
+            vg_count = 0,
+            num_vg_chosen = dumpvg_opts->num_chosen,
+            number;
+   filter_t filter = dumpvg_opts->filter; /* temporary name */
+   intn     ret_value = 0;
+
+   /* if no specific vgroups are requested, return vgroup count 
+      as NO_SPECIFIC (-1) */
+   if( filter == DALL )
+   {
+      ret_value = NO_SPECIFIC;
+      goto done;
+   }
+
+   /* if specific vgroups were requested, allocate space for the array
+      of indices */
+   if (num_vg_chosen > 0)
+      alloc_index_list( vg_chosen, num_vg_chosen );
+
+   /* else, no chosen vgroups but filter is not DALL, it shouldn't be this
+      combination, return vgroup count as NO_SPECIFIC to dump all */
+   else
+   {
+      ret_value = NO_SPECIFIC;
+      goto done;
+
+   }
+
+   /* if there are some vgroups requested by index, store the indices in
+      the array provided by the caller */
+   if( filter & DINDEX )
+      for (i = 0; i<dumpvg_opts->by_index.num_items; i++)
+      {
+         (*vg_chosen)[vg_count] = dumpvg_opts->by_index.num_list[i];
+         vg_count++;
+      }
+
+   /* if there are some vgroups requested by ref#, store the indices in
+      the array provided by the caller */
+   if( filter & DREFNUM )
+      for (i = 0; i<dumpvg_opts->by_ref.num_items; i++)
+      {
+         index = Vref_index(file_id, dumpvg_opts->by_ref.num_list[i]);
+         if (index == FAIL)
+         {
+            printf( "Vgroup with reference number %d: not found\n", 
+                           (int)dumpvg_opts->by_ref.num_list[i]);
+            *index_error = 1; /* error */
+         }
+         else
+         {
+            (*vg_chosen)[vg_count] = index;
+            vg_count++;
+         }
+      }
+
+   /* if there are some vgroups requested by name, store the indices in
+      the array provided by the caller */
+   if( filter & DNAME )
+      for (i = 0; i<dumpvg_opts->by_name.num_items; i++)
+      {
+         find_ref = (-1);
+         number = 0;
+         index = Vstr_index(file_id, dumpvg_opts->by_name.str_list[i], 1, &find_ref, &number);
+         if (index == FAIL)
+         {
+            printf( "Vgroup with name %s: not found\n", 
+                           dumpvg_opts->by_name.str_list[i]);
+            *index_error = 1; /* error */
+         }
+         else
+         {
+            (*vg_chosen)[vg_count] = index;
+            vg_count++;
+         }
+      }
+
+   /* if there are some vgroups requested by class, store the indices in
+      the array provided by the caller */
+   if( filter & DCLASS )
+      for (i = 0; i<dumpvg_opts->by_class.num_items; i++)
+      {
+         int32 found = 0;
+         char sear_class[MAXNAMELEN];
+
+         number = 0;
+         find_ref = (-1);
+         HDstrcpy( sear_class, dumpvg_opts->by_class.str_list[i] );
+         while ((index = Vstr_index(file_id, sear_class, 0, &find_ref, &number)) != -1)
+         {
+            if (vg_count < num_vg_chosen)
+               (*vg_chosen)[vg_count] = index;
+            else
+            {
+               /* reallocate the array vg_chosen to hold multiple
+                  vgroups since class 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] = index;
+               num_vg_chosen++;
+            }
+            found = 1;
+            vg_count++;
+         }
+         if (!found)
+         {
+            printf( "Vgroup with class %s: not found\n", 
+                           dumpvg_opts->by_class.str_list[i]);
+            *index_error = 1; /* error */
+         }
+      }
+   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 */
+      }
+    /* Normal cleanup */
+
+    return ret_value; 
+} /* 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, 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 */
+    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 */
+   }
+
+   if( *vg_chosen != NULL )
+   {
+      HDfree( *vg_chosen );
+      *vg_chosen = NULL;
+   } /* end if */
+
+} /* end of closeVG */
+
+intn
+vgBuildGraph(int32        vg_id, 
+           int32        file_id, 
+           int32        num_entries, 
+	   char* file_name,
+           vg_info_t *aNode,
+           intn         *skipfile)
+{
+    int32  vs;
+    char   vsname[MAXNAMELEN];
+    char   vgname[VGNAMELENMAX];
+    char   vgclass[VGNAMELENMAX];
+    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;
+
+   /* 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_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 );
+         }
+
+	 /* just in case vgroup name is null */
+         if (HDstrlen(vgname) == 0)
+            HDstrcat(vgname, "NoName");
+
+         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( vgname, "<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's name might be "" - is this same thing as <Unknown>? */
+         if (HDstrlen(vsname) == 0)
+            HDstrcat(vsname, "NoName");
+
+         /* 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 */
+
+   aNode->children[num_entries] = NULL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (aNode->children != NULL)
+            {
+                for (entry_num = 0; entry_num < num_entries; entry_num++)
+                   if (aNode->children[entry_num] != NULL)
+                       HDfree(aNode->children[entry_num]);
+                HDfree( aNode->children );
+            }
+          if (aNode->type != NULL)
+            {
+                for (entry_num = 0; entry_num < num_entries; entry_num++)
+                   if (aNode->type[entry_num] != NULL)
+                       HDfree(aNode->type[entry_num]);
+                HDfree( aNode->type );
+            }
+      }
+    /* Normal cleanup */
+    
+    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];
+    char   vgname[VGNAMELENMAX];
+    char   vgclass[VGNAMELENMAX];
+    char  *name = NULL;
+    int32  i;
+    char  *file_name = dumpvg_opts->ifile_name;
+    intn   status, ret_value = SUCCEED;
+
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+	/* macintosh cannot handle >32K locals */
+   char *fields = (char *)HDmalloc(VSFIELDMAX*FIELDNAMELENMAX* sizeof(char));
+   CHECK_ALLOC( fields, "*fields", "vgdumpfull" );
+
+#else /* !macintosh */
+    char   fields[VSFIELDMAX*FIELDNAMELENMAX];
+#endif /* !macintosh */    
+
+   /* 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 );
+      }
+
+      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 );
+         }
+
+	 /* just in case vgroup name is null */
+         if (HDstrlen(vgname) == 0)
+            HDstrcat(vgname, "NoName");
+
+         /* 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_type, 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 );
+
+	 /* just in case vdata name is null */
+         if (HDstrlen(vsname) == 0)
+               HDstrcat(vsname, "NoName");
+   
+         if (FAIL == VSgetclass(vs, vsclass))
+               ERROR_CONT_2( "in %s: VSgetclass failed for vdata with ref#=%d", 
+                                 "vgdumpfull", (int) elem_ref );
+
+         if (HDstrlen(vsclass) == 0)
+            HDstrcpy( vsclass, "<Unknown>" );
+
+         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's name might be "" - is this same thing as <Unknown>? */
+         if (HDstrlen(vsname) == 0)
+            HDstrcat(vsname, "NoName");
+
+         /* 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 */
+
+   aNode->children[num_entries] = NULL;
+
+   if( !found )
+      printf("     None.\n");
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (aNode->children != NULL)
+            {
+                for (i = 0; i < num_entries; i++)
+                   if (aNode->children[i] != NULL)
+                       HDfree(aNode->children[i]);
+                HDfree( aNode->children );
+            }
+          if (aNode->type != NULL)
+            {
+                for (i = 0; i < num_entries; i++)
+                   if (aNode->type[i] != NULL)
+                       HDfree(aNode->type[i]);
+                HDfree( aNode->type );
+            }
+      }
+    /* Normal cleanup */
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+   if(fields != NULL)
+   {
+      HDfree(fields);
+      fields = NULL;
+    } 
+#endif /* macintosh */ 
+    
+    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       i, j;
+    int32       vg_ref = -1;
+    int32       vg_tag;
+    int32       n_entries;
+    int32       level;
+    int32       max_vgs=0;
+    int32       num_nodes = 0;
+    int         index_error = 0;
+    int         dumpall = 0;
+    char        file_name[MAXFNLEN];
+    char        vgclass[VGNAMELENMAX];
+    char        vgname[VGNAMELENMAX];
+    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 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 );
+
+      /* 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, close hdf file & go to next file */
+      if (FAIL == Vstart(file_id))
+         ERROR_CONT_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 */
+         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 indices */
+      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 = -1;  /* searching at the beginning of the file */
+
+      /* for each vgroup: go thru each vgroup in the file or until the 
+         number of vgs being printed reaches the number of vgs chosen */
+      for (i = 0; (vg_ref = Vgetid(file_id, vg_ref)) != FAIL 
+                   && (dumpall || vg_count < num_vg_chosen); i++)
+      {
+         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) && (i != 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[i] = (vg_info_t *) HDmalloc(sizeof(vg_info_t));
+         CHECK_ALLOC( list[i], "list[i]", "dvg" );
+
+         /* 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) i);
+            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_type, 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[i], &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[i], &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[i] 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[i]->index = i;
+         HDstrcpy(list[i]->name, vgname);
+         list[i]->displayed = FALSE;
+         list[i]->treedisplayed = FALSE;  /* BMR - 01/16/99 */
+      }	/* for all vgroups */
+
+      /* 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 the list of vg_info_t nodes */
+      list = free_vginfo_list( list, max_vgs );
+
+      /* 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 */
+          closeVG( &file_id, &vg_chosen, file_name );
+          resetVG( &vg_id, file_name );
+          list = free_vginfo_list( list, max_vgs );
+      }
+    /* 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 lists for given indices, ref#s, names, and classes if
+      they had been allocated */
+   free_num_list( dumpvg_opts.by_index.num_list );
+   free_num_list( dumpvg_opts.by_ref.num_list );
+   free_str_list( dumpvg_opts.by_name.str_list, dumpvg_opts.by_name.num_items);
+   free_str_list( dumpvg_opts.by_class.str_list, dumpvg_opts.by_class.num_items );
+
+    return ret_value;
+}	/* end do_dumpvg() */
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/make.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/make.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/make.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+$! --------------------------------------------------------------------------
+$! For making HDP.EXE on VMS.
+$! --------------------------------------------------------------------------
+$!
+$!
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC"
+$ define/nolog sys$clib sys$library:deccrtl
+$ else
+$ ccopt = ""
+$ define/nolog sys$clib sys$library:vaxcrtl
+$ endif
+$ ccc := cc 'ccopt /opt/nodebug/define=(HDF,NO_SYS_XDR_INC)/nolist -
+            /include=([-.libsrc],[-.xdr],[--.hdf.src], -
+            [--.hdf.jpeg], [--.hdf.zlib]) 
+$
+$ ccc hdp.C
+$ ccc hdp_dump.C
+$ ccc hdp_list.C
+$ ccc hdp_rig.C
+$ ccc hdp_sds.C
+$ ccc hdp_util.C
+$ ccc hdp_vd.C
+$ ccc hdp_vg.C
+$ ccc hdp_gr.C
+$ ccc show.C
+$ link/nodebug/notraceback/exe=hdp.exe -
+    hdp.obj, -
+    hdp_dump.obj, -
+    hdp_list.obj, -
+    hdp_rig.obj, -
+    hdp_sds.obj, -
+    hdp_util.obj, -
+    hdp_vd.obj, -
+    hdp_vg.obj, -
+    hdp_gr.obj, -
+    show.obj, -
+    [--.lib]mfhdf/lib,[--.hdf.src]df/lib,[--.hdf.jpeg]libjpeg.olb/lib,  -
+    [--.hdf.zlib]libz.olb/lib, -
+    sys$input/opt
+        sys$clib/lib
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/show.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/show.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/show.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,696 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/* Modified from vshow.c by Eric Tsui, 12/25/1994. */
+
+#ifdef RCSID
+static char *RcsId[] = "@(#)$Revision: 1.22 $";
+#endif
+
+#define VSET_INTERFACE
+#include "hdp.h"
+
+#define BUFFER 1000000
+
+/* ------------------------------------------------ */
+
+int32
+dumpvd(int32       vd, 
+       file_type_t ft, 
+       int         data_only, 
+       FILE       *fp, 
+       char        separater[2],
+       int32       flds_indices[VSFIELDMAX], 
+       int         dumpallfields)
+{
+    char        vdname[VSNAMELENMAX];
+    int32       j, i, t, interlace, nv, vsize;
+    uint8      *bb = NULL;
+    uint8      *b = NULL;
+    DYN_VWRITELIST *w = NULL;
+    intn       (*vfmtfn[VSFIELDMAX]) (VOIDP ,  file_type_t ft,  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;
+
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+	/* macintosh cannot handle >32K locals */
+    char *fields = (char *)HDmalloc(VSFIELDMAX*FIELDNAMELENMAX* sizeof(char));
+    char *flds = (char *)HDmalloc(VSFIELDMAX*FIELDNAMELENMAX* sizeof(char));
+
+    CHECK_ALLOC( fields, "fields", "dumpvd" );
+    CHECK_ALLOC( flds, "flds", "dumpvd" );
+
+#else /* !macintosh */
+    char        fields[VSFIELDMAX*FIELDNAMELENMAX];
+    char        flds[VSFIELDMAX*FIELDNAMELENMAX];
+#endif /* !macintosh */    
+
+    /* 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(ft==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, ft, 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])
+            {
+            case DFNT_CHAR:
+                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(ft==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))
+                  {
+                      fprintf(stderr,"dumpvd: VSread failed for vd = %d \n",(int)vd);
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                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, ft, 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))
+                  {
+                      fprintf(stderr,"dumpvd: VSread failed for vd = %d \n",(int)vd);
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                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, ft, 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 */
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+   if(fields != NULL)
+   {
+      HDfree(fields);
+      fields = NULL;
+    } 
+   if(flds != NULL)
+   {
+      HDfree(flds);
+      fields = NULL;
+    } 
+#endif /* macintosh */
+    
+    return ret_value;
+}	/* dumpvd */
+
+
+/* 
+ * dumps attributes of vdata for vgroup
+ */
+intn 
+dumpattr(int32 vid, 
+         int32 findex, 
+         intn isvs,
+         file_type_t ft, 
+         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_type_t ft, FILE *);
+    intn          status;
+    intn          ret_value = SUCCEED;
+
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+	/* macintosh cannot handle >32K locals */
+    char *name = (char *)HDmalloc((FIELDNAMELENMAX+1) * sizeof(char));
+    uint8 *attrbuf = (uint8 *)HDmalloc((BUFFER) * sizeof(uint8));
+
+    /* check if allocations fail, terminate hdp */
+    CHECK_ALLOC( name, "name", "dumpattr" );
+    CHECK_ALLOC( attrbuf, "attrbuf", "dumpattr" );
+
+#else /* !macintosh */
+    char          name[FIELDNAMELENMAX+1];
+    uint8         attrbuf[BUFFER];
+#endif /* !macintosh */    
+
+    /* vdata or vgroup? */
+    if (isvs) 
+        nattrs = VSfnattrs(vid, findex);
+    else
+        nattrs = Vnattrs(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
+              status = Vattrinfo(vid, i, name, &i_type,&i_count, &e_size);
+
+          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
+                    status = Vgetattr(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
+                    status = Vgetattr(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)  
+            {
+            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, ft, 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 */
+#if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C)
+   if(name != NULL)
+   {
+      HDfree(name);
+      name = NULL;
+    } 
+   if(attrbuf != NULL)
+   {
+      HDfree(attrbuf);
+      attrbuf = NULL;
+    } 
+#endif /* macintosh */    
+
+    return ret_value;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/star.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/star.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/swf32.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/swf32.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/swf32_fileattr.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/swf32_fileattr.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/swi16.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/swi16.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/swi8.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/swi8.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tdata.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tdata.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tdf24.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tdf24.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tdfr8f.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tdfr8f.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/test.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/test.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-1.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-1.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-1.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,144 @@
+#############################
+Expected output for './hdp dumpgr grtdfui82.hdf'
+#############################
+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
+	 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
+	 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
+	 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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-10.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-10.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-10.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,149 @@
+#############################
+Expected output for './hdp dumpgr grtdfui84.hdf'
+#############################
+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
+	 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
+	 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
+	 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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-11.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-11.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-11.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,144 @@
+#############################
+Expected output for './hdp dumpgr grtdfui162.hdf'
+#############################
+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
+	 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
+	 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
+	 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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-12.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-12.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-12.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,95 @@
+#############################
+Expected output for './hdp dumpgr grtdfi322.hdf'
+#############################
+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
+	 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
+	 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
+	 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
+	 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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-13.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-13.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-13.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,115 @@
+#############################
+Expected output for './hdp dumpgr -p Image_with_Palette.hdf'
+#############################
+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
+	 Number of attributes = 0
+	 Data : 
+                1 2 2 3 3 4 4 5 5 6 2 3 3 4 4 5 5 6 6 7 3 4 4 5 5 
+                6 6 7 7 8 4 5 5 6 6 7 7 8 8 9 5 6 6 7 7 8 8 9 9 10 
+	 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 
+
+	 Image  Name = Second Image w/pal
+	 Index = 1
+	 Type= 8-bit unsigned integer
+	 width=5; height=5
+	 Ref. = 3
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 Number of attributes = 0
+	 Data : 
+                1 2 2 3 3 4 4 5 5 6 2 3 3 4 4 5 5 6 6 7 3 4 4 5 5 
+                6 6 7 7 8 4 5 5 6 6 7 7 8 8 9 5 6 6 7 7 8 8 9 9 10 
+	 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 
+
+	 Image  Name = Last Image: no pal
+	 Index = 2
+	 Type= 8-bit unsigned integer
+	 width=5; height=5
+	 Ref. = 4
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 Number of attributes = 0
+	 Data : 
+                1 2 2 3 3 4 4 5 5 6 2 3 3 4 4 5 5 6 6 7 3 4 4 5 5 
+                6 6 7 7 8 4 5 5 6 6 7 7 8 8 9 5 6 6 7 7 8 8 9 9 10 
+	 No palette data

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-14.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-14.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-14.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,34 @@
+#############################
+Expected output for './hdp dumpgr -h Image_with_Palette.hdf'
+#############################
+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
+	 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
+	 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
+	 Number of attributes = 0

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-15.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-15.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-15.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,37 @@
+#############################
+Expected output for './hdp dumpgr -r 2,4 -p -d Image_with_Palette.hdf'
+#############################
+1 2 2 3 3 4 4 5 5 6 2 3 3 4 4 5 5 6 6 7 3 4 4 5 5 6 6 7 7 8 4 5 5 
+6 6 7 7 8 8 9 5 6 6 7 7 8 8 9 9 10 
+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 
+1 2 2 3 3 4 4 5 5 6 2 3 3 4 4 5 5 6 6 7 3 4 4 5 5 6 6 7 7 8 4 5 5 
+6 6 7 7 8 8 9 5 6 6 7 7 8 8 9 9 10 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-16.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-16.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-16.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4 @@
+#############################
+Expected output for './hdp dumpgr -r 6 -d -s grtdfui82.hdf'
+#############################
+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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-17.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-17.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-17.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,21 @@
+#############################
+Expected output for './hdp dumpgr -r 6 -m 1 grtdfui82.hdf'
+#############################
+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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-18.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-18.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-18.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,95 @@
+#############################
+Expected output for './hdp dumpgr -c grtdfi322.hdf'
+#############################
+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
+	 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
+	 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
+	 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
+	 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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-2.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-2.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-2.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,103 @@
+#############################
+Expected output for './hdp dumpgr -i 0,1,3 grtdfui82.hdf'
+#############################
+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
+	 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
+	 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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-3.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-3.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-3.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,21 @@
+#############################
+Expected output for './hdp dumpgr -i 0 grtdfui82.hdf'
+#############################
+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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-4.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-4.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-4.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,21 @@
+#############################
+Expected output for './hdp dumpgr -n Image_array_5 grtdfui82.hdf'
+#############################
+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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-5.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-5.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-5.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,105 @@
+#############################
+Expected output for './hdp dumpgr -r 6,2,3 grtdfui82.hdf'
+#############################
+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
+	 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
+	 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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-6.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-6.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-6.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,8 @@
+#############################
+Expected output for './hdp dumpgr -r 6 -d grtdfui82.hdf'
+#############################
+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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-7.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-7.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-7.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,3 @@
+#############################
+Expected output for './hdp dumpgr -o my.dat grtdfui82.hdf'
+#############################

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-8.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-8.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-8.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,3 @@
+#############################
+Expected output for './hdp dumpgr -o mybin.dat -b grtdfui82.hdf'
+#############################

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-9.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-9.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpgr-9.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,147 @@
+#############################
+Expected output for './hdp dumpgr grtdfui83.hdf'
+#############################
+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
+	 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
+	 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
+	 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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-1.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-1.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-1.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,95 @@
+#############################
+Expected output for './hdp dumprig tdf24.hdf'
+#############################
+File name: tdf24.hdf 
+
+ndsets=3, dumpall=1, num_chosen=-1
+Data model: 24-bit raster image with 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 with 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 with 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-2.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-2.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-2.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,64 @@
+#############################
+Expected output for './hdp dumprig -i 1,2 tdf24.hdf'
+#############################
+File name: tdf24.hdf 
+
+ndsets=3, dumpall=0, num_chosen=2
+Data model: 24-bit raster image with 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 with 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-3.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-3.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-3.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,36 @@
+#############################
+Expected output for './hdp dumprig -i 1,3 tdf24.hdf'
+#############################
+File name: tdf24.hdf 
+
+ndsets=3, dumpall=0, num_chosen=2
+Data model: 24-bit raster image with 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-4.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-4.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-4.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,95 @@
+#############################
+Expected output for './hdp dumprig -m 24 tdf24.hdf'
+#############################
+File name: tdf24.hdf 
+
+ndsets=3, dumpall=1, num_chosen=-1
+Data model: 24-bit raster image with 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 with 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 with 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-5.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-5.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-5.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,64 @@
+#############################
+Expected output for './hdp dumprig -r 3,4 tdf24.hdf'
+#############################
+File name: tdf24.hdf 
+
+ndsets=3, dumpall=0, num_chosen=2
+Data model: 24-bit raster image with 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 with 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-6.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-6.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumprig-6.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,52 @@
+#############################
+Expected output for './hdp dumprig -r 3,4 -d tdf24.hdf'
+#############################
+ndsets=3, dumpall=0, num_chosen=2
+     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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-1.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-1.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-1.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,113 @@
+#############################
+Expected output for './hdp dumpsds swf32.hdf'
+#############################
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 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
+	 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
+	 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
+	 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 
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-2.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-2.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-2.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,28 @@
+#############################
+Expected output for './hdp dumpsds -i 2 swf32.hdf'
+#############################
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim2
+	 Index = 2
+	 Scale Type= 32-bit floating point
+	 Ref. = 5
+	 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 
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-3.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-3.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-3.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,65 @@
+#############################
+Expected output for './hdp dumpsds -i 1,3 swf32.hdf'
+#############################
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim1
+	 Index = 1
+	 Scale Type= 32-bit floating point
+	 Ref. = 4
+	 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
+	 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 
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-4.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-4.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-4.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,4 @@
+#############################
+Expected output for './hdp dumpsds -n Time swf32.hdf'
+#############################
+SDS with name Time: not found

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-5.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-5.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-5.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,65 @@
+#############################
+Expected output for './hdp dumpsds -n fakeDim0,Data-Set-2 swf32.hdf'
+#############################
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 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
+	 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 
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-6.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-6.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-6.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,65 @@
+#############################
+Expected output for './hdp dumpsds -r 3,2 swf32.hdf'
+#############################
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 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
+	 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 
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-7.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-7.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-7.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,14 @@
+#############################
+Expected output for './hdp dumpsds -r 3,2 -d swf32.hdf'
+#############################
+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 
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-8.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-8.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-8.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,110 @@
+#############################
+Expected output for './hdp dumpsds -h swf32_fileattr.hdf'
+#############################
+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
+	 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
+	 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
+	 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
+	 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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-9.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-9.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpsds-9.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,129 @@
+#############################
+Expected output for './hdp dumpsds -c swf32_fileattr.hdf'
+#############################
+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
+	 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
+	 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
+	 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
+	 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 
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-1.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-1.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-1.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,12147 @@
+#############################
+Expected output for './hdp dumpvd tvset.hdf'
+#############################
+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  ; 
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-10.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-10.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-10.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,237 @@
+#############################
+Expected output for './hdp dumpvd tvattr.hdf'
+#############################
+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  ; 
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-2.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-2.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-2.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,75 @@
+#############################
+Expected output for './hdp dumpvd -i 1,3,5 tvset.hdf'
+#############################
+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  ; 
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-3.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-3.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-3.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,62 @@
+#############################
+Expected output for './hdp dumpvd -r 1238,1239,1251,1252 tvset.hdf'
+#############################
+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  ; 
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-4.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-4.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-4.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,26 @@
+#############################
+Expected output for './hdp dumpvd -n Multi-Order Vdata tvset.hdf'
+#############################
+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  ; 
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-5.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-5.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-5.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,89 @@
+#############################
+Expected output for './hdp dumpvd -n Mixed Vdata,Integer Vdata tvset.hdf'
+#############################
+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  ; 
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-6.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-6.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-6.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,147 @@
+#############################
+Expected output for './hdp dumpvd -c Test object,No class specified tvset.hdf'
+#############################
+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  ; 
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-7.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-7.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-7.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+#############################
+Expected output for './hdp dumpvd -f B tvset.hdf'
+#############################
+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  ; 
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-8.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-8.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-8.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,23 @@
+#############################
+Expected output for './hdp dumpvd -f STATION_NAME,FLOATS tvset.hdf'
+#############################
+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  ; 
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-9.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-9.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvd-9.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,15 @@
+#############################
+Expected output for './hdp dumpvd -f STATION_NAME,FLOATS -d tvset.hdf'
+#############################
+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   
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-1.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-1.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-1.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+#############################
+Expected output for './hdp dumpvg tvset.hdf'
+#############################
+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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-10.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-10.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-10.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,71 @@
+#############################
+Expected output for './hdp dumpvg -h -c Dim0.0,Var0.0 tdata.hdf'
+#############################
+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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-11.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-11.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-11.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,62 @@
+#############################
+Expected output for './hdp dumpvg tvattr.hdf'
+#############################
+File name: tvattr.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 2;
+     name = vgname0; class = <Unknown>;
+     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 = <Unknown>;
+     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 = <Unknown>;
+	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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-12.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-12.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-12.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,62 @@
+#############################
+Expected output for './hdp dumpvg tvattr.hdf'
+#############################
+File name: tvattr.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 2;
+     name = vgname0; class = ;
+     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 = ;
+     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 = ;
+	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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-2.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-2.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-2.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+#############################
+Expected output for './hdp dumpvg -i 0,1 tvset.hdf'
+#############################
+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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-3.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-3.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-3.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,32 @@
+#############################
+Expected output for './hdp dumpvg -r 3 tvset.hdf'
+#############################
+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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-4.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-4.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-4.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,20 @@
+#############################
+Expected output for './hdp dumpvg -n Simple Vgroup tvset.hdf'
+#############################
+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 
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-5.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-5.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-5.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+#############################
+Expected output for './hdp dumpvg -c Test object tvset.hdf'
+#############################
+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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-6.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-6.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-6.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,103 @@
+#############################
+Expected output for './hdp dumpvg -i 1,3,5 tdata.hdf'
+#############################
+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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-7.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-7.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-7.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,111 @@
+#############################
+Expected output for './hdp dumpvg -r 32,39 tdata.hdf'
+#############################
+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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-8.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-8.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-8.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,111 @@
+#############################
+Expected output for './hdp dumpvg -n nsamp,tdata.hdf tdata.hdf'
+#############################
+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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-9.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-9.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/dumpvg-9.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,96 @@
+#############################
+Expected output for './hdp dumpvg -c CDF0.0 tdata.hdf'
+#############################
+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  
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-1.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-1.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-1.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,24 @@
+#############################
+Expected output for './hdp list tdata.hdf'
+#############################
+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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-10.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-10.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-10.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,57 @@
+#############################
+Expected output for './hdp list -n Example6.hdf'
+#############################
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-2.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-2.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-2.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,42 @@
+#############################
+Expected output for './hdp list -l tdata.hdf'
+#############################
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-3.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-3.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-3.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,42 @@
+#############################
+Expected output for './hdp list -d tdata.hdf'
+#############################
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-4.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-4.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-4.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+#############################
+Expected output for './hdp list -e tdata.hdf'
+#############################
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-5.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-5.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-5.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,8 @@
+#############################
+Expected output for './hdp list -t 720 tdata.hdf'
+#############################
+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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-6.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-6.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-6.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,10 @@
+#############################
+Expected output for './hdp list -d -t Numeric Data Group tdata.hdf'
+#############################
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-7.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-7.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-7.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,88 @@
+#############################
+Expected output for './hdp list -g tdata.hdf'
+#############################
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-8.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-8.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-8.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,42 @@
+#############################
+Expected output for './hdp list -a tdata.hdf'
+#############################
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-9.out
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-9.out	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testfiles/list-9.out	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,54 @@
+#############################
+Expected output for './hdp list -a Example6.hdf'
+#############################
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/testhdp.sh
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/dumper/testhdp.sh	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/dumper/testhdp.sh	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,318 @@
+#! /bin/sh
+# $Id: testhdp.sh,v 1.15 2000/09/05 15:04:41 bmribler Exp $
+# Test scripts for hdp (dumper).
+# See the USAGE function for command usage.
+
+
+# Definitions of commands and variables
+CMD='./hdp'
+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=testfiles/$1
+    shift
+    # print a id banner
+    MESG 6 "$@"
+    # run the test
+    ( 
+	echo "#############################"
+	echo "Expected output for '$CMD $@'" 
+	echo "#############################"
+        $CMD "$@"
+    ) > $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 $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 dumpsds-1.out dumpsds swf32.hdf
+TEST dumpsds-2.out dumpsds -i 2 swf32.hdf
+TEST dumpsds-3.out dumpsds -i 1,3 swf32.hdf
+
+# Next command should fail with error message: "SD with name Time: not found"
+TEST dumpsds-4.out dumpsds -n Time swf32.hdf
+TEST dumpsds-5.out dumpsds -n fakeDim0,Data-Set-2 swf32.hdf
+TEST dumpsds-6.out dumpsds -r 3,2 swf32.hdf
+TEST dumpsds-7.out dumpsds -r 3,2 -d swf32.hdf
+TEST dumpsds-8.out dumpsds -h swf32_fileattr.hdf
+TEST dumpsds-9.out dumpsds -c swf32_fileattr.hdf
+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
+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
+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 my.dat grtdfui82.hdf
+$RM my.dat
+TEST dumpgr-8.out dumpgr -o 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 to test new option -p that prints palette
+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 -p -d 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
+
+else
+MESG 3 "$TestName <<<SKIPPED>>>"
+fi
+
+# End of test
+FINISH

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tvattr.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tvattr.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tvset.hdf
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/dumper/tvset.hdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/Linux.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/Linux.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/Linux.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Sun)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_')	# for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,832 @@
+# Makefile for the FORTRAN interface to the Network CDF library
+#
+# $Id: Makefile.in,v 1.31 2000/08/30 21:55:39 wendling Exp $
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+ZLIB_LIB = $(TOP_SRCDIR)/hdf/zlib/libz.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+OTHERDIRS = config msoft vms
+
+PROGRAM		= ftest
+#OS		= @OS@
+#FC		= @FC@
+#CPP_NETCDF	= -I../libsrc $(HDF_INC)
+#CPPFLAGS	= $(CPPFLAGS_NF)
+#CFLAGS		= @CFLAGS@
+#FFLAGS		= @FFLAGS@
+#HDF_LIB         = @HDF_LIB@
+#JPEG_LIB        = @JPEG_LIB@
+GARBAGE		= $(PROGRAM) test.nc copy.nc \
+		  c*.hdf \
+		  test*.hdf hdftest hdfout.new \
+		  netcdf.f90
+HEADERS		= netcdf.inc netcdf.f90
+MANIFEST = $(DISTFILES)
+DISTFILES	= $(PROGRAM).src Makefile.in README aix.m4 common.inc \
+		  common.m4 depend descrip.mms fortc fortc1.sed \
+		  fortc2.sed hpux.m4 irix.m4 jackets.src msoft.m4 msoft.mk \
+		  osf.m4 sunos.m4 ultrix.m4 unicos.m4 vax-ultrix.m4 \
+		  vms.m4 convex.m4 freebsd.m4 Linux.m4 \
+		  msoft/NOTES msoft/fslen.asm msoft/ftest.for \
+		  msoft/jackets.c msoft/msoft.int \
+		  msoft/netcdf.inc \
+		  vms/ftest.for \
+		  vms/ftest.m4 \
+		  vms/jackets.c \
+		  vms/make.com \
+		  vms/netcdf.inc \
+		  mfsdf.c mfsdff.f hdftest.f \
+		config/netcdf-hpux.inc config/jackets-hpux.c config/ftest-hpux.f \
+		config/netcdf-irix4.inc config/jackets-irix4.c config/ftest-irix4.f \
+		config/netcdf-irix5.inc config/jackets-irix5.c config/ftest-irix5.f \
+		config/netcdf-irix6.inc config/jackets-irix6.c config/ftest-irix6.f \
+		config/netcdf-irix32.inc config/jackets-irix32.c config/ftest-irix32.f \
+		config/netcdf-sun.inc config/jackets-sun.c config/ftest-sun.f \
+		config/netcdf-linux.inc config/jackets-linux.c config/ftest-linux.f \
+		config/netcdf-fbsd.inc config/jackets-fbsd.c config/ftest-fbsd.f \
+		config/netcdf-alpha.inc config/jackets-alpha.c config/ftest-alpha.f \
+		config/netcdf-dec.inc config/jackets-dec.c config/ftest-dec.f \
+		config/netcdf-aix.inc config/jackets-aix.c config/ftest-aix.f \
+		config/netcdf-solaris.inc config/jackets-solaris.c config/ftest-solaris.f \
+		config/netcdf-solarisx86.inc config/jackets-solarisx86.c  config/ftest-solarisx86.f \
+		config/netcdf-convex.inc config/jackets-convex.c config/ftest-convex.f \
+		config/netcdf-unicos.inc config/jackets-unicos.c config/ftest-unicos.f
+
+LIBOBJS		= jackets.o mfsdf.o mfsdff.o
+LIBNAME		= mfhdf
+#REMOTE_LIBRARY	= ../libsrc/lib$(LIBNAME).a
+REMOTE_LIBRARY	= $(srcdir)/../libsrc/lib$(LIBNAME).a
+#LD_XDR		= @LD_XDR@
+#LD_NETCDF	= -L../libsrc -lmfhdf
+LD_NETCDF	= $(srcdir)/../libsrc/libmfhdf.a
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(JPEG_LIB) $(ZLIB_LIB) $(LIBSX)
+prefix		= ../../..
+
+# directory used by extelt test.
+TESTDIR = testdir
+
+all::		FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) nall ; \
+	esac
+
+
+nall::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) netcdf.inc $(REMOTE_LIBRARY); \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" netcdf.inc $(REMOTE_LIBRARY); \
+	fi
+
+test:		FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	    echo "=================================";\
+	    echo "netCDF Fortran interface tests";\
+	    echo "=================================";\
+	    ./$(PROGRAM); \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) hdftest;; \
+	esac
+
+install-includes:: install
+
+install::	FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) $(LOCAL_MACROS) installed_headers;; \
+	esac
+
+$(PROGRAM):	$(REMOTE_LIBRARY)
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	FFLAGS="$(FFLAGS)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	FFLAGS="$(FFLAGS)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+#	$(LD) -b -o libmfhdf.sl $(LIBOBJS)
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+#	$(LD) -b -o ../libsrc/libmfhdf.sl $(LIBOBJS)
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(PROGRAM).o FORCE
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF) '; \
+	fi; \
+	cmd="$$ld $(PROGRAM).o $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Rules to make Free format Fortran90 include files from F77 include files
+# 1) change all col. 1 [Cc] to '!'
+# 2) change all col. 6 continuation character to '&'
+#
+.SUFFIXES:	.inc .f90
+
+.inc.f90:
+	sed -e 's/^[cC]/!/' -e 's/^     [^ ]/     \&/' < $< > $*.f90
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log $(TESTDIR)/*
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags ftest.f netcdf.inc jackets.c \
+	    $(TESTDIR)/*
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/fortran
+dist: $(DISTFILES)
+	for subdir in $(OTHERDIRS); do \
+	  mkdir $(distdir)/$$subdir || exit 1; \
+	done
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+
+# Disable the following since the three files are created by hand
+# and copied in during configuration.  The following, if ever activiated,
+# would blow away those good files.
+#
+#jackets.c:	fortc1.sed fortc2.sed common.m4 jackets.src $(OS).m4
+#	./fortc -L . -O $(OS) jackets.src > $@
+#
+#netcdf.inc:	common.inc fortc1.sed fortc2.sed common.m4 $(OS).m4
+#	./fortc -L . -O $(OS) common.inc > $@
+#
+#$(PROGRAM).f:	fortc1.sed fortc2.sed common.m4 $(PROGRAM).src $(OS).m4
+#	./fortc -L . -O $(OS) $(PROGRAM).src > $@
+#
+hdftest:        FORCE
+	$(FC) $(FFLAGS) hdftest.f $(LIBS) -o $@
+	@ echo "=======================================";
+	@ echo "HDF-SD Fortran interface tests start";
+	@ echo "=======================================";
+	test -d $(TESTDIR) || mkdir $(TESTDIR)
+	./hdftest > hdfout.new
+	@cmd="$(DIFF) $(DIFF_FLAGS) hdfout.new hdftst.sav"; \
+	    echo $$cmd; \
+	    if $$cmd; then \
+		echo "*** HDF-SD Fortran interface tests passed ***"; \
+	    else \
+		echo "*** HDF-SD Fortran interface tests failed ***"; \
+		echo "The above differences are OK if small"; \
+		exit 0; \
+	    fi
+
+$(PROGRAM).o:	netcdf.inc
+jackets.o:	../libsrc/netcdf.h
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,98 @@
+# Makefile for the FORTRAN interface to the Network CDF library
+#
+# $Id: Makefile.in_orig,v 1.2 2000/08/30 21:55:42 wendling Exp $
+
+PROGRAM		= ftest
+OS		= @OS@
+FC		= @FC@
+CPP_NETCDF	= -I../libsrc @HDF_INC@
+CPPFLAGS	= $(CPP_NETCDF) @CPPFLAGS@
+CFLAGS		= @CFLAGS@
+FFLAGS		= @FFLAGS@
+HDF_LIB         = @HDF_LIB@
+JPEG_LIB        = @JPEG_LIB@
+GARBAGE		= $(PROGRAM) test.nc copy.nc netcdf.inc jackets.c \
+		  $(PROGRAM).f test*.hdf hdftest hdfout.new
+HEADERS		= netcdf.inc
+MANIFEST	= $(PROGRAM).src Makefile.in README aix.m4 common.inc \
+		  common.m4 depend descrip.mms fortc fortc1.sed \
+		  fortc2.sed hpux.m4 irix.m4 jackets.src msoft.m4 msoft.mk \
+		  next.m4 osf.m4 sunos.m4 ultrix.m4 unicos.m4 vax-ultrix.m4 \
+		  vms.m4 \
+		  msoft/NOTES msoft/fslen.asm msoft/ftest.for \
+		  msoft/jackets.c msoft/msoft.int \
+		  msoft/netcdf.inc \
+		  vms/ftest.for \
+		  vms/ftest.m4 \
+		  vms/jackets.c \
+		  vms/make.com \
+		  vms/netcdf.inc \
+		  mfsdf.c mfsdff.f hdftest.f
+
+LIBOBJS		= jackets.o mfsdf.o mfsdff.o
+LIBNAME		= netcdf
+REMOTE_LIBRARY	= ../libsrc/lib$(LIBNAME).a
+OBJS		= $(PROGRAM).o $(LIBOBJS) 
+LD_XDR		= @LD_XDR@
+LD_NETCDF	= -L../libsrc -lnetcdf
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(JPEG_LIB) $(LIBSX)
+prefix		= ../../..
+
+all::		FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) netcdf.inc $(REMOTE_LIBRARY);; \
+	esac
+
+test:		FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) $(MFLAGS) $(PROGRAM); \
+	    $(MAKE) $(MFLAGS) hdftest; \
+	    ./$(PROGRAM);; \
+	esac
+
+install::	FORCE
+	@case "$(FC)" in \
+	NONE*|none*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) installed_headers;; \
+	esac
+
+$(PROGRAM):	$(REMOTE_LIBRARY)
+
+include ../port/master.mk
+
+jackets.c:	fortc1.sed fortc2.sed common.m4 jackets.src $(OS).m4
+	./fortc -L . -O $(OS) jackets.src > $@
+
+netcdf.inc:	common.inc fortc1.sed fortc2.sed common.m4 $(OS).m4
+	./fortc -L . -O $(OS) common.inc > $@
+
+$(PROGRAM).f:	fortc1.sed fortc2.sed common.m4 $(PROGRAM).src $(OS).m4
+	./fortc -L . -O $(OS) $(PROGRAM).src > $@
+
+hdftest:        hdftest.f $(LIBRARY)
+	$(FC) -g hdftest.f $(LIBS) -o $@
+	./hdftest > hdfout.new
+	@cmd="diff hdfout.new hdftst.sav"; \
+	    echo $$cmd; \
+	    if $$cmd; then \
+		echo "*** HDF passes FORTRAN test ***"; \
+	    else \
+		echo "*** HDF fails FORTRAN test ***"; \
+		echo "The above differences are OK if small"; \
+		exit 0; \
+	    fi
+
+$(PROGRAM).o:	netcdf.inc
+jackets.o:	../libsrc/netcdf.h
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/README
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,62 @@
+This directory contains the source code for the netCDF FORTRAN jackets for
+various systems, generated from a single source with the m4 macro processor.
+The resulting generated sources for some platforms on which they cannot be
+easily generated (e.g. VMS, OS/2, MSDOS) are in subdirectories.  Don't
+despair if your system is not identified by one of the supported platforms;
+one of these or a trivial variation will work with many C/FORTRAN
+combinations.  In particular, many UNIX systems seem to work fine with the
+Sun version.
+
+To generate and test one of the supported sets of jackets try
+
+	make OS=<os>
+
+where <os> is one of sunos, ultrix, aix, unicos, vms, or msoft.  Note that
+the msoft Fortran interface requires some additional files supplied in the
+msoft subdirectory.
+
+If that works, install the jackets library with
+
+	make install OS=<os>
+
+To remake the FORTRAN jacket C source (jackets.c), the corresponding FORTRAN
+"include" file (netcdf.inc), and a FORTRAN driver program to test the
+FORTRAN interface (ftest.f) for a different platform identified by the OS
+macro, just
+
+	make clean
+	make OS=<os>
+
+You can use any value of the OS variable for which there is a corresponding
+$(OS).m4 files, e.g. sunos, vms, unicos, ultrix, aix, msoft.  This will also
+compile a FORTRAN test program and run it, to verify whether the resulting
+interface works.  "netcdf.inc" is a file of declarations that should be
+included in FORTRAN programs that use the netCDF interface.
+
+If one of the provided versions of jackets doesn't work on a new platform
+"foo", just create a "foo.m4" that encapsulates information about how C
+functions are called from FORTRAN and in particular how FORTRAN character
+string parameters are handled.  sunos.m4, vms.m4, aix.m4, ultrix.m4,
+unicos.m4, and msoft.m4 provide commented examples of how to do this.  If
+you get the FORTRAN jackets working on a new platform, please contribute
+your .m4 file to our collection, either by posting to the mailing list
+netcdfgroup at unidata.ucar.edu, or sending to russ at unidata.ucar.edu.
+
+Makefile	makes the jacket library from sources or runs a test
+NOTES		various OS-specific notes about Fortran interfaces
+README		this file
+common.inc	FORTRAN declarations and definitions common to all platforms
+common.m4	m4 macros for calling C from FORTRAN common to all systems
+ftest.f		generated FORTRAN driver for testing the jackets
+jackets.c	generated C source for FORTRAN jackets
+jackets.src	the One True Source from which jackets.c versions are derived
+fortc1.sed	turns readable jackets.src into m4 source jackets.m4
+fortc		a shell script that generates jackets.c and ftest.f
+aix.m4		m4 macros for calling C from FORTRAN for AIX
+sunos.m4	m4 macros for calling C from FORTRAN for Sun
+unicos.m4	m4 macros for calling C from FORTRAN for CRAY/UNICOS
+vms.m4		m4 macros for calling C from FORTRAN for VMS
+ultrix.m4	m4 macros for calling C from FORTRAN for ULTRIX
+msoft.m4	m4 macros for calling C from FORTRAN for Microsoft platforms
+vms/    	generated files for VAX/VMS systems
+msoft/		generated files for Microsoft compilers on MSDOS and OS/2

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/aix.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/aix.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/aix.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', AIX)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1')	# for AIX, use same name
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/common.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/common.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/common.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/common.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/common.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/common.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,54 @@
+divert(-1)dnl
+#
+# diversion 1 is for collecting formal arguments
+# diversion 2 is for extra formal arguments for string lengths
+# diversion 3 is for formal argument declarations
+# diversion 4 is for extra local variables derived from formal arguments
+#
+define(`STRING',`divert(1)ifdef(`INIT',,`, ')STRINGF(`$1')`'undefine(`INIT')divert(2)`'STRINGX(`$1')`'divert(3)`'STRINGD(`$1',`$2')`'divert(4)`'STRINGL(`$1')`'divert(0)')dnl
+define(`INTEGERSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+    F_INTEGER		*$1;	`$2'divert(0)')dnl
+define(`INTSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+    int		*$1;	`$2'divert(0)')dnl
+define(`LONGSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+    long		*$1;	`$2'divert(0)')dnl
+define(`FLOATSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+    float	*$1;	`$2'divert(0)')dnl
+define(`DOUBLESTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+    double	*$1;	`$2'divert(0)')dnl
+#
+# The following is for a pointer to a single character, not a Fortran 
+# character variable
+#
+define(`CHARSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+    char	*$1;	`$2'divert(0)')dnl
+define(`VOIDSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+    void	*$1;	`$2'divert(0)')dnl
+define(`M4__PROTO',`define(`INIT',1)$2`'NAMEF($1)(undivert(1)undivert(2))undivert(3)')
+define(`M4__LOCALS',`undivert(4)')
+# To make a C external struct name visible as a Fortran named common, e.g.
+# if
+#    extern struct foo {int n; float y} bar_;
+# is available to fortran as 
+#    common/bar/n, y
+# then we want this macro to append a `_' to its argument.  NAMEF works
+# for this in every case we know about.
+define(`M4__STRUCT_FOR_COMMON',`NAMEF($1)')dnl
+
+# Note: override the following default definitions in OS.m4, where necessary
+
+# Includes needed at the top of a file of C to be called from FORTRAN,
+# e.g. "#include descrip" for VMS
+define(`M4__STRING_DESCRIPTOR_INCLUDES',`')
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT 
+define(`M4__FORTRAN_DEFINES',`')
+
+# FORTRAN syntax for including a file, e.g. `$include: "filename"' for msoft
+define(`M4__RIGHT_QUOTE',')
+define(`F_INCLUDE',`      `include' M4__RIGHT_QUOTE`'$1`'M4__RIGHT_QUOTE')
+
+# include declaring C interfaces, needed in FORTRAN when calling C, e.g.
+# Microsoft FORTRAN needs to include msoft.int
+define(`M4__C_INTERFACE_DECLARATIONS',`')
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-aix.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-aix.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-aix.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-aix.f,v 1.3 1998/01/17 00:23:27 epourmal Exp $
+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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-alpha.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-alpha.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-alpha.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-alpha.f,v 1.3 1998/01/17 00:24:23 epourmal Exp $
+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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-convex.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-convex.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-convex.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-convex.f,v 1.3 1998/01/17 00:30:50 epourmal Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the CONVEX 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)
+      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)
+      integer*1 bytval(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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
+      integer*1 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
+
+      integer*1 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
+      integer*1 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
+      integer*1 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-dec.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-dec.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-dec.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-dec.f,v 1.3 1998/01/17 00:25:00 epourmal Exp $
+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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-fbsd.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-fbsd.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-fbsd.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-fbsd.f,v 1.3 1998/01/17 00:31:39 epourmal Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the FBSD 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)
+      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)
+      integer*1 bytval(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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
+      integer*1 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
+
+      integer*1 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
+      integer*1 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
+      integer*1 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-fujivp.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-fujivp.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-fujivp.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-fujivp.f,v 1.2 1998/01/17 00:32:25 epourmal Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the FUJIVP 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)
+      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)
+      integer*1 bytval(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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
+      integer*1 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
+
+      integer*1 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
+      integer*1 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
+      integer*1 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-hpux.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-hpux.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-hpux.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-hpux.f,v 1.3 1998/01/17 00:26:11 epourmal Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the HPUX 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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-ia64.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-ia64.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-ia64.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-ia64.f,v 1.1 2000/05/23 18:07:07 acheng Exp $
+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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix32.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix32.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix32.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-irix32.f,v 1.3 1998/01/17 00:33:06 epourmal Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the IRIX 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)
+      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)
+      integer*1 bytval(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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
+      integer*1 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
+
+      integer*1 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
+      integer*1 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
+      integer*1 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix4.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix4.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix4.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-irix4.f,v 1.3 1998/01/17 00:33:48 epourmal Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the IRIX 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)
+      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)
+      integer*1 bytval(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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
+      integer*1 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
+
+      integer*1 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
+      integer*1 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
+      integer*1 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix5.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix5.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix5.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-irix5.f,v 1.3 1998/01/17 00:34:31 epourmal Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the IRIX 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)
+      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)
+      integer*1 bytval(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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
+      integer*1 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
+
+      integer*1 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
+      integer*1 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
+      integer*1 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix6.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix6.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-irix6.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-irix6.f,v 1.3 1998/01/17 00:35:09 epourmal Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the IRIX 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)
+      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)
+      integer*1 bytval(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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)
+      integer*1 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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
+      integer*1 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
+
+      integer*1 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
+      integer*1 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
+      integer*1 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-linux.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-linux.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-linux.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-linux.f,v 1.3 1998/01/17 00:26:57 epourmal Exp $
+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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-mac.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-mac.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-mac.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-mac.f,v 1.3 1998/01/17 00:27:53 epourmal Exp $
+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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-solaris.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-solaris.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-solaris.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-solaris.f,v 1.3 1998/01/17 00:28:29 epourmal Exp $
+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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-solarisx86.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-solarisx86.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-solarisx86.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-solarisx86.f,v 1.3 1998/01/17 00:29:28 epourmal Exp $
+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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-sun.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-sun.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-sun.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-sun.f,v 1.3 1998/01/17 00:30:10 epourmal Exp $
+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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-t3e.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-t3e.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-t3e.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1222 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-t3e.f,v 1.4 1998/03/03 23:38:55 acheng Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the UNICOS 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)
+      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
+      real doubval(2)
+      real flval(2)
+      integer lngval(2)
+      integer shval(2)
+      integer i, j, k
+      character*31 varnam, attname(2,7), gattnam(2)
+      integer bytval(2)
+      common /atts/attname, gattnam
+      integer svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      real dvalidrg(2)
+      integer 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
+      real doubval(2)
+      real flval(2)
+      integer lngval(2)
+      integer shval(2)
+      integer bytval(2)
+      integer vartyp, nvdims, vdims(MAXVDIMS), nvatts
+
+      character*31 varnam, attname(2,7), gattnam(2)
+      common /atts/attname, gattnam
+      integer svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      real dvalidrg(2)
+      integer 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 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      real dvalidrg(2)
+      integer 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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
+      integer barray(times), byval(times)
+      integer sarray(times), shval(times)
+      integer*4 larray(lats)
+      real*4 farray(levels, lats, lons, times)
+      real*8 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
+
+      integer bvalue
+      integer svalue
+      integer*4 lvalue
+      real*4 fvalue
+      real*8 dvalue
+      character*1 c
+      real epsilon
+      real 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
+      integer barray(times)
+      integer sarray(times)
+      integer*4 larray(lats)
+      real*4 farray(levels, lats, lons, times)
+      real*8 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*4 lvalue
+      integer svalue
+      integer bvalue
+      real*4 pi
+      real*8 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 pi/3.14159/
+      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, pi, 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-unicos.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-unicos.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/ftest-unicos.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-unicos.f,v 1.3 1998/01/17 00:36:22 epourmal Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the UNICOS 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)
+      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
+      real doubval(2)
+      real flval(2)
+      integer lngval(2)
+      integer shval(2)
+      integer i, j, k
+      character*31 varnam, attname(2,7), gattnam(2)
+      integer bytval(2)
+      common /atts/attname, gattnam
+      integer svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      real dvalidrg(2)
+      integer 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
+      real doubval(2)
+      real flval(2)
+      integer lngval(2)
+      integer shval(2)
+      integer bytval(2)
+      integer vartyp, nvdims, vdims(MAXVDIMS), nvatts
+
+      character*31 varnam, attname(2,7), gattnam(2)
+      common /atts/attname, gattnam
+      integer svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      real dvalidrg(2)
+      integer 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 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      real dvalidrg(2)
+      integer 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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
+      integer barray(times), byval(times)
+      integer sarray(times), shval(times)
+      integer larray(lats)
+      real farray(levels, lats, lons, times)
+      real 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
+
+      integer bvalue
+      integer svalue
+      integer lvalue
+      real fvalue
+      real dvalue
+      character*1 c
+      real epsilon
+      real 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
+      integer barray(times)
+      integer sarray(times)
+      integer larray(lats)
+      real farray(levels, lats, lons, times)
+      real 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 svalue
+      integer bvalue
+      real 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-aix.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-aix.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-aix.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-aix.c,v 1.6 1997/11/05 22:19:48 koziol Exp $ */
+/*
+ * 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 AIX.  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)
+    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)
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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)
+/*
+ * 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 */
+
+/* ------------ AIX FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre(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
+ncopn(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
+ncddef(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
+ncdid(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
+ncvdef(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
+ncvid(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
+nctlen(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
+ncclos(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf(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
+ncinq(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
+ncsnc(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
+ncabor(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
+ncdinq(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
+ncdren(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
+ncvinq(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
+ncvpt1(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)
+#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
+ncvp1c(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
+ncvpt(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)
+#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
+ncvptc(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
+ncvptg(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)
+    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)
+#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
+ncvpgc(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
+ncvgt1(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)
+#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
+ncvg1c(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
+ncvgt(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)
+#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));
+	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 */
+#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
+ncvgtc(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
+ncvgtg(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)
+    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)
+#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
+ncvggc(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
+ncvren(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
+ncapt(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)
+#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
+ncaptc(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
+ncainq(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
+ncagt(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)
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc(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
+ncacpy(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
+ncanam(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
+ncaren(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
+ncadel(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
+ncsfil(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-alpha.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-alpha.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-alpha.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-alpha.c,v 1.3 1997/11/05 22:19:50 koziol Exp $ */
+/*
+ * 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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-convex.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-convex.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-convex.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-convex.c,v 1.3 1997/11/05 22:19:55 koziol Exp $ */
+/*
+ * 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 CONVEX.  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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ CONVEX FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-dec.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-dec.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-dec.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-dec.c,v 1.3 1997/11/05 22:19:58 koziol Exp $ */
+/*
+ * 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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-fbsd.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-fbsd.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-fbsd.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1900 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-fbsd.c,v 1.4 1997/11/05 19:40:02 koziol Exp $ */
+/*
+ * 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)
+    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)
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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)
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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];
+
+    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 (ncvarput1 (*cdfid, *varid - 1, nindices, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* puts a single character into an open netCDF file */
+void
+ncvp1c_(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
+ncvpt_(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;
+
+    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 (ncvarput (*cdfid, *varid - 1, nstart, ncount, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* writes a hypercube of character values into an open netCDF file */
+void
+ncvptc_(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
+ncvptg_(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;
+
+    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)
+    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 (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
+ncvpgc_(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
+ncvgt1_(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;
+
+    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 (ncvarget1 (*cdfid, *varid - 1, nindices, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets a single character data value from a variable of an open
+ * netCDF file
+ */
+void
+ncvg1c_(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
+ncvgt_(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;
+
+    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 (ncvarget (*cdfid, *varid - 1, nstart, ncount, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* reads a hypercube of character values from a netCDF variable */
+void
+ncvgtc_(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
+ncvgtg_(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;
+
+    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)
+    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 (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
+ncvggc_(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
+ncvren_(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
+ncapt_(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];
+
+    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 (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
+ncaptc_(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
+ncainq_(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
+ncagt_(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;
+
+    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 (ncattget (*cdfid, *varid - 1, name, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets the value of a netCDF character attribute given its variable
+ * ID and name
+ */
+void
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-fujivp.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-fujivp.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-fujivp.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/fortran/config/jackets-fujivp.c,v 1.2 1997/11/05 22:20:00 koziol Exp $ */
+/*
+ * 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)
+    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)
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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)
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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)
+#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
+ncvp1c_(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
+ncvpt_(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)
+#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
+ncvptc_(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
+ncvptg_(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)
+    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)
+#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
+ncvpgc_(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
+ncvgt1_(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)
+#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
+ncvg1c_(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
+ncvgt_(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)
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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)
+    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)
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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)
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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)
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-hpux.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-hpux.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-hpux.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-hpux.c,v 1.3 1997/11/05 22:20:03 koziol Exp $ */
+/*
+ * 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 HPUX.  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)
+    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)
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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)
+/*
+ * 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 */
+
+/* ------------ HPUX FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre(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
+ncopn(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
+ncddef(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
+ncdid(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
+ncvdef(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
+ncvid(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
+nctlen(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
+ncclos(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf(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
+ncinq(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
+ncsnc(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
+ncabor(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
+ncdinq(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
+ncdren(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
+ncvinq(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
+ncvpt1(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)
+#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
+ncvp1c(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
+ncvpt(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)
+#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
+ncvptc(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
+ncvptg(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)
+    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)
+#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
+ncvpgc(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
+ncvgt1(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)
+#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
+ncvg1c(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
+ncvgt(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)
+#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));
+	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 */
+#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
+ncvgtc(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
+ncvgtg(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)
+    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)
+#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
+ncvggc(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
+ncvren(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
+ncapt(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)
+#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
+ncaptc(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
+ncainq(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
+ncagt(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)
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc(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
+ncacpy(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
+ncanam(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
+ncaren(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
+ncadel(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
+ncsfil(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-ia64.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-ia64.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-ia64.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-ia64.c,v 1.1 2000/05/23 18:07:08 acheng Exp $ */
+/*
+ * 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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix32.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix32.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix32.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-irix32.c,v 1.3 1997/11/05 22:20:05 koziol Exp $ */
+/*
+ * 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 IRIX.  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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ IRIX FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix4.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix4.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix4.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-irix4.c,v 1.3 1997/11/05 22:20:09 koziol Exp $ */
+/*
+ * 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 IRIX.  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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ IRIX FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix5.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix5.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix5.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-irix5.c,v 1.3 1997/11/05 22:20:13 koziol Exp $ */
+/*
+ * 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 IRIX.  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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ IRIX FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix6.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix6.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-irix6.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-irix6.c,v 1.3 1997/11/05 22:20:16 koziol Exp $ */
+/*
+ * 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 IRIX.  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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ IRIX FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-linux.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-linux.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-linux.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-linux.c,v 1.3 1997/11/05 22:20:21 koziol Exp $ */
+/*
+ * 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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-mac.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-mac.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-mac.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-mac.c,v 1.3 1997/11/05 22:20:24 koziol Exp $ */
+/*
+ * 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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-solaris.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-solaris.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-solaris.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-solaris.c,v 1.3 1997/11/05 22:20:26 koziol Exp $ */
+/*
+ * 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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-solarisx86.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-solarisx86.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-solarisx86.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-solarisx86.c,v 1.3 1997/11/05 22:20:31 koziol Exp $ */
+/*
+ * 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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-sun.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-sun.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-sun.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2196 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-sun.c,v 1.3 1997/11/05 22:20:34 koziol Exp $ */
+/*
+ * 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;
+#ifdef __alpha
+    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;
+#ifdef __alpha
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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 */
+
+#ifdef __alpha
+/*
+ * 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 */
+
+/* ------------ Sun FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+ncpopt_(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+ncgopt_(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre_(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
+ncopn_(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
+ncddef_(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
+ncdid_(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
+ncvdef_(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
+ncvid_(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
+nctlen_(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
+ncclos_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf_(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf_(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
+ncinq_(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
+ncsnc_(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
+ncabor_(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
+ncdinq_(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
+ncdren_(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
+ncvinq_(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
+ncvpt1_(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 */
+#ifdef __alpha
+#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
+ncvp1c_(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
+ncvpt_(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 */
+#ifdef __alpha
+#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
+ncvptc_(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
+ncvptg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvpgc_(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
+ncvgt1_(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 */
+#ifdef __alpha
+#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
+ncvg1c_(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
+ncvgt_(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 */
+#ifdef __alpha
+#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));
+	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 */
+#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
+ncvgtc_(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
+ncvgtg_(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
+#ifdef __alpha
+    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 */
+#ifdef __alpha
+#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
+ncvggc_(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
+ncvren_(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
+ncapt_(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 */
+#ifdef __alpha
+#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
+ncaptc_(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
+ncainq_(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
+ncagt_(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 */
+#ifdef __alpha
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+ncagtc_(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
+ncacpy_(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
+ncanam_(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
+ncaren_(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
+ncadel_(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
+ncsfil_(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-t3e.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-t3e.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-t3e.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2229 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-t3e.c,v 1.4 1998/03/03 23:41:08 acheng Exp $ */
+/*
+ * 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 UNICOS.  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 */
+
+
+#include <fortran.h>	/* for _fcd functions */
+
+
+
+#define FORTRAN_HAS_NO_BYTE
+#define FORTRAN_HAS_NO_SHORT
+
+
+#if !NC_OLD_FILLVALUES
+
+struct ncfils {			/* This will be a common block from Fortran */
+    double dd;
+#if defined __alpha || (_MIPS_SZLONG == 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)
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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)
+/*
+ * 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 */
+
+/* ------------ UNICOS FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+NCPOPT(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+NCGOPT(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+NCCRE(pathnamed, clobmode, rcode)
+    _fcd	pathnamed;	
+    int		*clobmode;	
+    int		*rcode;	
+{
+    char	*pathname	= _fcdtocp (pathnamed);
+    unsigned	pathnamelen	= _fcdlen (pathnamed);
+    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
+NCOPN(pathnamed, rwmode, rcode)
+    _fcd	pathnamed;	
+    int		*rwmode;	
+    int		*rcode;	
+{
+    char	*pathname	= _fcdtocp (pathnamed);
+    unsigned	pathnamelen	= _fcdlen (pathnamed);
+    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
+NCDDEF(cdfid, dimnamed, dimlen, rcode)
+    int		*cdfid;	
+    _fcd	dimnamed;	
+    int		*dimlen;	
+    int		*rcode;	
+{
+    char	*dimname	= _fcdtocp (dimnamed);
+    unsigned	dimnamelen	= _fcdlen (dimnamed);
+    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
+NCDID(cdfid, dimnamed, rcode)
+    int		*cdfid;	
+    _fcd	dimnamed;	
+    int		*rcode;	
+{
+    char	*dimname	= _fcdtocp (dimnamed);
+    unsigned	dimnamelen	= _fcdlen (dimnamed);
+    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
+NCVDEF(cdfid, varnamed, datatype, ndims, dimarray, rcode)
+    int		*cdfid;	
+    _fcd	varnamed;	
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*rcode;	
+{
+    char	*varname	= _fcdtocp (varnamed);
+    unsigned	varnamelen	= _fcdlen (varnamed);
+    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
+NCVID(cdfid, varnamed, rcode)
+    int		*cdfid;	
+    _fcd	varnamed;	
+    int		*rcode;	
+{
+    char	*varname	= _fcdtocp (varnamed);
+    unsigned	varnamelen	= _fcdlen (varnamed);
+    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
+NCTLEN(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
+NCCLOS(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+NCREDF(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+NCENDF(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
+NCINQ(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
+NCSNC(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
+NCABOR(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
+NCDINQ(cdfid, dimid, dimnamed, size, rcode)
+    int		*cdfid;	
+    int		*dimid;	
+    _fcd	dimnamed;	
+    int		*size;	
+    int		*rcode;	
+{
+    char	*dimname	= _fcdtocp (dimnamed);
+    unsigned	dimnamelen	= _fcdlen (dimnamed);
+    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
+NCDREN(cdfid, dimid, dimnamed, rcode)
+    int		*cdfid;	
+    int		*dimid;	
+    _fcd	dimnamed;	
+    int		*rcode;	
+{
+    char	*dimname	= _fcdtocp (dimnamed);
+    unsigned	dimnamelen	= _fcdlen (dimnamed);
+    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
+NCVINQ(cdfid, varid, varnamed, datatype, ndims, dimarray, natts, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	varnamed;	
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*natts;	
+    int		*rcode;	
+{
+    char	*varname	= _fcdtocp (varnamed);
+    unsigned	varnamelen	= _fcdlen (varnamed);
+    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
+NCVPT1(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)
+#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
+NCVP1C(cdfid, varid, indices, chvald, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*indices;	
+    _fcd	chvald;	
+    int		*rcode;	
+{
+    char	*chval	= _fcdtocp (chvald);
+    unsigned	chvallen	= _fcdlen (chvald);
+    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
+NCVPT(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 ((int *)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 ((int *)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)
+#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
+NCVPTC(cdfid, varid, start, count, stringd, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    _fcd	stringd;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCVPTG(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)
+    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 ((int *)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 ((int *)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)
+#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
+NCVPGC(cdfid, varid, start, count, stride, basis, stringd, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    int		*stride;	
+    int		*basis;	
+    _fcd	stringd;	
+    int		*rcode;	
+{
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCVGT1(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)
+#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
+NCVG1C(cdfid, varid, indices, chvald, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*indices;	
+    _fcd	chvald;	
+    int		*rcode;	
+{
+    char	*chval	= _fcdtocp (chvald);
+    unsigned	chvallen	= _fcdlen (chvald);
+    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
+NCVGT(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)
+#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));
+	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 */
+#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
+NCVGTC(cdfid, varid, start, count, stringd, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    _fcd	stringd;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCVGTG(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)
+    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)
+#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
+NCVGGC(cdfid, varid, start, count, stride, basis, stringd, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    int		*stride;	
+    int		*basis;	
+    _fcd	stringd;	
+    int		*rcode;	
+{
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCVREN(cdfid, varid, varnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	varnamed;	
+    int		*rcode;	
+{
+    char	*varname	= _fcdtocp (varnamed);
+    unsigned	varnamelen	= _fcdlen (varnamed);
+    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
+NCAPT(cdfid, varid, attnamed, datatype, attlen, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    int		*datatype;	
+    int		*attlen;	
+    void	*value;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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 ((int *)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 ((int *)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)
+#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
+NCAPTC(cdfid, varid, attnamed, datatype, lenstr, stringd, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    int		*datatype;	
+    int		*lenstr;	
+    _fcd	stringd;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCAINQ(cdfid, varid, attnamed, datatype, attlen, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    int		*datatype;	
+    int		*attlen;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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
+NCAGT(cdfid, varid, attnamed, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    void	*value;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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)
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+NCAGTC(cdfid, varid, attnamed, stringd, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    _fcd	stringd;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCACPY(incdfid, invarid, attnamed, outcdfid, outvarid, rcode)
+    int		*incdfid;	
+    int		*invarid;	
+    _fcd	attnamed;	
+    int		*outcdfid;	
+    int		*outvarid;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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
+NCANAM(cdfid, varid, attnum, attnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*attnum;	
+    _fcd	attnamed;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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
+NCAREN(cdfid, varid, attnamed, newnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    _fcd	newnamed;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    char	*newname	= _fcdtocp (newnamed);
+    unsigned	newnamelen	= _fcdlen (newnamed);
+    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
+NCADEL(cdfid, varid, attnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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
+NCSFIL(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-unicos.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-unicos.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/jackets-unicos.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2229 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-unicos.c,v 1.3 1997/11/05 22:20:41 koziol Exp $ */
+/*
+ * 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 UNICOS.  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 */
+
+
+#include <fortran.h>	/* for _fcd functions */
+
+
+
+#define FORTRAN_HAS_NO_BYTE
+#define FORTRAN_HAS_NO_SHORT
+
+
+#if !NC_OLD_FILLVALUES
+
+struct ncfils {			/* This will be a common block from Fortran */
+    double dd;
+#if defined __alpha || (_MIPS_SZLONG == 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)
+    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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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)
+/*
+ * 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 */
+
+/* ------------ UNICOS FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+NCPOPT(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+NCGOPT(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+NCCRE(pathnamed, clobmode, rcode)
+    _fcd	pathnamed;	
+    int		*clobmode;	
+    int		*rcode;	
+{
+    char	*pathname	= _fcdtocp (pathnamed);
+    unsigned	pathnamelen	= _fcdlen (pathnamed);
+    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
+NCOPN(pathnamed, rwmode, rcode)
+    _fcd	pathnamed;	
+    int		*rwmode;	
+    int		*rcode;	
+{
+    char	*pathname	= _fcdtocp (pathnamed);
+    unsigned	pathnamelen	= _fcdlen (pathnamed);
+    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
+NCDDEF(cdfid, dimnamed, dimlen, rcode)
+    int		*cdfid;	
+    _fcd	dimnamed;	
+    int		*dimlen;	
+    int		*rcode;	
+{
+    char	*dimname	= _fcdtocp (dimnamed);
+    unsigned	dimnamelen	= _fcdlen (dimnamed);
+    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
+NCDID(cdfid, dimnamed, rcode)
+    int		*cdfid;	
+    _fcd	dimnamed;	
+    int		*rcode;	
+{
+    char	*dimname	= _fcdtocp (dimnamed);
+    unsigned	dimnamelen	= _fcdlen (dimnamed);
+    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
+NCVDEF(cdfid, varnamed, datatype, ndims, dimarray, rcode)
+    int		*cdfid;	
+    _fcd	varnamed;	
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*rcode;	
+{
+    char	*varname	= _fcdtocp (varnamed);
+    unsigned	varnamelen	= _fcdlen (varnamed);
+    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
+NCVID(cdfid, varnamed, rcode)
+    int		*cdfid;	
+    _fcd	varnamed;	
+    int		*rcode;	
+{
+    char	*varname	= _fcdtocp (varnamed);
+    unsigned	varnamelen	= _fcdlen (varnamed);
+    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
+NCTLEN(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
+NCCLOS(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+NCREDF(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+NCENDF(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
+NCINQ(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
+NCSNC(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
+NCABOR(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
+NCDINQ(cdfid, dimid, dimnamed, size, rcode)
+    int		*cdfid;	
+    int		*dimid;	
+    _fcd	dimnamed;	
+    int		*size;	
+    int		*rcode;	
+{
+    char	*dimname	= _fcdtocp (dimnamed);
+    unsigned	dimnamelen	= _fcdlen (dimnamed);
+    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
+NCDREN(cdfid, dimid, dimnamed, rcode)
+    int		*cdfid;	
+    int		*dimid;	
+    _fcd	dimnamed;	
+    int		*rcode;	
+{
+    char	*dimname	= _fcdtocp (dimnamed);
+    unsigned	dimnamelen	= _fcdlen (dimnamed);
+    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
+NCVINQ(cdfid, varid, varnamed, datatype, ndims, dimarray, natts, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	varnamed;	
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*natts;	
+    int		*rcode;	
+{
+    char	*varname	= _fcdtocp (varnamed);
+    unsigned	varnamelen	= _fcdlen (varnamed);
+    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
+NCVPT1(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)
+#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
+NCVP1C(cdfid, varid, indices, chvald, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*indices;	
+    _fcd	chvald;	
+    int		*rcode;	
+{
+    char	*chval	= _fcdtocp (chvald);
+    unsigned	chvallen	= _fcdlen (chvald);
+    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
+NCVPT(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)
+#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
+NCVPTC(cdfid, varid, start, count, stringd, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    _fcd	stringd;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCVPTG(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)
+    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)
+#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
+NCVPGC(cdfid, varid, start, count, stride, basis, stringd, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    int		*stride;	
+    int		*basis;	
+    _fcd	stringd;	
+    int		*rcode;	
+{
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCVGT1(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)
+#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
+NCVG1C(cdfid, varid, indices, chvald, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*indices;	
+    _fcd	chvald;	
+    int		*rcode;	
+{
+    char	*chval	= _fcdtocp (chvald);
+    unsigned	chvallen	= _fcdlen (chvald);
+    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
+NCVGT(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)
+#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));
+	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 */
+#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
+NCVGTC(cdfid, varid, start, count, stringd, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    _fcd	stringd;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCVGTG(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)
+    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)
+#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
+NCVGGC(cdfid, varid, start, count, stride, basis, stringd, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    int		*stride;	
+    int		*basis;	
+    _fcd	stringd;	
+    int		*rcode;	
+{
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCVREN(cdfid, varid, varnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	varnamed;	
+    int		*rcode;	
+{
+    char	*varname	= _fcdtocp (varnamed);
+    unsigned	varnamelen	= _fcdlen (varnamed);
+    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
+NCAPT(cdfid, varid, attnamed, datatype, attlen, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    int		*datatype;	
+    int		*attlen;	
+    void	*value;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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)
+#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
+NCAPTC(cdfid, varid, attnamed, datatype, lenstr, stringd, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    int		*datatype;	
+    int		*lenstr;	
+    _fcd	stringd;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCAINQ(cdfid, varid, attnamed, datatype, attlen, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    int		*datatype;	
+    int		*attlen;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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
+NCAGT(cdfid, varid, attnamed, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    void	*value;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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)
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+NCAGTC(cdfid, varid, attnamed, stringd, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    _fcd	stringd;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    char	*string	= _fcdtocp (stringd);
+    unsigned	stringlen	= _fcdlen (stringd);
+    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
+NCACPY(incdfid, invarid, attnamed, outcdfid, outvarid, rcode)
+    int		*incdfid;	
+    int		*invarid;	
+    _fcd	attnamed;	
+    int		*outcdfid;	
+    int		*outvarid;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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
+NCANAM(cdfid, varid, attnum, attnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*attnum;	
+    _fcd	attnamed;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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
+NCAREN(cdfid, varid, attnamed, newnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    _fcd	newnamed;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    char	*newname	= _fcdtocp (newnamed);
+    unsigned	newnamelen	= _fcdlen (newnamed);
+    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
+NCADEL(cdfid, varid, attnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    _fcd	attnamed;	
+    int		*rcode;	
+{
+    char	*attname	= _fcdtocp (attnamed);
+    unsigned	attnamelen	= _fcdlen (attnamed);
+    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
+NCSFIL(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-aix.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-aix.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-aix.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-alpha.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-alpha.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-alpha.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-convex.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-convex.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-convex.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-dec.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-dec.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-dec.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-fbsd.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-fbsd.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-fbsd.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-fujivp.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-fujivp.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-fujivp.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-hpux.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-hpux.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-hpux.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-ia64.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-ia64.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-ia64.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix32.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix32.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix32.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix4.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix4.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix4.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix5.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix5.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix5.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix6.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix6.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-irix6.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-linux.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-linux.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-linux.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-mac.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-mac.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-mac.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-solaris.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-solaris.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-solaris.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-solarisx86.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-solarisx86.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-solarisx86.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-sun.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-sun.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-sun.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-t3e.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-t3e.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-t3e.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-unicos.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-unicos.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/config/netcdf-unicos.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/convex.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/convex.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/convex.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', CONVEX)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1')	# for Convex, need post underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/craympp.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/craympp.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/craympp.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,52 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', UNICOS)
+
+# Includes needed at the top of a file of C to be called from FORTRAN
+define(`M4__STRING_DESCRIPTOR_INCLUDES',`
+#include <fortran.h>	/* for _fcd functions */
+')
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT 
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+#define FORTRAN_HAS_NO_SHORT
+')
+
+# transformation from fortran name to name of C module
+# for unicos, just convert to uppercase
+define(`NAMEF',
+       `translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)')
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1d')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`')
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    _fcd	$1d;	`$2'') # declare string parameter as type _fcd
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`
+    char	*$1	= _fcdtocp ($1d);
+    unsigned	$1len	= _fcdlen ($1d);')	# use _fcd functions
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`real')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/descrip.mms
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/descrip.mms	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/descrip.mms	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,74 @@
+! $Id: descrip.mms,v 1.2 1993/12/01 04:13:50 sxu Exp $
+!
+!          MMS file for netcdf Fortran API
+!
+!==============================================================================
+! ASSUMPTIONS:
+
+!==============================================================================
+! CUSTOMIZATIONS (change as necessary):
+
+!Root of the installation:
+INSTROOT	= LDMROOT:
+
+!Operating system version:
+OS		= vms_5_4
+
+!Compilation options:
+COPTS		= /opt/nodebug/define=HDF
+
+!==============================================================================
+INCDIR		= $(INSTROOT)[include]
+LIBDIR		= $(INSTROOT)[lib]
+LIBRARY		= [---.lib]netcdf.olb
+HDFLIB          = [--.hdf.lib]df.olb
+LINKFLAGS	= /nodebug/exec=$(mms$target_name).exe
+!LINKFLAGS	= /debug/exec=$(mms$target_name).exe
+SRCINCDIR	= [-.libsrc]
+INCLUDES	= /include=([-.xdr],$(SRCINCDIR),[--.hdf.include])
+CFLAGS		= $(COPTS)$(INCLUDES)/obj=$(mms$target_name).obj
+LIBOBJS 	= array=array.obj, attr=attr.obj, cdf=cdf.obj, dim=dim.obj,-
+		    file=file.obj, iarray=iarray.obj, error=error.obj,-
+		    putget=putget.obj, sharray=sharray.obj, string=string.obj,-
+		    var=var.obj,-
+		    htons.obj, ntohs.obj
+CLIB 		=  sys$library:vaxcrtl/lib
+LINKLIBS 	=  $(LIBRARY)/lib, $(HDFLIB)/lib, $(CLIB)
+
+all :		netcdf.inc, library, test
+	@ continue
+
+netcdf.inc :	[.vms]netcdf.inc
+	copy [.vms]$@ $@
+
+library :	$(LIBRARY)(jackets.obj)
+	@ continue
+
+jackets.obj :	[.vms]jackets.c
+
+mfsdf.obj :	[.vms]mfsdf.c
+
+mfsdff.obj :     [.vms]mfsdff.for
+
+test :		ftest.exe  hdftest.exe
+	run hdftest
+	run ftest
+	@ if $severity .eq. 0 then exit 1
+
+hdftest.exe :	hdftest.obj, jackets.obj, mfsdf.obj, mfsdff.obj 
+	$(LINK)$(LINKFLAGS) hdftest.obj, mfsdf.obj, mfsdff.obj, -
+               jackets.obj, $(LINKLIBS)
+
+hdftest.obj :	netcdf.inc, [.vms]hdftest.for
+
+ftest.exe :	ftest.obj, jackets.obj
+	$(LINK)$(LINKFLAGS) ftest.obj,jackets.obj,$(LINKLIBS)
+
+install :	netcdf.inc
+	copy netcdf.inc $(INCDIR)
+
+clean :
+	purge
+	- delete netcdf.inc.*,*.obj.*,*.lis.*,*.map.*,*.exe.*
+ftest.obj :	netcdf.inc, [.vms]ftest.for
+jackets.obj :	$(SRCINCDIR)netcdf.h

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/hdftestp.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/hdftestp.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/hdftestp.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2529 @@
+C
+C     Testing the Fortran interface for the multiple SD routines
+C
+      program hdftest
+
+      implicit none
+
+      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 sfstart,  sfcreate,  sfendacc, sfend,    sfsfill
+      integer sfrdata,  sfwdata,   sfdimid,  sfsdmname
+      integer sffinfo,  sfn2index, sfsdmstr, sfsdtstr, sfsdscale
+      integer sfscal,   sfselect,  sfginfo,  sfgdinfo, sfgainfo
+      integer sffattr,  sfsrange,  sfgrange, sfgfill,  sfsflmd
+      integer sfgcal,   sfgdscale, sfgdtstr, sfgdmstr
+      integer sfid2ref, sfref2index, sfsdmvc, sfisdmvc
+      integer sfsextf,  hxsdir,    hxscdir
+      integer sfwcdata, sfrcdata,  sfscfill, sfgcfill
+      integer sfscatt,  sfrcatt,   sfsnatt,  sfrnatt
+	integer sfchempty
+      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/
+
+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_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_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
+         integer   sfstart, sfcreate, sfendacc, sfend,
+     .             sfn2index, sfselect,
+     .             sfsfill, sfschnk, sfscchnk, sfwchnk, 
+     .             sfgichnk, sfrchnk, sfwdata, sfrdata
+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    = 1,
+     .                skphuff_skp_size = 2,
+     .                nbit_sign_ext    = 0,
+     .                nbit_fill_one    = 0,
+     .                nbit_start_bit   = 0,
+     .                nbit_bit_len     = 31 )
+
+
+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
+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
+         integer   sfstart, sfcreate, sfendacc, sfend,
+     .             sfn2index, sfselect,
+     .             sfsfill, sfschnk, sfscchnk, sfwcchnk, 
+     .             sfgichnk, sfrcchnk, sfwcdata, sfrcdata
+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    = 1,
+     .                skphuff_skp_size = 2,
+     .                nbit_sign_ext    = 0,
+     .                nbit_fill_one    = 0,
+     .                nbit_start_bit   = 0,
+     .                nbit_bit_len     = 31 )
+
+
+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
+         integer   comp_arg(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
+         integer   sfstart, sfcreate, sfendacc, sfend,
+     .             sfn2index, sfselect,
+     .             sfsfill, sfrdata,
+     .             sfwdata, sfscompress
+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    = 1,
+     .                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   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
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfhdfp.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfhdfp.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfhdfp.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,656 @@
+/****************************************************************************
+ * 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: mfhdfp.h,v 1.1 1997/05/26 20:00:37 sxu Exp $ */
+
+#ifndef _MFSD_H_
+#define _MFSD_H_
+
+#ifndef HDF
+#define HDF 1
+#endif
+
+/* change this back if it causes problems on other machines than the Alhpa-QAK */
+/* Reverse back to the previous way. AKC */
+#include "hdf.h"
+#include "netcdf.h"
+#ifdef OLD_WAY
+#include "local_nc.h"
+#endif /* OLD_WAY */
+
+#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 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int32 SDstart
+    (const char *name, int32 access);
+
+extern intn SDend
+    (int32 fid);
+
+extern intn SDfileinfo
+    (int32 fid, int32 *datasets, int32 *attrs);
+
+extern int32 SDselect
+    (int32 fid, int32 index);
+
+extern intn SDgetinfo
+    (int32 sdsid, char *name, int32 *rank, int32 *dimsizes, 
+           int32 *nt, int32 *nattr);
+
+#ifndef __CSTAR__
+extern intn SDreaddata
+    (int32 sdsid, int32 *start, int32 *stride, int32 *end, VOIDP data);
+#endif
+
+extern uint16 SDgerefnumber
+    (int32 sdsid);
+
+extern int32 SDnametoindex
+    (int32 fid, char *name);
+
+extern intn SDgetrange
+    (int32 sdsid, VOIDP pmax, VOIDP pmin);
+
+extern int32 SDcreate
+    (int32 fid, char *name, int32 nt, int32 rank, int32 *dimsizes);
+
+extern int32 SDgetdimid
+    (int32 sdsid, intn number);
+
+extern intn SDsetdimname
+    (int32 id, char *name);
+
+extern intn SDendaccess
+    (int32 id);
+
+extern intn SDsetrange
+    (int32 sdsid, VOIDP pmax, VOIDP pmin);
+
+extern intn SDsetattr
+    (int32 id, char *name, int32 nt, int32 count, VOIDP data);
+
+extern intn SDattrinfo
+    (int32 id, int32 index, char *name, int32 *nt, int32 *count);
+
+extern intn SDreadattr
+    (int32 id, int32 index, VOIDP buf);
+
+#ifndef __CSTAR__
+extern intn SDwritedata
+    (int32 sdsid, int32 *start, int32 *stride, int32 *end, VOIDP data);
+#endif
+
+extern intn SDsetdatastrs
+    (int32 sdsid, char *l, char *u, char *f, char *c);
+
+extern intn SDsetcal
+    (int32 sdsid, float64 cal, float64 cale, float64 ioff,
+               float64 ioffe, int32 nt);
+
+extern intn SDsetfillvalue
+    (int32 sdsid, VOIDP val);
+
+extern intn SDgetfillvalue
+    (int32 sdsid, VOIDP val);
+
+extern intn SDsetfillmode
+    (int32 id, intn fillmode);
+
+extern intn SDgetdatastrs
+    (int32 sdsid, char *l, char *u, char *f, char *c, intn len);
+
+extern intn SDgetcal
+    (int32 sdsid, float64 *cal, float64 *cale, float64 *ioff, 
+               float64 *ioffe, int32 *nt);
+
+extern intn SDsetdimstrs
+    (int32 id, char *l, char *u, char *f);
+
+extern intn SDsetdimscale
+    (int32 id, int32 count, int32 nt, VOIDP data);
+
+extern intn SDgetdimscale
+    (int32 id, VOIDP data);
+
+extern intn SDdiminfo
+    (int32 id, char *name, int32 *size, int32 *nt, int32 *nattr);
+
+extern intn SDgetdimstrs
+    (int32 id, char *l, char *u, char *f, intn len);
+
+extern intn SDsetexternalfile
+    (int32 id, char *filename, int32 offset);
+
+extern intn SDsetnbitdataset
+    (int32 id, intn start_bit, intn bit_len, intn sign_ext, intn fill_one);
+
+extern intn SDsetcompress
+    (int32 id, int32 type, comp_info *c_info);
+
+extern int32 SDfindattr
+    (int32 id, char *attrname);
+
+extern int32 SDidtoref
+    (int32 id);
+
+extern int32 SDreftoindex
+    (int32 fid, int32 ref);
+
+extern int32 SDisrecord
+    (int32 id);
+
+extern intn SDiscoordvar
+    (int32 id);
+
+extern intn SDsetaccesstype
+    (int32 id, uintn accesstype);
+
+extern intn SDsetblocksize
+    (int32 sdsid, int32 block_size);
+
+extern intn SDsetdimval_comp
+    (int32 dimid, intn compt_mode);
+
+extern intn SDisdimval_bwcomp
+    (int32 dimid);
+
+/*====================== Chunking Routines ================================*/
+
+/* Bit - flags used for SDsetchunk() and SDgetChunkInfo() */
+#define HDF_NONE    0x0
+#define HDF_CHUNK   0x1
+#define HDF_COMP    0x3
+#define HDF_NBIT    0x5
+
+/* Cache flags */
+#define HDF_CACHEALL 0x1
+
+/* Chunk Defintion */
+typedef union hdf_chunk_def_u
+{
+    /* Chunk Lengths only */
+    int32   chunk_lengths[MAX_VAR_DIMS]; /* chunk lengths along each dimension */
+
+    struct 
+    {   /* For Compression info */
+        int32      chunk_lengths[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 */
+        int32 chunk_lengths[MAX_VAR_DIMS]; /* chunk lengths along each dimension */
+        intn  start_bit;
+        intn  bit_len;
+        intn  sign_ext;
+        intn  fill_one;
+    } nbit;
+
+} HDF_CHUNK_DEF;
+
+
+/******************************************************************************
+ 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[MAX_VAR_DIMS];  Chunk lengths along each dimension
+
+         struct 
+          {   
+            int32     chunk_lengths[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
+******************************************************************************/
+extern 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. 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
+******************************************************************************/
+extern 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
+******************************************************************************/
+extern 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
+******************************************************************************/
+extern 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
+******************************************************************************/
+extern intn SDsetchunkcache
+    (int32 sdsid,     /* IN: sds access id */
+     int32 maxcache,  /* IN: max number of chunks to cache */
+     int32 flags      /* IN: flags = 0, HDF_CACHEALL */);
+
+/* Define the FORTRAN names */
+
+#ifndef MFSD_FNAMES
+#   define  MFSD_FNAMES
+#ifdef DF_CAPFNAMES
+# if !(defined INTEL86) && !(defined WIN32)
+#   define nscstart    FNAME(SCSTART)
+#   define nsfend      FNAME(SFEND)
+#   define nsfendacc   FNAME(SFENDACC)
+#   define nsffinfo    FNAME(SFFINFO)
+#   define nsfselect   FNAME(SFSELECT)
+#   define nscginfo    FNAME(SCGINFO)
+#   define nscgainfo   FNAME(SCGAINFO)
+#   define nscgdinfo   FNAME(SCGDINFO)
+#   define nsfgcal     FNAME(SFGCAL)
+#   define nsfscal     FNAME(SFSCAL)
+#   define nsfgdscale  FNAME(SFGDSCALE)
+#   define nsfsdscale  FNAME(SFSDSCALE)
+#   define nsfgcfill   FNAME(SFGCFILL)
+#   define nsfgfill    FNAME(SFGFILL)
+#   define nsfscfill   FNAME(SFSCFILL)
+#   define nsfsfill    FNAME(SFSFILL)
+#   define nsfsflmd    FNAME(SFSFLMD)
+#   define nsfgrange   FNAME(SFGRANGE)
+#   define nsfsrange   FNAME(SFSRANGE)
+#   define nscn2index  FNAME(SCN2INDEX)
+#   define nsccreate   FNAME(SCCREATE)
+#   define nscsdimstr  FNAME(SCSDIMSTR)
+#   define nscsdimname FNAME(SCSDIMNAME)
+#   define nscsdatstr  FNAME(SCSDATSTR)
+#   define nsfdimid    FNAME(SFDIMID)
+#   define nsfrcatt    FNAME(SFRCATT)
+#   define nsfrnatt    FNAME(SFRNATT)
+#   define nsfrattr    FNAME(SFRATTR)
+#   define nsfrcdata   FNAME(SFRCDATA)
+#   define nsfrdata    FNAME(SFRDATA)
+#   define nsfwcdata   FNAME(SFWCDATA)
+#   define nsfwdata    FNAME(SFWDATA)
+#   define nscgdatstrs FNAME(SCGDATSTRS)
+#   define nscgdimstrs FNAME(SCGDIMSTRS)
+#   define nscscatt    FNAME(SCSCATT)
+#   define nscsnatt    FNAME(SCSNATT)
+#   define nscsattr    FNAME(SCSATTR)
+#   define nscfattr    FNAME(SCFATTR)
+#   define nsfid2ref  FNAME(SFID2REF)
+#   define nsfref2index FNAME(SFREF2INDEX)
+#   define nsfiscvar   FNAME(SFISCVAR)
+#   define nscsextf    FNAME(SCSEXTF)
+#   define nsfsnbit    FNAME(SFSNBIT)
+#   define nsfsacct    FNAME(SFSACCT)
+#   define nsfsdmvc    FNAME(SFSDMVC)
+#   define nsfisdmvc   FNAME(SFISDMVC)
+# else /* Fortran PowerStation */
+#   define nscstart    FNAME(SCSTART)
+#   define nscend      FNAME(SCEND)
+#   define nscendacc   FNAME(SCENDACC)
+#   define nscfinfo    FNAME(SCFINFO)
+#   define nscselct    FNAME(SCSELCT)
+#   define nscdimid    FNAME(SCDIMID)
+#   define nscginfo    FNAME(SCGINFO)
+#   define nscgainfo   FNAME(SCGAINFO)
+#   define nscgdinfo   FNAME(SCGDINFO)
+#   define nscgcal     FNAME(SCGCAL)
+#   define nscscal     FNAME(SCSCAL)
+#   define nscgdscale  FNAME(SCGDSCALE)
+#   define nscsdscale  FNAME(SCSDSCALE)
+#   define nscgcfill   FNAME(SCGCFILL)
+#   define nscgfill    FNAME(SCGFILL)
+#   define nscscfill   FNAME(SCSCFILL)
+#   define nscsfill    FNAME(SCSFILL)
+#   define nscsflmd    FNAME(SCSFLMD)
+#   define nscgrange   FNAME(SCGRANGE)
+#   define nscsrange   FNAME(SCSRANGE)
+#   define nscn2index  FNAME(SCN2INDEX)
+#   define nsccreate   FNAME(SCCREATE)
+#   define nscsdimstr  FNAME(SCSDIMSTR)
+#   define nscsdimname FNAME(SCSDIMNAME)
+#   define nscsdatstr  FNAME(SCSDATSTR)
+#   define nscrcatt    FNAME(SCRCATT)
+#   define nscrnatt    FNAME(SCRNATT)
+#   define nscrattr    FNAME(SCRATTR)
+#   define nscrcdata   FNAME(SCRCDATA)
+#   define nscrdata    FNAME(SCRDATA)
+#   define nscwcdata   FNAME(SCWCDATA)
+#   define nscwdata    FNAME(SCWDATA)
+#   define nscgdatstrs FNAME(SCGDATSTRS)
+#   define nscgdimstrs FNAME(SCGDIMSTRS)
+#   define nscscatt    FNAME(SCSCATT)
+#   define nscsnatt    FNAME(SCSNATT)
+#   define nscsattr    FNAME(SCSATTR)
+#   define nscfattr    FNAME(SCFATTR)
+#   define nscid2ref   FNAME(SCID2REF)
+#   define nscr2idx    FNAME(SCR2IDX)
+#   define nsciscvar   FNAME(SCISCVAR)
+#   define nscsextf    FNAME(SCSEXTF)
+#   define nscsnbit    FNAME(SCSNBIT)
+#   define nscsacct    FNAME(SCSACCT)
+#   define nscsdmvc    FNAME(SCSDMVC)
+#   define nscisdmvc   FNAME(SCISDMVC)
+#  endif   /* Fortran PowerStation */
+#else   /* DF_CAPFNAMES */
+#  if !(defined INTEL86) && !(defined WIN32)
+#   define nscstart    FNAME(scstart)
+#   define nsfend      FNAME(sfend)
+#   define nsfendacc   FNAME(sfendacc)
+#   define nsffinfo    FNAME(sffinfo)
+#   define nsfselect   FNAME(sfselect)
+#   define nscginfo    FNAME(scginfo)
+#   define nscgainfo   FNAME(scgainfo)
+#   define nscgdinfo   FNAME(scgdinfo)
+#   define nsfgcal     FNAME(sfgcal)
+#   define nsfscal     FNAME(sfscal)
+#   define nsfgdscale  FNAME(sfgdscale)
+#   define nsfsdscale  FNAME(sfsdscale)
+#   define nsfgcfill   FNAME(sfgcfill)
+#   define nsfgfill    FNAME(sfgfill)
+#   define nsfscfill   FNAME(sfscfill)
+#   define nsfsfill    FNAME(sfsfill)
+#   define nsfsflmd    FNAME(sfsflmd)
+#   define nsfgrange   FNAME(sfgrange)
+#   define nsfsrange   FNAME(sfsrange)
+#   define nscn2index  FNAME(scn2index)
+#   define nsccreate   FNAME(sccreate)
+#   define nscsdimstr  FNAME(scsdimstr)
+#   define nscsdimname FNAME(scsdimname)
+#   define nscsdatstr  FNAME(scsdatstr)
+#   define nsfdimid    FNAME(sfdimid)
+#   define nsfrcatt    FNAME(sfrcatt)
+#   define nsfrnatt    FNAME(sfrnatt)
+#   define nsfrattr    FNAME(sfrattr)
+#   define nscscatt    FNAME(scscatt)
+#   define nscsnatt    FNAME(scsnatt)
+#   define nscsattr    FNAME(scsattr)
+#   define nscfattr    FNAME(scfattr)
+#   define nsfrcdata   FNAME(sfrcdata)
+#   define nsfrdata    FNAME(sfrdata)
+#   define nsfwcdata   FNAME(sfwcdata)
+#   define nsfwdata    FNAME(sfwdata)
+#   define nscgdatstrs FNAME(scgdatstrs)
+#   define nscgdimstrs FNAME(scgdimstrs)
+#   define nsfid2ref   FNAME(sfid2ref)
+#   define nsfref2index FNAME(sfref2index)
+#   define nsfiscvar   FNAME(sfiscvar)
+#   define nscsextf    FNAME(scsextf)
+#   define nsfsnbit    FNAME(sfsnbit)
+#   define nsfsacct    FNAME(sfsacct)
+#   define nsfsdmvc    FNAME(sfsdmvc)
+#   define nsfisdmvc   FNAME(sfisdmvc)
+#  else /* Powerstation */
+#   define nscstart    FNAME(scstart)
+#   define nscend      FNAME(scend)
+#   define nscendacc   FNAME(scendacc)
+#   define nscfinfo    FNAME(scfinfo)
+#   define nscselect   FNAME(scselect)
+#   define nscginfo    FNAME(scginfo)
+#   define nscgainfo   FNAME(scgainfo)
+#   define nscgdinfo   FNAME(scgdinfo)
+#   define nscgcal     FNAME(scgcal)
+#   define nscscal     FNAME(scscal)
+#   define nscgdscale  FNAME(scgdscale)
+#   define nscsdscale  FNAME(scsdscale)
+#   define nscgcfill   FNAME(scgcfill)
+#   define nscgfill    FNAME(scgfill)
+#   define nscscfill   FNAME(scscfill)
+#   define nscsfill    FNAME(scsfill)
+#   define nscsflmd    FNAME(scsflmd)
+#   define nscgrange   FNAME(scgrange)
+#   define nscsrange   FNAME(scsrange)
+#   define nscn2index  FNAME(scn2index)
+#   define nsccreate   FNAME(sccreate)
+#   define nscsdimstr  FNAME(scsdimstr)
+#   define nscsdimname FNAME(scsdimname)
+#   define nscsdatstr  FNAME(scsdatstr)
+#   define nscdimid    FNAME(scdimid)
+#   define nscrcatt    FNAME(scrcatt)
+#   define nscrnatt    FNAME(scrnatt)
+#   define nscrattr    FNAME(scrattr)
+#   define nscscatt    FNAME(scscatt)
+#   define nscsnatt    FNAME(scsnatt)
+#   define nscsattr    FNAME(scsattr)
+#   define nscfattr    FNAME(scfattr)
+#   define nscrcdata   FNAME(scrcdata)
+#   define nscrdata    FNAME(scrdata)
+#   define nscwcdata   FNAME(scwcdata)
+#   define nscwdata    FNAME(scwdata)
+#   define nscgdatstrs FNAME(scgdatstrs)
+#   define nscgdimstrs FNAME(scgdimstrs)
+#   define nscid2ref   FNAME(scid2ref)
+#   define nscr2idx    FNAME(scr2idx)
+#   define nsciscvar   FNAME(sciscvar)
+#   define nscsnbit    FNAME(scsnbit)
+#   define nscsextf    FNAME(scsextf)
+#   define nscsacct    FNAME(scsacct)
+#   define nscsdmvc    FNAME(scsdmvc)
+#   define nscisdmvc   FNAME(scisdmvc)
+# endif /* powerstation  */
+#endif /* capital */
+#endif /* MFSD_FNAMES */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MFSD_H_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfsdpf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfsdpf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfsdpf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2054 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.4 $";
+#endif
+
+/* $Id: mfsdpf.c,v 1.4 1999/04/02 18:37:19 ptlu Exp $ */
+
+/*
+  mfsdpf.c -- based on mfsdf.c,v 1.26
+  This file contains the HDF-style C stubs for the multi-file SDS
+  interface for Fortran PowerStation.
+
+  The basic routines called by fortran will be of the form sfxxxx
+  in mfsdpff.f. 
+  All c stubs in this file are named nscxxxx having the FNAME()
+  function applied to it.
+*/
+
+#ifdef HDF
+#include "mfhdf.h"
+
+#ifdef PROTOTYPE
+FRETVAL(intf) nscstart(_fcd name, intf *access, intf *namelen);
+FRETVAL(intf) nscend(intf *file_id);
+FRETVAL(intf) nscendacc(intf *id);
+FRETVAL(intf) nscfinfo(intf *file_id, intf *datasets, intf *gattr);
+FRETVAL(intf) nscselct(intf *file_id, intf *index);
+FRETVAL(intf) nscdimid(intf *id, intf *index);
+FRETVAL(intf) nscginfo(intf *id, _fcd name, intf *rank, 
+                intf *dimsizes, intf *nt, intf *nattr, intf *len);
+FRETVAL(intf) nscgcal(intf *id, float64 *cal, float64 *cale, 
+                float64 *ioff, float64 *ioffe, intf *nt);
+FRETVAL(intf) nscscal(intf *id, float64 *cal, float64 *cale,
+                float64 *ioff, float64 *ioffe, intf *nt);
+FRETVAL(intf) nscsdscale(intf *id, intf *count, intf *nt, VOIDP values);
+FRETVAL(intf) nscgdscale(intf *id, VOIDP values);
+FRETVAL(intf) nscscfill(intf *id, _fcd val);
+FRETVAL(intf) nscgcfill(intf *id, _fcd val);
+FRETVAL(intf) nscsfill(intf *id, VOIDP val);
+FRETVAL(intf) nscgfill(intf *id, VOIDP val);
+FRETVAL(intf) nscgrange(intf *id, VOIDP max, VOIDP min);
+FRETVAL(intf) nscsrange(intf *id, VOIDP max, VOIDP min);
+FRETVAL(intf) nscn2index(intf *id, _fcd name, intf *namelen);
+FRETVAL(intf) nsccreate(intf *id, _fcd name, intf *nt, intf *rank, 
+                        intf *dims, intf *namelen);
+FRETVAL(intf) nscsdimstr(intf *id, _fcd l, _fcd u, _fcd f, intf *ll, 
+                        intf *ul, intf *fl);
+FRETVAL(intf) nscsdimname(intf *id, _fcd name, intf *len);
+FRETVAL(intf) nscsdatstr(intf *id, _fcd l, _fcd u, _fcd f, _fcd c, 
+                        intf *ll, intf *ul, intf *fl, intf *cl);
+FRETVAL(intf) nscrcatt(intf *id, intf *index, _fcd buf);
+FRETVAL(intf) nscrnatt(intf *id, intf *index, VOIDP buf);
+FRETVAL(intf) nscrattr(intf *id, intf *index, VOIDP buf);
+FRETVAL(intf) nscrdata(intf *id, intf *start, intf *stride, 
+                       intf *end, VOIDP values);
+FRETVAL(intf) nscwdata(intf *id, intf *start, intf *stride, 
+                       intf *end, VOIDP values);
+FRETVAL(intf) nscgdimstrs(intf *dim, _fcd label, _fcd unit, 
+                      _fcd format,intf *llabel,intf *lunit, 
+                      intf *lformat, intf *mlen);
+FRETVAL(intf) nscrcdata(intf *id, intf *start, intf *stride, 
+                       intf *end, _fcd values);
+FRETVAL(intf) nscwcdata(intf *id, intf *start, intf *stride, 
+                       intf *end, _fcd values);
+FRETVAL(intf) nscgdatstrs(intf *id, _fcd label, _fcd unit,
+                 _fcd format, _fcd coord, intf *llabel, intf *lunit,
+                   intf *lformat, intf *lcoord, intf *len);
+FRETVAL(intf) nscgainfo(intf *id, intf *number, _fcd name, intf *nt, 
+                   intf *count, intf *len);
+FRETVAL(intf) nscgdinfo(intf *id, _fcd name, intf *sz, intf *nt, 
+                   intf *nattr, intf *len);
+FRETVAL(intf) nscscatt(intf *id, _fcd name, intf *nt, intf *count,
+                    _fcd data, intf *len);
+FRETVAL(intf) nscsnatt(intf *id, _fcd name, intf *nt, intf *count, VOIDP data, intf *len);
+FRETVAL(intf) nscsattr(intf *id, _fcd name, intf *nt, intf *count, 
+                       VOIDP data, intf *len);
+FRETVAL(intf) nscid2ref(intf *id);
+FRETVAL(intf) nscr2idx(intf *id, intf *ref);
+FRETVAL(intf) nsciscvar(intf *id);
+FRETVAL(intf) nscsextf(intf *id, _fcd name, intf *offset,
+                       intf *namelen);
+FRETVAL(intf) nscsnbit(intf *id, intf *start_bit, intf *bit_len,
+                       intf *sign_ext, intf *fill_one);
+FRETVAL(intf) nscsacct(intf *id, intf *type);
+FRETVAL(intf) nscsdmvc(intf *id, intf *compmode);
+FRETVAL(intf) nscisdmvc(intf *id);
+FRETVAL(intf) nscsflmd(intf *id, intf *fillmode);
+FRETVAL (intf) nscgichnk(intf *id, intf *dim_length, intf *flags);
+FRETVAL (intf) nscrcchnk(intf *id, intf *start, _fcd char_data);
+FRETVAL (intf) nscrchnk(intf *id, intf *start, VOIDP num_data);
+FRETVAL (intf) nscscchnk(intf *id, intf *maxcache, intf *flags);
+FRETVAL (intf) nscschnk(intf *id, intf *dim_length, intf *comp_type,
+                intf *comp_prm);
+FRETVAL (intf) nscwcchnk(intf *id, intf *start, _fcd char_data);
+FRETVAL (intf) nscwchnk(intf *id, intf *start, VOIDP num_data);
+FRETVAL (intf) nscscompress(intf *id, intf *comp_type, intf *comp_prm);
+FRETVAL(intf)  nscisrcrd(intf *id);
+FRETVAL(intf) nscsblksz(intf *id, intf *block_size);
+
+#else
+FRETVAL(intf) nscstart();
+FRETVAL(intf) nscend();
+FRETVAL(intf) nscendacc();
+FRETVAL(intf) nscfinfo();
+FRETVAL(intf) nscselct();
+FRETVAL(intf) nscdimid();
+FRETVAL(intf) nscginfo();
+FRETVAL(intf) nscgcal();
+FRETVAL(intf) nscscal();
+FRETVAL(intf) nscsdscale();
+FRETVAL(intf) nscgdscale();
+FRETVAL(intf) nscscfill();
+FRETVAL(intf) nscgcfill();
+FRETVAL(intf) nscsfill();
+FRETVAL(intf) nscgfill();
+FRETVAL(intf) nscgrange();
+FRETVAL(intf) nscsrange();
+FRETVAL(intf) nscn2index();
+FRETVAL(intf) nsccreate();
+FRETVAL(intf) nscsdimstr();
+FRETVAL(intf) nscsdimname();
+FRETVAL(intf) nscsdatstr();
+FRETVAL(intf) nscrcatt();
+FRETVAL(intf) nscrnatt();
+FRETVAL(intf) nscrattr();
+FRETVAL(intf) nscrdata();
+FRETVAL(intf) nscwdata();
+FRETVAL(intf) nscgdimstrs();
+FRETVAL(intf) nscrcdata();
+FRETVAL(intf) nscwcdata();
+FRETVAL(intf) nscgdatstrs();
+FRETVAL(intf) nscgainfo();
+FRETVAL(intf) nscgdinfo();
+FRETVAL(intf) nscscatt();
+FRETVAL(intf) nscsnatt();
+FRETVAL(intf) nscsattr();
+FRETVAL(intf) nscid2ref();
+FRETVAL(intf) nscr2idx();
+FRETVAL(intf) nsciscvar();
+FRETVAL(intf) nscsextf();
+FRETVAL(intf) nscsnbit();
+FRETVAL(intf) nscsacct();
+FRETVAL(intf) nscsdmvc();
+FRETVAL(intf) nscisdmvc();
+FRETVAL(intf) nscsflmd();
+FRETVAL(intf) nscgichnk();
+FRETVAL(intf) nscrcchnk();
+FRETVAL(intf) nscrchnk();
+FRETVAL(intf) nscscchnk();
+FRETVAL(intf) nscschnk();
+FRETVAL(intf) nscwcchnk();
+FRETVAL(intf) nscwchnk();
+FRETVAL(intf) nscscompress();
+FRETVAL(intf)  nscisrcrd();
+FRETVAL(intf) nscsblksz();
+#endif /* PROTOTYPE */
+
+/*-----------------------------------------------------------------------------
+ * 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:    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:    scginfo
+ * 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:    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:    scn2index
+ * 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:    sccreate
+ * 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:    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:    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;
+     int *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:    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:    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;
+    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:    scgainfo
+ * 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. This causes problems on VMS and T3D.
+ *--------------------------------------------------------------------*/
+
+   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:    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:    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:    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:    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               */
+comp_info cinfo;          /* compression info     */
+int   i;
+int32 rank, status, cflags, comp_type;
+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:     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:     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 PROTOTYPEi
+       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:     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
+ * 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          */
+comp_info cinfo;          /* compression info     */
+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;
+
+       default:
+
+          return FAIL;
+                    
+                     }
+
+ret = SDsetchunk(sdsid, chunk_def, cflags);
+ 
+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:     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:    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_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
+       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     */
+int32 c_type;              /* compression type definition */
+
+int   i, 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;
+
+       default:
+
+          return FAIL;
+                    
+                     }
+
+ret = SDsetcompress(sdsid, c_type, &c_info);
+return(ret);
+
+}
+/*-----------------------------------------------------------------------------
+ * 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 /* HDF */
+
+
+/*-----------------------------------------------------------------------------
+ * 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);
+}   
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfsdpff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfsdpff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/fort_ps/mfsdpff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1785 @@
+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: mfsdpff.f,v 1.5 1999/04/02 18:38:06 ptlu Exp $
+C
+C mfsdpff.f, based on mfsdff.f,v 1.7
+C
+C----------------------------------------------------------------------
+C     Name: sfstart
+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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfstart
+	!MS$endif
+
+      character*(*) filename
+      integer       access
+C      integer       scstart
+      INTERFACE
+        INTEGER FUNCTION scstart(filename,access, nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSTART' :: scstart
+	    !DEC$ ATTRIBUTES reference :: filename
+          integer access, nmlen
+          character*(*) filename
+        END FUNCTION scstart
+      END INTERFACE
+
+
+      sfstart = scstart(filename, access, len(filename))
+      return
+      end
+C----------------------------------------------------------------------
+C     Name: sfend
+C     Purpose:  call scend, close file
+C     Inputs:   file_id: handle to HDF file to close
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfend(file_id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfend
+	!MS$endif
+
+      integer       file_id
+C      integer       scend
+      INTERFACE
+        INTEGER FUNCTION scend(file_id)
+          !MS$ATTRIBUTES C, reference, alias: '_SCEND' :: scend
+          integer file_id
+        END FUNCTION scend
+      END INTERFACE
+
+      sfend = scend(file_id)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfendacc
+C     Purpose:  call scendacc, to end access to an sds
+C     Inputs:   id: id of the data set
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfendacc(id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfendacc
+	!MS$endif
+
+      integer       id
+C      integer       scendacc
+      INTERFACE
+        INTEGER FUNCTION scendacc(id)
+          !MS$ATTRIBUTES C, reference, alias: '_SCENDACC' :: scendacc
+          integer id
+        END FUNCTION scendacc
+      END INTERFACE
+
+      sfendacc = scendacc(id)
+      return
+      end
+C----------------------------------------------------------------------
+C     Name: sffinfo
+C     Purpose:  call scfinfo, get number datasets and attrs in the file
+C     Inputs:   file_id: handle to HDF file to close
+C     Outputs:  datasets: number of datasets
+C               gattr:    number of global attrs
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sffinfo(file_id, datasets, gattr)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sffinfo
+	!MS$endif
+
+      integer       file_id, datasets, gattr
+C      integer       scfinfo
+      INTERFACE
+        INTEGER FUNCTION scfinfo(file_id,datasets,gattr)
+          !MS$ATTRIBUTES C, reference, alias: '_SCFINFO' :: scfinfo
+          integer file_id,datasets, gattr
+        END FUNCTION scfinfo
+      END INTERFACE
+
+      sffinfo = scfinfo(file_id, datasets,gattr)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfselect
+C     Purpose:  call scselct, to return a handle to a data set.
+C     Inputs:   file_id:  handle to HDF file
+C               index:    number of dataset to choose
+C     Returns: sdsid on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfselect(file_id, index)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfselect
+	!MS$endif
+
+      integer       file_id, index
+C      integer       scselct
+      INTERFACE
+        INTEGER FUNCTION scselct(file_id,index)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSELCT' :: scselct
+          integer file_id, index
+        END FUNCTION scselct
+      END INTERFACE
+
+      sfselect = scselct(file_id, index)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfdimid
+C     Purpose:  call scdimid, get an id for a dim of a dataset
+C     Inputs:   id: handle to a dataset
+C               index: number of dimension to choose
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfdimid(id, index)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfdimid
+	!MS$endif
+
+      integer       id, index
+C      integer       scdimid
+      INTERFACE
+        INTEGER FUNCTION scdimid(id, index)
+          !MS$ATTRIBUTES C, reference, alias: '_SCDIMID' :: scdimid
+          integer id, index
+        END FUNCTION scdimid
+      END INTERFACE
+
+      sfdimid = scdimid(id, index)
+      return
+      end
+C----------------------------------------------------------------------
+C     Name: sfgcal
+C     Purpose:  call scgcal, get calibration info
+C     Inputs:   id: handle to a dataset
+C     Outputs:  cal, cale, ioff, ioffe: calibration factors and errors
+C               nt: number type of data
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfgcal(id,cal,cale,ioff,ioffe,nt)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfgcal
+	!MS$endif
+
+      integer       id, nt
+      real*8    cal, cale, ioff, ioffe
+C      integer       scgcal
+      INTERFACE
+        INTEGER FUNCTION scgcal(id,cal,cale,ioff,ioffe,nt)
+          !MS$ATTRIBUTES C, reference, alias: '_SCGCAL' :: scgcal
+          integer id, nt
+          real*8  cal, cale, ioff, ioffe
+        END FUNCTION scgcal
+      END INTERFACE
+
+      sfgcal = scgcal(id, cal,cale,ioff,ioffe,nt)
+      return
+      end
+ 
+C----------------------------------------------------------------------
+C     Name: sfscal
+C     Purpose:  call scscal, set calibration info
+C     Inputs:   id: handle to a dataset
+C     Outputs:  cal, cale, ioff, ioffe: calibration factors and errors
+C               nt: number type of data
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfscal(id,cal,cale,ioff,ioffe,nt)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfscal
+	!MS$endif
+
+      integer       id, nt
+      real*8    cal, cale, ioff, ioffe
+C      integer       scscal
+      INTERFACE
+        INTEGER FUNCTION scscal(id,cal,cale,ioff,ioffe,nt)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSCAL' :: scscal
+          integer id, nt
+          real*8  cal, cale, ioff, ioffe
+        END FUNCTION scscal
+      END INTERFACE
+
+      sfscal = scscal(id, cal,cale,ioff,ioffe,nt)
+      return
+      end
+ 
+C----------------------------------------------------------------------
+C     Name: sfsdscale
+C     Purpose:  call scsdscale, set dimension scale
+C     Inputs:   id: handle to a dimension
+C               count: size of the dimension
+C               nt: number type of data
+C               values: data
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfsdscale(id,count, nt, values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsdscale
+	!MS$endif
+
+      integer       id, count, nt, values
+C      integer       scsdscale
+      INTERFACE
+        INTEGER FUNCTION scsdscale(id, count, nt , values)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSDSCALE' :: scsdscale
+          integer id, count, nt, values
+        END FUNCTION scsdscale
+      END INTERFACE
+
+      sfsdscale = scsdscale(id, count, nt, values)
+      return
+      end
+C----------------------------------------------------------------------
+C     Name: sfgdscale
+C     Purpose:  call scgdscale, get dimension scale
+C     Inputs:   id: handle to a dimension
+C               values: data
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfgdscale(id, values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfgdscale
+	!MS$endif
+
+      integer       id, values
+C      integer       scgdscale
+      INTERFACE
+        INTEGER FUNCTION scgdscale(id, values)
+          !MS$ATTRIBUTES C, reference, alias: '_SCGDSCALE' :: scgdscale
+          integer id, values
+        END FUNCTION scgdscale
+      END INTERFACE
+
+      sfgdscale = scgdscale(id, values)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfscfill
+C     Purpose:  call scscfill, set char fill value
+C     Inputs:   id: handle to a dataset
+C               val: the fill value
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfscfill(id, val)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfscfill
+	!MS$endif
+
+      integer       id
+      character*1   val
+C      integer       scscfill
+      INTERFACE
+        INTEGER FUNCTION scscfill(id, val)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSCFILL' :: scscfill
+	    !DEC$ ATTRIBUTES reference :: val
+          integer id
+          character*1 val
+        END FUNCTION scscfill
+      END INTERFACE
+
+      sfscfill = scscfill(id, val)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfgcfill
+C     Purpose:  call scgcfill, get char fill value
+C     Inputs:   id: handle to a dataset
+C               val: the fill value
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfgcfill(id, val)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfgcfill
+	!MS$endif
+
+      integer       id
+      character*1   val
+C      integer       scgcfill
+      INTERFACE
+        INTEGER FUNCTION scgcfill(id, val)
+          !MS$ATTRIBUTES C, reference, alias: '_SCGCFILL' :: scgcfill
+	    !DEC$ ATTRIBUTES reference :: val
+          integer id
+          character*1 val
+        END FUNCTION scgcfill
+      END INTERFACE
+
+      sfgcfill = scgcfill(id, val)
+      return
+      end
+
+C----------------------------------------------------------------
+C     Name: sfsfill
+C     Purpose:  call scsfill, set numeric fill value
+C     Inputs:   id: handle to a dataset
+C               val: the fill value
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------
+
+      integer function sfsfill(id, val)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsfill
+	!MS$endif
+
+      integer       id, val
+C      integer       scsfill
+      INTERFACE
+        INTEGER FUNCTION scsfill(id, val)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSFILL' :: scsfill
+          integer id, val
+        END FUNCTION scsfill
+      END INTERFACE
+
+      sfsfill = scsfill(id, val)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfgfill
+C     Purpose:  call scgfill, get numeric fill value
+C     Inputs:   id: handle to a dataset
+C               val: the fill value
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfgfill(id, val)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfgfill
+	!MS$endif
+
+      integer       id, val
+C      integer       scgfill
+      INTERFACE
+        INTEGER FUNCTION scgfill(id, val)
+          !MS$ATTRIBUTES C, reference, alias: '_SCGFILL' :: scgfill
+          integer id, val
+        END FUNCTION scgfill
+      END INTERFACE
+
+      sfgfill = scgfill(id, val)
+      return
+      end
+
+C----------------------------------------------------------------
+C     Name: sfsrange
+C     Purpose:  call scsrange, set the valid range info
+C     Inputs:   id: handle to a dataset
+C               max, min: the maximum and minimum values
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------
+
+      integer function sfsrange(id, max, min)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsrange
+	!MS$endif
+
+      integer       id, max, min
+C      integer       scsrange
+      INTERFACE
+        INTEGER FUNCTION scsrange(id, max, min)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSRANGE' :: scsrange
+          integer id, max, min
+        END FUNCTION scsrange
+      END INTERFACE
+
+      sfsrange = scsrange(id, max, min)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfgrange
+C     Purpose:  call scgrange, get the valid range info
+C     Inputs:   id: handle to a dataset
+C               max, min:  the maximum and minimum values
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfgrange(id, max, min)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfgrange
+	!MS$endif
+
+      integer       id, max, min
+C      integer       scgrange
+      INTERFACE
+        INTEGER FUNCTION scgrange(id, max, min)
+          !MS$ATTRIBUTES C, reference, alias: '_SCGRANGE' :: scgrange
+          integer id, max, min
+        END FUNCTION scgrange
+      END INTERFACE
+
+      sfgrange = scgrange(id, max, min)
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfn2index
+	!MS$endif
+
+      character*(*) name
+      integer       id
+c      integer       scn2index
+      INTERFACE
+        INTEGER FUNCTION scn2index(id, name, nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCN2INDEX' :: scn2index
+	    !DEC$ ATTRIBUTES reference :: name
+          integer id, nmlen
+          character*(*) name
+        END FUNCTION scn2index
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfcreate
+	!MS$endif
+
+      character*(*) name
+      integer       id, nt, rank
+      integer       dims(*)
+C      integer       sccreate
+      INTERFACE
+        INTEGER FUNCTION sccreate(id,name,nt,rank,dims,nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCCREATE' :: sccreate
+	    !DEC$ ATTRIBUTES reference :: name
+          integer id, nt, rank, dims(*), nmlen
+          character*(*) name
+        END FUNCTION sccreate
+      END INTERFACE
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfsdmstr(id, label, unit, format)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsdmstr
+	!MS$endif
+
+      character*(*) label, unit, format
+      integer len, id
+C      integer scsdimstr
+      INTERFACE
+        INTEGER FUNCTION scsdimstr(id, label, unit, format,
+     +                       llen,ulen, flen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSDIMSTR' :: scsdimstr
+	    !DEC$ ATTRIBUTES reference :: label, unit, format
+          integer id, llen, ulen, flen
+          character*(*) label, unit, format
+        END FUNCTION scsdimstr
+      END INTERFACE
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfsdmname(id, name)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsdmname
+	!MS$endif
+
+      character*(*) name
+      integer len, id
+C      integer scsdimname
+      INTERFACE
+        INTEGER FUNCTION scsdimname(id, name, nmlen)
+          !MS$ATTRIBUTES C,reference,alias:'_SCSDIMNAME' :: scsdimname
+	    !DEC$ ATTRIBUTES reference :: name
+          integer id, nmlen
+          character*(*) name
+        END FUNCTION scsdimname
+      END INTERFACE
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfsdtstr(id, l, u, f, c)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsdtstr
+	!MS$endif
+
+      character*(*) l, u, f, c
+      integer len, id
+C      integer scsdatstr
+      INTERFACE
+        INTEGER FUNCTION scsdatstr(id, l, u, f, c, llen, 
+     +                         ulen, flen, clen)
+          !MS$ATTRIBUTES C,reference,alias:'_SCSDATSTR' :: scsdatstr
+	    !DEC$ ATTRIBUTES reference :: l,u,f,c
+          integer id, llen, ulen, flen, clen
+	    character*(*) l,u,f,c
+        END FUNCTION scsdatstr
+      END INTERFACE
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfgdtstr(id, label, unit, format, coord, mlen)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfgdtstr
+	!MS$endif
+
+      character*(*) label, unit, format, coord
+      integer len, id, mlen
+C       integer scgdatstrs
+      INTERFACE
+        INTEGER FUNCTION scgdatstrs(id,label,unit,format,coord,
+     +                               llen,ulen,flen, clen,mlen)
+          !MS$ATTRIBUTES C,reference,alias:'_SCGDATSTRS' :: scgdatstrs
+	    !DEC$ ATTRIBUTES reference :: label, unit, format, coord
+          integer id, llen, ulen, flen, clen, mlen
+          character*(*) label, unit, format, coord
+        END FUNCTION scgdatstrs
+      END INTERFACE
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfgdmstr(id, label, unit, format, mlen)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfgdmstr
+	!MS$endif
+
+      character*(*) label, unit, format
+      integer len, id
+C      integer scgdimstrs
+      INTERFACE
+        INTEGER FUNCTION scgdimstrs(id,label,unit,format,
+     + 	  llen,ulen,flen,mlen)
+          !MS$ATTRIBUTES C,reference,alias:'_SCGDIMSTRS' :: scgdimstrs
+	    !DEC$ ATTRIBUTES reference :: label, unit, format
+          integer id, llen, ulen, flen, mlen
+          character*(*) label, unit, format
+        END FUNCTION scgdimstrs
+      END INTERFACE
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfginfo(id, name, rank, dims, nt, nattr)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfginfo
+	!MS$endif
+
+      character*(*) name
+      integer rank, nt, nattr
+      integer dims(*)
+      integer len
+c      integer scginfo
+      INTERFACE
+        INTEGER FUNCTION scginfo(id,name,rank,dims,nt,nattr,nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCGINFO' :: scginfo
+	    !DEC$ ATTRIBUTES reference :: name
+          integer id,rank,dims(*),nt,nattr,nmlen
+          character*(*) name
+        END FUNCTION scginfo
+      END INTERFACE
+
+      sfginfo = scginfo(id, name, rank, dims, nt, nattr, len(name))
+      
+      return
+      end
+   
+C----------------------------------------------------------------------
+C Name:     sfrcatt
+C Purpose:  call scrcatt to get the contents of a char attribute
+C Inputs:   id: dataset id
+C           index: index of the attribute to read
+C           buf: space to hold attribute values
+C Returns:  0 on success, -1 on failure with error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfrcatt(id, index, buf)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfrcatt
+	!MS$endif
+
+      character   buf(*)
+      integer id, index
+c      integer scrcatt
+      INTERFACE
+        INTEGER FUNCTION scrcatt(id, index, buf)
+          !MS$ATTRIBUTES C, reference, alias: '_SCRCATT' :: scrcatt
+	    !DEC$ ATTRIBUTES reference :: buf
+          integer id, index
+          character   buf(*)
+        END FUNCTION scrcatt
+      END INTERFACE
+
+      sfrcatt = scrcatt(id, index, buf)
+
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfrnatt
+C Purpose:  call scrnatt to get the contents of a numeric attribute
+C Inputs:   id: dataset id
+C           index: index of the attribute to read
+C           buf: space to hold attribute values
+C Returns:  0 on success, -1 on failure with error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfrnatt(id, index, buf)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfrnatt
+	!MS$endif
+
+      integer id, index, buf
+c      integer scrnatt
+      INTERFACE
+        INTEGER FUNCTION scrnatt(id, index, buf)
+          !MS$ATTRIBUTES C, reference, alias: '_SCRNATT' :: scrnatt
+          integer id, index, buf
+        END FUNCTION scrnatt
+      END INTERFACE
+
+      sfrnatt = scrnatt(id, index, buf)
+
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfrattr
+C Purpose:  call scrattr to get the contents of an attribute
+C Inputs:   id: dataset id
+C           index: index of the attribute to read
+C           buf: space to hold attribute values
+C Returns:  0 on success, -1 on failure with error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfrattr(id, index, buf)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfrattr
+	!MS$endif
+
+      character*(*) buf
+      integer id, index
+c      integer scrattr
+      INTERFACE
+        INTEGER FUNCTION scrattr(id, index, buf)
+          !MS$ATTRIBUTES C, reference, alias: '_SCRATTR' :: scrattr
+	    !DEC$ ATTRIBUTES reference :: buf
+          integer id, index
+          character*(*) buf
+        END FUNCTION scrattr
+      END INTERFACE
+
+      sfrattr = scrattr(id, index, buf)
+
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfrdata
+C Purpose:  call scrdata to read a section of numeric data
+C Inputs:   id: dataset id
+C           start: start location
+C           stride: stride along each dimension
+C           end: number of values along each dim to read
+C           values: data
+C Returns:  0 on success, -1 on failure with error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfrdata(id, start,stride, end,values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfrdata
+	!MS$endif
+
+      integer id, start(*), stride(*), end(*), values(*)
+c      integer scrdata
+      INTERFACE
+        INTEGER FUNCTION scrdata(id,start, stride, end, values) 
+          !MS$ATTRIBUTES C, reference, alias: '_SCRDATA' :: scrdata
+          integer id, start(*), stride(*), end(*), values(*)
+        END FUNCTION scrdata
+      END INTERFACE
+
+      sfrdata = scrdata(id,start, stride, end, values)
+
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfwdata
+C Purpose:  call scwdata to write a section of numeric data
+C Inputs:   id: dataset id
+C           start: start location
+C           stride: stride along each dimension
+C           end: number of values along each dim to write
+C           values: data
+C Returns:  0 on success, -1 on failure with error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfwdata(id, start,stride, end,values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfwdata
+	!MS$endif
+
+      integer id, start(*), stride(*), end(*), values(*)
+c      integer scwdata
+      INTERFACE
+        INTEGER FUNCTION scwdata(id,start, stride, end, values) 
+          !MS$ATTRIBUTES C, reference, alias: '_SCWDATA' :: scwdata
+          integer id, start(*), stride(*), end(*), values(*)
+        END FUNCTION scwdata
+      END INTERFACE
+
+      sfwdata = scwdata(id,start, stride, end, values)
+
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfrcdata
+C Purpose:  call scrcdata to read a section of char data
+C Inputs:   id: dataset id
+C           start: start location
+C           stride: stride along each dimension
+C           end: number of values along each dim to read
+C           values: data
+C Returns:  0 on success, -1 on failure with error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfrcdata(id, start,stride, end,values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfrcdata
+	!MS$endif
+
+      integer id, start(*), stride(*), end(*)
+      character*(*) values
+c      integer scrcdata
+      INTERFACE
+        INTEGER FUNCTION scrcdata(id,start, stride, end, values) 
+          !MS$ATTRIBUTES C, reference, alias: '_SCRCDATA' :: scrcdata
+	    !DEC$ ATTRIBUTES reference :: values
+          integer id, start(*), stride(*), end(*)
+          character *(*) values
+        END FUNCTION scrcdata
+      END INTERFACE
+
+      sfrcdata = scrcdata(id,start, stride, end, values)
+
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfwcdata
+C Purpose:  call scwcdata to write a section of numeric data
+C Inputs:   id: dataset id
+C           start: start location
+C           stride: stride along each dimension
+C           end: number of values along each dim to write
+C           values: data
+C Returns:  0 on success, -1 on failure with error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfwcdata(id, start,stride, end,values)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfwcdata
+	!MS$endif
+
+      integer id, start(*), stride(*), end(*)
+      character*(*) values
+c      integer scwcdata
+      INTERFACE
+        INTEGER FUNCTION scwcdata(id,start, stride, end, values) 
+          !MS$ATTRIBUTES C, reference, alias: '_SCWCDATA' :: scwcdata
+	    !DEC$ ATTRIBUTES reference :: values
+          integer id, start(*), stride(*), end(*)
+          character*(*) values
+        END FUNCTION scwcdata
+      END INTERFACE
+
+      sfwcdata = scwcdata(id,start, stride, end, values)
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfgainfo(id, number, name, nt, count)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfgainfo
+	!MS$endif
+
+      character*(*) name
+      integer nt, number, len, count
+C      integer scgainfo
+      INTERFACE
+        INTEGER FUNCTION scgainfo(id, number, name,nt, count,nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCGAINFO' :: scgainfo
+	    !DEC$ ATTRIBUTES reference :: name
+          integer id, number, nt, count, nmlen
+          character*(*) name
+        END FUNCTION scgainfo
+      END INTERFACE
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfgdinfo(id, name, sz, nt, nattr)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfgdinfo
+	!MS$endif
+
+      character*(*) name
+      integer sz, nt, nattr, len
+C      integer scgdinfo
+      INTERFACE
+        INTEGER FUNCTION scgdinfo(id,name, sz, nt, nattr,nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCGDINFO' :: scgdinfo
+	    !DEC$ ATTRIBUTES reference :: name
+          integer id, sz, nt, nattr, nmlen
+          character*(*) name
+        END FUNCTION scgdinfo
+      END INTERFACE
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfscatt(id,name,nt,count,data)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfscatt
+	!MS$endif
+
+      character*(*) name
+      character data(*)
+      integer nt, count, len
+C      integer scscatt
+      INTERFACE
+        INTEGER FUNCTION scscatt(id,name, nt, count,data, nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSCATT' :: scscatt
+	    !DEC$ ATTRIBUTES reference :: name,data
+          integer id, nt, count, nmlen
+          character*(*) name
+          character     data(*)
+        END FUNCTION scscatt
+      END INTERFACE
+
+      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 error set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfsnatt(id, name, nt, count, data)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsnatt
+	!MS$endif
+
+      character*(*) name
+      integer nt, data, count, len
+C      integer scsnatt
+      INTERFACE
+        INTEGER FUNCTION scsnatt(id,name, nt, count,data, nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSNATT' :: scsnatt
+	    !DEC$ ATTRIBUTES reference :: name
+          integer id, nt, count, data, nmlen
+          character*(*) name
+        END FUNCTION scsnatt
+      END INTERFACE
+
+      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 error 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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsattr
+	!MS$endif
+
+      character*(*) name, data
+      integer nt, len, count
+C      integer scsattr
+      INTERFACE
+        INTEGER FUNCTION scsattr(id,name, nt, count,data, nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSATTR' :: scsattr
+	    !DEC$ ATTRIBUTES reference :: name,data
+          integer id, nt, count, nmlen
+          character*(*) name, data
+        END FUNCTION scsattr
+      END INTERFACE
+
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sffattr
+	!MS$endif
+
+      character*(*) name
+      integer       id, len
+C      integer       scfattr
+      INTERFACE
+        INTEGER FUNCTION scfattr(id,name, nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCFATTR' :: scfattr
+	    !DEC$ ATTRIBUTES reference :: name
+          integer id, nmlen
+          character*(*) name
+        END FUNCTION scfattr
+      END INTERFACE
+
+      sffattr = scfattr(id, name, len(name))
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfid2ref
+C     Purpose:  call scid2ref, map an id to ref
+C     Inputs:   id: variable id
+C     Returns: refernce number on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfid2ref(id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfid2ref
+	!MS$endif
+
+      integer       id
+C      integer       scid2ref
+      INTERFACE
+        INTEGER FUNCTION scid2ref(id)
+          !MS$ATTRIBUTES C, reference, alias: '_SCID2REF' :: scid2ref
+          integer id
+        END FUNCTION scid2ref
+      END INTERFACE
+
+      sfid2ref = scid2ref(id)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfref2index
+C     Purpose:  call scr2idx, map an ref to index
+C     Inputs:   id: variable id
+C               ref: reference number
+C     Returns: index on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfref2index(id, ref)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfref2index
+	!MS$endif
+
+      integer       id, ref
+C      integer       scr2idx
+      INTERFACE
+        INTEGER FUNCTION scr2idx(id, ref)
+          !MS$ATTRIBUTES C, reference, alias: '_SCR2IDX' :: scr2idx
+          integer id, ref
+        END FUNCTION scr2idx
+      END INTERFACE
+
+      sfref2index = scr2idx(id, ref)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfiscvar
+C     Purpose:  call sciscvar to see if a dataset is a coordinate var 
+C     Inputs:   id: variable id
+C     Returns: TRUE/FALSE
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfiscvar(id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfiscvar
+	!MS$endif
+
+      integer       id
+C      integer       sciscvar
+      INTERFACE
+        INTEGER FUNCTION sciscvar(id)
+          !MS$ATTRIBUTES C, reference, alias: '_SCISCVAR' :: sciscvar
+          integer id
+        END FUNCTION sciscvar
+      END INTERFACE
+
+      sfiscvar = sciscvar(id)
+      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)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsextf
+	!MS$endif
+
+      character*(*) fname
+      integer       id, offset, len
+C     integer       scsextf
+      INTERFACE
+        INTEGER FUNCTION scsextf(id, fname, offset, nmlen)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSEXTF' :: scsextf
+	    !DEC$ ATTRIBUTES reference :: fname
+          integer id, offset, nmlen
+          character*(*) fname
+        END FUNCTION scsextf
+      END INTERFACE
+
+      sfsextf = scsextf(id, fname, offset, len(fname))
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfsnbit
+C     Purpose:  call scsnbit, store data in n-bit data element
+C     Inputs:  id: variable id
+C              start_bit: starting bit offset
+C              bit_len: # 0f bits to write
+C              sign_ext: whether to use the top bit as a sign extender
+C              fill_one: whether to fill the "background bits" with ones
+C     Returns: SUCCEED on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfsnbit(id,start_bit,bit_len,sign_ext,fill_one)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsnbit
+	!MS$endif
+
+      integer       id,start_bit,bit_len,sign_ext,fill_one 
+C      integer       scsnbit
+      INTERFACE
+        INTEGER FUNCTION scsnbit(id,start_bit,bit_len,sign_ext,fill_one) 
+          !MS$ATTRIBUTES C, reference, alias: '_SCSNBIT' :: scsnbit
+          integer id,start_bit,bit_len,sign_ext,fill_one
+        END FUNCTION scsnbit
+      END INTERFACE
+
+      sfsnbit = scsnbit(id,start_bit,bit_len,sign_ext,fill_one)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfsacct
+C     Purpose:  call scsacct, set tje access type
+C     Inputs:   id: variable id
+C               type: the access type
+C     Returns: SUCCEED on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfsacct(id, acctype)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsacct
+	!MS$endif
+
+      integer       id, acctype
+C      integer       scsacct
+      INTERFACE
+        INTEGER FUNCTION scsacct(id, acctype)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSACCT' :: scsacct
+          integer id, acctype
+        END FUNCTION scsacct
+      END INTERFACE
+
+      sfsacct = scsacct(id, acctype)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfsdmvc
+C     Purpose:  call scsdmvc, set dim value backward compatible type
+C     Inputs:   id: dim id
+C               compmode:  (defined in mfhdf.h)
+C                  SD_DIMVAL_BW_COMP -- backward compatible 
+C                  SD_DIMVAL_BW_INCOMP -- incompatible
+C     Returns: SUCCEED on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfsdmvc(id, comptype)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsdmvc
+	!MS$endif
+
+      integer       id, comptype
+C      integer       scsdmvc
+      INTERFACE
+        INTEGER FUNCTION scsdmvc(id, comptype)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSDMVC' :: scsdmvc
+          integer id, comptype
+        END FUNCTION scsdmvc
+      END INTERFACE
+
+      sfsdmvc = scsdmvc(id, comptype)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfisdmvc
+C     Purpose:  call scisdmvc, get dim value backward compatibility 
+C     Inputs:   id: dim id
+C     Returns:  SD_DIMVAL_BW_COMP(1) -- backward compatible 
+C               SD_DIMVAL_BW_INCOMP(0) -- incompatible
+C               FAIL(-1) on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfisdmvc(id)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfisdmvc
+	!MS$endif
+
+      integer       id
+C      integer       scisdmvc
+      INTERFACE
+        INTEGER FUNCTION scisdmvc(id)
+          !MS$ATTRIBUTES C, reference, alias: '_SCISDMVC' :: scisdmvc
+          integer id
+        END FUNCTION scisdmvc
+      END INTERFACE
+
+      sfisdmvc = scisdmvc(id)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sfsflmd
+C     Purpose:  call scsflmd, set file fill mode
+C     Inputs:   id: file id
+C               fillmode: desired fill mode;
+C                    SD_FILL(default) or SD_NOFILL. 
+C     Returns: the current( before the new mode is set) fill mode;
+C              FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfsflmd(file_id, fillmode)
+	!MS$if defined(BUILD_HDF_DLL)
+	!MS$attributes dllexport :: sfsflmd 
+	!MS$endif
+
+      integer       file_id, fillmode
+C      integer       scsflmd
+      INTERFACE
+        INTEGER FUNCTION scsflmd(file_id, fillmode)
+          !MS$ATTRIBUTES C, reference, alias: '_SCSFLMD' :: scsflmd
+          integer file_id, fillmode
+        END FUNCTION scsflmd
+      END INTERFACE
+
+      sfsflmd = scsflmd(file_id, fillmode)
+      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 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 SD setchunk function)
+C-------------------------------------------------------------------------
+
+         INTEGER function sfgichnk(id, dim_length, comp_flag)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfgichnk 
+	     !MS$endif
+
+         INTEGER id, dim_length(*), comp_flag
+C         INTEGER scgichnk 
+
+      INTERFACE
+        INTEGER FUNCTION scgichnk(id, dim_length, comp_flag)
+          !MS$ATTRIBUTES C, reference, alias: '_SCGICHNK' :: scgichnk 
+          integer id, dim_length(*), comp_flag 
+        END FUNCTION scgichnk 
+      END INTERFACE
+
+         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 SDwriteChunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function sfrcchnk(id, start, char_data)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfrcchnk 
+	     !MS$endif
+C
+         INTEGER id, start(*)
+         CHARACTER*(*) char_data(*)
+C         INTEGER scrcchnk 
+
+      INTERFACE
+        INTEGER FUNCTION  scrcchnk(id, start, char_data)
+          !MS$ATTRIBUTES C, reference, alias: '_SCRCCHNK' :: scrcchnk 
+            !DEC$ ATTRIBUTES reference :: char_data
+          integer id, start(*)
+          character*(*) char_data(*) 
+        END FUNCTION scrcchnk 
+      END INTERFACE
+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 SDwriteChunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function sfrchnk(id, start, num_data)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfrchnk 
+	     !MS$endif
+C
+         INTEGER id, start(*), num_data(*)
+C         INTEGER scrchnk 
+
+      INTERFACE
+        INTEGER FUNCTION  scrchnk(id, start, num_data)
+          !MS$ATTRIBUTES C, reference, alias: '_SCRCHNK' :: scrchnk 
+          integer id, start(*), num_data(*)
+        END FUNCTION scrchnk 
+      END INTERFACE
+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)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfscchnk 
+	     !MS$endif
+C
+         INTEGER id, maxcache, flags 
+C         INTEGER scscchnk 
+
+      INTERFACE
+        INTEGER FUNCTION scscchnk(id, maxcache, flags) 
+          !MS$ATTRIBUTES C, reference, alias: '_SCSCCHNK' :: scscchnk 
+          integer id, maxcache, flags 
+        END FUNCTION scscchnk 
+      END INTERFACE
+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_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        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 SD setchunk function)
+C-------------------------------------------------------------------------
+
+         INTEGER function sfschnk(id, dim_length, comp_type,comp_prm)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfschnk 
+	     !MS$endif
+
+         INTEGER id, dim_length(*), comp_type, comp_prm(*)
+C         INTEGER scschnk 
+
+      INTERFACE
+        INTEGER FUNCTION scschnk(id, dim_length, comp_type, comp_prm) 
+          !MS$ATTRIBUTES C, reference, alias: '_SCSCHNK' :: scschnk 
+          integer id, dim_length(*), comp_type, comp_prm(*) 
+        END FUNCTION scschnk 
+      END INTERFACE
+
+         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)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfwcchnk 
+	     !MS$endif
+C
+         INTEGER id, start(*) 
+         CHARACTER*(*) char_data(*)
+C         INTEGER scwcchnk 
+
+      INTERFACE
+        INTEGER FUNCTION  scwcchnk(id, start, char_data)
+          !MS$ATTRIBUTES C, reference, alias: '_SCWCCHNK' :: scWcchnk 
+            !DEC$ ATTRIBUTES reference :: char_data
+          integer id, start(*)
+          character*(*) char_data(*) 
+        END FUNCTION scwcchnk 
+      END INTERFACE
+
+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)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfwchnk 
+	     !MS$endif
+C
+         INTEGER id, start(*), num_data(*)
+C         INTEGER scwchnk 
+
+      INTERFACE
+        INTEGER FUNCTION  scwchnk(id, start, num_data)
+          !MS$ATTRIBUTES C, reference, alias: '_SCWCHNK' :: scwchnk 
+          integer id, start(*), num_data(*)
+        END FUNCTION scwchnk 
+      END INTERFACE
+
+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_prm - compression parameter array:
+C                   comp_prm(1) = deflate_level for GZIP
+C                   comp_prm(1) = skphuff_skp_size for ADAPTIVE HUFFMAN
+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 SD setchunk function)
+C-------------------------------------------------------------------------
+
+         INTEGER function sfscompress(id, comp_type,comp_prm)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfscompress 
+	     !MS$endif
+
+         INTEGER id, comp_type, comp_prm(*)
+C         INTEGER scscompress 
+
+      INTERFACE
+        INTEGER FUNCTION scscompress(id, comp_type, comp_prm) 
+      !MS$ATTRIBUTES C, reference, alias: '_SCSCOMPRESS' :: scscompress 
+          integer id, comp_type, comp_prm(*) 
+        END FUNCTION sc scompress
+      END INTERFACE
+
+         sfscompress = scscompress(id, comp_type, comp_prm)
+         return
+         end
+
+C-------------------------------------------------------------------------
+C        Name:      sfisrcrd
+C        Purpose:   checkes if SDS is appendable ,i.e, has unlimited 
+C                   dimension 
+C        Inputs:    id       - data set ID
+C        Returns:   1 if true,  0 otherwise
+C        Calls:     scisrcrd (C stub for SDisrecord function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+ 
+         INTEGER function sfisrcrd(id)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfisrcrd 
+	     !MS$endif
+C
+         INTEGER id
+ 
+      INTERFACE
+        INTEGER FUNCTION  scisrcrd(id)
+          !MS$ATTRIBUTES C, reference, alias: '_SCISRCRD' :: scisrcrd
+          integer id
+        END FUNCTION scisrcrd
+      END INTERFACE
+ 
+C
+         sfisrcrd = scisrcrd(id)
+C
+         return
+         end
+ 
+C------------------------------------------------------------------------- 
+C        Name:      sfsblsz
+C        Purpose:   sets block size for writing unlimited SDS  
+C        Inputs:    id       - data set ID  
+C                   block_size - block size in bytes
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scsblsz (C stub for SDsetblocksize function)
+C        Users:     HDF Fortran programmers 
+C------------------------------------------------------------------------- 
+                                                                            
+         INTEGER function sfsblsz(id, block_size) 
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfsblsz 
+	     !MS$endif
+C 
+         INTEGER id, block_size
+  
+      INTERFACE 
+        INTEGER FUNCTION  scsblsz(id, block_size) 
+          !MS$ATTRIBUTES C, reference, alias: '_SCSBLSZ' :: scsblsz
+          integer id, block_size
+        END FUNCTION scsblsz
+      END INTERFACE 
+  
+C 
+         sfsblsz = scsblsz(id, block_size) 
+C 
+         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)
+	     !MS$if defined(BUILD_HDF_DLL)
+	     !MS$attributes dllexport :: sfchempty 
+	     !MS$endif
+C
+         INTEGER id, flag 
+C        INTEGER scchempty 
+C
+
+      INTERFACE 
+        INTEGER FUNCTION  scchempty(id, flag) 
+          !MS$ATTRIBUTES C, reference, alias: '_SCCHEMPTY' :: scchempty
+          integer id, flag
+        END FUNCTION scchempty
+      END INTERFACE 
+         sfchempty = scchempty(id, flag) 
+C
+         return 
+         end
+           
+         

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,52 @@
+#!/bin/sh
+# fortc - make Fortran-callable C source
+# usage: fortc [-L LibDir] [-O OperSys] [file ...]
+
+#set -x
+
+InFiles=
+LibDir=/usr/local/ldm/lib
+
+while [ $# -gt 0 ]; do
+    case $1 in
+    -L)	shift; LibDir=$1; shift;;
+    -L*)
+	LibDir=`echo $1 | sed 's/-.//'`; shift;;
+    -O)	shift; OS=$1; shift;;
+    -O*)
+	OS=`echo $1 | sed 's/-.//'`; shift;;
+    -*)	echo 1>&2 "Option '$1' is unknown"; exit 1;;
+    *)	InFiles="$InFiles $1"; shift;;
+    esac
+done
+
+case "$OS" in
+    aix*)
+	OS=aix;;
+    hpux*)
+	OS=hpux;;
+    irix*)
+	OS=irix;;
+    msoft*)
+	OS=msoft;;
+    next*)
+	OS=next;;
+    sun*)
+	OS=sunos;;
+    ultrix*)
+	OS=ultrix;;
+    unicos*)
+	OS=unicos;;
+    vms*)
+	OS=vms;;
+    S370*)
+	OS=fujivp;;
+    "")	echo 1>&2 \
+	    "$0: Operating-system not defined: environmental-variable OS not" \
+	    "set or option \"-O<system>\" not specified."
+	exit 2;;
+esac
+
+sed -f $LibDir/fortc1.sed $InFiles |
+    m4 $LibDir/common.m4 $LibDir/$OS.m4 - |
+    sed -f $LibDir/fortc2.sed

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc1.sed
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc1.sed	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc1.sed	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,108 @@
+s/\([^a-zA-Z]\)len/\1M4_len_4M/g
+s/CHARSTAR/M4_CHARSTAR_4M/g
+s/DOUBLESTAR/M4_DOUBLESTAR_4M/g
+s/FLOATSTAR/M4_FLOATSTAR_4M/g
+s/INTEGERSTAR/M4_INTEGERSTAR_4M/g
+s/INTSTAR/M4_INTSTAR_4M/g
+s/LONGSTAR/M4_LONGSTAR_4M/g
+s/NAMEF/M4_NAMEF_4M/g
+s/STRINGD/M4_STRINGD_4M/g
+s/STRINGF/M4_STRINGF_4M/g
+s/STRINGL/M4_STRINGL_4M/g
+s/STRINGX/M4_STRINGX_4M/g
+s/VOIDSTAR/M4_VOIDSTAR_4M/g
+s/changecom/M4_changecom_4M/g
+s/changequote/M4_changequote_4M/g
+s/decr/M4_decr_4M/g
+s/define/M4_define_4M/g
+s/defn/M4_defn_4M/g
+s/divert/M4_divert_4M/g
+s/divnum/M4_divnum_4M/g
+s/dnl/M4_dnl_4M/g
+s/dumpdef/M4_dumpdef_4M/g
+s/errprint/M4_errprint_4M/g
+s/eval/M4_eval_4M/g
+s/format/M4_format_4M/g
+s/ifdef/M4_ifdef_4M/g
+s/ifelse/M4_ifelse_4M/g
+s/include/M4_include_4M/g
+s/incr/M4_incr_4M/g
+s/index/M4_index_4M/g
+s/m4exit/M4_m4exit_4M/g
+s/m4wrap/M4_m4wrap_4M/g
+s/maketemp/M4_maketemp_4M/g
+s/popdef/M4_popdef_4M/g
+s/pushdef/M4_pushdef_4M/g
+s/shift/M4_shift_4M/g
+s/sinclude/M4_sinclude_4M/g
+s/substr/M4_substr_4M/g
+s/syscmd/M4_syscmd_4M/g
+s/sysval/M4_sysval_4M/g
+s/traceoff/M4_traceoff_4M/g
+s/traceon/M4_traceon_4M/g
+s/translit/M4_translit_4M/g
+s/undefine/M4_undefine_4M/g
+s/undivert/M4_undivert_4M/g
+s/unix/M4_unix_4M/g
+/^%\*/ {
+    d
+    b
+}
+/^\(%.*\)\/\*.*\*\/\(.*\)/s//\1\2/
+/^%[ 	]*\([a-zA-Z0-9_]*\)[ 	]*(/ {
+    s//M4__PROTO(`\1',/
+    b
+}
+/^%[ 	]*STRING[ 	]*\([a-zA-Z_][^ 	]*\).*$/ {
+    s//`STRING(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*string[ 	]*\([a-zA-Z_][^ 	]*\).*$/ {
+    s//`STRING(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*INTEGER[ 	]*[ 	]*\([A-Za-z_][^ 	]*\).*$/ {
+    s//`INTEGERSTAR(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*int[ 	]*\*[ 	]*\([A-Za-z_][^ 	]*\).*$/ {
+    s//`INTSTAR(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*long[ 	]*\*[ 	]*\([A-Za-z_][^ 	]*\).*$/ {
+    s//`LONGSTAR(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*REAL[ 	]*[ 	]*\([A-Za-z_][^ 	]*\).*$/ {
+    s//`FLOATSTAR(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*float[ 	]*\*[ 	]*\([A-Za-z_][^ 	]*\).*$/ {
+    s//`FLOATSTAR(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*DOUBLE[ 	]*[ 	]*\([A-Za-z_][^ 	]*\).*$/ {
+    s//`DOUBLESTAR(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*double[ 	]*\*[ 	]*\([A-Za-z_][^ 	]*\).*$/ {
+    s//`DOUBLESTAR(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*void[ 	]*\*[ 	]*\([A-Za-z_][^ 	]*\).*$/ {
+    s//`VOIDSTAR(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*char[ 	]*\*[ 	]*\([A-Za-z_][^ 	]*\).*$/ {
+    s//`CHARSTAR(\1)dnl'/
+    b cleanup
+}
+/^%[ 	]*{[ 	]*$/ {
+    s//{M4__LOCALS/
+    b
+}
+/^%[ 	]*\(.*\)$/s//\1/
+    b
+: cleanup
+    s/[ 	]*$//
+    s/,)/)/

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc2.sed
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc2.sed	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/fortc2.sed	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+s/M4_CHARSTAR_4M/CHARSTAR/g
+s/M4_DOUBLESTAR_4M/DOUBLESTAR/g
+s/M4_FLOATSTAR_4M/FLOATSTAR/g
+s/M4_INTEGERSTAR_4M/INTEGERSTAR/g
+s/M4_INTSTAR_4M/INTSTAR/g
+s/M4_NAMEF_4M/NAMEF/g
+s/M4_STRINGD_4M/STRINGD/g
+s/M4_STRINGF_4M/STRINGF/g
+s/M4_STRINGL_4M/STRINGL/g
+s/M4_STRINGX_4M/STRINGX/g
+s/M4_VOIDSTAR_4M/VOIDSTAR/g
+s/M4_changecom_4M/changecom/g
+s/M4_changequote_4M/changequote/g
+s/M4_decr_4M/decr/g
+s/M4_define_4M/define/g
+s/M4_defn_4M/defn/g
+s/M4_divert_4M/divert/g
+s/M4_divnum_4M/divnum/g
+s/M4_dnl_4M/dnl/g
+s/M4_dumpdef_4M/dumpdef/g
+s/M4_errprint_4M/errprint/g
+s/M4_eval_4M/eval/g
+s/M4_format_4M/format/g
+s/M4_ifdef_4M/ifdef/g
+s/M4_ifelse_4M/ifelse/g
+s/M4_include_4M/include/g
+s/M4_incr_4M/incr/g
+s/M4_index_4M/index/g
+s/M4_len_4M/len/g
+s/M4_m4exit_4M/m4exit/g
+s/M4_m4wrap_4M/m4wrap/g
+s/M4_maketemp_4M/maketemp/g
+s/M4_popdef_4M/popdef/g
+s/M4_pushdef_4M/pushdef/g
+s/M4_shift_4M/shift/g
+s/M4_sinclude_4M/sinclude/g
+s/M4_substr_4M/substr/g
+s/M4_syscmd_4M/syscmd/g
+s/M4_sysval_4M/sysval/g
+s/M4_traceoff_4M/traceoff/g
+s/M4_traceon_4M/traceon/g
+s/M4_translit_4M/translit/g
+s/M4_undefine_4M/undefine/g
+s/M4_undivert_4M/undivert/g
+s/M4_unix_4M/unix/g

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/freebsd.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/freebsd.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/freebsd.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Sun)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_')	# for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/ftest.lnk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/ftest.lnk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/ftest.lnk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+llibc7.lib oldnames.lib llibfor7.lib \hdf\hdf\lib\df.lib ..\xdr\xdr.lib ..\libsrc\netcdf.lib;

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/ftest.src
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/ftest.src	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/ftest.src	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1220 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest.src,v 1.3 1996/03/26 22:24:46 georgev Exp $
+c********************************************************************/
+
+M4__C_INTERFACE_DECLARATIONS
+
+c
+c     program to test the M4__SYSTEM Fortran jacket interface to the netCDF
+c
+      program ftest
+      
+F_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
+      LONG_INT 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)
+      end
+c
+c     subroutine to test ncacpy
+c
+      subroutine tncacpy(iname, oname)
+      character*31 iname, oname
+F_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)
+      LONG_INT lngval(2)
+      SHORT_INT shval(2)
+      integer i, j, k
+      character*31 varnam, attname(2,7), gattnam(2)
+      BYTE_INT bytval(2)
+      common /atts/attname, gattnam
+      SHORT_INT svalidrg(2)
+      real rvalidrg(2)
+      LONG_INT lvalidrg(2)
+      DOUBLE_PRECISION dvalidrg(2)
+      BYTE_INT 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
+F_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)
+F_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)
+      LONG_INT lngval(2)
+      SHORT_INT shval(2)
+      BYTE_INT bytval(2)
+      integer vartyp, nvdims, vdims(MAXVDIMS), nvatts
+
+      character*31 varnam, attname(2,7), gattnam(2)
+      common /atts/attname, gattnam
+      SHORT_INT svalidrg(2)
+      real rvalidrg(2)
+      LONG_INT lvalidrg(2)
+      DOUBLE_PRECISION dvalidrg(2)
+      BYTE_INT 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)
+F_INCLUDE(netcdf.inc)
+      integer ncid, iret
+
+c attribute vectors
+      SHORT_INT svalidrg(2)
+      real rvalidrg(2)
+      LONG_INT lvalidrg(2)
+      DOUBLE_PRECISION dvalidrg(2)
+      BYTE_INT 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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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      LONG_INT dimsiz(MAXNCDIM)
+      LONG_INT 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '0', 'longname', 'id',
+     + '0', '0'/
+      data gattnam/'source','basetime'/
+      end
+
+
+c
+c     subroutine to test ncddef
+c
+
+      subroutine tncddef(ncid)
+F_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
+      LONG_INT 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)
+F_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
+      LONG_INT recsiz
+c     loop control variables
+      integer i, j, k
+c     returned size of dimension
+      LONG_INT 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
+      LONG_INT 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)
+F_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)
+F_INCLUDE(netcdf.inc)
+      integer ncid
+
+c     function to define a netCDF variable
+      LONG_INT 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, 'shortv', 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)
+F_INCLUDE(netcdf.inc)
+      character*31 cdfname
+
+      integer ndims, times, lats, lons, levels, lenstr
+      parameter (times=4, lats=5, lons=5, levels=4)
+
+      LONG_INT start(MAXNCDIM), count(MAXNCDIM)
+      integer ncid, iret, i, m
+      integer  latdim, londim, leveldim, timedim, lendim
+      LONG_INT 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_INT barray(times), byval(times)
+      SHORT_INT sarray(times), shval(times)
+      LONG_INT 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)
+F_INCLUDE(netcdf.inc)
+      character*31 cdfname
+
+      integer ncid, iret
+      integer  latdim, londim, leveldim, timedim, lendim
+      LONG_INT dimsiz(MAXNCDIM)
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+
+      LONG_INT 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_INT bvalue
+      SHORT_INT svalue
+      LONG_INT 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 ncvgt
+     +1 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)
+F_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
+      LONG_INT 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
+      LONG_INT 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
+      LONG_INT count(MAXNCDIM)
+
+c     arrays of data values to be written
+      BYTE_INT barray(times)
+      SHORT_INT sarray(times)
+      LONG_INT 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)
+F_INCLUDE(netcdf.inc)
+      character*31 cdfname
+
+
+      integer iret, ncid
+      integer  latdim, londim, leveldim, timedim, lendim
+      LONG_INT dimsiz(MAXNCDIM)
+      common /dims/timedim, latdim, londim, leveldim, lendim, 
+     + dimsiz
+
+      LONG_INT bindx, sindx, lindx, findx(4), dindx(4), cindx
+
+      LONG_INT lvalue
+      SHORT_INT svalue
+      BYTE_INT 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/fujivp.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/fujivp.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/fujivp.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Sun)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_')	# for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/hdftest.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/hdftest.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/hdftest.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2529 @@
+C
+C     Testing the Fortran interface for the multiple SD routines
+C
+      program hdftest
+
+      implicit none
+
+      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 sfstart,  sfcreate,  sfendacc, sfend,    sfsfill
+      integer sfrdata,  sfwdata,   sfdimid,  sfsdmname
+      integer sffinfo,  sfn2index, sfsdmstr, sfsdtstr, sfsdscale
+      integer sfscal,   sfselect,  sfginfo,  sfgdinfo, sfgainfo
+      integer sffattr,  sfsrange,  sfgrange, sfgfill,  sfsflmd
+      integer sfgcal,   sfgdscale, sfgdtstr, sfgdmstr
+      integer sfid2ref, sfref2index, sfsdmvc, sfisdmvc
+      integer sfsextf,  hxsdir,    hxscdir
+      integer sfwcdata, sfrcdata,  sfscfill, sfgcfill
+      integer sfscatt,  sfrcatt,   sfsnatt,  sfrnatt
+      integer sfchempty
+      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_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_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
+         integer   sfstart, sfcreate, sfendacc, sfend,
+     .             sfn2index, sfselect,
+     .             sfsfill, sfschnk, sfscchnk, sfwchnk, 
+     .             sfgichnk, sfrchnk, sfwdata, sfrdata
+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    = 1,
+     .                skphuff_skp_size = 2,
+     .                nbit_sign_ext    = 0,
+     .                nbit_fill_one    = 0,
+     .                nbit_start_bit   = 0,
+     .                nbit_bit_len     = 31 )
+
+
+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
+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
+         integer   sfstart, sfcreate, sfendacc, sfend,
+     .             sfn2index, sfselect,
+     .             sfsfill, sfschnk, sfscchnk, sfwcchnk, 
+     .             sfgichnk, sfrcchnk, sfwcdata, sfrcdata
+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    = 1,
+     .                skphuff_skp_size = 2,
+     .                nbit_sign_ext    = 0,
+     .                nbit_fill_one    = 0,
+     .                nbit_start_bit   = 0,
+     .                nbit_bit_len     = 31 )
+
+
+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
+         integer   comp_arg(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
+         integer   sfstart, sfcreate, sfendacc, sfend,
+     .             sfn2index, sfselect,
+     .             sfsfill, sfrdata,
+     .             sfwdata, sfscompress
+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    = 1,
+     .                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   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
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/hdftst.sav
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/hdftst.sav	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/hdftst.sav	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/hpux.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/hpux.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/hpux.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,29 @@
+divert(-1)
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', HPUX)
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1')	# for HPUX, use same name
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+# extra arguments, if any, for string lengths
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+# FORTRAN syntax for including a file
+define(`M4__RIGHT_QUOTE',')
+define(`F_INCLUDE',`      `include' M4__RIGHT_QUOTE`'$1`'M4__RIGHT_QUOTE')
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/irix.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/irix.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/irix.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', IRIX)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_')	# for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/jackets.src
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/jackets.src	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/jackets.src	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2272 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets.src,v 1.9 1997/11/05 19:39:58 koziol Exp $ */
+%*
+%*  Meta-source for various versions of netCDF FORTRAN jacket library.
+%*
+%*  After minor preprocessing via a sed script, this file becomes source
+%*  to the m4 macro processor for a C library to be called from FORTRAN.
+%*  The main differences between this source and C are the way function
+%*  prototypes are declared.  All such declarations occur in lines beginning
+%*  with the "%" character.  A sed script converts these into calls to m4
+%*  macros for handling the various conventions for calling C functions from
+%*  FORTRAN.  Formal parameters corresponding to FORTRAN character strings
+%*  must be declared using the pseudo type "string".  Appending "len" to the
+%*  name of such variables is the convention used for variables representing
+%*  the FORTRAN length of string parameters.
+%*
+%*  For example, the following input
+%*  
+%*  % void
+%*  % ncadel (
+%*  %    int *cdfid,			/* netCDF ID */
+%*  %    int *varid,			/* variable ID */
+%*  %    string attname,		/* attribute name */
+%*  %    int *rcode			/* returned error code */
+%*  %    )
+%*  % {
+%*  
+%*  will be converted to the following m4 macro calls:
+%*  
+%*  void`'M4__dnl
+%*  M4__PROTO(`ncadel',
+%*  	`INTSTAR(cdfid)',
+%*  	`INTSTAR(varid)',
+%*  	`STRING(attname)',
+%*  	`INTSTAR(rcode)'
+%*  )
+%*  {M4__LOCALS
+%*  
+%*  which may be converted to the following C, using sun.m4 and common.m4
+%*
+%*  void
+%*  ncadel_ (cdfid, varid, attname, rcode, attnamelen)
+%*      int *cdfid;
+%*      int *varid;
+%*      char *attname;
+%*      int attnamelen;
+%*      int *rcode;
+%*  {
+%*
+/*
+ * 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 M4__SYSTEM.  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 */
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+#if !NC_OLD_FILLVALUES
+
+struct ncfils {			/* This will be a common block from Fortran */
+    double dd;
+#if defined __alpha || (_MIPS_SZLONG == 64)
+    int ll;
+#else
+    long ll;
+#endif
+    float ff;
+    short ss;
+    char cc;
+    char bb;
+} M4__STRUCT_FOR_COMMON(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)
+    int ll;
+#else
+    long ll;
+#endif
+    float ff;
+    short ss;
+    char cc;
+    char bb;
+} M4__STRUCT_FOR_COMMON(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 */
+
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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)
+/*
+ * Convert multi-dimensional array of NCLONGs stored in `int's to packed
+ * array of `long's, in malloc'ed space.  Returns pointer to `long's 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 `long's stored in `int's to 
+ * packed array of `long's, in malloc'ed space.  Returns pointer to `long's 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 `long's into a generalized multi-dimensional array
+ * of `int's.
+ */
+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 */
+
+/* ------------ M4__SYSTEM FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+% void
+% ncpopt (
+%	INTEGER val     /* NC_FATAL, NC_VERBOSE, or NC_FATAL|NC_VERBOSE */
+%       )
+% {
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+% void
+% ncgopt (
+%	INTEGER	val	/* NC_FATAL, NC_VERBOSE, or NC_FATAL|NC_VERBOSE */
+%       )
+% {
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+% int
+% nccre (
+%     STRING pathname,		/* file name of new netCDF file */
+%     INTEGER clobmode,		/* either NCCLOB or NCNOCLOB */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncopn (
+%     STRING pathname,		/* file name for netCDF to be opened */
+%     INTEGER rwmode,		/* either NCWRITE or NCNOWRIT */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncddef (
+%     INTEGER cdfid,		/* netCDF ID */
+%     STRING dimname,		/* dimension name */
+%     INTEGER dimlen,		/* size of dimension */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncdid (
+%     INTEGER cdfid,		/* netCDF ID */
+%     STRING dimname,		/* dimension name */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncvdef (
+%     INTEGER cdfid,		/* netCDF ID */
+%     STRING varname,		/* name of variable */
+%     INTEGER datatype,		/* netCDF datatype of variable */
+%     INTEGER ndims,		/* number of dimensions of variable */
+%     INTEGER dimarray,		/* array of ndims dimensions IDs */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncvid (
+%     INTEGER cdfid,		/* netCDF ID */
+%     STRING varname,		/* variable name */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% nctlen (
+%     INTEGER datatype,		/* netCDF datatype */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    int itype;
+
+    if ((itype = nctypelen ((nc_type) *datatype)) != -1) {
+	*rcode = 0;
+	return (itype);
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+
+/* closes an open netCDF file */
+% void
+% ncclos (
+%     INTEGER cdfid,			/* netCDF ID */
+%     INTEGER rcode			/* returned error code */
+%     )
+% {
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+% void
+% ncredf (
+%     INTEGER cdfid,			/* netCDF ID */
+%     INTEGER rcode			/* returned error code */
+%     )
+% {
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+% void
+% ncendf (
+%     INTEGER cdfid,			/* netCDF ID */
+%     INTEGER rcode			/* returned error code */
+%     )
+% {
+    *rcode = 0;
+    if (ncendef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* returns information about an open netCDF file given its netCDF ID */
+% void
+% ncinq (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER ndims,		/* returned number of dimensions */
+%     INTEGER nvars,		/* returned number of variables */
+%     INTEGER natts,		/* returned number of attributes */
+%     INTEGER recdim,		/* returned ID of the unlimited dimension */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    *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
+% ncsnc (
+%     INTEGER cdfid,			/* netCDF ID */
+%     INTEGER rcode			/* returned error code */
+%     )
+% {
+    *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
+% ncabor (
+%     INTEGER cdfid,			/* netCDF ID */
+%     INTEGER rcode			/* returned error code */
+%     )
+% {
+    *rcode = 0;
+    if (ncabort (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* returns the name and size of a dimension, given its ID */
+% void
+% ncdinq (
+%     INTEGER cdfid,			/* netCDF ID */
+%     INTEGER dimid,			/* dimension ID */
+%     STRING dimname,			/* returned dimension name */
+%     INTEGER size,			/* returned dimension size */
+%     INTEGER rcode			/* returned error code */
+%     )
+% {
+    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
+% ncdren (
+%     INTEGER cdfid,			/* netCDF ID */
+%     INTEGER dimid,			/* dimension ID */
+%     STRING dimname,			/* new name of dimension */
+%     INTEGER rcode			/* returned error code */
+%     )
+% {
+    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
+% ncvinq (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     STRING varname,		/* returned variable name */
+%     INTEGER datatype,		/* returned variable type */
+%     INTEGER ndims,		/* returned number of dimensions */
+%     INTEGER dimarray,		/* returned array of ndims dimension IDs */
+%     INTEGER natts,		/* returned number of attributes */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncvpt1 (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     INTEGER indices,		/* multidim index of data to be written */
+%     void *value,		/* pointer to data value to be written */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    int datatype, ndims, natts, i;
+    long nindices[MAX_VAR_DIMS];
+    int dimid[MAX_VAR_DIMS];
+#if defined __alpha || (_MIPS_SZLONG == 64)
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+#endif
+
+    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)
+#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
+% ncvp1c (
+%     INTEGER cdfid,	/* netCDF ID */
+%     INTEGER varid,	/* variable ID */
+%     INTEGER indices,	/* multidim. index of data value to be written */
+%     STRING chval,	/* data value to be written */
+%     INTEGER rcode	/* returned error code */
+%     )
+% {
+    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
+% ncvpt (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     INTEGER start,		/* multidimensional index of hypercube corner */
+%     INTEGER count,		/* multidimensional hypercube edge lengths */
+%     void *value,		/* block of data values to be written */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS], i;
+    int ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+#if defined __alpha || (_MIPS_SZLONG == 64)
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+#endif
+
+    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)
+#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
+% ncvptc (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     INTEGER start,		/* multidimensional index of hypercube corner */
+%     INTEGER count,		/* multidimensional hypercube edge lengths */
+%     STRING string,		/* block of data values to be written */
+%     INTEGER lenstr,		/* declared length of the data argument */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncvptg (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     INTEGER start,		/* multidimensional index of hypercube corner */
+%     INTEGER count,		/* multidimensional hypercube edge lengths */
+%     INTEGER stride,		/* netCDF variable access strides */
+%     INTEGER basis,		/* memory values access basis vector */
+%     void *value,		/* block of data values to be written */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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 defined __alpha || (_MIPS_SZLONG == 64)
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+#endif
+
+    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)
+    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)
+#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
+% ncvpgc (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     INTEGER start,		/* multidimensional index of hypercube corner */
+%     INTEGER count,		/* multidimensional hypercube edge lengths */
+%     INTEGER stride,		/* netCDF variable access strides */
+%     INTEGER basis,		/* memory values access basis vector */
+%     STRING string,		/* block of character values to be written */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncvgt1 (
+%     INTEGER cdfid,	/* netCDF ID */
+%     INTEGER varid,	/* variable ID */
+%     INTEGER indices,	/* multidimensional index of data values to be read */
+%     void *value,	/* pointer to location into which value is read */
+%     INTEGER rcode	/* returned error code */
+%     )
+% {
+    long nindices[MAX_VAR_DIMS], i;
+    int datatype, ndims, dimarray[MAX_VAR_DIMS], natts;
+#if defined __alpha || (_MIPS_SZLONG == 64)
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+#endif
+
+    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)
+#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
+% ncvg1c (
+%     INTEGER cdfid,	/* netCDF ID */
+%     INTEGER varid,	/* variable ID */
+%     INTEGER indices,	/* multidimensional index of data value to be read */
+%     STRING chval,	/* location into which data will be read */
+%     INTEGER rcode	/* returned error code */
+%     )
+% {
+    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
+% ncvgt (
+%     INTEGER cdfid,	/* netCDF ID */
+%     INTEGER varid,	/* variable ID */
+%     INTEGER start,	/* multidimensional index of the hypercube corner */
+%     INTEGER count,	/* multidimensional hypercube edge lengths */
+%     void *value,	/* locations into which the data will be read */
+%     INTEGER rcode	/* returned error code */
+%     )
+% {
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS];
+    int i, ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+#if defined __alpha || (_MIPS_SZLONG == 64)
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+#endif
+
+    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)
+#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));
+	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 */
+#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
+% ncvgtc (
+%     INTEGER cdfid,	/* netCDF ID */
+%     INTEGER varid,	/* variable ID */
+%     INTEGER start,	/* multidimensional index of hypercube corner */
+%     INTEGER count,	/* multidimensional hypercube edge lengths */
+%     STRING string,	/* character string for data values */
+%     INTEGER lenstr,	/* declared length of data argument */
+%     INTEGER rcode	/* returned error code */
+%     )
+% {
+    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
+% ncvgtg (
+%     INTEGER cdfid,	/* netCDF ID */
+%     INTEGER varid,	/* variable ID */
+%     INTEGER start,	/* multidimensional index of hypercube corner */
+%     INTEGER count,	/* multidimensional hypercube edge lengths */
+%     INTEGER stride,	/* netCDF variable access strides */
+%     INTEGER basis,	/* memory values access basis vectory */
+%     void *value,	/* locations into which data will be read */
+%     INTEGER rcode	/* returned error code */
+%     )
+% {
+    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 defined __alpha || (_MIPS_SZLONG == 64)
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+#endif
+
+    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)
+    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)
+#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
+% ncvggc (
+%     INTEGER cdfid,	/* netCDF ID */
+%     INTEGER varid,	/* variable ID */
+%     INTEGER start,	/* multidimensional index of hypercube corner */
+%     INTEGER count,	/* multidimensional hypercube edge lengths */
+%     INTEGER stride,	/* netCDF variable access strides */
+%     INTEGER basis,	/* memory values access basis vectory */
+%     STRING string,	/* locations into which data will be read */
+%     INTEGER rcode	/* returned error code */
+%     )
+% {
+    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
+% ncvren (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     STRING varname,		/* new name for variable */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncapt (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     STRING attname,		/* attribute name */
+%     INTEGER datatype,		/* attribute datatype */
+%     INTEGER attlen,		/* attribute length */
+%     void *value,		/* pointer to data values */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    char name[MAX_NC_NAME + 1];
+#if defined __alpha || (_MIPS_SZLONG == 64)
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+#endif
+
+    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)
+#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
+% ncaptc (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     STRING attname,		/* attribute name */
+%     INTEGER datatype,		/* attribute datatype */
+%     INTEGER lenstr,		/* length of data argument */
+%     STRING string,		/* character string value */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncainq (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     STRING attname,		/* returned attribute name */
+%     INTEGER datatype,		/* returned attribute datatype */
+%     INTEGER attlen,		/* returned attribute length */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncagt (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     STRING attname,		/* attribute name */
+%     void *value,		/* returned attribute values */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    char name[MAX_NC_NAME + 1];
+    int datatype;
+    int attlen;
+#if defined __alpha || (_MIPS_SZLONG == 64)
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+#endif
+
+    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)
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	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 */
+#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
+% ncagtc (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     STRING attname,		/* attribute name */
+%     STRING string,		/* returned attribute value */
+%     INTEGER lenstr,		/* length of string argument */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncacpy (
+%     INTEGER incdfid,	/* input netCDF ID */
+%     INTEGER invarid,	/* variable ID of input netCDF or NC_GLOBAL */
+%     STRING attname,	/* name of attribute in input netCDF to be copied */
+%     INTEGER outcdfid,	/* ID of output netCDF file for attribute */
+%     INTEGER outvarid,	/* ID of associated netCDF variable or NC_GLOBAL */
+%     INTEGER rcode	/* returned error code */
+%     )
+% {
+    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
+% ncanam (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     INTEGER attnum,		/* attribute number */
+%     STRING attname,		/* returned attribute name */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncaren (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     STRING attname,		/* attribute name */
+%     STRING newname,		/* new name */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncadel (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER varid,		/* variable ID */
+%     STRING attname,		/* attribute name */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    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
+% ncsfil (
+%     INTEGER cdfid,		/* netCDF ID */
+%     INTEGER fillmode,		/* fill mode, NCNOFILL or NCFILL */
+%     INTEGER rcode		/* returned error code */
+%     )
+% {
+    int retval;
+
+    if ((retval = ncsetfill (*cdfid, *fillmode)) != -1) {
+	*rcode = 0;
+	return retval;
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/mfsdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/mfsdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/mfsdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1934 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.35 $";
+#endif
+
+/* $Id: mfsdf.c,v 1.35 1999/03/27 22:57:18 epourmal Exp $ */
+
+/*
+
+  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
+
+*/
+
+#ifdef HDF
+#include "mfhdf.h"
+
+#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 */
+
+/*-----------------------------------------------------------------------------
+ * 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;
+     int *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. This causes problems on VMS and T3D.
+ *--------------------------------------------------------------------*/
+
+   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 PROTOTYPEi
+       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
+ * 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;
+
+       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_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
+       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     */
+    int32 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;
+
+       default:
+
+          return FAIL;
+                    
+                     }
+
+    ret = SDsetcompress(sdsid, c_type, &c_info);
+    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);
+}   

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/mfsdff.f
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/mfsdff.f	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/mfsdff.f	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,578 @@
+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: mfsdff.f,v 1.10 1999/03/27 22:57:17 epourmal Exp $
+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 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_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        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_prm - compression parameter array:
+C                   comp_prm(1) = deflate_level for GZIP
+C                   comp_prm(1) = skphuff_skp_size for ADAPTIVE HUFFMAN
+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:      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
+           

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/NOTES
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/NOTES	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/NOTES	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,15 @@
+This distribution and Makefiles have been tested on PCDOS 3.3, PCDOS 4.01,
+OS/2 1.2, OS/2 1.3, using Microsoft C 6.0 and Microsoft Fortran 5.0.
+
+Using the msoft.mk makefile in the parent of this directory.  It will copy
+the needed files from this directory.  Expect and ignore Fortran warnings
+and error messages such as
+
+ ftest.for(110) : warning F4999: NCTLEN : variable declared but not used
+  ...
+ ftest.for(185) : error F3606: NCAGT : formal argument VALUE : type mismatch
+ ftest.for(185) : error F3607: NCAGT : formal argument VALUE : length mismatch
+  ... 
+
+fslen.asm is an assembler routine needed to help find the length of
+FORTRAN character*(*) variables from a C routine they are passed into.

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/fslen.asm
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/fslen.asm	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/fslen.asm	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,36 @@
+FSLEN	SEGMENT  BYTE PUBLIC 'CODE'
+FSLEN	ENDS
+_DATA	SEGMENT  WORD PUBLIC 'DATA'
+_DATA	ENDS
+CONST	SEGMENT  WORD PUBLIC 'CONST'
+CONST	ENDS
+_BSS	SEGMENT  WORD PUBLIC 'BSS'
+_BSS	ENDS
+DGROUP	GROUP	CONST, _BSS, _DATA
+	ASSUME  CS: FSLEN, DS: DGROUP, SS: DGROUP, ES: DGROUP
+
+EXTRN	__FCclenv:DWORD
+
+FSLEN   SEGMENT
+		PUBLIC	_fslen
+_fslen	PROC FAR
+		push	bp
+		mov		bp,sp
+
+		shl 	WORD PTR [bp+6],1		; desired string # multiplied by 2
+		mov		ax,WORD PTR __FCclenv
+		mov		dx,WORD PTR __FCclenv+2
+		mov		WORD PTR [bp-4],ax
+		mov		WORD PTR [bp-2],dx
+		les		bx,DWORD PTR [bp-4]
+		add		bx,WORD PTR [bp+6]		; offset address of string 'n'
+		mov		ax,WORD PTR es:[bx]		; length of string
+		cwd
+
+		mov		sp,bp
+		pop		bp
+		ret
+
+_fslen	ENDP
+FSLEN	ENDS
+		END

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/ftest.for
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/ftest.for	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/ftest.for	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1215 @@
+c********************************************************************
+c   Copyright 1989, University Corporation for Atmospheric Research
+c   See netcdf/README file for copying and redistribution conditions.
+c   $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/fortran/msoft/ftest.for,v 1.1 1993/04/21 21:49:16 chouck Exp $
+c********************************************************************/
+
+$include: "msoft.int"
+
+
+c
+c     program to test the MICROSOFT 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 cdfid
+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*4 dimsiz(MAXNCDIM)
+C      allowable roundoff 
+      real epsilon
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+      data name/'test.cdf'/
+      data name2/'copy.cdf'/
+      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.cdf'
+      write(*,100) 'nccre'
+      cdfid = nccre(name, NCCLOB, iret)
+
+c     test ncddef
+      write(*,100) 'ncddef'
+      call tncddef(cdfid)
+
+c     test ncvdef
+      write(*,100) 'ncvdef'
+      call tncvdef(cdfid)
+
+c     test ncapt
+      write(*, 100) 'ncapt, ncaptc'
+      call tncapt(cdfid)
+
+c     close 'test.cdf'
+      write(*, 100) 'ncclos'
+      call ncclos(cdfid, 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)
+      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*4 lngval(2)
+      integer*2 shval(2)
+      integer i, j, k
+      character*31 varnam, attname(2,7), gattnam(2)
+      integer*1 bytval(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer*4 lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 bvalidrg(2)
+      character*31 gavalue(2), cavalue(2)
+      real epsilon
+
+      data bvalidrg/1,250/
+      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 cdfid, iret, i, j
+      integer ndims, nvars, natts, recdim
+      integer vartyp, nvdims, vdims(MAXVDIMS), nvatts
+      character*31 varnam, attnam
+
+      cdfid = ncopn(cdfname, NCWRITE, iret)
+c     put cdf in define mode
+      call ncredf (cdfid,iret)
+c     get number of global attributes
+      call ncinq (cdfid, ndims, nvars, natts, recdim, iret)
+      do 10 i = natts, 1, -1
+c     get name of global attribute
+         call ncanam (cdfid, NCGLOBAL, i, attnam, iret)
+c     delete global attribute
+         call ncadel (cdfid, NCGLOBAL, attnam, iret)
+ 10   continue
+
+      do 100 i = 1, nvars
+c     get number of variable attributes
+         call ncvinq (cdfid, i, varnam, vartyp, nvdims, vdims,
+     +        nvatts, iret)
+         do 200 j = nvatts, 1, -1
+            call ncanam (cdfid, i, j, attnam, iret)
+            call ncadel (cdfid, i, attnam, iret)
+ 200     continue
+ 100  continue
+      call ncinq (cdfid, ndims, nvars, natts, recdim, iret)
+      if (natts .ne. 0) write(*,*) 'error in ncadel'
+c     put netCDF into data mode
+      call ncendf (cdfid, iret)
+      call ncclos (cdfid, 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 cdfid, 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*4 lngval(2)
+      integer*2 shval(2)
+      integer*1 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*4 lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 bvalidrg(2)
+      character*31 gavalue(2), cavalue(2)
+      real epsilon
+
+      data bvalidrg/1,250/
+      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/
+      
+      cdfid = ncopn (cdfname, NCNOWRIT, iret)
+      call ncinq (cdfid, ndims, nvars, natts, recdim, iret)
+c     
+c     get global attributes first
+c     
+      do 10 i = 1, natts
+c     get name of attribute
+         call ncanam (cdfid, NCGLOBAL, i, attnam, iret)
+c     get attribute type and length
+         call ncainq (cdfid, 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 (cdfid, NCBYTE, attnam, bytval, iret)
+         else if (attype .eq. NCCHAR) then
+            call ncagtc (cdfid, 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 (cdfid, NCGLOBAL, attnam, shval, iret) 
+         else if (attype .eq. NCLONG) then
+            call ncagt (cdfid, NCGLOBAL, attnam, lngval, iret)            
+         else if (attype .eq. NCFLOAT) then
+            call ncagt (cdfid, NCGLOBAL, attnam, flval, iret)
+         else 
+            call ncagt (cdfid, NCGLOBAL, attnam, doubval,iret)          
+         end if
+ 10   continue
+
+c
+c     get variable attributes
+c
+      do 20 i = 1, nvars
+         call ncvinq (cdfid, i, varnam, vartyp, nvdims, vdims,
+     +                nvatts, iret)
+         do 25 j = 1, nvatts
+            call ncanam (cdfid, i, j, attnam, iret)
+            call ncainq (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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(cdfid, iret)
+      return
+      end
+c
+c     subroutine to test ncapt
+c
+      subroutine tncapt (cdfid)
+$include: "netcdf.inc"
+      integer cdfid, iret
+
+c attribute vectors
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer*4 lvalidrg(2)
+      double precision dvalidrg(2)
+      integer*1 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) = 250
+      call ncapt (cdfid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (cdfid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (cdfid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (cdfid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (cdfid, did, 'validrange', NCDOUBLE, 2,
+     +dvalidrg, iret)
+
+c
+c     global
+c
+
+      call ncaptc (cdfid, NCGLOBAL, 'source', NCCHAR, 3, 
+     +'NWS', iret)
+      call ncaptc (cdfid, NCGLOBAL, 'basetime', NCCHAR, 17, 
+     +'88/10/25 12:00:00', iret)
+
+c
+c     char
+c
+
+      call ncaptc (cdfid, chid, 'longname', NCCHAR, 11,
+     +'test string', iret)
+
+      call ncaptc (cdfid, chid, 'id', NCCHAR, 1,
+     +'a', iret)
+
+      return
+      end
+
+c
+c     initialize variables in labelled common blocks
+c
+      block data
+$include: "netcdf.inc"
+      common /cdims/ dimnam
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+      common /varn/varnam
+      common /atts/attname, gattnam
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer*4 dimsiz(MAXNCDIM)
+      character*31 dimnam(MAXNCDIM)
+      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/'byte', 'short', 'long', 'float', 'double', 'ch', 'c'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '0', 'longname', 'id',
+     + '0', '0'/
+      data gattnam/'source','basetime'/
+      end
+
+
+c
+c     subroutine to test ncddef
+c
+
+      subroutine tncddef(cdfid)
+$include: "netcdf.inc"
+      integer cdfid
+
+c     sizes of dimensions of 'test.cdf' and 'copy.cdf'
+      integer  ndims
+      parameter(ndims=5)
+c dimension ids
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer iret
+c     function to define a netCDF dimension
+      integer*4 dimsiz(MAXNCDIM)
+      character*31 dimnam(MAXNCDIM)
+      
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+      common /cdims/ dimnam
+
+c define dimensions
+      timedim = ncddef(cdfid, dimnam(1), NCUNLIM, iret)
+      latdim = ncddef(cdfid, dimnam(2), dimsiz(2), iret)
+      londim = ncddef(cdfid, dimnam(3), dimsiz(3), iret)
+      leveldim = ncddef(cdfid, dimnam(4), dimsiz(4), iret)
+      lendim = ncddef(cdfid, 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 cdfid
+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*4 recsiz
+c     loop control variables
+      integer i, j, k
+c     returned size of dimension
+      integer*4 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*4 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/
+
+      cdfid = ncopn (cdfname, NCNOWRIT, iret)
+      call ncinq (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, i, vname, vartyp, nvdims,
+     +        vdims, nvatts, iret)
+         if (vname .ne. varnam(i)) write(*,*) 'error in ncvinq or
+     + ncvdef'
+         if (vartyp .ne. vtyp(i)) write(*,*) 'error in ncvinq or
+     + ncvdef'
+         if (nvdims .ne. vndims(i)) write(*,*) 'error in ncvinq or
+     + ncvdef'
+         do 35 j = 1, nvdims
+            if (vdims(j) .ne. vdlist(j,i)) write(*,*) 'error in
+     + ncvinq or ncvdef'
+ 35      continue
+         if (nvatts .ne. vnatts(i)) write(*,*) 'error in ncvinq or
+     + ncvdef'
+c
+c     attributes
+c
+         do 45 k = 1, nvatts
+            call ncanam (cdfid, i, k, attnam, iret)
+            call ncainq (cdfid, 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 (cdfid, NCGLOBAL, i, attnam, iret)
+         call ncainq (cdfid, 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(cdfid, 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 cdfid, iret, latid, varid
+
+      dimnam(2) = 'latitude'
+      varnam(4) = 'real'
+      attname(1,6) = 'stringname'
+      gattnam(1) = 'agency'
+      cdfid = ncopn(cdfname, NCWRITE, iret)
+      call ncredf(cdfid, iret)
+      latid = ncdid(cdfid, 'lat', iret)
+      call ncdren(cdfid, latid, 'latitude', iret)
+      varid = ncvid(cdfid, 'float', iret)
+      call ncvren(cdfid, varid, 'real', iret)
+      varid = ncvid(cdfid, 'ch', iret)
+      call ncaren(cdfid, varid, 'longname', 'stringname', iret)
+      call ncaren(cdfid, NCGLOBAL, 'source', 'agency', iret)
+      call ncendf(cdfid, iret)
+      call ncclos(cdfid, iret)
+      return
+      end
+c     
+c     subroutine to test ncvdef
+c
+
+      subroutine tncvdef(cdfid)
+$include: "netcdf.inc"
+      integer cdfid
+
+c     function to define a netCDF variable
+      integer*4 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(cdfid, 'byte', NCBYTE, 1, bdims, iret)
+c
+c     short
+c
+      sdims(1) = timedim
+      sid = ncvdef (cdfid, 'short', NCSHORT, 1, sdims, iret)
+c
+c     long
+c
+      ldims(1) = latdim
+      lid = ncvdef (cdfid, 'long', NCLONG, 1, ldims, iret)
+c
+c     float
+c
+      fdims(4) = timedim
+      fdims(1) = leveldim
+      fdims(2) = londim
+      fdims(3) = latdim
+      fid = ncvdef (cdfid, 'float', NCFLOAT, 4, fdims, iret)
+c
+c     double
+c
+      ddims(4) = timedim
+      ddims(1) = leveldim
+      ddims(2) = londim
+      ddims(3) = latdim
+      did = ncvdef (cdfid, 'double', NCDOUBLE, 4, ddims, iret)
+c
+c     char
+c
+      chdims(2) = timedim
+      chdims(1) = lendim
+      chid = ncvdef (cdfid, 'ch', NCCHAR, 2, chdims, iret)
+
+      cdims(1) = timedim
+      cid = ncvdef (cdfid, 'c', 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*4 start(MAXNCDIM), count(MAXNCDIM)
+      integer cdfid, iret, i, m
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer*4 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
+      integer*1 barray(times), byval(times)
+      integer*2 sarray(times), shval(times)
+      integer*4 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/
+
+      cdfid = ncopn (cdfname, NCWRITE, iret)
+c     get number of variables in netCDF
+      call ncinq (cdfid, 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 (cdfid, m, varnam, vartyp, nvdims, vdims,
+     +                nvatts, iret)
+         if (vartyp .eq. NCBYTE) then
+c
+c     byte
+c
+            count(1) = times
+            call ncvgt (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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(cdfid, iret)
+      return
+      end
+
+      
+      subroutine tncvgt1(cdfname)
+$include: "netcdf.inc"
+      character*31 cdfname
+
+      integer cdfid, iret
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer*4 dimsiz(MAXNCDIM)
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+
+      integer*4 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
+
+      integer*1 bvalue
+      integer*2 svalue
+      integer*4 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/
+      
+      cdfid = ncopn (cdfname, NCNOWRIT, iret)
+c
+c     test ncvgt1 for byte
+c
+      call ncvgt1 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, fid, findx, fvalue, iret)
+      if (abs(fvalue - 3.14159) .gt. epsilon) write(*,*) 'error in ncvgt
+     +1 float:', fvalue, ' not close to', 3.14159
+c
+c     test ncvgt1 for double
+c
+      call ncvgt1 (cdfid, 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 (cdfid, cid, cindx, c, iret)
+      if (c .ne. 'a') write(*,*) 'error in ncvg1c'
+      call ncclos(cdfid, 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 cdfid, iret
+c     loop control variables
+      integer itime, ilev, ilon, ilat, i
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer*4 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*4 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*4 count(MAXNCDIM)
+
+c     arrays of data values to be written
+      integer*1 barray(times)
+      integer*2 sarray(times)
+      integer*4 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/
+
+      cdfid = ncopn (cdfname, NCWRITE, iret)
+
+c
+c     byte
+c
+      count(1) = times
+      call ncvpt (cdfid, bid, start, count, barray, iret)
+c
+c     short
+c
+      count(1) = times
+      call ncvpt (cdfid, sid, start, count, sarray, iret)
+c
+c     long
+c
+      do 30 i = 1,lats
+         larray(i) = 1000
+ 30   continue
+      count(1) = lats
+      call ncvpt (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, chid,start, count, string, lenstr, iret)
+      call ncclos(cdfid, iret)
+      return
+      end
+
+      
+      subroutine tncvpt1(cdfname)
+$include: "netcdf.inc"
+      character*31 cdfname
+
+
+      integer iret, cdfid
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer*4 dimsiz(MAXNCDIM)
+      common /dims/timedim, latdim, londim, leveldim, lendim, 
+     + dimsiz
+
+      integer*4 bindx, sindx, lindx, findx(4), dindx(4), cindx
+
+      integer*4 lvalue
+      integer*2 svalue
+      integer*1 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')
+      
+      cdfid = ncopn (cdfname, NCWRITE, iret)
+c
+c     test ncvpt1 for byte
+c
+      call ncvpt1 (cdfid, bid, bindx, bvalue, iret)
+c
+c     test ncvpt1 for short
+c
+      call ncvpt1 (cdfid, sid, sindx, svalue, iret)
+c     
+c     test ncvpt1 for long
+c
+      call ncvpt1 (cdfid, lid, lindx, lvalue, iret)
+c
+c     test ncvpt1 for float
+c
+      call ncvpt1 (cdfid, fid, findx, 3.14159, iret)
+c
+c     test ncvpt1 for double
+c
+      call ncvpt1 (cdfid, did, dindx, onethird, iret)
+c
+c     test ncvp1c for char
+c
+      call ncvp1c (cdfid, cid, cindx, 'a', iret)
+      call ncclos(cdfid, iret)
+      return
+      end

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/jackets.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/jackets.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/jackets.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1264 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/README file for copying and redistribution conditions.
+ */
+/* $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/fortran/msoft/jackets.c,v 1.1 1993/04/21 21:49:17 chouck Exp $ */
+/*
+ * 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 MICROSOFT.  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	"netcdf.h"
+#include	<ctype.h>
+#include        <string.h>
+#include	<stdio.h>
+
+extern long fslen(int); /* returns declared fortran string length of nth arg */
+
+
+
+
+extern char *
+malloc ();
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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 */
+{
+    extern void NCadvise();
+    extern char *cdf_routine_name; /* routine name in error messages */
+
+    cdf_routine_name = pname;
+    (void) 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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;
+}
+#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;
+}
+#endif /* FORTRAN_HAS_NO_SHORT */
+
+/* ------------ MICROSOFT FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+int
+ncpopt(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+int
+ncgopt(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre(pathname, clobmode, rcode)
+    char *pathname;	
+    int		*clobmode;	
+    int		*rcode;	
+{
+    int pathnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+    int cdfid;
+
+    (void) 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
+ncopn(pathname, rwmode, rcode)
+    char *pathname;	
+    int		*rwmode;	
+    int		*rcode;	
+{
+    int pathnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+    int cdfid;
+
+    (void) 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
+ncddef(cdfid, dimname, dimlen, rcode)
+    int		*cdfid;	
+    char *dimname;	
+    long		*dimlen;	
+    int		*rcode;	
+{
+    int dimnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+    int dimid;
+
+    (void) nstrncpy (name, dimname, dimnamelen);
+    if ((dimid = ncdimdef (*cdfid, name, *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
+ncdid(cdfid, dimname, rcode)
+    int		*cdfid;	
+    char *dimname;	
+    int		*rcode;	
+{
+    int dimnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+    int dimid;
+
+    (void) 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
+ncvdef(cdfid, varname, datatype, ndims, dimarray, rcode)
+    int		*cdfid;	
+    char *varname;	
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*rcode;	
+{
+    int varnamelen = fslen(1);
+    int varid, i, dimid[MAX_VAR_DIMS];
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncvid(cdfid, varname, rcode)
+    int		*cdfid;	
+    char *varname;	
+    int		*rcode;	
+{
+    int varnamelen = fslen(1);
+    int varid;
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+nctlen(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
+ncclos(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf(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
+ncinq(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
+ncsnc(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
+ncabor(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
+ncdinq(cdfid, dimid, dimname, size, rcode)
+    int		*cdfid;	
+    int		*dimid;	
+    char *dimname;	
+    long		*size;	
+    int		*rcode;	
+{
+    int dimnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+
+    *rcode = 0;
+    if (ncdiminq (*cdfid, *dimid - 1, name, size) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    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
+ncdren(cdfid, dimid, dimname, rcode)
+    int		*cdfid;	
+    int		*dimid;	
+    char *dimname;	
+    int		*rcode;	
+{
+    int dimnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncvinq(cdfid, varid, varname, datatype, ndims, dimarray, natts, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    char *varname;	
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*natts;	
+    int		*rcode;	
+{
+    int varnamelen = fslen(1);
+    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
+ncvpt1(cdfid, varid, indices, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*indices;	
+    void	*value;	
+    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;
+#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 (ncvarput1 (*cdfid, *varid - 1, nindices, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* puts a single character into an open netCDF file */
+void
+ncvp1c(cdfid, varid, indices, chval, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*indices;	
+    char *chval;	
+    int		*rcode;	
+{
+    int chvallen = fslen(1);
+    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
+ncvpt(cdfid, varid, start, count, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*start;	
+    long		*count;	
+    void	*value;	
+    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);
+
+    *rcode = 0;
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) datatype == NC_BYTE) {	/* pack ints into bytes */
+	char *bytes = itob (value, count, 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, count, 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 (ncvarput (*cdfid, *varid - 1, nstart, ncount, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* writes a hypercube of character values into an open netCDF file */
+void
+ncvptc(cdfid, varid, start, count, string, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*start;	
+    long		*count;	
+    char *string;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    int stringlen = fslen(1);
+    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;
+    }
+    if (dimprod(count,ndims) > *lenstr) {
+	*rcode = NC_ESTS;
+	handle_err ("NCVPTC", *rcode);
+	return;
+    }
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+    *rcode = 0;
+    if (ncvarput (*cdfid, *varid - 1, nstart, ncount, (ncvoid *) string) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* gets a single numeric value from a variable of an open netCDF file */
+void
+ncvgt1(cdfid, varid, indices, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*indices;	
+    void	*value;	
+    int		*rcode;	
+{
+    long nindices[MAX_VAR_DIMS], i;
+    int 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;
+#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 (ncvarget1 (*cdfid, *varid - 1, nindices, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets a single character data value from a variable of an open
+ * netCDF file
+ */
+void
+ncvg1c(cdfid, varid, indices, chval, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*indices;	
+    char *chval;	
+    int		*rcode;	
+{
+    int chvallen = fslen(1);
+    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
+ncvgt(cdfid, varid, start, count, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*start;	
+    long		*count;	
+    void	*value;	
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS];
+    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;
+    }
+    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 (count, 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 (count, 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 (ncvarget (*cdfid, *varid - 1, nstart, ncount, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* reads a hypercube of character values from a netCDF variable */
+void
+ncvgtc(cdfid, varid, start, count, string, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*start;	
+    long		*count;	
+    char *string;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    int stringlen = fslen(1);
+    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] = ' ';
+}
+
+/* changes the name of a netCDF variable in an open netCDF file */
+void
+ncvren(cdfid, varid, varname, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    char *varname;	
+    int		*rcode;	
+{
+    int varnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncapt(cdfid, varid, attname, datatype, attlen, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    char *attname;	
+    int		*datatype;	
+    int		*attlen;	
+    void	*value;	
+    int		*rcode;	
+{
+    int attnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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 (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
+ncaptc(cdfid, varid, attname, datatype, lenstr, string, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    char *attname;	
+    int		*datatype;	
+    int		*lenstr;	
+    char *string;	
+    int		*rcode;	
+{
+    int attnamelen = fslen(1);
+    int stringlen = fslen(2);
+    char name[MAX_NC_NAME + 1];
+    char *value;
+
+    (void) 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
+ncainq(cdfid, varid, attname, datatype, attlen, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    char *attname;	
+    int		*datatype;	
+    int		*attlen;	
+    int		*rcode;	
+{
+    int attnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncagt(cdfid, varid, attname, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    char *attname;	
+    void	*value;	
+    int		*rcode;	
+{
+    int attnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+#if defined(FORTRAN_HAS_NO_BYTE) || defined(FORTRAN_HAS_NO_SHORT)
+    int datatype;
+    int attlen;
+#endif
+
+    (void) nstrncpy (name, attname, attnamelen);
+    *rcode = 0;
+#if defined(FORTRAN_HAS_NO_BYTE) || defined(FORTRAN_HAS_NO_SHORT)
+    if (ncattinq (*cdfid, *varid - 1, name, (nc_type *) &datatype, &attlen) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+#endif
+#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 (ncattget (*cdfid, *varid - 1, name, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets the value of a netCDF character attribute given its variable
+ * ID and name
+ */
+void
+ncagtc(cdfid, varid, attname, string, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    char *attname;	
+    char *string;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    int attnamelen = fslen(1);
+    int stringlen = fslen(2);
+    char name[MAX_NC_NAME + 1];
+    int datatype;
+    int attlen;
+    int i;
+
+    (void) 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
+ncacpy(incdfid, invarid, attname, outcdfid, outvarid, rcode)
+    int		*incdfid;	
+    int		*invarid;	
+    char *attname;	
+    int		*outcdfid;	
+    int		*outvarid;	
+    int		*rcode;	
+{
+    int attnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncanam(cdfid, varid, attnum, attname, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*attnum;	
+    char *attname;	
+    int		*rcode;	
+{
+    int attnamelen = fslen(1);
+    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
+ncaren(cdfid, varid, attname, newname, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    char *attname;	
+    char *newname;	
+    int		*rcode;	
+{
+    int attnamelen = fslen(1);
+    int newnamelen = fslen(2);
+    char name[MAX_NC_NAME + 1], nname[MAX_NC_NAME + 1];
+
+    (void) nstrncpy (name, attname, attnamelen);
+    (void) 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
+ncadel(cdfid, varid, attname, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    char *attname;	
+    int		*rcode;	
+{
+    int attnamelen = fslen(1);
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncsfil(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/msoft.int
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/msoft.int	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/msoft.int	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,311 @@
+$STORAGE:2
+      INTERFACE TO INTEGER FUNCTION NCCRE [C]
+     $     (PATHNAME,CLOBMODE, rcode)
+      CHARACTER*1 PATHNAME [REFERENCE]
+      INTEGER CLOBMODE [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO INTEGER FUNCTION NCOPN [C]
+     $     (PATHNAME,RWMODE, rcode)
+      CHARACTER*1 PATHNAME [REFERENCE]
+      INTEGER RWMODE [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCREDF [C]
+     $     (CDFID, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCENDF [C]
+     $     (CDFID, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCCLOS [C]
+     $     (CDFID, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCINQ [C]
+     $     (CDFID, ndims,nvars,natts,recdim,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER ndims [REFERENCE]
+      INTEGER nvars [REFERENCE]
+      INTEGER natts [REFERENCE]
+      INTEGER recdim [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCSNC [C]
+     $     (CDFID, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCABOR [C]
+     $     (CDFID, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO INTEGER FUNCTION NCDDEF [C]
+     $     (CDFID,DIMNAME,SIZE, rcode)
+      INTEGER CDFID [REFERENCE]
+      CHARACTER*1 DIMNAME [REFERENCE]
+      INTEGER*4 SIZE [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO INTEGER FUNCTION NCDID [C]
+     $     (CDFID,DIMNAME, rcode)
+      INTEGER CDFID [REFERENCE]
+      CHARACTER*1 DIMNAME [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCDINQ [C]
+     $     (CDFID,DIMID, dimname,size,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER DIMID [REFERENCE]
+      CHARACTER*1 dimname [REFERENCE]
+      INTEGER*4 size [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCDREN [C]
+     $     (CDFID,DIMID,DIMNAME, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER DIMID [REFERENCE]
+      CHARACTER*1 DIMNAME [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO INTEGER FUNCTION NCVDEF [C]
+     $     (CDFID,VARNAME,DATATYPE,NVDIMS,VDIMS, rcode)
+      INTEGER CDFID [REFERENCE]
+      CHARACTER*1 VARNAME [REFERENCE]
+      INTEGER DATATYPE [REFERENCE]
+      INTEGER NVDIMS [REFERENCE]
+      INTEGER VDIMS [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO INTEGER FUNCTION NCVID [C]
+     $     (CDFID,VARNAME, rcode)
+      INTEGER CDFID [REFERENCE]
+      CHARACTER*1 VARNAME [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVINQ [C]
+     $     (CDFID,VARID, varname,datatype,nvdims,vdims,nvatts,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      CHARACTER*1 varname [REFERENCE]
+      INTEGER datatype [REFERENCE]
+      INTEGER nvdims [REFERENCE]
+      INTEGER vdims [REFERENCE]
+      INTEGER nvatts [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVPT1 [C]
+     $     (CDFID,VARID,INDICES,VALUE,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      INTEGER*4 INDICES [REFERENCE]
+      REAL VALUE [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVP1C [C]
+     $     (CDFID,VARID,INDICES, CHVAL,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      INTEGER*4 INDICES [REFERENCE]
+      CHARACTER*1 CHVAL [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVGT1 [C]
+     $     (CDFID,VARID,INDICES, value,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      INTEGER*4 INDICES [REFERENCE]
+      REAL value [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVG1C [C]
+     $     (CDFID,VARID,INDICES, chval,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      INTEGER*4 INDICES [REFERENCE]
+      CHARACTER*1 CHVAL [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVPT [C]
+     $     (CDFID,VARID,START,COUNTS,VALUE,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      INTEGER*4 START [REFERENCE]
+      INTEGER*4 COUNTS [REFERENCE]
+      REAL VALUE [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVPTC [C]
+     $     (CDFID,VARID,START,COUNTS,STRING,LENSTR, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      INTEGER*4 START [REFERENCE]
+      INTEGER*4 COUNTS [REFERENCE]
+      CHARACTER*1 STRING [REFERENCE]
+      INTEGER LENSTR [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVGT [C]
+     $     (CDFID,VARID,START,COUNTS, value,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      INTEGER*4 START [REFERENCE]
+      INTEGER*4 COUNTS [REFERENCE]
+      REAL value [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVGTC [C]
+     $     (CDFID,VARID,START,COUNTS,string,LENSTR,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      INTEGER*4 START [REFERENCE]
+      INTEGER*4 COUNTS [REFERENCE]
+      CHARACTER*1 string [REFERENCE]
+      INTEGER LENSTR [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCVREN [C]
+     $     (CDFID,VARID,VARNAME, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      CHARACTER*1 VARNAME [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCAPT [C]
+     $     (CDFID,VARID,ATTNAME,DATATYPE,ATTLEN,VALUE, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      CHARACTER*1 ATTNAME [REFERENCE]
+      INTEGER DATATYPE [REFERENCE]
+      INTEGER ATTLEN [REFERENCE]
+      REAL VALUE [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCAPTC [C]
+     $     (CDFID,VARID,ATTNAME,DATATYPE,LENSTR,STRING, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      CHARACTER*1 ATTNAME [REFERENCE]
+      INTEGER DATATYPE [REFERENCE]
+      INTEGER LENSTR [REFERENCE]
+      CHARACTER*1 STRING [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCAINQ [C]
+     $     (CDFID,VARID,ATTNAME, datatype,attlen,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      CHARACTER*1 ATTNAME [REFERENCE]
+      INTEGER datatype [REFERENCE]
+      INTEGER attlen [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCAGT [C]
+     $     (CDFID,VARID,ATTNAME, value,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      CHARACTER*1 ATTNAME [REFERENCE]
+      REAL value [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCAGTC [C]
+     $     (CDFID,VARID,ATTNAME, string,LENSTR,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      CHARACTER*1 ATTNAME [REFERENCE]
+      CHARACTER*1 string [REFERENCE]
+      INTEGER LENSTR [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCACPY [C]
+     $     (INCDFID,INVARID,ATTNAME,OUTCDFID,OUTVARID, rcode)
+      INTEGER INCDFID [REFERENCE]
+      INTEGER INVARID [REFERENCE]
+      CHARACTER*1 ATTNAME [REFERENCE]
+      INTEGER OUTCDFID [REFERENCE]
+      INTEGER OUTVARID [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCANAM [C]
+     $     (CDFID,VARID,ATTNUM, attname,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      INTEGER ATTNUM [REFERENCE]
+      CHARACTER*1 attname [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCAREN [C]
+     $     (CDFID,VARID,ATTNAME,NEWNAME,rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      CHARACTER*1 ATTNAME [REFERENCE]
+      CHARACTER*1 NEWNAME [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCADEL [C]
+     $     (CDFID,VARID,ATTNAME, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER VARID [REFERENCE]
+      CHARACTER*1 ATTNAME [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO INTEGER FUNCTION NCTLEN [C]
+     $     (DATATYPE, rcode)
+      INTEGER DATATYPE [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCPOPT [C]
+     $     (NCOPTS)
+      INTEGER NCOPTS [REFERENCE]
+      END
+
+      INTERFACE TO SUBROUTINE NCGOPT [C]
+     $     (ncopts)
+      INTEGER ncopts [REFERENCE]
+      END
+
+      INTERFACE TO INTEGER FUNCTION NCSFIL [C]
+     $     (CDFID,FILLMODE, rcode)
+      INTEGER CDFID [REFERENCE]
+      INTEGER FILLMODE [REFERENCE]
+      INTEGER rcode [REFERENCE]
+      END

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/netcdf.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/netcdf.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft/netcdf.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,172 @@
+c     machine specific xdr infinity constants	
+c
+      double precision XDRDINF,XDRFINF
+c     ifdef vax
+c
+c     parameter(XDRDINF = 1.7014118346046923e+38)
+c     parameter(XDRFINF = 2.93873588e-39)
+      
+c     ifdef sun
+      parameter(XDRDINF = 1.797693134862315809d+308)
+      parameter(XDRFINF = 3.4028235677e+38)
+c     
+c     Fill values
+c     These values are stuffed into newly allocated space as appropriate.
+c     The hope is that one might use these to notice that a particular dataum
+c     has not been set.
+c     
+      integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+      real FILFLOAT
+      double precision FILDOUB
+c
+c     Largest Negative value 
+      parameter(FILBYTE = 128)
+      parameter(FILCHAR = 0)
+      parameter(FILSHORT = 32768)
+      parameter(FILLONG = -2147483647-1)
+c     IEEE Infinity 
+      parameter(FILFLOAT = XDRFINF)
+      parameter(FILDOUB = XDRDINF)
+c      
+c     Functions in the FORTRAN interface
+c     These declarations may cause "unused variable" warnings
+      integer nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen
+
+      integer NCRDWR,NCCREAT,NCEXCL,NCINDEF,NCNSYNC,NCHSYNC
+      integer NCNDIRTY,NCHDIRTY,NCLINK,NCNOWRIT,NCWRITE
+      integer NCCLOB,NCNOCLOB,NCUNLIM,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     
+      parameter(NCUNLIM = 0)
+      
+c     
+c     attribute id to put/get a global attribute
+c     
+      parameter(NCGLOBAL  = 0)
+c     
+c     Advisory Maximums
+c     
+      parameter(MAXNCOP = 8)
+      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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,52 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', MICROSOFT)
+
+# Includes needed at the top of a file of C to be called from FORTRAN
+define(`M4__STRING_DESCRIPTOR_INCLUDES',
+`extern long fslen(int); /* returns declared fortran string length of nth arg */
+')
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1`'define(`STR_COUNT',1)')# for microsoft, just use same name
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`')
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char *$1;	`$2'')
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`
+    int $1`'`len' = fslen(STR_COUNT`'define(`STR_COUNT',incr(STR_COUNT)));') # all strings must be null-terminated
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`long') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer*4')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+# FORTRAN syntax for including a file
+define(`F_INCLUDE',`$`include': "$1"')
+
+# include declaring C interfaces, needed in FORTRAN when calling C, e.g.
+# Microsoft FORTRAN needs this
+define(`M4__C_INTERFACE_DECLARATIONS',
+`F_INCLUDE(msoft.int)
+')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft.mk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft.mk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/msoft.mk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,83 @@
+#  Copyright 1993, UCAR/Unidata
+#
+#  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
+
+LINK	  = link
+LFLAGS	  = /st:10000 /nod /noe
+
+INCDIR    = ..\libsrc
+INCLUDES  = /I$(INCDIR)
+
+BINDIR    = $(DESTDIR)\bin
+LIBDIR    = $(DESTDIR)\lib
+CLIB      = llibce.lib
+FORTLIB   = llibfor7.lib
+NETCDFLIB = ..\libsrc\netcdf.lib
+!IF $(OS2)
+OS2LIB    = os2.lib
+!ELSE
+OS2LIB    =
+!ENDIF
+XDRLIB    = ..\xdr\xdr.lib
+LIBS      = $(XDRLIB) $(NETCDFLIB) $(OS2LIB) $(CLIB) $(FORTLIB)
+
+.c.obj:
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
+
+.for.obj:
+	$(F77) $(FFLAGS) $(FPPFLAGS) $<
+
+LOADLIBS =
+
+GOAL =  ftest.exe
+
+SRCS =  ftest.for jackets.c
+OBJS =  ftest.obj jackets.obj fslen.obj
+
+all:	$(GOAL)
+
+test:	$(GOAL) FORCE
+	$(GOAL)
+
+$(GOAL): $(OBJS)
+	$(LINK) $(LFLAGS) $(OBJS) , $(GOAL) ,, @ftest.lnk;
+
+ftest.obj: ftest.for msoft.int netcdf.inc
+	$(F77) $(FFLAGS) $(FPPFLAGS) $?
+
+fslen.obj: fslen.asm
+
+ftest.for: msoft\ftest.for
+	copy msoft\ftest.for ftest.for
+
+jackets.c: msoft\jackets.c
+	copy msoft\jackets.c jackets.c
+
+netcdf.inc: msoft\netcdf.inc
+	copy msoft\netcdf.inc netcdf.inc
+
+msoft.int: msoft\msoft.int
+	copy msoft\msoft.int msoft.int
+
+fslen.asm: msoft\fslen.asm
+	copy msoft\fslen.asm fslen.asm
+
+install: $(GOAL)
+	copy $(GOAL) $(BINDIR)
+
+clean:
+	rm -f ftest.obj jackets.obj fslen.obj ftest.map $(GOAL) *.cdf
+	rm -f ftest.for jackets.c netcdf.inc msoft.int fslen.asm
+
+FORCE:
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+jackets.obj: jackets.c $(INCDIR)\netcdf.h
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) jackets.c

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/osf.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/osf.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/osf.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,40 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', OSF)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT 
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_')	# for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/solaris.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/solaris.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/solaris.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Sun)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_')	# for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/sunos.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/sunos.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/sunos.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Sun)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_')	# for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/ultrix.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/ultrix.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/ultrix.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,40 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', ULTRIX)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT 
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_')	# for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/unicos.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/unicos.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/unicos.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,52 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', UNICOS)
+
+# Includes needed at the top of a file of C to be called from FORTRAN
+define(`M4__STRING_DESCRIPTOR_INCLUDES',`
+#include <fortran.h>	/* for _fcd functions */
+')
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT 
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+#define FORTRAN_HAS_NO_SHORT
+')
+
+# transformation from fortran name to name of C module
+# for unicos, just convert to uppercase
+define(`NAMEF',
+       `translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)')
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1d')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`')
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    _fcd	$1d;	`$2'') # declare string parameter as type _fcd
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`
+    char	*$1	= _fcdtocp ($1d);
+    unsigned	$1len	= _fcdlen ($1d);')	# use _fcd functions
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`real')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vax-ultrix.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vax-ultrix.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vax-ultrix.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,43 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', ULTRIX)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT 
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+')
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_')	# for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len')  # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    char	*$1;	`$2'
+    int		$1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/ftest.for
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/ftest.for	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/ftest.for	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1221 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/fortran/vms/ftest.for,v 1.2 1996/01/30 16:20:52 sxu Exp $
+c********************************************************************/
+
+
+
+c
+c     program to test the VMS 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)
+      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) = 250
+      call ncapt (ncid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'validrange', 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', 'shortv', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '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, 'shortv', 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 ncvgt 1 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

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/ftest.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/ftest.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/ftest.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1208 @@
+c********************************************************************
+c   Copyright 1989, University Corporation for Atmospheric Research
+c   See netcdf/README file for copying and redistribution conditions.
+c   $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/fortran/vms/ftest.m4,v 1.1 1993/11/22 16:50:42 georgev Exp $
+c********************************************************************/
+c
+c     program to test the VMS 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 cdfid
+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.cdf'/
+      data name2/'copy.cdf'/
+      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.cdf'
+      write(*,100) 'nccre'
+      cdfid = nccre(name, NCCLOB, iret)
+
+c     test ncddef
+      write(*,100) 'ncddef'
+      call tncddef(cdfid)
+
+c     test ncvdef
+      write(*,100) 'ncvdef'
+      call tncvdef(cdfid)
+
+c     test ncapt
+      write(*, 100) 'ncapt, ncaptc'
+      call tncapt(cdfid)
+
+c     close 'test.cdf'
+      write(*, 100) 'ncclos'
+      call ncclos(cdfid, 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)
+      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,250/
+      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
+            call exit
+         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 !'
+               call exit
+            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 cdfid, iret, i, j
+      integer ndims, nvars, natts, recdim
+      integer vartyp, nvdims, vdims(MAXVDIMS), nvatts
+      character*31 varnam, attnam
+
+      cdfid = ncopn(cdfname, NCWRITE, iret)
+c     put cdf in define mode
+      call ncredf (cdfid,iret)
+c     get number of global attributes
+      call ncinq (cdfid, ndims, nvars, natts, recdim, iret)
+      do 10 i = natts, 1, -1
+c     get name of global attribute
+         call ncanam (cdfid, NCGLOBAL, i, attnam, iret)
+c     delete global attribute
+         call ncadel (cdfid, NCGLOBAL, attnam, iret)
+ 10   continue
+
+      do 100 i = 1, nvars
+c     get number of variable attributes
+         call ncvinq (cdfid, i, varnam, vartyp, nvdims, vdims,
+     +        nvatts, iret)
+         do 200 j = nvatts, 1, -1
+            call ncanam (cdfid, i, j, attnam, iret)
+            call ncadel (cdfid, i, attnam, iret)
+ 200     continue
+ 100  continue
+      call ncinq (cdfid, ndims, nvars, natts, recdim, iret)
+      if (natts .ne. 0) write(*,*) 'error in ncadel'
+c     put netCDF into data mode
+      call ncendf (cdfid, iret)
+      call ncclos (cdfid, 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 cdfid, 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
+      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), iret
+      double precision dvalidrg(2)
+      byte bvalidrg(2)
+      character*31 gavalue(2), cavalue(2)
+      real epsilon
+
+      data bvalidrg/1,250/
+      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/
+      
+      cdfid = ncopn (cdfname, NCNOWRIT, iret)
+      call ncinq (cdfid, ndims, nvars, natts, recdim, iret)
+c     
+c     get global attributes first
+c     
+      do 10 i = 1, natts
+c     get name of attribute
+         call ncanam (cdfid, NCGLOBAL, i, attnam, iret)
+c     get attribute type and length
+         call ncainq (cdfid, NCGLOBAL, attnam, attype, attlen,
+     +        iret)
+         if (attlen .gt. mattlen) then
+            write (*,*) 'global attribute too big!'
+            call exit
+         else if (attype .eq. NCBYTE) then
+            call ncagt (cdfid, NCBYTE, attnam, bytval, iret)
+         else if (attype .eq. NCCHAR) then
+            call ncagtc (cdfid, 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 (cdfid, NCGLOBAL, attnam, shval, iret) 
+         else if (attype .eq. NCLONG) then
+            call ncagt (cdfid, NCGLOBAL, attnam, lngval, iret)            
+         else if (attype .eq. NCFLOAT) then
+            call ncagt (cdfid, NCGLOBAL, attnam, flval, iret)
+         else 
+            call ncagt (cdfid, NCGLOBAL, attnam, doubval,iret)          
+         end if
+ 10   continue
+
+c
+c     get variable attributes
+c
+      do 20 i = 1, nvars
+         call ncvinq (cdfid, i, varnam, vartyp, nvdims, vdims,
+     +                nvatts, iret)
+         do 25 j = 1, nvatts
+            call ncanam (cdfid, i, j, attnam, iret)
+            call ncainq (cdfid, i, attnam, attype, attlen,
+     +                   iret)
+            if (attlen .gt. mattlen) then
+               write (*,*) 'variable ', i,  'attribute too big !'
+               call exit
+            else 
+               if (attype .eq. NCBYTE) then
+                  call ncagt (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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(cdfid, iret)
+      return
+      end
+c
+c     subroutine to test ncapt
+c
+      subroutine tncapt (cdfid)
+      include 'netcdf.inc'
+      integer cdfid
+
+c attribute vectors
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2), iret
+      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) = 250
+      call ncapt (cdfid, bid, 'validrange', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (cdfid, sid, 'validrange', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (cdfid, lid, 'validrange', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (cdfid, fid, 'validrange', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (cdfid, did, 'validrange', NCDOUBLE, 2,
+     +dvalidrg, iret)
+
+c
+c     global
+c
+
+      call ncaptc (cdfid, NCGLOBAL, 'source', NCCHAR, 3, 
+     +'NWS', iret)
+      call ncaptc (cdfid, NCGLOBAL, 'basetime', NCCHAR, 17, 
+     +'88/10/25 12:00:00', iret)
+
+c
+c     char
+c
+
+      call ncaptc (cdfid, chid, 'longname', NCCHAR, 11,
+     +'test string', iret)
+
+      call ncaptc (cdfid, chid, 'id', NCCHAR, 1,
+     +'a', iret)
+
+      return
+      end
+
+c
+c     initialize variables in labelled common blocks
+c
+      block data
+      include 'netcdf.inc'
+      common /cdims/ dimnam
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+      common /varn/varnam
+      common /atts/attname, gattnam
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer dimsiz(MAXNCDIM)
+      character*31 dimnam(MAXNCDIM)
+      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/'byte', 'short', 'long', 'float', 'double', 'ch', 'c'/
+      
+      data attname/'validrange', '0', 'validrange', '0', 'validrange',
+     + '0', 'validrange', '0', 'validrange', '0', 'longname', 'id',
+     + '0', '0'/
+      data gattnam/'source','basetime'/
+      end
+
+
+c
+c     subroutine to test ncddef
+c
+
+      subroutine tncddef(cdfid)
+      include 'netcdf.inc'
+      integer cdfid
+
+c     sizes of dimensions of 'test.cdf' and 'copy.cdf'
+      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(cdfid, dimnam(1), NCUNLIM, iret)
+      latdim = ncddef(cdfid, dimnam(2), dimsiz(2), iret)
+      londim = ncddef(cdfid, dimnam(3), dimsiz(3), iret)
+      leveldim = ncddef(cdfid, dimnam(4), dimsiz(4), iret)
+      lendim = ncddef(cdfid, 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 cdfid
+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,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/
+
+      cdfid = ncopn (cdfname, NCNOWRIT, iret)
+      call ncinq (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, i, vname, vartyp, nvdims,
+     +        vdims, nvatts, iret)
+         if (vname .ne. varnam(i)) write(*,*) 'error in ncvinq or
+     + ncvdef'
+         if (vartyp .ne. vtyp(i)) write(*,*) 'error in ncvinq or
+     + ncvdef'
+         if (nvdims .ne. vndims(i)) write(*,*) 'error in ncvinq or
+     + ncvdef'
+         do 35 j = 1, nvdims
+            if (vdims(j) .ne. vdlist(j,i)) write(*,*) 'error in
+     + ncvinq or ncvdef'
+ 35      continue
+         if (nvatts .ne. vnatts(i)) write(*,*) 'error in ncvinq or
+     + ncvdef'
+c
+c     attributes
+c
+         do 45 k = 1, nvatts
+            call ncanam (cdfid, i, k, attnam, iret)
+            call ncainq (cdfid, 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 (cdfid, NCGLOBAL, i, attnam, iret)
+         call ncainq (cdfid, 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(cdfid, 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 cdfid, iret, latid, varid
+
+      dimnam(2) = 'latitude'
+      varnam(4) = 'real'
+      attname(1,6) = 'stringname'
+      gattnam(1) = 'agency'
+      cdfid = ncopn(cdfname, NCWRITE, iret)
+      call ncredf(cdfid, iret)
+      latid = ncdid(cdfid, 'lat', iret)
+      call ncdren(cdfid, latid, 'latitude', iret)
+      varid = ncvid(cdfid, 'float', iret)
+      call ncvren(cdfid, varid, 'real', iret)
+      varid = ncvid(cdfid, 'ch', iret)
+      call ncaren(cdfid, varid, 'longname', 'stringname', iret)
+      call ncaren(cdfid, NCGLOBAL, 'source', 'agency', iret)
+      call ncendf(cdfid, iret)
+      call ncclos(cdfid, iret)
+      return
+      end
+c     
+c     subroutine to test ncvdef
+c
+
+      subroutine tncvdef(cdfid)
+      include 'netcdf.inc'
+      integer cdfid
+
+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(cdfid, 'byte', NCBYTE, 1, bdims, iret)
+c
+c     short
+c
+      sdims(1) = timedim
+      sid = ncvdef (cdfid, 'short', NCSHORT, 1, sdims, iret)
+c
+c     long
+c
+      ldims(1) = latdim
+      lid = ncvdef (cdfid, 'long', NCLONG, 1, ldims, iret)
+c
+c     float
+c
+      fdims(4) = timedim
+      fdims(1) = leveldim
+      fdims(2) = londim
+      fdims(3) = latdim
+      fid = ncvdef (cdfid, 'float', NCFLOAT, 4, fdims, iret)
+c
+c     double
+c
+      ddims(4) = timedim
+      ddims(1) = leveldim
+      ddims(2) = londim
+      ddims(3) = latdim
+      did = ncvdef (cdfid, 'double', NCDOUBLE, 4, ddims, iret)
+c
+c     char
+c
+      chdims(2) = timedim
+      chdims(1) = lendim
+      chid = ncvdef (cdfid, 'ch', NCCHAR, 2, chdims, iret)
+
+      cdims(1) = timedim
+      cid = ncvdef (cdfid, 'c', 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 cdfid, 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/
+
+      cdfid = ncopn (cdfname, NCWRITE, iret)
+c     get number of variables in netCDF
+      call ncinq (cdfid, 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 (cdfid, m, varnam, vartyp, nvdims, vdims,
+     +                nvatts, iret)
+         if (vartyp .eq. NCBYTE) then
+c
+c     byte
+c
+            count(1) = times
+            call ncvgt (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, 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(cdfid, iret)
+      return
+      end
+
+      
+      subroutine tncvgt1(cdfname)
+      include 'netcdf.inc'
+      character*31 cdfname
+
+      integer cdfid, 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/
+      
+      cdfid = ncopn (cdfname, NCNOWRIT, iret)
+c
+c     test ncvgt1 for byte
+c
+      call ncvgt1 (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, fid, findx, fvalue, iret)
+      if (abs(fvalue - 3.14159) .gt. epsilon) write(*,*) 'error in ncvgt
+     +1 float:', fvalue, ' not close to', 3.14159
+c
+c     test ncvgt1 for double
+c
+      call ncvgt1 (cdfid, 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 (cdfid, cid, cindx, c, iret)
+      if (c .ne. 'a') write(*,*) 'error in ncvg1c'
+      call ncclos(cdfid, 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 cdfid, 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 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), lenstr
+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/
+
+      cdfid = ncopn (cdfname, NCWRITE, iret)
+
+c
+c     byte
+c
+      count(1) = times
+      call ncvpt (cdfid, bid, start, count, barray, iret)
+c
+c     short
+c
+      count(1) = times
+      call ncvpt (cdfid, sid, start, count, sarray, iret)
+c
+c     long
+c
+      do 30 i = 1,lats
+         larray(i) = 1000
+ 30   continue
+      count(1) = lats
+      call ncvpt (cdfid, 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 (cdfid, 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 (cdfid, 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 (cdfid, chid,start, count, string, lenstr, iret)
+      call ncclos(cdfid, iret)
+      return
+      end
+
+      
+      subroutine tncvpt1(cdfname)
+      include 'netcdf.inc'
+      character*31 cdfname
+
+
+      integer iret, cdfid
+      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*2 short
+      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 short/10/
+      data onethird/0.3333333333D0/
+
+      bvalue = ichar('z')
+      
+      cdfid = ncopn (cdfname, NCWRITE, iret)
+c
+c     test ncvpt1 for byte
+c
+      call ncvpt1 (cdfid, bid, bindx, bvalue, iret)
+c
+c     test ncvpt1 for short
+c
+      call ncvpt1 (cdfid, sid, sindx, short, iret)
+c     
+c     test ncvpt1 for long
+c
+      call ncvpt1 (cdfid, lid, lindx, 1000, iret)
+c
+c     test ncvpt1 for float
+c
+      call ncvpt1 (cdfid, fid, findx, 3.14159, iret)
+c
+c     test ncvpt1 for double
+c
+      call ncvpt1 (cdfid, did, dindx, onethird, iret)
+c
+c     test ncvp1c for char
+c
+      call ncvp1c (cdfid, cid, cindx, 'a', iret)
+      call ncclos(cdfid, iret)
+      return
+      end

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/hdftest.for
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/hdftest.for	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/hdftest.for	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2458 @@
+C
+C     Testing the Fortran interface for the multiple SD routines
+C
+      program hdftest
+
+      implicit none
+
+      integer fid1, fid2
+
+      integer sds1, sds2, sds3, sds4
+
+      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 sfstart,  sfcreate,  sfendacc, sfend,    sfsfill
+      integer sfrdata,  sfwdata,   sfdimid,  sfsdmname
+      integer sffinfo,  sfn2index, sfsdmstr, sfsdtstr, sfsdscale
+      integer sfscal,   sfselect,  sfginfo,  sfgdinfo, sfgainfo
+      integer sffattr,  sfsrange,  sfgrange, sfgfill,  sfsflmd
+      integer sfgcal,   sfgdscale, sfgdtstr, sfgdmstr
+      integer sfid2ref, sfref2index, sfsdmvc, sfisdmvc
+      integer sfsextf,  hxsdir,    hxscdir
+      integer sfwcdata, sfrcdata,  sfscfill, sfgcfill
+      integer sfscatt,  sfrcatt,   sfsnatt,  sfrnatt
+      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/
+
+C     create a new file
+      err = 0
+      eps = 0.0001
+      access = 4
+      fid1 = sfstart('test1.hdf', access)
+      if(fid1.eq.-1) then
+         print *, 'Hopen 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
+      fid2 = sfstart('test1.hdf', 3)
+      if(fid2.ne.393216) then
+          print *, 'Reopen returned', fid2
+          err = err + 1
+      endif
+ 
+      sds3 = sfselect(fid2, 0)
+      if(sds3.ne.262144) then
+         print *, 'Select returned', sds3
+         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.ne.262145) then
+         print *, 'Select #4  returned', sds4
+         err = err + 1
+      endif
+
+      dim2 = sfdimid(sds4, 1)
+      if(dim2.ne.327683) 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_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_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
+         integer   sfstart, sfcreate, sfendacc, sfend,
+     .             sfn2index, sfselect,
+     .             sfsfill, sfschnk, sfscchnk, sfwchnk, 
+     .             sfgichnk, sfrchnk, sfwdata, sfrdata
+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   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    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    = 1,
+     .                skphuff_skp_size = 2,
+     .                nbit_sign_ext    = 0,
+     .                nbit_fill_one    = 0,
+     .                nbit_start_bit   = 0,
+     .                nbit_bit_len     = 31 )
+
+
+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
+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
+         integer   sfstart, sfcreate, sfendacc, sfend,
+     .             sfn2index, sfselect,
+     .             sfsfill, sfschnk, sfscchnk, sfwcchnk, 
+     .             sfgichnk, sfrcchnk, sfwcdata, sfrcdata
+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    = 1,
+     .                skphuff_skp_size = 2,
+     .                nbit_sign_ext    = 0,
+     .                nbit_fill_one    = 0,
+     .                nbit_start_bit   = 0,
+     .                nbit_bit_len     = 31 )
+
+
+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
+         integer   comp_arg(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
+         integer   sfstart, sfcreate, sfendacc, sfend,
+     .             sfn2index, sfselect,
+     .             sfsfill, sfrdata,
+     .             sfwdata, sfscompress
+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   data(n,m)
+C
+C  Buffer to hold part of the data when we read data back
+C
+         integer    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    = 1,
+     .                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   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
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/jackets.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/jackets.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/jackets.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1291 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/README file for copying and redistribution conditions.
+ */
+/* $Header: /afs/ncsa/projects/hdf/cvs/dist/mfhdf/fortran/vms/jackets.c,v 1.3 1998/06/25 17:06:14 epourmal Exp $ */
+/*
+ * 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 VMS.  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 */
+#ifdef HDF
+#include        "local_nc.h"
+#else
+#include	"netcdf.h"
+#endif
+#include	<ctype.h>
+#include        <string.h>
+#include	<stdio.h>
+#include        <stdlib.h>
+#include        <descrip.h>
+
+/*
+extern char *
+malloc ();
+*/
+
+/*
+ * global integer used for suppressing error messages and determining
+ * the fatality of errors.
+ */
+extern int ncopts;		/* default is (NC_FATAL | NC_VERBOSE) */
+
+/* global integer that contains a netCDF-specific error code */
+extern int ncerr;
+
+/* 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 */
+{
+    extern void NCadvise();
+    extern const char *cdf_routine_name; /* routine name in error messages */
+
+    cdf_routine_name = pname;
+    (void) 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';
+}
+
+/* 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';
+}
+
+
+/*
+ * 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;
+}
+#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;
+}
+#endif /* FORTRAN_HAS_NO_SHORT */
+
+/* ------------ VMS FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void ncpopt(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void ncgopt(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nccre(pathnamed, clobmode, rcode)
+    struct dsc$descriptor_s * pathnamed;	
+    int		*clobmode;	
+    int		*rcode;	
+{
+    char	*pathname	= pathnamed->dsc$a_pointer;
+    int		pathnamelen	= pathnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+    int cdfid;
+
+    (void) 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
+ncopn(pathnamed, rwmode, rcode)
+    struct dsc$descriptor_s * pathnamed;	
+    int		*rwmode;	
+    int		*rcode;	
+{
+    char	*pathname	= pathnamed->dsc$a_pointer;
+    int		pathnamelen	= pathnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+    int cdfid;
+
+    (void) 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
+ncddef(cdfid, dimnamed, dimlen, rcode)
+    int		*cdfid;	
+    struct dsc$descriptor_s * dimnamed;	
+    long		*dimlen;	
+    int		*rcode;	
+{
+    char	*dimname	= dimnamed->dsc$a_pointer;
+    int		dimnamelen	= dimnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+    int dimid;
+
+    (void) nstrncpy (name, dimname, dimnamelen);
+    if ((dimid = ncdimdef (*cdfid, name, *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
+ncdid(cdfid, dimnamed, rcode)
+    int		*cdfid;	
+    struct dsc$descriptor_s * dimnamed;	
+    int		*rcode;	
+{
+    char	*dimname	= dimnamed->dsc$a_pointer;
+    int		dimnamelen	= dimnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+    int dimid;
+
+    (void) 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
+ncvdef(cdfid, varnamed, datatype, ndims, dimarray, rcode)
+    int		*cdfid;	
+    struct dsc$descriptor_s * varnamed;	
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*rcode;	
+{
+    char	*varname	= varnamed->dsc$a_pointer;
+    int		varnamelen	= varnamed->dsc$w_length;
+    int varid, i, dimid[MAX_VAR_DIMS];
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncvid(cdfid, varnamed, rcode)
+    int		*cdfid;	
+    struct dsc$descriptor_s * varnamed;	
+    int		*rcode;	
+{
+    char	*varname	= varnamed->dsc$a_pointer;
+    int		varnamelen	= varnamed->dsc$w_length;
+    int varid;
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+nctlen(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
+ncclos(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+ncredf(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+ncendf(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
+ncinq(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
+ncsnc(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
+ncabor(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
+ncdinq(cdfid, dimid, dimnamed, size, rcode)
+    int		*cdfid;	
+    int		*dimid;	
+    struct dsc$descriptor_s * dimnamed;	
+    long		*size;	
+    int		*rcode;	
+{
+    char	*dimname	= dimnamed->dsc$a_pointer;
+    int		dimnamelen	= dimnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+
+    *rcode = 0;
+    if (ncdiminq (*cdfid, *dimid - 1, name, size) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    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
+ncdren(cdfid, dimid, dimnamed, rcode)
+    int		*cdfid;	
+    int		*dimid;	
+    struct dsc$descriptor_s * dimnamed;	
+    int		*rcode;	
+{
+    char	*dimname	= dimnamed->dsc$a_pointer;
+    int		dimnamelen	= dimnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncvinq(cdfid, varid, varnamed, datatype, ndims, dimarray, natts, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    struct dsc$descriptor_s * varnamed;	
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*natts;	
+    int		*rcode;	
+{
+    char	*varname	= varnamed->dsc$a_pointer;
+    int		varnamelen	= varnamed->dsc$w_length;
+    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
+ncvpt1(cdfid, varid, indices, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*indices;	
+    void	*value;	
+    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;
+#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 (ncvarput1 (*cdfid, *varid - 1, nindices, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* puts a single character into an open netCDF file */
+void
+ncvp1c(cdfid, varid, indices, chvald, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*indices;	
+    struct dsc$descriptor_s * chvald;	
+    int		*rcode;	
+{
+    char	*chval	= chvald->dsc$a_pointer;
+    int		chvallen	= chvald->dsc$w_length;
+    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
+ncvpt(cdfid, varid, start, count, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*start;	
+    long		*count;	
+    void	*value;	
+    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);
+
+    *rcode = 0;
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) datatype == NC_BYTE) {	/* pack ints into bytes */
+	char *bytes = itob (value, count, 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, count, 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 (ncvarput (*cdfid, *varid - 1, nstart, ncount, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* writes a hypercube of character values into an open netCDF file */
+void
+ncvptc(cdfid, varid, start, count, stringd, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*start;	
+    long		*count;	
+    struct dsc$descriptor_s * stringd;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char	*string	= stringd->dsc$a_pointer;
+    int		stringlen	= stringd->dsc$w_length;
+    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;
+    }
+    if (dimprod(count,ndims) > *lenstr) {
+	*rcode = NC_ESTS;
+	handle_err ("NCVPTC", *rcode);
+	return;
+    }
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+    *rcode = 0;
+    if (ncvarput (*cdfid, *varid - 1, nstart, ncount, (ncvoid *) string) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* gets a single numeric value from a variable of an open netCDF file */
+void
+ncvgt1(cdfid, varid, indices, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*indices;	
+    void	*value;	
+    int		*rcode;	
+{
+    long nindices[MAX_VAR_DIMS], i;
+    int 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;
+#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 (ncvarget1 (*cdfid, *varid - 1, nindices, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets a single character data value from a variable of an open
+ * netCDF file
+ */
+void
+ncvg1c(cdfid, varid, indices, chvald, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*indices;	
+    struct dsc$descriptor_s * chvald;	
+    int		*rcode;	
+{
+    char	*chval	= chvald->dsc$a_pointer;
+    int		chvallen	= chvald->dsc$w_length;
+    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
+ncvgt(cdfid, varid, start, count, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*start;	
+    long		*count;	
+    void	*value;	
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS];
+    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;
+    }
+    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 (count, 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 (count, 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 (ncvarget (*cdfid, *varid - 1, nstart, ncount, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* reads a hypercube of character values from a netCDF variable */
+void
+ncvgtc(cdfid, varid, start, count, stringd, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    long		*start;	
+    long		*count;	
+    struct dsc$descriptor_s * stringd;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char	*string	= stringd->dsc$a_pointer;
+    int		stringlen	= stringd->dsc$w_length;
+    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] = ' ';
+}
+
+/* changes the name of a netCDF variable in an open netCDF file */
+void
+ncvren(cdfid, varid, varnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    struct dsc$descriptor_s * varnamed;	
+    int		*rcode;	
+{
+    char	*varname	= varnamed->dsc$a_pointer;
+    int		varnamelen	= varnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncapt(cdfid, varid, attnamed, datatype, attlen, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    struct dsc$descriptor_s * attnamed;	
+    int		*datatype;	
+    int		*attlen;	
+    void	*value;	
+    int		*rcode;	
+{
+    char	*attname	= attnamed->dsc$a_pointer;
+    int		attnamelen	= attnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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 (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
+ncaptc(cdfid, varid, attnamed, datatype, lenstr, stringd, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    struct dsc$descriptor_s * attnamed;	
+    int		*datatype;	
+    int		*lenstr;	
+    struct dsc$descriptor_s * stringd;	
+    int		*rcode;	
+{
+    char	*attname	= attnamed->dsc$a_pointer;
+    int		attnamelen	= attnamed->dsc$w_length;
+    char	*string	= stringd->dsc$a_pointer;
+    int		stringlen	= stringd->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+    char *value;
+
+    (void) 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
+ncainq(cdfid, varid, attnamed, datatype, attlen, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    struct dsc$descriptor_s * attnamed;	
+    int		*datatype;	
+    int		*attlen;	
+    int		*rcode;	
+{
+    char	*attname	= attnamed->dsc$a_pointer;
+    int		attnamelen	= attnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncagt(cdfid, varid, attnamed, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    struct dsc$descriptor_s * attnamed;	
+    void	*value;	
+    int		*rcode;	
+{
+    char	*attname	= attnamed->dsc$a_pointer;
+    int		attnamelen	= attnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+#if defined(FORTRAN_HAS_NO_BYTE) || defined(FORTRAN_HAS_NO_SHORT)
+    int datatype;
+    int attlen;
+#endif
+
+    (void) nstrncpy (name, attname, attnamelen);
+    *rcode = 0;
+#if defined(FORTRAN_HAS_NO_BYTE) || defined(FORTRAN_HAS_NO_SHORT)
+    if (ncattinq (*cdfid, *varid - 1, name, (nc_type *) &datatype, &attlen) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+#endif
+#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 (ncattget (*cdfid, *varid - 1, name, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets the value of a netCDF character attribute given its variable
+ * ID and name
+ */
+void
+ncagtc(cdfid, varid, attnamed, stringd, lenstr, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    struct dsc$descriptor_s * attnamed;	
+    struct dsc$descriptor_s * stringd;	
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char	*attname	= attnamed->dsc$a_pointer;
+    int		attnamelen	= attnamed->dsc$w_length;
+    char	*string	= stringd->dsc$a_pointer;
+    int		stringlen	= stringd->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+    int datatype;
+    int attlen;
+    int i;
+
+    (void) 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
+ncacpy(incdfid, invarid, attnamed, outcdfid, outvarid, rcode)
+    int		*incdfid;	
+    int		*invarid;	
+    struct dsc$descriptor_s * attnamed;	
+    int		*outcdfid;	
+    int		*outvarid;	
+    int		*rcode;	
+{
+    char	*attname	= attnamed->dsc$a_pointer;
+    int		attnamelen	= attnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncanam(cdfid, varid, attnum, attnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*attnum;	
+    struct dsc$descriptor_s * attnamed;	
+    int		*rcode;	
+{
+    char	*attname	= attnamed->dsc$a_pointer;
+    int		attnamelen	= attnamed->dsc$w_length;
+    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
+ncaren(cdfid, varid, attnamed, newnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    struct dsc$descriptor_s * attnamed;	
+    struct dsc$descriptor_s * newnamed;	
+    int		*rcode;	
+{
+    char	*attname	= attnamed->dsc$a_pointer;
+    int		attnamelen	= attnamed->dsc$w_length;
+    char	*newname	= newnamed->dsc$a_pointer;
+    int		newnamelen	= newnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1], nname[MAX_NC_NAME + 1];
+
+    (void) nstrncpy (name, attname, attnamelen);
+    (void) 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
+ncadel(cdfid, varid, attnamed, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    struct dsc$descriptor_s * attnamed;	
+    int		*rcode;	
+{
+    char	*attname	= attnamed->dsc$a_pointer;
+    int		attnamelen	= attnamed->dsc$w_length;
+    char name[MAX_NC_NAME + 1];
+
+    (void) 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
+ncsfil(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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/make.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/make.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/make.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,58 @@
+$! --------------------------------------------------------------------------
+$! For making FTEST.EXE on VMS if you don't have MMS.
+$! --------------------------------------------------------------------------
+$!
+$! $Id: make.com,v 1.5 1996/11/07 00:31:10 sxu Exp $
+$
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC"
+$ define/nolog sys$clib sys$library:deccrtl
+$ else
+$ ccopt = ""
+$ define/nolog sys$clib sys$library:vaxcrtl
+$ endif
+$ ccc := cc 'ccopt /opt/nodebug/nolist -
+          /define=(HDF, VMS, NO_SYS_XDR_INC)    -
+         /include=([--.libsrc],[---.include],[---.hdf.src], -
+          [---.hdf.jpeg], [---.hdf.zlib],[--.xdr])
+$
+$ ccc JACKETS.C
+$ ccc MFSDF.C
+$ fort/opt/nodebug MFSDFF.FOR
+$ fort/opt/nodebug  HDFTEST.FOR
+$ fort/opt/nodebug  FTEST.FOR
+$
+$ link/nodebug/notraceback/exec=HDFTEST.exe -
+    hdftest.obj, mfsdf.obj, mfsdff.obj, -
+    [---.lib]mfhdf.olb/lib, [---.hdf.src]df.olb/lib, -
+    [---.hdf.jpeg]libjpeg/lib,  [---.hdf.zlib]libz.olb/lib, -
+    sys$input/opt
+        sys$clib/lib
+
+$ link/nodebug/notraceback/exec=FTEST.exe -
+    ftest.obj, -
+    jackets.obj, -
+    [---.lib]mfhdf.olb/lib, [---.hdf.src]df.olb/lib,  -
+    [---.hdf.jpeg]libjpeg/lib,  [---.hdf.zlib]libz.olb/lib, -
+    sys$input/opt
+	sys$clib/lib
+$
+$ library/replace [---.lib]mfhDF.OLB JACKETS
+$ library/replace [---.lib]mfhDF.OLB mfsdf
+$ library/replace [---.lib]mfhDF.OLB mfsdff
+$
+$ copy netcdf.inc [---.include]
+$ type sys$input
+     Run ftest
+$ run ftest
+$ type sys$input
+     Run hdftest
+$ create/dir [.testdir]
+$ run hdftest
+$
+$ type sys$input
+     Clean up ...
+$ delete *.obj;*
+$ delete *.exe;*
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/mfsdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/mfsdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/mfsdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1949 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.6 $";
+#endif
+
+/* $Id: mfsdf.c,v 1.6 1999/04/27 20:07:57 epourmal Exp $ */
+
+/*
+
+  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
+
+*/
+
+#ifdef HDF
+#include "mfhdf.h"
+
+#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);
+FRETVAL (intf) nscrchnk(intf *id, intf *start, VOIDP num_data);
+FRETVAL (intf) nscwchnk(intf *id, intf *start, VOIDP num_data);
+#else
+FRETVAL(intf) nsfscfill();
+FRETVAL(intf) nsfsfill();
+FRETVAL(intf) nsfgfill();
+FRETVAL(intf) nsfrnatt();
+FRETVAL(intf) nscsnatt();
+FRETVAL(intf) nsfsflmd();
+FRETVAL (intf) nscrchnk();
+FRETVAL (intf) nscwchnk();
+
+#endif /* PROTOTYPE */
+
+/*-----------------------------------------------------------------------------
+ * 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;
+     int *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. This causes problems on VMS and T3D.
+ *--------------------------------------------------------------------*/
+
+   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               */
+comp_info cinfo;          /* compression info     */
+int   i;
+int32 rank, status, cflags, comp_type;
+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);
+     break;
+
+  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);
+     break;
+
+  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);
+     break;
+
+  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);
+     break;
+
+  default:
+
+    return FAIL;
+    break;
+            
+  }
+
+
+}   
+/*-----------------------------------------------------------------------------
+ * 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:     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 PROTOTYPEi
+       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:     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
+ * 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          */
+comp_info cinfo;          /* compression info     */
+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;
+
+       default:
+
+          return FAIL;
+          break;
+                    
+                     }
+
+ret = SDsetchunk(sdsid, chunk_def, cflags);
+ 
+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:     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:    scscompress
+ * Puporse: Call SDsetcompress and SDsetnbitdataset
+ * 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_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
+       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     */
+int32 c_type;              /* compression type definition */
+
+int   i, 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;
+
+       default:
+
+          return FAIL;
+          break;
+                    
+                     }
+
+ret = SDsetcompress(sdsid, c_type, &c_info);
+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);
+}   

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/mfsdff.for
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/mfsdff.for	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/mfsdff.for	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,579 @@
+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: mfsdff.for,v 1.5 1999/04/27 20:08:00 epourmal Exp $
+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 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 SD setchunk 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 SDwriteChunk 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 SDwriteChunk 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_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        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 SD setchunk 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_prm - compression parameter array:
+C                   comp_prm(1) = deflate_level for GZIP
+C                   comp_prm(1) = skphuff_skp_size for ADAPTIVE HUFFMAN
+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 SD setchunk 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:      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
+           

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/netcdf.inc
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/netcdf.inc	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms/netcdf.inc	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,176 @@
+c     machine specific xdr infinity constants	
+c
+      double precision XDRDINF,XDRFINF
+c     ifdef vax
+c
+      parameter(XDRDINF = 1.7014118346046923e+38)
+      parameter(XDRFINF = 2.93873588e-39)
+      
+c     ifdef sun
+c     parameter(XDRDINF = 1.797693134862315900e+308)
+c     parameter(XDRFINF = 3.40282357e+38)
+c     
+c     Fill values
+c     These values are stuffed into newly allocated space as appropriate.
+c     The hope is that one might use these to notice that a particular dataum
+c     has not been set.
+c     
+      integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+      real FILFLOAT
+      double precision FILDOUB
+c
+c     Largest Negative value 
+      parameter(FILBYTE = 128)
+      parameter(FILCHAR = 0)
+      parameter(FILSHORT = 32768)
+      parameter(FILLONG = -2147483648)
+c     IEEE Infinity 
+      parameter(FILFLOAT = XDRFINF)
+      parameter(FILDOUB = XDRDINF)
+c      
+c     Functions in the FORTRAN interface
+c     These declarations may cause "unused variable" warnings
+      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)

Added: packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/fortran/vms.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,44 @@
+divert(-1)
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', VMS)
+
+# Includes needed at the top of a file of C to be called from FORTRAN
+define(`M4__STRING_DESCRIPTOR_INCLUDES',
+`#include descrip'
+)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1')	# for vms, just use same name
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1d')	# append d for argument name descriptor
+
+# extra arguments, if any, for string length
+define(`STRINGX',`')
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+    struct dsc$descriptor_s * $1d;	`$2'')
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`
+    char	*$1	= $1d->dsc$a_pointer;
+    int		$1len	= $1d->dsc$w_length;') # use descriptor components
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int') 
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,805 @@
+# Makefile for netCDF library
+#
+# $Id: Makefile.in,v 1.30 2000/08/30 21:55:46 wendling Exp $
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+ZLIB_LIB = $(TOP_SRCDIR)/hdf/zlib/libz.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+OTHERDIRS = config
+
+PROGRAM		= cdftest
+#SWAP    	= @SWAP@
+#NETLONG    	= @NETLONG@
+#CPPFLAGS	= $(CPPFLAGS_LIB)
+#CFLAGS		= $(CFLAGS_LIB)
+GARBAGE		= $(PROGRAM) test.cdf cdfout.new *.hdf \
+                  hdftest hdfout.new
+HEADERS		= netcdf.h mfhdf.h local_nc.h hdf2netcdf.h
+#XDRFILE	= @XDRFILE@
+#HDF_LIB         = @HDF_LIB@
+#JPEG_LIB        = @JPEG_LIB@
+CSRCS		= array.c attr.c cdf.c dim.c error.c file.c \
+		  globdef.c iarray.c putget.c putgetg.c sharray.c string.c \
+		  var.c xdrposix.c xdrstdio.c hdfsds.c mfsd.c nssdc.c
+MANIFEST = $(DISTFILES)
+DISTFILES	= Makefile.in README \
+		  depend \
+		  $(CSRCS) cdftest.c \
+		  alloc.h testout.sav descrip.mms error.h htons.mar \
+		  local_nc.h make.com msoft.mk netcdf.h ntohs.mar \
+		  test_cdf.sav hdfout.sav hdftest.c mfhdf.h win32cdf.h hdf2netcdf.h \
+		config/netcdf-hpux.h config/netcdf-irix4.h config/netcdf-irix5.h \
+		config/netcdf-irix6.h config/netcdf-irix32.h config/netcdf-sun.h \
+		config/netcdf-linux.h config/netcdf-fbsd.h config/netcdf-alpha.h \
+		config/netcdf-dec.h config/netcdf-aix.h config/netcdf-solaris.h \
+		config/netcdf-solarisx86.h config/netcdf-convex.h \
+		config/netcdf-unicos.h
+
+LIBOBJS		= array.o attr.o cdf.o dim.o file.o iarray.o error.o \
+		  globdef.o putget.o putgetg.o sharray.o string.o var.o \
+		  $(XDRFILE).o hdfsds.o mfsd.o nssdc.o
+LIBRARY		= mfhdf
+DEBUGLIBRARY	= mfhdf_g
+PROFILEDLIBRARY	= mfhdf_pg
+OBJS		= $(PROGRAM).o
+#LD_XDR		= @LD_XDR@
+LD_NETCDF	= libmfhdf.a
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(JPEG_LIB) $(LIBSX) $(ZLIB_LIB)
+prefix		= ../../..
+
+#all::		library
+all::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" library; \
+	fi
+
+#
+# The formatted file `cdftest_out.new' might differ from the touchstone
+# file `testout.sav', but this should be due to rounding errors.
+#
+# `$(PROGRAM)' creates the binary-file `test.cdf' which should be byte-for-byte
+# identical with `test_cdf.sav', modulo small rounding errors.
+#
+test:		$(PROGRAM) nhdftest
+	@ echo "========================="
+	@ echo "netCDF formatted tests"
+	@ echo "========================="
+	./$(PROGRAM) > cdfout.new
+	@cmd="$(DIFF) $(DIFF_FLAGS) cdfout.new 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"; \
+		exit 0; \
+	    fi
+#	@cmd="cmp test.cdf test_cdf.sav"; \
+#	    echo $$cmd; \
+#	    if $$cmd; then \
+#		echo "*** netCDF passes binary test ***"; \
+#	    else \
+#		echo "*** netCDF fails binary test ***"; \
+#		exit 1; \
+#	    fi
+
+install::	installed_library installed_headers
+
+install-includes::	installed_headers
+
+$(PROGRAM):	$(PROGRAM).o library
+
+nhdftest::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) hdftest; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" hdftest; \
+	fi
+
+hdftest:	hdftest.o library        
+	$(CC) $(CFLAGS) $(CFLAGS_NETCDF) hdftest.o $(LIBS) -o $@
+	@ echo "============================"
+	@ echo "HDF-SD C interfaces tests"
+	@ echo "============================"
+	./hdftest > hdfout.new
+	@cmd="$(DIFF) $(DIFF_FLAGS) hdfout.new hdfout.sav"; \
+	    echo $$cmd; \
+	    if $$cmd; then \
+		echo "*** HDF passes formatted test ***"; \
+	    else \
+		echo "*** HDF fails formatted test ***"; \
+		echo "The above differences are OK if small"; \
+		exit 0; \
+	    fi
+debug:
+#	rm -f $(COBJS)
+	$(MAKE) $(MFLAGS) "CFLAGS=-g $(CFLAGS_NETCDF) " "LIBRARY=$(LIBRARY)_g" library
+
+profiled:
+#	rm -f $(COBJS)
+	$(MAKE) $(MFLAGS) "CFLAGS=-pg $(CFLAGS_NETCDF) " "LIBRARY=$(LIBRARY)_pg" library
+
+cdftest.oc:	$(CSRCS) cdftest.c
+	#load -C $(CPPFLAGS) $(CPPFLAGS_NETCDF) -I/usr/local/lang/SC1.0/ansi_include \
+	    $(CSRCS) cdftest.c /usr/local/lang/SC1.0/ansi_lib/libansi.a 
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+#	$(LD) -b -o libmfhdf.sl $(LIBOBJS)
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF) '; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags netcdf.h
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/libsrc
+dist: $(DISTFILES)
+	for subdir in $(OTHERDIRS); do \
+	  mkdir $(distdir)/$$subdir || exit 1; \
+	done
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,98 @@
+# Makefile for netCDF library
+#
+# $Id: Makefile.in_orig,v 1.2 2000/08/30 21:55:46 wendling Exp $
+
+PROGRAM		= cdftest
+SWAP    	= @SWAP@
+NETLONG    	= @NETLONG@
+CPPFLAGS	= $(SWAP) $(NETLONG) @CPPFLAGS@
+CFLAGS		= @CFLAGS@ @HDF_INC@
+GARBAGE		= $(PROGRAM) test.cdf cdfout.new *.hdf \
+                  hdftest hdfout.new
+HEADERS		= netcdf.h mfhdf.h local_nc.h
+XDRFILE		= @XDRFILE@
+HDF_LIB         = @HDF_LIB@
+JPEG_LIB        = @JPEG_LIB@
+CSRCS		= array.c attr.c cdf.c dim.c error.c file.c \
+		  globdef.c iarray.c putget.c putgetg.c sharray.c string.c \
+		  var.c xdrposix.c xdrstdio.c hdfsds.c mfsd.c nssdc.c
+MANIFEST	= Makefile.in README \
+		  depend \
+		  $(CSRCS) cdftest.c \
+		  alloc.h testout.sav descrip.mms error.h htons.mar \
+		  local_nc.h make.com msoft.mk netcdf.h ntohs.mar \
+		  test_cdf.sav hdfout.sav mfsd.c hdfsds.c hdftest.c nssdc.c
+LIBOBJS		= array.o attr.o cdf.o dim.o file.o iarray.o error.o \
+		  globdef.o putget.o putgetg.o sharray.o string.o var.o \
+		  @XDRFILE at .o hdfsds.o mfsd.o nssdc.o
+LIBRARY		= netcdf
+DEBUGLIBRARY	= netcdf_g
+PROFILEDLIBRARY	= netcdf_pg
+OBJS		= $(PROGRAM).o
+LD_XDR		= @LD_XDR@
+LD_NETCDF	= libnetcdf.a
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(JPEG_LIB) $(LIBSX)
+prefix		= ../../..
+
+all::		library
+
+#
+# The formatted file `cdftest_out.new' might differ from the touchstone
+# file `testout.sav', but this should be due to rounding errors.
+#
+# `$(PROGRAM)' creates the binary-file `test.cdf' which should be byte-for-byte
+# identical with `test_cdf.sav', modulo small rounding errors.
+#
+test:		$(PROGRAM) hdftest
+	./$(PROGRAM) > cdfout.new
+	@cmd="diff cdfout.new 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"; \
+		exit 0; \
+	    fi
+#	@cmd="cmp test.cdf test_cdf.sav"; \
+#	    echo $$cmd; \
+#	    if $$cmd; then \
+#		echo "*** netCDF passes binary test ***"; \
+#	    else \
+#		echo "*** netCDF fails binary test ***"; \
+#		exit 1; \
+#	    fi
+
+install::	installed_library installed_headers
+
+$(PROGRAM):	$(PROGRAM).o library
+
+hdftest:	hdftest.o library        
+	$(CC) $(CFLAGS) hdftest.o $(LIBS) -o $@
+	./hdftest > hdfout.new
+	@cmd="diff hdfout.new hdfout.sav"; \
+	    echo $$cmd; \
+	    if $$cmd; then \
+		echo "*** HDF passes formatted test ***"; \
+	    else \
+		echo "*** HDF fails formatted test ***"; \
+		echo "The above differences are OK if small"; \
+		exit 0; \
+	    fi
+debug:
+#	rm -f $(COBJS)
+	$(MAKE) $(MFLAGS) "CFLAGS=-g" "LIBRARY=$(LIBRARY)_g" library
+
+profiled:
+#	rm -f $(COBJS)
+	$(MAKE) $(MFLAGS) "CFLAGS=-pg" "LIBRARY=$(LIBRARY)_pg" library
+
+cdftest.oc:	$(CSRCS) cdftest.c
+	#load -C $(CPPFLAGS) -I/usr/local/lang/SC1.0/ansi_include \
+	    $(CSRCS) cdftest.c /usr/local/lang/SC1.0/ansi_lib/libansi.a 
+
+include ../port/master.mk
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/README
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,45 @@
+$Id: README,v 1.1 1993/04/21 21:49:48 chouck Exp $
+
+Mon Apr 17 19:20:26 MDT 1989
+
+This is the source directory for the netcdf C language Library.
+
+There is a simple test program, "cdftest",
+which can be built to check the implementation.
+
+A much more exhaustive test can be found in ../nctest.
+
+Depending on the unkindness of your computer system vendor, you may
+need to build the xdr routines in ../xdr first. Most modern unix systems
+have the xdr routines aready in the C library.
+
+Running cdftest should produce output like the contents of "testout.sav".
+This program will also create a file called "test.cdf". This file should
+be byte for byte the same as "test_cdf.sav".
+
+
+Porting the netcdf code:
+
+	If your compiler supports the "void *" type and you wish to 
+   use this in the external interface, make sure that ncvoid is 
+   properly defined at the top of "netcdf.h".
+
+	If your compiler supports enums, "xdr_enum" works, and
+   you wish to use enums in the external interface, make sure
+   that USE_ENUM is defined at the top of "netcdf.h".
+
+	If your compiler supports the "binary mode" option to
+  fopen, as
+	fp = fopen(filename, "w+b") ;
+  be sure USE_BFLAG is defined near the top of "local_nc.h".
+  This is especially important on PC's and the MacIntosh, since
+  these systems will otherwise map bytes valued 0x0a ('\n') into
+  two bytes 0x0d 0x0a ('\r''\n').
+
+        Good Luck with the include files.
+
+
+The following files are only used on VAX/VMS:
+	descrip.mms - The immoral equivalent of a Makefile
+	htons.mar - 'Host to Network Short', in VAX Macro
+	ntohs.mar - 'Network to Host Short', in VAX Macro

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/alloc.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/alloc.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/alloc.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,53 @@
+/* $Id: alloc.h,v 1.5 1996/04/23 02:40:06 georgev Exp $ */
+#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_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/array.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/array.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/array.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,658 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: array.c,v 1.15 2000/08/29 13:56:50 koziol Exp $ */
+
+#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 ;
+	int 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 _CRAYMPP
+		xdr_NC_fnct = xdr_short;
+#elif defined __alpha || (_MIPS_SZLONG == 64) || defined IA64
+		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 );
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/attr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/attr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/attr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,572 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: attr.c,v 1.10 2000/08/29 13:56:51 koziol Exp $ */
+
+#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 && 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 ;
+    int 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 >= 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 ;
+	int attrid ;
+	int 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) ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdf.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdf.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdf.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,3589 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: cdf.c,v 1.72 2000/05/23 18:03:33 acheng Exp $ */
+
+#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 stuff 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
+
+/* -------------------------------- Hiscdf -------------------------------- */
+/*
+  Return TRUE/FALSE depending on if the given file is a NASA CDF file
+*/
+PRIVATE intn
+Hiscdf(filename)
+const char * filename;
+{
+    
+    static const char *FUNC = "Hiscdf";
+    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 Hiscdf
+*/
+/* -------------------------------- Hisnetcdf -------------------------------- */
+/*
+  Return TRUE if the given file is a netCDF file, FALSE otherwise.
+*/
+PRIVATE intn
+Hisnetcdf(filename)
+const char * filename;
+{
+    
+    static const char *FUNC = "Hisnetcdf";
+    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(Hiscdf(name))
+              cdf->file_type = CDF_FILE;
+          else if(Hisnetcdf(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 */
+
+          HDstrncpy(cdf->path, name, FILENAME_MAX);
+#if 0            
+          HDmemcpy(cdf->path, name, FILENAME_MAX);
+#endif
+            
+#ifdef DEBUG
+          printf("value returned from Hopen() : %d\n", cdf->hdf_file);
+#endif
+          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 ;
+          int 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 = NCMAGIC ;
+
+	if( xdrs->x_op == XDR_FREE)
+      {
+          NC_free_xcdf(*handlep) ;
+          return(TRUE) ;
+      }
+	
+	if( xdr_getpos(xdrs) != 0)
+      {
+          if( !xdr_setpos(xdrs, 0L) )
+            {
+                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;
+      }
+
+    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[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+((MAX_VAR_DIMS+1)*8)];   /* temporary buffer */
+    int32 tags[MAX_NC_ATTRS + MAX_VAR_DIMS + 2];
+    int32 refs[MAX_NC_ATTRS + MAX_VAR_DIMS + 10];
+    uint16       nt_ref, rank;
+    int32     GroupID, val;
+    uint8     *bufp = NULL;
+#ifdef LATER
+    CONSTR(FUNC,"hdf_write_var"); 
+#endif /* LATER */
+    int32      ret_value = SUCCEED;
+    register int  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++;
+            }
+      }
+  
+    /*
+     * 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 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 sz, i, j, status, done;
+    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 i, status, scaleref, scaletag, scalelen;
+    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[100] = "";
+    char vsclass[128] = "";
+    char vgclass[128] = "";
+    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;
+                                        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[128] = "";
+    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[100] = "";
+    char      fields[100] = "" ;
+    char      class[128] = "";
+    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[100] = "";
+    char     subname[100] = "";
+    char     class[128] = "";
+    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;
+    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;
+                  }
+
+                if(!HDstrcmp(class, _HDF_VARIABLE)) 
+                  {
+              
+                      /*
+                       * We have found a VGroup representing a 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++) 
+                        {
+                            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, class))
+                                    {
+#ifdef HDF_READ_VARS
+                                        fprintf(stderr, "hdf_read_vars:Vgetclass failed\n");
+#endif
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                                  if(!HDstrcmp(class, _HDF_DIMENSION) 
+                                     || !HDstrcmp(class, _HDF_UDIMENSION)) 
+                                    {
+                          
+                                        if(!HDstrcmp(class, _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 ----- */
+                                  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);
+                      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 */
+
+                      /* 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);
+                      
+                              } 
+                            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[100];
+  int32           entries;
+#endif
+  register int32  cdf_vg = FAIL;
+  register int    vgid = 0;
+  int             status;
+#ifdef OLD_WAY
+  register int    found;
+  char            class[128];
+#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
+*/
+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[128] = "";
+    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))
+                  {
+#ifdef HDF_CLOSE
+                      fprintf(stderr,"hdf_close: Vdetach failed for vgroup ref %d\n",
+                              id);
+#endif
+                      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? */
+
+#ifdef QAK
+    /* Free dimension array if necessary */
+    if(handle->dims) 
+        NC_free_array(handle->dims); /* Might need to close Vdatas? -QAK */
+#endif /* QAK */
+
+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 _CRAYMPP
+        xdr_NC_fnct = xdr_short;
+#elif defined __alpha || (_MIPS_SZLONG == 64) || defined IA64
+        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) ;
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,717 @@
+/*
+ * 	Copyright 1988 University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+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 "netcdf.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#ifdef macintosh
+    #include <LowMem.h>
+#endif
+
+# define assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__, __LINE__);exit(1);}}
+
+#define MAXSHORT	32767
+#define MAXLONG		2147483647
+#define  MAXBYTE	127
+
+/*   #ifdef PC  */
+/* For CRAYMPP, an explicit include <errno.h> uses the task-local memory */
+/* errno.  Read the CRAYMPP errno.h for more explanation. */
+#if defined PC || (defined VMS) || (defined CRAYMPP)
+#include <errno.h>
+#else
+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[MAX_NC_NAME] ;
+	nc_type type ;
+	int ndims ;
+	int dims[MAX_VAR_DIMS] ;
+	int num_attrs ;
+} vdesc[1] ;
+
+struct {
+	char mnem[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[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",
+		-MAXBYTE, MAXBYTE, -MAXBYTE, MAXBYTE , "ones",
+			2, {0,1,DONT_CARE} },
+#define Short_id 1
+	{ "Short", NC_SHORT, "Short variable",
+		-MAXSHORT, MAXSHORT, -MAXSHORT, MAXSHORT , "ones",
+			2, {0, 2, DONT_CARE }},
+#define Long_id 2
+	{ "Long", NC_LONG, "Long Integer variable",
+		-MAXLONG, MAXLONG, -MAXLONG, MAXLONG, "ones",
+			2, {1, 2, DONT_CARE}},
+#define Float_id 3
+	{ "Float", NC_FLOAT, "Single Precision Floating Point variable",
+		-MAXLONG, MAXLONG, -MAXLONG, MAXLONG, "flots",
+			3, {0, 1, 2 }},
+#define Double_id 4
+	{ "Double", NC_DOUBLE, "Double Precision Floating Point variable",
+		-MAXLONG, MAXLONG, -MAXLONG, MAXLONG, "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])
+		*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])
+		*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
+
+#if defined __MWERKS__
+#include <console.h>
+#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 ;
+
+#ifdef macintosh
+	Ptr	currStackBase, newApplLimit, currApplLimit, currHeapEnd;
+	/*	Expand the stack.  hdf_write_var( ) causes the stack to collide with
+		the 68K application heap when only the default stack size is used.  */
+	currStackBase = LMGetCurStackBase( );
+	newApplLimit = (Ptr) ( (long) currStackBase - 65536L );
+	currApplLimit = GetApplLimit( );
+	if ( newApplLimit > currApplLimit )	/* If we're about to shrink the stack, ...*/
+		 newApplLimit = currApplLimit;	/* ... then don't. */
+
+	currHeapEnd = LMGetHeapEnd( );
+	if ( newApplLimit < currHeapEnd )	/* If we're about overlap the stack and heap, */
+		 newApplLimit = currHeapEnd;	/* ... then don't. */
+
+	SetApplLimit( newApplLimit );
+#endif
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+#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)] ; *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;
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/cdftest.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,630 @@
+(This file must be converted with BinHex 4.0)
+
+:$f0NCR4PFh3ZF(*[DQ9MG!"069"b3eG*43!!!!"eI3!!!!$&(Q0[Ef`!!!!#!!!
+!+!!!F#F!!("2!!!&,J!!!$-"!!!!!!!!!!!!!!!!!J!!!!-8Y`!#!!!!!!!!!!)
+(F'&MDf&RC3!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Y`B at 0VB@GP,R0jE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-J!!!!!!!!!!,)F!!!!0F(*PCJ!,M'J!!!!c!!!!!!!!!!!XP!!
+!!"4`FQ9Q!!``f!!!!$3!!!!!!!!!!#bS!!!!#R"bC at B!#qYj!!!!03!!!!!!!!!
+!,,)!!!$%F(*PCJ!-9+J!!!!f!!!!!!!!!!!YGJ!!!4C`FQ9Q!!`$63!!!$F!!!!
+!!!!!!#k-!!!!ZR"bC at B!#lq3!!!!!$J!!!!!!!!!!#p'!!!!,R"bC at B!#jj(!!!
+!13!!!!!!!!!!,h3!!!)-F(*PCJ!,ER%!!!!k!!!CH3!!:

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-aix.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-aix.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-aix.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-aix.h,v 1.5 1997/11/14 02:44:46 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-alpha.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-alpha.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-alpha.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-alpha.h,v 1.5 1997/11/14 02:44:46 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-convex.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-convex.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-convex.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-convex.h,v 1.5 1997/11/14 02:44:48 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-dec.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-dec.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-dec.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-dec.h,v 1.5 1997/11/14 02:44:49 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-fbsd.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-fbsd.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-fbsd.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-fbsd.h,v 1.5 1997/11/14 02:44:49 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-fujivp.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-fujivp.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-fujivp.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-fujivp.h,v 1.4 1997/11/14 02:44:50 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-hpux.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-hpux.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-hpux.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-hpux.h,v 1.5 1997/11/14 02:44:50 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-ia64.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-ia64.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-ia64.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-ia64.h,v 1.1 2000/05/23 18:07:10 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64) || defined IA64
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix32.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix32.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix32.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-irix32.h,v 1.5 1997/11/14 02:44:51 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix4.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix4.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix4.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-irix4.h,v 1.5 1997/11/14 02:44:52 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix5.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix5.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix5.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-irix5.h,v 1.5 1997/11/14 02:44:52 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix6.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix6.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-irix6.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-irix6.h,v 1.6 1997/11/14 02:44:53 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-linux.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-linux.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-linux.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-linux.h,v 1.5 1997/11/14 02:44:54 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-mac.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-mac.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-mac.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-mac.h,v 1.5 1997/11/14 02:44:54 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-solaris.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-solaris.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-solaris.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-solaris.h,v 1.5 1997/11/14 02:44:55 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-solarisx86.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-solarisx86.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-solarisx86.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-solarisx86.h,v 1.5 1997/11/14 02:44:56 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-sun.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-sun.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-sun.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-sun.h,v 1.5 1997/11/14 02:44:56 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-t3e.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-t3e.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-t3e.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-t3e.h,v 1.3 1997/11/14 02:44:57 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-unicos.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-unicos.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-unicos.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-unicos.h,v 1.5 1997/11/14 02:44:58 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-vms.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-vms.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/config/netcdf-vms.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/* 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-vms.h,v 1.5 1997/11/14 02:44:58 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#ifdef __MWERKS__
+#ifndef HDF
+#define HDF
+#endif
+#endif /* __MWERKS__ */
+
+/*
+ * 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 __MWERKS__
+#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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64)
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/descrip.mms
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/descrip.mms	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/descrip.mms	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,70 @@
+! $Id: descrip.mms,v 1.2 1993/05/03 21:25:02 chouck Exp $
+!
+!          MMS file for netcdf
+!
+!==============================================================================
+! ASSUMPTIONS:
+
+!==============================================================================
+! CUSTOMIZATIONS (change as necessary):
+
+!Root of the installation:
+INSTROOT	= LDMROOT:
+
+!Operating system version:
+OS		= vms_5_4
+
+!Compilation options:
+COPTS		= /opt/nodebug
+
+!==============================================================================
+INCDIR		= $(INSTROOT)[include]
+LIBDIR		= $(INSTROOT)[lib]
+LIBRARY		= [-]netcdf.olb
+LINKFLAGS	= /nodebug/exec=$(mms$target_name).exe
+!LINKFLAGS	= /debug/exec=$(mms$target_name).exe
+CFLAGS		= $(COPTS)/include=[-.xdr]
+LIBOBJS       = array=array.obj, attr=attr.obj, cdf=cdf.obj, dim=dim.obj,-
+                  file=file.obj, iarray=iarray.obj, error=error.obj,-
+                  putget=putget.obj, putgetg=putgetg.obj,-
+                  sharray=sharray.obj, string=string.obj,-
+                  var=var.obj,-
+                  htons.obj, ntohs.obj
+CLIB 		=  sys$library:vaxcrtl.olb/lib
+LINKLIBS 	=  $(LIBRARY)/lib, $(CLIB)
+
+all :		library, test
+	@ continue
+
+library :	$(LIBRARY)($(LIBOBJS))
+	@ continue
+
+test :		cdftest.exe
+	run sys$disk:[]cdftest.exe
+
+cdftest.exe :	cdftest.obj, $(LIBRARY)
+	- $(LINK)$(LINKFLAGS) cdftest.obj, $(LINKLIBS)
+
+install :	all
+	copy netcdf.h $(INCDIR)
+
+clean :
+	purge
+	- delete *.obj.*,*.lis.*,*.map.*,*.exe.*
+
+cdftest.obj :	cdftest.c local_nc.h netcdf.h alloc.h
+
+array.obj :	array.c local_nc.h netcdf.h alloc.h
+attr.obj :	attr.c local_nc.h netcdf.h alloc.h
+cdf.obj :	cdf.c local_nc.h netcdf.h alloc.h
+dim.obj :	dim.c local_nc.h netcdf.h alloc.h
+file.obj :	file.c local_nc.h netcdf.h alloc.h
+iarray.obj :	iarray.c local_nc.h netcdf.h alloc.h
+error.obj :	error.c alloc.h
+putget.obj :	putget.c local_nc.h netcdf.h
+putgetg.obj:    putgetg.c local_nc.h netcdf.h
+sharray.obj :	sharray.c local_nc.h netcdf.h alloc.h
+string.obj :	string.c local_nc.h netcdf.h alloc.h
+var.obj :	var.c local_nc.h netcdf.h alloc.h
+htons.obj :	htons.mar
+ntohs.obj :	ntohs.mar

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/dim.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/dim.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/dim.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,356 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: dim.c,v 1.12 1997/11/17 02:29:30 sxu Exp $ */
+
+#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->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 ;
+	int ii ;
+	int 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 >= 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;
+{
+  int ii;
+  int 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 ;
+	int ii ;
+	int 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 ;
+	int ii ;
+	int 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) ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/error.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/error.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/error.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,217 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $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
+
+#ifdef VMS
+#include <ssdef.h>
+#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 vms
+/*
+ * On the vms system, when a system error occurs which is not
+ * mapped into the unix styled errno values, errno is set EVMSERR
+ * and a VMS error code is set in vaxc$errno.
+ * This routine prints the systems message associated with status return
+ * from a system services call.
+ */
+
+#include <descrip.h>
+#include <ssdef.h>
+
+static int
+vmserror1( int status )
+{
+	short msglen ;
+	char msgbuf[256] ;
+	$DESCRIPTOR(message, msgbuf) ;
+	register ret ;
+
+	ret = SYS$GETMSG(status, &msglen, &message, 15, 0) ;
+	
+	switch(ret) {
+	case SS$_BUFFEROVF :
+	case SS$_NORMAL :
+		(void) fprintf(stderr, "%.*s\n", msglen, msgbuf) ;
+		break ;
+	default :
+		break ;
+	}
+	return(ret) ;
+}
+#endif /* vms */
+
+
+#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 ;
+#ifdef vms
+	case EVMSERR :
+            ncerr = NC_SYSERR ;
+            (void) fputc(': ',stderr) ;
+            (void) vmserror1(vaxc$errno) ;
+            break ;
+#endif /* vms */
+            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) ;
+	}
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/error.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/error.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/error.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,17 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: error.h,v 1.3 1997/11/05 19:40:12 koziol Exp $ */
+#ifndef _NC_ERROR_
+#define _NC_ERROR_
+
+#ifndef NO_STDARG
+void nc_serror(const char *fmt, ...) ;
+void NCadvise(int err, const char *fmt,...) ;
+#else
+void nc_serror() ;
+void NCadvise() ;
+#endif /* NO_STDARG */
+
+#endif /* _NC_ERROR_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/file.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/file.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/file.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,930 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: file.c,v 1.14 1997/11/05 19:40:13 koziol Exp $ */
+
+#ifdef DEBUG
+#include <assert.h>
+#endif /* DEBUG */
+
+#include	<string.h>
+#include	"local_nc.h"
+#include	"alloc.h"
+#ifdef vms
+#   include <unixio.h>
+#   include <unixlib.h>
+#   include <file.h>
+#endif
+
+static int _ncdf = 0 ; /*  high water mark on open cdf's */
+static NC *_cdfs[MAX_NC_OPEN] ;
+#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
+
+/*
+ *  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 ;
+
+
+	/* 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) ;
+      }
+
+	handle = NC_new_cdf(path, mode) ;
+	if( handle == NULL)
+      {
+          if((mode & 0x0f) == NC_CLOBBER)
+            {
+                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++ ;
+	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? */
+                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 ;
+            }
+      }
+	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 ;
+
+	if(cdfid == _ncdf - 1)
+		_ncdf-- ;
+
+	return(0) ;
+}
+
+
+/* 
+ * 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
+    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++ ;
+
+	/* 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 ;
+{
+	int 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 ;
+	int ii ;
+	int 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-- ;
+                NC_free_cdf(handle) ;
+                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-- ;
+          handle->redefid = -1 ;
+      }
+
+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 ;
+
+	if(cdfid == _ncdf - 1)
+		_ncdf-- ;
+
+	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 ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/globdef.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/globdef.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/globdef.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,41 @@
+/*
+ *	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: globdef.c,v 1.1 1993/04/21 21:50:03 chouck Exp $
+ *
+ * This file initializes all global variables.  It's a separate file in order
+ * to allow the creation of SunOS sharable-libraries.
+ */
+
+#include "netcdf.h"
+
+
+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.
+ */
+char *cdf_routine_name = "netcdf";

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdf2netcdf.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdf2netcdf.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdf2netcdf.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,54 @@
+/* $Id: hdf2netcdf.h,v 1.1 1996/05/07 22:13:01 acheng Exp $ */
+
+/* If we disable the HDF version of the netCDF API (ncxxx interface)
+   (-DHAVE_NETCDF) 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. */
+#ifdef HAVE_NETCDF
+#define  HNAME(x)  sd_##x     /* pre-append 'sd_' to all netCDF fcn names */
+#else /* !HAVE_NETCDF i.e USING HDF NETCDF */
+#define  HNAME(x)   x
+#endif /* !HAVE_NETCDF i.e. USING HDF NETCDF */
+
+/* If using the real netCDF library and API (use -DHAVE_NETCDF)
+   need to mangle the HDF versions of netCDF API function names 
+   to not conflict w/ oriinal netCDF ones */
+#ifdef HAVE_NETCDF
+#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 /* HAVE_NETCDF i.e NOT USING HDF version of netCDF API */ 

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdfout.sav
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdfout.sav	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdfout.sav	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,11 @@
+0 := 7
+1 := 9
+2 := 11
+3 := 19
+4 := 21
+5 := 23
+6 := 31
+7 := 33
+8 := 35
+9 := 0
+num_err == 0

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdfsds.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdfsds.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdfsds.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1830 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.44 $";
+#endif
+
+/* $Id: hdfsds.c,v 1.44 1998/02/02 21:50:51 smitchel Exp $ */
+
+/***************************************************************************
+ *
+ * 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
+
+ **************************************************************************/
+
+#if (defined macintosh) || (defined MPW)
+#define HDF  /* Need this for the Macintosh, avoid putting on compile line */
+#endif
+
+#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 */
+
+                            /*
+                             * 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;
+
+                /*
+                 * 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 */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,3649 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.57 $";
+#endif
+
+/* $Id: hdftest.c,v 1.57 1999/02/25 08:18:07 bmribler Exp $ */
+
+#include "mfhdf.h"
+
+#ifdef macintosh
+    #include <LowMem.h>
+#endif
+
+#ifdef HDF
+
+/* Macro to check status value and print error message */
+#define CHECK(status, fail_value, name) {if(status == fail_value) { \
+    printf("*** Routine %s FAILED at line %d ***\n", name, __LINE__); num_err++;}}
+/* BMR - 2/21/99: added macro VERIFY to use in testing SDcheckempty */
+#define VERIFY(item, value, test_name) {if(item != value) { \
+    printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", test_name, (long)item,(int)__LINE__,__FILE__); num_err++;}}
+
+
+#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   "extfile.hdf"   /* 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 
+
+/* Macintosh console stuff */
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+/* Following section used in CHUNK tests */
+#ifdef CHUNK_TEST
+/* 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}}};
+
+static intn
+test_chunk()
+{
+    int32 fchk; /* File handles */
+    int32 nt;                /* Number type */
+    int32 dimsize[10];       /* dimension sizes */
+    int32 newsds, newsds2; /* SDS handles */
+    int32   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 rchunk_def;    /* Chunk defintion read */ 
+    int32   cflags;              /* chunk flags */
+    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_err = 0;    /* number of errors so far */
+
+    /* 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;
+    newsds8 = SDcreate(fchk, "DataSetChunked_2D_1", DFNT_UINT16, 2, d_dims);
+    if(newsds8 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 1. Failed to create a new data set \n");
+        num_err++;
+        goto test2;
+      }
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(newsds8, (VOIDP) &fill_u16);
+    CHECK(status, FAIL, "Chunk Test 1. 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(newsds8, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 1. Failed to create new chunked data set\n");
+        num_err++;
+        goto test2;
+      }
+
+    /* Set Chunk cache to hold 2 chunks */
+    status = SDsetchunkcache(newsds8, 2, 0);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 1. SDsetchunkcache failed\n");
+        num_err++;
+        goto test2;
+      }
+
+
+    /* Write data */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    edge_dims[0] = 9;
+    edge_dims[1] = 4;
+    status = SDwritedata(newsds8, 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_err++;
+        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(newsds8, 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_err++;
+                }
+          }
+      }
+    /* Get chunk lengths */
+    status = SDgetchunkinfo(newsds8, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 1. SDgetchunkinfo failed \n");
+        num_err++;
+        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_err++;
+        goto test2;
+      }
+
+    /* Close down this SDS*/    
+    status = SDendaccess(newsds8);
+    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;
+    newsds7 = SDcreate(fchk, "DataSetChunked_2D_2", DFNT_UINT16, 2, d_dims);
+    if(newsds7 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2. Failed to create a new data set \n");
+        num_err++;
+        goto test3;
+      }
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(newsds7, (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(newsds7, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2. Failed to create new chunked data set\n");
+        num_err++;
+        goto test3;
+      }
+
+    /* Set Chunk cache to hold 2 chunks */
+    status = SDsetchunkcache(newsds7, 2, 0);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDsetchunkcache failed\n");
+        num_err++;
+        goto test3;
+      }
+
+    /* Write data use SDwriteChunk */
+
+    /* Write chunk 1 */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    status = SDwritechunk(newsds7, start_dims, (VOIDP) chunk1_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 1\n");
+        num_err++;
+        goto test3;
+      }
+
+    /* Write chunk 4 */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    status = SDwritechunk(newsds7, start_dims, (VOIDP) chunk4_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 4\n");
+        num_err++;
+        goto test3;
+      }
+
+    /* Write chunk 2 */
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    status = SDwritechunk(newsds7, start_dims, (VOIDP) chunk2_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 2\n");
+        num_err++;
+        goto test3;
+      }
+
+    /* Write chunk 5 */
+    start_dims[0] = 2;
+    start_dims[1] = 0;
+    status = SDwritechunk(newsds7, start_dims, (VOIDP) chunk5_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 5\n");
+        num_err++;
+        goto test3;
+      }
+
+    /* Write chunk 3 */
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    status = SDwritechunk(newsds7, start_dims, (VOIDP) chunk3_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 3\n");
+        num_err++;
+        goto test3;
+      }
+
+    /* Write chunk 6 */
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    status = SDwritechunk(newsds7, start_dims, (VOIDP) chunk6_2u16);
+     if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 6\n");
+        num_err++;
+        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(newsds7, 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_err++;
+                }
+          }
+      }
+    /* Get chunk lengths */
+    status = SDgetchunkinfo(newsds7, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDgetchunkinfo failed \n");
+        num_err++;
+        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_err++;
+        goto test3;
+      }
+
+    /* Close down this SDS*/    
+    status = SDendaccess(newsds7);
+    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;
+    newsds4 = SDcreate(fchk, "DataSetChunked_3D_1", DFNT_FLOAT32, 3, d_dims);
+    if(newsds4 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 3. Failed to create a new 3D float32 data set \n");
+        num_err++;
+        goto test4;
+      }
+
+    max = 0.0;
+    status = SDsetfillvalue(newsds4, (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(newsds4, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 3. Failed to create new chunked data set\n");
+        num_err++;
+        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(newsds4, 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_err++;
+        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(newsds4, 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_err++;
+                    }
+              }
+          }
+      }
+
+    /* Close down SDS*/    
+    status = SDendaccess(newsds4);
+    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;
+    newsds5 = SDcreate(fchk, "DataSetChunked_3D_2", DFNT_UINT16, 3, d_dims);
+    if(newsds5 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 4. Failed to set a new uint16 3D data set chunked\n");
+        num_err++;
+        goto test5;
+      }
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(newsds5, (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(newsds5, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 4. Failed to create new chunked data set\n");
+        num_err++;
+        goto test5;
+      }
+
+    /* Set Chunk cache */
+    status = SDsetchunkcache(newsds5, 4, 0);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 4. SDsetchunkcache failed\n");
+        num_err++;
+        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(newsds5, 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_err++;
+        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(newsds5, 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_err++;
+                    }
+              }
+          }
+      }
+    /* Check chunk info */
+    status = SDgetchunkinfo(newsds5, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 4. SDgetchunkinfo failed \n");
+        num_err++;
+        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_err++;
+        goto test5;
+      }
+
+    /* Close down SDS*/    
+    status = SDendaccess(newsds5);
+    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;
+    newsds6 = SDcreate(fchk, "DataSetChunked_3D_3", DFNT_UINT8, 3, d_dims);
+    if(newsds6 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. Failed to set a new uint8 3D data set chunked\n");
+        num_err++;
+        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(newsds6, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. Failed to create new chunked data set\n");
+        num_err++;
+        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(newsds6, 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_err++;
+        goto test6;
+      }
+#endif
+
+    /* 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 5. SDwritechunk failed to write chunk 1\n");
+        num_err++;
+        goto test6;
+      }
+
+    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 5. SDwritechunk failed to write chunk 4\n");
+        num_err++;
+        goto test6;
+      }
+
+    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 5. SDwritechunk failed to write chunk 2\n");
+        num_err++;
+        goto test6;
+      }
+
+    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 5. SDwritechunk failed to write chunk 5\n");
+        num_err++;
+        goto test6;
+      }
+
+    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 5. SDwritechunk failed to write chunk 3\n");
+        num_err++;
+        goto test6;
+      }
+
+    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 5. SDwritechunk failed to write chunk 6\n");
+        num_err++;
+        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(newsds6, 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_err++;
+                    }
+              }
+          }
+      }
+
+    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 5. SDreadchunk failed to read chunk 1\n");
+        num_err++;
+        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_err++;
+            }
+       }
+
+    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 5. SDreadchunk failed to read chunk 2\n");
+        num_err++;
+        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_err++;
+            }
+       }
+    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 5. SDreadchunk failed to read chunk 3\n");
+        num_err++;
+        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_err++;
+            }
+       }
+
+    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, "Chunk Test 5. SDreadchunk failed to read chunk 4\n");
+        num_err++;
+        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_err++;
+            }
+       }
+
+    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 5. SDreadchunk failed to read chunk 5\n");
+        num_err++;
+        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_err++;
+            }
+       }
+
+    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 5. SDreadchunk failed to read chunk 6\n");
+        num_err++;
+        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_err++;
+            }
+       }
+
+    /* Close down SDS*/    
+    status = SDendaccess(newsds6);
+    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. 
+     *         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_err++;
+        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_err++;
+        goto test7;
+      }
+
+    /* Close down SDS ie. template creation*/    
+    status = SDendaccess(newsds6);
+    CHECK(status, FAIL, "Chunk Test 6. SDendaccess");
+
+    newsds6 = FAIL;
+
+    /* Select same SDS again, fist 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_err++;
+          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_err++;
+          goto test7;
+      }
+
+    /* 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_err++;
+        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_err++;
+        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_err++;
+        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_err++;
+        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_err++;
+        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_err++;
+        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_err++;
+                    }
+              }
+          }
+      }
+
+    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_err++;
+        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_err++;
+            }
+       }
+
+    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_err++;
+        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_err++;
+            }
+       }
+    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_err++;
+        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_err++;
+            }
+       }
+
+    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_err++;
+        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_err++;
+            }
+       }
+
+    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_err++;
+        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_err++;
+            }
+       }
+
+    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_err++;
+        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_err++;
+            }
+       }
+
+    /* 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;
+    newsds8 = SDcreate(fchk, "DataSetChunked_2D_GZIP_1", DFNT_UINT16, 2, d_dims);
+    if(newsds8 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 7. Failed to create a new 2D uint16 data set \n");
+        num_err++;
+        goto test8;
+      }
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(newsds8, (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(newsds8, 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_err++;
+        goto test8;
+      }
+
+    /* Set Chunk cache to hold 2 chunks */
+    status = SDsetchunkcache(newsds8, 2, 0);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 7. SDsetchunkcache failed\n");
+        num_err++;
+        goto test8;
+      }
+
+
+    /* Write data */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    edge_dims[0] = 9;
+    edge_dims[1] = 4;
+    status = SDwritedata(newsds8, 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_err++;
+        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(newsds8, 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_err++;
+                }
+          }
+      }
+    /* Get chunk lengths */
+    status = SDgetchunkinfo(newsds8, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 7. SDgetchunkinfo failed \n");
+        num_err++;
+        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_err++;
+        goto test8;
+      }
+
+    /* Close down this SDS*/    
+    status = SDendaccess(newsds8);
+    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;
+    newsds = SDcreate(fchk, "Chunked_NBitDataSet", nt, 2, dimsize);
+    if(newsds == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 8. SDcreate Failed to create a new chunked, nbit data set \n");
+        num_err++;
+        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;
+    status = SDsetchunk(newsds, chunk_def, HDF_CHUNK | HDF_NBIT);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 8. SDsetchunk Failed to create new chunked, NBIT data set\n");
+        num_err++;
+        goto done;
+      }
+
+    /* write out the data */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "Chunk Test 8. SDwritedata");
+
+    /* end access to SDS */
+    status = SDendaccess(newsds);
+    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 */
+    newsds2 = SDselect(fchk, 0);
+    if(newsds2 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 8. Failed to select a data set for n-bit access\n");
+        num_err++;
+        goto done;
+      }
+
+    /* read the n-bit data back in */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, 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_err++;
+          }
+      }
+
+    /* Get chunk lengths */
+    status = SDgetchunkinfo(newsds2, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 8. SDgetchunkinfo failed \n");
+        num_err++;
+        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_err++;
+        goto done;
+      }
+
+    /* end access to SDS */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "Chunk Test 8. SDendaccess");
+
+    /* close file */
+    status = SDend(fchk);
+    CHECK(status, FAIL, "Chunk Test 8. SDend");
+
+  done:
+
+    return num_err;
+} /* test_chunk() */
+#endif /* CHUNK_TEST */
+
+#ifdef NETCDF_READ_TEST
+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. */
+static 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[MAX_VAR_DIMS];
+    int32 start[MAX_VAR_DIMS];
+    int32 edges[MAX_VAR_DIMS];
+    int16 array_data[2][3];
+	char name[MAX_NC_NAME];
+    int32 status;
+    intn i, j;
+    int     num_err = 0;    /* number of errors so far */
+
+	/* Open the file 'test1.nc' and initialize the SDxxx interface. */
+	sd_id = SDstart("test1.nc", 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_err++;
+      }
+
+    if (n_file_attrs != 1 )
+      {
+          fprintf(stderr,"netCDF Read Test 1: SDfileinfo returned wrong number of file attributes in file test1.nc \n");
+          num_err++;
+      }
+
+	/* 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");
+
+    return num_err;
+} /* test_netcdf_reading() */
+#endif /* NETCDF_READ_TEST */
+
+int 
+main(int argc, char *argv[])
+{
+    int32 f1, f2, fext, fnbit, fcomp; /* File handles */
+    int32 nt;                /* Number type */
+    int32 dimsize[10];       /* dimension sizes */
+    int32 newsds, newsds2, newsds3; /* SDS handles */
+    int32 sdsid;                    /* SDS handle */
+    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 ? */
+#if defined COMP_TEST 
+    comp_info cinfo;            /* compression information structure */
+#endif /* COMP_TEST */
+    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;
+    int32   idata[100];
+    int32   rdata[100];
+    int16   sdata[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;
+    intn emptySDS = FALSE;
+    int     num_err = 0;    /* number of errors so far */
+
+
+#ifdef macintosh
+	Ptr	currStackBase, newApplLimit, currApplLimit, currHeapEnd;
+
+
+	/*	Expand the stack.  hdf_write_var( ) causes the stack to collide with 
+		the 68K application heap when only the default stack size is used. */
+	currStackBase = LMGetCurStackBase( );
+	newApplLimit = (Ptr) ( (long) currStackBase - 65536L );
+	currApplLimit = GetApplLimit( );
+	if ( newApplLimit > currApplLimit )	/* If we're about to shrink the stack, ... */
+		 newApplLimit = currApplLimit;	/* ... then don't. */
+
+	currHeapEnd = LMGetHeapEnd( );
+	if ( newApplLimit < currHeapEnd )	/* If we're about overlap the stack and heap, */
+		 newApplLimit = currHeapEnd;	/* ... then don't. */
+
+	SetApplLimit( newApplLimit );
+#endif
+
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+    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_err++;
+          SDend(f1);
+      }
+
+    f1 = SDstart(UFOFILE, DFACC_RDWR);
+    if (f1 != FAIL)
+      {
+          fprintf(stderr, "SDstart(..., RDWR) should fail\n");
+          num_err++;
+          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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+          }
+      }
+
+    /* hmm...lets store an attribute here for the dimension */
+    max = 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_err++;
+      }
+
+    if(count != 1) 
+      {
+        fprintf(stderr, "Wrong count for SDattrinfo(dim)\n");
+        num_err++;
+      }
+
+    if(strcmp(name, "DimAttr")) 
+      {
+        fprintf(stderr, "Wrong name for SDattrinfo(dim)\n");
+        num_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    if(count != 1) 
+      {
+        fprintf(stderr, "Wrong count for SDattrinfo(dim)\n");
+        num_err++;
+      }
+
+    if(strcmp(name, "Integer")) 
+      {
+        fprintf(stderr, "Wrong name for SDattrinfo(dim)\n");
+        num_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    if(count != 1) 
+      {
+        fprintf(stderr, "Wrong count for SDattrinfo(dim)\n");
+        num_err++;
+      }
+
+    if(strcmp(name, "UnsignedInteger")) 
+      {
+        fprintf(stderr, "Wrong name for SDattrinfo(dim)\n");
+        num_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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 = 10.0;
+    min = 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_err++;
+      }
+    if(HDstrcmp(u, "TheUnits")) 
+      {
+        fprintf(stderr, "Bogus units returned (%s)\n", u);
+        num_err++;
+      }
+    if(HDstrcmp(fmt, "")) 
+      {
+        fprintf(stderr, "Bogus format returned\n");
+        num_err++;
+      }
+    if(HDstrcmp(c, "TheCordsys")) 
+      {
+        fprintf(stderr, "Bogus cordsys returned\n");
+        num_err++;
+      }
+
+    /* retrieve CHAR attribute for 'DataSetAlpha' */
+    status = SDfindattr(newsds, "spam");
+    if(status != 2) 
+      {
+        fprintf(stderr, "Bad index for SDfindattr\n");
+        num_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    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_err++;
+      }
+    if(data[3] != -17.5) 
+      {
+        fprintf(stderr, "Wrong value returned loc 3: %f\n",(float)data[3]);
+        num_err++;
+      }
+    if(data[5] != 1.0) 
+      {
+        fprintf(stderr, "Wrong value returned loc 5: %f\n",(float)data[5]);
+        num_err++;
+      }
+    if(data[6] != -17.5) 
+      {
+        fprintf(stderr, "Wrong value returned loc 6: %f\n",(float)data[6]);
+        num_err++;
+      }
+    if(data[8] != 4.0) 
+      {
+        fprintf(stderr, "Wrong value returned loc 8: %f\n",(float)data[8]);
+        num_err++;
+      }
+
+    for(i = 0; i < 50; i++)
+        sdata[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) sdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* why do we print these 10 values here?....*/
+    for(i = 0; i < 10; i++)
+        printf("%d := %d\n", i, sdata[i]);
+    
+    /* 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_err++;
+      }
+
+    if(cale != 5.0) 
+      {
+        fprintf(stderr, "Wrong calibration info\n");
+        num_err++;
+      }
+
+    if(ioff != 3.0) 
+      {
+        fprintf(stderr, "Wrong calibration info\n");
+        num_err++;
+      }
+
+    if(ioffe != 2.5) 
+      {
+        fprintf(stderr, "Wrong calibration info\n");
+        num_err++;
+      }
+
+    if(nt != DFNT_INT8) 
+      {
+        fprintf(stderr, "Wrong calibration info\n");
+        num_err++;
+      }
+
+    /* 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");
+
+    /* BMR - 2/21/99: added a 2x2 dataset called EmptyDataset to file 
+       'test1.hdf' to later test new routine SDcheckempty.  */
+
+    /* create a 2x2 dataset called EmptyDataset in file test1.hdf */
+    dimsize[0] = 2;
+    dimsize[1] = 2;
+    newsds = SDcreate(f1, "EmptyDataset", DFNT_FLOAT32, 2, dimsize);
+    CHECK(newsds, FAIL, "SDcreate: Failed to create a new data set EmptyDataset ");
+    /* Close down this SDS*/
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "Test empty SDS. SDendaccess");
+    /* end BMR */
+
+    /* 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");
+
+    /* 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)");
+
+    /* 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");
+
+    /* BMR - 2/21/99: get index of dataset 'EmptyDataset' */
+    index = SDnametoindex(f1, "EmptyDataset");
+    CHECK(index, FAIL, "SDnametoindex: (EmptyDataset)");
+    
+    /* Select dataset 'EmptyDataset' */
+    sdsid = SDselect(f1, index);
+
+    /* This dataset should be empty, if SDcheckempty returns FAIL or the
+       parameter emptySDS is not TRUE, the test fails */
+    status = SDcheckempty( sdsid, &emptySDS );    
+    CHECK( status, FAIL, "SDcheckempty" );
+    VERIFY( emptySDS, TRUE, "SDcheckempty" );
+
+    /* end access to data set 'EmptyDataset' */
+    status = SDendaccess(sdsid);
+    CHECK(status, FAIL, "SDendaccess");
+    /* end BMR */
+
+    /* 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 it's index */
+    sdid = SDselect(f1, index);
+    CHECK(sdid, FAIL, "SDselect: (FIXED)");
+
+    /* 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 acces 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 it's 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, "wrong value: should be %d, got %d %d\n",
+                           100 + i-12, (int)idata[i], (int)idata[i+12]);
+           num_err++;
+          }
+      }
+    
+    for (i=18; i<24; i++)  
+      {
+        if (idata[i] ==fillval) 
+          {
+           fprintf(stderr, "wrong value: should not be %d, got %d\n",
+                           (int)fillval, (int)idata[i]);
+           num_err++;
+          }
+      }
+
+    /* 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 it's 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, "wrong value: should be %d, got %d \n",
+                           100 + i-12, (int)idata[i]);
+           num_err++;
+          }
+      }
+
+    for (i=18; i<24; i++)  
+      {
+        if (idata[i] != fillval) 
+          {
+           fprintf(stderr, "wrong value: should be %d, got %d\n",
+                           (int)fillval, (int)idata[i]);
+           num_err++;
+          }
+      }
+
+    /* 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 it's 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, "wrong value for %d: should be %d, got %d\n",
+                           i-12, (int)idata[i], (int)idata[i+12]);
+           num_err++;
+          }
+      }
+
+    for (i=18; i<24; i++)  
+      {
+        if (idata[i] !=fillval) 
+          {
+           fprintf(stderr, "wrong value: should be %d, got %d\n",
+                           (int)fillval, (int)idata[i]);
+           num_err++;
+          }
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+    /* 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_err++;
+       }
+    /* 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_err++;
+      }
+
+    /* 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, "wrong value: should be %d, got %d\n",
+                           i, (int)idata[i]);
+           num_err++;
+          }
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+
+    /* 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_err++;
+      }
+    /* 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_err++;
+      }
+
+    /* 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");
+
+#ifdef EXTERNAL_TEST
+
+    /*
+     * 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_err++;
+          }
+      }
+
+    if(idata[8] != 10) 
+      {
+        fprintf(stderr, "Bogus val in last loc in wrapper dset want 10  got %ld\n",
+		(long)idata[8]);
+        num_err++;
+      }
+
+    /* End access to data set "WrapperDataSet" */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close file 'exttst.hdf' */
+    status = SDend(fext);
+    CHECK(status, FAIL, "SDend");
+
+#endif /* EXTERNAL_TEST */
+
+
+#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_err++;
+          }
+      }
+
+    /* 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
+     */
+
+#ifdef QAK
+printf("writing 1st compressed dataset, basic skipping huffman\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+
+#ifdef QAK
+printf("before SDsetcompress\n");
+#endif /* QAK */
+    cinfo.skphuff.skp_size=4;
+    status = SDsetcompress(newsds,COMP_CODE_SKPHUFF,&cinfo);
+    CHECK(status, FAIL, "SDcompress");
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDwritedata\n");
+#endif /* QAK */
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    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 */
+#ifdef QAK
+printf("reading compressed dataset\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDreaddata\n");
+#endif /* QAK */
+    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_err++;
+        }
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+#ifdef QAK
+printf("writing 2nd compressed dataset, partially filled & skipping huffman\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    fillval=43;
+#ifdef QAK
+printf("before SDsetfillvalue\n");
+#endif /* QAK */
+    status = SDsetfillvalue(newsds,(VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+#ifdef QAK
+printf("before SDsetcompress\n");
+#endif /* QAK */
+    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;
+
+    start[0] = 1;
+    start[1] = 0;
+    end[0]   = 3;
+    end[1]   = 5;
+#ifdef QAK
+printf("before SDwritedata\n");
+#endif /* QAK */
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) &idata[5]);
+    CHECK(status, FAIL, "SDwritedata");
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    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 */
+#ifdef QAK
+printf("reading compressed dataset\n");
+#endif /* QAK */
+    fcomp = SDstart(COMPFILE2, 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_err++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDreaddata\n");
+#endif /* QAK */
+    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_err++;
+        }
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+#ifdef QAK
+printf("creating 3rd compressed dataset, compressed template & skipping huffman\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    fillval=56;
+#ifdef QAK
+printf("before SDsetfillvalue\n");
+#endif /* QAK */
+    status = SDsetfillvalue(newsds,(VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+#ifdef QAK
+printf("before SDsetcompress\n");
+#endif /* QAK */
+    cinfo.skphuff.skp_size=4;
+    status = SDsetcompress(newsds,COMP_CODE_SKPHUFF,&cinfo);
+    CHECK(status, FAIL, "SDsetcompress");
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    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 */
+#ifdef QAK
+printf("reading compressed dataset\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDreaddata\n");
+#endif /* QAK */
+    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_err++;
+        }
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+#ifdef QAK
+printf("creating 4th compressed dataset, compressed template read, then partial write & skipping huffman\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    fillval=67;
+#ifdef QAK
+printf("before SDsetfillvalue\n");
+#endif /* QAK */
+    status = SDsetfillvalue(newsds,(VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+#ifdef QAK
+printf("before SDsetcompress\n");
+#endif /* QAK */
+    cinfo.skphuff.skp_size=4;
+    status = SDsetcompress(newsds,COMP_CODE_SKPHUFF,&cinfo);
+    CHECK(status, FAIL, "SDsetcompress");
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    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 */
+#ifdef QAK
+printf("reading compressed dataset\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDreaddata\n");
+#endif /* QAK */
+    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_err++;
+        }
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+#ifdef QAK
+printf("writing compressed dataset\n");
+#endif /* QAK */
+    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_err++;
+    }
+    /* 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;
+#ifdef QAK
+printf("before SDwritedata\n");
+#endif /* QAK */
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) &idata[10]);
+    CHECK(status, FAIL, "SDwritedata");
+
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDreaddata\n");
+#endif /* QAK */
+    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_err++;
+        }
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+#ifdef QAK
+printf("writing 5th compressed dataset, basic RLE\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+
+#ifdef QAK
+printf("before SDsetcompress\n");
+#endif /* QAK */
+    status = SDsetcompress(newsds,COMP_CODE_RLE,&cinfo);
+    CHECK(status, FAIL, "SDcompress");
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDwritedata\n");
+#endif /* QAK */
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    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 */
+#ifdef QAK
+printf("reading compressed dataset\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDreaddata\n");
+#endif /* QAK */
+    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_err++;
+        }
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+#ifdef QAK
+printf("writing 6th compressed dataset, no encoding\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+
+#ifdef QAK
+printf("before SDsetcompress\n");
+#endif /* QAK */
+    status = SDsetcompress(newsds,COMP_CODE_NONE,&cinfo);
+    CHECK(status, FAIL, "SDcompress");
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDwritedata\n");
+#endif /* QAK */
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    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 */
+#ifdef QAK
+printf("reading compressed dataset\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDreaddata\n");
+#endif /* QAK */
+    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_err++;
+        }
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+#ifdef QAK
+printf("writing 7th compressed dataset, deflate encoding\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+
+#ifdef QAK
+printf("before SDsetcompress\n");
+#endif /* QAK */
+    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;
+#ifdef QAK
+printf("before SDwritedata\n");
+#endif /* QAK */
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    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 */
+#ifdef QAK
+printf("reading compressed dataset\n");
+#endif /* QAK */
+    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_err++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+#ifdef QAK
+printf("before SDreaddata\n");
+#endif /* QAK */
+    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_err++;
+        }
+
+#ifdef QAK
+printf("before SDendaccess\n");
+#endif /* QAK */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+#ifdef QAK
+printf("before SDend\n");
+#endif /* QAK */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+#endif /* COMP_TEST */
+
+
+#ifdef CHUNK_TEST
+    status = test_chunk();
+    CHECK(status, FAIL, "test_chunk");
+    num_err = num_err + status;
+#endif /* CHUNK_TEST */
+
+#ifdef NETCDF_READ_TEST
+    status = test_netcdf_reading();
+    CHECK(status, FAIL, "test_netcdf_reading");
+    num_err = num_err + status;
+#endif /* NETCDF_READ_TEST */
+
+    printf("num_err == %d\n", num_err);
+
+    exit(0);
+}
+
+#endif /* HDF */
+
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -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 "hdftest.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)/hdftest.exe $(OUTDIR)/hdftest.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)/"hdftest.bsc" 
+
+$(OUTDIR)/hdftest.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdftest.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)/"hdftest.pdb" /MACHINE:I386 /OUT:$(OUTDIR)/"hdftest.exe" 
+
+$(OUTDIR)/hdftest.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)/hdftest.exe $(OUTDIR)/hdftest.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)/"hdftest.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)/"hdftest.bsc" 
+
+$(OUTDIR)/hdftest.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/hdftest.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)/"hdftest.pdb" /DEBUG /MACHINE:I386 /OUT:$(OUTDIR)/"hdftest.exe" 
+
+$(OUTDIR)/hdftest.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=.\hdftest.c
+
+$(INTDIR)/hdftest.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/hdftest.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,716 @@
+(This file must be converted with BinHex 4.0)
+
+:$fKNCR4PFh3ZF(*[DQ9MG!"069"b3eG*43!!!!#&J3!!!!$e2 at 0[Ef`!!!!#!!!
+!+!!!J#X!!)"6!!!&,J!!!$-"!!!!!!!!!!!!!!!!!J!!!!-8Y`!#!!!!!!!!!!)
+(F'&MDf&RC3!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Y`B at 0VB@GP,R0jE3!!!!!
+!!!!!!!!!!!!!!!!!!!!!$90jFh4PE80XBA0cCA-!!!!!!!!!!!!!!!!!!!!!!!!
+!"3%!rrm!!!!!!!!!!2rr!3%"!3%!!!!!(J%"!!!!!!!!!!#CQ3!!2rmrrcrr!!%
+!#3C0EfjKBfm!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"!!S!!S"`J+!!#J
+!#J(#!S!!!!!!!!!!!!!!!!!!!!!!!3!!!3!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!J%!!!-!!`!"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!-F(*PCJ!'H3F!!!!X!!!!!!!
+!!!!UV`!!!GT`FQ9Q!!C)33!!!#d!!!!!!!!!!#b*!!!!$("bC at B!"bMb!!!!,J!
+!!!!!!!!!,*8!!!"LF(*PCJ!'U+B!!!![!!!!!!!!!!!Xp`!!!$K`FQ9Q!!DDeJ!
+!!$!!!!!!!!!!!#d[!!!!$A"bC at B!"Y*2!!!!-3!!!!!!!!!!,6`!!!!8F(*PCJ!
+'YZ%!!!!b!!!!!!!!!!!Y8!!!!!T`FQ9Q!!EMd`!!!$-!!!!!!!!!!#eD!!!!a("
+bC at B!"URe!!!!0!!!!!!!!!!!,Ki!!!%@F(*PCJ!'Q*d!!!!e!!!!!!!!!!![0!!
+!!,T`FQ9Q!!F#T`!!!$B!!!!!!!!!!#rZ!!!!,R"bC at B!"SUa!!!!0`!!!!!!!!!
+!5(F!!!)-F(*PCJ!(!Y-!!!!i!!!!!!!!!!"Li3!!!B"YFh"T!!!!!3!!!!!!!#h
+`!!!:

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/htons.mar
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/htons.mar	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/htons.mar	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,9 @@
+	.TITLE	htons
+
+	.entry	htons,^m<>
+	rotl	#8,4(ap),r0
+	movb	5(ap),r0
+	movzwl	r0,r0
+	ret
+
+	.end

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/iarray.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/iarray.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/iarray.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,121 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: iarray.c,v 1.6 1997/11/05 19:40:20 koziol Exp $ */
+
+#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) ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/local_nc.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/local_nc.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/local_nc.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,656 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: local_nc.h,v 1.50 1999/02/25 19:02:43 koziol Exp $ */
+#ifndef _LOCAL_NC_
+#define _LOCAL_NC_
+
+/*
+ *	netcdf library 'private' data structures, objects and interfaces
+ */
+
+#if (defined macintosh) || (defined MPW) || (defined __MWERKS__)
+#ifndef HDF
+#define HDF  /* For Mac we need to define this, to avoid putting on compile line */
+#endif
+#define NO_SYS_XDR_INC /* use stuff in "::xdr" */
+#define NO_ACCESS
+#define NO_GETPID
+#endif /* non command line compilers */
+
+#include	<stddef.h> /* size_t */
+#include	<stdio.h> /* FILENAME_MAX */
+#if (defined MPW)
+#include   <memory.h>
+#endif /* MPW */
+
+#ifndef FILENAME_MAX
+#define FILENAME_MAX  255
+#endif
+
+/* Do we have systeme XDR files */
+#ifndef  NO_SYS_XDR_INC 
+#ifdef VMS
+#    define  STDC_INCLUDES
+#endif   /* VMS */
+#ifdef __ultrix
+#define GCC_FIX
+#endif /* __ultrix */
+#include	<rpc/types.h>
+#ifdef __ultrix
+#undef GCC_FIX
+#endif /* __ultrix */
+#include	<rpc/xdr.h>
+#else    /* NO_SYS_XDR_INC */
+#if defined(macintosh) || defined (SYMANTEC_C)
+     /* For the mac reference types.h specifically
+        because we don't want it to pick up the system one */
+#include      "::xdr:types.h"  /* "../xdr/types.h" */
+#include      "::xdr:xdr.h"    /* "../xdr/xdr.h" */
+#else /* !macintosh */
+#include      <types.h>  /* <types.h */
+#include      <xdr.h>    /* <xdr.h> */
+#endif /* !macintosh */
+#endif /* NO_SYSTEM_XDR_INCLUDES */
+
+#include	"netcdf.h" /* needed for defs of nc_type, ncvoid, ... */
+
+/* ptr argument type in internal functions */
+#define Void    char
+
+/*
+** Include HDF stuff
+*/
+#ifdef HDF
+
+#include "hdf.h"
+#include "vg.h"
+#include "hfile.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 ;
+	NC_iarray *assoc ; /* user definition */
+	unsigned long *shape ; /* compiled info */
+	unsigned long *dsizes ; /* compiled info */
+	NC_array *attrs;
+	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) */
+    uint16 data_tag;  /* tag of the variable's data storage (if exists) */
+    uint16 ndg_ref;   /* ref of ndg for this dataset */
+    intn   data_offset; /* non-traditional data may not begin at 0 */
+    int32  block_size;  /* size of the blocks for unlimited dim. datasets */
+    int numrecs;  /* number of records this has been filled to */
+    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
+
+extern 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 (use -DHAVE_NETCDF)
+   need to mangle the HDF versions of netCDF API function names 
+   to not conflict w/ oriinal netCDF ones */
+#ifdef 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 /* HAVE_NETCDF ie. NOT USING HDF version of netCDF ncxxx API */
+
+extern void		nc_serror			PROTO((
+	const char *fmt,
+	...
+)) ;
+extern void		NCadvise			PROTO((
+	int err,
+	const char *fmt,
+	...
+)) ;
+
+extern int        NC_computeshapes	PROTO((
+    NC		*handle
+));
+extern int        NC_xtypelen		PROTO((
+    nc_type	type
+));
+extern int        NC_xlen_array		PROTO((
+    NC_array	*array
+));
+extern int        NC_xlen_attr		PROTO((
+    NC_attr	**app
+));
+extern int        NC_xlen_cdf		PROTO((
+    NC		*cdf
+));
+extern int        NC_xlen_dim		PROTO((
+    NC_dim	**dpp
+));
+extern int        NC_xlen_iarray	PROTO((
+    NC_iarray	*iarray
+));
+extern int        NC_xlen_string	PROTO((
+    NC_string	*cdfstr
+));
+extern int        NC_xlen_var		PROTO((
+    NC_var	**vpp
+));
+
+extern char       *NCmemset		PROTO((
+    char	*s,
+    int		c,
+    int		n
+));
+
+extern void       NC_arrayfill		PROTO((
+    void	*lo,
+    size_t	len,
+    nc_type	type
+));
+extern void       NC_copy_arrayvals	PROTO((
+    char	*target,
+    NC_array	*array
+));
+extern int       NC_free_array		PROTO((
+    NC_array	*array
+));
+extern int       NC_free_attr		PROTO((
+    NC_attr	*attr
+));
+extern int       NC_free_cdf		PROTO((
+    NC		*handle
+));
+extern int       NC_free_dim		PROTO((
+    NC_dim	*dim
+));
+extern int       NC_free_iarray	PROTO((
+    NC_iarray	*iarray
+));
+extern int       NC_free_string	PROTO((
+    NC_string	*cdfstr
+));
+extern int       NC_free_var		PROTO((
+    NC_var	*var
+));
+
+extern Void      *NC_incr_array		PROTO((
+    NC_array	*array,
+    Void	*tail
+));
+
+extern int       NC_dimid               PROTO((
+    NC          *handle,
+    char        *name
+));
+extern bool_t     NCcktype		PROTO((
+    nc_type	datatype
+));
+extern bool_t     NC_indefine		PROTO((
+    int		cdfid,
+    bool_t	iserr
+));
+extern bool_t     xdr_cdf		PROTO((
+    XDR		*xdrs,
+    NC		**handlep
+));
+extern bool_t     xdr_numrecs		PROTO((
+    XDR		*xdrs,
+    NC		*handle
+));
+extern bool_t     xdr_shorts		PROTO((
+    XDR		*xdrs,
+    short	*sp,
+    u_int	cnt
+));
+extern bool_t     xdr_NC_array		PROTO((
+    XDR		*xdrs,
+    NC_array	**app
+));
+extern bool_t     xdr_NC_attr		PROTO((
+    XDR		*xdrs,
+    NC_attr	**app
+));
+extern bool_t     xdr_NC_dim		PROTO((
+    XDR		*xdrs,
+    NC_dim	**dpp
+));
+extern bool_t     xdr_NC_fill		PROTO((
+    XDR		*xdrs,
+    NC_var	*vp
+));
+extern bool_t     xdr_NC_iarray		PROTO((
+    XDR		*xdrs,
+    NC_iarray	**ipp
+));
+extern bool_t     xdr_NC_string		PROTO((
+    XDR		*xdrs,
+    NC_string	**spp
+));
+extern bool_t     xdr_NC_var		PROTO((
+    XDR		*xdrs,
+    NC_var	**vpp
+));
+
+extern size_t     NC_typelen		PROTO((
+    nc_type	type
+));
+
+extern NC        *NC_check_id		PROTO((
+    int		cdfid
+));
+extern NC        *NC_dup_cdf		PROTO((
+    const char *name,
+	int     mode,
+    NC		*old
+));
+extern NC        *NC_new_cdf		PROTO((
+    const char *name,
+    int		mode
+));
+extern NC_array  *NC_new_array		PROTO((
+    nc_type	type,
+    unsigned	count,
+    const void	*values
+));
+extern NC_array  *NC_re_array		PROTO((
+    NC_array	*old,
+    nc_type	type,
+    unsigned	count,
+    const void	*values
+));
+extern NC_attr  *NC_new_attr        PROTO((
+    const char *name,
+    nc_type type,
+    unsigned count ,
+    const void *values
+));
+extern NC_attr  **NC_findattr		PROTO((
+    NC_array	**ap,
+    const char	*name
+));
+extern NC_dim    *NC_new_dim		PROTO((
+    const char	*name,
+    long	size
+));
+extern NC_iarray *NC_new_iarray		PROTO((
+    unsigned	count,
+    const int		values[]
+));
+extern NC_string *NC_new_string		PROTO((
+    unsigned	count,
+    const char	*str
+));
+extern NC_string *NC_re_string		PROTO((
+    NC_string	*old,
+    unsigned	count,
+    const char	*str
+));
+extern NC_var    *NC_hlookupvar		PROTO((
+    NC		*handle,
+    int		varid
+));
+extern NC_var    *NC_new_var		PROTO((
+    const char	*name,
+    nc_type	type,
+    int		ndims,
+    const int		*dims
+));
+extern int	NCvario			PROTO((
+	NC *handle,
+	int varid,
+	const long *start,
+	const long *edges,
+	void *values
+));
+extern bool_t	NCcoordck	PROTO((
+	NC *handle,
+	NC_var *vp, 
+	const long *coords
+));
+extern bool_t xdr_NCvshort    PROTO((
+        XDR *xdrs,
+        unsigned which,
+        short *values
+));
+extern bool_t	NC_dcpy			PROTO((
+	XDR *target,
+	XDR *source,
+	long nbytes
+));
+extern int NCxdrfile_sync
+    PROTO((XDR *xdrs));
+
+extern int NCxdrfile_create
+    PROTO((XDR *xdrs,const char *path,int ncmode));
+
+#ifdef HDF
+/* this routine is found in 'xdrposix.c' */
+extern void hdf_xdrfile_create
+    PROTO(( XDR *xdrs, int ncop));
+
+extern intn hdf_fill_array
+    PROTO((Void  * storage,int32 len,Void  * value,int32 type));
+
+extern intn hdf_get_data
+    PROTO((NC *handle,NC_var *vp));
+
+extern int32 hdf_get_vp_aid
+    PROTO((NC *handle, NC_var *vp));
+
+extern int hdf_map_type
+    PROTO((nc_type ));
+
+extern nc_type hdf_unmap_type
+    PROTO((int ));
+
+extern intn hdf_get_ref
+    PROTO((NC *,int ));
+
+extern intn hdf_create_dim_vdata
+    PROTO((XDR *,NC *,NC_dim *));
+
+extern intn hdf_create_compat_dim_vdata
+    PROTO((XDR *xdrs, NC *handle, NC_dim *dim, int32 dimval_ver));
+
+extern intn hdf_write_attr
+    PROTO((XDR *,NC *,NC_attr **));
+
+extern int32 hdf_write_dim
+    PROTO((XDR *,NC *,NC_dim **,int32));
+
+extern int32 hdf_write_var
+    PROTO((XDR *,NC *,NC_var **));
+
+extern intn hdf_write_xdr_cdf
+    PROTO((XDR *,NC **));
+
+extern intn hdf_conv_scales
+    PROTO((NC **));
+
+extern intn hdf_read_dims
+    PROTO((XDR *,NC *,int32 ));
+
+extern NC_array *hdf_read_attrs
+    PROTO((XDR *,NC *,int32 ));
+
+extern intn hdf_read_vars
+    PROTO((XDR *,NC *,int32 ));
+
+extern intn hdf_read_xdr_cdf
+    PROTO((XDR *,NC **));
+
+extern intn hdf_xdr_cdf
+    PROTO((XDR *,NC **));
+
+extern intn hdf_vg_clobber
+    PROTO((NC *,int ));
+
+extern intn hdf_cdf_clobber
+    PROTO((NC *));
+
+extern intn hdf_close
+    PROTO((NC *));
+
+extern intn hdf_read_sds_dims
+    PROTO((NC *));
+
+extern intn hdf_read_sds_cdf
+    PROTO((XDR *,NC **));
+
+extern intn SDPfreebuf PROTO((void));
+
+extern intn NCgenio
+    PROTO((NC *handle, int varid, const long *start, const long *count,
+        const long *stride, const long *imap, void *values));
+
+extern intn NC_var_shape
+    PROTO((NC_var *var,NC_array *dims));
+
+/* CDF stuff. don't need anymore? -GV */
+extern nc_type cdf_unmap_type
+    PROTO((int type));
+
+extern bool_t nssdc_read_cdf
+    PROTO((XDR *xdrs, NC **handlep));
+
+extern bool_t nssdc_write_cdf
+   PROTO((XDR *xdrs, NC **handlep));
+
+extern bool_t nssdc_xdr_cdf
+    PROTO((XDR *xdrs, NC **handlep));
+
+#endif /* HDF */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LOCAL_NC_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/make.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/make.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/make.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,90 @@
+$! --------------------------------------------------------------------------
+$! For making CDFTEST.EXE on VMS if you don't have MMS.
+$! --------------------------------------------------------------------------
+$!
+$! $Id: make.com,v 1.8 1996/11/07 00:26:25 sxu Exp $
+$!
+$! You must create the netcdf library, NETCDF.OLB, from the XDR directory,
+$! [-.xdr], before executing this procedure.
+$!
+$!
+$ macro :== macro/migration/nolist
+$!
+$ librep := library/replace [--.LIB]mfhdf.OLB
+$ copy [.config]netcdf-vms.h netcdf.h
+$!
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC"
+$ define/nolog sys$clib sys$library:deccrtl
+$ else
+$ ccopt = ""
+$ define/nolog sys$clib sys$library:vaxcrtl
+$ endif
+$ ccc := cc 'ccopt /opt/nodebug  -
+         /include=([-.xdr],[--.hdf.src],[--.hdf.jpeg], -
+         [--.hdf.zlib])/define=(NO_SYS_XDR_INC, swap, HDF, VMS)
+$!
+$ define rpc sys$disk:[-.xdr]
+$! define sys sys$library
+$!
+$ ccc ARRAY.C
+$ ccc ATTR.C
+$ ccc CDF.C
+$ ccc CDFTEST.C 
+$ ccc DIM.C
+$ ccc ERROR.C
+$ ccc FILE.C
+$ ccc globdef.c
+$ ccc IARRAY.C
+$ ccc nssdc.c
+$ ccc PUTGET.C
+$ ccc PUTGETG.C
+$ ccc SHARRAY.C
+$ ccc STRING.C
+$ ccc VAR.C
+$ ccc XDRPOSIX.C
+$! ccc XDRSTDIO.C
+$ ccc HDFSDS.C
+$ ccc MFSD.C
+$ ccc hdftest.c
+$! macro HTONS.MAR
+$! macro NTOHS.MAR
+$!
+$ librep ARRAY, ATTR, CDF, DIM, FILE, globdef, IARRAY, ERROR, -
+    nssdc, PUTGET, PUTGETG, SHARRAY, STRING, VAR, -
+    HDFSDS, MFSD, XDRPOSIX
+$ library/list=netcdf.list/name [--.lib]mfhdf.olb
+$ link/nodebug/exec=CDFTEST.exe/syslib -
+    cdftest.obj, -
+    [--.lib]mfhdf/library, -
+    [--.hdf.src]df/library, -
+    [--.hdf.jpeg]libjpeg/library, -
+    [--.hdf.zlib]libz/library,  -
+    sys$input/opt 
+ 	sys$clib/lib
+$!
+$ create/dir [-.-.include]
+$!
+$ copy netcdf.h [-.-.include]
+$ copy hdf2netcdf.h [--.include]
+$ link/nodebug/exec=hdftest.exe/syslib -
+    hdftest.obj, -
+    [--.lib]mfhdf/library, -
+    [--.hdf.src]df/library, -
+    [--.hdf.jpeg]libjpeg/library, -
+    [--.hdf.zlib]libz/library, -
+    sys$input/opt 
+        sys$clib/lib
+$ type sys$input
+       Run cdftest
+$ run cdftest
+$ type sys$input
+       Run hdftest
+$ run hdftest
+$
+$ type sys$input
+       Clean up ...
+$ delete *.obj;*
+$ delete *.exe;*
+$!

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfhdf.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfhdf.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfhdf.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,694 @@
+/****************************************************************************
+ * 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: mfhdf.h,v 1.43 2000/08/22 20:29:34 epourmal Exp $ */
+
+#ifndef _MFSD_H_
+#define _MFSD_H_
+
+#ifndef HDF
+#define HDF 1
+#endif
+
+/* change this back if it causes problems on other machines than the Alhpa-QAK */
+/* Reverse back to the previous way. AKC */
+#include "hdf.h"
+#include "netcdf.h"
+#ifdef OLD_WAY
+#include "local_nc.h"
+#endif /* OLD_WAY */
+
+#if defined(_MSC_VER) && !defined(_MFHDFLIB_) && !defined(_HDFLIB_)	/* Auto-link when possible */
+#	define MFHDF_LIB_VER	"414"
+#	if !defined(_DEBUG)
+#		if !defined(_HDFDLL_)
+#			define MFHDF_LIB_NAME	"HM" MFHDF_LIB_VER ".lib"
+#			pragma message( "Automatic linking with the static single-threaded MFHDF library - " MFHDF_LIB_NAME )
+#		else
+#			define MFHDF_LIB_NAME	"HM" MFHDF_LIB_VER "m.lib"
+#			pragma message( "Automatic linking with the multithreaded MFHDF DLL - " MFHDF_LIB_NAME )
+#		endif
+#	else
+#		if !defined(_HDFDLL_)
+#			define MFHDF_LIB_NAME	"HM" MFHDF_LIB_VER "d.lib"
+#			pragma message( "Automatic linking with the debug static single-threaded MFHDF library - " MFHDF_LIB_NAME  )
+#		else
+#			define MFHDF_LIB_NAME	"HM" MFHDF_LIB_VER "md.lib"
+#			pragma message( "Automatic linking with the debug multithreaded MFHDF DLL - " MFHDF_LIB_NAME  )
+#		endif
+#	endif
+#	pragma comment(lib, MFHDF_LIB_NAME )
+#endif /* defined(_MSC_VER) && !defined(_MFHDFLIB_) && !defined(_HDFLIB_) */
+
+#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 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+HDFLIBAPI int32 SDstart
+    (const char *name, int32 access);
+
+HDFLIBAPI intn SDend
+    (int32 fid);
+
+HDFLIBAPI intn SDfileinfo
+    (int32 fid, int32 *datasets, int32 *attrs);
+
+HDFLIBAPI int32 SDselect
+    (int32 fid, int32 index);
+
+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 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 index, char *name, int32 *nt, int32 *count);
+
+HDFLIBAPI intn SDreadattr
+    (int32 id, int32 index, 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 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, int32 type, comp_info *c_info);
+
+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 SDsetdimval_comp
+    (int32 dimid, intn compt_mode);
+
+HDFLIBAPI intn SDisdimval_bwcomp
+    (int32 dimid);
+
+HDFLIBAPI int32 SDcheckempty
+    (int32 sdsid, intn *emptySDS);
+
+/*====================== 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[MAX_VAR_DIMS];  Chunk lengths along each dimension
+
+         struct 
+          {   
+            int32     chunk_lengths[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 */);
+
+/* Define the FORTRAN names */
+
+#ifndef MFSD_FNAMES
+#   define  MFSD_FNAMES
+#ifdef DF_CAPFNAMES
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#   define nscstart    FNAME(SCSTART)
+#   define nsfend      FNAME(SFEND)
+#   define nsfendacc   FNAME(SFENDACC)
+#   define nsffinfo    FNAME(SFFINFO)
+#   define nsfselect   FNAME(SFSELECT)
+#   define nscginfo    FNAME(SCGINFO)
+#   define nscgainfo   FNAME(SCGAINFO)
+#   define nscgdinfo   FNAME(SCGDINFO)
+#   define nsfgcal     FNAME(SFGCAL)
+#   define nsfscal     FNAME(SFSCAL)
+#   define nsfgdscale  FNAME(SFGDSCALE)
+#   define nsfsdscale  FNAME(SFSDSCALE)
+#   define nsfgcfill   FNAME(SFGCFILL)
+#   define nsfgfill    FNAME(SFGFILL)
+#   define nsfscfill   FNAME(SFSCFILL)
+#   define nsfsfill    FNAME(SFSFILL)
+#   define nsfsflmd    FNAME(SFSFLMD)
+#   define nsfgrange   FNAME(SFGRANGE)
+#   define nsfsrange   FNAME(SFSRANGE)
+#   define nscn2index  FNAME(SCN2INDEX)
+#   define nsccreate   FNAME(SCCREATE)
+#   define nscsdimstr  FNAME(SCSDIMSTR)
+#   define nscsdimname FNAME(SCSDIMNAME)
+#   define nscsdatstr  FNAME(SCSDATSTR)
+#   define nsfdimid    FNAME(SFDIMID)
+#   define nsfrcatt    FNAME(SFRCATT)
+#   define nsfrnatt    FNAME(SFRNATT)
+#   define nsfrattr    FNAME(SFRATTR)
+#   define nsfrcdata   FNAME(SFRCDATA)
+#   define nsfrdata    FNAME(SFRDATA)
+#   define nsfwcdata   FNAME(SFWCDATA)
+#   define nsfwdata    FNAME(SFWDATA)
+#   define nscgdatstrs FNAME(SCGDATSTRS)
+#   define nscgdimstrs FNAME(SCGDIMSTRS)
+#   define nscscatt    FNAME(SCSCATT)
+#   define nscsnatt    FNAME(SCSNATT)
+#   define nscsattr    FNAME(SCSATTR)
+#   define nscfattr    FNAME(SCFATTR)
+#   define nsfid2ref  FNAME(SFID2REF)
+#   define nsfref2index FNAME(SFREF2INDEX)
+#   define nsfiscvar   FNAME(SFISCVAR)
+#   define nscsextf    FNAME(SCSEXTF)
+#   define nsfsacct    FNAME(SFSACCT)
+#   define nsfsdmvc    FNAME(SFSDMVC)
+#   define nsfisdmvc   FNAME(SFISDMVC)
+#   define nsfisrcrd     FNAME(SFISRCRD)
+#   define nscgichnk     FNAME(SCGICHNK)
+#   define nscrcchnk     FNAME(SCRCCHNK)
+#   define nscrchnk      FNAME(SCRCHNK)
+#   define nscscchnk     FNAME(SCSCCHNK)
+#   define nscschnk      FNAME(SCSCHNK)
+#   define nscwcchnk     FNAME(SCWCCHNK) 
+#   define nscwchnk      FNAME(SCWCHNK)
+#   define nscscompress  FNAME(SCSCOMPRESS)
+#   define nsfsnbit      FNAME(SFSNBIT)
+#   define nsfsblsz      FNAME(SFSBLSZ)
+#   define nscchempty    FNAME(SCCHEMPTY)
+# else /* Fortran PowerStation */
+#   define nscstart    FNAME(SCSTART)
+#   define nscend      FNAME(SCEND)
+#   define nscendacc   FNAME(SCENDACC)
+#   define nscfinfo    FNAME(SCFINFO)
+#   define nscselect   FNAME(SCSELECT)
+#   define nscginfo    FNAME(SCGINFO)
+#   define nscgainfo   FNAME(SCGAINFO)
+#   define nscgdinfo   FNAME(SCGDINFO)
+#   define nscgcal     FNAME(SCGCAL)
+#   define nscscal     FNAME(SCSCAL)
+#   define nscgdscale  FNAME(SCGDSCALE)
+#   define nscsdscale  FNAME(SCSDSCALE)
+#   define nscgcfill   FNAME(SCGCFILL)
+#   define nscgfill    FNAME(SCGFILL)
+#   define nscscfill   FNAME(SCSCFILL)
+#   define nscsfill    FNAME(SCSFILL)
+#   define nscsflmd    FNAME(SCSFLMD)
+#   define nscgrange   FNAME(SCGRANGE)
+#   define nscsrange   FNAME(SCSRANGE)
+#   define nscn2index  FNAME(SCN2INDEX)
+#   define nsccreate   FNAME(SCCREATE)
+#   define nscsdimstr  FNAME(SCSDIMSTR)
+#   define nscsdimname FNAME(SCSDIMNAME)
+#   define nscsdatstr  FNAME(SCSDATSTR)
+#   define nscdimid    FNAME(SCDIMID)
+#   define nscrcatt    FNAME(SCRCATT)
+#   define nscrnatt    FNAME(SCRNATT)
+#   define nscrattr    FNAME(SCRATTR)
+#   define nscrcdata   FNAME(SCRCDATA)
+#   define nscrdata    FNAME(SCRDATA)
+#   define nscwcdata   FNAME(SCWCDATA)
+#   define nscwdata    FNAME(SCWDATA)
+#   define nscgdatstrs FNAME(SCGDATSTRS)
+#   define nscgdimstrs FNAME(SCGDIMSTRS)
+#   define nscscatt    FNAME(SCSCATT)
+#   define nscsnatt    FNAME(SCSNATT)
+#   define nscsattr    FNAME(SCSATTR)
+#   define nscfattr    FNAME(SCFATTR)
+#   define nscid2ref  FNAME(SCID2REF)
+#   define nsciscvar   FNAME(SCISCVAR)
+#   define nscsextf    FNAME(SCSEXTF)
+#   define nscsacct    FNAME(SCSACCT)
+#   define nscsdmvc    FNAME(SCSDMVC)
+#   define nscisdmvc   FNAME(SCISDMVC)
+#   define nscisrcrd     FNAME(SCISRCRD)
+#   define nscgichnk     FNAME(SCGICHNK)
+#   define nscrcchnk     FNAME(SCRCCHNK)
+#   define nscrchnk      FNAME(SCRCHNK)
+#   define nscscchnk     FNAME(SCSCCHNK)
+#   define nscschnk      FNAME(SCSCHNK)
+#   define nscwcchnk     FNAME(SCWCCHNK)
+#   define nscwchnk      FNAME(SCWCHNK)
+#   define nscscompress  FNAME(SCSCOMPRESS)
+#   define nscsnbit      FNAME(SCSNBIT)
+#   define nscsblsz      FNAME(SCSBLSZ)
+#   define nscselct      FNAME(SCSELCT)
+#   define nscr2idx      FNAME(SCR2IDX)
+#   define nscchempty    FNAME(SCCHEMPTY)
+#  endif   /* Fortran PowerStation */
+#else   /* DF_CAPFNAMES */
+# if defined(UNIX386) || (!(defined INTEL86) && !(defined WIN32))
+#   define nscstart    FNAME(scstart)
+#   define nsfend      FNAME(sfend)
+#   define nsfendacc   FNAME(sfendacc)
+#   define nsffinfo    FNAME(sffinfo)
+#   define nsfselect   FNAME(sfselect)
+#   define nscginfo    FNAME(scginfo)
+#   define nscgainfo   FNAME(scgainfo)
+#   define nscgdinfo   FNAME(scgdinfo)
+#   define nsfgcal     FNAME(sfgcal)
+#   define nsfscal     FNAME(sfscal)
+#   define nsfgdscale  FNAME(sfgdscale)
+#   define nsfsdscale  FNAME(sfsdscale)
+#   define nsfgcfill   FNAME(sfgcfill)
+#   define nsfgfill    FNAME(sfgfill)
+#   define nsfscfill   FNAME(sfscfill)
+#   define nsfsfill    FNAME(sfsfill)
+#   define nsfsflmd    FNAME(sfsflmd)
+#   define nsfgrange   FNAME(sfgrange)
+#   define nsfsrange   FNAME(sfsrange)
+#   define nscn2index  FNAME(scn2index)
+#   define nsccreate   FNAME(sccreate)
+#   define nscsdimstr  FNAME(scsdimstr)
+#   define nscsdimname FNAME(scsdimname)
+#   define nscsdatstr  FNAME(scsdatstr)
+#   define nsfdimid    FNAME(sfdimid)
+#   define nsfrcatt    FNAME(sfrcatt)
+#   define nsfrnatt    FNAME(sfrnatt)
+#   define nsfrattr    FNAME(sfrattr)
+#   define nscscatt    FNAME(scscatt)
+#   define nscsnatt    FNAME(scsnatt)
+#   define nscsattr    FNAME(scsattr)
+#   define nscfattr    FNAME(scfattr)
+#   define nsfrcdata   FNAME(sfrcdata)
+#   define nsfrdata    FNAME(sfrdata)
+#   define nsfwcdata   FNAME(sfwcdata)
+#   define nsfwdata    FNAME(sfwdata)
+#   define nscgdatstrs FNAME(scgdatstrs)
+#   define nscgdimstrs FNAME(scgdimstrs)
+#   define nsfid2ref   FNAME(sfid2ref)
+#   define nsfref2index FNAME(sfref2index)
+#   define nsfiscvar   FNAME(sfiscvar)
+#   define nscsextf    FNAME(scsextf)
+#   define nsfsacct    FNAME(sfsacct)
+#   define nsfsdmvc    FNAME(sfsdmvc)
+#   define nsfisdmvc   FNAME(sfisdmvc)
+#   define nsfisrcrd     FNAME(sfisrcrd)
+#   define nscgichnk     FNAME(scgichnk)
+#   define nscrcchnk     FNAME(scrcchnk)
+#   define nscrchnk      FNAME(scrchnk)
+#   define nscscchnk     FNAME(scscchnk)
+#   define nscschnk      FNAME(scschnk)
+#   define nscwcchnk     FNAME(scwcchnk) 
+#   define nscwchnk      FNAME(scwchnk)
+#   define nscscompress  FNAME(scscompress)
+#   define nsfsnbit      FNAME(sfsnbit)
+#   define nsfsblsz      FNAME(sfsblsz)
+#   define nscchempty    FNAME(scchempty)
+#  else /* Powerstation */
+#   define nscstart    FNAME(scstart)
+#   define nscend      FNAME(scend)
+#   define nscendacc   FNAME(scendacc)
+#   define nscfinfo    FNAME(scfinfo)
+#   define nscginfo    FNAME(scginfo)
+#   define nscgainfo   FNAME(scgainfo)
+#   define nscgdinfo   FNAME(scgdinfo)
+#   define nscgcal     FNAME(scgcal)
+#   define nscscal     FNAME(scscal)
+#   define nscgdscale  FNAME(scgdscale)
+#   define nscsdscale  FNAME(scsdscale)
+#   define nscgcfill   FNAME(scgcfill)
+#   define nscgfill    FNAME(scgfill)
+#   define nscscfill   FNAME(scscfill)
+#   define nscsfill    FNAME(scsfill)
+#   define nscsflmd    FNAME(scsflmd)
+#   define nscgrange   FNAME(scgrange)
+#   define nscsrange   FNAME(scsrange)
+#   define nscn2index  FNAME(scn2index)
+#   define nsccreate   FNAME(sccreate)
+#   define nscsdimstr  FNAME(scsdimstr)
+#   define nscsdimname FNAME(scsdimname)
+#   define nscsdatstr  FNAME(scsdatstr)
+#   define nscdimid    FNAME(scdimid)
+#   define nscrcatt    FNAME(scrcatt)
+#   define nscrnatt    FNAME(scrnatt)
+#   define nscrattr    FNAME(scrattr)
+#   define nscscatt    FNAME(scscatt)
+#   define nscsnatt    FNAME(scsnatt)
+#   define nscsattr    FNAME(scsattr)
+#   define nscfattr    FNAME(scfattr)
+#   define nscrcdata   FNAME(scrcdata)
+#   define nscrdata    FNAME(scrdata)
+#   define nscwcdata   FNAME(scwcdata)
+#   define nscwdata    FNAME(scwdata)
+#   define nscgdatstrs FNAME(scgdatstrs)
+#   define nscgdimstrs FNAME(scgdimstrs)
+#   define nscid2ref   FNAME(scid2ref)
+#   define nsciscvar   FNAME(sciscvar)
+#   define nscsextf    FNAME(scsextf)
+#   define nscsacct    FNAME(scsacct)
+#   define nscsdmvc    FNAME(scsdmvc)
+#   define nscisdmvc   FNAME(scisdmvc)
+#   define nscisrcrd     FNAME(scisrcrd)
+#   define nscgichnk     FNAME(scgichnk)
+#   define nscrcchnk     FNAME(scrcchnk)
+#   define nscrchnk      FNAME(scrchnk)
+#   define nscscchnk     FNAME(scscchnk)
+#   define nscschnk      FNAME(scschnk)
+#   define nscwcchnk     FNAME(scwcchnk)
+#   define nscwchnk      FNAME(scwchnk)
+#   define nscscompress  FNAME(scscompress)
+#   define nscsnbit      FNAME(scsnbit)
+#   define nscsblsz      FNAME(scsblsz)
+#   define nscselct      FNAME(scselct)
+#   define nscr2idx      FNAME(scr2idx)
+#   define nscchempty    FNAME(scchempty)
+# endif /* powerstation  */
+#endif /* capital */
+#endif /* MFSD_FNAMES */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MFSD_H_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfhdflib.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfhdflib.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfhdflib.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2225 @@
+(This file must be conver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B!%lNH!!!!q`!!!!!!!!!!#l)!!!!iF(*PCJ!6[dN!!!$
+m!!!!!!!!!!!)dJ!!!!a`FQ9Q!"1EU3!!!2d!!!!!!!!!!#2A!!!"fR"bC at B!%l#
+M!!!!rJ!!!!!!!!!!#0i!!!!-F(*PCJ!6qZm!!!$r!!!!!!!!!!!4l!!!!'*`FQ9
+Q!"1rh3!!!3!!!!!!!!!!!"*1!!!!1("bC at B!%hQ3!!!!!3%!!!!!!!!!!!MU!!!
+!$A"bC at B!%d(E!!!"!J!!!!!!!!!!#qS!!!!8F(*PCJ!6d&%!!!%$!!!!!!!!!!!
+)p`!!!!T`FQ9Q!"16jJ!!!33!!!!!!!!!!"+'!!!!a("bC at B!%m18!!!""3!!!!!
+!!!!!*E%!!!%@F(*PCJ!65'`!!!%'!!!!!!!!!!!AZ3!!!,T`FQ9Q!"1qJ`!!!3F
+!!!!!!!!!!"Kc!!!!,R"bC at B!%i&q!!!"#!!!!!!!!!!!1k%!!!)-F(*PCJ!6A#S
+!!!%*!!"Jd3!!:

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfsd.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfsd.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/mfsd.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,6201 @@
+/****************************************************************************
+ * 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.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 1.129 $";
+#endif
+
+/* $Id: mfsd.c,v 1.129 2000/08/29 13:56:52 koziol Exp $ */
+#ifdef HAVE_PABLO
+#define PABLO_mask ID_mfsd_c
+#include "ProcIDs.h"
+#endif
+
+/******************************************************************************
+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
+
+Reading interface:
+------------------
+
+fid    = SDstart(file name, access);
+
+        --- get the number of data-sets in the file ---
+num    = SDnumber(fid);
+        
+sdsid  = SDselect(fid, i, ...);   0 <= i < num
+
+        --- return the name, rank, dimsizes, #of attr, datatype ---
+status = SDgetinfo(sdsid, ...); 
+
+status = SDreaddata(sdsid, ...);
+
+status = SDgetrange(sdsid, ...);
+
+status = SDend(fid);
+
+status = SDisdimval_bwcomp(dimid);
+
+status = SDcheckempty(sdsid, emptySDS);
+
+ 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 VMS
+#include <stat.h>
+#endif
+
+#ifdef HDF
+#include "mfhdf.h"
+#include "hfile.h"
+#include "hchunks.h" /* include here for now */
+
+/* for Chunk debugging */
+/*
+#define CHK_DEBUG
+*/
+
+/* Local function prototypes */
+
+PRIVATE NC_dim * SDIget_dim
+    (NC *handle, int32 id);
+
+PRIVATE NC * SDIhandle_from_id 
+    (int32 id, intn typ);
+
+PRIVATE NC_var *SDIget_var
+    (NC *handle, int32 sdsid);
+
+PRIVATE intn SDIputattr 
+    (NC_array **ap, const char *name, int32 nt, intn count, const void * data);
+
+PRIVATE int32 SDIgetcoordvar 
+    (NC *handle, NC_dim *dim, int32 id, int32 nt);
+
+PRIVATE int32 SDIfreevarAID 
+    (NC * handle, int32 index);
+
+PRIVATE intn SDIapfromid
+    (int32 id, NC ** handlep, NC_array *** app);
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+
+/******************************************************************************
+ 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
+
+******************************************************************************/
+PRIVATE 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) & 0xff;
+    if(tmp != typ)
+      {
+        ret_value = NULL;
+        goto done;
+      }
+
+    /* get the file from top 8 bits*/
+    tmp = (id >> 24) & 0xff;
+    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
+
+******************************************************************************/
+PRIVATE 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
+
+******************************************************************************/
+PRIVATE NC_dim *
+SDIget_dim(NC   *handle,/* IN: the handle for this file */
+           int32 id     /* IN: a dimension ID */)
+{
+    int32      dimid;
+    NC_array **ap = NULL;
+    NC_dim    *ret_value = NULL;
+
+    /* dimid is low 16bits of id */
+    dimid = id & 0xffff;
+
+    if(handle->dims != NULL 
+       && dimid >= 0 
+       && dimid < handle->dims->count) 
+      {
+        ap = (NC_array **)handle->dims->values;
+        ap += dimid;
+      } 
+    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 */
+
+
+/******************************************************************************
+ NAME
+	SDIstart -- initialize the SD interface
+
+ DESCRIPTION
+    Register the atexit callback function, etc.
+
+ RETURNS
+    SUCCEED/FAIL
+******************************************************************************/
+static intn
+SDIstart(void)
+{
+    CONSTR(FUNC, "SDIstart");    /* for HERROR */
+    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() */
+
+/******************************************************************************
+ 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 HERROR */
+    intn    cdfid;
+    int32   fid;
+    intn    NCmode;
+    NC     *handle = NULL;
+    int32   ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDstart: I've been called\n");
+#endif
+
+#ifdef HAVE_PABLO
+    TRACE_ON (PABLO_mask,ID_SDstart );
+#endif
+    /* 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 */
+        cdfid = nccreate(name, NC_CLOBBER);
+      } 
+    else 
+      { /* open the file */
+        cdfid = ncopen(name, NCmode);
+      }
+
+    /* check if bad create/open */
+    if(cdfid == -1) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* hmm.....*/
+    handle = NC_check_id(cdfid);
+    if(handle == NULL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* set in 'define' mode? */
+    handle->flags &= ~(NC_INDEF);
+
+    /* create file id to return */
+    fid = (((int32) cdfid) << 24) + (((int32) CDFTYPE) << 16) + cdfid;
+
+    ret_value = fid;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDstart );
+#endif
+
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDend );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDend );
+#endif
+
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDfileinfo );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDfileinfo );
+#endif
+
+    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       24       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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDselect );
+#endif
+
+    /* 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(handle->vars->count < index)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* create SDS id to return */
+    sdsid  = (((int32) fid & 0xffff) << 24) + (((int32) SDSTYPE) << 16) + index;
+
+    ret_value = sdsid;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDselect );
+#endif
+
+    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 MAX_NC_NAME 
+    characters in length.  NULL can be passed for the name
+    if it is not required.
+
+    dimsizes should be an array to hold the dimension sizes
+    a dataset can have at most 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 *nattr    /* OUT: the number of local attributes */)
+{
+    intn    i;
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    intn    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetinfo: I've been called\n");
+#endif
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDgetinfo );
+#endif
+
+    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(name != NULL) 
+      {
+          HDmemcpy(name, var->name->values, var->name->len);
+#if 0
+          HDstrncpy(name, var->name->values, var->name->len);
+#endif
+          name[var->name->len] = '\0';
+      }
+
+    *rank  = var->assoc->count;
+    if(!var->HDFtype)
+        *nt    = hdf_map_type(var->type);
+    else
+        *nt    = var->HDFtype;
+
+    *nattr = (var->attrs ? var->attrs->count : 0);
+
+    for(i = 0; i < *rank; 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;
+      }
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetinfo: looked up handle as %d\n", handle);
+#endif
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDgetinfo );
+#endif
+
+    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 */)
+{
+    NC     *handle = NULL;
+    NC_dim *dim = NULL;
+    intn    varid;
+    int32   status;
+#ifdef BIG_LONGS
+    long    Start[MAX_VAR_DIMS];
+    long    End[MAX_VAR_DIMS];
+    long    Stride[MAX_VAR_DIMS];
+#else
+    long    *Start = NULL;
+    long    *End   = NULL;
+    long    *Stride = NULL;
+#endif
+    intn    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDreaddata: I've been called\n");
+#endif
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDreaddata );
+#endif
+    
+    if((start == NULL) || (end == NULL) || (data == NULL))
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          handle = SDIhandle_from_id(sdsid, DIMTYPE);
+          if(handle == NULL) 
+            {
+              ret_value = FAIL;
+              goto done;
+            }
+          dim = SDIget_dim(handle, sdsid);
+      }
+
+    if(handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* 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 
+      {
+          /* oops, how do we know this ? */
+          varid = (intn)sdsid & 0xffff;
+      }
+
+    /*
+     * 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
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask,  ID_SDreaddata );
+#endif
+
+    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 */)
+{
+    intn     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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDnametoindex );
+#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, len) == 0) 
+          {
+            ret_value = ii;
+            goto done;
+          }
+      }
+
+    ret_value = FAIL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDnametoindex);
+#endif
+
+    return ret_value;    
+} /* SDnametoindex */
+
+
+
+/******************************************************************************
+ 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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDgetrange );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDgetrange);
+#endif
+
+    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 MAX_NC_NAME
+    characters.  Rank can be at most 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[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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDcreate );
+#endif
+
+    /* 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 > 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;
+
+    /* 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 >= 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) << 24) + (((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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDcreate);
+#endif
+
+    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       24       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 */)
+{
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    int32   id;
+    int32   dimindex;
+    int32   ret_value = FAIL;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetdimid: I've been called\n");
+#endif
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDgetdimid );
+#endif
+
+    /* 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 < number))
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get the dim number out of the assoc array */
+    dimindex = var->assoc->values[number];
+
+    /* build the dim id */
+    id  = (sdsid & 0xff000000) + (((int32) DIMTYPE) << 16) + dimindex;
+
+    ret_value = id;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDgetdimid);
+#endif
+
+    return ret_value;
+} /* SDgetdimid */
+
+
+/******************************************************************************
+ NAME
+	SDsetdimname -- give a name to a dimension
+
+ DESCRIPTION
+    Set the name of a dimension -- at most 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;
+    int32       len;
+    int32       ii;
+    intn        ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetdimname: I've been called\n");
+#endif
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetdimname );
+#endif
+
+    /* 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, (size_t)len) == 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 */
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetdimname);
+#endif
+
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDendaccess );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDendaccess);
+#endif
+
+    return ret_value;    
+} /* SDendaccess */
+
+/******************************************************************************
+ 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
+
+******************************************************************************/
+PRIVATE 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)
+      {
+#ifdef SDDEBUG
+          /* replace it with NCAdvice or HERROR? */
+          fprintf(stderr "SDIputattr: hdf_unmap_type failed for %d\n", nt);
+#endif
+          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 >= 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 */
+
+
+/******************************************************************************
+ 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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetrange );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetrange);
+#endif
+
+    return ret_value;    
+} /* SDsetrange */
+
+
+/******************************************************************************
+ 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.
+
+******************************************************************************/
+PRIVATE 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 */
+
+
+/******************************************************************************
+ 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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetattr );
+#endif
+
+    /* 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;
+      }
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetattr);
+#endif
+
+    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 */)
+{
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDattrinfo );
+#endif
+
+    /* sanity check args */
+    if((name == NULL) || (nt == NULL) || (count == NULL))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDattrinfo);
+#endif
+
+    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  */)
+{
+
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDreadattr );
+#endif
+
+    /* sanity check args */
+    if(buf == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDreadattr);
+#endif
+
+    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 */)
+{
+    intn    varid;
+    int32   status;
+    NC     *handle = NULL;
+    NC_dim *dim = NULL;
+#ifdef BIG_LONGS
+    long    Start[MAX_VAR_DIMS];
+    long    End[MAX_VAR_DIMS];
+    long    Stride[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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDwritedata );
+#endif
+
+    if((start == NULL) || (end == NULL) || (data == NULL))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+        handle = SDIhandle_from_id(sdsid, DIMTYPE);
+        if(handle == NULL) 
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+
+        dim = SDIget_dim(handle, sdsid);
+      }
+
+#ifdef QAK
+    fprintf(stderr, "SDwritedata: check 1.0\n");
+#endif
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 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;
+      }
+
+#ifdef QAK
+    fprintf(stderr, "SDwritedata: check 2.0\n");
+#endif
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDwritedata);
+#endif
+
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetdatastrs );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetdatastrs);
+#endif
+
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetcal );
+#endif
+    
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetcal);
+#endif
+
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetfillvalue );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetfillvalue);
+#endif
+
+    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 */)
+{
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDgetfillvalue );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDgetfillvalue);
+#endif
+
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDgetdatastrs );
+#endif
+
+    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 < 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 < 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 < 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 < 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDgetdatastrs);
+#endif
+
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDgetcal );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDgetcal);
+#endif
+
+    return ret_value;    
+} /* SDgetcal */
+
+
+/******************************************************************************
+ 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
+
+******************************************************************************/ 
+PRIVATE 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*/)
+{ 
+    int32      ii;
+    int32      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++) 
+      {
+          if( len == (*dp)->name->len 
+              && HDstrncmp(name->values, (*dp)->name->values, (size_t)len) == 0) 
+            {
+                /* 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)
+      {
+#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;
+      }
+
+    dimindex = (intn)id;
+    var = (NC_var *) NC_new_var(name->values, nctype, (unsigned)1, &dimindex);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 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 >= 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 */
+
+
+/******************************************************************************
+ 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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetdimstrs );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetdimstrs);
+#endif
+
+    return ret_value;    
+} /* SDsetdimstrs */
+
+
+/******************************************************************************
+ NAME
+	SDIfreevarAID -- free a variables AID
+
+ DESCRIPTION
+    Free the AID of the variable with the given index
+
+ RETURNS
+    SUCCEED / FAIL 
+
+******************************************************************************/
+PRIVATE 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 */
+ 
+
+/******************************************************************************
+ 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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetdimscale );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetdimscale);
+#endif
+
+    return ret_value;    
+} /* SDsetdimsacle */
+
+
+/******************************************************************************
+ 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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDgetdimscale );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDgetdimscale);
+#endif
+
+    return ret_value;    
+} /* SDsetdimsacle */
+
+
+/******************************************************************************
+ 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 
+    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 **dp = NULL;
+    intn     ii;
+    intn     len;
+    int      ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDdiminfo: I've been called\n");
+#endif
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDdiminfo );
+#endif
+
+    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;
+
+    *size  = dim->size;
+
+    if(handle->vars) 
+      {
+          len = dim->name->len;
+          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, (*dp)->name->len) == 0)
+                  {
+                      if (handle->file_type == HDF_FILE)
+                          *nt = ((*dp)->numrecs ? (*dp)->HDFtype : 0);
+                      else 
+                          *nt = (*dp)->HDFtype;
+
+                      *nattr = ((*dp)->attrs ? (*dp)->attrs->count : 0);
+                      ret_value = SUCCEED;
+                      goto done;
+                  }
+            }
+      }
+
+    /* no var so return NULL values */
+    *nt    = 0;
+    *nattr = 0;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDdiminfo);
+#endif
+
+    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 */)
+{
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDgetdimstrs );
+#endif
+
+    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++) 
+            {
+                if( namelen == (*dp)->name->len 
+                    && HDstrncmp(name, (*dp)->name->values, (size_t)namelen) == 0)
+                  {
+                      var = (*dp);
+                  }
+            }
+      }
+
+    if(!var)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(l) 
+      {
+          attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_LongName);
+          if(attr != NULL) 
+            {
+                intn minlen;
+                minlen = (len > (*attr)->data->count)? (*attr)->data->count: len;
+                HDstrncpy((char *)l, (*attr)->data->values, minlen);
+                if((*attr)->data->count < 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: len;
+                HDstrncpy((char *)u, (*attr)->data->values, minlen);
+                if((*attr)->data->count < 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: len;
+                HDstrncpy((char *)f, (*attr)->data->values, minlen);
+                if((*attr)->data->count < len)
+                    f[(*attr)->data->count] = '\0';
+            } 
+          else 
+              f[0] = '\0';
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDgetdimstrs);
+#endif
+
+    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
+    Return SUCCEED or 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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetexternalfile );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetexternalfile);
+#endif
+
+    return ret_value;    
+} /* SDsetexternalfile */
+
+
+/******************************************************************************
+ 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
+    Return SUCCEED or 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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetnbitdataset );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetnbitdataset);
+#endif
+
+    return ret_value;    
+} /* SDsetnbitdataset */
+
+
+/******************************************************************************
+ 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
+     Return SUCCEED or FAIL
+
+******************************************************************************/ 
+intn 
+SDsetcompress(int32      id,    /* IN: dataset ID */
+              int32      type,  /* IN: the type of compression to perform on the
+                                        next image */
+              comp_info *c_info /* IN: ptr to compression information structure */)
+{
+    NC        *handle;
+    NC_var    *var;
+    model_info m_info;  /* modeling information for the HCcreate() call */
+    intn       status = FAIL;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetcompress: I've been called\n");
+#endif /* SDDEBUG */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetcompress );
+#endif
+
+    if (type < 0 || type >= COMP_CODE_INVALID)
+      {
+          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;
+      }
+
+#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_coder_t)type, c_info);
+
+#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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetcompress);
+#endif
+
+    return ret_value;    
+} /* SDsetcompress */
+
+
+/******************************************************************************
+ 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;
+    int32      len;
+    int32      ret_value = FAIL;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDfindattr );
+#endif
+
+    /* 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, (size_t)len) == 0)
+            {
+                ret_value = attrid ; /* found it */
+                goto done;
+            }
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDfindattr);
+#endif
+
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDidtoref );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDidtoref);
+#endif
+
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDreftoindex );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDreftoindex);
+#endif
+
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDisrecord );
+#endif
+
+    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[0] == SD_UNLIMITED)
+        ret_value = TRUE;
+    else
+        ret_value = FALSE;
+
+done:
+    if (ret_value == FALSE)
+      { /* FALSE cleanup */
+
+      }
+    /* Normal cleanup */
+
+#ifdef HAVE_PABLO
+   TRACE_OFF (PABLO_mask, ID_SDisrecord);
+#endif
+
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDiscoordvar );
+#endif
+
+    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->assoc->count != 1)
+      {
+        ret_value = FALSE;
+        goto done;
+      }
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDiscoordvar);
+#endif
+
+    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
+    
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetrag );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetrag);
+#endif
+
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetaccesstype );
+#endif
+
+    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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetaccesstype);
+#endif
+
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetblocksize );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask,  ID_SDsetblocksize);
+#endif
+
+    return ret_value;    
+} /* SDsetblocksize */
+
+/******************************************************************************
+ 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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetfillmode );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetfillmode);
+#endif
+
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetdimval_comp );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetdimval_comp);
+#endif
+
+    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
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDisdimval_bwcomp );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDisdimval_bwcomp);
+#endif
+
+    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[MAX_VAR_DIMS];  Chunk lengths along each dimension
+
+         struct 
+          {   
+            int32     chunk_lengths[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 */)
+{
+    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 */
+    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 */
+    static     int32 tBuf_size = 0;/* statc conversion buffer size */
+    static     void  *tBuf = NULL; /* static buffer used for conversion */
+    intn       i;                  /* loop variable */
+    intn       ret_value = SUCCEED;   /* return value */
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: called  \n");
+#endif
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDsetchunk );
+#endif
+
+    /* 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;
+      }
+
+    /* 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):
+          cdef  = (HDF_CHUNK_DEF *)&chunk_def;
+          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 */
+          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;
+    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);
+
+    /* free chunk dims */
+    if (chunk[0].pdims != NULL)
+        HDfree(chunk[0].pdims);
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetchunk);
+#endif
+
+    return ret_value;
+} /* SDsetchunk */
+
+/******************************************************************************
+ 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
+******************************************************************************/
+intn 
+SDgetchunkinfo(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 */
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDgetchunkinfo );
+#endif
+
+    /* 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;
+      }
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDgetchunkinfo);
+#endif
+
+    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 */)
+{
+    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 */
+    intn       i;
+    sp_info_block_t info_block; /* special info block */
+    static uint32 tBuf_size = 0; /* statc conversion buffer size */
+    static void  *tBuf = NULL;   /* static buffer used for conversion */
+    intn       ret_value = SUCCEED;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDwritechunk );
+#endif
+
+    info_block.cdims = NULL;
+
+    /* Check args */
+    if (origin == NULL || datap == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* 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;
+      }
+
+    /* 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);
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDwritechunk);
+#endif
+
+    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 */)
+{
+    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 */
+    intn       i;
+    sp_info_block_t info_block; /* special info block */
+    static uint32 tBuf_size = 0; /* statc conversion buffer size */
+    static void  *tBuf = NULL; /* static buffer used for conversion */
+    intn       ret_value = SUCCEED;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask, ID_SDreadchunk );
+#endif
+
+    info_block.cdims = NULL;
+
+    /* Check args */
+    if (origin == NULL || datap == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* 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;
+      }
+
+    /* 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)
+            {  /* 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 */
+
+  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);
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDreadchunk);
+#endif
+
+    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;
+
+#ifdef HAVE_PABLO
+    TRACE_ON(PABLO_mask,ID_SDsetchunkcache );
+#endif
+
+    /* 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 */
+
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDsetchunkcache);
+#endif
+
+    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
+
+ AUTHOR
+	bmribler - 9-01-98
+        
+******************************************************************************/
+int32
+SDcheckempty(int32 sdsid,  /* IN: dataset ID */
+	     intn  *emptySDS /* TRUE if SDS is empty */)
+{
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    int32   ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDcheckempty: I've been called\n");
+#endif
+
+#ifdef HAVE_PABLO
+#ifndef ID_SDcheckempty
+#define ID_SDcheckempty DUMMY_HDF
+#endif
+    TRACE_ON(PABLO_mask,ID_SDcheckempty );
+#endif
+    /* 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;
+      }
+
+    /* if the SDS has been written with data, a storage is created 
+	for the SDS data, and var->data_ref will contain this storage's 
+	reference number, not 0 */
+    if( var->data_ref != 0 )
+      {
+        *emptySDS = FALSE;
+        goto done;
+      }
+    *emptySDS = TRUE;  /* SDS is not written with data */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+#ifdef HAVE_PABLO
+    TRACE_OFF (PABLO_mask, ID_SDcheckempty);
+#endif
+
+    return ret_value;
+} /* SDcheckempty */
+
+#endif /* HDF */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/msoft.mk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/msoft.mk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/msoft.mk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,143 @@
+#   Copyright 1993, University Corporation for Atmospheric Research
+#
+#  DOS and OS/2 Makefile for netCDF library
+#
+#  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 /st:3000
+#LFLAGS    = /cod /nod /st:8000
+LFLAGS=/INFO /COD /ST:8192 /MAP:FULL /SEG:256
+
+LIBDIR    = $(DESTDIR)\lib
+
+HDFDIR    = \hdf\hdf
+
+INCDIR    = ..\xdr
+INCLUDES  = /I$(INCDIR) /I$(HDFDIR)\include
+
+DEFINES  = /DSWAP /DNO_SYS_XDR_INC /DDOS_FS
+
+NETCDFLIB = netcdf.lib
+CLIBS     = llibc7.lib oldnames.lib
+!IF $(OS2)
+OS2LIB    = os2.lib
+!ELSE
+OS2LIB    =
+!ENDIF
+XDRLIB    = ..\xdr\xdr.lib
+HDFLIB    = \hdf\hdf\lib\df.lib
+LIBS      = $(NETCDFLIB) $(XDRLIB) $(OS2LIB) $(CLIBS) $(HDFLIB)
+
+MANIFEST = Makefile alloc.h array.c attr.c cdf.c \
+	cdftest.c descrip.mms dim.c error.c error.h file.c \
+	htons.mar iarray.c local_nc.h netcdf.h ntohs.mar \
+    putget.c sharray.c string.c test.cdf.sav var.c hdfsds.c \
+    mfsd.c globdef.c
+
+CSRCS = array.c attr.c cdf.c dim.c error.c file.c globdef.c iarray.c \
+    putget.c putgetg.c sharray.c string.c var.c hdfsds.c mfsd.c xdrposix.c
+
+COBJS = array.obj attr.obj cdf.obj dim.obj error.obj file.obj globdef.obj \
+	iarray.obj putget.obj putgetg.obj sharray.obj string.obj var.obj \
+    hdfsds.obj mfsd.obj xdrposix.obj
+
+LOBJS1 = -+array -+attr -+cdf -+dim -+error -+file -+globdef -+iarray
+LOBJS2 = -+putget -+putgetg -+sharray -+string -+var -+xdrposix
+LOBJS3 = -+hdfsds -+mfsd
+
+.c.obj:
+        $(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) $<
+
+all:		$(NETCDFLIB)
+
+$(NETCDFLIB): netcdf.h $(COBJS)
+        $(AR) $@ $(ARFLAGS) $(LOBJS1),LIB.LST;
+        $(AR) $@ $(ARFLAGS) $(LOBJS2),LIB.LST;
+        $(AR) $@ $(ARFLAGS) $(LOBJS3),LIB.LST;
+
+test:       cdftest.exe hdftest.exe FORCE
+	cdftest
+    hdftest
+
+FORCE:
+
+cdftest.exe: cdftest.obj $(NETCDFLIB)
+	$(LINK) $(LFLAGS) @cdftest.lnk
+#	$(LINK) $(LFLAGS) cdftest.obj,,,$(LIBS),cdftest;
+
+hdftest.exe: hdftest.obj $(NETCDFLIB)
+    $(LINK) $(LFLAGS) @hdftest.lnk
+#    $(LINK) $(LFLAGS) hdftest.obj,,,$(LIBS),hdftest;
+
+clean  :
+	del *.obj *.map *.lst *.bak netcdf.lib *.exe test.cdf
+
+install : $(NETCDFLIB)
+	copy $(NETCDFLIB) $(LIBDIR)
+
+array.obj: array.c
+array.obj: ./local_nc.h
+array.obj: ./netcdf.h
+array.obj: ./alloc.h
+attr.obj: attr.c
+attr.obj: ./local_nc.h
+attr.obj: ./netcdf.h
+attr.obj: ./alloc.h
+cdf.obj: cdf.c
+cdf.obj: ./local_nc.h
+cdf.obj: ./netcdf.h
+cdf.obj: ./alloc.h
+cdftest.obj: cdftest.c
+cdftest.obj: ./netcdf.h
+dim.obj: dim.c
+dim.obj: ./local_nc.h
+dim.obj: ./netcdf.h
+dim.obj: ./alloc.h
+error.obj: error.c
+error.obj: ./local_nc.h
+error.obj: ./netcdf.h
+file.obj: file.c
+file.obj: ./local_nc.h
+file.obj: ./netcdf.h
+file.obj: ./alloc.h
+globdef.obj: globdef.c
+globdef.obj: ./netcdf.h
+iarray.obj: iarray.c
+iarray.obj: ./local_nc.h
+iarray.obj: ./netcdf.h
+iarray.obj: ./alloc.h
+mfsd.obj: mfsd.c
+mfsd.obj: mfhdf.h
+mfsd.obj: local_nc.h
+putget.obj: putget.c
+putget.obj: ./local_nc.h
+putget.obj: ./netcdf.h
+putget.obj: ./alloc.h
+putgetg.obj: putgetg.c
+putgetg.obj: ./local_nc.h
+putgetg.obj: ./netcdf.h
+sharray.obj: sharray.c
+sharray.obj: ./local_nc.h
+sharray.obj: ./netcdf.h
+sharray.obj: ./alloc.h
+string.obj: string.c
+string.obj: ./local_nc.h
+string.obj: ./netcdf.h
+string.obj: ./alloc.h
+var.obj: var.c
+var.obj: ./local_nc.h
+var.obj: ./netcdf.h
+var.obj: ./alloc.h
+xdrposix.obj: xdrposix.c
+xdrposix.obj: ./netcdf.h
+xdrposix.obj: ./local_nc.h
+xdrposix.obj: ./netcdf.h
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/netcdf.h.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/netcdf.h.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/netcdf.h.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,581 @@
+/*
+ *	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,v 1.13 2000/05/23 18:03:34 acheng Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+/*
+ * 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.
+ */
+#define USE_ENUM
+
+
+/*
+ * 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	@OLD_FILLVALUES@
+
+/*
+ * 	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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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 */
+
+/*
+ * Added feature. The above values are defaults.
+ * 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"
+
+
+/*
+ *  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 */
+
+#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 _CRAYMPP
+typedef short	nclong;
+#elif defined __alpha || (_MIPS_SZLONG == 64) || defined IA64
+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
+
+extern int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+extern int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+extern int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+extern int ncredef	PROTO((
+    int		cdfid
+));
+extern int ncendef	PROTO((
+    int		cdfid
+));
+extern int ncclose	PROTO((
+    int		cdfid
+));
+extern int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+extern int ncsync	PROTO((
+    int		cdfid
+));
+extern int ncabort	PROTO((
+    int		cdfid
+));
+extern int ncnobuf	PROTO((
+    int		cdfid
+));
+extern int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+extern int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+extern int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+extern int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+extern int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+extern int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+extern int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+extern int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+extern int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+extern int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+extern int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+extern int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+extern int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+extern int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+extern int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+extern int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+extern int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+extern int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+extern int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+extern int nctypelen	PROTO((
+    nc_type	datatype
+));
+extern int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+extern int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+extern int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+extern int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/nssdc.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/nssdc.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/nssdc.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,901 @@
+/*
+
+  This file contains the code to read CDF V2.x files created with the
+  CDF library as written by the NSSDC group at NASA Goddard
+
+  The code in this file was written by the HDF Group at the National
+  Center for Supercomputing Applications and is governed by the
+  standard HDF copyright statements.
+
+*/
+
+/* #define DEBUG 1 */
+#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[MAX_VAR_DIMS];
+    int32    dim_sz[MAX_VAR_DIMS];
+    NC_dim * dim_rec[MAX_VAR_DIMS];
+    NC_var * vars[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 > 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 */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/ntohs.mar
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/ntohs.mar	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/ntohs.mar	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,9 @@
+	.TITLE	ntohs
+
+	.entry	ntohs,^m<>
+	rotl	#8,4(ap),r0
+	movb	5(ap),r0
+	movzwl	r0,r0
+	ret
+
+	.end

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/putget.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/putget.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/putget.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2596 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: putget.c,v 1.73 2000/08/29 13:56:53 koziol Exp $ */
+
+#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))
+
+/*
+ * 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 ;
+{
+	int 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 add and fill records out
+ * to the requested recno == coords[0] as a side effect.
+ */
+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 ;
+
+	if( IS_RECVAR(vp) )
+      {
+          boundary = coords + 1 ;
+          if(*coords < 0)
+              goto bad ;
+      } else
+          boundary = coords ;
+	
+	up = vp->shape + vp->assoc->count - 1 ;
+	ip = coords + vp->assoc->count - 1 ;
+#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( ; 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 >= *up )
+              goto bad ;
+      }
+
+#ifdef HDF
+    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;
+            
+          if((unfilled = *ip - vp->numrecs) < 0) 
+              return TRUE;   
+
+#ifdef CDEBUG
+fprintf(stderr, "NCcoordck: check 3.6, unfilled=%d\n",unfilled);
+#endif /* CDEBUG */
+          /* check to see if we are trying to read beyond the end */
+          if(handle->xdrs->x_op != XDR_ENCODE)
+              goto bad ;
+
+          /* else */
+          if ((handle->flags & NC_NOFILL) == 0) 
+            {
+                /* make sure we can write to this sucker */
+                if(vp->aid == FAIL && hdf_get_vp_aid(handle, vp) == FAIL) 
+                    return(FALSE);
+            
+                /*
+                 * Set up the array strg to hold the fill values
+                 */
+                len = (vp->len / vp->HDFsize) * vp->szof;
+                strg = (Void *) HDmalloc(len);
+                strg1 = (Void *) HDmalloc(len);
+                if (NULL == strg || NULL == strg1)
+                    return FALSE;
+
+                attr = NC_findattr(&vp->attrs, _FillValue);
+
+                if(attr != NULL)
+                    HDmemfill(strg,(*attr)->data->values,vp->szof,(vp->len/vp->HDFsize));
+                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;
+
+                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) > handle->numrecs) 
+          {
+              handle->numrecs = *ip + 1;
+              handle->flags |= NC_NDIRTY;
+          }
+
+        return (TRUE);
+    }
+#endif /* HDF */
+
+
+	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 _CRAYMPP
+		return( xdr_short(xdrs, (nclong *)values) ) ;
+#elif defined __alpha || (_MIPS_SZLONG == 64) || defined IA64
+		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 */
+                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;/* 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 */
+    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
+           */
+#ifdef DEBUG
+          fprintf(stderr, "hdf_xdr_NCvdata creating new data, check for fill value, vp->data_ref=%d\n",(int)vp->data_ref);
+#endif
+          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 */
+             elements_left = count;  /* 'count' is number of elements to
+be processed */
+             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 */
+                if (FAIL == DFKconvert(tBuf, values, 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;
+                }
+              } /* while more elements left to be processed */
+              SDPfreebuf();
+            } /* 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 */
+            elements_left = count;   /* all elements are left to be processed */
+            while( elements_left > 0 )
+            {
+               /* convert new_count elements in the user's buffer values and 
+                  write them into the temporary buffer */
+               if (FAIL == DFKconvert(values, 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;
+                }
+              } /* 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);
+
+#ifdef DEBUG
+          fprintf(stderr, "hdf_xdr_NCvdata: status=%d\n",(int)status);
+          if(status==FAIL)
+              HEprint(stdout,0);
+#endif
+          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 QAK
+    /* Read or write the data into / from values */
+    if(handle->xdrs->x_op == XDR_DECODE) {
+        status = HI_READ((hdf_file_t) handle->cdf_fp, tBuf, byte_count);
+        if(status == FAIL) return FALSE;
+        
+        /* convert tBuf into values */
+        DFKnumin(tBuf, values, (uint32) count, 0, 0);
+        
+    } else {
+
+#ifdef CDF_WRITE      
+        /*  convert values into tBuf */
+        DFKnumout(values, tBuf, (uint32) count, 0, 0);
+        
+        status = Hwrite(vp->aid, byte_count, tBuf);
+        if(status != byte_count) return FALSE;
+#endif /* CDF_WRITE */
+
+    }
+#endif /* QAK */
+    
+
+#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 _CRAYMPP
+                xdr_NC_fnct = xdr_short;
+#elif defined __alpha || (_MIPS_SZLONG == 64) || defined IA64
+		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 ;
+	edp = edges + vp->assoc->count - 1 ;
+	orp = origin + vp->assoc->count - 1 ;
+	for( ; shp >= boundary ; shp--,edp--,orp--)
+	{
+		if(*edp > *shp - *orp || *edp < 0 )
+		{
+			NCadvise(NC_EINVAL, "Invalid edge length %d", *edp) ;
+			return(NULL) ;
+		}
+		if(*edp < *shp )
+          {
+            partial=1;
+			break ;
+          }
+	}
+	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 */
+	newrecs = (*start + *edges) - handle->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)
+      {
+          handle->numrecs += newrecs ;
+	  vp->numrecs += newrecs;
+          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 ;
+#ifdef VDEBUG
+	fprintf(stderr, "edp\t%ld\n", (unsigned long)edp - (unsigned long)edges) ;
+#endif /* VDEBUG */
+	for( ; edp >= edp0 ; edp--)
+		iocount *= *edp ;
+	/* now edp = edp0 - 1 */
+
+	{ /* inline */
+        long  coords[MAX_VAR_DIMS], upper[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
+     */
+	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) ) ;
+}
+
+
+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[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[MAX_NC_VARS] ; 
+	int ii ;
+	long coords[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) ) ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/putgetg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/putgetg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/putgetg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,257 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *
+ *	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,v 1.8 1997/11/13 20:19:46 acheng Exp $
+ */
+
+#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[MAX_VAR_DIMS];
+	long	mystart[MAX_VAR_DIMS];
+	long	mystride[MAX_VAR_DIMS];
+	long	myimap[MAX_VAR_DIMS];
+	long	iocount[MAX_VAR_DIMS];	/* count vector for NCvario() */
+	long	stop[MAX_VAR_DIMS];	/* stop indexes */
+	long	length[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);
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/sharray.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/sharray.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/sharray.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,104 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: sharray.c,v 1.2 1993/05/03 21:25:15 chouck Exp $ */
+
+#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 ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/string.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/string.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/string.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,221 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: string.c,v 1.12 1997/11/05 19:40:32 koziol Exp $ */
+
+#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 > 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,  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) ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/test1.nc
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/test1.nc
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/test_cdf.sav
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/test_cdf.sav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/testout.sav
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/testout.sav	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/testout.sav	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/var.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/var.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/var.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,903 @@
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/*	$Id: var.c,v 1.25 2000/08/29 13:56:54 koziol Exp $ */
+
+#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;
+        ret->aid = FAIL;
+        ret->ndg_ref = 0;
+        ret->HDFtype = hdf_map_type(type);
+        ret->HDFsize = DFKNTsize(ret->HDFtype);
+        ret->is_ragged = FALSE;
+        ret->created = FALSE;       /* This is set in SDcreate() if its 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
+
+	var->shape = NULL ;
+	var->dsizes = NULL ;
+
+	/*
+	 * 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++ ;
+	}
+	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_dsizes") ;
+		return(-1) ;
+	}
+	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 >= 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 != 0)
+		*typep = vp->type ;
+	if(ndimsp != 0)
+	{
+		*ndimsp = vp->assoc->count ;
+	}
+	if(dims != 0)
+	{
+		for(ii = 0 ; ii < vp->assoc->count ; ii++)
+		{
+			dims[ii] = vp->assoc->values[ii] ;
+		}
+	}
+	if(nattrsp != 0)
+	{
+		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[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) ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/win32cdf.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/win32cdf.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/win32cdf.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,581 @@
+/* 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: win32cdf.h,v 1.4 1999/02/26 21:05:29 ptlu Exp $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+//RWR Modification Start 07/14/98
+//#include "api_adpt.h"
+#include "hdfi.h"
+//RWR Modification End
+
+/*
+ * 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.
+ */
+#define USE_ENUM
+
+
+/*
+ * 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 vax
+#define	XDR_D_INFINITY	1.7014118346046923e+38
+#define	XDR_F_INFINITY	1.70141173e+38
+#endif /* vax */
+
+#ifdef cray
+#define	XDR_D_INFINITY	1.797693134862313000e+308
+#define	XDR_F_INFINITY	XDR_D_INFINITY
+#endif /* cray */
+
+#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'
+ */
+#ifdef __alpha
+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
+
+extern 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) */
+
+/*
+ * NB: The following feature-test line is too long in order to accomodate a 
+ * bug in the VMS 5.3 C compiler.
+ */
+#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
+
+#include "hdf2netcdf.h"
+
+#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 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, 
+    const 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,
+    const 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,
+    const 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* const* datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/win32cdf.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/win32cdf.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/win32cdf.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,327 @@
+# 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 "win32cdf.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 : $(OUTDIR)/win32cdf.lib $(OUTDIR)/win32cdf.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 /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /I "..\xdr" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_SYS_XDR_INC" /D "HDF" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /I\
+ "..\xdr" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_SYS_XDR_INC" /D "HDF"\
+ /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"win32cdf.bsc" 
+
+$(OUTDIR)/win32cdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	$(INTDIR)/globdef.obj \
+	$(INTDIR)/error.obj \
+	$(INTDIR)/iarray.obj \
+	$(INTDIR)/array.obj \
+	$(INTDIR)/attr.obj \
+	$(INTDIR)/putgetg.obj \
+	$(INTDIR)/hdfsds.obj \
+	$(INTDIR)/string.obj \
+	$(INTDIR)/dim.obj \
+	$(INTDIR)/cdf.obj \
+	$(INTDIR)/var.obj \
+	$(INTDIR)/mfsd.obj \
+	$(INTDIR)/xdrposix.obj \
+	$(INTDIR)/file.obj \
+	$(INTDIR)/nssdc.obj \
+	$(INTDIR)/sharray.obj \
+	$(INTDIR)/putget.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"win32cdf.lib" 
+
+$(OUTDIR)/win32cdf.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 : $(OUTDIR)/win32cdf.lib $(OUTDIR)/win32cdf.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 /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /I "..\xdr" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_SYS_XDR_INC" /D "HDF" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Z7 /Od /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /I\
+ "..\xdr" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_SYS_XDR_INC" /D "HDF"\
+ /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"win32cdf.bsc" 
+
+$(OUTDIR)/win32cdf.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	$(INTDIR)/globdef.obj \
+	$(INTDIR)/error.obj \
+	$(INTDIR)/iarray.obj \
+	$(INTDIR)/array.obj \
+	$(INTDIR)/attr.obj \
+	$(INTDIR)/putgetg.obj \
+	$(INTDIR)/hdfsds.obj \
+	$(INTDIR)/string.obj \
+	$(INTDIR)/dim.obj \
+	$(INTDIR)/cdf.obj \
+	$(INTDIR)/var.obj \
+	$(INTDIR)/mfsd.obj \
+	$(INTDIR)/xdrposix.obj \
+	$(INTDIR)/file.obj \
+	$(INTDIR)/nssdc.obj \
+	$(INTDIR)/sharray.obj \
+	$(INTDIR)/putget.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"win32cdf.lib" 
+
+$(OUTDIR)/win32cdf.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=.\globdef.c
+
+$(INTDIR)/globdef.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\error.c
+
+$(INTDIR)/error.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\iarray.c
+
+$(INTDIR)/iarray.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\alloc.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\error.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\array.c
+
+$(INTDIR)/array.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\attr.c
+
+$(INTDIR)/attr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\putgetg.c
+
+$(INTDIR)/putgetg.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdfsds.c
+
+$(INTDIR)/hdfsds.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\string.c
+
+$(INTDIR)/string.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mfhdf.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dim.c
+
+$(INTDIR)/dim.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cdf.c
+
+$(INTDIR)/cdf.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\var.c
+
+$(INTDIR)/var.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mfsd.c
+
+$(INTDIR)/mfsd.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\xdrposix.c
+
+$(INTDIR)/xdrposix.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\local_nc.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\file.c
+
+$(INTDIR)/file.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\nssdc.c
+
+$(INTDIR)/nssdc.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\sharray.c
+
+$(INTDIR)/sharray.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\putget.c
+
+$(INTDIR)/putget.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\netcdf.h
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/xdrposix.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/xdrposix.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/xdrposix.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,682 @@
+/*
+ * 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,v 1.21 2000/08/29 23:51:07 wendling Exp $ */
+
+/*
+ * 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):
+ */
+#ifdef CRAY
+#   undef  NETLONG
+#   define NETLONG  long
+#endif
+#ifndef NETLONG
+#   define NETLONG  long
+#endif
+typedef NETLONG     netlong;
+#undef  NETLONG
+
+#ifdef vms
+#   include <unixio.h>
+#   include <file.h>
+#else
+#   if defined MSDOS || defined WINNT || defined WIN32
+#       include <io.h>
+#   else
+#       if defined (__MWERKS__)
+#            include <unistd.h>
+#       else
+#           if !(defined(macintosh) || defined (SYMANTEC_C))
+#               include <unistd.h>
+#           endif
+#       endif
+#   endif
+#   include <fcntl.h>
+#endif
+
+#if defined(macintosh) || defined (SYMANTEC_C)
+#include <types.h>
+#else
+#include <sys/types.h>
+#endif
+
+#include <string.h>
+#include "local_nc.h" /* prototypes for NCadvis, nc_error */
+		      /* also obtains <stdio.h>, <rpc/types.h>, &
+		       * <rpc/xdr.h> */
+#include "netcdf.h" /* NC_ */
+#include "mfhdf.h"
+
+#if !(defined DOS_FS || defined(macintosh) || defined (SYMANTEC_C))
+#   if defined VMS
+        typedef u_long ncpos_t;  /* size of u_long is 32 for DECC AXP */
+#   else 
+        typedef u_int ncpos_t ;  /* all unicies */
+#   endif
+#else
+#if defined DOS_FS
+typedef off_t ncpos_t ;
+#else /* macintosh */
+typedef u_long ncpos_t ;
+#endif /* macintosh */
+#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 */
+#ifndef CRAY
+#ifdef DOS_FS
+#ifdef QAK
+#define BIOBUFSIZ   4096
+#else
+#define BIOBUFSIZ   512
+#endif
+#else
+#define BIOBUFSIZ   8192
+#endif
+#else
+#define BIOBUFSIZ   196608 /* stat.st_oblksize */
+#endif
+    unsigned char base[BIOBUFSIZ];      /* the data buffer */
+} biobuf;
+
+
+static void
+free_biobuf(abuf)
+biobuf *abuf;
+{
+    if(abuf == NULL)
+        return;
+    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)
+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();
+#ifdef CRAY
+static inline_t *   xdrposix_inline();
+#else
+#if (_MIPS_SZLONG == 64)
+static long *    xdrposix_inline();
+#else
+static netlong *    xdrposix_inline();
+#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 */
+    xdrposix_destroy    /* destroy stream */
+};
+
+
+/*
+ * 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;
+    long *lp;
+{
+    unsigned char *up = (unsigned char *)lp ;
+#ifdef CRAY
+    *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;
+    long *lp;
+{
+
+    unsigned char *up = (unsigned char *)lp ;
+#ifdef SWAP
+    netlong mycopy = htonl(*lp);
+    up = (unsigned char *)&mycopy;
+#endif
+#ifdef CRAY
+    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;
+    u_int len;
+{
+
+    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;
+    u_int len;
+{
+
+    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*/
+#ifdef CRAY
+static inline_t *
+#else
+#if (_MIPS_SZLONG == 64)
+static long *
+#else
+static netlong *
+#endif
+#endif
+xdrposix_inline(xdrs, len)
+    XDR *xdrs;
+    u_int 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)
+
+static bool_t
+xdrposix_getint(xdrs, lp)
+    XDR *xdrs;
+    int *lp;
+{
+    unsigned char *up = (unsigned char *)lp ;
+#ifdef CRAY
+    *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_putint(xdrs, lp)
+    XDR *xdrs;
+    int *lp;
+{
+
+    unsigned char *up = (unsigned char *)lp ;
+#ifdef SWAP
+    netlong mycopy = htonl(*lp);
+    up = (unsigned char *)&mycopy;
+#endif
+#ifdef CRAY
+    up += (sizeof(long) - 4) ;
+#endif
+
+    if (biowrite((biobuf *)xdrs->x_private, up, 4) < 4)
+        return (FALSE);
+    return (TRUE);
+}
+#endif
+
+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 CRAY
+    fmode |= O_RAW ;
+#endif
+#ifdef DOS_FS
+    /*
+     * set default mode to binary to suppress the expansion of
+     * 0x0f into CRLF
+     */
+    if(_fmode != O_BINARY)
+        _fmode = O_BINARY ;
+#endif
+#if defined(macintosh) || defined (SYMANTEC_C)
+    fd = open(path, fmode);
+#else /* !macintosh  */
+    fd = open(path, fmode, 0666) ;
+#endif /* !macintosh */
+#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 ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/libsrc/xdrstdio.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/libsrc/xdrstdio.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/libsrc/xdrstdio.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,347 @@
+#if !defined(lint)
+static char rcsid[] = "$Id: xdrstdio.c,v 1.2 1993/05/03 21:25:17 chouck Exp $";
+#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) ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/macros.mk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/macros.mk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/macros.mk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,17 @@
+OS2     = 0
+CC        = cl
+#CFLAGS    = /c /AL /Za
+CFLAGS    = /DPC /DHDF /c /Gt64 /AH /W4 $(IFLAGS) /Zp1 /Zl
+#CFLAGS = /c /Gt64 /AH /W4 /DPC /DHDF /Ox /Mq /DTEST_WIN
+#CFLAGS=  /D$(MACHINE) /Gt64 /AH /W4 /Ozaxb2 $(IFLAGS) /Zp1 /Zl
+
+F77   = fl
+#FFLAGS    = /c /AL
+FFLAGS= /c /Gt64 /AH /W2 /Od /Tf
+
+AR        = lib
+ARFLAGS   =
+
+ASM       = masm
+
+FORT = 1

Added: packages/libhdf4/branches/upstream/current/mfhdf/make.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/make.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/make.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,62 @@
+$! --------------------------------------------------------------------------
+$! For making CDFTEST.EXE on VMS if you don't have MMS.
+$! --------------------------------------------------------------------------
+$!
+$! $Id: make.com,v 1.2 1993/09/03 12:16:43 koziol Exp $
+$!
+$! You must create the netcdf library, NETCDF.OLB, from the XDR directory,
+$! [-.xdr], before executing this procedure.
+$
+$
+$ macro :== macro/nolist
+$ ccc := cc /opt/nodebug/include=([-.xdr],[-.-.hdf.include])/nolist  -
+            /define=stdc_includes/define=swap/define=VMS/define=HDF
+
+$ librep := library/replace [-.-.-.LIB]NETCDF.OLB
+$
+$ define rpc sys$disk:[-.xdr]
+$ define sys sys$library
+$
+$ ccc ARRAY.C
+$ ccc ATTR.C
+$ ccc CDF.C
+$ ccc CDFTEST.C
+$ ccc DIM.C
+$ ccc ERROR.C
+$ ccc FILE.C
+$ ccc IARRAY.C
+$ ccc PUTGET.C
+$ ccc PUTGETG.C
+$ ccc SHARRAY.C
+$ ccc STRING.C
+$ ccc VAR.C
+$ ccc XDRPOSIX.C
+! $ ccc XDRSTDIO.C
+$ ccc HDFSDS.C
+$ ccc MFSD.C
+$ ccc hdftest.c
+$ macro HTONS.MAR
+$ macro NTOHS.MAR
+$
+$ librep ARRAY, ATTR, CDF, DIM, FILE, IARRAY, ERROR, -
+    PUTGET, PUTGETG, SHARRAY, STRING, VAR, HTONS, NTOHS, -
+    HDFSDS, MFSD, XDRPOSIX
+$ library/list=netcdf.list/name [-.-.-.lib]netcdf.olb
+$ link/nodebug/exec=CDFTEST.exe -
+    cdftest.obj, -
+    [-.-.-.lib]netcdf/library, -
+    [-.-.hdf.lib]df/library, -
+    sys$input/opt
+	sys$library:vaxcrtl.exe/share
+$
+$ create/dir [-.-.-.include]
+$
+$ copy netcdf.h [-.-.-.include]
+$
+$ link/nodebug/exec=hdftest.exe -
+    hdftest.obj, -
+    [-.-.-.lib]netcdf/library, -
+    [-.-.hdf.lib]df/library, -
+        sys$input/opt
+        sys$library:vaxcrtl.exe/share
+$

Added: packages/libhdf4/branches/upstream/current/mfhdf/mfhdf.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/mfhdf.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/mfhdf.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,518 @@
+# Microsoft Visual C++ generated build script - Do not modify
+
+PROJ = MFHDF
+DEBUG = 1
+PROGTYPE = 3
+CALLER = 
+ARGS = 
+DLLS = 
+ORIGIN = MSVCNT
+ORIGIN_VER = 1.00
+PROJPATH = E:\KOZIOL\MFHDF\ 
+USEMFC = 0
+CC = cl
+CPP = cl
+CXX = cl
+CCREATEPCHFLAG = 
+CPPCREATEPCHFLAG = 
+CUSEPCHFLAG = 
+CPPUSEPCHFLAG = 
+FIRSTC = ARRAY.C
+FIRSTCPP = 
+RC = rc
+CFLAGS_D_LIB32 = /nologo /W3 /Z7 /YX /D "_DEBUG" /D "STDC_INCLUDES" /D "_X86_" /D "_WINDOWS" /D "HDF" /D "WINNT" /D "NO_SYS_XDR_INC" /D "i386" /I "e:\koziol\mfhdf\xdr" /FR /ML /Fp"MFHDF.PCH"
+CFLAGS_R_LIB32 = /nologo /W3 /YX /O2 /D "NDEBUG" /D "_X86_" /D "_WINDOWS" /D "HDF" /D "WINNT" /D "NO_SYS_XDR_INC" /D "i386" /I "e:\koziol\mfhdf\xdr" /FR /ML /Fp"MFHDF.PCH"
+LFLAGS_D_LIB32 = /NOLOGO
+LFLAGS_R_LIB32 = /NOLOGO
+RCFLAGS32 = 
+D_RCDEFINES32 = -d_DEBUG
+R_RCDEFINES32 = -dNDEBUG
+OBJS_EXT = 
+LIBS_EXT = 
+!if "$(DEBUG)" == "1"
+CFLAGS = $(CFLAGS_D_LIB32)
+LFLAGS = 
+LIBS = 
+LFLAGS_LIB=$(LFLAGS_D_LIB32)
+MAPFILE_OPTION = 
+RCDEFINES = $(D_RCDEFINES32)
+!else
+CFLAGS = $(CFLAGS_R_LIB32)
+LFLAGS = 
+LIBS = 
+MAPFILE_OPTION = 
+LFLAGS_LIB=$(LFLAGS_R_LIB32)
+RCDEFINES = $(R_RCDEFINES32)
+!endif
+SBRS = ARRAY.SBR \
+		ATTR.SBR \
+		CDF.SBR \
+		DIM.SBR \
+		ERROR.SBR \
+		FILE.SBR \
+		GLOBDEF.SBR \
+		HDFSDS.SBR \
+		IARRAY.SBR \
+		MFSD.SBR \
+		PUTGET.SBR \
+		PUTGETG.SBR \
+		SHARRAY.SBR \
+		STRING.SBR \
+		VAR.SBR \
+		XDRPOSIX.SBR \
+		BYTEORDR.SBR \
+		XDR.SBR \
+		XDRARRAY.SBR \
+		XDRFLOAT.SBR \
+		XDRSTDIO.SBR \
+		GETOPT.SBR
+
+
+ARRAY_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+ATTR_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+CDF_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+DIM_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+ERROR_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h
+
+
+FILE_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+GLOBDEF_DEP =  \
+	e:\koziol\mfhdf\libsrc\netcdf.h
+
+
+HDFSDS_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h
+
+
+IARRAY_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+MFSD_DEP =  \
+	e:\koziol\mfhdf\libsrc\mfhdf.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	d:\users\koziol\hdf\src\hfile.h
+
+
+PUTGET_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+PUTGETG_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h
+
+
+SHARRAY_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+STRING_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+VAR_DEP =  \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\alloc.h
+
+
+XDRPOSIX_DEP =  \
+	e:\koziol\mfhdf\libsrc\netcdf.h \
+	e:\koziol\mfhdf\libsrc\local_nc.h \
+	d:\msvcnt\include\rpc\xdr.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h \
+	d:\users\koziol\hdf\src\vg.h \
+	d:\users\koziol\hdf\src\tbbt.h \
+	e:\koziol\mfhdf\libsrc\mfhdf.h
+
+
+BYTEORDR_DEP = 
+
+XDR_DEP =  \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h
+
+
+XDRARRAY_DEP =  \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h
+
+
+XDRFLOAT_DEP =  \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h
+
+
+XDRSTDIO_DEP =  \
+	d:\msvcnt\include\netinet\in.h \
+	e:\koziol\mfhdf\xdr\xdr.h \
+	d:\users\koziol\hdf\src\hdf.h \
+	d:\users\koziol\hdf\src\hdfi.h \
+	d:\msvcnt\include\sys\file.h \
+	d:\users\koziol\hdf\src\dfivms.h \
+	d:\users\koziol\hdf\src\maldebug.h \
+	d:\users\koziol\hdf\src\hcomp.h \
+	d:\users\koziol\hdf\src\herr.h \
+	d:\users\koziol\hdf\src\hproto.h \
+	d:\users\koziol\hdf\src\vproto.h
+
+
+GETOPT_DEP = 
+
+all:	$(PROJ).LIB $(PROJ).BSC
+
+ARRAY.OBJ:	LIBSRC\ARRAY.C $(ARRAY_DEP)
+	$(CC) $(CFLAGS) $(CCREATEPCHFLAG) /c LIBSRC\ARRAY.C
+
+ATTR.OBJ:	LIBSRC\ATTR.C $(ATTR_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c LIBSRC\ATTR.C
+
+CDF.OBJ:	LIBSRC\CDF.C $(CDF_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c LIBSRC\CDF.C
+
+DIM.OBJ:	LIBSRC\DIM.C $(DIM_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c LIBSRC\DIM.C
+
+ERROR.OBJ:	LIBSRC\ERROR.C $(ERROR_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c LIBSRC\ERROR.C
+
+FILE.OBJ:	LIBSRC\FILE.C $(FILE_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c LIBSRC\FILE.C
+
+GLOBDEF.OBJ:	LIBSRC\GLOBDEF.C $(GLOBDEF_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c LIBSRC\GLOBDEF.C
+
+HDFSDS.OBJ:	LIBSRC\HDFSDS.C $(HDFSDS_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c LIBSRC\HDFSDS.C
+
+IARRAY.OBJ:	LIBSRC\IARRAY.C $(IARRAY_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /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(XDRSTDIO_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c XDR\XDRSTDIO.C
+
+GETOPT.OBJ:	UTIL\GETOPT.C $(GETOPT_DEP)
+	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c UTIL\GETOPT.C
+
+$(PROJ).LIB:	ARRAY.OBJ ATTR.OBJ CDF.OBJ DIM.OBJ ERROR.OBJ FILE.OBJ GLOBDEF.OBJ HDFSDS.OBJ \
+	IARRAY.OBJ MFSD.OBJ PUTGET.OBJ PUTGETG.OBJ SHARRAY.OBJ STRING.OBJ VAR.OBJ XDRPOSIX.OBJ \
+	BYTEORDR.OBJ XDR.OBJ XDRARRAY.OBJ XDRFLOAT.OBJ XDRSTDIO.OBJ GETOPT.OBJ $(OBJS_EXT) $(LIBS_EXT)
+	echo >NUL @<<$(PROJ).CRF
+ARRAY.OBJ 
+ATTR.OBJ 
+CDF.OBJ 
+DIM.OBJ 
+ERROR.OBJ 
+FILE.OBJ 
+GLOBDEF.OBJ 
+HDFSDS.OBJ 
+IARRAY.OBJ 
+MFSD.OBJ 
+PUTGET.OBJ 
+PUTGETG.OBJ 
+SHARRAY.OBJ 
+STRING.OBJ 
+VAR.OBJ 
+XDRPOSIX.OBJ 
+BYTEORDR.OBJ 
+XDR.OBJ 
+XDRARRAY.OBJ 
+XDRFLOAT.OBJ 
+XDRSTDIO.OBJ 
+GETOPT.OBJ 
+
+
+<<
+	if exist $@ del $@
+	link -LIB @$(PROJ).CRF
+
+$(PROJ).BSC: $(SBRS)
+	bscmake @<<
+/o$@ $(SBRS)
+<<

Added: packages/libhdf4/branches/upstream/current/mfhdf/msoft.mk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/msoft.mk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/msoft.mk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,143 @@
+#   Copyright 1993, University Corporation for Atmospheric Research
+#
+#  DOS and OS/2 Makefile for netCDF library
+#
+#  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 /st:3000
+#LFLAGS    = /cod /nod /st:8000
+LFLAGS=/INFO /COD /ST:8192 /MAP:FULL /SEG:256
+
+LIBDIR    = $(DESTDIR)\lib
+
+HDFDIR    = \hdf\hdf
+
+INCDIR    = ..\xdr
+INCLUDES  = /I$(INCDIR) /I$(HDFDIR)\include
+
+DEFINES  = /DSWAP /DNO_SYS_XDR_INC /DDOS_FS
+
+NETCDFLIB = netcdf.lib
+CLIBS     = llibc7.lib oldnames.lib
+!IF $(OS2)
+OS2LIB    = os2.lib
+!ELSE
+OS2LIB    =
+!ENDIF
+XDRLIB    = ..\xdr\xdr.lib
+HDFLIB    = \hdf\hdf\lib\df.lib
+LIBS      = $(NETCDFLIB) $(XDRLIB) $(OS2LIB) $(CLIBS) $(HDFLIB)
+
+MANIFEST = Makefile alloc.h array.c attr.c cdf.c \
+	cdftest.c descrip.mms dim.c error.c error.h file.c \
+	htons.mar iarray.c local_nc.h netcdf.h ntohs.mar \
+    putget.c sharray.c string.c test.cdf.sav var.c hdfsds.c \
+    mfsd.c globdef.c
+
+CSRCS = array.c attr.c cdf.c dim.c error.c file.c globdef.c iarray.c \
+    putget.c putgetg.c sharray.c string.c var.c hdfsds.c mfsd.c xdrposix.c
+
+COBJS = array.obj attr.obj cdf.obj dim.obj error.obj file.obj globdef.obj \
+	iarray.obj putget.obj putgetg.obj sharray.obj string.obj var.obj \
+    hdfsds.obj mfsd.obj xdrposix.obj
+
+LOBJS1 = -+array -+attr -+cdf -+dim -+error -+file -+globdef -+iarray
+LOBJS2 = -+putget -+putgetg -+sharray -+string -+var -+xdrposix
+LOBJS3 = -+hdfsds -+mfsd
+
+.c.obj:
+        $(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) $<
+
+all:		$(NETCDFLIB)
+
+$(NETCDFLIB): netcdf.h $(COBJS)
+        $(AR) $@ $(ARFLAGS) $(LOBJS1),LIB.LST;
+        $(AR) $@ $(ARFLAGS) $(LOBJS2),LIB.LST;
+        $(AR) $@ $(ARFLAGS) $(LOBJS3),LIB.LST;
+
+test:       cdftest.exe hdftest.exe FORCE
+	cdftest
+    hdftest
+
+FORCE:
+
+cdftest.exe: cdftest.obj $(NETCDFLIB)
+	$(LINK) $(LFLAGS) @cdftest.lnk
+#	$(LINK) $(LFLAGS) cdftest.obj,,,$(LIBS),cdftest;
+
+hdftest.exe: hdftest.obj $(NETCDFLIB)
+    $(LINK) $(LFLAGS) @hdftest.lnk
+#    $(LINK) $(LFLAGS) hdftest.obj,,,$(LIBS),hdftest;
+
+clean  :
+	del *.obj *.map *.lst *.bak netcdf.lib *.exe test.cdf
+
+install : $(NETCDFLIB)
+	copy $(NETCDFLIB) $(LIBDIR)
+
+array.obj: array.c
+array.obj: ./local_nc.h
+array.obj: ./netcdf.h
+array.obj: ./alloc.h
+attr.obj: attr.c
+attr.obj: ./local_nc.h
+attr.obj: ./netcdf.h
+attr.obj: ./alloc.h
+cdf.obj: cdf.c
+cdf.obj: ./local_nc.h
+cdf.obj: ./netcdf.h
+cdf.obj: ./alloc.h
+cdftest.obj: cdftest.c
+cdftest.obj: ./netcdf.h
+dim.obj: dim.c
+dim.obj: ./local_nc.h
+dim.obj: ./netcdf.h
+dim.obj: ./alloc.h
+error.obj: error.c
+error.obj: ./local_nc.h
+error.obj: ./netcdf.h
+file.obj: file.c
+file.obj: ./local_nc.h
+file.obj: ./netcdf.h
+file.obj: ./alloc.h
+globdef.obj: globdef.c
+globdef.obj: ./netcdf.h
+iarray.obj: iarray.c
+iarray.obj: ./local_nc.h
+iarray.obj: ./netcdf.h
+iarray.obj: ./alloc.h
+mfsd.obj: mfsd.c
+mfsd.obj: mfsd.h
+mfsd.obj: local_nc.h
+putget.obj: putget.c
+putget.obj: ./local_nc.h
+putget.obj: ./netcdf.h
+putget.obj: ./alloc.h
+putgetg.obj: putgetg.c
+putgetg.obj: ./local_nc.h
+putgetg.obj: ./netcdf.h
+sharray.obj: sharray.c
+sharray.obj: ./local_nc.h
+sharray.obj: ./netcdf.h
+sharray.obj: ./alloc.h
+string.obj: string.c
+string.obj: ./local_nc.h
+string.obj: ./netcdf.h
+string.obj: ./alloc.h
+var.obj: var.c
+var.obj: ./local_nc.h
+var.obj: ./netcdf.h
+var.obj: ./alloc.h
+xdrposix.obj: xdrposix.c
+xdrposix.obj: ./netcdf.h
+xdrposix.obj: ./local_nc.h
+xdrposix.obj: ./netcdf.h
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,731 @@
+# Makefile for ncdump(1).
+#
+# $Id: Makefile.in,v 1.19 2000/08/30 18:43:28 wendling Exp $
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+ZLIB_LIB = $(TOP_SRCDIR)/hdf/zlib/libz.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+PROGRAM		= ncdump
+BINFILES	= $(PROGRAM)
+#HDF_LIB         = @HDF_LIB@
+#JPEG_LIB        = @JPEG_LIB@
+#HDF_INC         = @HDF_INC@
+#CPP_NETCDF	= -I../libsrc -I../port $(HDF_INC)
+#CPPFLAGS	= $(CPPFLAGS_NCD)
+#CFLAGS		= @CFLAGS@
+#FFLAGS		= @FFLAGS@
+MANIFEST = $(DISTFILES)
+DISTFILES	= Makefile.in ncdump.c ncdump.h  depend msoft.mk \
+		  test0.cdl vardata.c vardata.h dumplib.c dumplib.h ncdump.1 \
+                  make.com msofttab.c
+MANUALS		= ncdump.1
+LIBNAME		= mfhdf
+LD_NETCDF	= ../libsrc/libmfhdf.a
+OBJS		=  ncdump.o vardata.o dumplib.o
+#LD_XDR		= @LD_XDR@
+LD_NETCDF	= -L../libsrc -lmfhdf
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(JPEG_LIB) $(ZLIB_LIB) $(LIBSX)
+prefix		= ../../..
+GARBAGE		= $(PROGRAM) test0.nc test1.nc test1.cdl test2.cdl
+
+#all::		$(PROGRAM)
+all::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" $(PROGRAM); \
+	fi
+
+
+test:		$(PROGRAM) test0.cdl
+	$(NCGEN) -o test0.nc -n test0.cdl
+	./$(PROGRAM) test0.nc > test1.cdl
+	$(NCGEN) -o test1.nc -n test1.cdl
+	./$(PROGRAM) -n test0 test1.nc > test2.cdl
+	@cmp test1.cdl test2.cdl && \
+	    echo "*** $(PROGRAM) test successful ***" ; \
+	    rm test1.cdl test1.nc test2.cdl
+
+install::	installed_program installed_manuals
+install-utils::	installed_program
+install-man::	installed_manuals
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF) '; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+	chmod u=rw,og=r $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/ncdump
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+
+# Override the default definition for ncgen(1) in the master makefile.
+#
+NCGEN		= ../ncgen/ncgen
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,49 @@
+# Makefile for ncdump(1).
+#
+# $Id: Makefile.in_orig,v 1.2 2000/08/30 18:46:36 wendling Exp $
+
+PROGRAM		= ncdump
+BINFILES	= $(PROGRAM)
+HDF_LIB         = @HDF_LIB@
+JPEG_LIB        = @JPEG_LIB@
+HDF_INC         = @HDF_INC@
+CPP_NETCDF	= -I../libsrc -I../port $(HDF_INC)
+CPPFLAGS	= $(CPP_NETCDF) @CPPFLAGS@
+CFLAGS		= @CFLAGS@
+FFLAGS		= @FFLAGS@
+MANIFEST	= Makefile.in ncdump.c ncdump.h  depend msoft.mk \
+		  test0.cdl vardata.c vardata.h dumplib.c dumplib.h ncdump.1 \
+                  make.com msofttab.c
+MANUALS		= ncdump.1
+LIBNAME		= netcdf
+LD_NETCDF	= ../libsrc/libnetcdf.a
+OBJS		=  ncdump.o vardata.o dumplib.o
+LD_XDR		= @LD_XDR@
+LD_NETCDF	= -L../libsrc -lnetcdf
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(JPEG_LIB) $(LIBSX)
+prefix		= ../../..
+GARBAGE		= $(PROGRAM) test0.nc test1.nc test1.cdl test2.cdl
+
+all::		$(PROGRAM)
+
+
+test:		$(PROGRAM) test0.cdl
+	$(NCGEN) -o test0.nc -n test0.cdl
+	./$(PROGRAM) test0.nc > test1.cdl
+	$(NCGEN) -o test1.nc -n test1.cdl
+	./$(PROGRAM) -n test0 test1.nc > test2.cdl
+	@cmp test1.cdl test2.cdl && \
+	    echo "*** $(PROGRAM) test successful ***" ; \
+	    rm test1.cdl test1.nc test2.cdl
+
+install::	installed_program installed_manuals
+
+include ../port/master.mk
+
+# Override the default definition for ncgen(1) in the master makefile.
+#
+NCGEN		= ../ncgen/ncgen
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/SETUPNCDUMP.COM
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/SETUPNCDUMP.COM	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/SETUPNCDUMP.COM	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,2 @@
+ncdump  :==  $  MRLXP4$DKA200:[FOLK.dev.MFHDF.NCDUMP]ncdump
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ctest0.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ctest0.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ctest0.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,72 @@
+# Microsoft Visual C++ generated build script - Do not modify
+
+PROJ = CTEST0
+DEBUG = 1
+PROGTYPE = 2
+CALLER = 
+ARGS = 
+DLLS = 
+ORIGIN = MSVCNT
+ORIGIN_VER = 1.00
+PROJPATH = E:\KOZIOL\MFHDF\NCDUMP\ 
+USEMFC = 0
+CC = cl
+CPP = cl
+CXX = cl
+CCREATEPCHFLAG = 
+CPPCREATEPCHFLAG = 
+CUSEPCHFLAG = 
+CPPUSEPCHFLAG = 
+FIRSTC = 
+FIRSTCPP = 
+RC = rc
+CFLAGS_D_DEXE32 = /nologo /D_X86_ /W3 /FR /YX /D_DEBUG /Zi /D_CONSOLE /Fd"CTEST0.PDB" /Fp"CTEST0.PCH"
+CFLAGS_R_DEXE32 = /nologo /D_X86_ /W3 /FR /YX /O2 /DNDEBUG /D_CONSOLE /Fp"CTEST0.PCH"
+LFLAGS_D_DEXE32 = /NOLOGO /DEBUG /DEBUGTYPE:cv /SUBSYSTEM:console netapi32.lib 
+LFLAGS_R_DEXE32 = /NOLOGO /SUBSYSTEM:console netapi32.lib 
+LFLAGS_D_LIB32 = /NOLOGO 
+LFLAGS_R_LIB32 = /NOLOGO 
+LIBS_D_DEXE32 = 
+LIBS_R_DEXE32 = 
+RCFLAGS32 = 
+D_RCDEFINES32 = -d_DEBUG
+R_RCDEFINES32 = -dNDEBUG
+OBJS_EXT = 
+LIBS_EXT = 
+!if "$(DEBUG)" == "1"
+CFLAGS = $(CFLAGS_D_DEXE32)
+LFLAGS = $(LFLAGS_D_DEXE32)
+LIBS = $(LIBS_D_DEXE32)
+LFLAGS_LIB=$(LFLAGS_D_LIB32)
+MAPFILE_OPTION = 
+RCDEFINES = $(D_RCDEFINES32)
+!else
+CFLAGS = $(CFLAGS_R_DEXE32)
+LFLAGS = $(LFLAGS_R_DEXE32)
+LIBS = $(LIBS_R_DEXE32)
+MAPFILE_OPTION = 
+LFLAGS_LIB=$(LFLAGS_R_LIB32)
+RCDEFINES = $(R_RCDEFINES32)
+!endif
+
+all:	$(PROJ).EXE $(PROJ).BSC
+
+$(PROJ).EXE:	$(OBJS_EXT) $(LIBS_EXT)
+	echo >NUL @<<$(PROJ).CRF
+$(OBJS_EXT)
+-OUT:$(PROJ).EXE
+$(MAPFILE_OPTION)
+$(LIBS)
+$(LIBS_EXT)
+$(DEFFILE_OPTION) -implib:$(PROJ).lib
+<<
+	link $(LFLAGS) @$(PROJ).CRF
+
+run: $(PROJ).EXE
+	$(PROJ) $(RUNFLAGS)
+
+
+$(PROJ).BSC: $(SBRS)
+	bscmake @<<
+/o$@ $(SBRS)
+<<

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/dumplib.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/dumplib.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/dumplib.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,225 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/README file for copying and redistribution conditions.
+ *   $Id: dumplib.c,v 1.4 1997/11/14 02:27:44 acheng Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef NO_STDARG
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include "netcdf.h"
+#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;    
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/dumplib.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/dumplib.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/dumplib.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,101 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: dumplib.h,v 1.7 1997/11/05 19:40:37 koziol Exp $
+ *********************************************************************/
+
+extern char *progname;		/* for error messages */
+
+#ifndef EXIT_FAILURE
+#ifndef vms
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#else
+#define EXIT_SUCCESS 1
+#define EXIT_FAILURE 0
+#endif
+#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

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/make.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/make.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/make.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,35 @@
+$! --------------------------------------------------------------------------
+$! For making NCDUMP.EXE on VMS.
+$! --------------------------------------------------------------------------
+$!
+$! $Id: make.com,v 1.3 1996/11/07 00:29:37 sxu Exp $
+$!
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC"
+$ define/nolog sys$clib sys$library:deccrtl
+$ getopt = ""
+$ else
+$ ccopt = ""
+$ define/nolog sys$clib sys$library:vaxcrtl
+$ getopt = "getopt.obj, "
+$ endif
+$ ccc := cc 'ccopt /opt/nodebug -
+           /define=(HDF,VMS,NO_SYS_XDR_INC)/nolist -
+            /include=([-.libsrc],[-.xdr],[--.hdf.src], -
+            [--.hdf.jpeg], [--.hdf.zlib]) 
+$
+$ ccc [-.UTIL]GETOPT.C
+$ ccc DUMPLIB.C
+$ ccc NCDUMP.C
+$ ccc VARDATA.C
+$
+$ link/nodebug/exe=NCDUMP.exe -
+    'getopt   dumplib.obj, -
+    ncdump.obj, -
+    vardata.obj, -
+    [--.lib]mfhdf/lib,[--.hdf.src]df/lib, -
+    [--.hdf.jpeg]libjpeg.olb/lib,  -
+    [--.hdf.zlib]libz.olb/lib, -
+    sys$input/opt
+        sys$clib/lib

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/msoft.mk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/msoft.mk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/msoft.mk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,84 @@
+#   Copyright 1989, University Corporation for Atmospheric Research
+#
+#  DOS and OS/2 Makefile for ncdump
+#
+#  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:30000 /nod
+
+INCDIR1   = ..\libsrc
+INCDIR2   = ..\xdr
+INCLUDES  = /I$(INCDIR1) /I$(INCDIR2)
+
+BINDIR    = $(DESTDIR)\bin
+INCDIR    = $(DESTDIR)\include
+LIBDIR    = $(DESTDIR)\lib
+NCDUMPLIB = ncdump.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      = $(NCDUMPLIB) $(NETCDFLIB) $(XDRLIB) $(OS2LIB) $(HDFLIB) $(CLIB)
+
+.c.obj:
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
+
+LOADLIBS =
+
+GOAL =  ncdump.exe
+
+SRCS =  ncdump.c vardata.c dumplib.c
+
+MAIN = ncdump.obj
+
+OBJS =  vardata.obj dumplib.obj getopt.obj
+LOBJS = -+vardata.obj -+dumplib.obj -+getopt.obj
+
+all:	$(GOAL)
+
+$(GOAL): $(MAIN) $(NCDUMPLIB) $(NETCDFLIB) $(XDRLIB)
+    $(LINK) $(LFLAGS) $(MAIN),$(GOAL),, at ncdump.lnk;
+
+$(NCDUMPLIB): $(OBJS)
+	$(AR) $@ $(ARFLAGS) $(LOBJS),LIB.LST;
+
+getopt.obj: ..\util\getopt.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $?
+
+install: $(GOAL)
+	copy $(GOAL) $(BINDIR)
+	del $(GOAL)
+
+test:	ncdump.exe test0.cdl FORCE
+	..\ncgen\ncgen -o test0.cdf -n test0.cdl
+	ncdump test0.cdf > test1.cdl
+	..\ncgen\ncgen -o test1.cdf -n test1.cdl
+	ncdump -n test0 test1.cdf > test2.cdl
+	diff test1.cdl test2.cdl 
+	@echo "Test successful."
+
+ncdump: ncdump.exe
+
+clean:
+	rm -f *.obj *.map *.lst *.bak ncdump.lib $(GOAL) \
+		test0.cdf test1.cdf test1.cdl test2.cdl
+
+FORCE:
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+ncdump.obj:  $(INCDIR1)\netcdf.h
+vardata.obj: $(INCDIR1)\netcdf.h

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/msofttab.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/msofttab.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/msofttab.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1479 @@
+
+# line 10 "ncgen.y"
+#ifndef lint
+static char SccsId[] = "$Id: msofttab.c,v 1.4 1997/11/05 19:40:38 koziol Exp $";
+#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(const char *);			/* 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 */
+char *nctype();		/* returns type name from number */
+void nc_fill();		/* fills a generic array with a value */
+
+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 long 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 long *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 */
+# define NC_UNLIMITED_K 257
+# define BYTE_K 258
+# define CHAR_K 259
+# define SHORT_K 260
+# define LONG_K 261
+# define FLOAT_K 262
+# define DOUBLE_K 263
+# define IDENT 264
+# define TERMSTRING 265
+# define BYTE_CONST 266
+# define CHAR_CONST 267
+# define SHORT_CONST 268
+# define LONG_CONST 269
+# define FLOAT_CONST 270
+# define DOUBLE_CONST 271
+# define DIMENSIONS 272
+# define VARIABLES 273
+# define NETCDF 274
+# define DATA 275
+
+#include <malloc.h>
+#include <memory.h>
+#if 0
+#include <values.h>
+#endif
+
+#ifdef __cplusplus
+
+#ifndef yyerror
+	void yyerror(const char *);
+#endif
+
+#ifndef yylex
+#ifdef __EXTERN_C__
+	extern "C" { int yylex(void); }
+#else
+	int yylex(void);
+#endif
+#endif
+	int yyparse(void);
+
+#endif
+#define yyclearin yychar = -1
+#define yyerrok yyerrflag = 0
+extern int yychar;
+extern int yyerrflag;
+#ifndef YYSTYPE
+#define YYSTYPE int
+#endif
+YYSTYPE yylval;
+YYSTYPE yyval;
+typedef int yytabelem;
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 150
+#endif
+#if YYMAXDEPTH > 0
+int yy_yys[YYMAXDEPTH], *yys = yy_yys;
+YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;
+#else	/* user does initial allocation */
+int *yys;
+YYSTYPE *yyv;
+#endif
+static int yymaxdepth = YYMAXDEPTH;
+# define YYERRCODE 256
+
+# line 676 "ncgen.y"
+
+
+/* PROGRAMS */
+
+/* get lexical input routine generated by lex  */
+#include "msoftyy.c"
+
+void derror();
+
+yyerror(s)	/* called for yacc syntax error */
+    const char *s;
+{
+	derror(s);
+}
+
+int
+yywrap()			/* returns 1 on EOF if no more input */
+{
+    return  1;
+}
+
+
+/* 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;
+}
+yytabelem yyexca[] ={
+-1, 1,
+	0, -1,
+	-2, 0,
+	};
+# define YYNPROD 71
+# define YYLAST 225
+yytabelem yyact[]={
+
+    92,    93,    91,    94,    95,    96,    97,    71,    72,    70,
+    73,    74,    75,    76,    42,     2,    15,     6,    34,    40,
+    13,    36,    51,    52,     3,    84,    12,    68,    80,    78,
+    59,    39,    19,    18,    18,    77,    62,    56,    44,    35,
+    49,    46,    33,    86,    54,    50,    87,    89,    37,    17,
+    82,    57,    66,    22,    10,     9,    90,    85,    83,    63,
+    53,    69,    67,    48,    16,    47,    26,    79,    65,    58,
+    45,    25,    24,    38,    23,    43,    21,    11,     8,    41,
+    20,    14,     7,     5,     4,    55,     1,     0,     0,     0,
+     0,     0,     0,    81,     0,    60,    55,    47,    61,    64,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+    88,     0,     0,     0,    81,    99,    98,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,    27,    28,
+    29,    30,    31,    32,    36 };
+yytabelem yypact[]={
+
+  -259,-10000000,   -99,-10000000,  -255,-10000000,  -244,  -257,  -244,   -10,
+-10000000,   -29,-10000000,-10000000,-10000000,   -40,   -11,-10000000,  -244,  -238,
+  -261,   -40,   -21,-10000000,-10000000,  -243,-10000000,-10000000,-10000000,-10000000,
+-10000000,-10000000,-10000000,   -18,  -242,-10000000,-10000000,-10000000,-10000000,-10000000,
+-10000000,  -102,  -243,   -22,-10000000,     7,-10000000,-10000000,   -31,  -242,
+-10000000,-10000000,-10000000,  -243,   -23,-10000000,-10000000,  -243,    12,  -258,
+-10000000,   -24,-10000000,   -32,-10000000,-10000000,  -244,     6,-10000000,-10000000,
+-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,     2,
+-10000000,-10000000,  -258,     3,-10000000,  -265,-10000000,  -244,-10000000,-10000000,
+-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000 };
+yytabelem yypgo[]={
+
+     0,    86,    84,    83,    82,    81,    80,    79,    78,    55,
+    54,    77,    26,    76,    53,    74,    72,    71,    70,    41,
+    39,    69,    68,    67,    28,    66,    63,    62,    42,    45,
+    27,    61,    60,    44,    59,    58,    25,    57,    56 };
+yytabelem yyr1[]={
+
+     0,     2,     4,     6,     1,     3,     3,     8,     8,     9,
+     9,    10,    10,    11,    12,     5,     5,    13,    13,    14,
+    14,    15,    17,    17,    17,    17,    17,    17,    18,    18,
+    21,    19,    20,    22,    22,    23,    23,    24,    26,    16,
+    25,    25,    28,    29,    27,    27,    30,    31,    31,    31,
+    31,    31,    31,    31,     7,     7,    32,    32,    34,    33,
+    35,    35,    37,    36,    38,    38,    38,    38,    38,    38,
+    38 };
+yytabelem yyr2[]={
+
+     0,     1,     1,     1,    19,     0,     4,     4,     6,     2,
+     6,     7,     7,     3,     2,     0,     4,     4,     6,     2,
+     2,     4,     3,     3,     3,     3,     3,     3,     2,     6,
+     1,     7,     2,     0,     6,     2,     6,     3,     1,     9,
+     6,     5,     3,     3,     2,     6,     3,     3,     3,     3,
+     3,     3,     3,     3,     0,     4,     4,     6,     1,     9,
+     2,     6,     1,     5,     3,     3,     3,     3,     3,     3,
+     3 };
+yytabelem yychk[]={
+
+-10000000,    -1,   274,   123,    -2,    -3,   272,    -4,    -8,    -9,
+   -10,   -11,   -12,   264,    -5,   273,    -9,    59,    44,    61,
+    -6,   -13,   -14,   -15,   -16,   -17,   -25,   258,   259,   260,
+   261,   262,   263,   -28,    58,   -20,   264,    59,   -10,   269,
+   257,    -7,   275,   -14,    59,   -18,   -19,   -20,   -26,    58,
+   -29,   264,   125,   -32,   -33,   -28,    59,    44,   -21,    61,
+   -29,   -33,    59,   -34,   -19,   -22,    40,   -27,   -30,   -31,
+   267,   265,   266,   268,   269,   270,   271,    59,    61,   -23,
+   -24,   -12,    44,   -35,   -36,   -37,    41,    44,   -30,    44,
+   -38,   267,   265,   266,   268,   269,   270,   271,   -24,   -36 };
+yytabelem yydef[]={
+
+     0,    -2,     0,     1,     5,     2,     0,    15,     6,     0,
+     9,     0,    13,    14,     3,     0,     0,     7,     0,     0,
+    54,    16,     0,    19,    20,     0,    38,    22,    23,    24,
+    25,    26,    27,     0,     0,    42,    32,     8,    10,    11,
+    12,     0,     0,     0,    17,    21,    28,    30,     0,     0,
+    41,    43,     4,    55,     0,    58,    18,     0,    33,     0,
+    40,     0,    56,     0,    29,    31,     0,    39,    44,    46,
+    47,    48,    49,    50,    51,    52,    53,    57,    62,     0,
+    35,    37,     0,    59,    60,     0,    34,     0,    45,    62,
+    63,    64,    65,    66,    67,    68,    69,    70,    36,    61 };
+typedef struct
+#ifdef __cplusplus
+	yytoktype
+#endif
+{ char *t_name; int t_val; } yytoktype;
+#ifndef YYDEBUG
+#	define YYDEBUG	0	/* don't allow debugging */
+#endif
+
+#if YYDEBUG
+
+yytoktype yytoks[] =
+{
+	"NC_UNLIMITED_K",	257,
+	"BYTE_K",	258,
+	"CHAR_K",	259,
+	"SHORT_K",	260,
+	"LONG_K",	261,
+	"FLOAT_K",	262,
+	"DOUBLE_K",	263,
+	"IDENT",	264,
+	"TERMSTRING",	265,
+	"BYTE_CONST",	266,
+	"CHAR_CONST",	267,
+	"SHORT_CONST",	268,
+	"LONG_CONST",	269,
+	"FLOAT_CONST",	270,
+	"DOUBLE_CONST",	271,
+	"DIMENSIONS",	272,
+	"VARIABLES",	273,
+	"NETCDF",	274,
+	"DATA",	275,
+	"-unknown-",	-1	/* ends search */
+};
+
+char * yyreds[] =
+{
+	"-no such reduction-",
+	"ncdesc : NETCDF '{'",
+	"ncdesc : NETCDF '{' dimsection",
+	"ncdesc : NETCDF '{' dimsection vasection",
+	"ncdesc : NETCDF '{' dimsection vasection datasection '}'",
+	"dimsection : /* empty */",
+	"dimsection : DIMENSIONS dimdecls",
+	"dimdecls : dimdecline ';'",
+	"dimdecls : dimdecls dimdecline ';'",
+	"dimdecline : dimdecl",
+	"dimdecline : dimdecline ',' dimdecl",
+	"dimdecl : dimd '=' LONG_CONST",
+	"dimdecl : dimd '=' NC_UNLIMITED_K",
+	"dimd : dim",
+	"dim : IDENT",
+	"vasection : /* empty */",
+	"vasection : VARIABLES vadecls",
+	"vadecls : vadecl ';'",
+	"vadecls : vadecls vadecl ';'",
+	"vadecl : vardecl",
+	"vadecl : attdecl",
+	"vardecl : type varlist",
+	"type : BYTE_K",
+	"type : CHAR_K",
+	"type : SHORT_K",
+	"type : LONG_K",
+	"type : FLOAT_K",
+	"type : DOUBLE_K",
+	"varlist : varspec",
+	"varlist : varlist ',' varspec",
+	"varspec : var",
+	"varspec : var dimspec",
+	"var : IDENT",
+	"dimspec : /* empty */",
+	"dimspec : '(' dimlist ')'",
+	"dimlist : vdim",
+	"dimlist : dimlist ',' vdim",
+	"vdim : dim",
+	"attdecl : att",
+	"attdecl : att '=' attvallist",
+	"att : avar ':' attr",
+	"att : ':' attr",
+	"avar : var",
+	"attr : IDENT",
+	"attvallist : aconst",
+	"attvallist : attvallist ',' aconst",
+	"aconst : attconst",
+	"attconst : CHAR_CONST",
+	"attconst : TERMSTRING",
+	"attconst : BYTE_CONST",
+	"attconst : SHORT_CONST",
+	"attconst : LONG_CONST",
+	"attconst : FLOAT_CONST",
+	"attconst : DOUBLE_CONST",
+	"datasection : /* empty */",
+	"datasection : DATA datadecls",
+	"datadecls : datadecl ';'",
+	"datadecls : datadecls datadecl ';'",
+	"datadecl : avar",
+	"datadecl : avar '=' constlist",
+	"constlist : dconst",
+	"constlist : constlist ',' dconst",
+	"dconst : /* empty */",
+	"dconst : const",
+	"const : CHAR_CONST",
+	"const : TERMSTRING",
+	"const : BYTE_CONST",
+	"const : SHORT_CONST",
+	"const : LONG_CONST",
+	"const : FLOAT_CONST",
+	"const : DOUBLE_CONST",
+};
+#endif /* YYDEBUG */
+#if !defined(lint) && !defined(__cplusplus)
+static  char __yaccpar_sccsid1[] = "@(#) 9/3/92 yaccpar 6.11 Copyr 1991 Sun Micro";
+#endif
+
+/*
+** Skeleton parser driver for yacc output
+*/
+
+/*
+** yacc user known macros and defines
+*/
+#define YYERROR		goto yyerrlab
+#define YYACCEPT	return(0)
+#define YYABORT		return(1)
+#define YYBACKUP( newtoken, newvalue )\
+{\
+	if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
+	{\
+		yyerror( "syntax error - cannot backup" );\
+		goto yyerrlab;\
+	}\
+	yychar = newtoken;\
+	yystate = *yyps;\
+	yylval = newvalue;\
+	goto yynewstate;\
+}
+#define YYRECOVERING()	(!!yyerrflag)
+#define YYNEW(type)	malloc(sizeof(type) * yynewmax)
+#define YYCOPY(to, from, type) \
+	(type *) memcpy(to, (char *) from, yynewmax * sizeof(type))
+#define YYENLARGE( from, type) \
+	(type *) realloc((char *) from, yynewmax * sizeof(type))
+#ifndef YYDEBUG
+#	define YYDEBUG	1	/* make debugging available */
+#endif
+
+/*
+** user known globals
+*/
+int yydebug;			/* set to 1 to get debugging */
+
+/*
+** driver internal defines
+*/
+#define YYFLAG		(-10000000)
+
+/*
+** global variables used by the parser
+*/
+YYSTYPE *yypv;			/* top of value stack */
+int *yyps;			/* top of state stack */
+
+int yystate;			/* current state */
+int yytmp;			/* extra var (lasts between blocks) */
+
+int yynerrs;			/* number of errors */
+int yyerrflag;			/* error recovery flag */
+int yychar;			/* current input token number */
+
+
+
+#ifdef YYNMBCHARS
+#define YYLEX()		yycvtok(yylex())
+/*
+** yycvtok - return a token if i is a wchar_t value that exceeds 255.
+**	If i<255, i itself is the token.  If i>255 but the neither 
+**	of the 30th or 31st bit is on, i is already a token.
+*/
+#if defined(__STDC__) || defined(__cplusplus)
+int yycvtok(int i)
+#else
+int yycvtok(i) int i;
+#endif
+{
+	int first = 0;
+	int last = YYNMBCHARS - 1;
+	int mid;
+	wchar_t j;
+
+	if(i&0x60000000){/*Must convert to a token. */
+		if( yymbchars[last].character < i ){
+			return i;/*Giving up*/
+		}
+		while ((last>=first)&&(first>=0)) {/*Binary search loop*/
+			mid = (first+last)/2;
+			j = yymbchars[mid].character;
+			if( j==i ){/*Found*/ 
+				return yymbchars[mid].tvalue;
+			}else if( j<i ){
+				first = mid + 1;
+			}else{
+				last = mid -1;
+			}
+		}
+		/*No entry in the table.*/
+		return i;/* Giving up.*/
+	}else{/* i is already a token. */
+		return i;
+	}
+}
+#else/*!YYNMBCHARS*/
+#define YYLEX()		yylex()
+#endif/*!YYNMBCHARS*/
+
+/*
+** yyparse - return 0 if worked, 1 if syntax error not recovered from
+*/
+#if defined(__STDC__) || defined(__cplusplus)
+int yyparse(void)
+#else
+int yyparse()
+#endif
+{
+	register YYSTYPE *yypvt;	/* top of value stack for $vars */
+
+#if defined(__cplusplus) || defined(lint)
+/*
+	hacks to please C++ and lint - goto's inside switch should never be
+	executed; yypvt is set to 0 to avoid "used before set" warning.
+*/
+	static int __yaccpar_lint_hack__ = 0;
+	switch (__yaccpar_lint_hack__)
+	{
+		case 1: goto yyerrlab;
+		case 2: goto yynewstate;
+	}
+	yypvt = 0;
+#endif
+
+	/*
+	** Initialize externals - yyparse may be called more than once
+	*/
+	yypv = &yyv[-1];
+	yyps = &yys[-1];
+	yystate = 0;
+	yytmp = 0;
+	yynerrs = 0;
+	yyerrflag = 0;
+	yychar = -1;
+
+#if YYMAXDEPTH <= 0
+	if (yymaxdepth <= 0)
+	{
+		if ((yymaxdepth = YYEXPAND(0)) <= 0)
+		{
+			yyerror("yacc initialization error");
+			YYABORT;
+		}
+	}
+#endif
+
+	{
+		register YYSTYPE *yy_pv;	/* top of value stack */
+		register int *yy_ps;		/* top of state stack */
+		register int yy_state;		/* current state */
+		register int  yy_n;		/* internal state number info */
+	goto yystack;	/* moved from 6 lines above to here to please C++ */
+
+		/*
+		** get globals into registers.
+		** branch to here only if YYBACKUP was called.
+		*/
+	yynewstate:
+		yy_pv = yypv;
+		yy_ps = yyps;
+		yy_state = yystate;
+		goto yy_newstate;
+
+		/*
+		** get globals into registers.
+		** either we just started, or we just finished a reduction
+		*/
+	yystack:
+		yy_pv = yypv;
+		yy_ps = yyps;
+		yy_state = yystate;
+
+		/*
+		** top of for (;;) loop while no reductions done
+		*/
+	yy_stack:
+		/*
+		** put a state and value onto the stacks
+		*/
+#if YYDEBUG
+		/*
+		** if debugging, look up token value in list of value vs.
+		** name pairs.  0 and negative (-1) are special values.
+		** Note: linear search is used since time is not a real
+		** consideration while debugging.
+		*/
+		if ( yydebug )
+		{
+			register int yy_i;
+
+			printf( "State %d, token ", yy_state );
+			if ( yychar == 0 )
+				printf( "end-of-file\n" );
+			else if ( yychar < 0 )
+				printf( "-none-\n" );
+			else
+			{
+				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
+					yy_i++ )
+				{
+					if ( yytoks[yy_i].t_val == yychar )
+						break;
+				}
+				printf( "%s\n", yytoks[yy_i].t_name );
+			}
+		}
+#endif /* YYDEBUG */
+		if ( ++yy_ps >= &yys[ yymaxdepth ] )	/* room on stack? */
+		{
+			/*
+			** reallocate and recover.  Note that pointers
+			** have to be reset, or bad things will happen
+			*/
+			int yyps_index = (yy_ps - yys);
+			int yypv_index = (yy_pv - yyv);
+			int yypvt_index = (yypvt - yyv);
+			int yynewmax;
+#ifdef YYEXPAND
+			yynewmax = YYEXPAND(yymaxdepth);
+#else
+			yynewmax = 2 * yymaxdepth;	/* double table size */
+			if (yymaxdepth == YYMAXDEPTH)	/* first time growth */
+			{
+				char *newyys = (char *)YYNEW(int);
+				char *newyyv = (char *)YYNEW(YYSTYPE);
+				if (newyys != 0 && newyyv != 0)
+				{
+					yys = YYCOPY(newyys, yys, int);
+					yyv = YYCOPY(newyyv, yyv, YYSTYPE);
+				}
+				else
+					yynewmax = 0;	/* failed */
+			}
+			else				/* not first time */
+			{
+				yys = YYENLARGE(yys, int);
+				yyv = YYENLARGE(yyv, YYSTYPE);
+				if (yys == 0 || yyv == 0)
+					yynewmax = 0;	/* failed */
+			}
+#endif
+			if (yynewmax <= yymaxdepth)	/* tables not expanded */
+			{
+				yyerror( "yacc stack overflow" );
+				YYABORT;
+			}
+			yymaxdepth = yynewmax;
+
+			yy_ps = yys + yyps_index;
+			yy_pv = yyv + yypv_index;
+			yypvt = yyv + yypvt_index;
+		}
+		*yy_ps = yy_state;
+		*++yy_pv = yyval;
+
+		/*
+		** we have a new state - find out what to do
+		*/
+	yy_newstate:
+		if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
+			goto yydefault;		/* simple state */
+#if YYDEBUG
+		/*
+		** if debugging, need to mark whether new token grabbed
+		*/
+		yytmp = yychar < 0;
+#endif
+		if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
+			yychar = 0;		/* reached EOF */
+#if YYDEBUG
+		if ( yydebug && yytmp )
+		{
+			register int yy_i;
+
+			printf( "Received token " );
+			if ( yychar == 0 )
+				printf( "end-of-file\n" );
+			else if ( yychar < 0 )
+				printf( "-none-\n" );
+			else
+			{
+				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
+					yy_i++ )
+				{
+					if ( yytoks[yy_i].t_val == yychar )
+						break;
+				}
+				printf( "%s\n", yytoks[yy_i].t_name );
+			}
+		}
+#endif /* YYDEBUG */
+		if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
+			goto yydefault;
+		if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )	/*valid shift*/
+		{
+			yychar = -1;
+			yyval = yylval;
+			yy_state = yy_n;
+			if ( yyerrflag > 0 )
+				yyerrflag--;
+			goto yy_stack;
+		}
+
+	yydefault:
+		if ( ( yy_n = yydef[ yy_state ] ) == -2 )
+		{
+#if YYDEBUG
+			yytmp = yychar < 0;
+#endif
+			if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
+				yychar = 0;		/* reached EOF */
+#if YYDEBUG
+			if ( yydebug && yytmp )
+			{
+				register int yy_i;
+
+				printf( "Received token " );
+				if ( yychar == 0 )
+					printf( "end-of-file\n" );
+				else if ( yychar < 0 )
+					printf( "-none-\n" );
+				else
+				{
+					for ( yy_i = 0;
+						yytoks[yy_i].t_val >= 0;
+						yy_i++ )
+					{
+						if ( yytoks[yy_i].t_val
+							== yychar )
+						{
+							break;
+						}
+					}
+					printf( "%s\n", yytoks[yy_i].t_name );
+				}
+			}
+#endif /* YYDEBUG */
+			/*
+			** look through exception table
+			*/
+			{
+				register int *yyxi = yyexca;
+
+				while ( ( *yyxi != -1 ) ||
+					( yyxi[1] != yy_state ) )
+				{
+					yyxi += 2;
+				}
+				while ( ( *(yyxi += 2) >= 0 ) &&
+					( *yyxi != yychar ) )
+					;
+				if ( ( yy_n = yyxi[1] ) < 0 )
+					YYACCEPT;
+			}
+		}
+
+		/*
+		** check for syntax error
+		*/
+		if ( yy_n == 0 )	/* have an error */
+		{
+			/* no worry about speed here! */
+			switch ( yyerrflag )
+			{
+			case 0:		/* new error */
+				yyerror( "syntax error" );
+				goto skip_init;
+			yyerrlab:
+				/*
+				** get globals into registers.
+				** we have a user generated syntax type error
+				*/
+				yy_pv = yypv;
+				yy_ps = yyps;
+				yy_state = yystate;
+			skip_init:
+				yynerrs++;
+				/* FALLTHRU */
+			case 1:
+			case 2:		/* incompletely recovered error */
+					/* try again... */
+				yyerrflag = 3;
+				/*
+				** find state where "error" is a legal
+				** shift action
+				*/
+				while ( yy_ps >= yys )
+				{
+					yy_n = yypact[ *yy_ps ] + YYERRCODE;
+					if ( yy_n >= 0 && yy_n < YYLAST &&
+						yychk[yyact[yy_n]] == YYERRCODE)					{
+						/*
+						** simulate shift of "error"
+						*/
+						yy_state = yyact[ yy_n ];
+						goto yy_stack;
+					}
+					/*
+					** current state has no shift on
+					** "error", pop stack
+					*/
+#if YYDEBUG
+#	define _POP_ "Error recovery pops state %d, uncovers state %d\n"
+					if ( yydebug )
+						printf( _POP_, *yy_ps,
+							yy_ps[-1] );
+#	undef _POP_
+#endif
+					yy_ps--;
+					yy_pv--;
+				}
+				/*
+				** there is no state on stack with "error" as
+				** a valid shift.  give up.
+				*/
+				YYABORT;
+			case 3:		/* no shift yet; eat a token */
+#if YYDEBUG
+				/*
+				** if debugging, look up token in list of
+				** pairs.  0 and negative shouldn't occur,
+				** but since timing doesn't matter when
+				** debugging, it doesn't hurt to leave the
+				** tests here.
+				*/
+				if ( yydebug )
+				{
+					register int yy_i;
+
+					printf( "Error recovery discards " );
+					if ( yychar == 0 )
+						printf( "token end-of-file\n" );
+					else if ( yychar < 0 )
+						printf( "token -none-\n" );
+					else
+					{
+						for ( yy_i = 0;
+							yytoks[yy_i].t_val >= 0;
+							yy_i++ )
+						{
+							if ( yytoks[yy_i].t_val
+								== yychar )
+							{
+								break;
+							}
+						}
+						printf( "token %s\n",
+							yytoks[yy_i].t_name );
+					}
+				}
+#endif /* YYDEBUG */
+				if ( yychar == 0 )	/* reached EOF. quit */
+					YYABORT;
+				yychar = -1;
+				goto yy_newstate;
+			}
+		}/* end if ( yy_n == 0 ) */
+		/*
+		** reduction by production yy_n
+		** put stack tops, etc. so things right after switch
+		*/
+#if YYDEBUG
+		/*
+		** if debugging, print the string that is the user's
+		** specification of the reduction which is just about
+		** to be done.
+		*/
+		if ( yydebug )
+			printf( "Reduce by (%d) \"%s\"\n",
+				yy_n, yyreds[ yy_n ] );
+#endif
+		yytmp = yy_n;			/* value to switch over */
+		yypvt = yy_pv;			/* $vars top of value stack */
+		/*
+		** Look in goto table for next state
+		** Sorry about using yy_state here as temporary
+		** register variable, but why not, if it works...
+		** If yyr2[ yy_n ] doesn't have the low order bit
+		** set, then there is no action to be done for
+		** this reduction.  So, no saving & unsaving of
+		** registers done.  The only difference between the
+		** code just after the if and the body of the if is
+		** the goto yy_stack in the body.  This way the test
+		** can be made before the choice of what to do is needed.
+		*/
+		{
+			/* length of production doubled with extra bit */
+			register int yy_len = yyr2[ yy_n ];
+
+			if ( !( yy_len & 01 ) )
+			{
+				yy_len >>= 1;
+				yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
+				yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
+					*( yy_ps -= yy_len ) + 1;
+				if ( yy_state >= YYLAST ||
+					yychk[ yy_state =
+					yyact[ yy_state ] ] != -yy_n )
+				{
+					yy_state = yyact[ yypgo[ yy_n ] ];
+				}
+				goto yy_stack;
+			}
+			yy_len >>= 1;
+			yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
+			yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
+				*( yy_ps -= yy_len ) + 1;
+			if ( yy_state >= YYLAST ||
+				yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
+			{
+				yy_state = yyact[ yypgo[ yy_n ] ];
+			}
+		}
+					/* save until reenter driver code */
+		yystate = yy_state;
+		yyps = yy_ps;
+		yypv = yy_pv;
+	}
+	/*
+	** code supplied by user is placed in this switch
+	*/
+	switch( yytmp )
+	{
+		
+case 1:
+# line 103 "ncgen.y"
+{ init_netcdf(); } break;
+case 2:
+# line 105 "ncgen.y"
+{
+		       if (ndims > MAX_NC_DIMS)
+			 derror("Too many dimensions");
+		   } break;
+case 3:
+# line 110 "ncgen.y"
+{
+		       if (derror_count == 0)
+			 define_netcdf(netcdfname);
+		   } break;
+case 4:
+# line 116 "ncgen.y"
+{
+		       if (derror_count == 0)
+			 close_netcdf();
+		   } break;
+case 11:
+# line 131 "ncgen.y"
+{ if (long_val <= 0)
+			 derror("negative dimension size");
+		     dims[ndims].size = long_val;
+		     ndims++;
+		   } break;
+case 12:
+# line 137 "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 13:
+# line 145 "ncgen.y"
+{ if (yypvt[-0]->is_dim == 1) {
+		        derror( "duplicate dimension declaration for %s",
+		                yypvt[-0]->name);
+		     }
+	             yypvt[-0]->is_dim = 1;
+		     yypvt[-0]->dnum = ndims;
+		     dims[ndims].name = (char *) emalloc(strlen(yypvt[-0]->name)+1);
+		     (void) strcpy(dims[ndims].name, yypvt[-0]->name);
+		   } break;
+case 22:
+# line 167 "ncgen.y"
+{ type_code = NC_BYTE; } break;
+case 23:
+# line 168 "ncgen.y"
+{ type_code = NC_CHAR; } break;
+case 24:
+# line 169 "ncgen.y"
+{ type_code = NC_SHORT; } break;
+case 25:
+# line 170 "ncgen.y"
+{ type_code = NC_LONG; } break;
+case 26:
+# line 171 "ncgen.y"
+{ type_code = NC_FLOAT; } break;
+case 27:
+# line 172 "ncgen.y"
+{ type_code = NC_DOUBLE; } break;
+case 30:
+# line 178 "ncgen.y"
+{
+		    if (nvars >= MAX_NC_VARS)
+		       derror("too many variables");
+		    nvdims = 0;
+		    /* make sure variable not re-declared */
+		    if (yypvt[-0]->is_var == 1) {
+		       derror( "duplicate variable declaration for %s",
+		               yypvt[-0]->name);
+		    }
+	            yypvt[-0]->is_var = 1;
+		    yypvt[-0]->vnum = nvars;
+		    vars[nvars].name = (char *) emalloc(strlen(yypvt[-0]->name)+1);
+		    (void) strcpy(vars[nvars].name, yypvt[-0]->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 31:
+# line 198 "ncgen.y"
+{
+		    vars[nvars].ndims = nvdims;
+		    nvars++;
+		   } break;
+case 37:
+# line 212 "ncgen.y"
+{
+		    if (nvdims >= MAX_VAR_DIMS) {
+		       derror("%s has too many dimensions",vars[nvars].name);
+		    }
+		    if (yypvt[-0]->is_dim == 1)
+		       dimnum = yypvt[-0]->dnum;
+		    else {
+		       derror( "%s is not declared as a dimension",
+			       yypvt[-0]->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 38:
+# line 231 "ncgen.y"
+{
+		       valnum = 0;
+		       valtype = NC_UNSPECIFIED;
+		       /* get a large block for attributes, realloc later */
+		       att_space = emalloc(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 = (long *) att_space;
+		       float_valp = (float *) att_space;
+		       double_valp = (double *) att_space;
+		   } break;
+case 39:
+# line 245 "ncgen.y"
+{
+		       if (natts >= MAX_NC_ATTS)
+			 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 41:
+# line 264 "ncgen.y"
+{
+		    varnum = -1;  /* handle of "global" attribute */
+		   } break;
+case 42:
+# line 270 "ncgen.y"
+{ if (yypvt[-0]->is_var == 1)
+		       varnum = yypvt[-0]->vnum;
+		    else {
+		      derror("%s not declared as a variable, fatal error",
+			     yypvt[-0]->name);
+		      YYABORT;
+		      }
+		   } break;
+case 43:
+# line 280 "ncgen.y"
+{
+		       atts[natts].name = (char *) emalloc(strlen(yypvt[-0]->name)+1);
+		       (void) strcpy(atts[natts].name,yypvt[-0]->name);
+		   } break;
+case 46:
+# line 289 "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 47:
+# line 298 "ncgen.y"
+{
+		       atype_code = NC_CHAR;
+		       *char_valp++ = char_val;
+		       valnum++;
+		   } break;
+case 48:
+# line 304 "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 49:
+# line 315 "ncgen.y"
+{
+		       atype_code = NC_BYTE;
+		       *byte_valp++ = byte_val;
+		       valnum++;
+		   } break;
+case 50:
+# line 321 "ncgen.y"
+{
+		       atype_code = NC_SHORT;
+		       *short_valp++ = short_val;
+		       valnum++;
+		   } break;
+case 51:
+# line 327 "ncgen.y"
+{
+		       atype_code = NC_LONG;
+		       *long_valp++ = long_val;
+		       valnum++;
+		   } break;
+case 52:
+# line 333 "ncgen.y"
+{
+		       atype_code = NC_FLOAT;
+		       *float_valp++ = float_val;
+		       valnum++;
+		   } break;
+case 53:
+# line 339 "ncgen.y"
+{
+		       atype_code = NC_DOUBLE;
+		       *double_valp++ = double_val;
+		       valnum++;
+		   } break;
+case 58:
+# line 354 "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 = (long *) rec_start;
+			   break;
+			 case NC_FLOAT:
+			   float_valp = (float *) rec_start;
+			   break;
+			 case NC_DOUBLE:
+			   double_valp = (double *) rec_start;
+			   break;
+		       }
+		 } break;
+case 59:
+# line 403 "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 62:
+# line 420 "ncgen.y"
+{
+		       if(valnum >= var_len) {
+			   derror("too many values for this variable");
+			   exit (4);
+		       }
+		       not_a_string = 1;
+                   } break;
+case 63:
+# line 428 "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 = (long *) rec_start;
+				   break;
+				 case NC_FLOAT:
+				   float_valp = (float *) rec_start;
+				   break;
+				 case NC_DOUBLE:
+				   double_valp = (double *) rec_start;
+				   break;
+			       }
+			   }
+		       }
+		 } break;
+case 64:
+# line 487 "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 65:
+# line 512 "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 66:
+# line 545 "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 67:
+# line 570 "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 68:
+# line 595 "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 69:
+# line 620 "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 70:
+# line 645 "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;
+	}
+	goto yystack;		/* reset registers in driver code */
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.1
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,171 @@
+.\" $Id: ncdump.1,v 1.2 1996/03/26 22:34:09 georgev Exp $
+.TH NCDUMP 1 "$Date: 1996/03/26 22:34:09 $" "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.

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,722 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/README file for copying and redistribution conditions.
+ *   $Id: ncdump.c,v 1.15 2000/06/16 19:01:12 koziol Exp $
+ *********************************************************************/
+
+#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;
+
+static void
+usage()
+{
+#define USAGE   "\
+  [-c]             Coordinate variable data and header information\n\
+  [-h]             Header information only, no data\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 [-c|-h] [-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 vms
+#define FILE_DELIMITER ']'
+#endif    
+#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.
+ */
+char *fixstr(char *str)
+{
+    char *strdup(const char *);
+	char *new_str, *ptr;
+
+	if (!str)
+		return NULL;
+
+	ptr = new_str = strdup(str);
+
+	if (!ptr) {
+		error("Out of memory!");
+		return NULL;
+	}
+
+	for (; *ptr; ptr++)
+		if (!isalnum(*ptr) && *ptr != '_' && *ptr != '-')
+			*ptr = '_';
+
+	return new_str;
+}
+
+static void
+do_ncdump(path, 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 ncdim dims[MAX_NC_DIMS]; /* dimensions */
+	long vdims[MAX_NC_DIMS];	/* dimension sizes for a single variable */
+	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);
+
+			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);
+
+		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);
+
+			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);
+
+			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);
+
+		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?  */
+	  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];
+
+    while ((c = getopt(argc, argv, "b:cf:hl:n:v:d:")) != EOF)
+      switch(c) {
+	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 '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;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,85 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: ncdump.h,v 1.4 1996/03/26 22:34:10 georgev Exp $
+ *********************************************************************/
+
+#define  Printf  (void) printf
+
+typedef enum {false=0, true=1} bool;
+
+struct ncdim {			/* dimension */
+    char name[MAX_NC_NAME];
+    long size;
+};
+
+struct ncvar {			/* variable */
+    char name[MAX_NC_NAME];
+    nc_type type;
+    int ndims;
+    int dims[MAX_VAR_DIMS];
+    int natts;
+};
+
+struct ncatt {			/* attribute */
+    int var;
+    char name[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.
+				 */
+    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 */
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.lnk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.lnk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.lnk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+llibc7.lib oldnames.lib ncdump.lib \hdf\hdf\lib\df.lib ..\libsrc\netcdf.lib ..\xdr\xdr.lib

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/ncdump.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,191 @@
+# 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 "ncdump.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 : .\ncdump.exe .\ncdump.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" /I "..\ncgen" /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" /I "..\ncgen" /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)/"ncdump.bsc" 
+
+.\ncdump.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	.\vardata.obj \
+	.\dumplib.obj \
+	.\ncdump.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 ..\util\win32utl.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 ..\util\win32utl.lib\
+ ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"ncdump.pdb" /MACHINE:I386\
+ /STACK:2048000 /OUT:$(OUTDIR)/"ncdump.exe" 
+
+.\ncdump.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 : .\ncdump.exe .\ncdump.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" /I "..\ncgen" /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" /I "..\ncgen" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "HDF"\
+ /D "NO_SYS_XDR_INC" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"ncdump.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)/"ncdump.bsc" 
+
+.\ncdump.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	.\vardata.obj \
+	.\dumplib.obj \
+	.\ncdump.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 ..\util\win32utl.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 ..\util\win32utl.lib\
+ ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"ncdump.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"ncdump.exe" 
+
+.\ncdump.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=.\vardata.c
+
+.\vardata.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vardata.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dumplib.c
+
+.\dumplib.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\ncdump.c
+
+.\ncdump.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dumplib.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\ncdump.h
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/test0.cdl
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/test0.cdl	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/test0.cdl	2007-05-14 09:41:34 UTC (rev 808)
@@ -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;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/vardata.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/vardata.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/vardata.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,590 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vardata.c,v 1.9 2000/05/08 20:40:18 wendling Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netcdf.h>
+#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);
+
+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[MAX_VAR_DIMS];	/* corner coordinates */
+    long edg[MAX_VAR_DIMS];	/* edges of hypercube */
+    long add[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);
+
+    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;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncdump/vardata.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncdump/vardata.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncdump/vardata.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,31 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vardata.h,v 1.2 1996/03/26 22:34:11 georgev Exp $
+ *********************************************************************/
+
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,808 @@
+# Makefile for ncgen(1).
+#
+# $Id: Makefile.in,v 1.22 2000/08/30 18:43:30 wendling Exp $
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+ZLIB_LIB = $(TOP_SRCDIR)/hdf/zlib/libz.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+PROGRAM		= ncgen
+BINFILES	= $(PROGRAM)
+#CPP_NETCDF	= -I../libsrc
+#CPPFLAGS	= $(CPPFLAGS_NCG)
+#CFLAGS		= $(CFLAGS_NCG)
+#FFLAGS		= @FFLAGS@
+MANUALS		= ncgen.1
+GARBAGE		= $(PROGRAM) \
+		  ncgenyy.c ncgentab.c ncgentab.h \
+		  test0.nc test1.nc test1.cdl test2.cdl test0.f ctest0 \
+		  ftest0 ftest0.nc ftest1.cdl test0.c ctest0.nc ctest1.cdl
+vms_stuff	= vmstab.c vmstab.h vms_yy.c
+MANIFEST = $(DISTFILES)
+DISTFILES	= Makefile.in depend README \
+		  close.c descrip.mms escapes.c generate.c generic.h \
+		  genlib.c genlib.h getfill.c init.c lexyacc.com load.c \
+		  main.c make.com msoft.mk msofttab.c msofttab.h \
+		  msoftyy.c ncgen.1 ncgen.h ncgen.l ncgen.opt ncgen.y \
+		  test.com test0.cdl \
+		  $(vms_stuff)
+LIBNAME		= mfhdf
+LD_NETCDF	= ../libsrc/libmfhdf.a $(HDF_LIB) $(JPEG_LIB) $(ZLIB_LIB)
+OBJS		= main.o generate.o load.o ncgentab.o escapes.o \
+		  getfill.o init.o close.o genlib.o
+#LD_XDR		= @LD_XDR@
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(LIBSX)
+#LEX		= @LEX@
+#YACC		= @YACC@
+prefix		= ../../..
+
+all::		$(PROGRAM)
+
+test:           $(PROGRAM) test0.cdl btest ctest ftest FORCE
+
+install::	installed_program installed_manuals
+install-utils::	installed_program
+install-man::	installed_manuals
+
+$(PROGRAM):	main.o
+
+ncgentab.c \
+ncgentab.h:	ncgen.y ncgenyy.c ncgen.h
+	$(YACC) -d ncgen.y
+	mv y.tab.c ncgentab.c
+	mv y.tab.h ncgentab.h
+
+ncgenyy.c:	ncgen.l
+	$(LEX) ncgen.l
+	mv lex.yy.c ncgenyy.c
+
+# The SunOS 4.1.3 yacc(1) doesn't generate correct code.
+#
+vms-stuff:	ncgentab.h ncgentab.c ncgenyy.c
+	cp ncgentab.h vmstab.h
+	cp ncgentab.c vmstab.c
+	cp ncgenyy.c vms_yy.c
+
+#
+# test "-b" option of ncgen
+#
+btest:		$(PROGRAM) test0.cdl test1.cdl
+	./$(PROGRAM) -b test1.cdl
+	$(NCDUMP) test1.nc > test2.cdl
+	@$(DIFF) $(DIFF_FLAGS) test1.cdl test2.cdl && \
+	    echo "*** $(PROGRAM) -b test successful ***"
+
+#
+# test "-c" option of ncgen
+#
+ctest:		test1.cdl ctest0
+	./ctest0		# tests `-c' option, creates ctest0.nc
+	$(NCDUMP) -n test1 ctest0.nc > ctest1.cdl
+	@$(DIFF) $(DIFF_FLAGS) test1.cdl ctest1.cdl && \
+	    echo "*** $(PROGRAM) -c test successful ***"
+
+ctest0:		ncgen test0.cdl
+	./$(PROGRAM) -c -o ctest0.nc test0.cdl > test0.c
+	$(CC) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) -o $@ test0.c $(LIBS)
+
+#
+# test "-f" option of ncgen
+#
+ftest:		test1.cdl
+	@case "$(FC)" in \
+	NONE*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) $(MFLAGS) ftest0; \
+	    ./ftest0 ; \
+	    $(NCDUMP) -n test1 ftest0.nc > ftest1.cdl; \
+	    if $(DIFF) $(DIFF_FLAGS) test1.cdl ftest1.cdl; then \
+		echo "*** ncgen -f test successful ***"; \
+	    else \
+		echo "*** ncgen -f test failed " \
+		    "(but roundoff differences are OK) ***"; \
+	    fi;; \
+	esac
+
+ftest0:		$(PROGRAM) test0.cdl
+	@case "$(FC)" in \
+	NONE*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) $(MFLAGS) netcdf.inc; \
+	    ./$(PROGRAM) -f -o ftest0.nc test0.cdl > test0.f; \
+	    $(FC) $(FFLAGS) -o $@ test0.f $(LIBS);; \
+	esac
+
+test1.cdl:	test0.nc
+	$(NCDUMP) -n test1 test0.nc > $@
+
+test0.nc:	$(PROGRAM) test0.cdl
+	./$(PROGRAM) -b -o test0.nc test0.cdl
+
+netcdf.inc:
+	@case "$(FC)" in \
+	NONE*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    ln -s ../fortran/$@ .;; \
+	esac
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF) '; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+	chmod u=rw,og=r $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/ncgen
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+
+# Override the default definition for ncdump(1) in the master makefile.
+#
+NCDUMP		= ../ncdump/ncdump
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,132 @@
+# Makefile for ncgen(1).
+#
+# $Id: Makefile.in_orig,v 1.2 2000/08/30 18:46:40 wendling Exp $
+
+PROGRAM		= ncgen
+BINFILES	= $(PROGRAM)
+CPP_NETCDF	= -I../libsrc
+CPPFLAGS	= $(CPP_NETCDF) @CPPFLAGS@
+CFLAGS		= @CFLAGS@ @HDF_INC@
+FFLAGS		= @FFLAGS@
+MANUALS		= ncgen.1
+GARBAGE		= $(PROGRAM) \
+		  ncgenyy.c ncgentab.c ncgentab.h \
+		  test0.nc test1.nc test1.cdl test2.cdl test0.f ctest0 \
+		  ftest0 ftest0.nc ftest1.cdl test0.c ctest0.nc ctest1.cdl
+vms_stuff	= vmstab.c vmstab.h vms_yy.c
+MANIFEST	= Makefile.in depend README \
+		  close.c descrip.mms escapes.c generate.c generic.h \
+		  genlib.c genlib.h getfill.c init.c lexyacc.com load.c \
+		  main.c make.com msoft.mk msofttab.c msofttab.h \
+		  msoftyy.c ncgen.1 ncgen.h ncgen.l ncgen.opt ncgen.y \
+		  test.com test0.cdl \
+		  $(vms_stuff)
+LIBNAME		= netcdf
+LD_NETCDF	= ../libsrc/libnetcdf.a @HDF_LIB@ @JPEG_LIB@
+OBJS		= main.o generate.o load.o ncgentab.o escapes.o \
+		  getfill.o init.o close.o genlib.o
+LD_XDR		= @LD_XDR@
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(LIBSX)
+LEX		= @LEX@
+YACC		= @YACC@
+prefix		= ../../..
+
+all::		$(PROGRAM)
+
+test:           $(PROGRAM) test0.cdl btest ctest ftest FORCE
+
+install::	installed_program installed_manuals
+
+$(PROGRAM):	main.o
+
+ncgentab.c \
+ncgentab.h:	ncgen.y ncgenyy.c ncgen.h
+	$(YACC) -d ncgen.y
+	mv y.tab.c ncgentab.c
+	mv y.tab.h ncgentab.h
+
+ncgenyy.c:	ncgen.l
+	$(LEX) ncgen.l
+	mv lex.yy.c ncgenyy.c
+
+# The SunOS 4.1.3 yacc(1) doesn't generate correct code.
+#
+vms-stuff:	ncgentab.h ncgentab.c ncgenyy.c
+	cp ncgentab.h vmstab.h
+	cp ncgentab.c vmstab.c
+	cp ncgenyy.c vms_yy.c
+
+#
+# test "-b" option of ncgen
+#
+btest:		$(PROGRAM) test0.cdl test1.cdl
+	./$(PROGRAM) -b test1.cdl
+	$(NCDUMP) test1.nc > test2.cdl
+	@diff test1.cdl test2.cdl && \
+	    echo "*** $(PROGRAM) -b test successful ***"
+
+#
+# test "-c" option of ncgen
+#
+ctest:		test1.cdl ctest0
+	./ctest0		# tests `-c' option, creates ctest0.nc
+	$(NCDUMP) -n test1 ctest0.nc > ctest1.cdl
+	@diff test1.cdl ctest1.cdl && \
+	    echo "*** $(PROGRAM) -c test successful ***"
+
+ctest0:		ncgen test0.cdl
+	./$(PROGRAM) -c -o ctest0.nc test0.cdl > test0.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ test0.c $(LIBS)
+
+#
+# test "-f" option of ncgen
+#
+ftest:		test1.cdl
+	@case "$(FC)" in \
+	NONE*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) $(MFLAGS) ftest0; \
+	    ./ftest0 ; \
+	    $(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;; \
+	esac
+
+ftest0:		$(PROGRAM) test0.cdl
+	@case "$(FC)" in \
+	NONE*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    $(MAKE) $(MFLAGS) netcdf.inc; \
+	    ./$(PROGRAM) -f -o ftest0.nc test0.cdl > test0.f; \
+	    $(FC) $(FFLAGS) -o $@ test0.f $(LIBS);; \
+	esac
+
+test1.cdl:	test0.nc
+	$(NCDUMP) -n test1 test0.nc > $@
+
+test0.nc:	$(PROGRAM) test0.cdl
+	./$(PROGRAM) -b -o test0.nc test0.cdl
+
+netcdf.inc:
+	@case "$(FC)" in \
+	NONE*) \
+	    echo 1>&2 "\`$@' not made because no FORTRAN compiler";; \
+	*) \
+	    ln -s ../fortran/$@ .;; \
+	esac
+
+include ../port/master.mk
+
+# Override the default definition for ncdump(1) in the master makefile.
+#
+NCDUMP		= ../ncdump/ncdump
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/README
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -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.

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/close.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/close.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/close.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,57 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: close.c,v 1.2 1996/03/26 22:39:32 georgev Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include "ncgen.h"
+#include "genlib.h"
+
+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);");
+#ifndef vms
+    cline("   return 0;");
+#else
+    cline("   return 1;");
+#endif
+    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();
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ctest0.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ctest0.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ctest0.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,84 @@
+# Microsoft Visual C++ generated build script - Do not modify
+
+PROJ = CTEST0
+DEBUG = 1
+PROGTYPE = 2
+CALLER = 
+ARGS = 
+DLLS = 
+ORIGIN = MSVCNT
+ORIGIN_VER = 1.00
+PROJPATH = E:\KOZIOL\MFHDF\NCGEN\ 
+USEMFC = 0
+CC = cl
+CPP = cl
+CXX = cl
+CCREATEPCHFLAG = 
+CPPCREATEPCHFLAG = 
+CUSEPCHFLAG = 
+CPPUSEPCHFLAG = 
+FIRSTC = TEST0.C
+FIRSTCPP = 
+RC = rc
+CFLAGS_D_DEXE32 = /nologo /W3 /Zi /YX /D "_DEBUG" /D "_X86_" /D "_CONSOLE" /D "HDF" /D "WINNT" /D "STDC_INCLUDES" /D "NO_SYS_XDR_INC" /D "i386" /I "e:\koziol\mfhdf\libsrc" /I "e:\koziol\mfhdf\xdr" /FR /ML /Fd"CTEST0.PDB"  /Fp"CTEST0.PCH"
+CFLAGS_R_DEXE32 = /nologo /W3 /YX /O2 /D "NDEBUG" /D "_X86_" /D "_CONSOLE" /D "HDF" /D "WINNT" /D "STDC_INCLUDES" /D "NO_SYS_XDR_INC" /D "i386" /I "e:\koziol\mfhdf\libsrc" /I "e:\koziol\mfhdf\xdr" /FR /ML /Fp"CTEST0.PCH"
+LFLAGS_D_DEXE32 = /NOLOGO /DEBUG /DEBUGTYPE:cv /SUBSYSTEM:console netapi32.lib wsock32.lib
+LFLAGS_R_DEXE32 = /NOLOGO /SUBSYSTEM:console netapi32.lib wsock32.lib
+LFLAGS_D_LIB32 = /NOLOGO
+LFLAGS_R_LIB32 = /NOLOGO
+LIBS_D_DEXE32 = 
+LIBS_R_DEXE32 = 
+RCFLAGS32 = 
+D_RCDEFINES32 = -d_DEBUG
+R_RCDEFINES32 = -dNDEBUG
+OBJS_EXT = 
+LIBS_EXT = ..\MFHDF.LIB ..\..\HDF\SRC\HDF33SRC.LIB 
+!if "$(DEBUG)" == "1"
+CFLAGS = $(CFLAGS_D_DEXE32)
+LFLAGS = $(LFLAGS_D_DEXE32)
+LIBS = $(LIBS_D_DEXE32)
+LFLAGS_LIB=$(LFLAGS_D_LIB32)
+MAPFILE_OPTION = 
+RCDEFINES = $(D_RCDEFINES32)
+!else
+CFLAGS = $(CFLAGS_R_DEXE32)
+LFLAGS = $(LFLAGS_R_DEXE32)
+LIBS = $(LIBS_R_DEXE32)
+MAPFILE_OPTION = 
+LFLAGS_LIB=$(LFLAGS_R_LIB32)
+RCDEFINES = $(R_RCDEFINES32)
+!endif
+SBRS = TEST0.SBR
+
+
+MFHDF_DEP = 
+
+HDF33SRC_DEP = 
+
+all:	$(PROJ).EXE $(PROJ).BSC
+
+TEST0.OBJ:	TEST0.C $(TEST0_DEP)
+	$(CC) $(CFLAGS) $(CCREATEPCHFLAG) /c TEST0.C
+
+$(PROJ).EXE:	TEST0.OBJ $(OBJS_EXT) $(LIBS_EXT)
+	echo >NUL @<<$(PROJ).CRF
+TEST0.OBJ 
+$(OBJS_EXT)
+-OUT:$(PROJ).EXE
+$(MAPFILE_OPTION)
+..\MFHDF.LIB
+..\..\HDF\SRC\HDF33SRC.LIB
+$(LIBS)
+$(LIBS_EXT)
+$(DEFFILE_OPTION) -implib:$(PROJ).lib
+<<
+	link $(LFLAGS) @$(PROJ).CRF
+
+run: $(PROJ).EXE
+	$(PROJ) $(RUNFLAGS)
+
+
+$(PROJ).BSC: $(SBRS)
+	bscmake @<<
+/o$@ $(SBRS)
+<<

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/descrip.mms
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/descrip.mms	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/descrip.mms	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,64 @@
+! $Id: descrip.mms,v 1.1 1993/04/21 21:51:45 chouck Exp $
+!
+!          MMS file for ncgen
+!
+!==============================================================================
+! ASSUMPTIONS:
+
+!==============================================================================
+! CUSTOMIZATIONS (change as necessary):
+
+!Root of the installation:
+INSTROOT	= LDMROOT:
+
+!Operating system version:
+OS		= vms_5_4
+
+!Compilation options:
+COPTS		= /opt/nodebug
+
+!==============================================================================
+EXEDIR		= $(INSTROOT)[exe]
+LIBRARY		= [-]netcdf.olb
+LINKFLAGS	= /nodebug/exec=$(mms$target_name).exe
+!LINKFLAGS	= /debug/exec=$(mms$target_name).exe
+CFLAGS		= $(COPTS)/include=[-.src]
+OBJS 		= \
+		    getfill.obj, -
+		    close.obj, -
+		    derror.obj, -
+		    emalloc.obj, -
+		    escapes.obj, -
+		    generate.obj, -
+		    getopt.obj, -
+		    init.obj, -
+		    load.obj, -
+		    main.obj, -
+		    ncgentab.obj
+
+all :		ncgen.exe
+	@ continue
+
+ncgen.exe :	$(OBJS), $(LIBRARY)
+	$(LINK)$(LINKFLAGS) $(OBJS),$(LIBRARY)/lib,[]ncgen/opt
+
+getopt.obj :	[-.util]getopt.c
+
+install :	$(EXEDIR), $(EXEDIR)ncgen.exe
+	@ continue
+
+$(EXEDIR) :
+	- cre/dir $@
+
+$(EXEDIR)ncgen.exe :	ncgen.exe
+	copy ncgen.exe $@
+	purge $@
+
+clean :
+	purge
+	- delete *.obj.*,*.lis.*,*.map.*,*.exe.*
+
+ncgen.obj :	ncgentab.h
+
+ncgentab.obj :	vmstab.c
+	$(CC)$(CFLAGS)/obj=$@ $?

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/escapes.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/escapes.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/escapes.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,92 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: escapes.c,v 1.4 1997/11/05 19:40:42 koziol Exp $
+ *********************************************************************/
+
+#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;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/generate.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/generate.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/generate.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1092 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: generate.c,v 1.10 1998/12/08 21:38:02 koziol Exp $
+ *********************************************************************/
+
+#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[MAX_NC_DIMS];
+    int varids[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[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 \"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[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) {
+#ifdef cray
+#ifndef _CRAYMPP
+      /* Traditional vector pipe cray */
+      case NC_BYTE:
+	return "integer";
+      case NC_CHAR:
+	return "character";
+      case NC_SHORT:
+	return "integer";
+      case NC_LONG:
+	return "integer";
+      case NC_FLOAT:
+	return "real";
+      case NC_DOUBLE:
+	return "real";		/* we don't support CRAY 128-bit doubles */
+#else
+      /* a T3D/E.  INTEGER and REAL are both 8 bytes. */
+      case NC_BYTE:
+	return "integer";
+      case NC_CHAR:
+	return "character";
+      case NC_SHORT:
+	return "integer";
+      case NC_LONG:
+	return "integer*4";
+      case NC_FLOAT:
+	return "real*4";
+      case NC_DOUBLE:
+	return "real";
+#endif	/* (_CRAYMPP) */
+#else
+      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";
+#endif	
+      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);
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/generic.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/generic.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/generic.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,13 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: generic.h,v 1.3 1996/03/26 22:39:34 georgev Exp $
+ *********************************************************************/
+
+union generic {			/* used to hold any kind of fill_value */
+    double doublev;
+    float floatv;
+    nclong longv;
+    short shortv;
+    char charv;
+};

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/genlib.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/genlib.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/genlib.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,96 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: genlib.c,v 1.3 1997/11/05 19:40:44 koziol Exp $
+ *********************************************************************/
+
+#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;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/genlib.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/genlib.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/genlib.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,92 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: genlib.h,v 1.8 1997/11/05 19:40:45 koziol Exp $
+ *********************************************************************/
+
+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

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/getfill.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/getfill.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/getfill.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,131 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: getfill.c,v 1.6 2000/08/29 13:57:00 koziol Exp $
+ *********************************************************************/
+
+#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");
+    }
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/init.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/init.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/init.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,42 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: init.c,v 1.4 1997/11/05 19:40:47 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include "ncgen.h"
+#include "genlib.h"
+
+extern int netcdf_flag;
+extern int c_flag;
+extern int fortran_flag;
+
+struct dims dims[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[MAX_NC_VARS];	/* should be a malloc'ed list, not an array */
+
+struct atts atts[MAX_NC_ATTS];	/* 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) */
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/lexyacc.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/lexyacc.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/lexyacc.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,10 @@
+$! If you have lex and yacc for VMS (e.g. with DEC Shell) this rebuilds
+$! vms_yy.c, vmstab.c, and vmstab.h from ncgen.l and
+$! ncgen.y.  If you don't have lex and yacc, just use the *-vms files provided
+$! with the distribution.
+$!
+$ lex ncgen.l
+$ rename lex_yy.c vms_yy.c
+$ yacc -d ncgen.y
+$ rename y_tab.c vmstab.c
+$ rename y_tab.h vmstab.h

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/load.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/load.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/load.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,525 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: load.c,v 1.11 2000/08/29 13:57:00 koziol Exp $
+ *********************************************************************/
+
+#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[MAX_VAR_DIMS];
+    long edges[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[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[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);
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/main.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/main.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/main.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,122 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: main.c,v 1.9 1997/11/13 21:38:57 acheng Exp $
+ *********************************************************************/
+
+#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 [ -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, "bcfno:")) != EOF)
+      switch(c) {
+	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;
+#ifdef VMS
+    return (1-yyparse());
+#else
+    return (yyparse());
+#endif
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/make.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/make.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/make.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,50 @@
+$! --------------------------------------------------------------------------
+$! For making NCGEN.EXE on VMS.
+$! --------------------------------------------------------------------------
+$!
+$! $Id: make.com,v 1.5 1996/11/07 00:29:10 sxu Exp $
+$!
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC"
+$ define/nolog sys$clib sys$library:deccrtl
+$ else
+$ ccopt = ""
+$ define/nolog sys$clib sys$library:vaxcrtl
+$ endif
+$ ccc := cc 'ccopt  -
+       /opt/nodebug/include=([--.include],[--.hdf.src], -
+     [--.hdf.jpeg],[--.hdf.zlib], sys$library)/nolist    -
+     /define=(HDF,VMS,NO_SYS_XDR_INC)
+$
+$ copy vmstab.c ncgentab.c
+$ copy vmstab.h ncgentab.h
+$ copy vms_yy.c ncgenyy.c
+$
+$ ccc MAIN.C
+$ ccc GENERATE.C
+$ ccc LOAD.C
+$ ccc NCGENTAB.C
+$ ccc ESCAPES.C
+$ ccc GETFILL.C
+$ ccc INIT.C
+$ ccc CLOSE.C
+$ ccc GENLIB.C
+$ ccc [-.UTIL]GETOPT.C
+$
+$ link/nodebug/notraceback/exe=NCGEN.exe -
+    getfill.obj, -
+    close.obj, -
+    genlib.obj, -
+    escapes.obj, -
+    generate.obj, -
+    getopt.obj, -
+    init.obj, -
+    load.obj, -
+    main.obj, -
+    ncgentab.obj, -
+    [--.lib]mfhdf/lib, [--.hdf.src]df/lib,  -
+    [--.hdf.jpeg]libjpeg.olb/lib, -
+    [--.hdf.zlib]libz.olb/lib, -
+    sys$input/opt
+	sys$clib/lib

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msoft.mk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msoft.mk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msoft.mk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,158 @@
+#  Copyright 1993, UCAR/Unidata
+#
+#  DOS and OS/2 Makefile for ncgen
+#
+#  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   =
+
+!IF $(FORT)
+FORTLIB   = llibfor7.lib
+FTEST     = ftest
+!ENDIF
+
+LINK      = link
+LFLAGS    = /st:15000 /nod /noe
+
+INCDIR    = ..\libsrc
+INCLUDES  = /I$(INCDIR)
+
+DESTDIR   = C:
+FORTDIR   = ..\FORTRAN
+
+BINDIR    = $(DESTDIR)\bin
+LIBDIR    = $(DESTDIR)\lib
+NCGENLIB  = ncgen.lib
+NETCDFLIB = ..\libsrc\netcdf.lib
+HDFLIB    = \hdf\hdf\lib\df.lib
+CLIB      = llibc7.lib oldnames.lib
+
+!IF $(OS2)
+OS2LIB    = os2.lib
+!ELSE
+OS2LIB    = 
+!ENDIF
+XDRLIB    = ..\xdr\xdr.lib
+LIBS      = $(NCGENLIB) $(NETCDFLIB) $(XDRLIB) $(OS2LIB) $(HDFLIB) $(CLIB)
+
+.c.obj:
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
+
+LOADLIBS =
+
+GOAL =  ncgen.exe
+
+SRCS =  main.c generate.c load.c ncgentab.c escapes.c \
+	getfill.c init.c close.c genlib.c
+
+MAIN =  main.obj
+
+OBJS =	generate.obj load.obj ncgentab.obj escapes.obj \
+	getfill.obj init.obj close.obj genlib.obj getopt.obj
+
+LOBJS1 = -+generate.obj -+load.obj -+ncgentab.obj -+escapes.obj 
+LOBJS2 = -+getfill.obj -+init.obj -+close.obj -+genlib.obj -+getopt.obj
+
+all:	$(GOAL)
+
+$(GOAL): $(MAIN) $(NCGENLIB) $(NETCDFLIB)
+    $(LINK) $(LFLAGS) $(MAIN),$(GOAL),, at ncgen.lnk;
+
+$(NCGENLIB): $(OBJS)
+	$(AR) $@ $(ARFLAGS) $(LOBJS1),LIB.LST;
+	$(AR) $@ $(ARFLAGS) $(LOBJS2),LIB.LST;
+
+getopt.obj:	..\util\getopt.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $?
+
+install: $(GOAL)
+	copy $(GOAL) $(BINDIR)
+
+test:   ncgen.exe test0.cdl ntest ctest $(FTEST) FORCE
+
+FORCE:
+
+# test "-b" option of ncgen
+ntest:	ncgen.exe test0.cdl test1.cdl
+	ncgen -b test1.cdl
+	..\ncdump\ncdump test1.nc > test2.cdl
+ 	diff test1.cdl test2.cdl
+	@echo "*** ncgen -b test successful ***"
+
+# test "-c" option of ncgen
+ctest:	ncgen.exe test0.cdl test1.cdl
+	ncgen -c -o ctest0.nc test0.cdl > test0.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) test0.c
+#	$(LINK) $(LFLAGS) test0,test0.exe,,$(LIBS);
+	$(LINK) $(LFLAGS) test0,test0.exe,, at test0.lnk;
+	test0
+	..\ncdump\ncdump -n test1 ctest0.nc > ctest1.cdl
+ 	diff test1.cdl ctest1.cdl
+	@echo "*** ncgen -c test successful ***"
+
+# test "-f" option of ncgen
+ftest:	ncgen.exe test0.cdl netcdf.inc test1.cdl msoft.int jackets.obj fslen.obj
+	ncgen -f -o ftest0.nc test0.cdl > test0.for
+	$(F77) $(FFLAGS) test0.for
+	$(LINK) $(LFLAGS) test0 jackets fslen,test0.exe,,$(LIBS) $(FORTLIB);
+	test0
+	..\ncdump\ncdump -n test1 ftest0.nc > ftest1.cdl
+ 	diff test1.cdl ftest1.cdl
+	@echo "*** ncgen -f test successful ***"
+
+test1.cdl: test0.nc
+	..\ncdump\ncdump -n test1 test0.nc > test1.cdl
+
+test0.nc: ncgen.exe test0.cdl
+	ncgen -b test0.cdl
+
+netcdf.inc: $(FORTDIR)\netcdf.inc
+	rm -f netcdf.inc
+	copy $(FORTDIR)\netcdf.inc
+
+fslen.obj: $(FORTDIR)\fslen.asm
+	rm -f fslen.asm
+	copy $(FORTDIR)\fslen.asm
+	$(ASM) fslen;
+
+jackets.obj: $(FORTDIR)\jackets.c
+	rm -f jackets.c
+	copy $(FORTDIR)\jackets.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) jackets.c
+
+msoft.int: $(FORTDIR)\msoft.int
+	rm -f msoft.int
+	copy $(FORTDIR)\msoft.int
+
+ncgentab.c: msofttab.c
+	copy msofttab.c ncgentab.c
+
+ncgentab.h: msofttab.h
+	copy msofttab.h ncgentab.h
+
+ncgenyy.c: msoftyy.c
+	copy msoftyy.c ncgenyy.c
+
+ncgen: ncgen.exe
+
+clean:
+	rm -f *.obj *.map *.lst netcdf.inc msoft.int jackets.c fslen.asm \
+		*.bak ncgen.lib ncgentab.c ncgentab.h ncgenyy.c $(GOAL) 
+	rm -f test0.nc test0.for test0.exe test1.nc test1.cdl test2.cdl \
+		ftest0.nc ftest1.cdl test0.c ctest0.nc ctest1.cdl
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+generate.obj: $(INCDIR)\netcdf.h generic.h ncgen.h
+load.obj: $(INCDIR)\netcdf.h generic.h ncgen.h
+ncgentab.obj: $(INCDIR)\netcdf.h generic.h ncgen.h ncgenyy.c ncgentab.h
+getfill.obj: $(INCDIR)\netcdf.h generic.h
+init.obj: $(INCDIR)\netcdf.h ncgen.h
+init.obj: generic.h
+close.obj: $(INCDIR)\netcdf.h ncgen.h
+close.obj: generic.h

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msofttab.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msofttab.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msofttab.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1474 @@
+
+# line 10 "ncgen.y"
+#ifndef lint
+static char SccsId[] = "$Id: msofttab.c,v 1.5 1997/11/05 19:40:50 koziol Exp $";
+#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 */
+
+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 long 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 long *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 */
+# define NC_UNLIMITED_K 257
+# define BYTE_K 258
+# define CHAR_K 259
+# define SHORT_K 260
+# define LONG_K 261
+# define FLOAT_K 262
+# define DOUBLE_K 263
+# define IDENT 264
+# define TERMSTRING 265
+# define BYTE_CONST 266
+# define CHAR_CONST 267
+# define SHORT_CONST 268
+# define LONG_CONST 269
+# define FLOAT_CONST 270
+# define DOUBLE_CONST 271
+# define DIMENSIONS 272
+# define VARIABLES 273
+# define NETCDF 274
+# define DATA 275
+
+#include <malloc.h>
+
+#ifdef __cplusplus
+
+#ifndef yyerror
+	void yyerror(const char *);
+#endif
+
+#ifndef yylex
+#ifdef __EXTERN_C__
+	extern "C" { int yylex(void); }
+#else
+	int yylex(void);
+#endif
+#endif
+	int yyparse(void);
+
+#endif
+#define yyclearin yychar = -1
+#define yyerrok yyerrflag = 0
+extern int yychar;
+extern int yyerrflag;
+#ifndef YYSTYPE
+#define YYSTYPE int
+#endif
+YYSTYPE yylval;
+YYSTYPE yyval;
+typedef int yytabelem;
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 150
+#endif
+#if YYMAXDEPTH > 0
+int yy_yys[YYMAXDEPTH], *yys = yy_yys;
+YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;
+#else	/* user does initial allocation */
+int *yys;
+YYSTYPE *yyv;
+#endif
+static int yymaxdepth = YYMAXDEPTH;
+# define YYERRCODE 256
+
+# line 676 "ncgen.y"
+
+
+/* PROGRAMS */
+
+/* get lexical input routine generated by lex  */
+#include "msoftyy.c"
+
+void derror();
+
+yyerror(s)	/* called for yacc syntax error */
+     char *s;
+{
+	derror(s);
+}
+
+int
+yywrap()			/* returns 1 on EOF if no more input */
+{
+    return  1;
+}
+
+
+/* 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;
+}
+yytabelem yyexca[] ={
+-1, 1,
+	0, -1,
+	-2, 0,
+	};
+# define YYNPROD 71
+# define YYLAST 225
+yytabelem yyact[]={
+
+    92,    93,    91,    94,    95,    96,    97,    71,    72,    70,
+    73,    74,    75,    76,    42,     2,    15,     6,    34,    40,
+    13,    36,    51,    52,     3,    84,    12,    68,    80,    78,
+    59,    39,    19,    18,    18,    77,    62,    56,    44,    35,
+    49,    46,    33,    86,    54,    50,    87,    89,    37,    17,
+    82,    57,    66,    22,    10,     9,    90,    85,    83,    63,
+    53,    69,    67,    48,    16,    47,    26,    79,    65,    58,
+    45,    25,    24,    38,    23,    43,    21,    11,     8,    41,
+    20,    14,     7,     5,     4,    55,     1,     0,     0,     0,
+     0,     0,     0,    81,     0,    60,    55,    47,    61,    64,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+    88,     0,     0,     0,    81,    99,    98,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,    27,    28,
+    29,    30,    31,    32,    36 };
+yytabelem yypact[]={
+
+  -259,-10000000,   -99,-10000000,  -255,-10000000,  -244,  -257,  -244,   -10,
+-10000000,   -29,-10000000,-10000000,-10000000,   -40,   -11,-10000000,  -244,  -238,
+  -261,   -40,   -21,-10000000,-10000000,  -243,-10000000,-10000000,-10000000,-10000000,
+-10000000,-10000000,-10000000,   -18,  -242,-10000000,-10000000,-10000000,-10000000,-10000000,
+-10000000,  -102,  -243,   -22,-10000000,     7,-10000000,-10000000,   -31,  -242,
+-10000000,-10000000,-10000000,  -243,   -23,-10000000,-10000000,  -243,    12,  -258,
+-10000000,   -24,-10000000,   -32,-10000000,-10000000,  -244,     6,-10000000,-10000000,
+-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,     2,
+-10000000,-10000000,  -258,     3,-10000000,  -265,-10000000,  -244,-10000000,-10000000,
+-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000 };
+yytabelem yypgo[]={
+
+     0,    86,    84,    83,    82,    81,    80,    79,    78,    55,
+    54,    77,    26,    76,    53,    74,    72,    71,    70,    41,
+    39,    69,    68,    67,    28,    66,    63,    62,    42,    45,
+    27,    61,    60,    44,    59,    58,    25,    57,    56 };
+yytabelem yyr1[]={
+
+     0,     2,     4,     6,     1,     3,     3,     8,     8,     9,
+     9,    10,    10,    11,    12,     5,     5,    13,    13,    14,
+    14,    15,    17,    17,    17,    17,    17,    17,    18,    18,
+    21,    19,    20,    22,    22,    23,    23,    24,    26,    16,
+    25,    25,    28,    29,    27,    27,    30,    31,    31,    31,
+    31,    31,    31,    31,     7,     7,    32,    32,    34,    33,
+    35,    35,    37,    36,    38,    38,    38,    38,    38,    38,
+    38 };
+yytabelem yyr2[]={
+
+     0,     1,     1,     1,    19,     0,     4,     4,     6,     2,
+     6,     7,     7,     3,     2,     0,     4,     4,     6,     2,
+     2,     4,     3,     3,     3,     3,     3,     3,     2,     6,
+     1,     7,     2,     0,     6,     2,     6,     3,     1,     9,
+     6,     5,     3,     3,     2,     6,     3,     3,     3,     3,
+     3,     3,     3,     3,     0,     4,     4,     6,     1,     9,
+     2,     6,     1,     5,     3,     3,     3,     3,     3,     3,
+     3 };
+yytabelem yychk[]={
+
+-10000000,    -1,   274,   123,    -2,    -3,   272,    -4,    -8,    -9,
+   -10,   -11,   -12,   264,    -5,   273,    -9,    59,    44,    61,
+    -6,   -13,   -14,   -15,   -16,   -17,   -25,   258,   259,   260,
+   261,   262,   263,   -28,    58,   -20,   264,    59,   -10,   269,
+   257,    -7,   275,   -14,    59,   -18,   -19,   -20,   -26,    58,
+   -29,   264,   125,   -32,   -33,   -28,    59,    44,   -21,    61,
+   -29,   -33,    59,   -34,   -19,   -22,    40,   -27,   -30,   -31,
+   267,   265,   266,   268,   269,   270,   271,    59,    61,   -23,
+   -24,   -12,    44,   -35,   -36,   -37,    41,    44,   -30,    44,
+   -38,   267,   265,   266,   268,   269,   270,   271,   -24,   -36 };
+yytabelem yydef[]={
+
+     0,    -2,     0,     1,     5,     2,     0,    15,     6,     0,
+     9,     0,    13,    14,     3,     0,     0,     7,     0,     0,
+    54,    16,     0,    19,    20,     0,    38,    22,    23,    24,
+    25,    26,    27,     0,     0,    42,    32,     8,    10,    11,
+    12,     0,     0,     0,    17,    21,    28,    30,     0,     0,
+    41,    43,     4,    55,     0,    58,    18,     0,    33,     0,
+    40,     0,    56,     0,    29,    31,     0,    39,    44,    46,
+    47,    48,    49,    50,    51,    52,    53,    57,    62,     0,
+    35,    37,     0,    59,    60,     0,    34,     0,    45,    62,
+    63,    64,    65,    66,    67,    68,    69,    70,    36,    61 };
+typedef struct
+#ifdef __cplusplus
+	yytoktype
+#endif
+{ char *t_name; int t_val; } yytoktype;
+#ifndef YYDEBUG
+#	define YYDEBUG	0	/* don't allow debugging */
+#endif
+
+#if YYDEBUG
+
+yytoktype yytoks[] =
+{
+	"NC_UNLIMITED_K",	257,
+	"BYTE_K",	258,
+	"CHAR_K",	259,
+	"SHORT_K",	260,
+	"LONG_K",	261,
+	"FLOAT_K",	262,
+	"DOUBLE_K",	263,
+	"IDENT",	264,
+	"TERMSTRING",	265,
+	"BYTE_CONST",	266,
+	"CHAR_CONST",	267,
+	"SHORT_CONST",	268,
+	"LONG_CONST",	269,
+	"FLOAT_CONST",	270,
+	"DOUBLE_CONST",	271,
+	"DIMENSIONS",	272,
+	"VARIABLES",	273,
+	"NETCDF",	274,
+	"DATA",	275,
+	"-unknown-",	-1	/* ends search */
+};
+
+char * yyreds[] =
+{
+	"-no such reduction-",
+	"ncdesc : NETCDF '{'",
+	"ncdesc : NETCDF '{' dimsection",
+	"ncdesc : NETCDF '{' dimsection vasection",
+	"ncdesc : NETCDF '{' dimsection vasection datasection '}'",
+	"dimsection : /* empty */",
+	"dimsection : DIMENSIONS dimdecls",
+	"dimdecls : dimdecline ';'",
+	"dimdecls : dimdecls dimdecline ';'",
+	"dimdecline : dimdecl",
+	"dimdecline : dimdecline ',' dimdecl",
+	"dimdecl : dimd '=' LONG_CONST",
+	"dimdecl : dimd '=' NC_UNLIMITED_K",
+	"dimd : dim",
+	"dim : IDENT",
+	"vasection : /* empty */",
+	"vasection : VARIABLES vadecls",
+	"vadecls : vadecl ';'",
+	"vadecls : vadecls vadecl ';'",
+	"vadecl : vardecl",
+	"vadecl : attdecl",
+	"vardecl : type varlist",
+	"type : BYTE_K",
+	"type : CHAR_K",
+	"type : SHORT_K",
+	"type : LONG_K",
+	"type : FLOAT_K",
+	"type : DOUBLE_K",
+	"varlist : varspec",
+	"varlist : varlist ',' varspec",
+	"varspec : var",
+	"varspec : var dimspec",
+	"var : IDENT",
+	"dimspec : /* empty */",
+	"dimspec : '(' dimlist ')'",
+	"dimlist : vdim",
+	"dimlist : dimlist ',' vdim",
+	"vdim : dim",
+	"attdecl : att",
+	"attdecl : att '=' attvallist",
+	"att : avar ':' attr",
+	"att : ':' attr",
+	"avar : var",
+	"attr : IDENT",
+	"attvallist : aconst",
+	"attvallist : attvallist ',' aconst",
+	"aconst : attconst",
+	"attconst : CHAR_CONST",
+	"attconst : TERMSTRING",
+	"attconst : BYTE_CONST",
+	"attconst : SHORT_CONST",
+	"attconst : LONG_CONST",
+	"attconst : FLOAT_CONST",
+	"attconst : DOUBLE_CONST",
+	"datasection : /* empty */",
+	"datasection : DATA datadecls",
+	"datadecls : datadecl ';'",
+	"datadecls : datadecls datadecl ';'",
+	"datadecl : avar",
+	"datadecl : avar '=' constlist",
+	"constlist : dconst",
+	"constlist : constlist ',' dconst",
+	"dconst : /* empty */",
+	"dconst : const",
+	"const : CHAR_CONST",
+	"const : TERMSTRING",
+	"const : BYTE_CONST",
+	"const : SHORT_CONST",
+	"const : LONG_CONST",
+	"const : FLOAT_CONST",
+	"const : DOUBLE_CONST",
+};
+#endif /* YYDEBUG */
+#if !defined(lint) && !defined(__cplusplus)
+static  char __yaccpar_sccsid1[] = "@(#) 9/3/92 yaccpar 6.11 Copyr 1991 Sun Micro";
+#endif
+
+/*
+** Skeleton parser driver for yacc output
+*/
+
+/*
+** yacc user known macros and defines
+*/
+#define YYERROR		goto yyerrlab
+#define YYACCEPT	return(0)
+#define YYABORT		return(1)
+#define YYBACKUP( newtoken, newvalue )\
+{\
+	if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
+	{\
+		yyerror( "syntax error - cannot backup" );\
+		goto yyerrlab;\
+	}\
+	yychar = newtoken;\
+	yystate = *yyps;\
+	yylval = newvalue;\
+	goto yynewstate;\
+}
+#define YYRECOVERING()	(!!yyerrflag)
+#define YYNEW(type)	malloc(sizeof(type) * yynewmax)
+#define YYCOPY(to, from, type) \
+	(type *) memcpy(to, (char *) from, yynewmax * sizeof(type))
+#define YYENLARGE( from, type) \
+	(type *) realloc((char *) from, yynewmax * sizeof(type))
+#ifndef YYDEBUG
+#	define YYDEBUG	1	/* make debugging available */
+#endif
+
+/*
+** user known globals
+*/
+int yydebug;			/* set to 1 to get debugging */
+
+/*
+** driver internal defines
+*/
+#define YYFLAG		(-10000000)
+
+/*
+** global variables used by the parser
+*/
+YYSTYPE *yypv;			/* top of value stack */
+int *yyps;			/* top of state stack */
+
+int yystate;			/* current state */
+int yytmp;			/* extra var (lasts between blocks) */
+
+int yynerrs;			/* number of errors */
+int yyerrflag;			/* error recovery flag */
+int yychar;			/* current input token number */
+
+
+
+#ifdef YYNMBCHARS
+#define YYLEX()		yycvtok(yylex())
+/*
+** yycvtok - return a token if i is a wchar_t value that exceeds 255.
+**	If i<255, i itself is the token.  If i>255 but the neither 
+**	of the 30th or 31st bit is on, i is already a token.
+*/
+#if defined(__STDC__) || defined(__cplusplus)
+int yycvtok(int i)
+#else
+int yycvtok(i) int i;
+#endif
+{
+	int first = 0;
+	int last = YYNMBCHARS - 1;
+	int mid;
+	wchar_t j;
+
+	if(i&0x60000000){/*Must convert to a token. */
+		if( yymbchars[last].character < i ){
+			return i;/*Giving up*/
+		}
+		while ((last>=first)&&(first>=0)) {/*Binary search loop*/
+			mid = (first+last)/2;
+			j = yymbchars[mid].character;
+			if( j==i ){/*Found*/ 
+				return yymbchars[mid].tvalue;
+			}else if( j<i ){
+				first = mid + 1;
+			}else{
+				last = mid -1;
+			}
+		}
+		/*No entry in the table.*/
+		return i;/* Giving up.*/
+	}else{/* i is already a token. */
+		return i;
+	}
+}
+#else/*!YYNMBCHARS*/
+#define YYLEX()		yylex()
+#endif/*!YYNMBCHARS*/
+
+/*
+** yyparse - return 0 if worked, 1 if syntax error not recovered from
+*/
+#if defined(__STDC__) || defined(__cplusplus)
+int yyparse(void)
+#else
+int yyparse()
+#endif
+{
+	register YYSTYPE *yypvt;	/* top of value stack for $vars */
+
+#if defined(__cplusplus) || defined(lint)
+/*
+	hacks to please C++ and lint - goto's inside switch should never be
+	executed; yypvt is set to 0 to avoid "used before set" warning.
+*/
+	static int __yaccpar_lint_hack__ = 0;
+	switch (__yaccpar_lint_hack__)
+	{
+		case 1: goto yyerrlab;
+		case 2: goto yynewstate;
+	}
+	yypvt = 0;
+#endif
+
+	/*
+	** Initialize externals - yyparse may be called more than once
+	*/
+	yypv = &yyv[-1];
+	yyps = &yys[-1];
+	yystate = 0;
+	yytmp = 0;
+	yynerrs = 0;
+	yyerrflag = 0;
+	yychar = -1;
+
+#if YYMAXDEPTH <= 0
+	if (yymaxdepth <= 0)
+	{
+		if ((yymaxdepth = YYEXPAND(0)) <= 0)
+		{
+			yyerror("yacc initialization error");
+			YYABORT;
+		}
+	}
+#endif
+
+	{
+		register YYSTYPE *yy_pv;	/* top of value stack */
+		register int *yy_ps;		/* top of state stack */
+		register int yy_state;		/* current state */
+		register int  yy_n;		/* internal state number info */
+	goto yystack;	/* moved from 6 lines above to here to please C++ */
+
+		/*
+		** get globals into registers.
+		** branch to here only if YYBACKUP was called.
+		*/
+	yynewstate:
+		yy_pv = yypv;
+		yy_ps = yyps;
+		yy_state = yystate;
+		goto yy_newstate;
+
+		/*
+		** get globals into registers.
+		** either we just started, or we just finished a reduction
+		*/
+	yystack:
+		yy_pv = yypv;
+		yy_ps = yyps;
+		yy_state = yystate;
+
+		/*
+		** top of for (;;) loop while no reductions done
+		*/
+	yy_stack:
+		/*
+		** put a state and value onto the stacks
+		*/
+#if YYDEBUG
+		/*
+		** if debugging, look up token value in list of value vs.
+		** name pairs.  0 and negative (-1) are special values.
+		** Note: linear search is used since time is not a real
+		** consideration while debugging.
+		*/
+		if ( yydebug )
+		{
+			register int yy_i;
+
+			printf( "State %d, token ", yy_state );
+			if ( yychar == 0 )
+				printf( "end-of-file\n" );
+			else if ( yychar < 0 )
+				printf( "-none-\n" );
+			else
+			{
+				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
+					yy_i++ )
+				{
+					if ( yytoks[yy_i].t_val == yychar )
+						break;
+				}
+				printf( "%s\n", yytoks[yy_i].t_name );
+			}
+		}
+#endif /* YYDEBUG */
+		if ( ++yy_ps >= &yys[ yymaxdepth ] )	/* room on stack? */
+		{
+			/*
+			** reallocate and recover.  Note that pointers
+			** have to be reset, or bad things will happen
+			*/
+			int yyps_index = (yy_ps - yys);
+			int yypv_index = (yy_pv - yyv);
+			int yypvt_index = (yypvt - yyv);
+			int yynewmax;
+#ifdef YYEXPAND
+			yynewmax = YYEXPAND(yymaxdepth);
+#else
+			yynewmax = 2 * yymaxdepth;	/* double table size */
+			if (yymaxdepth == YYMAXDEPTH)	/* first time growth */
+			{
+				char *newyys = (char *)YYNEW(int);
+				char *newyyv = (char *)YYNEW(YYSTYPE);
+				if (newyys != 0 && newyyv != 0)
+				{
+					yys = YYCOPY(newyys, yys, int);
+					yyv = YYCOPY(newyyv, yyv, YYSTYPE);
+				}
+				else
+					yynewmax = 0;	/* failed */
+			}
+			else				/* not first time */
+			{
+				yys = YYENLARGE(yys, int);
+				yyv = YYENLARGE(yyv, YYSTYPE);
+				if (yys == 0 || yyv == 0)
+					yynewmax = 0;	/* failed */
+			}
+#endif
+			if (yynewmax <= yymaxdepth)	/* tables not expanded */
+			{
+				yyerror( "yacc stack overflow" );
+				YYABORT;
+			}
+			yymaxdepth = yynewmax;
+
+			yy_ps = yys + yyps_index;
+			yy_pv = yyv + yypv_index;
+			yypvt = yyv + yypvt_index;
+		}
+		*yy_ps = yy_state;
+		*++yy_pv = yyval;
+
+		/*
+		** we have a new state - find out what to do
+		*/
+	yy_newstate:
+		if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
+			goto yydefault;		/* simple state */
+#if YYDEBUG
+		/*
+		** if debugging, need to mark whether new token grabbed
+		*/
+		yytmp = yychar < 0;
+#endif
+		if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
+			yychar = 0;		/* reached EOF */
+#if YYDEBUG
+		if ( yydebug && yytmp )
+		{
+			register int yy_i;
+
+			printf( "Received token " );
+			if ( yychar == 0 )
+				printf( "end-of-file\n" );
+			else if ( yychar < 0 )
+				printf( "-none-\n" );
+			else
+			{
+				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
+					yy_i++ )
+				{
+					if ( yytoks[yy_i].t_val == yychar )
+						break;
+				}
+				printf( "%s\n", yytoks[yy_i].t_name );
+			}
+		}
+#endif /* YYDEBUG */
+		if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
+			goto yydefault;
+		if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )	/*valid shift*/
+		{
+			yychar = -1;
+			yyval = yylval;
+			yy_state = yy_n;
+			if ( yyerrflag > 0 )
+				yyerrflag--;
+			goto yy_stack;
+		}
+
+	yydefault:
+		if ( ( yy_n = yydef[ yy_state ] ) == -2 )
+		{
+#if YYDEBUG
+			yytmp = yychar < 0;
+#endif
+			if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
+				yychar = 0;		/* reached EOF */
+#if YYDEBUG
+			if ( yydebug && yytmp )
+			{
+				register int yy_i;
+
+				printf( "Received token " );
+				if ( yychar == 0 )
+					printf( "end-of-file\n" );
+				else if ( yychar < 0 )
+					printf( "-none-\n" );
+				else
+				{
+					for ( yy_i = 0;
+						yytoks[yy_i].t_val >= 0;
+						yy_i++ )
+					{
+						if ( yytoks[yy_i].t_val
+							== yychar )
+						{
+							break;
+						}
+					}
+					printf( "%s\n", yytoks[yy_i].t_name );
+				}
+			}
+#endif /* YYDEBUG */
+			/*
+			** look through exception table
+			*/
+			{
+				register int *yyxi = yyexca;
+
+				while ( ( *yyxi != -1 ) ||
+					( yyxi[1] != yy_state ) )
+				{
+					yyxi += 2;
+				}
+				while ( ( *(yyxi += 2) >= 0 ) &&
+					( *yyxi != yychar ) )
+					;
+				if ( ( yy_n = yyxi[1] ) < 0 )
+					YYACCEPT;
+			}
+		}
+
+		/*
+		** check for syntax error
+		*/
+		if ( yy_n == 0 )	/* have an error */
+		{
+			/* no worry about speed here! */
+			switch ( yyerrflag )
+			{
+			case 0:		/* new error */
+				yyerror( "syntax error" );
+				goto skip_init;
+			yyerrlab:
+				/*
+				** get globals into registers.
+				** we have a user generated syntax type error
+				*/
+				yy_pv = yypv;
+				yy_ps = yyps;
+				yy_state = yystate;
+			skip_init:
+				yynerrs++;
+				/* FALLTHRU */
+			case 1:
+			case 2:		/* incompletely recovered error */
+					/* try again... */
+				yyerrflag = 3;
+				/*
+				** find state where "error" is a legal
+				** shift action
+				*/
+				while ( yy_ps >= yys )
+				{
+					yy_n = yypact[ *yy_ps ] + YYERRCODE;
+					if ( yy_n >= 0 && yy_n < YYLAST &&
+						yychk[yyact[yy_n]] == YYERRCODE)					{
+						/*
+						** simulate shift of "error"
+						*/
+						yy_state = yyact[ yy_n ];
+						goto yy_stack;
+					}
+					/*
+					** current state has no shift on
+					** "error", pop stack
+					*/
+#if YYDEBUG
+#	define _POP_ "Error recovery pops state %d, uncovers state %d\n"
+					if ( yydebug )
+						printf( _POP_, *yy_ps,
+							yy_ps[-1] );
+#	undef _POP_
+#endif
+					yy_ps--;
+					yy_pv--;
+				}
+				/*
+				** there is no state on stack with "error" as
+				** a valid shift.  give up.
+				*/
+				YYABORT;
+			case 3:		/* no shift yet; eat a token */
+#if YYDEBUG
+				/*
+				** if debugging, look up token in list of
+				** pairs.  0 and negative shouldn't occur,
+				** but since timing doesn't matter when
+				** debugging, it doesn't hurt to leave the
+				** tests here.
+				*/
+				if ( yydebug )
+				{
+					register int yy_i;
+
+					printf( "Error recovery discards " );
+					if ( yychar == 0 )
+						printf( "token end-of-file\n" );
+					else if ( yychar < 0 )
+						printf( "token -none-\n" );
+					else
+					{
+						for ( yy_i = 0;
+							yytoks[yy_i].t_val >= 0;
+							yy_i++ )
+						{
+							if ( yytoks[yy_i].t_val
+								== yychar )
+							{
+								break;
+							}
+						}
+						printf( "token %s\n",
+							yytoks[yy_i].t_name );
+					}
+				}
+#endif /* YYDEBUG */
+				if ( yychar == 0 )	/* reached EOF. quit */
+					YYABORT;
+				yychar = -1;
+				goto yy_newstate;
+			}
+		}/* end if ( yy_n == 0 ) */
+		/*
+		** reduction by production yy_n
+		** put stack tops, etc. so things right after switch
+		*/
+#if YYDEBUG
+		/*
+		** if debugging, print the string that is the user's
+		** specification of the reduction which is just about
+		** to be done.
+		*/
+		if ( yydebug )
+			printf( "Reduce by (%d) \"%s\"\n",
+				yy_n, yyreds[ yy_n ] );
+#endif
+		yytmp = yy_n;			/* value to switch over */
+		yypvt = yy_pv;			/* $vars top of value stack */
+		/*
+		** Look in goto table for next state
+		** Sorry about using yy_state here as temporary
+		** register variable, but why not, if it works...
+		** If yyr2[ yy_n ] doesn't have the low order bit
+		** set, then there is no action to be done for
+		** this reduction.  So, no saving & unsaving of
+		** registers done.  The only difference between the
+		** code just after the if and the body of the if is
+		** the goto yy_stack in the body.  This way the test
+		** can be made before the choice of what to do is needed.
+		*/
+		{
+			/* length of production doubled with extra bit */
+			register int yy_len = yyr2[ yy_n ];
+
+			if ( !( yy_len & 01 ) )
+			{
+				yy_len >>= 1;
+				yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
+				yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
+					*( yy_ps -= yy_len ) + 1;
+				if ( yy_state >= YYLAST ||
+					yychk[ yy_state =
+					yyact[ yy_state ] ] != -yy_n )
+				{
+					yy_state = yyact[ yypgo[ yy_n ] ];
+				}
+				goto yy_stack;
+			}
+			yy_len >>= 1;
+			yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
+			yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
+				*( yy_ps -= yy_len ) + 1;
+			if ( yy_state >= YYLAST ||
+				yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
+			{
+				yy_state = yyact[ yypgo[ yy_n ] ];
+			}
+		}
+					/* save until reenter driver code */
+		yystate = yy_state;
+		yyps = yy_ps;
+		yypv = yy_pv;
+	}
+	/*
+	** code supplied by user is placed in this switch
+	*/
+	switch( yytmp )
+	{
+		
+case 1:
+# line 103 "ncgen.y"
+{ init_netcdf(); } break;
+case 2:
+# line 105 "ncgen.y"
+{
+		       if (ndims > MAX_NC_DIMS)
+			 derror("Too many dimensions");
+		   } break;
+case 3:
+# line 110 "ncgen.y"
+{
+		       if (derror_count == 0)
+			 define_netcdf(netcdfname);
+		   } break;
+case 4:
+# line 116 "ncgen.y"
+{
+		       if (derror_count == 0)
+			 close_netcdf();
+		   } break;
+case 11:
+# line 131 "ncgen.y"
+{ if (long_val <= 0)
+			 derror("negative dimension size");
+		     dims[ndims].size = long_val;
+		     ndims++;
+		   } break;
+case 12:
+# line 137 "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 13:
+# line 145 "ncgen.y"
+{ if (yypvt[-0]->is_dim == 1) {
+		        derror( "duplicate dimension declaration for %s",
+		                yypvt[-0]->name);
+		     }
+	             yypvt[-0]->is_dim = 1;
+		     yypvt[-0]->dnum = ndims;
+		     dims[ndims].name = (char *) emalloc(strlen(yypvt[-0]->name)+1);
+		     (void) strcpy(dims[ndims].name, yypvt[-0]->name);
+		   } break;
+case 22:
+# line 167 "ncgen.y"
+{ type_code = NC_BYTE; } break;
+case 23:
+# line 168 "ncgen.y"
+{ type_code = NC_CHAR; } break;
+case 24:
+# line 169 "ncgen.y"
+{ type_code = NC_SHORT; } break;
+case 25:
+# line 170 "ncgen.y"
+{ type_code = NC_LONG; } break;
+case 26:
+# line 171 "ncgen.y"
+{ type_code = NC_FLOAT; } break;
+case 27:
+# line 172 "ncgen.y"
+{ type_code = NC_DOUBLE; } break;
+case 30:
+# line 178 "ncgen.y"
+{
+		    if (nvars >= MAX_NC_VARS)
+		       derror("too many variables");
+		    nvdims = 0;
+		    /* make sure variable not re-declared */
+		    if (yypvt[-0]->is_var == 1) {
+		       derror( "duplicate variable declaration for %s",
+		               yypvt[-0]->name);
+		    }
+	            yypvt[-0]->is_var = 1;
+		    yypvt[-0]->vnum = nvars;
+		    vars[nvars].name = (char *) emalloc(strlen(yypvt[-0]->name)+1);
+		    (void) strcpy(vars[nvars].name, yypvt[-0]->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 31:
+# line 198 "ncgen.y"
+{
+		    vars[nvars].ndims = nvdims;
+		    nvars++;
+		   } break;
+case 37:
+# line 212 "ncgen.y"
+{
+		    if (nvdims >= MAX_VAR_DIMS) {
+		       derror("%s has too many dimensions",vars[nvars].name);
+		    }
+		    if (yypvt[-0]->is_dim == 1)
+		       dimnum = yypvt[-0]->dnum;
+		    else {
+		       derror( "%s is not declared as a dimension",
+			       yypvt[-0]->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 38:
+# line 231 "ncgen.y"
+{
+		       valnum = 0;
+		       valtype = NC_UNSPECIFIED;
+		       /* get a large block for attributes, realloc later */
+		       att_space = emalloc(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 = (long *) att_space;
+		       float_valp = (float *) att_space;
+		       double_valp = (double *) att_space;
+		   } break;
+case 39:
+# line 245 "ncgen.y"
+{
+		       if (natts >= MAX_NC_ATTS)
+			 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 41:
+# line 264 "ncgen.y"
+{
+		    varnum = -1;  /* handle of "global" attribute */
+		   } break;
+case 42:
+# line 270 "ncgen.y"
+{ if (yypvt[-0]->is_var == 1)
+		       varnum = yypvt[-0]->vnum;
+		    else {
+		      derror("%s not declared as a variable, fatal error",
+			     yypvt[-0]->name);
+		      YYABORT;
+		      }
+		   } break;
+case 43:
+# line 280 "ncgen.y"
+{
+		       atts[natts].name = (char *) emalloc(strlen(yypvt[-0]->name)+1);
+		       (void) strcpy(atts[natts].name,yypvt[-0]->name);
+		   } break;
+case 46:
+# line 289 "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 47:
+# line 298 "ncgen.y"
+{
+		       atype_code = NC_CHAR;
+		       *char_valp++ = char_val;
+		       valnum++;
+		   } break;
+case 48:
+# line 304 "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 49:
+# line 315 "ncgen.y"
+{
+		       atype_code = NC_BYTE;
+		       *byte_valp++ = byte_val;
+		       valnum++;
+		   } break;
+case 50:
+# line 321 "ncgen.y"
+{
+		       atype_code = NC_SHORT;
+		       *short_valp++ = short_val;
+		       valnum++;
+		   } break;
+case 51:
+# line 327 "ncgen.y"
+{
+		       atype_code = NC_LONG;
+		       *long_valp++ = long_val;
+		       valnum++;
+		   } break;
+case 52:
+# line 333 "ncgen.y"
+{
+		       atype_code = NC_FLOAT;
+		       *float_valp++ = float_val;
+		       valnum++;
+		   } break;
+case 53:
+# line 339 "ncgen.y"
+{
+		       atype_code = NC_DOUBLE;
+		       *double_valp++ = double_val;
+		       valnum++;
+		   } break;
+case 58:
+# line 354 "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 = (long *) rec_start;
+			   break;
+			 case NC_FLOAT:
+			   float_valp = (float *) rec_start;
+			   break;
+			 case NC_DOUBLE:
+			   double_valp = (double *) rec_start;
+			   break;
+		       }
+		 } break;
+case 59:
+# line 403 "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 62:
+# line 420 "ncgen.y"
+{
+		       if(valnum >= var_len) {
+			   derror("too many values for this variable");
+			   exit (4);
+		       }
+		       not_a_string = 1;
+                   } break;
+case 63:
+# line 428 "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 = (long *) rec_start;
+				   break;
+				 case NC_FLOAT:
+				   float_valp = (float *) rec_start;
+				   break;
+				 case NC_DOUBLE:
+				   double_valp = (double *) rec_start;
+				   break;
+			       }
+			   }
+		       }
+		 } break;
+case 64:
+# line 487 "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 65:
+# line 512 "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 66:
+# line 545 "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 67:
+# line 570 "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 68:
+# line 595 "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 69:
+# line 620 "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 70:
+# line 645 "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;
+	}
+	goto yystack;		/* reset registers in driver code */
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msofttab.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msofttab.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msofttab.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,19 @@
+# define NC_UNLIMITED_K 257
+# define BYTE_K 258
+# define CHAR_K 259
+# define SHORT_K 260
+# define LONG_K 261
+# define FLOAT_K 262
+# define DOUBLE_K 263
+# define IDENT 264
+# define TERMSTRING 265
+# define BYTE_CONST 266
+# define CHAR_CONST 267
+# define SHORT_CONST 268
+# define LONG_CONST 269
+# define FLOAT_CONST 270
+# define DOUBLE_CONST 271
+# define DIMENSIONS 272
+# define VARIABLES 273
+# define NETCDF 274
+# define DATA 275

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msoftyy.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msoftyy.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/msoftyy.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1842 @@
+# include <stdio.h>
+# define U(x) x
+# define NLSTATE yyprevious=YYNEWLINE
+# define BEGIN yybgin = yysvec + 1 +
+# define INITIAL 0
+# define YYLERR yysvec
+# define YYSTATE (yyestate-yysvec-1)
+# define YYOPTIM 1
+# define YYLMAX 200
+# define output(c) (void)putc(c,yyout)
+#if defined(__cplusplus) || defined(__STDC__)
+#if defined(__cplusplus) && defined(__EXTERN_C__)
+extern "C" {
+#endif
+	int yyback(int *, int);
+	int yyinput(void);
+	int yylook(void);
+	void yyoutput(int);
+	int yyracc(int);
+	int yyreject(void);
+	void yyunput(int);
+	int yylex(void);
+#ifndef yyless
+	void yyless(int);
+#endif
+#ifndef yywrap
+	int yywrap(void);
+#endif
+#ifdef LEXDEBUG
+	void allprint(char);
+	void sprint(char *);
+#endif
+#if defined(__cplusplus) && defined(__EXTERN_C__)
+}
+#endif
+#endif
+# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
+# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
+# define yymore() (yymorfg=1)
+# define ECHO (void)fprintf(yyout, "%s",yytext)
+# define REJECT { nstr = yyreject(); goto yyfussy;}
+int yyleng; extern char yytext[];
+int yymorfg;
+extern char *yysptr, yysbuf[];
+int yytchar;
+FILE *yyin = {stdin}, *yyout = {stdout};
+extern int yylineno;
+struct yysvf { 
+	struct yywork *yystoff;
+	struct yysvf *yyother;
+	int *yystops;};
+struct yysvf *yyestate;
+extern struct yysvf yysvec[], *yybgin;
+
+# line 3 "ncgen.l"
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: msoftyy.c,v 1.4 1996/03/26 22:39:38 georgev Exp $
+ *********************************************************************/
+
+#define	STREQ(a, b)	(*(a) == *(b) && strcmp((a), (b)) == 0)
+
+
+# line 11 "ncgen.l"
+/* 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 "msofttab.h"
+# define YYNEWLINE 10
+yylex(){
+int nstr; extern int yyprevious;
+while((nstr = yylook()) >= 0)
+yyfussy: switch(nstr){
+case 0:
+if(yywrap()) return(0); break;
+case 1:
+
+# line 26 "ncgen.l"
+	/* comment */ ;
+break;
+case 2:
+
+# line 28 "ncgen.l"
+	{
+			 if(yyleng > MAXTRST) {
+				yyerror("string too long, truncated\n");
+			        yytext[MAXTRST-1] = '\0';
+			 }
+			 expand_escapes(termstring,yytext,yyleng);
+		 	 return (TERMSTRING);
+		        }
+break;
+case 3:
+
+# line 37 "ncgen.l"
+{return (FLOAT_K);}
+break;
+case 4:
+
+# line 38 "ncgen.l"
+	{return (CHAR_K);}
+break;
+case 5:
+
+# line 39 "ncgen.l"
+	{return (BYTE_K);}
+break;
+case 6:
+
+# line 40 "ncgen.l"
+	{return (SHORT_K);}
+break;
+case 7:
+
+# line 41 "ncgen.l"
+{return (LONG_K);}
+break;
+case 8:
+
+# line 42 "ncgen.l"
+	{return (DOUBLE_K);}
+break;
+case 9:
+
+# line 43 "ncgen.l"
+{long_val = -1;
+			 return (NC_UNLIMITED_K);}
+break;
+case 10:
+
+# line 46 "ncgen.l"
+{return (DIMENSIONS);}
+break;
+case 11:
+
+# line 47 "ncgen.l"
+{return (VARIABLES);}
+break;
+case 12:
+
+# line 48 "ncgen.l"
+	{return (DATA);}
+break;
+case 13:
+
+# line 49 "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);
+		}
+break;
+case 14:
+
+# line 63 "ncgen.l"
+{    /* double missing values */
+		double_val = FILL_DOUBLE;  /* IEEE double infinity */
+		return (DOUBLE_CONST);
+		}
+break;
+case 15:
+
+# line 68 "ncgen.l"
+{    /* float missing values */
+		float_val = FILL_FLOAT;  /* IEEE float infinity */
+		return (FLOAT_CONST);
+		}
+break;
+case 16:
+
+# line 72 "ncgen.l"
+{
+		if ((yylval = lookup(yytext)) == NULL) {
+			yylval = install(yytext);
+			}
+		return (IDENT);
+		}
+break;
+case 17:
+
+# line 79 "ncgen.l"
+	{
+		lineno++ ;
+		}
+break;
+case 18:
+
+# line 82 "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);
+                }
+break;
+case 19:
+
+# line 89 "ncgen.l"
+{
+		if (sscanf((char*)yytext, "%e", &float_val) != 1) {
+		    sprintf(errstr,"bad float constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+                return (FLOAT_CONST);
+                }
+break;
+case 20:
+
+# line 96 "ncgen.l"
+{
+		if (sscanf((char*)yytext, "%hd", &short_val) != 1) {
+		    sprintf(errstr,"bad short constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		return (SHORT_CONST);
+	        }
+break;
+case 21:
+
+# line 103 "ncgen.l"
+{
+#ifdef cray	/* machines where longs have more precision than doubles. */
+    		char *ptr;
+		long_val = strtol((char*)yytext, &ptr, 0);
+		if (ptr == (char*)yytext) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		return (LONG_CONST);
+#else		/* 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;
+#ifdef VMS  /* work around bug in VMS strtol() */
+		if (STREQ((char*)yytext, "-2147483648")) {
+		    long_val = -2147483648;
+		    return (LONG_CONST);
+		}
+#endif /* VMS */
+		if (sscanf((char*)yytext, "%le", &dd) != 1) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		if (dd < LONG_MIN  ||  dd > LONG_MAX) {
+		    double_val = dd;
+		    return DOUBLE_CONST;
+		} else {
+		    long_val = dd;
+		    return LONG_CONST;
+		}
+#endif /* cray */
+	        }
+break;
+case 22:
+
+# line 138 "ncgen.l"
+{
+		long dd;
+#ifdef VMS  /* work around bug in VMS strtol() */
+		if (STREQ((char*)yytext, "-2147483648")) {
+		    long_val = -2147483648;
+		    return (LONG_CONST);
+		}
+#endif /* VMS */
+		if (sscanf((char*)yytext, "%li", &dd) != 1) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		long_val = dd;
+		return LONG_CONST;
+	        }
+break;
+case 23:
+
+# line 153 "ncgen.l"
+         {
+	        (void) sscanf((char*)&yytext[1],"%c",&byte_val);
+		return (BYTE_CONST);
+                }
+break;
+case 24:
+
+# line 157 "ncgen.l"
+ {
+		byte_val = strtol((char*)&yytext[2], (char **) 0, 8);
+		return (BYTE_CONST);
+                }
+break;
+case 25:
+
+# line 161 "ncgen.l"
+ {
+		byte_val = strtol((char*)&yytext[2], (char **) 0, 16);
+		return (BYTE_CONST);
+                }
+break;
+case 26:
+
+# line 165 "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 = '\?'; break;
+		  case '\'': byte_val = '\''; break;
+		  default: byte_val = (char)yytext[2];
+	           }
+		return (BYTE_CONST);
+                }
+break;
+case 27:
+
+# line 183 "ncgen.l"
+{/* whitespace */ ;
+		}
+break;
+case 28:
+
+# line 185 "ncgen.l"
+	return (yytext[0]) ;
+break;
+case -1:
+break;
+default:
+(void)fprintf(yyout,"bad switch yylook %d",nstr);
+} return(0); }
+/* end of yylex */
+int yyvstop[] = {
+0,
+
+28,
+0,
+
+27,
+28,
+0,
+
+17,
+0,
+
+28,
+0,
+
+28,
+0,
+
+28,
+0,
+
+28,
+0,
+
+18,
+28,
+0,
+
+28,
+0,
+
+21,
+28,
+0,
+
+21,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+16,
+28,
+0,
+
+27,
+0,
+
+2,
+0,
+
+18,
+0,
+
+21,
+0,
+
+18,
+0,
+
+19,
+0,
+
+1,
+0,
+
+22,
+0,
+
+22,
+0,
+
+22,
+0,
+
+21,
+0,
+
+20,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+18,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+2,
+0,
+
+23,
+0,
+
+18,
+0,
+
+18,
+0,
+
+22,
+0,
+
+18,
+22,
+0,
+
+22,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+18,
+0,
+
+16,
+19,
+0,
+
+16,
+0,
+
+16,
+0,
+
+7,
+16,
+0,
+
+15,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+14,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+7,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+26,
+0,
+
+24,
+26,
+0,
+
+14,
+0,
+
+18,
+22,
+0,
+
+19,
+22,
+0,
+
+18,
+22,
+0,
+
+5,
+16,
+0,
+
+4,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+7,
+16,
+0,
+
+16,
+0,
+
+3,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+24,
+0,
+
+25,
+0,
+
+12,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+6,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+8,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+13,
+0,
+
+13,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+15,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+9,
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+16,
+0,
+
+11,
+0,
+
+16,
+0,
+
+10,
+0,
+0};
+# define YYTYPE unsigned char
+struct yywork { YYTYPE verify, advance; } yycrank[] = {
+0,0,	0,0,	1,3,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	1,4,	1,5,	
+0,0,	4,38,	0,0,	0,0,	
+4,38,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	1,6,	
+4,38,	41,93,	0,0,	0,0,	
+1,7,	42,94,	95,137,	0,0,	
+1,8,	0,0,	1,9,	1,10,	
+1,11,	1,12,	1,13,	11,52,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	1,13,	0,0,	0,0,	
+13,46,	0,0,	0,0,	0,0,	
+0,0,	0,0,	1,14,	1,15,	
+1,16,	1,17,	1,18,	1,19,	
+1,14,	23,76,	1,20,	16,61,	
+22,74,	1,21,	19,69,	1,22,	
+9,48,	21,73,	17,62,	1,23,	
+1,24,	20,71,	1,25,	1,26,	
+13,56,	1,14,	17,63,	15,60,	
+24,77,	1,3,	25,78,	13,57,	
+17,64,	26,79,	60,105,	1,27,	
+1,28,	1,29,	37,92,	1,30,	
+22,75,	2,7,	1,31,	28,81,	
+33,88,	1,32,	19,70,	1,33,	
+2,10,	2,11,	30,85,	1,34,	
+1,35,	20,72,	1,36,	1,37,	
+13,56,	29,82,	31,86,	27,80,	
+1,3,	32,87,	34,89,	13,57,	
+17,65,	29,83,	35,90,	36,91,	
+2,15,	2,16,	48,99,	29,84,	
+61,106,	62,107,	63,108,	2,20,	
+64,109,	65,110,	69,113,	70,114,	
+2,22,	6,39,	71,115,	72,116,	
+2,23,	73,117,	74,118,	2,25,	
+2,26,	6,39,	6,39,	75,119,	
+76,120,	77,121,	78,122,	79,123,	
+80,124,	81,125,	46,46,	82,126,	
+2,27,	2,28,	2,29,	83,127,	
+2,30,	84,128,	85,129,	2,31,	
+86,130,	87,131,	2,32,	88,132,	
+2,33,	89,133,	6,40,	90,134,	
+2,34,	2,35,	91,135,	2,36,	
+2,37,	92,136,	7,42,	6,39,	
+99,141,	6,39,	46,56,	105,145,	
+6,39,	6,39,	7,42,	7,42,	
+106,146,	46,57,	107,147,	104,102,	
+6,39,	108,148,	109,149,	98,49,	
+110,150,	98,51,	104,57,	113,151,	
+101,49,	6,39,	101,51,	98,49,	
+6,39,	6,39,	6,39,	6,39,	
+101,49,	114,152,	115,153,	7,42,	
+6,39,	116,154,	46,56,	117,155,	
+118,156,	120,157,	121,158,	6,39,	
+7,42,	46,57,	7,42,	104,102,	
+6,39,	7,42,	7,42,	98,49,	
+6,41,	98,51,	104,57,	122,159,	
+101,49,	7,42,	101,51,	98,49,	
+123,160,	124,145,	125,146,	126,161,	
+101,49,	127,162,	7,42,	128,163,	
+129,164,	7,42,	7,42,	7,42,	
+7,42,	130,165,	131,155,	133,157,	
+134,168,	7,42,	135,169,	136,170,	
+147,175,	148,176,	149,177,	6,39,	
+7,42,	132,166,	150,178,	151,157,	
+152,179,	7,42,	153,180,	154,181,	
+8,44,	7,43,	8,45,	8,46,	
+8,46,	8,46,	8,46,	8,46,	
+8,46,	8,46,	8,46,	8,46,	
+156,182,	10,44,	10,44,	10,44,	
+10,44,	10,44,	10,44,	10,44,	
+10,44,	10,44,	10,44,	8,47,	
+158,183,	132,167,	159,184,	160,185,	
+161,175,	162,186,	163,187,	164,157,	
+7,42,	10,49,	10,50,	10,51,	
+165,188,	166,189,	167,190,	168,183,	
+12,44,	10,49,	12,53,	12,53,	
+12,53,	12,53,	12,53,	12,53,	
+12,53,	12,53,	12,53,	12,53,	
+169,191,	170,192,	172,171,	8,47,	
+174,173,	176,193,	177,194,	12,54,	
+12,54,	12,54,	12,54,	12,55,	
+12,54,	10,49,	10,50,	10,51,	
+178,195,	179,196,	12,56,	180,197,	
+181,198,	10,49,	96,138,	182,199,	
+184,200,	12,57,	185,201,	186,202,	
+187,194,	188,203,	12,58,	96,139,	
+96,139,	96,139,	96,139,	96,139,	
+96,139,	96,139,	96,139,	12,54,	
+12,54,	12,54,	12,54,	12,55,	
+12,54,	189,199,	190,199,	191,204,	
+192,205,	193,206,	12,56,	195,207,	
+196,208,	197,155,	198,209,	200,212,	
+201,213,	12,57,	202,214,	203,155,	
+14,59,	204,215,	12,58,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	205,216,	206,217,	207,218,	
+208,219,	209,219,	211,0,	212,220,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	213,221,	214,222,	
+215,223,	216,224,	14,59,	217,225,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	14,59,	14,59,	
+14,59,	14,59,	18,66,	218,119,	
+18,67,	220,226,	221,227,	18,68,	
+18,68,	18,68,	18,68,	18,68,	
+18,68,	18,68,	18,68,	18,68,	
+18,68,	43,95,	222,228,	223,226,	
+224,229,	225,230,	227,231,	228,232,	
+229,231,	43,95,	43,0,	230,233,	
+45,45,	45,45,	45,45,	45,45,	
+45,45,	45,45,	45,45,	45,45,	
+45,45,	66,98,	66,98,	66,98,	
+66,98,	66,98,	66,98,	66,98,	
+66,98,	66,98,	66,98,	232,233,	
+0,0,	0,0,	43,95,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	43,95,	
+0,0,	43,95,	45,57,	0,0,	
+43,96,	43,96,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+43,95,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	43,95,	0,0,	0,0,	
+43,95,	43,95,	43,95,	43,95,	
+0,0,	0,0,	0,0,	0,0,	
+43,95,	0,0,	45,57,	0,0,	
+0,0,	0,0,	0,0,	43,95,	
+0,0,	0,0,	0,0,	0,0,	
+43,95,	47,66,	0,0,	47,66,	
+43,95,	0,0,	47,98,	47,98,	
+47,98,	47,98,	47,98,	47,98,	
+47,98,	47,98,	47,98,	47,98,	
+50,100,	0,0,	50,100,	0,0,	
+0,0,	50,101,	50,101,	50,101,	
+50,101,	50,101,	50,101,	50,101,	
+50,101,	50,101,	50,101,	52,52,	
+43,97,	0,0,	0,0,	43,95,	
+55,66,	0,0,	55,66,	52,52,	
+52,0,	55,103,	55,103,	55,103,	
+55,103,	55,103,	55,103,	55,103,	
+55,103,	55,103,	55,103,	67,68,	
+67,68,	67,68,	67,68,	67,68,	
+67,68,	67,68,	67,68,	67,68,	
+67,68,	0,0,	0,0,	0,0,	
+52,52,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	52,52,	0,0,	52,52,	
+0,0,	0,0,	52,52,	52,52,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	52,52,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	52,52,	
+0,0,	0,0,	52,52,	52,52,	
+52,52,	52,52,	0,0,	0,0,	
+0,0,	0,0,	52,52,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	52,52,	0,0,	0,0,	
+0,0,	0,0,	52,52,	0,0,	
+0,0,	53,44,	52,52,	53,53,	
+53,53,	53,53,	53,53,	53,53,	
+53,53,	53,53,	53,53,	53,53,	
+53,53,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+53,54,	53,54,	53,54,	53,54,	
+53,55,	53,54,	0,0,	0,0,	
+0,0,	0,0,	0,0,	53,102,	
+0,0,	52,52,	0,0,	0,0,	
+0,0,	0,0,	53,57,	100,101,	
+100,101,	100,101,	100,101,	100,101,	
+100,101,	100,101,	100,101,	100,101,	
+100,101,	0,0,	0,0,	0,0,	
+53,54,	53,54,	53,54,	53,54,	
+53,55,	53,54,	0,0,	0,0,	
+0,0,	0,0,	0,0,	53,102,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	53,57,	54,54,	
+54,54,	54,54,	54,54,	54,54,	
+54,54,	54,54,	54,54,	54,54,	
+54,54,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+54,54,	54,54,	54,54,	54,54,	
+54,54,	54,54,	139,171,	0,0,	
+0,0,	0,0,	0,0,	54,102,	
+0,0,	0,0,	0,0,	139,172,	
+139,172,	139,172,	139,172,	139,172,	
+139,172,	139,172,	139,172,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+54,54,	54,54,	54,54,	54,54,	
+54,54,	54,54,	0,0,	0,0,	
+0,0,	0,0,	0,0,	54,102,	
+58,104,	58,104,	58,104,	58,104,	
+58,104,	58,104,	58,104,	58,104,	
+58,104,	58,104,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	58,104,	58,104,	58,104,	
+58,104,	58,104,	58,104,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	68,68,	
+68,68,	68,68,	68,68,	68,68,	
+68,68,	68,68,	68,68,	68,68,	
+68,68,	0,0,	0,0,	0,0,	
+0,0,	58,104,	58,104,	58,104,	
+58,104,	58,104,	58,104,	68,111,	
+0,0,	68,112,	0,0,	0,0,	
+0,0,	0,0,	0,0,	68,111,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	68,111,	
+97,137,	68,112,	0,0,	0,0,	
+0,0,	0,0,	0,0,	68,111,	
+0,0,	97,140,	97,140,	97,140,	
+97,140,	97,140,	97,140,	97,140,	
+97,140,	97,140,	97,140,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	97,140,	97,140,	
+97,140,	97,140,	97,140,	97,140,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+103,103,	103,103,	103,103,	103,103,	
+103,103,	103,103,	103,103,	103,103,	
+103,103,	103,103,	0,0,	0,0,	
+0,0,	0,0,	97,140,	97,140,	
+97,140,	97,140,	97,140,	97,140,	
+103,142,	0,0,	103,143,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+103,144,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+103,142,	140,173,	103,143,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+103,144,	0,0,	140,174,	140,174,	
+140,174,	140,174,	140,174,	140,174,	
+140,174,	140,174,	140,174,	140,174,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	199,210,	0,0,	140,174,	
+140,174,	140,174,	140,174,	140,174,	
+140,174,	199,210,	199,210,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	199,210,	140,174,	
+140,174,	140,174,	140,174,	140,174,	
+140,174,	0,0,	0,0,	199,210,	
+0,0,	199,211,	0,0,	0,0,	
+199,211,	199,211,	0,0,	0,0,	
+0,0,	0,0,	0,0,	210,210,	
+199,211,	0,0,	210,210,	210,210,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	199,211,	210,210,	0,0,	
+199,211,	199,211,	199,211,	199,211,	
+0,0,	0,0,	0,0,	210,210,	
+199,211,	0,0,	210,210,	210,210,	
+210,210,	210,210,	0,0,	199,211,	
+0,0,	0,0,	210,210,	0,0,	
+199,211,	0,0,	0,0,	0,0,	
+199,210,	210,210,	0,0,	0,0,	
+0,0,	0,0,	210,210,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	199,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	0,0,	0,0,	0,0,	
+0,0,	210,0,	0,0,	0,0,	
+0,0};
+struct yysvf yysvec[] = {
+0,	0,	0,
+yycrank+-1,	0,		0,	
+yycrank+-66,	yysvec+1,	0,	
+yycrank+0,	0,		yyvstop+1,
+yycrank+4,	0,		yyvstop+3,
+yycrank+0,	0,		yyvstop+6,
+yycrank+-144,	0,		yyvstop+8,
+yycrank+-185,	0,		yyvstop+10,
+yycrank+230,	0,		yyvstop+12,
+yycrank+2,	yysvec+8,	yyvstop+14,
+yycrank+241,	0,		yyvstop+16,
+yycrank+4,	0,		yyvstop+19,
+yycrank+270,	0,		yyvstop+21,
+yycrank+12,	yysvec+8,	yyvstop+24,
+yycrank+343,	0,		yyvstop+27,
+yycrank+2,	yysvec+14,	yyvstop+30,
+yycrank+3,	yysvec+14,	yyvstop+33,
+yycrank+17,	yysvec+14,	yyvstop+36,
+yycrank+423,	yysvec+14,	yyvstop+39,
+yycrank+2,	yysvec+14,	yyvstop+42,
+yycrank+7,	yysvec+14,	yyvstop+45,
+yycrank+2,	yysvec+14,	yyvstop+48,
+yycrank+7,	yysvec+14,	yyvstop+51,
+yycrank+4,	yysvec+14,	yyvstop+54,
+yycrank+20,	yysvec+14,	yyvstop+57,
+yycrank+16,	yysvec+14,	yyvstop+60,
+yycrank+32,	yysvec+14,	yyvstop+63,
+yycrank+2,	yysvec+14,	yyvstop+66,
+yycrank+3,	yysvec+14,	yyvstop+69,
+yycrank+24,	yysvec+14,	yyvstop+72,
+yycrank+6,	yysvec+14,	yyvstop+75,
+yycrank+12,	yysvec+14,	yyvstop+78,
+yycrank+14,	yysvec+14,	yyvstop+81,
+yycrank+7,	yysvec+14,	yyvstop+84,
+yycrank+25,	yysvec+14,	yyvstop+87,
+yycrank+26,	yysvec+14,	yyvstop+90,
+yycrank+21,	yysvec+14,	yyvstop+93,
+yycrank+5,	yysvec+14,	yyvstop+96,
+yycrank+0,	yysvec+4,	yyvstop+99,
+yycrank+0,	yysvec+6,	0,	
+yycrank+0,	0,		yyvstop+101,
+yycrank+-3,	yysvec+6,	0,	
+yycrank+2,	0,		0,	
+yycrank+-480,	0,		0,	
+yycrank+0,	yysvec+10,	yyvstop+103,
+yycrank+443,	yysvec+8,	0,	
+yycrank+114,	yysvec+8,	yyvstop+105,
+yycrank+526,	0,		0,	
+yycrank+37,	0,		0,	
+yycrank+0,	0,		yyvstop+107,
+yycrank+541,	0,		0,	
+yycrank+0,	0,		yyvstop+109,
+yycrank+-598,	0,		yyvstop+111,
+yycrank+643,	0,		yyvstop+113,
+yycrank+711,	0,		yyvstop+115,
+yycrank+561,	yysvec+54,	yyvstop+117,
+yycrank+0,	0,		yyvstop+119,
+yycrank+0,	0,		yyvstop+121,
+yycrank+772,	0,		0,	
+yycrank+0,	yysvec+14,	yyvstop+123,
+yycrank+14,	yysvec+14,	yyvstop+125,
+yycrank+71,	yysvec+14,	yyvstop+127,
+yycrank+53,	yysvec+14,	yyvstop+129,
+yycrank+61,	yysvec+14,	yyvstop+131,
+yycrank+55,	yysvec+14,	yyvstop+133,
+yycrank+24,	yysvec+14,	yyvstop+135,
+yycrank+453,	0,		0,	
+yycrank+571,	yysvec+14,	yyvstop+137,
+yycrank+807,	yysvec+14,	yyvstop+139,
+yycrank+63,	yysvec+14,	yyvstop+142,
+yycrank+32,	yysvec+14,	yyvstop+144,
+yycrank+62,	yysvec+14,	yyvstop+146,
+yycrank+45,	yysvec+14,	yyvstop+148,
+yycrank+71,	yysvec+14,	yyvstop+150,
+yycrank+66,	yysvec+14,	yyvstop+152,
+yycrank+77,	yysvec+14,	yyvstop+154,
+yycrank+91,	yysvec+14,	yyvstop+156,
+yycrank+78,	yysvec+14,	yyvstop+158,
+yycrank+82,	yysvec+14,	yyvstop+160,
+yycrank+77,	yysvec+14,	yyvstop+162,
+yycrank+44,	yysvec+14,	yyvstop+164,
+yycrank+64,	yysvec+14,	yyvstop+166,
+yycrank+47,	yysvec+14,	yyvstop+168,
+yycrank+58,	yysvec+14,	yyvstop+170,
+yycrank+52,	yysvec+14,	yyvstop+172,
+yycrank+59,	yysvec+14,	yyvstop+174,
+yycrank+56,	yysvec+14,	yyvstop+176,
+yycrank+63,	yysvec+14,	yyvstop+178,
+yycrank+59,	yysvec+14,	yyvstop+180,
+yycrank+80,	yysvec+14,	yyvstop+182,
+yycrank+68,	yysvec+14,	yyvstop+184,
+yycrank+74,	yysvec+14,	yyvstop+186,
+yycrank+71,	yysvec+14,	yyvstop+188,
+yycrank+0,	yysvec+6,	yyvstop+190,
+yycrank+0,	0,		yyvstop+192,
+yycrank+3,	0,		0,	
+yycrank+311,	0,		0,	
+yycrank+869,	0,		0,	
+yycrank+135,	yysvec+66,	yyvstop+194,
+yycrank+110,	0,		0,	
+yycrank+679,	0,		0,	
+yycrank+140,	yysvec+100,	yyvstop+196,
+yycrank+0,	0,		yyvstop+198,
+yycrank+904,	yysvec+54,	yyvstop+200,
+yycrank+123,	yysvec+58,	yyvstop+203,
+yycrank+122,	yysvec+14,	yyvstop+205,
+yycrank+114,	yysvec+14,	yyvstop+207,
+yycrank+133,	yysvec+14,	yyvstop+209,
+yycrank+132,	yysvec+14,	yyvstop+211,
+yycrank+136,	yysvec+14,	yyvstop+213,
+yycrank+106,	yysvec+14,	yyvstop+215,
+yycrank+0,	yysvec+14,	yyvstop+217,
+yycrank+0,	yysvec+14,	yyvstop+220,
+yycrank+142,	yysvec+14,	yyvstop+223,
+yycrank+120,	yysvec+14,	yyvstop+225,
+yycrank+149,	yysvec+14,	yyvstop+227,
+yycrank+116,	yysvec+14,	yyvstop+230,
+yycrank+152,	yysvec+14,	yyvstop+233,
+yycrank+157,	yysvec+14,	yyvstop+235,
+yycrank+0,	yysvec+14,	yyvstop+237,
+yycrank+149,	yysvec+14,	yyvstop+240,
+yycrank+144,	yysvec+14,	yyvstop+242,
+yycrank+166,	yysvec+14,	yyvstop+244,
+yycrank+171,	yysvec+14,	yyvstop+246,
+yycrank+144,	yysvec+14,	yyvstop+248,
+yycrank+132,	yysvec+14,	yyvstop+250,
+yycrank+150,	yysvec+14,	yyvstop+252,
+yycrank+148,	yysvec+14,	yyvstop+254,
+yycrank+153,	yysvec+14,	yyvstop+256,
+yycrank+155,	yysvec+14,	yyvstop+258,
+yycrank+156,	yysvec+14,	yyvstop+260,
+yycrank+155,	yysvec+14,	yyvstop+263,
+yycrank+202,	yysvec+14,	yyvstop+265,
+yycrank+151,	yysvec+14,	yyvstop+267,
+yycrank+146,	yysvec+14,	yyvstop+269,
+yycrank+157,	yysvec+14,	yyvstop+271,
+yycrank+158,	yysvec+14,	yyvstop+273,
+yycrank+0,	0,		yyvstop+275,
+yycrank+0,	0,		yyvstop+277,
+yycrank+743,	0,		0,	
+yycrank+966,	0,		0,	
+yycrank+0,	0,		yyvstop+280,
+yycrank+0,	yysvec+54,	yyvstop+282,
+yycrank+0,	yysvec+54,	yyvstop+285,
+yycrank+0,	0,		yyvstop+288,
+yycrank+0,	yysvec+14,	yyvstop+291,
+yycrank+0,	yysvec+14,	yyvstop+294,
+yycrank+206,	yysvec+14,	yyvstop+297,
+yycrank+187,	yysvec+14,	yyvstop+299,
+yycrank+190,	yysvec+14,	yyvstop+301,
+yycrank+162,	yysvec+14,	yyvstop+303,
+yycrank+187,	yysvec+14,	yyvstop+305,
+yycrank+156,	yysvec+14,	yyvstop+307,
+yycrank+203,	yysvec+14,	yyvstop+309,
+yycrank+165,	yysvec+14,	yyvstop+311,
+yycrank+0,	yysvec+14,	yyvstop+313,
+yycrank+220,	yysvec+14,	yyvstop+316,
+yycrank+0,	yysvec+14,	yyvstop+318,
+yycrank+216,	yysvec+14,	yyvstop+321,
+yycrank+225,	yysvec+14,	yyvstop+323,
+yycrank+238,	yysvec+14,	yyvstop+325,
+yycrank+246,	yysvec+14,	yyvstop+327,
+yycrank+195,	yysvec+14,	yyvstop+329,
+yycrank+198,	yysvec+14,	yyvstop+331,
+yycrank+191,	yysvec+14,	yyvstop+333,
+yycrank+209,	yysvec+14,	yyvstop+335,
+yycrank+245,	yysvec+14,	yyvstop+337,
+yycrank+214,	yysvec+14,	yyvstop+339,
+yycrank+199,	yysvec+14,	yyvstop+341,
+yycrank+219,	yysvec+14,	yyvstop+343,
+yycrank+232,	yysvec+14,	yyvstop+345,
+yycrank+0,	0,		yyvstop+347,
+yycrank+291,	0,		0,	
+yycrank+0,	0,		yyvstop+349,
+yycrank+293,	0,		0,	
+yycrank+0,	0,		yyvstop+351,
+yycrank+250,	yysvec+14,	yyvstop+353,
+yycrank+265,	yysvec+14,	yyvstop+355,
+yycrank+243,	yysvec+14,	yyvstop+357,
+yycrank+272,	yysvec+14,	yyvstop+359,
+yycrank+278,	yysvec+14,	yyvstop+361,
+yycrank+243,	yysvec+14,	yyvstop+363,
+yycrank+281,	yysvec+14,	yyvstop+365,
+yycrank+0,	yysvec+14,	yyvstop+367,
+yycrank+279,	yysvec+14,	yyvstop+370,
+yycrank+288,	yysvec+14,	yyvstop+372,
+yycrank+240,	yysvec+14,	yyvstop+374,
+yycrank+255,	yysvec+14,	yyvstop+376,
+yycrank+256,	yysvec+14,	yyvstop+378,
+yycrank+303,	yysvec+14,	yyvstop+380,
+yycrank+272,	yysvec+14,	yyvstop+382,
+yycrank+270,	yysvec+14,	yyvstop+384,
+yycrank+278,	yysvec+14,	yyvstop+386,
+yycrank+304,	yysvec+14,	yyvstop+388,
+yycrank+0,	yysvec+14,	yyvstop+390,
+yycrank+306,	yysvec+14,	yyvstop+393,
+yycrank+270,	yysvec+14,	yyvstop+395,
+yycrank+299,	yysvec+14,	yyvstop+397,
+yycrank+266,	yysvec+14,	yyvstop+399,
+yycrank+-1028,	0,		yyvstop+401,
+yycrank+299,	yysvec+14,	yyvstop+403,
+yycrank+308,	yysvec+14,	yyvstop+405,
+yycrank+281,	yysvec+14,	yyvstop+407,
+yycrank+273,	yysvec+14,	yyvstop+409,
+yycrank+273,	yysvec+14,	yyvstop+411,
+yycrank+293,	yysvec+14,	yyvstop+413,
+yycrank+323,	yysvec+14,	yyvstop+415,
+yycrank+293,	yysvec+14,	yyvstop+417,
+yycrank+302,	yysvec+14,	yyvstop+419,
+yycrank+284,	yysvec+14,	yyvstop+421,
+yycrank+-1038,	yysvec+199,	yyvstop+423,
+yycrank+-283,	yysvec+199,	yyvstop+425,
+yycrank+338,	yysvec+14,	yyvstop+428,
+yycrank+365,	yysvec+14,	yyvstop+430,
+yycrank+324,	yysvec+14,	yyvstop+432,
+yycrank+335,	yysvec+14,	yyvstop+434,
+yycrank+336,	yysvec+14,	yyvstop+436,
+yycrank+361,	yysvec+14,	yyvstop+438,
+yycrank+365,	yysvec+14,	yyvstop+440,
+yycrank+0,	yysvec+14,	yyvstop+442,
+yycrank+401,	yysvec+14,	yyvstop+445,
+yycrank+387,	yysvec+14,	yyvstop+447,
+yycrank+372,	yysvec+14,	yyvstop+449,
+yycrank+383,	yysvec+14,	yyvstop+451,
+yycrank+369,	yysvec+14,	yyvstop+453,
+yycrank+402,	yysvec+14,	yyvstop+455,
+yycrank+0,	yysvec+14,	yyvstop+457,
+yycrank+428,	yysvec+14,	yyvstop+460,
+yycrank+372,	yysvec+14,	yyvstop+462,
+yycrank+430,	yysvec+14,	yyvstop+464,
+yycrank+433,	yysvec+14,	yyvstop+466,
+yycrank+0,	0,		yyvstop+468,
+yycrank+453,	yysvec+14,	yyvstop+470,
+yycrank+0,	0,		yyvstop+472,
+0,	0,	0};
+struct yywork *yytop = yycrank+1161;
+struct yysvf *yybgin = yysvec+1;
+char yymatch[] = {
+00  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,011 ,012 ,01  ,011 ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+011 ,01  ,'"' ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,'+' ,01  ,'-' ,01  ,01  ,
+'0' ,'1' ,'1' ,'1' ,'1' ,'1' ,'1' ,'1' ,
+'8' ,'8' ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,'A' ,'A' ,'A' ,'D' ,'E' ,'F' ,'G' ,
+'G' ,'G' ,'G' ,'G' ,'L' ,'G' ,'G' ,'G' ,
+'G' ,'G' ,'G' ,'S' ,'G' ,'G' ,'G' ,'G' ,
+'X' ,'G' ,'G' ,01  ,0134,01  ,01  ,'G' ,
+01  ,'A' ,'A' ,'A' ,'D' ,'E' ,'F' ,'G' ,
+'G' ,'G' ,'G' ,'G' ,'L' ,'G' ,'G' ,'G' ,
+'G' ,'G' ,'G' ,'S' ,'G' ,'G' ,'G' ,'G' ,
+'X' ,'G' ,'G' ,'{' ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
+0};
+char yyextra[] = {
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0};
+/*	Copyright (c) 1989 AT&T	*/
+/*	  All Rights Reserved  	*/
+
+/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
+/*	The copyright notice above does not evidence any   	*/
+/*	actual or intended publication of such source code.	*/
+
+#ident "@(#)ncform 6.4 92/06/19 SMI"
+
+int yylineno =1;
+# define YYU(x) x
+# define NLSTATE yyprevious=YYNEWLINE
+char yytext[YYLMAX];
+struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
+char yysbuf[YYLMAX];
+char *yysptr = yysbuf;
+int *yyfnd;
+extern struct yysvf *yyestate;
+int yyprevious = YYNEWLINE;
+#if defined(__cplusplus) || defined(__STDC__)
+int yylook(void)
+#else
+yylook()
+#endif
+{
+	register struct yysvf *yystate, **lsp;
+	register struct yywork *yyt;
+	struct yysvf *yyz;
+	int yych, yyfirst;
+	struct yywork *yyr;
+# ifdef LEXDEBUG
+	int debug;
+# endif
+	char *yylastch;
+	/* start off machines */
+# ifdef LEXDEBUG
+	debug = 0;
+# endif
+	yyfirst=1;
+	if (!yymorfg)
+		yylastch = yytext;
+	else {
+		yymorfg=0;
+		yylastch = yytext+yyleng;
+		}
+	for(;;){
+		lsp = yylstate;
+		yyestate = yystate = yybgin;
+		if (yyprevious==YYNEWLINE) yystate++;
+		for (;;){
+# ifdef LEXDEBUG
+			if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
+# endif
+			yyt = yystate->yystoff;
+			if(yyt == yycrank && !yyfirst){  /* may not be any transitions */
+				yyz = yystate->yyother;
+				if(yyz == 0)break;
+				if(yyz->yystoff == yycrank)break;
+				}
+			*yylastch++ = yych = input();
+			if(yylastch > &yytext[YYLMAX]) {
+				fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+				exit(1);
+			}
+			yyfirst=0;
+		tryagain:
+# ifdef LEXDEBUG
+			if(debug){
+				fprintf(yyout,"char ");
+				allprint(yych);
+				putchar('\n');
+				}
+# endif
+			yyr = yyt;
+			if ( (int)yyt > (int)yycrank){
+				yyt = yyr + yych;
+				if (yyt <= yytop && yyt->verify+yysvec == yystate){
+					if(yyt->advance+yysvec == YYLERR)	/* error transitions */
+						{unput(*--yylastch);break;}
+					*lsp++ = yystate = yyt->advance+yysvec;
+					if(lsp > &yylstate[YYLMAX]) {
+						fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+						exit(1);
+					}
+					goto contin;
+					}
+				}
+# ifdef YYOPTIM
+			else if((int)yyt < (int)yycrank) {		/* r < yycrank */
+				yyt = yyr = yycrank+(yycrank-yyt);
+# ifdef LEXDEBUG
+				if(debug)fprintf(yyout,"compressed state\n");
+# endif
+				yyt = yyt + yych;
+				if(yyt <= yytop && yyt->verify+yysvec == yystate){
+					if(yyt->advance+yysvec == YYLERR)	/* error transitions */
+						{unput(*--yylastch);break;}
+					*lsp++ = yystate = yyt->advance+yysvec;
+					if(lsp > &yylstate[YYLMAX]) {
+						fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+						exit(1);
+					}
+					goto contin;
+					}
+				yyt = yyr + YYU(yymatch[yych]);
+# ifdef LEXDEBUG
+				if(debug){
+					fprintf(yyout,"try fall back character ");
+					allprint(YYU(yymatch[yych]));
+					putchar('\n');
+					}
+# endif
+				if(yyt <= yytop && yyt->verify+yysvec == yystate){
+					if(yyt->advance+yysvec == YYLERR)	/* error transition */
+						{unput(*--yylastch);break;}
+					*lsp++ = yystate = yyt->advance+yysvec;
+					if(lsp > &yylstate[YYLMAX]) {
+						fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+						exit(1);
+					}
+					goto contin;
+					}
+				}
+			if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
+# ifdef LEXDEBUG
+				if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
+# endif
+				goto tryagain;
+				}
+# endif
+			else
+				{unput(*--yylastch);break;}
+		contin:
+# ifdef LEXDEBUG
+			if(debug){
+				fprintf(yyout,"state %d char ",yystate-yysvec-1);
+				allprint(yych);
+				putchar('\n');
+				}
+# endif
+			;
+			}
+# ifdef LEXDEBUG
+		if(debug){
+			fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
+			allprint(yych);
+			putchar('\n');
+			}
+# endif
+		while (lsp-- > yylstate){
+			*yylastch-- = 0;
+			if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
+				yyolsp = lsp;
+				if(yyextra[*yyfnd]){		/* must backup */
+					while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
+						lsp--;
+						unput(*yylastch--);
+						}
+					}
+				yyprevious = YYU(*yylastch);
+				yylsp = lsp;
+				yyleng = yylastch-yytext+1;
+				yytext[yyleng] = 0;
+# ifdef LEXDEBUG
+				if(debug){
+					fprintf(yyout,"\nmatch ");
+					sprint(yytext);
+					fprintf(yyout," action %d\n",*yyfnd);
+					}
+# endif
+				return(*yyfnd++);
+				}
+			unput(*yylastch);
+			}
+		if (yytext[0] == 0  /* && feof(yyin) */)
+			{
+			yysptr=yysbuf;
+			return(0);
+			}
+		yyprevious = yytext[0] = input();
+		if (yyprevious>0)
+			output(yyprevious);
+		yylastch=yytext;
+# ifdef LEXDEBUG
+		if(debug)putchar('\n');
+# endif
+		}
+	}
+#if defined(__cplusplus) || defined(__STDC__)
+int yyback(int *p, int m)
+#else
+yyback(p, m)
+	int *p;
+#endif
+{
+	if (p==0) return(0);
+	while (*p) {
+		if (*p++ == m)
+			return(1);
+	}
+	return(0);
+}
+	/* the following are only used in the lex library */
+#if defined(__cplusplus) || defined(__STDC__)
+int yyinput(void)
+#else
+yyinput()
+#endif
+{
+	return(input());
+	}
+#if defined(__cplusplus) || defined(__STDC__)
+void yyoutput(int c)
+#else
+yyoutput(c)
+  int c; 
+#endif
+{
+	output(c);
+	}
+#if defined(__cplusplus) || defined(__STDC__)
+void yyunput(int c)
+#else
+yyunput(c)
+   int c; 
+#endif
+{
+	unput(c);
+	}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.1
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.1	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.1	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,361 @@
+.\" $Id: ncgen.1,v 1.2 1996/03/26 22:39:39 georgev Exp $
+.TH NCGEN 1 "$Date: 1996/03/26 22:39:39 $" "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.

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,53 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: ncgen.h,v 1.4 1996/06/28 23:33:28 acheng Exp $
+ *********************************************************************/
+
+#include "netcdf.h"
+#include "generic.h"		/* defines union generic */
+#ifdef VMS
+#include <stdlib.h>
+#endif
+#define MAX_NC_ATTSIZE    2000	/* max size in bytes of an attribute */
+#define MAX_NC_ATTS        500	/* max number of attributes in a netCDF */
+#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 */
+#define STREQ(a, b)     (*(a) == *(b) && strcmp((a), (b)) == 0)
+
+extern struct dims {			/* dimensions */
+    long size;
+    char *name;
+} dims[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[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[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[MAX_NC_ATTS];		/* should be a malloc'ed list, not an array */

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.l
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.l	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.l	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,202 @@
+%{
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: ncgen.l,v 1.10 2000/05/23 18:03:36 acheng Exp $
+ *********************************************************************/
+
+#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();
+
+#ifdef VMS
+#include <unixio.h>
+#include "ncgen.h"
+extern void yyerror();
+#endif
+#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]? {
+#if defined cray && ! defined (_CRAYMPP)
+		/* machines where longs have more precision than doubles. */
+    		char *ptr;
+		long_val = strtol((char*)yytext, &ptr, 0);
+		if (ptr == (char*)yytext) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		return (LONG_CONST);
+#else		
+		/* 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;
+#ifdef VMS  /* work around bug in VMS strtol() */
+		if (STREQ((char*)yytext, "-2147483648")) {
+		    long_val = -2147483648;
+		    return (LONG_CONST);
+		}
+#endif /* VMS */
+		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
+		if (dd < INT_MIN  ||  dd > INT_MAX) 
+#else
+#if defined (_CRAYMPP)
+		if (dd < -2147483648 || dd > 2147483647)
+#else
+		if (dd < LONG_MIN  ||  dd > LONG_MAX) 
+#endif
+#endif
+                {
+		    double_val = dd;
+		    return DOUBLE_CONST;
+		} else {
+		    long_val = dd;
+		    return LONG_CONST;
+		}
+#endif /* cray */
+	        }
+0[xX]?[0-9a-fA-F]+[lL]? {
+		long dd;
+#ifdef VMS  /* work around bug in VMS strtol() */
+		if (STREQ((char*)yytext, "-2147483648")) {
+		    long_val = -2147483648;
+		    return (LONG_CONST);
+		}
+#endif /* VMS */
+		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]) ;

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.lnk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.lnk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.lnk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+llibc7.lib oldnames.lib ncgen.lib \hdf\hdf\lib\df.lib ..\libsrc\netcdf.lib ..\xdr\xdr.lib

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,255 @@
+# 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 "ncgen.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)/ncgen.exe $(OUTDIR)/ncgen.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 "HDF" /D "NO_SYS_XDR_INC" /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 "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)/"ncgen.bsc" 
+
+$(OUTDIR)/ncgen.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/init.obj \
+	$(INTDIR)/generate.obj \
+	$(INTDIR)/main.obj \
+	$(INTDIR)/escapes.obj \
+	$(INTDIR)/load.obj \
+	$(INTDIR)/close.obj \
+	$(INTDIR)/genlib.obj \
+	$(INTDIR)/getfill.obj \
+	$(INTDIR)/msofttab.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 ..\util\win32utl.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 ..\util\win32utl.lib\
+ ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"ncgen.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"ncgen.exe" 
+
+$(OUTDIR)/ncgen.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)/ncgen.exe $(OUTDIR)/ncgen.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 "HDF" /D "NO_SYS_XDR_INC" /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\
+ "HDF" /D "NO_SYS_XDR_INC" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"ncgen.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)/"ncgen.bsc" 
+
+$(OUTDIR)/ncgen.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/init.obj \
+	$(INTDIR)/generate.obj \
+	$(INTDIR)/main.obj \
+	$(INTDIR)/escapes.obj \
+	$(INTDIR)/load.obj \
+	$(INTDIR)/close.obj \
+	$(INTDIR)/genlib.obj \
+	$(INTDIR)/getfill.obj \
+	$(INTDIR)/msofttab.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 ..\util\win32utl.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 ..\util\win32utl.lib\
+ ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"ncgen.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"ncgen.exe" 
+
+$(OUTDIR)/ncgen.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=.\ncgen.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\init.c
+
+$(INTDIR)/init.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\generate.c
+
+$(INTDIR)/generate.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\main.c
+
+$(INTDIR)/main.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\escapes.c
+
+$(INTDIR)/escapes.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\generic.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\load.c
+
+$(INTDIR)/load.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\close.c
+
+$(INTDIR)/close.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\genlib.c
+
+$(INTDIR)/genlib.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\genlib.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\getfill.c
+
+$(INTDIR)/getfill.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\msofttab.c
+
+$(INTDIR)/msofttab.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\msofttab.h
+# End Source File
+# End Group
+# End Project
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.opt
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.opt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.opt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+sys$share:vaxcrtl.exe/share

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.y
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.y	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/ncgen.y	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,740 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: ncgen.y,v 1.7 1997/11/05 19:40:51 koziol Exp $
+ *********************************************************************/
+
+/* yacc source for "ncgen", a netCDL parser and netCDF generator */
+
+%{
+#ifndef lint
+static char SccsId[] = "$Id: ncgen.y,v 1.7 1997/11/05 19:40:51 koziol Exp $";
+#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 > 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 >= 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 >= 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(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 >= MAX_NC_ATTS)
+			 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;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,82 @@
+$! Tests NCGEN on VMS.
+$
+$! Assumptions:
+$!   You are in the NCGEN source directory.
+$!   You have already made the NCGEN and NCDUMP executables from their
+$!   respective sources. 
+$
+$ ncgen == "$ sys$disk:[]ncgen.exe"
+$ ncdump == "$ sys$disk:[-.ncdump]ncdump.exe"
+$
+$! Test "-n" option of ncgen
+$
+$! Create test0.cdf from test0.cdl
+$ ncgen -n test0.cdl
+$
+$! Create test1.cdl from test0.cdf
+$ define/user sys$output test1.cdl
+$ ncdump -n test1 test0.cdf
+$
+$! Create test1.cdf from test1.cdl
+$ ncgen -n test1.cdl
+$
+$! Create test2.cdl from test1.cdf
+$ define/user sys$output test2.cdl
+$ ncdump -n test2 test1.cdf
+$
+$! Compare test1.cdl and test2.cdl.  They should be identical.
+$ difference test1.cdl test2.cdl	
+$
+$! Create test1.cdl
+$! Create test0.nc from test0.cdl
+$
+$ define/usrs sys$output test0.nc
+$ ncgen -b test0.cdl
+$ Create test1.cdf from test0.nc
+$ ncdump -n test1 test0.nc
+$
+$! Test "-c" option of ncgen
+$
+$! Create C program TEST0.C from test0.cdl
+$ define/user sys$output test0.c
+$ ncgen -c -o ctest0.cdf test0.cdl
+$
+$! Compile generated C program
+$ cc/include_dir=[--.include]/nodebug test0
+$ link /exe=test0 test0,[--.lib]mfhdf/lib,sys$input/opt
+	[--.hdf.src]df/lib,[--.hdf.jpeg]libjpeg.olb/lib, -
+        [--.hdf.zlib]libz.olb/lib, sys$library:vaxcrtl/lib
+$
+$! Run generated C program to create netCDF file ctest0.cdf
+$ run test0
+$
+$! Dump ctest0.cdf into CDL file ctest1.cdl
+$ define/user sys$output ctest1.cdl
+$ ncdump -n ctest1 ctest0.cdf
+$
+$! Compare test1.cdl and ctest1.cdl.  They should be identical.
+$ difference test1.cdl ctest1.cdl	
+$
+$! Test "-f" option of ncgen
+$
+$! Create FORTRAN program TEST0.FOR from test0.cdl
+$ define/user sys$output ftest0.for
+$ ncgen -f -o ftest0.cdf test0.cdl
+$
+$! Compile generated FORTRAN program
+$ copy [--.include]netcdf.inc netcdf.inc
+$ fortran/nodebug ftest0
+$ link /exe=ftest0 ftest0.obj,[--.lib]mfhdf/lib,sys$input/opt
+	[--.hdf.src]df/lib,[--.hdf.jpeg]libjpeg.olb/lib, -
+        [--.hdf.zlib]libz.olb/lib, sys$library:vaxcrtl/lib
+$
+$! Run generated FORTRAN program to create netCDF file ftest0.cdf
+$ run ftest0
+$
+$! Dump ftest0.cdf into CDL file ftest1.cdl
+$ define/user sys$output ftest1.cdl
+$ ncdump -n ftest1 ftest0.cdf
+$
+$! Compare test1.cdl and ftest1.cdl.  They should be identical.
+$ difference test1.cdl ftest1.cdl	
+$

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test0.cdl
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test0.cdl	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test0.cdl	2007-05-14 09:41:34 UTC (rev 808)
@@ -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;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test0.lnk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test0.lnk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/test0.lnk	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+llibc7.lib oldnames.lib ncgen.lib \hdf\hdf\lib\df.lib ..\libsrc\netcdf.lib ..\xdr\xdr.lib
\ No newline at end of file

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vms_yy.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vms_yy.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vms_yy.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1407 @@
+/* A lexical scanner generated by flex */
+
+/* scanner skeleton version:
+ * $Id: vms_yy.c,v 1.2 1996/03/26 22:39:41 georgev Exp $
+ */
+
+#define FLEX_SCANNER
+
+#include <stdio.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+#include <osfcn.h>
+
+/* use prototypes in function declarations */
+#define YY_USE_PROTOS
+
+/* the "const" storage-class-modifier is valid */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+#ifdef __STDC__
+
+#ifdef __GNUC__
+#include <stddef.h>
+void *malloc( size_t );
+void free( void* );
+#else
+#include <stdlib.h>
+#endif	/* __GNUC__ */
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif	/* __STDC__ */
+#endif	/* ! __cplusplus */
+
+
+#ifdef __TURBOC__
+#define YY_USE_CONST
+#endif
+
+
+#ifndef YY_USE_CONST
+#define const
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+/* we can't get here if it's an ANSI C compiler, or a C++ compiler,
+ * so it's got to be a K&R compiler, and therefore there's no standard
+ * place from which to include these definitions
+ */
+int read();
+#endif
+
+
+/* amount of stuff to slurp up with each read */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* returned upon end-of-file */
+#define YY_END_TOK 0
+
+/* copy whatever the last rule matched to the standard output */
+
+/* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
+/* this used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite()
+ */
+#define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
+
+/* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#define YY_INPUT(buf,result,max_size) \
+	if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
+	    YY_FATAL_ERROR( "read() in flex scanner failed" );
+#define YY_NULL 0
+
+/* 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.
+ */
+#define yyterminate() return ( YY_NULL )
+
+/* report a fatal error */
+
+/* The funky do-while is used to turn this macro definition into
+ * a single C statement (which needs a semi-colon terminator).
+ * This avoids problems with code like:
+ *
+ * 	if ( something_happens )
+ *		YY_FATAL_ERROR( "oops, the something happened" );
+ *	else
+ *		everything_okay();
+ *
+ * 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 YY_FATAL_ERROR() call.
+ */
+
+#define YY_FATAL_ERROR(msg) \
+	do \
+		{ \
+		(void) fputs( msg, stderr ); \
+		(void) putc( '\n', stderr ); \
+		exit( 1 ); \
+		} \
+	while ( 0 )
+
+/* default yywrap function - always treat EOF as an EOF */
+#define yywrap() 1
+
+/* 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 *
+
+/* 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 \
+	do \
+		{ \
+		yy_init_buffer( yy_current_buffer, yyin ); \
+		yy_load_buffer_state(); \
+		} \
+	while ( 0 )
+
+/* default declaration of generated scanner - a define so the user can
+ * easily add parameters
+ */
+#define YY_DECL int yylex YY_PROTO(( void )) 
+
+/* code executed at the end of each rule */
+#define YY_BREAK break;
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
+#endif
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+#define YY_CHAR char
+# line 1 "ncgen.l"
+#define INITIAL 0
+# line 2 "ncgen.l"
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vms_yy.c,v 1.2 1996/03/26 22:39:41 georgev Exp $
+ *********************************************************************/
+
+#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 25 "ncgen.l"
+
+/* done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext
+ */
+#define YY_DO_BEFORE_ACTION \
+	yytext = yy_bp; \
+	yyleng = yy_cp - yy_bp; \
+	yy_hold_char = *yy_cp; \
+	*yy_cp = '\0'; \
+	yy_c_buf_p = yy_cp;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* 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_c_buf_p = yy_cp = yy_bp + n; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, yytext )
+
+
+struct yy_buffer_state
+    {
+    FILE *yy_input_file;
+
+    YY_CHAR *yy_ch_buf;		/* input buffer */
+    YY_CHAR *yy_buf_pos;	/* current position in input buffer */
+
+    /* size of input buffer in bytes, not including room for EOB characters*/
+    int yy_buf_size;	
+
+    /* number of characters read into yy_ch_buf, not including EOB characters */
+    int yy_n_chars;
+
+    int yy_eof_status;		/* whether we've seen an EOF on this buffer */
+#define EOF_NOT_SEEN 0
+    /* "pending" happens when the EOF has been seen but there's still
+     * some text process
+     */
+#define EOF_PENDING 1
+#define EOF_DONE 2
+    };
+
+static YY_BUFFER_STATE yy_current_buffer;
+
+/* 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 YY_CHAR yy_hold_char;
+
+static int yy_n_chars;		/* number of characters read into yy_ch_buf */
+
+
+
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+#ifndef YY_USER_INIT
+#define YY_USER_INIT
+#endif
+
+extern YY_CHAR *yytext;
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+YY_CHAR *yytext;
+int yyleng;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+#define YY_END_OF_BUFFER 30
+typedef int yy_state_type;
+static const 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 const YY_CHAR yy_ec[128] =
+    {   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
+    } ;
+
+static const YY_CHAR 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 const 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 const 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 const 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 const 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 YY_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
+
+/* these variables are all declared out here so that section 3 code can
+ * manipulate them
+ */
+/* points to current character in buffer */
+static YY_CHAR *yy_c_buf_p = (YY_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;
+
+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 yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
+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 ));
+
+#define yy_new_buffer yy_create_buffer
+
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+
+YY_DECL
+    {
+    register yy_state_type yy_current_state;
+    register YY_CHAR *yy_cp, *yy_bp;
+    register int yy_act;
+
+
+
+    if ( yy_init )
+	{
+	YY_USER_INIT;
+
+	if ( ! yy_start )
+	    yy_start = 1;	/* first start state */
+
+	if ( ! yyin )
+	    yyin = stdin;
+
+	if ( ! yyout )
+	    yyout = stdout;
+
+	if ( yy_current_buffer )
+	    yy_init_buffer( yy_current_buffer, yyin );
+	else
+	    yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+	yy_load_buffer_state();
+
+	yy_init = 0;
+	}
+
+    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_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 = yy_def[yy_current_state];
+		if ( yy_current_state >= 241 )
+		    yy_c = yy_meta[yy_c];
+		}
+	    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+	    ++yy_cp;
+	    }
+	while ( yy_current_state != 240 );
+	yy_cp = yy_last_accepting_cpos;
+	yy_current_state = yy_last_accepting_state;
+
+yy_find_action:
+	yy_act = yy_accept[yy_current_state];
+
+	YY_DO_BEFORE_ACTION;
+	YY_USER_ACTION;
+
+do_action:	/* this label is used only to access EOF actions */
+
+
+	switch ( yy_act )
+	    {
+	    case 0: /* must backtrack */
+	    /* 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:
+# line 26 "ncgen.l"
+/* comment */ ;
+	YY_BREAK
+case 2:
+# line 28 "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:
+# line 37 "ncgen.l"
+{return (FLOAT_K);}
+	YY_BREAK
+case 4:
+# line 38 "ncgen.l"
+{return (CHAR_K);}
+	YY_BREAK
+case 5:
+# line 39 "ncgen.l"
+{return (BYTE_K);}
+	YY_BREAK
+case 6:
+# line 40 "ncgen.l"
+{return (SHORT_K);}
+	YY_BREAK
+case 7:
+# line 41 "ncgen.l"
+{return (LONG_K);}
+	YY_BREAK
+case 8:
+# line 42 "ncgen.l"
+{return (DOUBLE_K);}
+	YY_BREAK
+case 9:
+# line 43 "ncgen.l"
+{long_val = -1;
+			 return (NC_UNLIMITED_K);}
+	YY_BREAK
+case 10:
+# line 46 "ncgen.l"
+{return (DIMENSIONS);}
+	YY_BREAK
+case 11:
+# line 47 "ncgen.l"
+{return (VARIABLES);}
+	YY_BREAK
+case 12:
+# line 48 "ncgen.l"
+{return (DATA);}
+	YY_BREAK
+case 13:
+# line 49 "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:
+# line 63 "ncgen.l"
+{    /* double missing values */
+		double_val = FILL_DOUBLE;  /* IEEE double infinity */
+		return (DOUBLE_CONST);
+		}
+	YY_BREAK
+case 15:
+# line 68 "ncgen.l"
+{    /* float missing values */
+		float_val = FILL_FLOAT;  /* IEEE float infinity */
+		return (FLOAT_CONST);
+		}
+	YY_BREAK
+case 16:
+# line 72 "ncgen.l"
+{
+		if ((yylval = lookup(yytext)) == NULL) {
+			yylval = install(yytext);
+			}
+		return (IDENT);
+		}
+	YY_BREAK
+case 17:
+# line 79 "ncgen.l"
+{
+		lineno++ ;
+		}
+	YY_BREAK
+case 18:
+# line 82 "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:
+# line 89 "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:
+# line 96 "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:
+# line 103 "ncgen.l"
+{
+#ifdef cray	/* machines where longs have more precision than doubles. */
+    		char *ptr;
+		long_val = strtol((char*)yytext, &ptr, 0);
+		if (ptr == (char*)yytext) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		return (LONG_CONST);
+#else		/* 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;
+#ifdef VMS  /* work around bug in VMS strtol() */
+		if (STREQ((char*)yytext, "-2147483648")) {
+		    long_val = -2147483648;
+		    return (LONG_CONST);
+		}
+#endif /* VMS */
+		if (sscanf((char*)yytext, "%le", &dd) != 1) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		if (dd < LONG_MIN  ||  dd > LONG_MAX) {
+		    double_val = dd;
+		    return DOUBLE_CONST;
+		} else {
+		    long_val = dd;
+		    return LONG_CONST;
+		}
+#endif /* cray */
+	        }
+	YY_BREAK
+case 22:
+# line 138 "ncgen.l"
+{
+		long dd;
+#ifdef VMS  /* work around bug in VMS strtol() */
+		if (STREQ((char*)yytext, "-2147483648")) {
+		    long_val = -2147483648;
+		    return (LONG_CONST);
+		}
+#endif /* VMS */
+		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:
+# line 153 "ncgen.l"
+{
+	        (void) sscanf((char*)&yytext[1],"%c",&byte_val);
+		return (BYTE_CONST);
+                }
+	YY_BREAK
+case 24:
+# line 157 "ncgen.l"
+{
+		byte_val = strtol((char*)&yytext[2], (char **) 0, 8);
+		return (BYTE_CONST);
+                }
+	YY_BREAK
+case 25:
+# line 161 "ncgen.l"
+{
+		byte_val = strtol((char*)&yytext[2], (char **) 0, 16);
+		return (BYTE_CONST);
+                }
+	YY_BREAK
+case 26:
+# line 165 "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 = '\?'; break;
+		  case '\'': byte_val = '\''; break;
+		  default: byte_val = (char)yytext[2];
+	           }
+		return (BYTE_CONST);
+                }
+	YY_BREAK
+case 27:
+# line 183 "ncgen.l"
+{/* whitespace */ ;
+		}
+	YY_BREAK
+case 28:
+# line 185 "ncgen.l"
+return (yytext[0]) ;
+	YY_BREAK
+case 29:
+# line 186 "ncgen.l"
+ECHO;
+	YY_BREAK
+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 = yy_cp - yytext - 1;
+
+		/* undo the effects of YY_DO_BEFORE_ACTION */
+		*yy_cp = yy_hold_char;
+
+		/* 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 yyinput().
+		 */
+		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 + 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 + 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_last_accepting_cpos;
+			    yy_current_state = yy_last_accepting_state;
+			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 + YY_MORE_ADJ;
+
+			    yy_act = YY_STATE_EOF((yy_start - 1) / 2);
+			    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 + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state();
+
+			yy_cp = yy_c_buf_p;
+			yy_bp = yytext + 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 + YY_MORE_ADJ;
+			goto yy_find_action;
+		    }
+		break;
+		}
+
+	    default:
+#ifdef FLEX_DEBUG
+		printf( "action # %d\n", yy_act );
+#endif
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	    }
+	}
+    }
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * synopsis
+ *     int yy_get_next_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 YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
+    register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
+    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" );
+
+    /* try to read more data */
+
+    /* first move last chars to start of buffer */
+    number_to_move = yy_c_buf_p - yytext;
+
+    for ( i = 0; i < number_to_move; ++i )
+	*(dest++) = *(source++);
+
+    if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
+	/* don't do the read, it's not guaranteed to return an EOF,
+	 * just force an EOF
+	 */
+	yy_n_chars = 0;
+
+    else
+	{
+	int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+	if ( num_to_read > YY_READ_BUF_SIZE )
+	    num_to_read = YY_READ_BUF_SIZE;
+
+	else if ( num_to_read <= 0 )
+	    YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
+
+	/* read in more data */
+	YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+		  yy_n_chars, num_to_read );
+	}
+
+    if ( yy_n_chars == 0 )
+	{
+	if ( number_to_move == 1 )
+	    {
+	    ret_val = EOB_ACT_END_OF_FILE;
+	    yy_current_buffer->yy_eof_status = EOF_DONE;
+	    }
+
+	else
+	    {
+	    ret_val = EOB_ACT_LAST_MATCH;
+	    yy_current_buffer->yy_eof_status = 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 begins at the second character in yy_ch_buf; the first
+     * character is the one which preceded it before reading in the latest
+     * buffer; it needs to be kept around in case it's a newline, so
+     * yy_get_previous_state() will have with '^' rules active
+     */
+
+    yytext = &yy_current_buffer->yy_ch_buf[1];
+
+    return ( ret_val );
+    }
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached
+ *
+ * synopsis
+ *     yy_state_type yy_get_previous_state();
+ */
+
+static yy_state_type yy_get_previous_state()
+
+    {
+    register yy_state_type yy_current_state;
+    register YY_CHAR *yy_cp;
+
+    yy_current_state = yy_start;
+
+    for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+	{
+	register YY_CHAR yy_c = (*yy_cp ? yy_ec[*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 = yy_def[yy_current_state];
+	    if ( yy_current_state >= 241 )
+		yy_c = yy_meta[yy_c];
+	    }
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + 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( register yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+register yy_state_type yy_current_state;
+#endif
+
+    {
+    register int yy_is_jam;
+    register YY_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 = yy_def[yy_current_state];
+	if ( yy_current_state >= 241 )
+	    yy_c = yy_meta[yy_c];
+	}
+    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+    yy_is_jam = (yy_current_state == 240);
+
+    return ( yy_is_jam ? 0 : yy_current_state );
+    }
+
+
+#ifdef YY_USE_PROTOS
+static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+YY_CHAR c;
+register YY_CHAR *yy_bp;
+#endif
+
+    {
+    register YY_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 */
+	register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
+	register YY_CHAR *dest =
+	    &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
+	register YY_CHAR *source =
+	    &yy_current_buffer->yy_ch_buf[number_to_move];
+
+	while ( source > yy_current_buffer->yy_ch_buf )
+	    *--dest = *--source;
+
+	yy_cp += dest - source;
+	yy_bp += dest - source;
+	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" );
+	}
+
+    if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
+	yy_cp[-2] = '\n';
+
+    *--yy_cp = c;
+
+    /* note: the formal parameter *must* be called "yy_bp" for this
+     *       macro to now work correctly
+     */
+    YY_DO_BEFORE_ACTION; /* set up yytext again */
+    }
+
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+
+    {
+    int c;
+    YY_CHAR *yy_cp = yy_c_buf_p;
+
+    *yy_cp = 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 */
+	    yytext = yy_c_buf_p;
+	    ++yy_c_buf_p;
+
+	    switch ( yy_get_next_buffer() )
+		{
+		case EOB_ACT_END_OF_FILE:
+		    {
+		    if ( yywrap() )
+			{
+			yy_c_buf_p = yytext + YY_MORE_ADJ;
+			return ( EOF );
+			}
+
+		    YY_NEW_FILE;
+
+#ifdef __cplusplus
+		    return ( yyinput() );
+#else
+		    return ( input() );
+#endif
+		    }
+		    break;
+
+		case EOB_ACT_CONTINUE_SCAN:
+		    yy_c_buf_p = yytext + YY_MORE_ADJ;
+		    break;
+
+		case EOB_ACT_LAST_MATCH:
+#ifdef __cplusplus
+		    YY_FATAL_ERROR( "unexpected last match in yyinput()" );
+#else
+		    YY_FATAL_ERROR( "unexpected last match in input()" );
+#endif
+		}
+	    }
+	}
+
+    c = *yy_c_buf_p;
+    yy_hold_char = *++yy_c_buf_p;
+
+    return ( c );
+    }
+
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+
+    {
+    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 = 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) malloc( 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 = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
+
+    if ( ! b->yy_ch_buf )
+	YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+    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 == yy_current_buffer )
+	yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+    free( (char *) b->yy_ch_buf );
+    free( (char *) 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
+
+    {
+    b->yy_input_file = file;
+
+    /* we put in the '\n' and start reading from [1] so that an
+     * initial match-at-newline will be true.
+     */
+
+    b->yy_ch_buf[0] = '\n';
+    b->yy_n_chars = 1;
+
+    /* 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[1] = YY_END_OF_BUFFER_CHAR;
+    b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
+
+    b->yy_buf_pos = &b->yy_ch_buf[1];
+
+    b->yy_eof_status = EOF_NOT_SEEN;
+    }
+# line 186 "ncgen.l"

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vmstab.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vmstab.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vmstab.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1342 @@
+
+# line 10 "ncgen.y"
+#ifndef lint
+static char SccsId[] = "$Id: vmstab.c,v 1.3 1997/11/05 19:40:53 koziol Exp $";
+#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 */
+
+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 long 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 long *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 */
+# define NC_UNLIMITED_K 257
+# define BYTE_K 258
+# define CHAR_K 259
+# define SHORT_K 260
+# define LONG_K 261
+# define FLOAT_K 262
+# define DOUBLE_K 263
+# define IDENT 264
+# define TERMSTRING 265
+# define BYTE_CONST 266
+# define CHAR_CONST 267
+# define SHORT_CONST 268
+# define LONG_CONST 269
+# define FLOAT_CONST 270
+# define DOUBLE_CONST 271
+# define DIMENSIONS 272
+# define VARIABLES 273
+# define NETCDF 274
+# define DATA 275
+#define yyclearin yychar = -1
+#define yyerrok yyerrflag = 0
+extern int yychar;
+extern int yyerrflag;
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 150
+#endif
+#ifndef YYSTYPE
+#define YYSTYPE long
+#endif
+YYSTYPE yylval, yyval;
+typedef int yytabelem;
+# define YYERRCODE 256
+
+# line 676 "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);
+}
+
+
+/* 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;
+}
+yytabelem yyexca[] ={
+-1, 1,
+	0, -1,
+	-2, 0,
+	};
+# define YYNPROD 71
+# define YYLAST 225
+yytabelem yyact[]={
+
+    92,    93,    91,    94,    95,    96,    97,    71,    72,    70,
+    73,    74,    75,    76,    42,     2,    15,     6,    34,    40,
+    13,    36,    51,    52,     3,    84,    12,    68,    80,    78,
+    59,    39,    19,    18,    18,    77,    62,    56,    44,    35,
+    49,    46,    33,    86,    54,    50,    87,    89,    37,    17,
+    82,    57,    66,    22,    10,     9,    90,    85,    83,    63,
+    53,    69,    67,    48,    16,    47,    26,    79,    65,    58,
+    45,    25,    24,    38,    23,    43,    21,    11,     8,    41,
+    20,    14,     7,     5,     4,    55,     1,     0,     0,     0,
+     0,     0,     0,    81,     0,    60,    55,    47,    61,    64,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+    88,     0,     0,     0,    81,    99,    98,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,    27,    28,
+    29,    30,    31,    32,    36 };
+yytabelem yypact[]={
+
+  -259, -1000,   -99, -1000,  -255, -1000,  -244,  -257,  -244,   -10,
+ -1000,   -29, -1000, -1000, -1000,   -40,   -11, -1000,  -244,  -238,
+  -261,   -40,   -21, -1000, -1000,  -243, -1000, -1000, -1000, -1000,
+ -1000, -1000, -1000,   -18,  -242, -1000, -1000, -1000, -1000, -1000,
+ -1000,  -102,  -243,   -22, -1000,     7, -1000, -1000,   -31,  -242,
+ -1000, -1000, -1000,  -243,   -23, -1000, -1000,  -243,    12,  -258,
+ -1000,   -24, -1000,   -32, -1000, -1000,  -244,     6, -1000, -1000,
+ -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,     2,
+ -1000, -1000,  -258,     3, -1000,  -265, -1000,  -244, -1000, -1000,
+ -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000 };
+yytabelem yypgo[]={
+
+     0,    86,    84,    83,    82,    81,    80,    79,    78,    55,
+    54,    77,    26,    76,    53,    74,    72,    71,    70,    41,
+    39,    69,    68,    67,    28,    66,    63,    62,    42,    45,
+    27,    61,    60,    44,    59,    58,    25,    57,    56 };
+yytabelem yyr1[]={
+
+     0,     2,     4,     6,     1,     3,     3,     8,     8,     9,
+     9,    10,    10,    11,    12,     5,     5,    13,    13,    14,
+    14,    15,    17,    17,    17,    17,    17,    17,    18,    18,
+    21,    19,    20,    22,    22,    23,    23,    24,    26,    16,
+    25,    25,    28,    29,    27,    27,    30,    31,    31,    31,
+    31,    31,    31,    31,     7,     7,    32,    32,    34,    33,
+    35,    35,    37,    36,    38,    38,    38,    38,    38,    38,
+    38 };
+yytabelem yyr2[]={
+
+     0,     1,     1,     1,    19,     0,     4,     4,     6,     2,
+     6,     7,     7,     3,     2,     0,     4,     4,     6,     2,
+     2,     4,     3,     3,     3,     3,     3,     3,     2,     6,
+     1,     7,     2,     0,     6,     2,     6,     3,     1,     9,
+     6,     5,     3,     3,     2,     6,     3,     3,     3,     3,
+     3,     3,     3,     3,     0,     4,     4,     6,     1,     9,
+     2,     6,     1,     5,     3,     3,     3,     3,     3,     3,
+     3 };
+yytabelem yychk[]={
+
+ -1000,    -1,   274,   123,    -2,    -3,   272,    -4,    -8,    -9,
+   -10,   -11,   -12,   264,    -5,   273,    -9,    59,    44,    61,
+    -6,   -13,   -14,   -15,   -16,   -17,   -25,   258,   259,   260,
+   261,   262,   263,   -28,    58,   -20,   264,    59,   -10,   269,
+   257,    -7,   275,   -14,    59,   -18,   -19,   -20,   -26,    58,
+   -29,   264,   125,   -32,   -33,   -28,    59,    44,   -21,    61,
+   -29,   -33,    59,   -34,   -19,   -22,    40,   -27,   -30,   -31,
+   267,   265,   266,   268,   269,   270,   271,    59,    61,   -23,
+   -24,   -12,    44,   -35,   -36,   -37,    41,    44,   -30,    44,
+   -38,   267,   265,   266,   268,   269,   270,   271,   -24,   -36 };
+yytabelem yydef[]={
+
+     0,    -2,     0,     1,     5,     2,     0,    15,     6,     0,
+     9,     0,    13,    14,     3,     0,     0,     7,     0,     0,
+    54,    16,     0,    19,    20,     0,    38,    22,    23,    24,
+    25,    26,    27,     0,     0,    42,    32,     8,    10,    11,
+    12,     0,     0,     0,    17,    21,    28,    30,     0,     0,
+    41,    43,     4,    55,     0,    58,    18,     0,    33,     0,
+    40,     0,    56,     0,    29,    31,     0,    39,    44,    46,
+    47,    48,    49,    50,    51,    52,    53,    57,    62,     0,
+    35,    37,     0,    59,    60,     0,    34,     0,    45,    62,
+    63,    64,    65,    66,    67,    68,    69,    70,    36,    61 };
+typedef struct { char *t_name; int t_val; } yytoktype;
+#ifndef YYDEBUG
+#	define YYDEBUG	0	/* don't allow debugging */
+#endif
+
+#if YYDEBUG
+
+yytoktype yytoks[] =
+{
+	"NC_UNLIMITED_K",	257,
+	"BYTE_K",	258,
+	"CHAR_K",	259,
+	"SHORT_K",	260,
+	"LONG_K",	261,
+	"FLOAT_K",	262,
+	"DOUBLE_K",	263,
+	"IDENT",	264,
+	"TERMSTRING",	265,
+	"BYTE_CONST",	266,
+	"CHAR_CONST",	267,
+	"SHORT_CONST",	268,
+	"LONG_CONST",	269,
+	"FLOAT_CONST",	270,
+	"DOUBLE_CONST",	271,
+	"DIMENSIONS",	272,
+	"VARIABLES",	273,
+	"NETCDF",	274,
+	"DATA",	275,
+	"-unknown-",	-1	/* ends search */
+};
+
+char * yyreds[] =
+{
+	"-no such reduction-",
+	"ncdesc : NETCDF '{'",
+	"ncdesc : NETCDF '{' dimsection",
+	"ncdesc : NETCDF '{' dimsection vasection",
+	"ncdesc : NETCDF '{' dimsection vasection datasection '}'",
+	"dimsection : /* empty */",
+	"dimsection : DIMENSIONS dimdecls",
+	"dimdecls : dimdecline ';'",
+	"dimdecls : dimdecls dimdecline ';'",
+	"dimdecline : dimdecl",
+	"dimdecline : dimdecline ',' dimdecl",
+	"dimdecl : dimd '=' LONG_CONST",
+	"dimdecl : dimd '=' NC_UNLIMITED_K",
+	"dimd : dim",
+	"dim : IDENT",
+	"vasection : /* empty */",
+	"vasection : VARIABLES vadecls",
+	"vadecls : vadecl ';'",
+	"vadecls : vadecls vadecl ';'",
+	"vadecl : vardecl",
+	"vadecl : attdecl",
+	"vardecl : type varlist",
+	"type : BYTE_K",
+	"type : CHAR_K",
+	"type : SHORT_K",
+	"type : LONG_K",
+	"type : FLOAT_K",
+	"type : DOUBLE_K",
+	"varlist : varspec",
+	"varlist : varlist ',' varspec",
+	"varspec : var",
+	"varspec : var dimspec",
+	"var : IDENT",
+	"dimspec : /* empty */",
+	"dimspec : '(' dimlist ')'",
+	"dimlist : vdim",
+	"dimlist : dimlist ',' vdim",
+	"vdim : dim",
+	"attdecl : att",
+	"attdecl : att '=' attvallist",
+	"att : avar ':' attr",
+	"att : ':' attr",
+	"avar : var",
+	"attr : IDENT",
+	"attvallist : aconst",
+	"attvallist : attvallist ',' aconst",
+	"aconst : attconst",
+	"attconst : CHAR_CONST",
+	"attconst : TERMSTRING",
+	"attconst : BYTE_CONST",
+	"attconst : SHORT_CONST",
+	"attconst : LONG_CONST",
+	"attconst : FLOAT_CONST",
+	"attconst : DOUBLE_CONST",
+	"datasection : /* empty */",
+	"datasection : DATA datadecls",
+	"datadecls : datadecl ';'",
+	"datadecls : datadecls datadecl ';'",
+	"datadecl : avar",
+	"datadecl : avar '=' constlist",
+	"constlist : dconst",
+	"constlist : constlist ',' dconst",
+	"dconst : /* empty */",
+	"dconst : const",
+	"const : CHAR_CONST",
+	"const : TERMSTRING",
+	"const : BYTE_CONST",
+	"const : SHORT_CONST",
+	"const : LONG_CONST",
+	"const : FLOAT_CONST",
+	"const : DOUBLE_CONST",
+};
+#endif /* YYDEBUG */
+/*
+ * (c) Copyright 1990, OPEN SOFTWARE FOUNDATION, INC.
+ * ALL RIGHTS RESERVED
+ */
+/*
+ * OSF/1 Release 1.0
+ */
+/* @(#)yaccpar	1.3  com/cmd/lang/yacc,3.1, 9/7/89 18:46:37 */
+/*
+** Skeleton parser driver for yacc output
+*/
+
+/*
+** yacc user known macros and defines
+*/
+#ifdef YYSPLIT
+#   define YYERROR	return(-2)
+#else
+#   define YYERROR	goto yyerrlab
+#endif
+
+#define YYACCEPT	return(0)
+#define YYABORT		return(1)
+#define YYBACKUP( newtoken, newvalue )\
+{\
+	if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
+	{\
+		yyerror( "syntax error - cannot backup" );\
+		goto yyerrlab;\
+	}\
+	yychar = newtoken;\
+	yystate = *yyps;\
+	yylval = newvalue;\
+	goto yynewstate;\
+}
+#define YYRECOVERING()	(!!yyerrflag)
+#ifndef YYDEBUG
+#	define YYDEBUG	1	/* make debugging available */
+#endif
+
+/*
+** user known globals
+*/
+int yydebug;			/* set to 1 to get debugging */
+
+/*
+** driver internal defines
+*/
+#define YYFLAG		(-1000)
+
+#ifdef YYSPLIT
+#   define YYSCODE { \
+			extern int (*yyf[])(); \
+			register int yyret; \
+			if (yyf[yytmp]) \
+			    if ((yyret=(*yyf[yytmp])()) == -2) \
+				    goto yyerrlab; \
+				else if (yyret>=0) return(yyret); \
+		   }
+#endif
+
+/*
+** global variables used by the parser
+*/
+YYSTYPE yyv[ YYMAXDEPTH ];	/* value stack */
+int yys[ YYMAXDEPTH ];		/* state stack */
+
+YYSTYPE *yypv;			/* top of value stack */
+YYSTYPE *yypvt;			/* top of value stack for $vars */
+int *yyps;			/* top of state stack */
+
+int yystate;			/* current state */
+int yytmp;			/* extra var (lasts between blocks) */
+
+int yynerrs;			/* number of errors */
+int yyerrflag;			/* error recovery flag */
+int yychar;			/* current input token number */
+
+
+
+/*
+** yyparse - return 0 if worked, 1 if syntax error not recovered from
+*/
+int
+yyparse()
+{
+	/*
+	** Initialize externals - yyparse may be called more than once
+	*/
+	yypv = &yyv[-1];
+	yyps = &yys[-1];
+	yystate = 0;
+	yytmp = 0;
+	yynerrs = 0;
+	yyerrflag = 0;
+	yychar = -1;
+
+	goto yystack;
+	{
+		register YYSTYPE *yy_pv;	/* top of value stack */
+		register int *yy_ps;		/* top of state stack */
+		register int yy_state;		/* current state */
+		register int  yy_n;		/* internal state number info */
+
+		/*
+		** get globals into registers.
+		** branch to here only if YYBACKUP was called.
+		*/
+	yynewstate:
+		yy_pv = yypv;
+		yy_ps = yyps;
+		yy_state = yystate;
+		goto yy_newstate;
+
+		/*
+		** get globals into registers.
+		** either we just started, or we just finished a reduction
+		*/
+	yystack:
+		yy_pv = yypv;
+		yy_ps = yyps;
+		yy_state = yystate;
+
+		/*
+		** top of for (;;) loop while no reductions done
+		*/
+	yy_stack:
+		/*
+		** put a state and value onto the stacks
+		*/
+#if YYDEBUG
+		/*
+		** if debugging, look up token value in list of value vs.
+		** name pairs.  0 and negative (-1) are special values.
+		** Note: linear search is used since time is not a real
+		** consideration while debugging.
+		*/
+		if ( yydebug )
+		{
+			register int yy_i;
+
+			printf( "State %d, token ", yy_state );
+			if ( yychar == 0 )
+				printf( "end-of-file\n" );
+			else if ( yychar < 0 )
+				printf( "-none-\n" );
+			else
+			{
+				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
+					yy_i++ )
+				{
+					if ( yytoks[yy_i].t_val == yychar )
+						break;
+				}
+				printf( "%s\n", yytoks[yy_i].t_name );
+			}
+		}
+#endif /* YYDEBUG */
+		if ( ++yy_ps >= &yys[ YYMAXDEPTH ] )	/* room on stack? */
+		{
+			yyerror( "yacc stack overflow" );
+			YYABORT;
+		}
+		*yy_ps = yy_state;
+		*++yy_pv = yyval;
+
+		/*
+		** we have a new state - find out what to do
+		*/
+	yy_newstate:
+		if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
+			goto yydefault;		/* simple state */
+#if YYDEBUG
+		/*
+		** if debugging, need to mark whether new token grabbed
+		*/
+		yytmp = yychar < 0;
+#endif
+		if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
+			yychar = 0;		/* reached EOF */
+#if YYDEBUG
+		if ( yydebug && yytmp )
+		{
+			register int yy_i;
+
+			printf( "Received token " );
+			if ( yychar == 0 )
+				printf( "end-of-file\n" );
+			else if ( yychar < 0 )
+				printf( "-none-\n" );
+			else
+			{
+				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
+					yy_i++ )
+				{
+					if ( yytoks[yy_i].t_val == yychar )
+						break;
+				}
+				printf( "%s\n", yytoks[yy_i].t_name );
+			}
+		}
+#endif /* YYDEBUG */
+		if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
+			goto yydefault;
+		if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )	/*valid shift*/
+		{
+			yychar = -1;
+			yyval = yylval;
+			yy_state = yy_n;
+			if ( yyerrflag > 0 )
+				yyerrflag--;
+			goto yy_stack;
+		}
+
+	yydefault:
+		if ( ( yy_n = yydef[ yy_state ] ) == -2 )
+		{
+#if YYDEBUG
+			yytmp = yychar < 0;
+#endif
+			if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
+				yychar = 0;		/* reached EOF */
+#if YYDEBUG
+			if ( yydebug && yytmp )
+			{
+				register int yy_i;
+
+				printf( "Received token " );
+				if ( yychar == 0 )
+					printf( "end-of-file\n" );
+				else if ( yychar < 0 )
+					printf( "-none-\n" );
+				else
+				{
+					for ( yy_i = 0;
+						yytoks[yy_i].t_val >= 0;
+						yy_i++ )
+					{
+						if ( yytoks[yy_i].t_val
+							== yychar )
+						{
+							break;
+						}
+					}
+					printf( "%s\n", yytoks[yy_i].t_name );
+				}
+			}
+#endif /* YYDEBUG */
+			/*
+			** look through exception table
+			*/
+			{
+				register int *yyxi = yyexca;
+
+				while ( ( *yyxi != -1 ) ||
+					( yyxi[1] != yy_state ) )
+				{
+					yyxi += 2;
+				}
+				while ( ( *(yyxi += 2) >= 0 ) &&
+					( *yyxi != yychar ) )
+					;
+				if ( ( yy_n = yyxi[1] ) < 0 )
+					YYACCEPT;
+			}
+		}
+
+		/*
+		** check for syntax error
+		*/
+		if ( yy_n == 0 )	/* have an error */
+		{
+			/* no worry about speed here! */
+			switch ( yyerrflag )
+			{
+			case 0:		/* new error */
+				yyerror( "syntax error" );
+				goto skip_init;
+			yyerrlab:
+				/*
+				** get globals into registers.
+				** we have a user generated syntax type error
+				*/
+				yy_pv = yypv;
+				yy_ps = yyps;
+				yy_state = yystate;
+				yynerrs++;
+			skip_init:
+			case 1:
+			case 2:		/* incompletely recovered error */
+					/* try again... */
+				yyerrflag = 3;
+				/*
+				** find state where "error" is a legal
+				** shift action
+				*/
+				while ( yy_ps >= yys )
+				{
+					yy_n = yypact[ *yy_ps ] + YYERRCODE;
+					if ( yy_n >= 0 && yy_n < YYLAST &&
+						yychk[yyact[yy_n]] == YYERRCODE)					{
+						/*
+						** simulate shift of "error"
+						*/
+						yy_state = yyact[ yy_n ];
+						goto yy_stack;
+					}
+					/*
+					** current state has no shift on
+					** "error", pop stack
+					*/
+#if YYDEBUG
+#	define _POP_ "Error recovery pops state %d, uncovers state %d\n"
+					if ( yydebug )
+						printf( _POP_, *yy_ps,
+							yy_ps[-1] );
+#	undef _POP_
+#endif
+					yy_ps--;
+					yy_pv--;
+				}
+				/*
+				** there is no state on stack with "error" as
+				** a valid shift.  give up.
+				*/
+				YYABORT;
+			case 3:		/* no shift yet; eat a token */
+#if YYDEBUG
+				/*
+				** if debugging, look up token in list of
+				** pairs.  0 and negative shouldn't occur,
+				** but since timing doesn't matter when
+				** debugging, it doesn't hurt to leave the
+				** tests here.
+				*/
+				if ( yydebug )
+				{
+					register int yy_i;
+
+					printf( "Error recovery discards " );
+					if ( yychar == 0 )
+						printf( "token end-of-file\n" );
+					else if ( yychar < 0 )
+						printf( "token -none-\n" );
+					else
+					{
+						for ( yy_i = 0;
+							yytoks[yy_i].t_val >= 0;
+							yy_i++ )
+						{
+							if ( yytoks[yy_i].t_val
+								== yychar )
+							{
+								break;
+							}
+						}
+						printf( "token %s\n",
+							yytoks[yy_i].t_name );
+					}
+				}
+#endif /* YYDEBUG */
+				if ( yychar == 0 )	/* reached EOF. quit */
+					YYABORT;
+				yychar = -1;
+				goto yy_newstate;
+			}
+		}/* end if ( yy_n == 0 ) */
+		/*
+		** reduction by production yy_n
+		** put stack tops, etc. so things right after switch
+		*/
+#if YYDEBUG
+		/*
+		** if debugging, print the string that is the user's
+		** specification of the reduction which is just about
+		** to be done.
+		*/
+		if ( yydebug )
+			printf( "Reduce by (%d) \"%s\"\n",
+				yy_n, yyreds[ yy_n ] );
+#endif
+		yytmp = yy_n;			/* value to switch over */
+		yypvt = yy_pv;			/* $vars top of value stack */
+		/*
+		** Look in goto table for next state
+		** Sorry about using yy_state here as temporary
+		** register variable, but why not, if it works...
+		** If yyr2[ yy_n ] doesn't have the low order bit
+		** set, then there is no action to be done for
+		** this reduction.  So, no saving & unsaving of
+		** registers done.  The only difference between the
+		** code just after the if and the body of the if is
+		** the goto yy_stack in the body.  This way the test
+		** can be made before the choice of what to do is needed.
+		*/
+		{
+			/* length of production doubled with extra bit */
+			register int yy_len = yyr2[ yy_n ];
+
+			if ( !( yy_len & 01 ) )
+			{
+				yy_len >>= 1;
+				yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
+				yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
+					*( yy_ps -= yy_len ) + 1;
+				if ( yy_state >= YYLAST ||
+					yychk[ yy_state =
+					yyact[ yy_state ] ] != -yy_n )
+				{
+					yy_state = yyact[ yypgo[ yy_n ] ];
+				}
+				goto yy_stack;
+			}
+			yy_len >>= 1;
+			yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
+			yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
+				*( yy_ps -= yy_len ) + 1;
+			if ( yy_state >= YYLAST ||
+				yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
+			{
+				yy_state = yyact[ yypgo[ yy_n ] ];
+			}
+		}
+					/* save until reenter driver code */
+		yystate = yy_state;
+		yyps = yy_ps;
+		yypv = yy_pv;
+	}
+	/*
+	** code supplied by user is placed in this switch
+	*/
+
+		switch(yytmp){
+
+case 1:
+# line 103 "ncgen.y"
+{ init_netcdf(); } break;
+case 2:
+# line 105 "ncgen.y"
+{
+		       if (ndims > MAX_NC_DIMS)
+			 derror("Too many dimensions");
+		   } break;
+case 3:
+# line 110 "ncgen.y"
+{
+		       if (derror_count == 0)
+			 define_netcdf(netcdfname);
+		   } break;
+case 4:
+# line 116 "ncgen.y"
+{
+		       if (derror_count == 0)
+			 close_netcdf();
+		   } break;
+case 11:
+# line 131 "ncgen.y"
+{ if (long_val <= 0)
+			 derror("negative dimension size");
+		     dims[ndims].size = long_val;
+		     ndims++;
+		   } break;
+case 12:
+# line 137 "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 13:
+# line 145 "ncgen.y"
+{ if (yypvt[-0]->is_dim == 1) {
+		        derror( "duplicate dimension declaration for %s",
+		                yypvt[-0]->name);
+		     }
+	             yypvt[-0]->is_dim = 1;
+		     yypvt[-0]->dnum = ndims;
+		     dims[ndims].name = (char *) emalloc(strlen(yypvt[-0]->name)+1);
+		     (void) strcpy(dims[ndims].name, yypvt[-0]->name);
+		   } break;
+case 22:
+# line 167 "ncgen.y"
+{ type_code = NC_BYTE; } break;
+case 23:
+# line 168 "ncgen.y"
+{ type_code = NC_CHAR; } break;
+case 24:
+# line 169 "ncgen.y"
+{ type_code = NC_SHORT; } break;
+case 25:
+# line 170 "ncgen.y"
+{ type_code = NC_LONG; } break;
+case 26:
+# line 171 "ncgen.y"
+{ type_code = NC_FLOAT; } break;
+case 27:
+# line 172 "ncgen.y"
+{ type_code = NC_DOUBLE; } break;
+case 30:
+# line 178 "ncgen.y"
+{
+		    if (nvars >= MAX_NC_VARS)
+		       derror("too many variables");
+		    nvdims = 0;
+		    /* make sure variable not re-declared */
+		    if (yypvt[-0]->is_var == 1) {
+		       derror( "duplicate variable declaration for %s",
+		               yypvt[-0]->name);
+		    }
+	            yypvt[-0]->is_var = 1;
+		    yypvt[-0]->vnum = nvars;
+		    vars[nvars].name = (char *) emalloc(strlen(yypvt[-0]->name)+1);
+		    (void) strcpy(vars[nvars].name, yypvt[-0]->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 31:
+# line 198 "ncgen.y"
+{
+		    vars[nvars].ndims = nvdims;
+		    nvars++;
+		   } break;
+case 37:
+# line 212 "ncgen.y"
+{
+		    if (nvdims >= MAX_VAR_DIMS) {
+		       derror("%s has too many dimensions",vars[nvars].name);
+		    }
+		    if (yypvt[-0]->is_dim == 1)
+		       dimnum = yypvt[-0]->dnum;
+		    else {
+		       derror( "%s is not declared as a dimension",
+			       yypvt[-0]->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 38:
+# line 231 "ncgen.y"
+{
+		       valnum = 0;
+		       valtype = NC_UNSPECIFIED;
+		       /* get a large block for attributes, realloc later */
+		       att_space = emalloc(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 = (long *) att_space;
+		       float_valp = (float *) att_space;
+		       double_valp = (double *) att_space;
+		   } break;
+case 39:
+# line 245 "ncgen.y"
+{
+		       if (natts >= MAX_NC_ATTS)
+			 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 41:
+# line 264 "ncgen.y"
+{
+		    varnum = -1;  /* handle of "global" attribute */
+		   } break;
+case 42:
+# line 270 "ncgen.y"
+{ if (yypvt[-0]->is_var == 1)
+		       varnum = yypvt[-0]->vnum;
+		    else {
+		      derror("%s not declared as a variable, fatal error",
+			     yypvt[-0]->name);
+		      YYABORT;
+		      }
+		   } break;
+case 43:
+# line 280 "ncgen.y"
+{
+		       atts[natts].name = (char *) emalloc(strlen(yypvt[-0]->name)+1);
+		       (void) strcpy(atts[natts].name,yypvt[-0]->name);
+		   } break;
+case 46:
+# line 289 "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 47:
+# line 298 "ncgen.y"
+{
+		       atype_code = NC_CHAR;
+		       *char_valp++ = char_val;
+		       valnum++;
+		   } break;
+case 48:
+# line 304 "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 49:
+# line 315 "ncgen.y"
+{
+		       atype_code = NC_BYTE;
+		       *byte_valp++ = byte_val;
+		       valnum++;
+		   } break;
+case 50:
+# line 321 "ncgen.y"
+{
+		       atype_code = NC_SHORT;
+		       *short_valp++ = short_val;
+		       valnum++;
+		   } break;
+case 51:
+# line 327 "ncgen.y"
+{
+		       atype_code = NC_LONG;
+		       *long_valp++ = long_val;
+		       valnum++;
+		   } break;
+case 52:
+# line 333 "ncgen.y"
+{
+		       atype_code = NC_FLOAT;
+		       *float_valp++ = float_val;
+		       valnum++;
+		   } break;
+case 53:
+# line 339 "ncgen.y"
+{
+		       atype_code = NC_DOUBLE;
+		       *double_valp++ = double_val;
+		       valnum++;
+		   } break;
+case 58:
+# line 354 "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 = (long *) rec_start;
+			   break;
+			 case NC_FLOAT:
+			   float_valp = (float *) rec_start;
+			   break;
+			 case NC_DOUBLE:
+			   double_valp = (double *) rec_start;
+			   break;
+		       }
+		 } break;
+case 59:
+# line 403 "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 62:
+# line 420 "ncgen.y"
+{
+		       if(valnum >= var_len) {
+			   derror("too many values for this variable");
+			   exit (4);
+		       }
+		       not_a_string = 1;
+                   } break;
+case 63:
+# line 428 "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 = (long *) rec_start;
+				   break;
+				 case NC_FLOAT:
+				   float_valp = (float *) rec_start;
+				   break;
+				 case NC_DOUBLE:
+				   double_valp = (double *) rec_start;
+				   break;
+			       }
+			   }
+		       }
+		 } break;
+case 64:
+# line 487 "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 65:
+# line 512 "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 66:
+# line 545 "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 67:
+# line 570 "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 68:
+# line 595 "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 69:
+# line 620 "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 70:
+# line 645 "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;
+}
+
+
+	goto yystack;		/* reset registers in driver code */
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vmstab.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vmstab.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/ncgen/vmstab.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,19 @@
+# define NC_UNLIMITED_K 257
+# define BYTE_K 258
+# define CHAR_K 259
+# define SHORT_K 260
+# define LONG_K 261
+# define FLOAT_K 262
+# define DOUBLE_K 263
+# define IDENT 264
+# define TERMSTRING 265
+# define BYTE_CONST 266
+# define CHAR_CONST 267
+# define SHORT_CONST 268
+# define LONG_CONST 269
+# define FLOAT_CONST 270
+# define DOUBLE_CONST 271
+# define DIMENSIONS 272
+# define VARIABLES 273
+# define NETCDF 274
+# define DATA 275

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,730 @@
+# Makefile for netCDF (semi)exhaustive test.
+#
+# $Id: Makefile.in,v 1.21 2000/08/30 00:11:23 wendling Exp $
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+ZLIB_LIB = $(TOP_SRCDIR)/hdf/zlib/libz.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+PROGRAM		= nctest
+#CPP_NETCDF	= -I../libsrc
+#CPPFLAGS	= $(CPPFLAGS_NCT)
+#HDF_LIB         = @HDF_LIB@
+#JPEG_LIB        = @JPEG_LIB@
+#CFLAGS		= $(CFLAGS_NCT)
+MANIFEST = $(DISTFILES)
+DISTFILES	= Makefile.in README add.c add.h atttests.c cdftests.c \
+		  depend dimtests.c driver.c emalloc.c emalloc.h error.c \
+		  error.h misctest.c msoft.mk rec.c slabs.c testcdf.h \
+		  tests.h val.c val.h vardef.c varget.c vargetg.c varput.c \
+		  varputg.c vartests.c vputget.c vputgetg.c make.com
+LIBNAME		= mfhdf
+LD_NETCDF	= ../libsrc/libmfhdf.a
+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
+OBJS		= varget.o vargetg.o varput.o varputg.o vardef.o vartests.o \
+		  vputget.o vputgetg.o driver.o cdftests.o dimtests.o  rec.o \
+		  atttests.o misctest.o add.o error.o emalloc.o val.o slabs.o
+#LD_XDR		= @LD_XDR@
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(JPEG_LIB) $(ZLIB_LIB) $(LIBSX)
+GARBAGE		= $(PROGRAM) lint.out *.nc *.cdf *.log
+
+all::		program
+
+test:		$(PROGRAM)
+	@ echo "==========================="
+	@ echo "netCDF C interface tests"
+	@ echo "==========================="
+	./$(PROGRAM)
+
+$(PROGRAM):   ../libsrc/libmfhdf.a
+
+install::
+
+nctime:		nctime.o
+	$(CC) $(CFLAGS) $(CFLAGS_NETCDF) nctime.o $(LIBS) -o $@
+
+debug:      ../libsrc/libmfhdf.a
+	purify $(CC) $(CFLAGS) $(CFLAGS_NETCDF) $(OBJS) $(LIBS) -o pnctest
+
+perfs:      ../libsrc/libmfhdf.a
+	quantify $(CC) $(CFLAGS) $(CFLAGS_NETCDF) $(OBJS) $(LIBS) -o qnctest
+
+saber_src:
+	#load -C $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(SRCS) $(LIBS)
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF) '; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+	chmod u=rw,og=r $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/nctest
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,53 @@
+# Makefile for netCDF (semi)exhaustive test.
+#
+# $Id: Makefile.in_orig,v 1.1 1996/03/28 20:57:37 georgev Exp $
+
+PROGRAM		= nctest
+CPP_NETCDF	= -I../libsrc
+CPPFLAGS	= $(CPP_NETCDF) @CPPFLAGS@
+HDF_LIB         = @HDF_LIB@
+JPEG_LIB        = @JPEG_LIB@
+CFLAGS		= @CFLAGS@ @HDF_INC@
+MANIFEST	= Makefile.in README add.c add.h atttests.c cdftests.c \
+		  depend dimtests.c driver.c emalloc.c emalloc.h error.c \
+		  error.h misctest.c msoft.mk rec.c slabs.c testcdf.h \
+		  tests.h val.c val.h vardef.c varget.c vargetg.c varput.c \
+		  varputg.c vartests.c vputget.c vputgetg.c make.com
+LIBNAME		= netcdf
+LD_NETCDF	= ../libsrc/libnetcdf.a
+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
+OBJS		= varget.o vargetg.o varput.o varputg.o vardef.o vartests.o \
+		  vputget.o vputgetg.o driver.o cdftests.o dimtests.o  rec.o \
+		  atttests.o misctest.o add.o error.o emalloc.o val.o slabs.o
+LD_XDR		= @LD_XDR@
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(JPEG_LIB)
+GARBAGE		= $(PROGRAM) lint.out *.cdf *.log
+
+all::		program
+
+test:		$(PROGRAM)
+	./$(PROGRAM)
+
+$(PROGRAM):   ../libsrc/libnetcdf.a
+
+install::
+
+nctime:		nctime.o
+	$(CC) $(CFLAGS) nctime.o $(LIBS) -o $@
+
+debug:      ../libsrc/libnetcdf.a
+	purify $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o pnctest
+
+perfs:      ../libsrc/libnetcdf.a
+	quantify $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o qnctest
+
+saber_src:
+	#load -C $(CPPFLAGS) $(SRCS) $(LIBS)
+
+include ../port/master.mk
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/README
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,44 @@
+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".
+
+For VMS, type "@make".  The make.com, make.opt, and *-vms files are for
+VMS only.  When nctest.exe is successfully made, invoke it with "run
+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 ...
+except that on VMS systems, the line "Doesn't support shared access on
+vms" will appear a couple of times after the "ncopen" and "ncsync"
+tests.

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/add.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/add.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/add.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,210 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: add.c,v 1.6 1997/11/05 19:40:56 koziol Exp $
+ *********************************************************************/
+
+/* 
+ * utility functions to update in-memory netcdf by adding new 
+ * dimensions, variables, and attributes.
+ */
+#include <stdio.h>
+#include <string.h>
+#include "netcdf.h"
+#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 >= 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 >= 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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/add.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/add.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/add.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,65 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: add.h,v 1.2 1996/03/26 22:43:23 georgev Exp $
+ *********************************************************************/
+
+#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

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/atttests.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/atttests.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/atttests.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1374 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: atttests.c,v 1.7 1996/03/26 22:43:24 georgev Exp $
+ *********************************************************************/
+
+#ifdef _MPW
+#define		__SEG__  toobig    /* under MPW on MacOS, makes it fit */
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include "netcdf.h"
+#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(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(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(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) * MAX_VAR_DIMS);
+    vtmp.name = (char *) emalloc(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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/cdftests.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/cdftests.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/cdftests.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,790 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: cdftests.c,v 1.9 1998/02/02 21:52:53 smitchel Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "netcdf.h"
+#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 !(defined(vms) || defined(macintosh) || defined (SYMANTEC_C))
+    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++;
+	    }
+    }
+#else /* Macintosh or VMS */
+#if defined(macintosh) || defined (SYMANTEC_C)
+	fprintf(stderr,"This version of the library Doesn't support shared access to files on Macintosh\n") ;
+#else /* !macintosh */
+	fprintf(stderr,"Doesn't support shared access on vms\n") ;
+#endif /* !macintosh */
+#endif /* Macintosh or VMS */
+
+    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) {
+#ifndef vms
+	    error("%s: second ncopen failed", pname);
+	    nerrs++;
+#else
+	    fprintf(stderr,"Doesn't support shared access on vms\n") ;
+#endif
+	} 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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/dimtests.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/dimtests.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/dimtests.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,400 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: dimtests.c,v 1.4 1996/03/26 22:43:25 georgev Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include "netcdf.h"
+#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(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[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(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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/driver.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/driver.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/driver.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,153 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: driver.c,v 1.8 1998/01/14 19:32:40 bmribler Exp $
+ *********************************************************************/
+
+#include "netcdf.h"
+#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
+
+#ifdef macintosh
+    #include <LowMem.h>
+#endif
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+#ifdef PROTOTYPE
+int main(int argc, char *argv[])
+#else
+int main(argc, argv)
+int argc;
+char *argv[];
+#endif
+{
+    static char testfile[] = "test.nc";
+
+#ifdef macintosh
+	Ptr	currStackBase, newApplLimit, currApplLimit, currHeapEnd;
+
+
+	/*	Expand the stack.  hdf_write_var( ) causes the stack to collide with
+		the 68K application heap when only the default stack size is used.   */
+	currStackBase = LMGetCurStackBase( );
+	newApplLimit = (Ptr) ( (long) currStackBase - 65536L );
+	currApplLimit = GetApplLimit( );
+	if ( newApplLimit > currApplLimit )	/* If we're about to shrink the stack, ...*/
+		 newApplLimit = currApplLimit;	/* ... then don't. */
+
+	currHeapEnd = LMGetHeapEnd( );
+	if ( newApplLimit < currHeapEnd )	/* If we're about overlap the stack and heap,...*/
+		 newApplLimit = currHeapEnd;	/* ... then don't.*/
+
+	SetApplLimit( newApplLimit );
+#endif
+#if defined __MWERKS__
+    argc = ccommand(&argv);
+#endif
+
+#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);
+
+    test_ncsync(testfile);
+
+    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);
+
+    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
+#ifdef vms
+#define EXIT_SUCCESS 1
+#else
+#define EXIT_SUCCESS 0
+#endif
+    return EXIT_SUCCESS;
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/emalloc.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/emalloc.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/emalloc.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,63 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: emalloc.c,v 1.6 1996/03/26 22:43:26 georgev Exp $
+ *********************************************************************/
+
+/*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;
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/emalloc.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/emalloc.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/emalloc.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,30 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: emalloc.h,v 1.4 1996/03/26 22:43:27 georgev Exp $
+ *********************************************************************/
+
+#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
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/error.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/error.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/error.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,72 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: error.c,v 1.4 1997/11/05 19:40:58 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+
+#ifndef NO_STDARG
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include "netcdf.h"
+#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 */
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/error.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/error.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/error.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,59 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: error.h,v 1.6 1997/11/05 19:40:59 koziol Exp $
+ *********************************************************************/
+
+#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

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/make.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/make.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/make.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,67 @@
+$! --------------------------------------------------------------------------
+$! For making NCTEST.EXE on VMS if you don't have MMS.
+$! --------------------------------------------------------------------------
+$!
+$! $Id: make.com,v 1.5 1996/11/07 00:28:32 sxu Exp $
+$!
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC"
+$ define/nolog sys$clib sys$library:deccrtl
+$ else
+$ ccopt = ""
+$ define/nolog sys$clib sys$library:vaxcrtl
+$ endif
+$ ccc := cc 'ccopt /opt/nodebug -
+          /include=([--.hdf.src],[--.hdf.jpeg], -
+          [--.hdf.zlib],[-.libsrc])/nolist  -
+            /define=(NO_SYS_XDR_INC,swap,HDF.VMS)
+
+$
+$ ccc ADD.C
+$ ccc ATTTESTS.C
+$ ccc CDFTESTS.C
+$ ccc DIMTESTS.C
+$ ccc DRIVER.C
+$ ccc EMALLOC.C
+$ ccc ERROR.C
+$ ccc MISCTEST.C
+$ ccc REC.C
+$ ccc SLABS.C
+$ ccc VAL.C
+$ ccc VARDEF.C
+$ ccc VARGET.C
+$ ccc VARPUT.C
+$ ccc VPUTGET.C
+$ ccc VARGETG.C
+$ ccc VARPUTG.C
+$ ccc VPUTGETG.C
+$ ccc VARTESTS.C
+$
+$ link/nodebug/traceback/exe=NCTEST.exe -
+    add.obj, -
+    atttests.obj, -
+    cdftests.obj, -
+    dimtests.obj, -
+    driver.obj, -
+    emalloc.obj, -
+    error.obj, -
+    misctest.obj, -
+    rec.obj, -
+    slabs.obj, -
+    val.obj, -
+    vardef.obj, -
+    varget.obj, -
+    varput.obj, -
+    vputget.obj, -
+    vargetg.obj, -
+    varputg.obj, -
+    vputgetg.obj, -
+    vartests.obj, -
+    [--.lib]mfhdf/lib, [--.hdf.src]df/lib,[--.hdf.jpeg]libjpeg.olb/lib, -
+    [--.hdf.zlib]libz.olb/lib, -
+    sys$input/opt
+	sys$clib/lib
+$
+$ run nctest
+$

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/misctest.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/misctest.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/misctest.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,57 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: misctest.c,v 1.4 1997/11/05 19:41:00 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include "netcdf.h"
+#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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/msoft.mk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/msoft.mk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/msoft.mk	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.def
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.def	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.def	2007-05-14 09:41:34 UTC (rev 808)
@@ -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.
+;

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.lnk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.lnk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.lnk	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/nctest.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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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!!!!!!!!%8B!!!!iF(*PCJ!-6Ci!!!!Y!!!!!!!
+!!!!4IJ!!!!a`FQ9Q!!a(C!!!!#i!!!!!!!!!!'Re!!!"fR"bC at B!$'9G!!!!,`!
+!!!!!!!!!-l-!!!!-F(*PCJ!-%P8!!!!`!!!!!!!!!!!c[`!!!'*`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!!!:

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/rec.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/rec.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/rec.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,612 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: rec.c,v 1.7 1996/03/26 22:43:30 georgev Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include "netcdf.h"
+#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[MAX_VAR_DIMS];
+
+    if (ncinquire(ncid, 0, &nvars, 0, &recdimid) == -1)
+      return -1;
+    if (recdimid == -1)
+      return 0;
+    nrecvars = 0;
+    for (iv = 0; iv < nvars; iv++) {
+	if (ncvarinq(ncid, iv, 0, 0, &ndims, dimids, 0) == -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[MAX_VAR_DIMS];
+    int id;
+    long size;
+
+    if (ncinquire(ncid, 0, 0, 0, &recdimid) == -1)
+      return -1;
+    if (ncvarinq(ncid, vid, 0, &type, &ndims, dimids, 0) == -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[MAX_VAR_DIMS];
+
+    if (ncvarinq(ncid, varid, 0, 0, &ndims, dimids, 0) == -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[MAX_VAR_DIMS];
+    long edges[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[MAX_VAR_DIMS];
+    long edges[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], 0, 0, 0) == -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], 0, 0, 0) == -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");
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/slabs.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/slabs.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/slabs.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,359 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: slabs.c,v 1.5 1996/03/26 22:43:31 georgev Exp $
+ *********************************************************************/
+
+#include "netcdf.h"
+#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
+/* 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";
+    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);
+    }
+}
+
+
+/*
+ * 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";
+    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);
+    }
+}
+
+
+/*
+ * 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); */
+			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 (val_diff(va[iv].type, v, 0, VF(point))) {
+	    error("%s: ncvarget got wrong value for point", pname);
+	    nerrs++;
+	}
+	
+	/* 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 (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 (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 (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;
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/testcdf.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/testcdf.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/testcdf.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,67 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: testcdf.h,v 1.5 1996/03/26 22:43:31 georgev Exp $
+ *********************************************************************/
+
+/*
+ * 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 "hdf.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
+				 */

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/tests.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/tests.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/tests.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,129 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: tests.h,v 1.3 1996/03/26 22:43:32 georgev Exp $
+ *********************************************************************/
+
+#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_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

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/val.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/val.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/val.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,244 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: val.c,v 1.6 1998/12/08 21:38:05 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include "netcdf.h"
+#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);
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/val.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/val.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/val.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,51 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: val.h,v 1.3 1996/03/26 22:43:33 georgev Exp $
+ *********************************************************************/
+
+#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

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/vardef.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/vardef.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/vardef.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,299 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vardef.c,v 1.14 2000/08/29 13:57:05 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "netcdf.h"
+#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) * MAX_VAR_DIMS);
+    tmp.name = (char *) emalloc(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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/varget.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/varget.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/varget.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,140 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: varget.c,v 1.7 1996/03/26 22:43:34 georgev Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#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[MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/vargetg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/vargetg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/vargetg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,147 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vargetg.c,v 1.5 1994/04/07 14:55:39 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#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[MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[MAX_VAR_DIMS];	/* netcdf edge lengths to upper corner */
+	void *vals;		/* pointer to block of values */
+    } hc;			/* test hypercube */
+    long strides[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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/varput.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/varput.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/varput.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,146 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: varput.c,v 1.7 1996/03/26 22:43:34 georgev Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#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[MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/varputg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/varputg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/varputg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,149 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: varputg.c,v 1.5 1994/04/07 14:55:43 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#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[MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[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[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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/vartests.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/vartests.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/vartests.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,666 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vartests.c,v 1.9 1997/11/05 19:41:03 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include "netcdf.h"
+#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) * MAX_VAR_DIMS);
+    var.name = (char *) emalloc(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[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) * MAX_VAR_DIMS);
+    var.name = (char *) emalloc(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");
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/vputget.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/vputget.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/vputget.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,128 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vputget.c,v 1.6 1997/11/05 19:41:05 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#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[MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[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;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/nctest/vputgetg.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/nctest/vputgetg.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/nctest/vputgetg.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,173 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vputgetg.c,v 1.6 1997/11/05 19:41:06 koziol Exp $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#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[MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[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[MAX_VAR_DIMS];	/* external strides */
+    long basis[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[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;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/pablo/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/pablo/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/pablo/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,824 @@
+# Makefile for netCDF library
+#
+# $Id: Makefile.in,v 1.3 2000/08/30 00:11:24 wendling Exp $
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+MFHDFSRC = $(TOP_SRCDIR)/mfhdf/libsrc
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+ZLIB_LIB = $(TOP_SRCDIR)/hdf/zlib/libz.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+PABLO_INCDIR = .
+PABLO_INCLUDE= -I$(PABLO_INCDIR)
+
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+OTHERDIRS = config
+
+PROGRAM		= cdftest
+#SWAP    	= @SWAP@
+#NETLONG    	= @NETLONG@
+#CPPFLAGS	= $(CPPFLAGS_LIB)
+#CFLAGS		= $(CFLAGS_LIB)
+GARBAGE		= $(PROGRAM) test.cdf cdfout.new *.hdf \
+                  hdftest hdfout.new
+HEADERS		= netcdf.h mfhdf.h local_nc.h hdf2netcdf.h
+#XDRFILE	= @XDRFILE@
+#HDF_LIB         = @HDF_LIB@
+#JPEG_LIB        = @JPEG_LIB@
+CSRCS		= array.c attr.c cdf.c dim.c error.c file.c \
+		  globdef.c iarray.c putget.c putgetg.c sharray.c string.c \
+		  var.c xdrposix.c xdrstdio.c hdfsds.c mfsd.c nssdc.c
+MANIFEST = $(DISTFILES)
+DISTFILES	= Makefile.in README \
+		  depend \
+		  $(CSRCS) cdftest.c \
+		  alloc.h testout.sav descrip.mms error.h htons.mar \
+		  local_nc.h make.com msoft.mk netcdf.h ntohs.mar \
+		  test_cdf.sav hdfout.sav hdftest.c mfhdf.h win32cdf.h hdf2netcdf.h \
+		config/netcdf-hpux.h config/netcdf-irix4.h config/netcdf-irix5.h \
+		config/netcdf-irix6.h config/netcdf-irix32.h config/netcdf-sun.h \
+		config/netcdf-linux.h config/netcdf-fbsd.h config/netcdf-alpha.h \
+		config/netcdf-dec.h config/netcdf-aix.h config/netcdf-solaris.h \
+		config/netcdf-solarisx86.h config/netcdf-convex.h \
+		config/netcdf-unicos.h
+
+LIBOBJS		= array.o attr.o cdf.o dim.o file.o iarray.o error.o \
+		  globdef.o putget.o putgetg.o sharray.o string.o var.o \
+		  $(XDRFILE).o hdfsds.o mfsd.o nssdc.o
+LIBRARY		= mfhdf-inst
+DEBUGLIBRARY	= mfhdf_g-inst
+PROFILEDLIBRARY	= mfhdf_pg-inst
+OBJS		= $(PROGRAM).o
+#LD_XDR		= @LD_XDR@
+LD_NETCDF	= libmfhdf-inst.a
+LIBS		= $(LD_NETCDF) $(LD_XDR) $(HDF_LIB) $(JPEG_LIB) $(ZLIB_LIB)
+prefix		= ../../..
+
+#all::		library
+all::         FORCE
+	@if test -z "$(PABLO_FLAGS)"; then \
+	   : true; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) all-inst; \
+	fi
+
+all-inst::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" library; \
+	fi
+
+#
+# The formatted file `cdftest_out.new' might differ from the touchstone
+# file `testout.sav', but this should be due to rounding errors.
+#
+# `$(PROGRAM)' creates the binary-file `test.cdf' which should be byte-for-byte
+# identical with `test_cdf.sav', modulo small rounding errors.
+#
+test:		$(PROGRAM) nhdftest
+	@ echo "========================="
+	@ echo "netCDF formatted tests"
+	@ echo "========================="
+	./$(PROGRAM) > cdfout.new
+	@cmd="$(DIFF) $(DIFF_FLAGS) cdfout.new 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"; \
+		exit 0; \
+	    fi
+#	@cmd="cmp test.cdf test_cdf.sav"; \
+#	    echo $$cmd; \
+#	    if $$cmd; then \
+#		echo "*** netCDF passes binary test ***"; \
+#	    else \
+#		echo "*** netCDF fails binary test ***"; \
+#		exit 1; \
+#	    fi
+
+#install::	installed_library installed_headers
+install::	installed_library 
+
+#install-includes::	installed_headers
+
+$(PROGRAM):	$(PROGRAM).o library
+
+nhdftest::         FORCE
+	@if test -z "$(FMPOOL_FLAGS)"; then \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) hdftest; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) FMPOOL_FLAGS="$(FMPOOL_FLAGS) -I$(FMPOOL_INC)" hdftest; \
+	fi
+
+hdftest:	hdftest.o library        
+	$(CC) $(CFLAGS) $(CFLAGS_NETCDF) hdftest.o $(LIBS) -o $@
+	@ echo "============================"
+	@ echo "HDF-SD C interfaces tests"
+	@ echo "============================"
+	./hdftest > hdfout.new
+	@cmd="$(DIFF) $(DIFF_FLAGS) hdfout.new hdfout.sav"; \
+	    echo $$cmd; \
+	    if $$cmd; then \
+		echo "*** HDF passes formatted test ***"; \
+	    else \
+		echo "*** HDF fails formatted test ***"; \
+		echo "The above differences are OK if small"; \
+		exit 0; \
+	    fi
+debug:
+#	rm -f $(COBJS)
+	$(MAKE) $(MFLAGS) "CFLAGS=-g $(CFLAGS_NETCDF) " "LIBRARY=$(LIBRARY)_g" library
+
+profiled:
+#	rm -f $(COBJS)
+	$(MAKE) $(MFLAGS) "CFLAGS=-pg $(CFLAGS_NETCDF) " "LIBRARY=$(LIBRARY)_pg" library
+
+cdftest.oc:	$(CSRCS) cdftest.c
+	#load -C $(CPPFLAGS) $(CPPFLAGS_NETCDF) -I/usr/local/lang/SC1.0/ansi_include \
+	    $(CSRCS) cdftest.c /usr/local/lang/SC1.0/ansi_lib/libansi.a 
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $(MFHDFSRC)/$*.f
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) \
+	$(PABLO_FLAGS) -I$(PABLO_HINC) $(MFHDFSRC)/$*.c $(PABLO_INCLUDE) 
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+#	$(LD) -b -o libmfhdf-inst.sl $(LIBOBJS)
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::     FORCE
+	@if test -z "$(PABLO_FLAGS)"; then \
+	  : true; \
+	else            \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	   LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	   installed_libfile ; \
+	fi
+ 
+
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF) '; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags netcdf.h
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/libsrc
+dist: $(DISTFILES)
+	for subdir in $(OTHERDIRS); do \
+	  mkdir $(distdir)/$$subdir || exit 1; \
+	done
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/pablo/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/pablo/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/pablo/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,318 @@
+array.c: $(MFHDFSRC)/array.c
+array.o: array.c
+array.o: $(MFHDFSRC)/local_nc.h
+array.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+attr.c: $(MFHDFSRC)/attr.c
+attr.o: attr.c
+attr.o: $(MFHDFSRC)/local_nc.h
+attr.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+cdf.c: $(MFHDFSRC)/cdf.c
+cdf.o: cdf.c
+cdf.o: $(MFHDFSRC)/local_nc.h
+cdf.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+cdftest.c: $(MFHDFSRC)/cdftest.c
+cdftest.o: cdftest.c
+cdftest.o: $(MFHDFSRC)/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.c: $(MFHDFSRC)/dim.c
+dim.o: dim.c
+dim.o: $(MFHDFSRC)/local_nc.h
+dim.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+error.c: $(MFHDFSRC)/error.c
+error.o: error.c
+error.o: $(MFHDFSRC)/local_nc.h
+error.o: $(MFHDFSRC)/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.c: $(MFHDFSRC)/file.c
+file.o: file.c
+file.o: $(MFHDFSRC)/local_nc.h
+file.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+globdef.c: $(MFHDFSRC)/globdef.c
+globdef.o: globdef.c
+globdef.o: $(MFHDFSRC)/netcdf.h
+globdef.o: ../../hdf/src//hlimits.h
+hdfsds.c: $(MFHDFSRC)/hdfsds.c
+hdfsds.o: hdfsds.c
+hdfsds.o: $(MFHDFSRC)/local_nc.h
+hdfsds.o: $(MFHDFSRC)/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.c: $(MFHDFSRC)/hdftest.c
+hdftest.o: hdftest.c
+hdftest.o: $(MFHDFSRC)/mfhdf.h
+hdftest.o: $(MFHDFSRC)/local_nc.h
+hdftest.o: $(MFHDFSRC)/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.c: $(MFHDFSRC)/iarray.c
+iarray.o: iarray.c
+iarray.o: $(MFHDFSRC)/local_nc.h
+iarray.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+mfsd.c: $(MFHDFSRC)/mfsd.c
+mfsd.o: mfsd.c
+mfsd.o: $(MFHDFSRC)/mfhdf.h
+mfsd.o: $(MFHDFSRC)/local_nc.h
+mfsd.o: $(MFHDFSRC)/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.c: $(MFHDFSRC)/nssdc.c
+nssdc.o: nssdc.c
+nssdc.o: $(MFHDFSRC)/local_nc.h
+nssdc.o: $(MFHDFSRC)/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.c: $(MFHDFSRC)/putget.c
+putget.o: putget.c
+putget.o: $(MFHDFSRC)/local_nc.h
+putget.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+putgetg.c: $(MFHDFSRC)/putgetg.c
+putgetg.o: putgetg.c
+putgetg.o: $(MFHDFSRC)/local_nc.h
+putgetg.o: $(MFHDFSRC)/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.c: $(MFHDFSRC)/sharray.c
+sharray.o: sharray.c
+sharray.o: $(MFHDFSRC)/local_nc.h
+sharray.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+string.c: $(MFHDFSRC)/string.c
+string.o: string.c
+string.o: $(MFHDFSRC)/local_nc.h
+string.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+var.c: $(MFHDFSRC)/var.c
+var.o: var.c
+var.o: $(MFHDFSRC)/local_nc.h
+var.o: $(MFHDFSRC)/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: $(MFHDFSRC)/alloc.h
+xdrposix.c: $(MFHDFSRC)/xdrposix.c
+xdrposix.o: xdrposix.c
+xdrposix.o: $(MFHDFSRC)/netcdf.h
+xdrposix.o: ../../hdf/src//hlimits.h
+xdrposix.o: $(MFHDFSRC)/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: $(MFHDFSRC)/mfhdf.h
+xdrstdio.c: $(MFHDFSRC)/xdrstdio.c
+xdrstdio.o: xdrstdio.c
+xdrstdio.o: $(MFHDFSRC)/local_nc.h
+xdrstdio.o: $(MFHDFSRC)/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

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/COPYRIGHT
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/COPYRIGHT	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/COPYRIGHT	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,13 @@
+(C) Copyright 1993 UCAR/Unidata
+
+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 or
+Unidata, to assist in its use, correction, modification, or enhancement.

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/CUSTOMIZE
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/CUSTOMIZE	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/CUSTOMIZE	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,10 @@
+# This file is for customizing the configuation process performed by
+# `./configuration'.  This file consists of sh(1) variable-definition lines.
+# The value given to those variable by this file will override their default
+# values.
+#
+# Type of C compiler (default is `cc'):
+# CC='gcc -traditional'
+#
+# Type of FORTRAN compiler (default is `f77'):
+# FC=f77

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/HISTORY
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/HISTORY	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/HISTORY	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,144 @@
+VERSION		COMMENTS
+
+ 1.5.1 ?
+               Added support for NeXTOS to autoconf macro UC_OS.
+
+               Added script `which' and autoconf macro `UC_PROG_WHICH' to
+               support platforms with no which(1) (e.g. UNICOS).
+
+               Added recursive macros to master makefile to support, for
+               example, command-line redefinition of CFLAGS.
+
+               Fixed bug in UC_VERSION in setting minor version number.
+
+               Fixed benign bug in UC_PREFIX that caused two identical
+               definitions for `prefix' and `exec-prefix' in `config.status'.
+
+               Added UC_MACHINE to determine machine hardware type.
+
+1.5	1993-5-3
+		Added support for Concurrent's (Masscomp's?) Real Time Unix
+		(RTU) operating system.
+
+		Made missing system header files be defined as `/dev/null'.
+
+		Added default definition of NULL to stddef.h.in.
+
+		Added support for `sigset_t', `sig_atomic_t', and `struct
+		sigaction' and for sigfillset(), sigismember(), and
+		sigpending(), and sigaction().
+
+		Modified autoconf(1) support:
+		    Made udposix.h independent of AC_CONFIG_HEADER().
+
+		    Added capability for transforming any file via @...@
+		    substitutions (not just makefiles).  This required a
+		    slight change to autoconf(1)'s `acgeneral.m4'.
+
+		    Made configure create POSIX header-files (e.g. stdlib.h),
+		    allowing @...@ substitutions, and modified them
+		    accordingly.
+
+		Added full support for `size_t' in <stddef.h>, <stdlib.h>,
+		<string.h>, and <time.h>.
+
+		Added support for GNU info(1) pages.
+
+		Added support for Data General's DGUX to fortc(1), UC_OS,
+		and UC_PROG_FC.
+
+1.4.1	1993-3-27
+		Undid 1.4 modification because the library-build rule would
+		fail on platforms where autoconf set RANLIB to `@:'.
+
+		Quoted all define() first arguments in file `aclocal.m4' so
+		that it can be read twice by m4(1) (useful because when 
+		autoconf(1) is executed in this directory, it effectively
+		reads `aclocal.m4' twice).
+
+		Placed under CVS control.
+
+		Corrected UC_CPP_X11 so that it won't generate `-I-I...'.
+
+		Added test for OSF operating system.
+
+		Added CPP_LDM and LD_LDM to missing values checklist.
+
+1.4	1993-3-5
+
+		Modified library creation rules so that nothing is done if
+		LIBOBJS is empty.
+
+1.3.4	1993-3-1
+
+		Modified local autoconf(1) support file`aclocal.m4': added
+		self-lockouts to UC_LIMITS and UC_FLOAT and UC_PROG_CC
+		requirement.
+
+		Modified method in master makefile, `master.mk.in', for
+		producing .f file from .F file.  Now uses symbolic link to
+		.c file.  Necessary because SunOS `acc -E' doesn't handle
+		.F files and SunOS `cpp' gets wrong header files.
+
+		Removed extraneous message about checking for <limits.h>
+		from autoconf(1) macro-support file, aclocal.h.
+
+1.3.3	1993-2-24
+
+		Added modification of existing symbolic link to `ftp'
+		target.
+
+1.3.2	1993-2-23
+
+		Changed rule for making a program in the master makefile.
+		Now, the C compiler only uses $(CFLAGS) and the FORTRAN 
+		compiler only uses $(FFLAGS): the $(LDFLAGS) reference has
+		been removed.  This accomodates compilers that don't pass
+		unknown options to the loader.
+
+		Added `config' to `clean' target.
+
+		Added `aclocal.m4' to MANIFEST so users can play with the
+		autoconf(1)-generated configure script.
+
+1.3.1	Tuesday, February 9, 1993
+
+		Added dependency on library to `program' target.
+
+1.3
+
+		Changed `tar.Z' target: the top-level directory will now be
+		the package name suffixed with the version number (e.g
+		`udunits-1.5/README').
+
+		Removed `configure' targets from Makefile.in and
+		fortc/Makefile.in to comply with autoconf(1) 1.3.
+
+1.2
+
+		Added `SUBDIR_TARGETS = fortc/all' to Makefile.in so that
+		it knows how to make `fortc/all'.
+
+		Changed the way the operating-system is discovered from
+		relying on file /etc/motd to testing for predefined C
+		preprocessing macros.  This is more robust in the face of
+		changes to the /etc/motd file at the expense of being less
+		encompasing (I only know about the predefined macros of AIX,
+		HPUX, IRIX, SunOS, and ULTRIX).
+
+1.1.1
+
+		Added HISTORY (this file) to the distribution.
+
+		Changed procedure for discovering operating-system to use
+		sed(1) rather than awk(1).
+
+		Dropped the `lib' from `fortclib.{h,fc}'.
+
+1.1
+
+		Ported to HPUX.
+
+1.0
+
+		Initial release.  Tested on AIX, IRIX, SunOS, ULTRIX.

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,777 @@
+# This is the makefile for the Unidata portability package.
+#
+# $Id: Makefile.in,v 1.13 2000/08/30 00:11:26 wendling Exp $
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+#PACKAGE		= udport
+LIBRARY		= udport
+#MAJOR_NO	= @MAJOR_NO@
+#MINOR_NO	= @MINOR_NO@
+
+#CPPFLAGS	= $(CPPFLAGS_PORT)
+#CFLAGS		= @CFLAGS@
+
+#PORT_CFORTRAN	= @PORT_CFORTRAN@
+#NEED_FORTC	= @NEED_FORTC@
+
+#PORT_HEADERS	= @PORT_HEADERS@
+config_headers	= signal.h stdarg.h stddef.h stdlib.h string.h time.h \
+		  udconfig.h udposix.h
+made_headers	= float.h limits.h
+#LIBOBJS		= uddummy.o @LIBOBJS@
+
+prefix		= ../../..
+
+#SUBDIRS	= @PORT_SUBDIRS@
+SUBDIRS		= $(PORT_SUBDIRS)
+SUBDIR_TARGETS	= fortc/all fortc/install fortc/clean fortc/distclean
+MANIFEST = $(DISTFILES)
+DISTFILES        = COPYRIGHT CUSTOMIZE HISTORY Makefile.in VERSION aclocal.m4 \
+		  $(PORT_MANIFEST) \
+		  configure configure.in depend master.mk.in uddummy.c
+
+# Note that the `all' target might not make `fortc/all'.  That will depend 
+# on whether or not that utility is required.
+
+all::		FORCE $(PORT_HEADERS)
+	@if [ "$(NEED_FORTC)" = yes ]; then \
+	    $(MAKE) $(MFLAGS) $(SBUDIR_MACROS) fortc/all; \
+	else \
+	    :; \
+	fi
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library
+
+# We install the portability library modules directly into an installed
+# portability library even though the package using this portability library
+# (the client package) probably doesn't reference the installed one.  This is
+# done because the client package might be another library and linking
+# against it might require some modules of this library.  We don't install
+# the portability library just created because different packages can require
+# different modules.
+#
+install::	$(LIBOBJS)
+	$(MAKE) $(MFLAGS) $(LIBDIR) LIBDIR=$(LIBDIR)
+	$(AR) rcuv $(LIBDIR)/libudport.a $(LIBOBJS)
+	$(RANLIB) $(LIBDIR)/libudport.a
+
+clean::		FORCE
+	@if [ "$(NEED_FORTC)" = yes ]; then \
+	    $(MAKE) $(MFLAGS) fortc/clean; \
+	else \
+	    :; \
+	fi
+	rm -f $(made_headers) config
+
+distclean::
+	@if [ "$(NEED_FORTC)" = yes ]; then \
+	    $(MAKE) $(MFLAGS) fortc/distclean; \
+	else \
+	    :; \
+	fi
+	rm -f $(made_headers) $(config_headers) config master.mk
+
+Makefile:	Makefile.in master.mk.in
+
+float.h:	config
+	./config -f > $@
+limits.h:	config
+	./config -l > $@
+cfortran.h:	cfortran_h
+	if test "$(PORT_CFORTRAN)" = stdc; then \
+	    sed 's/\/\*\*\//##/g' cfortran_h > $@; \
+	else \
+	    cp cfortran_h $@; \
+	fi
+
+# C compiler information program:
+#
+# NB: config(1) must be compiled unoptimized.  We first assume that `signed
+# char' is valid; if that doesn't work, then we assume it's invalid.  If
+# that doesn't work, the user will have to determine the appropriate
+# compilation flags (see config.c).
+#
+# If the following program won't compile, then contact
+# support at unidata.ucar.edu (ask for Steve).
+#
+config:               config.c
+	if $(CC) config.c -o config 2> /dev/null; then \
+		: true; \
+	else \
+		$(CC) -DNO_SC config.c -o config; \
+	fi
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $(CFLAGS_NETCDF) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CFLAGS_NETCDF) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS) $(CFLAGS_NETCDF) '; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/port
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,104 @@
+# This is the makefile for the Unidata portability package.
+#
+# $Id: Makefile.in_orig,v 1.1 1996/03/28 20:57:38 georgev Exp $
+
+PACKAGE		= udport
+LIBRARY		= udport
+MAJOR_NO	= @MAJOR_NO@
+MINOR_NO	= @MINOR_NO@
+
+CPPFLAGS	= -I. @CPPFLAGS@
+CFLAGS		= @CFLAGS@
+
+PORT_CFORTRAN	= @PORT_CFORTRAN@
+NEED_FORTC	= @NEED_FORTC@
+
+PORT_HEADERS	= @PORT_HEADERS@
+config_headers	= signal.h stdarg.h stddef.h stdlib.h string.h time.h \
+		  udconfig.h udposix.h
+made_headers	= float.h limits.h
+LIBOBJS		= uddummy.o @LIBOBJS@
+
+prefix		= ../../..
+
+SUBDIRS		= @PORT_SUBDIRS@
+SUBDIR_TARGETS	= fortc/all fortc/install fortc/clean fortc/distclean
+MANIFEST        = COPYRIGHT CUSTOMIZE HISTORY Makefile.in VERSION aclocal.m4 \
+		  @PORT_MANIFEST@ \
+		  configure configure.in depend master.mk.in uddummy.c
+
+# Note that the `all' target might not make `fortc/all'.  That will depend 
+# on whether or not that utility is required.
+
+all::		FORCE $(PORT_HEADERS)
+	@if [ "$(NEED_FORTC)" = yes ]; then \
+	    $(MAKE) $(MFLAGS) fortc/all; \
+	else \
+	    :; \
+	fi
+	@$(MAKE) $(MFLAGS) library
+
+# We install the portability library modules directly into an installed
+# portability library even though the package using this portability library
+# (the client package) probably doesn't reference the installed one.  This is
+# done because the client package might be another library and linking
+# against it might require some modules of this library.  We don't install
+# the portability library just created because different packages can require
+# different modules.
+#
+install::	$(LIBOBJS)
+	$(MAKE) $(MFLAGS) $(LIBDIR) LIBDIR=$(LIBDIR)
+	$(AR) rcuv $(LIBDIR)/libudport.a $(LIBOBJS)
+	$(RANLIB) $(LIBDIR)/libudport.a
+
+clean::		FORCE
+	@if [ "$(NEED_FORTC)" = yes ]; then \
+	    $(MAKE) $(MFLAGS) fortc/clean; \
+	else \
+	    :; \
+	fi
+	rm -f $(made_headers) config
+
+distclean::
+	@if [ "$(NEED_FORTC)" = yes ]; then \
+	    $(MAKE) $(MFLAGS) fortc/distclean; \
+	else \
+	    :; \
+	fi
+	rm -f $(made_headers) $(config_headers) config master.mk
+
+Makefile:	Makefile.in master.mk.in
+
+float.h:	config
+	./config -f > $@
+limits.h:	config
+	./config -l > $@
+cfortran.h:	cfortran_h
+	if test "$(PORT_CFORTRAN)" = stdc; then \
+	    sed 's/\/\*\*\//##/g' cfortran_h > $@; \
+	else \
+	    cp cfortran_h $@; \
+	fi
+
+# C compiler information program:
+#
+# NB: config(1) must be compiled unoptimized.  We first assume that `signed
+# char' is valid; if that doesn't work, then we assume it's invalid.  If
+# that doesn't work, the user will have to determine the appropriate
+# compilation flags (see config.c).
+#
+# If the following program won't compile, then contact
+# support at unidata.ucar.edu (ask for Steve).
+#
+config:               config.c
+	if $(CC) config.c -o config 2> /dev/null; then \
+		: true; \
+	else \
+		$(CC) -DNO_SC config.c -o config; \
+	fi
+
+include master.mk
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/VERSION
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/VERSION	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/VERSION	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+1.5.1

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/aclocal.m4
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/aclocal.m4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/aclocal.m4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1157 @@
+define(diversion_number, divnum)dnl
+divert(-1)
+
+
+dnl Define a substitution for both `@...@' and C preprocessor forms.
+dnl
+define(UC_REPLACE, [dnl
+$1=$2
+AC_SUBST($1)dnl
+AC_DEFINE($1,$2)
+])
+
+
+dnl Set the value of a variable.  Use the environment if possible; otherwise
+dnl set it to a default value.  Call the substitute routine.
+dnl
+define([UC_DEFAULT], [dnl
+$1=${$1-"$2"}
+AC_SUBST([$1])
+])
+
+
+dnl Initialize this Unidata autoconf(1)-support module.
+dnl
+define([UC_INIT], [dnl
+AC_INIT($1) dnl
+UC_CUSTOMIZE dnl
+UC_PORT dnl
+])
+
+
+dnl Set up for customizing the makefile in the port/ subdirectory.
+dnl
+define([UC_PORT], [dnl
+TRANSFORMEES='port/Makefile port/master.mk'
+POST_PROCESSEES='port/Makefile'
+UC_DEFAULT(CPPFLAGS, -DNDEBUG) dnl
+UC_DEFAULT(CFLAGS, -O) dnl
+UC_OS dnl
+case "${OS}" in
+  aix*)  UC_ENSURE(CPPFLAGS, -D_ALL_SOURCE);;
+  hpux*) UC_ENSURE(CPPFLAGS, -D_HPUX_SOURCE);;
+esac
+UC_DEFAULT(LIBOBJS, ) dnl
+UC_DEFAULT(PORT_HEADERS, ) dnl
+UC_DEFAULT(PORT_MANIFEST, )
+UC_DEFAULT(PORT_SUBDIRS, )
+UC_PROG_CC dnl
+UC_PROG_AR dnl
+AC_PROG_RANLIB dnl
+])
+
+
+dnl Terminate this Unidata autoconf(1)-support module.
+dnl
+define([UC_TERM], [dnl
+UC_CHECK_MISSING dnl
+UC_POSTPROCESS_MAKEFILES($1) dnl
+])
+
+
+dnl Finish with everything (both GNU and Unidata autoconf(1) support).
+dnl
+define([UC_FINISH], [dnl
+AC_OUTPUT($1 ${TRANSFORMEES-})dnl
+UC_TERM($1 ${POST_PROCESSEES-})dnl
+])
+
+
+dnl Add a member to the list of makefiles to be post-processed.
+dnl
+define([UC_POST_PROCESS], [dnl
+UC_ENSURE(POST_PROCESSEES, $1)dnl
+])
+
+
+dnl Add a member to the list of files to be transformed.
+dnl
+define([UC_CREATE], [dnl
+UC_ENSURE(TRANSFORMEES, $1)dnl
+])
+
+
+dnl Check for functioning `const' keyword
+dnl
+define([UC_CONST], [dnl
+AC_COMPILE_CHECK([working const], , [/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+], dnl
+, dnl
+[AC_DEFINE(UD_NO_CONST)])dnl
+])
+
+
+dnl Check for functioning `signed' keyword
+dnl
+define([UC_SIGNED],
+[AC_COMPILE_CHECK([working signed], ,
+changequote(,)dnl
+signed char x;
+changequote([,])dnl
+, dnl
+, dnl
+[AC_DEFINE(UD_NO_SIGNED)])dnl
+])
+
+
+dnl Check for function prototypes
+dnl
+define([UC_PROTOTYPES],
+[AC_COMPILE_CHECK([function prototypes], ,
+extern int foo(int bar);
+, dnl
+, dnl
+[AC_DEFINE(UD_NO_PROTOTYPES)])dnl
+])
+
+
+dnl Convert argument to uppercase.
+dnl
+define([UC_UPPERCASE],[translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)])
+
+
+dnl Return the C macro name version of the argument.
+dnl
+define([UC_C_MACRONAME], [UC_UPPERCASE([translit($1,/.<>,__)])])
+
+
+dnl Obtain the pathname of a system-supplied header file.  The value of the
+dnl associated shell variable is empty if the header-file could not be found.
+dnl
+define([UC_SYSTEM_HEADER], [dnl
+AC_REQUIRE([UC_PROG_CPP])dnl
+echo "#include <$1.h>" > conftestpath.c
+dnl
+dnl We add additional `/'s to the header file name to preclude compiler 
+dnl warnings about the non-portability of `#include "/usr/include/..."'.
+dnl
+path=`$CPP conftestpath.c 2> /dev/null |
+    sed -n 's/^#.* 1 "\(.*$1\.h\)".*/\1/p' | 
+    head -1`
+if test -z "$path"; then
+    path=/dev/null
+else
+    path=//$path
+fi
+rm -f conftestpath.c
+ifelse($1, limits, , [ifelse($1, float, , [dnl
+UC_CREATE(port/$1.h)dnl
+UC_REPLACE(UD_SYSTEM_[]UC_C_MACRONAME(ifelse($2,,$1,$2))_H,\"$path\")dnl
+])])dnl
+])
+
+
+dnl Define macros for variadic function support
+dnl
+define([UC_VARIADIC_FUNCTIONS],[dnl
+AC_REQUIRE([UC_PROG_CPP])dnl
+UC_ENSURE(PORT_MANIFEST, stdarg.h.in)dnl
+AC_COMPILE_CHECK([variadic function support], [#include <stdarg.h>]
+int foo(int bar, ...) {
+    va_list     alist;
+    va_start(alist, bar);
+    bar = (int)va_arg(alist, int);
+    va_end(alist);
+    return bar;
+}, , [dnl
+UC_REPLACE(UD_NO_STDARG,0)dnl
+UC_SYSTEM_HEADER(stdarg)], [dnl
+UC_REPLACE(UD_NO_STDARG,1)dnl
+UC_SYSTEM_HEADER(varargs, stdarg)])dnl
+UC_ENSURE(PORT_HEADERS, stdarg.h)dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Define macro for string generation
+dnl
+define([UC_MAKESTRING], [dnl
+AC_COMPILE_CHECK([stringization], dnl
+[# define MAKESTRING(x)	#x],
+char *cp = MAKESTRING(foo);
+, dnl
+, dnl
+[AC_DEFINE(UD_NO_STRINGIZATION)])dnl
+])
+
+
+dnl Define macro for token pasting.
+dnl
+define([UC_GLUE], [dnl
+ifdef([AC_PROVIDE_$0], , [
+AC_COMPILE_CHECK([token pasting], [#define GLUE(a,b) a ## b],
+char *GLUE(c,p) = "foo";
+, dnl
+, dnl
+[AC_DEFINE(UD_NO_TOKEN_PASTING)])
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Define pointer-to-void macro.
+dnl
+define([UC_VOIDP],
+[AC_COMPILE_CHECK([void*], ,
+extern void *foo();
+, dnl
+, dnl
+[AC_DEFINE(UD_NO_VOIDSTAR)])])
+
+
+dnl CFORTRAN support:
+dnl
+define([UC_CFORTRAN], [dnl
+ifdef([AC_PROVIDE_$0], , [
+echo "checking for cfortran.h"
+UC_ENSURE(PORT_MANIFEST, cfortran_h)dnl
+UC_ENSURE(PORT_HEADERS, cfortran.h)dnl
+AC_REQUIRE([UC_GLUE])dnl
+case "$DEFS" in
+  *UD_NO_TOKEN_PASTING*) PORT_CFORTRAN=reiser;;
+  *) PORT_CFORTRAN=stdc;;
+esac
+AC_SUBST(PORT_CFORTRAN)dnl
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Check for standard, udposix(3) stuff.
+dnl
+define([UC_UDPOSIX], [dnl
+ifdef([AC_PROVIDE_$0], , [
+AC_REQUIRE([UC_CONST])dnl
+AC_REQUIRE([UC_SIGNED])dnl
+AC_REQUIRE([UC_PROTOTYPES])dnl
+AC_REQUIRE([UC_VARIADIC_FUNCTIONS])dnl
+AC_REQUIRE([UC_MAKESTRING])dnl
+AC_REQUIRE([UC_GLUE])dnl
+AC_REQUIRE([UC_VOIDP])dnl
+UC_ENSURE(PORT_MANIFEST, udposix.h.in)dnl
+UC_ENSURE(PORT_HEADERS, udposix.h)dnl
+UC_CREATE(port/udposix.h)dnl
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Check for a function.
+dnl
+define([UC_FUNC], [dnl
+AC_REPLACE_FUNCS($2)dnl
+case "$LIBOBJS" in
+    *$2.o*) UC_REPLACE([UD_NO_[]UC_UPPERCASE($2)_DECL],1);;
+    *) UC_REPLACE([UD_NO_[]UC_UPPERCASE($2)_DECL],0);;
+esac
+])
+
+
+dnl Check for a type definition.
+dnl
+define([UC_TYPEDEF], [dnl
+AC_COMPILE_CHECK("typedef $2 in $1", [#include $1
+typedef void $2;], , [dnl
+UC_REPLACE(UD_NO_[]UC_C_MACRONAME($1[]_$2),1)dnl
+], [dnl
+UC_REPLACE(UD_NO_[]UC_C_MACRONAME($1[]_$2),0)dnl
+])dnl
+])
+
+
+dnl Check for a structure definition.
+dnl
+define([UC_STRUCT], [dnl
+AC_COMPILE_CHECK(structure $2, [#include $1
+struct $2 {char *foo;};], , [dnl
+UC_REPLACE(UD_NO_[]UC_UPPERCASE($2)[]_STRUCT,1)dnl
+], [dnl
+UC_REPLACE(UD_NO_[]UC_UPPERCASE($2)[]_STRUCT,0)dnl
+])dnl
+])
+
+
+dnl Ensure a macro definition.
+dnl
+define([UC_MACRO], [dnl
+AC_COMPILE_CHECK(macro $2, [#include $1
+#ifdef $2
+  error
+#endif], , 
+[UC_REPLACE(UD_NO_[]UC_UPPERCASE($2)_MACRO,1)],
+[UC_REPLACE(UD_NO_[]UC_UPPERCASE($2)_MACRO,0)])dnl
+])
+
+
+dnl Check for POSIX threads.
+dnl
+define([UC_PTHREADS], [dnl
+ifdef([AC_PROVIDE_$0], , [dnl
+AC_BEFORE([$0], [UC_UDPOSIX_ERRNO])dnl
+AC_BEFORE([$0], [UC_UDPOSIX_LIMITS])dnl
+AC_BEFORE([$0], [UC_UDPOSIX_SETJMP])dnl
+AC_BEFORE([$0], [UC_UDPOSIX_SIGNAL])dnl
+AC_BEFORE([$0], [UC_UDPOSIX_UNISTD])dnl
+echo checking for POSIX threads
+UC_TEST_DIR(CPP_PTHREADS,
+    /usr/include /usr/gnu/include /usr/local/include /usr/local/gnu/include,
+    pthread.h,
+    [POSIX threads [[include]]-directory],
+    [-I/usr/local/[[include]]])dnl
+case "$CPP_PTHREADS" in
+    -I*) ;;
+    /usr/include)  CPP_PTHREADS=;;
+    *) CPP_PTHREADS=-I$CPP_PTHREADS;;
+esac
+DEFS="$DEFS $CPP_PTHREADS"
+UC_TEST_LIB(LD_PTHREADS,
+    /lib /usr/lib /usr/gnu /usr/local/lib /usr/local/gnu/lib,
+    pthreads,
+    POSIX threads,
+    -L/usr/local/lib -lpthreads)dnl
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Ensure a POSIX <limits.h>.
+dnl
+define([UC_UDPOSIX_LIMITS], [dnl
+ifdef([AC_PROVIDE_$0], , [dnl
+AC_REQUIRE([UC_PROG_CC])dnl
+AC_REQUIRE([UC_UDPOSIX])dnl
+UC_ENSURE(PORT_MANIFEST, config.c)dnl
+AC_HEADER_CHECK(UC_SYSTEM_HEADER(limits), , dnl
+[UC_ENSURE(PORT_HEADERS, limits.h)])dnl
+])])
+
+
+dnl Ensure a POSIX <float.h>.
+dnl
+define([UC_UDPOSIX_FLOAT], [dnl
+ifdef([AC_PROVIDE_$0], , [dnl
+AC_REQUIRE([UC_PROG_CC])dnl
+AC_REQUIRE([UC_UDPOSIX])dnl
+echo "checking for conforming <float.h>"
+UC_ENSURE(PORT_MANIFEST, config.c)dnl
+AC_TEST_CPP([#include <float.h>
+#define DBL_DIG foobar], dnl
+[UC_ENSURE(PORT_HEADERS, float.h)])dnl
+])])
+
+
+dnl Ensure a POSIX <stdarg.h>.
+dnl
+define([UC_UDPOSIX_STDARG], [dnl
+AC_REQUIRE([UC_VARIADIC_FUNCTIONS])dnl
+])
+
+
+dnl Ensure a POSIX <stddef.h>.
+dnl
+define([UC_UDPOSIX_STDDEF], [dnl
+ifdef([AC_PROVIDE_$0], , [dnl
+AC_REQUIRE([UC_UDPOSIX])dnl
+UC_ENSURE(PORT_MANIFEST, stddef.h.in)dnl
+UC_ENSURE(PORT_HEADERS, stddef.h)dnl
+UC_SYSTEM_HEADER(stddef)dnl
+UC_MACRO(<stddef.h>, offsetof, (type\, member), dnl
+    ((size_t)\&((type*)0)->member))dnl
+UC_TYPEDEF(<stddef.h>, size_t)dnl
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Ensure a POSIX <stdlib.h>.
+dnl
+define([UC_UDPOSIX_STDLIB], [dnl
+AC_REQUIRE([UC_UDPOSIX])dnl
+UC_ENSURE(PORT_MANIFEST, stdlib.h.in atexit.c)dnl
+UC_ENSURE(PORT_HEADERS, stdlib.h)dnl
+UC_SYSTEM_HEADER(stdlib)dnl
+dnl UC_TYPEDEF(<stdlib.h>, div_t, struct div { int quot; int rem; })dnl
+dnl UC_TYPEDEF(<stdlib.h>, ldiv_t, struct ldiv { long quot; long rem; })dnl
+UC_TYPEDEF(<stdlib.h>, size_t)dnl
+UC_FUNC(<stdlib.h>, atexit, int atexit, (void (*fcn)(void)))dnl
+UC_FUNC(<stdlib.h>, getenv)dnl
+AC_HAVE_FUNCS(on_exit)dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Ensure a POSIX <string.h>.
+dnl
+define([UC_UDPOSIX_STRING], [dnl
+AC_REQUIRE([UC_UDPOSIX])dnl
+UC_ENSURE(PORT_MANIFEST, strerror.c string.h strstr.c string.h.in)dnl
+UC_ENSURE(PORT_HEADERS, string.h)dnl
+UC_SYSTEM_HEADER(string)dnl
+UC_TYPEDEF(<string.h>, size_t)dnl
+UC_FUNC(<string.h>, strerror, char *strerror, (int errno))dnl
+UC_FUNC(<string.h>, strstr, char *strstr, 
+    (const char *cs\, const char *ct))dnl
+AC_HAVE_FUNCS(bcopy [[index]] rindex)dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Ensure a POSIX <time.h>.
+dnl
+define([UC_UDPOSIX_TIME], [dnl
+ifdef([AC_PROVIDE_$0], , [
+AC_REQUIRE([UC_UDPOSIX])dnl
+UC_ENSURE(PORT_MANIFEST, difftime.c strftime.c time.h.in)dnl
+UC_ENSURE(PORT_HEADERS, time.h)dnl
+UC_SYSTEM_HEADER(time)dnl
+UC_TYPEDEF(<time.h>, time_t)dnl
+UC_TYPEDEF(<time.h>, size_t)dnl
+UC_FUNC(<time.h>, difftime)dnl
+UC_FUNC(<time.h>, strftime)dnl
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Ensure a POSIX <signal.h>.
+dnl
+define([UC_UDPOSIX_SIGNAL], [dnl
+AC_REQUIRE([UC_UDPOSIX])dnl
+UC_ENSURE(PORT_MANIFEST, signal.h.in sigaddset.c \
+    sigdelset.c sigemptyset.c sigfillset.c sigismember.c sigpending.c \
+    sigprocmask.c sigsuspend.c)dnl
+UC_ENSURE(PORT_HEADERS, signal.h)dnl
+UC_SYSTEM_HEADER(signal)dnl
+UC_TYPEDEF(<signal.h>, sigset_t)dnl
+UC_TYPEDEF(<signal.h>, sig_atomic_t)dnl
+UC_STRUCT(<signal.h>, sigaction)dnl
+UC_FUNC(<signal.h>, sigemptyset, int sigemptyset, (sigset_t *set))dnl
+UC_FUNC(<signal.h>, sigfillset, int sigfillset, (sigset_t *set))dnl
+UC_FUNC(<signal.h>, sigaddset, int sigaddset, (sigset_t *set\, int signo))dnl
+UC_FUNC(<signal.h>, sigdelset, int sigdelset, (sigset_t *set\, int signo))dnl
+UC_FUNC(<signal.h>, sigismember, int sigismember, (const sigset_t *set\, int signo))dnl
+UC_FUNC(<signal.h>, sigaction, int sigaction, (int sig\, const struct sigaction *act\, struct sigaction *oact))dnl
+UC_FUNC(<signal.h>, sigprocmask, int sigprocmask, (int how\, const sigset_t *set\, sigset_t *oset))dnl
+UC_FUNC(<signal.h>, sigpending, int sigpending, (sigset_t *set))dnl
+UC_FUNC(<signal.h>, sigsuspend, int sigsuspend, (const sigset_t *set))dnl
+AC_HAVE_FUNCS(sigvec sigblock sigpause sigsetmask sigstack bsdsigp)dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Ensure a POSIX <unistd.h>.
+dnl
+define([UC_UDPOSIX_UNISTD], [dnl
+ifdef([AC_PROVIDE_$0], , [
+AC_REQUIRE([UC_UDPOSIX])dnl
+UC_ENSURE(PORT_MANIFEST, unistd.h.in)dnl
+UC_ENSURE(PORT_HEADERS, unistd.h)dnl
+UC_SYSTEM_HEADER(unistd)dnl
+UC_TYPEDEF(<unistd.h>, size_t)dnl
+UC_FUNC(<unistd.h>, getlogin)dnl
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Ensure a <select.h>.
+dnl
+define([UC_SELECT], [dnl
+UC_ENSURE(PORT_MANIFEST, select.h)dnl
+UC_SYSTEM_HEADER(sys/select)dnl
+])
+
+
+dnl Check for C compiler.  This macro replaces the AC_PROG_CC macro because 
+dnl that macro prefers the GNU C compiler.  Note that `c89' isn't checked for;
+dnl this is because that compiler hides things like NBBY.
+dnl
+define([UC_PROG_CC], [dnl
+ifdef([AC_PROVIDE_$0], , [
+AC_BEFORE([$0], [UC_PROG_CPP])dnl
+AC_PROGRAM_CHECK(CC, cc, cc, )dnl
+if test -z "$CC"; then
+  UC_NEED_VALUE(CC, [C compiler], /bin/cc)dnl
+fi
+dnl Find out if we are using GNU C, under whatever name.
+cat <<EOF > conftest.c
+#ifdef __GNUC__
+  yes
+#endif
+EOF
+${CC-cc} -E conftest.c > conftest.out 2>&1
+if egrep yes conftest.out >/dev/null 2>&1; then
+  GCC=1 # For later tests.
+  CC="$CC -O"
+fi
+rm -f conftest*
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Check for which(1)
+dnl
+define([UC_PROG_WHICH], [dnl
+ifdef([AC_PROVIDE_$0], , [dnl
+UC_ENSURE(PORT_MANIFEST, which)dnl
+AC_PROGRAM_CHECK(WHICH, which, which, [UC_ABSPATH(port)]/which)dnl
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Check for cpp(1).  This macro replaces the AC_PROG_CPP macro because:
+dnl	1. That macro, for some reason, sets the value of the shell 
+dnl	   variable `CPP' to `${CC-cc} -E' rather than to the cpp(1)
+dnl	   program and such a value has caused trouble in shell command
+dnl	   lines;
+dnl	2. The documentation explicitly states that the AC_PROG_CPP macro 
+dnl	   should be called after the AC_PROG_CC macro, so there's no reason 
+dnl	   for the above value that I can see; and
+dnl	3. We need to discover when ${CPP} doesn't work (e.g. when it's 
+dnl	   defined as `acc -E' under older versions of SunOS).
+dnl
+define([UC_PROG_CPP], [dnl
+ifdef([AC_PROVIDE_$0], , [dnl
+AC_REQUIRE([UC_PROG_WHICH])dnl
+AC_REQUIRE([UC_PROG_CC])dnl
+AC_PROG_CPP[]dnl
+CPP=`eval echo $CPP`
+echo "#include <stdlib.h>" > conftest.c
+if test `$CPP conftest.c 2> /dev/null | wc -l` = 0; then
+  if test "$CPP" = cpp; then
+    echo 1>&2 "$[]0: C preprocessor, \`$CPP', doesn't work"
+    UC_NEED_VALUE(CPP, [C preprocessor], /lib/cpp)dnl
+  else
+    echo 1>&2 "$[]0: C preprocessor, \`$CPP', doesn't work; setting to \`cpp'"
+    CPP=cpp
+    if test `$(WHICH) ${CPP} 2>&1 | wc -w` != 1; then
+      echo 1>&2 "$[]0: C preprocessor, \`$CPP', doesn't exist"
+      UC_NEED_VALUE(CPP, [C preprocessor], /lib/cpp)dnl
+    fi
+  fi
+fi
+rm -f conftest.c
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Check for FORTRAN compiler.
+dnl
+define([UC_PROG_FC], [dnl
+ifdef([AC_PROVIDE_$0], , [ dnl
+AC_REQUIRE([UC_OS])dnl
+case "$OS" in
+  hpux*) AC_PROGRAMS_CHECK(FC, fort77 fortc f77);;
+  dgux*) AC_PROGRAMS_CHECK(FC, ghf77 f77);;
+  *)     AC_PROGRAMS_CHECK(FC, f77 cf77 fc);;
+esac
+if test -z "$FC"; then
+  UC_ENSURE(FC, NONE)
+  echo "configure: Was unable to find a Fortran compiler on this machine."
+fi
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Check for FORTRAN library.
+dnl
+define([UC_LIB_F77], [dnl
+ifdef([AC_PROVIDE_$0], , [ dnl
+AC_REQUIRE([UC_PROG_FC])dnl
+AC_REQUIRE([UC_PROG_WHICH])dnl
+echo checking for FORTRAN library
+case `$(WHICH) "$FC"` in
+  *lang*) LD_F77='-lF77 -lM77';;
+  *)	  LD_F77='-lF77';;
+esac
+AC_SUBST(LD_F77)dnl
+AC_PROVIDE([$0])dnl
+])
+])
+
+
+dnl Check for library utility, ar(1).
+dnl
+define([UC_PROG_AR], [dnl
+AC_PROGRAM_CHECK(AR, ar, ar, )dnl
+if test -z "$AR"; then
+  UC_NEED_VALUE(AR, [library utility], /bin/ar)dnl
+fi
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for troff(1).
+dnl
+define([UC_PROG_TROFF], [dnl
+AC_PROGRAM_CHECK(TROFF, troff, ptroff, troff)dnl
+if test -z "$TROFF"; then
+  UC_NEED_VALUE(TROFF, [troff(1)-like utility], /bin/troff)dnl
+fi
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for fortc(1)
+dnl
+define([UC_PROG_FORTC], [dnl
+AC_REQUIRE([UC_OS])dnl
+AC_REQUIRE([UC_UDPOSIX_STDDEF])dnl
+UC_ENSURE(PORT_SUBDIRS, fortc)dnl
+UC_ENSURE(PORT_MANIFEST, fortc.h fortc.fc udalloc.h)dnl
+UC_CREATE(port/fortc/Makefile)dnl
+UC_POST_PROCESS(port/fortc/Makefile)dnl
+dir=`pwd`/port/fortc
+FORTC="$dir/fortc"
+AC_SUBST(FORTC)dnl
+NEED_FORTC=yes
+AC_SUBST(NEED_FORTC)dnl
+])
+
+
+dnl Check for neqn(1).
+dnl
+define([UC_PROG_NEQN], [dnl
+AC_PROGRAM_CHECK(NEQN, neqn, neqn, cat)dnl
+test "$NEQN" = cat && 
+  echo 1>&2 "$[]0: Can't find program \`neqn'; setting to \`cat'"
+])
+
+
+dnl Check for tbl(1).
+dnl
+define([UC_PROG_TBL], [dnl
+AC_PROGRAM_CHECK(TBL, tbl, tbl, cat)dnl
+test "$TBL" = cat && 
+  echo 1>&2 "$[]0: Can't find program \`tbl'; setting to \`cat'"
+])
+
+
+dnl Check for makeinfo(1).
+dnl
+define([UC_PROG_MAKEINFO], [dnl
+AC_PROGRAM_CHECK(MAKEINFO, makeinfo, makeinfo)dnl
+])
+
+
+dnl Determine the operating system.
+dnl
+define([UC_OS], [dnl
+ifdef([AC_PROVIDE_$0], , [
+if test -z "$OS"; then
+echo checking for type of operating system
+cat << \CAT_EOF > conftest.c
+#ifdef __osf__
+OS_osf
+#endif
+#ifdef _AIX
+OS_aix
+#endif
+#ifdef __DGUX__
+OS_dgux
+#endif
+#ifdef hpux
+OS_hpux
+#endif
+#ifdef NeXT
+OS_nextos
+#endif
+#ifdef sgi
+OS_irix
+#endif
+#ifdef sun
+OS_sunos
+#endif
+#ifdef ultrix
+OS_ultrix
+#endif
+#ifdef _UNICOS
+OS_unicos
+#endif
+#ifdef __convex__
+OS_convex
+#endif
+#ifdef masscomp
+OS_rtu
+#endif
+CAT_EOF
+OS=`cc -E conftest.c | sed -n '/^OS_/ {
+  s///p
+  q
+}'`
+rm conftest.c
+if test -z "$OS"; then
+  UC_NEED_VALUE(OS, [operating system], sunos)dnl
+fi
+fi
+AC_SUBST(OS)dnl
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Determine the machine type.
+dnl
+define([UC_MACHINE], [dnl
+ifdef([AC_PROVIDE_$0], , [
+if test -z "$MACHINE"; then
+echo checking for type of machine
+MACHINE=`uname -m | tr A-Z a-z`
+if test -z "$MACHINE"; then
+  UC_NEED_VALUE(MACHINE, [machine hardware type], sun4c)dnl
+fi
+fi
+AC_SUBST(MACHINE)dnl
+AC_PROVIDE([$0])dnl
+])])
+
+
+dnl Check for ncdump(1)
+dnl
+ncdump=${NCDUMP-}
+NCDUMP=
+AC_PROGRAMS_CHECK(NCDUMP, $ncdump ncdump UC_ABSPATH($exec_prefix)/ncdump)dnl
+if test -z "$NCDUMP"; then
+  UC_NEED_VALUE(NCDUMP, [netCDF lister], /usr/local/unidata/bin/ncdump)dnl
+fi
+])
+
+
+dnl Check for ncgen(1)
+dnl
+ncgen=${NCGEN-}
+NCGEN=
+AC_PROGRAMS_CHECK(NCGEN, $ncgen ncgen UC_ABSPATH($exec_prefix)/ncgen)dnl
+if test -z "$NCGEN"; then
+  UC_NEED_VALUE(NCGEN, [netCDF generator], /usr/local/unidata/bin/ncgen)dnl
+fi
+])
+
+
+dnl Test a script.
+dnl
+define([UC_TEST_SCRIPT],
+[cat << EOF > conftest.sh
+[$1]
+EOF
+chmod +x conftest.sh
+if ./conftest.sh 2> /dev/null; then
+  ifelse([$2], , :, [$2])
+ifelse([$3], , , [else
+  $3
+])dnl
+fi
+rm -f conftest.sh
+])dnl
+
+
+dnl Filter a file through cpp(1).
+dnl
+define([UC_FILTER_CPP], [dnl
+AC_REQUIRE([UC_PROG_CPP])dnl
+echo processing $1 with the C preprocessor to produce $2
+ifdef([AC_CONFIG_NAME],
+UC_TEST_SCRIPT([dnl
+echo "$DEFS" > conftest.c
+echo "dnl line 1 $1" >> conftest.c
+cat $1 >> conftest.c
+$CPP conftest.c | \
+    awk '/^$/ {if (set) next; set=1} {print} !/^$/ {set=0}' > $2
+rm -f conftest.c]), dnl
+[UC_TEST_SCRIPT(
+[$CPP "$DEFS" $1 | \
+    awk '/^$/ {if (set) next; set=1} {print} !/^$/ {set=0}' > $2])])])
+
+
+dnl Convert a pathname to an absolute one at autoconf(1) execution time.
+dnl
+define([UC_ABSPATH_M4], [dnl
+syscmd([case "$1" in 
+  /*) echo $1; exit;;
+   *) path=`pwd`/$1
+      tail=
+      while test -n "$path"; do
+        (cd $path && echo `pwd`$rest) 2> /dev/null && exit
+        base=/`basename "$path"`
+        tail=/$base$tail
+        path=`echo "$path" | sed "s/\/$base//"`
+      done;;
+esac > conftest.syscmd 2>&1
+])dnl
+include(conftest.syscmd)dnl
+])
+
+
+dnl Convert a pathname to an absolute one at ./configure execution time.
+dnl
+define([UC_ABSPATH], [`dnl
+case "$1" in 
+  /*[)] echo $1; exit;;
+   *[)] path=\`pwd\`/$1
+        tail=
+        while test -n "$path"; do
+          (cd $path && echo \`pwd\`$rest) 2> /dev/null && exit
+          base=/\`basename "$path"\`
+          tail=/$base$tail
+          path=\`echo "$path" | sed "s/\/$base//"\`
+        done;;
+esac
+`])
+
+
+dnl Set a value for the installation prefix.
+dnl
+define([UC_PREFIX], 
+[AC_BEFORE([$0],[UC_PROG_FORTC])dnl
+AC_BEFORE([$0],[UC_LIB_NETCDF])AC_BEFORE([$0],[UC_CPP_NETCDF])dnl
+AC_BEFORE([$0],[UC_LIB_NCOPERS])AC_BEFORE([$0],[UC_CPP_NCOPERS])dnl
+AC_BEFORE([$0],[UC_LIB_UDPORT])dnl
+echo setting the installation prefix
+prefix=UC_ABSPATH(${prefix-$1})
+test -z "$exec_prefix" && exec_prefix=$prefix/bin
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for a directory containing a file.
+dnl
+define([UC_TEST_DIR], [dnl
+  if test -z "$$1"; then
+    for dir in $2; do
+      if test -r $dir/$3; then
+        $1=$dir
+        break;
+      fi
+    done
+    if test -z "$$1"; then
+      UC_NEED_VALUE($1, $4, $5)dnl
+    fi
+  fi
+AC_SUBST($1)dnl
+])
+
+
+dnl Check for X11 header-file directory.
+dnl
+define([UC_CPP_X11], [dnl
+echo checking for X11 header-files
+UC_TEST_DIR(CPP_X11, ${OPENWINHOME-/usr/openwin}/[[include]] \
+    /usr/[[include]] /usr/local/[[include]], X11/Xlib.h,
+    X11 [[[include]]]-directory, -I/usr/openwin/[[[include]]])dnl
+CPP_X11=`case ${CPP_X11} in -I*) echo ${CPP_X11};; *) echo -I${CPP_X11-};; esac`
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for McIDAS library.
+dnl
+define([UC_LIB_MCIDAS], [dnl
+echo checking for MCIDAS library
+UC_TEST_LIB(LD_MCIDAS, /home/mcidas/lib /home/mcidasd/lib, mcidas, McIDAS, dnl
+  -L/home/mcidas/lib -lmcidas)dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for X11 library.
+dnl
+define([UC_LIB_X11], [dnl
+echo checking for X11 library
+UC_TEST_LIB(LD_X11, ${OPENWINHOME-/usr/openwin}/lib /usr/lib dnl
+  /usr/lib/X11 /usr/local/lib /usr/local/lib/X11, X11, X11, dnl
+  -L/usr/lib/X11 -lX11)dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for X11 implementation (header file and library).
+dnl
+define([UC_X11], [AC_REQUIRE([UC_CPP_X11])AC_REQUIRE([UC_LIB_X11])])
+
+
+dnl Check for netCDF header-file directory.
+dnl
+define([UC_CPP_NETCDF], [dnl
+echo checking for netCDF header-file
+UC_TEST_DIR(CPP_NETCDF, UC_ABSPATH($prefix/[[[include]]]), netcdf.h,
+    [netCDF [[include]]-directory], [-I/usr/local/unidata/[[include]]])dnl
+CPP_NETCDF=`case ${CPP_NETCDF} in -I*) echo ${CPP_NETCDF};; *) echo -I${CPP_NETCDF-};; esac`
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for netCDF library.
+dnl
+define([UC_LIB_NETCDF], [dnl
+echo checking for netCDF library
+UC_TEST_LIB(LD_NETCDF, UC_ABSPATH($prefix/lib), netcdf,
+  netCDF, -L/usr/local/unidata/lib -lnetcdf)dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for netCDF implementation (header file and library).
+dnl
+define([UC_NETCDF], [AC_REQUIRE([UC_CPP_NETCDF])AC_REQUIRE([UC_LIB_NETCDF])])
+
+
+dnl Check for netCDF operators library.
+dnl
+define([UC_LIB_NCOPERS], [dnl
+echo checking for netCDF operators library
+UC_TEST_LIB(LD_NCOPERS, UC_ABSPATH($prefix/lib), ncopers,
+  netCDF-operators, [-L/usr/local/unidata/lib -lncopers])dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for LDM header-file directory.
+dnl
+define([UC_CPP_LDM], [dnl
+echo checking for LDM header-file
+UC_TEST_DIR(CPP_LDM, UC_ABSPATH($prefix/[[[include]]]) dnl
+    UC_ABSPATH($prefix/../[[[include]]]) dnl
+    UC_ABSPATH($prefix/../ldm/[[[include]]]), ldm.h,
+    [LDM [[include]]-directory], [-I/usr/local/unidata/[[include]]])dnl
+CPP_LDM=`case ${CPP_LDM} in -I*) echo ${CPP_LDM};; *) echo -I${CPP_LDM-};; esac`
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for LDM library.
+dnl
+define([UC_LIB_LDM], [dnl
+echo checking for LDM library
+UC_TEST_LIB(LD_LDM, UC_ABSPATH($prefix/lib) dnl
+  UC_ABSPATH($prefix/../lib) UC_ABSPATH($prefix/../ldm/lib), ldm,
+  LDM, -L/usr/local/unidata/lib -lldm)dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for LDM implementation (header file and library).
+dnl
+define([UC_LDM], [AC_REQUIRE([UC_CPP_LDM])AC_REQUIRE([UC_LIB_LDM])])
+
+
+dnl Check for udres(3) library.
+dnl
+define([UC_LIB_UDRES], [dnl
+echo 'checking for udres library'
+UC_TEST_LIB(LD_UDRES, UC_ABSPATH($prefix/lib), udape,
+  udres, -L/usr/local/unidata/lib -ludape)dnl
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Set installation programs.  This differs from the standard
+dnl autoconf(1) macro by making installed data files group writable.
+dnl
+define([UC_PROG_INSTALL], [dnl
+AC_PROG_INSTALL[]dnl
+INSTALL_DATA="`echo "${INSTALL_DATA}" | sed 's/644/664/'`"
+AC_PROVIDE([$0])dnl
+])
+
+
+dnl Check for a library.  It would have been nice to see if a compile-link-
+dnl execute sequence would have worked (via AC_TEST_PROGRAM) but, with dynamic
+dnl libraries under SunOS, the link and execution fail due to unresolved 
+dnl references.  Ergo, we just check for the regular `.a' file.
+dnl
+define([UC_TEST_LIB], [dnl
+if test -z "$$1"; then
+  for dir in $2; do
+    if test -r $dir/lib$3.a; then
+      $1="-L$dir -l$3"
+      break
+    fi
+  done
+  if test -z "$$1"; then
+      UC_NEED_VALUE($1, [$4 library], $5)dnl
+  fi
+fi
+AC_SUBST($1)dnl
+])
+
+
+dnl Check for missing definitions.
+dnl
+define([UC_CHECK_MISSING], [dnl
+if test -s conf.missing; then
+  cat << CAT_EOF
+
+$[]0: The following variables need values.  They may be set in
+the environment or in the file CUSTOMIZE.  Variables referring to
+executable programs needn't be set if the relevant directory is added to
+PATH.  In any case, ./configure should probably be rerun.  See file INSTALL
+for details.
+
+CAT_EOF
+  awk -F: 'BEGIN {printf "%-13s%-27s%s\n", "VARIABLE", "MEANING", "EXAMPLE";
+	          printf "%-13s%-27s%s\n", "--------", "-------", "-------"}
+	         {printf "%-13s%-27s%s\n", $[]1, $[]2, $[]3}' conf.missing
+  rm conf.missing
+  exit 1
+fi
+rm -f conf.missing
+])
+
+
+dnl Post process makefiles.
+dnl
+define([UC_POSTPROCESS_MAKEFILES], [dnl
+AC_REQUIRE([UC_PROG_CC])dnl
+define([dn],divnum)divert(-1)undivert[]divert(dn)undefine([dn])dnl
+dnl Post process any makefiles.
+dnl
+dnl Create a script to accomplish the post processing.
+dnl
+cat << EOF_CONFTEST_SH > conftest.sh
+cat << EOF_CONFTEST_C > conftest.c
+#include <stdio.h>
+main()
+{
+    return readsub((char*)NULL) ? 0 : 1;
+}
+readsub(inpath)
+    char	*inpath;
+{
+    char	buf[[2048]], path[[1024]];
+    FILE	*fp	= inpath == NULL
+				? stdin
+				: fopen(inpath, "r");
+    if (fp == NULL) {
+	(void) perror(inpath);
+	return 0;
+    }
+    buf[[sizeof(buf)-1]]	= 0;
+    while (fgets(buf, sizeof(buf), fp) != NULL) {
+      if (sscanf(buf, "[include]%*[[] \\t[]]%s", path) == 1) {
+          if (!readsub(path))
+		return 0;
+	} else {
+	    (void) fputs(buf, stdout);
+	}
+    }
+    return 1;
+}
+EOF_CONFTEST_C
+if $CC -o conftest conftest.c; then
+    conftest=\`pwd\`/conftest
+    set $1
+    for file do
+      echo post processing makefile \\\`\$file\\'
+      sd=\`pwd\`/\`echo \$file | sed 's,[[^/]]*\$,,'\`
+      base=\`basename \$file\`
+      (cd \$sd; \$conftest < \$base > conftest.mk && mv conftest.mk \$base)
+    done
+fi
+rm conftest conftest.c
+EOF_CONFTEST_SH
+dnl
+dnl Append the above script to the output-script file, config.status, so that 
+dnl invoking that file will also do the post processing.  Note that the 
+dnl output-script file will be invoked by ./configure before the post-
+dnl processing code is appended.
+dnl
+cat conftest.sh >> config.status
+dnl
+dnl If appropriate, do the postprocessing now because the previous step 
+dnl couldn't.
+dnl
+test -n "$no_create" || sh conftest.sh
+rm conftest.sh
+])
+
+
+dnl Get shell-variable override values for local customizations.
+dnl
+define([UC_CUSTOMIZE], [dnl
+AC_BEFORE([$0], [UC_DEFAULT])dnl
+if [[ -r CUSTOMIZE ]]; then
+  echo reading configuration customizations
+  . ./CUSTOMIZE
+fi
+])
+
+
+dnl Set the root of the FTP distribution directory.
+dnl
+define([UC_FTPDIR], [dnl
+FTPDIR=${FTPDIR-/home/ftp}/$1
+AC_SUBST(FTPDIR)dnl
+])
+
+
+dnl Set package name.
+dnl
+define([UC_PACKAGE], [dnl
+echo checking for package name
+PACKAGE=${PACKAGE-`basename \`pwd\``}
+AC_SUBST(PACKAGE)dnl
+])
+
+
+dnl Set version identifiers.
+dnl
+define([UC_VERSION], [dnl
+echo checking for package version
+if test -z "$VERSION"; then
+  if test -r VERSION; then \
+    VERSION="`cat VERSION`"
+  else
+    VERSION=
+  fi
+fi
+AC_SUBST(VERSION)dnl
+if test -z "$MAJOR_NO"; then
+  if test -n "$VERSION"; then \
+    MAJOR_NO=`echo $VERSION |
+      sed -n '/^\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*.*/s//\1/p;q'`
+  else
+    MAJOR_NO=
+  fi
+fi
+AC_SUBST(MAJOR_NO)dnl
+if test -z "$MINOR_NO"; then
+  if test -n "$VERSION"; then \
+    MINOR_NO=`echo $VERSION |
+      sed -n '/^[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\).*/s//\1/p;q'`
+  else
+    MINOR_NO=
+  fi
+fi
+AC_SUBST(MINOR_NO)dnl
+])
+
+
+dnl Handle a missing value.
+dnl
+define([UC_NEED_VALUE], [dnl
+echo "$1:$2:$3" >> conf.missing
+])
+
+
+dnl Ensure that a variable contains a given string and that it's substituted.
+dnl
+define([UC_ENSURE], [dnl
+ifelse($2, , [dnl
+  $1=${$1-}
+], [dnl
+  for arg in $2; do
+    case "$$1" in
+      *$arg*[)] ;;
+      *[)]      $1="${$1-} $arg";;
+    esac
+  done
+])dnl
+AC_SUBST($1)dnl
+]dnl
+)
+
+
+divert(diversion_number)dnl

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/configure
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/configure	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/configure	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,1407 @@
+#!/bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf.
+# Copyright (C) 1991, 1992, 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, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
+#        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
+# Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
+# --with-PACKAGE unless this script has special code to handle it.
+
+
+for arg
+do
+  # Handle --exec-prefix with a space before the argument.
+  if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
+  # Handle --host with a space before the argument.
+  elif test x$next_host = xyes; then next_host=
+  # Handle --prefix with a space before the argument.
+  elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
+  # Handle --srcdir with a space before the argument.
+  elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
+  else
+    case $arg in
+     # For backward compatibility, also recognize exact --exec_prefix.
+     -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
+	exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
+     -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
+	next_exec_prefix=yes ;;
+
+     -gas | --gas | --ga | --g) ;;
+
+     -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
+     -host | --host | --hos | --ho | --h)
+	next_host=yes ;;
+
+     -nfp | --nfp | --nf) ;;
+
+     -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
+        no_create=1 ;;
+
+     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+	prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
+     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+	next_prefix=yes ;;
+
+     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
+	srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
+     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
+	next_srcdir=yes ;;
+
+     -with-* | --with-*)
+       package=`echo $arg|sed 's/-*with-//'`
+       # Delete all the valid chars; see if any are left.
+       if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
+         echo "configure: $package: invalid package name" >&2; exit 1
+       fi
+       eval "with_`echo $package|sed s/-/_/g`=1" ;;
+
+     *) ;;
+    esac
+  fi
+done
+
+trap 'rm -f conftest* core; exit 1' 1 3 15
+
+rm -f conftest*
+compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+unique_file=udposix.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  srcdirdefaulted=yes
+  # Try the directory containing this script, then `..'.
+  prog=$0
+  confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
+  test "X$confdir" = "X$prog" && confdir=.
+  srcdir=$confdir
+  if test ! -r $srcdir/$unique_file; then
+    srcdir=..
+  fi
+fi
+if test ! -r $srcdir/$unique_file; then
+  if test x$srcdirdefaulted = xyes; then
+    echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
+  else
+    echo "configure: Can not find sources in \`${srcdir}'." 1>&2
+  fi
+  exit 1
+fi
+# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
+# But we can't avoid them for `..', to make subdirectories work.
+case $srcdir in
+  .|/*|~*) ;;
+  *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
+esac
+ if [ -r CUSTOMIZE ]; then
+  echo reading configuration customizations
+  . ./CUSTOMIZE
+fi
+    for arg in udposix.h.in; do
+    case "$PORT_MANIFEST" in
+      *$arg*) ;;
+      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
+    esac
+  done
+CPPFLAGS=${CPPFLAGS-"-DNDEBUG"}
+
+ CFLAGS=${CFLAGS-"-O"}
+
+ 
+if test -z "$OS"; then
+echo checking for type of operating system
+cat << \CAT_EOF > conftest.c
+#ifdef __osf__
+OS_osf
+#endif
+#ifdef _AIX
+OS_aix
+#endif
+#ifdef hpux
+OS_hpux
+#endif
+#ifdef sgi
+OS_irix
+#endif
+#ifdef sun
+OS_sunos
+#endif
+#ifdef ultrix
+OS_ultrix
+#endif
+#ifdef _UNICOS
+OS_unicos
+#endif
+#ifdef masscomp
+OS_rtu
+#endif
+CAT_EOF
+OS=`cc -E conftest.c | sed -n '/^OS_/ {
+  s///p
+  q
+}'`
+rm conftest.c
+if test -z "$OS"; then
+  echo "OS:operating system:sunos" >> conf.missing
+fi
+fi
+ case "${OS}" in
+  aix*)    for arg in -D_ALL_SOURCE; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="$CPPFLAGS $arg";;
+    esac
+  done
+;;
+  hpux*)   for arg in -D_HPUX_SOURCE; do
+    case "$CPPFLAGS" in
+      *$arg*) ;;
+      *)      CPPFLAGS="$CPPFLAGS $arg";;
+    esac
+  done
+;;
+esac
+LIBOBJS=${LIBOBJS-""}
+
+ PORT_HEADERS=${PORT_HEADERS-""}
+
+ PORT_MANIFEST=${PORT_MANIFEST-""}
+
+
+PORT_SUBDIRS=${PORT_SUBDIRS-""}
+
+
+
+if test -z "$CC"; then
+  echo checking for cc
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/cc; then
+      CC="cc"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$CC" && CC=""
+if test -z "$CC"; then
+  echo "CC:C compiler:/bin/cc" >> conf.missing
+fi
+# Find out if we are using GNU C, under whatever name.
+cat <<EOF > conftest.c
+#ifdef __GNUC__
+  yes
+#endif
+EOF
+${CC-cc} -E conftest.c > conftest.out 2>&1
+if egrep yes conftest.out >/dev/null 2>&1; then
+  GCC=1 # For later tests.
+  CC="$CC -O"
+fi
+rm -f conftest*
+ if test -z "$AR"; then
+  echo checking for ar
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/ar; then
+      AR="ar"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$AR" && AR=""
+if test -z "$AR"; then
+  echo "AR:library utility:/bin/ar" >> conf.missing
+fi
+ if test -z "$RANLIB"; then
+  echo checking for ranlib
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/ranlib; then
+      RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$RANLIB" && RANLIB="@:"
+  
+
+echo setting the installation prefix
+prefix=`case "${prefix-../../..}" in 
+  /*) echo ${prefix-../../..}; exit;;
+   *) path=\`pwd\`/${prefix-../../..}
+        tail=
+        while test -n "$path"; do
+          (cd $path && echo \`pwd\`$rest) 2> /dev/null && exit
+          base=/\`basename "$path"\`
+          tail=/$base$tail
+          path=\`echo "$path" | sed "s/\/$base//"\`
+        done;;
+esac
+`
+test -z "$exec_prefix" && exec_prefix=$prefix/bin
+
+
+CPPFLAGS=${CPPFLAGS-"-DNDEBUG"}
+
+
+CFLAGS=${CFLAGS-"-O"}
+
+
+FFLAGS=${FFLAGS-"-O"}
+
+
+LIBOBJS=${LIBOBJS-""}
+
+
+
+if test -z "$RANLIB"; then
+  echo checking for ranlib
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/ranlib; then
+      RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$RANLIB" && RANLIB="@:"
+
+
+ case "$OS" in
+  hpux*) for p in fort77 fortc f77
+do
+if test -z "$FC"; then
+  echo checking for $p
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$p; then
+      FC="$p"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$FC" && FC=""
+
+test -n "$FC" && break
+done
+;;
+  *)     for p in f77 cf77
+do
+if test -z "$FC"; then
+  echo checking for $p
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$p; then
+      FC="$p"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$FC" && FC=""
+
+test -n "$FC" && break
+done
+;;
+esac
+if test -z "$FC"; then
+  echo "FC:FORTRAN compiler:/bin/f77" >> conf.missing
+fi
+
+
+echo checking how to run the C preprocessor
+if test -z "$CPP"; then
+  CPP='${CC-cc} -E'
+  cat > conftest.c <<EOF
+#include <stdio.h>
+EOF
+err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
+if test -z "$err"; then
+  :
+else
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+CPP=`eval echo $CPP`
+echo "#include <stdlib.h>" > conftest.c
+if test `$CPP conftest.c 2> /dev/null | wc -l` = 0; then
+  if test "$CPP" = cpp; then
+    echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work"
+    echo "CPP:C preprocessor:/lib/cpp" >> conf.missing
+  else
+    echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work; setting to \`cpp'"
+    CPP=cpp
+    if test `which ${CPP} 2>&1 | wc -w` != 1; then
+      echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't exist"
+      echo "CPP:C preprocessor:/lib/cpp" >> conf.missing
+    fi
+  fi
+fi
+rm -f conftest.c
+
+
+echo checking for working const
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { /* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+ }
+EOF
+if eval $compile; then
+  :
+else
+  DEFS="$DEFS -DUD_NO_CONST=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_CONST\${SEDdB}UD_NO_CONST\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_CONST\${SEDuB}UD_NO_CONST\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_CONST\${SEDeB}UD_NO_CONST\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+
+echo checking for working signed
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { signed char x;
+ }
+EOF
+if eval $compile; then
+  :
+else
+  DEFS="$DEFS -DUD_NO_SIGNED=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGNED\${SEDdB}UD_NO_SIGNED\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGNED\${SEDuB}UD_NO_SIGNED\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGNED\${SEDeB}UD_NO_SIGNED\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+
+echo checking for function prototypes
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { extern int foo(int bar);
+ }
+EOF
+if eval $compile; then
+  :
+else
+  DEFS="$DEFS -DUD_NO_PROTOTYPES=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_PROTOTYPES\${SEDdB}UD_NO_PROTOTYPES\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_PROTOTYPES\${SEDuB}UD_NO_PROTOTYPES\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_PROTOTYPES\${SEDeB}UD_NO_PROTOTYPES\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+
+  for arg in stdarg.h.in; do
+    case "$PORT_MANIFEST" in
+      *$arg*) ;;
+      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
+    esac
+  done
+echo checking for variadic function support
+cat > conftest.c <<EOF
+#include <stdarg.h>
+main() { exit(0); } 
+t() { ;}
+int foo(int bar, ...) {
+    va_list     alist;
+    va_start(alist, bar);
+    bar = (int)va_arg(alist, int);
+    va_end(alist);
+    return bar;
+ }
+EOF
+if eval $compile; then
+  echo "#include <stdarg.h>" > conftestpath.c
+path=`$CPP conftestpath.c 2> /dev/null |
+    sed -n 's/^#.* 1 "\(.*stdarg\.h\)".*/\1/p' | 
+    head -1`
+if test -z "$path"; then
+    path=/dev/null
+else
+    path=//$path
+fi
+rm -f conftestpath.c
+DEFS="$DEFS -DUD_SYSTEM_STDARG_H=\"$path\""
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_STDARG_H\${SEDdB}UD_SYSTEM_STDARG_H\${SEDdC}\"$path\"\${SEDdD}
+\${SEDuA}UD_SYSTEM_STDARG_H\${SEDuB}UD_SYSTEM_STDARG_H\${SEDuC}\"$path\"\${SEDuD}
+\${SEDeA}UD_SYSTEM_STDARG_H\${SEDeB}UD_SYSTEM_STDARG_H\${SEDeC}\"$path\"\${SEDeD}
+"
+  for arg in port/stdarg.h; do
+    case "$UC_TRANSFORMEES" in
+      *$arg*) ;;
+      *)      UC_TRANSFORMEES="$UC_TRANSFORMEES $arg";;
+    esac
+  done
+
+else
+  DEFS="$DEFS -DUD_NO_STDARG=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_STDARG\${SEDdB}UD_NO_STDARG\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_STDARG\${SEDuB}UD_NO_STDARG\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_STDARG\${SEDeB}UD_NO_STDARG\${SEDeC}1\${SEDeD}
+"
+echo "#include <varargs.h>" > conftestpath.c
+path=`$CPP conftestpath.c 2> /dev/null |
+    sed -n 's/^#.* 1 "\(.*varargs\.h\)".*/\1/p' | 
+    head -1`
+if test -z "$path"; then
+    path=/dev/null
+else
+    path=//$path
+fi
+rm -f conftestpath.c
+DEFS="$DEFS -DUD_SYSTEM_STDARG_H=\"$path\""
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_STDARG_H\${SEDdB}UD_SYSTEM_STDARG_H\${SEDdC}\"$path\"\${SEDdD}
+\${SEDuA}UD_SYSTEM_STDARG_H\${SEDuB}UD_SYSTEM_STDARG_H\${SEDuC}\"$path\"\${SEDuD}
+\${SEDeA}UD_SYSTEM_STDARG_H\${SEDeB}UD_SYSTEM_STDARG_H\${SEDeC}\"$path\"\${SEDeD}
+"
+  for arg in port/varargs.h; do
+    case "$UC_TRANSFORMEES" in
+      *$arg*) ;;
+      *)      UC_TRANSFORMEES="$UC_TRANSFORMEES $arg";;
+    esac
+  done
+
+fi
+rm -f conftest*
+  for arg in stdarg.h; do
+    case "$PORT_HEADERS" in
+      *$arg*) ;;
+      *)      PORT_HEADERS="$PORT_HEADERS $arg";;
+    esac
+  done
+
+echo checking for stringization
+cat > conftest.c <<EOF
+# define MAKESTRING(x)	#x
+main() { exit(0); } 
+t() { char *cp = MAKESTRING(foo);
+ }
+EOF
+if eval $compile; then
+  :
+else
+  DEFS="$DEFS -DUD_NO_STRINGIZATION=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_STRINGIZATION\${SEDdB}UD_NO_STRINGIZATION\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_STRINGIZATION\${SEDuB}UD_NO_STRINGIZATION\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_STRINGIZATION\${SEDeB}UD_NO_STRINGIZATION\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+
+
+echo checking for token pasting
+cat > conftest.c <<EOF
+#define GLUE(a,b) a ## b
+main() { exit(0); } 
+t() { char *GLUE(c,p) = "foo";
+ }
+EOF
+if eval $compile; then
+  :
+else
+  DEFS="$DEFS -DUD_NO_TOKEN_PASTING=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_TOKEN_PASTING\${SEDdB}UD_NO_TOKEN_PASTING\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_TOKEN_PASTING\${SEDuB}UD_NO_TOKEN_PASTING\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_TOKEN_PASTING\${SEDeB}UD_NO_TOKEN_PASTING\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+
+
+echo checking for void*
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { extern void *foo();
+ }
+EOF
+if eval $compile; then
+  :
+else
+  DEFS="$DEFS -DUD_NO_VOIDSTAR=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_VOIDSTAR\${SEDdB}UD_NO_VOIDSTAR\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_VOIDSTAR\${SEDuB}UD_NO_VOIDSTAR\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_VOIDSTAR\${SEDeB}UD_NO_VOIDSTAR\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+
+  for arg in udposix.h.in; do
+    case "$PORT_MANIFEST" in
+      *$arg*) ;;
+      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
+    esac
+  done
+
+  for arg in stddef.h.in; do
+    case "$PORT_MANIFEST" in
+      *$arg*) ;;
+      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
+    esac
+  done
+  for arg in stddef.h; do
+    case "$PORT_HEADERS" in
+      *$arg*) ;;
+      *)      PORT_HEADERS="$PORT_HEADERS $arg";;
+    esac
+  done
+echo "#include <stddef.h>" > conftestpath.c
+path=`$CPP conftestpath.c 2> /dev/null |
+    sed -n 's/^#.* 1 "\(.*stddef\.h\)".*/\1/p' | 
+    head -1`
+if test -z "$path"; then
+    path=/dev/null
+else
+    path=//$path
+fi
+rm -f conftestpath.c
+DEFS="$DEFS -DUD_SYSTEM_STDDEF_H=\"$path\""
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_STDDEF_H\${SEDdB}UD_SYSTEM_STDDEF_H\${SEDdC}\"$path\"\${SEDdD}
+\${SEDuA}UD_SYSTEM_STDDEF_H\${SEDuB}UD_SYSTEM_STDDEF_H\${SEDuC}\"$path\"\${SEDuD}
+\${SEDeA}UD_SYSTEM_STDDEF_H\${SEDeB}UD_SYSTEM_STDDEF_H\${SEDeC}\"$path\"\${SEDeD}
+"
+  for arg in port/stddef.h; do
+    case "$UC_TRANSFORMEES" in
+      *$arg*) ;;
+      *)      UC_TRANSFORMEES="$UC_TRANSFORMEES $arg";;
+    esac
+  done
+echo checking for macro offsetof
+cat > conftest.c <<EOF
+#include <stddef.h>
+#ifdef offsetof
+  error
+#endif
+main() { exit(0); } 
+t() {  }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_OFFSETOF_MACRO=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_OFFSETOF_MACRO\${SEDdB}UD_NO_OFFSETOF_MACRO\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_OFFSETOF_MACRO\${SEDuB}UD_NO_OFFSETOF_MACRO\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_OFFSETOF_MACRO\${SEDeB}UD_NO_OFFSETOF_MACRO\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+
+  for arg in fortc; do
+    case "$PORT_SUBDIRS" in
+      *$arg*) ;;
+      *)      PORT_SUBDIRS="$PORT_SUBDIRS $arg";;
+    esac
+  done
+  for arg in fortc.h fortc.fc udalloc.h; do
+    case "$PORT_MANIFEST" in
+      *$arg*) ;;
+      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
+    esac
+  done
+dir=`pwd`/port/fortc
+FORTC="$dir/fortc"
+NEED_FORTC=yes
+
+if test -z "$NEQN"; then
+  echo checking for neqn
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/neqn; then
+      NEQN="neqn"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$NEQN" && NEQN="cat"
+test "$NEQN" = cat && 
+  echo 1>&2 "$0: Can't find program \`neqn'; setting to \`cat'"
+
+if test -z "$TBL"; then
+  echo checking for tbl
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/tbl; then
+      TBL="tbl"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$TBL" && TBL="cat"
+test "$TBL" = cat && 
+  echo 1>&2 "$0: Can't find \`tbl'; setting to \`cat'"
+
+# Make sure to not get the incompatible SysV /etc/install and
+# /usr/sbin/install, which might be in PATH before a BSD-like install,
+# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
+# or the AFS install, which mishandles nonexistent args.  (Sigh.)
+if test -z "$INSTALL"; then
+  echo checking for install
+  saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    case $dir in
+    /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
+    *)
+      if test -f $dir/install; then
+	if grep dspmsg $dir/install >/dev/null 2>&1; then
+	  : # AIX
+	else
+	  INSTALL="$dir/install -c"
+	  INSTALL_PROGRAM='$(INSTALL)'
+	  INSTALL_DATA='$(INSTALL) -m 644'
+	  break
+	fi
+      fi
+      ;;
+    esac
+  done
+  IFS="$saveifs"
+fi
+INSTALL=${INSTALL-cp}
+INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
+INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
+INSTALL_DATA="`echo "${INSTALL_DATA}" | sed 's/644/664/'`"
+
+
+
+  for arg in signal.h.in sigaddset.c \
+    sigdelset.c sigemptyset.c sigfillset.c sigismember.c sigpending.c \
+    sigprocmask.c sigsuspend.c; do
+    case "$PORT_MANIFEST" in
+      *$arg*) ;;
+      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
+    esac
+  done
+  for arg in signal.h; do
+    case "$PORT_HEADERS" in
+      *$arg*) ;;
+      *)      PORT_HEADERS="$PORT_HEADERS $arg";;
+    esac
+  done
+echo "#include <signal.h>" > conftestpath.c
+path=`$CPP conftestpath.c 2> /dev/null |
+    sed -n 's/^#.* 1 "\(.*signal\.h\)".*/\1/p' | 
+    head -1`
+if test -z "$path"; then
+    path=/dev/null
+else
+    path=//$path
+fi
+rm -f conftestpath.c
+DEFS="$DEFS -DUD_SYSTEM_SIGNAL_H=\"$path\""
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_SIGNAL_H\${SEDdB}UD_SYSTEM_SIGNAL_H\${SEDdC}\"$path\"\${SEDdD}
+\${SEDuA}UD_SYSTEM_SIGNAL_H\${SEDuB}UD_SYSTEM_SIGNAL_H\${SEDuC}\"$path\"\${SEDuD}
+\${SEDeA}UD_SYSTEM_SIGNAL_H\${SEDeB}UD_SYSTEM_SIGNAL_H\${SEDeC}\"$path\"\${SEDeD}
+"
+  for arg in port/signal.h; do
+    case "$UC_TRANSFORMEES" in
+      *$arg*) ;;
+      *)      UC_TRANSFORMEES="$UC_TRANSFORMEES $arg";;
+    esac
+  done
+echo checking for typedef sigset_t
+cat > conftest.c <<EOF
+#include <signal.h>
+typedef void sigset_t;
+main() { exit(0); } 
+t() {  }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGSET_T=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGSET_T\${SEDdB}UD_NO_SIGSET_T\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGSET_T\${SEDuB}UD_NO_SIGSET_T\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGSET_T\${SEDeB}UD_NO_SIGSET_T\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+echo checking for typedef sig_atomic_t
+cat > conftest.c <<EOF
+#include <signal.h>
+typedef void sig_atomic_t;
+main() { exit(0); } 
+t() {  }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIG_ATOMIC_T=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIG_ATOMIC_T\${SEDdB}UD_NO_SIG_ATOMIC_T\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIG_ATOMIC_T\${SEDuB}UD_NO_SIG_ATOMIC_T\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIG_ATOMIC_T\${SEDeB}UD_NO_SIG_ATOMIC_T\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+echo checking for structure sigaction
+cat > conftest.c <<EOF
+#include <signal.h>
+struct sigaction {char *foo;};
+main() { exit(0); } 
+t() {  }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGACTION_STRUCT=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGACTION_STRUCT\${SEDdB}UD_NO_SIGACTION_STRUCT\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGACTION_STRUCT\${SEDuB}UD_NO_SIGACTION_STRUCT\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGACTION_STRUCT\${SEDeB}UD_NO_SIGACTION_STRUCT\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+echo checking for function sigemptyset declaration
+cat > conftest.c <<EOF
+#include <signal.h>
+main() { exit(0); } 
+t() { extern struct {int foo;} *sigemptyset();
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGEMPTYSET_DECL=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGEMPTYSET_DECL\${SEDdB}UD_NO_SIGEMPTYSET_DECL\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGEMPTYSET_DECL\${SEDuB}UD_NO_SIGEMPTYSET_DECL\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGEMPTYSET_DECL\${SEDeB}UD_NO_SIGEMPTYSET_DECL\${SEDeC}1\${SEDeD}
+"
+for func in sigemptyset
+do
+echo checking for ${func}
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { 
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}(); }
+EOF
+if eval $compile; then
+  :
+else
+  LIBOBJS="$LIBOBJS ${func}.o"
+fi
+rm -f conftest*
+
+done
+
+fi
+rm -f conftest*
+echo checking for function sigfillset declaration
+cat > conftest.c <<EOF
+#include <signal.h>
+main() { exit(0); } 
+t() { extern struct {int foo;} *sigfillset();
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGFILLSET_DECL=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGFILLSET_DECL\${SEDdB}UD_NO_SIGFILLSET_DECL\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGFILLSET_DECL\${SEDuB}UD_NO_SIGFILLSET_DECL\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGFILLSET_DECL\${SEDeB}UD_NO_SIGFILLSET_DECL\${SEDeC}1\${SEDeD}
+"
+for func in sigfillset
+do
+echo checking for ${func}
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { 
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}(); }
+EOF
+if eval $compile; then
+  :
+else
+  LIBOBJS="$LIBOBJS ${func}.o"
+fi
+rm -f conftest*
+
+done
+
+fi
+rm -f conftest*
+echo checking for function sigaddset declaration
+cat > conftest.c <<EOF
+#include <signal.h>
+main() { exit(0); } 
+t() { extern struct {int foo;} *sigaddset();
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGADDSET_DECL=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGADDSET_DECL\${SEDdB}UD_NO_SIGADDSET_DECL\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGADDSET_DECL\${SEDuB}UD_NO_SIGADDSET_DECL\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGADDSET_DECL\${SEDeB}UD_NO_SIGADDSET_DECL\${SEDeC}1\${SEDeD}
+"
+for func in sigaddset
+do
+echo checking for ${func}
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { 
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}(); }
+EOF
+if eval $compile; then
+  :
+else
+  LIBOBJS="$LIBOBJS ${func}.o"
+fi
+rm -f conftest*
+
+done
+
+fi
+rm -f conftest*
+echo checking for function sigdelset declaration
+cat > conftest.c <<EOF
+#include <signal.h>
+main() { exit(0); } 
+t() { extern struct {int foo;} *sigdelset();
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGDELSET_DECL=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGDELSET_DECL\${SEDdB}UD_NO_SIGDELSET_DECL\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGDELSET_DECL\${SEDuB}UD_NO_SIGDELSET_DECL\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGDELSET_DECL\${SEDeB}UD_NO_SIGDELSET_DECL\${SEDeC}1\${SEDeD}
+"
+for func in sigdelset
+do
+echo checking for ${func}
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { 
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}(); }
+EOF
+if eval $compile; then
+  :
+else
+  LIBOBJS="$LIBOBJS ${func}.o"
+fi
+rm -f conftest*
+
+done
+
+fi
+rm -f conftest*
+echo checking for function sigismember declaration
+cat > conftest.c <<EOF
+#include <signal.h>
+main() { exit(0); } 
+t() { extern struct {int foo;} *sigismember();
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGISMEMBER_DECL=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGISMEMBER_DECL\${SEDdB}UD_NO_SIGISMEMBER_DECL\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGISMEMBER_DECL\${SEDuB}UD_NO_SIGISMEMBER_DECL\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGISMEMBER_DECL\${SEDeB}UD_NO_SIGISMEMBER_DECL\${SEDeC}1\${SEDeD}
+"
+for func in sigismember
+do
+echo checking for ${func}
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { 
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}(); }
+EOF
+if eval $compile; then
+  :
+else
+  LIBOBJS="$LIBOBJS ${func}.o"
+fi
+rm -f conftest*
+
+done
+
+fi
+rm -f conftest*
+echo checking for function sigaction declaration
+cat > conftest.c <<EOF
+#include <signal.h>
+main() { exit(0); } 
+t() { extern struct {int foo;} *sigaction();
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGACTION_DECL=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGACTION_DECL\${SEDdB}UD_NO_SIGACTION_DECL\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGACTION_DECL\${SEDuB}UD_NO_SIGACTION_DECL\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGACTION_DECL\${SEDeB}UD_NO_SIGACTION_DECL\${SEDeC}1\${SEDeD}
+"
+for func in sigaction
+do
+echo checking for ${func}
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { 
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}(); }
+EOF
+if eval $compile; then
+  :
+else
+  LIBOBJS="$LIBOBJS ${func}.o"
+fi
+rm -f conftest*
+
+done
+
+fi
+rm -f conftest*
+echo checking for function sigprocmask declaration
+cat > conftest.c <<EOF
+#include <signal.h>
+main() { exit(0); } 
+t() { extern struct {int foo;} *sigprocmask();
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGPROCMASK_DECL=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGPROCMASK_DECL\${SEDdB}UD_NO_SIGPROCMASK_DECL\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGPROCMASK_DECL\${SEDuB}UD_NO_SIGPROCMASK_DECL\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGPROCMASK_DECL\${SEDeB}UD_NO_SIGPROCMASK_DECL\${SEDeC}1\${SEDeD}
+"
+for func in sigprocmask
+do
+echo checking for ${func}
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { 
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}(); }
+EOF
+if eval $compile; then
+  :
+else
+  LIBOBJS="$LIBOBJS ${func}.o"
+fi
+rm -f conftest*
+
+done
+
+fi
+rm -f conftest*
+echo checking for function sigpending declaration
+cat > conftest.c <<EOF
+#include <signal.h>
+main() { exit(0); } 
+t() { extern struct {int foo;} *sigpending();
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGPENDING_DECL=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGPENDING_DECL\${SEDdB}UD_NO_SIGPENDING_DECL\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGPENDING_DECL\${SEDuB}UD_NO_SIGPENDING_DECL\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGPENDING_DECL\${SEDeB}UD_NO_SIGPENDING_DECL\${SEDeC}1\${SEDeD}
+"
+for func in sigpending
+do
+echo checking for ${func}
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { 
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}(); }
+EOF
+if eval $compile; then
+  :
+else
+  LIBOBJS="$LIBOBJS ${func}.o"
+fi
+rm -f conftest*
+
+done
+
+fi
+rm -f conftest*
+echo checking for function sigsuspend declaration
+cat > conftest.c <<EOF
+#include <signal.h>
+main() { exit(0); } 
+t() { extern struct {int foo;} *sigsuspend();
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -DUD_NO_SIGSUSPEND_DECL=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGSUSPEND_DECL\${SEDdB}UD_NO_SIGSUSPEND_DECL\${SEDdC}1\${SEDdD}
+\${SEDuA}UD_NO_SIGSUSPEND_DECL\${SEDuB}UD_NO_SIGSUSPEND_DECL\${SEDuC}1\${SEDuD}
+\${SEDeA}UD_NO_SIGSUSPEND_DECL\${SEDeB}UD_NO_SIGSUSPEND_DECL\${SEDeC}1\${SEDeD}
+"
+for func in sigsuspend
+do
+echo checking for ${func}
+cat > conftest.c <<EOF
+
+main() { exit(0); } 
+t() { 
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}(); }
+EOF
+if eval $compile; then
+  :
+else
+  LIBOBJS="$LIBOBJS ${func}.o"
+fi
+rm -f conftest*
+
+done
+
+fi
+rm -f conftest*
+for func in sigvec sigblock sigpause sigsetmask sigstack bsdsigp
+do
+trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
+echo checking for ${func}
+cat > conftest.c <<EOF
+#include <stdio.h>
+main() { exit(0); } 
+t() { 
+#ifdef __stub_${func}
+choke me
+#else
+/* Override any gcc2 internal prototype to avoid an error.  */
+extern char ${func}(); ${func}();
+#endif
+ }
+EOF
+if eval $compile; then
+  DEFS="$DEFS -D${trfunc}=1"
+SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
+\${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
+\${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
+"
+fi
+rm -f conftest*
+#endif
+done
+
+
+
+
+
+FTPDIR=${FTPDIR-/home/ftp}/pub/sdm
+
+
+echo checking for package version
+if test -z "$VERSION"; then
+  if test -r VERSION; then \
+    VERSION="`cat VERSION`"
+  else
+    VERSION=
+  fi
+fi
+if test -z "$MAJOR_NO"; then
+  if test -n "$VERSION"; then \
+    MAJOR_NO=`echo $VERSION |
+      sed -n '/^\([0-9][0-9]*\)\.[0-9][0-9]*.*/s//\1/p;q'`
+  else
+    MAJOR_NO=
+  fi
+fi
+if test -z "$MINOR_NO"; then
+  if test -n "$VERSION"; then \
+    MINOR_NO=`echo $VERSON |
+      sed -n '/^[0-9][0-9]*\.\([0-9][0-9]*\).*/s//\1/p;q'`
+  else
+    MINOR_NO=
+  fi
+fi
+
+
+if test -n "$prefix"; then
+  test -z "$exec_prefix" && exec_prefix='${prefix}'
+  prsub="s%^prefix\\([ 	]*\\)=\\([ 	]*\\).*$%prefix\\1=\\2$prefix%"
+fi
+if test -n "$exec_prefix"; then
+  prsub="$prsub
+s%^exec_prefix\\([ 	]*\\)=\\([ 	]*\\).*$%\
+exec_prefix\\1=\\2$exec_prefix%"
+fi
+
+trap 'rm -f config.status; exit 1' 1 3 15
+echo creating config.status
+rm -f config.status
+cat > config.status <<EOF
+#!/bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null`:
+#
+# $0 $*
+
+for arg
+do
+  case "\$arg" in
+    -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    exec /bin/sh $0 $* ;;
+    *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
+  esac
+done
+
+trap 'rm -f Makefile \
+    fortc/Makefile \
+ ${UC_TRANSFORMEES-} port/udposix.h conftest*; exit 1' 1 3 15
+PORT_MANIFEST='$PORT_MANIFEST'
+CPPFLAGS='$CPPFLAGS'
+CFLAGS='$CFLAGS'
+OS='$OS'
+LIBOBJS='$LIBOBJS'
+PORT_HEADERS='$PORT_HEADERS'
+PORT_SUBDIRS='$PORT_SUBDIRS'
+CC='$CC'
+AR='$AR'
+RANLIB='$RANLIB'
+prefix='$prefix'
+exec_prefix='$exec_prefix'
+FFLAGS='$FFLAGS'
+FC='$FC'
+CPP='$CPP'
+UC_TRANSFORMEES='$UC_TRANSFORMEES'
+FORTC='$FORTC'
+NEED_FORTC='$NEED_FORTC'
+NEQN='$NEQN'
+TBL='$TBL'
+INSTALL='$INSTALL'
+INSTALL_PROGRAM='$INSTALL_PROGRAM'
+INSTALL_DATA='$INSTALL_DATA'
+FTPDIR='$FTPDIR'
+VERSION='$VERSION'
+MAJOR_NO='$MAJOR_NO'
+MINOR_NO='$MINOR_NO'
+LIBS='$LIBS'
+srcdir='$srcdir'
+prefix='$prefix'
+exec_prefix='$exec_prefix'
+prsub='$prsub'
+EOF
+cat >> config.status <<\EOF
+
+top_srcdir=$srcdir
+for file in .. Makefile \
+    fortc/Makefile \
+ ${UC_TRANSFORMEES-}; do if [ "x$file" != "x.." ]; then
+  srcdir=$top_srcdir
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
+  if test "$dir" != "$file"; then
+    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
+    test ! -d $dir && mkdir $dir
+  fi
+  echo creating $file
+  rm -f $file
+  case $file in
+    *.c|*.h) echo "/* Generated automatically from `echo $file|sed 's|.*/||'`.in by configure. */" > $file;;
+    *) echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file;;
+  esac
+  sed -e "
+$prsub
+s%@PORT_MANIFEST@%$PORT_MANIFEST%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CFLAGS@%$CFLAGS%g
+s%@OS@%$OS%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@PORT_HEADERS@%$PORT_HEADERS%g
+s%@PORT_SUBDIRS@%$PORT_SUBDIRS%g
+s%@CC@%$CC%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@prefix@%$prefix%g
+s%@exec_prefix@%$exec_prefix%g
+s%@FFLAGS@%$FFLAGS%g
+s%@FC@%$FC%g
+s%@CPP@%$CPP%g
+s%@UC_TRANSFORMEES@%$UC_TRANSFORMEES%g
+s%@FORTC@%$FORTC%g
+s%@NEED_FORTC@%$NEED_FORTC%g
+s%@NEQN@%$NEQN%g
+s%@TBL@%$TBL%g
+s%@INSTALL@%$INSTALL%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@FTPDIR@%$FTPDIR%g
+s%@VERSION@%$VERSION%g
+s%@MAJOR_NO@%$MAJOR_NO%g
+s%@MINOR_NO@%$MINOR_NO%g
+s%@LIBS@%$LIBS%g
+s%@srcdir@%$srcdir%g
+s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
+fi; done
+
+echo creating port/udposix.h
+# These sed commands are put into SEDDEFS when defining a macro.
+# They are broken into pieces to make the sed script easier to manage.
+# They are passed to sed as "A NAME B NAME C VALUE D", where NAME
+# is the cpp macro being defined and VALUE is the value it is being given.
+# Each defining turns into a single global substitution command.
+#
+# SEDd sets the value in "#define NAME VALUE" lines.
+SEDdA='s@^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+SEDdB='\([ 	][ 	]*\)[^ 	]*@\1#\2'
+SEDdC='\3'
+SEDdD='@g'
+# SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+SEDuA='s@^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+SEDuB='\([ 	]\)@\1#\2define\3'
+SEDuC=' '
+SEDuD='\4 at g'
+# SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+SEDeA='s@^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+SEDeB='$@\1#\2define\3'
+SEDeC=' '
+SEDeD='@g'
+rm -f conftest.sed
+cat > conftest.sed <<CONFEOF
+EOF
+# Turn off quoting long enough to insert the sed commands.
+cat >> config.status <<EOF
+$SEDDEFS
+EOF
+cat >> config.status <<\EOF
+CONFEOF
+rm -f conftest.h
+# Break up the sed commands because old seds have small limits.
+cp $top_srcdir/port/udposix.h.in conftest.h1
+while :
+do
+  lines=`grep -c . conftest.sed`
+  if test -z "$lines" || test "$lines" -eq 0; then break; fi
+  rm -f conftest.s1 conftest.s2 conftest.h2
+  sed 40q conftest.sed > conftest.s1 # Like head -40.
+  sed 1,40d conftest.sed > conftest.s2 # Like tail +41.
+  sed -f conftest.s1 < conftest.h1 > conftest.h2
+  rm -f conftest.s1 conftest.h1 conftest.sed
+  mv conftest.h2 conftest.h1
+  mv conftest.s2 conftest.sed
+done
+rm -f conftest.sed conftest.h
+echo "/* port/udposix.h.  Generated automatically by configure.  */" > conftest.h
+cat conftest.h1 >> conftest.h
+rm -f conftest.h1
+if cmp -s port/udposix.h conftest.h 2>/dev/null; then
+  # The file exists and we would not be changing it.
+  rm -f conftest.h
+else
+  rm -f port/udposix.h
+  mv conftest.h port/udposix.h
+fi
+
+EOF
+chmod +x config.status
+test -n "$no_create" || ./config.status
+if test -s conf.missing; then
+  cat << CAT_EOF
+
+$0: The following variables need values.  They may be set in
+the environment or in the file CUSTOMIZE.  Variables referring to
+executable programs needn't be set if the relevant directory is added to
+PATH.  In any case, ./configure should probably be rerun.  See file INSTALL
+for details.
+
+CAT_EOF
+  awk -F: 'BEGIN {printf "%-13s%-27s%s\n", "VARIABLE", "MEANING", "EXAMPLE";
+	          printf "%-13s%-27s%s\n", "--------", "-------", "-------"}
+	         {printf "%-13s%-27s%s\n", $1, $2, $3}' conf.missing
+  rm conf.missing
+  exit 1
+fi
+rm -f conf.missing
+ # Post process any makefiles.
+#
+# Create a script to accomplish the post processing.
+#
+cat << \EOF_CONFTEST_SH > conftest.sh
+cat << \EOF_CONFTEST_C > conftest.c
+#include <stdio.h>
+main()
+{
+    return readsub((char*)NULL) ? 0 : 1;
+}
+readsub(inpath)
+    char	*inpath;
+{
+    char	buf[2048], path[1024];
+    FILE	*fp	= inpath == NULL
+				? stdin
+				: fopen(inpath, "r");
+    if (fp == NULL) {
+	(void) perror(inpath);
+	return 0;
+    }
+    buf[sizeof(buf)-1]	= 0;
+    while (fgets(buf, sizeof(buf), fp) != NULL) {
+	if (sscanf(buf, "include%*[] \t[]%s", path) == 1) {
+	    if (!readsub(path))
+		return 0;
+	} else {
+	    (void) fputs(buf, stdout);
+	}
+    }
+    return 1;
+}
+EOF_CONFTEST_C
+if $CC -o conftest conftest.c; then
+    conftest=`pwd`/conftest
+    set Makefile \
+    fortc/Makefile \
+
+    for file do
+      echo post processing makefile \`$file\'
+      sd=`pwd`/`echo $file | sed 's,[^/]*$,,'`
+      base=`basename $file`
+      (cd $sd; $conftest < $base > conftest.mk && mv conftest.mk $base)
+    done
+fi
+rm conftest conftest.c
+EOF_CONFTEST_SH
+#
+# Append the above script to the output-script file, config.status, so that 
+# invoking that file will also do the post processing.  Note that the 
+# output-script file will be invoked by ./configure before the post-
+# processing code is appended.
+#
+cat conftest.sh >> config.status
+#
+# If appropriate, do the postprocessing now because the previous step 
+# couldn't.
+#
+test -n "$no_create" || CC=$CC sh conftest.sh
+rm conftest.sh
+ 

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/configure.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/configure.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/configure.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,50 @@
+dnl $Id: configure.in,v 1.2 1993/05/03 21:26:52 chouck Exp $
+dnl
+dnl Process this file with GNU autoconf(1) to produce a configure script.
+dnl
+UC_INIT(udposix.h)
+
+UC_PREFIX(../../..)
+
+UC_DEFAULT(CPPFLAGS, -DNDEBUG)
+UC_DEFAULT(CFLAGS, -O)
+UC_DEFAULT(FFLAGS, -O)
+UC_DEFAULT(LIBOBJS, )
+
+AC_PROG_RANLIB
+UC_PROG_CC
+UC_PROG_FC
+UC_PROG_CPP
+UC_PROG_FORTC
+UC_PROG_NEQN
+UC_PROG_TBL
+UC_PROG_NCDUMP
+UC_PROG_NCGEN
+UC_PROG_INSTALL
+
+UC_UDPOSIX
+UC_UDPOSIX_STDDEF
+UC_UDPOSIX_LIMITS
+UC_UDPOSIX_FLOAT
+UC_UDPOSIX_SIGNAL
+UC_UDPOSIX_STDLIB
+UC_UDPOSIX_STRING
+
+dnl UC_FORTC
+dnl UC_LINKLIST
+dnl UC_PATHNAME
+dnl UC_STRBUF
+dnl UC_STRVEC
+dnl UC_UDALLOC
+dnl UC_ULOG
+
+UC_OS
+
+UC_FTPDIR(pub/sdm)
+
+UC_VERSION
+
+UC_FINISH(
+    Makefile \
+    fortc/Makefile \
+)

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+uddummy.o: uddummy.c

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/mast_mk.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/mast_mk.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/mast_mk.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,494 @@
+# This is the master makefile.  It contains general rules.
+#
+# $Id: mast_mk.in,v 1.1 1993/04/21 21:53:51 chouck Exp $
+
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+############################################################################
+# General Macros:
+############################################################################
+prefix		= @prefix@
+exec_prefix	= @exec_prefix@
+AR		= @AR@
+CC		= @CC@
+CPP		= @CPP@
+INCDIR		= $(prefix)/include
+INSTALL		= @INSTALL@
+INSTALL_DATA	= @INSTALL_DATA@
+INSTALL_PROGRAM	= @INSTALL_PROGRAM@
+FC		= @FC@
+NCDUMP		= @NCDUMP@
+NCGEN		= @NCGEN@
+NEQN		= @NEQN@
+OS		= @OS@
+SHELL		= /bin/sh
+TBL		= @TBL@
+
+
+############################################################################
+# Recursive make(1)s in Subdirectories:
+############################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) prefix=$(prefix) exec_prefix=$(exec_prefix) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+############################################################################
+# Compilation:
+############################################################################
+FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $<
+
+
+############################################################################
+# Libraries:
+############################################################################
+RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CPPFLAGS) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CPPFLAGS) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+############################################################################
+# Programs:
+############################################################################
+BINDIR		= $(exec_prefix)
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS)'; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+############################################################################
+# Header files:
+############################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+############################################################################
+# `etc/' files:
+############################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+dummy_etcdir $(ETCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+############################################################################
+# Manual Pages:
+############################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+############################################################################
+# Cleanup:
+############################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+############################################################################
+# Configuration:
+############################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+############################################################################
+# Dependency maintenance:
+############################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+############################################################################
+# Distributions:
+############################################################################
+FTPDIR		= @FTPDIR@
+VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+		$(MAKE) $(MFLAGS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+
+############################################################################
+# Miscellaneous:
+############################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/master.mk.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/master.mk.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/master.mk.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,573 @@
+# This is the master makefile.  It contains general rules.
+#
+# $Id: master.mk.in,v 1.3 1993/05/11 22:51:30 chouck Exp $
+
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+############################################################################
+# General Macros:
+############################################################################
+prefix		= @prefix@
+exec_prefix	= @exec_prefix@
+AR		= @AR@
+CC		= @CC@
+CPP		= @CPP@
+INCDIR		= $(prefix)/include
+INSTALL		= @INSTALL@
+INSTALL_DATA	= @INSTALL_DATA@
+INSTALL_PROGRAM	= @INSTALL_PROGRAM@
+FC		= @FC@
+MAKEINFO        = @MAKEINFO@
+NCDUMP		= @NCDUMP@
+NCGEN		= @NCGEN@
+NEQN		= @NEQN@
+OS		= @OS@
+SHELL		= /bin/sh
+TBL		= @TBL@
+WHICH		= @WHICH@
+
+############################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+############################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+############################################################################
+# Recursive make(1)s in Subdirectories:
+############################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		prefix=$(prefix) exec_prefix=$(exec_prefix) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+############################################################################
+# Compilation:
+############################################################################
+FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $<
+
+
+############################################################################
+# Libraries:
+############################################################################
+RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CPPFLAGS) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CPPFLAGS) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+############################################################################
+# Programs:
+############################################################################
+BINDIR		= $(exec_prefix)
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS)'; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+############################################################################
+# Header files:
+############################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+############################################################################
+# `etc/' files:
+############################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+dummy_etcdir $(ETCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+############################################################################
+# Manual Pages:
+############################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+############################################################################
+# TeX-Info Pages:
+############################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	$(INSTALL_DATA) $(INFO) $@
+
+dummy_infodir $(INFODIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+############################################################################
+# Cleanup:
+############################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+############################################################################
+# Configuration:
+############################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+############################################################################
+# Dependency maintenance:
+############################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+############################################################################
+# Distributions:
+############################################################################
+FTPDIR		= @FTPDIR@
+VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+
+############################################################################
+# Miscellaneous:
+############################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/uddummy.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/uddummy.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/uddummy.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+void uddummy() {;}

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/udposix.h.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/udposix.h.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/udposix.h.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,174 @@
+/*
+ * $Id: udposix.h.in,v 1.1 1993/04/21 21:53:57 chouck Exp $
+ *
+ * Base udposix(3) configuration header file.
+ */
+
+#ifndef UD_udposix_h
+#define UD_udposix_h
+
+
+/*
+ * Support for Standard C:
+ */
+#undef UD_NO_CONST
+#undef UD_NO_SIGNED
+#undef UD_NO_PROTOTYPES
+#undef UD_NO_STRINGIZATION
+#undef UD_NO_TOKEN_PASTING
+#undef UD_NO_VOIDSTAR
+#undef UD_NO_STDARG
+#undef UD_NO_OFFSETOF_MACRO
+
+#undef UD_NO_STRERROR_DECL
+#undef UD_NO_ATEXIT_DECL
+#undef UD_NO_STRSTR_DECL
+#undef UD_NO_DIFFTIME_DECL
+
+
+/*
+ * Support for non-standard but common extensions:
+ */
+#undef UD_NO_FD_SET
+#undef UD_NO_SELECT_DECL
+#undef UD_NO_FD_MACROS
+
+
+/*
+ * Pathnames of system-supplied header files (except for float.h and 
+ * limits.h):
+ */
+#define UD_SYSTEM_FLOAT_H	"///usr/include/float.h"
+#define UD_SYSTEM_LIMITS_H	"///usr/include/limits.h"
+#define UD_SYSTEM_SIGNAL_H	"///usr/include/signal.h"
+#define UD_SYSTEM_STDARG_H	"///usr/include/stdarg.h"
+#define UD_SYSTEM_STDDEF_H	"///usr/include/stddef.h"
+#define UD_SYSTEM_STDLIB_H	"///usr/include/stdlib.h"
+#define UD_SYSTEM_STRING_H	"///usr/include/string.h"
+#define UD_SYSTEM_TIME_H	"///usr/include/time.h"
+#define	UD_SYSTEM_SELECT_H	"/dev/null"
+
+
+/*
+ * Available non-POSIX functions:
+ */
+#undef HAVE_SIGVEC
+#undef HAVE_SIGBLOCK
+#undef HAVE_SIGPAUSE
+#undef HAVE_SIGSETMASK
+#undef HAVE_SIGSTACK
+#undef HAVE_BSDSIGP
+#undef HAVE_BCOPY
+#undef HAVE_ON_EXIT
+
+
+/*
+ * Try to obtain a POSIX environment.
+ */
+#if 0
+#ifndef _POSIX_SOURCE
+#  define _POSIX_SOURCE
+#endif
+#endif
+
+
+/*
+ * Compiler keyword support.  Define whatever your compiler doesn't support
+ * to nothing (e.g. `#define const').
+ */
+#ifdef UD_NO_CONST
+#  define const
+#endif
+#ifdef UD_NO_SIGNED
+#  define signed
+#endif
+
+
+/*
+ * Function prototyping.  Define the following to `()' if your compiler 
+ * doesn't support function prototyping.
+ */
+#ifdef UD_NO_PROTOTYPES
+#  define UD_PROTO(args)	()
+#else
+#  define UD_PROTO(args)	args
+#endif
+
+/*
+ * Additional macro support for function prototyping:
+ */
+#define UD_EXTERN_FUNC(type_name,args)	extern type_name UD_PROTO(args)
+/*
+ * Macros for backwards compatibility:
+ */
+#undef  EXTERN_FUNC
+#define EXTERN_FUNC(type_name,args)	UD_EXTERN_FUNC(type_name,args)
+#undef  PROTO
+#define PROTO(args)			UD_PROTO(args)
+
+
+/*
+ * String-generation macro.  Define the following to `"x"' if your compiler
+ * doesn't support Standard C stringization.
+ */
+#ifdef UD_NO_STRINGIZATION
+#  define MAKESTRING_UD(x)	"x"
+#endif
+
+/*
+ * Macro used in programs:
+ */
+#define UD_MAKESTRING(x)	MAKESTRING_UD(x)
+/*
+ * Macro for backwards compatibility:
+ */
+#define MAKESTRING(x)		UD_MAKESTRING(x)
+
+
+/*
+ * Token-pasting macro.
+ */
+#ifdef UD_NO_TOKEN_PASTING
+#  define GLUE_UD(a,b)	a/**/b
+#endif
+
+/*
+ * Macro used in programs:
+ */
+#define UD_GLUE(a,b)	GLUE_UD(a,b)
+/*
+ * Macro for backwards compatibility:
+ */
+#define GLUE(a,b)	UD_GLUE(a,b)
+
+
+/*
+ * Pointer-to-void type.  Define as `char*' if your compiler doesn't support
+ * `void*'.
+ */
+#ifndef UD_FORTRAN_SOURCE
+#  ifdef UD_NO_VOIDSTAR
+       typedef char*	voidp;
+#  else
+       typedef void*	voidp;
+#  endif
+#endif
+
+/*
+ * Macro for backwards compatibility:
+ */
+#define VOIDP		voidp
+
+
+/*
+ * Define `statement' macro.
+ */
+#ifdef lint
+      extern int	UD_ZERO;
+#else
+#     define UD_ZERO	0
+#endif
+#define UD_STMT(stuff) do {stuff} while (UD_ZERO)
+
+
+#endif /* UD_udposix_h */

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/udposixh.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/udposixh.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/udposixh.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,174 @@
+/*
+ * $Id: udposixh.in,v 1.1 1993/04/21 21:53:59 chouck Exp $
+ *
+ * Base udposix(3) configuration header file.
+ */
+
+#ifndef UD_udposix_h
+#define UD_udposix_h
+
+
+/*
+ * Support for Standard C:
+ */
+#undef UD_NO_CONST
+#undef UD_NO_SIGNED
+#undef UD_NO_PROTOTYPES
+#undef UD_NO_STRINGIZATION
+#undef UD_NO_TOKEN_PASTING
+#undef UD_NO_VOIDSTAR
+#undef UD_NO_STDARG
+#undef UD_NO_OFFSETOF_MACRO
+
+#undef UD_NO_STRERROR_DECL
+#undef UD_NO_ATEXIT_DECL
+#undef UD_NO_STRSTR_DECL
+#undef UD_NO_DIFFTIME_DECL
+
+
+/*
+ * Support for non-standard but common extensions:
+ */
+#undef UD_NO_FD_SET
+#undef UD_NO_SELECT_DECL
+#undef UD_NO_FD_MACROS
+
+
+/*
+ * Pathnames of system-supplied header files (except for float.h and 
+ * limits.h):
+ */
+#define UD_SYSTEM_FLOAT_H	"///usr/include/float.h"
+#define UD_SYSTEM_LIMITS_H	"///usr/include/limits.h"
+#define UD_SYSTEM_SIGNAL_H	"///usr/include/signal.h"
+#define UD_SYSTEM_STDARG_H	"///usr/include/stdarg.h"
+#define UD_SYSTEM_STDDEF_H	"///usr/include/stddef.h"
+#define UD_SYSTEM_STDLIB_H	"///usr/include/stdlib.h"
+#define UD_SYSTEM_STRING_H	"///usr/include/string.h"
+#define UD_SYSTEM_TIME_H	"///usr/include/time.h"
+#define	UD_SYSTEM_SELECT_H	"/dev/null"
+
+
+/*
+ * Available non-POSIX functions:
+ */
+#undef HAVE_SIGVEC
+#undef HAVE_SIGBLOCK
+#undef HAVE_SIGPAUSE
+#undef HAVE_SIGSETMASK
+#undef HAVE_SIGSTACK
+#undef HAVE_BSDSIGP
+#undef HAVE_BCOPY
+#undef HAVE_ON_EXIT
+
+
+/*
+ * Try to obtain a POSIX environment.
+ */
+#if 0
+#ifndef _POSIX_SOURCE
+#  define _POSIX_SOURCE
+#endif
+#endif
+
+
+/*
+ * Compiler keyword support.  Define whatever your compiler doesn't support
+ * to nothing (e.g. `#define const').
+ */
+#ifdef UD_NO_CONST
+#  define const
+#endif
+#ifdef UD_NO_SIGNED
+#  define signed
+#endif
+
+
+/*
+ * Function prototyping.  Define the following to `()' if your compiler 
+ * doesn't support function prototyping.
+ */
+#ifdef UD_NO_PROTOTYPES
+#  define UD_PROTO(args)	()
+#else
+#  define UD_PROTO(args)	args
+#endif
+
+/*
+ * Additional macro support for function prototyping:
+ */
+#define UD_EXTERN_FUNC(type_name,args)	extern type_name UD_PROTO(args)
+/*
+ * Macros for backwards compatibility:
+ */
+#undef  EXTERN_FUNC
+#define EXTERN_FUNC(type_name,args)	UD_EXTERN_FUNC(type_name,args)
+#undef  PROTO
+#define PROTO(args)			UD_PROTO(args)
+
+
+/*
+ * String-generation macro.  Define the following to `"x"' if your compiler
+ * doesn't support Standard C stringization.
+ */
+#ifdef UD_NO_STRINGIZATION
+#  define MAKESTRING_UD(x)	"x"
+#endif
+
+/*
+ * Macro used in programs:
+ */
+#define UD_MAKESTRING(x)	MAKESTRING_UD(x)
+/*
+ * Macro for backwards compatibility:
+ */
+#define MAKESTRING(x)		UD_MAKESTRING(x)
+
+
+/*
+ * Token-pasting macro.
+ */
+#ifdef UD_NO_TOKEN_PASTING
+#  define GLUE_UD(a,b)	a/**/b
+#endif
+
+/*
+ * Macro used in programs:
+ */
+#define UD_GLUE(a,b)	GLUE_UD(a,b)
+/*
+ * Macro for backwards compatibility:
+ */
+#define GLUE(a,b)	UD_GLUE(a,b)
+
+
+/*
+ * Pointer-to-void type.  Define as `char*' if your compiler doesn't support
+ * `void*'.
+ */
+#ifndef UD_FORTRAN_SOURCE
+#  ifdef UD_NO_VOIDSTAR
+       typedef char*	voidp;
+#  else
+       typedef void*	voidp;
+#  endif
+#endif
+
+/*
+ * Macro for backwards compatibility:
+ */
+#define VOIDP		voidp
+
+
+/*
+ * Define `statement' macro.
+ */
+#ifdef lint
+      extern int	UD_ZERO;
+#else
+#     define UD_ZERO	0
+#endif
+#define UD_STMT(stuff) do {stuff} while (UD_ZERO)
+
+
+#endif /* UD_udposix_h */

Added: packages/libhdf4/branches/upstream/current/mfhdf/port/which
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/port/which	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/port/which	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+PATHS=`echo $PATH | sed -e 's/:/ /g'`
+for program in $* ; do
+  found=false
+  for dir in $PATHS; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$program; then
+      found=true
+      echo $dir/$program
+
+      break
+    fi
+  done
+  if test $found = false ; then
+    echo $program not in $PATHS
+  fi
+done
+
+if test $found = true ; then
+  exit 0
+else
+  exit 1
+fi

Added: packages/libhdf4/branches/upstream/current/mfhdf/util/getopt.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/util/getopt.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/util/getopt.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,84 @@
+/*LINTLIBRARY*/
+#define NULL	0
+#define EOF	(-1)
+
+/*  
+ #ifdef VMS
+#include <unixio.h>
+#endif        
+ */
+
+#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);
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/util/make.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/util/make.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/util/make.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,10 @@
+$! --------------------------------------------------------------------------
+$! For making GETOPT.OBJ on VMS if you don't have MMS.
+$! --------------------------------------------------------------------------
+$!
+$! $Id: make.com,v 1.1 1993/05/03 21:27:01 chouck Exp $
+$
+$ ccc := cc /opt/nodebug/nolist
+$
+$ ccc GETOPT.C
+$

Added: packages/libhdf4/branches/upstream/current/mfhdf/util/msoft.mk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/util/msoft.mk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/util/msoft.mk	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/util/win32utl.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/util/win32utl.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/util/win32utl.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/Makefile.in
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/Makefile.in	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/Makefile.in	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,747 @@
+# Makefile for the eXternal Data Representation (XDR) library routines 
+# used by the Network CDF library (needed if and only if the native xdr(3)
+# implementation is broken or doesn't exist).
+#
+# $Id: Makefile.in,v 1.20 2000/08/30 21:55:50 wendling Exp $
+# NOTE: This Makefile.in is used by the Cygnus 'configure' script to
+#       generate the top level Makefile.
+
+# ############# Start of system configuration section. #############
+
+# 'srcdir' Gets set to directory this Makefile is found in
+srcdir = .
+TOP_SRCDIR = ../..
+
+prefix = $(TOP_SRCDIR)/NewHDF
+
+exec_prefix = $(prefix)
+tooldir = $(exec_prefix)/$(target)
+
+program_transform_name =
+
+datadir = $(prefix)/lib
+mandir = $(prefix)/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+docdir = $(datadir)/doc
+
+SHELL = /bin/sh
+
+INSTALL = ${TOP_SRCDIR}/install-sh -c
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
+
+# /usr/local/bin/m4 (GNU version?)
+M4   = /usr/local/bin/m4
+# /usr/local/bin/perl (GNU version?)
+PERL = /usr/local/bin/perl
+
+# Name of achive randomizer, usually ranlib (use 'touch' if non-existant)
+RANLIB = ranlib
+
+# Name of library archiver and flags to send, default 'AR=ar', 'ARFLAGS=r'
+AR = ar
+ARFLAGS = rc
+
+# Name of remove utility, default 'RM=/bin/rm', 'RMFLAGS=-f'
+RM = /bin/rm
+RMFLAGS = -f
+
+AS = as
+CC = gcc
+CFLAGS = -ansi
+FC = f77
+FFLAGS=
+
+# Set for document generation
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+# Directory in which to install binaries
+bindir = $(exec_prefix)/bin
+
+# Directory in which to install header files.
+includedir = $(prefex)/include
+
+# Directory in which to install library files.
+libdir = $(prefix)/lib
+
+# Directory in which to install documentation info files.
+infodir = $(prefix)/info
+
+# ------------ General Macros for NETCDF --------------------
+INCDIR	 = $(prefix)/include
+HDF_LIB  = $(TOP_SRCDIR)/hdf/src/libdf.a
+HDF_INC  = $(TOP_SRCDIR)/hdf/src/
+PABLO_HINC = $(TOP_SRCDIR)/hdf/pablo
+FMPOOL_INC = $(TOP_SRCDIR)/hdf/fmpool
+JPEG_LIB = $(TOP_SRCDIR)/hdf/jpeg/libjpeg.a
+ZLIB_LIB = $(TOP_SRCDIR)/hdf/zlib/libz.a
+NETCDF_INC = $(TOP_SRCDIR)/mfhdf/libsrc
+PORT_INC   = $(TOP_SRCDIR)/mfhdf/port
+CPP	   = $(CC) -E
+CFLAGS_NETCDF = 
+CPPFLAGS_HDF  = -DNDEBUG -DHDF $(FMPOOL_FLAGS)
+CPP_NETCDF    = -I. -I$(HDF_INC) -I$(NETCDF_INC) -I$(PORT_INC)
+CPPFLAGS_LIB	= $(SWAP) $(NETLONG) 
+CPPFLAGS_XDR	= $(CPP_XDR) 
+CPPFLAGS_NETCDF =  $(CPPFLAGS_XDR) $(CPP_NETCDF) $(CPPFLAGS_LIB) $(CPPFLAGS_HDF) 
+FFLAGS  =
+NCDUMP	= 
+NCGEN	= 
+NEQN	= neqn
+OS	= 
+TBL	= tbl
+WHICH	= which
+FTPDIR	= 
+VERSION	= 2.3.2
+LEX	= lex
+YACC	= yacc
+DIFF    = diff
+DIFF_FLAGS = -w
+
+
+#### ----- host and target specific makefile fragments come in here.-------
+### ------------------- end of makefile fragments -------------------------
+# ############# End of system configuration section. ###############
+
+PROGRAM		= xdrtest
+#OS		= @OS@
+#CPP_XDR		= @CPP_XDR@
+#CPPFLAGS	= $(CPPFLAGS_XDR)
+#CFLAGS		= $(CFLAGS_XDR)
+HEADERS		= xdr.h types.h
+MANIFEST = $(DISTFILES)
+DISTFILES	= Makefile.in NOTICE.h README depend \
+		  byteordr.c descrip.mms htonl.mar make.com msoft.mk \
+		  ntohl.mar test_xdr.sav types.h xdr.c xdr.h xdrarray.c \
+		  xdrfloat.c xdrstdio.c $(PROGRAM).c $(PROGRAM).opt \
+		  testout.sav
+LIBOBJS		= $(XDR_LIBOBJS)
+LIBNAME		= mfhdf
+REMOTE_LIBRARY	= ../libsrc/lib$(LIBNAME).a
+OBJS		= $(PROGRAM).o $(LIBOBJS)
+#LD_XDR		= @LD_XDR@
+LD_NETCDF	= ../libsrc/libmfhdf.a
+LIBS		= $(LD_XDR) $(LIBSX)
+INSTALL_DEPS	= $(XDR_INSTALL_DEPS)
+prefix		= ../../..
+GARBAGE		= test.xdr $(PROGRAM)_out.new
+
+
+all::         FORCE
+	@if test -z "$(LIBOBJS)"; then \
+	  : true; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(REMOTE_LIBRARY); \
+	fi
+
+# The formatted file `$(PROGRAM)_out.new' might differ from the touchstone
+# file `testout.sav', but this should be due to SMALL rounding errors.
+#
+# `$(PROGRAM)' creates the binary-file `test.xdr' which MUST be byte-for-byte
+# identical with `test_xdr.sav'.
+#
+test:		$(PROGRAM)
+	@ echo "========================="
+	@ echo "netCDF XDR tests start"
+	@ echo "========================="
+	./$(PROGRAM) > $(PROGRAM)_out.new
+	@cmd="$(DIFF) $(DIFF_FLAGS) $(PROGRAM)_out.new testout.sav"; \
+	echo $$cmd; \
+	if $$cmd; then \
+	    echo "*** XDR passes formatted test ***"; \
+	else \
+	    echo "*** XDR fails formatted test ***"; \
+	    echo "The above differences are OK iff due to rounding"; \
+	    exit 0; \
+	fi
+	@cmd="cmp test.xdr test_xdr.sav"; \
+	echo $$cmd; \
+	if $$cmd; then \
+	    echo "*** XDR passes binary test ***"; \
+	else \
+	    echo "*** XDR fails binary test ***"; \
+	    exit 1; \
+	fi
+
+install::
+
+install-includes::
+
+# This is the master.mk.in makefile.  It contains general rules.
+#
+
+.SUFFIXES:
+.SUFFIXES:	.so .o .i .c .fc .f .F .l .y
+
+# ###########################################################################
+# General Macros: (moved to make file fragment )
+# ###########################################################################
+#CPP		= @CPP@
+#NCDUMP		= @NCDUMP@
+#NCGEN		= @NCGEN@
+#NEQN		= @NEQN@
+#OS		= @OS@
+#TBL		= @TBL@
+#WHICH		= @WHICH@
+
+# ###########################################################################
+# Recursive Macros (command-line changes to others aren't supported):
+# ###########################################################################
+SUBDIR_MACROS = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+LOCAL_MACROS  = CC="$(CC)" \
+	CFLAGS="$(CFLAGS)" \
+	CPP="$(CPP)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	exec_prefix="$(exec_prefix)" \
+	FC="$(FC)" \
+	prefix="$(prefix)"
+
+# ###########################################################################
+# Recursive make(1)s in Subdirectories:
+# ###########################################################################
+
+subdir_dummy_target $(SUBDIR_TARGETS):
+	@echo ""
+	@dir=`echo $@ | sed 's,/.*,,'`; \
+	    target=`echo $@ | sed "s,$$dir/,,"`; \
+	    cd $$dir && \
+	    echo "making \`$$target' in directory `pwd`" && \
+	    echo "" && \
+	    $(MAKE) $(MFLAGS) $(SUBDIR_MACROS) \
+		$$target || exit 1
+	@echo ""
+	@echo "returning to directory `pwd`"
+	@echo ""
+
+
+# ###########################################################################
+# Compilation:
+# ###########################################################################
+#FORTC		= @FORTC@
+
+# Compile FORTRAN code.
+#
+.f.o:
+	$(FC) -c $(FFLAGS) $<
+.F.o:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $*.f \
+	|| (rm -f $*.f $$$$.c; exit 1) \
+	&& rm $$$$.c
+	$(FC) -c $(FFLAGS) $*.f
+.F.f:
+	ln -s $< $$$$.c \
+	&& $(CPP) -DUD_FORTRAN_SOURCE $(CPPFLAGS) $(CPPFLAGS_NETCDF) $$$$.c \
+	    | sed '/^# *[0-9]/d' > $@ \
+	|| (rm -f $@ $$$$.c; exit 1) \
+	&& rm $$$$.c
+
+# Generate FORTRAN-callable C code.
+#
+.fc.o:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || ( rm -f $*.c; exit 1)
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c
+.fc.c:
+	$(FORTC) -O $(OS) $< > $@ \
+	    || (rm -f $*.c; exit 1)
+
+# Compile C code.
+#
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $<
+
+# Compile lex(1) code.  This rule is here to ensure the use of CPPFLAGS.
+# 
+.l.o:
+	rm -f $*.c
+	$(LEX) -t $< > $*.c
+	$(CC) -c $(CPPFLAGS) $(CPPFLAGS_NETCDF) $(CFLAGS) $*.c
+	rm $*.c
+
+# C preprocess.  
+#   NB: 
+#	1. The output `file' is not created but appears on standard output;
+#	2. Line numbering information is kept.
+#
+.c.i:
+	$(CPP) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $<
+
+
+# ###########################################################################
+# Libraries:
+# ###########################################################################
+# RANLIB		= @RANLIB@
+LIBDIR		= $(prefix)/lib
+LIB_A		= lib$(LIBRARY).a
+
+library::		$(LIB_A)
+
+# The following rule is forced because the library can be created by a
+# makefile in another directory prior to the execution of the following rule.
+#
+$(LIB_A):		$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+# The following rule is for those makefiles needing to install object
+# modules in a library in another directory.  They need only define 
+# REMOTE_LIBRARY and LIBOBJS.  The rule is forced for the same reason as the
+# $(LIB_A) rule.
+#
+lib_dummy $(REMOTE_LIBRARY):	$(LIBOBJS) FORCE
+	$(AR) rcuv $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+installed_libfiles:	FORCE
+	@if [ -n "$(LIBFILES)" ]; then \
+	    libfiles="$(LIBFILES)"; \
+	    for libfile in $$libfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    LIBDIR=$(LIBDIR) LIBFILE=$$libfile \
+		    installed_libfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_library::	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+	    LIBDIR=$(LIBDIR) LIBFILE=$(LIB_A) \
+	    installed_libfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_libfile:	$(LIBDIR)/$(LIBFILE)
+
+$(LIBDIR)/$(LIBFILE):	$(LIBDIR) $(LIBFILE)
+	$(INSTALL_DATA) $(LIBFILE) $@
+
+dummy_libdir $(LIBDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+LIB_SO		= lib$(LIBRARY).so.$(MAJOR_NO).$(MINOR_NO)
+LIB_SA		= lib$(LIBRARY).sa.$(MAJOR_NO).$(MINOR_NO)
+
+#library::		FORCE
+#	@so_objs=`echo $(LIBOBJS) | sed 's/\.o/.so/g'`; \
+#	if [ -z "$$so_objs" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SO) \
+#		SO_OBJS="$$so_objs"; \
+#	fi
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIB_SA); \
+#	fi
+
+$(LIB_SO):	$(SO_OBJS)
+	ld -assert pure-text $(SO_OBJS) -o $@
+$(LIB_SA):	$(SA_OBJS) FORCE
+	$(AR) rcuv $@ $(SA_OBJS)
+
+.fc.so:
+	$(FORTC) -O $(OS) $< > $*.c \
+	    || (rm -f $*.c; exit 1)
+	$(CC) -c -pic $(CFLAGS) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $*.c -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+.c.so:
+	$(CC) -c -pic $(CFLAGS) $(CPPFLAGS) $(CPPFLAGS_NETCDF) $< -o $$$$.o \
+	    || (rm -f $$$$.o; exit 1)
+	mv $$$$.o $@
+
+#installed_library::	$(LIBDIR)/$(LIB_SO)
+#	@if [ -z "$(SA_OBJS)" ]; then \
+#	    :; \
+#	else \
+#	    $(MAKE) $(MFLAGS) $(LIBDIR)/$(LIB_SA); \
+#	fi
+
+$(LIBDIR)/$(LIB_SO):	$(LIBDIR) $(LIB_SO)
+	$(INSTALL_DATA) $(LIB_SO) $(LIBDIR)/$(LIB_SO)
+$(LIBDIR)/$(LIB_SA):	$(LIBDIR) $(LIB_SA)
+	$(INSTALL_DATA) $(LIB_SA) $(LIBDIR)/$(LIB_SA)
+
+
+# ###########################################################################
+# Programs:
+# ###########################################################################
+BINDIR		= $(exec_prefix)/bin
+
+programs:	$(PROGRAMS)
+program:
+	@if [ -z "$(PROGRAM)" ]; then \
+	    : true; \
+	else \
+	    if [ -z "$(LIBRARY)" ]; then \
+		: true; \
+	    else \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) library; \
+	    fi; \
+	    $(MAKE) $(MFLAGS) $(LOCAL_MACROS) $(PROGRAM); \
+	fi
+
+dummy_prog $(PROGRAM):	$(OBJS)
+	@if [ -r $@.f -o -r $@.F ]; then \
+	    ld='$(FC) $(FFLAGS)'; \
+	else \
+	    ld='$(CC) $(CFLAGS)'; \
+	fi; \
+	cmd="$$ld $(OBJS) $(LIBS) -o $@"; \
+	echo $$cmd; \
+	$$cmd \
+	    || (rm -f $@; exit 1)
+
+installed_programs:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) installed_binfiles \
+	    BINDIR=$(BINDIR) BINFILES="$(PROGRAMS)"
+
+installed_binfiles:	FORCE
+	@if [ -n "$(BINFILES)" ]; then \
+	    binfiles="$(BINFILES)"; \
+	    for binfile in $$binfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) \
+		    BINDIR=$(BINDIR) BINFILE=$$binfile \
+		    installed_binfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+installed_program:	FORCE
+	@$(MAKE) $(MFLAGS) $(LOCAL_MACROS) BINDIR=$(BINDIR) BINFILE=$(PROGRAM) \
+	    installed_binfile
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_binfile:	$(BINDIR)/$(BINFILE)
+
+$(BINDIR)/$(BINFILE):	$(BINDIR) $(BINFILE)
+	$(INSTALL_PROGRAM) $(BINFILE) $@
+
+dummy_bindir $(BINDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# Header files:
+# ###########################################################################
+installed_headers:	FORCE
+	@if [ -n "$(HEADERS)" ]; then \
+	    headers="$(HEADERS)"; \
+	    for header in $$headers; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INCDIR=$(INCDIR) HEADER=$$header \
+		    installed_header || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_header:	$(INCDIR)/$(HEADER)
+
+$(INCDIR)/$(HEADER):	$(INCDIR) $(HEADER)
+	$(INSTALL_DATA) $(HEADER) $@
+
+dummy_incdir $(INCDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+
+# ###########################################################################
+# `etc/' files:
+# ###########################################################################
+ETCDIR	= $(prefix)/etc
+
+installed_etcfiles:
+	@if [ -n "$(ETCFILES)" ]; then \
+	    etcfiles="$(ETCFILES)"; \
+	    for etcfile in $$etcfiles; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) ETCDIR=$(ETCDIR) ETCFILE=$$etcfile \
+		    installed_etcfile || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_etcfile:	$(ETCDIR)/$(ETCFILE)
+
+$(ETCDIR)/$(ETCFILE):	$(ETCDIR) $(ETCFILE)
+	-mkdir -p $(ETCDIR)
+	-chmod u+rwx,g+rws,o=rx $(ETCDIR)
+	$(INSTALL_DATA) $(ETCFILE) $@
+
+# ###########################################################################
+# Manual Pages:
+# ###########################################################################
+MANDIR	= $(prefix)/man
+
+installed_manuals:	FORCE
+	@if [ -n "$(MANUALS)" ]; then \
+	    manuals="$(MANUALS)"; \
+	    for manual in $$manuals; do \
+		mandir=$(MANDIR)/man`echo $$manual | sed 's/.*\.\(.\).*/\1/'`; \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANDIR=$$mandir MANUAL=$$manual \
+		    installed_manual || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_manual:	$(MANDIR)/$(MANUAL)
+
+# The first sed(1) editing command in the following replaces the expanded
+# RCS keyword `$Date ...' in the `.TH' macro line with something more 
+# appropriate to a manual page.
+#
+$(MANDIR)/$(MANUAL):	$(MANDIR) $(MANUAL)
+	sed \
+	 -e '/^\.TH/s/$$D\ate: \([0-9]*\)\/\([0-9]*\)\/\([0-9]*\).*\$$/\1-\2-\3/'\
+	 $(MANUAL) | $(TBL) | $(NEQN) > $@
+
+dummy_mandir $(MANDIR):
+	mkdir -p $@
+	chmod u+rwx,g+rws,o=rx $@
+
+# ###########################################################################
+# TeX-Info Pages:
+# ###########################################################################
+INFODIR       = $(prefix)/info
+
+installed_infos:      FORCE
+	if [ -z "$(MAKEINFO)" ]; then \
+		echo 1>&2 "Can't install info(1) pages because no makeinfo(1)"; \
+	else \
+	  if [ -n "$(INFOS)" ]; then \
+	      infos="$(INFOS)"; \
+	      for info in $$infos; do \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) INFODIR=$(INFODIR) INFO=$$info \
+		installed_info || exit 1; \
+	      done; \
+	   else \
+	      :; \
+	   fi; \
+	fi;
+# The following target decouples the previous targets from the actual rule;
+# thus, eliminating extraneous make(1) messages.
+#
+installed_info:       $(INFODIR)/$(INFO)
+
+$(INFODIR)/$(INFO):   $(INFODIR) $(INFO)
+	-mkdir -p $(INFODIR)
+	-chmod u+rwx,g+rws,o=rx $(INFODIR)
+	$(INSTALL_DATA) $(INFO) $@
+
+# Rules for generating info pages:
+#
+.SUFFIXES:    .info .texi .texinfo .txn
+.texi.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.texinfo.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+.txn.info:
+	@if [ -z "$(MAKEINFO)" ]; then \
+	  echo 1>&2 "Can't create $@ because no makeinfo(1)"; \
+	else \
+	  $(MAKEINFO) $< --no-split --output=$@; \
+	fi
+
+# Ensure that info page depends on canonical TeX-Info macros.
+#
+dummy_info $(INFO):   texinfo.tex
+
+# ###########################################################################
+# Cleanup:
+# ###########################################################################
+clean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log
+
+realclean::	distclean
+distclean::
+	rm -f $(GARBAGE) $(PROGRAM) a.out core *.o *.a *.so.* *.sa.* *.so \
+	    *.log Makefile config.status cc_id tags
+
+
+# ###########################################################################
+# Configuration:
+# ###########################################################################
+
+# The following target is touched because config.status won't update it if
+# it hasn't changed.
+#
+# The following is commented-out because the HPUX make(1) goes into a loop.
+#
+#Makefile:	config.status
+#	./config.status
+#	touch $@
+
+config.status:	cc_id configure
+	./configure --no-create
+
+cc_id:		FORCE
+	if test -r $@ && test "`cat $@`" = "$(CC)"; then \
+	    :; \
+	else \
+	    echo "$(CC)" > $@; \
+	fi
+
+configure:		configure.in
+	autoconf
+
+
+# ###########################################################################
+# Dependency maintenance:
+# ###########################################################################
+.PRECIOUS:	depend
+#
+# Note: The following rule will only work if the C compiler behaves correctly
+# when given the `-M' option.  AIX's cc(1) and SunOS's acc(1) behave
+# incorrectly.  --Steve Emmerson 1992-09-24
+#
+# Furthermore, we do not attempt to maintain dependencies on installed
+# header files (e.g. those in $(INCDIR)) for two reasons: 1) the dependency
+# list generated at Unidata mightn't correspond to the situation at a client
+# site; and 2) clients using broken compilers (c.f. previous note) can't
+# regenerate the dependency list.
+#
+disabled_depend:		FORCE
+	-incdir=`echo $(INCDIR) | sed s',/,\\\/,g'`; \
+	cc -M $(CPPFLAGS) $(CPPFLAGS_NETCDF) *.c 2> /dev/null | \
+	    awk '{ \
+		if ($$0 ~ /:/) { \
+		    target	= $$1; \
+		    if (target ~ /:/) { \
+			target	= substr(target,1,length(target)-1); \
+			start	= 2; \
+		    } else { \
+			start	= 3; \
+		    } \
+		} else { \
+		    start	= 1; \
+		} \
+		for (i = start; i <= NF; ++i) { \
+		    if ($$i !~ /^\\/ && \
+			$$i !~ /port\// && \
+			$$i !~ /^\//) \
+			print target ": " $$i \
+		} \
+	    }' > $@
+	tag='### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###'; \
+	    sed -e "/^$$tag$$/r depend" \
+		-e "/^$$tag$$/q" Makefile > Makefile.new
+	mv Makefile.new Makefile
+
+
+# ###########################################################################
+# Distributions:
+# ###########################################################################
+#FTPDIR		= @FTPDIR@
+#VERSION		= @VERSION@
+
+ftp:		$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z
+	test ! -h $(FTPDIR)/$(PACKAGE).tar.Z && exit 0; \
+	cd $(FTPDIR) || exit 1; \
+	rm $(PACKAGE).tar.Z || exit 1; \
+	ln -s $(PACKAGE)-$(VERSION).tar.Z $(PACKAGE).tar.Z;
+
+$(FTPDIR)/$(PACKAGE)-$(VERSION).tar.Z:	$(PACKAGE)-$(VERSION).tar.Z
+	cp $(PACKAGE)-$(VERSION).tar.Z $@ 
+	chmod u+rw,g+rw,o=r $@
+
+tar.Z:		$(PACKAGE)-$(VERSION).tar.Z
+
+$(PACKAGE)-$(VERSION).tar.Z:	MANIFEST
+	dir=`basename \`pwd\`` \
+	&& id=$(PACKAGE)-$(VERSION) \
+	&& cd .. \
+	&& ln -s $$dir $$id \
+	&& tar -chof - `sed "s|^|$$id/|" $$id/MANIFEST` \
+	    | compress > $$id/$@ \
+	&& rm $$id
+
+MANIFEST:	FORCE
+	@echo 1>&2 Creating MANIFEST
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo > $@
+
+MANIFEST.echo:	FORCE
+	@$(MAKE) -s $(MFLAGS) $(LOCAL_MACROS) \
+	    MANIFEST=`echo $(MANIFEST) | sed 's/MANIFEST//'` \
+	    ensure_manifest > /dev/null
+	@echo $(MANIFEST) | fmt -1
+	@if [ -n "$(SUBDIRS)" ]; then \
+	    subdirs="$(SUBDIRS)"; \
+	    for subdir in $$subdirs; do \
+		(cd $$subdir && \
+	        echo 1>&2 Creating $@ in `pwd` && \
+		$(MAKE) $(MFLAGS) $(LOCAL_MACROS) MANIFEST.echo | \
+		    sed "s|^|$$subdir/|") || exit 1; \
+	    done; \
+	else \
+	    :; \
+	fi
+
+ensure_manifest:	$(MANIFEST)
+
+# for distribution creation
+distdir = $(TOP_SRCDIR)/$(PACKAGE)-$(VERSION)/$(curdir)
+curdir = mfhdf/xdr
+dist: $(DISTFILES)
+	@for file in $(DISTFILES); do \
+	  ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
+	    || { echo copying $$file instead; \
+	    cp -p $(srcdir)/$$file $(distdir)/$$file;}; \
+	done
+
+# ###########################################################################
+# Miscellaneous:
+# ###########################################################################
+
+# The following dummy target is useful as a dependency to ensure that a
+# rule is always executed.
+#
+FORCE:
+
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/Makefile.in_orig
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/Makefile.in_orig	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/Makefile.in_orig	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,69 @@
+# Makefile for the eXternal Data Representation (XDR) library routines 
+# used by the Network CDF library (needed if and only if the native xdr(3)
+# implementation is broken or doesn't exist).
+#
+# $Id: Makefile.in_orig,v 1.2 2000/08/30 21:55:50 wendling Exp $
+
+PROGRAM		= xdrtest
+OS		= @OS@
+CPP_XDR		= @CPP_XDR@
+CPPFLAGS	= $(CPP_XDR) @CPPFLAGS@
+CFLAGS		= @CFLAGS@ @HDF_INC@
+HEADERS		= xdr.h types.h
+MANIFEST	= Makefile.in NOTICE.h README depend \
+		  byteordr.c descrip.mms htonl.mar make.com msoft.mk \
+		  ntohl.mar test_xdr.sav types.h xdr.c xdr.h xdrarray.c \
+		  xdrfloat.c xdrstdio.c $(PROGRAM).c $(PROGRAM).opt \
+		  testout.sav
+LIBOBJS		= @XDR_LIBOBJS@
+LIBNAME		= netcdf
+REMOTE_LIBRARY	= ../libsrc/lib$(LIBNAME).a
+OBJS		= $(PROGRAM).o $(LIBOBJS)
+LD_XDR		= @LD_XDR@
+LD_NETCDF	= ../libsrc/libnetcdf.a
+LIBS		= $(LD_XDR) $(LIBSX)
+INSTALL_DEPS	= @XDR_INSTALL_DEPS@
+prefix		= ../../..
+GARBAGE		= test.xdr $(PROGRAM)_out.new
+
+
+all::         FORCE
+	@if test -z "$(LIBOBJS)"; then \
+	  : true; \
+	else		 \
+	  $(MAKE) $(MFLAGS) $(REMOTE_LIBRARY); \
+	fi
+
+# The formatted file `$(PROGRAM)_out.new' might differ from the touchstone
+# file `testout.sav', but this should be due to SMALL rounding errors.
+#
+# `$(PROGRAM)' creates the binary-file `test.xdr' which MUST be byte-for-byte
+# identical with `test_xdr.sav'.
+#
+test:		$(PROGRAM)
+	./$(PROGRAM) > $(PROGRAM)_out.new
+	@cmd="diff -w $(PROGRAM)_out.new testout.sav"; \
+	echo $$cmd; \
+	if $$cmd; then \
+	    echo "*** XDR passes formatted test ***"; \
+	else \
+	    echo "*** XDR fails formatted test ***"; \
+	    echo "The above differences are OK iff due to rounding"; \
+	    exit 0; \
+	fi
+	@cmd="cmp test.xdr test_xdr.sav"; \
+	echo $$cmd; \
+	if $$cmd; then \
+	    echo "*** XDR passes binary test ***"; \
+	else \
+	    echo "*** XDR fails binary test ***"; \
+	    exit 1; \
+	fi
+
+install::
+
+include ../port/master.mk
+
+### Everything after the following line might be overwritten ###
+### DO NOT DELETE THIS LINE.  make depend DEPENDS ON IT ###
+include depend

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/NOTICE.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/NOTICE.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/NOTICE.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/README
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/README	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/README	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,76 @@
+$Id: README,v 1.1 1993/04/21 21:54:15 chouck Exp $
+
+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.

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/byteordr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/byteordr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/byteordr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -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);
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/depend
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/depend	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/depend	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/descrip.mms
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/descrip.mms	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/descrip.mms	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,59 @@
+! $Id: descrip.mms,v 1.2 1993/12/01 04:05:19 sxu Exp $
+!
+!          Build/test an xdr library on vms
+!
+
+!==============================================================================
+! ASSUMPTIONS:
+
+!==============================================================================
+! CUSTOMIZATIONS (change as necessary):
+
+!Root of the installation:
+INSTROOT	= LDMROOT:
+
+!Operating system version:
+OS		= vms_5_4
+
+!Compilation options:
+COPTS		= 
+
+!==============================================================================
+INCDIR		= $(INSTROOT)[include]
+LIBDIR		= $(INSTROOT)[lib]
+LIBOBJS		= xdr.obj, xdrfloat.obj, xdrstdio.obj, htonl.obj, ntohl.obj
+LIBRARY		= [---.lib]netcdf.olb
+LINKFLAGS	= /nodebug/exec=$(mms$target_name).exe
+!LINKFLAGS	= /debug/exec=$(mms$target_name).exe
+CFLAGS		= $(COPTS)/include=sys$disk:[]
+SYSLIBS		= sys$library:vaxcrtl/lib
+
+all :		library, xdrtest.exe
+	continue
+
+install :	all
+	continue
+
+library :	$(LIBRARY)($(LIBOBJS))
+	continue
+
+xdrtest.exe :	xdrtest.obj, xdrarray.obj, $(LIBRARY)
+	$(LINK) $(LINKFLAGS) xdrtest.obj,xdrarray.obj,$(LIBRARY)/lib,$(SYSLIBS)
+
+rtest.exe :  rtest.obj, xdrarray.obj, $(LIBRARY)
+	$(LINK) $(LINKFLAGS) rtest.obj,xdrarray.obj,$(LIBRARY)/lib,$(SYSLIBS)
+
+rtest.obj : xdrtest.c xdr.h types.h
+	$(CC) $(CFLAGS) /undefine="CREATE" xdrtest.c /OBJECT= $@
+
+clean :
+	purge
+	- delete *.obj.*,*.lis.*,*.map.*,*.exe.*
+
+xdr.obj : xdr.c xdr.h types.h
+xdrfloat.obj : xdrfloat.c xdr.h types.h
+xdrstdio.obj : xdrstdio.c xdr.h types.h
+xdrarray.obj : xdrarray.c xdr.h types.h
+htonl.obj : htonl.mar
+ntohl.obj : ntohl.mar
+xdrtest.obj : xdrtest.c xdr.h types.h

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/htonl.mar
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/htonl.mar	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/htonl.mar	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/make.com
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/make.com	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/make.com	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,38 @@
+$! --------------------------------------------------------------------------
+$! For making XDRTEST.EXE on VMS if you don't have MMS.
+$! --------------------------------------------------------------------------
+$!
+$! $Id: make.com,v 1.4 1996/11/07 00:27:30 sxu Exp $
+$
+$ macro :== macro/nolist/migration
+$ if f$getsyi("arch_name") .eqs. "VAX"
+$ then 
+$ ccopt = "/DECC/STANDARD=VAXC"
+$ define/nolog sys$clib sys$library:deccrtl
+$ else
+$ ccopt = ""
+$ define/nolog sys$clib sys$library:vaxcrtl
+$ endif
+$ ccc := cc 'ccopt /opt/nodebug/nolist -
+            /define=(HDF,VMS, NO_SYS_XDR_INC)  -
+            /include=([],[--.hdf.src], [--.hdf.jpeg],[--.hdf.zlib])
+$!
+$ ccc XDR.C
+$ ccc XDRTEST.C
+$ ccc XDRARRAY.C
+$ ccc XDRFLOAT.C
+$ ccc XDRSTDIO.C
+$! macro HTONL.MAR
+$! macro NTOHL.MAR
+$!
+$ library/create [-.-.LIB]MFHDF.OLB
+$! library/replace [-.-.LIB]MFHDF.OLB XDR, XDRFLOAT, XDRSTDIO, HTONL, NTOHL
+$ library/replace [-.-.LIB]MFHDF.OLB XDR, XDRFLOAT, XDRSTDIO
+$!
+$ link/nodebug/exec=XDRTEST.exe -
+    xdrtest.obj, -
+    xdrarray.obj, -
+    [-.-.lib]mfhdf.olb/lib, -
+    sys$input/opt
+       sys$clib/lib
+$ delete *.obj;*

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/msoft.mk
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/msoft.mk	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/msoft.mk	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/ntohl.mar
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/ntohl.mar	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/ntohl.mar	2007-05-14 09:41:34 UTC (rev 808)
@@ -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

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/test_xdr.sav
===================================================================
(Binary files differ)


Property changes on: packages/libhdf4/branches/upstream/current/mfhdf/xdr/test_xdr.sav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/testout.sav
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/testout.sav	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/testout.sav	2007-05-14 09:41:34 UTC (rev 808)
@@ -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 

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/types.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/types.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/types.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,62 @@
+/* @(#)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
+#if !(defined vms || defined UNIX386 || defined __FreeBSD__ || defined WINNT || defined WIN32 || defined __ultrix || (defined __sun__ && defined __i386__) || defined _CRAYMPP)
+long ntohl(long);
+long htonl(long);
+#endif /* !unix */
+#ifdef vms
+#define ntohl decc$ntohl
+#define htonl decc$htonl
+#endif
+#endif
+
+#ifdef STDC_INCLUDES
+#include <stddef.h>
+#include <stdlib.h>
+#else
+#ifdef __vax
+extern void *malloc();
+#else
+extern char *malloc();
+#endif /* __vax */
+#endif
+
+#define mem_alloc(bsize)    malloc(bsize)
+#define mem_free(ptr, bsize)    free(ptr)
+
+#if defined unix | defined __unix | defined vms
+#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__ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/win32xdr.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/win32xdr.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/win32xdr.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdr.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdr.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdr.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,566 @@
+/* @(#)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> 
+#if (defined macintosh || defined SYMANTEC_C || defined MAC)
+#include <strings.h>
+#endif
+
+#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)
+#ifdef _CRAYMPP
+	    { /* need to support sign extension */
+		if (XDR_GETLONG(xdrs, lp)){
+		    if (*lp & 0x80000000)
+			*lp |= 0xffffffff00000000;;
+		    return(TRUE);
+		}
+		return (FALSE);
+	    }
+#else
+		return (XDR_GETLONG(xdrs, lp));
+#endif
+
+	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);
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdr.h
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdr.h	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdr.h	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,257 @@
+/* @(#)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__
+
+#if defined(__MWERKS__)	/* non-command line compiler */
+#ifndef HDF
+#define HDF
+#endif
+#endif
+
+/*
+ * 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.
+ */
+/*
+#if (defined vms) && !(defined __vax)   
+#include <in.h>
+typedef unsigned int    u_int;
+#endif
+*/
+/*
+ * 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)))
+
+/*
+ * These are the "generic" xdr routines.
+ */
+extern void     xdr_free(xdrproc_t , char *);
+extern bool_t	xdr_void(void);
+extern bool_t	xdr_int(XDR *, int *);
+extern bool_t	xdr_u_int(XDR *, u_int *);
+extern bool_t	xdr_long(XDR *, long *);
+extern bool_t	xdr_u_long(XDR *, u_long *);
+extern bool_t	xdr_short(XDR *, short *);
+extern bool_t	xdr_u_short(XDR *, u_short *);
+extern bool_t	xdr_bool(XDR *, bool_t *);
+extern bool_t	xdr_enum(XDR *, enum_t *);
+extern bool_t	xdr_array(XDR *, caddr_t *, u_int *, u_int, u_int, xdrproc_t );
+extern bool_t	xdr_bytes(XDR *, char **, u_int *, u_int);
+extern bool_t	xdr_opaque(XDR *, caddr_t , u_int );
+extern bool_t	xdr_string(XDR *, char **, u_int);
+extern bool_t	xdr_union(XDR *, enum_t *, char *, struct xdr_discrim *, xdrproc_t );
+extern bool_t	xdr_char(XDR *, char *);
+extern bool_t	xdr_u_char(XDR *, char *);
+extern bool_t	xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t );
+extern bool_t	xdr_float(XDR *, float *);
+extern bool_t	xdr_double(XDR *, double *);
+extern bool_t	xdr_reference();
+extern bool_t	xdr_pointer();
+extern 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;
+extern bool_t   xdr_netobj(XDR *,struct netobj *);
+
+/*
+ * These are the public routines for the various implementations of
+ * xdr streams.
+ */
+extern void   xdrmem_create();		/* XDR using memory buffers */
+extern void   xdrstdio_create(XDR *, FILE *, enum xdr_op );	/* XDR using stdio library */
+extern void   xdrrec_create();		/* XDR pseudo records for tcp */
+extern bool_t xdrrec_endofrecord();	/* make end of xdr record */
+extern bool_t xdrrec_skiprecord();	/* move to beginning of next record */
+extern bool_t xdrrec_eof();		/* true if no more input */
+
+#ifdef HDF
+#include "hdf.h"
+#endif /* HDF */
+
+#endif /* !__XDR_HEADER__ */

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrarray.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrarray.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrarray.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -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);	
+}
+

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrfloat.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrfloat.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrfloat.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,319 @@
+/* @(#)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:
+#ifdef _CRAYMPP
+		/* T3D longs are 64 bits but floats are 32 bits */
+		return (XDR_PUTBYTES(xdrs, (caddr_t)fp, 4));
+#else
+#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
+#endif
+
+	case XDR_DECODE:
+#ifdef _CRAYMPP
+		/* T3D longs are 64 bits but floats are 32 bits */
+		return (XDR_GETBYTES(xdrs, (caddr_t)fp, 4));
+#else
+#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
+#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
+#ifdef _CRAYMPP
+		return (XDR_PUTBYTES(xdrs, (caddr_t)dp, 8));
+#else
+#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 */
+#endif
+
+	case XDR_DECODE:
+#ifndef vax
+		lp = (long *)dp;
+#ifdef _CRAYMPP
+		return (XDR_GETBYTES(xdrs, (caddr_t)dp, 8));
+#else
+#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 */
+#endif
+#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);
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrlib.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrlib.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrlib.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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!!!!U!!!!+N!!!#U!!!!U`!!!+`!!!#B!!!!XJ!!!,-!!!#d!!!!Y3!!!+i!!!#
+a!!!!YJ!!!,F!!!#i!!!!V3!!!,!!!!#j!!!!ZJ!!!,X!!!#m!!!![3!!!,i!!!#
+r!!!!`!!!!-%!!!$#!!!!``!!!+m!!!$*!!!!bJ!!!-X!!!$-!!!!a3!!!-J!!!$
+0!!!!cJ!!!-m!!!$%!!!!a`!!!0!!!!$4!!!!dJ!!!0-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!)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!!!:

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrstdio.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrstdio.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrstdio.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,227 @@
+/* @(#)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 VMS || defined WINNT || defined WIN32)
+#     if !(defined macintosh || defined SYMANTEC_C || defined MAC)
+#        include <netinet/in.h>     /* for htonl() */
+#     else /* Macintosh equivalent */
+#        define ntohl(x) x
+#        define ntohs(x) x
+#        define htonl(x) x
+#        define htons(x) x
+#     endif /* Macintosh */
+#else
+#     ifdef VMS
+#        include <in.h>
+#     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
+#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;
+{
+#ifdef _CRAYMPP
+    caddr_t 	cp;
+    int		sizediff;
+
+    /* Some machines have sizeof(long) > 4 */
+    /* Read data into the least significant 4 bytes which assume to be */
+    /* at the higher address. */
+    sizediff = sizeof(long) - 4;
+    if (sizediff){
+	*lp = 0;
+	cp = (caddr_t)lp + sizediff;
+    }
+    else
+	cp = (caddr_t)lp;
+
+    if (fread(cp, 4, 1, (FILE *)xdrs->x_private) != 1)
+        return (FALSE);
+
+    /* need to deal with sign extension for those 64 bit signed longs */
+#else
+    if (fread((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
+	return (FALSE);
+#endif
+
+#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
+
+#ifdef _CRAYMPP
+  {
+    caddr_t	cp;
+    int	sizediff;
+
+    /* Some machines have sizeof(long) > 4 */
+    /* Write only the least significant 4 bytes which assume to be */
+    /* at the higher address. */
+    sizediff = sizeof(long) - 4;
+    if (sizediff)
+	cp = (caddr_t)lp + sizediff;
+    else
+	cp = (caddr_t)lp;
+
+    if (fwrite(cp, 4, 1, (FILE *)xdrs->x_private) != 1)
+	return (FALSE);
+  }
+#else
+    if (fwrite((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
+	return (FALSE);
+#endif
+
+    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);
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.c
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.c	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.c	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,412 @@
+/*
+ * 	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>
+#if (defined macintosh || defined SYMANTEC_C || defined MAC)
+#define NO_SYS_XDR_INC /* use local "xdr.h" */
+#	include "types.h"
+#else /* not macintosh */
+#       ifdef vms
+#         include <in.h>
+#         include <libdef.h>
+#         include <lib$routines.h>
+#         include <string.h>
+#       else
+#   	  include <sys/types.h>	/* for <netinet/in.h> on some systems */
+#   	  if !defined MSDOS & !defined WIN32
+#            include <netinet/in.h>	/* for htonl() */
+#   	  endif
+#	endif
+#endif /* not macintosh */
+
+/*
+ * 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__ */
+
+#if defined __MWERKS__
+#include <console.h>
+#endif
+
+int main(ac,av)
+int ac ;
+char *av[] ;
+{
+	int ii ;
+	const char *fname ;
+	FILE *F ;
+	XDR xdrs[1] ;
+	u_int count ;
+	u_int szof ;
+#ifdef vms
+	static long timer_addr = 0 ;
+#endif
+
+	/* 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] ;
+
+
+#if defined __MWERKS__
+    ac = ccommand(&av);
+#endif
+	
+#ifdef MDEBUG
+	malloc_debug(2) ;
+#endif
+	fname = TESTFILE ;
+	if(ac > 1)
+	{
+		fname = av[1] ;
+	} 
+#ifdef CREATE
+/* Create */
+
+#ifdef vms
+	lib$init_timer(&timer_addr) ;
+	F = fopen(fname,"wb",
+		"mbf=2","mbc=16") ;
+#else
+#ifdef __STDC__
+	F = fopen(fname,"wb") ;
+#else
+	F = fopen(fname,"w") ;
+#endif
+#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 vms
+	F = fopen(fname,"rb",
+		"mbf=2","mbc=16" ) ;
+#else
+#ifdef __STDC__
+	F = fopen(fname,"rb") ;
+#else
+	F = fopen(fname,"r") ;
+#endif
+#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 < 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 < 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 < 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 < 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 < 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 < 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 < 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
+#ifdef vms
+	lib$show_timer(&timer_addr) ;
+#endif
+	exit(0) ;
+}

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.mak
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.mak	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.mak	2007-05-14 09:41:34 UTC (rev 808)
@@ -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
+################################################################################

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.opt
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.opt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.opt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1 @@
+sys$library:vaxcrtl.exe/share

Added: packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.project.hqx
===================================================================
--- packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.project.hqx	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mfhdf/xdr/xdrtest.project.hqx	2007-05-14 09:41:34 UTC (rev 808)
@@ -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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3!!!!!!!!!!"Xm!!!38("bC at B!!r9&!!!!*3!
+!!!!!!!!!,J-!!!*NF(*PCJ!%$Y-!!!!Q!!!!!!!!!!!lf!!!'r*`FQ9Q!!2"D`!
+!!#F!!!!!!!!!!!ek!!!!"("bC at B!!mBV!!!!+!!!!!!!!!!!+i`!!!!BF(*PCJ!
+$Z'-!!!!T!!!!!!!!!!!VT!!!!!T`FQ9Q!!2V&3!!!#S!!!!!!!!!!#ZZ!!!!$R"
+bC at B!"%rY!!!!+`!!!!!!!!!!+l`!!!$'F(*PCJ!$c%F!!!!X!!!!!!!!!!!XXJ!
+!!$K`FQ9Q!!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!!!:

Added: packages/libhdf4/branches/upstream/current/mkinstalldirs
===================================================================
--- packages/libhdf4/branches/upstream/current/mkinstalldirs	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/mkinstalldirs	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,32 @@
+#!/bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman at prep.ai.mit.edu>
+# Created: 1993-05-16
+# Last modified: 1994-03-25
+# Public domain
+
+errstatus=0
+
+for file in ${1+"$@"} ; do 
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d in ${1+"$@"} ; do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp" 1>&2
+        mkdir "$pathcomp" || errstatus=$?
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here

Added: packages/libhdf4/branches/upstream/current/move-if-change
===================================================================
--- packages/libhdf4/branches/upstream/current/move-if-change	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/move-if-change	2007-05-14 09:41:34 UTC (rev 808)
@@ -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


Property changes on: packages/libhdf4/branches/upstream/current/move-if-change
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/libhdf4/branches/upstream/current/release_notes/ABOUT_4.1r4
===================================================================
--- packages/libhdf4/branches/upstream/current/release_notes/ABOUT_4.1r4	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/release_notes/ABOUT_4.1r4	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,95 @@
+
+                          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.
+

Added: packages/libhdf4/branches/upstream/current/release_notes/bugs_fixed.txt
===================================================================
--- packages/libhdf4/branches/upstream/current/release_notes/bugs_fixed.txt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/release_notes/bugs_fixed.txt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,253 @@
+
+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. 

Added: packages/libhdf4/branches/upstream/current/release_notes/compile.txt
===================================================================
--- packages/libhdf4/branches/upstream/current/release_notes/compile.txt	                        (rev 0)
+++ packages/libhdf4/branches/upstream/current/release_notes/compile.txt	2007-05-14 09:41:34 UTC (rev 808)
@@ -0,0 +1,236 @@
+ 
+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.1r4/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:
+         hd414.lib hm414.lib (single-threaded release version)
+         hd414d.lib hm414d.lib (single-threaded debug version)
+
+         hd414m.lib hm414m.lib (multi-threaded release version)
+         hd414md.lib hm414md.lib (multi-threaded debug version)
+
+
+




More information about the Pkg-grass-devel mailing list